Merge remote-tracking branch 'origin/feature/dadian' into release
This commit is contained in:
commit
a4a84aba24
10
src/api_s2c/user/ApiDot.ts
Normal file
10
src/api_s2c/user/ApiDot.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import {ApiCall} from "tsrpc";
|
||||||
|
import {ReqDot, ResDot} from "../../shared/protocols/user/PtlDot";
|
||||||
|
import {addGameDot} from "../../gameLog";
|
||||||
|
|
||||||
|
export default async function (call: ApiCall<ReqDot, ResDot>) {
|
||||||
|
|
||||||
|
addGameDot(call.uid, call.req.type, call.req.data)
|
||||||
|
|
||||||
|
call.succ({});
|
||||||
|
}
|
@ -44,3 +44,29 @@ export async function addGameLog(uid:string, type:string, req:any, data:any){
|
|||||||
console.error('addGameLog',e);
|
console.error('addGameLog',e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 玩家游戏内打点
|
||||||
|
* @param uid 玩家uid
|
||||||
|
* @param type 日志类型
|
||||||
|
* @param data 日志内容
|
||||||
|
*/
|
||||||
|
|
||||||
|
export async function addGameDot(uid:string, type:string, data?:any){
|
||||||
|
try{
|
||||||
|
if(!logDB){
|
||||||
|
await connGameLogDB();
|
||||||
|
}
|
||||||
|
let log = {
|
||||||
|
uid,
|
||||||
|
type,
|
||||||
|
data
|
||||||
|
}
|
||||||
|
//事件时间
|
||||||
|
log['cTime'] = Math.floor(Date.now()/1000);
|
||||||
|
|
||||||
|
logDB.collection('gameDot').insertOne(log);
|
||||||
|
}catch(e){
|
||||||
|
console.error('addGameLog',e);
|
||||||
|
}
|
||||||
|
}
|
8
src/shared/protocols/user/PtlDot.ts
Normal file
8
src/shared/protocols/user/PtlDot.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
export interface ReqDot {
|
||||||
|
type: string,
|
||||||
|
data?: any
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ResDot {
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user