正在显示
4 个修改的文件
包含
116 行增加
和
25 行删除
| @@ -151,7 +151,7 @@ from audit_flow_process where uid=? and enable_status =1 and review_status in (% | @@ -151,7 +151,7 @@ from audit_flow_process where uid=? and enable_status =1 and review_status in (% | ||
| 151 | 151 | ||
| 152 | func GetChanceCollect(uid int64, lastId int64, pageSize int, v interface{}) (total int, err error) { | 152 | func GetChanceCollect(uid int64, lastId int64, pageSize int, v interface{}) (total int, err error) { |
| 153 | sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from ( | 153 | sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from ( |
| 154 | -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 ( | 154 | +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,b.publish_status from ( |
| 155 | select id collect_id,source_id,create_at collect_time,chance_id from chance_favorite where (0=? or id<?) and user_id =? and enable_status=1 | 155 | select id collect_id,source_id,create_at collect_time,chance_id from chance_favorite where (0=? or id<?) and user_id =? and enable_status=1 |
| 156 | and source_type=1 | 156 | and source_type=1 |
| 157 | and (mark_flag&2)>0 | 157 | and (mark_flag&2)>0 |
| @@ -174,7 +174,7 @@ limit ?`) | @@ -174,7 +174,7 @@ limit ?`) | ||
| 174 | 174 | ||
| 175 | func GetChanceThumbUp(uid int64, lastId int64, pageSize int, v interface{}) (total int, err error) { | 175 | func GetChanceThumbUp(uid int64, lastId int64, pageSize int, v interface{}) (total int, err error) { |
| 176 | sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from ( | 176 | sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from ( |
| 177 | -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 ( | 177 | +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,b.publish_status from ( |
| 178 | select id collect_id,source_id,create_at collect_time from chance_favorite where (0=? or id<?) and user_id =? and enable_status=1 | 178 | select id collect_id,source_id,create_at collect_time from chance_favorite where (0=? or id<?) and user_id =? and enable_status=1 |
| 179 | and source_type=1 | 179 | and source_type=1 |
| 180 | and (mark_flag&1)>0 | 180 | and (mark_flag&1)>0 |
| @@ -209,7 +209,7 @@ func GetChanceComment(uid int64, lastId int64, pageSize int, v interface{}) (tot | @@ -209,7 +209,7 @@ func GetChanceComment(uid int64, lastId int64, pageSize int, v interface{}) (tot | ||
| 209 | sql := fmt.Sprintf(`select a.*,b.content commented_content,b.create_at commented_time,b.user_id commented_user_id | 209 | sql := fmt.Sprintf(`select a.*,b.content commented_content,b.create_at commented_time,b.user_id commented_user_id |
| 210 | from ( | 210 | from ( |
| 211 | select a.*,b.images,b.speechs,b.videos from ( | 211 | select a.*,b.images,b.speechs,b.videos from ( |
| 212 | -select a.*,b.source_content,b.enable_status,b.user_id chance_user_id,b.create_at,b.review_status,b.approve_data from ( | 212 | +select a.*,b.source_content,b.enable_status,b.user_id chance_user_id,b.create_at,b.review_status,b.approve_data,b.publish_status from ( |
| 213 | select id,content,view_total,zan_total,comment_total,source_type,source_id,create_at comment_time from comment | 213 | select id,content,view_total,zan_total,comment_total,source_type,source_id,create_at comment_time from comment |
| 214 | where user_id =? and (?=0 or id<?) | 214 | where user_id =? and (?=0 or id<?) |
| 215 | )a left outer join chance b on a.source_id = b.id and source_type=1 | 215 | )a left outer join chance b on a.source_id = b.id and source_type=1 |
| @@ -599,3 +599,36 @@ select count(0) from ( | @@ -599,3 +599,36 @@ select count(0) from ( | ||
| 599 | } | 599 | } |
| 600 | return | 600 | return |
| 601 | } | 601 | } |
| 602 | + | ||
| 603 | +//是否存在按发布机会部门编号查询 | ||
| 604 | +func ExitsChanceByDeparmentIds(chanceId int64, departmentIds []int64) (v *Chance, err error) { | ||
| 605 | + sql := fmt.Sprintf(`select id from chance where id=%v and department_id in (%v)`, | ||
| 606 | + chanceId, utils.JoinInt64s(departmentIds, ",")) | ||
| 607 | + o := orm.NewOrm() | ||
| 608 | + if err = o.Raw(sql).QueryRow(&v); err != nil { | ||
| 609 | + return | ||
| 610 | + } | ||
| 611 | + return | ||
| 612 | +} | ||
| 613 | + | ||
| 614 | +//是否存在发布机会的部门编号查询 | ||
| 615 | +func ExitsChanceByPublicDeparmentIds(chanceId int64, departmentIds []int64) (v *Chance, err error) { | ||
| 616 | + sql := fmt.Sprintf(`select chance_id from chance_department where chance_id=%v and department_id in (%v)`, | ||
| 617 | + chanceId, utils.JoinInt64s(departmentIds, ",")) | ||
| 618 | + o := orm.NewOrm() | ||
| 619 | + if err = o.Raw(sql).QueryRow(&v); err != nil { | ||
| 620 | + return | ||
| 621 | + } | ||
| 622 | + return | ||
| 623 | +} | ||
| 624 | + | ||
| 625 | +//是否存在机会 - 审核人 | ||
| 626 | +func ExitsChanceByAuditUser(chanceId int64, auditUserId int64) (v *Chance, err error) { | ||
| 627 | + sql := fmt.Sprintf(`select * from audit_flow_process where chance_id =%v and uid =%v and enable_status=1 limit 1`, | ||
| 628 | + chanceId, auditUserId) | ||
| 629 | + o := orm.NewOrm() | ||
| 630 | + if err = o.Raw(sql).QueryRow(&v); err != nil { | ||
| 631 | + return | ||
| 632 | + } | ||
| 633 | + return | ||
| 634 | +} |
| @@ -237,7 +237,7 @@ type MyCollectChanceRequest struct { | @@ -237,7 +237,7 @@ type MyCollectChanceRequest struct { | ||
| 237 | PageSize int `json:"pageSize" valid:"Required"` | 237 | PageSize int `json:"pageSize" valid:"Required"` |
| 238 | } | 238 | } |
| 239 | type MyCollectChanceResponse struct { | 239 | type MyCollectChanceResponse struct { |
| 240 | - List []CommonListItem `json:"list"` | 240 | + List []*CommonListItem `json:"list"` |
| 241 | Total int `json:"total"` | 241 | Total int `json:"total"` |
| 242 | } | 242 | } |
| 243 | 243 | ||
| @@ -247,7 +247,7 @@ type MyThumbUpChanceRequest struct { | @@ -247,7 +247,7 @@ type MyThumbUpChanceRequest struct { | ||
| 247 | PageSize int `json:"pageSize" valid:"Required"` | 247 | PageSize int `json:"pageSize" valid:"Required"` |
| 248 | } | 248 | } |
| 249 | type MyThumbUpChanceResponse struct { | 249 | type MyThumbUpChanceResponse struct { |
| 250 | - List []CommonListItem `json:"list"` | 250 | + List []*CommonListItem `json:"list"` |
| 251 | Total int `json:"total"` | 251 | Total int `json:"total"` |
| 252 | } | 252 | } |
| 253 | 253 | ||
| @@ -257,7 +257,7 @@ type MyCommentRequest struct { | @@ -257,7 +257,7 @@ type MyCommentRequest struct { | ||
| 257 | PageSize int `json:"pageSize" valid:"Required"` | 257 | PageSize int `json:"pageSize" valid:"Required"` |
| 258 | } | 258 | } |
| 259 | type MyCommentResponse struct { | 259 | type MyCommentResponse struct { |
| 260 | - List []CommonListItem `json:"list"` | 260 | + List []*CommonListItem `json:"list"` |
| 261 | Total int `json:"total"` | 261 | Total int `json:"total"` |
| 262 | } | 262 | } |
| 263 | 263 | ||
| @@ -292,6 +292,7 @@ type ChanceCollectItemOrm struct { | @@ -292,6 +292,7 @@ type ChanceCollectItemOrm struct { | ||
| 292 | Images string `orm:"column(images)"` | 292 | Images string `orm:"column(images)"` |
| 293 | Voices string `orm:"column(speechs)"` | 293 | Voices string `orm:"column(speechs)"` |
| 294 | Videos string `orm:"column(videos)"` | 294 | Videos string `orm:"column(videos)"` |
| 295 | + PublishStatus int `orm:"column(publish_status)"` //公开状态 | ||
| 295 | 296 | ||
| 296 | //ApproveData string `json:"approveData"` //审核数据 | 297 | //ApproveData string `json:"approveData"` //审核数据 |
| 297 | TemplateId int `orm:"column(audit_template_id)"` | 298 | TemplateId int `orm:"column(audit_template_id)"` |
| @@ -319,6 +320,7 @@ type ChanceThumbUpItemOrm struct { | @@ -319,6 +320,7 @@ type ChanceThumbUpItemOrm struct { | ||
| 319 | Images string `orm:"column(images)"` | 320 | Images string `orm:"column(images)"` |
| 320 | Voices string `orm:"column(speechs)"` | 321 | Voices string `orm:"column(speechs)"` |
| 321 | Videos string `orm:"column(videos)"` | 322 | Videos string `orm:"column(videos)"` |
| 323 | + PublishStatus int `orm:"column(publish_status)"` //公开状态 | ||
| 322 | 324 | ||
| 323 | //ApproveData string `json:"approveData"` //审核数据 | 325 | //ApproveData string `json:"approveData"` //审核数据 |
| 324 | TemplateId int `orm:"column(audit_template_id)"` | 326 | TemplateId int `orm:"column(audit_template_id)"` |
| @@ -343,6 +345,7 @@ type ChanceCommentItemOrm struct { | @@ -343,6 +345,7 @@ type ChanceCommentItemOrm struct { | ||
| 343 | Images string `orm:"column(images)"` | 345 | Images string `orm:"column(images)"` |
| 344 | Voices string `orm:"column(speechs)"` | 346 | Voices string `orm:"column(speechs)"` |
| 345 | Videos string `orm:"column(videos)"` | 347 | Videos string `orm:"column(videos)"` |
| 348 | + PublishStatus int `orm:"column(publish_status)"` //公开状态 | ||
| 346 | 349 | ||
| 347 | CommentTotal int `orm:"column(comment_total)"` | 350 | CommentTotal int `orm:"column(comment_total)"` |
| 348 | ZanTotal int `orm:"column(zan_total)"` | 351 | ZanTotal int `orm:"column(zan_total)"` |
| @@ -572,6 +575,7 @@ type ChanceItem struct { | @@ -572,6 +575,7 @@ type ChanceItem struct { | ||
| 572 | Speechs []Speech `json:"speechs"` | 575 | Speechs []Speech `json:"speechs"` |
| 573 | Pictures []Picture `json:"pictures"` | 576 | Pictures []Picture `json:"pictures"` |
| 574 | Videos []Video `json:"videos"` | 577 | Videos []Video `json:"videos"` |
| 578 | + PublicStatus int `json:"public_status"` | ||
| 575 | } | 579 | } |
| 576 | type ChanceData struct { | 580 | type ChanceData struct { |
| 577 | ThumbsUpTotal int `json:"thumbsupTotal"` //点赞总数 | 581 | ThumbsUpTotal int `json:"thumbsupTotal"` //点赞总数 |
| @@ -43,13 +43,12 @@ func GetChancePool(uid, cid int64, chanceTypeId int, lastId int64, pageSize int, | @@ -43,13 +43,12 @@ func GetChancePool(uid, cid int64, chanceTypeId int, lastId int64, pageSize int, | ||
| 43 | return | 43 | return |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | -func GetChanceValidPermission(uid, cid int64, chanceTypeId int, lastId int64, pageSize int, items []protocol.CommonListItem) (total int, err error) { | 46 | +//检查机会权限 |
| 47 | +func ValidChancePermission(uid, cid int64, items []*protocol.CommonListItem) (err error) { | ||
| 47 | var ( | 48 | var ( |
| 48 | check int | 49 | check int |
| 49 | specialDIds []int64 | 50 | specialDIds []int64 |
| 50 | userDIds []int64 | 51 | userDIds []int64 |
| 51 | - | ||
| 52 | - chanceIds []int64 | ||
| 53 | ) | 52 | ) |
| 54 | if op, e := GetUserPermission(uid); e == nil { | 53 | if op, e := GetUserPermission(uid); e == nil { |
| 55 | for i := range op.CheckOption.Departments { | 54 | for i := range op.CheckOption.Departments { |
| @@ -61,27 +60,72 @@ func GetChanceValidPermission(uid, cid int64, chanceTypeId int, lastId int64, pa | @@ -61,27 +60,72 @@ func GetChanceValidPermission(uid, cid int64, chanceTypeId int, lastId int64, pa | ||
| 61 | specialDIds = append(specialDIds, 0) | 60 | specialDIds = append(specialDIds, 0) |
| 62 | } | 61 | } |
| 63 | for i := range items { | 62 | for i := range items { |
| 64 | - chanceIds = append(chanceIds, items[i].Chance.Id) // 机会列表 | 63 | + if items[i].ChanceStatus != 0 { |
| 64 | + continue | ||
| 65 | } | 65 | } |
| 66 | - //log.Debug(fmt.Sprintf("user:%v check:%v", uid, check)) | ||
| 67 | - for i := range items { | 66 | + if items[i].ChanceId == 0 { |
| 67 | + items[i].ChanceStatus = protocol.ChanceStatusClose | ||
| 68 | + continue | ||
| 69 | + } | ||
| 70 | + if items[i].Chance.Provider == nil { | ||
| 71 | + items[i].ChanceStatus = protocol.ChanceStatusClose | ||
| 72 | + continue | ||
| 73 | + } | ||
| 74 | + var chancePublicStatus = items[i].Chance.PublicStatus | ||
| 75 | + var chanceUserId = items[i].Chance.Provider.UserId | ||
| 76 | + var chanceId = items[i].ChanceId | ||
| 68 | switch check { | 77 | switch check { |
| 69 | case OpportunityCheckLv1: | 78 | case OpportunityCheckLv1: |
| 70 | - if items[i].Chance.Provider.UserId == uid { | 79 | + if chanceUserId == uid { |
| 80 | + continue | ||
| 81 | + } | ||
| 82 | + if _, e := models.ExitsChanceByAuditUser(chanceId, uid); e == nil { | ||
| 71 | continue | 83 | continue |
| 72 | } | 84 | } |
| 85 | + items[i].ChanceStatus = protocol.ChanceStatusClose | ||
| 73 | case OpportunityCheckLv2: | 86 | case OpportunityCheckLv2: |
| 74 | - if err = models.GetUserDepartmentIds(uid, cid, &userDIds); err != nil { | ||
| 75 | - log.Error(err) | 87 | + if chancePublicStatus == protocol.PublicToCompany { |
| 88 | + continue | ||
| 89 | + } | ||
| 90 | + if chanceUserId == uid { | ||
| 91 | + continue | ||
| 92 | + } | ||
| 93 | + if chancePublicStatus == protocol.PublicToDepartment { | ||
| 94 | + if len(userDIds) == 0 { | ||
| 95 | + if e := models.GetUserDepartmentIds(uid, cid, &userDIds); e != nil { | ||
| 96 | + log.Error(e) | ||
| 76 | return | 97 | return |
| 77 | } | 98 | } |
| 78 | - | 99 | + } |
| 100 | + if _, e := models.ExitsChanceByPublicDeparmentIds(chanceId, userDIds); e == nil { | ||
| 101 | + continue | ||
| 102 | + } | ||
| 103 | + } | ||
| 104 | + if _, e := models.ExitsChanceByAuditUser(chanceId, uid); e == nil { | ||
| 105 | + continue | ||
| 106 | + } | ||
| 107 | + items[i].ChanceStatus = protocol.ChanceStatusClose | ||
| 79 | case OpportunityCheckLv3: | 108 | case OpportunityCheckLv3: |
| 80 | - | ||
| 81 | - case OpportunityCheckLv4: | ||
| 82 | - | 109 | + if chanceUserId == uid { |
| 110 | + continue | ||
| 111 | + } | ||
| 112 | + if len(userDIds) == 0 { | ||
| 113 | + if e := models.GetUserDepartmentIds(uid, cid, &userDIds); e != nil { | ||
| 114 | + log.Error(e) | ||
| 115 | + return | ||
| 116 | + } | ||
| 117 | + } | ||
| 118 | + if _, e := models.ExitsChanceByDeparmentIds(chanceId, userDIds); e == nil { | ||
| 119 | + continue | ||
| 120 | + } | ||
| 121 | + if _, e := models.ExitsChanceByAuditUser(chanceId, uid); e == nil { | ||
| 122 | + continue | ||
| 123 | + } | ||
| 124 | + items[i].ChanceStatus = protocol.ChanceStatusClose | ||
| 125 | + case OpportunityCheckLv4: //所有权限 不检查 | ||
| 126 | + break | ||
| 83 | default: | 127 | default: |
| 84 | - | 128 | + break |
| 85 | } | 129 | } |
| 86 | } | 130 | } |
| 87 | return | 131 | return |
| @@ -1436,8 +1436,9 @@ func MyCollectChance(header *protocol.RequestHeader, request *protocol.MyCollect | @@ -1436,8 +1436,9 @@ func MyCollectChance(header *protocol.RequestHeader, request *protocol.MyCollect | ||
| 1436 | rsp = &protocol.MyCollectChanceResponse{Total: total} | 1436 | rsp = &protocol.MyCollectChanceResponse{Total: total} |
| 1437 | for i := 0; i < len(myChances); i++ { | 1437 | for i := 0; i < len(myChances); i++ { |
| 1438 | chance := myChances[i] | 1438 | chance := myChances[i] |
| 1439 | - commItem := protocol.CommonListItem{} | 1439 | + commItem := &protocol.CommonListItem{} |
| 1440 | commItem.ReviewStatus = chance.ReviewStatus | 1440 | commItem.ReviewStatus = chance.ReviewStatus |
| 1441 | + commItem.ChanceId = chance.ChanceId | ||
| 1441 | if len(chance.SourceContent) == 0 { //机会删除 | 1442 | if len(chance.SourceContent) == 0 { //机会删除 |
| 1442 | commItem.ChanceStatus = protocol.ChanceStatusDelete | 1443 | commItem.ChanceStatus = protocol.ChanceStatusDelete |
| 1443 | } else if chance.ChanceEnableStatus == 0 { //机会关闭 | 1444 | } else if chance.ChanceEnableStatus == 0 { //机会关闭 |
| @@ -1452,6 +1453,7 @@ func MyCollectChance(header *protocol.RequestHeader, request *protocol.MyCollect | @@ -1452,6 +1453,7 @@ func MyCollectChance(header *protocol.RequestHeader, request *protocol.MyCollect | ||
| 1452 | Id: chance.ChanceId, | 1453 | Id: chance.ChanceId, |
| 1453 | Provider: provider, | 1454 | Provider: provider, |
| 1454 | //CreateTime: chance.CreateTime.Unix() * 1000, | 1455 | //CreateTime: chance.CreateTime.Unix() * 1000, |
| 1456 | + PublicStatus: chance.PublishStatus, | ||
| 1455 | } | 1457 | } |
| 1456 | jsonUnmarshal(chance.SourceContent, &item.FormList) | 1458 | jsonUnmarshal(chance.SourceContent, &item.FormList) |
| 1457 | item.FormList = clearEmptyForm(item.FormList) | 1459 | item.FormList = clearEmptyForm(item.FormList) |
| @@ -1486,6 +1488,7 @@ func MyCollectChance(header *protocol.RequestHeader, request *protocol.MyCollect | @@ -1486,6 +1488,7 @@ func MyCollectChance(header *protocol.RequestHeader, request *protocol.MyCollect | ||
| 1486 | } | 1488 | } |
| 1487 | rsp.List = append(rsp.List, commItem) | 1489 | rsp.List = append(rsp.List, commItem) |
| 1488 | } | 1490 | } |
| 1491 | + agg.ValidChancePermission(header.UserId, header.CompanyId, rsp.List) | ||
| 1489 | return | 1492 | return |
| 1490 | } | 1493 | } |
| 1491 | 1494 | ||
| @@ -1507,8 +1510,9 @@ func MyThumbUpChance(header *protocol.RequestHeader, request *protocol.MyThumbUp | @@ -1507,8 +1510,9 @@ func MyThumbUpChance(header *protocol.RequestHeader, request *protocol.MyThumbUp | ||
| 1507 | rsp = &protocol.MyThumbUpChanceResponse{Total: total} | 1510 | rsp = &protocol.MyThumbUpChanceResponse{Total: total} |
| 1508 | for i := 0; i < len(myChances); i++ { | 1511 | for i := 0; i < len(myChances); i++ { |
| 1509 | chance := myChances[i] | 1512 | chance := myChances[i] |
| 1510 | - commItem := protocol.CommonListItem{} | 1513 | + commItem := &protocol.CommonListItem{} |
| 1511 | commItem.ReviewStatus = chance.ReviewStatus | 1514 | commItem.ReviewStatus = chance.ReviewStatus |
| 1515 | + commItem.ChanceId = chance.ChanceId | ||
| 1512 | if len(chance.SourceContent) == 0 { //机会删除 | 1516 | if len(chance.SourceContent) == 0 { //机会删除 |
| 1513 | commItem.ChanceStatus = protocol.ChanceStatusDelete | 1517 | commItem.ChanceStatus = protocol.ChanceStatusDelete |
| 1514 | } else if chance.ChanceEnableStatus == 0 { //机会关闭 | 1518 | } else if chance.ChanceEnableStatus == 0 { //机会关闭 |
| @@ -1523,6 +1527,7 @@ func MyThumbUpChance(header *protocol.RequestHeader, request *protocol.MyThumbUp | @@ -1523,6 +1527,7 @@ func MyThumbUpChance(header *protocol.RequestHeader, request *protocol.MyThumbUp | ||
| 1523 | Id: chance.ChanceId, | 1527 | Id: chance.ChanceId, |
| 1524 | Provider: provider, | 1528 | Provider: provider, |
| 1525 | CreateTime: chance.CreateTime.Unix() * 1000, | 1529 | CreateTime: chance.CreateTime.Unix() * 1000, |
| 1530 | + PublicStatus: chance.PublishStatus, | ||
| 1526 | } | 1531 | } |
| 1527 | jsonUnmarshal(chance.SourceContent, &item.FormList) | 1532 | jsonUnmarshal(chance.SourceContent, &item.FormList) |
| 1528 | item.FormList = clearEmptyForm(item.FormList) | 1533 | item.FormList = clearEmptyForm(item.FormList) |
| @@ -1556,6 +1561,7 @@ func MyThumbUpChance(header *protocol.RequestHeader, request *protocol.MyThumbUp | @@ -1556,6 +1561,7 @@ func MyThumbUpChance(header *protocol.RequestHeader, request *protocol.MyThumbUp | ||
| 1556 | } | 1561 | } |
| 1557 | rsp.List = append(rsp.List, commItem) | 1562 | rsp.List = append(rsp.List, commItem) |
| 1558 | } | 1563 | } |
| 1564 | + agg.ValidChancePermission(header.UserId, header.CompanyId, rsp.List) | ||
| 1559 | return | 1565 | return |
| 1560 | } | 1566 | } |
| 1561 | 1567 | ||
| @@ -1577,23 +1583,27 @@ func MyComment(header *protocol.RequestHeader, request *protocol.MyCommentReques | @@ -1577,23 +1583,27 @@ func MyComment(header *protocol.RequestHeader, request *protocol.MyCommentReques | ||
| 1577 | rsp = &protocol.MyCommentResponse{Total: total} | 1583 | rsp = &protocol.MyCommentResponse{Total: total} |
| 1578 | for i := 0; i < len(myChances); i++ { | 1584 | for i := 0; i < len(myChances); i++ { |
| 1579 | chance := myChances[i] | 1585 | chance := myChances[i] |
| 1580 | - commItem := protocol.CommonListItem{} | 1586 | + commItem := &protocol.CommonListItem{} |
| 1587 | + commItem.ChanceId = chance.SourceId | ||
| 1581 | if chance.SourceType == protocol.SourceTypeChance { | 1588 | if chance.SourceType == protocol.SourceTypeChance { |
| 1582 | commItem.ReviewStatus = chance.ReviewStatus | 1589 | commItem.ReviewStatus = chance.ReviewStatus |
| 1583 | if len(chance.SourceContent) == 0 { //机会删除 | 1590 | if len(chance.SourceContent) == 0 { //机会删除 |
| 1584 | commItem.ChanceStatus = protocol.ChanceStatusDelete | 1591 | commItem.ChanceStatus = protocol.ChanceStatusDelete |
| 1585 | } else if chance.ChanceEnableStatus == 0 { //机会关闭 | 1592 | } else if chance.ChanceEnableStatus == 0 { //机会关闭 |
| 1586 | commItem.ChanceStatus = protocol.ChanceStatusClose | 1593 | commItem.ChanceStatus = protocol.ChanceStatusClose |
| 1587 | - } else { | 1594 | + } |
| 1588 | if provider, err = agg.GetUserBaseInfo(chance.Uid, header.CompanyId); err != nil { | 1595 | if provider, err = agg.GetUserBaseInfo(chance.Uid, header.CompanyId); err != nil { |
| 1589 | commItem.ChanceStatus = protocol.ChanceStatusDelete | 1596 | commItem.ChanceStatus = protocol.ChanceStatusDelete |
| 1597 | + err = nil | ||
| 1590 | log.Error(err) | 1598 | log.Error(err) |
| 1599 | + commItem.Chance = protocol.ChanceItem{} | ||
| 1591 | //return | 1600 | //return |
| 1592 | } else { | 1601 | } else { |
| 1593 | item := protocol.ChanceItem{ | 1602 | item := protocol.ChanceItem{ |
| 1594 | Id: chance.SourceId, | 1603 | Id: chance.SourceId, |
| 1595 | Provider: provider, | 1604 | Provider: provider, |
| 1596 | CreateTime: chance.CreateTime.Unix() * 1000, | 1605 | CreateTime: chance.CreateTime.Unix() * 1000, |
| 1606 | + PublicStatus: chance.PublishStatus, | ||
| 1597 | } | 1607 | } |
| 1598 | jsonUnmarshal(chance.SourceContent, &item.FormList) | 1608 | jsonUnmarshal(chance.SourceContent, &item.FormList) |
| 1599 | item.FormList = clearEmptyForm(item.FormList) | 1609 | item.FormList = clearEmptyForm(item.FormList) |
| @@ -1602,7 +1612,6 @@ func MyComment(header *protocol.RequestHeader, request *protocol.MyCommentReques | @@ -1602,7 +1612,6 @@ func MyComment(header *protocol.RequestHeader, request *protocol.MyCommentReques | ||
| 1602 | jsonUnmarshal(chance.Videos, &item.Videos) | 1612 | jsonUnmarshal(chance.Videos, &item.Videos) |
| 1603 | commItem.Chance = item | 1613 | commItem.Chance = item |
| 1604 | } | 1614 | } |
| 1605 | - } | ||
| 1606 | commItem.ReviewStatus = chance.ReviewStatus | 1615 | commItem.ReviewStatus = chance.ReviewStatus |
| 1607 | //{ | 1616 | //{ |
| 1608 | // var chanceData = protocol.ChanceData{ | 1617 | // var chanceData = protocol.ChanceData{ |
| @@ -1634,6 +1643,7 @@ func MyComment(header *protocol.RequestHeader, request *protocol.MyCommentReques | @@ -1634,6 +1643,7 @@ func MyComment(header *protocol.RequestHeader, request *protocol.MyCommentReques | ||
| 1634 | commItem.SourceType = chance.SourceType | 1643 | commItem.SourceType = chance.SourceType |
| 1635 | rsp.List = append(rsp.List, commItem) | 1644 | rsp.List = append(rsp.List, commItem) |
| 1636 | } | 1645 | } |
| 1646 | + agg.ValidChancePermission(header.UserId, header.CompanyId, rsp.List) | ||
| 1637 | return | 1647 | return |
| 1638 | } | 1648 | } |
| 1639 | 1649 |
-
请 注册 或 登录 后发表评论