更新添加联营上传物料

parent 73b09a7e
......@@ -15,14 +15,15 @@ class CheckLogin
{
//前端用户登录token
$yunxin_token = $request->cookie('yunxin_token') == "" ? $request->input('yunxin_token') : $request->cookie('yunxin_token') ;
$userInfo = Redis::get('yunxin_login_'.$yunxin_token);
$userInfoKey = Redis::keys('yunxin_login_'.$yunxin_token."*");
$userInfo = count($userInfoKey) ? Redis::get($userInfoKey[0]) : "";
$nowUrl = $request->url();
$pos = strpos($request->path(), 'api/');
$isApi = false;
if ($pos === 0) $isApi = true;
$request->supplier_name = ""; //登录用户名
if (empty($yunxin_token) || empty($userInfo) ){ //没有登录跳到登录页
if (strpos($nowUrl,'/api/ApiLogin') == false && strpos($nowUrl,'/api/ApiForgetPassword') == false && $isApi){
Export([-1,'请登录']);
......
......@@ -46,11 +46,12 @@ class SupplierAccountModel extends Model
if (!$account['status']){
return [1006,'此账号已被禁用'];
}
$account_id = $account['id']; //账号id
//用户详情
$supplierInfo = DB::connection("pur")->table("supplier_channel")->where("supplier_id",$account['supplier_id'])->first();
//用户角色
$yunxinCon = DB::connection("yunxin");
$roleInfo = $yunxinCon->table("auth_role_access")->where("account_id",$account['id'])->first();
$roleInfo = $yunxinCon->table("auth_role_access")->where("account_id",$account_id)->first();
$info = [
'supplier_id'=>$account['supplier_id'],
......@@ -73,7 +74,7 @@ class SupplierAccountModel extends Model
#登录信息写入缓存
$key = md5($account_name.$code.time());
$expire = 7200;//过期两个小时
$res = Redis::setex('yunxin_login_'.$key, $expire, utf8JsonEncode($info));
$res = Redis::setex('yunxin_login_'.$key."_$account_id", $expire, utf8JsonEncode($info));
if ($res != 'OK'){
throw new Exception('写入缓存失败',1004);
}
......@@ -119,7 +120,11 @@ class SupplierAccountModel extends Model
$password = createPassword($new_password);
$this->where("id",$request->account_id)->update(['password'=>$password]);
Redis::del("yunxin_login_".$request->yunxin_token); //重新登录
$userInfoKey = Redis::keys('yunxin_login_'.$request->yunxin_token."*");
foreach ($userInfoKey as $k=>$v){
Redis::del($v);//删除登录信息
}
setcookie('yunxin_token','',time()-3600); //清除cookie
return [0,"重置密码成功,请重新登录"];
}
/*
......@@ -144,14 +149,17 @@ class SupplierAccountModel extends Model
$password = createPassword($new_password);
$this->where("id",$request->account_id)->update(['password'=>$password]);
Redis::del("yunxin_login_".$request->yunxin_token); //删除缓存
Redis::del("yunxin_login_".$request->yunxin_token."*"); //删除缓存
return [0,"成功,请登录"];
}
/*
* 退出登录
*/
public function LoginOut($request){
Redis::del("yunxin_login_".$request->yunxin_token);//删除登录信息
$userInfoKey = Redis::keys('yunxin_login_'.$request->yunxin_token."*");
foreach ($userInfoKey as $k=>$v){
Redis::del($v);//删除登录信息
}
setcookie('yunxin_token','',time()-3600); //清除cookie
}
/*
......@@ -216,7 +224,11 @@ class SupplierAccountModel extends Model
$password = createPassword($new_password);
$this->where("mobile",$mobile)->update(['password'=>$password]);
Redis::del("yunxin_login_".$request->yunxin_token); //删除缓存
$userInfoKey = Redis::keys('yunxin_login_'.$request->yunxin_token."*");
foreach ($userInfoKey as $k=>$v){
Redis::del($v);//删除登录信息
}
setcookie('yunxin_token','',time()-3600); //清除cookie
return [0,"成功,请登录"];
}
......
......@@ -29,6 +29,7 @@ class UploadLogModel extends Model
//查数据
$list=$this->where('type',$type)->where("create_uid",$create_uid)->orderBy('id','desc')->paginate($limit,['*'],'p',$p)->toArray();
$data = $list['data'];
if (!count($data)) return [1002,'没有数据'];
if ($type == UploadLogMap::type_import_sku){
//如果是联营sku导入,查询状态
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment