-
Notifications
You must be signed in to change notification settings - Fork 0
/
consts.go
161 lines (129 loc) · 5.14 KB
/
consts.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
package errz
const (
Success int64 = 0
SuccessMsg = "success"
FailMsg = "fail"
)
const (
CodeInvalidParam int64 = 10000 + iota
CodeTokenInvalid
CodeNoPermission
CodeRpcCall
CodeServiceBusy
)
const (
MsgInvalidParam = "invalid param"
MsgRpcCall = "rpc call failed"
MsgServiceBusy = "service busy"
MsgInvalidToken = "invalid token"
)
const (
CodeUserService int64 = 20000 + iota
CodeSentVerification
CodeGetVerification
CodeWrongVerification
CodeGenerateUid
CodeUserExist
CodeGenerateToken
CodeWrongPassword
CodeGetUserInfo
CodeChangeAvatar
CodeChangeBackground
CodePublishMsgInNsq
)
var (
ErrUserInternal = NewErrZ(WithCode(CodeUserService), WithMsg("user service busy"))
ErrSentVerification = NewErrZ(WithCode(CodeSentVerification), WithMsg("send verification failed"))
ErrGetVerification = NewErrZ(WithCode(CodeGetVerification), WithMsg("verification expired "))
ErrWrongVerification = NewErrZ(WithCode(CodeWrongVerification), WithMsg("verification wrong"))
ErrGenerateUid = NewErrZ(WithCode(CodeGenerateUid), WithMsg("generate user id failed"))
ErrUserExist = NewErrZ(WithCode(CodeUserExist), WithMsg("user exist"))
ErrGenerateToken = NewErrZ(WithCode(CodeGenerateToken), WithMsg("generate user token failed"))
ErrWrongPassword = NewErrZ(WithCode(CodeWrongPassword), WithMsg("wrong user password"))
ErrGetUserInfo = NewErrZ(WithCode(CodeGetUserInfo), WithMsg("get user info failed"))
ErrChangeAvatar = NewErrZ(WithCode(CodeChangeAvatar), WithMsg("change avatar failed"))
ErrChangeBackground = NewErrZ(WithCode(CodeChangeBackground), WithMsg("change background failed"))
ErrPublishMsgInNsq = NewErrZ(WithCode(CodePublishMsgInNsq), WithMsg("publish message in nsq failed"))
)
const (
CodeMerchantService int64 = 30000 + iota
CodeGenerateMerchantId
CodeMerchantExist
CodeGenerateMToken
CodeWrongPwd
CodeGetMerchantInfo
)
var (
ErrMerchantInternal = NewErrZ(WithCode(CodeMerchantService), WithMsg("merchant service busy"))
ErrGenerateMerchantId = NewErrZ(WithCode(CodeGenerateMerchantId), WithMsg("generate merchant id failed"))
ErrMerchantExist = NewErrZ(WithCode(CodeMerchantExist), WithMsg("merchant exist"))
ErrGenerateMToken = NewErrZ(WithCode(CodeGenerateMToken), WithMsg("generate merchant token failed"))
ErrWrongPwd = NewErrZ(WithCode(CodeWrongPwd), WithMsg("wrong merchant password"))
ErrGetMerchantInfo = NewErrZ(WithCode(CodeGetMerchantInfo), WithMsg("get merchant info failed"))
)
const (
CodeProductService int64 = 40000 + iota
CodeGenerateProductId
CodeCreateProduct
CodeNoProduct
)
var (
ErrProductInternal = NewErrZ(WithCode(CodeProductService), WithMsg("product service busy"))
ErrGenerateProductId = NewErrZ(WithCode(CodeGenerateProductId), WithMsg("generate product id failed"))
ErrCreateProduct = NewErrZ(WithCode(CodeCreateProduct), WithMsg("create product failed"))
ErrNoProduct = NewErrZ(WithCode(CodeNoProduct), WithMsg("no such product"))
)
const (
CodeOperateService int64 = 50000 + iota
CodeGetOperateInfo
CodeFavoriteProduct
CodeGetFavoriteStatus
CodeGetCommentNum
CodeGetSaleNum
)
var (
ErrOperateInternal = NewErrZ(WithCode(CodeOperateService), WithMsg("operate service busy"))
ErrGetOperateInfo = NewErrZ(WithCode(CodeGetOperateInfo), WithMsg("get operate info failed"))
ErrFavoriteProduct = NewErrZ(WithCode(CodeFavoriteProduct), WithMsg("favorite product failed"))
ErrGetFavoriteStatus = NewErrZ(WithCode(CodeGetFavoriteStatus), WithMsg("get user favorite status failed"))
ErrGetCommentNum = NewErrZ(WithCode(CodeGetCommentNum), WithMsg("get comment num failed"))
ErrGetSaleNum = NewErrZ(WithCode(CodeGetSaleNum), WithMsg("get sale num failed"))
)
const (
CodeOrderService int64 = 60000 + iota
CodeShortage
CodeGenerateOrderId
CodeUpdateOrder
CodeOrderList
)
var (
ErrOrderInternal = NewErrZ(WithCode(CodeOrderService), WithMsg("order service busy"))
ErrShortage = NewErrZ(WithCode(CodeShortage), WithMsg("shortage of stock"))
ErrGenerateOrderId = NewErrZ(WithCode(CodeGenerateOrderId), WithMsg("generate order id failed"))
ErrUpdateOrder = NewErrZ(WithCode(CodeUpdateOrder), WithMsg("update order status failed"))
ErrGetOrder = NewErrZ(WithCode(CodeOrderList), WithMsg("get order failed"))
)
const (
CodePayService int64 = 70000 + iota
CodeOrderPaid
CodeOrderCancel
CodeAmountWrong
CodeGenerateAlipay
)
var (
ErrPayInternal = NewErrZ(WithCode(CodePayService), WithMsg("pay service busy"))
ErrOrderPaid = NewErrZ(WithCode(CodeOrderPaid), WithMsg("order have paid"))
ErrOrderCancel = NewErrZ(WithCode(CodeOrderCancel), WithMsg("order have canceled"))
ErrAmountWrong = NewErrZ(WithCode(CodeAmountWrong), WithMsg("wrong amount"))
ErrGenerateAlipay = NewErrZ(WithCode(CodeGenerateAlipay), WithMsg("generate alipay failed"))
)
const (
CodeCartService int64 = 80000 + iota
CodeeAddProductToCart
CodeGetCart
)
var (
ErrCartInternal = NewErrZ(WithCode(CodeCartService), WithMsg("cart service busy"))
ErrAddProductToCart = NewErrZ(WithCode(CodeeAddProductToCart), WithMsg("add product to cart failed"))
ErrGetCart = NewErrZ(WithCode(CodeGetCart), WithMsg("get cart failed"))
)