Commit 40d55825 authored by qinhaitao's avatar qinhaitao

feat: 🎸 add Stat

parent f24c72a9
...@@ -33,11 +33,15 @@ export default class StatService { ...@@ -33,11 +33,15 @@ export default class StatService {
* @return {boolean} * @return {boolean}
* @memberof StatService * @memberof StatService
*/ */
async addStat(type: number, userInfo: IUserInfo = {} as IUserInfo, customStatData: object = {}): Promise<string> { async addStat(
type: number,
userInfo: IUserInfo = {} as IUserInfo,
customStatData: object = {}
): Promise<{ id: string }> {
const { openId } = this.context const { openId } = this.context
const { activityId } = this.context.data const { activityId } = this.context.data
const { userNick } = userInfo const { userNick } = userInfo
return await this.statdao.insertOne({ const id = await this.statdao.insertOne({
activityId, activityId,
type, type,
typeName: STAT_TYPE[type], typeName: STAT_TYPE[type],
...@@ -47,6 +51,7 @@ export default class StatService { ...@@ -47,6 +51,7 @@ export default class StatService {
createTime: Date.now(), createTime: Date.now(),
createDay: getToday() createDay: getToday()
}) })
return { id }
} }
async getStats(activityId: string, startDay: string, endDay: string): Promise<any> { async getStats(activityId: string, startDay: string, endDay: string): Promise<any> {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment