作者 陈志颖

feat:个人任务统计增加已过期任务

@@ -24,6 +24,7 @@ const ( @@ -24,6 +24,7 @@ const (
24 TASK_STATUS_COMPLETED //已完成 24 TASK_STATUS_COMPLETED //已完成
25 TASK_STATUS_CLOSED //关闭 25 TASK_STATUS_CLOSED //关闭
26 TASK_STATUS_UNCONFIRMED //待确认 26 TASK_STATUS_UNCONFIRMED //待确认
  27 + TASK_STATUS_EXPIRED //已过期
27 ) 28 )
28 29
29 // 任务 30 // 任务
@@ -288,8 +288,18 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro @@ -288,8 +288,18 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro
288 } else { 288 } else {
289 completedAsParticipator = int64(count) 289 completedAsParticipator = int64(count)
290 } 290 }
291 - //if count, err := tx.Model(taskModel).  
292 - // Where(`task.sponsor @> '{}'`) 291 + // TODO 已过期竞标任务统计
  292 + if count, err := tx.Model(taskModel).
  293 + Where(`task.sponsor @> '{"uid":?}'`, uid).
  294 + //Where(`task.task_type = ? `, domain.TASK_STATUS_EXPIRED).
  295 + Where(`task.task_type = ?`, 2).
  296 + Where("task.task_status = ? ", domain.TASK_STATUS_UNCLAIMED).
  297 + Where(`task.planned_completion_time < ?`, time.Now()).
  298 + Count(); err != nil {
  299 + return nil, err
  300 + } else {
  301 + expiredAsSponsor = int64(count)
  302 + }
293 return map[string]interface{}{ 303 return map[string]interface{}{
294 "underwayAsAssignedPerson": underwayAsAssignedPerson, 304 "underwayAsAssignedPerson": underwayAsAssignedPerson,
295 "unAcceptanceAsAssignedPerson": unAcceptanceAsAssignedPerson, 305 "unAcceptanceAsAssignedPerson": unAcceptanceAsAssignedPerson,