소스 검색

测试超级福利

afa 6 달 전
부모
커밋
e7881af947
1개의 변경된 파일11개의 추가작업 그리고 11개의 파일을 삭제
  1. 11 11
      application/api/controller/Airdrop.php

+ 11 - 11
application/api/controller/Airdrop.php

@@ -43,17 +43,17 @@ class Airdrop extends Api
     {
         $row = $userWelfare::getIsWelfare();
         if(empty($row->is_newbie)) $this->error(__('暂未开启'));
-      
-        $info = $productOrder::getUserWelfare($this->auth->id, $productOrder::Newbie);
+        $user = $userModel->getById($this->auth->id);
+        $info = $productOrder::getUserWelfare($user->id, $productOrder::Newbie);
         if(!empty($info)) $this->error(__('您已领取'));
         Db::startTrans();
         try {
             
             //添加Rwa茶记录
-            $result = WelfareLoginc::setUserWelfareLos($this->auth->id, $row->new_product_id, $row->new_num, time(), $this->lan, $productOrder::Newbie);
+            $result = WelfareLoginc::setUserWelfareLos($user->id, $row->new_product_id, $row->new_num, time(), $this->lan, $productOrder::Newbie);
 
             //修改标识
-            $userModel::where('id', $this->auth->id)->update(['is_super'=> $userModel::NewPeo]);
+            $userModel::where('id', $user->id)->update(['is_super'=> $userModel::NewPeo]);
             Db::commit();
         } catch (\Exception $e) {
             Db::rollback();
@@ -70,29 +70,29 @@ class Airdrop extends Api
         $row = $userWelfare::getIsWelfare();
         if(empty($row->is_super)) $this->error(__('暂未开启'));
         if($this->auth->is_super != $userModel::NewPeo) $this->error(__('您已领取'));
-
+        $user = $userModel->getById($this->auth->id);
         //判断距离领取新人福利是否超过一天
-        $info = $productOrder::getUserWelfare($this->auth->id, $productOrder::Newbie);
+        $info = $productOrder::getUserWelfare($user->id, $productOrder::Newbie);
         if((time()-$info->create_time) >= config('super_weal_end_time')) $this->error(__('您已过期'));
         Db::startTrans();
         try {
             
             //把9.9茶宝转入冻结账号
-            if($row->frozen > 0) $ledgerWalletModel->setChangeFrozen($this->auth->id, $row->frozen, LedgerFrozenChangeModel::Super, '+');
+            if($row->frozen > 0) $ledgerWalletModel->setChangeFrozen($user->id, $row->frozen, LedgerFrozenChangeModel::Super, '+');
             
             //添加Rwa茶记录
-            WelfareLoginc::setUserWelfareLos($this->auth->id, $row->super_product_id, $row->super_num, time(), $this->lan, $productOrder::Super);
+            WelfareLoginc::setUserWelfareLos($user->id, $row->super_product_id, $row->super_num, time(), $this->lan, $productOrder::Super);
 
             //添加超级福利标识/上级
-            $userModel::updateUserLevel($this->auth->id, $this->auth->parent_id, $this->auth->address_level);
+            $userModel::updateUserLevel($user->id, $user->parent_id, $user->address_level);
 
             //插入待空投记录
             $result = UserAirdrop::insert([
-                'user_id'       =>  $this->auth->id,
+                'user_id'       =>  $user->id,
                 'type_id'       =>  UserAirdrop::TypeSuperWeal,
                 'product_id'    =>  $row->super_product_id,
                 'num'           =>  $row->super_num,
-                'address'       =>  $this->auth->address,
+                'address'       =>  $user->address,
                 'remark'        =>  '超级福利空投',
                 'create_time'   =>time(),
                 'status'        =>UserAirdrop::Normal,//为0 待发放层级奖励