22
This commit is contained in:
+36
-65
@@ -37,10 +37,11 @@ class Tongji extends Command
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$this->question($input,$output);
|
||||
//$this->role($input,$output);
|
||||
//$this->recharge($input,$output);
|
||||
//$this->withdrawl($input,$output);
|
||||
$action = $input->getOption('action');
|
||||
if(method_exists($this, $action)){
|
||||
return $this->$action($input, $output);
|
||||
}
|
||||
cp('操作不存在:'.$action);
|
||||
return self::SUCCESS;
|
||||
}
|
||||
/**
|
||||
@@ -119,69 +120,39 @@ class Tongji extends Command
|
||||
}
|
||||
cp($withdrawl_result);
|
||||
}
|
||||
function question(InputInterface $input, OutputInterface $output) {
|
||||
$order_list = \app\model\ProductOrder::withJoin([
|
||||
'product'=>function($q){
|
||||
return $q->field('price,interest_rate');
|
||||
}
|
||||
])->where('quantity','>',0)->select();
|
||||
}
|
||||
/**
|
||||
* 修复所有角色购买统计
|
||||
* 修复团队统计数据
|
||||
* @param InputInterface $input
|
||||
* @param OutputInterface $output
|
||||
* @return int
|
||||
*/
|
||||
function role(InputInterface $input, OutputInterface $output) {
|
||||
function build_team(InputInterface $input, OutputInterface $output){
|
||||
$list = Db::name('user')->order('id','asc')->column('id');
|
||||
//$list = [['id'=>100006]];
|
||||
foreach($list as $k=>$user_id){
|
||||
//team_total
|
||||
$team_user_ids = Db::name('user_team')->where('ancestor_id',$user_id)
|
||||
->where('depth','>',0)
|
||||
->order('depth','ASC')
|
||||
->column('descendant_id');
|
||||
Db::name('user_extend')->where('user_id',$user_id)->data([
|
||||
'team_total'=> count($team_user_ids)
|
||||
])->save();
|
||||
cache('team_user_count_'.$user_id,count($team_user_ids));
|
||||
|
||||
$direct_use_count = Db::name('user')->where('parent_id',$user_id)->count('id');
|
||||
$vip_user_count = Db::name('user')->whereIn('id',$team_user_ids)->where('role_id','>',1)->count('id');
|
||||
|
||||
Db::name('user_extend')->where('user_id',$user_id)->data([
|
||||
'direct_total'=> $direct_use_count,
|
||||
'vip_total'=> $vip_user_count
|
||||
])->save();
|
||||
cache('team_direct_total_'.$user_id,$direct_use_count);
|
||||
cache('team_vip_total_'.$user_id,$vip_user_count);
|
||||
update_user_level($user_id,$vip_user_count);
|
||||
cp($user_id.'完成');
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 模拟用户注册
|
||||
*/
|
||||
function register(InputInterface $input, OutputInterface $output){
|
||||
$last_user_id = UserModel::order('id','desc')->limit(1)->value('id');
|
||||
for ($i=$last_user_id+1; $i <= $last_user_id+2; $i++) {
|
||||
$uids = UserModel::where("status",1)->column('id');
|
||||
$referrerId = $uids[array_rand($uids)];
|
||||
$email = 'test'.$i.'@msn.cn';
|
||||
$mobile = '';
|
||||
$password = '123456';
|
||||
$extends = [
|
||||
'role_id' => rand(1,3),
|
||||
'money' => 0,
|
||||
'parent_id' => $referrerId
|
||||
];
|
||||
$user = \support\Jwt::register($email, $password, $email, $mobile, $extends);
|
||||
cp($user['id']);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
function updateRechargeAddress(InputInterface $input, OutputInterface $output){
|
||||
$saveData = [];
|
||||
$res = post(Config('pay.server').'/RechargeAddress/create',['appid'=>Config('pay.appid')]);
|
||||
if($res){
|
||||
$res = json_decode($res,true);
|
||||
if($res['code'] === 0){
|
||||
$saveData['bep_recharge_address'] = $res['data']['BEP-20']['address'];
|
||||
$saveData['trc_recharge_address'] = $res['data']['TRC-20']['address'];
|
||||
$saveData['decimal_part'] = $res['data']['BEP-20']['decimal_part'];
|
||||
}
|
||||
}
|
||||
UserModel::where('id',123409)->update($saveData);
|
||||
return 0;
|
||||
}
|
||||
function otop(){
|
||||
$secret = 'EJGYB7OZR2W46XRX7VB3PXHSOY4LUAWCA5GTDAVTWKHXNDAAAIIP7AQ3JSO3XZJNX5J5OTIDEQVKLYFYIYNAXSCYF4GNZ2EMA4ORA3Y';
|
||||
$totp = \OTPHP\TOTP::create($secret);
|
||||
$secret = $totp->getSecret();
|
||||
$totp->setLabel('cansnow');
|
||||
$totp->setIssuer('DVPN');
|
||||
$qrCodeUri =$totp->getProvisioningUri();
|
||||
cp($secret);
|
||||
cp($qrCodeUri);
|
||||
cp('https://api.qrtool.cn/?text='.urlencode($qrCodeUri));
|
||||
cp($totp->at(time()));
|
||||
if ($totp->verify('535714')) {
|
||||
cp('验证成功');
|
||||
} else {
|
||||
cp('验证失败');
|
||||
}
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user