作者 何书鹏

代付测试

... ... @@ -21,7 +21,7 @@ use Yansongda\Pay\Pay;
*/
class Order extends Api
{
protected $noNeedLogin = ['friendPay','commentOrderDetail'];
protected $noNeedLogin = ['friendPay','commentOrderDetail','pay'];
protected $noNeedRight = ['*'];
/**
... ... @@ -555,12 +555,16 @@ class Order extends Api
{
$order_id = $this->request->post('id');
$friend_id = $this->request->post('user_id');
if (!is_numeric($order_id) || ($friend_id && !is_numeric($friend_id))) $this->error('参数不合法');
empty($order_id) && $this->error('缺少必需参数');
$model = new \app\api\model\Order();
$order = $model::get($order_id);
if (!$order) $this->error('订单不存在');
$openid = Third::get(['user_id'=>$this->auth->id]);
// $openid = Third::get(['user_id'=>$this->auth->id]);
$openid = Third::alias('a')
->join('user b','b.id = a.user_id')
->field('a.openid')
->find();
if (!$openid) $this->error('未注册用户');
$params = [
'type' => 'wechat',
... ... @@ -574,8 +578,8 @@ class Order extends Api
'returnurl' => '',
];
$result = Service::submitOrder($params);
$order->pay_user_id = $this->auth->id;
$order->isUpdate()->save();
// $order->pay_user_id = $this->auth->id;
// $order->isUpdate()->save();
$this->success('支付信息',$result);
}
... ...