|
@@ -277,7 +277,8 @@ func GetPersonSubsidiary(positionId int64) (string, string, string) {
|
|
|
name = gconv.String((*personnel)["name"])
|
|
|
}
|
|
|
//二维码获取
|
|
|
- qrData := Mysql.SelectBySql(`SELECT
|
|
|
+ if name != "" {
|
|
|
+ qrData := Mysql.SelectBySql(`SELECT
|
|
|
b.qr_code
|
|
|
FROM
|
|
|
wx_qy_user a
|
|
@@ -286,8 +287,9 @@ func GetPersonSubsidiary(positionId int64) (string, string, string) {
|
|
|
AND b.is_del = 0
|
|
|
ORDER BY
|
|
|
b.create_date DESC`, fmt.Sprintf("%%%s%%", name))
|
|
|
- if qrData != nil && len(*qrData) > 0 {
|
|
|
- qrCode = gconv.String((*qrData)[0]["qr_code"])
|
|
|
+ if qrData != nil && len(*qrData) > 0 {
|
|
|
+ qrCode = gconv.String((*qrData)[0]["qr_code"])
|
|
|
+ }
|
|
|
}
|
|
|
return phone, qrCode, name
|
|
|
}
|
|
@@ -336,7 +338,7 @@ func processClueInfo(uId, cluename string) (isGroup, isCommerce int, kcPositionI
|
|
|
}, "", "")
|
|
|
if clueData != nil && len(*clueData) > 0 {
|
|
|
clueId := gconv.Int64((*clueData)["id"])
|
|
|
- is_transfer := gconv.Int64((*clueData)["is_transfer"])
|
|
|
+ is_transfer = gconv.Int64((*clueData)["is_transfer"])
|
|
|
if is_transfer == 1 {
|
|
|
//在客成
|
|
|
customData := TiDb.FindOne("dwd_f_csm_customer_info", map[string]interface{}{
|
|
@@ -354,24 +356,26 @@ func processClueInfo(uId, cluename string) (isGroup, isCommerce int, kcPositionI
|
|
|
func getClueState(c *gin.Context) {
|
|
|
// 1. 参数绑定和验证
|
|
|
var req FetchDeptAdminRequest
|
|
|
+ response := FetchDeptAdminResponse{}
|
|
|
if err := c.ShouldBindJSON(&req); err != nil {
|
|
|
c.JSON(http.StatusBadRequest, gin.H{"error": "无效的请求参数"})
|
|
|
return
|
|
|
}
|
|
|
// 2. 处理用户信息
|
|
|
- uId, _, _, _, _, _ := processUserInfo(req)
|
|
|
-
|
|
|
+ uId, _, source, belong_to, _, _ := processUserInfo(req)
|
|
|
+ if source == "0104" || strings.HasPrefix(belong_to, "02") || source == "0102" || source == "0103" || strings.HasPrefix(belong_to, "03") {
|
|
|
+ c.JSON(http.StatusOK, response)
|
|
|
+ return
|
|
|
+ }
|
|
|
// 3. 处理线索信息
|
|
|
_, _, kcPositionId, isTransfer, clueData := processClueInfo(uId, "")
|
|
|
- // 4. 准备响应数据
|
|
|
- response := FetchDeptAdminResponse{}
|
|
|
- // 5. 根据是否转移获取不同数据
|
|
|
+ // 4. 根据是否转移获取不同数据
|
|
|
positionId := gconv.Int64((*clueData)["position_id"])
|
|
|
if isTransfer == 1 {
|
|
|
response.Phone, response.Wxer, response.Name = GetPersonSubsidiary(kcPositionId)
|
|
|
} else {
|
|
|
response.Phone, response.Wxer, response.Name = GetPersonSubsidiary(positionId)
|
|
|
}
|
|
|
- // 6. 返回响应
|
|
|
+ // 5. 返回响应
|
|
|
c.JSON(http.StatusOK, response)
|
|
|
}
|