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
64737a39
Commit
64737a39
authored
Dec 08, 2020
by
qinhaitao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:
🐛
bug
parent
4add8c34
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
11 deletions
+32
-11
share.controller.ts
v2.0/src/controller/share.controller.ts
+1
-1
errorCode.ts
v2.0/src/errorCode.ts
+4
-0
checkInviteId.ts
v2.0/src/utils/common/check/checkInviteId.ts
+12
-1
index.ts
v2.0/src/utils/common/update/index.ts
+5
-3
updateUserInfo.ts
v2.0/src/utils/common/update/updateUserInfo.ts
+10
-6
No files found.
v2.0/src/controller/share.controller.ts
View file @
64737a39
...
...
@@ -5,7 +5,7 @@ import { resultsModel } from '../sdk'
import
{
CommonUserService
,
CommonStatService
,
CommonTaskService
}
from
'../service/common'
import
{
STAT_TYPE
}
from
'../constants'
import
{
checkActivityTime
,
checkInviteId
,
checkHelpRecord
,
checkNewVip
}
from
'../utils/common/check'
import
{
updateVip
}
from
'../utils/common/update/'
import
{
update
HelpRecord
,
update
Vip
}
from
'../utils/common/update/'
export
default
class
Share
{
/**
...
...
v2.0/src/errorCode.ts
View file @
64737a39
...
...
@@ -87,6 +87,10 @@ export const BusinessError = {
code
:
`430009`
,
defaultMsg
:
`只有新会员才能助力哦~`
},
ERROR_INVITE_TIMES_LIMIT
:
{
code
:
`440001`
,
defaultMsg
:
`今天分享者的助力名额已满,明天再来助力吧`
},
ERROR_DO_TASK
:
{
code
:
`430010`
,
defaultMsg
:
`任务完成失败~`
...
...
v2.0/src/utils/common/check/checkInviteId.ts
View file @
64737a39
...
...
@@ -5,6 +5,7 @@ import { CODE_TYPES } from '../../../errorCode'
import
{
dbFindOne
}
from
'../../common/mongodb'
import
{
USER_DB_NAME
}
from
'../../../db'
import
{
getTodayCompleteTask
}
from
'../task'
import
{
TASK_RATE_TYPE
}
from
'../../../constants'
/**
* 检查inviteId是否合法 返回邀请人的用户信息
...
...
@@ -15,7 +16,7 @@ import { getTodayCompleteTask } from '../task'
*/
export
default
async
function
checkInviteId
(
context
:
IContext
<
{
activityId
:
string
;
inviteId
:
string
}
>
,
{}:
IControllerInfos
{
activityInfo
}:
IControllerInfos
)
{
const
{
openId
,
...
...
@@ -34,8 +35,18 @@ export default async function checkInviteId(
// inviteId的用户信息查询不到, 则inviteId无效
if
(
!
inviteUserInfo
)
return
resultsModel
.
error
(
CODE_TYPES
.
ERROR_INVALID_INVITE_ID
)
const
{
tasks
:
{
invites
}
}
=
activityInfo
const
{
taskRateType
,
times
}
=
invites
const
{
todayCompleteTimes
}
=
getTodayCompleteTask
(
'invites'
,
inviteUserInfo
)
// 助力次数超限制
if
(
taskRateType
===
TASK_RATE_TYPE
.
EVERYDAY
&&
todayCompleteTimes
>=
times
)
{
return
resultsModel
.
error
(
CODE_TYPES
.
ERROR_INVITE_TIMES_LIMIT
)
}
return
{
inviteUserInfo
}
...
...
v2.0/src/utils/common/update/index.ts
View file @
64737a39
...
...
@@ -3,7 +3,7 @@ import updateVip from './updateVip'
import
updateSignTask
from
'./updateSignTask'
import
updateOrderGoods
from
'./updateOrderGoods'
import
updateFirstLoginToday
from
'./updateFirstLoginToday'
import
updateUserInfo
,
{
reduceGameTimes
}
from
'./updateUserInfo'
import
updateUserInfo
,
{
reduceGameTimes
,
updateHelpRecord
}
from
'./updateUserInfo'
const
update
=
{
updateVip
,
...
...
@@ -11,7 +11,8 @@ const update = {
updateOrderGoods
,
updateFirstLoginToday
,
updateUserInfo
,
reduceGameTimes
reduceGameTimes
,
updateHelpRecord
}
export
default
update
...
...
@@ -22,5 +23,6 @@ export {
updateOrderGoods
,
updateFirstLoginToday
,
updateUserInfo
,
reduceGameTimes
reduceGameTimes
,
updateHelpRecord
}
v2.0/src/utils/common/update/updateUserInfo.ts
View file @
64737a39
...
...
@@ -20,12 +20,16 @@ export function reduceGameTimes(needGameTimes: number) {
})
}
export
function
updateHelpRecord
()
{
return
updateUserInfo
({
$where
:
`!!this.inviteId`
,
export
async
function
updateHelpRecord
(
context
:
IContext
<
IParams
>
,
{
userInfo
}:
IControllerInfos
):
Promise
<
IPreUpdateQuery
|
undefined
>
{
const
{
inviteId
}
=
context
.
data
if
(
inviteId
)
return
{}
if
(
!
userInfo
)
return
{}
return
{
$set
:
{
inviteId
}
}
)
}
}
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