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
"eladmin-system/src/vscode:/vscode.git/clone" did not exist on "5e95ae5bf1e0f854a55456c1b45b28d0edec66e7"
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 {
...
@@ -53,7 +53,7 @@ public class AdminAddressController {
@RequestParam
(
value
=
"limit"
,
defaultValue
=
"10"
)
Integer
limit
,
@RequestParam
(
value
=
"limit"
,
defaultValue
=
"10"
)
Integer
limit
,
String
sort
,
String
order
){
String
sort
,
String
order
){
if
(
adminId
==
null
){
if
(
adminId
==
null
){
return
ResponseUtil
.
fail401
();
return
ResponseUtil
.
unlogin
();
}
}
List
<
LitemallAddress
>
addressList
=
addressService
.
querySelective
(
userId
,
name
,
page
,
limit
,
sort
,
order
);
List
<
LitemallAddress
>
addressList
=
addressService
.
querySelective
(
userId
,
name
,
page
,
limit
,
sort
,
order
);
...
@@ -75,7 +75,7 @@ public class AdminAddressController {
...
@@ -75,7 +75,7 @@ public class AdminAddressController {
@PostMapping
(
"/create"
)
@PostMapping
(
"/create"
)
public
Object
create
(
@LoginAdmin
Integer
adminId
,
@RequestBody
LitemallAddress
address
){
public
Object
create
(
@LoginAdmin
Integer
adminId
,
@RequestBody
LitemallAddress
address
){
if
(
adminId
==
null
){
if
(
adminId
==
null
){
return
ResponseUtil
.
fail401
();
return
ResponseUtil
.
unlogin
();
}
}
String
mobile
=
address
.
getMobile
();
String
mobile
=
address
.
getMobile
();
...
@@ -92,7 +92,7 @@ public class AdminAddressController {
...
@@ -92,7 +92,7 @@ public class AdminAddressController {
@GetMapping
(
"/read"
)
@GetMapping
(
"/read"
)
public
Object
read
(
@LoginAdmin
Integer
adminId
,
Integer
addressId
){
public
Object
read
(
@LoginAdmin
Integer
adminId
,
Integer
addressId
){
if
(
adminId
==
null
){
if
(
adminId
==
null
){
return
ResponseUtil
.
fail401
();
return
ResponseUtil
.
unlogin
();
}
}
LitemallAddress
address
=
addressService
.
findById
(
addressId
);
LitemallAddress
address
=
addressService
.
findById
(
addressId
);
...
@@ -103,7 +103,7 @@ public class AdminAddressController {
...
@@ -103,7 +103,7 @@ public class AdminAddressController {
@PostMapping
(
"/update"
)
@PostMapping
(
"/update"
)
public
Object
update
(
@LoginAdmin
Integer
adminId
,
@RequestBody
LitemallAddress
address
){
public
Object
update
(
@LoginAdmin
Integer
adminId
,
@RequestBody
LitemallAddress
address
){
if
(
adminId
==
null
){
if
(
adminId
==
null
){
return
ResponseUtil
.
fail401
();
return
ResponseUtil
.
unlogin
();
}
}
addressService
.
updateById
(
address
);
addressService
.
updateById
(
address
);
Map
<
String
,
Object
>
addressVo
=
toVo
(
address
);
Map
<
String
,
Object
>
addressVo
=
toVo
(
address
);
...
@@ -113,7 +113,7 @@ public class AdminAddressController {
...
@@ -113,7 +113,7 @@ public class AdminAddressController {
@PostMapping
(
"/delete"
)
@PostMapping
(
"/delete"
)
public
Object
delete
(
@LoginAdmin
Integer
adminId
,
@RequestBody
LitemallAddress
address
){
public
Object
delete
(
@LoginAdmin
Integer
adminId
,
@RequestBody
LitemallAddress
address
){
if
(
adminId
==
null
){
if
(
adminId
==
null
){
return
ResponseUtil
.
fail401
();
return
ResponseUtil
.
unlogin
();
}
}
addressService
.
delete
(
address
.
getId
());
addressService
.
delete
(
address
.
getId
());
return
ResponseUtil
.
ok
();
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 {
...
@@ -43,9 +43,9 @@ public class AdminHistoryController {
@PostMapping
(
"/create"
)
@PostMapping
(
"/create"
)
public
Object
create
(
@LoginAdmin
Integer
adminId
,
@RequestBody
LitemallSearchHistory
history
){
public
Object
create
(
@LoginAdmin
Integer
adminId
,
@RequestBody
LitemallSearchHistory
history
){
if
(
adminId
==
null
){
if
(
adminId
==
null
){
return
ResponseUtil
.
fail401
();
return
ResponseUtil
.
unlogin
();
}
}
return
ResponseUtil
.
fail501
();
return
ResponseUtil
.
unsupport
();
}
}
@GetMapping
(
"/read"
)
@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 {
...
@@ -48,7 +48,7 @@ public class AdminOrderController {
@RequestParam
(
value
=
"limit"
,
defaultValue
=
"10"
)
Integer
limit
,
@RequestParam
(
value
=
"limit"
,
defaultValue
=
"10"
)
Integer
limit
,
String
sort
,
String
order
){
String
sort
,
String
order
){
if
(
adminId
==
null
){
if
(
adminId
==
null
){
return
ResponseUtil
.
fail401
();
return
ResponseUtil
.
unlogin
();
}
}
List
<
LitemallOrder
>
orderList
=
orderService
.
querySelective
(
userId
,
orderSn
,
page
,
limit
,
sort
,
order
);
List
<
LitemallOrder
>
orderList
=
orderService
.
querySelective
(
userId
,
orderSn
,
page
,
limit
,
sort
,
order
);
int
total
=
orderService
.
countSelective
(
userId
,
orderSn
,
page
,
limit
,
sort
,
order
);
int
total
=
orderService
.
countSelective
(
userId
,
orderSn
,
page
,
limit
,
sort
,
order
);
...
@@ -74,7 +74,7 @@ public class AdminOrderController {
...
@@ -74,7 +74,7 @@ public class AdminOrderController {
@GetMapping
(
"/read"
)
@GetMapping
(
"/read"
)
public
Object
read
(
@LoginAdmin
Integer
adminId
,
Integer
id
){
public
Object
read
(
@LoginAdmin
Integer
adminId
,
Integer
id
){
if
(
adminId
==
null
){
if
(
adminId
==
null
){
return
ResponseUtil
.
fail401
();
return
ResponseUtil
.
unlogin
();
}
}
LitemallOrder
order
=
orderService
.
findById
(
id
);
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 {
...
@@ -29,7 +29,7 @@ public class AdminUserController {
@RequestParam
(
value
=
"limit"
,
defaultValue
=
"10"
)
Integer
limit
,
@RequestParam
(
value
=
"limit"
,
defaultValue
=
"10"
)
Integer
limit
,
String
sort
,
String
order
){
String
sort
,
String
order
){
if
(
adminId
==
null
){
if
(
adminId
==
null
){
return
ResponseUtil
.
fail401
();
return
ResponseUtil
.
unlogin
();
}
}
List
<
LitemallUser
>
userList
=
userService
.
querySelective
(
username
,
mobile
,
page
,
limit
,
sort
,
order
);
List
<
LitemallUser
>
userList
=
userService
.
querySelective
(
username
,
mobile
,
page
,
limit
,
sort
,
order
);
int
total
=
userService
.
countSeletive
(
username
,
mobile
,
page
,
limit
,
sort
,
order
);
int
total
=
userService
.
countSeletive
(
username
,
mobile
,
page
,
limit
,
sort
,
order
);
...
@@ -43,7 +43,7 @@ public class AdminUserController {
...
@@ -43,7 +43,7 @@ public class AdminUserController {
@GetMapping
(
"/username"
)
@GetMapping
(
"/username"
)
public
Object
username
(
String
username
){
public
Object
username
(
String
username
){
if
(
StringUtil
.
isEmpty
(
username
)){
if
(
StringUtil
.
isEmpty
(
username
)){
return
ResponseUtil
.
fail402
();
return
ResponseUtil
.
badArgument
();
}
}
int
total
=
userService
.
countSeletive
(
username
,
null
,
null
,
null
,
null
,
null
);
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) => {
...
@@ -33,7 +33,7 @@ router.beforeEach((to, from, next) => {
})
})
}).
catch
(()
=>
{
}).
catch
(()
=>
{
store
.
dispatch
(
'
FedLogOut
'
).
then
(()
=>
{
store
.
dispatch
(
'
FedLogOut
'
).
then
(()
=>
{
Message
.
error
(
'
Verification failed, please login again
'
)
Message
.
error
(
'
验证失败,请输入正确的用户名和密码
'
)
next
({
path
:
'
/login
'
})
next
({
path
:
'
/login
'
})
})
})
})
})
...
...
litemall-admin/src/utils/request.js
View file @
1d08bb4d
...
@@ -26,22 +26,29 @@ service.interceptors.request.use(config => {
...
@@ -26,22 +26,29 @@ service.interceptors.request.use(config => {
service
.
interceptors
.
response
.
use
(
service
.
interceptors
.
response
.
use
(
response
=>
{
response
=>
{
const
res
=
response
.
data
const
res
=
response
.
data
if
(
res
.
errno
===
502
)
{
MessageBox
.
alert
(
'
系统内部错误,请联系管理员维护
'
,
'
错误
'
,
{
if
(
res
.
errno
===
501
)
{
MessageBox
.
alert
(
'
系统未登录,请重新登录
'
,
'
未登录
'
,
{
confirmButtonText
:
'
确定
'
,
confirmButtonText
:
'
确定
'
,
type
:
'
error
'
type
:
'
error
'
})
return
Promise
.
reject
(
'
error
'
)
}
else
if
(
res
.
errno
!==
0
)
{
MessageBox
.
alert
(
'
超时自动退出系统,请重新登录
'
,
'
已退出
'
,
{
confirmButtonText
:
'
重新登录
'
,
type
:
'
error
'
}).
then
(()
=>
{
}).
then
(()
=>
{
store
.
dispatch
(
'
FedLogOut
'
).
then
(()
=>
{
store
.
dispatch
(
'
FedLogOut
'
).
then
(()
=>
{
location
.
reload
()
location
.
reload
()
})
})
})
})
return
Promise
.
reject
(
'
error
'
)
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
{
}
else
{
return
response
return
response
}
}
...
...
litemall-core/src/main/java/org/linlinjava/litemall/core/util/ResponseUtil.java
View file @
1d08bb4d
...
@@ -41,46 +41,27 @@ public class ResponseUtil {
...
@@ -41,46 +41,27 @@ public class ResponseUtil {
return
obj
;
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
(){
public
static
Object
badArgument
(){
return
fail40
2
(
);
return
fail
(
40
1
,
"参数不对"
);
}
}
public
static
Object
fail403
()
{
return
fail
(
403
,
"参数值不对"
);
}
public
static
Object
badArgumentValue
(){
public
static
Object
badArgumentValue
(){
return
fail403
();
return
fail
(
402
,
"参数值不对"
);
}
public
static
Object
fail501
()
{
return
fail
(
501
,
"业务不支持"
);
}
}
public
static
Object
un
support
(){
public
static
Object
un
login
(){
return
fail501
(
);
return
fail
(
501
,
"请登录"
);
}
}
public
static
Object
fail502
()
{
public
static
Object
serious
(){
return
fail
(
502
,
"系统内部错误"
);
return
fail
(
502
,
"系统内部错误"
);
}
}
public
static
Object
serious
(){
public
static
Object
unsupport
(){
return
fail50
2
(
);
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 {
...
@@ -69,7 +69,7 @@ public class WxAuthController {
List
<
LitemallUser
>
userList
=
userService
.
queryByUsername
(
username
);
List
<
LitemallUser
>
userList
=
userService
.
queryByUsername
(
username
);
LitemallUser
user
=
null
;
LitemallUser
user
=
null
;
if
(
userList
.
size
()
>
1
){
if
(
userList
.
size
()
>
1
){
return
ResponseUtil
.
fail502
();
return
ResponseUtil
.
serious
();
}
}
else
if
(
userList
.
size
()
==
0
){
else
if
(
userList
.
size
()
==
0
){
return
ResponseUtil
.
badArgumentValue
();
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 {
...
@@ -125,7 +125,7 @@ public class WxOrderController {
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
Integer
page
,
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
Integer
page
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"10"
)
Integer
size
)
{
@RequestParam
(
value
=
"size"
,
defaultValue
=
"10"
)
Integer
size
)
{
if
(
userId
==
null
)
{
if
(
userId
==
null
)
{
return
ResponseUtil
.
fail401
();
return
ResponseUtil
.
unlogin
();
}
}
if
(
showType
==
null
)
{
if
(
showType
==
null
)
{
showType
=
0
;
showType
=
0
;
...
@@ -186,10 +186,10 @@ public class WxOrderController {
...
@@ -186,10 +186,10 @@ public class WxOrderController {
@GetMapping
(
"detail"
)
@GetMapping
(
"detail"
)
public
Object
detail
(
@LoginUser
Integer
userId
,
Integer
orderId
)
{
public
Object
detail
(
@LoginUser
Integer
userId
,
Integer
orderId
)
{
if
(
userId
==
null
)
{
if
(
userId
==
null
)
{
return
ResponseUtil
.
fail401
();
return
ResponseUtil
.
unlogin
();
}
}
if
(
orderId
==
null
)
{
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 {
...
@@ -87,7 +87,7 @@ public class WxTopicController {
@GetMapping
(
"related"
)
@GetMapping
(
"related"
)
public
Object
related
(
Integer
id
)
{
public
Object
related
(
Integer
id
)
{
if
(
id
==
null
){
if
(
id
==
null
){
return
ResponseUtil
.
fail402
();
return
ResponseUtil
.
badArgument
();
}
}
List
<
LitemallTopic
>
topicRelatedList
=
topicService
.
queryRelatedList
(
id
,
0
,
4
);
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") {
...
@@ -36,7 +36,7 @@ function request(url, data = {}, method = "GET") {
if
(
res
.
statusCode
==
200
)
{
if
(
res
.
statusCode
==
200
)
{
if
(
res
.
data
.
errno
==
4
01
)
{
if
(
res
.
data
.
errno
==
5
01
)
{
// 清除登录相关内容
// 清除登录相关内容
try
{
try
{
wx
.
removeStorageSync
(
'
userInfo
'
);
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