add 数据之言-商户登录接口
This commit is contained in:
parent
65c3fccd2c
commit
ac4023b113
@ -39,8 +39,29 @@ class Login extends BaseController
|
||||
$expire = time()+ 3600 * 24;
|
||||
$token = md5($expire);
|
||||
// 缓存token
|
||||
Cache::set($token.'_'.$user['uid'], $expire);
|
||||
Cache::set($token.'_dataview_'.$user['id'], $expire);
|
||||
return app('json')->success(compact('user','token', 'expire'));
|
||||
}
|
||||
public function mechantLogin(UserRepository $repository)
|
||||
{
|
||||
$account = $this->request->param('account');
|
||||
$password= $this->request->param('password');
|
||||
|
||||
if (!$account) return app('json')->fail('请输入账号');
|
||||
|
||||
$user = $repository->accountByUser($account);
|
||||
|
||||
if (!$user)return app('json')->fail('账号不存在');;
|
||||
if (!password_verify($password, $user['pwd'])) {
|
||||
$msg = '账号或密码错误';
|
||||
throw new ValidateException($msg);
|
||||
}
|
||||
$expire = time()+ 3600 * 24;
|
||||
$token = md5($expire);
|
||||
// 缓存token
|
||||
Cache::set($token.'_merchant_'.$user['uid'], $expire);
|
||||
return app('json')->success(compact('user','token', 'expire'));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -766,6 +766,7 @@ Route::group('api/', function () {
|
||||
|
||||
// login
|
||||
Route::post('login', 'Login/login');
|
||||
Route::post('mechant_login', 'Login/mechantLogin');
|
||||
|
||||
/**---------------------数据之眼可视化大屏api-------------------- end */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user