SmsTemplateApplyServices.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\services\yihaotong;
  12. use app\services\BaseServices;
  13. use crmeb\services\FormBuilder;
  14. /**
  15. * 短信模板
  16. * Class SmsTemplateApplyServices
  17. * @package app\services\message\sms
  18. */
  19. class SmsTemplateApplyServices extends BaseServices
  20. {
  21. /**
  22. * @var FormBuilder
  23. */
  24. protected $builder;
  25. /**
  26. * SmsTemplateApplyServices constructor.
  27. * @param FormBuilder $builder
  28. */
  29. public function __construct(FormBuilder $builder)
  30. {
  31. $this->builder = $builder;
  32. }
  33. /**
  34. * 创建短信模板表单
  35. * @return array
  36. * @throws \FormBuilder\Exception\FormBuilderException
  37. */
  38. public function createSmsTemplateForm()
  39. {
  40. $field = [
  41. $this->builder->input('title', '模板名称')->placeholder('模板名称,如:订单支付成功'),
  42. $this->builder->input('content', '模板内容')->type('textarea')->placeholder('模板内容,如:您购买的商品已支付成功,支付金额{$pay_price}元,订单号{$order_id},感谢您的光临!(注:模板内容不要添加短信签名)'),
  43. $this->builder->radio('type', '模板类型', 1)->options([['label' => '验证码', 'value' => 1], ['label' => '通知', 'value' => 2], ['label' => '推广', 'value' => 3]])
  44. ];
  45. return $field;
  46. }
  47. /**
  48. * 获取短信申请模板
  49. * @return array
  50. * @throws \FormBuilder\Exception\FormBuilderException
  51. */
  52. public function getSmsTemplateForm()
  53. {
  54. return create_form('申请短信模板', $this->createSmsTemplateForm(), $this->url('/notify/sms/temp'), 'POST');
  55. }
  56. }