getClientIp(); $data['invite_code'] = User::gen_invite_code(); $data['password'] = (new User())->passwordHash($input['password']); $loginCode = User::gen_login_code(6); $data['login_code'] = $loginCode; $data['last_login_time'] = Carbon::now()->toDateTimeString(); $data['last_login_ip'] = $data['reg_ip']; $data['country_id'] = 1; $data['country_code'] = 86; $data['referrer'] = 0; $data['user_auth_level'] = 2; $data['pid'] = $input['pid']; $data['deep'] = 1; $data['whethertopromote'] = 1; $data['is_system'] = 0; $data['contract_deal'] = 1; //创建用户 $user = User::query()->create($data); // 创建用户钱包 $result3 = (new UserWalletService())->createWallet($user); //给该用户充值 $result5 = UserWallet::query()->where('user_id',$user['user_id'])->where('coin_id',1)->update(['usable_balance'=>$input['InitializeUSDT']]); DB::commit(); } catch (\Exception $e) { DB::rollBack(); throw $e; } } return $this->success('添加成功'); } /** * Build a form here. */ public function form() { //$this->radio('account_type')->options([1 => '手机', 2 => '邮箱'])->default(1)->required(); $this->radio('account_type')->options([2 => '邮箱'])->default(2)->required(); $this->text('PromoteAccount')->required(); $this->text('password')->required(); $this->text('InitializeUSDT', '初始化USDT')->default(0); $this->text('pid', '邀请人UID')->default(11); $this->text('referrer', '代理商UID')->default(11)->help('为空时默认与上级ID相等'); //$this->text('password')->required(); } /** * The data of the form. * * @return array */ public function default() { return []; } }