|
- 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"
- "gim/internal/business/comm/db"
- md3 "gim/internal/logic/domain/message/md"
-
- "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.Memo, -1)
- Content = strings.Replace(Content, "[时间]", args.Times, -1)
- return Content
- }
-
- // CommAddPush 公共处理推送数据
- func CommAddPush(args md3.PushParams) {
- pushPlatform := db.DbSysCfg.SysCfgFindWithDb(args.MasterId, "app_push_platform")["app_push_platform"]
- if pushPlatform == "jg" { //极光
- args.Content = getChangeContent(args, args.Content)
- JgPush(args)
- return
- }
- return
- }
-
- func JgPush(args md3.PushParams) {
- thirdJgPush := db.DbSysCfg.SysCfgFindWithDb(args.MasterId, "jg_push_app_key", "jg_push_app_secret")
- if thirdJgPush["jg_push_app_key"] == "" || thirdJgPush["jg_push_app_secret"] == "" {
- return
- }
- //alia := db.DbUserPushForJg.UserPushForJgGetWithDb(args.MasterId, args.Uid)
- var aud = md2.PushAudience{Alias: []string{args.PushAlia}}
- var extras interface{}
- var param = md2.PushParam{
- Platform: "all",
- Audience: aud,
- Title: args.Title,
- Content: args.Content,
- Extras: extras,
- }
- send, _, err := jg_push.Send(thirdJgPush["jg_push_app_key"], thirdJgPush["jg_push_app_secret"], param)
- if err != nil {
- return
- }
- if send == "" {
- return
- }
- //TODO::发送成功处理
- return
- }
|