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
82aef41d
Commit
82aef41d
authored
Sep 01, 2020
by
qinhaitao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:
🎸
完善数据统计
parent
d61b97d8
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
110 additions
and
33 deletions
+110
-33
stat.controller.d.ts
v2.0/dist/controller/stat.controller.d.ts
+7
-1
stat.controller.js
v2.0/dist/controller/stat.controller.js
+32
-15
stat.controller.js.map
v2.0/dist/controller/stat.controller.js.map
+1
-1
task.controller.js.map
v2.0/dist/controller/task.controller.js.map
+1
-1
index.js
v2.0/dist/index.js
+9
-1
index.js.map
v2.0/dist/index.js.map
+1
-1
BaseDao.js
v2.0/mockServer/sdk/BaseDao.js
+15
-0
request.js
v2.0/mockServer/sdk/request.js
+1
-1
stat.controller.ts
v2.0/src/controller/stat.controller.ts
+34
-10
task.controller.ts
v2.0/src/controller/task.controller.ts
+0
-1
index.ts
v2.0/src/index.ts
+9
-1
No files found.
v2.0/dist/controller/stat.controller.d.ts
View file @
82aef41d
/** @format */
interface
IStatsParams
{
activityId
:
string
;
startDay
:
string
;
endDay
:
string
;
}
/** @format */
export
default
class
StatController
{
/**
* 统计数据
*/
getStats
(
context
:
IContext
<
I
Params
>
):
Promise
<
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
any
,
false
>
|
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
any
,
tru
e
>>
;
getStats
(
context
:
IContext
<
I
StatsParams
>
):
Promise
<
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
any
[],
true
>
|
import
(
"taobao-mini-sdk/lib/utils/resultmodel"
).
Result
<
any
,
fals
e
>>
;
}
export
{};
v2.0/dist/controller/stat.controller.js
View file @
82aef41d
...
...
@@ -50,7 +50,7 @@ var StatController = /** @class */ (function () {
*/
StatController
.
prototype
.
getStats
=
function
(
context
)
{
return
__awaiter
(
this
,
void
0
,
void
0
,
function
()
{
var
_a
,
activityId
,
startDay
,
endDay
,
userDao
,
accessDao
,
oneDay
,
xlsxData
,
day
,
PV
,
UV
,
newUV
,
vipPV
,
noVipPV
,
vipUV
,
noVipUV
,
newVipUV
,
newFollowUV
,
keyValueMapper
,
tommorrow
,
buffer
,
result
,
e_1
;
var
_a
,
activityId
,
startDay
,
endDay
,
userDao
,
accessDao
,
oneDay
,
xlsxData
,
day
,
PV
,
UV
,
newUV
,
vipPV
,
noVipPV
,
vipUV
,
noVipUV
,
newVipUV
,
newFollowUV
,
keyValueMapper
,
tommorrow
,
buffer
,
e_1
;
return
__generator
(
this
,
function
(
_b
)
{
switch
(
_b
.
label
)
{
case
0
:
...
...
@@ -61,7 +61,7 @@ var StatController = /** @class */ (function () {
xlsxData
=
[];
_b
.
label
=
1
;
case
1
:
_b
.
trys
.
push
([
1
,
1
4
,
,
15
]);
_b
.
trys
.
push
([
1
,
1
3
,
,
14
]);
day
=
startDay
;
_b
.
label
=
2
;
case
2
:
...
...
@@ -118,7 +118,22 @@ var StatController = /** @class */ (function () {
activityId
:
activityId
,
'member.follow'
:
true
,
'member.followDay'
:
day
})];
})
// 签到任务
// const signTaskUV = await userDao.count({
// activityId,
// [`taskInfo.${day}.sign`]: {
// $exists: true
// }
// })
// 收藏商品
// const collectGoodsTaskUV = await userDao.count({
// activityId,
// [`taskInfo.${day}.collecctGoods`]: {
// $exists: true
// }
// })
];
case
11
:
newFollowUV
=
_b
.
sent
();
keyValueMapper
=
{
...
...
@@ -132,6 +147,8 @@ var StatController = /** @class */ (function () {
未入会
UV
:
noVipUV
,
新入会
UV
:
newVipUV
,
新增关注
UV
:
newFollowUV
// 收藏商品UV: collectGoodsTaskUV
// 签到任务UV: signTaskUV
};
if
(
day
===
startDay
)
{
xlsxData
.
push
(
Object
.
keys
(
keyValueMapper
));
...
...
@@ -148,23 +165,23 @@ var StatController = /** @class */ (function () {
data
:
xlsxData
}
]);
return
[
4
/*yield*/
,
context
.
cloud
.
file
.
uploadFile
({
fileContent
:
buffer
,
fileName
:
"
\
u6570
\
u636E
\
u7EDF
\
u8BA1"
+
startDay
.
replace
(
/
\/
/g
,
'-'
)
+
"-"
+
endDay
.
replace
(
/
\/
/g
,
'-'
)
+
".xlsx"
})];
case
13
:
result
=
_b
.
sent
();
// let result = {}
console
.
log
(
xlsxData
,
'xlsxData'
);
if
(
result
.
url
)
{
result
.
url
=
result
.
url
.
replace
(
'http'
,
'https'
).
replace
(
'-internal'
,
''
);
}
return
[
2
/*return*/
,
sdk_1
.
resultsModel
.
success
(
result
.
url
)];
case
14
:
// let result = await context.cloud.file.uploadFile({
// fileContent: buffer,
// fileName: `数据统计${startDay.replace(/\//g, '-')}-${endDay.replace(/\//g, '-')}.xlsx`
// })
// console.log(xlsxData, 'xlsxData')
// if (result.url) {
// result.url = result.url.replace('http', 'https').replace('-internal', '')
// }
return
[
2
/*return*/
,
sdk_1
.
resultsModel
.
success
(
xlsxData
)];
case
13
:
e_1
=
_b
.
sent
();
console
.
log
(
'上传文件出错'
,
e_1
);
// 打印日志
return
[
2
/*return*/
,
sdk_1
.
resultsModel
.
error
(
constants_1
.
CODE_TYPES
.
SYSTEM_ERROR
,
"
\
u4E0A
\
u4F20
\
u6587
\
u4EF6
\
u9519
\
u8BEF"
)];
case
1
5
:
return
[
2
/*return*/
];
case
1
4
:
return
[
2
/*return*/
];
}
});
});
...
...
v2.0/dist/controller/stat.controller.js.map
View file @
82aef41d
{"version":3,"file":"stat.controller.js","sourceRoot":"","sources":["../../src/controller/stat.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,4BAAoE;AACpE,8BAAmF;AACnF,0CAAyC;AACzC,gCAAiC;AAEjC,cAAc;AACd;IAAA;IA+GA,CAAC;IA9GC;;OAEG;IACG,iCAAQ,GAAd,UAAe,OAA0B;;;;;;wBACjC,KAAmC,OAAO,CAAC,IAAI,EAA7C,UAAU,gBAAA,EAAE,QAAQ,cAAA,EAAE,MAAM,YAAA,CAAiB;wBAE/C,OAAO,GAAa,IAAI,aAAO,CAAC,OAAO,EAAE,iBAAY,CAAC,CAAA;wBACtD,SAAS,GAAa,IAAI,aAAO,CAAC,OAAO,EAAE,mBAAc,CAAC,CAAA;wBAC1D,MAAM,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAA;wBAEzB,QAAQ,GAAG,EAAE,CAAA;;;;wBAEb,GAAG,GAAG,QAAQ,CAAA;;;6BACX,CAAA,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAA;wBAE/C,qBAAM,SAAS,CAAC,KAAK,CAAC,EAAE,UAAU,YAAA,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;4BAChE,OAAO;0BADyD;;wBAA1D,EAAE,GAAG,SAAqD;wBAG9D,qBAAM,SAAS,CAAC,SAAS,CAAC;gCACxB,EAAE,MAAM,EAAE,EAAE,UAAU,YAAA,EAAE,SAAS,EAAE,GAAG,EAAE,EAAE;gCAC1C,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE;6BACnD,CAAC,EAAA;;wBAJE,EAAE,GAAG,CACT,SAGE,CACH,CAAC,MAAM;wBAEM,qBAA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AAC,KAAK,EAAE,GAAG,CAAC,SAAI,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,UAAO;6BACnF,CAAC,EAAA;;wBAHE,MAAM,GAAG,SAGX;wBACF,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;wBACjC,IAAI,MAAM,CAAC,GAAG,EAAE;4BACd,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;yBAC1E;wBACD,sBAAO,kBAAY,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,EAAA;;;wBAEvC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAC,CAAC,CAAA;wBACxB,OAAO;wBACP,sBAAO,kBAAY,CAAC,KAAK,CAAC,sBAAU,CAAC,YAAY,EAAE,sCAAQ,CAAC,EAAA;;;;;KAE/D;IACH,qBAAC;AAAD,CAAC,AA/GD,IA+GC"}
\ No newline at end of file
{"version":3,"file":"stat.controller.js","sourceRoot":"","sources":["../../src/controller/stat.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,4BAAoE;AACpE,8BAAmF;AACnF,0CAAyC;AACzC,gCAAiC;AAQjC,cAAc;AACd;IAAA;IAiIA,CAAC;IAhIC;;OAEG;IACG,iCAAQ,GAAd,UAAe,OAA+B;;;;;;wBACtC,KAAmC,OAAO,CAAC,IAAI,EAA7C,UAAU,gBAAA,EAAE,QAAQ,cAAA,EAAE,MAAM,YAAA,CAAiB;wBAE/C,OAAO,GAAa,IAAI,aAAO,CAAC,OAAO,EAAE,iBAAY,CAAC,CAAA;wBACtD,SAAS,GAAa,IAAI,aAAO,CAAC,OAAO,EAAE,mBAAc,CAAC,CAAA;wBAC1D,MAAM,GAAG,EAAE,GAAG,IAAI,GAAG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No newline at end of file
v2.0/dist/controller/task.controller.js.map
View file @
82aef41d
This diff is collapsed.
Click to expand it.
v2.0/dist/index.js
View file @
82aef41d
...
...
@@ -7,5 +7,13 @@ var task_controller_1 = require("./controller/task.controller");
var
base_controller_1
=
require
(
"./controller/base.controller"
);
var
awards_controller_1
=
require
(
"./controller/awards.controller"
);
var
share_controller_1
=
require
(
"./controller/share.controller"
);
exports
.
default
=
utils_1
.
exportHandlers
([
user_controller_1
.
default
,
task_controller_1
.
default
,
base_controller_1
.
default
,
awards_controller_1
.
default
,
share_controller_1
.
default
]);
var
stat_controller_1
=
require
(
"./controller/stat.controller"
);
exports
.
default
=
utils_1
.
exportHandlers
([
user_controller_1
.
default
,
task_controller_1
.
default
,
base_controller_1
.
default
,
awards_controller_1
.
default
,
share_controller_1
.
default
,
stat_controller_1
.
default
]);
//# sourceMappingURL=index.js.map
\ No newline at end of file
v2.0/dist/index.js.map
View file @
82aef41d
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,cAAc;;AAEd,iCAAwC;AACxC,gEAAyD;AACzD,gEAAyD;AACzD,gEAAyD;AACzD,oEAA6D;AAC7D,kEAA2D;AAE3D,kBAAe,sBAAc,CAAC,CAAC,yBAAc,EAAE,yBAAc,EAAE,yBAAc,EAAE,2BAAgB,EAAE,0BAAe,CAAC,CAAC,CAAA"}
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,cAAc;;AAEd,iCAAwC;AACxC,gEAAyD;AACzD,gEAAyD;AACzD,gEAAyD;AACzD,oEAA6D;AAC7D,kEAA2D;AAC3D,gEAAyD;AAEzD,kBAAe,sBAAc,CAAC;IAC5B,yBAAc;IACd,yBAAc;IACd,yBAAc;IACd,2BAAgB;IAChB,0BAAe;IACf,yBAAc;CACf,CAAC,CAAA"}
\ No newline at end of file
v2.0/mockServer/sdk/BaseDao.js
View file @
82aef41d
...
...
@@ -107,6 +107,21 @@ class BaseDao {
})
return
result
}
/**
* 聚合查询
* @param query
* @param options
*/
async
aggregate
(
query
)
{
let
result
=
await
CURD_REQUEST
({
db
:
this
.
db
,
TABLE
:
this
.
TABLE
,
type
:
`aggregate`
,
query
:
query
||
{}
})
return
result
}
}
module
.
exports
=
BaseDao
v2.0/mockServer/sdk/request.js
View file @
82aef41d
...
...
@@ -11,7 +11,7 @@ const request = async (path, params) => {
})
if
(
!
res
.
data
.
data
)
{
console
.
log
(
`调用
${
path
}${
JSON
.
stringify
(
params
)}
\n返回结果`
,
res
.
data
)
return
false
return
res
.
data
.
data
}
return
res
.
data
.
data
}
...
...
v2.0/src/controller/stat.controller.ts
View file @
82aef41d
...
...
@@ -5,12 +5,18 @@ import { resultsModel, dateFormatter, transformBeijingDate, BaseDao } from '../s
import
{
CODE_TYPES
}
from
'../constants'
import
*
as
xlsx
from
'node-xlsx'
interface
IStatsParams
{
activityId
:
string
startDay
:
string
endDay
:
string
}
/** @format */
export
default
class
StatController
{
/**
* 统计数据
*/
async
getStats
(
context
:
IContext
<
IParams
>
)
{
async
getStats
(
context
:
IContext
<
I
Stats
Params
>
)
{
const
{
activityId
,
startDay
,
endDay
}
=
context
.
data
const
userDao
:
IBaseDao
=
new
BaseDao
(
context
,
USER_DB_NAME
)
...
...
@@ -71,6 +77,22 @@ export default class StatController {
'member.followDay'
:
day
})
// 签到任务
// const signTaskUV = await userDao.count({
// activityId,
// [`taskInfo.${day}.sign`]: {
// $exists: true
// }
// })
// 收藏商品
// const collectGoodsTaskUV = await userDao.count({
// activityId,
// [`taskInfo.${day}.collecctGoods`]: {
// $exists: true
// }
// })
const
keyValueMapper
=
{
时间
:
day
,
访问
PV
:
PV
,
...
...
@@ -82,6 +104,8 @@ export default class StatController {
未入会
UV
:
noVipUV
,
新入会
UV
:
newVipUV
,
新增关注
UV
:
newFollowUV
// 收藏商品UV: collectGoodsTaskUV
// 签到任务UV: signTaskUV
}
if
(
day
===
startDay
)
{
...
...
@@ -101,16 +125,16 @@ export default class StatController {
])
// let result = {}
let
result
=
await
context
.
cloud
.
file
.
uploadFile
({
fileContent
:
buffer
,
fileName
:
`数据统计
${
startDay
.
replace
(
/
\/
/g
,
'-'
)}
-
${
endDay
.
replace
(
/
\/
/g
,
'-'
)}
.xlsx`
})
console
.
log
(
xlsxData
,
'xlsxData'
)
if
(
result
.
url
)
{
result
.
url
=
result
.
url
.
replace
(
'http'
,
'https'
).
replace
(
'-internal'
,
''
)
}
return
resultsModel
.
success
(
result
.
url
)
// let result = await context.cloud.file.uploadFile({
// fileContent: buffer,
// fileName: `数据统计${startDay.replace(/\//g, '-')}-${endDay.replace(/\//g, '-')}.xlsx`
// })
// console.log(xlsxData, 'xlsxData')
// if (result.url) {
// result.url = result.url.replace('http', 'https').replace('-internal', '')
// }
return
resultsModel
.
success
(
xlsxData
)
}
catch
(
e
)
{
console
.
log
(
'上传文件出错'
,
e
)
// 打印日志
...
...
v2.0/src/controller/task.controller.ts
View file @
82aef41d
...
...
@@ -41,7 +41,6 @@ export default class Task {
const
vipTask
=
taskService
.
initVipTask
(
updatedUserInfo
,
vipInfo
,
tasks
)
// 关注店铺
const
followTask
=
taskService
.
initFollowTask
(
updatedUserInfo
,
tasks
)
// 签到任务
const
signTask
=
taskService
.
initSignTask
(
updatedUserInfo
,
tasks
)
// 下单任务
...
...
v2.0/src/index.ts
View file @
82aef41d
...
...
@@ -6,5 +6,13 @@ import TaskController from './controller/task.controller'
import
BaseController
from
'./controller/base.controller'
import
AwardsController
from
'./controller/awards.controller'
import
ShareController
from
'./controller/share.controller'
import
StatController
from
'./controller/stat.controller'
export
default
exportHandlers
([
UserController
,
TaskController
,
BaseController
,
AwardsController
,
ShareController
])
export
default
exportHandlers
([
UserController
,
TaskController
,
BaseController
,
AwardsController
,
ShareController
,
StatController
])
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