package service import ( jg_push "code.fnuoos.com/go_rely_warehouse/zyos_go_jg_push.git/hdl" md2 "code.fnuoos.com/go_rely_warehouse/zyos_go_jg_push.git/md" "fmt" svc "gim/internal/business/comm/service" md3 "gim/internal/logic/domain/message/md" "gim/pkg/logger" "go.uber.org/zap" "strings" ) func getChangeContent(args md3.PushParams, Content string) string { Content = strings.Replace(Content, "[MasterId]", args.MasterId, -1) Content = strings.Replace(Content, "[消息发送者-会员昵称]", args.SendUserNickname, -1) Content = strings.Replace(Content, "[消息发送者-会员头像]", args.SendUserAvatarUrl, -1) Content = strings.Replace(Content, "[消息类型]", args.MessageType, -1) Content = strings.Replace(Content, "[备注]", args.Memo, -1) Content = strings.Replace(Content, "[时间]", args.Times, -1) return Content } // CommAddPush 公共处理推送数据 func CommAddPush(args md3.PushParams) { logger.Logger.Debug("CommAddPush", zap.String("master_id", args.MasterId), zap.String("uid", args.Uid), zap.String("push_alia", args.PushAlia), zap.String("title", args.Title), zap.String("content", args.Content), zap.String("push_type", args.PushType), zap.String("message_type", args.MessageType), zap.String("send_user_nickname", args.SendUserNickname), zap.String("send_user_avatar_url", args.SendUserAvatarUrl), zap.String("reason", args.Memo), zap.String("times", args.Times), ) pushPlatform := svc.SysCfgGet(args.MasterId, "app_push_platform") if pushPlatform == "JgPush" { //极光 args.Content = getChangeContent(args, args.Content) JgPush(args) return } return } func JgPush(args md3.PushParams) { jgPushAppKey := svc.SysCfgGet(args.MasterId, "jg_push_app_key") jgPushAppSecret := svc.SysCfgGet(args.MasterId, "jg_push_app_secret") fmt.Println(">>>>>>>>>>>>>>>>>>>>jg_push_app_key<<<<<<<<<<<<<<<<<<<<<<", jgPushAppKey) fmt.Println(">>>>>>>>>>>>>>>>>>>>jg_push_app_secret<<<<<<<<<<<<<<<<<<<<<<", jgPushAppSecret) if jgPushAppKey == "" || jgPushAppSecret == "" { return } //alia := db.DbUserPushForJg.UserPushForJgGetWithDb(args.MasterId, args.Uid) var aud = md2.PushAudience{Alias: []string{args.PushAlia}} var extras = map[string]interface{}{ "master_id": args.MasterId, "uid": args.Uid, "push_type": args.PushType, "message_type": args.MessageType, "send_user_nickname": args.SendUserNickname, "send_user_avatar_url": args.SendUserAvatarUrl, "memo": args.Memo, "times": args.Times, } var intent = map[string]interface{}{ "url": "#Intent;action=android.intent.action.MAIN;end", } var param = md2.PushParam{ Platform: "all", Audience: aud, Title: args.Title, Content: args.Content, Extras: extras, Intent: intent, } send, res, err := jg_push.Send(jgPushAppKey, jgPushAppSecret, param) logger.Logger.Debug("JgPush_log", zap.String("send", send), zap.String("res", res), zap.String("push_alia", args.PushAlia), zap.String("title", param.Title), zap.String("content", param.Content), zap.String("jg_push_app_key", jgPushAppKey), zap.String("jg_push_app_secret", jgPushAppSecret), ) if err != nil { fmt.Println("send_error::::", err) return } if send == "" { return } //TODO::发送成功处理 return }