544782275@qq.com 3 years ago
parent
commit
628851d36c
1 changed files with 6 additions and 2 deletions
  1. 6 2
      application/api/controller/Order.php

+ 6 - 2
application/api/controller/Order.php

@@ -155,11 +155,13 @@ class Order extends Base
      * @tag 支付
      * @header name:Authorization require:1 desc:Token
      * @param name:order_id type:int require:1 default:-- desc:订单ID
+     * @param name:pay_type type:int require:0 default:-- desc:支付类型(1:微信,2:支付宝)
      * @return name:config type:array default:-- desc:支付配置(微信和支付宝返回值不同)
      */
     public function pay_order(){
         $uid = $this->uid;
         $order_id = input('order_id');
+        $pay_type = input('pay_type',0);
         if(empty($order_id)){
             $this->error('参数错误');
         }
@@ -167,9 +169,11 @@ class Order extends Base
         if(empty($order_info)){
             $this->error('订单信息有误');
         }
-        $pay_type = $order_info['pay_type'];
+        if(empty($pay_type)){
+            $pay_type = $order_info['pay_type'];
+        }
         $pay_no = get_order_sn();
-        Db::name('store_order')->where('id',$order_id)->update(array('pay_no'=>$pay_no));
+        Db::name('store_order')->where('id',$order_id)->update(array('pay_no'=>$pay_no,'pay_type'=>$pay_type));
         if($pay_type == 1){    //微信支付
             $notify_url = $this->request->root(true) . '/api/Pay/order_notify';
             $price_total = 0.01;