OrderBuyerPayedMinNotice.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2020/6/14
  6. * Time: 8:15
  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 OrderBuyerPayedMinNotice 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. 'name1'=>['value'=> $this->checkDataLength($this->member->nickname,10)],//姓名
  27. //'date4'=>['value'=> $this->order->order_sn],//订单号码
  28. 'date4'=>['value'=> $this->timeData['create_time']],//下单时间
  29. 'amount3'=>['value'=> $this->order['price']],//订单金额
  30. 'thing6'=>['value'=> $this->checkDataLength($this->goodsTitle,20)],// 商品名称
  31. //'keyword6'=>['value'=> $this->order->pay_type_name],//支付方式
  32. 'date8'=>['value'=> $this->timeData['pay_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['message'] = $this->temp_title."消息通知未开启";
  43. \Log::debug($back['message']);
  44. return ;
  45. }
  46. $this->organizeData();
  47. \Log::debug("新版小程序消息-支付1",$this->temp_id);
  48. \Log::debug("新版小程序消息-支付2",$this->miniFans->openid);
  49. \Log::debug("新版小程序消息-支付3",$this->data);
  50. $result = (new AppletMessageNotice($this->temp_id,$this->miniFans->openid,$this->data,[],2))->sendMessage();
  51. if ($result['status'] == 0) {
  52. \Log::debug($result['message']);
  53. }
  54. }
  55. }