feat(消息): 添加推送消息sdk

This commit is contained in:
luying
2023-03-21 20:50:27 +08:00
parent 45fd46700f
commit 65a94fc4cc
19 changed files with 409 additions and 17 deletions

View File

@@ -1,7 +1,8 @@
import { prop } from "@typegoose/typegoose";
import { SDK_37_CONST } from "../consts";
import { SDK_37_CONST, SDK_PUSH_TARGET_TYPE } from "../consts";
import { RoleType } from "../db/Role";
import { UserType } from "../db/User";
import { DicPushMessage } from "../pubUtils/dictionary/DicPushMessage";
import { nowSeconds } from "../pubUtils/timeUtil";
@@ -378,4 +379,44 @@ export class IOSRefundParam {
return { appid, uid, game_id, sid, actor_id, order_id, order_no, money, game_coin, product_id, time, ext }
}
}
export class PushMsg37Param {
notify_id: string; // 消息唯一标号,毫秒时间戳
game_id: number; // 游戏id
c_game_id: number; // 子游戏id
title: string; // 消息标题
text: string; // 消息正文
target: SDK_PUSH_TARGET_TYPE; // 推送目标类型
audience: string; // 用户uid最多200个
click_type: string; // 点击通知后续动作
url: string; // 网页地址
intent: string; // 打开特定页面
time: string; // 当前请求时间
sign: string; // 签名
source: number; // 推送来源表
type: string; // 推送内容
constructor(time: number) {
this.notify_id = time.toString();
this.game_id = SDK_37_CONST.PUSH_GAME_ID;
this.c_game_id = SDK_37_CONST.FX_C_GAME_ID;
this.time = Math.floor(time/1000).toString();
this.source = 0; // 0: 游戏内
}
public setMsgInfo(dic: DicPushMessage, target: SDK_PUSH_TARGET_TYPE, audience: string) {
this.title = dic.title;
this.text = dic.description;
this.target = target;
this.audience = audience;
this.click_type = dic.clickType;
if(dic.url != '&') this.url = dic.url;
if(dic.intent != '&') this.intent = dic.intent;
this.type = dic.pushMsgType;
}
public setSign(sign: string) {
this.sign = sign;
}
}