浏览代码

用户查询处理

WH01243 3 天之前
父节点
当前提交
22fa34f7b0
共有 1 个文件被更改,包括 27 次插入15 次删除
  1. 27 15
      clueSync/manualOperation.go

+ 27 - 15
clueSync/manualOperation.go

@@ -65,8 +65,20 @@ func clueBefore(c *gin.Context) {
 		if clueData != nil {
 			positionId = gconv.Int64((*clueData)["position_id"])
 		}
-
 	} else {
+		if uId == "" || phone == "" {
+			data := TiDb.FindOne("temporary_assignment", map[string]interface{}{
+				"userId": userId,
+				"status": 0,
+			}, "", "")
+			if data != nil && len(*data) > 0 {
+				positionId = gconv.Int64((*data)["positionId"])
+				returnData.Phone, returnData.Wxer, returnData.Name = GetPersonSubsidiary(positionId)
+				log.Println(returnData)
+				c.JSON(http.StatusOK, returnData)
+				return
+			}
+		}
 		belong_to = GetUserChannel(userId)
 	}
 	if source == "0104" || strings.HasPrefix(belong_to, "02") || source == "0102" || source == "0103" || phone == "" || strings.HasPrefix(belong_to, "03") {
@@ -75,19 +87,6 @@ func clueBefore(c *gin.Context) {
 	}
 	top_cluetype, sub_cluetype, level, topname, subname := getCodeId(req.Action, req.SourceDesc)
 	seatNumber, saleName, saleData, pIsOk, isFreeze, noticePositionId := "", "", []map[string]interface{}{}, true, true, int64(0)
-	if uId == "" || phone == "" {
-		data := TiDb.FindOne("temporary_assignment", map[string]interface{}{
-			"userId": userId,
-			"status": 0,
-		}, "", "")
-		if data != nil && len(*data) > 0 {
-			positionId = gconv.Int64((*data)["positionId"])
-			returnData.Phone, returnData.Wxer, returnData.Name = GetPersonSubsidiary(positionId)
-			log.Println(returnData)
-			c.JSON(http.StatusOK, returnData)
-			return
-		}
-	}
 	if positionId != 0 {
 		//线索上边已经有人了
 		personnel := TiDb.FindOne("dwd_f_crm_personnel_management", map[string]interface{}{
@@ -396,6 +395,7 @@ func processClueInfo(uId, cluename string) (isGroup, isCommerce int, kcPositionI
 // 线索状态查询
 func getClueState(c *gin.Context) {
 	// 1. 参数绑定和验证
+	positionId := int64(0)
 	var req FetchDeptAdminRequest
 	response := FetchDeptAdminResponse{}
 	if err := c.ShouldBindJSON(&req); err != nil {
@@ -410,10 +410,22 @@ func getClueState(c *gin.Context) {
 		c.JSON(http.StatusOK, response)
 		return
 	}
+	if uId == "" {
+		data := TiDb.FindOne("temporary_assignment", map[string]interface{}{
+			"userId": userId,
+			"status": 0,
+		}, "", "")
+		if data != nil && len(*data) > 0 {
+			positionId = gconv.Int64((*data)["positionId"])
+			response.Phone, response.Wxer, response.Name = GetPersonSubsidiary(positionId)
+			log.Println(response)
+			c.JSON(http.StatusOK, response)
+			return
+		}
+	}
 	// 3. 处理线索信息
 	_, _, kcPositionId, isTransfer, clueData := processClueInfo(uId, "")
 	// 4. 根据是否转移获取不同数据
-	positionId := int64(0)
 	if clueData != nil {
 		positionId = gconv.Int64((*clueData)["position_id"])
 	} else {