Browse Source

订单收益

lizhen_gitee 1 year ago
parent
commit
6a5d475bde
2 changed files with 13 additions and 2 deletions
  1. 3 2
      application/extra/wallet.php
  2. 10 0
      application/index/controller/Plantask.php

+ 3 - 2
application/extra/wallet.php

@@ -6,8 +6,9 @@ return [
     'logtype' => [
         1  => '邀请奖励',
         2  => '积分兑换',
-        3  => '直推代理奖励',
-        4  => '兼推代理奖励',
+        3  => '直推代理奖励', //支付后立刻获得
+        4  => '兼推代理奖励', //支付后立刻获得
+        5  => '下单收益',    //支付后立刻获得
     ],
     'moneyname' => [
         'money'    => '佣金',

+ 10 - 0
application/index/controller/Plantask.php

@@ -92,6 +92,16 @@ class Plantask extends Controller
 
         foreach($order_list as $key => $order){
 
+            //买家立刻得到积分
+            if($order['order_shouyi'] > 0){
+                $rs_wallet = $walletmodel->lockChangeAccountRemain($order['user_id'],'score',$order['order_shouyi'],5,'下单收益','unishop_order',$order['id']);
+                if($rs_wallet['status'] === false){
+                    echo $rs_wallet['msg'];
+                    Db::rollback();
+                    exit;
+                }
+            }
+
             //直推代理商获益
             $intro_uid = Db::name('user')->where('id',$order['user_id'])->value('intro_uid');
             if($intro_uid){