更新添加联营上传物料

parent 3301e67e
...@@ -32,12 +32,14 @@ class CheckLogin ...@@ -32,12 +32,14 @@ class CheckLogin
return redirect('/web/login' ); return redirect('/web/login' );
} }
}else{ }else{
Redis::expire('yunxin_login_'.$yunxin_token,7200); //延长登录时间
$userInfoArr = json_decode($userInfo,true); $userInfoArr = json_decode($userInfo,true);
if (strpos($nowUrl,'/web/login') !== false){ //如果已经登录,跳到登录页 if (strpos($nowUrl,'/web/login') !== false){ //如果已经登录,跳到登录页
return $userInfoArr['supplier_id'] >0 ? redirect('/web/GoodsList' ) : redirect('/web/GoodsComList' ); return $userInfoArr['supplier_id'] >0 ? redirect('/web/GoodsList' ) : redirect('/web/GoodsComList' );
} }
foreach ($userInfoKey as $k=>$v){
Redis::expire($v,7200); //延长登录时间
}
$request->mobile = $userInfoArr['mobile']; $request->mobile = $userInfoArr['mobile'];
$request->account_id = $userInfoArr['account_id']; //自营id $request->account_id = $userInfoArr['account_id']; //自营id
$request->supplier_id = $userInfoArr['supplier_id']; $request->supplier_id = $userInfoArr['supplier_id'];
......
...@@ -74,7 +74,7 @@ class SupplierAccountModel extends Model ...@@ -74,7 +74,7 @@ class SupplierAccountModel extends Model
#登录信息写入缓存 #登录信息写入缓存
$key = md5($account_name.$code.time()); $key = md5($account_name.$code.time());
$expire = 7200;//过期两个小时 $expire = 7200;//过期两个小时
$res = Redis::setex('yunxin_login_'.$key."_$account_id", $expire, utf8JsonEncode($info)); $res = Redis::setex('yunxin_login_'.$key."_supplier_accountid_".$account_id, $expire, utf8JsonEncode($info));
if ($res != 'OK'){ if ($res != 'OK'){
throw new Exception('写入缓存失败',1004); throw new Exception('写入缓存失败',1004);
} }
...@@ -149,7 +149,10 @@ class SupplierAccountModel extends Model ...@@ -149,7 +149,10 @@ class SupplierAccountModel extends Model
$password = createPassword($new_password); $password = createPassword($new_password);
$this->where("id",$request->account_id)->update(['password'=>$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);//删除登录信息
}
return [0,"成功,请登录"]; return [0,"成功,请登录"];
} }
/* /*
......
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