|
@@ -171,28 +171,42 @@ func EmployUpdate(tx *sql.Tx, employ_info_id, employ_custom_id, positionId int64
|
|
|
if position_id == positionId {
|
|
|
return cm.CrmMysql.UpdateByTx(tx, tablename, map[string]interface{}{"id": id, "position_id": positionId}, map[string]interface{}{key: 1})
|
|
|
} else {
|
|
|
- data["position_id"] = positionId
|
|
|
- data["ent_id"] = entId
|
|
|
- data["ent_dept_id"] = entDeptId
|
|
|
- data["ent_user_id"] = entUserId
|
|
|
- //当前咨询不是分配员的 创建该条
|
|
|
- if employ_custom_id > 0 {
|
|
|
- //
|
|
|
- data["is_handle"] = 1
|
|
|
- data["is_ignore"] = 0
|
|
|
- data["is_create_custom"] = 1
|
|
|
-
|
|
|
- } else if employ_info_id > 0 {
|
|
|
- data["is_handle"] = 1
|
|
|
- data["is_ignore"] = 0
|
|
|
- data["is_dis"] = 0
|
|
|
- data[key] = 1
|
|
|
- for _, v := range GetOtherKey(key) {
|
|
|
- data[v] = 0
|
|
|
+ //判断是否已创建该条,但是是取消收录状态、如果是则改为已收录,不是则创建一条新的
|
|
|
+ //TODO
|
|
|
+ d2 := cm.CrmMysql.SelectBySqlByTx(tx, fmt.Sprintf(`select * from %v where source_id = ? and position_id =?`, tablename), data["source_id"], positionId)
|
|
|
+ if d2 != nil && len(*d2) > 0 {
|
|
|
+ //已创建
|
|
|
+ return cm.CrmMysql.UpdateByTx(tx, tablename, map[string]interface{}{
|
|
|
+ "source_id": data["source_id"],
|
|
|
+ "position_id": positionId,
|
|
|
+ }, map[string]interface{}{
|
|
|
+ key: 1,
|
|
|
+ "status": 1,
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ data["position_id"] = positionId
|
|
|
+ data["ent_id"] = entId
|
|
|
+ data["ent_dept_id"] = entDeptId
|
|
|
+ data["ent_user_id"] = entUserId
|
|
|
+ //当前咨询不是分配员的 创建该条
|
|
|
+ if employ_custom_id > 0 {
|
|
|
+ //
|
|
|
+ data["is_handle"] = 1
|
|
|
+ data["is_ignore"] = 0
|
|
|
+ data["is_create_custom"] = 1
|
|
|
+
|
|
|
+ } else if employ_info_id > 0 {
|
|
|
+ data["is_handle"] = 1
|
|
|
+ data["is_ignore"] = 0
|
|
|
+ data["is_dis"] = 0
|
|
|
+ data[key] = 1
|
|
|
+ for _, v := range GetOtherKey(key) {
|
|
|
+ data[v] = 0
|
|
|
+ }
|
|
|
}
|
|
|
+ delete(data, "id")
|
|
|
+ return cm.CrmMysql.InsertByTx(tx, tablename, data) > 0
|
|
|
}
|
|
|
- delete(data, "id")
|
|
|
- return cm.CrmMysql.InsertByTx(tx, tablename, data) > 0
|
|
|
}
|
|
|
}
|
|
|
return ok
|