SupplierWithDrawAuditNotice.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2020/6/21
  6. * Time: 18:00
  7. */
  8. namespace app\common\services\notice\applet\supplier;
  9. use app\common\services\notice\applet\AppletMessageNotice;
  10. use app\common\services\notice\BaseMessageBody;
  11. use app\common\services\notice\share\MiniNoticeTemplate;
  12. class SupplierWithDrawAuditNotice extends BaseMessageBody
  13. {
  14. use MiniNoticeTemplate;
  15. public $withdraw;
  16. public function __construct($withdraw)
  17. {
  18. $this->withdraw = $withdraw;
  19. }
  20. public function organizeData()
  21. {
  22. // TODO: Implement organizeData() method.
  23. $this->data = [
  24. 'time1'=>['value'=> $this->withdraw->created_at->toDateTimeString()],// 提现时间
  25. 'amount3'=>['value'=> $this->withdraw->money],//提现金额
  26. 'thing2'=>['value'=> $this->checkDataLength($this->withdraw->type_name,20)],// 提现方式
  27. 'phrase4'=>['value'=> $this->checkDataLength($this->withdraw->status_obj['name'],5)],// 提现状态
  28. ];
  29. }
  30. public function sendMessage()
  31. {
  32. // TODO: Implement sendMessage() method.
  33. $this->getTemplate("提现状态通知");
  34. $back = [];
  35. if (empty($this->temp_open)) {
  36. $back['message'] = $this->temp_title."消息通知未开启";
  37. \Log::debug($back['message']);
  38. return ;
  39. }
  40. $this->organizeData();
  41. \Log::debug("新版小程序消息-供应商提现1",$this->temp_id);
  42. \Log::debug("新版小程序消息-供应商提现2",$this->withdraw->hasOneSupplier->hasOneMember->hasOneMiniApp->openid);
  43. \Log::debug("新版小程序消息-供应商提现3",$this->data);
  44. $result = (new AppletMessageNotice($this->temp_id,$this->withdraw->hasOneSupplier->hasOneMember->hasOneMiniApp->openid,$this->data,[],2))->sendMessage();
  45. if ($result['status'] == 0) {
  46. \Log::debug($result['message']);
  47. }
  48. }
  49. }