From aa2d07ca8dd6ebe5920911a15eb55c3fdd888f4c Mon Sep 17 00:00:00 2001
From: Gordon <1432970085@qq.com>
Date: Wed, 24 Aug 2022 14:22:47 +0800
Subject: [PATCH] callback add ex field and sdk server shell update

---
 config/config.yaml             |  3 +++
 internal/rpc/msg/callback.go   |  3 ++-
 pkg/call_back_struct/common.go |  1 +
 script/sdk_svr_start.sh        | 12 ++++--------
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/config/config.yaml b/config/config.yaml
index 5524a1219..984d8175a 100644
--- a/config/config.yaml
+++ b/config/config.yaml
@@ -102,6 +102,9 @@ cmsapi:
 sdk:
   openImSdkWsPort: [ 10003 ] #jssdk服务端口,默认即可,项目中使用jssdk才需开放此端口或做nginx转发
   dataDir: [ ../db/sdk/ ]
+  openImWsAddress:
+  openImApiAddress:
+
 #对象存储服务,以下配置二选一,目前支持两种,腾讯云和minio,二者配置好其中一种即可(如果使用minio参考https://doc.rentsoft.cn/#/qa/minio搭建minio服务器)
 credential: #腾讯cos,发送图片、视频、文件时需要,请自行申请后替换,必须修改
   tencent:
diff --git a/internal/rpc/msg/callback.go b/internal/rpc/msg/callback.go
index e00ee001a..e60a1ff3c 100644
--- a/internal/rpc/msg/callback.go
+++ b/internal/rpc/msg/callback.go
@@ -29,6 +29,7 @@ func copyCallbackCommonReqStruct(msg *pbChat.SendMsgReq) cbApi.CommonCallbackReq
 		SenderFaceURL:    msg.MsgData.SenderFaceURL,
 		Content:          callback.GetContent(msg.MsgData),
 		Seq:              msg.MsgData.Seq,
+		Ex:               msg.MsgData.Ex,
 	}
 	return req
 }
@@ -137,11 +138,11 @@ func callbackAfterSendGroupMsg(msg *pbChat.SendMsgReq) cbApi.CommonCallbackResp
 }
 
 func callbackWordFilter(msg *pbChat.SendMsgReq) cbApi.CommonCallbackResp {
+	log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), msg)
 	callbackResp := cbApi.CommonCallbackResp{OperationID: msg.OperationID}
 	if !config.Config.Callback.CallbackWordFilter.Enable || msg.MsgData.ContentType != constant.Text {
 		return callbackResp
 	}
-	log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), msg)
 	commonCallbackReq := copyCallbackCommonReqStruct(msg)
 	commonCallbackReq.CallbackCommand = constant.CallbackWordFilterCommand
 	req := cbApi.CallbackWordFilterReq{
diff --git a/pkg/call_back_struct/common.go b/pkg/call_back_struct/common.go
index ea61818e5..c3e5a4a71 100644
--- a/pkg/call_back_struct/common.go
+++ b/pkg/call_back_struct/common.go
@@ -17,6 +17,7 @@ type CommonCallbackReq struct {
 	Seq              uint32   `json:"seq"`
 	AtUserIDList     []string `json:"atUserList"`
 	SenderFaceURL    string   `json:"faceURL"`
+	Ex               string   `json:"ex"`
 }
 
 type CommonCallbackResp struct {
diff --git a/script/sdk_svr_start.sh b/script/sdk_svr_start.sh
index 5ac90501d..f362e6d2d 100644
--- a/script/sdk_svr_start.sh
+++ b/script/sdk_svr_start.sh
@@ -4,17 +4,13 @@ source ./style_info.cfg
 source ./path_info.cfg
 source ./function.sh
 ulimit -n 200000
-list1=$(cat $config_path | grep openImApiPort | awk -F '[:]' '{print $NF}')
-list2=$(cat $config_path | grep openImWsPort | awk -F '[:]' '{print $NF}')
+
+ws_address=$(cat $config_path | grep openImWsAddress | awk -F '[:]' '{print $NF}')
+api_address=$(cat $config_path | grep openImApiAddress | awk -F '[:]' '{print $NF}')
 list3=$(cat $config_path | grep openImSdkWsPort | awk -F '[:]' '{print $NF}')
 logLevel=$(cat $config_path | grep remainLogLevel | awk -F '[:]' '{print $NF}')
-list_to_string $list1
-api_ports=($ports_array)
-list_to_string $list2
-ws_ports=($ports_array)
 list_to_string $list3
 sdk_ws_ports=($ports_array)
-list_to_string $list4
 
 
 
@@ -28,7 +24,7 @@ fi
 #Waiting port recycling
 sleep 1
 cd ${sdk_server_binary_root}
-  nohup ./${sdk_server_name} -openIM_api_port ${api_ports[0]} -openIM_ws_port ${ws_ports[0]} -sdk_ws_port ${sdk_ws_ports[0]} -openIM_log_level ${logLevel} >>../logs/openIM.log 2>&1 &
+  nohup ./${sdk_server_name} -openIM_api_address ${api_address} -openIM_ws_address ${ws_address} -sdk_ws_port ${sdk_ws_ports[0]} -openIM_log_level ${logLevel} >>../logs/openIM.log 2>&1 &
 
 #Check launched service process
 sleep 3