...
|
...
|
@@ -1494,11 +1494,12 @@ func ChanceStatistics(header *protocol.RequestHeader, request *protocol.ChanceSt |
|
|
//我提交的机会
|
|
|
func MySubmitChance(header *protocol.RequestHeader, request *protocol.MySubmitChanceRequest) (rsp *protocol.MySubmitChanceResponse, err error) {
|
|
|
var (
|
|
|
myChances []protocol.ChanceItemOrm
|
|
|
total int
|
|
|
provider *protocol.BaseUserInfo
|
|
|
chance *models.Chance
|
|
|
ormItems []protocol.CommChanceItemOrm
|
|
|
chance *models.Chance
|
|
|
)
|
|
|
rsp = &protocol.MySubmitChanceResponse{
|
|
|
List: make([]protocol.CommonListItem, 0),
|
|
|
}
|
|
|
if request.LastId > 0 {
|
|
|
if chance, err = models.GetChanceById(request.LastId); err != nil {
|
|
|
log.Error("机会不存在", request.LastId, err)
|
...
|
...
|
@@ -1506,7 +1507,7 @@ func MySubmitChance(header *protocol.RequestHeader, request *protocol.MySubmitCh |
|
|
}
|
|
|
request.LastId = chance.UpdateAt.Unix()
|
|
|
}
|
|
|
if total, err = models.GetChanceMyChance(header.UserId, header.CompanyId, []int8{request.ReviewStatus}, request.LastId, request.PageSize, &myChances); err != nil {
|
|
|
if rsp.Total, err = models.GetChanceMyChance(header.UserId, header.CompanyId, []int8{request.ReviewStatus}, request.LastId, request.PageSize, &ormItems); err != nil {
|
|
|
if err == orm.ErrNoRows {
|
|
|
err = nil
|
|
|
return
|
...
|
...
|
@@ -1514,41 +1515,15 @@ func MySubmitChance(header *protocol.RequestHeader, request *protocol.MySubmitCh |
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
|
|
if provider, err = agg.GetUserBaseInfo(header.UserId, header.CompanyId); err != nil {
|
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
|
|
rsp = &protocol.MySubmitChanceResponse{Total: total}
|
|
|
|
|
|
for i := 0; i < len(myChances); i++ {
|
|
|
chance := myChances[i]
|
|
|
for i := 0; i < len(ormItems); i++ {
|
|
|
ormItem := ormItems[i]
|
|
|
commItem := protocol.CommonListItem{}
|
|
|
{
|
|
|
item := protocol.ChanceItem{
|
|
|
Id: chance.Id,
|
|
|
Provider: provider,
|
|
|
CreateTime: chance.CreateTime.Unix() * 1000,
|
|
|
UpdateTime: chance.UpdateTime.Unix() * 1000,
|
|
|
ApproveTime: chance.ApproveTime.Unix() * 1000,
|
|
|
}
|
|
|
if item.ApproveTime < 0 {
|
|
|
item.ApproveTime = 0
|
|
|
}
|
|
|
jsonUnmarshal(chance.SourceContent, &item.FormList)
|
|
|
item.FormList = clearEmptyForm(item.FormList)
|
|
|
jsonUnmarshal(chance.Images, &item.Pictures)
|
|
|
jsonUnmarshal(chance.Voices, &item.Speechs)
|
|
|
jsonUnmarshal(chance.Videos, &item.Videos)
|
|
|
commItem.Chance = item
|
|
|
}
|
|
|
if chance.Status == models.ChanceStatusClose {
|
|
|
commItem.ChanceStatus = protocol.ChanceStatusClose
|
|
|
}
|
|
|
commItem.ReviewStatus = chance.ReviewStatus
|
|
|
commItem.Chance, commItem.ChanceStatus = agg.SetChanceItem(header, ormItem)
|
|
|
commItem.ReviewStatus = ormItem.ReviewStatus
|
|
|
if request.ReviewStatus == protocol.ReviewStatusPass {
|
|
|
var approveData protocol.ApproveData
|
|
|
jsonUnmarshal(chance.ApproveData, &approveData)
|
|
|
//commItem.ApproveData = approveData //TODO:删除不需要
|
|
|
jsonUnmarshal(ormItem.ApproveData, &approveData)
|
|
|
commItem.Score = approveData.Score
|
|
|
}
|
|
|
rsp.List = append(rsp.List, commItem)
|
...
|
...
|
|