mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-23 11:58:41 +08:00
第三方开放登录增加公众号通知
This commit is contained in:
parent
30fb586d0b
commit
b090f3778e
@ -26,7 +26,7 @@ class DeliverTask extends Task
|
|||||||
{
|
{
|
||||||
$logger = $this->getLogger('order');
|
$logger = $this->getLogger('order');
|
||||||
|
|
||||||
$tasks = $this->findTasks();
|
$tasks = $this->findTasks(30);
|
||||||
|
|
||||||
if ($tasks->count() == 0) {
|
if ($tasks->count() == 0) {
|
||||||
return;
|
return;
|
||||||
@ -244,7 +244,7 @@ class DeliverTask extends Task
|
|||||||
* @param int $limit
|
* @param int $limit
|
||||||
* @return ResultsetInterface|Resultset|TaskModel[]
|
* @return ResultsetInterface|Resultset|TaskModel[]
|
||||||
*/
|
*/
|
||||||
protected function findTasks($limit = 100)
|
protected function findTasks($limit = 30)
|
||||||
{
|
{
|
||||||
$itemType = TaskModel::TYPE_DELIVER;
|
$itemType = TaskModel::TYPE_DELIVER;
|
||||||
$status = TaskModel::STATUS_PENDING;
|
$status = TaskModel::STATUS_PENDING;
|
||||||
|
@ -20,7 +20,7 @@ class NoticeTask extends Task
|
|||||||
{
|
{
|
||||||
$logger = $this->getLogger('notice');
|
$logger = $this->getLogger('notice');
|
||||||
|
|
||||||
$tasks = $this->findTasks(500);
|
$tasks = $this->findTasks(300);
|
||||||
|
|
||||||
if ($tasks->count() == 0) {
|
if ($tasks->count() == 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -29,7 +29,7 @@ class RefundTask extends Task
|
|||||||
{
|
{
|
||||||
$logger = $this->getLogger('refund');
|
$logger = $this->getLogger('refund');
|
||||||
|
|
||||||
$tasks = $this->findTasks();
|
$tasks = $this->findTasks(30);
|
||||||
|
|
||||||
if ($tasks->count() == 0) {
|
if ($tasks->count() == 0) {
|
||||||
return;
|
return;
|
||||||
@ -259,7 +259,7 @@ class RefundTask extends Task
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理测试订单退款
|
* 处理赞赏订单退款
|
||||||
*
|
*
|
||||||
* @param OrderModel $order
|
* @param OrderModel $order
|
||||||
*/
|
*/
|
||||||
|
@ -8,6 +8,7 @@ use App\Repos\Connect as ConnectRepo;
|
|||||||
use App\Repos\User as UserRepo;
|
use App\Repos\User as UserRepo;
|
||||||
use App\Services\Auth\Home as AuthService;
|
use App\Services\Auth\Home as AuthService;
|
||||||
use App\Services\Logic\Account\Register as RegisterService;
|
use App\Services\Logic\Account\Register as RegisterService;
|
||||||
|
use App\Services\Logic\Notice\AccountLogin as AccountLoginNoticeService;
|
||||||
use App\Services\OAuth\QQ as QQAuth;
|
use App\Services\OAuth\QQ as QQAuth;
|
||||||
use App\Services\OAuth\WeiBo as WeiBoAuth;
|
use App\Services\OAuth\WeiBo as WeiBoAuth;
|
||||||
use App\Services\OAuth\WeiXin as WeiXinAuth;
|
use App\Services\OAuth\WeiXin as WeiXinAuth;
|
||||||
@ -32,6 +33,8 @@ class Connect extends Service
|
|||||||
|
|
||||||
$this->handleConnectRelation($user, $openUser);
|
$this->handleConnectRelation($user, $openUser);
|
||||||
|
|
||||||
|
$this->handleLoginNotice($user);
|
||||||
|
|
||||||
$auth = $this->getAppAuth();
|
$auth = $this->getAppAuth();
|
||||||
|
|
||||||
$auth->saveAuthInfo($user);
|
$auth->saveAuthInfo($user);
|
||||||
@ -57,6 +60,8 @@ class Connect extends Service
|
|||||||
|
|
||||||
$this->handleConnectRelation($user, $openUser);
|
$this->handleConnectRelation($user, $openUser);
|
||||||
|
|
||||||
|
$this->handleLoginNotice($user);
|
||||||
|
|
||||||
$auth = $this->getAppAuth();
|
$auth = $this->getAppAuth();
|
||||||
|
|
||||||
$auth->saveAuthInfo($user);
|
$auth->saveAuthInfo($user);
|
||||||
@ -75,6 +80,8 @@ class Connect extends Service
|
|||||||
|
|
||||||
$user = $userRepo->findById($connect->user_id);
|
$user = $userRepo->findById($connect->user_id);
|
||||||
|
|
||||||
|
$this->handleLoginNotice($user);
|
||||||
|
|
||||||
$auth = $this->getAppAuth();
|
$auth = $this->getAppAuth();
|
||||||
|
|
||||||
$auth->saveAuthInfo($user);
|
$auth->saveAuthInfo($user);
|
||||||
@ -208,4 +215,11 @@ class Connect extends Service
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function handleLoginNotice(UserModel $user)
|
||||||
|
{
|
||||||
|
$service = new AccountLoginNoticeService();
|
||||||
|
|
||||||
|
$service->createTask($user);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ class WechatOfficialAccount extends Service
|
|||||||
{
|
{
|
||||||
$service = new WechatService();
|
$service = new WechatService();
|
||||||
|
|
||||||
$service->logger->info('Received Message:' . json_encode($message));
|
$service->logger->debug('Received Message ' . json_encode($message));
|
||||||
|
|
||||||
switch ($message['MsgType']) {
|
switch ($message['MsgType']) {
|
||||||
case 'event':
|
case 'event':
|
||||||
@ -74,7 +74,7 @@ class WechatOfficialAccount extends Service
|
|||||||
return $this->handleLocationEvent($message);
|
return $this->handleLocationEvent($message);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return $message['Event'];
|
return $this->emptyReplyMessage();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -118,7 +118,7 @@ class WechatOfficialAccount extends Service
|
|||||||
|
|
||||||
$this->handleSubscribeRelation($userId, $openId);
|
$this->handleSubscribeRelation($userId, $openId);
|
||||||
|
|
||||||
return new TextMessage("欢迎您的光临!");
|
return new TextMessage('开心呀,我们又多了一个小伙伴!');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function handleUnsubscribeEvent($message)
|
protected function handleUnsubscribeEvent($message)
|
||||||
@ -134,7 +134,7 @@ class WechatOfficialAccount extends Service
|
|||||||
$subscribe->update();
|
$subscribe->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new TextMessage("我们又少了一个可爱的小伙伴!");
|
return new TextMessage('伤心呀,我们又少了一个小伙伴!');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function handleScanEvent($message)
|
protected function handleScanEvent($message)
|
||||||
@ -198,20 +198,22 @@ class WechatOfficialAccount extends Service
|
|||||||
|
|
||||||
protected function emptyReplyMessage()
|
protected function emptyReplyMessage()
|
||||||
{
|
{
|
||||||
return new TextMessage("");
|
return new TextMessage('');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function defaultReplyMessage()
|
protected function defaultReplyMessage()
|
||||||
{
|
{
|
||||||
return new TextMessage("没有匹配的服务,如有需要请联系客服!");
|
return new TextMessage('没有匹配的服务,如有需要请联系客服!');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function handleSubscribeRelation($userId, $openId)
|
protected function handleSubscribeRelation($userId, $openId)
|
||||||
{
|
{
|
||||||
$validator = new UserValidator();
|
$validator = new UserValidator();
|
||||||
|
|
||||||
$validator->checkUser($userId);
|
$validator->checkUser($userId);
|
||||||
|
|
||||||
$subscribeRepo = new WechatSubscribeRepo();
|
$subscribeRepo = new WechatSubscribeRepo();
|
||||||
|
|
||||||
$subscribe = $subscribeRepo->findByOpenId($openId);
|
$subscribe = $subscribeRepo->findByOpenId($openId);
|
||||||
|
|
||||||
if ($subscribe) {
|
if ($subscribe) {
|
||||||
|
@ -20,11 +20,19 @@ class AccountLogin extends WechatNotice
|
|||||||
$first = '你好,登录系统成功!';
|
$first = '你好,登录系统成功!';
|
||||||
$remark = '如果非本人操作,请立即修改密码哦!';
|
$remark = '如果非本人操作,请立即修改密码哦!';
|
||||||
|
|
||||||
|
$loginRegion = implode('/', [
|
||||||
|
$params['login_region']['country'],
|
||||||
|
$params['login_region']['province'],
|
||||||
|
$params['login_region']['city'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$loginTime = date('Y-m-d H:i:s', $params['login_time']);
|
||||||
|
|
||||||
$params = [
|
$params = [
|
||||||
'first' => $first,
|
'first' => $first,
|
||||||
'remark' => $remark,
|
'remark' => $remark,
|
||||||
'keyword1' => $params['login_region'],
|
'keyword1' => $loginRegion,
|
||||||
'keyword2' => date('Y-m-d H:i', $params['login_time']),
|
'keyword2' => $loginTime,
|
||||||
];
|
];
|
||||||
|
|
||||||
$templateId = $this->getTemplateId($this->templateCode);
|
$templateId = $this->getTemplateId($this->templateCode);
|
||||||
|
@ -49,9 +49,6 @@ $scheduler->php($script, $bin, ['--task' => 'unlock_user', '--action' => 'main']
|
|||||||
$scheduler->php($script, $bin, ['--task' => 'revoke_vip', '--action' => 'main'])
|
$scheduler->php($script, $bin, ['--task' => 'revoke_vip', '--action' => 'main'])
|
||||||
->daily(3, 11);
|
->daily(3, 11);
|
||||||
|
|
||||||
$scheduler->php($script, $bin, ['--task' => 'clean_token', '--action' => 'main'])
|
|
||||||
->daily(3, 17);
|
|
||||||
|
|
||||||
$scheduler->php($script, $bin, ['--task' => 'sitemap', '--action' => 'main'])
|
$scheduler->php($script, $bin, ['--task' => 'sitemap', '--action' => 'main'])
|
||||||
->daily(4, 3);
|
->daily(4, 3);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user