作者 陈志颖

fix:修复更新奖励素范围问题

@@ -131,6 +131,12 @@ func (status *UnReleasedStatus) Update(task *Task, data map[string]interface{}) @@ -131,6 +131,12 @@ func (status *UnReleasedStatus) Update(task *Task, data map[string]interface{})
131 if suMoney, ok := data["suMoney"]; ok { 131 if suMoney, ok := data["suMoney"]; ok {
132 task.SuMoney = suMoney.(float64) 132 task.SuMoney = suMoney.(float64)
133 } 133 }
  134 + if minSuMoney, ok := data["minSuMoney"]; ok {
  135 + task.MinSuMoney = minSuMoney.(float64)
  136 + }
  137 + if maxSuMoney, ok := data["maxSuMoney"]; ok {
  138 + task.MaxSuMoney = maxSuMoney.(float64)
  139 + }
134 if task.TaskType == TASK_TYPE_BID { 140 if task.TaskType == TASK_TYPE_BID {
135 if bidStartTime, ok := data["bidStartTime"]; ok { 141 if bidStartTime, ok := data["bidStartTime"]; ok {
136 task.BidInfo.BidStartTime = bidStartTime.(time.Time) 142 task.BidInfo.BidStartTime = bidStartTime.(time.Time)
@@ -216,7 +222,7 @@ func (status *UnReleasedStatus) RejectReceiver(task *Task) error { @@ -216,7 +222,7 @@ func (status *UnReleasedStatus) RejectReceiver(task *Task) error {
216 222
217 type UnClaimedStatus struct{} 223 type UnClaimedStatus struct{}
218 224
219 -// TODO 待领取任务开放编辑 225 +// 待领取任务开放编辑
220 func (status *UnClaimedStatus) Update(task *Task, data map[string]interface{}) error { 226 func (status *UnClaimedStatus) Update(task *Task, data map[string]interface{}) error {
221 //return fmt.Errorf("待领取的任务不允许编辑") 227 //return fmt.Errorf("待领取的任务不允许编辑")
222 if taskName, ok := data["taskName"]; ok { 228 if taskName, ok := data["taskName"]; ok {
@@ -240,6 +246,12 @@ func (status *UnClaimedStatus) Update(task *Task, data map[string]interface{}) e @@ -240,6 +246,12 @@ func (status *UnClaimedStatus) Update(task *Task, data map[string]interface{}) e
240 if suMoney, ok := data["suMoney"]; ok { 246 if suMoney, ok := data["suMoney"]; ok {
241 task.SuMoney = suMoney.(float64) 247 task.SuMoney = suMoney.(float64)
242 } 248 }
  249 + if minSuMoney, ok := data["minSuMoney"]; ok {
  250 + task.MinSuMoney = minSuMoney.(float64)
  251 + }
  252 + if maxSuMoney, ok := data["maxSuMoney"]; ok {
  253 + task.MaxSuMoney = maxSuMoney.(float64)
  254 + }
243 if task.TaskType == TASK_TYPE_BID { 255 if task.TaskType == TASK_TYPE_BID {
244 if bidStartTime, ok := data["bidStartTime"]; ok { 256 if bidStartTime, ok := data["bidStartTime"]; ok {
245 task.BidInfo.BidStartTime = bidStartTime.(time.Time) 257 task.BidInfo.BidStartTime = bidStartTime.(time.Time)
@@ -32,9 +32,9 @@ func (repository *TaskRepository) Save(task *domain.Task) (*domain.Task, error) @@ -32,9 +32,9 @@ func (repository *TaskRepository) Save(task *domain.Task) (*domain.Task, error)
32 return task, err 32 return task, err
33 } 33 }
34 if _, err := tx.QueryOne( 34 if _, err := tx.QueryOne(
35 - pg.Scan(&task.TaskId, &task.CompanyId, &task.TaskName, &task.TaskType, &task.Sponsor, &task.TaskStatus, &task.ReferenceResource, &task.ProjectBelong, pg.Array(&task.CustomerValues), &task.TaskNature, &task.SuMoney, &task.AcceptanceStandard, &task.TaskDescription, pg.Array(&task.TaskPictureUrls), &task.IsRewardTake, &task.CreateTime, &task.ReleaseTime, &task.Participators, &task.TaskPercentage, &task.SolveReport, pg.Array(&task.SolvePictureUrls), &task.AssignedPerson, &task.PlannedCompletionTime, &task.ActualCompletionTime),  
36 - "INSERT INTO tasks (id, company_id, task_name, task_type, sponsor, task_status, reference_resource, project_belong, customer_values, task_nature, su_money, acceptance_standard, task_description, task_picture_urls, is_reward_take, create_time, release_time, participators, task_percentage, solve_report, solve_picture_urls, assigned_person, planned_completion_time, actual_completion_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id, company_id, task_name, task_type, sponsor, task_status, reference_resource, project_belong, customer_values, task_nature, su_money, acceptance_standard, task_description, task_picture_urls, is_reward_take, create_time, release_time, participators, task_percentage, solve_report, solve_picture_urls, assigned_person, planned_completion_time, actual_completion_time",  
37 - takeId, task.CompanyId, task.TaskName, task.TaskType, task.Sponsor, task.TaskStatus, task.ReferenceResource, task.ProjectBelong, pg.Array(task.CustomerValues), task.TaskNature, task.SuMoney, task.AcceptanceStandard, task.TaskDescription, pg.Array(task.TaskPictureUrls), task.IsRewardTake, task.CreateTime, task.ReleaseTime, task.Participators, task.TaskPercentage, task.SolveReport, pg.Array(task.SolvePictureUrls), task.AssignedPerson, task.PlannedCompletionTime, task.ActualCompletionTime); err != nil { 35 + pg.Scan(&task.TaskId, &task.CompanyId, &task.TaskName, &task.TaskType, &task.Sponsor, &task.TaskStatus, &task.ReferenceResource, &task.ProjectBelong, pg.Array(&task.CustomerValues), &task.TaskNature, &task.SuMoney, &task.MinSuMoney, &task.MaxSuMoney, &task.AcceptanceStandard, &task.TaskDescription, pg.Array(&task.TaskPictureUrls), &task.IsRewardTake, &task.CreateTime, &task.ReleaseTime, &task.Participators, &task.TaskPercentage, &task.SolveReport, pg.Array(&task.SolvePictureUrls), &task.AssignedPerson, &task.PlannedCompletionTime, &task.ActualCompletionTime),
  36 + "INSERT INTO tasks (id, company_id, task_name, task_type, sponsor, task_status, reference_resource, project_belong, customer_values, task_nature, su_money, min_su_money, max_su_money, acceptance_standard, task_description, task_picture_urls, is_reward_take, create_time, release_time, participators, task_percentage, solve_report, solve_picture_urls, assigned_person, planned_completion_time, actual_completion_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id, company_id, task_name, task_type, sponsor, task_status, reference_resource, project_belong, customer_values, task_nature, su_money, min_su_money, max_su_money, acceptance_standard, task_description, task_picture_urls, is_reward_take, create_time, release_time, participators, task_percentage, solve_report, solve_picture_urls, assigned_person, planned_completion_time, actual_completion_time",
  37 + takeId, task.CompanyId, task.TaskName, task.TaskType, task.Sponsor, task.TaskStatus, task.ReferenceResource, task.ProjectBelong, pg.Array(task.CustomerValues), task.TaskNature, task.SuMoney, task.MinSuMoney, task.MaxSuMoney, task.AcceptanceStandard, task.TaskDescription, pg.Array(task.TaskPictureUrls), task.IsRewardTake, task.CreateTime, task.ReleaseTime, task.Participators, task.TaskPercentage, task.SolveReport, pg.Array(task.SolvePictureUrls), task.AssignedPerson, task.PlannedCompletionTime, task.ActualCompletionTime); err != nil {
38 return task, err 38 return task, err
39 } 39 }
40 } else { 40 } else {
@@ -49,9 +49,9 @@ func (repository *TaskRepository) Save(task *domain.Task) (*domain.Task, error) @@ -49,9 +49,9 @@ func (repository *TaskRepository) Save(task *domain.Task) (*domain.Task, error)
49 taskReceiverUid = 0 49 taskReceiverUid = 0
50 } 50 }
51 if _, err := tx.QueryOne( 51 if _, err := tx.QueryOne(
52 - pg.Scan(&task.TaskId, &task.CompanyId, &task.TaskName, &task.TaskType, &task.Sponsor, &task.TaskStatus, &task.ReferenceResource, &task.ProjectBelong, pg.Array(&task.CustomerValues), &task.TaskNature, &task.SuMoney, &task.AcceptanceStandard, &task.TaskDescription, pg.Array(&task.TaskPictureUrls), &task.IsRewardTake, &task.CreateTime, &task.ReleaseTime, &task.Participators, &task.TaskPercentage, &task.SolveReport, pg.Array(&task.SolvePictureUrls), &task.AssignedPerson, &task.PlannedCompletionTime, &task.ActualCompletionTime, &task.ReceiveTime, &task.CompleteTime, &task.AcceptanceTime),  
53 - "UPDATE tasks SET company_id=?, task_name=?, task_type=?, sponsor=?, task_status=?, reference_resource=?, project_belong=?, customer_values=?, task_nature=?, su_money=?, acceptance_standard=?, task_description=?, task_picture_urls=?, is_reward_take=?, receiver_uid=?, create_time=?, release_time=?, participators=?, task_percentage=?, solve_report=?, solve_picture_urls=?, assigned_person=?, planned_completion_time=?, actual_completion_time=?, receive_time=?, complete_time=?, acceptance_time=? WHERE id=? RETURNING id, company_id, task_name, task_type, sponsor, task_status, reference_resource, project_belong, customer_values, task_nature, su_money, acceptance_standard, task_description, task_picture_urls, is_reward_take, create_time, release_time, participators, task_percentage, solve_report, solve_picture_urls, assigned_person, planned_completion_time, actual_completion_time, receive_time, complete_time, acceptance_time",  
54 - task.CompanyId, task.TaskName, task.TaskType, task.Sponsor, task.TaskStatus, task.ReferenceResource, task.ProjectBelong, pg.Array(task.CustomerValues), task.TaskNature, task.SuMoney, task.AcceptanceStandard, task.TaskDescription, pg.Array(task.TaskPictureUrls), task.IsRewardTake, taskReceiverUid, task.CreateTime, task.ReleaseTime, task.Participators, task.TaskPercentage, task.SolveReport, pg.Array(task.SolvePictureUrls), task.AssignedPerson, task.PlannedCompletionTime, task.ActualCompletionTime, task.ReceiveTime, task.CompleteTime, task.AcceptanceTime, task.Identify()); err != nil { 52 + pg.Scan(&task.TaskId, &task.CompanyId, &task.TaskName, &task.TaskType, &task.Sponsor, &task.TaskStatus, &task.ReferenceResource, &task.ProjectBelong, pg.Array(&task.CustomerValues), &task.TaskNature, &task.SuMoney, &task.MinSuMoney, &task.MaxSuMoney, &task.AcceptanceStandard, &task.TaskDescription, pg.Array(&task.TaskPictureUrls), &task.IsRewardTake, &task.CreateTime, &task.ReleaseTime, &task.Participators, &task.TaskPercentage, &task.SolveReport, pg.Array(&task.SolvePictureUrls), &task.AssignedPerson, &task.PlannedCompletionTime, &task.ActualCompletionTime, &task.ReceiveTime, &task.CompleteTime, &task.AcceptanceTime),
  53 + "UPDATE tasks SET company_id=?, task_name=?, task_type=?, sponsor=?, task_status=?, reference_resource=?, project_belong=?, customer_values=?, task_nature=?, su_money=?, min_su_money=?, max_su_money=?, acceptance_standard=?, task_description=?, task_picture_urls=?, is_reward_take=?, receiver_uid=?, create_time=?, release_time=?, participators=?, task_percentage=?, solve_report=?, solve_picture_urls=?, assigned_person=?, planned_completion_time=?, actual_completion_time=?, receive_time=?, complete_time=?, acceptance_time=? WHERE id=? RETURNING id, company_id, task_name, task_type, sponsor, task_status, reference_resource, project_belong, customer_values, task_nature, su_money, min_su_money, max_su_money, acceptance_standard, task_description, task_picture_urls, is_reward_take, create_time, release_time, participators, task_percentage, solve_report, solve_picture_urls, assigned_person, planned_completion_time, actual_completion_time, receive_time, complete_time, acceptance_time",
  54 + task.CompanyId, task.TaskName, task.TaskType, task.Sponsor, task.TaskStatus, task.ReferenceResource, task.ProjectBelong, pg.Array(task.CustomerValues), task.TaskNature, task.SuMoney, task.MinSuMoney, task.MaxSuMoney, task.AcceptanceStandard, task.TaskDescription, pg.Array(task.TaskPictureUrls), task.IsRewardTake, taskReceiverUid, task.CreateTime, task.ReleaseTime, task.Participators, task.TaskPercentage, task.SolveReport, pg.Array(task.SolvePictureUrls), task.AssignedPerson, task.PlannedCompletionTime, task.ActualCompletionTime, task.ReceiveTime, task.CompleteTime, task.AcceptanceTime, task.Identify()); err != nil {
55 return task, err 55 return task, err
56 } 56 }
57 } 57 }