浏览代码

feat:发消息

wangchuanjin 1 年之前
父节点
当前提交
7dda83b1d2
共有 5 个文件被更改,包括 21 次插入16 次删除
  1. 6 8
      config/config.go
  2. 2 4
      etc/push.json
  3. 1 0
      go.mod
  4. 3 0
      go.sum
  5. 9 4
      rpc/message.go

+ 6 - 8
config/config.go

@@ -40,14 +40,12 @@ type config struct {
 }
 
 type msgConf struct {
-	Title      string
-	Content    string
-	MsgType    int64
-	Link       string
-	Appid      string
-	AppPushUrl string
-	WxPushUrl  string
-	IosPushUrl string
+	Title     string
+	Content   string
+	MsgType   int64
+	Appid     string
+	PcUrl     string
+	MobileUrl string
 }
 
 var (

+ 2 - 4
etc/push.json

@@ -39,11 +39,9 @@
 		"title":"做任务赚好礼",
 		"content":"7天内完成新手任务,额外赠送超级订阅7天体验。获取更多采购项目信息,快速对接项目联系人!",
 		"msgType":1,
-		"link":"/home/work-bench/app/points/earn,/jy_mobile/points/earn,/jy_mobile/points/earn",
 		"appid":"10000",
-		"appPushUrl":"/jy_mobile/points/earn",
-		"wxPushUrl":"/jy_mobile/points/earn",
-		"iosPushUrl":"/jy_mobile/points/earn"
+		"pcUrl":"/home/work-bench/app/points/earn",
+		"mobileUrl":"/jy_mobile/points/earn"
 	}
   }
 }

+ 1 - 0
go.mod

@@ -7,6 +7,7 @@ require (
 	app.yhyue.com/moapp/jyPoints v1.1.2-0.20231020023521-1a4b1bbf9736
 	app.yhyue.com/moapp/jy_docs v1.1.1-0.20231024064228-a0ce3483eaf1
 	app.yhyue.com/moapp/jybase v0.0.0-20230901064756-2fc66b18db40
+	bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20230911091604-2faa31032743
 	github.com/gogf/gf/v2 v2.0.6
 	github.com/nsqio/go-nsq v1.1.0
 	github.com/zeromicro/go-zero v1.5.6

+ 3 - 0
go.sum

@@ -10,12 +10,15 @@ app.yhyue.com/moapp/jybase v0.0.0-20220415064050-37ce64b3e2d4/go.mod h1:qNRA0sHu
 app.yhyue.com/moapp/jybase v0.0.0-20220418104200-46c3fff161c7/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
 app.yhyue.com/moapp/jybase v0.0.0-20220420032112-668025915ee4/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
 app.yhyue.com/moapp/jybase v0.0.0-20220421060131-a1001013ba46/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
+app.yhyue.com/moapp/jybase v0.0.0-20230419121327-bedf77840ba6/go.mod h1:zB47XTeJvpcbtBRYgkQuxOICWNexiZfbUO+7aUf6mNs=
 app.yhyue.com/moapp/jybase v0.0.0-20230901064756-2fc66b18db40 h1:/FcBvpf/KW8g6GBfTkypVW1pGbNs+iNhDrUGUi+KNjc=
 app.yhyue.com/moapp/jybase v0.0.0-20230901064756-2fc66b18db40/go.mod h1:Hv9U/7oHRucqH315Tr1+d03NCvS9mOKPfk8pwwlOIwQ=
 app.yhyue.com/moapp/jyfs v0.0.0-20231024061508-480c270480d4/go.mod h1:61hzZ3dZHXL28BNl8BOgZsvM2S5UVY5YFzOkEUPrSu4=
 bp.jydev.jianyu360.cn/BP/jynsq v0.0.0-20220222052708-ebc43af90698/go.mod h1:ojo/AUH9Yr1wzarEjOaNMkj1Cet/9r8IgLyba64Z52E=
 bp.jydev.jianyu360.cn/BaseService/gateway v0.0.0-20220419090715-88ddb32961be/go.mod h1:Yj4oabIGItuMoF0BXYLz2XAnF581kxgXBrvlUtIJrkI=
 bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4/go.mod h1:BMLd/5wb3BIEGhnEgF9y1sJN9P5/Dw9kYsoiE9V8I9g=
+bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20230911091604-2faa31032743 h1:7IaukyEAbMvgEv3/TiHlw7lzWPoksE4tVa1ap16RC9Q=
+bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20230911091604-2faa31032743/go.mod h1:1SQIPPL5Ya5BzQdByFKtTkXrXTWBv+PDqWIhNknLnZw=
 bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.0-20220418005748-8ba5d936dd53/go.mod h1:E5lcDI3k4FESLxiAetCfWQTq8qfpy9cv0yN1oKoEO34=
 bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.0-20220419023723-0b32d4a41751/go.mod h1:6KL5LMEku83uRbre0W/bj5kXG2I6pJGBFtktmtp51yM=
 bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.0-20220420075831-0b59892e9982/go.mod h1:wsHNO91h37H+xE4ZNny0yd7mtpODeDJxbVYhIRMR+qw=

+ 9 - 4
rpc/message.go

@@ -3,11 +3,14 @@ package rpc
 import (
 	"fmt"
 	"log"
+	"strconv"
+	"time"
 
 	"app.yhyue.com/moapp/MessageCenter/rpc/messageclient"
 	"app.yhyue.com/moapp/MessageCenter/rpc/type/message"
 	"app.yhyue.com/moapp/jybase/go-logger/logger"
 	. "app.yhyue.com/moapp/message/config"
+	. "bp.jydev.jianyu360.cn/BaseService/pushpkg/p"
 	"github.com/gogf/gf/v2/os/gcfg"
 	"github.com/gogf/gf/v2/os/gctx"
 	"github.com/zeromicro/go-zero/core/discov"
@@ -31,16 +34,18 @@ func init() {
 
 //新用户注册,发送增送剑鱼币消息
 func SendNewUserMsg(userId string) error {
+	wxUrl := "/front/sess/" + Se.EncodeString(userId+",_id,identityKeep,") + "__" + Se.EncodeString(PushConfig.Messages.NewUser.MobileUrl)
+	appUrl := "/jyapp/free/sess/" + Se.EncodeString(userId+",_id,"+strconv.Itoa(int(time.Now().Unix()))+",") + "__" + Se.EncodeString(PushConfig.Messages.NewUser.MobileUrl)
 	req := &message.MultipleSaveMsgReq{
 		UserIds:    userId,
 		Title:      PushConfig.Messages.NewUser.Title,
 		Content:    PushConfig.Messages.NewUser.Content,
 		MsgType:    PushConfig.Messages.NewUser.MsgType,
-		Link:       PushConfig.Messages.NewUser.Link,
+		Link:       PushConfig.Messages.NewUser.PcUrl + "," + PushConfig.Messages.NewUser.MobileUrl + "," + PushConfig.Messages.NewUser.MobileUrl,
 		Appid:      PushConfig.Messages.NewUser.Appid,
-		AppPushUrl: PushConfig.Messages.NewUser.AppPushUrl,
-		WxPushUrl:  PushConfig.Messages.NewUser.WxPushUrl,
-		IosPushUrl: PushConfig.Messages.NewUser.IosPushUrl,
+		AppPushUrl: appUrl,
+		WxPushUrl:  PushConfig.Webdomain + wxUrl,
+		IosPushUrl: appUrl,
 	}
 	resp, err := messageclient.NewMessage(messageClient).MultipleSaveMsg(gctx.New(), req)
 	if err != nil {