OrderBuyerCreateMinNotice.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2020/6/14
  6. * Time: 7:37
  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 OrderBuyerCreateMinNotice 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->goodsTitle],// 商品信息
  31. ];
  32. }
  33. public function sendMessage()
  34. {
  35. // TODO: Implement sendMessage() method.
  36. $this->processData($this->orderModel);
  37. $this->getTemplate("订单提交成功通知");
  38. $back = [];
  39. if (empty($this->temp_open)) {
  40. $back['status'] = 0;
  41. $back['message'] = $this->temp_title."消息通知未开启";
  42. return $back;
  43. }
  44. $this->organizeData();
  45. $result = (new AppletMessageNotice($this->temp_id,$this->miniFans->openid,$this->data,[],2))->sendMessage();
  46. if ($result['status'] == 0) {
  47. \Log::debug($result['message']);
  48. }
  49. }
  50. }