Commit 71a295eb authored by qinhaitao's avatar qinhaitao

fix: 🐛 follow task

parent e6b2c904
......@@ -121,14 +121,20 @@ export default class TaskService extends UserService {
} = this.context
const record = { itemId, openId: taskType === 'invites' ? openId : undefined, ...customRecord }
const result = await this.updateUser(userInfo._id, {
let updateQuery: IUpdateQuery = {
$inc: {
[`remainTimes.${taskType}`]: rewards
},
$push: {
[`taskInfo.${today}.${taskType}`]: { ...record, createTime: Date.now() }
}
})
}
if (taskType === 'follow') {
updateQuery.$set = {
follow: setNewFollowUserData(userInfo.follow)
}
}
const result = await this.updateUser(userInfo._id, updateQuery)
return result ? { ok: 1 } : CODE_TYPES.ERROR_DO_TASK
}
......
......@@ -32,7 +32,11 @@ export function setNewVipUserData(member: IMemberInfo): IMemberInfo {
}
export function setNewFollowUserData(follow: IFollowInfo): IFollowInfo {
const followBefore = follow.flag
const today = getToday()
if (followBefore || follow.newFollow) {
return follow
}
return {
...follow,
newFollow: true,
......
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