Prechádzať zdrojové kódy

客成修改线索名称移交客成

renjiaojiao 19 hodín pred
rodič
commit
ef5cf9cdc4
2 zmenil súbory, kde vykonal 16 pridanie a 14 odobranie
  1. 9 9
      api/internal/svc/servicecontext.go
  2. 7 5
      service/custom.go

+ 9 - 9
api/internal/svc/servicecontext.go

@@ -24,23 +24,23 @@ func NewServiceContext(c config.Config) *ServiceContext {
 		BiServiceRpc: biservice.NewBiService(zrpc.MustNewClient(c.BiServiceRpc)),
 		ResourceCenterRpc: resource.NewResource(zrpc.MustNewClient(zrpc.RpcClientConf{
 			Etcd: discov.EtcdConf{
-				Hosts: c.BiServiceRpc.Etcd.Hosts,
-				//Hosts: []string{"172.31.31.205:2379"},
-				Key: c.ResourceCenterKey,
+				//Hosts: c.BiServiceRpc.Etcd.Hosts,
+				Hosts: []string{"172.31.31.205:2379"},
+				Key:   c.ResourceCenterKey,
 			},
 		})),
 		UserCenterRpc: usercenter.NewUserCenter(zrpc.MustNewClient(zrpc.RpcClientConf{
 			Etcd: discov.EtcdConf{
-				Hosts: c.BiServiceRpc.Etcd.Hosts,
-				//Hosts: []string{"172.31.31.205:2379"},
-				Key: c.UserCenterKey,
+				//Hosts: c.BiServiceRpc.Etcd.Hosts,
+				Hosts: []string{"172.31.31.205:2379"},
+				Key:   c.UserCenterKey,
 			},
 		})),
 		MessageCenterRpc: messageclient.NewMessage(zrpc.MustNewClient(zrpc.RpcClientConf{
 			Etcd: discov.EtcdConf{
-				Hosts: c.BiServiceRpc.Etcd.Hosts,
-				//Hosts: []string{"172.31.31.205:2379"},
-				Key: c.MessageCenterKey,
+				//Hosts: c.BiServiceRpc.Etcd.Hosts,
+				Hosts: []string{"172.31.31.205:2379"},
+				Key:   c.MessageCenterKey,
 			},
 		})),
 	}

+ 7 - 5
service/custom.go

@@ -24,7 +24,7 @@ func RelatedCompanyIsCustom(companyName string) bool {
 func ClueTransfer(clueId, changeType, kcType, mainClueId int64, clueName string) (status int, err error) {
 	if changeType == 1 { //电销中修改线索名称
 		status, err = DxUpdateClueName(clueId, clueName)
-	} else { //客成修改名称
+	} else {             //客成修改名称
 		if kcType == 1 { //回电销
 			status, err = ClueTransferDx(clueId, mainClueId)
 		} else { //划转到关联客户客成
@@ -130,7 +130,7 @@ func ClueTransferDx(clueId, mainClueId int64) (status int, err error) {
 	//查询原主账号电销人员
 	is_assign := 1
 	status = 1
-	positionId, kcPositionId, seatNumber, isFreeze := GetSalePerson(mainClueId)
+	positionId, kcPositionId, seatNumber, kcName, isFreeze := GetSalePerson(mainClueId)
 	if isFreeze || positionId == 0 {
 		is_assign = 0
 	}
@@ -177,7 +177,7 @@ func ClueTransferDx(clueId, mainClueId int64) (status int, err error) {
 			"position_id":  common.If(kcPositionId > 0, kcPositionId, -1),
 			"change_field": "position_id",
 			"change_type":  "客户成功经理",
-			"old_value":    kcPositionId,
+			"old_value":    kcName,
 			"new_value":    "/",
 			"createtime":   nowTime,
 			"BCPCID":       common.GetRandom(32),
@@ -235,12 +235,13 @@ func ClueTransferKc(clueId int64, clueName string) (int, error) {
 	return -1, errors.New("更新客成信息出错")
 }
 
-func GetSalePerson(mainClueId int64) (positionId, kcPosId int64, seatNumber string, isFreeze bool) {
+func GetSalePerson(mainClueId int64) (positionId, kcPosId int64, seatNumber, kcName string, isFreeze bool) {
 	isFreeze = false
-	clueData := entity.JyBiTidb.SelectBySql("SELECT a.position_id,a.seatNumber,b.position_id as kcPosId FROM dwd_f_crm_clue_info a LEFT JOIN dwd_f_csm_customer_info b ON a.id = b.clue_id WHERE a.id = ?", mainClueId)
+	clueData := entity.JyBiTidb.SelectBySql("SELECT a.position_id,a.seatNumber,b.position_id as kcPosId,b.name as kcName FROM dwd_f_crm_clue_info a LEFT JOIN dwd_f_csm_customer_info b ON a.id = b.clue_id WHERE a.id = ?", mainClueId)
 	if clueData != nil && len(*clueData) > 0 {
 		positionId = common.Int64All((*clueData)[0]["position_id"])
 		seatNumber = common.InterfaceToStr((*clueData)[0]["seatNumber"])
+		kcName = common.InterfaceToStr((*clueData)[0]["kcName"])
 		kcPosId = common.Int64All((*clueData)[0]["kcPosId"])
 	}
 
@@ -287,6 +288,7 @@ func GetSalePerson(mainClueId int64) (positionId, kcPosId int64, seatNumber stri
 					seatNumber = gconv.String((*sdata)[0]["seat_number"])
 					//newPerson = gconv.String((*sdata)[0]["name"])
 				}
+				break
 			}
 		}
 	}