正在显示
12 个修改的文件
包含
299 行增加
和
6 行删除
| @@ -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 = "https://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" |
| @@ -510,6 +510,27 @@ func (this *ChanceController) MyThumbUpChance() { | @@ -510,6 +510,27 @@ func (this *ChanceController) MyThumbUpChance() { | ||
| 510 | msg = protocol.NewReturnResponse(chance.MyThumbUpChance(header, request)) | 510 | msg = protocol.NewReturnResponse(chance.MyThumbUpChance(header, request)) |
| 511 | } | 511 | } |
| 512 | 512 | ||
| 513 | +//MyComment 我的评论 | ||
| 514 | +//@router /myComment [post] | ||
| 515 | +func (this *ChanceController) MyComment() { | ||
| 516 | + var msg *protocol.ResponseMessage | ||
| 517 | + defer func() { | ||
| 518 | + this.Resp(msg) | ||
| 519 | + }() | ||
| 520 | + var request *protocol.MyCommentRequest | ||
| 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.MyComment(header, request)) | ||
| 532 | +} | ||
| 533 | + | ||
| 513 | //ChancePool 机会池 | 534 | //ChancePool 机会池 |
| 514 | //@router /chancePool [post] | 535 | //@router /chancePool [post] |
| 515 | func (this *ChanceController) ChancePool() { | 536 | func (this *ChanceController) ChancePool() { |
| @@ -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,24 @@ func (this *MessageController) MsgChanceApprove() { | @@ -179,3 +179,24 @@ 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 | +} |
| @@ -219,3 +219,30 @@ limit ?`) | @@ -219,3 +219,30 @@ limit ?`) | ||
| 219 | } | 219 | } |
| 220 | return | 220 | return |
| 221 | } | 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 { | ||
| 244 | + return | ||
| 245 | + } | ||
| 246 | + } | ||
| 247 | + return | ||
| 248 | +} |
| @@ -155,7 +155,7 @@ func GetUserMsgs(userId, companyId int64, msgType int, sourceType int, lastId in | @@ -155,7 +155,7 @@ func GetUserMsgs(userId, companyId int64, msgType int, sourceType int, lastId in | ||
| 155 | 155 | ||
| 156 | //获取公告消息列表 | 156 | //获取公告消息列表 |
| 157 | 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) { |
| 158 | - sql := `select b.id,b.title,unix_timestamp(b.update_at) update_at,a.is_read ` | 158 | + sql := `select b.id,b.title,unix_timestamp(b.update_at)*1000 update_at,a.is_read ` |
| 159 | sqlCount := `select count(0) ` | 159 | sqlCount := `select count(0) ` |
| 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 ` | 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 ` |
| 161 | sqlCount += where | 161 | sqlCount += where |
| @@ -218,6 +218,16 @@ type MyThumbUpChanceResponse struct { | @@ -218,6 +218,16 @@ type MyThumbUpChanceResponse struct { | ||
| 218 | Total int `json:"total"` | 218 | Total int `json:"total"` |
| 219 | } | 219 | } |
| 220 | 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 | + | ||
| 221 | //机会池列表 | 231 | //机会池列表 |
| 222 | type ChancePoolItemOrm struct { | 232 | type ChancePoolItemOrm struct { |
| 223 | ChanceId int64 `orm:"column(id)"` | 233 | ChanceId int64 `orm:"column(id)"` |
| @@ -286,6 +296,40 @@ type ChanceThumbUpItemOrm struct { | @@ -286,6 +296,40 @@ type ChanceThumbUpItemOrm struct { | ||
| 286 | CollectTime time.Time `orm:"column(collect_time)"` //收藏时间 | 296 | CollectTime time.Time `orm:"column(collect_time)"` //收藏时间 |
| 287 | } | 297 | } |
| 288 | 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 | + //ApproveData string `json:"approveData"` //审核数据 | ||
| 312 | + //TemplateId int `orm:"column(audit_template_id)"` | ||
| 313 | + //ChanceTypeId int `orm:"column(chance_type_id)"` | ||
| 314 | + | ||
| 315 | + CommentTotal int `orm:"column(comment_total)"` | ||
| 316 | + ZanTotal int `orm:"column(zan_total)"` | ||
| 317 | + ViewTotal int `orm:"column(view_total)"` | ||
| 318 | + | ||
| 319 | + CommentId int64 `orm:"column(id)"` | ||
| 320 | + CommentContent string `orm:"column(content)"` | ||
| 321 | + CommentTime time.Time `orm:"column(comment_time)"` | ||
| 322 | + | ||
| 323 | + //被评论的对象 | ||
| 324 | + CommentedUserId int64 `orm:"column(commented_user_id)"` | ||
| 325 | + CommentedContent string `orm:"column(commented_content)"` | ||
| 326 | + CommentedTime time.Time `orm:"column(commented_time)"` //收藏时间 | ||
| 327 | + | ||
| 328 | + //评论对象类型 | ||
| 329 | + SourceType int `orm:"column(source_type)"` | ||
| 330 | + SourceId int64 `orm:"column(source_id)"` | ||
| 331 | +} | ||
| 332 | + | ||
| 289 | /*ChanceDetail 机会详情*/ | 333 | /*ChanceDetail 机会详情*/ |
| 290 | type ChanceDetailRequest struct { | 334 | type ChanceDetailRequest struct { |
| 291 | Id int64 `json:"id"` //机会编号 | 335 | Id int64 `json:"id"` //机会编号 |
| @@ -430,6 +474,10 @@ type CommonListItem struct { | @@ -430,6 +474,10 @@ type CommonListItem struct { | ||
| 430 | ChanceType interface{} `json:"chanceType,omitempty"` //机会类型 | 474 | ChanceType interface{} `json:"chanceType,omitempty"` //机会类型 |
| 431 | ChanceTemplate interface{} `json:"template,omitempty"` //机会模板 | 475 | ChanceTemplate interface{} `json:"template,omitempty"` //机会模板 |
| 432 | 476 | ||
| 477 | + //我评论的 评论数据 | ||
| 478 | + CommentedData interface{} `json:"commentedData,omitempty"` | ||
| 479 | + SourceType int `json:"sourceType,omitempty"` //类型 1:机会 2:评论 | ||
| 480 | + | ||
| 433 | ChanceStatus int `json:"chanceStatus"` //0:正常 1.删除 2.关闭 | 481 | ChanceStatus int `json:"chanceStatus"` //0:正常 1.删除 2.关闭 |
| 434 | ReviewStatus int `json:"reviewStatus"` //审核状态 | 482 | ReviewStatus int `json:"reviewStatus"` //审核状态 |
| 435 | } | 483 | } |
| @@ -462,3 +510,10 @@ type ThumbUpData struct { | @@ -462,3 +510,10 @@ type ThumbUpData struct { | ||
| 462 | Id int64 `json:"id"` | 510 | Id int64 `json:"id"` |
| 463 | ThumbUpTime int64 `json:"thumbUpTime"` //收藏时间 | 511 | ThumbUpTime int64 `json:"thumbUpTime"` //收藏时间 |
| 464 | } | 512 | } |
| 513 | + | ||
| 514 | +//评论内容 | ||
| 515 | +type CommentData struct { | ||
| 516 | + Id int64 `json:"id"` //评论编号 | ||
| 517 | + Content string `json:"content"` //评论内容 | ||
| 518 | + CommentTime int64 `json:"commentTime"` //评论时间 | ||
| 519 | +} |
| @@ -55,7 +55,7 @@ const ( | @@ -55,7 +55,7 @@ const ( | ||
| 55 | MsgTypeCommend = 2 //表彰 | 55 | MsgTypeCommend = 2 //表彰 |
| 56 | MsgTypeInteraction = 4 //互动消息 | 56 | MsgTypeInteraction = 4 //互动消息 |
| 57 | MsgTypeAudit = 8 //机会审核 | 57 | MsgTypeAudit = 8 //机会审核 |
| 58 | - MsgTypeAuditBy = 16 //机会被审核消息 | 58 | + MsgTypeAuditBy = 16 //机会被审核消息-我提交的 |
| 59 | MsgTypeComment = 32 //评论 | 59 | MsgTypeComment = 32 //评论 |
| 60 | MsgTypeThumbUp = 64 //点赞 | 60 | MsgTypeThumbUp = 64 //点赞 |
| 61 | ) | 61 | ) |
| @@ -116,6 +116,7 @@ type UserMsg struct { | @@ -116,6 +116,7 @@ type UserMsg struct { | ||
| 116 | CreateAt int64 `json:"msgTime"` | 116 | CreateAt int64 `json:"msgTime"` |
| 117 | IsRead int `json:"isRead"` | 117 | IsRead int `json:"isRead"` |
| 118 | //机会 //评论 | 118 | //机会 //评论 |
| 119 | + Link string `json:"link,omitempty"` | ||
| 119 | } | 120 | } |
| 120 | 121 | ||
| 121 | type Message struct { | 122 | type Message struct { |
| @@ -212,6 +213,16 @@ type MsgChanceApproveResponse struct { | @@ -212,6 +213,16 @@ type MsgChanceApproveResponse struct { | ||
| 212 | Total int `json:"total"` | 213 | Total int `json:"total"` |
| 213 | } | 214 | } |
| 214 | 215 | ||
| 216 | +/*MsgChanceSubmit 我提交的*/ | ||
| 217 | +type MsgChanceSubmitRequest struct { | ||
| 218 | + LastId int64 `json:"lastId"` | ||
| 219 | + PageSize int `json:"pageSize" valid:"Required"` | ||
| 220 | +} | ||
| 221 | +type MsgChanceSubmitResponse struct { | ||
| 222 | + List []CommonListItem `json:"list"` | ||
| 223 | + Total int `json:"total"` | ||
| 224 | +} | ||
| 225 | + | ||
| 215 | //我的审核机会列表 | 226 | //我的审核机会列表 |
| 216 | type MsgChanceApproveItemOrm struct { | 227 | type MsgChanceApproveItemOrm struct { |
| 217 | ChanceUserId int64 `orm:"column(chance_user_id)"` | 228 | ChanceUserId int64 `orm:"column(chance_user_id)"` |
| @@ -185,6 +185,14 @@ func init() { | @@ -185,6 +185,14 @@ func init() { | ||
| 185 | 185 | ||
| 186 | beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"], | 186 | beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"], |
| 187 | beego.ControllerComments{ | 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{ | ||
| 188 | Method: "MySubmitChance", | 196 | Method: "MySubmitChance", |
| 189 | Router: `/mySubmitChance`, | 197 | Router: `/mySubmitChance`, |
| 190 | AllowHTTPMethods: []string{"post"}, | 198 | AllowHTTPMethods: []string{"post"}, |
| @@ -313,6 +321,14 @@ func init() { | @@ -313,6 +321,14 @@ func init() { | ||
| 313 | 321 | ||
| 314 | beego.GlobalControllerRouter["opp/controllers/v1:MessageController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:MessageController"], | 322 | beego.GlobalControllerRouter["opp/controllers/v1:MessageController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:MessageController"], |
| 315 | beego.ControllerComments{ | 323 | beego.ControllerComments{ |
| 324 | + Method: "MsgChanceSubmit", | ||
| 325 | + Router: `/msgChanceSubmit`, | ||
| 326 | + AllowHTTPMethods: []string{"post"}, | ||
| 327 | + MethodParams: param.Make(), | ||
| 328 | + Params: nil}) | ||
| 329 | + | ||
| 330 | + beego.GlobalControllerRouter["opp/controllers/v1:MessageController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:MessageController"], | ||
| 331 | + beego.ControllerComments{ | ||
| 316 | Method: "MsgCompanyNotice", | 332 | Method: "MsgCompanyNotice", |
| 317 | Router: `/msgCompanyNotice`, | 333 | Router: `/msgCompanyNotice`, |
| 318 | AllowHTTPMethods: []string{"post"}, | 334 | AllowHTTPMethods: []string{"post"}, |
| @@ -344,8 +344,8 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | @@ -344,8 +344,8 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | ||
| 344 | for i := range approveItemResponse.MessageData.ApplyUserMessage { | 344 | for i := range approveItemResponse.MessageData.ApplyUserMessage { |
| 345 | message := approveItemResponse.MessageData.ApplyUserMessage[i] | 345 | message := approveItemResponse.MessageData.ApplyUserMessage[i] |
| 346 | nextApprovers = append(nextApprovers, message.ReceiverInfo.ReceiverUid) | 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 { | 347 | + if err = agg.SendApprovedMsg(message.ReceiverInfo.ReceiverUid, message.ReceiverInfo.ReceiverName, |
| 348 | + header.CompanyId, chance.Id, chance.ChanceTypeId, request.ReviewStatus, protocol.MsgTypeAuditBy); err != nil { | ||
| 349 | log.Error(err) | 349 | log.Error(err) |
| 350 | return | 350 | return |
| 351 | } | 351 | } |
| @@ -1120,6 +1120,84 @@ func MyThumbUpChance(header *protocol.RequestHeader, request *protocol.MyThumbUp | @@ -1120,6 +1120,84 @@ func MyThumbUpChance(header *protocol.RequestHeader, request *protocol.MyThumbUp | ||
| 1120 | return | 1120 | return |
| 1121 | } | 1121 | } |
| 1122 | 1122 | ||
| 1123 | +//我的评论 | ||
| 1124 | +func MyComment(header *protocol.RequestHeader, request *protocol.MyCommentRequest) (rsp *protocol.MyCommentResponse, err error) { | ||
| 1125 | + var ( | ||
| 1126 | + myChances []protocol.ChanceCommentItemOrm | ||
| 1127 | + total int | ||
| 1128 | + provider *protocol.BaseUserInfo | ||
| 1129 | + ) | ||
| 1130 | + if total, err = models.GetChanceComment(header.UserId, request.LastId, request.PageSize, &myChances); err != nil { | ||
| 1131 | + if err == orm.ErrNoRows { | ||
| 1132 | + err = nil | ||
| 1133 | + return | ||
| 1134 | + } | ||
| 1135 | + log.Error(err) | ||
| 1136 | + return | ||
| 1137 | + } | ||
| 1138 | + rsp = &protocol.MyCommentResponse{Total: total} | ||
| 1139 | + for i := 0; i < len(myChances); i++ { | ||
| 1140 | + chance := myChances[i] | ||
| 1141 | + commItem := protocol.CommonListItem{} | ||
| 1142 | + if chance.SourceType == protocol.SourceTypeChance { | ||
| 1143 | + commItem.ReviewStatus = chance.ReviewStatus | ||
| 1144 | + if len(chance.SourceContent) == 0 { //机会删除 | ||
| 1145 | + commItem.ChanceStatus = protocol.ChanceStatusDelete | ||
| 1146 | + } else if chance.ChanceEnableStatus == 0 { //机会关闭 | ||
| 1147 | + commItem.ChanceStatus = protocol.ChanceStatusClose | ||
| 1148 | + } else { | ||
| 1149 | + if provider, err = agg.GetUserBaseInfo(header.UserId, header.CompanyId); err != nil { | ||
| 1150 | + commItem.ChanceStatus = protocol.ChanceStatusDelete | ||
| 1151 | + log.Error(err) | ||
| 1152 | + //return | ||
| 1153 | + } else { | ||
| 1154 | + item := protocol.ChanceItem{ | ||
| 1155 | + Id: chance.SourceId, | ||
| 1156 | + Provider: provider, | ||
| 1157 | + CreateTime: chance.CreateTime.Unix() * 1000, | ||
| 1158 | + } | ||
| 1159 | + jsonUnmarshal(chance.SourceContent, &item.FormList) | ||
| 1160 | + item.FormList = clearEmptyForm(item.FormList) | ||
| 1161 | + jsonUnmarshal(chance.Images, &item.Pictures) | ||
| 1162 | + jsonUnmarshal(chance.Voices, &item.Speechs) | ||
| 1163 | + jsonUnmarshal(chance.Videos, &item.Videos) | ||
| 1164 | + commItem.Chance = item | ||
| 1165 | + } | ||
| 1166 | + } | ||
| 1167 | + commItem.ReviewStatus = chance.ReviewStatus | ||
| 1168 | + //{ | ||
| 1169 | + // var chanceData = protocol.ChanceData{ | ||
| 1170 | + // ThumbsUpTotal: chance.ZanTotal, | ||
| 1171 | + // CommentTotal: chance.CommentTotal, | ||
| 1172 | + // PageViewTotal: chance.ViewTotal, | ||
| 1173 | + // } | ||
| 1174 | + // chanceData.IsThumbsUp, chanceData.IsCollect, _ = getChanceMarkFlag(header, chance.SourceType) | ||
| 1175 | + // commItem.ChanceData = chanceData | ||
| 1176 | + //} | ||
| 1177 | + //{ | ||
| 1178 | + // //做一次查询 查回所有的模板数据 | ||
| 1179 | + // commItem.ChanceTemplate = getTemplate(chance.TemplateId) | ||
| 1180 | + // commItem.ChanceType = getChanceType(chance.ChanceTypeId) | ||
| 1181 | + //} | ||
| 1182 | + } | ||
| 1183 | + if chance.SourceType == protocol.SourceTypeComment { | ||
| 1184 | + commItem.CommentedData = protocol.CommentData{ | ||
| 1185 | + Id: chance.SourceId, | ||
| 1186 | + Content: chance.CommentedContent, | ||
| 1187 | + CommentTime: chance.CommentedTime.Unix() * 1000, | ||
| 1188 | + } | ||
| 1189 | + } | ||
| 1190 | + commItem.CommentData = protocol.CommentData{ | ||
| 1191 | + Id: chance.CommentId, | ||
| 1192 | + CommentTime: chance.CommentTime.Unix() * 1000, | ||
| 1193 | + Content: chance.CommentContent, | ||
| 1194 | + } | ||
| 1195 | + commItem.SourceType = chance.SourceType | ||
| 1196 | + rsp.List = append(rsp.List, commItem) | ||
| 1197 | + } | ||
| 1198 | + return | ||
| 1199 | +} | ||
| 1200 | + | ||
| 1123 | //获取机会点赞/收藏状态 | 1201 | //获取机会点赞/收藏状态 |
| 1124 | func getChanceMarkFlag(header *protocol.RequestHeader, chanceId int64) (isThumbsUp, isCollect bool, err error) { | 1202 | func getChanceMarkFlag(header *protocol.RequestHeader, chanceId int64) (isThumbsUp, isCollect bool, err error) { |
| 1125 | var flag int | 1203 | var flag int |
| @@ -189,6 +189,7 @@ func MsgCompanyNotice(header *protocol.RequestHeader, request *protocol.MsgCompa | @@ -189,6 +189,7 @@ func MsgCompanyNotice(header *protocol.RequestHeader, request *protocol.MsgCompa | ||
| 189 | Content: tmp.Title, | 189 | Content: tmp.Title, |
| 190 | CreateAt: tmp.UpdateTime, | 190 | CreateAt: tmp.UpdateTime, |
| 191 | IsRead: int(tmp.IsRead), | 191 | IsRead: int(tmp.IsRead), |
| 192 | + Link: fmt.Sprintf("%v/#/ability/announcement?id=%v&uid=%v&oppo=", beego.AppConfig.String("h5_host"), tmp.Id, header.UserId), | ||
| 192 | }) | 193 | }) |
| 193 | } | 194 | } |
| 194 | return | 195 | return |
| @@ -252,6 +253,64 @@ func MsgChanceApprove(header *protocol.RequestHeader, request *protocol.MsgChanc | @@ -252,6 +253,64 @@ func MsgChanceApprove(header *protocol.RequestHeader, request *protocol.MsgChanc | ||
| 252 | return | 253 | return |
| 253 | } | 254 | } |
| 254 | 255 | ||
| 256 | +// 消息中心-我提交的 | ||
| 257 | +func MsgChanceSubmit(header *protocol.RequestHeader, request *protocol.MsgChanceSubmitRequest) (rsp *protocol.MsgChanceSubmitResponse, err error) { | ||
| 258 | + var ( | ||
| 259 | + myChances []protocol.MsgChanceApproveItemOrm | ||
| 260 | + total int | ||
| 261 | + provider *protocol.BaseUserInfo | ||
| 262 | + ) | ||
| 263 | + if total, err = models.GetChanceMsg(header.UserId, request.LastId, request.PageSize, protocol.MsgTypeAuditBy, &myChances); err != nil { | ||
| 264 | + if err == orm.ErrNoRows { | ||
| 265 | + err = nil | ||
| 266 | + return | ||
| 267 | + } | ||
| 268 | + log.Error(err) | ||
| 269 | + return | ||
| 270 | + } | ||
| 271 | + rsp = &protocol.MsgChanceSubmitResponse{Total: total} | ||
| 272 | + for i := 0; i < len(myChances); i++ { | ||
| 273 | + chance := myChances[i] | ||
| 274 | + commItem := protocol.CommonListItem{} | ||
| 275 | + commItem.ReviewStatus = chance.ReviewStatus | ||
| 276 | + if len(chance.SourceContent) == 0 { //机会删除 | ||
| 277 | + commItem.ChanceStatus = protocol.ChanceStatusDelete | ||
| 278 | + } else if chance.ChanceEnableStatus == 0 { //机会关闭 | ||
| 279 | + commItem.ChanceStatus = protocol.ChanceStatusClose | ||
| 280 | + } else { | ||
| 281 | + if provider, err = agg.GetUserBaseInfo(chance.ChanceUserId, header.CompanyId); err != nil { | ||
| 282 | + commItem.ChanceStatus = protocol.ChanceStatusDelete | ||
| 283 | + log.Error(err) | ||
| 284 | + continue | ||
| 285 | + } else { | ||
| 286 | + item := protocol.ChanceItem{ | ||
| 287 | + Id: chance.ChanceId, | ||
| 288 | + Provider: provider, | ||
| 289 | + CreateTime: chance.CreateTime.Unix() * 1000, | ||
| 290 | + } | ||
| 291 | + utils.JsonUnmarshal(chance.SourceContent, &item.FormList) | ||
| 292 | + item.FormList = agg.ClearEmptyForm(item.FormList) | ||
| 293 | + utils.JsonUnmarshal(chance.Images, &item.Pictures) | ||
| 294 | + utils.JsonUnmarshal(chance.Voices, &item.Speechs) | ||
| 295 | + utils.JsonUnmarshal(chance.Videos, &item.Videos) | ||
| 296 | + commItem.Chance = item | ||
| 297 | + } | ||
| 298 | + } | ||
| 299 | + | ||
| 300 | + if chance.ReviewStatus == protocol.ReviewStatusPass { | ||
| 301 | + var approveData *protocol.ApproveData | ||
| 302 | + utils.JsonUnmarshal(chance.ApproveData, &approveData) | ||
| 303 | + if approveData != nil { | ||
| 304 | + commItem.Score = approveData.Score | ||
| 305 | + } | ||
| 306 | + } | ||
| 307 | + //审核完有审核数据 | ||
| 308 | + commItem.Message = chance.Message | ||
| 309 | + rsp.List = append(rsp.List, commItem) | ||
| 310 | + } | ||
| 311 | + return | ||
| 312 | +} | ||
| 313 | + | ||
| 255 | //H5公告详情 | 314 | //H5公告详情 |
| 256 | func H5Announcement(header *protocol.RequestHeader, request *protocol.AnnouncementRequest) (rsp *protocol.AnnouncementResponse, err error) { | 315 | func H5Announcement(header *protocol.RequestHeader, request *protocol.AnnouncementRequest) (rsp *protocol.AnnouncementResponse, err error) { |
| 257 | var ( | 316 | var ( |
| @@ -383,6 +383,11 @@ func UserStatistics(header *protocol.RequestHeader, request *protocol.UserStatis | @@ -383,6 +383,11 @@ func UserStatistics(header *protocol.RequestHeader, request *protocol.UserStatis | ||
| 383 | log.Error(err) | 383 | log.Error(err) |
| 384 | } | 384 | } |
| 385 | break | 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 | ||
| 386 | case protocol.MyCommitChance: | 391 | case protocol.MyCommitChance: |
| 387 | 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 { |
| 388 | log.Error(err) | 393 | log.Error(err) |
-
请 注册 或 登录 后发表评论