Browse Source

feat: 创建机会修改咨询信息调整

zhangxinlei1996 1 year ago
parent
commit
82537b6bef
2 changed files with 5 additions and 3 deletions
  1. 4 1
      service/custom.go
  2. 1 2
      service/sale_chance.go

+ 4 - 1
service/custom.go

@@ -161,11 +161,13 @@ func EmployUpdate(tx *sql.Tx, employ_info_id, employ_custom_id, positionId int64
 		tablename = entity.EMPLOY_INFO
 		id = employ_info_id
 	}
+	fmt.Println(tablename, id)
 	if tablename == "" || id == 0 {
 		return employ_info_id, employ_custom_id
 	}
 	//判断该条信息是不是当前资讯分配员的
 	d := cm.CrmMysql.SelectBySqlByTx(tx, fmt.Sprintf(`select * from %v where id = ?`, tablename), id)
+	fmt.Println(d)
 	if d != nil && len(*d) > 0 {
 		data := (*d)[0]
 		position_id := gconv.Int64(data["position_id"])
@@ -176,13 +178,14 @@ func EmployUpdate(tx *sql.Tx, employ_info_id, employ_custom_id, positionId int64
 			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 {
 				//已创建
-				cm.CrmMysql.UpdateByTx(tx, tablename, map[string]interface{}{
+				qwe := cm.CrmMysql.UpdateByTx(tx, tablename, map[string]interface{}{
 					"source_id":   data["source_id"],
 					"position_id": positionId,
 				}, map[string]interface{}{
 					key:      1,
 					"status": 1,
 				})
+				log.Println(qwe, data["source_id"], positionId)
 			} else {
 				data["position_id"] = positionId
 				data["ent_id"] = entId

+ 1 - 2
service/sale_chance.go

@@ -159,10 +159,9 @@ func SaveChange(ctx context.Context, argsChange, argsTask, argsTaskTeam []interf
 	changeId, taskId := int64(-1), int64(-1)
 	cm.CrmMysql.ExecTx("创建机会", func(tx *sql.Tx) bool {
 		//
-		employ_info_id_new, employ_custom_id_new := EmployUpdate(tx, employ_info_id, employ_custom_id, positionId, "is_create_chance", entId, entUserId, entDeptId)
+		employ_info_id_new, _ := EmployUpdate(tx, employ_info_id, 0, positionId, "is_create_chance", entId, entUserId, entDeptId)
 
 		argsChange[3] = employ_info_id_new
-		argsChange[4] = employ_custom_id_new
 
 		//插入机会
 		changeId = SaleChangeAdd(tx, argsChange)