OrderReceivedMinNotice.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2020/6/7
  6. * Time: 20:42
  7. */
  8. namespace app\common\services\notice\applet;
  9. use app\common\services\notice\BaseMessageBody;
  10. use app\common\models\Order;
  11. use app\common\services\notice\share\BackstageNoticeMember;
  12. use app\common\services\notice\share\OrderNoticeData;
  13. use app\common\services\notice\share\MiniNoticeTemplate;
  14. class OrderReceivedMinNotice extends BaseMessageBody
  15. {
  16. use OrderNoticeData,BackstageNoticeMember,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->goodsTitle],// 商品名
  27. // 'keyword2'=>['value'=> $this->member->nickname],//买家昵称
  28. // 'keyword3'=>['value'=> $this->order->order_sn],// 订单编号
  29. // 'keyword4'=>['value'=> $this->timeData['create_time']],// 订单时间
  30. // 'keyword5'=>['value'=> $this->order['price']],//订单金額
  31. // 'keyword6'=>['value'=> $this->timeData['finish_time']],// 确认收货时间
  32. // ];
  33. $this->data = [
  34. 'thing6'=>['value'=> $this->goodsTitle],// 商品名称
  35. 'thing4'=>['value'=> \Setting::get('shop.shop')['name']],//商户名称
  36. 'character_string8'=>['value'=> $this->order->order_sn],// 订单编号
  37. 'date7'=>['value'=> $this->timeData['finish_time']],// 收货时间
  38. 'phrase3'=>['value'=> "已收货"]// 订单状态
  39. ];
  40. }
  41. public function sendMessage()
  42. {
  43. // TODO: Implement sendMessage() method.
  44. $this->processData($this->orderModel);
  45. $this->getTemplate("确认收货通知");
  46. $this->getBackMember();
  47. if (empty($this->temp_open)) {
  48. $back['message'] = $this->temp_title."消息通知未开启";
  49. \Log::debug($back['message']);
  50. }
  51. $this->organizeData();
  52. $result = (new AppletMessageNotice($this->temp_id,0,$this->data,$this->minOpenIds,2))->sendMessage();
  53. if ($result['status'] == 0) {
  54. \Log::debug($result['message']);
  55. }
  56. }
  57. }