Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄成意
/
yunxin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3301e67e
authored
May 17, 2019
by
PRY5YKGJ82EZEPX\Administrator
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
更新添加联营上传物料
parent
73b09a7e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
8 deletions
app/Http/Middleware/CheckLogin.php
app/Model/SupplierAccountModel.php
app/Model/UploadLogModel.php
app/Http/Middleware/CheckLogin.php
View file @
3301e67e
...
...
@@ -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
,
'请登录'
]);
...
...
app/Model/SupplierAccountModel.php
View file @
3301e67e
...
...
@@ -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
,
"成功,请登录"
];
}
...
...
app/Model/UploadLogModel.php
View file @
3301e67e
...
...
@@ -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导入,查询状态
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment