message.go
9.6 KB
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
package protocol
import (
"encoding/json"
"time"
)
var errmessge ErrorMap = map[int]string{
0: "成功",
1: "系统异常",
2: "参数错误",
3: "统一用户中心操作异常",
5: "繁忙,请稍后再试",
101: "clientId或clientSecret无效",
113: "签名验证失败",
502: "用户不存在",
503: "用户被禁用",
601: "公司被禁用",
602: "用户无模块权限",
1009: "验证码已失效",
1011: "获取验证码次数超出限制,请联系管理员",
1012: "请输入正确的验证码",
2001: "请输入正确的手机号码",
2002: "您还不是正式用户,请联系管理员",
2009: "上传的文件流为空",
2021: "登录失败,手机号或密码错误",
2025: "短信验证码验证失败",
2026: "新密码与确认密码不一致",
2027: "密码必须至少有6个字符",
2028: "请输入正确的旧密码",
2029: "当前手机号已存在,请重新输入",
2030: "新密码与旧密码一致,请重新输入",
2060: "读取公告失败",
4139: "authCode无效或过期",
4140: "refreshToken过期,需要重新登录授权",
4141: "accessToken过期或无效,需要进行重新获取令牌",
4142: "Uuid已存在,请求失败",
4201: "无该公司",
//机会相关
5101: "该机会已被删除",
5102: "该机会已被关闭或没有权限查看",
//机会审批相关
5201: "该机会模板未配置审批人,请选择其他模板",
5202: "该机会已被审批",
5203: "已处理,请勿重新处理", //审批服务器操作失败
5204: "评分或者公开状态不能为空",
5205: "机会未审核通过,不能修改评分或者公开状态",
5206: "该机会已经被其他人审批",
5207: "公司管理员未设置",
//模板相关
5301: "机会模板不存在",
5302: "该机会分类已被停用",
//消息相关
5401: "消息不存在",
//评分相关
5501: "基础评分不符合要求",
5502: "附加评分不符合要求",
5503: "价值评分不符合要求",
5510: "评分配置不存在,请联系管理员",
5511: "发现分计算不一致,请重新提交",
//评论相关
5601: "评论不存在",
//企业平台
10001: "用户不存在",
10002: "登录凭证已过期,请重新登录",
10003: "验证码不能为空",
10004: "登录凭证不能为空",
10005: "密码不能为空",
10006: "用户不存在",
10007: "用户已被禁用",
10008: "用户无模块权限",
}
const (
MsgTypeBulletin = 1 //公告
MsgTypeCommend = 2 //表彰
MsgTypeInteraction = 4 //互动消息
MsgTypeAudit = 8 //机会审核
MsgTypeAuditBy = 16 //机会被审核消息-我提交的
MsgTypeComment = 32 //评论
MsgTypeThumbUp = 64 //点赞
MsgTypeChanceRevise = 128 //补充机会
)
var (
MessageApproving = "提交了一条%v机会消息,需要您审核"
MessageApproveSuccess = "审核通过您提交的%v机会"
MessageApproveReject = "退回了您提交的%v机会"
MessageZanChance = "点赞了您发布的机会"
MessageZanComment = "点赞了您发布的评论"
MessageChanceRevise = "补充了您发布的%v机会信息"
)
/*MessageCenter */
type MessageCenterRequest struct {
MsgType int `json:"msgType" valid:"Required"`
}
type MessageCenterResponse struct {
Totals []*MessageTotal `json:"totals"`
}
type MessageTotal struct {
MsgType int `json:"msgType" orm:"column(msg_type)"`
MsgTotal int `json:"msgTotal" orm:"column(total)"`
}
/*MsgCenterRead */
type MsgCenterReadRequest struct {
MsgId int64 `json:"msgId" valid:"Required"`
MsgType int `json:"msgType" valid:"Required"`
}
type MsgCenterReadResponse struct {
}
/*MsgCenterAllRead */
type MsgCenterAllReadRequest struct {
MsgType int `json:"msgType" valid:"Required"`
}
type MsgCenterAllReadResponse struct {
}
/*互动消息*/
type MsgInteractiveRequest struct {
LastId int64 `json:"lastId"`
PageSize int `json:"pageSize" valid:"Required"`
MsgType int `json:"msgType" valid:"Required"`
SourceType int `json:"sourceType" valid:"Required"`
}
type MsgInteractiveResponse struct {
Lists []*UserMsg `json:"lists"`
Total int `json:"total"`
}
type UserMsg struct {
MsgId int64 `json:"msgId"`
BulletinId int64 `json:"-"`
SourceType int `json:"msgType"`
Content string `json:"title"`
CreateAt int64 `json:"msgTime"`
IsRead int `json:"isRead"`
//机会 //评论
Link string `json:"link,omitempty"`
}
type Message struct {
ErrorCode
Data json.RawMessage `json:"data"`
}
func (m Message) Unmarshal(v interface{}) error {
if len(m.Data) == 0 {
m.Data = []byte("{}")
}
return json.Unmarshal(m.Data, v)
}
/**************公告****************/
type Question struct {
Id int `json:"id"`
Type int `json:"way" valid:"Required"`
Title string `json:"title" valid:"Required"`
Content []QuestionContent `json:"options" valid:"Required"`
}
type QuestionContent struct {
Id int `json:"id" valid:"Required"`
Content string `json:"content" valid:"Required"`
}
type Cover struct {
Path string `json:"path" valid:"Required"`
H int `json:"-"`
W int `json:"-"`
ImageId string `json:"imageId"`
}
/*公告列表 BulletinList */
type BulletinListRequest struct {
}
type BulletinListResponse struct {
List []*BulletinItem `json:"list"`
Total int
}
type BulletinItem struct {
Id int `json:"id"`
Type int8 `json:"type"`
Title string `json:"title"`
Status int8 `json:"status"`
Receiver []Receiver `json:"receiver" valid:"Required"`
CreateAt string `json:"time"`
}
type Receiver struct {
Id int64 `json:"id"`
NickName string `json:"name"`
}
/*请求公告列表 Announcements */
type AnnouncementsRequest struct {
}
type AnnouncementsResponse struct {
Lists []Announcement `json:"lists,omitempty"`
}
type Announcement struct {
Id int `json:"id"`
Type int `json:"type" valid:"Required"`
Title string `json:"title" valid:"Required"`
Cover Cover `json:"cover" valid:"Required"`
Link string `json:"link"`
Control int `json:"control"`
}
/*AnnouncementRead */
type AnnouncementReadRequest struct {
Id int `json:"id" valid:"Required"` //公告id
}
type AnnouncementReadResponse struct {
}
/*MsgCompanyNotice 消息中心-公司公告 */
type MsgCompanyNoticeRequest struct {
LastId int64 `json:"lastId"`
PageSize int `json:"pageSize" valid:"Required"`
}
type MsgCompanyNoticeResponse struct {
Lists []UserMsg `json:"lists"`
Total int `json:"total"`
}
/*MsgChanceApprove 机会审核消息*/
type MsgChanceApproveRequest struct {
LastId int64 `json:"lastId"`
PageSize int `json:"pageSize" valid:"Required"`
}
type MsgChanceApproveResponse struct {
List []MsgCommonListItem `json:"list"`
Total int `json:"total"`
}
/*MsgChanceSubmit 我提交的*/
type MsgChanceSubmitRequest struct {
LastId int64 `json:"lastId"`
PageSize int `json:"pageSize" valid:"Required"`
}
type MsgChanceSubmitResponse struct {
List []MsgCommonListItem `json:"list"`
Total int `json:"total"`
}
/*MsgChanceComment 消息中心-互动消息.评论*/
type MsgChanceCommentRequest struct {
LastId int64 `json:"lastId"`
PageSize int `json:"pageSize" valid:"Required"`
}
type MsgChanceCommentResponse struct {
List []MsgCommonListItem `json:"list"`
Total int `json:"total"`
}
/*MsgChanceThumbUp 息中心-互动消息.点赞*/
type MsgChanceThumbUpRequest struct {
LastId int64 `json:"lastId"`
PageSize int `json:"pageSize" valid:"Required"`
}
type MsgChanceThumbUpResponse struct {
List []MsgCommonListItem `json:"list"`
Total int `json:"total"`
}
/*MsgChanceRevise 消息中心-机会补充*/
type MsgChanceReviseRequest struct {
LastId int64 `json:"lastId"`
PageSize int `json:"pageSize" valid:"Required"`
}
type MsgChanceReviseResponse struct {
List []MsgCommonListItem `json:"list"`
Total int `json:"total"`
}
//我的审核机会列表
type MsgChanceApproveItemOrm struct {
CommChanceItemOrm
Id int64 `orm:"column(id)"` //消息id
MsgTime time.Time `orm:"column(msg_time)"`
ReceiveUserId int64 `orm:"column(receive_user_id)"`
SenderUserId int64 `orm:"column(sender_user_id)"`
CreateTime time.Time `orm:"column(create_at)"`
Message string `orm:"column(message)"`
IsRead int64 `orm:"column(is_read)"`
//ChanceId int64 `orm:"column(chance_id)"` // 机会id
EnableStatus int `orm:"column(enable_status)"`
SourceId int64 `orm:"column(source_id)"` // 机会id
Data string `orm:"column(data)"`
}
/*Announcement H5公告详情*/
type AnnouncementRequest struct {
Id int `json:"id" valid:"Required"`
Uid int `json:"uid" valid:"Required"`
}
type AnnouncementResponse struct {
Announcement H5Announcement `json:"announcement"`
}
type H5Announcement struct {
Id int `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
Control int `json:"control"`
IsRead int `json:"isRead"`
Vote Question `json:"vote"`
VoteResults []int `json:"voteResults"`
EditContent string `json:"editContent"`
}
/*AnnouncementSubmit H5完成公告操作*/
type AnnouncementSubmitRequest struct {
Id int `json:"id" valid:"Required"` //公告id
Uid int64 `json:"uid"`
VoteResults []int `json:"voteResults"`
VoteId int `json:"voteId"` //投票问题id
EditContent string `json:"editContent"`
}
type AnnouncementSubmitResponse struct {
}
type Answer struct {
VoteResults []int `json:"voteResults"`
EditContent string `json:"editContent"`
}
//扩展消息附加数据
type MsgData struct {
Score *Score `json:"score,omitempty"`
Reason string `json:"-"`
}