Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taobao-mini-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qinhaitao
taobao-mini-template
Commits
16a0fbee
Commit
16a0fbee
authored
Mar 11, 2021
by
王波
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改基础模板
parent
1f2739df
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
70 additions
and
60 deletions
+70
-60
config.json
v2.0/compileServer/config.json
+15
-11
constants.ts
v2.0/src/constants.ts
+0
-1
task.controller.ts
v2.0/src/controller/common/task.controller.ts
+32
-26
growShare.controller.ts
v2.0/src/controller/growShare.controller.ts
+3
-3
growTask.controller.ts
v2.0/src/controller/growTask.controller.ts
+9
-9
index.ts
v2.0/src/service/common/index.ts
+3
-3
activityConfig.d.ts
v2.0/src/typings/activityConfig.d.ts
+1
-2
updateSignGrowTask.ts
v2.0/src/utils/common/update/updateSignGrowTask.ts
+7
-5
No files found.
v2.0/compileServer/config.json
View file @
16a0fbee
...
...
@@ -81,7 +81,8 @@
"type"
:
"common"
,
"name"
:
"registeInfos"
,
"params"
:
[
"vipInfo"
"vipInfo"
,
"task"
]
},
{
...
...
@@ -107,12 +108,12 @@
{
"type"
:
"common"
,
"behave"
:
"update"
,
"name"
:
"updateSignTask"
"name"
:
"updateSign
Grow
Task"
},
{
"type"
:
"common"
,
"behave"
:
"update"
,
"name"
:
"updateOrderGoods"
"name"
:
"update
Grow
OrderGoods"
}
]
}
...
...
@@ -120,11 +121,12 @@
"main"
:
[
{
"type"
:
"common"
,
"service"
:
"task"
,
"service"
:
"
Grow
task"
,
"function"
:
"initTaskList"
,
"params"
:
[
{
"type"
:
"var"
,
"value"
:
"userInfo"
},
{
"type"
:
"var"
,
"value"
:
"activityInfo"
}
{
"type"
:
"var"
,
"value"
:
"activityInfo"
},
{
"type"
:
"var"
,
"value"
:
"task"
}
],
"return"
:
true
}
...
...
@@ -145,7 +147,8 @@
"type"
:
"common"
,
"name"
:
"registeInfos"
,
"params"
:
[
"session"
"session"
,
"task"
]
},
{
...
...
@@ -161,7 +164,7 @@
{
"type"
:
"common"
,
"behave"
:
"check"
,
"name"
:
"checkTaskLimit"
"name"
:
"check
Grow
TaskLimit"
},
{
"type"
:
"common"
,
...
...
@@ -174,12 +177,13 @@
"main"
:
[
{
"type"
:
"common"
,
"service"
:
"task"
,
"service"
:
"
Grow
task"
,
"function"
:
"completeTask"
,
"params"
:
[
{
"type"
:
"var"
,
"value"
:
"context.data.taskType"
},
{
"type"
:
"var"
,
"value"
:
"activityInfo"
},
{
"type"
:
"var"
,
"value"
:
"userInfo"
}
{
"type"
:
"var"
,
"value"
:
"userInfo"
},
{
"type"
:
"var"
,
"value"
:
"task"
}
],
"return"
:
true
}
...
...
@@ -217,7 +221,7 @@
"main"
:
[
{
"type"
:
"common"
,
"service"
:
"task"
,
"service"
:
"
Grow
task"
,
"function"
:
"receiveTaskRewards"
,
"params"
:
[
{
"type"
:
"var"
,
"value"
:
"context.data.taskType"
},
...
...
@@ -259,7 +263,7 @@
},
{
"type"
:
"common"
,
"service"
:
"task"
,
"service"
:
"
Grow
task"
,
"function"
:
"getItemListWithCollectStatus"
,
"params"
:
[
{
"type"
:
"var"
,
"value"
:
"commonBaseGetItemListByIdsResult1"
},
...
...
v2.0/src/constants.ts
View file @
16a0fbee
...
...
@@ -108,7 +108,6 @@ export enum STAT_TYPE {
INITE_SUCCESS
}
// 每次参与消耗次数
export
const
JOIN_NEED_TIMES
=
1
...
...
v2.0/src/controller/common/task.controller.ts
View file @
16a0fbee
/** @format */
import
{
services
,
checkParams
,
registeInfos
,
preCheck
,
preUpdate
}
from
'../../decorator/common'
import
{
checkActivityTime
,
checkTaskLimit
,
checkExchangeCreditsTask
,
checkRemainTimes
}
from
'../../utils/common/check'
import
{
updateVip
,
updateSignTask
,
updateOrderGoods
}
from
'../../utils/common/update'
import
{
checkActivityTime
,
checkGrowTaskLimit
,
checkExchangeCreditsTask
,
checkRemainTimes
}
from
'../../utils/common/check'
import
{
updateVip
,
updateSignGrowTask
,
updateGrowOrderGoods
}
from
'../../utils/common/update'
import
customUtil
from
'../../utils/custom'
import
{
resultsModel
}
from
'../../sdk'
import
{
Common
T
askService
,
CommonBaseService
}
from
'../../service/common'
import
{
Common
Growt
askService
,
CommonBaseService
}
from
'../../service/common'
export
default
class
TaskController
{
/**
* 任务列表
*/
@
checkParams
([
'activityId'
])
@
registeInfos
([
'vipInfo'
])
@
services
([
Common
T
askService
])
@
registeInfos
([
'vipInfo'
,
'task'
])
@
services
([
Common
Growt
askService
])
@
preCheck
([
checkActivityTime
])
@
preUpdate
([
updateVip
,
updateSign
Task
,
update
OrderGoods
])
@
preUpdate
([
updateVip
,
updateSign
GrowTask
,
updateGrow
OrderGoods
])
async
getTaskList
(
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
,
vipInfo
}:
IControllerInfos
,
[
common
TaskService
]:
[
CommonT
askService
]
{
activityInfo
,
userInfo
,
vipInfo
,
task
}:
IControllerInfos
,
[
common
GrowtaskService
]:
[
CommonGrowt
askService
]
)
{
const
common
TaskInitTaskListResult1
=
await
commonTaskService
.
initTaskList
(
userInfo
,
activityInfo
)
const
common
GrowtaskInitTaskListResult1
=
await
commonGrowtaskService
.
initTaskList
(
userInfo
,
activityInfo
,
task
)
return
resultsModel
.
success
({
...
common
T
askInitTaskListResult1
...
common
Growt
askInitTaskListResult1
})
}
/**
* 完成任务
*/
@
checkParams
([
'activityId'
,
'taskType'
])
@
registeInfos
([
'session'
])
@
services
([
Common
T
askService
])
@
preCheck
([
checkActivityTime
,
checkTaskLimit
,
checkExchangeCreditsTask
])
@
registeInfos
([
'session'
,
'task'
])
@
services
([
Common
Growt
askService
])
@
preCheck
([
checkActivityTime
,
check
Grow
TaskLimit
,
checkExchangeCreditsTask
])
async
doCompleteTask
(
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
,
session
}:
IControllerInfos
,
[
common
TaskService
]:
[
CommonT
askService
]
{
activityInfo
,
userInfo
,
session
,
task
}:
IControllerInfos
,
[
common
GrowtaskService
]:
[
CommonGrowt
askService
]
)
{
const
common
TaskCompleteTaskResult1
=
await
commonT
askService
.
completeTask
(
const
common
GrowtaskCompleteTaskResult1
=
await
commonGrowt
askService
.
completeTask
(
context
.
data
.
taskType
,
activityInfo
,
userInfo
userInfo
,
task
)
return
resultsModel
.
success
({
...
common
T
askCompleteTaskResult1
...
common
Growt
askCompleteTaskResult1
})
}
/**
* 领取任务奖励
*/
@
checkParams
([
'activityId'
,
'taskType'
,
'rewardsKey'
])
@
services
([
Common
T
askService
])
@
services
([
Common
Growt
askService
])
@
preCheck
([
checkActivityTime
,
checkRemainTimes
])
async
receiveTaskRewards
(
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
[
common
TaskService
]:
[
CommonT
askService
]
[
common
GrowtaskService
]:
[
CommonGrowt
askService
]
)
{
const
common
TaskReceiveTaskRewardsResult1
=
await
commonT
askService
.
receiveTaskRewards
(
const
common
GrowtaskReceiveTaskRewardsResult1
=
await
commonGrowt
askService
.
receiveTaskRewards
(
context
.
data
.
taskType
,
context
.
data
.
rewardsKey
,
userInfo
)
return
resultsModel
.
success
({
...
common
T
askReceiveTaskRewardsResult1
...
common
Growt
askReceiveTaskRewardsResult1
})
}
/**
...
...
@@ -71,19 +77,19 @@ export default class TaskController {
*/
@
checkParams
([
'activityId'
,
'itemIds'
])
@
registeInfos
([
'session'
])
@
services
([
CommonBaseService
,
Common
T
askService
])
@
services
([
CommonBaseService
,
Common
Growt
askService
])
async
getCollectGoodsList
(
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
,
session
}:
IControllerInfos
,
[
commonBaseService
,
common
TaskService
]:
[
CommonBaseService
,
CommonT
askService
]
[
commonBaseService
,
common
GrowtaskService
]:
[
CommonBaseService
,
CommonGrowt
askService
]
)
{
const
commonBaseGetItemListByIdsResult1
=
await
commonBaseService
.
getItemListByIds
(
context
.
data
.
itemIds
,
session
)
const
common
TaskGetItemListWithCollectStatusResult2
=
await
commonT
askService
.
getItemListWithCollectStatus
(
const
common
GrowtaskGetItemListWithCollectStatusResult2
=
await
commonGrowt
askService
.
getItemListWithCollectStatus
(
commonBaseGetItemListByIdsResult1
,
userInfo
)
return
resultsModel
.
success
({
...
common
T
askGetItemListWithCollectStatusResult2
...
common
Growt
askGetItemListWithCollectStatusResult2
})
}
}
v2.0/src/controller/growShare.controller.ts
View file @
16a0fbee
...
...
@@ -2,7 +2,7 @@
import
{
services
,
preCheck
,
registeInfos
,
preUpdate
,
checkParams
}
from
'../decorator/common'
import
{
resultsModel
}
from
'../sdk'
import
{
CommonStatService
,
CommonGrow
T
askService
}
from
'../service/common'
import
{
CommonStatService
,
CommonGrow
t
askService
}
from
'../service/common'
import
{
STAT_TYPE
}
from
'../constants'
import
{
checkActivityTime
,
checkInviteId
,
checkHelpRecord
,
checkNewVip
}
from
'../utils/common/check'
import
{
updateHelpRecord
,
updateVip
}
from
'../utils/common/update'
...
...
@@ -14,13 +14,13 @@ export default class Share {
*/
@
checkParams
([
'activityId'
,
'inviteId'
])
@
registeInfos
([
'vipInfo'
])
@
services
([
CommonGrow
T
askService
,
CommonStatService
])
@
services
([
CommonGrow
t
askService
,
CommonStatService
])
@
preCheck
([
checkActivityTime
,
checkInviteId
,
checkNewVip
,
checkHelpRecord
])
@
preUpdate
([
updateVip
,
updateHelpRecord
])
async
doHelp
(
context
:
IContext
<
IParams
>
,
{
userInfo
,
activityInfo
}:
IControllerInfos
,
[
growTaskService
,
statService
]:
[
CommonGrow
T
askService
,
CommonStatService
],
[
growTaskService
,
statService
]:
[
CommonGrow
t
askService
,
CommonStatService
],
{
inviteUserInfo
}:
IPreCheckData
)
{
// 如果邀请任务是每日的,则需要请求每日任务信息
...
...
v2.0/src/controller/growTask.controller.ts
View file @
16a0fbee
...
...
@@ -2,7 +2,7 @@
import
{
checkParams
,
services
,
registeInfos
,
preCheck
}
from
'../decorator/common'
import
{
resultsModel
}
from
'../sdk'
import
{
CommonGrow
T
askService
,
CommonBaseService
}
from
'../service/common'
import
{
CommonGrow
t
askService
,
CommonBaseService
}
from
'../service/common'
import
{
ITaskInfo
}
from
'../service/common/task.service'
import
{
checkActivityTime
,
...
...
@@ -20,13 +20,13 @@ export default class Task {
*/
@
checkParams
([
'activityId'
])
@
registeInfos
([
'vipInfo'
,
'task'
])
@
services
([
CommonGrow
T
askService
])
@
services
([
CommonGrow
t
askService
])
@
preCheck
([
checkActivityTime
])
@
preUpdate
([
updateVip
,
updateSignGrowTask
,
updateGrowOrderGoods
])
async
getTaskList
(
context
:
IContext
<
IParams
>
,
{
userInfo
,
activityInfo
,
task
}:
IControllerInfos
,
[
growTaskService
]:
[
CommonGrow
T
askService
]
[
growTaskService
]:
[
CommonGrow
t
askService
]
):
Promise
<
IResult
<
{
list
:
ITaskInfo
[]
}
>>
{
// 读取B端 tasks字段配置自动生成任务列表
const
result
=
await
growTaskService
.
initTaskList
(
userInfo
,
activityInfo
,
task
)
...
...
@@ -44,12 +44,12 @@ export default class Task {
*/
@
checkParams
([
'activityId'
,
'taskType'
,
'itemId?'
,
'credits?'
])
@
registeInfos
([
'session'
,
'task'
])
@
services
([
CommonGrow
T
askService
])
@
services
([
CommonGrow
t
askService
])
@
preCheck
([
checkActivityTime
,
checkGrowTaskLimit
,
checkExchangeCreditsTask
])
async
doCompleteTask
(
context
:
IContext
<
IParams
>
,
{
userInfo
,
activityInfo
,
task
}:
IControllerInfos
,
[
growTaskService
]:
[
CommonGrow
T
askService
]
[
growTaskService
]:
[
CommonGrow
t
askService
]
)
{
const
{
taskType
}
=
context
.
data
...
...
@@ -64,12 +64,12 @@ export default class Task {
* 领取的奖励增加的key值 如: gameTimes 前端传入
*/
@
checkParams
([
'activityId'
,
'taskType'
,
'rewardsKey'
])
@
services
([
CommonGrow
T
askService
])
@
services
([
CommonGrow
t
askService
])
@
preCheck
([
checkActivityTime
,
checkRemainTimes
])
async
receiveTaskRewards
(
context
:
IContext
<
IParams
>
,
{
userInfo
}:
IControllerInfos
,
[
growTaskService
]:
[
CommonGrow
T
askService
]
[
growTaskService
]:
[
CommonGrow
t
askService
]
):
Promise
<
IResult
<
{
rewards
:
number
}
>>
{
const
{
rewardsKey
}
=
context
.
data
const
{
taskType
}
=
context
.
data
...
...
@@ -84,11 +84,11 @@ export default class Task {
*/
@
checkParams
([
'activityId'
,
'itemIds'
])
@
registeInfos
([
'session'
])
@
services
([
CommonBaseService
,
CommonGrow
T
askService
])
@
services
([
CommonBaseService
,
CommonGrow
t
askService
])
async
getCollectGoodsList
(
context
:
IContext
<
IParams
>
,
{
session
,
userInfo
}:
IControllerInfos
,
[
commonBaseService
,
growTaskService
]:
[
CommonBaseService
,
CommonGrow
T
askService
]
[
commonBaseService
,
growTaskService
]:
[
CommonBaseService
,
CommonGrow
t
askService
]
)
{
const
{
itemIds
}
=
context
.
data
...
...
v2.0/src/service/common/index.ts
View file @
16a0fbee
...
...
@@ -8,7 +8,7 @@ import CommonTaskService from './task.service'
import
CommonStatService
from
'./stat.service'
import
CommonGameService
from
'./game.service'
import
CommonSignService
from
'./sign.service'
import
CommonGrow
T
askService
from
'./growTask.service'
import
CommonGrow
t
askService
from
'./growTask.service'
const
common
=
{
CommonAccessService
,
...
...
@@ -19,7 +19,7 @@ const common = {
CommonStatService
,
CommonGameService
,
CommonSignService
,
CommonGrow
T
askService
CommonGrow
t
askService
}
export
default
common
...
...
@@ -33,5 +33,5 @@ export {
CommonStatService
,
CommonGameService
,
CommonSignService
,
CommonGrow
T
askService
CommonGrow
t
askService
}
v2.0/src/typings/activityConfig.d.ts
View file @
16a0fbee
...
...
@@ -2,8 +2,7 @@
type
IActivityInfo
=
ICommonActivityInfo
&
ICustomActivityInfo
interface
ICustomActivityInfo
{
}
interface
ICustomActivityInfo
{}
interface
ICommonActivityInfo
{
_id
?:
string
id
?:
string
...
...
v2.0/src/utils/common/update/updateSignGrowTask.ts
View file @
16a0fbee
...
...
@@ -15,11 +15,13 @@ export default async function updateSignTask(
if
(
todayCompleteTimes
===
0
)
{
const
result
=
await
updateTaskInfo
(
context
,
task
.
_id
,
'sign'
,
{
createTime
:
Date
.
now
()
})
return
result
===
1
?
{
return
result
===
1
?
{
$inc
:
{
'remainTimes.sign'
:
value
||
0
},
}
:
{}
}
}
:
{}
}
return
{}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment