ソースを参照

修复层级奖励
修改超级福利到期实际

jason 7 ヶ月 前
コミット
dd992121f4

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

@@ -28,7 +28,7 @@ class Airdrop extends Api
     public function getNewbieWeal(UserWelfare $userWelfare, ProductOrder $productOrder)
     {
         $info    = $productOrder::getUserWelfare($this->auth->id, $productOrder::Newbie);
-        $endTime = isset($info->create_time)? bcadd($info->create_time, 86400): 0;
+        $endTime = isset($info->create_time)? bcadd($info->create_time, config('super_weal_end_time')): 0;
 
         $rows    = $userWelfare::getIsWelfare();
         $this->success('', ['is_super'=>$this->auth->address_level, 'end_time'=>$endTime, 'chabao'=>$rows->frozen]);
@@ -69,7 +69,7 @@ class Airdrop extends Api
 
         //判断距离领取新人福利是否超过一天
         $info = $productOrder::getUserWelfare($this->auth->id, $productOrder::Newbie);
-        if((time()-$info->create_time) >= 86400) $this->error(__('您已过期'));
+        if((time()-$info->create_time) >= config('super_weal_end_time')) $this->error(__('您已过期'));
         Db::startTrans();
         try {
             //把9.9茶宝转入冻结账号

+ 2 - 117
application/common/logic/AirdropLogic.php

@@ -135,9 +135,9 @@ class AirdropLogic
         //分享 3 个拿 10 层,分享 10 个拿 31 层
         foreach ($parents_info as $parent){
             if($parent['direct_super'] >= 3 && $parent['distance'] <= 10){
-                $send_user_ids[] = $parent['parent_id'];
+                $send_user_ids[] = $parent['id'];
             }else if($parent['direct_super'] >= 10 && $parent['distance'] <= 31){
-                $send_user_ids[] = $parent['parent_id'];
+                $send_user_ids[] = $parent['id'];
             }
         }
         if(empty($send_user_ids)){
@@ -170,121 +170,6 @@ class AirdropLogic
         return $info->save();
     }
 
-    /**
-     * 拨币
-     * 向会员发放qubic
-     * 每一万算力每天收益14-15万个币
-     */
-    public function AllocateQubic()
-    {
-        $type_id = 2;
-
-        $date = $this->getExeDate($type_id);
-        if(empty($date)){
-            (new Output())->writeln("本次没有可用时间:" . $date);
-            return ;
-        }
-
-        //创建定时任务执行日志
-        $log_id = (new TimedTaskLogModel())->insertGetId([
-            'type_id'       => $type_id,
-            'type_name'     => $this->rewards_type[$type_id],
-            'date_time'     => $date,
-            'create_time'   => date('Y-m-d H:i:s'),
-        ]);
-
-        //查找会员资产列表
-        $info_list = DB::table('ledger_wallet')
-            ->alias('w')
-            ->join('user u','u.id = w.user_id')
-            ->field('user_id,power')
-            ->where('power', '>', 0)
-            ->where('effective_time', '>', 0) //报单有收益
-            ->select();
-
-        if(empty($info_list)){
-            (new Output())->writeln("本次没有可用会员数据:" . $date);
-            return $log_id;
-        }
-
-        $num =rand(120000,130000);
-        $power_price = $num/10000;//每算力每日获得SMH的数量,算法为每一万算力每日产15万个Qubic
-
-        foreach ($info_list as $info) {
-            $amount = ($info['power']) * $power_price;
-            $check = (new LedgerQubicChangeModel())
-                ->where('user_id', $info['user_id'])
-                ->where('action', LedgerQubicChangeModel::SysSend)
-                ->where('from_id', strtotime($date))
-                ->count();
-            if($check){
-                dump('用户ID:' . $info['user_id'] . '已拨过,拨币量为:' . $amount);
-            }else{
-                dump(['用户ID:' . $info['user_id'],'拨币量为:' . $amount]);
-
-                //发放
-                (new LedgerWalletModel)->changeWalletAccount($info['user_id'], Asset::QUBIC, $amount, LedgerQubicChangeModel::SysSend);
-            }
-        }
-        return $log_id;
-    }
-
-    /**
-     * 拨币
-     * 向会员发放qubic
-     * 每一万算力每天收益14-15万个币
-     */
-    public function AllocateAleo()
-    {
-        $type_id = 11;
-
-        $date = $this->getExeDate($type_id);
-        if(empty($date)){
-            (new Output())->writeln("本次没有可用时间:" . $date);
-            return ;
-        }
-
-        //创建定时任务执行日志
-        $log_id = (new TimedTaskLogModel())->insertGetId([
-            'type_id'       => $type_id,
-            'type_name'     => $this->rewards_type[$type_id],
-            'date_time'     => $date,
-            'create_time'   => date('Y-m-d H:i:s'),
-        ]);
-
-        //查找会员资产列表
-        $info_list = DB::table('ledger_wallet')
-            ->alias('w')
-            ->join('user u','u.id = w.user_id')
-            ->field('user_id,power')
-            ->where('power', '>', 0)
-            ->where('effective_time', '>', 0) //报单有收益
-            ->select();
-
-        if(empty($info_list)){
-            (new Output())->writeln("本次没有可用会员数据:" . $date);
-            return $log_id;
-        }
-        $num = mt_rand(4030,4080) / 1000;//每一万算力每日获得Aleo的数量,算法为每一万算力每日产6.5个币,并从2024-9-20开始,每天递减5%
-        $power_price = $num/10000;//每算力每日获得Aleo的数量,算法为每一万算力每日产6.5个币,并从2024-9-20开始,每天递减5%
-        foreach ($info_list as $info) {
-            $amount = ($info['power']) * $power_price;
-            $check = (new LedgerQubicChangeModel())
-                ->where('user_id', $info['user_id'])
-                ->where('action', LedgerTokenChangeModel::SysSend)
-                ->where('from_id', strtotime($date))
-                ->count();
-            if($check){
-                dump('用户ID:' . $info['user_id'] . '已拨过,拨币量为:' . $amount);
-            }else{
-                dump(['用户ID:' . $info['user_id'],'拨币量为:' . $amount]);
-
-                //发放
-                (new LedgerWalletModel)->changeWalletAccount($info['user_id'], Asset::TOKEN, $amount, LedgerTokenChangeModel::SysSend);
-            }
-        }
-        return $log_id;
-    }
     /**
      * 获取可用日期
      * @var array

+ 1 - 0
application/config.php

@@ -320,4 +320,5 @@ return [
     'google_secret'   => 'EHAO77VUMH5XHFR6', //谷歌验证私钥
     'min_rwa_price'   => 499, //Rwa最低价格统计数量,
     'withdraw_in_amount' => 600, //提现金额手续费
+    'super_weal_end_time' => 168 * 3600, //168小时
 ];