|
|
@@ -177,7 +177,6 @@ class Auth extends BaseController
|
|
|
*/
|
|
|
public function loginFailure($account, $number = 5, $n = 3)
|
|
|
{
|
|
|
- @file_put_contents('quanju3.txt',"-登录测试1\r\n",8);
|
|
|
$key = 'api_login_failuree_' . $account;
|
|
|
$numb = Cache::get($key) ?? 0;
|
|
|
$numb++;
|
|
|
@@ -206,7 +205,6 @@ class Auth extends BaseController
|
|
|
*/
|
|
|
public function userInfo()
|
|
|
{
|
|
|
- @file_put_contents('quanju3.txt',"-登录测试2\r\n",8);
|
|
|
$user = $this->request->userInfo()->hidden(['label_id', 'group_id', 'pwd', 'addres', 'card_id', 'last_time', 'last_ip', 'create_time', 'mark', 'status', 'spread_time', 'real_name', 'birthday', 'brokerage_price']);
|
|
|
$user->append(['service', 'topService', 'total_collect_product', 'total_collect_store', 'total_coupon', 'total_visit_product', 'total_unread', 'total_recharge', 'lock_integral', 'total_integral', 'staffs']);
|
|
|
$data = $user->toArray();
|
|
|
@@ -280,7 +278,6 @@ class Auth extends BaseController
|
|
|
*/
|
|
|
public function logout(UserRepository $repository)
|
|
|
{
|
|
|
- @file_put_contents('quanju3.txt',"-登录测试3\r\n",8);
|
|
|
$repository->clearToken($this->request->token());
|
|
|
return app('json')->success('退出登录');
|
|
|
}
|
|
|
@@ -295,19 +292,16 @@ class Auth extends BaseController
|
|
|
*/
|
|
|
public function auth()
|
|
|
{
|
|
|
- @file_put_contents('quanju3.txt',"-登录测试4\r\n",8);
|
|
|
if (systemConfig('is_phone_login') === '1') {
|
|
|
return app('json')->fail('请绑定手机号');
|
|
|
}
|
|
|
|
|
|
$request = $this->request;
|
|
|
$oauth = WechatService::create()->getApplication()->oauth;
|
|
|
- @file_put_contents('quanju3.txt',json_encode($oauth)."-这里怎么说\r\n",8);
|
|
|
$oauth->setRequest(new Request($request->get(), $request->post(), [], [], [], $request->server(), $request->getContent()));
|
|
|
try {
|
|
|
$wechatInfo = $oauth->user()->getOriginal();
|
|
|
} catch (Exception $e) {
|
|
|
- @file_put_contents('quanju3.txt',"-难道是这里\r\n",8);
|
|
|
return app('json')->fail('授权失败[001]', ['message' => $e->getMessage()]);
|
|
|
}
|
|
|
if (!isset($wechatInfo['nickname'])) {
|
|
|
@@ -341,7 +335,6 @@ class Auth extends BaseController
|
|
|
*/
|
|
|
public function mpAuth()
|
|
|
{
|
|
|
- @file_put_contents('quanju3.txt',"-登录测试5\r\n",8);
|
|
|
list($code, $post_cache_key) = $this->request->params([
|
|
|
'code',
|
|
|
'cache_key',
|
|
|
@@ -405,7 +398,6 @@ class Auth extends BaseController
|
|
|
|
|
|
public function getCaptcha()
|
|
|
{
|
|
|
- @file_put_contents('quanju3.txt',"-登录测试6\r\n",8);
|
|
|
$codeBuilder = new CaptchaBuilder(null, new PhraseBuilder(4));
|
|
|
$key = uniqid(microtime(true), true);
|
|
|
Cache::set('api_captche' . $key, $codeBuilder->getPhrase(), 300);
|
|
|
@@ -425,7 +417,6 @@ class Auth extends BaseController
|
|
|
|
|
|
public function verify(UserAuthValidate $validate)
|
|
|
{
|
|
|
- @file_put_contents('quanju3.txt',"-登录测试7\r\n",8);
|
|
|
$data = $this->request->params(['phone', ['type', 'login'], ['captchaType', 'clickWord'], ['captchaVerification', ''], 'token']);
|
|
|
//二次验证
|
|
|
try {
|
|
|
@@ -462,7 +453,6 @@ class Auth extends BaseController
|
|
|
|
|
|
public function smsLogin(UserAuthValidate $validate, UserRepository $repository)
|
|
|
{
|
|
|
- @file_put_contents('quanju3.txt',"-登录测试8\r\n",8);
|
|
|
$data = $this->request->params(['phone', 'sms_code', 'spread', 'auth_token', ['user_type', 'h5']]);
|
|
|
$validate->sceneSmslogin()->check($data);
|
|
|
$sms_code = app()->make(SmsService::class)->checkSmsCode($data['phone'], $data['sms_code'], 'login');
|
|
|
@@ -487,7 +477,6 @@ class Auth extends BaseController
|
|
|
|
|
|
public function changePassword(ChangePasswordValidate $validate, UserRepository $repository)
|
|
|
{
|
|
|
- @file_put_contents('quanju3.txt',"-登录测试9\r\n",8);
|
|
|
$data = $this->request->params(['phone', 'sms_code', 'pwd']);
|
|
|
$validate->check($data);
|
|
|
$user = $repository->accountByUser($data['phone']);
|
|
|
@@ -502,7 +491,6 @@ class Auth extends BaseController
|
|
|
|
|
|
public function spread(UserRepository $userRepository)
|
|
|
{
|
|
|
- @file_put_contents('quanju3.txt',"-登录测试10\r\n",8);
|
|
|
$data = $this->request->params([
|
|
|
['spread_spid', 0],
|
|
|
['spread_code', null],
|
|
|
@@ -524,7 +512,6 @@ class Auth extends BaseController
|
|
|
*/
|
|
|
public function register(UserAuthValidate $validate, UserRepository $repository)
|
|
|
{
|
|
|
- @file_put_contents('quanju3.txt',"-登录测试12\r\n",8);
|
|
|
$data = $this->request->params(['phone', 'sms_code', 'spread', 'pwd', 'auth_token', ['user_type', 'h5']]);
|
|
|
$validate->check($data);
|
|
|
$sms_code = app()->make(SmsService::class)->checkSmsCode($data['phone'], $data['sms_code'], 'login');
|
|
|
@@ -595,7 +582,7 @@ class Auth extends BaseController
|
|
|
} else if ($auth['type'] === 'wechat') {
|
|
|
$request = $this->request;
|
|
|
$oauth = WechatService::create()->getApplication()->oauth;
|
|
|
- @file_put_contents('quanju3.txt',json_encode($oauth)."-微信登陆内容\r\n",8);
|
|
|
+ @file_put_contents('quanju3.txt',json_encode($oauth)."-\r\n",8);
|
|
|
$oauth->setRequest(new Request($data, $data, [], [], [], $request->server(), $request->getContent()));
|
|
|
try {
|
|
|
$wechatInfo = $oauth->user()->getOriginal();
|
|
|
@@ -652,7 +639,7 @@ class Auth extends BaseController
|
|
|
*/
|
|
|
public function authLogin()
|
|
|
{
|
|
|
- @file_put_contents('quanju3.txt',"-登录测试13\r\n",8);
|
|
|
+ @file_put_contents('quanju3.txt',"-是走这里吗\r\n",8);
|
|
|
$auth = $this->request->param('auth');
|
|
|
$users = $this->authInfo($auth, !systemConfig('is_phone_login'));
|
|
|
if (!$users)
|
|
|
@@ -695,7 +682,6 @@ class Auth extends BaseController
|
|
|
*/
|
|
|
public function mpLoginType()
|
|
|
{
|
|
|
- @file_put_contents('quanju3.txt',"-登录测试14\r\n",8);
|
|
|
$code = $this->request->param('code');
|
|
|
if (!$code) return app('json')->fail('请获取code参数');
|
|
|
$spread = $this->request->param('spread',0);
|
|
|
@@ -711,7 +697,6 @@ class Auth extends BaseController
|
|
|
*/
|
|
|
public function appAuth()
|
|
|
{
|
|
|
- @file_put_contents('quanju3.txt',"-登录测试15\r\n",8);
|
|
|
$data = $this->request->params(['userInfo']);
|
|
|
|
|
|
if (systemConfig('is_phone_login') === '1') {
|
|
|
@@ -732,7 +717,6 @@ class Auth extends BaseController
|
|
|
|
|
|
public function getMerCertificate($merId)
|
|
|
{
|
|
|
- @file_put_contents('quanju3.txt',"-登录测试16\r\n",8);
|
|
|
$merId = (int)$merId;
|
|
|
$data = $this->request->params(['key', 'code']);
|
|
|
if (!$this->checkCaptcha($data['key'], $data['code']))
|
|
|
@@ -745,7 +729,6 @@ class Auth extends BaseController
|
|
|
|
|
|
public function appleAuth()
|
|
|
{
|
|
|
- @file_put_contents('quanju3.txt',"-登录测试17\r\n",8);
|
|
|
$data = $this->request->params(['openId', 'nickname']);
|
|
|
|
|
|
if (systemConfig('is_phone_login') === '1') {
|
|
|
@@ -770,7 +753,6 @@ class Auth extends BaseController
|
|
|
*/
|
|
|
public function cancel()
|
|
|
{
|
|
|
- @file_put_contents('quanju3.txt',"-登录测试18\r\n",8);
|
|
|
$userRepository = app()->make(UserRepository::class);
|
|
|
$user = $this->request->userInfo();
|
|
|
$order = app()->make(StoreOrderRepository::class)->search(['uid' => $user['uid'], 'paid' => 1])->where('StoreOrder.status', 0)->count();
|
|
|
@@ -802,7 +784,6 @@ class Auth extends BaseController
|
|
|
*/
|
|
|
public function mpPhone()
|
|
|
{
|
|
|
- @file_put_contents('quanju3.txt',"-登录测试19\r\n",8);
|
|
|
$code = $this->request->param('code');
|
|
|
$auth_token = $this->request->param('auth_token');
|
|
|
$iv = $this->request->param('iv');
|
|
|
@@ -855,7 +836,6 @@ class Auth extends BaseController
|
|
|
*/
|
|
|
public function ajcaptcha()
|
|
|
{
|
|
|
- @file_put_contents('quanju3.txt',"-登录测试20\r\n",8);
|
|
|
$captchaType = $this->request->param('captchaType', 'clickWord');
|
|
|
if (!$captchaType) return app('json')->fail('请输入类型');
|
|
|
return app('json')->success(aj_captcha_create($captchaType));
|
|
|
@@ -867,7 +847,6 @@ class Auth extends BaseController
|
|
|
*/
|
|
|
public function ajcheck()
|
|
|
{
|
|
|
- @file_put_contents('quanju3.txt',"-登录测试21\r\n",8);
|
|
|
$token = $this->request->param('token', '');
|
|
|
$pointJson = $this->request->param('pointJson', '');
|
|
|
$captchaType = $this->request->param('captchaType', 'clickWord');
|