Commit 59323d0c authored by qinhaitao's avatar qinhaitao

feat: 🎸 commonSer 命名

parent a300ba28
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { services, checkParams, registeInfos } from '../decorator/common' import { services, checkParams, registeInfos } from '../decorator/common'
import { resultsModel } from '../sdk' import { resultsModel } from '../sdk'
import { AwardsService } from '../service/common' import { CommonAwardsService } from '../service/common'
import preCheck from '../decorator/common/preCheck' import preCheck from '../decorator/common/preCheck'
import { import {
checkActivityTime, checkActivityTime,
...@@ -20,11 +20,11 @@ export default class AwardsController { ...@@ -20,11 +20,11 @@ export default class AwardsController {
* 我的奖品列表 * 我的奖品列表
*/ */
@checkParams(['activityId']) @checkParams(['activityId'])
@services([AwardsService]) @services([CommonAwardsService])
async getMyPrizeList( async getMyPrizeList(
context: IContext<IParams>, context: IContext<IParams>,
{ activityInfo }: IControllerInfos, { activityInfo }: IControllerInfos,
[awardSer]: [AwardsService] [awardSer]: [CommonAwardsService]
): Promise<IResult<{ list: IAwards[] }>> { ): Promise<IResult<{ list: IAwards[] }>> {
const result = await awardSer.getMyPrizeList(activityInfo) const result = await awardSer.getMyPrizeList(activityInfo)
return resultsModel.success(result) return resultsModel.success(result)
...@@ -34,12 +34,12 @@ export default class AwardsController { ...@@ -34,12 +34,12 @@ export default class AwardsController {
* 领取实物 * 领取实物
*/ */
@checkParams(['activityId', 'id', 'name', 'phone', 'province', 'city', 'area', 'addressDetail', 'streetName']) @checkParams(['activityId', 'id', 'name', 'phone', 'province', 'city', 'area', 'addressDetail', 'streetName'])
@services([AwardsService]) @services([CommonAwardsService])
@preCheck([checkPrizeExpired, checkValidObjectPrize]) @preCheck([checkPrizeExpired, checkValidObjectPrize])
async receiveObjectPrize( async receiveObjectPrize(
context: IContext<IParams>, context: IContext<IParams>,
{ activityInfo }: IReceivePrizeControllerInfos, { activityInfo }: IReceivePrizeControllerInfos,
[awardSer]: [AwardsService] [awardSer]: [CommonAwardsService]
): Promise<IResult<boolean>> { ): Promise<IResult<boolean>> {
let { province, city, area, streetName, addressDetail, id, name, phone } = context.data let { province, city, area, streetName, addressDetail, id, name, phone } = context.data
...@@ -61,12 +61,12 @@ export default class AwardsController { ...@@ -61,12 +61,12 @@ export default class AwardsController {
*/ */
@checkParams(['activityId', 'id']) @checkParams(['activityId', 'id'])
@registeInfos(['session']) @registeInfos(['session'])
@services([AwardsService]) @services([CommonAwardsService])
@preCheck([checkPrizeExpired, checkValidEnamePrize]) @preCheck([checkPrizeExpired, checkValidEnamePrize])
async receiveEnamePrize( async receiveEnamePrize(
context: IContext<IParams>, context: IContext<IParams>,
{ awardInfo, session }: IReceivePrizeControllerInfos, { awardInfo, session }: IReceivePrizeControllerInfos,
[awardSer]: [AwardsService] [awardSer]: [CommonAwardsService]
) { ) {
let { id } = context.data let { id } = context.data
...@@ -79,12 +79,12 @@ export default class AwardsController { ...@@ -79,12 +79,12 @@ export default class AwardsController {
* 概率抽奖 * 概率抽奖
*/ */
@checkParams(['activityId', 'prizeDataType']) @checkParams(['activityId', 'prizeDataType'])
@services([AwardsService]) @services([CommonAwardsService])
@preCheck([checkActivityTime]) @preCheck([checkActivityTime])
async drawLotteryPrize( async drawLotteryPrize(
context: IContext<IParams>, context: IContext<IParams>,
{ userInfo }: IControllerInfos, { userInfo }: IControllerInfos,
[awardSer]: [AwardsService] [awardSer]: [CommonAwardsService]
): Promise< ): Promise<
IResult<{ IResult<{
id?: string id?: string
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
import { services, checkParams, registeInfos, noCheckUser } from '../decorator/common' import { services, checkParams, registeInfos, noCheckUser } from '../decorator/common'
import { resultsModel } from '../sdk' import { resultsModel } from '../sdk'
import { BaseService } from '../service/common' import { CommonBaseService } from '../service/common'
export default class BaseController { export default class BaseController {
/** /**
* 活动基本信息 * 活动基本信息
*/ */
@checkParams(['activityId']) @checkParams(['activityId'])
@noCheckUser @noCheckUser
@services([BaseService]) @services([CommonBaseService])
async getActivityBaseInfoById( async getActivityBaseInfoById(
context: IContext<{ context: IContext<{
activityId: string activityId: string
...@@ -24,11 +24,11 @@ export default class BaseController { ...@@ -24,11 +24,11 @@ export default class BaseController {
*/ */
@checkParams(['itemIds']) @checkParams(['itemIds'])
@registeInfos(['session']) @registeInfos(['session'])
@services([BaseService]) @services([CommonBaseService])
async getItemListByItemIds( async getItemListByItemIds(
context: IContext<IParams>, context: IContext<IParams>,
{ session }: IControllerInfos, { session }: IControllerInfos,
[baseService]: [BaseService] [baseService]: [CommonBaseService]
): Promise<IResult<{ list: ITaoBaoItems[] }>> { ): Promise<IResult<{ list: ITaoBaoItems[] }>> {
const { itemIds } = context.data const { itemIds } = context.data
......
...@@ -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 { UserService, GameService } from '../service/common' import { CommonUserService, CommonGameService } from '../service/common'
import { checkActivityTime, checkJoinId, checkUserInfo, checkVip } from '../utils/common/check' import { checkActivityTime, checkJoinId, checkUserInfo, checkVip } from '../utils/common/check'
import { updateUserInfo } from '../utils/common/update' import { updateUserInfo } from '../utils/common/update'
...@@ -17,11 +17,11 @@ export default class Game { ...@@ -17,11 +17,11 @@ export default class Game {
* needKeys 根据需求自取字段 格式: { gameTimes: 1 } * needKeys 根据需求自取字段 格式: { gameTimes: 1 }
*/ */
@checkParams(['activityId', 'needKeys']) @checkParams(['activityId', 'needKeys'])
@services([UserService]) @services([CommonUserService])
async getGameInfo( async getGameInfo(
context: IContext<IParams>, context: IContext<IParams>,
{ userInfo, activityInfo }: IControllerInfos, { userInfo, activityInfo }: IControllerInfos,
[userService]: [UserService] [userService]: [CommonUserService]
) { ) {
const { needKeys } = context.data const { needKeys } = context.data
const gameInfoResult = await userService.getUserInfo(needKeys) const gameInfoResult = await userService.getUserInfo(needKeys)
...@@ -31,7 +31,7 @@ export default class Game { ...@@ -31,7 +31,7 @@ export default class Game {
} }
@checkParams(['activityId']) @checkParams(['activityId'])
@services([GameService]) @services([CommonGameService])
@preCheck([checkActivityTime, checkVip, checkUserInfo({ gameTimes: { $gte: 3 } }, '游戏次数不足,做点任务吧')]) @preCheck([checkActivityTime, checkVip, checkUserInfo({ gameTimes: { $gte: 3 } }, '游戏次数不足,做点任务吧')])
@preUpdate([ @preUpdate([
updateUserInfo({ updateUserInfo({
...@@ -42,7 +42,7 @@ export default class Game { ...@@ -42,7 +42,7 @@ export default class Game {
async startGame( async startGame(
context: IContext<IParams>, context: IContext<IParams>,
{ userInfo, activityInfo }: IControllerInfos, { userInfo, activityInfo }: IControllerInfos,
[gameService]: [GameService] [gameService]: [CommonGameService]
) { ) {
const joinResult = await gameService.addJoinRecord(userInfo) const joinResult = await gameService.addJoinRecord(userInfo)
...@@ -52,12 +52,12 @@ export default class Game { ...@@ -52,12 +52,12 @@ export default class Game {
} }
@checkParams(['activityId', 'id', 'score']) @checkParams(['activityId', 'id', 'score'])
@services([GameService]) @services([CommonGameService])
@preCheck([checkJoinId]) @preCheck([checkJoinId])
async submitGame( async submitGame(
context: IContext<IParams>, context: IContext<IParams>,
{ userInfo, joinInfo }: ISumitGameControllerInfos, { userInfo, joinInfo }: ISumitGameControllerInfos,
[gameService]: [GameService] [gameService]: [CommonGameService]
) { ) {
const { id, score } = context.data const { id, score } = context.data
const result = await gameService.submitGame(id, score, userInfo, joinInfo) const result = await gameService.submitGame(id, score, userInfo, joinInfo)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { services, checkParams, registeInfos, preUpdate } from '../decorator/common' import { services, checkParams, registeInfos, preUpdate } from '../decorator/common'
import { resultsModel } from '../sdk' import { resultsModel } from '../sdk'
import { UserService, AccessService } from '../service/common' import { CommonUserService, CommonAccessService } from '../service/common'
import { noCheckUser } from '../decorator/common' import { noCheckUser } from '../decorator/common'
export default class LoginController { export default class LoginController {
/** /**
...@@ -15,11 +15,11 @@ export default class LoginController { ...@@ -15,11 +15,11 @@ export default class LoginController {
@checkParams(['activityId', 'userNick', 'avatar', 'isFollow']) @checkParams(['activityId', 'userNick', 'avatar', 'isFollow'])
@noCheckUser @noCheckUser
@registeInfos(['vipInfo']) @registeInfos(['vipInfo'])
@services([UserService, AccessService]) @services([CommonUserService, CommonAccessService])
async login( async login(
context: IContext<IParams>, context: IContext<IParams>,
{ userInfo, activityInfo, vipInfo }: IControllerInfos, { userInfo, activityInfo, vipInfo }: IControllerInfos,
[userService, accessService]: [UserService, AccessService] [userService, accessService]: [CommonUserService, CommonAccessService]
): Promise<IResult<{ openId: string; firstLoginToday: boolean; newUser: boolean }>> { ): Promise<IResult<{ openId: string; firstLoginToday: boolean; newUser: boolean }>> {
const updatedUserInfo = await userService.doLogin(userInfo, vipInfo, activityInfo) const updatedUserInfo = await userService.doLogin(userInfo, vipInfo, activityInfo)
// access表 // access表
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { services, preCheck, registeInfos, preUpdate, checkParams } from '../decorator/common/' import { services, preCheck, registeInfos, preUpdate, checkParams } from '../decorator/common/'
import { resultsModel } from '../sdk' import { resultsModel } from '../sdk'
import { UserService, StatService, TaskService } from '../service/common' import { CommonUserService, CommonStatService, CommonTaskService } from '../service/common'
import { STAT_TYPE } from '../constants' import { STAT_TYPE } from '../constants'
import { checkActivityTime, checkInviteId, checkHelpRecord, checkNewVip } from '../utils/common/check' import { checkActivityTime, checkInviteId, checkHelpRecord, checkNewVip } from '../utils/common/check'
import { updateVip } from '../utils/common/update/' import { updateVip } from '../utils/common/update/'
...@@ -15,7 +15,7 @@ export default class Share { ...@@ -15,7 +15,7 @@ export default class Share {
* 获取邀请信息 * 获取邀请信息
*/ */
@checkParams(['activityId']) @checkParams(['activityId'])
@services([UserService]) @services([CommonUserService])
async getShareInfo( async getShareInfo(
context: IContext<IParams>, context: IContext<IParams>,
{ userInfo }: IControllerInfos { userInfo }: IControllerInfos
...@@ -33,13 +33,13 @@ export default class Share { ...@@ -33,13 +33,13 @@ export default class Share {
*/ */
@checkParams(['activityId', 'inviteId']) @checkParams(['activityId', 'inviteId'])
@registeInfos(['vipInfo']) @registeInfos(['vipInfo'])
@services([TaskService, StatService]) @services([CommonTaskService, CommonStatService])
@preCheck([checkActivityTime, checkInviteId, checkNewVip, checkHelpRecord]) @preCheck([checkActivityTime, checkInviteId, checkNewVip, checkHelpRecord])
@preUpdate([updateVip]) @preUpdate([updateVip])
async doHelp( async doHelp(
context: IContext<IParams>, context: IContext<IParams>,
{ userInfo, activityInfo, inviteUserInfo }: IdoHelpInfos, { userInfo, activityInfo, inviteUserInfo }: IdoHelpInfos,
[taskService, statService]: [TaskService, StatService] [taskService, statService]: [CommonTaskService, CommonStatService]
): Promise<IResult<boolean>> { ): Promise<IResult<boolean>> {
const { openId } = context const { openId } = context
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { resultsModel } from '../sdk' import { resultsModel } from '../sdk'
import { checkParams, services } from '../decorator/common' import { checkParams, services } from '../decorator/common'
import { StatService } from '../service/common' import { CommonStatService } from '../service/common'
/** @format */ /** @format */
export default class StatController { export default class StatController {
...@@ -10,8 +10,8 @@ export default class StatController { ...@@ -10,8 +10,8 @@ export default class StatController {
* 增加埋点记录 * 增加埋点记录
*/ */
@checkParams(['activityId', 'type']) @checkParams(['activityId', 'type'])
@services([StatService]) @services([CommonStatService])
async addStat(context: IContext<IParams>, { userInfo }: IControllerInfos, [statService]: [StatService]) { async addStat(context: IContext<IParams>, { userInfo }: IControllerInfos, [statService]: [CommonStatService]) {
const { type } = context.data const { type } = context.data
const result = await statService.addStat(type, userInfo) const result = await statService.addStat(type, userInfo)
return resultsModel.success(result) return resultsModel.success(result)
...@@ -20,8 +20,8 @@ export default class StatController { ...@@ -20,8 +20,8 @@ export default class StatController {
* 统计数据 * 统计数据
*/ */
@checkParams(['activityId', 'startDay', 'endDay']) @checkParams(['activityId', 'startDay', 'endDay'])
@services([StatService]) @services([CommonStatService])
async getStats(context: IContext<IParams>, {}: IControllerInfos, [statService]: [StatService]) { async getStats(context: IContext<IParams>, {}: IControllerInfos, [statService]: [CommonStatService]) {
const { activityId, startDay, endDay } = context.data const { activityId, startDay, endDay } = context.data
const xlsxData = await statService.getStats(activityId, startDay, endDay) const xlsxData = await statService.getStats(activityId, startDay, endDay)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { checkParams, services, registeInfos, preCheck } from '../decorator/common' import { checkParams, services, registeInfos, preCheck } from '../decorator/common'
import { resultsModel } from '../sdk' import { resultsModel } from '../sdk'
import { TaskService, BaseService } from '../service/common' import { CommonTaskService, CommonBaseService } from '../service/common'
import { ITaskInfo } from '../service/common/task.service' import { ITaskInfo } from '../service/common/task.service'
import { checkActivityTime, checkTaskLimit, checkExchangeCreditsTask, checkRemainTimes } from '../utils/common/check/' import { checkActivityTime, checkTaskLimit, checkExchangeCreditsTask, checkRemainTimes } from '../utils/common/check/'
import { preUpdate } from '../decorator/common' import { preUpdate } from '../decorator/common'
...@@ -14,13 +14,13 @@ export default class Task { ...@@ -14,13 +14,13 @@ export default class Task {
*/ */
@checkParams(['activityId']) @checkParams(['activityId'])
@registeInfos(['vipInfo']) @registeInfos(['vipInfo'])
@services([TaskService]) @services([CommonTaskService])
@preCheck([checkActivityTime]) @preCheck([checkActivityTime])
@preUpdate([updateVip, updateSignTask, updateOrderGoods]) @preUpdate([updateVip, updateSignTask, updateOrderGoods])
async getTaskList( async getTaskList(
context: IContext<IParams>, context: IContext<IParams>,
{ userInfo, activityInfo }: IControllerInfos, { userInfo, activityInfo }: IControllerInfos,
[taskService]: [TaskService] [taskService]: [CommonTaskService]
): Promise<IResult<{ list: ITaskInfo[] }>> { ): Promise<IResult<{ list: ITaskInfo[] }>> {
// 读取B端 tasks字段配置自动生成任务列表 // 读取B端 tasks字段配置自动生成任务列表
const result = await taskService.initTaskList(userInfo, activityInfo) const result = await taskService.initTaskList(userInfo, activityInfo)
...@@ -38,12 +38,12 @@ export default class Task { ...@@ -38,12 +38,12 @@ export default class Task {
*/ */
@checkParams(['activityId', 'taskType']) @checkParams(['activityId', 'taskType'])
@registeInfos(['session']) @registeInfos(['session'])
@services([TaskService]) @services([CommonTaskService])
@preCheck([checkActivityTime, checkTaskLimit, checkExchangeCreditsTask]) @preCheck([checkActivityTime, checkTaskLimit, checkExchangeCreditsTask])
async doCompleteTask( async doCompleteTask(
context: IContext<IParams>, context: IContext<IParams>,
{ userInfo, activityInfo }: IControllerInfos, { userInfo, activityInfo }: IControllerInfos,
[taskService]: [TaskService] [taskService]: [CommonTaskService]
): Promise<IResult<boolean>> { ): Promise<IResult<boolean>> {
const { taskType } = context.data const { taskType } = context.data
...@@ -58,12 +58,12 @@ export default class Task { ...@@ -58,12 +58,12 @@ export default class Task {
* 领取的奖励增加的key值 如: gameTimes 前端传入 * 领取的奖励增加的key值 如: gameTimes 前端传入
*/ */
@checkParams(['activityId', 'taskType', 'rewardsKey']) @checkParams(['activityId', 'taskType', 'rewardsKey'])
@services([TaskService]) @services([CommonTaskService])
@preCheck([checkActivityTime, checkRemainTimes]) @preCheck([checkActivityTime, checkRemainTimes])
async receiveTaskRewards( async receiveTaskRewards(
context: IContext<IParams>, context: IContext<IParams>,
{ userInfo }: IControllerInfos, { userInfo }: IControllerInfos,
[taskService]: [TaskService] [taskService]: [CommonTaskService]
): Promise<IResult<{ rewards: number }>> { ): Promise<IResult<{ rewards: number }>> {
const { rewardsKey } = context.data const { rewardsKey } = context.data
const { taskType } = context.data const { taskType } = context.data
...@@ -78,17 +78,17 @@ export default class Task { ...@@ -78,17 +78,17 @@ export default class Task {
*/ */
@checkParams(['activityId', 'itemIds']) @checkParams(['activityId', 'itemIds'])
@registeInfos(['session']) @registeInfos(['session'])
@services([BaseService, TaskService]) @services([CommonBaseService, CommonTaskService])
async getCollectGoodsList( async getCollectGoodsList(
context: IContext<IParams>, context: IContext<IParams>,
{ session, userInfo }: IControllerInfos, { session, userInfo }: IControllerInfos,
[baseService, taskService]: [BaseService, TaskService] [commonBaseService, commonTaskService]: [CommonBaseService, CommonTaskService]
) { ) {
const { itemIds } = context.data const { itemIds } = context.data
const list = await baseService.getItemListByIds(itemIds, session) const list = await commonBaseService.getItemListByIds(itemIds, session)
const listWithCollectStatus = await taskService.getItemListWithCollectStatus(list, userInfo) const listWithCollectStatus = await commonTaskService.getItemListWithCollectStatus(list, userInfo)
return resultsModel.success(listWithCollectStatus) return resultsModel.success(listWithCollectStatus)
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { services, checkParams, registeInfos } from '../decorator/common' import { services, checkParams, registeInfos } from '../decorator/common'
import { resultsModel } from '../sdk' import { resultsModel } from '../sdk'
import { UserService } from '../service/common' import { CommonUserService } from '../service/common'
interface IRankList { interface IRankList {
userNick: string userNick: string
...@@ -23,11 +23,11 @@ export default class User { ...@@ -23,11 +23,11 @@ export default class User {
* 获取会员信息 * 获取会员信息
*/ */
@checkParams(['activityId']) @checkParams(['activityId'])
@services([UserService]) @services([CommonUserService])
async getVipInfo( async getVipInfo(
context: IContext<IParams>, context: IContext<IParams>,
{ activityInfo }: IControllerInfos, { activityInfo }: IControllerInfos,
[userService]: [UserService] [userService]: [CommonUserService]
): Promise<IResult<IVipInfo>> { ): Promise<IResult<IVipInfo>> {
// 拼接回调参数 // 拼接回调参数
const result = await userService.getShopVip(context, activityInfo) const result = await userService.getShopVip(context, activityInfo)
...@@ -39,8 +39,8 @@ export default class User { ...@@ -39,8 +39,8 @@ export default class User {
* 获取排行榜 * 获取排行榜
*/ */
@checkParams(['activityId', 'key', 'timeKey']) @checkParams(['activityId', 'key', 'timeKey'])
@services([UserService]) @services([CommonUserService])
async getRankList(context: IContext<IParams>, { userInfo }: IControllerInfos, [userService]: [UserService]) { async getRankList(context: IContext<IParams>, { userInfo }: IControllerInfos, [userService]: [CommonUserService]) {
const { key, timeKey, limit = 200 } = context.data const { key, timeKey, limit = 200 } = context.data
const rankInfo = await userService.getMyRankInfo(key, timeKey, userInfo) const rankInfo = await userService.getMyRankInfo(key, timeKey, userInfo)
......
/** @format */ /** @format */
import { isEmpty, merge } from 'lodash' import { isEmpty, merge } from 'lodash'
import { UserService } from '../../service/common'
import { recordErrorLog } from '../../utils/common/logger' import { recordErrorLog } from '../../utils/common/logger'
import { resultsModel } from '../../sdk' import { resultsModel } from '../../sdk'
import { CODE_TYPES } from '../../errorCode' import { CODE_TYPES } from '../../errorCode'
......
/** @format */ /** @format */
import { UserService, BaseService } from '../../service/common' import { CommonUserService, CommonBaseService } from '../../service/common'
import { getSellerSession } from '../../utils' import { getSellerSession } from '../../utils'
import { formatVipCbUrl, getShopVip } from '../../utils/common/vip' import { formatVipCbUrl, getShopVip } from '../../utils/common/vip'
import { CODE_TYPES } from '../../errorCode' import { CODE_TYPES } from '../../errorCode'
...@@ -9,10 +9,10 @@ export type IInfo = 'session' | 'vipInfo' ...@@ -9,10 +9,10 @@ export type IInfo = 'session' | 'vipInfo'
async function initBaseInfo(context: IContext<IParams>, baseInfos: ICheckControllerInfos, needInfos: IInfo[]) { async function initBaseInfo(context: IContext<IParams>, baseInfos: ICheckControllerInfos, needInfos: IInfo[]) {
const handler = context?.cloud?.dataspace?.context?.handler const handler = context?.cloud?.dataspace?.context?.handler
const userService = new UserService(context) const userService = new CommonUserService(context)
if (!baseInfos.activityInfo) { if (!baseInfos.activityInfo) {
const baseService = new BaseService(context) const baseService = new CommonBaseService(context)
// 活动基本情况 // 活动基本情况
const activityInfo = await baseService.getBaseInfo(context.data.activityId) const activityInfo = await baseService.getBaseInfo(context.data.activityId)
if (!activityInfo) return CODE_TYPES.ERROR_NO_ACTIVITY if (!activityInfo) return CODE_TYPES.ERROR_NO_ACTIVITY
......
...@@ -4,7 +4,7 @@ import { logFn, recordErrorLog } from '../../utils' ...@@ -4,7 +4,7 @@ import { logFn, recordErrorLog } from '../../utils'
import { resultsModel } from '../../sdk' import { resultsModel } from '../../sdk'
import { CODE_TYPES } from '../../constants' import { CODE_TYPES } from '../../constants'
import { doHandler } from '../../utils/' import { doHandler } from '../../utils/'
import { UserService, BaseService } from '../../service/common' import { CommonUserService, CommonBaseService } from '../../service/common'
type Constructor = new (...args: any[]) => {} type Constructor = new (...args: any[]) => {}
...@@ -12,7 +12,7 @@ async function formatBaseInfos(context: IContext<IParams>, baseInfos: ICheckCont ...@@ -12,7 +12,7 @@ async function formatBaseInfos(context: IContext<IParams>, baseInfos: ICheckCont
// 如果未调用registeInfos 则 重新注入userInfo和 activityInfo // 如果未调用registeInfos 则 重新注入userInfo和 activityInfo
if (!baseInfos.registed) { if (!baseInfos.registed) {
if (!baseInfos.activityInfo && !baseInfos.noCheckActivity) { if (!baseInfos.activityInfo && !baseInfos.noCheckActivity) {
const baseService = new BaseService(context) const baseService = new CommonBaseService(context)
// 活动基本情况 // 活动基本情况
const activityInfo = await baseService.getBaseInfo(context.data.activityId) const activityInfo = await baseService.getBaseInfo(context.data.activityId)
if (!activityInfo) return CODE_TYPES.ERROR_NO_ACTIVITY if (!activityInfo) return CODE_TYPES.ERROR_NO_ACTIVITY
...@@ -21,7 +21,7 @@ async function formatBaseInfos(context: IContext<IParams>, baseInfos: ICheckCont ...@@ -21,7 +21,7 @@ async function formatBaseInfos(context: IContext<IParams>, baseInfos: ICheckCont
// 默认注入活动和用户信息并校验 // 默认注入活动和用户信息并校验
if (!baseInfos.userInfo) { if (!baseInfos.userInfo) {
const userService = new UserService(context) const userService = new CommonUserService(context)
const userInfo = await userService.getUserInfo() const userInfo = await userService.getUserInfo()
if (!userInfo && !baseInfos.noCheckUser) return CODE_TYPES.ERROR_NO_USER if (!userInfo && !baseInfos.noCheckUser) return CODE_TYPES.ERROR_NO_USER
baseInfos.userInfo = userInfo baseInfos.userInfo = userInfo
......
/** @format */ /** @format */
import AccessService from './access.service' import CommonAccessService from './access.service'
import BaseService from './base.service' import CommonBaseService from './base.service'
import UserService from './user.service' import CommonUserService from './user.service'
import AwardsService from './awards.service' import CommonAwardsService from './awards.service'
import TaskService from './task.service' import CommonTaskService from './task.service'
import StatService from './stat.service' import CommonStatService from './stat.service'
import GameService from './game.service' import CommonGameService from './game.service'
const common = { const common = {
AccessService, CommonAccessService,
BaseService, CommonBaseService,
UserService, CommonUserService,
AwardsService, CommonAwardsService,
TaskService, CommonTaskService,
StatService, CommonStatService,
GameService CommonGameService
} }
export default common export default common
export { export {
AccessService, CommonAccessService,
BaseService, CommonBaseService,
UserService, CommonUserService,
AwardsService, CommonAwardsService,
TaskService, CommonTaskService,
StatService, CommonStatService,
GameService CommonGameService
} }
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