SupplierWithDrawArrivalNotice.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2020/6/21
  6. * Time: 18:45
  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. use app\common\services\notice\share\WithDrawData;
  13. class SupplierWithDrawArrivalNotice extends BaseMessageBody
  14. {
  15. use MiniNoticeTemplate;
  16. public $withdraw;
  17. public function __construct($withdraw)
  18. {
  19. $this->withdraw = $withdraw;
  20. }
  21. public function organizeData()
  22. {
  23. // TODO: Implement organizeData() method.
  24. $this->data = [
  25. 'date4'=>['value'=> $this->withdraw->created_at->toDateTimeString()],// 提现时间
  26. 'amount5'=>['value'=> $this->withdraw->money],//提现金额
  27. 'thing3'=>['value'=> $this->checkDataLength($this->withdraw->type_name,20)],// 提现方式
  28. 'phrase6'=>['value'=> $this->checkDataLength($this->withdraw->status_obj['name'],5)],// 提现状态,
  29. 'date2' => ['value'=> date("Y-m-d H:i:s",time())]
  30. ];
  31. }
  32. public function sendMessage()
  33. {
  34. // TODO: Implement sendMessage() method.
  35. $this->getTemplate("提现到账通知");
  36. $back = [];
  37. if (empty($this->temp_open)) {
  38. $back['message'] = $this->temp_title."消息通知未开启";
  39. \Log::debug($back['message']);
  40. return ;
  41. }
  42. $this->organizeData();
  43. \Log::debug("新版小程序消息-供应商到账1",$this->temp_id);
  44. \Log::debug("新版小程序消息-供应商到账2",$this->withdraw->hasOneSupplier->hasOneMember->hasOneMiniApp->openid);
  45. \Log::debug("新版小程序消息-供应商到账3",$this->data);
  46. $result = (new AppletMessageNotice($this->temp_id,$this->withdraw->hasOneSupplier->hasOneMember->hasOneMiniApp->openid,$this->data,[],2))->sendMessage();
  47. if ($result['status'] == 0) {
  48. \Log::debug($result['message']);
  49. }
  50. }
  51. }