Purchasesmstemplate.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. namespace app\admin\model;
  3. use think\Model;
  4. class Purchasesmstemplate extends Model
  5. {
  6. protected $table = 'purchase_sms_template';
  7. /** 时间由控制器写入 datetime 字符串(库表为 datetime,勿用 int 时间戳) */
  8. protected $autoWriteTimestamp = false;
  9. protected $createTime = false;
  10. protected $updateTime = false;
  11. protected $deleteTime = false;
  12. public function getSceneList()
  13. {
  14. return [
  15. 'review_email' => '外发下发-邮箱',
  16. 'review_sms' => '外发下发-短信',
  17. 'confirm_ok' => '采购确认-通过',
  18. 'confirm_fail' => '采购确认-未通过',
  19. ];
  20. }
  21. /** status:1=正常 0=禁用 */
  22. public function getStatusList()
  23. {
  24. return ['1' => '正常', '0' => '禁用'];
  25. }
  26. public static function isEmailScene(string $scene): bool
  27. {
  28. return $scene === 'review_email' || $scene === 'review';
  29. }
  30. public static function isSmsScene(string $scene): bool
  31. {
  32. return in_array($scene, ['review_sms', 'confirm_ok', 'confirm_fail'], true);
  33. }
  34. /**
  35. * 各场景编辑弹窗右侧变量说明(统一列表,改 getVariableGuide() 一处即可)
  36. *
  37. * @return array<int, array{tag:string,label:string,example:string,scenes:string}>
  38. */
  39. public static function getVariableGuideForScene(string $scene): array
  40. {
  41. unset($scene);
  42. return static::getVariableGuide();
  43. }
  44. /**
  45. * 模版变量说明(唯一维护处:右侧「说明」列改这里 label 即可,四个模版弹窗显示相同)
  46. *
  47. * @return array<int, array{tag:string,label:string,example:string,scenes:string}>
  48. */
  49. public static function getVariableGuide(): array
  50. {
  51. return [
  52. ['tag' => '{company_name}', 'label' => '供应商名称', 'example' => '浙江某某印刷有限公司', 'scenes' => '全部'],
  53. ['tag' => '{contact_name}', 'label' => '姓名', 'example' => '张三', 'scenes' => '全部'],
  54. ['tag' => '{phone}', 'label' => '手机号', 'example' => '13800138000', 'scenes' => '全部'],
  55. ['tag' => '{email}', 'label' => '邮箱', 'example' => 'user@example.com', 'scenes' => '全部'],
  56. ['tag' => '{ccydh}', 'label' => '订单号', 'example' => '202603668L', 'scenes' => '全部'],
  57. ['tag' => '{cyjmc}', 'label' => '印件名称', 'example' => '藏书票2', 'scenes' => '全部'],
  58. ['tag' => '{cgymc}', 'label' => '工序名称(单道工序)', 'example' => '骑马订', 'scenes' => '外发下发'],
  59. ['tag' => '{category}', 'label' => '业务分类', 'example' => '出版物印刷', 'scenes' => '外发下发'],
  60. ['tag' => '{deadline}', 'label' => '截止时间', 'example' => '2026-05-18 14:30', 'scenes' => '外发下发'],
  61. ['tag' => '{process_lines}', 'label' => '订单工序明细(文本)', 'example' => "1.压折线 单位:张\n2.模切", 'scenes' => '外发下发'],
  62. ['tag' => '{process_lines_html}', 'label' => '订单工序明细(表格)', 'example' => '<table>…</table>', 'scenes' => '外发下发邮箱'],
  63. ['tag' => '{platform_url}', 'label' => '平台链接', 'example' => 'https://…', 'scenes' => '外发下发邮箱'],
  64. ];
  65. }
  66. }