Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
goods
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
bp
goods
Commits
f233f8d6
Commit
f233f8d6
authored
Aug 06, 2021
by
jianghaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'jielong' of
https://gitlab.yidian-inc.com/bp/goods
into jielong
parents
c33d7377
e487e748
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
0 deletions
+61
-0
Pindan.php
daemon/Pindan.php
+61
-0
No files found.
daemon/Pindan.php
0 → 100644
View file @
f233f8d6
<?php
namespace
Daemon
;
use
Api\PhpServices\Daemon\DaemonServiceInterface
;
use
Api\PhpUtils\Log\DaemonLog
;
use
App\Services\marketing\MarketingService
;
use
Api\PhpServices\Wechat\Msg
;
class
Pindan
implements
DaemonServiceInterface
{
public
function
run
()
{
//只在16:40执行逻辑
if
(
date
(
'H'
)
!=
16
||
date
(
'i'
)
!=
40
)
{
sleep
(
5
);
return
false
;
}
try
{
//查询进行中的拼单活动
$params
[
'marketing_type'
]
=
4
;
//1分销 2团购 3秒杀 4团餐
$params
[
'online_status'
]
=
1
;
//状态 , 1启用,2关闭,3 到期
$params
[
'activity_status'
]
=
2
;
//1 未开始,2进行中,3已结束
$params
[
'page'
]
=
1
;
$params
[
'page_size'
]
=
1
;
$list
=
MarketingService
::
marketingList
(
$params
);
if
(
empty
(
$list
[
'result'
]))
{
return
false
;
}
//给订阅用户发送消息
//http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=71667995
$app_id
=
'wx4e0d92499185fb74'
;
$template_id
=
'LqGgPLdQPh2CHAFN1B8UK7NVc4LQt2zpjOZoyNuwaEI'
;
$page_url
=
'/pages/home/index?messageNotify=1'
;
$type
=
2
;
// 1 公众号 2 小程序
//活动信息
$params
=
[
$list
[
'result'
][
0
][
'marketing_name'
],
$list
[
'result'
][
0
][
'create_time'
],
$list
[
'result'
][
0
][
'pindan_desc'
]
];
//发送消息
Msg
::
send
(
999
,
$app_id
,
$template_id
,
$page_url
,
$type
,
$params
);
sleep
(
60
);
//保证16:40只执行一次
}
catch
(
Exception
$e
)
{
DaemonLog
::
info
(
'DaemonServiceInterface_pindan'
,
'params:'
.
json_encode
(
$params
)
.
' exception:'
.
$e
->
getMessage
()
);
}
}
}
\ No newline at end of file
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