站内信模板化
This commit is contained in:
parent
66cf670643
commit
6f4aff0648
|
@ -48,4 +48,5 @@ return [
|
|||
'User.avatar' => '头像',
|
||||
'Status activity' => '课程活动消息',
|
||||
'Mini_type activity_apply' => '课程活动审核',
|
||||
'Mini_type activity_order' => '课程活动订单',
|
||||
];
|
||||
|
|
|
@ -82,7 +82,7 @@ class Message extends BaseModel
|
|||
|
||||
public function getMiniTypeList()
|
||||
{
|
||||
return ['order_notice' => __('Mini_type order_notice'), 'classes_auth' => __('Mini_type classes_auth'), 'classes_apply' => __('Mini_type classes_apply') ,'activity_apply' => __('Mini_type activity_apply'), 'shop_apply' => __('Mini_type shop_apply'), 'classes_order_notice' => __('Mini_type classes_order_notice'), 'user_auth' => __('Mini_type user_auth'), 'aftercare' => __('Mini_type aftercare'), 'other' => __('Mini_type other')];
|
||||
return ['order_notice' => __('Mini_type order_notice'), 'classes_auth' => __('Mini_type classes_auth'), 'classes_apply' => __('Mini_type classes_apply') ,'activity_apply' => __('Mini_type activity_apply'), 'shop_apply' => __('Mini_type shop_apply'), 'classes_order_notice' => __('Mini_type classes_order_notice'), 'user_auth' => __('Mini_type user_auth'), 'aftercare' => __('Mini_type aftercare'), 'other' => __('Mini_type other'),'activity_order' => __('Mini_type activity_order')];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
<?php
|
||||
namespace app\common\listener\activityorder;
|
||||
use app\common\model\manystore\Shop;
|
||||
use app\common\model\school\classes\activity\order\Order;
|
||||
use app\common\model\school\classes\activity\order\OrderItem;
|
||||
use app\common\model\school\classes\Evaluate;
|
||||
use app\common\model\school\classes\Verification;
|
||||
use app\common\model\school\Message;
|
||||
use app\common\model\school\MessageConfig;
|
||||
|
||||
|
@ -19,6 +23,49 @@ class OrderHook
|
|||
{
|
||||
["order"=>$order] = $params;
|
||||
|
||||
$order = Order::where("id" , $order["id"])->find();
|
||||
|
||||
$detail = $order->detail;
|
||||
$user = $order->user;
|
||||
$order_item = OrderItem::where("classes_activity_order_id",$order["id"])->find();
|
||||
$shop = Shop::where("id",$order['shop_id'])->find();
|
||||
//记录订单日志
|
||||
$mini_type = "activity_order";
|
||||
$to_id = $order["user_id"];
|
||||
$status ="activity";
|
||||
$params=[
|
||||
"event"=>"classes_activity_order_create_after",
|
||||
"order_id"=>$order["id"],
|
||||
"order_no"=>$order["order_no"],
|
||||
"classes_activity_id"=>$order["classes_activity_id"],
|
||||
];
|
||||
$param = [
|
||||
"title"=>$detail["title"],
|
||||
"name" => $order_item["name"],
|
||||
"shop_name" => $shop['name'],
|
||||
"order_no" => $order["order_no"],
|
||||
"nickname" => $user["nickname"],
|
||||
"realname" => $user["realname"],
|
||||
"mobile" => $user["mobile"],
|
||||
"price" => $order["totalprice"],
|
||||
"payprice" => $order["payprice"],
|
||||
"real_refundprice" => $order["real_refundprice"],
|
||||
"sub_refundprice" => $order["sub_refundprice"],
|
||||
"reason" => $order["reason"],
|
||||
"address"=>$detail["address"]."(".$detail["address_detail"].")",
|
||||
"start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"end_time" => date("Y-m-d H:i",$detail["end_time"]),
|
||||
];
|
||||
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"])
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -29,6 +76,60 @@ class OrderHook
|
|||
{
|
||||
["order"=>$order] = $params;
|
||||
|
||||
$order = Order::where("id" , $order["id"])->find();
|
||||
$detail = $order->detail;
|
||||
$user = $order->user;
|
||||
$order_item = OrderItem::where("classes_activity_order_id",$order["id"])->find();
|
||||
$shop = Shop::where("id",$order['shop_id'])->find();
|
||||
//记录订单日志
|
||||
$mini_type = "activity_order";
|
||||
$to_id = $order["user_id"];
|
||||
$status ="activity";
|
||||
$params=[
|
||||
"event"=>"classes_activity_order_payed_after",
|
||||
"order_id"=>$order["id"],
|
||||
"order_no"=>$order["order_no"],
|
||||
"classes_activity_id"=>$order["classes_activity_id"],
|
||||
];
|
||||
$param = [
|
||||
"title"=>$detail["title"],
|
||||
"name" => $order_item["name"],
|
||||
"shop_name" => $shop['name'],
|
||||
"order_no" => $order["order_no"],
|
||||
"nickname" => $user["nickname"],
|
||||
"realname" => $user["realname"],
|
||||
"mobile" => $user["mobile"],
|
||||
"price" => $order["totalprice"],
|
||||
"payprice" => $order["payprice"],
|
||||
"real_refundprice" => $order["real_refundprice"],
|
||||
"sub_refundprice" => $order["sub_refundprice"],
|
||||
"reason" => $order["reason"],
|
||||
"address"=>$detail["address"]."(".$detail["address_detail"].")",
|
||||
"start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"end_time" => date("Y-m-d H:i",$detail["end_time"]),
|
||||
];
|
||||
|
||||
//发用户
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_user")
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
//发所有核销员
|
||||
$verifications = Verification::where("shop_id",$order['shop_id'])->select();
|
||||
foreach ($verifications as $verification){
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_verification")
|
||||
->setTemplateData($param)
|
||||
->setToUid($verification["user_id"])
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -39,6 +140,48 @@ class OrderHook
|
|||
['order' => $order,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
|
||||
|
||||
|
||||
$order = Order::where("id" , $order["id"])->find();
|
||||
|
||||
$detail = $order->detail;
|
||||
$user = $order->user;
|
||||
$order_item = OrderItem::where("classes_activity_order_id",$order["id"])->find();
|
||||
$shop = Shop::where("id",$order['shop_id'])->find();
|
||||
//记录订单日志
|
||||
$mini_type = "activity_order";
|
||||
$to_id = $order["user_id"];
|
||||
$status ="activity";
|
||||
$params=[
|
||||
"event"=>"classes_activity_order_cancel_after",
|
||||
"order_id"=>$order["id"],
|
||||
"order_no"=>$order["order_no"],
|
||||
"classes_activity_id"=>$order["classes_activity_id"],
|
||||
];
|
||||
$param = [
|
||||
"title"=>$detail["title"],
|
||||
"name" => $order_item["name"],
|
||||
"shop_name" => $shop['name'],
|
||||
"order_no" => $order["order_no"],
|
||||
"nickname" => $user["nickname"],
|
||||
"realname" => $user["realname"],
|
||||
"mobile" => $user["mobile"],
|
||||
"price" => $order["totalprice"],
|
||||
"payprice" => $order["payprice"],
|
||||
"real_refundprice" => $order["real_refundprice"],
|
||||
"sub_refundprice" => $order["sub_refundprice"],
|
||||
"reason" => $order["reason"],
|
||||
"address"=>$detail["address"]."(".$detail["address_detail"].")",
|
||||
"start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"end_time" => date("Y-m-d H:i",$detail["end_time"]),
|
||||
];
|
||||
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"])
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
|
||||
|
||||
}
|
||||
|
@ -74,7 +217,62 @@ class OrderHook
|
|||
public function classesActivityOrderAuthSuccessAfter(&$params)
|
||||
{
|
||||
['order' => $order,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
|
||||
|
||||
$order = Order::where("id" , $order["id"])->find();
|
||||
$detail = $order->detail;
|
||||
$user = $order->user;
|
||||
$order_item = OrderItem::where("classes_activity_order_id",$order["id"])->find();
|
||||
$shop = Shop::where("id",$order['shop_id'])->find();
|
||||
//记录订单日志
|
||||
$mini_type = "activity_order";
|
||||
$to_id = $order["user_id"];
|
||||
$status ="activity";
|
||||
$params=[
|
||||
"event"=>"classes_activity_order_auth_success_after",
|
||||
"order_id"=>$order["id"],
|
||||
"order_no"=>$order["order_no"],
|
||||
"classes_activity_id"=>$order["classes_activity_id"],
|
||||
];
|
||||
$param = [
|
||||
"title"=>$detail["title"],
|
||||
"name" => $order_item["name"],
|
||||
"shop_name" => $shop['name'],
|
||||
"order_no" => $order["order_no"],
|
||||
"nickname" => $user["nickname"],
|
||||
"realname" => $user["realname"],
|
||||
"mobile" => $user["mobile"],
|
||||
"price" => $order["totalprice"],
|
||||
"payprice" => $order["payprice"],
|
||||
"real_refundprice" => $order["real_refundprice"],
|
||||
"sub_refundprice" => $order["sub_refundprice"],
|
||||
"reason" => $order["reason"],
|
||||
"address"=>$detail["address"]."(".$detail["address_detail"].")",
|
||||
"start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"end_time" => date("Y-m-d H:i",$detail["end_time"]),
|
||||
];
|
||||
|
||||
//发用户
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_user")
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
//发所有核销员
|
||||
$verifications = Verification::where("shop_id",$order['shop_id'])->select();
|
||||
foreach ($verifications as $verification){
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_verification")
|
||||
->setTemplateData($param)
|
||||
->setToUid($verification["user_id"])
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -82,8 +280,61 @@ class OrderHook
|
|||
public function classesActivityOrderAuthFailAfter(&$params)
|
||||
{
|
||||
['order' => $order,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
|
||||
// $detail = $order->detail;
|
||||
$order = Order::where("id" , $order["id"])->find();
|
||||
$detail = $order->detail;
|
||||
$user = $order->user;
|
||||
$order_item = OrderItem::where("classes_activity_order_id",$order["id"])->find();
|
||||
$shop = Shop::where("id",$order['shop_id'])->find();
|
||||
//记录订单日志
|
||||
$mini_type = "activity_order";
|
||||
$to_id = $order["user_id"];
|
||||
$status ="activity";
|
||||
$params=[
|
||||
"event"=>"classes_activity_order_auth_fail_after",
|
||||
"order_id"=>$order["id"],
|
||||
"order_no"=>$order["order_no"],
|
||||
"classes_activity_id"=>$order["classes_activity_id"],
|
||||
];
|
||||
$param = [
|
||||
"title"=>$detail["title"],
|
||||
"name" => $order_item["name"],
|
||||
"shop_name" => $shop['name'],
|
||||
"order_no" => $order["order_no"],
|
||||
"nickname" => $user["nickname"],
|
||||
"realname" => $user["realname"],
|
||||
"mobile" => $user["mobile"],
|
||||
"price" => $order["totalprice"],
|
||||
"payprice" => $order["payprice"],
|
||||
"real_refundprice" => $order["real_refundprice"],
|
||||
"sub_refundprice" => $order["sub_refundprice"],
|
||||
"reason" => $order["reason"],
|
||||
"address"=>$detail["address"]."(".$detail["address_detail"].")",
|
||||
"start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"end_time" => date("Y-m-d H:i",$detail["end_time"]),
|
||||
];
|
||||
|
||||
//发用户
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_user")
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
//发所有核销员
|
||||
$verifications = Verification::where("shop_id",$order['shop_id'])->select();
|
||||
foreach ($verifications as $verification){
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_verification")
|
||||
->setTemplateData($param)
|
||||
->setToUid($verification["user_id"])
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -92,7 +343,60 @@ class OrderHook
|
|||
public function classesActivityOrderRefundSuccessAfter(&$params)
|
||||
{
|
||||
['order' => $order,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
|
||||
$order = Order::where("id" , $order["id"])->find();
|
||||
$detail = $order->detail;
|
||||
$user = $order->user;
|
||||
$order_item = OrderItem::where("classes_activity_order_id",$order["id"])->find();
|
||||
$shop = Shop::where("id",$order['shop_id'])->find();
|
||||
//记录订单日志
|
||||
$mini_type = "activity_order";
|
||||
$to_id = $order["user_id"];
|
||||
$status ="activity";
|
||||
$params=[
|
||||
"event"=>"classes_activity_order_refund_success_after",
|
||||
"order_id"=>$order["id"],
|
||||
"order_no"=>$order["order_no"],
|
||||
"classes_activity_id"=>$order["classes_activity_id"],
|
||||
];
|
||||
$param = [
|
||||
"title"=>$detail["title"],
|
||||
"name" => $order_item["name"],
|
||||
"shop_name" => $shop['name'],
|
||||
"order_no" => $order["order_no"],
|
||||
"nickname" => $user["nickname"],
|
||||
"realname" => $user["realname"],
|
||||
"mobile" => $user["mobile"],
|
||||
"price" => $order["totalprice"],
|
||||
"payprice" => $order["payprice"],
|
||||
"real_refundprice" => $order["real_refundprice"],
|
||||
"sub_refundprice" => $order["sub_refundprice"],
|
||||
"reason" => $order["reason"],
|
||||
"address"=>$detail["address"]."(".$detail["address_detail"].")",
|
||||
"start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"end_time" => date("Y-m-d H:i",$detail["end_time"]),
|
||||
];
|
||||
|
||||
//发用户
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_user")
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
//发所有核销员
|
||||
$verifications = Verification::where("shop_id",$order['shop_id'])->select();
|
||||
foreach ($verifications as $verification){
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_verification")
|
||||
->setTemplateData($param)
|
||||
->setToUid($verification["user_id"])
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -100,7 +404,62 @@ class OrderHook
|
|||
public function classesActivityOrderRefundFailAfter(&$params)
|
||||
{
|
||||
['order' => $order,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
|
||||
// $detail = $order->detail;
|
||||
|
||||
$order = Order::where("id" , $order["id"])->find();
|
||||
$detail = $order->detail;
|
||||
$user = $order->user;
|
||||
$order_item = OrderItem::where("classes_activity_order_id",$order["id"])->find();
|
||||
$shop = Shop::where("id",$order['shop_id'])->find();
|
||||
//记录订单日志
|
||||
$mini_type = "activity_order";
|
||||
$to_id = $order["user_id"];
|
||||
$status ="activity";
|
||||
$params=[
|
||||
"event"=>"classes_activity_order_refund_fail_after",
|
||||
"order_id"=>$order["id"],
|
||||
"order_no"=>$order["order_no"],
|
||||
"classes_activity_id"=>$order["classes_activity_id"],
|
||||
];
|
||||
$param = [
|
||||
"title"=>$detail["title"],
|
||||
"name" => $order_item["name"],
|
||||
"shop_name" => $shop['name'],
|
||||
"order_no" => $order["order_no"],
|
||||
"nickname" => $user["nickname"],
|
||||
"realname" => $user["realname"],
|
||||
"mobile" => $user["mobile"],
|
||||
"price" => $order["totalprice"],
|
||||
"payprice" => $order["payprice"],
|
||||
"real_refundprice" => $order["real_refundprice"],
|
||||
"sub_refundprice" => $order["sub_refundprice"],
|
||||
"reason" => $order["reason"],
|
||||
"address"=>$detail["address"]."(".$detail["address_detail"].")",
|
||||
"start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"end_time" => date("Y-m-d H:i",$detail["end_time"]),
|
||||
];
|
||||
|
||||
//发用户
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_user")
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
//发所有核销员
|
||||
$verifications = Verification::where("shop_id",$order['shop_id'])->select();
|
||||
foreach ($verifications as $verification){
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_verification")
|
||||
->setTemplateData($param)
|
||||
->setToUid($verification["user_id"])
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -111,9 +470,64 @@ class OrderHook
|
|||
public function classesActivityOrderFinishAfter(&$params)
|
||||
{
|
||||
['order' => $order,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
|
||||
// $detail = $order->detail;
|
||||
|
||||
|
||||
|
||||
$order = Order::where("id" , $order["id"])->find();
|
||||
$detail = $order->detail;
|
||||
$user = $order->user;
|
||||
$order_item = OrderItem::where("classes_activity_order_id",$order["id"])->find();
|
||||
$shop = Shop::where("id",$order['shop_id'])->find();
|
||||
//记录订单日志
|
||||
$mini_type = "activity_order";
|
||||
$to_id = $order["user_id"];
|
||||
$status ="activity";
|
||||
$params=[
|
||||
"event"=>"classes_activity_order_finish_after",
|
||||
"order_id"=>$order["id"],
|
||||
"order_no"=>$order["order_no"],
|
||||
"classes_activity_id"=>$order["classes_activity_id"],
|
||||
];
|
||||
$param = [
|
||||
"title"=>$detail["title"],
|
||||
"name" => $order_item["name"],
|
||||
"shop_name" => $shop['name'],
|
||||
"order_no" => $order["order_no"],
|
||||
"nickname" => $user["nickname"],
|
||||
"realname" => $user["realname"],
|
||||
"mobile" => $user["mobile"],
|
||||
"price" => $order["totalprice"],
|
||||
"payprice" => $order["payprice"],
|
||||
"real_refundprice" => $order["real_refundprice"],
|
||||
"sub_refundprice" => $order["sub_refundprice"],
|
||||
"reason" => $order["reason"],
|
||||
"address"=>$detail["address"]."(".$detail["address_detail"].")",
|
||||
"start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"end_time" => date("Y-m-d H:i",$detail["end_time"]),
|
||||
];
|
||||
|
||||
|
||||
//发用户
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_user")
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
//发所有核销员
|
||||
$verifications = Verification::where("shop_id",$order['shop_id'])->select();
|
||||
foreach ($verifications as $verification){
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_verification")
|
||||
->setTemplateData($param)
|
||||
->setToUid($verification["user_id"])
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
namespace app\common\listener\classes;
|
||||
use app\common\model\manystore\Shop;
|
||||
use app\common\model\school\Message;
|
||||
use app\common\model\school\MessageConfig;
|
||||
use app\common\model\User;
|
||||
|
||||
class ActivityHook
|
||||
{
|
||||
|
@ -12,11 +14,12 @@ class ActivityHook
|
|||
// 课程审核提交
|
||||
public function activityAuthNeedAfter(&$params)
|
||||
{
|
||||
['activity' => $activity] = $params;
|
||||
$shop = Shop::where("id",$activity['shop_id'])->find();
|
||||
['activity' => $activityAuth] = $params;
|
||||
$shop = Shop::where("id",$activityAuth['shop_id'])->find();
|
||||
if($shop && $shop['user_id']){
|
||||
$user = User::where("id",$shop["user_id"])->find();
|
||||
//课程推送给老师
|
||||
$desc = "您的新课程活动{$activity['title']}已提交审核,审核时间为1-3日内,请耐心等待审核结果";
|
||||
$desc = "您的新课程活动{$activityAuth['title']}已提交审核,审核时间为1-3日内,请耐心等待审核结果";
|
||||
|
||||
$title = "新课程活动审核";
|
||||
$mini_type = "activity_apply";
|
||||
|
@ -28,10 +31,34 @@ class ActivityHook
|
|||
$oper_type="system";
|
||||
$params=[
|
||||
"event"=>"activity_auth_need_after",
|
||||
"classes_lib_id"=>$activity["id"],
|
||||
"classes_lib_id"=>$activityAuth["id"],
|
||||
];
|
||||
Message::$event_name = $params["event"];
|
||||
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
|
||||
|
||||
|
||||
$param = [
|
||||
"name" => $shop['name'],
|
||||
"shop_realname"=> $user["realname"],
|
||||
"shop_nickname"=> $user["nickname"],
|
||||
"shop_mobile"=> $user["mobile"],
|
||||
"title" => $activityAuth['title'],
|
||||
"address"=>$activityAuth["address"]."(".$activityAuth["address_detail"].")",
|
||||
"price" => $activityAuth["price"],
|
||||
"start_time" => date("Y-m-d H:i",$activityAuth["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"end_time" => date("Y-m-d H:i",$activityAuth["end_time"]),
|
||||
"sign_start_time" => date("Y-m-d H:i",$activityAuth["sign_start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"sign_end_time" => date("Y-m-d H:i",$activityAuth["sign_end_time"]),
|
||||
"reason" => $activityAuth['reason'],
|
||||
];
|
||||
|
||||
//发给用户
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"])
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
|
||||
}
|
||||
|
||||
|
@ -44,12 +71,12 @@ class ActivityHook
|
|||
// 课程审核通过后
|
||||
public function activityAuthSuccessAfter(&$params)
|
||||
{
|
||||
['activity' => $activity] = $params;
|
||||
$shop = Shop::where("id",$activity['shop_id'])->find();
|
||||
['activity' => $activityAuth] = $params;
|
||||
$shop = Shop::where("id",$activityAuth['shop_id'])->find();
|
||||
if($shop && $shop['user_id']){
|
||||
|
||||
$user = User::where("id",$shop["user_id"])->find();
|
||||
//课程推送给老师
|
||||
$desc = "您的新课程活动{$activity['title']}已审核通过,可以在后台操作课程活动上架!";
|
||||
$desc = "您的新课程活动{$activityAuth['title']}已审核通过,可以在后台操作课程活动上架!";
|
||||
|
||||
$title = "新课程活动审核成功";
|
||||
$mini_type = "activity_apply";
|
||||
|
@ -61,10 +88,36 @@ class ActivityHook
|
|||
$oper_type="system";
|
||||
$params=[
|
||||
"event"=>"activity_auth_success_after",
|
||||
"classes_activity_id"=>$activity["id"],
|
||||
"classes_activity_id"=>$activityAuth["id"],
|
||||
];
|
||||
Message::$event_name = $params["event"];
|
||||
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
|
||||
|
||||
|
||||
|
||||
$param = [
|
||||
"name" => $shop['name'],
|
||||
"shop_realname"=> $user["realname"],
|
||||
"shop_nickname"=> $user["nickname"],
|
||||
"shop_mobile"=> $user["mobile"],
|
||||
"title" => $activityAuth['title'],
|
||||
"address"=>$activityAuth["address"]."(".$activityAuth["address_detail"].")",
|
||||
"price" => $activityAuth["price"],
|
||||
"start_time" => date("Y-m-d H:i",$activityAuth["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"end_time" => date("Y-m-d H:i",$activityAuth["end_time"]),
|
||||
"sign_start_time" => date("Y-m-d H:i",$activityAuth["sign_start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"sign_end_time" => date("Y-m-d H:i",$activityAuth["sign_end_time"]),
|
||||
"reason" => $activityAuth['reason'],
|
||||
];
|
||||
|
||||
//发给用户
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"])
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -74,12 +127,12 @@ class ActivityHook
|
|||
// 课程审核失败后
|
||||
public function activityAuthFailAfter(&$params)
|
||||
{
|
||||
['activity' => $activity] = $params;
|
||||
$shop = Shop::where("id",$activity['shop_id'])->find();
|
||||
['activity' => $activityAuth] = $params;
|
||||
$shop = Shop::where("id",$activityAuth['shop_id'])->find();
|
||||
if($shop && $shop['user_id']){
|
||||
|
||||
$user = User::where("id",$shop["user_id"])->find();
|
||||
//课程推送给老师
|
||||
$desc = "您的新课程活动{$activity['title']}审核未通过,未通过原因为:{$activity['reason']},整改后,可以在后台重新提交!";
|
||||
$desc = "您的新课程活动{$activityAuth['title']}审核未通过,未通过原因为:{$activityAuth['reason']},整改后,可以在后台重新提交!";
|
||||
|
||||
$title = "新课程活动审核不通过";
|
||||
$mini_type = "activity_apply";
|
||||
|
@ -91,10 +144,37 @@ class ActivityHook
|
|||
$oper_type="system";
|
||||
$params=[
|
||||
"event"=>"activity_auth_fail_after",
|
||||
"classes_activity_id"=>$activity["id"],
|
||||
"classes_activity_id"=>$activityAuth["id"],
|
||||
];
|
||||
Message::$event_name = $params["event"];
|
||||
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
|
||||
|
||||
|
||||
|
||||
|
||||
$param = [
|
||||
"name" => $shop['name'],
|
||||
"shop_realname"=> $user["realname"],
|
||||
"shop_nickname"=> $user["nickname"],
|
||||
"shop_mobile"=> $user["mobile"],
|
||||
"title" => $activityAuth['title'],
|
||||
"address"=>$activityAuth["address"]."(".$activityAuth["address_detail"].")",
|
||||
"price" => $activityAuth["price"],
|
||||
"start_time" => date("Y-m-d H:i",$activityAuth["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"end_time" => date("Y-m-d H:i",$activityAuth["end_time"]),
|
||||
"sign_start_time" => date("Y-m-d H:i",$activityAuth["sign_start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"sign_end_time" => date("Y-m-d H:i",$activityAuth["sign_end_time"]),
|
||||
"reason" => $activityAuth['reason'],
|
||||
];
|
||||
|
||||
//发给用户
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"])
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
<?php
|
||||
namespace app\common\listener\classes;
|
||||
use app\common\model\dyqc\ManystoreShop;
|
||||
use app\common\model\school\classes\Teacher;
|
||||
use app\common\model\school\Message;
|
||||
use app\common\model\school\MessageConfig;
|
||||
|
||||
class ClassesHook
|
||||
{
|
||||
|
@ -12,6 +15,9 @@ class ClassesHook
|
|||
public function classesAuthNeedAfter(&$params)
|
||||
{
|
||||
['classes' => $classes] = $params;
|
||||
$teacher_user = \app\common\model\User::get($classes["user_id"]);
|
||||
$teacher = Teacher::get($classes["teacher_id"]);
|
||||
$shop = ManystoreShop::get($classes["shop_id"]);
|
||||
//课程推送给老师
|
||||
$desc = "您的新课程{$classes['title']}已提交审核,审核时间为1-3日内,请耐心等待审核结果";
|
||||
|
||||
|
@ -27,9 +33,39 @@ class ClassesHook
|
|||
"event"=>"classes_auth_need_after",
|
||||
"classes_lib_id"=>$classes["id"],
|
||||
];
|
||||
Message::$event_name = $params["event"];
|
||||
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
|
||||
|
||||
$param = [
|
||||
"title" => $classes['title'],
|
||||
"teacher_name"=> $teacher["name"] ?? "课程负责人",
|
||||
"teacher_realname"=> $teacher_user["realname"] ?? "课程负责人真实姓名",
|
||||
"teacher_nickname"=> $teacher_user["nickname"] ?? "课程负责人昵称",
|
||||
"teacher_mobile"=> $teacher_user["mobile"] ?? "课程负责人电话",
|
||||
"address"=>$classes["address"]."(".$classes["address_detail"].")",
|
||||
"price" => $classes["price"],
|
||||
"start_time" => date("Y-m-d H:i",$classes["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"end_time" => date("Y-m-d H:i",$classes["end_time"]),
|
||||
// "reason" => $classes['reason'],
|
||||
];
|
||||
|
||||
//发给机构老师
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_user")
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
//发给机构拥有者
|
||||
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_shop")
|
||||
->setTemplateData($param)
|
||||
->setToUid($shop["user_id"])
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
|
||||
}
|
||||
|
||||
|
@ -39,6 +75,9 @@ class ClassesHook
|
|||
public function classesAuthSuccessAfter(&$params)
|
||||
{
|
||||
['classes' => $classes] = $params;
|
||||
$teacher_user = \app\common\model\User::get($classes["user_id"]);
|
||||
$teacher = Teacher::get($classes["teacher_id"]);
|
||||
$shop = ManystoreShop::get($classes["shop_id"]);
|
||||
|
||||
//课程推送给老师
|
||||
$desc = "您的新课程{$classes['title']}已审核通过,可以在后台操作课程上架!";
|
||||
|
@ -55,8 +94,29 @@ class ClassesHook
|
|||
"event"=>"classes_auth_success_after",
|
||||
"classes_lib_id"=>$classes["id"],
|
||||
];
|
||||
Message::$event_name = $params["event"];
|
||||
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
|
||||
|
||||
$param = [
|
||||
"title" => $classes['title'],
|
||||
"teacher_name"=> $teacher["name"] ?? "课程负责人",
|
||||
"teacher_realname"=> $teacher_user["realname"] ?? "课程负责人真实姓名",
|
||||
"teacher_nickname"=> $teacher_user["nickname"] ?? "课程负责人昵称",
|
||||
"teacher_mobile"=> $teacher_user["mobile"] ?? "课程负责人电话",
|
||||
"address"=>$classes["address"]."(".$classes["address_detail"].")",
|
||||
"price" => $classes["price"],
|
||||
"start_time" => date("Y-m-d H:i",$classes["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"end_time" => date("Y-m-d H:i",$classes["end_time"]),
|
||||
// "reason" => $classes['reason'],
|
||||
];
|
||||
|
||||
//发给机构老师
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"])
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
|
||||
}
|
||||
|
||||
|
@ -64,7 +124,9 @@ class ClassesHook
|
|||
public function classesAuthFailAfter(&$params)
|
||||
{
|
||||
['classes' => $classes] = $params;
|
||||
|
||||
$teacher_user = \app\common\model\User::get($classes["user_id"]);
|
||||
$teacher = Teacher::get($classes["teacher_id"]);
|
||||
$shop = ManystoreShop::get($classes["shop_id"]);
|
||||
|
||||
//课程推送给老师
|
||||
$desc = "您的新课程{$classes['title']}审核未通过,未通过原因为:{$classes['reason']},整改后,可以在后台重新提交!";
|
||||
|
@ -81,10 +143,29 @@ class ClassesHook
|
|||
"event"=>"classes_auth_fail_after",
|
||||
"classes_lib_id"=>$classes["id"],
|
||||
];
|
||||
Message::$event_name = $params["event"];
|
||||
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
|
||||
|
||||
$param = [
|
||||
"title" => $classes['title'],
|
||||
"teacher_name"=> $teacher["name"] ?? "课程负责人",
|
||||
"teacher_realname"=> $teacher_user["realname"] ?? "课程负责人真实姓名",
|
||||
"teacher_nickname"=> $teacher_user["nickname"] ?? "课程负责人昵称",
|
||||
"teacher_mobile"=> $teacher_user["mobile"] ?? "课程负责人电话",
|
||||
"address"=>$classes["address"]."(".$classes["address_detail"].")",
|
||||
"price" => $classes["price"],
|
||||
"start_time" => date("Y-m-d H:i",$classes["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"end_time" => date("Y-m-d H:i",$classes["end_time"]),
|
||||
"reason" => $classes['reason'],
|
||||
];
|
||||
|
||||
//发给机构老师
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"])
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -176,11 +176,11 @@ class OrderHook
|
|||
}
|
||||
//插入订单取消日志
|
||||
if(!$user_id ||$order["user_id"] !=$user_id ){
|
||||
$pron = "[员工操作]";
|
||||
$pron = "[机构老师代操作]";
|
||||
}else{
|
||||
$pron = "";
|
||||
}
|
||||
$desc = $pron."{$detail["title"]}课程课时{$order["name"]}预约单审核成功,预约成功等待核销!";
|
||||
$desc = $pron;
|
||||
|
||||
$title = "课时预约单审核通过";
|
||||
$mini_type = "classes_auth";
|
||||
|
@ -233,14 +233,20 @@ class OrderHook
|
|||
{
|
||||
['order' => $order,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
|
||||
$detail = $order->detail;
|
||||
|
||||
$user = $order->user;
|
||||
//查询老师信息和老师用户信息
|
||||
$teacher = Teacher::where("id", $detail["teacher_id"])->find();
|
||||
$teacher_user = null;
|
||||
if($teacher){
|
||||
$teacher_user = $teacher->user;
|
||||
}
|
||||
//插入订单取消日志
|
||||
if(!$user_id ||$order["user_id"] !=$user_id ){
|
||||
$pron = "[员工操作]";
|
||||
$pron = "[机构老师代操作]";
|
||||
}else{
|
||||
$pron = "";
|
||||
}
|
||||
$desc = $pron."{$detail["title"]}课程课时{$order["name"]}预约单审核不通过,原因;{$order['reason']},该课时单将取消以便重新下单";
|
||||
$desc = $pron;
|
||||
|
||||
$title = "课时预约单审核不通过";
|
||||
$mini_type = "classes_auth";
|
||||
|
@ -256,10 +262,37 @@ class OrderHook
|
|||
"order_no"=>$order["order_no"],
|
||||
"reason"=>$order['reason']
|
||||
];
|
||||
Message::$event_name = $params["event"];
|
||||
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
|
||||
|
||||
|
||||
|
||||
$param = [
|
||||
"title"=>$detail["title"],
|
||||
"name" => $order["name"],
|
||||
"order_no" => $order["order_no"],
|
||||
"nickname" => $user["nickname"],
|
||||
"realname" => $user["realname"],
|
||||
"mobile" => $user["mobile"],
|
||||
"reason" => $order["reason"],
|
||||
"system"=>$desc,
|
||||
"teacher_name"=> $teacher["name"] ?? "课程负责人",
|
||||
"teacher_realname"=> $teacher_user["realname"] ?? "课程负责人真实姓名",
|
||||
"teacher_nickname"=> $teacher_user["nickname"] ?? "课程负责人昵称",
|
||||
"teacher_mobile"=> $teacher_user["mobile"] ?? "课程负责人电话",
|
||||
"start_time" => date("Y-m-d H:i",$order["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"end_time" => date("Y-m-d H:i",$order["end_time"]),
|
||||
"address"=>$detail["address"]."(".$detail["address_detail"].")",
|
||||
];
|
||||
|
||||
//发给用户
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"])
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
|
||||
}
|
||||
|
||||
// 订单核销完成后
|
||||
|
@ -267,12 +300,18 @@ class OrderHook
|
|||
{
|
||||
['order' => $order,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
|
||||
$detail = $order->detail;
|
||||
|
||||
$user = $order->user;
|
||||
//查询老师信息和老师用户信息
|
||||
$teacher = Teacher::where("id", $detail["teacher_id"])->find();
|
||||
$teacher_user = null;
|
||||
if($teacher){
|
||||
$teacher_user = $teacher->user;
|
||||
}
|
||||
|
||||
if(!$user_id ||$order["user_id"] !=$user_id ){
|
||||
$desc = "[员工操作]{$detail["title"]}课程课时{$order["name"]}预约单核销成功,当前课时已完成";
|
||||
$desc = "[机构老师代操作]";
|
||||
}else{
|
||||
$desc = "{$detail["title"]}课程课时{$order["name"]}预约单核销成功,当前课时已完成";
|
||||
$desc = "";
|
||||
}
|
||||
|
||||
$title = "课时预约单已核销";
|
||||
|
@ -288,10 +327,38 @@ class OrderHook
|
|||
"order_id"=>$order["id"],
|
||||
"order_no"=>$order["order_no"],
|
||||
];
|
||||
Message::$event_name = $params["event"];
|
||||
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
|
||||
|
||||
|
||||
|
||||
|
||||
$param = [
|
||||
"title"=>$detail["title"],
|
||||
"name" => $order["name"],
|
||||
"order_no" => $order["order_no"],
|
||||
"nickname" => $user["nickname"],
|
||||
"realname" => $user["realname"],
|
||||
"mobile" => $user["mobile"],
|
||||
// "reason" => $order["reason"],
|
||||
"system"=>$desc,
|
||||
"teacher_name"=> $teacher["name"] ?? "课程负责人",
|
||||
"teacher_realname"=> $teacher_user["realname"] ?? "课程负责人真实姓名",
|
||||
"teacher_nickname"=> $teacher_user["nickname"] ?? "课程负责人昵称",
|
||||
"teacher_mobile"=> $teacher_user["mobile"] ?? "课程负责人电话",
|
||||
"start_time" => date("Y-m-d H:i",$order["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"end_time" => date("Y-m-d H:i",$order["end_time"]),
|
||||
"address"=>$detail["address"]."(".$detail["address_detail"].")",
|
||||
];
|
||||
|
||||
//发给用户
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"])
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -302,11 +369,17 @@ class OrderHook
|
|||
{
|
||||
['order' => $order,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
|
||||
$detail = $order->detail;
|
||||
|
||||
$user = $order->user;
|
||||
//查询老师信息和老师用户信息
|
||||
$teacher = Teacher::where("id", $detail["teacher_id"])->find();
|
||||
$teacher_user = null;
|
||||
if($teacher){
|
||||
$teacher_user = $teacher->user;
|
||||
}
|
||||
if(!$user_id ||$order["user_id"] !=$user_id ){
|
||||
$desc = "[员工代操作]{$detail["title"]}课程课时{$order["name"]}预约单取消成功,课时已原路退回";
|
||||
$desc = "[机构老师代操作]";
|
||||
}else{
|
||||
$desc = "{$detail["title"]}课程课时{$order["name"]}预约单取消成功,课时已原路退回";
|
||||
$desc = "";
|
||||
}
|
||||
|
||||
$title = "课时预约单已取消";
|
||||
|
@ -322,11 +395,35 @@ class OrderHook
|
|||
"order_id"=>$order["id"],
|
||||
"order_no"=>$order["order_no"],
|
||||
];
|
||||
Message::$event_name = $params["event"];
|
||||
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
|
||||
|
||||
|
||||
$param = [
|
||||
"title"=>$detail["title"],
|
||||
"name" => $order["name"],
|
||||
"order_no" => $order["order_no"],
|
||||
"nickname" => $user["nickname"],
|
||||
"realname" => $user["realname"],
|
||||
"mobile" => $user["mobile"],
|
||||
// "reason" => $order["reason"],
|
||||
"system"=>$desc,
|
||||
"teacher_name"=> $teacher["name"] ?? "课程负责人",
|
||||
"teacher_realname"=> $teacher_user["realname"] ?? "课程负责人真实姓名",
|
||||
"teacher_nickname"=> $teacher_user["nickname"] ?? "课程负责人昵称",
|
||||
"teacher_mobile"=> $teacher_user["mobile"] ?? "课程负责人电话",
|
||||
"start_time" => date("Y-m-d H:i",$order["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"end_time" => date("Y-m-d H:i",$order["end_time"]),
|
||||
"address"=>$detail["address"]."(".$detail["address_detail"].")",
|
||||
];
|
||||
|
||||
//发给用户
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"])
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ namespace app\common\listener\manystore;
|
|||
use app\common\model\dyqc\ManystoreShop;
|
||||
use app\common\model\school\classes\ClassesLib;
|
||||
use app\common\model\school\Message;
|
||||
use app\common\model\school\MessageConfig;
|
||||
use app\common\model\User;
|
||||
use app\manystore\model\Manystore;
|
||||
|
||||
class ShopHook
|
||||
|
@ -67,7 +69,7 @@ class ShopHook
|
|||
{
|
||||
["shop"=>$shop] = $params;
|
||||
|
||||
|
||||
$user = User::where("id" ,$shop["user_id"])->find();
|
||||
//记录订单日志
|
||||
|
||||
$desc = "您申请的认证{$shop['name']}已提交审核,审核时间为1-3日内,请耐心等待审核结果";
|
||||
|
@ -85,8 +87,28 @@ class ShopHook
|
|||
"shop_id"=>$shop["id"],
|
||||
"desc"=>$shop["desc"],
|
||||
];
|
||||
Message::$event_name = $params["event"];
|
||||
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
|
||||
|
||||
|
||||
|
||||
|
||||
$param = [
|
||||
"name" => $shop['name'],
|
||||
"nickname" => $user["nickname"],
|
||||
"realname" => $user["realname"],
|
||||
"mobile" => $user["mobile"],
|
||||
"desc"=>$shop['desc'],
|
||||
"address"=>$shop["address"]."(".$shop["address_detail"].")",
|
||||
];
|
||||
|
||||
//发给用户
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"])
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
|
||||
//机构初始化数据
|
||||
ManystoreShop::initData($shop->id);
|
||||
|
@ -104,11 +126,6 @@ class ShopHook
|
|||
$manystore = Manystore::where("shop_id",$shop["id"])->find();
|
||||
$mobile = $user['mobile'] ?? "";
|
||||
$shop_backend_url = config("site.shop_backend_url");
|
||||
$desc = "您申请的认证:{$shop['name']}已审核通过,您可登录官方后台补充完其余资料,并开始发布课程<br>
|
||||
后台地址是: {$shop_backend_url}<br>
|
||||
账号是: 您的手机号 {$mobile}<br>
|
||||
初始化密码是: {$password}<br>
|
||||
";
|
||||
|
||||
$title = "入驻申请通过";
|
||||
$mini_type = "shop_apply";
|
||||
|
@ -126,23 +143,44 @@ class ShopHook
|
|||
"mobile"=>$mobile,
|
||||
"password"=>$password,
|
||||
];
|
||||
Message::$event_name = $params["event"];
|
||||
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$param = [
|
||||
"name" => $shop['name'],
|
||||
"nickname" => $user["nickname"],
|
||||
"realname" => $user["realname"],
|
||||
"mobile" => $user["mobile"],
|
||||
"desc"=>$shop['desc'],
|
||||
"address"=>$shop["address"]."(".$shop["address_detail"].")",
|
||||
"shop_backend_url" => $shop_backend_url,
|
||||
"username"=>$manystore["username"],
|
||||
"password"=>$password,
|
||||
];
|
||||
|
||||
//发给用户
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"])
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 机构账号审核失败后
|
||||
public function shopAuthFailAfter(&$params)
|
||||
{
|
||||
["shop"=>$shop] = $params;
|
||||
|
||||
$user = User::where("id" ,$shop["user_id"])->find();
|
||||
|
||||
//记录订单日志
|
||||
|
||||
$desc = "您申请的认证{$shop['name']}审核未通过,未通过原因为:{$shop['reason']},如已整改,可重新发起申请";
|
||||
|
||||
$title = "入驻申请失败";
|
||||
$mini_type = "shop_apply";
|
||||
$to_type="user";
|
||||
|
@ -156,10 +194,28 @@ class ShopHook
|
|||
"shop_id"=>$shop["id"],
|
||||
"desc"=>$shop["desc"],
|
||||
];
|
||||
Message::$event_name = $params["event"];
|
||||
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
|
||||
|
||||
|
||||
$param = [
|
||||
"name" => $shop['name'],
|
||||
"nickname" => $user["nickname"],
|
||||
"realname" => $user["realname"],
|
||||
"mobile" => $user["mobile"],
|
||||
"desc"=>$shop['desc'],
|
||||
"address"=>$shop["address"]."(".$shop["address_detail"].")",
|
||||
"reason" => $shop['reason'],
|
||||
];
|
||||
|
||||
//发给用户
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"])
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
<?php
|
||||
namespace app\common\listener\serviceorder;
|
||||
use app\common\model\dyqc\ManystoreShop;
|
||||
use app\common\model\school\classes\Teacher;
|
||||
use app\common\model\school\Message;
|
||||
use app\common\model\school\MessageConfig;
|
||||
use app\common\model\User;
|
||||
|
||||
class OrderHook
|
||||
{
|
||||
|
@ -13,6 +17,10 @@ class OrderHook
|
|||
['serviceorder' => $serverorder,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
|
||||
|
||||
$detail = $serverorder->detail;
|
||||
$user = User::where("id",$serverorder["user_id"])->find();
|
||||
$teacher_user = \app\common\model\User::get($detail["user_id"]);
|
||||
$teacher = Teacher::get($detail["teacher_id"]);
|
||||
$shop = ManystoreShop::get($serverorder["shop_id"]);
|
||||
//记录订单日志
|
||||
|
||||
$desc = "课程{$detail["title"]}订单已申请售后,等待机构处理";
|
||||
|
@ -31,10 +39,63 @@ class OrderHook
|
|||
"classes_order_id"=>$serverorder["classes_order_id"],
|
||||
"order_no"=>$serverorder["order_no"],
|
||||
];
|
||||
Message::$event_name = $params["event"];
|
||||
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
|
||||
|
||||
|
||||
|
||||
$param = [
|
||||
"name" => $shop['name'],
|
||||
"realname"=> $user["realname"],
|
||||
"nickname"=> $user["nickname"],
|
||||
"mobile"=> $user["mobile"],
|
||||
|
||||
|
||||
"title" => $detail['title'],
|
||||
"teacher_name"=> $teacher["name"] ?? "课程负责人",
|
||||
"teacher_realname"=> $teacher_user["realname"] ?? "课程负责人真实姓名",
|
||||
"teacher_nickname"=> $teacher_user["nickname"] ?? "课程负责人昵称",
|
||||
"teacher_mobile"=> $teacher_user["mobile"] ?? "课程负责人电话",
|
||||
"address"=>$detail["address"]."(".$detail["address_detail"].")",
|
||||
"price" => $detail["price"],
|
||||
"start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"end_time" => date("Y-m-d H:i",$detail["end_time"]),
|
||||
"reason" => $serverorder['reason'],
|
||||
"reject_reason" => $serverorder['reject_reason'],
|
||||
"order_no" => $serverorder['order_no'],
|
||||
"tbc_price" => $serverorder['tbc_price'],
|
||||
"c_price" => $serverorder['c_price'],
|
||||
"real_refundprice" => $serverorder['real_refundprice'],
|
||||
"sub_refundprice" => $serverorder['sub_refundprice'],
|
||||
];
|
||||
|
||||
|
||||
//发给用户
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_user")
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
//发给机构负责人
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_shop")
|
||||
->setTemplateData($param)
|
||||
->setToUid($shop["user_id"])
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
//发给机构老师
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_teacher")
|
||||
->setTemplateData($param)
|
||||
->setToUid($teacher["user_id"])
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,6 +108,10 @@ class OrderHook
|
|||
['serviceorder' => $serviceorder,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
|
||||
|
||||
$detail = $serviceorder->detail;
|
||||
$user = User::where("id",$serviceorder["user_id"])->find();
|
||||
$teacher_user = \app\common\model\User::get($detail["user_id"]);
|
||||
$teacher = Teacher::get($detail["teacher_id"]);
|
||||
$shop = ManystoreShop::get($serviceorder["shop_id"]);
|
||||
//记录订单日志
|
||||
|
||||
$desc = "课程{$detail["title"]}订单已取消售后,订单恢复原状态";
|
||||
|
@ -65,8 +130,63 @@ class OrderHook
|
|||
"classes_order_id"=>$serviceorder["classes_order_id"],
|
||||
"order_no"=>$serviceorder["order_no"],
|
||||
];
|
||||
Message::$event_name = $params["event"];
|
||||
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
|
||||
|
||||
|
||||
|
||||
$param = [
|
||||
"name" => $shop['name'],
|
||||
"realname"=> $user["realname"],
|
||||
"nickname"=> $user["nickname"],
|
||||
"mobile"=> $user["mobile"],
|
||||
|
||||
|
||||
"title" => $detail['title'],
|
||||
"teacher_name"=> $teacher["name"] ?? "课程负责人",
|
||||
"teacher_realname"=> $teacher_user["realname"] ?? "课程负责人真实姓名",
|
||||
"teacher_nickname"=> $teacher_user["nickname"] ?? "课程负责人昵称",
|
||||
"teacher_mobile"=> $teacher_user["mobile"] ?? "课程负责人电话",
|
||||
"address"=>$detail["address"]."(".$detail["address_detail"].")",
|
||||
"price" => $detail["price"],
|
||||
"start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"end_time" => date("Y-m-d H:i",$detail["end_time"]),
|
||||
"reason" => $serviceorder['reason'],
|
||||
"reject_reason" => $serviceorder['reject_reason'],
|
||||
"order_no" => $serviceorder['order_no'],
|
||||
"tbc_price" => $serviceorder['tbc_price'],
|
||||
"c_price" => $serviceorder['c_price'],
|
||||
"real_refundprice" => $serviceorder['real_refundprice'],
|
||||
"sub_refundprice" => $serviceorder['sub_refundprice'],
|
||||
];
|
||||
|
||||
|
||||
//发给用户
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_user")
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
//发给机构负责人
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_shop")
|
||||
->setTemplateData($param)
|
||||
->setToUid($shop["user_id"])
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
//发给机构老师
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_teacher")
|
||||
->setTemplateData($param)
|
||||
->setToUid($teacher["user_id"])
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -79,6 +199,10 @@ class OrderHook
|
|||
['serviceorder' => $serviceorder,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
|
||||
|
||||
$detail = $serviceorder->detail;
|
||||
$user = User::where("id",$serviceorder["user_id"])->find();
|
||||
$teacher_user = \app\common\model\User::get($detail["user_id"]);
|
||||
$teacher = Teacher::get($detail["teacher_id"]);
|
||||
$shop = ManystoreShop::get($serviceorder["shop_id"]);
|
||||
//记录订单日志
|
||||
|
||||
$desc = "课程{$detail["title"]}订单机构已同意售后,待您确认售后金额是否同意";
|
||||
|
@ -97,8 +221,62 @@ class OrderHook
|
|||
"classes_order_id"=>$serviceorder["classes_order_id"],
|
||||
"order_no"=>$serviceorder["order_no"],
|
||||
];
|
||||
Message::$event_name = $params["event"];
|
||||
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
|
||||
|
||||
|
||||
$param = [
|
||||
"name" => $shop['name'],
|
||||
"realname"=> $user["realname"],
|
||||
"nickname"=> $user["nickname"],
|
||||
"mobile"=> $user["mobile"],
|
||||
|
||||
|
||||
"title" => $detail['title'],
|
||||
"teacher_name"=> $teacher["name"] ?? "课程负责人",
|
||||
"teacher_realname"=> $teacher_user["realname"] ?? "课程负责人真实姓名",
|
||||
"teacher_nickname"=> $teacher_user["nickname"] ?? "课程负责人昵称",
|
||||
"teacher_mobile"=> $teacher_user["mobile"] ?? "课程负责人电话",
|
||||
"address"=>$detail["address"]."(".$detail["address_detail"].")",
|
||||
"price" => $detail["price"],
|
||||
"start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"end_time" => date("Y-m-d H:i",$detail["end_time"]),
|
||||
"reason" => $serviceorder['reason'],
|
||||
"reject_reason" => $serviceorder['reject_reason'],
|
||||
"order_no" => $serviceorder['order_no'],
|
||||
"tbc_price" => $serviceorder['tbc_price'],
|
||||
"c_price" => $serviceorder['c_price'],
|
||||
"real_refundprice" => $serviceorder['real_refundprice'],
|
||||
"sub_refundprice" => $serviceorder['sub_refundprice'],
|
||||
];
|
||||
|
||||
|
||||
//发给用户
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_user")
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
//发给机构负责人
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_shop")
|
||||
->setTemplateData($param)
|
||||
->setToUid($shop["user_id"])
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
//发给机构老师
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_teacher")
|
||||
->setTemplateData($param)
|
||||
->setToUid($teacher["user_id"])
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -110,6 +288,10 @@ class OrderHook
|
|||
['serviceorder' => $serviceorder,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
|
||||
|
||||
$detail = $serviceorder->detail;
|
||||
$user = User::where("id",$serviceorder["user_id"])->find();
|
||||
$teacher_user = \app\common\model\User::get($detail["user_id"]);
|
||||
$teacher = Teacher::get($detail["teacher_id"]);
|
||||
$shop = ManystoreShop::get($serviceorder["shop_id"]);
|
||||
//记录订单日志
|
||||
|
||||
$desc = "课程{$detail["title"]}订单机构售后已驳回,原因:{$serviceorder["reject_reason"]}";
|
||||
|
@ -128,8 +310,64 @@ class OrderHook
|
|||
"classes_order_id"=>$serviceorder["classes_order_id"],
|
||||
"order_no"=>$serviceorder["order_no"],
|
||||
];
|
||||
Message::$event_name = $params["event"];
|
||||
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
|
||||
|
||||
|
||||
|
||||
|
||||
$param = [
|
||||
"name" => $shop['name'],
|
||||
"realname"=> $user["realname"],
|
||||
"nickname"=> $user["nickname"],
|
||||
"mobile"=> $user["mobile"],
|
||||
|
||||
|
||||
"title" => $detail['title'],
|
||||
"teacher_name"=> $teacher["name"] ?? "课程负责人",
|
||||
"teacher_realname"=> $teacher_user["realname"] ?? "课程负责人真实姓名",
|
||||
"teacher_nickname"=> $teacher_user["nickname"] ?? "课程负责人昵称",
|
||||
"teacher_mobile"=> $teacher_user["mobile"] ?? "课程负责人电话",
|
||||
"address"=>$detail["address"]."(".$detail["address_detail"].")",
|
||||
"price" => $detail["price"],
|
||||
"start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"end_time" => date("Y-m-d H:i",$detail["end_time"]),
|
||||
"reason" => $serviceorder['reason'],
|
||||
"reject_reason" => $serviceorder['reject_reason'],
|
||||
"order_no" => $serviceorder['order_no'],
|
||||
"tbc_price" => $serviceorder['tbc_price'],
|
||||
"c_price" => $serviceorder['c_price'],
|
||||
"real_refundprice" => $serviceorder['real_refundprice'],
|
||||
"sub_refundprice" => $serviceorder['sub_refundprice'],
|
||||
];
|
||||
|
||||
|
||||
//发给用户
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_user")
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
//发给机构负责人
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_shop")
|
||||
->setTemplateData($param)
|
||||
->setToUid($shop["user_id"])
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
//发给机构老师
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_teacher")
|
||||
->setTemplateData($param)
|
||||
->setToUid($teacher["user_id"])
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -143,6 +381,10 @@ class OrderHook
|
|||
['serviceorder' => $serviceorder,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
|
||||
|
||||
$detail = $serviceorder->detail;
|
||||
$user = User::where("id",$serviceorder["user_id"])->find();
|
||||
$teacher_user = \app\common\model\User::get($detail["user_id"]);
|
||||
$teacher = Teacher::get($detail["teacher_id"]);
|
||||
$shop = ManystoreShop::get($serviceorder["shop_id"]);
|
||||
//记录订单日志
|
||||
|
||||
$desc = "课程{$detail["title"]}订单用户已同意售后,系统正在结算资金中,请耐心等待";
|
||||
|
@ -161,8 +403,62 @@ class OrderHook
|
|||
"classes_order_id"=>$serviceorder["classes_order_id"],
|
||||
"order_no"=>$serviceorder["order_no"],
|
||||
];
|
||||
Message::$event_name = $params["event"];
|
||||
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
|
||||
|
||||
|
||||
|
||||
$param = [
|
||||
"name" => $shop['name'],
|
||||
"realname"=> $user["realname"],
|
||||
"nickname"=> $user["nickname"],
|
||||
"mobile"=> $user["mobile"],
|
||||
|
||||
|
||||
"title" => $detail['title'],
|
||||
"teacher_name"=> $teacher["name"] ?? "课程负责人",
|
||||
"teacher_realname"=> $teacher_user["realname"] ?? "课程负责人真实姓名",
|
||||
"teacher_nickname"=> $teacher_user["nickname"] ?? "课程负责人昵称",
|
||||
"teacher_mobile"=> $teacher_user["mobile"] ?? "课程负责人电话",
|
||||
"address"=>$detail["address"]."(".$detail["address_detail"].")",
|
||||
"price" => $detail["price"],
|
||||
"start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"end_time" => date("Y-m-d H:i",$detail["end_time"]),
|
||||
"reason" => $serviceorder['reason'],
|
||||
"reject_reason" => $serviceorder['reject_reason'],
|
||||
"order_no" => $serviceorder['order_no'],
|
||||
"tbc_price" => $serviceorder['tbc_price'],
|
||||
"c_price" => $serviceorder['c_price'],
|
||||
"real_refundprice" => $serviceorder['real_refundprice'],
|
||||
"sub_refundprice" => $serviceorder['sub_refundprice'],
|
||||
];
|
||||
|
||||
|
||||
//发给用户
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_user")
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
//发给机构负责人
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_shop")
|
||||
->setTemplateData($param)
|
||||
->setToUid($shop["user_id"])
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
//发给机构老师
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_teacher")
|
||||
->setTemplateData($param)
|
||||
->setToUid($teacher["user_id"])
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
|
||||
}
|
||||
|
||||
|
@ -174,6 +470,10 @@ class OrderHook
|
|||
['serviceorder' => $serviceorder,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
|
||||
|
||||
$detail = $serviceorder->detail;
|
||||
$user = User::where("id",$serviceorder["user_id"])->find();
|
||||
$teacher_user = \app\common\model\User::get($detail["user_id"]);
|
||||
$teacher = Teacher::get($detail["teacher_id"]);
|
||||
$shop = ManystoreShop::get($serviceorder["shop_id"]);
|
||||
//记录订单日志
|
||||
|
||||
$desc = "课程{$detail["title"]}订单用户售后已驳回,原因:{$serviceorder["reject_reason"]}";
|
||||
|
@ -192,8 +492,63 @@ class OrderHook
|
|||
"classes_order_id"=>$serviceorder["classes_order_id"],
|
||||
"order_no"=>$serviceorder["order_no"],
|
||||
];
|
||||
Message::$event_name = $params["event"];
|
||||
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
|
||||
|
||||
|
||||
|
||||
|
||||
$param = [
|
||||
"name" => $shop['name'],
|
||||
"realname"=> $user["realname"],
|
||||
"nickname"=> $user["nickname"],
|
||||
"mobile"=> $user["mobile"],
|
||||
|
||||
|
||||
"title" => $detail['title'],
|
||||
"teacher_name"=> $teacher["name"] ?? "课程负责人",
|
||||
"teacher_realname"=> $teacher_user["realname"] ?? "课程负责人真实姓名",
|
||||
"teacher_nickname"=> $teacher_user["nickname"] ?? "课程负责人昵称",
|
||||
"teacher_mobile"=> $teacher_user["mobile"] ?? "课程负责人电话",
|
||||
"address"=>$detail["address"]."(".$detail["address_detail"].")",
|
||||
"price" => $detail["price"],
|
||||
"start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"end_time" => date("Y-m-d H:i",$detail["end_time"]),
|
||||
"reason" => $serviceorder['reason'],
|
||||
"reject_reason" => $serviceorder['reject_reason'],
|
||||
"order_no" => $serviceorder['order_no'],
|
||||
"tbc_price" => $serviceorder['tbc_price'],
|
||||
"c_price" => $serviceorder['c_price'],
|
||||
"real_refundprice" => $serviceorder['real_refundprice'],
|
||||
"sub_refundprice" => $serviceorder['sub_refundprice'],
|
||||
];
|
||||
|
||||
|
||||
//发给用户
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_user")
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
//发给机构负责人
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_shop")
|
||||
->setTemplateData($param)
|
||||
->setToUid($shop["user_id"])
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
//发给机构老师
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_teacher")
|
||||
->setTemplateData($param)
|
||||
->setToUid($teacher["user_id"])
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
|
||||
}
|
||||
|
||||
|
@ -206,6 +561,10 @@ class OrderHook
|
|||
['serviceorder' => $serviceorder,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
|
||||
|
||||
$detail = $serviceorder->detail;
|
||||
$user = User::where("id",$serviceorder["user_id"])->find();
|
||||
$teacher_user = \app\common\model\User::get($detail["user_id"]);
|
||||
$teacher = Teacher::get($detail["teacher_id"]);
|
||||
$shop = ManystoreShop::get($serviceorder["shop_id"]);
|
||||
//记录订单日志
|
||||
|
||||
$desc = "课程{$detail["title"]}订单售后金额已原路退回到您的账户中{$serviceorder["real_refundprice"]}元,请注意查看";
|
||||
|
@ -224,8 +583,62 @@ class OrderHook
|
|||
"classes_order_id"=>$serviceorder["classes_order_id"],
|
||||
"order_no"=>$serviceorder["order_no"],
|
||||
];
|
||||
Message::$event_name = $params["event"];
|
||||
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
|
||||
|
||||
|
||||
$param = [
|
||||
"name" => $shop['name'],
|
||||
"realname"=> $user["realname"],
|
||||
"nickname"=> $user["nickname"],
|
||||
"mobile"=> $user["mobile"],
|
||||
|
||||
|
||||
"title" => $detail['title'],
|
||||
"teacher_name"=> $teacher["name"] ?? "课程负责人",
|
||||
"teacher_realname"=> $teacher_user["realname"] ?? "课程负责人真实姓名",
|
||||
"teacher_nickname"=> $teacher_user["nickname"] ?? "课程负责人昵称",
|
||||
"teacher_mobile"=> $teacher_user["mobile"] ?? "课程负责人电话",
|
||||
"address"=>$detail["address"]."(".$detail["address_detail"].")",
|
||||
"price" => $detail["price"],
|
||||
"start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"end_time" => date("Y-m-d H:i",$detail["end_time"]),
|
||||
"reason" => $serviceorder['reason'],
|
||||
"reject_reason" => $serviceorder['reject_reason'],
|
||||
"order_no" => $serviceorder['order_no'],
|
||||
"tbc_price" => $serviceorder['tbc_price'],
|
||||
"c_price" => $serviceorder['c_price'],
|
||||
"real_refundprice" => $serviceorder['real_refundprice'],
|
||||
"sub_refundprice" => $serviceorder['sub_refundprice'],
|
||||
];
|
||||
|
||||
|
||||
//发给用户
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_user")
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
//发给机构负责人
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_shop")
|
||||
->setTemplateData($param)
|
||||
->setToUid($shop["user_id"])
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
//发给机构老师
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_teacher")
|
||||
->setTemplateData($param)
|
||||
->setToUid($teacher["user_id"])
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -237,6 +650,10 @@ class OrderHook
|
|||
['serviceorder' => $serviceorder,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
|
||||
|
||||
$detail = $serviceorder->detail;
|
||||
$user = User::where("id",$serviceorder["user_id"])->find();
|
||||
$teacher_user = \app\common\model\User::get($detail["user_id"]);
|
||||
$teacher = Teacher::get($detail["teacher_id"]);
|
||||
$shop = ManystoreShop::get($serviceorder["shop_id"]);
|
||||
//记录订单日志
|
||||
|
||||
$desc = "课程{$detail["title"]}订单售后记录异常,系统已强制终止售后,原因:{$serviceorder["reject_reason"]}";
|
||||
|
@ -255,8 +672,63 @@ class OrderHook
|
|||
"classes_order_id"=>$serviceorder["classes_order_id"],
|
||||
"order_no"=>$serviceorder["order_no"],
|
||||
];
|
||||
Message::$event_name = $params["event"];
|
||||
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
|
||||
|
||||
|
||||
|
||||
$param = [
|
||||
"name" => $shop['name'],
|
||||
"realname"=> $user["realname"],
|
||||
"nickname"=> $user["nickname"],
|
||||
"mobile"=> $user["mobile"],
|
||||
|
||||
|
||||
"title" => $detail['title'],
|
||||
"teacher_name"=> $teacher["name"] ?? "课程负责人",
|
||||
"teacher_realname"=> $teacher_user["realname"] ?? "课程负责人真实姓名",
|
||||
"teacher_nickname"=> $teacher_user["nickname"] ?? "课程负责人昵称",
|
||||
"teacher_mobile"=> $teacher_user["mobile"] ?? "课程负责人电话",
|
||||
"address"=>$detail["address"]."(".$detail["address_detail"].")",
|
||||
"price" => $detail["price"],
|
||||
"start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
|
||||
"end_time" => date("Y-m-d H:i",$detail["end_time"]),
|
||||
"reason" => $serviceorder['reason'],
|
||||
"reject_reason" => $serviceorder['reject_reason'],
|
||||
"order_no" => $serviceorder['order_no'],
|
||||
"tbc_price" => $serviceorder['tbc_price'],
|
||||
"c_price" => $serviceorder['c_price'],
|
||||
"real_refundprice" => $serviceorder['real_refundprice'],
|
||||
"sub_refundprice" => $serviceorder['sub_refundprice'],
|
||||
];
|
||||
|
||||
|
||||
//发给用户
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_user")
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
//发给机构负责人
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_shop")
|
||||
->setTemplateData($param)
|
||||
->setToUid($shop["user_id"])
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
//发给机构老师
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"]."_teacher")
|
||||
->setTemplateData($param)
|
||||
->setToUid($teacher["user_id"])
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
namespace app\common\listener\user;
|
||||
use app\common\model\school\classes\Verification;
|
||||
use app\common\model\school\Message;
|
||||
use app\common\model\school\MessageConfig;
|
||||
use app\common\model\User;
|
||||
use app\manystore\model\Manystore;
|
||||
|
||||
class UserHook
|
||||
|
@ -13,6 +15,7 @@ class UserHook
|
|||
{
|
||||
['user_auth' => $user_auth,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
|
||||
$shop = $user_auth->shop;
|
||||
$user = User::where("id",$user_auth["user_id"])->find();
|
||||
// //课程推送给老师
|
||||
$desc = "机构{$shop['name']}已发起授权申请,请确实是否同意!";
|
||||
|
||||
|
@ -28,8 +31,23 @@ class UserHook
|
|||
"event"=>"user_auth_need_after",
|
||||
"shop_id"=>$user_auth["shop_id"],
|
||||
];
|
||||
Message::$event_name = $params["event"];
|
||||
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
|
||||
|
||||
$param = [
|
||||
"name" => $shop['name'],
|
||||
"realname"=> $user["realname"] ,
|
||||
"nickname"=> $user["nickname"] ,
|
||||
"mobile"=> $user["mobile"] ,
|
||||
];
|
||||
|
||||
//发给用户
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"])
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
|
||||
}
|
||||
|
||||
|
@ -38,8 +56,8 @@ class UserHook
|
|||
public function userAuthSuccessAfter(&$params)
|
||||
{
|
||||
['user_auth' => $user_auth,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
|
||||
|
||||
$shop = $user_auth->shop;
|
||||
$user = User::where("id",$user_auth["user_id"])->find();
|
||||
// //课程推送给老师
|
||||
$desc = "您已同意机构{$shop['name']}发起的授权申请。";
|
||||
|
||||
|
@ -55,8 +73,23 @@ class UserHook
|
|||
"event"=>"user_auth_success_after",
|
||||
"shop_id"=>$user_auth["shop_id"],
|
||||
];
|
||||
Message::$event_name = $params["event"];
|
||||
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
|
||||
$param = [
|
||||
"name" => $shop['name'],
|
||||
"realname"=> $user["realname"] ,
|
||||
"nickname"=> $user["nickname"] ,
|
||||
"mobile"=> $user["mobile"] ,
|
||||
];
|
||||
|
||||
//发给用户
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"])
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
|
||||
$manystore = Manystore::where("shop_id",$user_auth["shop_id"])->find();
|
||||
if($manystore){
|
||||
// //加入核销员
|
||||
|
@ -82,6 +115,7 @@ class UserHook
|
|||
['user_auth' => $user_auth,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
|
||||
|
||||
$shop = $user_auth->shop;
|
||||
$user = User::where("id",$user_auth["user_id"])->find();
|
||||
// //课程推送给老师
|
||||
$desc = "您已拒绝机构{$shop['name']}发起的授权申请。";
|
||||
|
||||
|
@ -97,9 +131,23 @@ class UserHook
|
|||
"event"=>"user_auth_fail_after",
|
||||
"shop_id"=>$user_auth["shop_id"],
|
||||
];
|
||||
Message::$event_name = $params["event"];
|
||||
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
|
||||
|
||||
$param = [
|
||||
"name" => $shop['name'],
|
||||
"realname"=> $user["realname"] ,
|
||||
"nickname"=> $user["nickname"] ,
|
||||
"mobile"=> $user["mobile"] ,
|
||||
];
|
||||
|
||||
//发给用户
|
||||
(new MessageConfig)
|
||||
->setTemplate($params["event"])
|
||||
->setTemplateData($param)
|
||||
->setToUid($to_id)
|
||||
->setMessageStatus($status)
|
||||
->setMessageMiniType($mini_type)
|
||||
->setMessageParams($params)
|
||||
->sendMessage();
|
||||
}
|
||||
|
||||
public function userUpdateAfter(&$params)
|
||||
|
|
|
@ -80,7 +80,7 @@ class Message extends BaseModel
|
|||
|
||||
public function getMiniTypeList()
|
||||
{
|
||||
return ['order_notice' => __('Mini_type order_notice'), 'classes_auth' => __('Mini_type classes_auth'), 'classes_apply' => __('Mini_type classes_apply') , 'activity_apply' => __('Mini_type activity_apply'), 'shop_apply' => __('Mini_type shop_apply'), 'classes_order_notice' => __('Mini_type classes_order_notice'), 'user_auth' => __('Mini_type user_auth'), 'aftercare' => __('Mini_type aftercare'), 'other' => __('Mini_type other')];
|
||||
return ['order_notice' => __('Mini_type order_notice'), 'classes_auth' => __('Mini_type classes_auth'), 'classes_apply' => __('Mini_type classes_apply') , 'activity_apply' => __('Mini_type activity_apply'), 'shop_apply' => __('Mini_type shop_apply'), 'classes_order_notice' => __('Mini_type classes_order_notice'), 'user_auth' => __('Mini_type user_auth'), 'aftercare' => __('Mini_type aftercare'), 'other' => __('Mini_type other'),'activity_order' => __('Mini_type activity_order')];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ class MessageConfig extends Model
|
|||
|
||||
public function setTemplate($event_name,$params=[],$to_uid=0){
|
||||
$this->messageTemplate = MessageConfigItem::where("event_two",$event_name)->find();
|
||||
if(!$this->messageTemplate) throw new \Exception("消息模板不存在");
|
||||
if(!$this->messageTemplate)return $this;
|
||||
//设置模板内容
|
||||
if($params){
|
||||
$this->setTemplateData($params);
|
||||
|
@ -221,6 +221,7 @@ class MessageConfig extends Model
|
|||
*/
|
||||
public function setMessageContent($expression = '{{KEYWORD}}'){
|
||||
$template = $this->messageTemplate;
|
||||
if(!$template) return $this;
|
||||
$template_content = $template['selfmail_template_text'];
|
||||
//解析获取文本内容
|
||||
$this->templateString = Common::parsePrintTemplateString($template_content,$this->templateData,$expression);
|
||||
|
|
Loading…
Reference in New Issue