OrderPayedMinNotice.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: yunzhong
  5. * Date: 2020/6/5
  6. * Time: 17:34
  7. */
  8. namespace app\common\services\notice\applet;
  9. use app\common\models\Order;
  10. use app\common\services\notice\BaseMessageBody;
  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 OrderPayedMinNotice 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->member->nickname],// 用户
  27. // 'keyword2'=>['value'=> $this->order->order_sn],//订单号
  28. // 'keyword3'=>['value'=> $this->goodsTitle],//商品名称
  29. // 'keyword4'=>['value'=> $this->order->pay_type_name],// 支付方式
  30. // 'keyword5'=>['value'=> $this->order['price']],// 支付金额
  31. // 'keyword6'=>['value'=> $this->address['realname']],//收貨人
  32. // 'keyword7'=>['value'=> $this->address['province'] . ' ' . $this->address['city'] . ' ' . $this->address['area'] . ' ' . $this->address['address']],//收貨地址
  33. // ];
  34. $this->data = [
  35. 'name1'=>['value'=> $this->member->nickname],//姓名
  36. //'date4'=>['value'=> $this->order->order_sn],//订单号码
  37. 'date4'=>['value'=> $this->timeData['create_time']],//下单时间
  38. 'amount3'=>['value'=> $this->order['price']],//订单金额
  39. 'thing6'=>['value'=> $this->goodsTitle],// 商品名称
  40. //'keyword6'=>['value'=> $this->order->pay_type_name],//支付方式
  41. 'date8'=>['value'=> $this->timeData['pay_time']],//支付时间
  42. ];
  43. }
  44. public function sendMessage()
  45. {
  46. // TODO: Implement sendMessage() method.
  47. $this->processData($this->orderModel);
  48. $this->getTemplate("订单支付成功通知");
  49. $this->getBackMember();
  50. if (empty($this->temp_open)) {
  51. $back['message'] = "消息通知未开启";
  52. \Log::debug($back['message']);
  53. }
  54. $this->organizeData();
  55. $result = (new AppletMessageNotice($this->temp_id,0,$this->data,$this->minOpenIds,2))->sendMessage();
  56. if ($result['status'] == 0) {
  57. \Log::debug($result['message']);
  58. }
  59. }
  60. }