|
|
@@ -307,42 +307,63 @@ class User extends Api
|
|
|
$this->success('');
|
|
|
}
|
|
|
/**
|
|
|
- * 手机验证码登录
|
|
|
+ * 提现信息
|
|
|
*
|
|
|
- * @ApiMethod (POST)
|
|
|
- * @param string $mobile 手机号
|
|
|
- * @param string $captcha 验证码
|
|
|
*/
|
|
|
- public function mobilelogin()
|
|
|
+ public function withdraw_info()
|
|
|
{
|
|
|
- $mobile = $this->request->post('mobile');
|
|
|
- $captcha = $this->request->post('captcha');
|
|
|
- if (!$mobile || !$captcha) {
|
|
|
- $this->error(__('Invalid parameters'));
|
|
|
+ $user = $this->auth->getUser();
|
|
|
+ $withdraw_info = UserModel::getAgentWithdrawInfoByAgentId($user['agent_id']);
|
|
|
+
|
|
|
+ $resdata['usdt']['is_open'] = $withdraw_info['usdt'];
|
|
|
+ $resdata['bank']['is_open'] = $withdraw_info['bank'];
|
|
|
+
|
|
|
+ if($withdraw_info['usdt']){
|
|
|
+ $resdata['usdt']['address'] = $user['usdt_address'];
|
|
|
}
|
|
|
- if (!Validate::regex($mobile, "^1\d{10}$")) {
|
|
|
- $this->error(__('Mobile is incorrect'));
|
|
|
+
|
|
|
+ if($withdraw_info['bank']){
|
|
|
+ $resdata['bank']['account_name'] = $resdata['bank']['bank_name'] = $resdata['bank']['bank_card'] = '';
|
|
|
+ $bank_info = json_decode($user['bank_info'], true);
|
|
|
+ if(!empty($bank_info)){
|
|
|
+ $resdata['bank']['account_name'] = $bank_info['account_name'];
|
|
|
+ $resdata['bank']['bank_name'] = $bank_info['bank_name'];
|
|
|
+ $resdata['bank']['bank_card'] = $bank_info['bank_card'];
|
|
|
+ }
|
|
|
}
|
|
|
- if (!Sms::check($mobile, $captcha, 'mobilelogin')) {
|
|
|
- $this->error(__('Captcha is incorrect'));
|
|
|
+
|
|
|
+ $this->success('', $resdata);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 提现信息修改
|
|
|
+ *
|
|
|
+ */
|
|
|
+ public function withdraw_change()
|
|
|
+ {
|
|
|
+ $user = $this->auth->getUser();
|
|
|
+
|
|
|
+ $fund_pwd = $this->request->post("fund_pwd", '', null);
|
|
|
+ if(md5($fund_pwd) != $user['fund_pwd']){
|
|
|
+ $this->error(__('资金密码有误'));
|
|
|
}
|
|
|
- $user = \app\common\model\Users::getByMobile($mobile);
|
|
|
- if ($user) {
|
|
|
- if ($user->status != 'normal') {
|
|
|
- $this->error(__('Account is locked'));
|
|
|
- }
|
|
|
- //如果已经有账号则直接登录
|
|
|
- $ret = $this->auth->direct($user->id);
|
|
|
- } else {
|
|
|
- $ret = $this->auth->register($mobile, Random::alnum(), '', $mobile, []);
|
|
|
+
|
|
|
+ $updata = [];
|
|
|
+ $withdraw_info = UserModel::getAgentWithdrawInfoByAgentId($user['agent_id']);
|
|
|
+ if($withdraw_info['usdt']){
|
|
|
+ $updata['usdt_address'] = $this->request->post("usdt_address", '', null);
|
|
|
}
|
|
|
- if ($ret) {
|
|
|
- Sms::flush($mobile, 'mobilelogin');
|
|
|
- $data = ['userinfo' => $this->auth->getUserinfo()];
|
|
|
- $this->success(__('Logged in successful'), $data);
|
|
|
- } else {
|
|
|
- $this->error($this->auth->getError());
|
|
|
+
|
|
|
+ if($withdraw_info['bank']){
|
|
|
+ $bank_info['account_name'] = $this->request->post("account_name", '', null);
|
|
|
+ $bank_info['bank_name'] = $this->request->post("bank_name", '', null);
|
|
|
+ $bank_info['bank_card'] = $this->request->post("bank_card", '', null);
|
|
|
+
|
|
|
+ $updata['bank_info'] = json_encode($bank_info);
|
|
|
}
|
|
|
+ //dump($updata);
|
|
|
+ (new UserModel())->where('id', $user['id'])->update($updata);
|
|
|
+
|
|
|
+ $this->success(__('完成'));
|
|
|
}
|
|
|
|
|
|
/**
|