OrderRefundMinNotice.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2020/6/14
  6. * Time: 9:29
  7. */
  8. namespace app\common\services\notice\applet\refund;
  9. use app\common\models\Order;
  10. use app\common\models\refund\RefundApply;
  11. use app\common\services\notice\applet\AppletMessageNotice;
  12. use app\common\services\notice\BaseMessageBody;
  13. use app\common\services\notice\share\BackstageNoticeMember;
  14. use app\common\services\notice\share\MiniNoticeTemplate;
  15. use app\common\services\notice\share\OrderNoticeData;
  16. class OrderRefundMinNotice extends BaseMessageBody
  17. {
  18. use OrderNoticeData,MiniNoticeTemplate,BackstageNoticeMember;
  19. public $refund;
  20. public $orderModel;
  21. public function __construct($refund,$order)
  22. {
  23. $this->refund = $refund;
  24. $this->orderModel = $order;
  25. }
  26. public function organizeData()
  27. {
  28. // TODO: Implement organizeData() method.
  29. $this->data = [
  30. 'keyword1'=>['value'=> $this->member->nickname],// 退款人
  31. 'keyword2'=>['value'=> $this->refund->refund_sn],//退款单号
  32. 'keyword3'=>['value'=> $this->refund->create_time],// 退款时间
  33. 'keyword4'=>['value'=> $this->order->pay_type_name],// 退款方式
  34. 'keyword5'=>['value'=> $this->order->price],// 订单金额
  35. 'keyword6'=>['value'=> $this->refund->reason],// 订单原因
  36. ];
  37. }
  38. public function sendMessage()
  39. {
  40. // TODO: Implement sendMessage() method.
  41. $this->processData($this->orderModel);
  42. $this->getTemplate("退款申请通知");
  43. $this->getBackMember();
  44. if (empty($this->temp_open)) {
  45. $back['status'] = 0;
  46. $back['message'] = "消息通知未开启";
  47. return $back;
  48. }
  49. $this->organizeData();
  50. $result = (new AppletMessageNotice($this->temp_id,0,$this->data,$this->minOpenIds,2))->sendMessage();
  51. if ($result['status'] == 0) {
  52. \Log::debug($result['message']);
  53. }
  54. }
  55. }