|
@@ -135,9 +135,9 @@ class AirdropLogic
|
|
|
//分享 3 个拿 10 层,分享 10 个拿 31 层
|
|
//分享 3 个拿 10 层,分享 10 个拿 31 层
|
|
|
foreach ($parents_info as $parent){
|
|
foreach ($parents_info as $parent){
|
|
|
if($parent['direct_super'] >= 3 && $parent['distance'] <= 10){
|
|
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){
|
|
}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)){
|
|
if(empty($send_user_ids)){
|
|
@@ -170,121 +170,6 @@ class AirdropLogic
|
|
|
return $info->save();
|
|
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
|
|
* @var array
|