Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
1d08bb4d
Commit
1d08bb4d
authored
Jun 05, 2018
by
Junling Bu
Browse files
重新设计失败错误码。
parent
86cbc11d
Changes
11
Hide whitespace changes
Inline
Side-by-side
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminAddressController.java
View file @
1d08bb4d
...
...
@@ -53,7 +53,7 @@ public class AdminAddressController {
@RequestParam
(
value
=
"limit"
,
defaultValue
=
"10"
)
Integer
limit
,
String
sort
,
String
order
){
if
(
adminId
==
null
){
return
ResponseUtil
.
fail401
();
return
ResponseUtil
.
unlogin
();
}
List
<
LitemallAddress
>
addressList
=
addressService
.
querySelective
(
userId
,
name
,
page
,
limit
,
sort
,
order
);
...
...
@@ -75,7 +75,7 @@ public class AdminAddressController {
@PostMapping
(
"/create"
)
public
Object
create
(
@LoginAdmin
Integer
adminId
,
@RequestBody
LitemallAddress
address
){
if
(
adminId
==
null
){
return
ResponseUtil
.
fail401
();
return
ResponseUtil
.
unlogin
();
}
String
mobile
=
address
.
getMobile
();
...
...
@@ -92,7 +92,7 @@ public class AdminAddressController {
@GetMapping
(
"/read"
)
public
Object
read
(
@LoginAdmin
Integer
adminId
,
Integer
addressId
){
if
(
adminId
==
null
){
return
ResponseUtil
.
fail401
();
return
ResponseUtil
.
unlogin
();
}
LitemallAddress
address
=
addressService
.
findById
(
addressId
);
...
...
@@ -103,7 +103,7 @@ public class AdminAddressController {
@PostMapping
(
"/update"
)
public
Object
update
(
@LoginAdmin
Integer
adminId
,
@RequestBody
LitemallAddress
address
){
if
(
adminId
==
null
){
return
ResponseUtil
.
fail401
();
return
ResponseUtil
.
unlogin
();
}
addressService
.
updateById
(
address
);
Map
<
String
,
Object
>
addressVo
=
toVo
(
address
);
...
...
@@ -113,7 +113,7 @@ public class AdminAddressController {
@PostMapping
(
"/delete"
)
public
Object
delete
(
@LoginAdmin
Integer
adminId
,
@RequestBody
LitemallAddress
address
){
if
(
adminId
==
null
){
return
ResponseUtil
.
fail401
();
return
ResponseUtil
.
unlogin
();
}
addressService
.
delete
(
address
.
getId
());
return
ResponseUtil
.
ok
();
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminHistoryController.java
View file @
1d08bb4d
...
...
@@ -43,9 +43,9 @@ public class AdminHistoryController {
@PostMapping
(
"/create"
)
public
Object
create
(
@LoginAdmin
Integer
adminId
,
@RequestBody
LitemallSearchHistory
history
){
if
(
adminId
==
null
){
return
ResponseUtil
.
fail401
();
return
ResponseUtil
.
unlogin
();
}
return
ResponseUtil
.
fail501
();
return
ResponseUtil
.
unsupport
();
}
@GetMapping
(
"/read"
)
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminOrderController.java
View file @
1d08bb4d
...
...
@@ -48,7 +48,7 @@ public class AdminOrderController {
@RequestParam
(
value
=
"limit"
,
defaultValue
=
"10"
)
Integer
limit
,
String
sort
,
String
order
){
if
(
adminId
==
null
){
return
ResponseUtil
.
fail401
();
return
ResponseUtil
.
unlogin
();
}
List
<
LitemallOrder
>
orderList
=
orderService
.
querySelective
(
userId
,
orderSn
,
page
,
limit
,
sort
,
order
);
int
total
=
orderService
.
countSelective
(
userId
,
orderSn
,
page
,
limit
,
sort
,
order
);
...
...
@@ -74,7 +74,7 @@ public class AdminOrderController {
@GetMapping
(
"/read"
)
public
Object
read
(
@LoginAdmin
Integer
adminId
,
Integer
id
){
if
(
adminId
==
null
){
return
ResponseUtil
.
fail401
();
return
ResponseUtil
.
unlogin
();
}
LitemallOrder
order
=
orderService
.
findById
(
id
);
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminUserController.java
View file @
1d08bb4d
...
...
@@ -29,7 +29,7 @@ public class AdminUserController {
@RequestParam
(
value
=
"limit"
,
defaultValue
=
"10"
)
Integer
limit
,
String
sort
,
String
order
){
if
(
adminId
==
null
){
return
ResponseUtil
.
fail401
();
return
ResponseUtil
.
unlogin
();
}
List
<
LitemallUser
>
userList
=
userService
.
querySelective
(
username
,
mobile
,
page
,
limit
,
sort
,
order
);
int
total
=
userService
.
countSeletive
(
username
,
mobile
,
page
,
limit
,
sort
,
order
);
...
...
@@ -43,7 +43,7 @@ public class AdminUserController {
@GetMapping
(
"/username"
)
public
Object
username
(
String
username
){
if
(
StringUtil
.
isEmpty
(
username
)){
return
ResponseUtil
.
fail402
();
return
ResponseUtil
.
badArgument
();
}
int
total
=
userService
.
countSeletive
(
username
,
null
,
null
,
null
,
null
,
null
);
...
...
litemall-admin/src/permission.js
View file @
1d08bb4d
...
...
@@ -33,7 +33,7 @@ router.beforeEach((to, from, next) => {
})
}).
catch
(()
=>
{
store
.
dispatch
(
'
FedLogOut
'
).
then
(()
=>
{
Message
.
error
(
'
Verification failed, please login again
'
)
Message
.
error
(
'
验证失败,请输入正确的用户名和密码
'
)
next
({
path
:
'
/login
'
})
})
})
...
...
litemall-admin/src/utils/request.js
View file @
1d08bb4d
...
...
@@ -26,22 +26,29 @@ service.interceptors.request.use(config => {
service
.
interceptors
.
response
.
use
(
response
=>
{
const
res
=
response
.
data
if
(
res
.
errno
===
502
)
{
MessageBox
.
alert
(
'
系统内部错误,请联系管理员维护
'
,
'
错误
'
,
{
if
(
res
.
errno
===
501
)
{
MessageBox
.
alert
(
'
系统未登录,请重新登录
'
,
'
未登录
'
,
{
confirmButtonText
:
'
确定
'
,
type
:
'
error
'
})
return
Promise
.
reject
(
'
error
'
)
}
else
if
(
res
.
errno
!==
0
)
{
MessageBox
.
alert
(
'
超时自动退出系统,请重新登录
'
,
'
已退出
'
,
{
confirmButtonText
:
'
重新登录
'
,
type
:
'
error
'
}).
then
(()
=>
{
store
.
dispatch
(
'
FedLogOut
'
).
then
(()
=>
{
location
.
reload
()
})
})
return
Promise
.
reject
(
'
error
'
)
}
else
if
(
res
.
errno
===
502
)
{
MessageBox
.
alert
(
'
系统内部错误,请联系管理员维护
'
,
'
错误
'
,
{
confirmButtonText
:
'
确定
'
,
type
:
'
error
'
})
return
Promise
.
reject
(
'
error
'
)
}
else
if
(
res
.
errno
===
503
)
{
MessageBox
.
alert
(
'
请求业务目前未支持
'
,
'
警告
'
,
{
confirmButtonText
:
'
确定
'
,
type
:
'
error
'
})
return
Promise
.
reject
(
'
error
'
)
}
else
{
return
response
}
...
...
litemall-core/src/main/java/org/linlinjava/litemall/core/util/ResponseUtil.java
View file @
1d08bb4d
...
...
@@ -41,46 +41,27 @@ public class ResponseUtil {
return
obj
;
}
public
static
Object
fail401
()
{
return
fail
(
401
,
"请登录"
);
}
public
static
Object
unlogin
(){
return
fail401
();
}
public
static
Object
fail402
()
{
return
fail
(
402
,
"参数不对"
);
}
public
static
Object
badArgument
(){
return
fail40
2
(
);
return
fail
(
40
1
,
"参数不对"
);
}
public
static
Object
fail403
()
{
return
fail
(
403
,
"参数值不对"
);
}
public
static
Object
badArgumentValue
(){
return
fail403
();
}
public
static
Object
fail501
()
{
return
fail
(
501
,
"业务不支持"
);
return
fail
(
402
,
"参数值不对"
);
}
public
static
Object
un
support
(){
return
fail501
(
);
public
static
Object
un
login
(){
return
fail
(
501
,
"请登录"
);
}
public
static
Object
fail502
()
{
public
static
Object
serious
(){
return
fail
(
502
,
"系统内部错误"
);
}
public
static
Object
serious
(){
return
fail50
2
(
);
public
static
Object
unsupport
(){
return
fail
(
50
3
,
"业务不支持"
);
}
}
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxAuthController.java
View file @
1d08bb4d
...
...
@@ -69,7 +69,7 @@ public class WxAuthController {
List
<
LitemallUser
>
userList
=
userService
.
queryByUsername
(
username
);
LitemallUser
user
=
null
;
if
(
userList
.
size
()
>
1
){
return
ResponseUtil
.
fail502
();
return
ResponseUtil
.
serious
();
}
else
if
(
userList
.
size
()
==
0
){
return
ResponseUtil
.
badArgumentValue
();
...
...
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxOrderController.java
View file @
1d08bb4d
...
...
@@ -125,7 +125,7 @@ public class WxOrderController {
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
Integer
page
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"10"
)
Integer
size
)
{
if
(
userId
==
null
)
{
return
ResponseUtil
.
fail401
();
return
ResponseUtil
.
unlogin
();
}
if
(
showType
==
null
)
{
showType
=
0
;
...
...
@@ -186,10 +186,10 @@ public class WxOrderController {
@GetMapping
(
"detail"
)
public
Object
detail
(
@LoginUser
Integer
userId
,
Integer
orderId
)
{
if
(
userId
==
null
)
{
return
ResponseUtil
.
fail401
();
return
ResponseUtil
.
unlogin
();
}
if
(
orderId
==
null
)
{
return
ResponseUtil
.
fail402
();
return
ResponseUtil
.
badArgument
();
}
// 订单信息
...
...
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxTopicController.java
View file @
1d08bb4d
...
...
@@ -87,7 +87,7 @@ public class WxTopicController {
@GetMapping
(
"related"
)
public
Object
related
(
Integer
id
)
{
if
(
id
==
null
){
return
ResponseUtil
.
fail402
();
return
ResponseUtil
.
badArgument
();
}
List
<
LitemallTopic
>
topicRelatedList
=
topicService
.
queryRelatedList
(
id
,
0
,
4
);
...
...
litemall-wx/utils/util.js
View file @
1d08bb4d
...
...
@@ -36,7 +36,7 @@ function request(url, data = {}, method = "GET") {
if
(
res
.
statusCode
==
200
)
{
if
(
res
.
data
.
errno
==
4
01
)
{
if
(
res
.
data
.
errno
==
5
01
)
{
// 清除登录相关内容
try
{
wx
.
removeStorageSync
(
'
userInfo
'
);
...
...
Write
Preview
Supports
Markdown
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