Commit b3b53ede authored by qinhaitao's avatar qinhaitao

feat: 🎸 集卡代码

parent 71207cb3
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
"mpath": "^0.7.0", "mpath": "^0.7.0",
"node-xlsx": "^0.15.0", "node-xlsx": "^0.15.0",
"source-map-support": "^0.5.19", "source-map-support": "^0.5.19",
"taobao-mini-sdk": "^0.2.4" "taobao-mini-sdk": "0.2.4"
}, },
"scripts": { "scripts": {
"start": "tsc", "start": "tsc",
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { services, checkParams, preCheck, preUpdate } from '../decorator/common' import { services, checkParams, preCheck, preUpdate } from '../decorator/common'
import { resultsModel } from '../sdk' import { resultsModel } from '../sdk'
import { CommonUserService, CommonGameService } from '../service/common' import { CommonCardService } from '../service/common'
import { import {
checkActivityTime, checkActivityTime,
checkJoinId, checkJoinId,
...@@ -19,15 +19,23 @@ export interface ISumitGameControllerInfos extends IControllerInfos { ...@@ -19,15 +19,23 @@ export interface ISumitGameControllerInfos extends IControllerInfos {
export default class Card { export default class Card {
@checkParams(['activityId']) @checkParams(['activityId'])
@services([CommonGameService]) @services([CommonCardService])
async getCollectCardInfo( async getCollectCardInfo(
context: IContext<IParams>, context: IContext<IParams>,
{ userInfo, activityInfo }: IControllerInfos, { userInfo, activityInfo }: IControllerInfos,
[gameService]: [CommonGameService] [cardService]: [CommonCardService]
) { ) {
// const joinResult = await gameService.addJoinRecord(userInfo) const { joinedTimes, gameTimes } = userInfo
// return resultsModel.success({ }
// ...joinResult
// }) @checkParams(['activityId'])
@services([CommonCardService])
@preCheck([checkActivityTime, checkVip])
async doJoin(
context: IContext<IParams>,
{ userInfo, activityInfo }: IControllerInfos,
[cardService]: [CommonCardService]
) {
const { joinedTimes, gameTimes } = userInfo
} }
} }
...@@ -3,5 +3,8 @@ ...@@ -3,5 +3,8 @@
export const customInitUserInfo: ICustomUserInfo = { export const customInitUserInfo: ICustomUserInfo = {
gameTimes: 0, gameTimes: 0,
maxScore: 0, maxScore: 0,
totalScore: 0 totalScore: 0,
joinedTimes: 0,
cardsCollectedCount: 0,
cardInfo: {}
} }
/**
* 基本信息
*
* @format
*/
import { BaseDao, TBAPIS } from '../../sdk'
import { JOIN_DB_NAME } from '../../db'
import { ACTIVITY_STATUS } from '../../constants'
import { getToday } from '../../utils'
import UserService from './user.service'
export default class CardService extends UserService {
context: IContext<IParams>
joindao: IBaseDao
constructor(context: IContext<IParams>) {
super(context)
this.joindao = new BaseDao(context, JOIN_DB_NAME)
}
// 集卡
async collectCard(activityId: string) {}
}
...@@ -7,6 +7,7 @@ import CommonAwardsService from './awards.service' ...@@ -7,6 +7,7 @@ import CommonAwardsService from './awards.service'
import CommonTaskService from './task.service' import CommonTaskService from './task.service'
import CommonStatService from './stat.service' import CommonStatService from './stat.service'
import CommonGameService from './game.service' import CommonGameService from './game.service'
import CommonCardService from './card.service'
const common = { const common = {
CommonAccessService, CommonAccessService,
...@@ -15,7 +16,8 @@ const common = { ...@@ -15,7 +16,8 @@ const common = {
CommonAwardsService, CommonAwardsService,
CommonTaskService, CommonTaskService,
CommonStatService, CommonStatService,
CommonGameService CommonGameService,
CommonCardService
} }
export default common export default common
...@@ -27,5 +29,6 @@ export { ...@@ -27,5 +29,6 @@ export {
CommonAwardsService, CommonAwardsService,
CommonTaskService, CommonTaskService,
CommonStatService, CommonStatService,
CommonGameService CommonGameService,
CommonCardService
} }
...@@ -7,6 +7,12 @@ interface ICustomUserInfo { ...@@ -7,6 +7,12 @@ interface ICustomUserInfo {
maxScore?: number maxScore?: number
totalScore?: number totalScore?: number
updateScoreTime?: number updateScoreTime?: number
// 集卡
joinedTimes?: number
cardsCollectedCount?: number
cardInfo: {
[key: string]: number
}
} }
interface ICommonUserInfo { interface ICommonUserInfo {
......
...@@ -907,7 +907,7 @@ table@^5.2.3: ...@@ -907,7 +907,7 @@ table@^5.2.3:
slice-ansi "^2.1.0" slice-ansi "^2.1.0"
string-width "^3.0.0" string-width "^3.0.0"
taobao-mini-sdk@^0.2.4: taobao-mini-sdk@0.2.4:
version "0.2.4" version "0.2.4"
resolved "https://registry.npm.taobao.org/taobao-mini-sdk/download/taobao-mini-sdk-0.2.4.tgz#5074718bd4135263adbabbf30d8c6b44a0da1d9a" resolved "https://registry.npm.taobao.org/taobao-mini-sdk/download/taobao-mini-sdk-0.2.4.tgz#5074718bd4135263adbabbf30d8c6b44a0da1d9a"
integrity sha1-UHRxi9QTUmOturvzDYxrRKDaHZo= integrity sha1-UHRxi9QTUmOturvzDYxrRKDaHZo=
......
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