...
|
...
|
@@ -546,6 +546,7 @@ class Order extends Api |
|
|
* @ApiMethod (POST)
|
|
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
* @ApiParams (name="id", type="integer", required=true, description="订单ID")
|
|
|
* @ApiParams (name="openid", type="string", required=false, description="代付人openid")
|
|
|
* @ApiReturn ({
|
|
|
'code':'1',
|
|
|
'msg':'返回成功'
|
...
|
...
|
@@ -554,19 +555,20 @@ class Order extends Api |
|
|
public function pay()
|
|
|
{
|
|
|
$order_id = $this->request->post('id');
|
|
|
$friend_id = $this->request->post('user_id');
|
|
|
$openid = $this->request->post('openid');
|
|
|
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::alias('a')
|
|
|
// $third = Third::get(['user_id'=>$this->auth->id]);
|
|
|
$third = Third::alias('a')
|
|
|
->join('user b','b.id = a.user_id')
|
|
|
->where('a.user_id',$order['user_id'])
|
|
|
->field('a.openid')
|
|
|
->find();
|
|
|
if (!$openid) $this->error('未注册用户');
|
|
|
if (!$third) $this->error('下单人未注册');
|
|
|
|
|
|
$params = [
|
|
|
'type' => 'wechat',
|
|
|
'orderid' => $order['order_no'],
|
...
|
...
|
@@ -574,7 +576,7 @@ class Order extends Api |
|
|
// 'amount' => $order['pay_price'],
|
|
|
'amount' => 0.01,
|
|
|
'method' => 'miniapp',
|
|
|
'openid' => $openid['openid'],
|
|
|
'openid' => !empty($openid) ? $openid : $third['openid'],
|
|
|
'notifyurl' => $this->request->domain().'/api/notify/orderNotify/type/wechat',
|
|
|
'returnurl' => '',
|
|
|
];
|
...
|
...
|
|