Browse Source

支付完订单立刻得奖励,测试完成

lizhen_gitee 1 year ago
parent
commit
08070104a8
2 changed files with 7 additions and 6 deletions
  1. 2 1
      application/common/model/Wallet.php
  2. 5 5
      application/index/controller/Plantask.php

+ 2 - 1
application/common/model/Wallet.php

@@ -67,7 +67,7 @@ class Wallet extends Model
      * @return array[log_table]
      * @return array[log_id]
      */
-    public function lockChangeAccountRemain($user_id,$accountType='money',$number,$logtype='',$remark='',$table='',$table_id=0,$isAdmin=false)
+    public function lockChangeAccountRemain($user_id,$accountType='money',$number,$logtype='',$remark='',$table='',$table_id=0,$table_uid=0)
     {
         //初始化
         $result = array(
@@ -125,6 +125,7 @@ class Wallet extends Model
             $data['remain'] = bcadd($wallet[$accountType], $number);
             $data['table'] = $table;
             $data['table_id'] = $table_id;
+            $data['table_uid'] = $table_uid;
             $data['remark'] = $remark;
             $data['createtime'] = time();
             $data['updatetime'] = time();

+ 5 - 5
application/index/controller/Plantask.php

@@ -81,7 +81,7 @@ class Plantask extends Controller
             'have_paid' => ['gt',0],
             'paidtasktime' => 0,
         ];
-        $order_list = Db::name('unishop_order')->where($map)->limit(10)->select();
+        $order_list = Db::name('unishop_order')->where($map)->order('id asc')->limit(10)->select();
         if(empty($order_list)){
             echo '没有数据';
             exit;
@@ -94,7 +94,7 @@ class Plantask extends Controller
 
             //买家立刻得到积分
             if($order['order_shouyi'] > 0){
-                $rs_wallet = $walletmodel->lockChangeAccountRemain($order['user_id'],'score',$order['order_shouyi'],5,'下单收益','unishop_order',$order['id']);
+                $rs_wallet = $walletmodel->lockChangeAccountRemain($order['user_id'],'score',$order['order_shouyi'],5,'下单收益','unishop_order',$order['id'],$order['user_id']);
                 if($rs_wallet['status'] === false){
                     echo $rs_wallet['msg'];
                     Db::rollback();
@@ -108,7 +108,7 @@ class Plantask extends Controller
                 $bili = config('site.orderpaid_zhitui_bili') ?: 5;
                 $score = bcdiv(bcmul($order['order_price'],$bili,2),100,2);
                 if($score > 0){
-                    $rs_wallet = $walletmodel->lockChangeAccountRemain($intro_uid,'score',$score,3,'直推代理奖励','unishop_order',$order['id']);
+                    $rs_wallet = $walletmodel->lockChangeAccountRemain($intro_uid,'score',$score,3,'直推代理奖励','unishop_order',$order['id'],$order['user_id']);
                     if($rs_wallet['status'] === false){
                         echo $rs_wallet['msg'];
                         Db::rollback();
@@ -123,7 +123,7 @@ class Plantask extends Controller
                 $bili = config('site.orderpaid_jiantui_bili') ?: 1;
                 $score = bcdiv(bcmul($order['order_price'],$bili,2),100,2);
                 if($score > 0){
-                    $rs_wallet = $walletmodel->lockChangeAccountRemain($top_uid,'score',$score,4,'间推代理奖励','unishop_order',$order['id']);
+                    $rs_wallet = $walletmodel->lockChangeAccountRemain($top_uid,'score',$score,4,'间推代理奖励','unishop_order',$order['id'],$order['user_id']);
                     if($rs_wallet['status'] === false){
                         echo $rs_wallet['msg'];
                         Db::rollback();
@@ -144,7 +144,7 @@ class Plantask extends Controller
         }
 
         Db::commit();
-        echo '成功';
+        echo '成功'.count($order_list);
     }
 
     //自动结算10日前订单