格式化事件代码

This commit is contained in:
liaofei 2019-11-28 18:40:09 +08:00
parent 0b2e0f103e
commit d236a9da93
7 changed files with 107 additions and 92 deletions

View File

@ -1,7 +1,9 @@
<?php <?php
namespace crmeb\subscribes; namespace crmeb\subscribes;
use think\facade\Db; use think\facade\Db;
/** /**
* 素材消息事件 * 素材消息事件
* Class MaterialSubscribe * Class MaterialSubscribe

View File

@ -1,4 +1,5 @@
<?php <?php
namespace crmeb\subscribes; namespace crmeb\subscribes;
use app\admin\model\wechat\WechatMessage; use app\admin\model\wechat\WechatMessage;
@ -42,7 +43,8 @@ class MessageSubscribe
$data['reflectnum'] = UserExtract::where('status', 0)->count();//提现 $data['reflectnum'] = UserExtract::where('status', 0)->count();//提现
$data['msgcount'] = intval($data['ordernum']) + intval($data['inventory']) + intval($data['commentnum']) + intval($data['reflectnum']); $data['msgcount'] = intval($data['ordernum']) + intval($data['inventory']) + intval($data['commentnum']) + intval($data['reflectnum']);
ChannelService::instance()->send('ADMIN_NEW_PUSH', $data); ChannelService::instance()->send('ADMIN_NEW_PUSH', $data);
}catch (\Exception $e){} } catch (\Exception $e) {
}
} }
/** /**
@ -101,6 +103,7 @@ class MessageSubscribe
Log::error('短信下发事件发生系统错误,错误原因:' . $e->getMessage()); Log::error('短信下发事件发生系统错误,错误原因:' . $e->getMessage());
} }
} }
/** /**
* 发送短信 * 发送短信
* @param boolean $switch 发送开关 * @param boolean $switch 发送开关
@ -228,6 +231,7 @@ class MessageSubscribe
$this->send(true, $userInfo->phone, compact('admin_name', 'order_id'), 'ADMIN_RETURN_GOODS_CODE', '用户退款管理员发送短信通知失败,订单号为:' . $storeInfo->order_id); $this->send(true, $userInfo->phone, compact('admin_name', 'order_id'), 'ADMIN_RETURN_GOODS_CODE', '用户退款管理员发送短信通知失败,订单号为:' . $storeInfo->order_id);
}); });
} }
/** /**
* 提取管理员权限 * 提取管理员权限
* @param callable $callable 回调函数 * @param callable $callable 回调函数

View File

@ -133,8 +133,10 @@ class OrderSubscribe
//检测会员等级 //检测会员等级
event('UserLevelAfter', [$order['uid']]); event('UserLevelAfter', [$order['uid']]);
try {
//向后台发送新订单消息 //向后台发送新订单消息
ChannelService::instance()->send('NEW_ORDER', ['order_id' => $order['order_id']]); ChannelService::instance()->send('NEW_ORDER', ['order_id' => $order['order_id']]);
} catch (\Throwable $e) {
}
} }
} }

View File

@ -1,4 +1,5 @@
<?php <?php
namespace crmeb\subscribes; namespace crmeb\subscribes;
/** /**
@ -30,7 +31,8 @@ class ProductSubscribe
* 用户操作产品添加事件 用户点赞产品 用户收藏产品 * 用户操作产品添加事件 用户点赞产品 用户收藏产品
* @param $event * @param $event
*/ */
public function onStoreProductUserOperationConfirmAfter($event){ public function onStoreProductUserOperationConfirmAfter($event)
{
list($category, $productId, $relationType, $uid) = $event; list($category, $productId, $relationType, $uid) = $event;
//$category 产品类型 //$category 产品类型
//$productId 产品编号 //$productId 产品编号
@ -42,7 +44,8 @@ class ProductSubscribe
* 用户操作产品取消事件 用户取消点赞产品 用户取消收藏产品 * 用户操作产品取消事件 用户取消点赞产品 用户取消收藏产品
* @param $event * @param $event
*/ */
public function onStoreProductUserOperationCancelAfter($event){ public function onStoreProductUserOperationCancelAfter($event)
{
list($category, $productId, $relationType, $uid) = $event; list($category, $productId, $relationType, $uid) = $event;
//$category 产品类型 //$category 产品类型
//$productId 产品编号 //$productId 产品编号

View File

@ -1,8 +1,10 @@
<?php <?php
namespace crmeb\subscribes; namespace crmeb\subscribes;
use app\admin\model\system\SystemAdmin; use app\admin\model\system\SystemAdmin;
use app\admin\model\system\SystemLog; use app\admin\model\system\SystemLog;
/** /**
* 后台系统事件 * 后台系统事件
* Class SystemSubscribe * Class SystemSubscribe

View File

@ -1,4 +1,5 @@
<?php <?php
namespace crmeb\subscribes; namespace crmeb\subscribes;
use app\admin\model\system\SystemAttachment; use app\admin\model\system\SystemAttachment;
@ -26,6 +27,7 @@ class TaskSubscribe
public function onTask_2() public function onTask_2()
{ {
} }
/** /**
* 6秒钟执行的方法 * 6秒钟执行的方法
*/ */