OrderRefundFailMinNotice.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2020/6/14
  6. * Time: 9:49
  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\MiniNoticeTemplate;
  14. use app\common\services\notice\share\OrderNoticeData;
  15. class OrderRefundFailMinNotice extends BaseMessageBody
  16. {
  17. use OrderNoticeData,MiniNoticeTemplate;
  18. public $refund;
  19. public $orderModel;
  20. public function __construct($refund,$order)
  21. {
  22. $this->refund = $refund;
  23. $this->orderModel = $order;
  24. }
  25. public function organizeData()
  26. {
  27. // TODO: Implement organizeData() method.
  28. $this->data = [
  29. 'keyword1'=>['value'=> $this->order->nickname],// 商户名称
  30. 'keyword2'=>['value'=> $this->refund->refund_sn],//订单编号
  31. 'keyword3'=>['value'=> $this->refund->create_time],// 退款时间
  32. 'keyword4'=>['value'=> $this->refund->price],// 退款金额
  33. 'keyword5'=>['value'=> $this->refund->reason],// 退款理由
  34. 'keyword6'=>['value'=> $this->refund->reject_reason],// 拒绝原因
  35. ];
  36. }
  37. public function sendMessage()
  38. {
  39. // TODO: Implement sendMessage() method.
  40. $this->processData($this->orderModel);
  41. $this->getTemplate("退款成功通知");
  42. $back = [];
  43. if (empty($this->temp_open)) {
  44. $back['status'] = 0;
  45. $back['message'] = $this->temp_title."消息通知未开启";
  46. return $back;
  47. }
  48. $this->organizeData();
  49. $result = (new AppletMessageNotice($this->temp_id,$this->miniFans->openid,$this->data,[],2))->sendMessage();
  50. if ($result['status'] == 0) {
  51. \Log::debug($result['message']);
  52. }
  53. }
  54. }