|
|
@@ -252,6 +252,7 @@ class Wallet extends BaseController
|
|
|
//USDT提现
|
|
|
public function withdraw()
|
|
|
{
|
|
|
+ $error_code = -1;
|
|
|
try {
|
|
|
$member_id = request()->user->member_id;
|
|
|
$params = request()->validate([
|
|
|
@@ -260,7 +261,10 @@ class Wallet extends BaseController
|
|
|
'safe_word' => ['required'],
|
|
|
]);
|
|
|
$user = User::where('member_id', $member_id)->first();
|
|
|
- if (empty($user->payment_password)) throw new Exception(lang("请先设置资金密码"));
|
|
|
+ if (empty($user->payment_password)) {
|
|
|
+ $error_code = 10011;
|
|
|
+ throw new Exception(lang("请先设置资金密码"));
|
|
|
+ }
|
|
|
//校验资金密码
|
|
|
if (!password_verify($params['safe_word'], $user->payment_password)) {
|
|
|
throw new Exception(lang('资金密码错误'));
|
|
|
@@ -316,7 +320,7 @@ class Wallet extends BaseController
|
|
|
} catch (ValidationException $e) {
|
|
|
return $this->error($e->validator->errors()->first());
|
|
|
} catch (\Exception $e) {
|
|
|
- return $this->error($e->getMessage());
|
|
|
+ return $this->error($e->getMessage(), [], $error_code);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -326,6 +330,7 @@ class Wallet extends BaseController
|
|
|
* 提现(手动到账): DF001 支付宝转卡; DF002 支付宝转支付宝; DF005数字人民币; rgtx(人工提现,手动打款)
|
|
|
*/
|
|
|
public function payout() {
|
|
|
+ $error_code = -1;
|
|
|
try {
|
|
|
$params = request()->validate([
|
|
|
'amount' => ['required', 'numeric', 'min:0.01'],
|
|
|
@@ -337,7 +342,10 @@ class Wallet extends BaseController
|
|
|
]);
|
|
|
$member_id = request()->user->member_id;
|
|
|
$user = User::where('member_id', $member_id)->first();
|
|
|
- if (empty($user->payment_password)) throw new Exception(lang("请先设置资金密码"));
|
|
|
+ if (empty($user->payment_password)) {
|
|
|
+ $error_code = 10011;
|
|
|
+ throw new Exception(lang("请先设置资金密码"));
|
|
|
+ }
|
|
|
//校验资金密码
|
|
|
if (!password_verify($params['safe_word'], $user->payment_password)) {
|
|
|
throw new Exception(lang('资金密码错误'));
|
|
|
@@ -403,7 +411,7 @@ class Wallet extends BaseController
|
|
|
} catch (ValidationException $e) {
|
|
|
return $this->error($e->validator->errors()->first());
|
|
|
} catch (\Exception $e) {
|
|
|
- return $this->error($e->getMessage());
|
|
|
+ return $this->error($e->getMessage(), [], $error_code);
|
|
|
}
|
|
|
}
|
|
|
|