Commit 8c8a77ad authored by qinhaitao's avatar qinhaitao

feat: 🎸 配置信息

parent 2e6e259c
......@@ -269,6 +269,104 @@
]
}
},
"share": {
"getShareInfo": {
"desc": "获取邀请信息",
"decorators":[
{
"type": "common",
"name": "checkParams",
"params": [
"activityId"
]
}
]
}
},
"login": {
"login":{
"desc":"登录接口, 初始化/更新用户信息",
"decorators":[
{
"type": "common",
"name": "checkParams",
"params": [
"activityId",
"userNick",
"avatar",
"isFollow"
]
},
{
"type": "common",
"name": "noCheckUser","params": [
"activityId"
]
},
{
"type": "common",
"name": "registeInfos",
"params": [
"vipInfo"
]
}
],
"main": [
{
"type": "common",
"service": "user",
"function": "doLogin",
"params": [
{ "type": "var", "value": "userInfo" },
{ "type": "var", "value": "vipInfo" },
{ "type": "var", "value": "activityInfo" }
],
"return": true
},
{
"type": "common",
"service": "access",
"function": "addAccess",
"params": [
{ "type": "var", "value": "commonUserDoLoginResult1" },
{ "type": "var", "value": "vipInfo" }
],
"return": true
}
]
}
},
"base": {
"getActivityBaseInfoById":{
"desc":"活动基本信息",
"decorators":[
{
"type": "common",
"name": "checkParams",
"params": [
"activityId"
]
},
{
"type": "common",
"name": "noCheckUser","params": [
"activityId"
]
}
],
"main": [
{
"type": "common",
"service": "base",
"function": "getBaseInfo",
"params": [
{ "type": "var", "value": "context.data.activityId" }
],
"return": true
}
]
}
},
"stat": {
"addStat": {
"desc": "增加埋点记录",
......
{
"name": "nunjucks-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"gulp": "^4.0.2",
"gulp-nunjucks-render": "^2.2.3",
"gulp-rename": "^2.0.0"
},
"dependencies": {
"fs-extra": "^9.0.1"
}
"name": "nunjucks-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"gulp": "^4.0.2",
"gulp-nunjucks-render": "^2.2.3",
"gulp-rename": "^2.0.0"
},
"dependencies": {
"fs-extra": "^9.0.1"
}
\ No newline at end of file
}
This diff is collapsed.
......@@ -14,9 +14,14 @@ export default class BaseController {
context: IContext<{
activityId: string
}>,
{ activityInfo }: IControllerInfos
{}: IControllerInfos,
[baseService]: [CommonBaseService]
): Promise<IResult<IActivityInfo>> {
return resultsModel.success(activityInfo)
const { activityId } = context.data
const activityInfo = await baseService.getBaseInfo(activityId)
return resultsModel.success({
...activityInfo
})
}
/**
......
/** @format */
import commonDecorator, { services } from '../../decorator/common'
import commonUtilCheck from '../../utils/common/check'
import commonUtilUpdate from '../../utils/common/update'
import customDecorator from '../../decorator/custom'
import customUtil from '../../utils/custom'
import { resultsModel } from '../../sdk'
import { CommonBaseService } from '../../service/common'
export default class BaseController {
/**
* 活动基本信息
*/
@commonDecorator.checkParams(['activityId'])
@commonDecorator.noCheckUser(['activityId'])
@services([CommonBaseService])
async getActivityBaseInfoById(
context: IContext<IParams>,
{ activityInfo, userInfo }: IControllerInfos,
[commonBaseService]: [CommonBaseService]
) {
const commonBaseGetBaseInfoResult1 = await commonBaseService.getBaseInfo(context.data.activityId)
return resultsModel.success({
...commonBaseGetBaseInfoResult1
})
}
}
/** @format */
import commonDecorator, { services } from '../../decorator/common'
import commonUtilCheck from '../../utils/common/check'
import commonUtilUpdate from '../../utils/common/update'
import customDecorator from '../../decorator/custom'
import customUtil from '../../utils/custom'
import { resultsModel } from '../../sdk'
import { CommonUserService, CommonAccessService } from '../../service/common'
export default class LoginController {
/**
* 登录接口, 初始化/更新用户信息
*/
@commonDecorator.checkParams(['activityId', 'userNick', 'avatar', 'isFollow'])
@commonDecorator.noCheckUser(['activityId'])
@commonDecorator.registeInfos(['vipInfo'])
@services([CommonUserService, CommonAccessService])
async login(
context: IContext<IParams>,
{ activityInfo, userInfo, vipInfo }: IControllerInfos,
[commonUserService, commonAccessService]: [CommonUserService, CommonAccessService]
) {
const commonUserDoLoginResult1 = await commonUserService.doLogin(userInfo, vipInfo, activityInfo)
const commonAccessAddAccessResult2 = await commonAccessService.addAccess(commonUserDoLoginResult1, vipInfo)
return resultsModel.success({
...commonUserDoLoginResult1,
...commonAccessAddAccessResult2
})
}
}
......@@ -40,7 +40,7 @@ export default class Share {
context: IContext<IParams>,
{ userInfo, activityInfo, inviteUserInfo }: IdoHelpInfos,
[taskService, statService]: [CommonTaskService, CommonStatService]
): Promise<IResult<boolean>> {
) {
const { openId } = context
const result = await taskService.completeTask('invites', activityInfo, inviteUserInfo)
......
......@@ -44,7 +44,7 @@ export default class Task {
context: IContext<IParams>,
{ userInfo, activityInfo }: IControllerInfos,
[taskService]: [CommonTaskService]
): Promise<IResult<boolean>> {
) {
const { taskType } = context.data
// 更新user表
......
......@@ -3,6 +3,10 @@ import CommonUserController from './controller/common/user.controller'
const CommonUserControllerInstance = new CommonUserController()
import CommonTaskController from './controller/common/task.controller'
const CommonTaskControllerInstance = new CommonTaskController()
import CommonLoginController from './controller/common/login.controller'
const CommonLoginControllerInstance = new CommonLoginController()
import CommonBaseController from './controller/common/base.controller'
const CommonBaseControllerInstance = new CommonBaseController()
import CommonStatController from './controller/common/stat.controller'
const CommonStatControllerInstance = new CommonStatController()
import CustomTest1Controller from './controller/custom/test1.controller'
......@@ -17,6 +21,8 @@ export default {
commonTaskDocompletetask: CommonTaskControllerInstance.doCompleteTask,
commonTaskReceivetaskrewards: CommonTaskControllerInstance.receiveTaskRewards,
commonTaskGetcollectgoodslist: CommonTaskControllerInstance.getCollectGoodsList,
commonLoginLogin: CommonLoginControllerInstance.login,
commonBaseGetactivitybaseinfobyid: CommonBaseControllerInstance.getActivityBaseInfoById,
commonStatAddstat: CommonStatControllerInstance.addStat,
commonStatGetstats: CommonStatControllerInstance.getStats,
customTest1Addstat: CustomTest1ControllerInstance.addStat,
......
......@@ -112,12 +112,7 @@ export default class TaskService extends UserService {
* @returns {boolean}
* @memberof TaskService
*/
async completeTask(
taskType: ITaskType,
activityInfo: IActivityInfo,
userInfo: IUserInfo,
customRecord: Object = {}
): Promise<boolean | ICodeType> {
async completeTask(taskType: ITaskType, activityInfo: IActivityInfo, userInfo: IUserInfo, customRecord: Object = {}) {
const today = getToday()
const rewards = activityInfo?.tasks?.[taskType]?.value || 0
const {
......@@ -134,7 +129,7 @@ export default class TaskService extends UserService {
[`taskInfo.${today}.${taskType}`]: { ...record, createTime: Date.now() }
}
})
return result ? true : CODE_TYPES.ERROR_DO_TASK
return result ? { ok: 1 } : CODE_TYPES.ERROR_DO_TASK
}
// 根据下单下单记录,更新状态
......
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