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
7eabebef
Commit
7eabebef
authored
Jul 21, 2020
by
秦海涛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
9ed34853
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
63 deletions
+16
-63
activity.controller.js
server/duiba/controller/activity.controller.js
+12
-60
activityconfig.service.js
server/duiba/service/activityconfig.service.js
+4
-3
No files found.
server/duiba/controller/activity.controller.js
View file @
7eabebef
...
...
@@ -57,32 +57,19 @@ const getActivityListByOpenId = async function (context) {
loginfo
(
context
,
"getActivityListByOpenId"
);
const
{
openId
}
=
context
;
let
ActivityConfig
=
new
ActivityConfigService
(
context
);
let
ActivityInstance
=
new
ActivityInstanceService
(
context
);
let
ActivitySeller
=
new
ActivitySellerService
(
context
);
try
{
let
sellInfo
=
await
ActivitySeller
.
findSellerInfo
(
openId
);
console
.
log
(
sellInfo
,
"sellInfo"
);
if
(
sellInfo
&&
sellInfo
[
0
])
{
let
result
=
await
ActivityConfig
.
getActivityListByOpenId
(
sellInfo
&&
sellInfo
[
0
].
shopId
,
context
.
data
);
let
instanceInfo
=
await
ActivityInstance
.
getMiniAppInstanceInfoByNick
(
sellInfo
[
0
].
userNick
);
if
(
result
)
{
result
.
list
.
map
((
item
)
=>
{
item
.
activityId
=
item
.
_id
;
item
.
onlineUrl
=
instanceInfo
&&
instanceInfo
[
0
]
?
instanceInfo
[
0
].
online_url
:
""
;
return
item
;
});
return
resultsModel
.
success
(
result
);
}
return
resultsModel
.
error
(
CODE_TYPES
.
SYSTEM_ERROR
,
"查询活动列表失败"
);
}
else
{
return
resultsModel
.
error
(
CODE_TYPES
.
SYSTEM_ERROR
,
"小程序未授权"
);
let
result
=
await
ActivityConfig
.
getActivityListByOpenId
(
openId
,
context
.
data
);
if
(
result
)
{
result
.
list
.
map
((
item
)
=>
{
item
.
activityId
=
item
.
_id
;
return
item
;
});
return
resultsModel
.
success
(
result
);
}
return
resultsModel
.
error
(
CODE_TYPES
.
SYSTEM_ERROR
,
"查询活动列表失败"
);
}
catch
(
e
)
{
console
.
log
(
"catch"
,
"查询活动列表失败"
);
return
resultsModel
.
error
(
CODE_TYPES
.
SYSTEM_ERROR
,
"查询活动列表失败"
);
...
...
@@ -98,17 +85,11 @@ const saveActivityInfoByHasId = async function (context) {
const
{
openId
}
=
context
;
let
{
title
=
""
,
subtitle
=
""
,
activityId
=
""
,
startTime
,
endTime
,
rule
,
logoImg
=
""
,
prizeInfoList
=
[],
taskList
=
[],
commandTitle
,
beenInvitedText
,
commandImg
,
rule
,
}
=
context
.
data
;
let
initialData
;
if
(
activityId
)
{
...
...
@@ -122,26 +103,6 @@ const saveActivityInfoByHasId = async function (context) {
"活动名称不可超过12个字"
);
}
if
(
!
subtitle
)
{
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
"活动副标题为空"
);
}
else
if
(
subtitle
.
length
>
16
)
{
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
"活动副标题不可超过16个字"
);
}
if
(
!
logoImg
)
{
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
"logo图片必须配置"
);
}
if
(
!
commandTitle
)
{
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
"邀请者淘口令必须配置"
);
}
if
(
!
beenInvitedText
)
{
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
"被邀请者文案必须配置"
);
}
if
(
!
commandImg
)
{
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
"淘口令图片必须配置"
);
}
if
(
taskList
.
length
===
0
)
{
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
"任务配置必须配置一项"
);
}
else
{
...
...
@@ -263,10 +224,6 @@ const saveActivityInfoByHasId = async function (context) {
);
}
}
let
shopInfoResult
=
await
ActivityTop
.
getShopId
();
if
(
!
shopInfoResult
.
success
)
{
return
resultsModel
.
error
(
CODE_TYPES
.
SYSTEM_ERROR
,
"获取淘宝店铺信息失败"
);
}
console
.
log
(
shopInfoResult
,
"shopInfo"
);
const
baseData
=
{
title
,
...
...
@@ -274,12 +231,7 @@ const saveActivityInfoByHasId = async function (context) {
startTime
,
endTime
,
rule
,
shopId
:
shopInfoResult
.
data
.
sid
,
openId
,
beenInvitedText
,
commandTitle
,
commandImg
,
logoImg
,
taskList
,
};
prizeInfoList
=
prizeInfoList
.
map
((
v
,
i
)
=>
{
...
...
server/duiba/service/activityconfig.service.js
View file @
7eabebef
...
...
@@ -188,11 +188,11 @@ module.exports = class ActivityConfigService {
}
//通过openId去获取当前商家活动列表
async
getActivityListByOpenId
(
shop
Id
,
{
pageSize
=
10
,
pageNo
=
1
})
{
async
getActivityListByOpenId
(
open
Id
,
{
pageSize
=
10
,
pageNo
=
1
})
{
return
{
list
:
await
this
.
activityconfigDao
.
find
(
{
shop
Id
,
open
Id
,
deleteStatus
:
DELETE_STATUS
.
EXIST
,
},
{
...
...
@@ -209,7 +209,7 @@ module.exports = class ActivityConfigService {
}
),
total
:
await
this
.
activityconfigDao
.
count
({
shop
Id
,
open
Id
,
deleteStatus
:
DELETE_STATUS
.
EXIST
,
}),
pageSize
,
...
...
@@ -217,6 +217,7 @@ module.exports = class ActivityConfigService {
};
}
//通过activityId去获取活动配置信息
async
getActivityInfoByActivityId
(
activityId
)
{
return
{
...
...
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