530 lines
15 KiB
Go
530 lines
15 KiB
Go
|
// Package asPush -----------------------------
|
|||
|
// @file : unipush2V0Push.go
|
|||
|
// @author : JJXu
|
|||
|
// @contact : wavingbear@163.com
|
|||
|
// @time : 2024/12/19 14:10
|
|||
|
// -------------------------------------------
|
|||
|
package asPush
|
|||
|
|
|||
|
import (
|
|||
|
"context"
|
|||
|
"fmt"
|
|||
|
"github.com/fonchain_enterprise/fonchain-main/api/artistInfoUser"
|
|||
|
"github.com/fonchain_enterprise/fonchain-main/api/unipush"
|
|||
|
"github.com/fonchain_enterprise/fonchain-main/pkg/service"
|
|||
|
)
|
|||
|
|
|||
|
const (
|
|||
|
ARTWORK_ON_EDIT = "ARTWORK_ON_EDIT" //画作信息待修改
|
|||
|
ARTWORK_ON_SUPPLY = "ARTWORK_ON_SUPPLY" //画作信息待补充
|
|||
|
ARTWORK_ON_MAIL = "ARTWORK_ON_MAIL" //画作待寄出
|
|||
|
ARTWORK_ON_RECEIVE = "ARTWORK_ON_RECEIVE" //画作待收货
|
|||
|
CONTRACT_ON_SIGN = "CONTRACT_ON_SIGN" //合同待签署
|
|||
|
ARTWORK_AUTH_ON_PAY = "ARTWORK_AUTH_ON_PAY" //鉴证费用待支付
|
|||
|
INVITATION_LETTER_ON_CONFIRM = "INVITATION_LETTER_ON_CONFIRM" //邀请函待确认
|
|||
|
NEW_CHAT_MESSAGE = "NEW_CHAT_MESSAGE" //客服聊天新消息
|
|||
|
|
|||
|
)
|
|||
|
|
|||
|
var _ IArtistInfoNotifyPush = new(ArtistInfoUniPush)
|
|||
|
|
|||
|
func init() {
|
|||
|
service.SetInvitationLetterAppNoticeFunc(new(ArtistInfoUniPush).InvitationLetterWaitToBeConfirmedNotice)
|
|||
|
}
|
|||
|
|
|||
|
// ArtistInfoUniPush 画家宝3.0使用unipush2.0进行app推送
|
|||
|
type ArtistInfoUniPush struct {
|
|||
|
}
|
|||
|
|
|||
|
func NewArtistinfoUniPush() *ArtistInfoUniPush {
|
|||
|
return &ArtistInfoUniPush{}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
// 实名信息申请成功 没用到
|
|||
|
func (p ArtistInfoUniPush) RealNameApplySuccess(userId int64) error {
|
|||
|
params := NewUnipush2V0ParamsBuilder()
|
|||
|
cids := p.GetClientId(userId)
|
|||
|
if len(cids) == 0 {
|
|||
|
return nil
|
|||
|
}
|
|||
|
params.Title("实名信息提交成功")
|
|||
|
params.Content("请耐心等待审批结果")
|
|||
|
//params.ViewPathOfPayload("artistInfo/realName")
|
|||
|
params.OptionsOfParams(
|
|||
|
NewUnipushHuaWeiOptions(),
|
|||
|
NewUnipushVivoOptions(),
|
|||
|
NewUnipushXiaoMiOptions("131021"), //todo
|
|||
|
NewUnipushRongYaoOptions(),
|
|||
|
NewUnipushOppoOptions(),
|
|||
|
)
|
|||
|
for _, cid := range cids {
|
|||
|
params.ClientId(cid)
|
|||
|
errs := p.PushData(params)
|
|||
|
if errs != nil {
|
|||
|
return errs
|
|||
|
}
|
|||
|
}
|
|||
|
return nil
|
|||
|
}
|
|||
|
|
|||
|
// 实名信息审批结果通知 没用到
|
|||
|
func (p ArtistInfoUniPush) RealNameAuditResultNotice(userId int64, auditResult string) error {
|
|||
|
params := NewUnipush2V0ParamsBuilder()
|
|||
|
cids := p.GetClientId(userId)
|
|||
|
if len(cids) == 0 {
|
|||
|
return nil
|
|||
|
}
|
|||
|
params.Title("实名信息审批结果通知")
|
|||
|
params.Content("您的实名信息审批[" + auditResult + "],请进入画家宝查看详情。")
|
|||
|
//params.ViewPathOfPayload("artistInfo/realName")
|
|||
|
params.OptionsOfParams(
|
|||
|
NewUnipushHuaWeiOptions(),
|
|||
|
NewUnipushVivoOptions(),
|
|||
|
NewUnipushXiaoMiOptions("131021"), //todo
|
|||
|
NewUnipushRongYaoOptions(),
|
|||
|
NewUnipushOppoOptions(),
|
|||
|
)
|
|||
|
for _, cid := range cids {
|
|||
|
params.ClientId(cid)
|
|||
|
errs := p.PushData(params)
|
|||
|
if errs != nil {
|
|||
|
return errs
|
|||
|
}
|
|||
|
}
|
|||
|
return nil
|
|||
|
}
|
|||
|
|
|||
|
// 画作基本信息/补充信息审批通知
|
|||
|
func (p ArtistInfoUniPush) ArtworkAuditResultNotice(userId int64, artworkName, auditType string, auditResult string, hasMany ...bool) error {
|
|||
|
fmt.Println("auditType:", auditType)
|
|||
|
fmt.Println("auditResult:", auditResult)
|
|||
|
if auditResult == "不通过" {
|
|||
|
cids := p.GetClientId(userId)
|
|||
|
if len(cids) == 0 {
|
|||
|
return nil
|
|||
|
}
|
|||
|
params := NewUnipush2V0ParamsBuilder()
|
|||
|
params.ClientId(cids...)
|
|||
|
params.Title("画作信息待修改")
|
|||
|
params.Content("您有一幅画作审核不通过,需要您进行相关信息修改,点击查看")
|
|||
|
params.ViewPathOfPayload(ARTWORK_ON_EDIT)
|
|||
|
params.OptionsOfParams(
|
|||
|
NewUnipushHuaWeiOptions(),
|
|||
|
NewUnipushVivoOptions(),
|
|||
|
NewUnipushXiaoMiOptions("131021"),
|
|||
|
NewUnipushRongYaoOptions(),
|
|||
|
NewUnipushOppoOptions(),
|
|||
|
)
|
|||
|
for _, cid := range cids {
|
|||
|
params.ClientId(cid)
|
|||
|
errs := p.PushData(params)
|
|||
|
if errs != nil {
|
|||
|
return errs
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
return nil
|
|||
|
}
|
|||
|
|
|||
|
// 画作补充信息发起通知
|
|||
|
func (p ArtistInfoUniPush) ArtworkSupplementNotice(userId int64) error {
|
|||
|
params := NewUnipush2V0ParamsBuilder()
|
|||
|
cids := p.GetClientId(userId)
|
|||
|
if len(cids) == 0 {
|
|||
|
return nil
|
|||
|
}
|
|||
|
params.Title("画作信息补充")
|
|||
|
params.Content("您有一幅画作审核通过,需要您进行相关信息补充,点击查看详情")
|
|||
|
params.ViewPathOfPayload(ARTWORK_ON_SUPPLY)
|
|||
|
params.OptionsOfParams(
|
|||
|
NewUnipushHuaWeiOptions(),
|
|||
|
NewUnipushVivoOptions(),
|
|||
|
NewUnipushXiaoMiOptions("131021"),
|
|||
|
NewUnipushRongYaoOptions(),
|
|||
|
NewUnipushOppoOptions(),
|
|||
|
)
|
|||
|
fmt.Println("ArtworkSupplementNotice 1111")
|
|||
|
for _, cid := range cids {
|
|||
|
params.ClientId(cid)
|
|||
|
errs := p.PushData(params)
|
|||
|
if errs != nil {
|
|||
|
return errs
|
|||
|
}
|
|||
|
}
|
|||
|
return nil
|
|||
|
}
|
|||
|
|
|||
|
// 画展补充信息发起通知
|
|||
|
func (p ArtistInfoUniPush) ArtistArtshowSupplementBeginNotice(userId int64) error {
|
|||
|
//params := NewUnipush2V0ParamsBuilder()
|
|||
|
//params.ClientId(p.GetClientId(userId)...)
|
|||
|
//params.Title("画作信息补充")
|
|||
|
//params.Content("您有一幅画作审核通过,需要您进行相关信息补充,点击查看详情")
|
|||
|
//params.ViewPathOfPayload("131021") //todo
|
|||
|
//params.OptionsOfParams(
|
|||
|
// NewUnipushHuaWeiOptions(),
|
|||
|
// NewUnipushVivoOptions(),
|
|||
|
// NewUnipushXiaoMiOptions("131021"),
|
|||
|
// NewUnipushRongYaoOptions(),
|
|||
|
// NewUnipushOppoOptions(),
|
|||
|
//)
|
|||
|
//return p.PushData(params)
|
|||
|
return nil
|
|||
|
}
|
|||
|
|
|||
|
// 画展审批通知 画家宝3.0已弃用
|
|||
|
func (p ArtistInfoUniPush) ArtistArtshowSupplementAuditNotice(userId int64, auditType AuditType) error {
|
|||
|
return nil
|
|||
|
}
|
|||
|
|
|||
|
// 画作数字化通知
|
|||
|
// digitState: 1=已分配、2=已完成
|
|||
|
func (p ArtistInfoUniPush) ArtworkSystemDigitNotice(userId int64, artworkName string, digitState int) error {
|
|||
|
params := NewUnipush2V0ParamsBuilder()
|
|||
|
cids := p.GetClientId(userId)
|
|||
|
if len(cids) == 0 {
|
|||
|
return nil
|
|||
|
}
|
|||
|
params.Title("画作信息补充")
|
|||
|
if digitState == 1 {
|
|||
|
params.Content(fmt.Sprintf("您的画作[%s]已进入数字化流程", artworkName))
|
|||
|
} else {
|
|||
|
params.Content(fmt.Sprintf("您的画作[%s]已完成数字化", artworkName))
|
|||
|
}
|
|||
|
params.ViewPathOfPayload("131021") //todo
|
|||
|
params.OptionsOfParams(
|
|||
|
NewUnipushHuaWeiOptions(),
|
|||
|
NewUnipushVivoOptions(),
|
|||
|
NewUnipushXiaoMiOptions("131021"),
|
|||
|
NewUnipushRongYaoOptions(),
|
|||
|
NewUnipushOppoOptions(),
|
|||
|
)
|
|||
|
for _, cid := range cids {
|
|||
|
params.ClientId(cid)
|
|||
|
errs := p.PushData(params)
|
|||
|
if errs != nil {
|
|||
|
return errs
|
|||
|
}
|
|||
|
}
|
|||
|
return nil
|
|||
|
}
|
|||
|
|
|||
|
// 鉴证流程相关通知
|
|||
|
func (p ArtistInfoUniPush) ArtworkSystemAuthNotice(userId int64, artworkName string, authState int) error {
|
|||
|
var alert string
|
|||
|
if authState == 1 {
|
|||
|
alert = fmt.Sprintf("您的画作[%s]已进入鉴证流程", artworkName)
|
|||
|
} else {
|
|||
|
alert = fmt.Sprintf("您的画作[%s]已完成鉴证", artworkName)
|
|||
|
}
|
|||
|
|
|||
|
params := NewUnipush2V0ParamsBuilder()
|
|||
|
cids := p.GetClientId(userId)
|
|||
|
if len(cids) == 0 {
|
|||
|
return nil
|
|||
|
}
|
|||
|
params.Title("鉴证通知")
|
|||
|
params.Content(alert)
|
|||
|
params.ViewPathOfPayload("131021") //todo
|
|||
|
params.OptionsOfParams(
|
|||
|
NewUnipushHuaWeiOptions(),
|
|||
|
NewUnipushVivoOptions(),
|
|||
|
NewUnipushXiaoMiOptions("131021"),
|
|||
|
NewUnipushRongYaoOptions(),
|
|||
|
NewUnipushOppoOptions(),
|
|||
|
)
|
|||
|
for _, cid := range cids {
|
|||
|
params.ClientId(cid)
|
|||
|
errs := p.PushData(params)
|
|||
|
if errs != nil {
|
|||
|
return errs
|
|||
|
}
|
|||
|
}
|
|||
|
return nil
|
|||
|
}
|
|||
|
|
|||
|
// 画作待寄出通知
|
|||
|
func (p ArtistInfoUniPush) ArtworkWaitToBeMailedNotice(userId int64) error {
|
|||
|
params := NewUnipush2V0ParamsBuilder()
|
|||
|
cids := p.GetClientId(userId)
|
|||
|
if len(cids) == 0 {
|
|||
|
return nil
|
|||
|
}
|
|||
|
params.ClientId(cids...)
|
|||
|
params.Title("画作待寄出")
|
|||
|
params.Content("您有一批画作被通知寄出,请尽快进行相关的线下及线上操作,点击查看详情")
|
|||
|
params.ViewPathOfPayload(ARTWORK_ON_MAIL)
|
|||
|
params.OptionsOfParams(
|
|||
|
NewUnipushHuaWeiOptions(),
|
|||
|
NewUnipushVivoOptions(),
|
|||
|
NewUnipushXiaoMiOptions("131021"),
|
|||
|
NewUnipushRongYaoOptions(),
|
|||
|
NewUnipushOppoOptions(),
|
|||
|
)
|
|||
|
for _, cid := range cids {
|
|||
|
params.ClientId(cid)
|
|||
|
errs := p.PushData(params)
|
|||
|
if errs != nil {
|
|||
|
return errs
|
|||
|
}
|
|||
|
}
|
|||
|
return nil
|
|||
|
}
|
|||
|
|
|||
|
// 画作待收货
|
|||
|
func (p ArtistInfoUniPush) ArtworkWaitToBeReceivedNotice(userId int64) error {
|
|||
|
params := NewUnipush2V0ParamsBuilder()
|
|||
|
cids := p.GetClientId(userId)
|
|||
|
if len(cids) == 0 {
|
|||
|
return nil
|
|||
|
}
|
|||
|
params.Title("画作待收货")
|
|||
|
params.Content("您有一批画作被确认退回,请关注相关物流状态并及时确认收货,点击查看详情")
|
|||
|
params.ViewPathOfPayload(ARTWORK_ON_RECEIVE)
|
|||
|
params.OptionsOfParams(
|
|||
|
NewUnipushHuaWeiOptions(),
|
|||
|
NewUnipushVivoOptions(),
|
|||
|
NewUnipushXiaoMiOptions("131021"),
|
|||
|
NewUnipushRongYaoOptions(),
|
|||
|
NewUnipushOppoOptions(),
|
|||
|
)
|
|||
|
for _, cid := range cids {
|
|||
|
params.ClientId(cid)
|
|||
|
errs := p.PushData(params)
|
|||
|
if errs != nil {
|
|||
|
return errs
|
|||
|
}
|
|||
|
}
|
|||
|
return nil
|
|||
|
}
|
|||
|
|
|||
|
// 合同待签署
|
|||
|
func (p ArtistInfoUniPush) ContractOnWaitToBeSignedNotice(userId int64) error {
|
|||
|
params := NewUnipush2V0ParamsBuilder()
|
|||
|
cids := p.GetClientId(userId)
|
|||
|
if len(cids) == 0 {
|
|||
|
return nil
|
|||
|
}
|
|||
|
params.Title("合同待签署")
|
|||
|
params.Content("您有一批合同已被发起,请尽快进行线上签署,点击查看详情")
|
|||
|
params.ViewPathOfPayload(CONTRACT_ON_SIGN)
|
|||
|
params.OptionsOfParams(
|
|||
|
NewUnipushHuaWeiOptions(),
|
|||
|
NewUnipushVivoOptions(),
|
|||
|
NewUnipushXiaoMiOptions("131023"),
|
|||
|
NewUnipushRongYaoOptions(),
|
|||
|
NewUnipushOppoOptions(),
|
|||
|
)
|
|||
|
for _, cid := range cids {
|
|||
|
params.ClientId(cid)
|
|||
|
errs := p.PushData(params)
|
|||
|
if errs != nil {
|
|||
|
return errs
|
|||
|
}
|
|||
|
}
|
|||
|
return p.PushData(params)
|
|||
|
}
|
|||
|
|
|||
|
// 鉴证待支付
|
|||
|
func (p ArtistInfoUniPush) AuthpaymentWaitToBePaidNotice(userId int64) error {
|
|||
|
params := NewUnipush2V0ParamsBuilder()
|
|||
|
cids := p.GetClientId(userId)
|
|||
|
if len(cids) == 0 {
|
|||
|
return nil
|
|||
|
}
|
|||
|
params.Title("费用待支付")
|
|||
|
params.Content("您有一笔待支付费用,请尽快进行线上缴纳,点击查看详情")
|
|||
|
params.ViewPathOfPayload(ARTWORK_AUTH_ON_PAY)
|
|||
|
params.OptionsOfParams(
|
|||
|
NewUnipushHuaWeiOptions(),
|
|||
|
NewUnipushVivoOptions(),
|
|||
|
NewUnipushXiaoMiOptions("131024"),
|
|||
|
NewUnipushRongYaoOptions(),
|
|||
|
NewUnipushOppoOptions(),
|
|||
|
)
|
|||
|
for _, cid := range cids {
|
|||
|
params.ClientId(cid)
|
|||
|
errs := p.PushData(params)
|
|||
|
if errs != nil {
|
|||
|
return errs
|
|||
|
}
|
|||
|
}
|
|||
|
return nil
|
|||
|
}
|
|||
|
|
|||
|
// 邀请函待确认
|
|||
|
func (p ArtistInfoUniPush) InvitationLetterWaitToBeConfirmedNotice(userId int64) error {
|
|||
|
params := NewUnipush2V0ParamsBuilder()
|
|||
|
params.Title("邀请函待确认")
|
|||
|
params.Content("您有一份邀请函已接收,请尽快进行线上确认,点击查看详情")
|
|||
|
params.ViewPathOfPayload(INVITATION_LETTER_ON_CONFIRM)
|
|||
|
params.OptionsOfParams(
|
|||
|
NewUnipushHuaWeiOptions(),
|
|||
|
NewUnipushVivoOptions(),
|
|||
|
NewUnipushXiaoMiOptions("131025"),
|
|||
|
NewUnipushRongYaoOptions(),
|
|||
|
NewUnipushOppoOptions(),
|
|||
|
)
|
|||
|
cids := p.GetClientId(userId)
|
|||
|
if len(cids) == 0 {
|
|||
|
return nil
|
|||
|
}
|
|||
|
for _, cid := range cids {
|
|||
|
params.ClientId(cid)
|
|||
|
errs := p.PushData(params)
|
|||
|
if errs != nil {
|
|||
|
return errs
|
|||
|
}
|
|||
|
fmt.Println("发送app推送 cid", cid, "data", string(params.JsonData()))
|
|||
|
}
|
|||
|
return nil
|
|||
|
}
|
|||
|
|
|||
|
// 客服聊天消息提醒
|
|||
|
func (p ArtistInfoUniPush) NewChatMessageNotice(userId int64, txtMessage string) error {
|
|||
|
params := NewUnipush2V0ParamsBuilder()
|
|||
|
params.Title("画家宝客服")
|
|||
|
runMsg := []rune(txtMessage)
|
|||
|
if len(runMsg) > 15 {
|
|||
|
txtMessage = string(runMsg[:15])
|
|||
|
}
|
|||
|
params.Content(txtMessage)
|
|||
|
params.ViewPathOfPayload(NEW_CHAT_MESSAGE)
|
|||
|
params.forceNotification(false)
|
|||
|
params.OptionsOfParams(
|
|||
|
NewUnipushHuaWeiOptions(),
|
|||
|
NewUnipushVivoOptions(),
|
|||
|
NewUnipushXiaoMiOptions("131025"), //todo代办
|
|||
|
NewUnipushRongYaoOptions(),
|
|||
|
NewUnipushOppoOptions(),
|
|||
|
)
|
|||
|
cids := p.GetClientId(userId)
|
|||
|
if len(cids) == 0 {
|
|||
|
return nil
|
|||
|
}
|
|||
|
for _, cid := range cids {
|
|||
|
params.ClientId(cid)
|
|||
|
errs := p.PushData(params)
|
|||
|
if errs != nil {
|
|||
|
return errs
|
|||
|
}
|
|||
|
fmt.Println("发送app推送 cid", cid, "data", string(params.JsonData()))
|
|||
|
}
|
|||
|
return nil
|
|||
|
}
|
|||
|
func (p ArtistInfoUniPush) GetAccId(userId ...int64) (accIdList []int64) {
|
|||
|
if len(userId) == 0 {
|
|||
|
return
|
|||
|
}
|
|||
|
ctx := context.Background()
|
|||
|
userRes, err := service.GrpcArtistInfoUserImpl.GetUserList(ctx,
|
|||
|
&artistInfoUser.GetUserListRequest{UserIdIn: userId, PageSize: -1, Page: 1},
|
|||
|
)
|
|||
|
if err != nil {
|
|||
|
return
|
|||
|
}
|
|||
|
if userRes == nil || userRes.Total == 0 {
|
|||
|
return
|
|||
|
}
|
|||
|
for _, user := range userRes.List {
|
|||
|
accIdList = append(accIdList, user.MgmtAccId)
|
|||
|
}
|
|||
|
return
|
|||
|
}
|
|||
|
func (p ArtistInfoUniPush) GetClientId(userId ...int64) (cidList []string) {
|
|||
|
if len(userId) == 0 {
|
|||
|
return
|
|||
|
}
|
|||
|
ctx := context.Background()
|
|||
|
userRes, err := service.GrpcArtistInfoUserImpl.GetUserList(ctx,
|
|||
|
&artistInfoUser.GetUserListRequest{UserIdIn: userId, PageSize: -1, Page: 1},
|
|||
|
)
|
|||
|
if err != nil {
|
|||
|
return
|
|||
|
}
|
|||
|
if userRes == nil || userRes.Total == 0 {
|
|||
|
return
|
|||
|
}
|
|||
|
accIdList := []int64{}
|
|||
|
for _, user := range userRes.List {
|
|||
|
accIdList = append(accIdList, user.MgmtAccId)
|
|||
|
}
|
|||
|
fmt.Println("accIdList :", accIdList)
|
|||
|
cidRes, err := service.GrpcUnipushImpl.GetCidOfMultiUsers(context.Background(), &unipush.GetCidOfMultiUsersRequest{UserId: accIdList, Domain: domain})
|
|||
|
if err != nil {
|
|||
|
fmt.Println("查询cid失败", err)
|
|||
|
return
|
|||
|
}
|
|||
|
fmt.Println("cidList:", cidRes.Data)
|
|||
|
for _, v := range cidRes.Data {
|
|||
|
if len(v.Cid) > 0 {
|
|||
|
cidList = append(cidList, v.Cid...)
|
|||
|
}
|
|||
|
}
|
|||
|
return
|
|||
|
}
|
|||
|
|
|||
|
// 通用的消息推送
|
|||
|
//func (p ArtistInfoUniPush) CommonPush(params *unipush.AppNotifyParams) error {
|
|||
|
// fmt.Println("使用unipush进行app推送")
|
|||
|
// ctx := context.Background()
|
|||
|
// //userRes, err := service.GrpcArtistInfoUserImpl.GetUserList(ctx,
|
|||
|
// // &artistInfoUser.GetUserListRequest{Query: &artistInfoUser.UserData{ID: userId}},
|
|||
|
// //)
|
|||
|
// //if err != nil {
|
|||
|
// // return errors.New("发送通知失败:" + err.Error())
|
|||
|
// //}
|
|||
|
// //if userRes == nil || userRes.Total == 0 {
|
|||
|
// // return errors.New("未找到用户信息")
|
|||
|
// //}
|
|||
|
// //notifyParams := p.BuildParams()
|
|||
|
// //notifyParams.Title = title
|
|||
|
// //notifyParams.Content = alert
|
|||
|
// //notifyParams.UserId = []int64{userRes.List[0].MgmtAccId}
|
|||
|
// resp, err := service.GrpcUnipushImpl.InvokeCloudFunc(ctx, &unipush.InvokeCloudFuncRequest{
|
|||
|
// Domain: "artistinfo",
|
|||
|
// Func: unipush.FuncType_notify,
|
|||
|
// AppNotifyParams: params,
|
|||
|
// })
|
|||
|
// if err != nil {
|
|||
|
// return err
|
|||
|
// }
|
|||
|
// fmt.Println(resp)
|
|||
|
// return err
|
|||
|
//}
|
|||
|
|
|||
|
// 通用的消息推送
|
|||
|
func (p ArtistInfoUniPush) PushData(params *Unipush2V0ParamsBuilder) error {
|
|||
|
fmt.Println("使用unipush进行app推送 1")
|
|||
|
ctx := context.Background()
|
|||
|
resp, err := service.GrpcUnipushImpl.InvokeCloudFunc(ctx, &unipush.InvokeCloudFuncRequest{
|
|||
|
Domain: domain,
|
|||
|
Func: unipush.FuncType_notify,
|
|||
|
JsonData: params.JsonData(),
|
|||
|
})
|
|||
|
fmt.Println("使用unipush进行app推送 2")
|
|||
|
if err != nil {
|
|||
|
return err
|
|||
|
}
|
|||
|
fmt.Println("使用unipush进行app推送 3")
|
|||
|
fmt.Println("resp", resp)
|
|||
|
return err
|
|||
|
}
|
|||
|
|
|||
|
// 通用的消息推送
|
|||
|
func (p ArtistInfoUniPush) InitUnipush2V0CloudFunc(params *Unipush2V0ParamsBuilder) error {
|
|||
|
fmt.Println("使用unipush进行app推送")
|
|||
|
ctx := context.Background()
|
|||
|
resp, err := service.GrpcUnipushImpl.InvokeCloudFunc(ctx, &unipush.InvokeCloudFuncRequest{
|
|||
|
Domain: domain,
|
|||
|
Func: unipush.FuncType_notify,
|
|||
|
JsonData: params.JsonData(),
|
|||
|
})
|
|||
|
if err != nil {
|
|||
|
return err
|
|||
|
}
|
|||
|
fmt.Println(resp)
|
|||
|
return err
|
|||
|
}
|