|
@@ -750,7 +750,7 @@ func (f *Front) UserTaskList() {
|
|
|
}
|
|
|
if s_role == "4" {
|
|
|
query["s_personid"] = s_personid
|
|
|
- } else if s_role == "2" {
|
|
|
+ } else if s_role == "2" || s_role == "1" {
|
|
|
query["s_groupid"] = gid
|
|
|
}
|
|
|
if status != "-1" { //任务状态
|
|
@@ -835,24 +835,41 @@ func (f *Front) UserTaskDeliver() {
|
|
|
f.ServeJson(map[string]interface{}{"success": success, "msg": msg})
|
|
|
}
|
|
|
|
|
|
-// UserTaskClose 用户任务关闭
|
|
|
+// UserTaskClose 用户任务打回
|
|
|
func (f *Front) UserTaskClose() {
|
|
|
defer qu.Catch()
|
|
|
user := f.GetSession("user").(map[string]interface{})
|
|
|
username := qu.ObjToString(user["s_login"])
|
|
|
- userTaskId := f.GetString("taskid") //用户任务id
|
|
|
- qu.Debug("User Task Id:", userTaskId)
|
|
|
+ taskid := f.GetString("taskid") //用户任务id
|
|
|
+ qu.Debug("User Task Id:", taskid)
|
|
|
sourceInfo := f.GetString("s_sourceinfo") //数据源表
|
|
|
- //status := f.GetString("s_status")
|
|
|
- task, _ := Mgo.FindById(TASKCOLLNAME, userTaskId, map[string]interface{}{"s_status": 1})
|
|
|
- if len(*task) <= 0 {
|
|
|
- f.ServeJson(map[string]interface{}{"success": false, "msg": "查询任务失败"})
|
|
|
+ currenttime := time.Now().Unix()
|
|
|
+ //更新数据源
|
|
|
+ success := Mgo.Update(sourceInfo, map[string]interface{}{"s_usertaskid": taskid}, map[string]interface{}{
|
|
|
+ "$set": map[string]interface{}{
|
|
|
+ "b_istag": false,
|
|
|
+ "i_ckdata": 0,
|
|
|
+ "i_updatetime": currenttime,
|
|
|
+ },
|
|
|
+ }, false, true)
|
|
|
+ // 修改任务
|
|
|
+ if success {
|
|
|
+ Mgo.UpdateById(TASKCOLLNAME, taskid, map[string]interface{}{
|
|
|
+ "$set": map[string]interface{}{
|
|
|
+ "s_status": "未开始",
|
|
|
+ "s_updateperson": username,
|
|
|
+ "i_updatetime": currenttime,
|
|
|
+ "s_progress": "0%",
|
|
|
+ },
|
|
|
+ "$unset": map[string]interface{}{
|
|
|
+ "i_completetime": "",
|
|
|
+ },
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ f.ServeJson(map[string]interface{}{"success": false, "msg": "操作失败"})
|
|
|
return
|
|
|
}
|
|
|
- status := qu.ObjToString((*task)["s_status"])
|
|
|
- userTaskIdStatus := map[string]string{userTaskId: status}
|
|
|
- msg, count, success := RetrieveCloseTaskByUser(sourceInfo, username, userTaskIdStatus)
|
|
|
- f.ServeJson(map[string]interface{}{"success": success, "count": count, "msg": msg})
|
|
|
+ f.ServeJson(map[string]interface{}{"success": success})
|
|
|
}
|
|
|
|
|
|
// UpdateSourceInfoByUser 用户分发任务成功后更新数据源表
|