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