dxc hace 2 años
padre
commit
735007b5d4
Se han modificado 1 ficheros con 3 adiciones y 2 borrados
  1. 3 2
      internal/logic/callback/callbackmsglogic.go

+ 3 - 2
internal/logic/callback/callbackmsglogic.go

@@ -263,9 +263,9 @@ func msgTypeTextHandle(svcCtx *svc.ServiceContext, msg *model.CbMsg) {
 			logx.Error("GetSessionState fail ", err)
 		}
 		_ = svcCtx.Redis.Set(key, fmt.Sprintf("%v", sessionState.ServiceState))
-		return
+		v = fmt.Sprintf("%v", sessionState.ServiceState)
 	}
-	if v == "0" {
+	if v == "0" || v == "1" {
 		//进入会话事件,加入消息流转池
 		err := svcCtx.WxApi.UpdateSessionState(msg.OpenKfid, msg.ExternalUserid, "", 2)
 		if err != nil {
@@ -292,6 +292,7 @@ func msgTypeEventHandle(svcCtx *svc.ServiceContext, msg *model.CbMsg) {
 	switch string(eventType) {
 	case types.EventTypeSessionStatusChange:
 		key := fmt.Sprintf("cb_user_state:%v", msg.ExternalUserid)
+		_, _ = svcCtx.Redis.Del(key)
 		//获取会话状态
 		err, sessionState := svcCtx.WxApi.GetSessionState(msg.OpenKfid, msg.ExternalUserid)
 		if err != nil {