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
e788f979
Commit
e788f979
authored
Jul 24, 2020
by
秦海涛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
f1f9af32
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
117 deletions
+27
-117
index.js
client/cmpUtils/index.js
+0
-0
task-dialog.axml
client/components/dialog/task-dialog/task-dialog.axml
+1
-1
tb-range-picker.js
client/components/form/tb-range-picker/tb-range-picker.js
+8
-3
activityseller.controller.js
server/duiba/controller/activityseller.controller.js
+18
-113
No files found.
client/cmpUtils/index.js
deleted
100644 → 0
View file @
f1f9af32
client/components/dialog/task-dialog/task-dialog.axml
View file @
e788f979
...
...
@@ -43,7 +43,7 @@
</form-item>
<form-item label="任务奖励">
<input onChange="onChange" data-name="value" defaultValue="{{value}}" name="value" addonTextAfter="{{unit}}"/>
<input onChange="onChange" data-name="value" defaultValue="{{value}}" name="value" addonTextAfter="{{unit}}"
placeholder="1-999" maxLength="{{3}}"
/>
</form-item>
</form>
<view class="task-content-btn">
...
...
client/components/form/tb-range-picker/tb-range-picker.js
View file @
e788f979
...
...
@@ -72,8 +72,9 @@ Component({
const
[
startTime
,
endTime
]
=
e
.
detail
.
value
;
const
innerTimeRange
=
[
startTime
||
''
,
endTime
||
''
];
if
(
!
startTime
&&
!
endTime
)
{
this
.
confrimChangeTime
([
''
,
''
])
this
.
confrimChangeTime
([
''
,
''
]
,
'请输入活动时间'
)
}
this
.
setData
({
innerTimeRange
})
...
...
@@ -92,9 +93,9 @@ Component({
}
let
timeHasSame
=
new
Date
(
endTime
).
getTime
()
===
new
Date
(
startTime
).
getTime
()
let
timeIsCantChoose
=
new
Date
().
getTime
()
>
new
Date
(
startTime
).
getTime
()
let
timeBeginError
=
new
Date
().
getTime
(
startTime
)
>
new
Date
(
endTime
).
getTime
();
if
(
timeHasSame
||
timeIsCantChoose
)
{
if
(
timeHasSame
||
timeIsCantChoose
||
timeBeginError
)
{
let
errTips
=
''
;
if
(
timeIsCantChoose
&&
!
disableStartTime
)
{
errTips
=
`活动开始时间不能小于当前时间`
...
...
@@ -104,6 +105,10 @@ Component({
errTips
=
`开始时间不能等于结束时间`
console
.
log
(
'error'
,
'开始时间不能等于结束时间'
)
}
if
(
timeBeginError
)
{
errTips
=
`开始时间不能大于结束时间`
;
console
.
log
(
'error'
,
'开始时间不能大于结束时间'
);
}
this
.
confrimChangeTime
([
startTime
,
endTime
],
errTips
)
}
else
{
this
.
setData
({
...
...
server/duiba/controller/activityseller.controller.js
View file @
e788f979
...
...
@@ -8,140 +8,45 @@ const ResultsModel = require("../utils/results.model");
let
resultsModel
=
new
ResultsModel
();
//保存授权信息
//保存授权信息
//保存授权信息
module
.
exports
=
async
(
context
)
=>
{
loginfo
(
context
,
"sellerInfo"
);
let
{
openId
,
accessToken
,
appKey
,
userNick
,
appOwnerOpenId
,
consumeMiniAppId
,
}
=
context
;
let
{
openId
,
accessToken
,
appKey
,
userNick
,
appOwnerOpenId
}
=
context
;
let
ActivitySeller
=
new
ActivitySellerService
(
context
);
let
ActivityTop
=
new
ActivityTopService
(
context
);
let
ActivityInstance
=
new
ActivityInstanceService
(
context
);
try
{
let
primaryAccountNick
=
userNick
;
let
isPrimaryAccount
=
true
;
if
(
~
userNick
.
indexOf
(
":"
))
{
let
userNickArr
=
userNick
.
split
(
":"
);
isPrimaryAccount
=
false
;
primaryAccountNick
=
userNickArr
[
0
]
;
let
isPrimaryAccount
=
userNickArr
.
length
===
1
;
console
.
log
(
userNick
,
isPrimaryAccount
,
"userNick------"
)
;
if
(
!
isPrimaryAccount
)
{
let
sellerInfo
=
await
ActivitySeller
.
getSellerInfoByUserNick
(
primaryAccountNick
userNickArr
[
0
]
);
console
.
log
(
sellerInfo
,
"seller----info------"
);
if
(
sellerInfo
)
{
accessToken
=
sellerInfo
.
accessToken
;
}
else
{
return
resultsModel
.
error
(
CODE_TYPES
.
SYSTEM_ERROR
,
"请用主账号进入后台进行授权"
);
}
}
}
let
hasResult
=
await
ActivitySeller
.
findSellerInfo
(
openId
);
let
subInfo
=
await
ActivityTop
.
getSubRelationship
(
primaryAccountNick
);
if
(
hasResult
&&
hasResult
[
0
]
&&
isPrimaryAccount
)
{
await
ActivitySeller
.
updateSellerInfo
(
openId
,
{
let
hasResult
=
await
ActivitySeller
.
findSellerInfo
(
context
.
openId
);
if
(
hasResult
&&
hasResult
[
0
])
{
await
ActivitySeller
.
updateSellerInfo
(
context
.
openId
,
{
accessToken
,
});
await
ActivityInstance
.
updateInstanceInfo
(
openId
,
{
accessToken
,
});
// return resultsModel.success({ deadline: subInfo.deadline || "" });
return
resultsModel
.
success
(
true
);
}
else
{
let
shopInfoResult
=
await
ActivityTop
.
getShopId
();
if
(
!
shopInfoResult
.
success
)
{
return
resultsModel
.
error
(
CODE_TYPES
.
SYSTEM_ERROR
,
"获取淘宝店铺信息失败"
);
}
try
{
await
ActivitySeller
.
saveSellerInfo
({
let
result
=
await
ActivitySeller
.
saveSellerInfo
({
accessToken
,
openId
,
appKey
,
shopId
:
shopInfoResult
.
data
.
sid
,
userNick
,
appOwnerOpenId
,
});
// return resultsModel.success({ deadline: subInfo.deadline || "" }
);
return
resultsModel
.
success
(
result
);
}
catch
(
e
)
{
console
.
log
(
e
,
"保存授权信息失败"
);
return
resultsModel
.
error
(
CODE_TYPES
.
SYSTEM_ERROR
,
"保存授权信息失败"
);
}
}
let
instanceOldInfo
=
await
ActivityInstance
.
getMiniAppInstanceInfoByNick
(
primaryAccountNick
);
if
(
!
instanceOldInfo
)
{
if
(
!
isPrimaryAccount
)
{
return
resultsModel
.
error
(
CODE_TYPES
.
SYSTEM_ERROR
,
"请用主账号进入后台进行授权"
);
}
let
instanceInfo
=
await
ActivityTop
.
getTemplateInstantiate
();
const
{
app_id
,
app_version
}
=
instanceInfo
;
if
(
instanceInfo
)
{
let
onlineInstance
=
await
ActivityTop
.
pushOnlineInstance
({
app_id
,
app_version
,
});
await
ActivityInstance
.
saveInstanceInfo
({
...
instanceInfo
,
clients
:
onlineInstance
.
online_results
.
miniapp_instance_app_online_dto
.
reduce
(
(
s
,
v
)
=>
{
return
(
s
+=
v
.
client
+
","
);
},
""
),
...
onlineInstance
.
app_info
,
accessToken
,
template_version
:
TEMPLATE_INFO
.
template_version
,
template_id
:
TEMPLATE_INFO
.
template_id
,
openId
,
appKey
,
consumeMiniAppId
,
userNick
,
appOwnerOpenId
,
});
}
else
{
console
.
log
(
"实例化信息获取失败"
);
}
}
else
{
if
(
TEMPLATE_INFO
.
template_version
!==
instanceOldInfo
.
template_version
)
{
const
{
clients
,
app_id
,
template_id
}
=
instanceOldInfo
;
let
updateInfo
=
{
clients
,
app_id
,
template_id
,
ext_json
:
{
name
:
"online"
,
},
template_version
:
TEMPLATE_INFO
.
template_version
,
};
let
updateInstanceInfo
=
await
ActivityTop
.
updateMiniInstance
(
updateInfo
);
let
onlineInstance
=
await
ActivityTop
.
pushOnlineInstance
({
app_id
:
updateInstanceInfo
.
app_id
,
app_version
:
updateInstanceInfo
.
app_version
,
});
await
ActivityInstance
.
updateInstanceInfo
({
template_version
:
TEMPLATE_INFO
.
template_version
,
...
onlineInstance
.
app_info
,
app_version
:
updateInstanceInfo
.
app_version
,
pre_view_url
:
updateInstanceInfo
.
pre_view_url
,
});
}
}
return
resultsModel
.
success
({
deadline
:
subInfo
.
deadline
||
""
});
}
catch
(
e
)
{
console
.
log
(
e
,
"获取授权信息失败"
);
return
resultsModel
.
error
(
CODE_TYPES
.
SYSTEM_ERROR
,
"获取授权信息失败"
);
...
...
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