Payment.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: 萤火科技 <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types = 1);
  12. namespace app\common\service\message\order;
  13. use app\common\service\message\Basics;
  14. use app\common\model\store\Setting as SettingModel;
  15. use app\common\enum\setting\sms\Scene as SettingSmsScene;
  16. /**
  17. * 消息通知服务 [订单支付成功]
  18. * Class Payment
  19. * @package app\common\service\message\order
  20. */
  21. class Payment extends Basics
  22. {
  23. /**
  24. * 参数列表
  25. * @var array
  26. */
  27. protected $param = [
  28. 'order' => []
  29. ];
  30. /**
  31. * 订单页面链接
  32. * @var array
  33. */
  34. private $pageUrl = 'pages/order/detail';
  35. /**
  36. * 发送消息通知
  37. * @param array $param
  38. * @return mixed|void
  39. * @throws \app\common\exception\BaseException
  40. * @throws \think\Exception
  41. * @throws \think\db\exception\DataNotFoundException
  42. * @throws \think\db\exception\DbException
  43. * @throws \think\db\exception\ModelNotFoundException
  44. */
  45. public function send(array $param)
  46. {
  47. // 记录参数
  48. $this->param = $param;
  49. // 短信通知商家
  50. $this->onSendSms();
  51. }
  52. /**
  53. * 短信通知商家
  54. * @return bool
  55. * @throws \think\Exception
  56. * @throws \think\db\exception\DataNotFoundException
  57. * @throws \think\db\exception\DbException
  58. * @throws \think\db\exception\ModelNotFoundException
  59. */
  60. private function onSendSms()
  61. {
  62. $orderInfo = $this->param['order'];
  63. return $this->sendSms(SettingSmsScene::ORDER_PAY, ['order_no' => $orderInfo['order_no']]);
  64. }
  65. /**
  66. * 格式化商品名称
  67. * @param $goodsData
  68. * @return string
  69. */
  70. private function getFormatGoodsName($goodsData)
  71. {
  72. return $this->getSubstr($goodsData[0]['goods_name']);
  73. }
  74. }