|
@@ -303,11 +303,10 @@ func MsgCompanyNotice(header *protocol.RequestHeader, request *protocol.MsgCompa |
|
@@ -303,11 +303,10 @@ func MsgCompanyNotice(header *protocol.RequestHeader, request *protocol.MsgCompa |
303
|
//消息中心-机会审核消息
|
303
|
//消息中心-机会审核消息
|
304
|
func MsgChanceApprove(header *protocol.RequestHeader, request *protocol.MsgChanceApproveRequest) (rsp *protocol.MsgChanceApproveResponse, err error) {
|
304
|
func MsgChanceApprove(header *protocol.RequestHeader, request *protocol.MsgChanceApproveRequest) (rsp *protocol.MsgChanceApproveResponse, err error) {
|
305
|
var (
|
305
|
var (
|
306
|
- myChances []protocol.MsgChanceApproveItemOrm
|
|
|
307
|
- total int
|
|
|
308
|
- provider *protocol.BaseUserInfo
|
306
|
+ ormItems []protocol.MsgChanceApproveItemOrm
|
|
|
307
|
+ total int
|
309
|
)
|
308
|
)
|
310
|
- if total, err = models.GetChanceMsg(header.UserId, request.LastId, request.PageSize, protocol.MsgTypeAudit, &myChances); err != nil {
|
309
|
+ if total, err = models.GetChanceMsg(header.UserId, request.LastId, request.PageSize, protocol.MsgTypeAudit, &ormItems); err != nil {
|
311
|
if err == orm.ErrNoRows {
|
310
|
if err == orm.ErrNoRows {
|
312
|
err = nil
|
311
|
err = nil
|
313
|
return
|
312
|
return
|
|
@@ -317,49 +316,18 @@ func MsgChanceApprove(header *protocol.RequestHeader, request *protocol.MsgChanc |
|
@@ -317,49 +316,18 @@ func MsgChanceApprove(header *protocol.RequestHeader, request *protocol.MsgChanc |
317
|
}
|
316
|
}
|
318
|
rsp = &protocol.MsgChanceApproveResponse{Total: total}
|
317
|
rsp = &protocol.MsgChanceApproveResponse{Total: total}
|
319
|
rsp.List = make([]protocol.MsgCommonListItem, 0)
|
318
|
rsp.List = make([]protocol.MsgCommonListItem, 0)
|
320
|
- for i := 0; i < len(myChances); i++ {
|
|
|
321
|
- chance := myChances[i]
|
319
|
+ for i := 0; i < len(ormItems); i++ {
|
|
|
320
|
+ ormItem := ormItems[i]
|
322
|
commItem := protocol.MsgCommonListItem{}
|
321
|
commItem := protocol.MsgCommonListItem{}
|
323
|
- commItem.ReviewStatus = chance.ReviewStatus
|
|
|
324
|
- if len(chance.SourceContent) == 0 { //机会删除
|
|
|
325
|
- commItem.ChanceStatus = protocol.ChanceStatusDelete
|
|
|
326
|
- } else if chance.ChanceEnableStatus == 0 { //机会关闭
|
|
|
327
|
- commItem.ChanceStatus = protocol.ChanceStatusDelete
|
|
|
328
|
- }
|
|
|
329
|
- if chance.Status == models.ChanceStatusClose {
|
|
|
330
|
- commItem.ChanceStatus = protocol.ChanceStatusClose
|
|
|
331
|
- }
|
|
|
332
|
- if provider, err = agg.GetUserBaseInfo(chance.ChanceUserId, header.CompanyId); err != nil {
|
|
|
333
|
- commItem.ChanceStatus = protocol.ChanceStatusDelete
|
|
|
334
|
- log.Error(err)
|
|
|
335
|
- continue
|
|
|
336
|
- } else {
|
|
|
337
|
- item := protocol.ChanceItem{
|
|
|
338
|
- Id: chance.ChanceId,
|
|
|
339
|
- Provider: provider,
|
|
|
340
|
- CreateTime: chance.CreateTime.Unix() * 1000,
|
|
|
341
|
- }
|
|
|
342
|
- utils.JsonUnmarshal(chance.SourceContent, &item.FormList)
|
|
|
343
|
- item.FormList = agg.ClearEmptyForm(item.FormList)
|
|
|
344
|
- utils.JsonUnmarshal(chance.Images, &item.Pictures)
|
|
|
345
|
- utils.JsonUnmarshal(chance.Voices, &item.Speechs)
|
|
|
346
|
- utils.JsonUnmarshal(chance.Videos, &item.Videos)
|
|
|
347
|
- commItem.Chance = item
|
|
|
348
|
- }
|
322
|
+ commItem.Chance, commItem.ChanceStatus = agg.SetChanceItem(header, ormItem.CommChanceItemOrm)
|
|
|
323
|
+ commItem.ReviewStatus = ormItem.ReviewStatus
|
349
|
|
324
|
|
350
|
- //if chance.ReviewStatus == protocol.ReviewStatusPass {
|
|
|
351
|
- // var approveData *protocol.ApproveData
|
|
|
352
|
- // utils.JsonUnmarshal(chance.ApproveData, &approveData)
|
|
|
353
|
- // if approveData != nil {
|
|
|
354
|
- // commItem.Score = approveData.Score
|
|
|
355
|
- // }
|
|
|
356
|
- //}
|
|
|
357
|
- commItem.MsgId = chance.Id
|
|
|
358
|
- commItem.MsgTime = chance.MsgTime.Unix() * 1000
|
325
|
+ commItem.MsgId = ormItem.Id
|
|
|
326
|
+ commItem.MsgTime = ormItem.MsgTime.Unix() * 1000
|
359
|
//审核完有审核数据
|
327
|
//审核完有审核数据
|
360
|
- commItem.Message = chance.Message
|
|
|
361
|
- commItem.IsRead = chance.IsRead == 1
|
|
|
362
|
- commItem.ChanceId = chance.ChanceId
|
328
|
+ commItem.Message = ormItem.Message
|
|
|
329
|
+ commItem.IsRead = ormItem.IsRead == 1
|
|
|
330
|
+ commItem.ChanceId = ormItem.ChanceId
|
363
|
rsp.List = append(rsp.List, commItem)
|
331
|
rsp.List = append(rsp.List, commItem)
|
364
|
}
|
332
|
}
|
365
|
return
|
333
|
return
|
|
@@ -368,11 +336,10 @@ func MsgChanceApprove(header *protocol.RequestHeader, request *protocol.MsgChanc |
|
@@ -368,11 +336,10 @@ func MsgChanceApprove(header *protocol.RequestHeader, request *protocol.MsgChanc |
368
|
// 消息中心-我提交的
|
336
|
// 消息中心-我提交的
|
369
|
func MsgChanceSubmit(header *protocol.RequestHeader, request *protocol.MsgChanceSubmitRequest) (rsp *protocol.MsgChanceSubmitResponse, err error) {
|
337
|
func MsgChanceSubmit(header *protocol.RequestHeader, request *protocol.MsgChanceSubmitRequest) (rsp *protocol.MsgChanceSubmitResponse, err error) {
|
370
|
var (
|
338
|
var (
|
371
|
- myChances []protocol.MsgChanceApproveItemOrm
|
|
|
372
|
- total int
|
|
|
373
|
- provider *protocol.BaseUserInfo
|
339
|
+ ormItems []protocol.MsgChanceApproveItemOrm
|
374
|
)
|
340
|
)
|
375
|
- if total, err = models.GetChanceMsg(header.UserId, request.LastId, request.PageSize, protocol.MsgTypeAuditBy, &myChances); err != nil {
|
341
|
+ rsp = &protocol.MsgChanceSubmitResponse{List: make([]protocol.MsgCommonListItem, 0)}
|
|
|
342
|
+ if rsp.Total, err = models.GetChanceMsg(header.UserId, request.LastId, request.PageSize, protocol.MsgTypeAuditBy, &ormItems); err != nil {
|
376
|
if err == orm.ErrNoRows {
|
343
|
if err == orm.ErrNoRows {
|
377
|
err = nil
|
344
|
err = nil
|
378
|
return
|
345
|
return
|
|
@@ -380,62 +347,33 @@ func MsgChanceSubmit(header *protocol.RequestHeader, request *protocol.MsgChance |
|
@@ -380,62 +347,33 @@ func MsgChanceSubmit(header *protocol.RequestHeader, request *protocol.MsgChance |
380
|
log.Error(err)
|
347
|
log.Error(err)
|
381
|
return
|
348
|
return
|
382
|
}
|
349
|
}
|
383
|
- rsp = &protocol.MsgChanceSubmitResponse{Total: total}
|
|
|
384
|
- rsp.List = make([]protocol.MsgCommonListItem, 0)
|
|
|
385
|
- for i := 0; i < len(myChances); i++ {
|
|
|
386
|
- chance := myChances[i]
|
350
|
+
|
|
|
351
|
+ for i := 0; i < len(ormItems); i++ {
|
|
|
352
|
+ ormItem := ormItems[i]
|
387
|
commItem := protocol.MsgCommonListItem{}
|
353
|
commItem := protocol.MsgCommonListItem{}
|
388
|
- commItem.ReviewStatus = chance.ReviewStatus
|
|
|
389
|
- if len(chance.SourceContent) == 0 { //机会删除
|
|
|
390
|
- commItem.ChanceStatus = protocol.ChanceStatusDelete
|
|
|
391
|
- } else if chance.ChanceEnableStatus == 0 { //机会关闭
|
|
|
392
|
- commItem.ChanceStatus = protocol.ChanceStatusDelete
|
|
|
393
|
- }
|
|
|
394
|
- if chance.Status == models.ChanceStatusClose {
|
|
|
395
|
- commItem.ChanceStatus = protocol.ChanceStatusClose
|
|
|
396
|
- }
|
|
|
397
|
- approveUserId := chance.ChanceUserId
|
|
|
398
|
- if chance.SenderUserId != 0 {
|
|
|
399
|
- approveUserId = chance.SenderUserId
|
|
|
400
|
- }
|
|
|
401
|
- if provider, err = agg.GetUserBaseInfo(approveUserId, header.CompanyId); err != nil {
|
|
|
402
|
- commItem.ChanceStatus = protocol.ChanceStatusDelete
|
|
|
403
|
- log.Error(err)
|
|
|
404
|
- continue
|
|
|
405
|
- } else {
|
|
|
406
|
- item := protocol.ChanceItem{
|
|
|
407
|
- Id: chance.ChanceId,
|
|
|
408
|
- Provider: provider,
|
|
|
409
|
- CreateTime: chance.CreateTime.Unix() * 1000,
|
|
|
410
|
- }
|
|
|
411
|
- utils.JsonUnmarshal(chance.SourceContent, &item.FormList)
|
|
|
412
|
- item.FormList = agg.ClearEmptyForm(item.FormList)
|
|
|
413
|
- utils.JsonUnmarshal(chance.Images, &item.Pictures)
|
|
|
414
|
- utils.JsonUnmarshal(chance.Voices, &item.Speechs)
|
|
|
415
|
- utils.JsonUnmarshal(chance.Videos, &item.Videos)
|
|
|
416
|
- commItem.Chance = item
|
354
|
+
|
|
|
355
|
+ //注:此处是审核人的用户信息
|
|
|
356
|
+ if ormItem.SenderUserId != 0 {
|
|
|
357
|
+ ormItem.CommChanceItemOrm.ChanceUserId = ormItem.SenderUserId
|
417
|
}
|
358
|
}
|
|
|
359
|
+ commItem.Chance, commItem.ChanceStatus = agg.SetChanceItem(header, ormItem.CommChanceItemOrm)
|
|
|
360
|
+ commItem.ReviewStatus = ormItem.ReviewStatus
|
418
|
|
361
|
|
419
|
- //if chance.ReviewStatus == protocol.ReviewStatusPass {
|
|
|
420
|
- // var approveData *protocol.ApproveData
|
|
|
421
|
- // utils.JsonUnmarshal(chance.ApproveData, &approveData)
|
|
|
422
|
- // if approveData != nil {
|
|
|
423
|
- // commItem.Score = approveData.Score
|
|
|
424
|
- // }
|
|
|
425
|
- //}
|
|
|
426
|
- if len(chance.Data) > 0 && chance.ReviewStatus != protocol.ReviewStatusReturn { //获取评分 && chance.ReviewStatus == protocol.ReviewStatusPass
|
362
|
+ //审核数据
|
|
|
363
|
+ if len(ormItem.Data) > 0 && ormItem.ReviewStatus != protocol.ReviewStatusReturn { //获取评分 && chance.ReviewStatus == protocol.ReviewStatusPass
|
427
|
var msgData *protocol.MsgData
|
364
|
var msgData *protocol.MsgData
|
428
|
- utils.JsonUnmarshal(chance.Data, &msgData)
|
365
|
+ utils.JsonUnmarshal(ormItem.Data, &msgData)
|
429
|
commItem.Score = msgData.Score
|
366
|
commItem.Score = msgData.Score
|
430
|
}
|
367
|
}
|
431
|
- commItem.IsRead = chance.IsRead == 1
|
|
|
432
|
- //审核完有审核数据
|
|
|
433
|
- commItem.Message = chance.Message
|
|
|
434
|
- commItem.MsgId = chance.Id
|
|
|
435
|
- commItem.MsgTime = chance.MsgTime.Unix() * 1000
|
|
|
436
|
- commItem.ChanceId = chance.ChanceId
|
|
|
437
|
- if commItem.ChanceId == 0 && chance.SourceId > 0 {
|
|
|
438
|
- commItem.ChanceId = chance.SourceId
|
368
|
+
|
|
|
369
|
+ //消息基础数据
|
|
|
370
|
+ commItem.IsRead = ormItem.IsRead == 1
|
|
|
371
|
+ commItem.Message = ormItem.Message
|
|
|
372
|
+ commItem.MsgId = ormItem.Id
|
|
|
373
|
+ commItem.MsgTime = ormItem.MsgTime.Unix() * 1000
|
|
|
374
|
+ commItem.ChanceId = ormItem.ChanceId
|
|
|
375
|
+ if commItem.ChanceId == 0 && ormItem.SourceId > 0 {
|
|
|
376
|
+ commItem.ChanceId = ormItem.SourceId
|
439
|
}
|
377
|
}
|
440
|
rsp.List = append(rsp.List, commItem) //非指针 append对象完 再修改数据也是无效
|
378
|
rsp.List = append(rsp.List, commItem) //非指针 append对象完 再修改数据也是无效
|
441
|
}
|
379
|
}
|
|
@@ -445,11 +383,11 @@ func MsgChanceSubmit(header *protocol.RequestHeader, request *protocol.MsgChance |
|
@@ -445,11 +383,11 @@ func MsgChanceSubmit(header *protocol.RequestHeader, request *protocol.MsgChance |
445
|
// 消息中心-互动消息.评论
|
383
|
// 消息中心-互动消息.评论
|
446
|
func MsgChanceComment(header *protocol.RequestHeader, request *protocol.MsgChanceCommentRequest) (rsp *protocol.MsgChanceCommentResponse, err error) {
|
384
|
func MsgChanceComment(header *protocol.RequestHeader, request *protocol.MsgChanceCommentRequest) (rsp *protocol.MsgChanceCommentResponse, err error) {
|
447
|
var (
|
385
|
var (
|
448
|
- myChances []protocol.ChanceCommentItemOrm
|
|
|
449
|
- total int
|
|
|
450
|
- provider *protocol.BaseUserInfo
|
386
|
+ ormItems []protocol.ChanceCommentItemOrm
|
|
|
387
|
+ total int
|
|
|
388
|
+ provider *protocol.BaseUserInfo
|
451
|
)
|
389
|
)
|
452
|
- if total, err = models.GetChanceCommentMsg(header.UserId, request.LastId, request.PageSize, protocol.MsgTypeComment, &myChances); err != nil {
|
390
|
+ if total, err = models.GetChanceCommentMsg(header.UserId, request.LastId, request.PageSize, protocol.MsgTypeComment, &ormItems); err != nil {
|
453
|
if err == orm.ErrNoRows {
|
391
|
if err == orm.ErrNoRows {
|
454
|
err = nil
|
392
|
err = nil
|
455
|
return
|
393
|
return
|
|
@@ -459,66 +397,46 @@ func MsgChanceComment(header *protocol.RequestHeader, request *protocol.MsgChanc |
|
@@ -459,66 +397,46 @@ func MsgChanceComment(header *protocol.RequestHeader, request *protocol.MsgChanc |
459
|
}
|
397
|
}
|
460
|
rsp = &protocol.MsgChanceCommentResponse{Total: total}
|
398
|
rsp = &protocol.MsgChanceCommentResponse{Total: total}
|
461
|
rsp.List = make([]protocol.MsgCommonListItem, 0)
|
399
|
rsp.List = make([]protocol.MsgCommonListItem, 0)
|
462
|
- for i := 0; i < len(myChances); i++ {
|
|
|
463
|
- chance := myChances[i]
|
400
|
+ for i := 0; i < len(ormItems); i++ {
|
|
|
401
|
+ ormItem := ormItems[i]
|
464
|
commItem := protocol.MsgCommonListItem{}
|
402
|
commItem := protocol.MsgCommonListItem{}
|
465
|
- if chance.SourceType == protocol.SourceTypeChance {
|
|
|
466
|
- commItem.ReviewStatus = chance.ReviewStatus
|
|
|
467
|
- if len(chance.SourceContent) == 0 { //机会删除
|
|
|
468
|
- commItem.ChanceStatus = protocol.ChanceStatusDelete
|
|
|
469
|
- } else if chance.ChanceEnableStatus == 0 { //机会关闭
|
|
|
470
|
- commItem.ChanceStatus = protocol.ChanceStatusClose
|
|
|
471
|
- }
|
|
|
472
|
- if chance.Status == models.ChanceStatusClose {
|
|
|
473
|
- commItem.ChanceStatus = protocol.ChanceStatusClose
|
|
|
474
|
- }
|
|
|
475
|
- if chance.ChanceUserId > 0 {
|
|
|
476
|
- if provider, err = agg.GetUserBaseInfo(chance.ChanceUserId, header.CompanyId); err != nil {
|
|
|
477
|
- commItem.ChanceStatus = protocol.ChanceStatusDelete
|
|
|
478
|
- log.Error(err)
|
|
|
479
|
- //return
|
|
|
480
|
- } else {
|
|
|
481
|
- item := protocol.ChanceItem{
|
|
|
482
|
- Id: chance.SourceId,
|
|
|
483
|
- Provider: provider,
|
|
|
484
|
- CreateTime: chance.CreateTime.Unix() * 1000,
|
|
|
485
|
- }
|
|
|
486
|
- utils.JsonUnmarshal(chance.SourceContent, &item.FormList)
|
|
|
487
|
- item.FormList = protocol.ClearEmptyForm(item.FormList)
|
|
|
488
|
- utils.JsonUnmarshal(chance.Images, &item.Pictures)
|
|
|
489
|
- utils.JsonUnmarshal(chance.Voices, &item.Speechs)
|
|
|
490
|
- utils.JsonUnmarshal(chance.Videos, &item.Videos)
|
|
|
491
|
- commItem.Chance = item
|
|
|
492
|
- }
|
|
|
493
|
- }
|
|
|
494
|
- commItem.ReviewStatus = chance.ReviewStatus
|
403
|
+ if ormItem.SourceType == protocol.SourceTypeChance {
|
|
|
404
|
+ commItem.Chance, commItem.ChanceStatus = agg.SetChanceItem(header, ormItem.CommChanceItemOrm)
|
|
|
405
|
+ commItem.ReviewStatus = ormItem.ReviewStatus
|
495
|
}
|
406
|
}
|
496
|
- if chance.SourceType == protocol.SourceTypeComment {
|
|
|
497
|
- if provider, err = agg.GetUserBaseInfo(chance.CommentedUserId, header.CompanyId); err != nil {
|
407
|
+
|
|
|
408
|
+ //被评论内容
|
|
|
409
|
+ if ormItem.SourceType == protocol.SourceTypeComment {
|
|
|
410
|
+ if provider, err = agg.GetUserBaseInfo(ormItem.CommentedUserId, header.CompanyId); err != nil {
|
498
|
commItem.ChanceStatus = protocol.ChanceStatusDelete
|
411
|
commItem.ChanceStatus = protocol.ChanceStatusDelete
|
499
|
log.Error(err)
|
412
|
log.Error(err)
|
500
|
//return
|
413
|
//return
|
501
|
}
|
414
|
}
|
502
|
commItem.CommentedData = protocol.CommentData{
|
415
|
commItem.CommentedData = protocol.CommentData{
|
503
|
- Id: chance.SourceId,
|
|
|
504
|
- Content: chance.CommentedContent,
|
|
|
505
|
- CommentTime: chance.CommentedTime.Unix() * 1000,
|
416
|
+ Id: ormItem.SourceId,
|
|
|
417
|
+ Content: ormItem.CommentedContent,
|
|
|
418
|
+ CommentTime: ormItem.CommentedTime.Unix() * 1000,
|
506
|
Provider: provider,
|
419
|
Provider: provider,
|
507
|
}
|
420
|
}
|
508
|
}
|
421
|
}
|
|
|
422
|
+
|
|
|
423
|
+ //评论内容
|
509
|
comment := protocol.CommentData{
|
424
|
comment := protocol.CommentData{
|
510
|
- Id: chance.CommentId,
|
|
|
511
|
- CommentTime: chance.CommentTime.Unix() * 1000,
|
|
|
512
|
- Content: chance.CommentContent,
|
425
|
+ Id: ormItem.CommentId,
|
|
|
426
|
+ CommentTime: ormItem.CommentTime.Unix() * 1000,
|
|
|
427
|
+ Content: ormItem.CommentContent,
|
513
|
//Provider: provider,
|
428
|
//Provider: provider,
|
514
|
}
|
429
|
}
|
515
|
- comment.Provider, _ = agg.GetUserBaseInfo(chance.SenderUserId, header.CompanyId)
|
430
|
+ comment.Provider, _ = agg.GetUserBaseInfo(ormItem.SenderUserId, header.CompanyId)
|
516
|
commItem.CommentData = comment
|
431
|
commItem.CommentData = comment
|
517
|
- commItem.IsRead = chance.IsRead == 1
|
|
|
518
|
- commItem.SourceType = chance.SourceType
|
|
|
519
|
- commItem.MsgId = chance.CommentId
|
|
|
520
|
- commItem.MsgTime = chance.CommentTime.Unix() * 1000
|
|
|
521
|
- commItem.ChanceId = chance.ChanceId
|
432
|
+
|
|
|
433
|
+ //消息基础内容
|
|
|
434
|
+ commItem.IsRead = ormItem.IsRead == 1
|
|
|
435
|
+ commItem.SourceType = ormItem.SourceType
|
|
|
436
|
+ commItem.MsgId = ormItem.CommentId
|
|
|
437
|
+ commItem.MsgTime = ormItem.CommentTime.Unix() * 1000
|
|
|
438
|
+ commItem.ChanceId = ormItem.ChanceId
|
|
|
439
|
+
|
522
|
rsp.List = append(rsp.List, commItem)
|
440
|
rsp.List = append(rsp.List, commItem)
|
523
|
}
|
441
|
}
|
524
|
return
|
442
|
return
|
|
@@ -527,11 +445,11 @@ func MsgChanceComment(header *protocol.RequestHeader, request *protocol.MsgChanc |
|
@@ -527,11 +445,11 @@ func MsgChanceComment(header *protocol.RequestHeader, request *protocol.MsgChanc |
527
|
//消息中心-互动消息.点赞
|
445
|
//消息中心-互动消息.点赞
|
528
|
func MsgChanceThumbUp(header *protocol.RequestHeader, request *protocol.MsgChanceThumbUpRequest) (rsp *protocol.MsgChanceThumbUpResponse, err error) {
|
446
|
func MsgChanceThumbUp(header *protocol.RequestHeader, request *protocol.MsgChanceThumbUpRequest) (rsp *protocol.MsgChanceThumbUpResponse, err error) {
|
529
|
var (
|
447
|
var (
|
530
|
- myChances []protocol.ChanceCommentItemOrm
|
|
|
531
|
- total int
|
|
|
532
|
- provider *protocol.BaseUserInfo
|
448
|
+ ormItems []protocol.ChanceCommentItemOrm
|
|
|
449
|
+ total int
|
|
|
450
|
+ provider *protocol.BaseUserInfo
|
533
|
)
|
451
|
)
|
534
|
- if total, err = models.GetChanceCommentMsg(header.UserId, request.LastId, request.PageSize, protocol.MsgTypeThumbUp, &myChances); err != nil {
|
452
|
+ if total, err = models.GetChanceCommentMsg(header.UserId, request.LastId, request.PageSize, protocol.MsgTypeThumbUp, &ormItems); err != nil {
|
535
|
if err == orm.ErrNoRows {
|
453
|
if err == orm.ErrNoRows {
|
536
|
err = nil
|
454
|
err = nil
|
537
|
return
|
455
|
return
|
|
@@ -541,65 +459,44 @@ func MsgChanceThumbUp(header *protocol.RequestHeader, request *protocol.MsgChanc |
|
@@ -541,65 +459,44 @@ func MsgChanceThumbUp(header *protocol.RequestHeader, request *protocol.MsgChanc |
541
|
}
|
459
|
}
|
542
|
rsp = &protocol.MsgChanceThumbUpResponse{Total: total}
|
460
|
rsp = &protocol.MsgChanceThumbUpResponse{Total: total}
|
543
|
rsp.List = make([]protocol.MsgCommonListItem, 0)
|
461
|
rsp.List = make([]protocol.MsgCommonListItem, 0)
|
544
|
- for i := 0; i < len(myChances); i++ {
|
|
|
545
|
- chance := myChances[i]
|
462
|
+ for i := 0; i < len(ormItems); i++ {
|
|
|
463
|
+ ormItem := ormItems[i]
|
546
|
commItem := protocol.MsgCommonListItem{}
|
464
|
commItem := protocol.MsgCommonListItem{}
|
547
|
- if chance.SourceType == protocol.SourceTypeChance {
|
|
|
548
|
- commItem.ReviewStatus = chance.ReviewStatus
|
|
|
549
|
- if len(chance.SourceContent) == 0 { //机会删除
|
|
|
550
|
- commItem.ChanceStatus = protocol.ChanceStatusDelete
|
|
|
551
|
- } else if chance.ChanceEnableStatus == 0 { //机会关闭
|
|
|
552
|
- commItem.ChanceStatus = protocol.ChanceStatusClose
|
|
|
553
|
- }
|
|
|
554
|
- if chance.Status == models.ChanceStatusClose {
|
|
|
555
|
- commItem.ChanceStatus = protocol.ChanceStatusClose
|
|
|
556
|
- }
|
|
|
557
|
- if provider, err = agg.GetUserBaseInfo(chance.ChanceUserId, header.CompanyId); err != nil {
|
|
|
558
|
- commItem.ChanceStatus = protocol.ChanceStatusDelete
|
|
|
559
|
- log.Error(err)
|
|
|
560
|
- //return
|
|
|
561
|
- } else {
|
|
|
562
|
- item := protocol.ChanceItem{
|
|
|
563
|
- Id: chance.SourceId,
|
|
|
564
|
- Provider: provider,
|
|
|
565
|
- CreateTime: chance.CreateTime.Unix() * 1000,
|
|
|
566
|
- }
|
|
|
567
|
- utils.JsonUnmarshal(chance.SourceContent, &item.FormList)
|
|
|
568
|
- item.FormList = protocol.ClearEmptyForm(item.FormList)
|
|
|
569
|
- utils.JsonUnmarshal(chance.Images, &item.Pictures)
|
|
|
570
|
- utils.JsonUnmarshal(chance.Voices, &item.Speechs)
|
|
|
571
|
- utils.JsonUnmarshal(chance.Videos, &item.Videos)
|
|
|
572
|
- commItem.Chance = item
|
|
|
573
|
- }
|
|
|
574
|
- commItem.ReviewStatus = chance.ReviewStatus
|
465
|
+ if ormItem.SourceType == protocol.SourceTypeChance {
|
|
|
466
|
+ commItem.Chance, commItem.ChanceStatus = agg.SetChanceItem(header, ormItem.CommChanceItemOrm)
|
|
|
467
|
+ commItem.ReviewStatus = ormItem.ReviewStatus
|
575
|
}
|
468
|
}
|
576
|
- if chance.SourceType == protocol.SourceTypeComment {
|
|
|
577
|
- if provider, err = agg.GetUserBaseInfo(chance.CommentedUserId, header.CompanyId); err != nil {
|
469
|
+
|
|
|
470
|
+ //点赞评论的内容
|
|
|
471
|
+ if ormItem.SourceType == protocol.SourceTypeComment {
|
|
|
472
|
+ if provider, err = agg.GetUserBaseInfo(ormItem.CommentedUserId, header.CompanyId); err != nil {
|
578
|
commItem.ChanceStatus = protocol.ChanceStatusDelete
|
473
|
commItem.ChanceStatus = protocol.ChanceStatusDelete
|
579
|
log.Error(err)
|
474
|
log.Error(err)
|
580
|
//return
|
475
|
//return
|
581
|
}
|
476
|
}
|
582
|
commItem.CommentedData = protocol.CommentData{
|
477
|
commItem.CommentedData = protocol.CommentData{
|
583
|
- Id: chance.SourceId,
|
|
|
584
|
- Content: chance.CommentedContent,
|
|
|
585
|
- CommentTime: chance.CommentedTime.Unix() * 1000,
|
478
|
+ Id: ormItem.SourceId,
|
|
|
479
|
+ Content: ormItem.CommentedContent,
|
|
|
480
|
+ CommentTime: ormItem.CommentedTime.Unix() * 1000,
|
586
|
Provider: provider,
|
481
|
Provider: provider,
|
587
|
}
|
482
|
}
|
588
|
}
|
483
|
}
|
589
|
-
|
484
|
+ //点赞数据
|
590
|
thumb := protocol.ThumbUpData{
|
485
|
thumb := protocol.ThumbUpData{
|
591
|
- Id: chance.CommentId,
|
|
|
592
|
- ThumbUpTime: chance.CommentTime.Unix() * 1000,
|
|
|
593
|
- Content: chance.CommentContent,
|
486
|
+ Id: ormItem.CommentId,
|
|
|
487
|
+ ThumbUpTime: ormItem.CommentTime.Unix() * 1000,
|
|
|
488
|
+ Content: ormItem.CommentContent,
|
594
|
//Provider: provider,
|
489
|
//Provider: provider,
|
595
|
}
|
490
|
}
|
596
|
- thumb.Provider, _ = agg.GetUserBaseInfo(chance.SenderUserId, header.CompanyId)
|
491
|
+ thumb.Provider, _ = agg.GetUserBaseInfo(ormItem.SenderUserId, header.CompanyId)
|
597
|
commItem.ThumbUpData = thumb
|
492
|
commItem.ThumbUpData = thumb
|
598
|
- commItem.IsRead = chance.IsRead == 1
|
|
|
599
|
- commItem.SourceType = chance.SourceType
|
|
|
600
|
- commItem.MsgId = chance.CommentId
|
|
|
601
|
- commItem.MsgTime = chance.CommentTime.Unix() * 1000
|
|
|
602
|
- commItem.ChanceId = chance.ChanceId
|
493
|
+
|
|
|
494
|
+ //消息基础数据
|
|
|
495
|
+ commItem.IsRead = ormItem.IsRead == 1
|
|
|
496
|
+ commItem.SourceType = ormItem.SourceType
|
|
|
497
|
+ commItem.MsgId = ormItem.CommentId
|
|
|
498
|
+ commItem.MsgTime = ormItem.CommentTime.Unix() * 1000
|
|
|
499
|
+ commItem.ChanceId = ormItem.ChanceId
|
603
|
rsp.List = append(rsp.List, commItem)
|
500
|
rsp.List = append(rsp.List, commItem)
|
604
|
}
|
501
|
}
|
605
|
return
|
502
|
return
|