OrderBuyerRefundNotice.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2020/6/14
  6. * Time: 14:23
  7. */
  8. namespace app\common\services\notice\official\buyer;
  9. use app\common\models\Order;
  10. use app\common\models\refund\RefundApply;
  11. use app\common\services\notice\BaseMessageBody;
  12. use app\common\services\notice\official\OfficialMessageNotice;
  13. use app\common\services\notice\share\OfficialNoticeTemplate;
  14. use app\common\services\notice\share\OrderNoticeData;
  15. class OrderBuyerRefundNotice extends BaseMessageBody
  16. {
  17. use OfficialNoticeTemplate,OrderNoticeData;
  18. public $orderModel;
  19. public $refund;
  20. public function __construct($refund ,$order)
  21. {
  22. $this->orderModel = $order;
  23. $this->refund = $refund;
  24. }
  25. public function organizeData()
  26. {
  27. // TODO: Implement organizeData() method.
  28. $this->data = [
  29. ['name' => '商城名称', 'value' => \Setting::get('shop.shop')['name']],
  30. ['name' => '粉丝昵称', 'value' => $this->member['nickname']],
  31. ['name' => '退款单号', 'value' => $this->refund->refund_sn],
  32. ['name' => '退款申请时间', 'value' => $this->refund->create_time->toDateTimeString()],
  33. ['name' => '退款方式', 'value' => $this->order->pay_type_name],
  34. ['name' => '退款金额', 'value' => $this->refund->price],
  35. ['name' => '退款原因', 'value' => $this->refund->reason],
  36. ];
  37. }
  38. public function sendMessage()
  39. {
  40. // TODO: Implement sendMessage() method.
  41. $this->processData($this->orderModel);
  42. $this->getTemplate('order_refund_apply');
  43. $this->organizeData();
  44. \Log::debug("新版公众号消息-退款申请1",$this->template_id);
  45. \Log::debug("新版公众号消息-退款申请2",$this->fans->openid);
  46. \Log::debug("新版公众号消息-退款申请3",$this->data);
  47. $result = (new OfficialMessageNotice($this->temp_id,$this->fans->openid,$this->data,[],1,$this->url))->sendMessage();
  48. if ($result['status'] == 0) {
  49. \Log::debug($result['message']);
  50. }
  51. }
  52. }