浏览代码

外呼接口调整

xuzhiheng 2 年之前
父节点
当前提交
ca6247b795
共有 5 个文件被更改,包括 48 次插入54 次删除
  1. 1 13
      api/internal/logic/calllogic.go
  2. 1 1
      rpc/biService.proto
  3. 1 6
      rpc/internal/logic/calllogic.go
  4. 23 23
      rpc/pb/biService.pb.go
  5. 22 11
      service/hlyj.go

+ 1 - 13
api/internal/logic/calllogic.go

@@ -26,21 +26,9 @@ func NewCallLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CallLogic {
 }
 
 func (l *CallLogic) Call(req *types.CallReq) (resp *types.Resp, err error) {
-	resp = &types.Resp{}
 	callresp, err := l.svcCtx.BiServiceRpc.Call(l.ctx, &pb.CallReq{
 		PositionId: req.PositionId,
 		Phone:      req.Phone,
 	})
-
-	if callresp == nil || err != nil {
-		resp.Error_msg = "暂无数据"
-		resp.Error_code = -1
-		resp.Data = map[string]interface{}{
-			"status": -1,
-		}
-	}
-	resp.Data = map[string]interface{}{
-		"status": callresp.Status,
-	}
-	return
+	return &types.Resp{Error_code: 1, Data: callresp.Data}, err
 }

+ 1 - 1
rpc/biService.proto

