afa 6 сар өмнө
parent
commit
ec3983b8a5

+ 9 - 12
application/api/controller/Airdrop.php

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

+ 1 - 1
application/api/controller/Announcement.php

@@ -40,7 +40,7 @@ class Announcement extends Api
         //标题
         if(!empty($title)) $paginator =$paginator->where('title', 'LIKE', '%'.$title.'%');
 
-        $paginator =$paginator->field('id,to_lang,weigh,img_url,createtime,title as title,is_top,sub_type_id,introduction,body')->order('is_top desc, weigh desc')->paginate($this->pageSize);
+        $paginator =$paginator->field('id,to_lang,weigh,img_url,createtime,title as title,is_top,sub_type_id,introduction,body')->order('is_top desc, weigh desc, createtime desc')->paginate($this->pageSize);
        
         $paginator = $announcementType::getSubTypeById($paginator, $this->lan);  
         $this->success('', $this->buildResp($paginator->total(), $paginator->currentPage(), $paginator->items()));

+ 1 - 1
application/common/model/UserModel.php

@@ -142,7 +142,7 @@ class UserModel extends Model
                             $parent->address_level = self::LevelFour;
                             //空投
                             $welfare = config('super_welfare')[self::LevelFour];
-                            $model::setPopularNoAreaOrder($welfare['num'] , 0, 0, $welfare['product_id'], $item, $model::Airdrop);
+                            $model::setPopularNoAreaOrder($welfare['num'], 0, 0, $welfare['product_id'], $item, $model::Airdrop);
                         }
                     }elseif($parent->address_level == self::LevelFour){
                         $parentCounts = self::where('parent_id', $item)->where('address_level', '>=', self::LevelFour)->count();