Commit 76c36558 authored by maggie's avatar maggie

代码迁移

parent 3c47a8d2
...@@ -36,6 +36,11 @@ const customFileMap = (controllers = {}) => { ...@@ -36,6 +36,11 @@ const customFileMap = (controllers = {}) => {
} }
} }
} }
for (let main of controllers[controllerType][controller][fn].main) {
if (main.type === 'custom') {
result.services[main.name] = true
}
}
} }
} }
} }
...@@ -44,7 +49,7 @@ const customFileMap = (controllers = {}) => { ...@@ -44,7 +49,7 @@ const customFileMap = (controllers = {}) => {
const run = async (gulp, nunjucksRender, rename, nunjucksRenderConfig) => { const run = async (gulp, nunjucksRender, rename, nunjucksRenderConfig) => {
//编译自定义文件 //编译自定义文件
const { decorators, utils } = customFileMap(config.controllers) const { decorators, utils, services } = customFileMap(config.controllers)
for (let decorator in decorators) { for (let decorator in decorators) {
await gulp await gulp
.src(`${serverTemplatePath}/decorator.njk`) .src(`${serverTemplatePath}/decorator.njk`)
......
...@@ -4,17 +4,17 @@ import commonUtilCheck from '../../utils/common/check' ...@@ -4,17 +4,17 @@ import commonUtilCheck from '../../utils/common/check'
import commonUtilUpdate from '../../utils/common/update' import commonUtilUpdate from '../../utils/common/update'
import customDecorator from '../../decorator/custom' import customDecorator from '../../decorator/custom'
import { resultsModel } from '../../sdk' import { resultsModel } from '../../sdk'
import { StatService } from '../../service' import commonService, { StatService } from '../../service/common'
export default class StatController { export default class StatController {
/** /**
* 增加埋点记录 * 增加埋点记录
*/ */
@commonDecorator.checkParams(['activityId', 'type']) @commonDecorator.checkParams(['activityId', 'type'])
@services([StatService]) @services([commonService.StatService])
async addStat( async addStat(
context: IContext<IParams>, context: IContext<IParams>,
{ activityInfo, userInfo }: IControllerInfos, { activityInfo, userInfo }: IControllerInfos,
[statService]: [StatService] [statService]: [commonService.StatService]
) { ) {
const commonStatAddstatResult1 = await statService.addStat(context.data.type, userInfo) const commonStatAddstatResult1 = await statService.addStat(context.data.type, userInfo)
return resultsModel.success({ return resultsModel.success({
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
* @format * @format
*/ */
import { BaseDao } from '../sdk' import { BaseDao } from '../../sdk'
import { getToday } from '../utils' import { getToday } from '../../utils'
import { ACCESS_DB_NAME } from '../db' import { ACCESS_DB_NAME } from '../../db'
export default class UserAccessService { export default class UserAccessService {
context: IContext<IParams> context: IContext<IParams>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @format * @format
*/ */
import { BaseDao, resultsModel } from '../sdk' import { BaseDao, resultsModel } from '../../sdk'
import UserService from './user.service' import UserService from './user.service'
import { import {
CODE_TYPES, CODE_TYPES,
...@@ -14,11 +14,11 @@ import { ...@@ -14,11 +14,11 @@ import {
DELETE_STATUS, DELETE_STATUS,
SWICH_TOCK, SWICH_TOCK,
SHIP_STATUS SHIP_STATUS
} from '../constants' } from '../../constants'
import { AWARDS_DB_NAME, PRIZE_CONFIG_DB_NAME } from '../db' import { AWARDS_DB_NAME, PRIZE_CONFIG_DB_NAME } from '../../db'
import { sendTBAward, getSellerSession, rand } from '../utils' import { sendTBAward, getSellerSession, rand } from '../../utils'
import { generateCodeTypeWithMsg } from '../utils/common/helper' import { generateCodeTypeWithMsg } from '../../utils/common/helper'
import { getToday } from '../utils/common/getToday' import { getToday } from '../../utils/common/getToday'
export default class AwardsService extends UserService { export default class AwardsService extends UserService {
awardsdao: IBaseDao awardsdao: IBaseDao
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
* @format * @format
*/ */
import { BaseDao, TBAPIS } from '../sdk' import { BaseDao, TBAPIS } from '../../sdk'
import { ACTIVITY_CONFIG_DB_NAME } from '../db' import { ACTIVITY_CONFIG_DB_NAME } from '../../db'
import { ACTIVITY_STATUS } from '../constants' import { ACTIVITY_STATUS } from '../../constants'
export default class BaseService { export default class BaseService {
context: IContext<any> context: IContext<any>
......
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
* @format * @format
*/ */
import { BaseDao, TBAPIS } from '../sdk' import { BaseDao, TBAPIS } from '../../sdk'
import { JOIN_DB_NAME } from '../db' import { JOIN_DB_NAME } from '../../db'
import { ACTIVITY_STATUS } from '../constants' import { ACTIVITY_STATUS } from '../../constants'
import { getToday } from '../utils' import { getToday } from '../../utils'
export default class GameService { export default class GameService {
context: IContext<IParams> context: IContext<IParams>
......
/** @format */
import AccessService from './access.service'
import BaseService from './base.service'
import UserService from './user.service'
import AwardsService from './awards.service'
import TaskService from './task.service'
import StatService from './stat.service'
import GameService from './game.service'
const common = {
AccessService,
BaseService,
UserService,
AwardsService,
TaskService,
StatService,
GameService
}
export default common
export {
AccessService,
BaseService,
UserService,
AwardsService,
TaskService,
StatService,
GameService
}
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
* @format * @format
*/ */
import { BaseDao, dateFormatter, transformBeijingDate } from '../sdk' import { BaseDao, dateFormatter, transformBeijingDate } from '../../sdk'
import { STAT_DB_NAME, ACCESS_DB_NAME, USER_DB_NAME, AWARDS_DB_NAME } from '../db' import { STAT_DB_NAME, ACCESS_DB_NAME, USER_DB_NAME, AWARDS_DB_NAME } from '../../db'
import * as xlsx from 'node-xlsx' import * as xlsx from 'node-xlsx'
import { getToday } from '../utils' import { getToday } from '../../utils'
import { STAT_TYPE } from '../constants' import { STAT_TYPE } from '../../constants'
export default class StatService { export default class StatService {
context: IContext<any> context: IContext<any>
......
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
*/ */
import UserService from './user.service' import UserService from './user.service'
import { getToday, getUserOrderlist, generateVipUrl, formatVipCbUrl } from '../utils' import { getToday, getUserOrderlist, generateVipUrl, formatVipCbUrl } from '../../utils'
import { TASK_RATE_TYPE, TASK_STATUS } from '../constants' import { TASK_RATE_TYPE, TASK_STATUS } from '../../constants'
import { getTodayCompleteTask, getTotalCompleteTask, setTaskStatus } from '../utils/common/task' import { getTodayCompleteTask, getTotalCompleteTask, setTaskStatus } from '../../utils/common/task'
import { CODE_TYPES } from '../errorCode' import { CODE_TYPES } from '../../errorCode'
export interface ITaskInfo { export interface ITaskInfo {
taskType?: string // 任务类型 taskType?: string // 任务类型
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
* @format * @format
*/ */
import { BaseDao } from '../sdk' import { BaseDao } from '../../sdk'
import BaseService from './base.service' import BaseService from './base.service'
import { USER_DB_NAME } from '../db' import { USER_DB_NAME } from '../../db'
import { getToday, formatUpdateUserProjection } from '../utils' import { getToday, formatUpdateUserProjection } from '../../utils'
import { isNewVip } from '../utils/common/userUpdate' import { isNewVip } from '../../utils/common/userUpdate'
import { formatUserNick, formatUpdatedDataByProjection } from '../utils/common/format' import { formatUserNick, formatUpdatedDataByProjection } from '../../utils/common/format'
import { getShopVip, formatVipCbUrl } from '../utils/common/vip' import { getShopVip, formatVipCbUrl } from '../../utils/common/vip'
class UserService extends BaseService { class UserService extends BaseService {
userdao: IBaseDao userdao: IBaseDao
constructor(context: IContext<IParams>) { constructor(context: IContext<IParams>) {
......
/** @format */
export { default as AccessService } from './access.service'
export { default as BaseService } from './base.service'
export { default as UserService } from './user.service'
export { default as AwardsService } from './awards.service'
export { default as TaskService } from './task.service'
export { default as StatService } from './stat.service'
export { default as GameService } from './game.service'
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