renjiaojiao 1 жил өмнө
parent
commit
dd85d00cd2

+ 7 - 2
rpc/internal/common/appPush.go

@@ -11,7 +11,7 @@ import (
 	"strings"
 )
 
-func AppPushMsg(userInfo map[string]interface{}, stm, appPushUrl, title, detail string) error {
+func AppPushMsg(userInfo map[string]interface{}, stm, appPushUrl, title, detail string, msgType int64) error {
 	//限制
 	//校验发送间隔
 	userId := mongodb.BsonIdToSId(userInfo["_id"])
@@ -29,8 +29,13 @@ func AppPushMsg(userInfo map[string]interface{}, stm, appPushUrl, title, detail
 				phoneType = qutil.ObjToString(userInfo["s_appponetype"])
 				name = qutil.ObjToString(userInfo["s_name"])
 				appVersion = qutil.ObjToString(userInfo["s_appversion"])
-				if strings.Contains(phoneType, "iPhone") && strings.HasPrefix(appPushUrl, "/") {
+				/*if strings.Contains(phoneType, "iPhone") && strings.HasPrefix(appPushUrl, "/") {
 					appPushUrl = appPushUrl[1:]
+				}*/
+				if strings.Contains(phoneType, "iPhone") {
+					if strings.HasPrefix(appPushUrl, "/") && msgType != 10 {
+						appPushUrl = appPushUrl[1:]
+					}
 				}
 				dt := map[string]interface{}{
 					"receiveUserId": userId,

+ 11 - 14
rpc/internal/common/sendMsg.go

@@ -6,7 +6,6 @@ import (
 	"app.yhyue.com/moapp/MessageCenter/util"
 	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/redis"
-	"database/sql"
 	"fmt"
 	"github.com/zeromicro/go-zero/core/logx"
 	"log"
@@ -423,23 +422,21 @@ func MultSave(this message.MultipleSaveMsgReq) (int64, string) {
 			c := entity.Mysql.Count("conversation", map[string]interface{}{"receive_id": v, "send_id": this.SendUserId})
 			sql3 := `INSERT INTO message(appid,receive_userid,receive_name,send_userid,send_name,title,content,msg_type,link,cite_id,createtime,isRead,isdel,msg_log_id,show_buoy,show_content,group_id,position_id) values ("%s",'%s','%s','%s','%s','%s','%s',%d,'%s',0,'%s',0,1,%d,%d,'%s',%d,?);`
 			sql3 = fmt.Sprintf(sql3, this.Appid, v, userName, this.SendUserId, this.SendName, this.Title, this.Content, this.MsgType, this.Link, time.Now().Format("2006-01-02 15:04:05"), this.MsgLogId, this.ShowBuoy, this.ShowContent, group_id)
+
 			if c <= 0 {
 				sql1 := `INSERT INTO conversation(appid,secret_key,user_id,receive_id,receive_name,send_id,send_name,sort,createtime) values ('%s','','%s','%s','%s','%s','%s',0,'%s');`
 				sql1 = fmt.Sprintf(sql1, this.Appid, this.SendUserId, v, userName, this.SendUserId, this.SendName, time.Now().Format("2006-01-02 15:04:05"))
-				ok := entity.Mysql.ExecTx("发送消息事务", func(tx *sql.Tx) bool {
-					//插入会话表
-					in1 := entity.Mysql.InsertBySqlByTx(tx, sql1)
-					sql2 := `INSERT INTO conversation(appid,secret_key,user_id,receive_id,receive_name,send_id,send_name,sort,createtime) values ('%s','','%s','%s','%s','%s','%s',0,'%s');`
-					sql2 = fmt.Sprintf(sql2, this.Appid, v, this.SendUserId, this.SendName, v, userName, time.Now().Format("2006-01-02 15:04:05"))
-					in2 := entity.Mysql.InsertBySqlByTx(tx, sql2)
-					//插入消息表
-					in3 := entity.Mysql.InsertBySqlByTx(tx, sql3, common.If(positionId != 0, positionId, nil))
-					logx.Info(in1, in2, in3)
 
-					return in1 > -1 && in2 > -1 && in3 > -1
-				})
-				logx.Info("执行事务是否成功:", ok)
-				if ok {
+				//插入会话表
+				in1 := entity.Mysql.InsertBySql(sql1)
+				sql2 := `INSERT INTO conversation(appid,secret_key,user_id,receive_id,receive_name,send_id,send_name,sort,createtime) values ('%s','','%s','%s','%s','%s','%s',0,'%s');`
+				sql2 = fmt.Sprintf(sql2, this.Appid, v, this.SendUserId, this.SendName, v, userName, time.Now().Format("2006-01-02 15:04:05"))
+				in2 := entity.Mysql.InsertBySql(sql2)
+				//插入消息表
+				in3 := entity.Mysql.InsertBySql(sql3, common.If(positionId != 0, positionId, nil))
+				logx.Info(in1, in2, in3)
+
+				if in1 > -1 && in2 > -1 && in3 > -1 {
 					ok1 := MsgCountAdd(v, this.Appid, this.MsgType)
 					if !ok1 {
 						log.Println("存redis:", ok1, v)