<?php namespace Place\Lib;
use Dever;
use Place;
class Callback
{
    # 资源支付成功
    public function resource($place, $order_num, $type, $status, $body = array())
    {
        Dever::input('authorization', 'is_string', '入口码', $place);
        $order = Dever::db('order', 'place')->find(array('type' => $type, 'order_num' => $order_num));
        if ($order && $order['status'] == 1) {
            if ($status == 1) {
                $update['status'] = 5;
                if ($type == 3) {
                    $update['status'] = 2;
                }
            } else {
                $update['status'] = 7;
            }
            $update['pdate'] = time();
            $state = Dever::db('order', 'place')->update($order['id'], $update);
            if (!$state) {
                return '订单更新失败';
            }
        }
    }
}