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
24566176
Commit
24566176
authored
Mar 11, 2021
by
王波
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改模板接口
parent
16a0fbee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
1 deletion
+39
-1
growShare.controller.ts
v2.0/src/controller/growShare.controller.ts
+1
-1
growTask.service.ts
v2.0/src/service/common/growTask.service.ts
+38
-0
No files found.
v2.0/src/controller/growShare.controller.ts
View file @
24566176
...
...
@@ -24,7 +24,7 @@ export default class Share {
{
inviteUserInfo
}:
IPreCheckData
)
{
// 如果邀请任务是每日的,则需要请求每日任务信息
const
task
=
await
getTask
(
context
,
inviteUserInfo
.
openId
)
const
task
=
await
g
rowTaskService
.
g
etTask
(
context
,
inviteUserInfo
.
openId
)
const
result
=
await
growTaskService
.
completeTask
(
'invites'
,
activityInfo
,
inviteUserInfo
,
task
)
statService
.
addStat
(
STAT_TYPE
.
INITE_SUCCESS
,
userInfo
)
...
...
v2.0/src/service/common/growTask.service.ts
View file @
24566176
...
...
@@ -5,8 +5,10 @@
*/
import
UserService
from
'./user.service'
import
{
BaseDao
}
from
'../../sdk'
import
{
getToday
,
getUserOrderlist
,
generateVipUrl
,
formatVipCbUrl
,
setNewFollowUserData
}
from
'../../utils'
import
{
TASK_RATE_TYPE
,
TASK_STATUS
}
from
'../../constants'
import
{
TASK_DB_NAME
}
from
'../../db'
import
{
getTotalCompleteTask
,
setGrowTaskStatus
,
...
...
@@ -30,8 +32,10 @@ export interface ITaskInfo {
status
:
number
// 任务状态 1未完成 2 待领取 3 已完成
}
export
default
class
TaskService
extends
UserService
{
taskInfodao
:
IBaseDao
constructor
(
context
:
IContext
<
IParams
>
)
{
super
(
context
)
this
.
taskInfodao
=
new
BaseDao
(
context
,
TASK_DB_NAME
)
}
// 根据活动tasks字段渲染任务
...
...
@@ -207,4 +211,38 @@ export default class TaskService extends UserService {
})
}
}
/**
* 获取用户任务参与信息
* @param context
* @param openId
* @param activityId
*/
async
getTask
(
context
:
IContext
<
IParams
>
,
openId
:
string
=
''
,
activityId
?:
string
):
Promise
<
ITask
>
{
activityId
=
activityId
?
activityId
:
context
.
data
.
activityId
openId
=
openId
?
openId
:
context
.
openId
const
createDay
=
getToday
()
//查询每日任务完成记录
const
result
:
ITask
=
await
this
.
taskInfodao
.
findOne
({
openId
,
activityId
,
createDay
})
//如果还没有今天的任务数据,则新增一条用户任务数据
if
(
!
result
)
{
const
insertObj
=
{
openId
,
activityId
,
taskInfo
:
{},
createTime
:
Date
.
now
(),
createDay
:
createDay
}
const
insertResult
=
await
this
.
taskInfodao
.
insertOne
(
insertObj
)
return
{
...
insertObj
,
_id
:
insertResult
}
}
return
result
}
}
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