chuweiqiang hace 1 año
padre
commit
8008708b6b
Se han modificado 1 ficheros con 24 adiciones y 0 borrados
  1. 24 0
      application/api/controller/Order.php

+ 24 - 0
application/api/controller/Order.php

@@ -10,6 +10,7 @@ namespace app\api\controller;
 use app\admin\model\order\Order as OrderModel; //订单
 use app\admin\model\order\OrderGoods; //订单商品
 use app\admin\model\books\Books; //教材
+use app\admin\model\order\UserGoods;
 use app\admin\model\video\Video; //教材
 use app\api\controller\Pay; //教材
 use app\common\controller\Api;
@@ -230,6 +231,29 @@ class Order extends Api
         if(!$order){
             $this->error('订单不存在');
         }
+        $OrderGoods = new OrderGoods();
+        $UserGoods = new UserGoods();
+        $OrderModel = new \app\admin\model\order\Order();
+        //$order = $OrderModel->where('order_on',$message['out_trade_no'])->find();
+        $o_arr = [
+            'status' => 1,
+            'paytime' => date('Y-m-d H:i:s'),
+            'pay_type' => $data['pay_type'],
+
+        ];
+        $OrderModel->where('id',$order['id'])->update($o_arr);
+
+        $goods = $OrderGoods->where('order_id',$order['id'])->select();
+        foreach ($goods as $k => $v){
+            $g_arr = [
+                'goods_type' => $v['goods_type'],
+                'goods_id' => $v['goods_id'],
+                'order_id' => $order['id'],
+                'user_id' => $order['user_id'],
+            ];
+            $UserGoods->save($g_arr);
+        }
+        return $this->success('操作成功');
         $Pay = new Pay();
         if($data['pay_type'] == 0){
             //微信