@@ -65,7 +65,7 @@ message CallReq{
 message Resp{
 	int64 error_code = 1;
 	string error_msg = 2;
-	int64 status =3;
+	string data =3;
 }
 
 service BiService {

+ 1 - 6
rpc/internal/logic/calllogic.go

@@ -37,11 +37,6 @@ func (l *CallLogic) Call(in *pb.CallReq) (*pb.Resp, error) {
 		Integratedid: entity.Hlyj.Integratedid,
 		CallFlag:     entity.Hlyj.CallFlag,
 	}
-	status := hlyj.Call(in.Phone, in.PositionId)
-	if status {
-		resp.Status = 1
-	} else {
-		resp.Status = -1
-	}
+	resp.Data = hlyj.Call(in.Phone, in.PositionId)
 	return resp, nil
 }

+ 23 - 23
rpc/pb/biService.pb.go

@@ -642,7 +642,7 @@ type Resp struct {
 
 	ErrorCode int64  `protobuf:"varint,1,opt,name=error_code,json=errorCode,proto3" json:"error_code,omitempty"`
 	ErrorMsg  string `protobuf:"bytes,2,opt,name=error_msg,json=errorMsg,proto3" json:"error_msg,omitempty"`
-	Status    int64  `protobuf:"varint,3,opt,name=status,proto3" json:"status,omitempty"`
+	Data      string `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
 }
 
 func (x *Resp) Reset() {
@@ -691,11 +691,11 @@ func (x *Resp) GetErrorMsg() string {
 	return ""
 }
 
-func (x *Resp) GetStatus() int64 {
+func (x *Resp) GetData() string {
 	if x != nil {
-		return x.Status
+		return x.Data
 	}
-	return 0
+	return ""
 }
 
 var File_biService_proto protoreflect.FileDescriptor
@@ -775,28 +775,28 @@ var file_biService_proto_rawDesc = []byte{
 	0x65, 0x71, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69,
 	0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f,
 	0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01,
-	0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x22, 0x5a, 0x0a, 0x04, 0x52, 0x65, 0x73,
+	0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x22, 0x56, 0x0a, 0x04, 0x52, 0x65, 0x73,
 	0x70, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18,
 	0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65,
 	0x12, 0x1b, 0x0a, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20,
-	0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x16, 0x0a,
-	0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73,
-	0x74, 0x61, 0x74, 0x75, 0x73, 0x32, 0xdd, 0x01, 0x0a, 0x09, 0x42, 0x69, 0x53, 0x65, 0x72, 0x76,
-	0x69, 0x63, 0x65, 0x12, 0x30, 0x0a, 0x0b, 0x6d, 0x79, 0x44, 0x61, 0x74, 0x61, 0x41, 0x73, 0x73,
-	0x65, 0x74, 0x12, 0x0f, 0x2e, 0x4d, 0x79, 0x44, 0x61, 0x74, 0x61, 0x41, 0x73, 0x73, 0x65, 0x74,
-	0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x4d, 0x79, 0x44, 0x61, 0x74, 0x61, 0x41, 0x73, 0x73, 0x65,
-	0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2d, 0x0a, 0x0a, 0x61, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a,
-	0x65, 0x63, 0x74, 0x12, 0x0e, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74,
-	0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74,
-	0x52, 0x65, 0x73, 0x70, 0x12, 0x2b, 0x0a, 0x09, 0x67, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x49,
-	0x64, 0x12, 0x0e, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65,
-	0x71, 0x1a, 0x0e, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x49, 0x64, 0x52, 0x65, 0x73,
-	0x70, 0x12, 0x29, 0x0a, 0x08, 0x64, 0x72, 0x61, 0x77, 0x43, 0x6c, 0x75, 0x65, 0x12, 0x0c, 0x2e,
-	0x64, 0x72, 0x61, 0x77, 0x43, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x41, 0x64,
-	0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x17, 0x0a, 0x04,
-	0x43, 0x61, 0x6c, 0x6c, 0x12, 0x08, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x05,
-	0x2e, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70,
-	0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x12, 0x0a,
+	0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74,
+	0x61, 0x32, 0xdd, 0x01, 0x0a, 0x09, 0x42, 0x69, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12,
+	0x30, 0x0a, 0x0b, 0x6d, 0x79, 0x44, 0x61, 0x74, 0x61, 0x41, 0x73, 0x73, 0x65, 0x74, 0x12, 0x0f,
+	0x2e, 0x4d, 0x79, 0x44, 0x61, 0x74, 0x61, 0x41, 0x73, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x1a,
+	0x10, 0x2e, 0x4d, 0x79, 0x44, 0x61, 0x74, 0x61, 0x41, 0x73, 0x73, 0x65, 0x74, 0x52, 0x65, 0x73,
+	0x70, 0x12, 0x2d, 0x0a, 0x0a, 0x61, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12,
+	0x0e, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x1a,
+	0x0f, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70,
+	0x12, 0x2b, 0x0a, 0x09, 0x67, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x49, 0x64, 0x12, 0x0e, 0x2e,
+	0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e,
+	0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x29, 0x0a,
+	0x08, 0x64, 0x72, 0x61, 0x77, 0x43, 0x6c, 0x75, 0x65, 0x12, 0x0c, 0x2e, 0x64, 0x72, 0x61, 0x77,
+	0x43, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f,
+	0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x17, 0x0a, 0x04, 0x43, 0x61, 0x6c, 0x6c,
+	0x12, 0x08, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x05, 0x2e, 0x52, 0x65, 0x73,
+	0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
+	0x33,
 }
 
 var (

+ 22 - 11
service/hlyj.go

@@ -2,11 +2,13 @@ package service
 
 import (
 	"context"
+	"encoding/json"
 	"log"
 	"time"
 
 	"app.yhyue.com/moapp/jybase/date"
 	"app.yhyue.com/moapp/jybase/redis"
+	. "bp.jydev.jianyu360.cn/BaseService/biService/entity"
 	"github.com/gogf/gf/v2/frame/g"
 	"github.com/gogf/gf/v2/util/gconv"
 )
@@ -25,7 +27,7 @@ func (this *HlyjStruct) GetRedisKey() string {
 	return "hlyj_access_token"
 }
 
-//获取token
+// 获取token
 func (this *HlyjStruct) GetAccessToken() string {
 	//取缓存
 	if redisToken := redis.GetStr("newother", this.GetRedisKey()); redisToken != "" {
@@ -59,21 +61,30 @@ func Get(url string, param map[string]interface{}) (str string) {
 	return
 }
 
-//打电话
-func (this *HlyjStruct) Call(phone string, positionId int64) bool {
+// 打电话
+func (this *HlyjStruct) Call(phone string, positionId int64) string {
 	//获取token
-	token := this.GetAccessToken()
-	if token == "" {
-		log.Println("未获取到token")
-		return false
-	}
+	// token := this.GetAccessToken()
+	// if token == "" {
+	// 	log.Println("未获取到token")
+	// 	return false
+	// }
 	//获取坐席id
 	integratedid, _ := getSeatNumber(positionId)
 	if integratedid == "" {
 		log.Println("未获取到坐席id")
-		return false
+		return ""
 	}
+	id := JyBiTidb.Insert("call_history", map[string]interface{}{
+		"phone":      phone,
+		"positionId": positionId,
+		"seatNumber": integratedid,
+		"createTime": time.Now().Format(date.Date_Full_Layout),
+	})
+	data := map[string]interface{}{"callId": id}
+	bytes, _ := json.Marshal(&data)
+	return string(bytes)
 	//打电话接口
-	ret := Get(this.CallUrl, g.Map{"flag": this.CallFlag, "account": this.Account, "integratedid": integratedid, "accessToken": token, "phonenum": phone})
-	return ret == "200"
+	// ret := Get(this.CallUrl, g.Map{"flag": this.CallFlag, "account": this.Account, "integratedid": integratedid, "accessToken": token, "phonenum": phone})
+	// return ret == "200"
 }