Merge remote-tracking branch 'origin/dev' into test
# Conflicts: # conf/dev.conf
正在显示
23 个修改的文件
包含
1340 行增加
和
122 行删除
| @@ -12,7 +12,7 @@ aliyun_logs_access ="${aliyun_logs_access||F:/log/app.log}" | @@ -12,7 +12,7 @@ aliyun_logs_access ="${aliyun_logs_access||F:/log/app.log}" | ||
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | #redis相关配置 | 14 | #redis相关配置 |
| 15 | -redis_add = "${REDIS_HOST||192.168.100.102}" | 15 | +redis_add = "${REDIS_HOST||127.0.0.1}" |
| 16 | redis_add_port = "${REDIS_PORT||6379}" | 16 | redis_add_port = "${REDIS_PORT||6379}" |
| 17 | redis_auth = "123456" | 17 | redis_auth = "123456" |
| 18 | 18 | ||
| @@ -38,7 +38,7 @@ user_center_app_secret ="cykbjnfqgctn" | @@ -38,7 +38,7 @@ user_center_app_secret ="cykbjnfqgctn" | ||
| 38 | 38 | ||
| 39 | 39 | ||
| 40 | #Html5 | 40 | #Html5 |
| 41 | -h5_host = "http://web-open-test.fjmaimaimai.com" | 41 | +h5_host = "http://mmm-web-open-test.fjmaimaimai.com" |
| 42 | 42 | ||
| 43 | #审核中心 | 43 | #审核中心 |
| 44 | suplus_approve_host ="http://suplus-approve-dev.fjmaimaimai.com" | 44 | suplus_approve_host ="http://suplus-approve-dev.fjmaimaimai.com" |
| @@ -305,3 +305,9 @@ func (this *BaseController) Finish() { | @@ -305,3 +305,9 @@ func (this *BaseController) Finish() { | ||
| 305 | log.Debug(fmt.Sprintf("<====Send to uid(%d) ucid(%v) client: %d byte\nRequestId:%s RspBodyData: %s", this.Header.Uid, this.Header.UserId, length, this.Header.GetRequestId(), string(strByte))) | 305 | log.Debug(fmt.Sprintf("<====Send to uid(%d) ucid(%v) client: %d byte\nRequestId:%s RspBodyData: %s", this.Header.Uid, this.Header.UserId, length, this.Header.GetRequestId(), string(strByte))) |
| 306 | } | 306 | } |
| 307 | } | 307 | } |
| 308 | + | ||
| 309 | +//func(this *BaseController)Get(){ | ||
| 310 | +// if strings.HasSuffix(this.Ctx.Request.RequestURI,".mp3"){ | ||
| 311 | +// this.Ctx.ResponseWriter.Header().Set("Content-Type","audio/mpeg") | ||
| 312 | +// } | ||
| 313 | +//} |
| @@ -12,7 +12,7 @@ type ChanceController struct { | @@ -12,7 +12,7 @@ type ChanceController struct { | ||
| 12 | controllers.BaseController | 12 | controllers.BaseController |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | -//IComment | 15 | +//IComment 我来评论 |
| 16 | // @router /iComment [post] | 16 | // @router /iComment [post] |
| 17 | func (this *ChanceController) IComment() { | 17 | func (this *ChanceController) IComment() { |
| 18 | var msg *protocol.ResponseMessage | 18 | var msg *protocol.ResponseMessage |
| @@ -54,7 +54,7 @@ func (this *ChanceController) IComments() { | @@ -54,7 +54,7 @@ func (this *ChanceController) IComments() { | ||
| 54 | msg = protocol.NewReturnResponse(chance.IComments(header, request)) | 54 | msg = protocol.NewReturnResponse(chance.IComments(header, request)) |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | -//Comments | 57 | +//Comments 评论列表 |
| 58 | // @router /comments [post] | 58 | // @router /comments [post] |
| 59 | func (this *ChanceController) Comments() { | 59 | func (this *ChanceController) Comments() { |
| 60 | var msg *protocol.ResponseMessage | 60 | var msg *protocol.ResponseMessage |
| @@ -72,10 +72,31 @@ func (this *ChanceController) Comments() { | @@ -72,10 +72,31 @@ func (this *ChanceController) Comments() { | ||
| 72 | return | 72 | return |
| 73 | } | 73 | } |
| 74 | header := controllers.GetRequestHeader(this.Ctx) | 74 | header := controllers.GetRequestHeader(this.Ctx) |
| 75 | - request.SourceType = protocol.SourceTypeChance | 75 | + //request.SourceType = protocol.SourceTypeChance |
| 76 | msg = protocol.NewReturnResponse(chance.Comments(header, request)) | 76 | msg = protocol.NewReturnResponse(chance.Comments(header, request)) |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | +//Thumbsups 点赞列表 | ||
| 80 | +// @router /thumbsups [post] | ||
| 81 | +func (this *ChanceController) Thumbsups() { | ||
| 82 | + var msg *protocol.ResponseMessage | ||
| 83 | + defer func() { | ||
| 84 | + this.Resp(msg) | ||
| 85 | + }() | ||
| 86 | + var request *protocol.ThumbsupsRequest | ||
| 87 | + if err := json.Unmarshal(this.ByteBody, &request); err != nil { | ||
| 88 | + log.Error(err) | ||
| 89 | + msg = protocol.BadRequestParam(1) | ||
| 90 | + return | ||
| 91 | + } | ||
| 92 | + if b, m := this.Valid(request); !b { | ||
| 93 | + msg = m | ||
| 94 | + return | ||
| 95 | + } | ||
| 96 | + header := controllers.GetRequestHeader(this.Ctx) | ||
| 97 | + msg = protocol.NewReturnResponse(chance.Thumbsups(header, request)) | ||
| 98 | +} | ||
| 99 | + | ||
| 79 | //Favorite | 100 | //Favorite |
| 80 | // @router /favorite [post] | 101 | // @router /favorite [post] |
| 81 | func (this *ChanceController) Favorite() { | 102 | func (this *ChanceController) Favorite() { |
| @@ -139,7 +160,7 @@ func (this *ChanceController) CommentDetailsMulti() { | @@ -139,7 +160,7 @@ func (this *ChanceController) CommentDetailsMulti() { | ||
| 139 | msg = protocol.NewReturnResponse(chance.CommentDetailsMulti(header, request)) | 160 | msg = protocol.NewReturnResponse(chance.CommentDetailsMulti(header, request)) |
| 140 | } | 161 | } |
| 141 | 162 | ||
| 142 | -//SympathyAction | 163 | +//SympathyAction 机会点赞/收藏 |
| 143 | //@router /sympathyAction [post] | 164 | //@router /sympathyAction [post] |
| 144 | func (this *ChanceController) SympathyAction() { | 165 | func (this *ChanceController) SympathyAction() { |
| 145 | var msg *protocol.ResponseMessage | 166 | var msg *protocol.ResponseMessage |
| @@ -294,27 +315,6 @@ func (this *ChanceController) MySubmitChance() { | @@ -294,27 +315,6 @@ func (this *ChanceController) MySubmitChance() { | ||
| 294 | msg = protocol.NewReturnResponse(chance.MySubmitChance(header, request)) | 315 | msg = protocol.NewReturnResponse(chance.MySubmitChance(header, request)) |
| 295 | } | 316 | } |
| 296 | 317 | ||
| 297 | -//ChancePool 机会池 | ||
| 298 | -//@router /chancePool [post] | ||
| 299 | -func (this *ChanceController) ChancePool() { | ||
| 300 | - var msg *protocol.ResponseMessage | ||
| 301 | - defer func() { | ||
| 302 | - this.Resp(msg) | ||
| 303 | - }() | ||
| 304 | - var request *protocol.ChancePoolRequest | ||
| 305 | - if err := json.Unmarshal(this.ByteBody, &request); err != nil { | ||
| 306 | - log.Error(err) | ||
| 307 | - msg = protocol.BadRequestParam(1) | ||
| 308 | - return | ||
| 309 | - } | ||
| 310 | - if b, m := this.Valid(request); !b { | ||
| 311 | - msg = m | ||
| 312 | - return | ||
| 313 | - } | ||
| 314 | - header := controllers.GetRequestHeader(this.Ctx) | ||
| 315 | - msg = protocol.NewReturnResponse(chance.ChancePool(header, request)) | ||
| 316 | -} | ||
| 317 | - | ||
| 318 | //ChanceDetail 机会详情 | 318 | //ChanceDetail 机会详情 |
| 319 | //@router /chanceDetail [post] | 319 | //@router /chanceDetail [post] |
| 320 | func (this *ChanceController) ChanceDetail() { | 320 | func (this *ChanceController) ChanceDetail() { |
| @@ -488,3 +488,87 @@ func (this *ChanceController) MyApproveChance() { | @@ -488,3 +488,87 @@ func (this *ChanceController) MyApproveChance() { | ||
| 488 | header := controllers.GetRequestHeader(this.Ctx) | 488 | header := controllers.GetRequestHeader(this.Ctx) |
| 489 | msg = protocol.NewReturnResponse(chance.MyApproveChance(header, request)) | 489 | msg = protocol.NewReturnResponse(chance.MyApproveChance(header, request)) |
| 490 | } | 490 | } |
| 491 | + | ||
| 492 | +//MyCollectChance 我的收藏 | ||
| 493 | +//@router /myCollectChance [post] | ||
| 494 | +func (this *ChanceController) MyCollectChance() { | ||
| 495 | + var msg *protocol.ResponseMessage | ||
| 496 | + defer func() { | ||
| 497 | + this.Resp(msg) | ||
| 498 | + }() | ||
| 499 | + var request *protocol.MyCollectChanceRequest | ||
| 500 | + if err := json.Unmarshal(this.ByteBody, &request); err != nil { | ||
| 501 | + log.Error(err) | ||
| 502 | + msg = protocol.BadRequestParam(1) | ||
| 503 | + return | ||
| 504 | + } | ||
| 505 | + if b, m := this.Valid(request); !b { | ||
| 506 | + msg = m | ||
| 507 | + return | ||
| 508 | + } | ||
| 509 | + header := controllers.GetRequestHeader(this.Ctx) | ||
| 510 | + msg = protocol.NewReturnResponse(chance.MyCollectChance(header, request)) | ||
| 511 | +} | ||
| 512 | + | ||
| 513 | +//MyThumbUpChance 我点赞的机会 | ||
| 514 | +//@router /myThumbUpChance [post] | ||
| 515 | +func (this *ChanceController) MyThumbUpChance() { | ||
| 516 | + var msg *protocol.ResponseMessage | ||
| 517 | + defer func() { | ||
| 518 | + this.Resp(msg) | ||
| 519 | + }() | ||
| 520 | + var request *protocol.MyThumbUpChanceRequest | ||
| 521 | + if err := json.Unmarshal(this.ByteBody, &request); err != nil { | ||
| 522 | + log.Error(err) | ||
| 523 | + msg = protocol.BadRequestParam(1) | ||
| 524 | + return | ||
| 525 | + } | ||
| 526 | + if b, m := this.Valid(request); !b { | ||
| 527 | + msg = m | ||
| 528 | + return | ||
| 529 | + } | ||
| 530 | + header := controllers.GetRequestHeader(this.Ctx) | ||
| 531 | + msg = protocol.NewReturnResponse(chance.MyThumbUpChance(header, request)) | ||
| 532 | +} | ||
| 533 | + | ||
| 534 | +//MyComment 我的评论 | ||
| 535 | +//@router /myComment [post] | ||
| 536 | +func (this *ChanceController) MyComment() { | ||
| 537 | + var msg *protocol.ResponseMessage | ||
| 538 | + defer func() { | ||
| 539 | + this.Resp(msg) | ||
| 540 | + }() | ||
| 541 | + var request *protocol.MyCommentRequest | ||
| 542 | + if err := json.Unmarshal(this.ByteBody, &request); err != nil { | ||
| 543 | + log.Error(err) | ||
| 544 | + msg = protocol.BadRequestParam(1) | ||
| 545 | + return | ||
| 546 | + } | ||
| 547 | + if b, m := this.Valid(request); !b { | ||
| 548 | + msg = m | ||
| 549 | + return | ||
| 550 | + } | ||
| 551 | + header := controllers.GetRequestHeader(this.Ctx) | ||
| 552 | + msg = protocol.NewReturnResponse(chance.MyComment(header, request)) | ||
| 553 | +} | ||
| 554 | + | ||
| 555 | +//ChancePool 机会池 | ||
| 556 | +//@router /chancePool [post] | ||
| 557 | +func (this *ChanceController) ChancePool() { | ||
| 558 | + var msg *protocol.ResponseMessage | ||
| 559 | + defer func() { | ||
| 560 | + this.Resp(msg) | ||
| 561 | + }() | ||
| 562 | + var request *protocol.ChancePoolRequest | ||
| 563 | + if err := json.Unmarshal(this.ByteBody, &request); err != nil { | ||
| 564 | + log.Error(err) | ||
| 565 | + msg = protocol.BadRequestParam(1) | ||
| 566 | + return | ||
| 567 | + } | ||
| 568 | + if b, m := this.Valid(request); !b { | ||
| 569 | + msg = m | ||
| 570 | + return | ||
| 571 | + } | ||
| 572 | + header := controllers.GetRequestHeader(this.Ctx) | ||
| 573 | + msg = protocol.NewReturnResponse(chance.ChancePool(header, request)) | ||
| 574 | +} |
| @@ -12,7 +12,7 @@ type MessageController struct { | @@ -12,7 +12,7 @@ type MessageController struct { | ||
| 12 | controllers.BaseController | 12 | controllers.BaseController |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | -//MessageCenter | 15 | +//MessageCenter 消息中心 |
| 16 | // @router /messageCenter [post] | 16 | // @router /messageCenter [post] |
| 17 | func (this *MessageController) MessageCenter() { | 17 | func (this *MessageController) MessageCenter() { |
| 18 | var msg *protocol.ResponseMessage | 18 | var msg *protocol.ResponseMessage |
| @@ -159,7 +159,7 @@ func (this *MessageController) MsgCompanyNotice() { | @@ -159,7 +159,7 @@ func (this *MessageController) MsgCompanyNotice() { | ||
| 159 | msg = protocol.NewReturnResponse(message.MsgCompanyNotice(header, request)) | 159 | msg = protocol.NewReturnResponse(message.MsgCompanyNotice(header, request)) |
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | -//MsgChanceApprove 机会审核消息 | 162 | +//MsgChanceApprove 消息中心-机会审核消息 |
| 163 | //@router /msgChanceApprove [post] | 163 | //@router /msgChanceApprove [post] |
| 164 | func (this *MessageController) MsgChanceApprove() { | 164 | func (this *MessageController) MsgChanceApprove() { |
| 165 | var msg *protocol.ResponseMessage | 165 | var msg *protocol.ResponseMessage |
| @@ -179,3 +179,66 @@ func (this *MessageController) MsgChanceApprove() { | @@ -179,3 +179,66 @@ func (this *MessageController) MsgChanceApprove() { | ||
| 179 | header := controllers.GetRequestHeader(this.Ctx) | 179 | header := controllers.GetRequestHeader(this.Ctx) |
| 180 | msg = protocol.NewReturnResponse(message.MsgChanceApprove(header, request)) | 180 | msg = protocol.NewReturnResponse(message.MsgChanceApprove(header, request)) |
| 181 | } | 181 | } |
| 182 | + | ||
| 183 | +//MsgChanceSubmit 消息中心-我提交的 | ||
| 184 | +//@router /msgChanceSubmit [post] | ||
| 185 | +func (this *MessageController) MsgChanceSubmit() { | ||
| 186 | + var msg *protocol.ResponseMessage | ||
| 187 | + defer func() { | ||
| 188 | + this.Resp(msg) | ||
| 189 | + }() | ||
| 190 | + var request *protocol.MsgChanceSubmitRequest | ||
| 191 | + if err := json.Unmarshal(this.ByteBody, &request); err != nil { | ||
| 192 | + log.Error(err) | ||
| 193 | + msg = protocol.BadRequestParam(1) | ||
| 194 | + return | ||
| 195 | + } | ||
| 196 | + if b, m := this.Valid(request); !b { | ||
| 197 | + msg = m | ||
| 198 | + return | ||
| 199 | + } | ||
| 200 | + header := controllers.GetRequestHeader(this.Ctx) | ||
| 201 | + msg = protocol.NewReturnResponse(message.MsgChanceSubmit(header, request)) | ||
| 202 | +} | ||
| 203 | + | ||
| 204 | +//MsgChanceComment 消息中心-互动消息.评论 | ||
| 205 | +//@router /msgChanceComment [post] | ||
| 206 | +func (this *MessageController) MsgChanceComment() { | ||
| 207 | + var msg *protocol.ResponseMessage | ||
| 208 | + defer func() { | ||
| 209 | + this.Resp(msg) | ||
| 210 | + }() | ||
| 211 | + var request *protocol.MsgChanceCommentRequest | ||
| 212 | + if err := json.Unmarshal(this.ByteBody, &request); err != nil { | ||
| 213 | + log.Error(err) | ||
| 214 | + msg = protocol.BadRequestParam(1) | ||
| 215 | + return | ||
| 216 | + } | ||
| 217 | + if b, m := this.Valid(request); !b { | ||
| 218 | + msg = m | ||
| 219 | + return | ||
| 220 | + } | ||
| 221 | + header := controllers.GetRequestHeader(this.Ctx) | ||
| 222 | + msg = protocol.NewReturnResponse(message.MsgChanceComment(header, request)) | ||
| 223 | +} | ||
| 224 | + | ||
| 225 | +//MsgChanceThumbUp 消息中心-互动消息.点赞 | ||
| 226 | +//@router /msgChanceThumbUp [post] | ||
| 227 | +func (this *MessageController) MsgChanceThumbUp() { | ||
| 228 | + var msg *protocol.ResponseMessage | ||
| 229 | + defer func() { | ||
| 230 | + this.Resp(msg) | ||
| 231 | + }() | ||
| 232 | + var request *protocol.MsgChanceThumbUpRequest | ||
| 233 | + if err := json.Unmarshal(this.ByteBody, &request); err != nil { | ||
| 234 | + log.Error(err) | ||
| 235 | + msg = protocol.BadRequestParam(1) | ||
| 236 | + return | ||
| 237 | + } | ||
| 238 | + if b, m := this.Valid(request); !b { | ||
| 239 | + msg = m | ||
| 240 | + return | ||
| 241 | + } | ||
| 242 | + header := controllers.GetRequestHeader(this.Ctx) | ||
| 243 | + msg = protocol.NewReturnResponse(message.MsgChanceThumbUp(header, request)) | ||
| 244 | +} |
| @@ -49,7 +49,7 @@ spec: | @@ -49,7 +49,7 @@ spec: | ||
| 49 | volumeMounts: | 49 | volumeMounts: |
| 50 | - mountPath: /opt/logs | 50 | - mountPath: /opt/logs |
| 51 | name: accesslogs | 51 | name: accesslogs |
| 52 | - - mountPath: /var/www/opp-dev/file | 52 | + - mountPath: /var/www/opp/file |
| 53 | name: mmmjihuitest-pvc1 | 53 | name: mmmjihuitest-pvc1 |
| 54 | ports: | 54 | ports: |
| 55 | - containerPort: 8080 | 55 | - containerPort: 8080 |
| @@ -3,6 +3,7 @@ package main | @@ -3,6 +3,7 @@ package main | ||
| 3 | import ( | 3 | import ( |
| 4 | "fmt" | 4 | "fmt" |
| 5 | "github.com/astaxie/beego" | 5 | "github.com/astaxie/beego" |
| 6 | + "github.com/astaxie/beego/context" | ||
| 6 | _ "github.com/go-sql-driver/mysql" | 7 | _ "github.com/go-sql-driver/mysql" |
| 7 | "gitlab.fjmaimaimai.com/mmm-go/gocomm/common" | 8 | "gitlab.fjmaimaimai.com/mmm-go/gocomm/common" |
| 8 | "gitlab.fjmaimaimai.com/mmm-go/gocomm/config" | 9 | "gitlab.fjmaimaimai.com/mmm-go/gocomm/config" |
| @@ -13,6 +14,7 @@ import ( | @@ -13,6 +14,7 @@ import ( | ||
| 13 | "opp/internal/utils" | 14 | "opp/internal/utils" |
| 14 | _ "opp/routers" | 15 | _ "opp/routers" |
| 15 | "os" | 16 | "os" |
| 17 | + "strings" | ||
| 16 | "time" | 18 | "time" |
| 17 | ) | 19 | ) |
| 18 | 20 | ||
| @@ -71,6 +73,8 @@ func init() { | @@ -71,6 +73,8 @@ func init() { | ||
| 71 | log.Info(fmt.Sprintf("env REDIS_HOST:%v", os.Getenv("REDIS_HOST"))) | 73 | log.Info(fmt.Sprintf("env REDIS_HOST:%v", os.Getenv("REDIS_HOST"))) |
| 72 | log.Info(fmt.Sprintf("env REDIS_PORT:%v", os.Getenv("REDIS_PORT"))) | 74 | log.Info(fmt.Sprintf("env REDIS_PORT:%v", os.Getenv("REDIS_PORT"))) |
| 73 | log.Info(fmt.Sprintf("env aliyun_file_access:%v", os.Getenv("aliyun_file_access"))) | 75 | log.Info(fmt.Sprintf("env aliyun_file_access:%v", os.Getenv("aliyun_file_access"))) |
| 76 | + | ||
| 77 | + //mime.AddExtensionType(".mp3","audio/mpeg") | ||
| 74 | } | 78 | } |
| 75 | 79 | ||
| 76 | func main() { | 80 | func main() { |
| @@ -79,6 +83,14 @@ func main() { | @@ -79,6 +83,14 @@ func main() { | ||
| 79 | }() | 83 | }() |
| 80 | log.Info("app on start!") | 84 | log.Info("app on start!") |
| 81 | log.Info("Beego Run Mode:", beego.BConfig.RunMode) | 85 | log.Info("Beego Run Mode:", beego.BConfig.RunMode) |
| 82 | - | 86 | + beego.InsertFilter("file/opp/*", beego.BeforeStatic, FilterBeforeStatic) |
| 83 | beego.Run() | 87 | beego.Run() |
| 84 | } | 88 | } |
| 89 | + | ||
| 90 | +var FilterBeforeStatic = func(ctx *context.Context) { | ||
| 91 | + if strings.HasSuffix(ctx.Request.RequestURI, ".mp3") { | ||
| 92 | + //If-Modified-Since | ||
| 93 | + //ctx.Request.Header.Add("If-Modified-Since","") | ||
| 94 | + ctx.ResponseWriter.Header().Add("Content-Type", "audio/mpeg") | ||
| 95 | + } | ||
| 96 | +} |
| @@ -103,8 +103,7 @@ func GetAuditFlowProcessBy(processId, uid int64) (v *AuditFlowProcess, err error | @@ -103,8 +103,7 @@ func GetAuditFlowProcessBy(processId, uid int64) (v *AuditFlowProcess, err error | ||
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | //当前审批批次已经结束 唤醒下一批次审批人 | 105 | //当前审批批次已经结束 唤醒下一批次审批人 |
| 106 | -func UpdatetAuditFlowProcessToNext(chanceId int64, level int, uids []int64) (err error) { | ||
| 107 | - o := orm.NewOrm() | 106 | +func UpdatetAuditFlowProcessToNext(o orm.Ormer, chanceId int64, level int, uids []int64) (err error) { |
| 108 | sql := "update audit_flow_process set enable_status =1,is_active=1,update_at=now() where chance_id=? and level=? and uid in (?)" | 107 | sql := "update audit_flow_process set enable_status =1,is_active=1,update_at=now() where chance_id=? and level=? and uid in (?)" |
| 109 | if err = utils.ExecuteSQLWithOrmer(o, sql, chanceId, level, utils.JoinInt64s(uids, ",")); err != nil { | 108 | if err = utils.ExecuteSQLWithOrmer(o, sql, chanceId, level, utils.JoinInt64s(uids, ",")); err != nil { |
| 110 | return | 109 | return |
| @@ -113,8 +112,7 @@ func UpdatetAuditFlowProcessToNext(chanceId int64, level int, uids []int64) (err | @@ -113,8 +112,7 @@ func UpdatetAuditFlowProcessToNext(chanceId int64, level int, uids []int64) (err | ||
| 113 | } | 112 | } |
| 114 | 113 | ||
| 115 | //或签 有一人已经通过 同批次在审核状态置为无效 | 114 | //或签 有一人已经通过 同批次在审核状态置为无效 |
| 116 | -func UpdatetAuditFlowProcessNoApprove(chanceId int64, level int, reviewStatus int) (err error) { | ||
| 117 | - o := orm.NewOrm() | 115 | +func UpdatetAuditFlowProcessNoApprove(o orm.Ormer, chanceId int64, level int, reviewStatus int) (err error) { |
| 118 | sql := "update audit_flow_process set enable_status =0,is_active=0,update_at=now() where chance_id=? and level=? and review_status=?" | 116 | sql := "update audit_flow_process set enable_status =0,is_active=0,update_at=now() where chance_id=? and level=? and review_status=?" |
| 119 | if err = utils.ExecuteSQLWithOrmer(o, sql, chanceId, level, reviewStatus); err != nil { | 117 | if err = utils.ExecuteSQLWithOrmer(o, sql, chanceId, level, reviewStatus); err != nil { |
| 120 | return | 118 | return |
| @@ -152,7 +152,7 @@ func GetChancePool(uid, cid int64, chanceTypeId int, lastId int64, pageSize int, | @@ -152,7 +152,7 @@ func GetChancePool(uid, cid int64, chanceTypeId int, lastId int64, pageSize int, | ||
| 152 | sql := `select a.*,b.images,speechs,videos | 152 | sql := `select a.*,b.images,speechs,videos |
| 153 | from ( | 153 | from ( |
| 154 | select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total from chance | 154 | select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total from chance |
| 155 | -where user_id=? and company_id=? and review_status=3 and (?=0 or chance_type_id =?) and (?=0 or id>?) and enable_status=1 | 155 | +where company_id=? and review_status=3 and (?=0 or chance_type_id =?) and (?=0 or id>?) and enable_status=1 |
| 156 | order by create_at desc | 156 | order by create_at desc |
| 157 | limit ? | 157 | limit ? |
| 158 | ) a left JOIN chance_data b on a.id =b.chance_id` | 158 | ) a left JOIN chance_data b on a.id =b.chance_id` |
| @@ -160,14 +160,87 @@ limit ? | @@ -160,14 +160,87 @@ limit ? | ||
| 160 | 160 | ||
| 161 | sqlCount := fmt.Sprintf(`select count(0) from ( | 161 | sqlCount := fmt.Sprintf(`select count(0) from ( |
| 162 | select id from chance | 162 | select id from chance |
| 163 | -where user_id=? and company_id=? and review_status=3 and (%v=0 or chance_type_id =%v) and enable_status=1 | 163 | +where company_id=? and review_status=3 and (%v=0 or chance_type_id =%v) and enable_status=1 |
| 164 | order by create_at desc | 164 | order by create_at desc |
| 165 | ) a left JOIN chance_data b on a.id =b.chance_id`, chanceTypeId, chanceTypeId) | 165 | ) a left JOIN chance_data b on a.id =b.chance_id`, chanceTypeId, chanceTypeId) |
| 166 | - if err = utils.ExecuteQueryOne(&total, sqlCount, uid, cid); err != nil { | 166 | + if err = utils.ExecuteQueryOne(&total, sqlCount, cid); err != nil { |
| 167 | return | 167 | return |
| 168 | } | 168 | } |
| 169 | if v != nil { | 169 | if v != nil { |
| 170 | - if err = utils.ExecuteQueryAll(v, sql, uid, cid, chanceTypeId, chanceTypeId, lastId, lastId, pageSize); err != nil { | 170 | + if err = utils.ExecuteQueryAll(v, sql, cid, chanceTypeId, chanceTypeId, lastId, lastId, pageSize); err != nil { |
| 171 | + return | ||
| 172 | + } | ||
| 173 | + } | ||
| 174 | + return | ||
| 175 | +} | ||
| 176 | + | ||
| 177 | +func GetChanceCollect(uid int64, lastId int64, pageSize int, v interface{}) (total int, err error) { | ||
| 178 | + sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from ( | ||
| 179 | +select a.*,b.user_id,b.id,b.create_at,b.source_content,b.enable_status,b.review_status,b.audit_template_id,b.chance_type_id,comment_total,zan_total,view_total from ( | ||
| 180 | +select id collect_id,source_id,create_at collect_time from chance_favorite where (0=? or id>?) and user_id =? and enable_status=1 | ||
| 181 | +and source_type=1 | ||
| 182 | +and (mark_flag&2)>0 | ||
| 183 | +)a left outer join chance b on a.source_id = b.id | ||
| 184 | +)a left outer join chance_data b on a.source_id =b.chance_id | ||
| 185 | +order by collect_time desc | ||
| 186 | +limit ?`) | ||
| 187 | + | ||
| 188 | + sqlCount := `select count(0) from chance_favorite where user_id =? and enable_status=1 and (mark_flag&2)>0` | ||
| 189 | + if err = utils.ExecuteQueryOne(&total, sqlCount, uid); err != nil { | ||
| 190 | + return | ||
| 191 | + } | ||
| 192 | + if v != nil { | ||
| 193 | + if err = utils.ExecuteQueryAll(v, sql, lastId, lastId, uid, pageSize); err != nil { | ||
| 194 | + return | ||
| 195 | + } | ||
| 196 | + } | ||
| 197 | + return | ||
| 198 | +} | ||
| 199 | + | ||
| 200 | +func GetChanceThumbUp(uid int64, lastId int64, pageSize int, v interface{}) (total int, err error) { | ||
| 201 | + sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from ( | ||
| 202 | +select a.*,b.user_id,b.id,b.create_at,b.source_content,b.enable_status,b.review_status,b.audit_template_id,b.chance_type_id,comment_total,zan_total,view_total from ( | ||
| 203 | +select id collect_id,source_id,create_at collect_time from chance_favorite where (0=? or id>?) and user_id =? and enable_status=1 | ||
| 204 | +and source_type=1 | ||
| 205 | +and (mark_flag&1)>0 | ||
| 206 | +)a left outer join chance b on a.source_id = b.id | ||
| 207 | +)a left outer join chance_data b on a.source_id =b.chance_id | ||
| 208 | +order by collect_time desc | ||
| 209 | +limit ?`) | ||
| 210 | + | ||
| 211 | + sqlCount := `select count(0) from chance_favorite where user_id =? and enable_status=1 and (mark_flag&2)>0` | ||
| 212 | + if err = utils.ExecuteQueryOne(&total, sqlCount, uid); err != nil { | ||
| 213 | + return | ||
| 214 | + } | ||
| 215 | + if v != nil { | ||
| 216 | + if err = utils.ExecuteQueryAll(v, sql, lastId, lastId, uid, pageSize); err != nil { | ||
| 217 | + return | ||
| 218 | + } | ||
| 219 | + } | ||
| 220 | + return | ||
| 221 | +} | ||
| 222 | + | ||
| 223 | +//我的评论 | ||
| 224 | +func GetChanceComment(uid int64, lastId int64, pageSize int, v interface{}) (total int, err error) { | ||
| 225 | + sql := fmt.Sprintf(`select a.*,b.content commented_content,b.create_at commented_time,b.user_id commented_user_id | ||
| 226 | +from ( | ||
| 227 | +select a.*,b.images,b.speechs,b.videos from ( | ||
| 228 | +select a.*,b.source_content,b.enable_status,b.user_id chance_user_id,b.create_at,b.review_status,b.approve_data from ( | ||
| 229 | +select id,content,view_total,zan_total,comment_total,source_type,source_id,create_at comment_time from comment | ||
| 230 | +where user_id =? and (?=0 or id>?) | ||
| 231 | +)a left outer join chance b on a.source_id = b.id and source_type=1 | ||
| 232 | +)a left outer join chance_data b on a.source_id = b.chance_id and source_type = 1 | ||
| 233 | +)a left outer join comment b on a.source_id = b.id and a.source_type=2 | ||
| 234 | +order by create_at desc | ||
| 235 | +limit ?`) | ||
| 236 | + | ||
| 237 | + sqlCount := `select count(0) from comment | ||
| 238 | +where user_id =?` | ||
| 239 | + if err = utils.ExecuteQueryOne(&total, sqlCount, uid); err != nil { | ||
| 240 | + return | ||
| 241 | + } | ||
| 242 | + if v != nil { | ||
| 243 | + if err = utils.ExecuteQueryAll(v, sql, uid, lastId, lastId, pageSize); err != nil { | ||
| 171 | return | 244 | return |
| 172 | } | 245 | } |
| 173 | } | 246 | } |
| @@ -81,12 +81,12 @@ func DeleteChanceFavorite(id int64) (err error) { | @@ -81,12 +81,12 @@ func DeleteChanceFavorite(id int64) (err error) { | ||
| 81 | 81 | ||
| 82 | //按1.用户id 2.公司id 3.标记类型 4.机会类型编号 5.最后编号 6.页数 | 82 | //按1.用户id 2.公司id 3.标记类型 4.机会类型编号 5.最后编号 6.页数 |
| 83 | //获取用户点赞收藏机会 | 83 | //获取用户点赞收藏机会 |
| 84 | -func GetChanceFavorites(userId, companyId int64, markFlag, chanceType int, lastId int64, pageSize int) (v []*ChanceFavorite, total int, err error) { | 84 | +func GetChanceFavorites(userId, companyId int64, markFlag, sourceType int, lastId int64, pageSize int) (v []*ChanceFavorite, total int, err error) { |
| 85 | sql := mybeego.NewSqlExutor().Table("chance_favorite").Order("create_at desc") | 85 | sql := mybeego.NewSqlExutor().Table("chance_favorite").Order("create_at desc") |
| 86 | sql.Where(fmt.Sprintf("user_id=%d", userId)) | 86 | sql.Where(fmt.Sprintf("user_id=%d", userId)) |
| 87 | sql.Where(fmt.Sprintf("company_id=%d", companyId)) | 87 | sql.Where(fmt.Sprintf("company_id=%d", companyId)) |
| 88 | - if chanceType > 0 { | ||
| 89 | - sql.Where(fmt.Sprintf("chance_type=%d", chanceType)) | 88 | + if sourceType > 0 { |
| 89 | + sql.Where(fmt.Sprintf("source_type=%d", sourceType)) | ||
| 90 | } | 90 | } |
| 91 | if markFlag > 0 { | 91 | if markFlag > 0 { |
| 92 | sql.Where(fmt.Sprintf("mark_flag&%d>0", markFlag)) | 92 | sql.Where(fmt.Sprintf("mark_flag&%d>0", markFlag)) |
| @@ -40,6 +40,8 @@ const ( | @@ -40,6 +40,8 @@ const ( | ||
| 40 | SqlUserMsgUnRead = "select * from user_msg where source_id=? and company_id=? and receive_user_id=? and msg_type=? and is_read=0 order by create_at desc" //特定未读消息 | 40 | SqlUserMsgUnRead = "select * from user_msg where source_id=? and company_id=? and receive_user_id=? and msg_type=? and is_read=0 order by create_at desc" //特定未读消息 |
| 41 | //用户消息 - 按 1.源id 2.接收者id 3.消息类型 | 41 | //用户消息 - 按 1.源id 2.接收者id 3.消息类型 |
| 42 | SqlUserMsg = "select * from user_msg where source_id=? and receive_user_id=? and msg_type=? " //特定未读消息 | 42 | SqlUserMsg = "select * from user_msg where source_id=? and receive_user_id=? and msg_type=? " //特定未读消息 |
| 43 | + //删除消息 | ||
| 44 | + SqlDeleteUserMsg = "delete from user_msg where source_id=? and source_type=? and receive_user_id=? and msg_type=? " //特定未读消息 | ||
| 43 | ) | 45 | ) |
| 44 | 46 | ||
| 45 | func (t *UserMsg) TableName() string { | 47 | func (t *UserMsg) TableName() string { |
| @@ -115,7 +117,7 @@ GROUP BY msg_type` | @@ -115,7 +117,7 @@ GROUP BY msg_type` | ||
| 115 | func UpdateUserMsgSetRead(userId int64, companyId int64, msgType int, msgId int64) (err error) { | 117 | func UpdateUserMsgSetRead(userId int64, companyId int64, msgType int, msgId int64) (err error) { |
| 116 | o := orm.NewOrm() | 118 | o := orm.NewOrm() |
| 117 | sql := `update user_msg set is_read = 1 | 119 | sql := `update user_msg set is_read = 1 |
| 118 | - where receive_user_id = ? and company_id=? and is_public=1 ` | 120 | + where receive_user_id = ? and company_id=? ` |
| 119 | if msgType > 0 { | 121 | if msgType > 0 { |
| 120 | sql += fmt.Sprintf(" and (msg_type & %v)>0", msgType) | 122 | sql += fmt.Sprintf(" and (msg_type & %v)>0", msgType) |
| 121 | } | 123 | } |
| @@ -153,7 +155,7 @@ func GetUserMsgs(userId, companyId int64, msgType int, sourceType int, lastId in | @@ -153,7 +155,7 @@ func GetUserMsgs(userId, companyId int64, msgType int, sourceType int, lastId in | ||
| 153 | 155 | ||
| 154 | //获取公告消息列表 | 156 | //获取公告消息列表 |
| 155 | func GetUserMsgsBulletin(userId, companyId int64, msgType int, lastId int64, pageSize int, v interface{}) (total int, err error) { | 157 | func GetUserMsgsBulletin(userId, companyId int64, msgType int, lastId int64, pageSize int, v interface{}) (total int, err error) { |
| 156 | - sql := `select b.id,b.title,unix_timestamp(b.update_at) update_at,a.is_read ` | 158 | + sql := `select a.id msg_id,b.id,b.title,unix_timestamp(a.create_at)*1000 update_at,a.is_read ` |
| 157 | sqlCount := `select count(0) ` | 159 | sqlCount := `select count(0) ` |
| 158 | where := `from user_msg a,bulletin b where a.receive_user_id =? and a.company_id=? and a.source_id = b.id and a.msg_type=? and a.company_id=? and b.status=2 ` | 160 | where := `from user_msg a,bulletin b where a.receive_user_id =? and a.company_id=? and a.source_id = b.id and a.msg_type=? and a.company_id=? and b.status=2 ` |
| 159 | sqlCount += where | 161 | sqlCount += where |
| @@ -166,7 +168,7 @@ func GetUserMsgsBulletin(userId, companyId int64, msgType int, lastId int64, pag | @@ -166,7 +168,7 @@ func GetUserMsgsBulletin(userId, companyId int64, msgType int, lastId int64, pag | ||
| 166 | if v == nil { | 168 | if v == nil { |
| 167 | return | 169 | return |
| 168 | } | 170 | } |
| 169 | - where += ` order by b.update_at desc` | 171 | + where += ` order by a.create_at desc` |
| 170 | sql += where + " limit ?" | 172 | sql += where + " limit ?" |
| 171 | if err = utils.ExecuteQueryAll(v, sql, userId, companyId, msgType, companyId, pageSize); err != nil { | 173 | if err = utils.ExecuteQueryAll(v, sql, userId, companyId, msgType, companyId, pageSize); err != nil { |
| 172 | return | 174 | return |
| @@ -197,3 +199,29 @@ from user_msg where receive_user_id=? and source_type=1 and msg_type=? ` | @@ -197,3 +199,29 @@ from user_msg where receive_user_id=? and source_type=1 and msg_type=? ` | ||
| 197 | } | 199 | } |
| 198 | return | 200 | return |
| 199 | } | 201 | } |
| 202 | + | ||
| 203 | +//获取机会评论消息 | ||
| 204 | +func GetChanceCommentMsg(uid, lastId int64, pageSize int, msgType int, v interface{}) (total int, err error) { | ||
| 205 | + sql := `select a.*,b.content commented_content,b.create_at commented_time,b.user_id commented_user_id from ( | ||
| 206 | +select a.*,b.images,b.speechs,b.videos from ( | ||
| 207 | +select a.*,b.source_content,b.enable_status,b.user_id chance_user_id,b.create_at,b.review_status from ( | ||
| 208 | +select id,message content,source_type,source_id,create_at comment_time from user_msg | ||
| 209 | +where receive_user_id =? and (?=0 or id>?) and msg_type=? | ||
| 210 | +)a left outer join chance b on a.source_id = b.id and source_type=1 | ||
| 211 | +)a left outer join chance_data b on a.source_id = b.chance_id and source_type = 1 | ||
| 212 | +)a left outer join comment b on a.source_id = b.id and a.source_type=2 | ||
| 213 | +order by create_at desc | ||
| 214 | +LIMIT ?` | ||
| 215 | + | ||
| 216 | + sqlCount := `select count(0) | ||
| 217 | +from user_msg where receive_user_id=? and source_type=1 and msg_type=? ` | ||
| 218 | + if err = utils.ExecuteQueryOne(&total, sqlCount, uid, msgType); err != nil { | ||
| 219 | + return | ||
| 220 | + } | ||
| 221 | + if v != nil { | ||
| 222 | + if err = utils.ExecuteQueryAll(v, sql, uid, lastId, lastId, msgType, pageSize); err != nil { | ||
| 223 | + return | ||
| 224 | + } | ||
| 225 | + } | ||
| 226 | + return | ||
| 227 | +} |
| @@ -69,10 +69,10 @@ type FavoriteResponse struct { | @@ -69,10 +69,10 @@ type FavoriteResponse struct { | ||
| 69 | 69 | ||
| 70 | /*SympathyAction 点赞,收藏*/ | 70 | /*SympathyAction 点赞,收藏*/ |
| 71 | type SympathyActionRequest struct { | 71 | type SympathyActionRequest struct { |
| 72 | - MarkType int `json:"mark_type" valid:"Required"` // 1.赞 2.收藏 | ||
| 73 | - SourceType int `json:"source_type" valid:"Required"` //protocol.SourceType //机会 评论 | ||
| 74 | - Id int64 `json:"id" valid:"Required"` | ||
| 75 | - SympathyType int `json:"sympathy_type"` //1:标记 0:取消标记 | 72 | + MarkType int `json:"markType" valid:"Required"` // 1.赞 2.收藏 |
| 73 | + SourceType int `json:"sourceType" valid:"Required"` //protocol.SourceType //1.机会 2.评论 | ||
| 74 | + Id int64 `json:"id" valid:"Required"` //机会编号 / 评论编号 | ||
| 75 | + SympathyType int `json:"sympathyType"` //1:标记 0:取消标记 | ||
| 76 | } | 76 | } |
| 77 | type SympathyActionResponse struct { | 77 | type SympathyActionResponse struct { |
| 78 | } | 78 | } |
| @@ -181,7 +181,7 @@ type MyApproveChanceResponse struct { | @@ -181,7 +181,7 @@ type MyApproveChanceResponse struct { | ||
| 181 | 181 | ||
| 182 | //我的审核机会列表 | 182 | //我的审核机会列表 |
| 183 | type ChanceApproveItemOrm struct { | 183 | type ChanceApproveItemOrm struct { |
| 184 | - ChanceUserId int64 `orm:"column(chance_user_id)"` | 184 | + ChanceUserId int64 `orm:"column(user_id)"` |
| 185 | SourceContent string `orm:"column(source_content)"` | 185 | SourceContent string `orm:"column(source_content)"` |
| 186 | ChanceEnableStatus int `orm:"column(enable_status)"` | 186 | ChanceEnableStatus int `orm:"column(enable_status)"` |
| 187 | Images string `orm:"column(images)"` | 187 | Images string `orm:"column(images)"` |
| @@ -198,9 +198,39 @@ type ChanceApproveItemOrm struct { | @@ -198,9 +198,39 @@ type ChanceApproveItemOrm struct { | ||
| 198 | ChanceId int64 `orm:"column(chance_id)"` // 机会id | 198 | ChanceId int64 `orm:"column(chance_id)"` // 机会id |
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | +/*MyCollectChance 我的收藏*/ | ||
| 202 | +type MyCollectChanceRequest struct { | ||
| 203 | + LastId int64 `json:"lastId"` | ||
| 204 | + PageSize int `json:"pageSize" valid:"Required"` | ||
| 205 | +} | ||
| 206 | +type MyCollectChanceResponse struct { | ||
| 207 | + List []CommonListItem `json:"list"` | ||
| 208 | + Total int `json:"total"` | ||
| 209 | +} | ||
| 210 | + | ||
| 211 | +/*MyThumbUpChance 我点赞的机会*/ | ||
| 212 | +type MyThumbUpChanceRequest struct { | ||
| 213 | + LastId int64 `json:"lastId"` | ||
| 214 | + PageSize int `json:"pageSize" valid:"Required"` | ||
| 215 | +} | ||
| 216 | +type MyThumbUpChanceResponse struct { | ||
| 217 | + List []CommonListItem `json:"list"` | ||
| 218 | + Total int `json:"total"` | ||
| 219 | +} | ||
| 220 | + | ||
| 221 | +/*MyComment 我的评论*/ | ||
| 222 | +type MyCommentRequest struct { | ||
| 223 | + LastId int64 `json:"lastId"` | ||
| 224 | + PageSize int `json:"pageSize" valid:"Required"` | ||
| 225 | +} | ||
| 226 | +type MyCommentResponse struct { | ||
| 227 | + List []CommonListItem `json:"list"` | ||
| 228 | + Total int `json:"total"` | ||
| 229 | +} | ||
| 230 | + | ||
| 201 | //机会池列表 | 231 | //机会池列表 |
| 202 | type ChancePoolItemOrm struct { | 232 | type ChancePoolItemOrm struct { |
| 203 | - Id int64 `orm:"column(id)"` | 233 | + ChanceId int64 `orm:"column(id)"` |
| 204 | Uid int64 `orm:"column(user_id)"` | 234 | Uid int64 `orm:"column(user_id)"` |
| 205 | CreateTime time.Time `orm:"column(create_at)"` | 235 | CreateTime time.Time `orm:"column(create_at)"` |
| 206 | SourceContent string `orm:"column(source_content)"` | 236 | SourceContent string `orm:"column(source_content)"` |
| @@ -210,12 +240,90 @@ type ChancePoolItemOrm struct { | @@ -210,12 +240,90 @@ type ChancePoolItemOrm struct { | ||
| 210 | ReviewStatus int `orm:"column(review_status)"` //审核状态 1:待审核 2:被退回 3:已通过 | 240 | ReviewStatus int `orm:"column(review_status)"` //审核状态 1:待审核 2:被退回 3:已通过 |
| 211 | 241 | ||
| 212 | //ApproveData string `json:"approveData"` //审核数据 | 242 | //ApproveData string `json:"approveData"` //审核数据 |
| 243 | + TemplateId int `orm:"column(audit_template_id)"` | ||
| 244 | + ChanceTypeId int `orm:"column(chance_type_id)"` | ||
| 245 | + | ||
| 246 | + CommentTotal int `orm:"column(comment_total)"` | ||
| 247 | + ZanTotal int `orm:"column(zan_total)"` | ||
| 248 | + ViewTotal int `orm:"column(view_total)"` | ||
| 249 | +} | ||
| 213 | 250 | ||
| 251 | +//机会池收藏列表项 | ||
| 252 | +type ChanceCollectItemOrm struct { | ||
| 253 | + ChanceId int64 `orm:"column(id)"` | ||
| 254 | + ChanceUserId int64 `orm:"column(user_id)"` | ||
| 255 | + CreateTime time.Time `orm:"column(create_at)"` | ||
| 256 | + SourceContent string `orm:"column(source_content)"` | ||
| 257 | + ChanceEnableStatus int `orm:"column(enable_status)"` | ||
| 258 | + ReviewStatus int `orm:"column(review_status)"` //审核状态 1:待审核 2:被退回 3:已通过 | ||
| 259 | + Images string `orm:"column(images)"` | ||
| 260 | + Voices string `orm:"column(speechs)"` | ||
| 261 | + Videos string `orm:"column(videos)"` | ||
| 262 | + | ||
| 263 | + //ApproveData string `json:"approveData"` //审核数据 | ||
| 214 | TemplateId int `orm:"column(audit_template_id)"` | 264 | TemplateId int `orm:"column(audit_template_id)"` |
| 215 | ChanceTypeId int `orm:"column(chance_type_id)"` | 265 | ChanceTypeId int `orm:"column(chance_type_id)"` |
| 266 | + | ||
| 216 | CommentTotal int `orm:"column(comment_total)"` | 267 | CommentTotal int `orm:"column(comment_total)"` |
| 217 | ZanTotal int `orm:"column(zan_total)"` | 268 | ZanTotal int `orm:"column(zan_total)"` |
| 218 | ViewTotal int `orm:"column(view_total)"` | 269 | ViewTotal int `orm:"column(view_total)"` |
| 270 | + | ||
| 271 | + CollectId int64 `orm:"column(collect_id)"` //收藏id | ||
| 272 | + CollectTime time.Time `orm:"column(collect_time)"` //收藏时间 | ||
| 273 | +} | ||
| 274 | + | ||
| 275 | +//机会池收藏列表项 | ||
| 276 | +type ChanceThumbUpItemOrm struct { | ||
| 277 | + ChanceId int64 `orm:"column(id)"` | ||
| 278 | + ChanceUserId int64 `orm:"column(user_id)"` | ||
| 279 | + CreateTime time.Time `orm:"column(create_at)"` | ||
| 280 | + SourceContent string `orm:"column(source_content)"` | ||
| 281 | + ChanceEnableStatus int `orm:"column(enable_status)"` | ||
| 282 | + ReviewStatus int `orm:"column(review_status)"` //审核状态 1:待审核 2:被退回 3:已通过 | ||
| 283 | + Images string `orm:"column(images)"` | ||
| 284 | + Voices string `orm:"column(speechs)"` | ||
| 285 | + Videos string `orm:"column(videos)"` | ||
| 286 | + | ||
| 287 | + //ApproveData string `json:"approveData"` //审核数据 | ||
| 288 | + TemplateId int `orm:"column(audit_template_id)"` | ||
| 289 | + ChanceTypeId int `orm:"column(chance_type_id)"` | ||
| 290 | + | ||
| 291 | + CommentTotal int `orm:"column(comment_total)"` | ||
| 292 | + ZanTotal int `orm:"column(zan_total)"` | ||
| 293 | + ViewTotal int `orm:"column(view_total)"` | ||
| 294 | + | ||
| 295 | + CollectId int64 `orm:"column(collect_id)"` //收藏id | ||
| 296 | + CollectTime time.Time `orm:"column(collect_time)"` //收藏时间 | ||
| 297 | +} | ||
| 298 | + | ||
| 299 | +//我的评论 | ||
| 300 | +type ChanceCommentItemOrm struct { | ||
| 301 | + //ChanceId int64 `orm:"column(id)"` | ||
| 302 | + Uid int64 `orm:"column(chance_user_id)"` | ||
| 303 | + CreateTime time.Time `orm:"column(create_at)"` | ||
| 304 | + SourceContent string `orm:"column(source_content)"` | ||
| 305 | + ChanceEnableStatus int `orm:"column(enable_status)"` | ||
| 306 | + ReviewStatus int `orm:"column(review_status)"` //审核状态 1:待审核 2:被退回 3:已通过 | ||
| 307 | + Images string `orm:"column(images)"` | ||
| 308 | + Voices string `orm:"column(speechs)"` | ||
| 309 | + Videos string `orm:"column(videos)"` | ||
| 310 | + | ||
| 311 | + CommentTotal int `orm:"column(comment_total)"` | ||
| 312 | + ZanTotal int `orm:"column(zan_total)"` | ||
| 313 | + ViewTotal int `orm:"column(view_total)"` | ||
| 314 | + | ||
| 315 | + CommentId int64 `orm:"column(id)"` | ||
| 316 | + CommentContent string `orm:"column(content)"` | ||
| 317 | + CommentTime time.Time `orm:"column(comment_time)"` | ||
| 318 | + | ||
| 319 | + //被评论的对象 | ||
| 320 | + CommentedUserId int64 `orm:"column(commented_user_id)"` | ||
| 321 | + CommentedContent string `orm:"column(commented_content)"` | ||
| 322 | + CommentedTime time.Time `orm:"column(commented_time)"` //收藏时间 | ||
| 323 | + | ||
| 324 | + //评论对象类型 | ||
| 325 | + SourceType int `orm:"column(source_type)"` | ||
| 326 | + SourceId int64 `orm:"column(source_id)"` | ||
| 219 | } | 327 | } |
| 220 | 328 | ||
| 221 | /*ChanceDetail 机会详情*/ | 329 | /*ChanceDetail 机会详情*/ |
| @@ -224,13 +332,13 @@ type ChanceDetailRequest struct { | @@ -224,13 +332,13 @@ type ChanceDetailRequest struct { | ||
| 224 | } | 332 | } |
| 225 | type ChanceDetailResponse struct { | 333 | type ChanceDetailResponse struct { |
| 226 | ChanceDetail ChanceItem `json:"chance"` | 334 | ChanceDetail ChanceItem `json:"chance"` |
| 227 | - ChanceData interface{} `json:"chanceData,omitempty"` //机会数据(是否收藏/点赞 浏览数 点赞总数 评论数)ChanceData | 335 | + StatisticData interface{} `json:"statisticData"` //机会数据(是否收藏/点赞 浏览数 点赞总数 评论数)ChanceData |
| 228 | ApproveData *ApproveData `json:"approveData"` | 336 | ApproveData *ApproveData `json:"approveData"` |
| 229 | ApproveProcess []*ProcessItem `json:"approveProcess"` | 337 | ApproveProcess []*ProcessItem `json:"approveProcess"` |
| 230 | ApproveAccess *ApproveAccess `json:"approveAccess"` // | 338 | ApproveAccess *ApproveAccess `json:"approveAccess"` // |
| 231 | ChanceType NameItem `json:"chanceType"` //机会类型 | 339 | ChanceType NameItem `json:"chanceType"` //机会类型 |
| 232 | ChanceTemplate NameItem `json:"template"` //机会模板 | 340 | ChanceTemplate NameItem `json:"template"` //机会模板 |
| 233 | - ReviewStatus int `json:"review_status"` //审核状态 1:待审核 2:被退回 3:已通过 | 341 | + ReviewStatus int `json:"reviewStatus"` //审核状态 1:待审核 2:被退回 3:已通过 |
| 234 | } | 342 | } |
| 235 | 343 | ||
| 236 | type ChanceType struct { | 344 | type ChanceType struct { |
| @@ -261,6 +369,7 @@ type ChanceCalculateScoreRequest struct { | @@ -261,6 +369,7 @@ type ChanceCalculateScoreRequest struct { | ||
| 261 | } | 369 | } |
| 262 | type ChanceCalculateScoreResponse struct { | 370 | type ChanceCalculateScoreResponse struct { |
| 263 | DiscoveryScore float64 `json:"discoveryScore"` //发现分 | 371 | DiscoveryScore float64 `json:"discoveryScore"` //发现分 |
| 372 | + DiscoveryScorePercent int `json:"discoveryScorePercent"` //发现分-百分比 | ||
| 264 | } | 373 | } |
| 265 | 374 | ||
| 266 | /*ChanceDelete 机会删除*/ | 375 | /*ChanceDelete 机会删除*/ |
| @@ -313,6 +422,20 @@ type Form struct { | @@ -313,6 +422,20 @@ type Form struct { | ||
| 313 | Required int8 `json:"required"` | 422 | Required int8 `json:"required"` |
| 314 | } | 423 | } |
| 315 | 424 | ||
| 425 | +//清楚未填写的表单数据 | ||
| 426 | +func ClearEmptyForm(inputFormList []*Form) (FormList []*Form) { | ||
| 427 | + if len(inputFormList) == 0 { | ||
| 428 | + return | ||
| 429 | + } | ||
| 430 | + for i := range inputFormList { | ||
| 431 | + item := inputFormList[i] | ||
| 432 | + if len(item.Value) > 0 { | ||
| 433 | + FormList = append(FormList, item) | ||
| 434 | + } | ||
| 435 | + } | ||
| 436 | + return | ||
| 437 | +} | ||
| 438 | + | ||
| 316 | //语音 | 439 | //语音 |
| 317 | type Speech struct { | 440 | type Speech struct { |
| 318 | Path string `json:"path"` | 441 | Path string `json:"path"` |
| @@ -348,20 +471,26 @@ type ChanceTotalItem struct { | @@ -348,20 +471,26 @@ type ChanceTotalItem struct { | ||
| 348 | //机会列表 通用项 | 471 | //机会列表 通用项 |
| 349 | type CommonListItem struct { | 472 | type CommonListItem struct { |
| 350 | Chance ChanceItem `json:"chance,omitempty"` //机会详情 | 473 | Chance ChanceItem `json:"chance,omitempty"` //机会详情 |
| 351 | - ChanceData interface{} `json:"chanceData,omitempty"` //机会数据(是否收藏/点赞 浏览数 点赞总数 评论数)ChanceData | 474 | + ChanceData interface{} `json:"statisticData,omitempty"` //机会数据(是否收藏/点赞 浏览数 点赞总数 评论数)ChanceData |
| 352 | Approve interface{} `json:"approve,omitempty"` //审核人 审核信息(时间) Approve | 475 | Approve interface{} `json:"approve,omitempty"` //审核人 审核信息(时间) Approve |
| 353 | ApproveData interface{} `json:"approveData,omitempty"` //审核数据(公开状态 评分) ApproveData | 476 | ApproveData interface{} `json:"approveData,omitempty"` //审核数据(公开状态 评分) ApproveData |
| 354 | Message interface{} `json:"message,omitempty"` //消息 | 477 | Message interface{} `json:"message,omitempty"` //消息 |
| 355 | - Comment interface{} `json:"comment,omitempty"` //评论 | ||
| 356 | - ChanceStatus int `json:"chanceStatus"` //0:正常 1.删除 2.关闭 | ||
| 357 | - ReviewStatus int `json:"reviewStatus"` //审核状态 | ||
| 358 | - | 478 | + CommentData interface{} `json:"commentData,omitempty"` //评论 |
| 479 | + CollectData interface{} `json:"collectData,omitempty"` //收藏数据 | ||
| 480 | + ThumbUpData interface{} `json:"thumbUpData,omitempty"` //点赞数据 | ||
| 359 | //我审核的-通过 | 481 | //我审核的-通过 |
| 360 | Score interface{} `json:"score,omitempty"` | 482 | Score interface{} `json:"score,omitempty"` |
| 361 | 483 | ||
| 362 | //模板 | 484 | //模板 |
| 363 | ChanceType interface{} `json:"chanceType,omitempty"` //机会类型 | 485 | ChanceType interface{} `json:"chanceType,omitempty"` //机会类型 |
| 364 | ChanceTemplate interface{} `json:"template,omitempty"` //机会模板 | 486 | ChanceTemplate interface{} `json:"template,omitempty"` //机会模板 |
| 487 | + | ||
| 488 | + //我评论的 评论数据 | ||
| 489 | + CommentedData interface{} `json:"commentedData,omitempty"` | ||
| 490 | + SourceType int `json:"sourceType,omitempty"` //类型 1:机会 2:评论 | ||
| 491 | + | ||
| 492 | + ChanceStatus int `json:"chanceStatus"` //0:正常 1.删除 2.关闭 | ||
| 493 | + ReviewStatus int `json:"reviewStatus"` //审核状态 | ||
| 365 | } | 494 | } |
| 366 | type ChanceItem struct { | 495 | type ChanceItem struct { |
| 367 | Id int64 `json:"id"` | 496 | Id int64 `json:"id"` |
| @@ -375,8 +504,28 @@ type ChanceItem struct { | @@ -375,8 +504,28 @@ type ChanceItem struct { | ||
| 375 | type ChanceData struct { | 504 | type ChanceData struct { |
| 376 | ThumbsUpTotal int `json:"thumbsupTotal"` //点赞总数 | 505 | ThumbsUpTotal int `json:"thumbsupTotal"` //点赞总数 |
| 377 | CommentTotal int `json:"commentTotal"` //评论总数 | 506 | CommentTotal int `json:"commentTotal"` //评论总数 |
| 378 | - PageViewTotal int `json:"pageView"` //评论总数 | 507 | + PageViewTotal int `json:"pageViewTotal"` //评论总数 |
| 379 | 508 | ||
| 380 | - IsThumbsUp bool `json:"thumbsup"` //是否点赞 1 点赞, 0 没有点赞 | 509 | + IsThumbsUp bool `json:"isThumbsUp"` //是否点赞 1 点赞, 0 没有点赞 |
| 381 | IsCollect bool `json:"isCollect"` //是否收藏 1 是 0 否 | 510 | IsCollect bool `json:"isCollect"` //是否收藏 1 是 0 否 |
| 382 | } | 511 | } |
| 512 | + | ||
| 513 | +//收藏数据 | ||
| 514 | +type CollectData struct { | ||
| 515 | + Id int64 `json:"id"` | ||
| 516 | + CollectTime int64 `json:"collectTime"` //收藏时间 | ||
| 517 | +} | ||
| 518 | + | ||
| 519 | +//点赞数据 | ||
| 520 | +type ThumbUpData struct { | ||
| 521 | + Id int64 `json:"id"` | ||
| 522 | + Content string `json:"content"` //点赞内容 | ||
| 523 | + ThumbUpTime int64 `json:"thumbUpTime"` //收藏时间 | ||
| 524 | +} | ||
| 525 | + | ||
| 526 | +//评论内容 | ||
| 527 | +type CommentData struct { | ||
| 528 | + Id int64 `json:"id"` //评论编号 | ||
| 529 | + Content string `json:"content"` //评论内容 | ||
| 530 | + CommentTime int64 `json:"commentTime"` //评论时间 | ||
| 531 | +} |
| @@ -94,4 +94,5 @@ type Score struct { | @@ -94,4 +94,5 @@ type Score struct { | ||
| 94 | ExtraScore float64 `json:"extraScore"` //额外分 | 94 | ExtraScore float64 `json:"extraScore"` //额外分 |
| 95 | ValueScore float64 `json:"valueScore"` //价值分 | 95 | ValueScore float64 `json:"valueScore"` //价值分 |
| 96 | DiscoveryScore float64 `json:"discoveryScore"` //发现分 | 96 | DiscoveryScore float64 `json:"discoveryScore"` //发现分 |
| 97 | + DiscoveryScorePercent int `json:"discoveryScorePercent"` //发现分-百分比 | ||
| 97 | } | 98 | } |
| @@ -9,7 +9,7 @@ const ( | @@ -9,7 +9,7 @@ const ( | ||
| 9 | /*IComment */ | 9 | /*IComment */ |
| 10 | type ICommentRequest struct { | 10 | type ICommentRequest struct { |
| 11 | Content string `json:"content" valid:"Required"` | 11 | Content string `json:"content" valid:"Required"` |
| 12 | - SourceType int `json:"type" valid:"Required"` | 12 | + SourceType int `json:"type" valid:"Required"` //1.机会 2:评论 |
| 13 | Id int64 `json:"id" valid:"Required"` | 13 | Id int64 `json:"id" valid:"Required"` |
| 14 | } | 14 | } |
| 15 | type ICommentResponse struct { | 15 | type ICommentResponse struct { |
| @@ -39,23 +39,42 @@ type CommentsRequest struct { | @@ -39,23 +39,42 @@ type CommentsRequest struct { | ||
| 39 | LastId int64 `json:"lastId"` | 39 | LastId int64 `json:"lastId"` |
| 40 | PageSize int `json:"pageSize" valid:"Required"` | 40 | PageSize int `json:"pageSize" valid:"Required"` |
| 41 | SourceId int64 `json:"id" valid:"Required"` | 41 | SourceId int64 `json:"id" valid:"Required"` |
| 42 | - SourceType int | 42 | + SourceType int `json:"sourceType" valid:"Required"` //1:机会 2:评论 |
| 43 | } | 43 | } |
| 44 | type CommentsResponse struct { | 44 | type CommentsResponse struct { |
| 45 | - Total int `json:"total"` | ||
| 46 | Comments []*Comments `json:"comments"` | 45 | Comments []*Comments `json:"comments"` |
| 46 | + Total int `json:"total"` | ||
| 47 | +} | ||
| 48 | + | ||
| 49 | +/*Thumbsups 点赞列表*/ | ||
| 50 | +type ThumbsupsRequest struct { | ||
| 51 | + LastId int64 `json:"lastId"` | ||
| 52 | + PageSize int `json:"pageSize" valid:"Required"` | ||
| 53 | + SourceId int64 `json:"id" valid:"Required"` | ||
| 54 | + SourceType int `json:"sourceType" valid:"Required"` //1:机会 2:评论 | ||
| 55 | +} | ||
| 56 | +type ThumbsupsResponse struct { | ||
| 57 | + Thumbups []*Thumbups `json:"thumbups"` | ||
| 58 | + Total int `json:"total"` | ||
| 47 | } | 59 | } |
| 48 | 60 | ||
| 49 | /*评论列表*/ | 61 | /*评论列表*/ |
| 50 | type Comments struct { | 62 | type Comments struct { |
| 51 | Id int64 `json:"id"` | 63 | Id int64 `json:"id"` |
| 52 | - Provider *BaseUserInfo `json:"provider"` | 64 | + CreateTime int64 `json:"createTime"` |
| 53 | Content string `json:"content"` | 65 | Content string `json:"content"` |
| 54 | - ViewTotal int `json:"pageView"` | 66 | + Provider *BaseUserInfo `json:"provider"` |
| 67 | + | ||
| 68 | + ViewTotal int `json:"pageViewTotal"` | ||
| 55 | CommentTotal int `json:"commentTotal"` | 69 | CommentTotal int `json:"commentTotal"` |
| 56 | - ZanTotal int `json:"zanTotal"` | 70 | + ZanTotal int `json:"thumbsupTotal"` |
| 71 | + IsZan int `json:"isThumbsUp"` //0:未点赞 1:点赞 | ||
| 72 | +} | ||
| 73 | + | ||
| 74 | +type Thumbups struct { | ||
| 75 | + Id int64 `json:"id"` | ||
| 57 | CreateTime int64 `json:"createTime"` | 76 | CreateTime int64 `json:"createTime"` |
| 58 | - IsZan int `json:"is_zan"` //0:未点赞 1:点赞 | 77 | + Provider *BaseUserInfo `json:"provider"` |
| 59 | } | 78 | } |
| 60 | 79 | ||
| 61 | /*CommentDetailsMulti */ | 80 | /*CommentDetailsMulti */ |
| @@ -13,3 +13,11 @@ func Test_Err(t *testing.T) { | @@ -13,3 +13,11 @@ func Test_Err(t *testing.T) { | ||
| 13 | bt2, _ := json.Marshal(normalmsg) | 13 | bt2, _ := json.Marshal(normalmsg) |
| 14 | t.Log(string(bt2)) | 14 | t.Log(string(bt2)) |
| 15 | } | 15 | } |
| 16 | + | ||
| 17 | +func Test_Ceil(t *testing.T) { | ||
| 18 | + value := 90.12 | ||
| 19 | + intValue := int(value) | ||
| 20 | + t.Log(intValue) | ||
| 21 | + | ||
| 22 | + t.Log(0.38 * 0.3) | ||
| 23 | +} |
| @@ -42,9 +42,21 @@ var errmessge ErrorMap = map[int]string{ | @@ -42,9 +42,21 @@ var errmessge ErrorMap = map[int]string{ | ||
| 42 | 5203: "审批服务器操作失败", | 42 | 5203: "审批服务器操作失败", |
| 43 | 5204: "评分或者公开状态不能为空", | 43 | 5204: "评分或者公开状态不能为空", |
| 44 | 5205: "机会未审核通过,不能修改评分或者公开状态", | 44 | 5205: "机会未审核通过,不能修改评分或者公开状态", |
| 45 | + 5206: "未找到审批节点或者无权限", | ||
| 45 | 46 | ||
| 46 | //模板相关 | 47 | //模板相关 |
| 47 | 5301: "机会模板不存在", | 48 | 5301: "机会模板不存在", |
| 49 | + | ||
| 50 | + //消息相关 | ||
| 51 | + 5401: "消息不存在", | ||
| 52 | + | ||
| 53 | + //评分相关 | ||
| 54 | + 5501: "基础评分不符合要求", | ||
| 55 | + 5502: "附加评分不符合要求", | ||
| 56 | + 5503: "价值评分不符合要求", | ||
| 57 | + | ||
| 58 | + 5510: "评分配置不存在,请联系管理员", | ||
| 59 | + 5511: "发现分计算不一致,请重新提交", | ||
| 48 | } | 60 | } |
| 49 | 61 | ||
| 50 | const ( | 62 | const ( |
| @@ -52,7 +64,7 @@ const ( | @@ -52,7 +64,7 @@ const ( | ||
| 52 | MsgTypeCommend = 2 //表彰 | 64 | MsgTypeCommend = 2 //表彰 |
| 53 | MsgTypeInteraction = 4 //互动消息 | 65 | MsgTypeInteraction = 4 //互动消息 |
| 54 | MsgTypeAudit = 8 //机会审核 | 66 | MsgTypeAudit = 8 //机会审核 |
| 55 | - MsgTypeAuditBy = 16 //机会被审核消息 | 67 | + MsgTypeAuditBy = 16 //机会被审核消息-我提交的 |
| 56 | MsgTypeComment = 32 //评论 | 68 | MsgTypeComment = 32 //评论 |
| 57 | MsgTypeThumbUp = 64 //点赞 | 69 | MsgTypeThumbUp = 64 //点赞 |
| 58 | ) | 70 | ) |
| @@ -61,6 +73,9 @@ var ( | @@ -61,6 +73,9 @@ var ( | ||
| 61 | MessageApproving = "提交了一条%v机会消息,需要您审核" | 73 | MessageApproving = "提交了一条%v机会消息,需要您审核" |
| 62 | MessageApproveSuccess = "审核通过你提交的%v机会" | 74 | MessageApproveSuccess = "审核通过你提交的%v机会" |
| 63 | MessageApproveReject = "退回您了提交的%v机会" | 75 | MessageApproveReject = "退回您了提交的%v机会" |
| 76 | + | ||
| 77 | + MessageZanChance = "点赞了您发布的机会" | ||
| 78 | + MessageZanComment = "点赞了您发布的评论" | ||
| 64 | ) | 79 | ) |
| 65 | 80 | ||
| 66 | /*MessageCenter */ | 81 | /*MessageCenter */ |
| @@ -104,12 +119,14 @@ type MsgInteractiveResponse struct { | @@ -104,12 +119,14 @@ type MsgInteractiveResponse struct { | ||
| 104 | } | 119 | } |
| 105 | 120 | ||
| 106 | type UserMsg struct { | 121 | type UserMsg struct { |
| 107 | - Id int64 `json:"msgId"` | 122 | + MsgId int64 `json:"msgId"` |
| 123 | + BulletinId int64 `json:"-"` | ||
| 108 | SourceType int `json:"msgType"` | 124 | SourceType int `json:"msgType"` |
| 109 | Content string `json:"content"` | 125 | Content string `json:"content"` |
| 110 | CreateAt int64 `json:"msgTime"` | 126 | CreateAt int64 `json:"msgTime"` |
| 111 | IsRead int `json:"isRead"` | 127 | IsRead int `json:"isRead"` |
| 112 | //机会 //评论 | 128 | //机会 //评论 |
| 129 | + Link string `json:"link,omitempty"` | ||
| 113 | } | 130 | } |
| 114 | 131 | ||
| 115 | type Message struct { | 132 | type Message struct { |
| @@ -206,6 +223,36 @@ type MsgChanceApproveResponse struct { | @@ -206,6 +223,36 @@ type MsgChanceApproveResponse struct { | ||
| 206 | Total int `json:"total"` | 223 | Total int `json:"total"` |
| 207 | } | 224 | } |
| 208 | 225 | ||
| 226 | +/*MsgChanceSubmit 我提交的*/ | ||
| 227 | +type MsgChanceSubmitRequest struct { | ||
| 228 | + LastId int64 `json:"lastId"` | ||
| 229 | + PageSize int `json:"pageSize" valid:"Required"` | ||
| 230 | +} | ||
| 231 | +type MsgChanceSubmitResponse struct { | ||
| 232 | + List []CommonListItem `json:"list"` | ||
| 233 | + Total int `json:"total"` | ||
| 234 | +} | ||
| 235 | + | ||
| 236 | +/*MsgChanceComment 消息中心-互动消息.评论*/ | ||
| 237 | +type MsgChanceCommentRequest struct { | ||
| 238 | + LastId int64 `json:"lastId"` | ||
| 239 | + PageSize int `json:"pageSize" valid:"Required"` | ||
| 240 | +} | ||
| 241 | +type MsgChanceCommentResponse struct { | ||
| 242 | + List []CommonListItem `json:"list"` | ||
| 243 | + Total int `json:"total"` | ||
| 244 | +} | ||
| 245 | + | ||
| 246 | +/*MsgChanceThumbUp 息中心-互动消息.点赞*/ | ||
| 247 | +type MsgChanceThumbUpRequest struct { | ||
| 248 | + LastId int64 `json:"lastId"` | ||
| 249 | + PageSize int `json:"pageSize" valid:"Required"` | ||
| 250 | +} | ||
| 251 | +type MsgChanceThumbUpResponse struct { | ||
| 252 | + List []CommonListItem `json:"list"` | ||
| 253 | + Total int `json:"total"` | ||
| 254 | +} | ||
| 255 | + | ||
| 209 | //我的审核机会列表 | 256 | //我的审核机会列表 |
| 210 | type MsgChanceApproveItemOrm struct { | 257 | type MsgChanceApproveItemOrm struct { |
| 211 | ChanceUserId int64 `orm:"column(chance_user_id)"` | 258 | ChanceUserId int64 `orm:"column(chance_user_id)"` |
| @@ -177,6 +177,22 @@ func init() { | @@ -177,6 +177,22 @@ func init() { | ||
| 177 | 177 | ||
| 178 | beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"], | 178 | beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"], |
| 179 | beego.ControllerComments{ | 179 | beego.ControllerComments{ |
| 180 | + Method: "MyCollectChance", | ||
| 181 | + Router: `/myCollectChance`, | ||
| 182 | + AllowHTTPMethods: []string{"post"}, | ||
| 183 | + MethodParams: param.Make(), | ||
| 184 | + Params: nil}) | ||
| 185 | + | ||
| 186 | + beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"], | ||
| 187 | + beego.ControllerComments{ | ||
| 188 | + Method: "MyComment", | ||
| 189 | + Router: `/myComment`, | ||
| 190 | + AllowHTTPMethods: []string{"post"}, | ||
| 191 | + MethodParams: param.Make(), | ||
| 192 | + Params: nil}) | ||
| 193 | + | ||
| 194 | + beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"], | ||
| 195 | + beego.ControllerComments{ | ||
| 180 | Method: "MySubmitChance", | 196 | Method: "MySubmitChance", |
| 181 | Router: `/mySubmitChance`, | 197 | Router: `/mySubmitChance`, |
| 182 | AllowHTTPMethods: []string{"post"}, | 198 | AllowHTTPMethods: []string{"post"}, |
| @@ -185,6 +201,14 @@ func init() { | @@ -185,6 +201,14 @@ func init() { | ||
| 185 | 201 | ||
| 186 | beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"], | 202 | beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"], |
| 187 | beego.ControllerComments{ | 203 | beego.ControllerComments{ |
| 204 | + Method: "MyThumbUpChance", | ||
| 205 | + Router: `/myThumbUpChance`, | ||
| 206 | + AllowHTTPMethods: []string{"post"}, | ||
| 207 | + MethodParams: param.Make(), | ||
| 208 | + Params: nil}) | ||
| 209 | + | ||
| 210 | + beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"], | ||
| 211 | + beego.ControllerComments{ | ||
| 188 | Method: "Permission", | 212 | Method: "Permission", |
| 189 | Router: `/permission`, | 213 | Router: `/permission`, |
| 190 | AllowHTTPMethods: []string{"post"}, | 214 | AllowHTTPMethods: []string{"post"}, |
| @@ -223,6 +247,14 @@ func init() { | @@ -223,6 +247,14 @@ func init() { | ||
| 223 | MethodParams: param.Make(), | 247 | MethodParams: param.Make(), |
| 224 | Params: nil}) | 248 | Params: nil}) |
| 225 | 249 | ||
| 250 | + beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"], | ||
| 251 | + beego.ControllerComments{ | ||
| 252 | + Method: "Thumbsups", | ||
| 253 | + Router: `/thumbsups`, | ||
| 254 | + AllowHTTPMethods: []string{"post"}, | ||
| 255 | + MethodParams: param.Make(), | ||
| 256 | + Params: nil}) | ||
| 257 | + | ||
| 226 | beego.GlobalControllerRouter["opp/controllers/v1:CommendController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:CommendController"], | 258 | beego.GlobalControllerRouter["opp/controllers/v1:CommendController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:CommendController"], |
| 227 | beego.ControllerComments{ | 259 | beego.ControllerComments{ |
| 228 | Method: "Company", | 260 | Method: "Company", |
| @@ -297,6 +329,30 @@ func init() { | @@ -297,6 +329,30 @@ func init() { | ||
| 297 | 329 | ||
| 298 | beego.GlobalControllerRouter["opp/controllers/v1:MessageController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:MessageController"], | 330 | beego.GlobalControllerRouter["opp/controllers/v1:MessageController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:MessageController"], |
| 299 | beego.ControllerComments{ | 331 | beego.ControllerComments{ |
| 332 | + Method: "MsgChanceComment", | ||
| 333 | + Router: `/msgChanceComment`, | ||
| 334 | + AllowHTTPMethods: []string{"post"}, | ||
| 335 | + MethodParams: param.Make(), | ||
| 336 | + Params: nil}) | ||
| 337 | + | ||
| 338 | + beego.GlobalControllerRouter["opp/controllers/v1:MessageController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:MessageController"], | ||
| 339 | + beego.ControllerComments{ | ||
| 340 | + Method: "MsgChanceSubmit", | ||
| 341 | + Router: `/msgChanceSubmit`, | ||
| 342 | + AllowHTTPMethods: []string{"post"}, | ||
| 343 | + MethodParams: param.Make(), | ||
| 344 | + Params: nil}) | ||
| 345 | + | ||
| 346 | + beego.GlobalControllerRouter["opp/controllers/v1:MessageController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:MessageController"], | ||
| 347 | + beego.ControllerComments{ | ||
| 348 | + Method: "MsgChanceThumbUp", | ||
| 349 | + Router: `/msgChanceThumbUp`, | ||
| 350 | + AllowHTTPMethods: []string{"post"}, | ||
| 351 | + MethodParams: param.Make(), | ||
| 352 | + Params: nil}) | ||
| 353 | + | ||
| 354 | + beego.GlobalControllerRouter["opp/controllers/v1:MessageController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:MessageController"], | ||
| 355 | + beego.ControllerComments{ | ||
| 300 | Method: "MsgCompanyNotice", | 356 | Method: "MsgCompanyNotice", |
| 301 | Router: `/msgCompanyNotice`, | 357 | Router: `/msgCompanyNotice`, |
| 302 | AllowHTTPMethods: []string{"post"}, | 358 | AllowHTTPMethods: []string{"post"}, |
| @@ -185,6 +185,7 @@ func GetChanceMarkData(userId, companyId int64, sourceId int64) (flag int, err e | @@ -185,6 +185,7 @@ func GetChanceMarkData(userId, companyId int64, sourceId int64) (flag int, err e | ||
| 185 | ) | 185 | ) |
| 186 | if v, err = models.GetChanceFavorite(userId, companyId, sourceId, protocol.SourceTypeChance); err != nil { | 186 | if v, err = models.GetChanceFavorite(userId, companyId, sourceId, protocol.SourceTypeChance); err != nil { |
| 187 | if err == orm.ErrNoRows { | 187 | if err == orm.ErrNoRows { |
| 188 | + //log.Error(userId, companyId, sourceId, err) | ||
| 188 | return 0, nil | 189 | return 0, nil |
| 189 | } | 190 | } |
| 190 | return | 191 | return |
| @@ -2,8 +2,10 @@ package agg | @@ -2,8 +2,10 @@ package agg | ||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "fmt" | 4 | "fmt" |
| 5 | + "github.com/astaxie/beego/orm" | ||
| 5 | "gitlab.fjmaimaimai.com/mmm-go/gocomm/identity/idgen" | 6 | "gitlab.fjmaimaimai.com/mmm-go/gocomm/identity/idgen" |
| 6 | "gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log" | 7 | "gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log" |
| 8 | + "opp/internal/utils" | ||
| 7 | "opp/models" | 9 | "opp/models" |
| 8 | "opp/protocol" | 10 | "opp/protocol" |
| 9 | "time" | 11 | "time" |
| @@ -134,6 +136,16 @@ func SendMsg(receiverId int64, name string, companyId int64, sourceId int64, sou | @@ -134,6 +136,16 @@ func SendMsg(receiverId int64, name string, companyId int64, sourceId int64, sou | ||
| 134 | return | 136 | return |
| 135 | } | 137 | } |
| 136 | 138 | ||
| 139 | +//删除已发送的消息 | ||
| 140 | +func DeleteSendedMsg(sourceId int64, sourceType int, receiverId int64, msgType int) (err error) { | ||
| 141 | + o := orm.NewOrm() | ||
| 142 | + log.Info(fmt.Sprintf("删除消息 接收者:%v 来源编号:%v 来源类型:%v 消息类型:%v", receiverId, sourceId, sourceType, msgType)) | ||
| 143 | + if err = utils.ExecuteSQLWithOrmer(o, models.SqlDeleteUserMsg, sourceId, sourceType, receiverId, msgType); err != nil { | ||
| 144 | + log.Error(err) | ||
| 145 | + } | ||
| 146 | + return | ||
| 147 | +} | ||
| 148 | + | ||
| 137 | //打印消息日志 | 149 | //打印消息日志 |
| 138 | func logMsg(msg *models.UserMsg, name string) { | 150 | func logMsg(msg *models.UserMsg, name string) { |
| 139 | log.Info(fmt.Sprintf("发送消息 消息类型:%v Receiver:%v(%v) Message:%v SourceId:%v SourceType:%v", | 151 | log.Info(fmt.Sprintf("发送消息 消息类型:%v Receiver:%v(%v) Message:%v SourceId:%v SourceType:%v", |
| @@ -52,7 +52,7 @@ func (s SuplusApprove) NewApproveInstance(header *protocol.RequestHeader, proces | @@ -52,7 +52,7 @@ func (s SuplusApprove) NewApproveInstance(header *protocol.RequestHeader, proces | ||
| 52 | Approver: userCompany.NickName, | 52 | Approver: userCompany.NickName, |
| 53 | Uid: userCompany.Id, | 53 | Uid: userCompany.Id, |
| 54 | Sign: ApproveSign, | 54 | Sign: ApproveSign, |
| 55 | - Type: 1, | 55 | + Type: 2, |
| 56 | } | 56 | } |
| 57 | for i := range process { | 57 | for i := range process { |
| 58 | var ( | 58 | var ( |
| @@ -274,6 +274,7 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | @@ -274,6 +274,7 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | ||
| 274 | approveItemResponse ApproveItemResponse | 274 | approveItemResponse ApproveItemResponse |
| 275 | mapProcess = make(map[string]interface{}) | 275 | mapProcess = make(map[string]interface{}) |
| 276 | mapChance = make(map[string]interface{}) | 276 | mapChance = make(map[string]interface{}) |
| 277 | + result *protocol.ChanceCalculateScoreResponse | ||
| 277 | ) | 278 | ) |
| 278 | rsp = &protocol.ChanceApproveResponse{} | 279 | rsp = &protocol.ChanceApproveResponse{} |
| 279 | //TODO:测试注入 | 280 | //TODO:测试注入 |
| @@ -298,7 +299,7 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | @@ -298,7 +299,7 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | ||
| 298 | } | 299 | } |
| 299 | if process, err = models.GetAuditFlowProcessBy(request.ProcessId, header.UserId); err != nil { | 300 | if process, err = models.GetAuditFlowProcessBy(request.ProcessId, header.UserId); err != nil { |
| 300 | log.Error(request.ProcessId, header.UserId, err) | 301 | log.Error(request.ProcessId, header.UserId, err) |
| 301 | - err = protocol.NewErrWithMessage(5202) | 302 | + err = protocol.NewErrWithMessage(5206) |
| 302 | return | 303 | return |
| 303 | } | 304 | } |
| 304 | if chance.ReviewStatus != protocol.ReviewStatusAuditging { | 305 | if chance.ReviewStatus != protocol.ReviewStatusAuditging { |
| @@ -307,6 +308,16 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | @@ -307,6 +308,16 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | ||
| 307 | return | 308 | return |
| 308 | } | 309 | } |
| 309 | { | 310 | { |
| 311 | + //计算发现分 | ||
| 312 | + if result, err = ChanceCalculateScore(header, &protocol.ChanceCalculateScoreRequest{Score: request.ApproveData.Score}); err != nil { | ||
| 313 | + log.Error("计算发现分错误:", err) | ||
| 314 | + //err = protocol.NewErrWithMessage(5511) | ||
| 315 | + return | ||
| 316 | + } | ||
| 317 | + request.ApproveData.Score.DiscoveryScore = result.DiscoveryScore | ||
| 318 | + request.ApproveData.Score.DiscoveryScorePercent = result.DiscoveryScorePercent | ||
| 319 | + } | ||
| 320 | + { | ||
| 310 | mapProcess["ReviewStatus"] = int8(request.ReviewStatus) | 321 | mapProcess["ReviewStatus"] = int8(request.ReviewStatus) |
| 311 | mapProcess["ApproveTime"] = time.Now() | 322 | mapProcess["ApproveTime"] = time.Now() |
| 312 | if request.ReviewStatus == protocol.ReviewStatusPass { | 323 | if request.ReviewStatus == protocol.ReviewStatusPass { |
| @@ -332,29 +343,42 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | @@ -332,29 +343,42 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | ||
| 332 | return | 343 | return |
| 333 | } | 344 | } |
| 334 | log.Info(fmt.Sprintf("用户%v 更新机会审核状态 process_id:%v 状态:%v", header.UserId, process.Id, request.ReviewStatus)) | 345 | log.Info(fmt.Sprintf("用户%v 更新机会审核状态 process_id:%v 状态:%v", header.UserId, process.Id, request.ReviewStatus)) |
| 346 | + orm := orm.NewOrm() | ||
| 347 | + orm.Begin() | ||
| 348 | + if request.ReviewStatus == protocol.ReviewStatusReturn { | ||
| 349 | + mapChance["ReviewStatus"] = int8(request.ReviewStatus) //退回也要更新审核状态 | ||
| 350 | + //增加一条待处理记录到审核列表 | ||
| 351 | + //生成提交记录 | ||
| 352 | + if _, err = orm.Insert(GenAuditFlowProcess_Submit(header, chance.Id, chance.AuditTemplateId, protocol.ReviewStatusWait)); err != nil { | ||
| 353 | + log.Error(err) | ||
| 354 | + orm.Rollback() | ||
| 355 | + return | ||
| 356 | + } | ||
| 357 | + } | ||
| 335 | { | 358 | { |
| 336 | //更新下一批次的审核人 | 359 | //更新下一批次的审核人 |
| 337 | var nextApprovers []int64 | 360 | var nextApprovers []int64 |
| 361 | + if err = agg.SendApprovedMsg(chance.UserId, "", | ||
| 362 | + header.CompanyId, chance.Id, chance.ChanceTypeId, request.ReviewStatus, protocol.MsgTypeAuditBy); err != nil { | ||
| 363 | + log.Error(err) | ||
| 364 | + orm.Rollback() | ||
| 365 | + return | ||
| 366 | + } | ||
| 338 | if approveItemResponse.IsOver == 1 { | 367 | if approveItemResponse.IsOver == 1 { |
| 339 | //结束审批 | 368 | //结束审批 |
| 340 | { | 369 | { |
| 341 | mapChance["ReviewStatus"] = int8(request.ReviewStatus) | 370 | mapChance["ReviewStatus"] = int8(request.ReviewStatus) |
| 342 | } | 371 | } |
| 343 | //发送审核结果消息给提交人 | 372 | //发送审核结果消息给提交人 |
| 344 | - for i := range approveItemResponse.MessageData.ApplyUserMessage { | ||
| 345 | - message := approveItemResponse.MessageData.ApplyUserMessage[i] | ||
| 346 | - nextApprovers = append(nextApprovers, message.ReceiverInfo.ReceiverUid) | ||
| 347 | - if err = agg.SendApproveMsg(message.ReceiverInfo.ReceiverUid, message.ReceiverInfo.ReceiverName, | ||
| 348 | - header.CompanyId, chance.Id, chance.ChanceTypeId, request.ReviewStatus); err != nil { | ||
| 349 | - log.Error(err) | ||
| 350 | - return | ||
| 351 | - } | ||
| 352 | - } | ||
| 353 | - //更新同批次的为审核的状态置为无效 | ||
| 354 | - if err = models.UpdatetAuditFlowProcessNoApprove(chance.Id, chance.AuditLevel, protocol.ReviewStatusAuditging); err != nil { | ||
| 355 | - log.Error(err) | ||
| 356 | - return | ||
| 357 | - } | 373 | + //for i := range approveItemResponse.MessageData.ApplyUserMessage { |
| 374 | + // message := approveItemResponse.MessageData.ApplyUserMessage[i] | ||
| 375 | + // nextApprovers = append(nextApprovers, message.ReceiverInfo.ReceiverUid) | ||
| 376 | + // if err = agg.SendApprovedMsg(message.ReceiverInfo.ReceiverUid, message.ReceiverInfo.ReceiverName, | ||
| 377 | + // header.CompanyId, chance.Id, chance.ChanceTypeId, request.ReviewStatus, protocol.MsgTypeAuditBy); err != nil { | ||
| 378 | + // log.Error(err) | ||
| 379 | + // return | ||
| 380 | + // } | ||
| 381 | + //} | ||
| 358 | } else { | 382 | } else { |
| 359 | //发送下一个消息给下一流程的审核人 | 383 | //发送下一个消息给下一流程的审核人 |
| 360 | for i := range approveItemResponse.MessageData.ApproveMessage { | 384 | for i := range approveItemResponse.MessageData.ApproveMessage { |
| @@ -363,26 +387,27 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | @@ -363,26 +387,27 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | ||
| 363 | if err = agg.SendApproveMsg(message.ReceiverInfo.ReceiverUid, message.ReceiverInfo.ReceiverName, | 387 | if err = agg.SendApproveMsg(message.ReceiverInfo.ReceiverUid, message.ReceiverInfo.ReceiverName, |
| 364 | header.CompanyId, chance.Id, chance.ChanceTypeId, protocol.ReviewStatusAuditging); err != nil { | 388 | header.CompanyId, chance.Id, chance.ChanceTypeId, protocol.ReviewStatusAuditging); err != nil { |
| 365 | log.Error(err) | 389 | log.Error(err) |
| 390 | + orm.Rollback() | ||
| 366 | return | 391 | return |
| 367 | } | 392 | } |
| 368 | } | 393 | } |
| 369 | //更新下一批次的审核人 同批次的为审核的状态置为无效 | 394 | //更新下一批次的审核人 同批次的为审核的状态置为无效 |
| 370 | if len(nextApprovers) != 0 { | 395 | if len(nextApprovers) != 0 { |
| 371 | - if err = models.UpdatetAuditFlowProcessToNext(chance.Id, chance.AuditLevel+1, nextApprovers); err != nil { | 396 | + if err = models.UpdatetAuditFlowProcessToNext(orm, chance.Id, chance.AuditLevel+1, nextApprovers); err != nil { |
| 372 | log.Error(err) | 397 | log.Error(err) |
| 398 | + orm.Rollback() | ||
| 373 | log.Info(fmt.Sprintf("更新机会失败 chance_id:%v 下一批次审批人员:%v", chance.Id, nextApprovers)) | 399 | log.Info(fmt.Sprintf("更新机会失败 chance_id:%v 下一批次审批人员:%v", chance.Id, nextApprovers)) |
| 374 | return | 400 | return |
| 375 | } | 401 | } |
| 376 | log.Info(fmt.Sprintf("更新机会 chance_id:%v 下一批次审批人员:%v", chance.Id, nextApprovers)) | 402 | log.Info(fmt.Sprintf("更新机会 chance_id:%v 下一批次审批人员:%v", chance.Id, nextApprovers)) |
| 377 | - if err = models.UpdatetAuditFlowProcessNoApprove(chance.Id, chance.AuditLevel, protocol.ReviewStatusAuditging); err != nil { | 403 | + if err = models.UpdatetAuditFlowProcessNoApprove(orm, chance.Id, chance.AuditLevel, protocol.ReviewStatusAuditging); err != nil { |
| 378 | log.Error(err) | 404 | log.Error(err) |
| 405 | + orm.Rollback() | ||
| 379 | return | 406 | return |
| 380 | } | 407 | } |
| 381 | } | 408 | } |
| 382 | } | 409 | } |
| 383 | } | 410 | } |
| 384 | - orm := orm.NewOrm() | ||
| 385 | - orm.Begin() | ||
| 386 | if err = utils.UpdateTableByMapWithOrmer(orm, process, mapProcess); err != nil { | 411 | if err = utils.UpdateTableByMapWithOrmer(orm, process, mapProcess); err != nil { |
| 387 | log.Error("更新机会审核流程 状态失败 process_id:", process.Id, err) | 412 | log.Error("更新机会审核流程 状态失败 process_id:", process.Id, err) |
| 388 | orm.Rollback() | 413 | orm.Rollback() |
| @@ -393,6 +418,14 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | @@ -393,6 +418,14 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | ||
| 393 | log.Error("更新机会审核状态失败 chance_id:", chance.Id, err) | 418 | log.Error("更新机会审核状态失败 chance_id:", chance.Id, err) |
| 394 | return | 419 | return |
| 395 | } | 420 | } |
| 421 | + if request.ReviewStatus == protocol.ReviewStatusReturn || approveItemResponse.IsOver == 1 { | ||
| 422 | + //更新同批次的为审核的状态置为无效 | ||
| 423 | + if err = models.UpdatetAuditFlowProcessNoApprove(orm, chance.Id, chance.AuditLevel, protocol.ReviewStatusAuditging); err != nil { | ||
| 424 | + log.Error(err) | ||
| 425 | + orm.Rollback() | ||
| 426 | + return | ||
| 427 | + } | ||
| 428 | + } | ||
| 396 | if request.ApproveData.PublicData.PublishStatus == protocol.PublicToDepartment { | 429 | if request.ApproveData.PublicData.PublishStatus == protocol.PublicToDepartment { |
| 397 | if err = utils.ExecuteSQLWithOrmer(orm, models.SqlDeleteChanceDepartment, chance.Id); err != nil { | 430 | if err = utils.ExecuteSQLWithOrmer(orm, models.SqlDeleteChanceDepartment, chance.Id); err != nil { |
| 398 | log.Error(err) | 431 | log.Error(err) |
| @@ -469,12 +502,13 @@ func ChanceApproveProcess(header *protocol.RequestHeader, chance *models.Chance) | @@ -469,12 +502,13 @@ func ChanceApproveProcess(header *protocol.RequestHeader, chance *models.Chance) | ||
| 469 | item := &protocol.ProcessItem{ | 502 | item := &protocol.ProcessItem{ |
| 470 | Id: process.Id, | 503 | Id: process.Id, |
| 471 | ReviewStatus: int(process.ReviewStatus), | 504 | ReviewStatus: int(process.ReviewStatus), |
| 472 | - ApproveWay: int(process.AuditFlowType), | 505 | + ApproveWay: int(process.ActionType), |
| 506 | + ApproveType: process.AuditFlowType, | ||
| 473 | Uid: process.Uid, | 507 | Uid: process.Uid, |
| 474 | Name: process.UserName, | 508 | Name: process.UserName, |
| 475 | } | 509 | } |
| 476 | - if item.ApproveWay == protocol.AuditBySpecailUser { | ||
| 477 | - item.ApproveWay = protocol.AuditByUser | 510 | + if item.ApproveType == protocol.AuditBySpecailUser { |
| 511 | + item.ApproveType = protocol.AuditByUser | ||
| 478 | } | 512 | } |
| 479 | if item.ReviewStatus != protocol.ReviewStatusAuditging { | 513 | if item.ReviewStatus != protocol.ReviewStatusAuditging { |
| 480 | item.ApproveTime = process.ApproveTime.Unix() * 1000 | 514 | item.ApproveTime = process.ApproveTime.Unix() * 1000 |
| @@ -65,13 +65,15 @@ func SympathyAction(header *protocol.RequestHeader, request *protocol.SympathyAc | @@ -65,13 +65,15 @@ func SympathyAction(header *protocol.RequestHeader, request *protocol.SympathyAc | ||
| 65 | chanceType int | 65 | chanceType int |
| 66 | incre int = 1 | 66 | incre int = 1 |
| 67 | table string = "comment" | 67 | table string = "comment" |
| 68 | + message string = protocol.MessageZanComment | ||
| 68 | ) | 69 | ) |
| 69 | rsp = &protocol.SympathyActionResponse{} | 70 | rsp = &protocol.SympathyActionResponse{} |
| 70 | - if chanceFavoirte, err = models.GetChanceFavorite(header.Uid, header.CompanyId, request.Id, request.SourceType); err != nil && err != orm.ErrNoRows { | 71 | + if chanceFavoirte, err = models.GetChanceFavorite(header.UserId, header.CompanyId, request.Id, request.SourceType); err != nil && err != orm.ErrNoRows { |
| 71 | log.Error(err) | 72 | log.Error(err) |
| 72 | return | 73 | return |
| 73 | } | 74 | } |
| 74 | if request.SourceType == protocol.SourceTypeChance { | 75 | if request.SourceType == protocol.SourceTypeChance { |
| 76 | + message = protocol.MessageZanChance | ||
| 75 | if chance, err = models.GetChanceById(request.Id); err != nil { | 77 | if chance, err = models.GetChanceById(request.Id); err != nil { |
| 76 | log.Error("机会不存在", err) | 78 | log.Error("机会不存在", err) |
| 77 | return | 79 | return |
| @@ -102,7 +104,7 @@ func SympathyAction(header *protocol.RequestHeader, request *protocol.SympathyAc | @@ -102,7 +104,7 @@ func SympathyAction(header *protocol.RequestHeader, request *protocol.SympathyAc | ||
| 102 | } | 104 | } |
| 103 | } | 105 | } |
| 104 | if exists { | 106 | if exists { |
| 105 | - if err = models.UpdateChanceFavorite(header.Uid, header.CompanyId, request.Id, 1<<(uint(request.MarkType-1))); err != nil { | 107 | + if err = models.UpdateChanceFavorite(header.UserId, header.CompanyId, request.Id, 1<<(uint(request.MarkType-1))); err != nil { |
| 106 | log.Error(request.MarkType, err) | 108 | log.Error(request.MarkType, err) |
| 107 | return | 109 | return |
| 108 | } | 110 | } |
| @@ -111,7 +113,7 @@ func SympathyAction(header *protocol.RequestHeader, request *protocol.SympathyAc | @@ -111,7 +113,7 @@ func SympathyAction(header *protocol.RequestHeader, request *protocol.SympathyAc | ||
| 111 | //add | 113 | //add |
| 112 | chanceFavoirte = &models.ChanceFavorite{ | 114 | chanceFavoirte = &models.ChanceFavorite{ |
| 113 | Id: idgen.Next(), | 115 | Id: idgen.Next(), |
| 114 | - UserId: header.Uid, | 116 | + UserId: header.UserId, |
| 115 | CompanyId: header.CompanyId, | 117 | CompanyId: header.CompanyId, |
| 116 | MarkFlag: request.SympathyType, | 118 | MarkFlag: request.SympathyType, |
| 117 | SourceType: request.SourceType, | 119 | SourceType: request.SourceType, |
| @@ -124,7 +126,7 @@ func SympathyAction(header *protocol.RequestHeader, request *protocol.SympathyAc | @@ -124,7 +126,7 @@ func SympathyAction(header *protocol.RequestHeader, request *protocol.SympathyAc | ||
| 124 | log.Error(err) | 126 | log.Error(err) |
| 125 | return | 127 | return |
| 126 | } else { | 128 | } else { |
| 127 | - log.Debug(fmt.Sprintf("SympathyAction user:%d id:%d sympathy:%v", header.Uid, request.Id, request.SympathyType)) | 129 | + log.Debug(fmt.Sprintf("SympathyAction user:%d id:%d sympathy:%v", header.UserId, request.Id, request.SympathyType)) |
| 128 | goto END | 130 | goto END |
| 129 | } | 131 | } |
| 130 | END: | 132 | END: |
| @@ -134,6 +136,11 @@ END: | @@ -134,6 +136,11 @@ END: | ||
| 134 | } | 136 | } |
| 135 | if request.SympathyType == protocol.UnMarkFlag { | 137 | if request.SympathyType == protocol.UnMarkFlag { |
| 136 | incre = -1 | 138 | incre = -1 |
| 139 | + //删除点赞消息 | ||
| 140 | + agg.DeleteSendedMsg(chance.Id, protocol.SourceTypeChance, chance.UserId, protocol.MsgTypeThumbUp) | ||
| 141 | + } else { | ||
| 142 | + //发送点赞消息 | ||
| 143 | + agg.SendMsg(chance.UserId, fmt.Sprintf("%v", chance.UserId), chance.CompanyId, chance.Id, 1, message, protocol.MsgTypeThumbUp) | ||
| 137 | } | 144 | } |
| 138 | if !utils.ExecuteSqlByRoll(true, agg.GetIncrementSql(table, "zan_total", incre, request.Id)) { | 145 | if !utils.ExecuteSqlByRoll(true, agg.GetIncrementSql(table, "zan_total", incre, request.Id)) { |
| 139 | // | 146 | // |
| @@ -276,7 +283,7 @@ func ChanceSubmit(header *protocol.RequestHeader, request *protocol.ChanceSubmit | @@ -276,7 +283,7 @@ func ChanceSubmit(header *protocol.RequestHeader, request *protocol.ChanceSubmit | ||
| 276 | } | 283 | } |
| 277 | 284 | ||
| 278 | //生成提交记录 | 285 | //生成提交记录 |
| 279 | - if _, err = orm.Insert(GenAuditFlowProcess_Submit(header, chance.Id, template.Id)); err != nil { | 286 | + if _, err = orm.Insert(GenAuditFlowProcess_Submit(header, chance.Id, template.Id, protocol.ReviewStatusSubmit)); err != nil { |
| 280 | log.Error(err) | 287 | log.Error(err) |
| 281 | orm.Rollback() | 288 | orm.Rollback() |
| 282 | return | 289 | return |
| @@ -487,6 +494,7 @@ func ChanceChangeScore(header *protocol.RequestHeader, request *protocol.ChanceC | @@ -487,6 +494,7 @@ func ChanceChangeScore(header *protocol.RequestHeader, request *protocol.ChanceC | ||
| 487 | chance *models.Chance | 494 | chance *models.Chance |
| 488 | mapChance = make(map[string]interface{}) | 495 | mapChance = make(map[string]interface{}) |
| 489 | approveData protocol.ApproveData | 496 | approveData protocol.ApproveData |
| 497 | + result *protocol.ChanceCalculateScoreResponse | ||
| 490 | ) | 498 | ) |
| 491 | if chance, err = models.GetChanceByIdAndEnable(request.ChanceId); err != nil { | 499 | if chance, err = models.GetChanceByIdAndEnable(request.ChanceId); err != nil { |
| 492 | err = protocol.NewErrWithMessage(5101) //不存在 | 500 | err = protocol.NewErrWithMessage(5101) //不存在 |
| @@ -496,6 +504,13 @@ func ChanceChangeScore(header *protocol.RequestHeader, request *protocol.ChanceC | @@ -496,6 +504,13 @@ func ChanceChangeScore(header *protocol.RequestHeader, request *protocol.ChanceC | ||
| 496 | err = protocol.NewErrWithMessage(5205) | 504 | err = protocol.NewErrWithMessage(5205) |
| 497 | return | 505 | return |
| 498 | } | 506 | } |
| 507 | + if result, err = ChanceCalculateScore(header, &protocol.ChanceCalculateScoreRequest{Score: request.Score}); err != nil { | ||
| 508 | + log.Error("计算发现分错误:", err) | ||
| 509 | + //err = protocol.NewErrWithMessage(5511) | ||
| 510 | + return | ||
| 511 | + } | ||
| 512 | + request.Score.DiscoveryScore = result.DiscoveryScore | ||
| 513 | + request.Score.DiscoveryScorePercent = result.DiscoveryScorePercent | ||
| 499 | //TODO:角色检查权限 | 514 | //TODO:角色检查权限 |
| 500 | if e := json.Unmarshal([]byte(chance.ApproveData), &approveData); e == nil { | 515 | if e := json.Unmarshal([]byte(chance.ApproveData), &approveData); e == nil { |
| 501 | approveData.Score = request.Score | 516 | approveData.Score = request.Score |
| @@ -505,7 +520,7 @@ func ChanceChangeScore(header *protocol.RequestHeader, request *protocol.ChanceC | @@ -505,7 +520,7 @@ func ChanceChangeScore(header *protocol.RequestHeader, request *protocol.ChanceC | ||
| 505 | mapChance["BasicScore"] = request.Score.BasicScore | 520 | mapChance["BasicScore"] = request.Score.BasicScore |
| 506 | mapChance["ExtraScore"] = request.Score.ExtraScore | 521 | mapChance["ExtraScore"] = request.Score.ExtraScore |
| 507 | mapChance["ValueScore"] = request.Score.ValueScore | 522 | mapChance["ValueScore"] = request.Score.ValueScore |
| 508 | - mapChance["DiscoveryScore"] = request.Score.DiscoveryScore | 523 | + mapChance["DiscoveryScore"] = result.DiscoveryScore |
| 509 | } | 524 | } |
| 510 | orm := orm.NewOrm() | 525 | orm := orm.NewOrm() |
| 511 | orm.Begin() | 526 | orm.Begin() |
| @@ -521,10 +536,60 @@ func ChanceChangeScore(header *protocol.RequestHeader, request *protocol.ChanceC | @@ -521,10 +536,60 @@ func ChanceChangeScore(header *protocol.RequestHeader, request *protocol.ChanceC | ||
| 521 | 536 | ||
| 522 | //计算发现分 | 537 | //计算发现分 |
| 523 | func ChanceCalculateScore(header *protocol.RequestHeader, request *protocol.ChanceCalculateScoreRequest) (rsp *protocol.ChanceCalculateScoreResponse, err error) { | 538 | func ChanceCalculateScore(header *protocol.RequestHeader, request *protocol.ChanceCalculateScoreRequest) (rsp *protocol.ChanceCalculateScoreResponse, err error) { |
| 524 | - var () | ||
| 525 | - //TODO:取配置数据 | 539 | + var ( |
| 540 | + config *models.SysConfig | ||
| 541 | + scoreConfig protocol.ScoreConfig | ||
| 542 | + sum float64 | ||
| 543 | + ) | ||
| 526 | rsp = &protocol.ChanceCalculateScoreResponse{} | 544 | rsp = &protocol.ChanceCalculateScoreResponse{} |
| 527 | - rsp.DiscoveryScore = request.Score.BasicScore*1.0 + request.Score.ExtraScore*1.0 + request.Score.ValueScore*1.0 | 545 | + if config, err = models.GetSysConfigByCompanyId(int(header.CompanyId), models.KeyScore); err != nil { |
| 546 | + err = protocol.NewErrWithMessage(5510) | ||
| 547 | + log.Error(header.CompanyId, err) | ||
| 548 | + return | ||
| 549 | + } | ||
| 550 | + if err = json.Unmarshal([]byte(config.Content), &scoreConfig); err != nil { | ||
| 551 | + err = protocol.NewErrWithMessage(5510) | ||
| 552 | + log.Error(err) | ||
| 553 | + return | ||
| 554 | + } | ||
| 555 | + { | ||
| 556 | + basic := request.Score.BasicScore | ||
| 557 | + if basic < scoreConfig.BasicScore.Min || basic > scoreConfig.BasicScore.Max { | ||
| 558 | + err = protocol.NewErrWithMessage(5501) | ||
| 559 | + log.Error(fmt.Sprintf("%v out range[%v:%v]", basic, scoreConfig.BasicScore.Min, scoreConfig.BasicScore.Max)) | ||
| 560 | + return | ||
| 561 | + } | ||
| 562 | + sum += scoreConfig.BasicScore.Max * scoreConfig.DiscoveryScore.BasicFactor | ||
| 563 | + } | ||
| 564 | + { | ||
| 565 | + extral := request.Score.ExtraScore | ||
| 566 | + if extral < scoreConfig.ExtraScore.Min || extral > scoreConfig.ExtraScore.Max { | ||
| 567 | + err = protocol.NewErrWithMessage(5502) | ||
| 568 | + log.Error(fmt.Sprintf("%v out range[%v:%v]", extral, scoreConfig.ExtraScore.Min, scoreConfig.ExtraScore.Max)) | ||
| 569 | + return | ||
| 570 | + } | ||
| 571 | + sum += scoreConfig.ExtraScore.Max * scoreConfig.DiscoveryScore.ExtraFactor | ||
| 572 | + } | ||
| 573 | + { | ||
| 574 | + value := request.Score.ValueScore | ||
| 575 | + if value < scoreConfig.ValueScore.Min || value > scoreConfig.ValueScore.Max { | ||
| 576 | + err = protocol.NewErrWithMessage(5502) | ||
| 577 | + log.Error(fmt.Sprintf("%v out range[%v:%v]", value, scoreConfig.ValueScore.Min, scoreConfig.ValueScore.Max)) | ||
| 578 | + return | ||
| 579 | + } | ||
| 580 | + sum += scoreConfig.ValueScore.Max * scoreConfig.DiscoveryScore.ValueFactor | ||
| 581 | + } | ||
| 582 | + rsp.DiscoveryScore = request.Score.BasicScore*scoreConfig.DiscoveryScore.BasicFactor + request.Score.ExtraScore*scoreConfig.DiscoveryScore.ExtraFactor + request.Score.ValueScore*scoreConfig.DiscoveryScore.ValueFactor | ||
| 583 | + rsp.DiscoveryScorePercent = int((rsp.DiscoveryScore / sum) * 100) | ||
| 584 | + log.Debug(fmt.Sprintf("计算发现-> score_config:%v score:%v 总分:%v 发现分:%v 发现分百分比:%v", common.AssertJson(scoreConfig), common.AssertJson(request.Score), sum, rsp.DiscoveryScore, rsp.DiscoveryScorePercent)) | ||
| 585 | + //发现分不为0 | ||
| 586 | + if request.Score.DiscoveryScore != 0 { | ||
| 587 | + if request.Score.DiscoveryScore != 0 && rsp.DiscoveryScore != request.Score.DiscoveryScore { | ||
| 588 | + log.Error(fmt.Sprintf("input :%v out:%v want:%v", request.Score.DiscoveryScore, rsp.DiscoveryScore, request.Score.DiscoveryScore)) | ||
| 589 | + err = protocol.NewErrWithMessage(5511) | ||
| 590 | + return | ||
| 591 | + } | ||
| 592 | + } | ||
| 528 | return | 593 | return |
| 529 | } | 594 | } |
| 530 | 595 | ||
| @@ -542,7 +607,7 @@ func ChancePermission(header *protocol.RequestHeader, request *protocol.ChancePe | @@ -542,7 +607,7 @@ func ChancePermission(header *protocol.RequestHeader, request *protocol.ChancePe | ||
| 542 | } | 607 | } |
| 543 | 608 | ||
| 544 | //生成审批流-提交记录 | 609 | //生成审批流-提交记录 |
| 545 | -func GenAuditFlowProcess_Submit(header *protocol.RequestHeader, chanceId int64, templateId int64) (v *models.AuditFlowProcess) { | 610 | +func GenAuditFlowProcess_Submit(header *protocol.RequestHeader, chanceId int64, templateId int64, reviewStatus int) (v *models.AuditFlowProcess) { |
| 546 | v = &models.AuditFlowProcess{ | 611 | v = &models.AuditFlowProcess{ |
| 547 | Id: idgen.Next(), | 612 | Id: idgen.Next(), |
| 548 | ChanceId: chanceId, | 613 | ChanceId: chanceId, |
| @@ -551,7 +616,7 @@ func GenAuditFlowProcess_Submit(header *protocol.RequestHeader, chanceId int64, | @@ -551,7 +616,7 @@ func GenAuditFlowProcess_Submit(header *protocol.RequestHeader, chanceId int64, | ||
| 551 | UpdateAt: time.Now(), | 616 | UpdateAt: time.Now(), |
| 552 | ApproveTime: time.Now(), | 617 | ApproveTime: time.Now(), |
| 553 | EnableStatus: 1, | 618 | EnableStatus: 1, |
| 554 | - ReviewStatus: protocol.ReviewStatusSubmit, | 619 | + ReviewStatus: int8(reviewStatus), |
| 555 | } | 620 | } |
| 556 | if approver, err := models.GetUsersById(header.Uid); err != nil { | 621 | if approver, err := models.GetUsersById(header.Uid); err != nil { |
| 557 | log.Error(err) | 622 | log.Error(err) |
| @@ -759,6 +824,8 @@ func getParentDepartmentors(pid int) (ids []int64) { | @@ -759,6 +824,8 @@ func getParentDepartmentors(pid int) (ids []int64) { | ||
| 759 | func ChanceStatistics(header *protocol.RequestHeader, request *protocol.ChanceStatisticsRequest) (rsp *protocol.ChanceStatisticsResponse, err error) { | 824 | func ChanceStatistics(header *protocol.RequestHeader, request *protocol.ChanceStatisticsRequest) (rsp *protocol.ChanceStatisticsResponse, err error) { |
| 760 | var ( | 825 | var ( |
| 761 | chanceType []*models.ChanceType | 826 | chanceType []*models.ChanceType |
| 827 | + total int | ||
| 828 | + sum int | ||
| 762 | ) | 829 | ) |
| 763 | if chanceType, err = models.GetChanceTypeAll(header.CompanyId); err != nil { | 830 | if chanceType, err = models.GetChanceTypeAll(header.CompanyId); err != nil { |
| 764 | log.Error(err) | 831 | log.Error(err) |
| @@ -767,12 +834,18 @@ func ChanceStatistics(header *protocol.RequestHeader, request *protocol.ChanceSt | @@ -767,12 +834,18 @@ func ChanceStatistics(header *protocol.RequestHeader, request *protocol.ChanceSt | ||
| 767 | rsp = &protocol.ChanceStatisticsResponse{} | 834 | rsp = &protocol.ChanceStatisticsResponse{} |
| 768 | for i := range chanceType { | 835 | for i := range chanceType { |
| 769 | item := chanceType[i] | 836 | item := chanceType[i] |
| 837 | + if total, err = models.GetChancePool(header.UserId, header.CompanyId, item.Id, 0, 0, nil); err != nil { | ||
| 838 | + log.Error(err) | ||
| 839 | + return | ||
| 840 | + } | ||
| 841 | + sum += total | ||
| 770 | rsp.List = append(rsp.List, protocol.ChanceTotalItem{ | 842 | rsp.List = append(rsp.List, protocol.ChanceTotalItem{ |
| 771 | Id: item.Id, | 843 | Id: item.Id, |
| 772 | Name: item.Name, | 844 | Name: item.Name, |
| 773 | - Total: i * 2, | 845 | + Total: total, |
| 774 | }) | 846 | }) |
| 775 | } | 847 | } |
| 848 | + rsp.ChanceTotal = sum | ||
| 776 | return | 849 | return |
| 777 | } | 850 | } |
| 778 | 851 | ||
| @@ -849,7 +922,7 @@ func ChancePool(header *protocol.RequestHeader, request *protocol.ChancePoolRequ | @@ -849,7 +922,7 @@ func ChancePool(header *protocol.RequestHeader, request *protocol.ChancePoolRequ | ||
| 849 | commItem := protocol.CommonListItem{} | 922 | commItem := protocol.CommonListItem{} |
| 850 | { | 923 | { |
| 851 | item := protocol.ChanceItem{ | 924 | item := protocol.ChanceItem{ |
| 852 | - Id: chance.Id, | 925 | + Id: chance.ChanceId, |
| 853 | Provider: provider, | 926 | Provider: provider, |
| 854 | CreateTime: chance.CreateTime.Unix() * 1000, | 927 | CreateTime: chance.CreateTime.Unix() * 1000, |
| 855 | } | 928 | } |
| @@ -867,7 +940,7 @@ func ChancePool(header *protocol.RequestHeader, request *protocol.ChancePoolRequ | @@ -867,7 +940,7 @@ func ChancePool(header *protocol.RequestHeader, request *protocol.ChancePoolRequ | ||
| 867 | CommentTotal: chance.CommentTotal, | 940 | CommentTotal: chance.CommentTotal, |
| 868 | PageViewTotal: chance.ViewTotal, | 941 | PageViewTotal: chance.ViewTotal, |
| 869 | } | 942 | } |
| 870 | - if flag, err = agg.GetChanceMarkData(header.UserId, header.CompanyId, chance.Id); err != nil { | 943 | + if flag, err = agg.GetChanceMarkData(header.UserId, header.CompanyId, chance.ChanceId); err != nil { |
| 871 | log.Error(err) | 944 | log.Error(err) |
| 872 | continue | 945 | continue |
| 873 | } | 946 | } |
| @@ -903,7 +976,6 @@ func MyApproveChance(header *protocol.RequestHeader, request *protocol.MyApprove | @@ -903,7 +976,6 @@ func MyApproveChance(header *protocol.RequestHeader, request *protocol.MyApprove | ||
| 903 | total int | 976 | total int |
| 904 | provider *protocol.BaseUserInfo | 977 | provider *protocol.BaseUserInfo |
| 905 | ) | 978 | ) |
| 906 | - rsp = &protocol.MyApproveChanceResponse{} | ||
| 907 | if total, err = models.GetChanceMyApproveChance(header.UserId, header.CompanyId, []int8{request.ReviewStatus}, request.LastId, request.PageSize, &myChances); err != nil { | 979 | if total, err = models.GetChanceMyApproveChance(header.UserId, header.CompanyId, []int8{request.ReviewStatus}, request.LastId, request.PageSize, &myChances); err != nil { |
| 908 | if err == orm.ErrNoRows { | 980 | if err == orm.ErrNoRows { |
| 909 | err = nil | 981 | err = nil |
| @@ -922,9 +994,10 @@ func MyApproveChance(header *protocol.RequestHeader, request *protocol.MyApprove | @@ -922,9 +994,10 @@ func MyApproveChance(header *protocol.RequestHeader, request *protocol.MyApprove | ||
| 922 | } else if chance.ChanceEnableStatus == 0 { //机会关闭 | 994 | } else if chance.ChanceEnableStatus == 0 { //机会关闭 |
| 923 | commItem.ChanceStatus = protocol.ChanceStatusClose | 995 | commItem.ChanceStatus = protocol.ChanceStatusClose |
| 924 | } else { | 996 | } else { |
| 925 | - if provider, err = agg.GetUserBaseInfo(header.UserId, header.CompanyId); err != nil { | 997 | + if provider, err = agg.GetUserBaseInfo(chance.ChanceUserId, header.CompanyId); err != nil { |
| 926 | commItem.ChanceStatus = protocol.ChanceStatusDelete | 998 | commItem.ChanceStatus = protocol.ChanceStatusDelete |
| 927 | - log.Error(err) | 999 | + log.Error(chance.ChanceUserId, header.CompanyId, err) |
| 1000 | + err = nil | ||
| 928 | //return | 1001 | //return |
| 929 | } else { | 1002 | } else { |
| 930 | item := protocol.ChanceItem{ | 1003 | item := protocol.ChanceItem{ |
| @@ -966,6 +1039,264 @@ func MyApproveChance(header *protocol.RequestHeader, request *protocol.MyApprove | @@ -966,6 +1039,264 @@ func MyApproveChance(header *protocol.RequestHeader, request *protocol.MyApprove | ||
| 966 | return | 1039 | return |
| 967 | } | 1040 | } |
| 968 | 1041 | ||
| 1042 | +// 我的收藏 | ||
| 1043 | +func MyCollectChance(header *protocol.RequestHeader, request *protocol.MyCollectChanceRequest) (rsp *protocol.MyCollectChanceResponse, err error) { | ||
| 1044 | + var ( | ||
| 1045 | + myChances []protocol.ChanceCollectItemOrm | ||
| 1046 | + total int | ||
| 1047 | + provider *protocol.BaseUserInfo | ||
| 1048 | + ) | ||
| 1049 | + if total, err = models.GetChanceCollect(header.UserId, request.LastId, request.PageSize, &myChances); err != nil { | ||
| 1050 | + if err == orm.ErrNoRows { | ||
| 1051 | + err = nil | ||
| 1052 | + return | ||
| 1053 | + } | ||
| 1054 | + log.Error(err) | ||
| 1055 | + return | ||
| 1056 | + } | ||
| 1057 | + rsp = &protocol.MyCollectChanceResponse{Total: total} | ||
| 1058 | + for i := 0; i < len(myChances); i++ { | ||
| 1059 | + chance := myChances[i] | ||
| 1060 | + commItem := protocol.CommonListItem{} | ||
| 1061 | + commItem.ReviewStatus = chance.ReviewStatus | ||
| 1062 | + if len(chance.SourceContent) == 0 { //机会删除 | ||
| 1063 | + commItem.ChanceStatus = protocol.ChanceStatusDelete | ||
| 1064 | + } else if chance.ChanceEnableStatus == 0 { //机会关闭 | ||
| 1065 | + commItem.ChanceStatus = protocol.ChanceStatusClose | ||
| 1066 | + } else { | ||
| 1067 | + if provider, err = agg.GetUserBaseInfo(chance.ChanceUserId, header.CompanyId); err != nil { | ||
| 1068 | + commItem.ChanceStatus = protocol.ChanceStatusDelete | ||
| 1069 | + log.Error(err) | ||
| 1070 | + //return | ||
| 1071 | + } else { | ||
| 1072 | + item := protocol.ChanceItem{ | ||
| 1073 | + Id: chance.ChanceId, | ||
| 1074 | + Provider: provider, | ||
| 1075 | + //CreateTime: chance.CreateTime.Unix() * 1000, | ||
| 1076 | + } | ||
| 1077 | + jsonUnmarshal(chance.SourceContent, &item.FormList) | ||
| 1078 | + item.FormList = clearEmptyForm(item.FormList) | ||
| 1079 | + jsonUnmarshal(chance.Images, &item.Pictures) | ||
| 1080 | + jsonUnmarshal(chance.Voices, &item.Speechs) | ||
| 1081 | + jsonUnmarshal(chance.Videos, &item.Videos) | ||
| 1082 | + commItem.Chance = item | ||
| 1083 | + } | ||
| 1084 | + } | ||
| 1085 | + commItem.ReviewStatus = chance.ReviewStatus | ||
| 1086 | + { | ||
| 1087 | + var chanceData = protocol.ChanceData{ | ||
| 1088 | + ThumbsUpTotal: chance.ZanTotal, | ||
| 1089 | + CommentTotal: chance.CommentTotal, | ||
| 1090 | + PageViewTotal: chance.ViewTotal, | ||
| 1091 | + } | ||
| 1092 | + chanceData.IsThumbsUp, chanceData.IsCollect, _ = getChanceMarkFlag(header, chance.ChanceId) | ||
| 1093 | + commItem.ChanceData = chanceData | ||
| 1094 | + } | ||
| 1095 | + { | ||
| 1096 | + //做一次查询 查回所有的模板数据 | ||
| 1097 | + commItem.ChanceTemplate = getTemplate(chance.TemplateId) | ||
| 1098 | + commItem.ChanceType = getChanceType(chance.ChanceTypeId) | ||
| 1099 | + } | ||
| 1100 | + { | ||
| 1101 | + //收藏数据 | ||
| 1102 | + commItem.CollectData = protocol.CollectData{ | ||
| 1103 | + Id: chance.CollectId, | ||
| 1104 | + CollectTime: chance.CollectTime.Unix() * 1000, | ||
| 1105 | + } | ||
| 1106 | + } | ||
| 1107 | + rsp.List = append(rsp.List, commItem) | ||
| 1108 | + } | ||
| 1109 | + return | ||
| 1110 | +} | ||
| 1111 | + | ||
| 1112 | +//我点赞的机会 | ||
| 1113 | +func MyThumbUpChance(header *protocol.RequestHeader, request *protocol.MyThumbUpChanceRequest) (rsp *protocol.MyThumbUpChanceResponse, err error) { | ||
| 1114 | + var ( | ||
| 1115 | + myChances []protocol.ChanceThumbUpItemOrm | ||
| 1116 | + total int | ||
| 1117 | + provider *protocol.BaseUserInfo | ||
| 1118 | + ) | ||
| 1119 | + if total, err = models.GetChanceThumbUp(header.UserId, request.LastId, request.PageSize, &myChances); err != nil { | ||
| 1120 | + if err == orm.ErrNoRows { | ||
| 1121 | + err = nil | ||
| 1122 | + return | ||
| 1123 | + } | ||
| 1124 | + log.Error(err) | ||
| 1125 | + return | ||
| 1126 | + } | ||
| 1127 | + rsp = &protocol.MyThumbUpChanceResponse{Total: total} | ||
| 1128 | + for i := 0; i < len(myChances); i++ { | ||
| 1129 | + chance := myChances[i] | ||
| 1130 | + commItem := protocol.CommonListItem{} | ||
| 1131 | + commItem.ReviewStatus = chance.ReviewStatus | ||
| 1132 | + if len(chance.SourceContent) == 0 { //机会删除 | ||
| 1133 | + commItem.ChanceStatus = protocol.ChanceStatusDelete | ||
| 1134 | + } else if chance.ChanceEnableStatus == 0 { //机会关闭 | ||
| 1135 | + commItem.ChanceStatus = protocol.ChanceStatusClose | ||
| 1136 | + } else { | ||
| 1137 | + if provider, err = agg.GetUserBaseInfo(chance.ChanceUserId, header.CompanyId); err != nil { | ||
| 1138 | + commItem.ChanceStatus = protocol.ChanceStatusDelete | ||
| 1139 | + log.Error(err) | ||
| 1140 | + //return | ||
| 1141 | + } else { | ||
| 1142 | + item := protocol.ChanceItem{ | ||
| 1143 | + Id: chance.ChanceId, | ||
| 1144 | + Provider: provider, | ||
| 1145 | + CreateTime: chance.CreateTime.Unix() * 1000, | ||
| 1146 | + } | ||
| 1147 | + jsonUnmarshal(chance.SourceContent, &item.FormList) | ||
| 1148 | + item.FormList = clearEmptyForm(item.FormList) | ||
| 1149 | + jsonUnmarshal(chance.Images, &item.Pictures) | ||
| 1150 | + jsonUnmarshal(chance.Voices, &item.Speechs) | ||
| 1151 | + jsonUnmarshal(chance.Videos, &item.Videos) | ||
| 1152 | + commItem.Chance = item | ||
| 1153 | + } | ||
| 1154 | + } | ||
| 1155 | + commItem.ReviewStatus = chance.ReviewStatus | ||
| 1156 | + { | ||
| 1157 | + var chanceData = protocol.ChanceData{ | ||
| 1158 | + ThumbsUpTotal: chance.ZanTotal, | ||
| 1159 | + CommentTotal: chance.CommentTotal, | ||
| 1160 | + PageViewTotal: chance.ViewTotal, | ||
| 1161 | + } | ||
| 1162 | + chanceData.IsThumbsUp, chanceData.IsCollect, _ = getChanceMarkFlag(header, chance.ChanceId) | ||
| 1163 | + commItem.ChanceData = chanceData | ||
| 1164 | + } | ||
| 1165 | + { | ||
| 1166 | + //做一次查询 查回所有的模板数据 | ||
| 1167 | + commItem.ChanceTemplate = getTemplate(chance.TemplateId) | ||
| 1168 | + commItem.ChanceType = getChanceType(chance.ChanceTypeId) | ||
| 1169 | + } | ||
| 1170 | + { | ||
| 1171 | + //收藏数据 | ||
| 1172 | + commItem.ThumbUpData = protocol.ThumbUpData{ | ||
| 1173 | + Id: chance.CollectId, | ||
| 1174 | + ThumbUpTime: chance.CollectTime.Unix() * 1000, | ||
| 1175 | + } | ||
| 1176 | + } | ||
| 1177 | + rsp.List = append(rsp.List, commItem) | ||
| 1178 | + } | ||
| 1179 | + return | ||
| 1180 | +} | ||
| 1181 | + | ||
| 1182 | +//我的评论 | ||
| 1183 | +func MyComment(header *protocol.RequestHeader, request *protocol.MyCommentRequest) (rsp *protocol.MyCommentResponse, err error) { | ||
| 1184 | + var ( | ||
| 1185 | + myChances []protocol.ChanceCommentItemOrm | ||
| 1186 | + total int | ||
| 1187 | + provider *protocol.BaseUserInfo | ||
| 1188 | + ) | ||
| 1189 | + if total, err = models.GetChanceComment(header.UserId, request.LastId, request.PageSize, &myChances); err != nil { | ||
| 1190 | + if err == orm.ErrNoRows { | ||
| 1191 | + err = nil | ||
| 1192 | + return | ||
| 1193 | + } | ||
| 1194 | + log.Error(err) | ||
| 1195 | + return | ||
| 1196 | + } | ||
| 1197 | + rsp = &protocol.MyCommentResponse{Total: total} | ||
| 1198 | + for i := 0; i < len(myChances); i++ { | ||
| 1199 | + chance := myChances[i] | ||
| 1200 | + commItem := protocol.CommonListItem{} | ||
| 1201 | + if chance.SourceType == protocol.SourceTypeChance { | ||
| 1202 | + commItem.ReviewStatus = chance.ReviewStatus | ||
| 1203 | + if len(chance.SourceContent) == 0 { //机会删除 | ||
| 1204 | + commItem.ChanceStatus = protocol.ChanceStatusDelete | ||
| 1205 | + } else if chance.ChanceEnableStatus == 0 { //机会关闭 | ||
| 1206 | + commItem.ChanceStatus = protocol.ChanceStatusClose | ||
| 1207 | + } else { | ||
| 1208 | + if provider, err = agg.GetUserBaseInfo(chance.Uid, header.CompanyId); err != nil { | ||
| 1209 | + commItem.ChanceStatus = protocol.ChanceStatusDelete | ||
| 1210 | + log.Error(err) | ||
| 1211 | + //return | ||
| 1212 | + } else { | ||
| 1213 | + item := protocol.ChanceItem{ | ||
| 1214 | + Id: chance.SourceId, | ||
| 1215 | + Provider: provider, | ||
| 1216 | + CreateTime: chance.CreateTime.Unix() * 1000, | ||
| 1217 | + } | ||
| 1218 | + jsonUnmarshal(chance.SourceContent, &item.FormList) | ||
| 1219 | + item.FormList = clearEmptyForm(item.FormList) | ||
| 1220 | + jsonUnmarshal(chance.Images, &item.Pictures) | ||
| 1221 | + jsonUnmarshal(chance.Voices, &item.Speechs) | ||
| 1222 | + jsonUnmarshal(chance.Videos, &item.Videos) | ||
| 1223 | + commItem.Chance = item | ||
| 1224 | + } | ||
| 1225 | + } | ||
| 1226 | + commItem.ReviewStatus = chance.ReviewStatus | ||
| 1227 | + //{ | ||
| 1228 | + // var chanceData = protocol.ChanceData{ | ||
| 1229 | + // ThumbsUpTotal: chance.ZanTotal, | ||
| 1230 | + // CommentTotal: chance.CommentTotal, | ||
| 1231 | + // PageViewTotal: chance.ViewTotal, | ||
| 1232 | + // } | ||
| 1233 | + // chanceData.IsThumbsUp, chanceData.IsCollect, _ = getChanceMarkFlag(header, chance.SourceType) | ||
| 1234 | + // commItem.ChanceData = chanceData | ||
| 1235 | + //} | ||
| 1236 | + //{ | ||
| 1237 | + // //做一次查询 查回所有的模板数据 | ||
| 1238 | + // commItem.ChanceTemplate = getTemplate(chance.TemplateId) | ||
| 1239 | + // commItem.ChanceType = getChanceType(chance.ChanceTypeId) | ||
| 1240 | + //} | ||
| 1241 | + } | ||
| 1242 | + if chance.SourceType == protocol.SourceTypeComment { | ||
| 1243 | + commItem.CommentedData = protocol.CommentData{ | ||
| 1244 | + Id: chance.SourceId, | ||
| 1245 | + Content: chance.CommentedContent, | ||
| 1246 | + CommentTime: chance.CommentedTime.Unix() * 1000, | ||
| 1247 | + } | ||
| 1248 | + } | ||
| 1249 | + commItem.CommentData = protocol.CommentData{ | ||
| 1250 | + Id: chance.CommentId, | ||
| 1251 | + CommentTime: chance.CommentTime.Unix() * 1000, | ||
| 1252 | + Content: chance.CommentContent, | ||
| 1253 | + } | ||
| 1254 | + commItem.SourceType = chance.SourceType | ||
| 1255 | + rsp.List = append(rsp.List, commItem) | ||
| 1256 | + } | ||
| 1257 | + return | ||
| 1258 | +} | ||
| 1259 | + | ||
| 1260 | +//获取机会点赞/收藏状态 | ||
| 1261 | +func getChanceMarkFlag(header *protocol.RequestHeader, chanceId int64) (isThumbsUp, isCollect bool, err error) { | ||
| 1262 | + var flag int | ||
| 1263 | + if flag, err = agg.GetChanceMarkData(header.UserId, header.CompanyId, chanceId); err != nil { | ||
| 1264 | + log.Error(err) | ||
| 1265 | + return | ||
| 1266 | + } | ||
| 1267 | + isThumbsUp = (flag & protocol.MarkFlagZan) == protocol.MarkFlagZan | ||
| 1268 | + isCollect = (flag & protocol.MarkFlagCollect) == protocol.MarkFlagCollect | ||
| 1269 | + return | ||
| 1270 | +} | ||
| 1271 | + | ||
| 1272 | +//获取模板 | ||
| 1273 | +func getTemplate(templateId int) protocol.NameItem { | ||
| 1274 | + if template, e := models.GetAuditTemplateById(int64(templateId)); e == nil { | ||
| 1275 | + item := protocol.NameItem{ | ||
| 1276 | + Id: int(template.Id), | ||
| 1277 | + Name: template.Name, | ||
| 1278 | + } | ||
| 1279 | + return item | ||
| 1280 | + } else { | ||
| 1281 | + log.Error(templateId, e) | ||
| 1282 | + } | ||
| 1283 | + return protocol.NameItem{} | ||
| 1284 | +} | ||
| 1285 | + | ||
| 1286 | +//获取机会一级分类 | ||
| 1287 | +func getChanceType(chanceTypeId int) protocol.NameItem { | ||
| 1288 | + if template, e := models.GetChanceTypeById(chanceTypeId); e == nil { | ||
| 1289 | + item := protocol.NameItem{ | ||
| 1290 | + Id: int(template.Id), | ||
| 1291 | + Name: template.Name, | ||
| 1292 | + } | ||
| 1293 | + return item | ||
| 1294 | + } else { | ||
| 1295 | + log.Error(chanceTypeId, e) | ||
| 1296 | + } | ||
| 1297 | + return protocol.NameItem{} | ||
| 1298 | +} | ||
| 1299 | + | ||
| 969 | func jsonUnmarshal(jsonData string, v interface{}) { | 1300 | func jsonUnmarshal(jsonData string, v interface{}) { |
| 970 | if len(jsonData) == 0 { | 1301 | if len(jsonData) == 0 { |
| 971 | return | 1302 | return |
| @@ -998,6 +1329,7 @@ func ChanceDetail(header *protocol.RequestHeader, request *protocol.ChanceDetail | @@ -998,6 +1329,7 @@ func ChanceDetail(header *protocol.RequestHeader, request *protocol.ChanceDetail | ||
| 998 | approveProcess *protocol.ChanceApproveProcessResponse | 1329 | approveProcess *protocol.ChanceApproveProcessResponse |
| 999 | //chanceType *models.ChanceType | 1330 | //chanceType *models.ChanceType |
| 1000 | //tempalte *models.AuditTemplate | 1331 | //tempalte *models.AuditTemplate |
| 1332 | + table string = "chance" | ||
| 1001 | ) | 1333 | ) |
| 1002 | rsp = &protocol.ChanceDetailResponse{} | 1334 | rsp = &protocol.ChanceDetailResponse{} |
| 1003 | if chance, err = models.GetChanceById(request.Id); err != nil { | 1335 | if chance, err = models.GetChanceById(request.Id); err != nil { |
| @@ -1024,6 +1356,11 @@ func ChanceDetail(header *protocol.RequestHeader, request *protocol.ChanceDetail | @@ -1024,6 +1356,11 @@ func ChanceDetail(header *protocol.RequestHeader, request *protocol.ChanceDetail | ||
| 1024 | err = protocol.NewErrWithMessage(5101) | 1356 | err = protocol.NewErrWithMessage(5101) |
| 1025 | return | 1357 | return |
| 1026 | } | 1358 | } |
| 1359 | + if chance.ReviewStatus == protocol.ReviewStatusPass { | ||
| 1360 | + if !utils.ExecuteSqlByRoll(true, agg.GetIncrementSql(table, "view_total", 1, request.Id)) { | ||
| 1361 | + // | ||
| 1362 | + } | ||
| 1363 | + } | ||
| 1027 | //用户信息 | 1364 | //用户信息 |
| 1028 | if provider, err = agg.GetUserBaseInfo(chance.UserId, header.CompanyId); err != nil { | 1365 | if provider, err = agg.GetUserBaseInfo(chance.UserId, header.CompanyId); err != nil { |
| 1029 | log.Error(err) | 1366 | log.Error(err) |
| @@ -1051,6 +1388,22 @@ func ChanceDetail(header *protocol.RequestHeader, request *protocol.ChanceDetail | @@ -1051,6 +1388,22 @@ func ChanceDetail(header *protocol.RequestHeader, request *protocol.ChanceDetail | ||
| 1051 | rsp.ApproveProcess = approveProcess.ApproveProcess | 1388 | rsp.ApproveProcess = approveProcess.ApproveProcess |
| 1052 | rsp.ApproveAccess = approveProcess.ApproveAccess | 1389 | rsp.ApproveAccess = approveProcess.ApproveAccess |
| 1053 | } | 1390 | } |
| 1391 | + | ||
| 1392 | + { | ||
| 1393 | + var flag int | ||
| 1394 | + var chanceData = protocol.ChanceData{ | ||
| 1395 | + ThumbsUpTotal: chance.ZanTotal, | ||
| 1396 | + CommentTotal: chance.CommentTotal, | ||
| 1397 | + PageViewTotal: chance.ViewTotal, | ||
| 1398 | + } | ||
| 1399 | + if flag, err = agg.GetChanceMarkData(header.UserId, header.CompanyId, chance.Id); err != nil { | ||
| 1400 | + log.Error(err) | ||
| 1401 | + return | ||
| 1402 | + } | ||
| 1403 | + chanceData.IsThumbsUp = (flag & protocol.MarkFlagZan) == protocol.MarkFlagZan | ||
| 1404 | + chanceData.IsCollect = (flag & protocol.MarkFlagCollect) == protocol.MarkFlagCollect | ||
| 1405 | + rsp.StatisticData = chanceData | ||
| 1406 | + } | ||
| 1054 | return | 1407 | return |
| 1055 | } | 1408 | } |
| 1056 | 1409 |
| @@ -2,6 +2,7 @@ package chance | @@ -2,6 +2,7 @@ package chance | ||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "fmt" | 4 | "fmt" |
| 5 | + "github.com/astaxie/beego/orm" | ||
| 5 | "gitlab.fjmaimaimai.com/mmm-go/gocomm/identity/idgen" | 6 | "gitlab.fjmaimaimai.com/mmm-go/gocomm/identity/idgen" |
| 6 | "gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log" | 7 | "gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log" |
| 7 | "opp/internal/utils" | 8 | "opp/internal/utils" |
| @@ -19,6 +20,8 @@ func IComment(header *protocol.RequestHeader, request *protocol.ICommentRequest) | @@ -19,6 +20,8 @@ func IComment(header *protocol.RequestHeader, request *protocol.ICommentRequest) | ||
| 19 | chance *models.Chance | 20 | chance *models.Chance |
| 20 | updateTable interface{} | 21 | updateTable interface{} |
| 21 | updateMap = make(map[string]interface{}) | 22 | updateMap = make(map[string]interface{}) |
| 23 | + recevierId int64 | ||
| 24 | + sourceId int64 | ||
| 22 | ) | 25 | ) |
| 23 | switch request.SourceType { | 26 | switch request.SourceType { |
| 24 | case protocol.SourceTypeChance: | 27 | case protocol.SourceTypeChance: |
| @@ -28,15 +31,22 @@ func IComment(header *protocol.RequestHeader, request *protocol.ICommentRequest) | @@ -28,15 +31,22 @@ func IComment(header *protocol.RequestHeader, request *protocol.ICommentRequest) | ||
| 28 | } | 31 | } |
| 29 | updateTable = chance | 32 | updateTable = chance |
| 30 | updateMap["CommentTotal"] = chance.CommentTotal + 1 | 33 | updateMap["CommentTotal"] = chance.CommentTotal + 1 |
| 34 | + recevierId = chance.UserId | ||
| 35 | + sourceId = chance.Id | ||
| 36 | + break | ||
| 31 | case protocol.SourceTypeComment: | 37 | case protocol.SourceTypeComment: |
| 32 | if comment, err = models.GetCommentById(request.Id); err != nil { | 38 | if comment, err = models.GetCommentById(request.Id); err != nil { |
| 33 | log.Error(err) | 39 | log.Error(err) |
| 34 | return | 40 | return |
| 35 | } | 41 | } |
| 36 | updateTable = comment | 42 | updateTable = comment |
| 43 | + recevierId = comment.UserId | ||
| 44 | + sourceId = comment.Id | ||
| 37 | updateMap["CommentTotal"] = comment.CommentTotal + 1 | 45 | updateMap["CommentTotal"] = comment.CommentTotal + 1 |
| 46 | + break | ||
| 38 | default: | 47 | default: |
| 39 | err = fmt.Errorf("unknow source_type:%v", request.SourceType) | 48 | err = fmt.Errorf("unknow source_type:%v", request.SourceType) |
| 49 | + return | ||
| 40 | } | 50 | } |
| 41 | newComment := &models.Comment{ | 51 | newComment := &models.Comment{ |
| 42 | Id: idgen.Next(), | 52 | Id: idgen.Next(), |
| @@ -46,8 +56,11 @@ func IComment(header *protocol.RequestHeader, request *protocol.ICommentRequest) | @@ -46,8 +56,11 @@ func IComment(header *protocol.RequestHeader, request *protocol.ICommentRequest) | ||
| 46 | CreateAt: time.Now(), | 56 | CreateAt: time.Now(), |
| 47 | SourceId: request.Id, | 57 | SourceId: request.Id, |
| 48 | } | 58 | } |
| 49 | - if _, err = models.AddComment(newComment); err != nil { | 59 | + orm := orm.NewOrm() |
| 60 | + orm.Begin() | ||
| 61 | + if _, err = orm.Insert(newComment); err != nil { | ||
| 50 | log.Error(err) | 62 | log.Error(err) |
| 63 | + orm.Rollback() | ||
| 51 | return | 64 | return |
| 52 | } | 65 | } |
| 53 | if baseUserInfo, err = agg.GetUserBaseInfo(header.Uid, header.CompanyId); err != nil { | 66 | if baseUserInfo, err = agg.GetUserBaseInfo(header.Uid, header.CompanyId); err != nil { |
| @@ -55,12 +68,22 @@ func IComment(header *protocol.RequestHeader, request *protocol.ICommentRequest) | @@ -55,12 +68,22 @@ func IComment(header *protocol.RequestHeader, request *protocol.ICommentRequest) | ||
| 55 | return | 68 | return |
| 56 | } | 69 | } |
| 57 | if updateTable != nil { | 70 | if updateTable != nil { |
| 58 | - utils.UpdateTableByMap(updateTable, updateMap) | 71 | + if err = utils.UpdateTableByMapWithOrmer(orm, updateTable, updateMap); err != nil { |
| 72 | + log.Error(err) | ||
| 73 | + orm.Rollback() | ||
| 74 | + return | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | + if err = agg.SendMsg(recevierId, "", header.CompanyId, sourceId, request.SourceType, request.Content, protocol.MsgTypeComment); err != nil { | ||
| 78 | + log.Error(err) | ||
| 79 | + orm.Rollback() | ||
| 80 | + return | ||
| 59 | } | 81 | } |
| 82 | + orm.Commit() | ||
| 60 | rsp = &protocol.ICommentResponse{ | 83 | rsp = &protocol.ICommentResponse{ |
| 61 | Id: newComment.Id, | 84 | Id: newComment.Id, |
| 62 | Content: newComment.Content, | 85 | Content: newComment.Content, |
| 63 | - CreateTime: newComment.CreateAt.Unix(), | 86 | + CreateTime: newComment.CreateAt.Unix() * 1000, |
| 64 | Provider: baseUserInfo, | 87 | Provider: baseUserInfo, |
| 65 | } | 88 | } |
| 66 | return | 89 | return |
| @@ -128,7 +151,7 @@ func Comments(header *protocol.RequestHeader, request *protocol.CommentsRequest) | @@ -128,7 +151,7 @@ func Comments(header *protocol.RequestHeader, request *protocol.CommentsRequest) | ||
| 128 | Id: comment.Id, | 151 | Id: comment.Id, |
| 129 | Provider: baseUserInfo, | 152 | Provider: baseUserInfo, |
| 130 | Content: comment.Content, | 153 | Content: comment.Content, |
| 131 | - CreateTime: comment.CreateAt.Unix(), | 154 | + CreateTime: comment.CreateAt.Unix() * 1000, |
| 132 | ViewTotal: comment.ViewTotal, | 155 | ViewTotal: comment.ViewTotal, |
| 133 | ZanTotal: comment.ZanTotal, | 156 | ZanTotal: comment.ZanTotal, |
| 134 | CommentTotal: comment.CommentTotal, | 157 | CommentTotal: comment.CommentTotal, |
| @@ -141,6 +164,39 @@ func Comments(header *protocol.RequestHeader, request *protocol.CommentsRequest) | @@ -141,6 +164,39 @@ func Comments(header *protocol.RequestHeader, request *protocol.CommentsRequest) | ||
| 141 | return | 164 | return |
| 142 | } | 165 | } |
| 143 | 166 | ||
| 167 | +//点赞列表 | ||
| 168 | +func Thumbsups(header *protocol.RequestHeader, request *protocol.ThumbsupsRequest) (rsp *protocol.ThumbsupsResponse, err error) { | ||
| 169 | + var ( | ||
| 170 | + favorites []*models.ChanceFavorite | ||
| 171 | + total int | ||
| 172 | + baseUserInfo *protocol.BaseUserInfo | ||
| 173 | + ) | ||
| 174 | + rsp = &protocol.ThumbsupsResponse{} | ||
| 175 | + if favorites, total, err = models.GetChanceFavorites(header.UserId, header.CompanyId, protocol.MarkFlagZan, request.SourceType, request.LastId, request.PageSize); err != nil { | ||
| 176 | + if err == orm.ErrNoRows { | ||
| 177 | + err = nil | ||
| 178 | + return | ||
| 179 | + } | ||
| 180 | + return | ||
| 181 | + } | ||
| 182 | + for i := range favorites { | ||
| 183 | + f := favorites[i] | ||
| 184 | + if baseUserInfo, err = agg.GetUserBaseInfo(f.UserId, header.CompanyId); err != nil { | ||
| 185 | + log.Error(err) | ||
| 186 | + //return | ||
| 187 | + continue | ||
| 188 | + } | ||
| 189 | + item := &protocol.Thumbups{ | ||
| 190 | + Id: f.Id, | ||
| 191 | + Provider: baseUserInfo, | ||
| 192 | + CreateTime: f.CreateAt.Unix() * 1000, | ||
| 193 | + } | ||
| 194 | + rsp.Thumbups = append(rsp.Thumbups, item) | ||
| 195 | + } | ||
| 196 | + rsp.Total = total | ||
| 197 | + return | ||
| 198 | +} | ||
| 199 | + | ||
| 144 | //评论详情-不带地下评论 | 200 | //评论详情-不带地下评论 |
| 145 | func CommentDetailsSingle(header *protocol.RequestHeader, request *protocol.CommentDetailsSingleRequest) (rsp *protocol.CommentDetailsSingleResponse, err error) { | 201 | func CommentDetailsSingle(header *protocol.RequestHeader, request *protocol.CommentDetailsSingleRequest) (rsp *protocol.CommentDetailsSingleResponse, err error) { |
| 146 | var ( | 202 | var ( |
| @@ -17,15 +17,25 @@ import ( | @@ -17,15 +17,25 @@ import ( | ||
| 17 | func MessageCenter(header *protocol.RequestHeader, request *protocol.MessageCenterRequest) (rsp *protocol.MessageCenterResponse, err error) { | 17 | func MessageCenter(header *protocol.RequestHeader, request *protocol.MessageCenterRequest) (rsp *protocol.MessageCenterResponse, err error) { |
| 18 | var () | 18 | var () |
| 19 | rsp = &protocol.MessageCenterResponse{} | 19 | rsp = &protocol.MessageCenterResponse{} |
| 20 | - err = models.GetUserMsgTotals(header.Uid, header.CompanyId, request.MsgType, &rsp.Totals) | 20 | + err = models.GetUserMsgTotals(header.UserId, header.CompanyId, request.MsgType, &rsp.Totals) |
| 21 | return | 21 | return |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | //标记已读 | 24 | //标记已读 |
| 25 | func MsgCenterRead(header *protocol.RequestHeader, request *protocol.MsgCenterReadRequest) (rsp *protocol.MsgCenterReadResponse, err error) { | 25 | func MsgCenterRead(header *protocol.RequestHeader, request *protocol.MsgCenterReadRequest) (rsp *protocol.MsgCenterReadResponse, err error) { |
| 26 | - var () | ||
| 27 | - //rsp =&protocol.MsgCenterReadResponse{} | ||
| 28 | - err = models.UpdateUserMsgSetRead(header.Uid, header.CompanyId, request.MsgType, request.MsgId) | 26 | + var ( |
| 27 | + msg *models.UserMsg | ||
| 28 | + ) | ||
| 29 | + rsp = &protocol.MsgCenterReadResponse{} | ||
| 30 | + if msg, err = models.GetUserMsgById(request.MsgId); err != nil { | ||
| 31 | + log.Error(err) | ||
| 32 | + err = protocol.NewErrWithMessage(5401) | ||
| 33 | + return | ||
| 34 | + } | ||
| 35 | + if msg.IsRead == 1 { | ||
| 36 | + return | ||
| 37 | + } | ||
| 38 | + err = models.UpdateUserMsgSetRead(header.UserId, header.CompanyId, request.MsgType, request.MsgId) | ||
| 29 | if err != nil { | 39 | if err != nil { |
| 30 | log.Error(err) | 40 | log.Error(err) |
| 31 | } | 41 | } |
| @@ -35,7 +45,8 @@ func MsgCenterRead(header *protocol.RequestHeader, request *protocol.MsgCenterRe | @@ -35,7 +45,8 @@ func MsgCenterRead(header *protocol.RequestHeader, request *protocol.MsgCenterRe | ||
| 35 | //标记全部已读 | 45 | //标记全部已读 |
| 36 | func MsgCenterAllRead(header *protocol.RequestHeader, request *protocol.MsgCenterAllReadRequest) (rsp *protocol.MsgCenterAllReadResponse, err error) { | 46 | func MsgCenterAllRead(header *protocol.RequestHeader, request *protocol.MsgCenterAllReadRequest) (rsp *protocol.MsgCenterAllReadResponse, err error) { |
| 37 | var () | 47 | var () |
| 38 | - err = models.UpdateUserMsgSetRead(header.Uid, header.CompanyId, request.MsgType, 0) | 48 | + rsp = &protocol.MsgCenterAllReadResponse{} |
| 49 | + err = models.UpdateUserMsgSetRead(header.UserId, header.CompanyId, request.MsgType, 0) | ||
| 39 | if err != nil { | 50 | if err != nil { |
| 40 | log.Error(err) | 51 | log.Error(err) |
| 41 | } | 52 | } |
| @@ -48,7 +59,7 @@ func MsgInteractive(header *protocol.RequestHeader, request *protocol.MsgInterac | @@ -48,7 +59,7 @@ func MsgInteractive(header *protocol.RequestHeader, request *protocol.MsgInterac | ||
| 48 | userMsgs []*models.UserMsg | 59 | userMsgs []*models.UserMsg |
| 49 | ) | 60 | ) |
| 50 | rsp = &protocol.MsgInteractiveResponse{} | 61 | rsp = &protocol.MsgInteractiveResponse{} |
| 51 | - userMsgs, rsp.Total, err = models.GetUserMsgs(header.Uid, header.CompanyId, request.MsgType, request.SourceType, request.LastId, request.PageSize) | 62 | + userMsgs, rsp.Total, err = models.GetUserMsgs(header.UserId, header.CompanyId, request.MsgType, request.SourceType, request.LastId, request.PageSize) |
| 52 | if err != nil { | 63 | if err != nil { |
| 53 | log.Error(err) | 64 | log.Error(err) |
| 54 | return | 65 | return |
| @@ -60,7 +71,7 @@ func MsgInteractive(header *protocol.RequestHeader, request *protocol.MsgInterac | @@ -60,7 +71,7 @@ func MsgInteractive(header *protocol.RequestHeader, request *protocol.MsgInterac | ||
| 60 | for i := range userMsgs { | 71 | for i := range userMsgs { |
| 61 | msg := userMsgs[i] | 72 | msg := userMsgs[i] |
| 62 | userMsg := &protocol.UserMsg{ | 73 | userMsg := &protocol.UserMsg{ |
| 63 | - Id: msg.Id, | 74 | + BulletinId: msg.Id, |
| 64 | Content: msg.Message, | 75 | Content: msg.Message, |
| 65 | CreateAt: msg.CreateAt.Unix(), | 76 | CreateAt: msg.CreateAt.Unix(), |
| 66 | IsRead: int(msg.IsRead), | 77 | IsRead: int(msg.IsRead), |
| @@ -155,6 +166,7 @@ func AnnouncementRead(header *protocol.RequestHeader, request *protocol.Announce | @@ -155,6 +166,7 @@ func AnnouncementRead(header *protocol.RequestHeader, request *protocol.Announce | ||
| 155 | //消息中心-公司公告 | 166 | //消息中心-公司公告 |
| 156 | func MsgCompanyNotice(header *protocol.RequestHeader, request *protocol.MsgCompanyNoticeRequest) (rsp *protocol.MsgCompanyNoticeResponse, err error) { | 167 | func MsgCompanyNotice(header *protocol.RequestHeader, request *protocol.MsgCompanyNoticeRequest) (rsp *protocol.MsgCompanyNoticeResponse, err error) { |
| 157 | type MsgBulletin struct { | 168 | type MsgBulletin struct { |
| 169 | + MsgId int64 `orm:"column(msg_id)"` | ||
| 158 | Id int `orm:"column(id)"` | 170 | Id int `orm:"column(id)"` |
| 159 | Title string `orm:"column(title)"` | 171 | Title string `orm:"column(title)"` |
| 160 | UpdateTime int64 `orm:"column(update_at)"` | 172 | UpdateTime int64 `orm:"column(update_at)"` |
| @@ -173,11 +185,13 @@ func MsgCompanyNotice(header *protocol.RequestHeader, request *protocol.MsgCompa | @@ -173,11 +185,13 @@ func MsgCompanyNotice(header *protocol.RequestHeader, request *protocol.MsgCompa | ||
| 173 | for i := range msgBulletins { | 185 | for i := range msgBulletins { |
| 174 | tmp := msgBulletins[i] | 186 | tmp := msgBulletins[i] |
| 175 | rsp.Lists = append(rsp.Lists, protocol.UserMsg{ | 187 | rsp.Lists = append(rsp.Lists, protocol.UserMsg{ |
| 176 | - Id: int64(tmp.Id), | 188 | + MsgId: tmp.MsgId, |
| 189 | + BulletinId: int64(tmp.Id), | ||
| 177 | SourceType: models.MsgTypeBulletin, | 190 | SourceType: models.MsgTypeBulletin, |
| 178 | Content: tmp.Title, | 191 | Content: tmp.Title, |
| 179 | CreateAt: tmp.UpdateTime, | 192 | CreateAt: tmp.UpdateTime, |
| 180 | IsRead: int(tmp.IsRead), | 193 | IsRead: int(tmp.IsRead), |
| 194 | + Link: fmt.Sprintf("%v/#/ability/announcement?id=%v&uid=%v&oppo=", beego.AppConfig.String("h5_host"), tmp.Id, header.UserId), | ||
| 181 | }) | 195 | }) |
| 182 | } | 196 | } |
| 183 | return | 197 | return |
| @@ -241,6 +255,192 @@ func MsgChanceApprove(header *protocol.RequestHeader, request *protocol.MsgChanc | @@ -241,6 +255,192 @@ func MsgChanceApprove(header *protocol.RequestHeader, request *protocol.MsgChanc | ||
| 241 | return | 255 | return |
| 242 | } | 256 | } |
| 243 | 257 | ||
| 258 | +// 消息中心-我提交的 | ||
| 259 | +func MsgChanceSubmit(header *protocol.RequestHeader, request *protocol.MsgChanceSubmitRequest) (rsp *protocol.MsgChanceSubmitResponse, err error) { | ||
| 260 | + var ( | ||
| 261 | + myChances []protocol.MsgChanceApproveItemOrm | ||
| 262 | + total int | ||
| 263 | + provider *protocol.BaseUserInfo | ||
| 264 | + ) | ||
| 265 | + if total, err = models.GetChanceMsg(header.UserId, request.LastId, request.PageSize, protocol.MsgTypeAuditBy, &myChances); err != nil { | ||
| 266 | + if err == orm.ErrNoRows { | ||
| 267 | + err = nil | ||
| 268 | + return | ||
| 269 | + } | ||
| 270 | + log.Error(err) | ||
| 271 | + return | ||
| 272 | + } | ||
| 273 | + rsp = &protocol.MsgChanceSubmitResponse{Total: total} | ||
| 274 | + for i := 0; i < len(myChances); i++ { | ||
| 275 | + chance := myChances[i] | ||
| 276 | + commItem := protocol.CommonListItem{} | ||
| 277 | + commItem.ReviewStatus = chance.ReviewStatus | ||
| 278 | + if len(chance.SourceContent) == 0 { //机会删除 | ||
| 279 | + commItem.ChanceStatus = protocol.ChanceStatusDelete | ||
| 280 | + } else if chance.ChanceEnableStatus == 0 { //机会关闭 | ||
| 281 | + commItem.ChanceStatus = protocol.ChanceStatusClose | ||
| 282 | + } else { | ||
| 283 | + if provider, err = agg.GetUserBaseInfo(chance.ChanceUserId, header.CompanyId); err != nil { | ||
| 284 | + commItem.ChanceStatus = protocol.ChanceStatusDelete | ||
| 285 | + log.Error(err) | ||
| 286 | + continue | ||
| 287 | + } else { | ||
| 288 | + item := protocol.ChanceItem{ | ||
| 289 | + Id: chance.ChanceId, | ||
| 290 | + Provider: provider, | ||
| 291 | + CreateTime: chance.CreateTime.Unix() * 1000, | ||
| 292 | + } | ||
| 293 | + utils.JsonUnmarshal(chance.SourceContent, &item.FormList) | ||
| 294 | + item.FormList = agg.ClearEmptyForm(item.FormList) | ||
| 295 | + utils.JsonUnmarshal(chance.Images, &item.Pictures) | ||
| 296 | + utils.JsonUnmarshal(chance.Voices, &item.Speechs) | ||
| 297 | + utils.JsonUnmarshal(chance.Videos, &item.Videos) | ||
| 298 | + commItem.Chance = item | ||
| 299 | + } | ||
| 300 | + } | ||
| 301 | + | ||
| 302 | + if chance.ReviewStatus == protocol.ReviewStatusPass { | ||
| 303 | + var approveData *protocol.ApproveData | ||
| 304 | + utils.JsonUnmarshal(chance.ApproveData, &approveData) | ||
| 305 | + if approveData != nil { | ||
| 306 | + commItem.Score = approveData.Score | ||
| 307 | + } | ||
| 308 | + } | ||
| 309 | + //审核完有审核数据 | ||
| 310 | + commItem.Message = chance.Message | ||
| 311 | + rsp.List = append(rsp.List, commItem) | ||
| 312 | + } | ||
| 313 | + return | ||
| 314 | +} | ||
| 315 | + | ||
| 316 | +// 消息中心-互动消息.评论 | ||
| 317 | +func MsgChanceComment(header *protocol.RequestHeader, request *protocol.MsgChanceCommentRequest) (rsp *protocol.MsgChanceCommentResponse, err error) { | ||
| 318 | + var ( | ||
| 319 | + myChances []protocol.ChanceCommentItemOrm | ||
| 320 | + total int | ||
| 321 | + provider *protocol.BaseUserInfo | ||
| 322 | + ) | ||
| 323 | + if total, err = models.GetChanceCommentMsg(header.UserId, request.LastId, request.PageSize, protocol.MsgTypeComment, &myChances); err != nil { | ||
| 324 | + if err == orm.ErrNoRows { | ||
| 325 | + err = nil | ||
| 326 | + return | ||
| 327 | + } | ||
| 328 | + log.Error(err) | ||
| 329 | + return | ||
| 330 | + } | ||
| 331 | + rsp = &protocol.MsgChanceCommentResponse{Total: total} | ||
| 332 | + for i := 0; i < len(myChances); i++ { | ||
| 333 | + chance := myChances[i] | ||
| 334 | + commItem := protocol.CommonListItem{} | ||
| 335 | + if chance.SourceType == protocol.SourceTypeChance { | ||
| 336 | + commItem.ReviewStatus = chance.ReviewStatus | ||
| 337 | + if len(chance.SourceContent) == 0 { //机会删除 | ||
| 338 | + commItem.ChanceStatus = protocol.ChanceStatusDelete | ||
| 339 | + } else if chance.ChanceEnableStatus == 0 { //机会关闭 | ||
| 340 | + commItem.ChanceStatus = protocol.ChanceStatusClose | ||
| 341 | + } else { | ||
| 342 | + if provider, err = agg.GetUserBaseInfo(chance.Uid, header.CompanyId); err != nil { | ||
| 343 | + commItem.ChanceStatus = protocol.ChanceStatusDelete | ||
| 344 | + log.Error(err) | ||
| 345 | + //return | ||
| 346 | + } else { | ||
| 347 | + item := protocol.ChanceItem{ | ||
| 348 | + Id: chance.SourceId, | ||
| 349 | + Provider: provider, | ||
| 350 | + CreateTime: chance.CreateTime.Unix() * 1000, | ||
| 351 | + } | ||
| 352 | + utils.JsonUnmarshal(chance.SourceContent, &item.FormList) | ||
| 353 | + item.FormList = protocol.ClearEmptyForm(item.FormList) | ||
| 354 | + utils.JsonUnmarshal(chance.Images, &item.Pictures) | ||
| 355 | + utils.JsonUnmarshal(chance.Voices, &item.Speechs) | ||
| 356 | + utils.JsonUnmarshal(chance.Videos, &item.Videos) | ||
| 357 | + commItem.Chance = item | ||
| 358 | + } | ||
| 359 | + } | ||
| 360 | + commItem.ReviewStatus = chance.ReviewStatus | ||
| 361 | + } | ||
| 362 | + if chance.SourceType == protocol.SourceTypeComment { | ||
| 363 | + commItem.CommentedData = protocol.CommentData{ | ||
| 364 | + Id: chance.SourceId, | ||
| 365 | + Content: chance.CommentedContent, | ||
| 366 | + CommentTime: chance.CommentedTime.Unix() * 1000, | ||
| 367 | + } | ||
| 368 | + } | ||
| 369 | + commItem.CommentData = protocol.CommentData{ | ||
| 370 | + Id: chance.CommentId, | ||
| 371 | + CommentTime: chance.CommentTime.Unix() * 1000, | ||
| 372 | + Content: chance.CommentContent, | ||
| 373 | + } | ||
| 374 | + commItem.SourceType = chance.SourceType | ||
| 375 | + rsp.List = append(rsp.List, commItem) | ||
| 376 | + } | ||
| 377 | + return | ||
| 378 | +} | ||
| 379 | + | ||
| 380 | +//消息中心-互动消息.点赞 | ||
| 381 | +func MsgChanceThumbUp(header *protocol.RequestHeader, request *protocol.MsgChanceThumbUpRequest) (rsp *protocol.MsgChanceThumbUpResponse, err error) { | ||
| 382 | + var ( | ||
| 383 | + myChances []protocol.ChanceCommentItemOrm | ||
| 384 | + total int | ||
| 385 | + provider *protocol.BaseUserInfo | ||
| 386 | + ) | ||
| 387 | + if total, err = models.GetChanceCommentMsg(header.UserId, request.LastId, request.PageSize, protocol.MsgTypeThumbUp, &myChances); err != nil { | ||
| 388 | + if err == orm.ErrNoRows { | ||
| 389 | + err = nil | ||
| 390 | + return | ||
| 391 | + } | ||
| 392 | + log.Error(err) | ||
| 393 | + return | ||
| 394 | + } | ||
| 395 | + rsp = &protocol.MsgChanceThumbUpResponse{Total: total} | ||
| 396 | + for i := 0; i < len(myChances); i++ { | ||
| 397 | + chance := myChances[i] | ||
| 398 | + commItem := protocol.CommonListItem{} | ||
| 399 | + if chance.SourceType == protocol.SourceTypeChance { | ||
| 400 | + commItem.ReviewStatus = chance.ReviewStatus | ||
| 401 | + if len(chance.SourceContent) == 0 { //机会删除 | ||
| 402 | + commItem.ChanceStatus = protocol.ChanceStatusDelete | ||
| 403 | + } else if chance.ChanceEnableStatus == 0 { //机会关闭 | ||
| 404 | + commItem.ChanceStatus = protocol.ChanceStatusClose | ||
| 405 | + } else { | ||
| 406 | + if provider, err = agg.GetUserBaseInfo(chance.Uid, header.CompanyId); err != nil { | ||
| 407 | + commItem.ChanceStatus = protocol.ChanceStatusDelete | ||
| 408 | + log.Error(err) | ||
| 409 | + //return | ||
| 410 | + } else { | ||
| 411 | + item := protocol.ChanceItem{ | ||
| 412 | + Id: chance.SourceId, | ||
| 413 | + Provider: provider, | ||
| 414 | + CreateTime: chance.CreateTime.Unix() * 1000, | ||
| 415 | + } | ||
| 416 | + utils.JsonUnmarshal(chance.SourceContent, &item.FormList) | ||
| 417 | + item.FormList = protocol.ClearEmptyForm(item.FormList) | ||
| 418 | + utils.JsonUnmarshal(chance.Images, &item.Pictures) | ||
| 419 | + utils.JsonUnmarshal(chance.Voices, &item.Speechs) | ||
| 420 | + utils.JsonUnmarshal(chance.Videos, &item.Videos) | ||
| 421 | + commItem.Chance = item | ||
| 422 | + } | ||
| 423 | + } | ||
| 424 | + commItem.ReviewStatus = chance.ReviewStatus | ||
| 425 | + } | ||
| 426 | + if chance.SourceType == protocol.SourceTypeComment { | ||
| 427 | + commItem.CommentedData = protocol.CommentData{ | ||
| 428 | + Id: chance.SourceId, | ||
| 429 | + Content: chance.CommentedContent, | ||
| 430 | + CommentTime: chance.CommentedTime.Unix() * 1000, | ||
| 431 | + } | ||
| 432 | + } | ||
| 433 | + commItem.ThumbUpData = protocol.ThumbUpData{ | ||
| 434 | + Id: chance.CommentId, | ||
| 435 | + ThumbUpTime: chance.CommentTime.Unix() * 1000, | ||
| 436 | + Content: chance.CommentContent, | ||
| 437 | + } | ||
| 438 | + commItem.SourceType = chance.SourceType | ||
| 439 | + rsp.List = append(rsp.List, commItem) | ||
| 440 | + } | ||
| 441 | + return | ||
| 442 | +} | ||
| 443 | + | ||
| 244 | //H5公告详情 | 444 | //H5公告详情 |
| 245 | func H5Announcement(header *protocol.RequestHeader, request *protocol.AnnouncementRequest) (rsp *protocol.AnnouncementResponse, err error) { | 445 | func H5Announcement(header *protocol.RequestHeader, request *protocol.AnnouncementRequest) (rsp *protocol.AnnouncementResponse, err error) { |
| 246 | var ( | 446 | var ( |
| @@ -299,7 +499,10 @@ func H5Announcement(header *protocol.RequestHeader, request *protocol.Announceme | @@ -299,7 +499,10 @@ func H5Announcement(header *protocol.RequestHeader, request *protocol.Announceme | ||
| 299 | return | 499 | return |
| 300 | } | 500 | } |
| 301 | if userMsg.IsRead == 0 { //判断是否可以置为 已读 | 501 | if userMsg.IsRead == 0 { //判断是否可以置为 已读 |
| 302 | - if bulletin.AllowClose == 2 && bulletin != nil && bulletin.Id != 0 { | 502 | + //if bulletin.AllowClose == 2 && bulletin != nil && bulletin.Id != 0 { |
| 503 | + // setRead = true | ||
| 504 | + //} | ||
| 505 | + if bulletin.AllowClose == 0 { | ||
| 303 | setRead = true | 506 | setRead = true |
| 304 | } | 507 | } |
| 305 | } | 508 | } |
| @@ -373,6 +373,21 @@ func UserStatistics(header *protocol.RequestHeader, request *protocol.UserStatis | @@ -373,6 +373,21 @@ func UserStatistics(header *protocol.RequestHeader, request *protocol.UserStatis | ||
| 373 | for flag = 1; flag <= (protocol.MyAuditChanceReturn); flag = flag << 1 { | 373 | for flag = 1; flag <= (protocol.MyAuditChanceReturn); flag = flag << 1 { |
| 374 | total = 0 | 374 | total = 0 |
| 375 | switch flag { | 375 | switch flag { |
| 376 | + case protocol.CollectStatic: //收藏 | ||
| 377 | + if total, err = models.GetChanceCollect(header.UserId, 0, 0, nil); err != nil { | ||
| 378 | + log.Error(err) | ||
| 379 | + } | ||
| 380 | + break | ||
| 381 | + case protocol.ZanStatic: //点赞 | ||
| 382 | + if total, err = models.GetChanceThumbUp(header.UserId, 0, 0, nil); err != nil { | ||
| 383 | + log.Error(err) | ||
| 384 | + } | ||
| 385 | + break | ||
| 386 | + case protocol.CommentStatic: //评论 | ||
| 387 | + if total, err = models.GetChanceComment(header.UserId, 0, 0, nil); err != nil { | ||
| 388 | + log.Error(err) | ||
| 389 | + } | ||
| 390 | + break | ||
| 376 | case protocol.MyCommitChance: | 391 | case protocol.MyCommitChance: |
| 377 | if total, err = agg.MyChanceStatic(header, protocol.ReviewStatusAuditging, protocol.ReviewStatusReturn, protocol.ReviewStatusPass); err != nil { | 392 | if total, err = agg.MyChanceStatic(header, protocol.ReviewStatusAuditging, protocol.ReviewStatusReturn, protocol.ReviewStatusPass); err != nil { |
| 378 | log.Error(err) | 393 | log.Error(err) |
-
请 注册 或 登录 后发表评论