|
|
@ -184,6 +184,14 @@ class Auth extends BaseController |
|
|
|
return app('json')->success($data); |
|
|
|
return app('json')->success($data); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* notes 兑换配置 |
|
|
|
|
|
|
|
* @return mixed |
|
|
|
|
|
|
|
* @create 2024/3/19 22:20 |
|
|
|
|
|
|
|
* @update 2024/3/19 22:20 |
|
|
|
|
|
|
|
* @author zhangkxiang |
|
|
|
|
|
|
|
* @editor |
|
|
|
|
|
|
|
*/ |
|
|
|
public function exchangeConfig(){ |
|
|
|
public function exchangeConfig(){ |
|
|
|
$config = app(UserAssetsRepository::class)->getConfig(); |
|
|
|
$config = app(UserAssetsRepository::class)->getConfig(); |
|
|
|
$huitong = app(HuitongRepository::class)->getCurrent(); |
|
|
|
$huitong = app(HuitongRepository::class)->getCurrent(); |
|
|
@ -195,6 +203,39 @@ class Auth extends BaseController |
|
|
|
return app('json')->success($data); |
|
|
|
return app('json')->success($data); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function toShare(){ |
|
|
|
|
|
|
|
$count = $this->request->param('count', 1); |
|
|
|
|
|
|
|
$uid = 3; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
app(UserAssetsRepository::class)->consumeToShare($uid, $count); |
|
|
|
|
|
|
|
}catch (\Exception $e){ |
|
|
|
|
|
|
|
return app('json')->fail($e->getMessage()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return app('json')->success(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function toHuitong(){ |
|
|
|
|
|
|
|
$count = $this->request->param('count', 1); |
|
|
|
|
|
|
|
$phone = $this->request->param('phoneTo', "13166665555"); |
|
|
|
|
|
|
|
$smsCode = $this->request->param('smsCode', 0156); |
|
|
|
|
|
|
|
$type = $this->request->param('type', 'intention'); |
|
|
|
|
|
|
|
$uid = 3; |
|
|
|
|
|
|
|
Log::info("code: {$smsCode}, type: {$type}"); |
|
|
|
|
|
|
|
// $checkSms = app()->make(SmsService::class)->checkSmsCode('18362705640', $smsCode, $type); |
|
|
|
|
|
|
|
// if (!$smsCode || !$checkSms) |
|
|
|
|
|
|
|
// return app('json')->fail('验证码不正确'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
app(UserAssetsRepository::class)->sendHuitong($uid, $phone, $count); |
|
|
|
|
|
|
|
}catch (\Exception $e){ |
|
|
|
|
|
|
|
return app('json')->fail($e->getMessage()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return app('json')->success(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @param UserRepository $repository |
|
|
|
* @param UserRepository $repository |
|
|
|
* @return mixed |
|
|
|
* @return mixed |
|
|
@ -361,6 +402,7 @@ class Auth extends BaseController |
|
|
|
try { |
|
|
|
try { |
|
|
|
$sms_code = str_pad(random_int(1, 9999), 4, 0, STR_PAD_LEFT); |
|
|
|
$sms_code = str_pad(random_int(1, 9999), 4, 0, STR_PAD_LEFT); |
|
|
|
$sms_time = systemConfig('sms_time') ? systemConfig('sms_time') : 30; |
|
|
|
$sms_time = systemConfig('sms_time') ? systemConfig('sms_time') : 30; |
|
|
|
|
|
|
|
Log::info("{$data['phone']} send {$sms_code} with {$data['type']} "); |
|
|
|
SmsService::create()->send($data['phone'], 'VERIFICATION_CODE', ['code' => $sms_code, 'time' => $sms_time]); |
|
|
|
SmsService::create()->send($data['phone'], 'VERIFICATION_CODE', ['code' => $sms_code, 'time' => $sms_time]); |
|
|
|
} catch (Exception $e) { |
|
|
|
} catch (Exception $e) { |
|
|
|
return app('json')->fail($e->getMessage()); |
|
|
|
return app('json')->fail($e->getMessage()); |
|
|
|