OrderBuyerCancelMinNotice.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2020/6/14
  6. * Time: 7:57
  7. */
  8. namespace app\common\services\notice\applet\buyer;
  9. use app\common\models\Order;
  10. use app\common\services\notice\applet\AppletMessageNotice;
  11. use app\common\services\notice\BaseMessageBody;
  12. use app\common\services\notice\share\MiniNoticeTemplate;
  13. use app\common\services\notice\share\OrderNoticeData;
  14. class OrderBuyerCancelMinNotice extends BaseMessageBody
  15. {
  16. use OrderNoticeData,MiniNoticeTemplate;
  17. public $orderModel;
  18. public function __construct($order)
  19. {
  20. $this->orderModel = $order;
  21. }
  22. public function organizeData()
  23. {
  24. // TODO: Implement organizeData() method.
  25. $this->data = [
  26. 'keyword1'=>['value'=> $this->member->nickname],// 用户名
  27. 'keyword2'=>['value'=> $this->order->order_sn],//订单号
  28. 'keyword3'=>['value'=> $this->timeData['create_time']],// 下单时间
  29. 'keyword4'=>['value'=> $this->order['price']],// 订单金额
  30. 'keyword5'=>['value'=> $this->order['dispatch_price']],// 订单运费
  31. 'keyword6'=>['value'=> $this->goodsTitle],// 商品详情
  32. 'keyword7'=>['value'=> $this->timeData['cancel_time']],// 取消时间
  33. ];
  34. }
  35. public function sendMessage()
  36. {
  37. // TODO: Implement sendMessage() method.
  38. $this->processData($this->orderModel);
  39. $this->getTemplate("订单取消通知");
  40. $back = [];
  41. if (empty($this->temp_open)) {
  42. $back['status'] = 0;
  43. $back['message'] = $this->temp_title."消息通知未开启";
  44. return $back;
  45. }
  46. $this->organizeData();
  47. $result = (new AppletMessageNotice($this->temp_id,$this->miniFans->openid,$this->data,[],2))->sendMessage();
  48. if ($result['status'] == 0) {
  49. \Log::debug($result['message']);
  50. }
  51. }
  52. }