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
46d532cb
Commit
46d532cb
authored
Oct 22, 2020
by
qinhaitao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:
🎸
增加排名
parent
6b9ac21a
Changes
35
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
450 additions
and
363 deletions
+450
-363
constants.d.ts
v2.0/dist/constants.d.ts
+1
-2
constants.js
v2.0/dist/constants.js
+1
-2
constants.js.map
v2.0/dist/constants.js.map
+1
-1
share.controller.d.ts
v2.0/dist/controller/share.controller.d.ts
+2
-2
share.controller.js
v2.0/dist/controller/share.controller.js
+44
-28
share.controller.js.map
v2.0/dist/controller/share.controller.js.map
+1
-1
user.controller.d.ts
v2.0/dist/controller/user.controller.d.ts
+29
-0
user.controller.js
v2.0/dist/controller/user.controller.js
+39
-0
user.controller.js.map
v2.0/dist/controller/user.controller.js.map
+1
-1
index.d.ts
v2.0/dist/index.d.ts
+28
-2
index.js
v2.0/dist/index.js
+3
-2
index.js.map
v2.0/dist/index.js.map
+1
-1
stat.service.d.ts
v2.0/dist/service/stat.service.d.ts
+1
-0
stat.service.js
v2.0/dist/service/stat.service.js
+10
-0
stat.service.js.map
v2.0/dist/service/stat.service.js.map
+1
-1
task.service.js
v2.0/dist/service/task.service.js
+3
-3
task.service.js.map
v2.0/dist/service/task.service.js.map
+1
-1
user.service.d.ts
v2.0/dist/service/user.service.d.ts
+24
-32
user.service.js
v2.0/dist/service/user.service.js
+42
-122
user.service.js.map
v2.0/dist/service/user.service.js.map
+1
-1
index.d.ts
v2.0/dist/utils/index.d.ts
+2
-0
index.js
v2.0/dist/utils/index.js
+2
-0
index.js.map
v2.0/dist/utils/index.js.map
+1
-1
constants.ts
v2.0/src/constants.ts
+1
-2
share.controller.ts
v2.0/src/controller/share.controller.ts
+33
-25
user.controller.ts
v2.0/src/controller/user.controller.ts
+32
-1
errorCode.ts
v2.0/src/errorCode.ts
+4
-0
index.ts
v2.0/src/index.ts
+3
-2
stat.service.ts
v2.0/src/service/stat.service.ts
+4
-0
task.service.ts
v2.0/src/service/task.service.ts
+14
-4
user.service.ts
v2.0/src/service/user.service.ts
+39
-126
dao.d.ts
v2.0/src/typings/dao.d.ts
+2
-0
index.ts
v2.0/src/utils/index.ts
+4
-0
format.ts
v2.0/src/utils/package/format.ts
+33
-0
userUpdate.ts
v2.0/src/utils/package/userUpdate.ts
+42
-0
No files found.
v2.0/dist/constants.d.ts
View file @
46d532cb
...
...
@@ -56,8 +56,7 @@ export declare const SHIP_STATUS: {
HAS_SHIP
:
number
;
};
export
declare
enum
STAT_TYPE
{
CLICK_INVITE
=
1
,
CLICK_FOLLOW_TASK
=
2
INITE_SUCCESS
=
0
}
export
declare
const
appId
=
"${
\
u9700
\
u8981
\
u8865
\
u5145}"
;
export
declare
const
sellerId
=
"${
\
u5546
\
u94FAid}"
;
...
...
v2.0/dist/constants.js
View file @
46d532cb
...
...
@@ -86,8 +86,7 @@ exports.SHIP_STATUS = {
// 记录数据
var
STAT_TYPE
;
(
function
(
STAT_TYPE
)
{
STAT_TYPE
[
STAT_TYPE
[
"CLICK_INVITE"
]
=
1
]
=
"CLICK_INVITE"
;
STAT_TYPE
[
STAT_TYPE
[
"CLICK_FOLLOW_TASK"
]
=
2
]
=
"CLICK_FOLLOW_TASK"
;
STAT_TYPE
[
STAT_TYPE
[
"INITE_SUCCESS"
]
=
0
]
=
"INITE_SUCCESS"
;
})(
STAT_TYPE
=
exports
.
STAT_TYPE
||
(
exports
.
STAT_TYPE
=
{}));
exports
.
appId
=
'${需要补充}'
;
// 商铺id 拼接vip链接用
...
...
v2.0/dist/constants.js.map
View file @
46d532cb
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;AAEd,8CAA2B;AAE3B,cAAc;AACD,QAAA,OAAO,GAAG;IACrB,6CAA6C,EAAE,kBAAkB;IACjE,yBAAyB,EAAE,iBAAiB;IAC5C,oBAAoB,EAAE,aAAa;IACnC,sCAAsC,EAAE,gBAAgB;IACxD,iBAAiB,EAAE,cAAc;IACjC,YAAY,EAAE,YAAY;IAC1B,iBAAiB,EAAE,iBAAiB;CACrC,CAAA;AAED,SAAS;AACI,QAAA,WAAW,GAAG;IACzB,MAAM;IACN,SAAS,EAAE,CAAC;IACZ,MAAM;IACN,UAAU,EAAE,CAAC;IACb,OAAO;IACP,OAAO,EAAE,CAAC;IACV,OAAO;IACP,IAAI,EAAE,CAAC;IACP,MAAM;IACN,OAAO,EAAE,CAAC;IACV,OAAO;IACP,KAAK,EAAE,CAAC;CACT,CAAA;AAED,OAAO;AACM,QAAA,2BAA2B,GAAa;IACnD,wBAAwB;IACxB,uBAAuB;IACvB,0BAA0B;IAC1B,oBAAoB;IACpB,gBAAgB;IAChB,qBAAqB;CACtB,CAAA;AAcD,UAAU;AACG,QAAA,cAAc,GAAG;IAC5B,OAAO,EAAE,CAAC;IACV,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,CAAC;CACX,CAAA;AAED,MAAM;AACO,QAAA,WAAW,GAAG;IACzB,OAAO,EAAE,CAAC;IACV,YAAY,EAAE,CAAC;IACf,IAAI,EAAE,CAAC,CAAC,MAAM;CACf,CAAA;AAED,OAAO;AACM,QAAA,UAAU,GAAG;IACxB,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;CACV,CAAA;AAED,OAAO;AACM,QAAA,eAAe,GAAG;IAC7B,OAAO,EAAE,CAAC;IACV,WAAW,EAAE,CAAC,CAAC,KAAK;CACrB,CAAA;AAED,WAAW;AACX,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,6CAAS,CAAA;IACT,mDAAY,CAAA;AACd,CAAC,EAHW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAGrB;AAED,MAAM;AACO,QAAA,WAAW,GAAG;IACzB,UAAU,EAAE,CAAC;IACb,OAAO,EAAE,CAAC;IACV,QAAQ,EAAE,CAAC;CACZ,CAAA;AAED,OAAO;AACP,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,yDAAgB,CAAA;IAChB,mEAAiB,CAAA;AACnB,CAAC,EAHW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAGpB;AAEY,QAAA,KAAK,GAAG,SAAS,CAAA;AAE9B,gBAAgB;AACH,QAAA,QAAQ,GAAG,SAAS,CAAA;AAEjC,cAAc;AACD,QAAA,UAAU,GAAW,qBAAmB,aAAO,CAAA"}
\ No newline at end of file
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;AAEd,8CAA2B;AAE3B,cAAc;AACD,QAAA,OAAO,GAAG;IACrB,6CAA6C,EAAE,kBAAkB;IACjE,yBAAyB,EAAE,iBAAiB;IAC5C,oBAAoB,EAAE,aAAa;IACnC,sCAAsC,EAAE,gBAAgB;IACxD,iBAAiB,EAAE,cAAc;IACjC,YAAY,EAAE,YAAY;IAC1B,iBAAiB,EAAE,iBAAiB;CACrC,CAAA;AAED,SAAS;AACI,QAAA,WAAW,GAAG;IACzB,MAAM;IACN,SAAS,EAAE,CAAC;IACZ,MAAM;IACN,UAAU,EAAE,CAAC;IACb,OAAO;IACP,OAAO,EAAE,CAAC;IACV,OAAO;IACP,IAAI,EAAE,CAAC;IACP,MAAM;IACN,OAAO,EAAE,CAAC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file @
46d532cb
/** @format */
import
{
UserService
,
Task
Service
}
from
'../service'
;
import
{
UserService
,
AccessService
,
TaskService
,
Stat
Service
}
from
'../service'
;
export
default
class
Share
{
/**
* 获取邀请信息
...
...
@@ -15,5 +15,5 @@ export default class Share {
doHelp
(
context
:
IContext
<
{
activityId
:
string
;
inviteId
:
string
;
}
>
,
{
userInfo
,
vipInfo
,
activityInfo
}:
IControllerInfos
,
[
userService
,
taskService
]:
[
UserService
,
Task
Service
]):
Promise
<
IResult
<
boolean
>>
;
}
>
,
{
userInfo
,
vipInfo
,
activityInfo
}:
IControllerInfos
,
[
userService
,
taskService
,
statService
]:
[
UserService
,
TaskService
,
StatService
,
Access
Service
]):
Promise
<
IResult
<
boolean
>>
;
}
v2.0/dist/controller/share.controller.js
View file @
46d532cb
...
...
@@ -53,6 +53,7 @@ var sdk_1 = require("../sdk");
var
utils_1
=
require
(
"../utils"
);
var
service_1
=
require
(
"../service"
);
var
registeInfos_1
=
require
(
"../decorator/registeInfos"
);
var
constants_2
=
require
(
"../constants"
);
var
Share
=
/** @class */
(
function
()
{
function
Share
()
{
}
...
...
@@ -76,14 +77,14 @@ var Share = /** @class */ (function () {
*/
Share
.
prototype
.
doHelp
=
function
(
context
,
_a
,
_b
)
{
var
userInfo
=
_a
.
userInfo
,
vipInfo
=
_a
.
vipInfo
,
activityInfo
=
_a
.
activityInfo
;
var
userService
=
_b
[
0
],
taskService
=
_b
[
1
];
var
userService
=
_b
[
0
],
taskService
=
_b
[
1
]
,
statService
=
_b
[
2
]
;
return
__awaiter
(
this
,
void
0
,
void
0
,
function
()
{
var
inviteId
,
openId
,
inviteUserInfo
,
taskInfo
,
tasks
,
value
,
isNewVip
,
isValidShare
,
today
,
inviteUserId
;
var
_
c
;
return
__generator
(
this
,
function
(
_
d
)
{
switch
(
_
d
.
label
)
{
var
_c
,
inviteId
,
activityId
,
openId
,
inviteUserInfo
,
userInviteSuccessCount
,
tasks
,
value
,
isNewVip
,
isValidShare
,
today
,
inviteUserId
;
var
_
d
;
return
__generator
(
this
,
function
(
_
e
)
{
switch
(
_
e
.
label
)
{
case
0
:
inviteId
=
context
.
data
.
invite
Id
;
_c
=
context
.
data
,
inviteId
=
_c
.
inviteId
,
activityId
=
_c
.
activity
Id
;
openId
=
context
.
openId
;
if
(
openId
===
inviteId
)
return
[
2
/*return*/
,
sdk_1
.
resultsModel
.
error
(
constants_1
.
CODE_TYPES
.
ERROR_NO_INVITE_SELF
)];
...
...
@@ -91,52 +92,66 @@ var Share = /** @class */ (function () {
// inviteId的用户信息查询不到, 则inviteId无效
];
case
1
:
inviteUserInfo
=
_
d
.
sent
();
inviteUserInfo
=
_
e
.
sent
();
// inviteId的用户信息查询不到, 则inviteId无效
if
(
!
inviteUserInfo
)
return
[
2
/*return*/
,
sdk_1
.
resultsModel
.
error
(
constants_1
.
CODE_TYPES
.
ERROR_INVALID_INVITE_ID
)];
taskInfo
=
taskService
.
getCompleteTaskByUserTaskInfo
(
'invites'
,
inviteUserInfo
).
taskInfo
;
// 邀请成功列表有该用户信息
if
(
taskInfo
.
some
(
function
(
v
)
{
return
v
.
openId
===
openId
;
}))
{
return
[
2
/*return*/
,
sdk_1
.
resultsModel
.
error
(
constants_1
.
CODE_TYPES
.
ERROR_AREADY_INVITE_SUCCESS
)];
}
return
[
2
/*return*/
,
sdk_1
.
resultsModel
.
error
(
constants_1
.
CODE_TYPES
.
ERROR_INVALID_INVITE_ID
)
// 邀请成功有该用户信息
];
return
[
4
/*yield*/
,
statService
.
getStatCountByquery
({
activityId
:
activityId
,
openId
:
openId
,
type
:
constants_2
.
STAT_TYPE
.
INITE_SUCCESS
})];
case
2
:
userInviteSuccessCount
=
_e
.
sent
();
if
(
userInviteSuccessCount
)
return
[
2
/*return*/
,
sdk_1
.
resultsModel
.
error
(
constants_1
.
CODE_TYPES
.
ERROR_AREADY_INVITE_SUCCESS
)
// 获取活动基本信息
];
tasks
=
activityInfo
.
tasks
;
value
=
tasks
.
invites
.
value
;
isNewVip
=
u
serService
.
checkNewVip
(
userInfo
,
vipInfo
);
if
(
!
(
isNewVip
&&
!
userInfo
.
member
.
newMember
))
return
[
3
/*break*/
,
3
];
isNewVip
=
u
tils_1
.
checkNewVip
(
userInfo
,
vipInfo
);
if
(
!
(
isNewVip
&&
!
userInfo
.
member
.
newMember
))
return
[
3
/*break*/
,
4
];
return
[
4
/*yield*/
,
userService
.
updateUser
(
userInfo
.
_id
,
{
$set
:
{
member
:
u
serService
.
setNewVipUserData
(
userInfo
.
member
)
member
:
u
tils_1
.
setNewVipUserData
(
userInfo
.
member
)
}
})];
case
2
:
_d
.
sent
();
_d
.
label
=
3
;
case
3
:
_e
.
sent
();
_e
.
label
=
4
;
case
4
:
isValidShare
=
[
isNewVip
].
every
(
function
(
v
)
{
return
!!
v
;
});
today
=
utils_1
.
getToday
();
if
(
!
isValidShare
)
return
[
3
/*break*/
,
5
];
if
(
!
isValidShare
)
return
[
2
/*return*/
,
sdk_1
.
resultsModel
.
error
(
constants_1
.
CODE_TYPES
.
ERROR_INVITE
)
// 成功邀请
];
inviteUserId
=
inviteUserInfo
.
_id
;
// 增加邀请人的待领取次数和邀请记录
return
[
4
/*yield*/
,
userService
.
updateUser
(
inviteUserId
,
{
$inc
:
{
'remainTimes.invites'
:
value
},
$push
:
(
_
c
=
{},
_
c
[
"taskInfo."
+
today
+
".invites"
]
=
{
openId
:
openId
,
createTime
:
Date
.
now
()
},
_
c
)
$push
:
(
_
d
=
{},
_
d
[
"taskInfo."
+
today
+
".invites"
]
=
{
openId
:
openId
,
createTime
:
Date
.
now
()
},
_
d
)
})];
case
4
:
case
5
:
// 增加邀请人的待领取次数和邀请记录
_d
.
sent
();
_d
.
label
=
5
;
case
5
:
return
[
2
/*return*/
,
sdk_1
.
resultsModel
.
success
(
true
)];
_e
.
sent
();
return
[
4
/*yield*/
,
statService
.
addStat
(
constants_2
.
STAT_TYPE
.
INITE_SUCCESS
,
userInfo
)];
case
6
:
_e
.
sent
();
return
[
2
/*return*/
,
sdk_1
.
resultsModel
.
success
(
true
)];
}
});
});
};
__decorate
([
check_1
.
paramsCheck
([
'activityId'
]),
check_1
.
userCheck
({
intercept
:
true
}),
registeInfos_1
.
registeInfos
([
'userInfo'
,
'activityInfo'
]),
services_1
.
services
([
service_1
.
UserService
]),
__metadata
(
"design:type"
,
Function
),
...
...
@@ -146,8 +161,9 @@ var Share = /** @class */ (function () {
__decorate
([
check_1
.
paramsCheck
([
'activityId'
,
'inviteId'
]),
check_1
.
activityTimeCheck
,
check_1
.
userCheck
({
intercept
:
true
}),
registeInfos_1
.
registeInfos
([
'userInfo'
,
'vipInfo'
,
'activityInfo'
]),
services_1
.
services
([
service_1
.
UserService
,
service_1
.
TaskService
,
service_1
.
AccessService
]),
services_1
.
services
([
service_1
.
UserService
,
service_1
.
TaskService
,
service_1
.
StatService
,
service_1
.
AccessService
]),
__metadata
(
"design:type"
,
Function
),
__metadata
(
"design:paramtypes"
,
[
Object
,
Object
,
Array
]),
__metadata
(
"design:returntype"
,
Promise
)
...
...
v2.0/dist/controller/share.controller.js.map
View file @
46d532cb
{"version":3,"file":"share.controller.js","sourceRoot":"","sources":["../../src/controller/share.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,4CAA2C;AAC3C,4CAA8E;AAC9E,kDAAgD;AAEhD,8BAAqC;AACrC,kCAAmC;AACnC,sCAAoE;AACpE,0DAAwD;AAExD;IAAA;IA8FA,CAAC;IA7FC;;OAEG;IAIG,4BAAY,GAAlB,UACE,OAEE,EACF,EAA8B;YAA5B,QAAQ,cAAA;;;;gBAOO,OAAO,GACpB,QAAQ,oBADY,CACZ;gBAEZ,sBAAO,kBAAY,CAAC,OAAO,CAAC;wBAC1B,OAAO,EAAE,OAAO;qBACjB,CAAC,EAAA;;;KACH;IACD;;OAEG;IAKG,sBAAM,GAAZ,UACE,OAGE,EACF,EAAqD,EACrD,EAAsD;YADpD,QAAQ,c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SAIE,CAAA;;;wBAIE,YAAY,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,CAAC,EAAH,CAAG,CAAC,CAAA;wBAEzC,KAAK,GAAG,gBAAQ,EAAE,CAAA;6BACpB,YAAY,EAAZ,wBAAY;wBACD,YAAY,GAAK,cAAc,IAAnB,CAAmB;wBAC5C,mBAAmB;wBACnB,qBAAM,WAAW,CAAC,UAAU,CAAC,YAAY,EAAE;gCACzC,IAAI,EAAE;oCACJ,qBAAqB,EAAE,KAAK;iCAC7B;gCACD,KAAK;oCACH,GAAC,cAAY,KAAK,aAAU,IAAG,EAAE,MAAM,QAAA,EAAE,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE;uCAClE;6BACF,CAAC,EAAA;;wBARF,mBAAmB;wBACnB,SAOE,CAAA;;4BAGJ,sBAAO,kBAAY,CAAC,OAAO,CAAC,IAAI,CAAC,EAAA;;;;KAClC;IAtFD;QAHC,mBAAW,CAAC,CAAC,YAAY,CAAC,CAAC;QAC3B,2BAAY,CAAC,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QAC1C,mBAAQ,CAAC,CAAC,qBAAW,CAAC,CAAC;;;;6CAkBvB;IAQD;QAJC,mBAAW,CAAC,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QACvC,yBAAiB;QACjB,2BAAY,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;QACrD,mBAAQ,CAAC,CAAC,qBAAW,EAAE,qBAAW,EAAE,uBAAa,CAAC,CAAC;;;;uCA8DnD;IACH,YAAC;CAAA,AA9FD,IA8FC;kBA9FoB,KAAK"}
\ No newline at end of file
{"version":3,"file":"share.controller.js","sourceRoot":"","sources":["../../src/controller/share.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,4CAA2C;AAC3C,4CAA8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ClC;IA5FD;QAJC,mBAAW,CAAC,CAAC,YAAY,CAAC,CAAC;QAC3B,iBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC9B,2BAAY,CAAC,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QAC1C,mBAAQ,CAAC,CAAC,qBAAW,CAAC,CAAC;;;;6CAkBvB;IASD;QALC,mBAAW,CAAC,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QACvC,yBAAiB;QACjB,iBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC9B,2BAAY,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;QACrD,mBAAQ,CAAC,CAAC,qBAAW,EAAE,qBAAW,EAAE,qBAAW,EAAE,uBAAa,CAAC,CAAC;;;;uCAmEhE;IACH,YAAC;CAAA,AArGD,IAqGC;kBArGoB,KAAK"}
\ No newline at end of file
v2.0/dist/controller/user.controller.d.ts
View file @
46d532cb
...
...
@@ -23,4 +23,33 @@ export default class User {
* 获取会员信息
*/
getVipInfo
(
context
:
IContext
<
IVipParams
>
,
{
session
,
activityUserNick
}:
IControllerInfos
):
Promise
<
IResult
<
IVipInfo
>>
;
/**
* 获取排行榜
*/
getRankList
(
context
:
IContext
<
{
activityId
:
string
;
}
>
,
{
userInfo
}:
IControllerInfos
,
[
userService
]:
[
UserService
]):
Promise
<
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
{
userNick
:
string
;
avatar
:
string
;
rank
:
number
;
score
:
any
;
list
:
{
userNick
:
string
;
rank
:
number
;
_id
?:
string
;
id
?:
string
;
activityId
:
string
;
avatar
:
string
;
openId
:
string
;
createTime
:
number
;
updateTime
:
number
;
createDay
?:
string
;
inviteId
?:
string
;
member
?:
IMemberInfo
;
follow
?:
IFollowInfo
;
remainTimes
?:
IRemainTimesInfo
;
taskInfo
?:
object
;
login
?:
object
;
}[];
},
true
>>
;
}
v2.0/dist/controller/user.controller.js
View file @
46d532cb
...
...
@@ -106,6 +106,37 @@ var User = /** @class */ (function () {
});
});
};
/**
* 获取排行榜
*/
User
.
prototype
.
getRankList
=
function
(
context
,
_a
,
_b
)
{
var
userInfo
=
_a
.
userInfo
;
var
userService
=
_b
[
0
];
return
__awaiter
(
this
,
void
0
,
void
0
,
function
()
{
var
sortKey
,
sortTime
,
userNick
,
avatar
,
rank
,
list
;
return
__generator
(
this
,
function
(
_c
)
{
switch
(
_c
.
label
)
{
case
0
:
sortKey
=
'score'
;
sortTime
=
'updateScoreTime'
;
userNick
=
userInfo
.
userNick
,
avatar
=
userInfo
.
avatar
;
return
[
4
/*yield*/
,
userService
.
getMyRank
(
sortKey
,
sortTime
,
userInfo
[
sortKey
])];
case
1
:
rank
=
_c
.
sent
();
return
[
4
/*yield*/
,
userService
.
getRank
(
sortKey
,
sortTime
,
200
)];
case
2
:
list
=
_c
.
sent
();
return
[
2
/*return*/
,
sdk_1
.
resultsModel
.
success
({
userNick
:
userNick
,
avatar
:
avatar
,
rank
:
rank
,
score
:
userInfo
[
sortKey
],
list
:
list
})];
}
});
});
};
__decorate
([
decorator_1
.
paramsCheck
([
'activityId'
,
'userNick'
,
'avatar'
,
'isFollow'
]),
decorator_1
.
activityTimeCheck
,
...
...
@@ -123,6 +154,14 @@ var User = /** @class */ (function () {
__metadata
(
"design:paramtypes"
,
[
Object
,
Object
]),
__metadata
(
"design:returntype"
,
Promise
)
],
User
.
prototype
,
"getVipInfo"
,
null
);
__decorate
([
decorator_1
.
paramsCheck
([
'activityId'
]),
decorator_1
.
userCheck
({
intercept
:
true
}),
decorator_1
.
services
([
service_1
.
UserService
]),
__metadata
(
"design:type"
,
Function
),
__metadata
(
"design:paramtypes"
,
[
Object
,
Object
,
Array
]),
__metadata
(
"design:returntype"
,
Promise
)
],
User
.
prototype
,
"getRankList"
,
null
);
return
User
;
}());
exports
.
default
=
User
;
...
...
v2.0/dist/controller/user.controller.js.map
View file @
46d532cb
{"version":3,"file":"user.controller.js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CAAC;QAC7D,6BAAiB;QACjB,wBAAY,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;QACrD,oBAAQ,CAAC,CAAC,qBAAW,EAAE,uBAAa,CAAC,CAAC;;;;qCAoBtC;IAOD;QAHC,uBAAW,CAAC,CAAC,YAAY,CAAC,CAAC;QAC3B,wBAAY,CAAC,CAAC,SAAS,CAAC,CAAC;QACzB,oBAAQ,CAAC,EAAE,CAAC;;;;0CAUZ;IAQD;QAHC,uBAAW,CAAC,CAAC,YAAY,CAAC,CAAC;QAC3B,qBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC9B,oBAAQ,CAAC,CAAC,qBAAW,CAAC,CAAC;;;;2CAwBvB;IACH,WAAC;CAAA,AA3ED,IA2EC;kBA3EoB,IAAI"}
\ No newline at end of file
v2.0/dist/index.d.ts
View file @
46d532cb
...
...
@@ -17,12 +17,38 @@ declare const _default: {
list
:
IAwards
[];
}
>>
;
receiveObjectPrize
:
(
context
:
IContext
<
import
(
"./controller/awards.controller"
).
IReceiveOjectParams
>
,
{}:
{},
[
awardSer
]:
[
import
(
"./service"
).
AwardsService
])
=>
Promise
<
IResult
<
boolean
>>
;
receiveEnamePrize
:
(
context
:
IContext
<
import
(
"./controller/awards.controller"
).
IReceiveEnameParams
>
,
{}:
{},
[
awardSer
]:
[
import
(
"./service"
).
AwardsService
])
=>
Promise
<
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
string
|
boolean
|
object
|
string
[]
|
object
[]
|
number
[],
false
>
|
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
import
(
"taobao-mini-sdk/lib/utils/codetypes"
).
CodeType
|
IAwards
,
true
>>
;
receiveEnamePrize
:
(
context
:
IContext
<
import
(
"./controller/awards.controller"
).
IReceiveEnameParams
>
,
{}:
{},
[
awardSer
]:
[
import
(
"./service"
).
AwardsService
])
=>
Promise
<
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
string
|
boolean
|
object
|
string
[]
|
object
[]
|
number
[],
false
>
|
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
IAwards
|
import
(
"taobao-mini-sdk/lib/utils/codetypes"
).
CodeType
,
true
>>
;
doHelp
:
(
context
:
IContext
<
{
activityId
:
string
;
inviteId
:
string
;
}
>
,
{
userInfo
,
vipInfo
,
activityInfo
}:
IControllerInfos
,
[
userService
,
taskService
]:
[
import
(
"./service/user.service"
).
default
,
import
(
"./service"
).
Task
Service
])
=>
Promise
<
IResult
<
boolean
>>
;
}
>
,
{
userInfo
,
vipInfo
,
activityInfo
}:
IControllerInfos
,
[
userService
,
taskService
,
statService
]:
[
import
(
"./service/user.service"
).
default
,
import
(
"./service"
).
TaskService
,
import
(
"./service"
).
StatService
,
import
(
"./service"
).
Access
Service
])
=>
Promise
<
IResult
<
boolean
>>
;
getStats
:
(
context
:
IContext
<
import
(
"./controller/stat.controller"
).
IGetStatsParams
>
)
=>
Promise
<
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
string
|
boolean
|
object
|
string
[]
|
object
[]
|
number
[],
false
>
|
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
any
,
true
>>
;
addStat
:
(
context
:
IContext
<
import
(
"./controller/stat.controller"
).
IAddStatsParams
>
,
{
userInfo
}:
IControllerInfos
,
[
statService
]:
[
import
(
"./service"
).
StatService
])
=>
Promise
<
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
boolean
,
true
>>
;
getRankList
:
(
context
:
IContext
<
{
activityId
:
string
;
}
>
,
{
userInfo
}:
IControllerInfos
,
[
userService
]:
[
import
(
"./service/user.service"
).
default
])
=>
Promise
<
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
{
userNick
:
string
;
avatar
:
string
;
rank
:
number
;
score
:
any
;
list
:
{
userNick
:
string
;
rank
:
number
;
_id
?:
string
;
id
?:
string
;
activityId
:
string
;
avatar
:
string
;
openId
:
string
;
createTime
:
number
;
updateTime
:
number
;
createDay
?:
string
;
inviteId
?:
string
;
member
?:
IMemberInfo
;
follow
?:
IFollowInfo
;
remainTimes
?:
IRemainTimesInfo
;
taskInfo
?:
object
;
login
?:
object
;
}[];
},
true
>>
;
};
export
default
_default
;
v2.0/dist/index.js
View file @
46d532cb
...
...
@@ -8,7 +8,7 @@ var base_controller_1 = require("./controller/base.controller");
var
awards_controller_1
=
require
(
"./controller/awards.controller"
);
var
share_controller_1
=
require
(
"./controller/share.controller"
);
var
stat_controller_1
=
require
(
"./controller/stat.controller"
);
var
_a
=
new
user_controller_1
.
default
(),
login
=
_a
.
login
,
getVipInfo
=
_a
.
getVipInfo
;
var
_a
=
new
user_controller_1
.
default
(),
login
=
_a
.
login
,
getVipInfo
=
_a
.
getVipInfo
,
getRankList
=
_a
.
getRankList
;
var
_b
=
new
task_controller_1
.
default
(),
getTaskList
=
_b
.
getTaskList
,
receiveTaskRewards
=
_b
.
receiveTaskRewards
,
getCollectGoodsList
=
_b
.
getCollectGoodsList
,
// 获取收藏商品列表,包含收藏状态
doFollowTask
=
_b
.
doFollowTask
,
doJumpLinkTask
=
_b
.
doJumpLinkTask
,
doBrowseGoodsTask
=
_b
.
doBrowseGoodsTask
,
doCollectGoodsTask
=
_b
.
doCollectGoodsTask
,
doExchangeCreditsTask
=
_b
.
doExchangeCreditsTask
;
var
_c
=
new
base_controller_1
.
default
(),
getActivityBaseInfoById
=
_c
.
getActivityBaseInfoById
,
getItemListByItemIds
=
_c
.
getItemListByItemIds
;
...
...
@@ -26,6 +26,7 @@ exports.default = {
receiveEnamePrize
:
receiveEnamePrize
,
doHelp
:
doHelp
,
getStats
:
getStats
,
addStat
:
addStat
addStat
:
addStat
,
getRankList
:
getRankList
};
//# sourceMappingURL=index.js.map
\ No newline at end of file
v2.0/dist/index.js.map
View file @
46d532cb
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,cAAc;;AAE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AAvD,KAAK,WAAA,EAAE,UAAU,gBAAA,EAAE,WAAW,iBAAyB,CAAA;AACzD,IAAA,KASF,IAAI,yBAAc,EAAE,EARtB,WAAW,iBAAA,EACX,kBAAkB,wBAAA,EAClB,mBAAmB,yBAAA,EAAE,kBAAkB;AACvC,YAAY,kBAAA,EACZ,cAAc,oBAAA,EACd,iBAAiB,uBAAA,EACjB,kBAAkB,wBAAA,EAClB,qBAAqB,2BACC,CAAA;AAElB,IAAA,KAAoD,IAAI,yBAAc,EAAE,EAAtE,uBAAuB,6BAAA,EAAE,oBAAoB,0BAAyB,CAAA;AAExE,IAAA,KAA8E,IAAI,2BAAgB,EAAE,EAAlG,cAAc,oBAAA,EAAE,kBAAkB,wBAAA,EAAE,iBAAiB,uBAAA,EAAE,gBAAgB,sBAA2B,CAAA;AAElG,IAAA,MAAM,GAAK,IAAI,0BAAe,EAAE,OAA1B,CAA0B;AAElC,IAAA,KAAwB,IAAI,yBAAc,EAAE,EAA1C,QAAQ,cAAA,EAAE,OAAO,aAAyB,CAAA;AAElD,kBAAe;IACb,KAAK,OAAA;IACL,UAAU,YAAA;IACV,WAAW,aAAA;IACX,kBAAkB,oBAAA;IAClB,uBAAuB,yBAAA;IACvB,cAAc,gBAAA;IACd,kBAAkB,oBAAA;IAClB,iBAAiB,mBAAA;IACjB,MAAM,QAAA;IACN,QAAQ,UAAA;IACR,OAAO,SAAA;IACP,WAAW,aAAA;CACZ,CAAA"}
\ No newline at end of file
v2.0/dist/service/stat.service.d.ts
View file @
46d532cb
...
...
@@ -17,4 +17,5 @@ export default class StatService {
* @memberof StatService
*/
addStat
(
type
:
number
,
userInfo
?:
IUserInfo
,
customStatData
?:
object
):
Promise
<
string
>
;
getStatCountByquery
(
query
:
IMongoQuery
):
Promise
<
number
>
;
}
v2.0/dist/service/stat.service.js
View file @
46d532cb
...
...
@@ -89,6 +89,16 @@ var StatService = /** @class */ (function () {
});
});
};
StatService
.
prototype
.
getStatCountByquery
=
function
(
query
)
{
return
__awaiter
(
this
,
void
0
,
void
0
,
function
()
{
return
__generator
(
this
,
function
(
_a
)
{
switch
(
_a
.
label
)
{
case
0
:
return
[
4
/*yield*/
,
this
.
statdao
.
count
(
query
)];
case
1
:
return
[
2
/*return*/
,
_a
.
sent
()];
}
});
});
};
return
StatService
;
}());
exports
.
default
=
StatService
;
...
...
v2.0/dist/service/stat.service.js.map
View file @
46d532cb
{"version":3,"file":"stat.service.js","sourceRoot":"","sources":["../../src/service/stat.service.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,8BAAgC;AAChC,4BAAoC;AACpC,kCAAmC;AACnC,0CAAwC;AAExC;IAGE,qBAAY,OAA0B;QACpC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,aAAO,CAAC,OAAO,EAAE,iBAAY,CAAC,CAAA;IACnD,CAAC;IAED;;;;;;;;OAQG;IACG,6BAAO,GAAb,UAAc,IAAY,EAAE,QAAqC,EAAE,cAA2B;QAAlE,yBAAA,EAAA,WAAsB,EAAe;QAAE,+BAAA,EAAA,mBAA2B;;;;;;wBACpF,MAAM,GAAK,IAAI,CAAC,OAAO,OAAjB,CAAiB;wBACvB,UAAU,GAAK,IAAI,CAAC,OAAO,CAAC,IAAI,WAAtB,CAAsB;wBAChC,QAAQ,GAAK,QAAQ,SAAb,CAAa;wBACtB,qBAAM,IAAI,CAAC,OAAO,CAAC,SAAS,qBACjC,UAAU,YAAA;gCACV,IAAI,MAAA,EACJ,QAAQ,EAAE,qBAAS,CAAC,IAAI,CAAC,EACzB,QAAQ,UAAA;gCACR,MAAM,QAAA,IACH,cAAc,KACjB,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,EACtB,SAAS,EAAE,gBAAQ,EAAE,IACrB,EAAA;4BATF,sBAAO,SASL,EAAA;;;;KACH;IACH,kBAAC;AAAD,CAAC,AAhCD,IAgCC"}
\ No newline at end of file
{"version":3,"file":"stat.service.js","sourceRoot":"","sources":["../../src/service/stat.service.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,8BAAgC;AAChC,4BAAoC;AACpC,kCAAmC;AACnC,0CAAwC;AAExC;IAGE,qBAAY,OAA0B;QACpC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,aAAO,CAAC,OAAO,EAAE,iBAAY,CAAC,CAAA;IACnD,CAAC;IAED;;;;;;;;OAQG;IACG,6BAAO,GAAb,UAAc,IAAY,EAAE,QAAqC,EAAE,cAA2B;QAAlE,yBAAA,EAAA,WAAsB,EAAe;QAAE,+BAAA,EAAA,mBAA2B;;;;;;wBACpF,MAAM,GAAK,IAAI,CAAC,OAAO,OAAjB,CAAiB;wBACvB,UAAU,GAAK,IAAI,CAAC,OAAO,CAAC,IAAI,WAAtB,CAAsB;wBAChC,QAAQ,GAAK,QAAQ,SAAb,CAAa;wBACtB,qBAAM,IAAI,CAAC,OAAO,CAAC,SAAS,qBACjC,UAAU,YAAA;gCACV,IAAI,MAAA,EACJ,QAAQ,EAAE,qBAAS,CAAC,IAAI,CAAC,EACzB,QAAQ,UAAA;gCACR,MAAM,QAAA,IACH,cAAc,KACjB,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,EACtB,SAAS,EAAE,gBAAQ,EAAE,IACrB,EAAA;4BATF,sBAAO,SASL,EAAA;;;;KACH;IAEK,yCAAmB,GAAzB,UAA0B,KAAkB;;;;4BACnC,qBAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAAA;4BAAtC,sBAAO,SAA+B,EAAA;;;;KACvC;IACH,kBAAC;AAAD,CAAC,AApCD,IAoCC"}
\ No newline at end of file
v2.0/dist/service/task.service.js
View file @
46d532cb
...
...
@@ -115,7 +115,7 @@ var TaskService = /** @class */ (function (_super) {
var
member
=
userInfo
.
member
;
var
newMember
=
member
.
newMember
;
var
today
=
utils_1
.
getToday
();
var
isNewVip
=
this
.
checkNewVip
(
userInfo
,
vipInfo
);
var
isNewVip
=
utils_1
.
checkNewVip
(
userInfo
,
vipInfo
);
var
value
=
tasks
.
member
.
value
;
var
projection
=
{
$set
:
{},
...
...
@@ -123,7 +123,7 @@ var TaskService = /** @class */ (function (_super) {
$push
:
{}
};
if
(
isNewVip
&&
!
newMember
)
{
member
=
this
.
setNewVipUserData
(
member
);
member
=
utils_1
.
setNewVipUserData
(
member
);
// @ts-ignore
projection
.
$set
.
member
=
member
;
projection
.
$inc
[
'remainTimes.member'
]
=
+
value
;
...
...
@@ -229,7 +229,7 @@ var TaskService = /** @class */ (function (_super) {
_id
=
userInfo
.
_id
,
follow
=
userInfo
.
follow
;
tasks
=
activityInfo
.
tasks
;
value
=
(
tasks
||
{}).
follow
.
value
;
followInfo
=
this
.
setNewFollowUserData
(
follow
);
followInfo
=
utils_1
.
setNewFollowUserData
(
follow
);
return
[
4
/*yield*/
,
this
.
updateUser
(
_id
,
{
$set
:
{
follow
:
followInfo
...
...
v2.0/dist/service/task.service.js.map
View file @
46d532cb
This diff is collapsed.
Click to expand it.
v2.0/dist/service/user.service.d.ts
View file @
46d532cb
...
...
@@ -36,47 +36,39 @@ declare class UserService extends BaseService {
* @returns 若更新成功,返回为1; 若更新失败,返回为 0 或系统直接报错
*/
updateUser
(
_id
:
string
,
projection
:
IUpdateQuery
):
Promise
<
number
>
;
/**
* @desc 排行榜
* @param {查询条件} match
* @param {排序规则} sort
* @param {查询条数} limit
*/
getRank
(
match
:
Object
,
sort
:
Object
,
limit
:
number
):
Promise
<
any
>
;
/**
* @desc 获取我的排名
* @param {查询条件} match
* @param {排序规则} sort
*/
getMyRank
(
match
:
Object
,
sort
:
Object
):
Promise
<
any
>
;
getRank
(
sortValueKey
:
string
,
sortTimeKey
:
string
,
limit
?:
number
):
Promise
<
{
userNick
:
string
;
rank
:
number
;
_id
?:
string
;
id
?:
string
;
activityId
:
string
;
avatar
:
string
;
openId
:
string
;
createTime
:
number
;
updateTime
:
number
;
createDay
?:
string
;
inviteId
?:
string
;
member
?:
IMemberInfo
;
follow
?:
IFollowInfo
;
remainTimes
?:
IRemainTimesInfo
;
taskInfo
?:
object
;
login
?:
object
;
}[]
>
;
/**
* 获取用户排名
*/
getUserRank
(
hotValue
:
number
):
Promise
<
string
|
number
>
;
/**
* updateUser projection 格式化
*
* @param {object} projection
* @return {*}
* @param {string} sortValueKey 排名字段
* @param {number} userValue
* @param {string} sortTimeKey
* @return {number} 排行
* @memberof UserService
*/
formatUpdateUserProjection
(
projection
:
IUpdateQuery
):
IUpdateQuery
;
getMyRank
(
sortValueKey
:
string
,
sortTimeKey
:
string
,
userValue
:
number
):
Promise
<
number
>
;
/**
* @desc 根据用户主键id查找用户详情
* @param {用户的主键id} _id
* @returns 若用户不存在,返回null; 用户存在,返回用户信息(object对象)
*/
getUserInfoById
(
_id
:
string
):
Promise
<
unknown
>
;
/**
*判断是否新会员
*
* @param {IUserInfo} userInfo
* @param {IVipInfo} vipInfo
* @returns {boolean}
* @memberof UserService
*/
checkNewVip
(
userInfo
:
IUserInfo
,
vipInfo
:
IVipInfo
):
boolean
;
setNewVipUserData
(
member
:
IMemberInfo
):
IMemberInfo
;
setNewFollowUserData
(
follow
:
IFollowInfo
):
IFollowInfo
;
}
export
default
UserService
;
v2.0/dist/service/user.service.js
View file @
46d532cb
This diff is collapsed.
Click to expand it.
v2.0/dist/service/user.service.js.map
View file @
46d532cb
This diff is collapsed.
Click to expand it.
v2.0/dist/utils/index.d.ts
View file @
46d532cb
...
...
@@ -9,3 +9,5 @@ export * from './package/getUserOrderlist';
export
*
from
'./package/vip'
;
export
*
from
'./package/exportHandlers'
;
export
*
from
'./package/helper'
;
export
*
from
'./package/userUpdate'
;
export
*
from
'./package/format'
;
v2.0/dist/utils/index.js
View file @
46d532cb
...
...
@@ -25,4 +25,6 @@ __exportStar(require("./package/getUserOrderlist"), exports);
__exportStar
(
require
(
"./package/vip"
),
exports
);
__exportStar
(
require
(
"./package/exportHandlers"
),
exports
);
__exportStar
(
require
(
"./package/helper"
),
exports
);
__exportStar
(
require
(
"./package/userUpdate"
),
exports
);
__exportStar
(
require
(
"./package/format"
),
exports
);
//# sourceMappingURL=index.js.map
\ No newline at end of file
v2.0/dist/utils/index.js.map
View file @
46d532cb
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;AAEd,cAAc;AACd,uDAAoC;AAEpC,iBAAiB;AACjB,qDAAkC;AAElC,gBAAgB;AAChB,wDAAqC;AAErC,SAAS;AACT,uDAAoC;AAEpC,mDAAgC;AAEhC,iDAA8B;AAE9B,6DAA0C;AAE1C,gDAA6B;AAE7B,2DAAwC;AAExC,mDAAgC"}
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;AAEd,cAAc;AACd,uDAAoC;AAEpC,iBAAiB;AACjB,qDAAkC;AAElC,gBAAgB;AAChB,wDAAqC;AAErC,SAAS;AACT,uDAAoC;AAEpC,mDAAgC;AAEhC,iDAA8B;AAE9B,6DAA0C;AAE1C,gDAA6B;AAE7B,2DAAwC;AAExC,mDAAgC;AAEhC,uDAAoC;AAEpC,mDAAgC"}
\ No newline at end of file
v2.0/src/constants.ts
View file @
46d532cb
...
...
@@ -94,8 +94,7 @@ export const SHIP_STATUS = {
// 记录数据
export
enum
STAT_TYPE
{
CLICK_INVITE
=
1
,
CLICK_FOLLOW_TASK
INITE_SUCCESS
}
export
const
appId
=
'${需要补充}'
...
...
v2.0/src/controller/share.controller.ts
View file @
46d532cb
...
...
@@ -5,15 +5,17 @@ import { paramsCheck, userCheck, activityTimeCheck } from '../decorator/check'
import
{
services
}
from
'../decorator/services'
import
{
resultsModel
}
from
'../sdk'
import
{
getToday
}
from
'../utils'
import
{
UserService
,
AccessService
,
TaskService
}
from
'../service'
import
{
getToday
,
setNewVipUserData
,
checkNewVip
}
from
'../utils'
import
{
UserService
,
AccessService
,
TaskService
,
StatService
}
from
'../service'
import
{
registeInfos
}
from
'../decorator/registeInfos'
import
{
STAT_TYPE
}
from
'../constants'
export
default
class
Share
{
/**
* 获取邀请信息
*/
@
paramsCheck
([
'activityId'
])
@
userCheck
({
intercept
:
true
})
@
registeInfos
([
'userInfo'
,
'activityInfo'
])
@
services
([
UserService
])
async
getShareInfo
(
...
...
@@ -39,31 +41,34 @@ export default class Share {
*/
@
paramsCheck
([
'activityId'
,
'inviteId'
])
@
activityTimeCheck
@
userCheck
({
intercept
:
true
})
@
registeInfos
([
'userInfo'
,
'vipInfo'
,
'activityInfo'
])
@
services
([
UserService
,
TaskService
,
AccessService
])
@
services
([
UserService
,
TaskService
,
StatService
,
AccessService
])
async
doHelp
(
context
:
IContext
<
{
activityId
:
string
inviteId
:
string
}
>
,
{
userInfo
,
vipInfo
,
activityInfo
}:
IControllerInfos
,
[
userService
,
taskService
]:
[
UserService
,
Task
Service
]
[
userService
,
taskService
,
statService
]:
[
UserService
,
TaskService
,
StatService
,
Access
Service
]
):
Promise
<
IResult
<
boolean
>>
{
const
{
inviteId
}
=
context
.
data
const
{
inviteId
,
activityId
}
=
context
.
data
const
{
openId
}
=
context
if
(
openId
===
inviteId
)
return
resultsModel
.
error
(
CODE_TYPES
.
ERROR_NO_INVITE_SELF
)
const
inviteUserInfo
:
IUserInfo
=
await
userService
.
getUserInfoByOpenId
(
inviteId
)
// inviteId的用户信息查询不到, 则inviteId无效
if
(
!
inviteUserInfo
)
return
resultsModel
.
error
(
CODE_TYPES
.
ERROR_INVALID_INVITE_ID
)
const
{
taskInfo
}
=
taskService
.
getCompleteTaskByUserTaskInfo
(
'invites'
,
inviteUserInfo
)
// 邀请成功列表有该用户信息
if
(
taskInfo
.
some
(
v
=>
v
.
openId
===
openId
))
{
return
resultsModel
.
error
(
CODE_TYPES
.
ERROR_AREADY_INVITE_SUCCESS
)
}
// 邀请成功有该用户信息
const
userInviteSuccessCount
=
await
statService
.
getStatCountByquery
({
activityId
,
openId
,
type
:
STAT_TYPE
.
INITE_SUCCESS
})
if
(
userInviteSuccessCount
)
return
resultsModel
.
error
(
CODE_TYPES
.
ERROR_AREADY_INVITE_SUCCESS
)
// 获取活动基本信息
const
{
tasks
}
=
activityInfo
...
...
@@ -73,13 +78,13 @@ export default class Share {
}:
ITasks
=
tasks
// 新会员
const
isNewVip
=
userService
.
checkNewVip
(
userInfo
,
vipInfo
)
const
isNewVip
=
checkNewVip
(
userInfo
,
vipInfo
)
// 新会员更新状态
if
(
isNewVip
&&
!
userInfo
.
member
.
newMember
)
{
await
userService
.
updateUser
(
userInfo
.
_id
,
{
$set
:
{
member
:
userService
.
setNewVipUserData
(
userInfo
.
member
)
member
:
setNewVipUserData
(
userInfo
.
member
)
}
})
}
...
...
@@ -88,7 +93,9 @@ export default class Share {
const
isValidShare
=
[
isNewVip
].
every
(
v
=>
!!
v
)
const
today
=
getToday
()
if
(
isValidShare
)
{
if
(
!
isValidShare
)
return
resultsModel
.
error
(
CODE_TYPES
.
ERROR_INVITE
)
// 成功邀请
const
{
_id
:
inviteUserId
}
=
inviteUserInfo
// 增加邀请人的待领取次数和邀请记录
await
userService
.
updateUser
(
inviteUserId
,
{
...
...
@@ -99,7 +106,8 @@ export default class Share {
[
`taskInfo.
${
today
}
.invites`
]:
{
openId
,
createTime
:
Date
.
now
()
}
}
})
}
await
statService
.
addStat
(
STAT_TYPE
.
INITE_SUCCESS
,
userInfo
)
return
resultsModel
.
success
(
true
)
}
...
...
v2.0/src/controller/user.controller.ts
View file @
46d532cb
/** @format */
import
{
services
,
paramsCheck
,
activityTimeCheck
,
registeInfos
}
from
'../decorator'
import
{
services
,
paramsCheck
,
activityTimeCheck
,
registeInfos
,
userCheck
}
from
'../decorator'
import
{
resultsModel
}
from
'../sdk'
import
{
UserService
,
AccessService
}
from
'../service'
import
{
formatVipCbUrl
,
getShopVip
}
from
'../utils/package/vip'
...
...
@@ -61,4 +61,35 @@ export default class User {
return
resultsModel
.
success
(
result
)
}
/**
* 获取排行榜
*/
@
paramsCheck
([
'activityId'
])
@
userCheck
({
intercept
:
true
})
@
services
([
UserService
])
async
getRankList
(
context
:
IContext
<
{
activityId
:
string
}
>
,
{
userInfo
}:
IControllerInfos
,
[
userService
]:
[
UserService
]
)
{
const
sortKey
=
'score'
const
sortTime
=
'updateScoreTime'
const
{
userNick
,
avatar
}
=
userInfo
const
rank
=
await
userService
.
getMyRank
(
sortKey
,
sortTime
,
userInfo
[
sortKey
])
const
list
=
await
userService
.
getRank
(
sortKey
,
sortTime
,
200
)
return
resultsModel
.
success
({
userNick
,
avatar
,
rank
,
score
:
userInfo
[
sortKey
],
list
})
}
}
v2.0/src/errorCode.ts
View file @
46d532cb
...
...
@@ -68,6 +68,10 @@ export const BusinessError = {
code
:
`430008`
,
defaultMsg
:
`自己不能给自己助力`
},
ERROR_INVITE
:
{
code
:
`430009`
,
defaultMsg
:
`只有新会员才能助力哦~`
},
ERROR_FORBIDDEN_OPE
:
{
code
:
`530001`
,
defaultMsg
:
`非法操作`
...
...
v2.0/src/index.ts
View file @
46d532cb
...
...
@@ -8,7 +8,7 @@ import AwardsController from './controller/awards.controller'
import
ShareController
from
'./controller/share.controller'
import
StatController
from
'./controller/stat.controller'
const
{
login
,
getVipInfo
}
=
new
UserController
()
const
{
login
,
getVipInfo
,
getRankList
}
=
new
UserController
()
const
{
getTaskList
,
receiveTaskRewards
,
...
...
@@ -39,5 +39,6 @@ export default {
receiveEnamePrize
,
doHelp
,
getStats
,
addStat
addStat
,
getRankList
}
v2.0/src/service/stat.service.ts
View file @
46d532cb
...
...
@@ -41,4 +41,8 @@ export default class StatService {
createDay
:
getToday
()
})
}
async
getStatCountByquery
(
query
:
IMongoQuery
)
{
return
await
this
.
statdao
.
count
(
query
)
}
}
v2.0/src/service/task.service.ts
View file @
46d532cb
...
...
@@ -6,7 +6,17 @@
import
{
merge
}
from
'lodash'
import
UserService
from
'./user.service'
import
{
getToday
,
getUserOrderlist
,
logger
,
generateVipUrl
,
formatVipCbUrl
,
sleep
}
from
'../utils'
import
{
getToday
,
getUserOrderlist
,
logger
,
generateVipUrl
,
formatVipCbUrl
,
sleep
,
setNewVipUserData
,
setNewFollowUserData
,
checkNewVip
}
from
'../utils'
import
{
TASK_RATE_TYPE
,
TASK_STATUS
}
from
'../constants'
export
interface
ITaskInfo
{
...
...
@@ -67,7 +77,7 @@ export default class TaskService extends UserService {
const
{
newMember
}
=
member
const
today
=
getToday
()
const
isNewVip
=
this
.
checkNewVip
(
userInfo
,
vipInfo
)
const
isNewVip
=
checkNewVip
(
userInfo
,
vipInfo
)
const
{
member
:
{
value
}
...
...
@@ -80,7 +90,7 @@ export default class TaskService extends UserService {
}
if
(
isNewVip
&&
!
newMember
)
{
member
=
this
.
setNewVipUserData
(
member
)
member
=
setNewVipUserData
(
member
)
// @ts-ignore
projection
.
$set
.
member
=
member
...
...
@@ -194,7 +204,7 @@ export default class TaskService extends UserService {
}
=
tasks
||
{}
// 更新follow信息
const
followInfo
:
IFollowInfo
=
this
.
setNewFollowUserData
(
follow
)
const
followInfo
:
IFollowInfo
=
setNewFollowUserData
(
follow
)
// 增加待领取次数
return
await
this
.
updateUser
(
_id
,
{
...
...
v2.0/src/service/user.service.ts
View file @
46d532cb
...
...
@@ -7,9 +7,9 @@
import
{
BaseDao
,
TBAPIS
}
from
'../sdk'
import
BaseService
from
'./base.service'
import
{
USER_DB_NAME
}
from
'../db'
import
{
formatVipCbUrl
,
getToday
,
isUseVipMock
,
generateVipUrl
}
from
'../utils'
import
{
VIP_MOCK
}
from
'../vipMock
'
import
{
sellerId
}
from
'../constants
'
import
{
getToday
,
formatUpdateUserProjection
}
from
'../utils'
import
{
checkNewVip
}
from
'../utils/package/userUpdate
'
import
{
formatUserNick
}
from
'../utils/package/format
'
class
UserService
extends
BaseService
{
userdao
:
IBaseDao
constructor
(
context
:
IContext
<
IParams
>
)
{
...
...
@@ -126,7 +126,7 @@ class UserService extends BaseService {
}
// 之前进入活动非会员,现在进入会员,则视为新会员用户
const
isNewVip
=
this
.
checkNewVip
(
userInfo
,
vipInfo
)
const
isNewVip
=
checkNewVip
(
userInfo
,
vipInfo
)
if
(
isNewVip
&&
!
userInfo
.
member
.
newMember
)
{
// @ts-ignore
projection
.
$set
.
member
=
this
.
setNewVipUserData
(
userInfo
.
member
)
...
...
@@ -152,115 +152,66 @@ class UserService extends BaseService {
* @returns 若更新成功,返回为1; 若更新失败,返回为 0 或系统直接报错
*/
async
updateUser
(
_id
:
string
,
projection
:
IUpdateQuery
)
{
return
await
this
.
userdao
.
update
({
_id
},
this
.
formatUpdateUserProjection
(
projection
))
return
await
this
.
userdao
.
update
({
_id
},
formatUpdateUserProjection
(
projection
))
}
/**
* @desc 排行榜
* @param {查询条件} match
* @param {排序规则} sort
* @param {查询条数} limit
*/
async
getRank
(
match
:
Object
,
sort
:
Object
,
limit
:
number
)
{
const
{
data
}
=
this
.
context
const
{
activityId
}
=
data
return
await
this
.
userdao
.
aggregate
([
{
$match
:
{
...
match
,
activityId
}
},
{
$sort
:
sort
},
{
$group
:
{
_id
:
null
,
table
:
{
$push
:
'$$ROOT'
}
}
},
{
$unwind
:
{
path
:
'$table'
,
includeArrayIndex
:
'no'
}
},
// 获取排名列表
async
getRank
(
sortValueKey
:
string
,
sortTimeKey
:
string
,
limit
:
number
=
200
)
{
let
{
activityId
}
=
this
.
context
.
data
//获取排名
let
list
=
await
this
.
userdao
.
find
<
IUserInfo
>
(
{
$project
:
{
_id
:
0
,
openId
:
'$table.openId'
,
userNick
:
'$table.userNick'
,
no
:
{
$add
:
[
'$no'
,
1
]
}
}
activityId
:
activityId
,
[
sortValueKey
]:
{
$gt
:
0
}
},
{
$limit
:
limit
}
])
}
/**
* @desc 获取我的排名
* @param {查询条件} match
* @param {排序规则} sort
*/
async
getMyRank
(
match
:
Object
,
sort
:
Object
)
{
const
{
openId
,
data
}
=
this
.
context
const
{
activityId
}
=
data
return
await
this
.
userdao
.
aggregate
([
{
$match
:
{
...
match
,
activityId
}
},
{
$sort
:
sort
},
{
$group
:
{
_id
:
null
,
table
:
{
$push
:
'$$ROOT'
}
}
},
{
$unwind
:
{
path
:
'$table'
,
includeArrayIndex
:
'no'
}
},
{
$project
:
{
_id
:
0
,
openId
:
'$table.openId'
,
userNick
:
'$table.userNick'
,
no
:
{
$add
:
[
'$no'
,
1
]
projection
:
{
[
sortValueKey
]:
1
,
userNick
:
1
,
avatar
:
1
,
_id
:
0
},
sort
:
{
[
sortValueKey
]:
-
1
,
[
sortTimeKey
]:
1
},
limit
}
)
return
list
.
map
((
v
,
i
)
=>
{
return
{
...
v
,
userNick
:
formatUserNick
(
v
.
userNick
),
rank
:
i
+
1
}
},
{
$match
:
{
openId
}
}
])
})
}
/**
* 获取用户排名
*
* @param {string} sortValueKey 排名字段
* @param {number} userValue
* @param {string} sortTimeKey
* @return {number} 排行
* @memberof UserService
*/
async
get
UserRank
(
hotValue
:
number
)
{
async
get
MyRank
(
sortValueKey
:
string
,
sortTimeKey
:
string
,
userValue
:
number
):
Promise
<
number
>
{
let
{
activityId
}
=
this
.
context
.
data
const
{
openId
}
=
this
.
context
let
sameScoreList
=
await
this
.
userdao
.
find
<
IUserInfo
>
(
{
hot
Value
,
activityId
},
{
[
sortValueKey
]:
user
Value
,
activityId
},
{
sort
:
{
updateTime
:
1
}
sort
:
{
[
sortTimeKey
]
:
1
}
}
)
let
rank
:
string
|
number
=
'未上榜'
let
rank
:
number
let
gap
=
0
//说明有多个跟自己同分数的人
for
(
let
j
=
0
;
j
<
sameScoreList
.
length
;
j
++
)
{
if
(
sameScoreList
[
j
].
openId
==
openId
)
{
if
(
sameScoreList
[
j
].
openId
==
=
openId
)
{
gap
=
j
}
}
rank
=
await
this
.
userdao
.
count
({
hotValue
:
{
$gt
:
hot
Value
},
activityId
})
rank
=
await
this
.
userdao
.
count
({
[
sortValueKey
]:
{
$gt
:
user
Value
},
activityId
})
rank
=
rank
+
1
+
gap
if
(
rank
>
1000
)
{
rank
=
'1000+'
}
return
rank
}
/**
* updateUser projection 格式化
*
* @param {object} projection
* @return {*}
* @memberof UserService
*/
formatUpdateUserProjection
(
projection
:
IUpdateQuery
):
IUpdateQuery
{
projection
[
'$set'
]
=
projection
[
'$set'
]
||
{}
projection
[
'$set'
].
updateTime
=
Date
.
now
()
// $push不存在属性 删除$push
if
(
projection
[
'$push'
]
&&
!
Object
.
keys
(
projection
[
'$push'
]).
length
)
{
delete
projection
[
'$push'
]
}
// $pushAll不存在属性 删除$pushAll
if
(
projection
[
'$pushAll'
]
&&
!
Object
.
keys
(
projection
[
'$pushAll'
]).
length
)
{
delete
projection
[
'$pushAll'
]
}
console
.
log
(
projection
)
return
projection
}
/**
* @desc 根据用户主键id查找用户详情
* @param {用户的主键id} _id
...
...
@@ -269,44 +220,6 @@ class UserService extends BaseService {
async
getUserInfoById
(
_id
:
string
)
{
return
await
this
.
userdao
.
findOne
({
_id
})
}
/**
*判断是否新会员
*
* @param {IUserInfo} userInfo
* @param {IVipInfo} vipInfo
* @returns {boolean}
* @memberof UserService
*/
checkNewVip
(
userInfo
:
IUserInfo
,
vipInfo
:
IVipInfo
):
boolean
{
const
{
member
:
{
flag
}
}
=
userInfo
const
{
isVip
}
=
vipInfo
return
!
flag
&&
isVip
}
setNewVipUserData
(
member
:
IMemberInfo
):
IMemberInfo
{
const
today
=
getToday
()
return
{
...
member
,
newMember
:
true
,
bememberTime
:
Date
.
now
(),
bememberDay
:
today
}
}
setNewFollowUserData
(
follow
:
IFollowInfo
):
IFollowInfo
{
const
today
=
getToday
()
return
{
...
follow
,
newFollow
:
true
,
followTime
:
Date
.
now
(),
followDay
:
today
}
}
}
export
default
UserService
v2.0/src/typings/dao.d.ts
View file @
46d532cb
...
...
@@ -130,6 +130,8 @@ interface IFindProjection {
}
maxTimeMS
?:
number
upsert
?:
boolean
limit
?:
number
skip
?:
number
returnOriginal
?:
boolean
collation
?:
CollationDocument
}
...
...
v2.0/src/utils/index.ts
View file @
46d532cb
...
...
@@ -23,3 +23,7 @@ export * from './package/vip'
export
*
from
'./package/exportHandlers'
export
*
from
'./package/helper'
export
*
from
'./package/userUpdate'
export
*
from
'./package/format'
v2.0/src/utils/package/format.ts
0 → 100644
View file @
46d532cb
/**
* updateUser projection 格式化
*
* @format
* @param {object} projection
* @return {*}
* @memberof UserService
*/
export
function
formatUpdateUserProjection
(
projection
:
IUpdateQuery
):
IUpdateQuery
{
projection
[
'$set'
]
=
projection
[
'$set'
]
||
{}
projection
[
'$set'
].
updateTime
=
Date
.
now
()
// $push不存在属性 删除$push
if
(
projection
[
'$push'
]
&&
!
Object
.
keys
(
projection
[
'$push'
]).
length
)
{
delete
projection
[
'$push'
]
}
console
.
log
(
projection
)
return
projection
}
// 用户昵称脱敏
export
function
formatUserNick
(
name
:
string
)
{
let
newStr
:
string
if
(
name
.
length
===
2
)
{
newStr
=
name
.
substr
(
0
,
1
)
+
'***'
+
name
.
substr
(
-
1
,
1
)
}
else
if
(
name
.
length
>
2
)
{
let
char
=
'***'
newStr
=
name
.
substr
(
0
,
1
)
+
char
+
name
.
substr
(
-
1
,
1
)
}
else
{
newStr
=
name
+
'***'
}
return
newStr
}
v2.0/src/utils/package/userUpdate.ts
0 → 100644
View file @
46d532cb
/** @format */
import
{
getToday
}
from
'./getToday'
/**
* 判断是否新会员
*
* @format
* @param {IUserInfo} userInfo
* @param {IVipInfo} vipInfo
* @returns {boolean}
* @memberof UserService
*/
export
function
checkNewVip
(
userInfo
:
IUserInfo
,
vipInfo
:
IVipInfo
):
boolean
{
const
{
member
:
{
flag
}
}
=
userInfo
const
{
isVip
}
=
vipInfo
return
!
flag
&&
isVip
}
export
function
setNewVipUserData
(
member
:
IMemberInfo
):
IMemberInfo
{
const
today
=
getToday
()
return
{
...
member
,
newMember
:
true
,
bememberTime
:
Date
.
now
(),
bememberDay
:
today
}
}
export
function
setNewFollowUserData
(
follow
:
IFollowInfo
):
IFollowInfo
{
const
today
=
getToday
()
return
{
...
follow
,
newFollow
:
true
,
followTime
:
Date
.
now
(),
followDay
:
today
}
}
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