Revert "Revert "✨ feat(消息): 添加推送消息sdk""
This reverts commit 918cc3415f.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { DEBUG_PRICE, REDIS_KEY, SDK_37_ADDR, SDK_37_CONST, WJX_KEY } from '../consts';
|
||||
import { request37 } from './httpUtil';
|
||||
import { nowSeconds } from './timeUtil';
|
||||
import { LoginValidataReturn37, Chat37Params, GetServerListParam } from '../domain/sdk';
|
||||
import { LoginValidataReturn37, Chat37Params, GetServerListParam, PushMsg37Param } from '../domain/sdk';
|
||||
import * as crypto from 'crypto'
|
||||
import { gameData } from './data';
|
||||
|
||||
@@ -57,6 +57,18 @@ export function get37CheckChatMd5Sign(body: Chat37Params, key: string) {
|
||||
return sign;
|
||||
}
|
||||
|
||||
export function get37PushMsgMd5Sign(body: PushMsg37Param, key: string) {
|
||||
let { notify_id = '', game_id = '', c_game_id = '', title = '', text = '', target = '', click_type = '', time = '' } = body;
|
||||
let str = encodeUtf8(`${notify_id}${game_id}${c_game_id}${title}${text}${target}${click_type}${key}${time}`);
|
||||
let sign = md5(str);
|
||||
console.log('** origin str', body, str, sign);
|
||||
return sign;
|
||||
}
|
||||
|
||||
function encodeUtf8(str: string) {
|
||||
return Buffer.from(str, 'utf8').toString();
|
||||
}
|
||||
|
||||
export function get37Md5SignB(body: any, key: string) {
|
||||
return getMd5ObjSign(body, '', (str) => `${str}${key}`);
|
||||
}
|
||||
@@ -120,7 +132,6 @@ export function getChannelId(channelType: string, uid: number|string) {
|
||||
return `${channelType}_${uid}`;
|
||||
}
|
||||
|
||||
|
||||
/********* 厚土防沉迷 *********/
|
||||
|
||||
export function getVidObjSign(body: any) {
|
||||
@@ -177,4 +188,8 @@ export function isSkipEncode(isDevelop = false) {
|
||||
|
||||
export function needRebate() {
|
||||
return gameData.serverConst.NEED_REBATE == 1;
|
||||
}
|
||||
|
||||
export function needPushMsg() {
|
||||
return gameData.serverConst.PUSH_MSG == 1;
|
||||
}
|
||||
Reference in New Issue
Block a user