|
|
@@ -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 待发放层级奖励
|