Browse Source

sunguidong

zhangguidong 2 years ago
parent
commit
2f2142388f
2 changed files with 6 additions and 2 deletions
  1. 4 2
      application/api/controller/Notify.php
  2. 2 0
      application/api/controller/Order.php

+ 4 - 2
application/api/controller/Notify.php

@@ -53,15 +53,17 @@ class Notify extends Api
             if ($message['return_code'] === 'SUCCESS') { // return_code 表示通信状态,不代表支付状态
                 // 用户是否支付成功
                 if ($message ['result_code'] === 'SUCCESS') {
-                    $username = $user_model->where('id',$order['user_id'])->value('username');
+                    $username = $user_model->where('id',$order['user_id'])->find();
                     $log_data = [
                         'user_id'=>$order['user_id'],
-                        'username'=>$username,
+                        'username'=>$username['username'],
                         'money'=>$order['price'],
                         'desc'=>'商城购物支付',
                         'create_time'=>time()
                     ];
                     $transaction_log_model->insert($log_data);
+                    $sms_model = new Chuyutimedtask();
+                    $sms_model->order_sms(['mobile'=>$username['mobile'],'score'=>$username['score']]);
                     $pay_model->save(['status'=>2,'pay_time'=>time()],['pay_no'=>$message['out_trade_no']]);
                     $order_model->save(['status'=>2],['pay_no'=>$message['out_trade_no']]);
                     // 用户支付失败

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

@@ -89,6 +89,8 @@ class Order extends Api
         try {
             $tableware_order_model->insertGetId($data);
             $tableware_model->isUpdate(true,['id'=>$input['tableware_id']])->save(['stock'=>$tableware_info['stock']-$input['num']]);
+            $sms_model = new Chuyutimedtask();
+            $sms_model->order_sms(['mobile'=>$this->auth->mobile,'score'=>$this->auth->score]);
             Db::commit();
             $this->success('订单创建成功');
         }catch (Exception $e){