Purchasesmstemplate.php 4.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. 'bid_open' => '开标双重验证',
  20. 'rfq_salesman_email' => '询价通知业务员-邮箱',
  21. 'rfq_supplier_email' => '供应商询价通知',
  22. ];
  23. }
  24. /** status:1=正常 0=禁用 */
  25. public function getStatusList()
  26. {
  27. return ['1' => '正常', '0' => '禁用'];
  28. }
  29. public static function isEmailScene(string $scene): bool
  30. {
  31. return in_array($scene, ['review_email', 'review', 'rfq_salesman_email', 'rfq_supplier_email'], true);
  32. }
  33. public static function isSmsScene(string $scene): bool
  34. {
  35. return in_array($scene, ['review_sms', 'confirm_ok', 'confirm_fail', 'bid_open'], true);
  36. }
  37. /**
  38. * 各场景编辑弹窗右侧变量说明(统一列表,改 getVariableGuide() 一处即可)
  39. *
  40. * @return array<int, array{tag:string,label:string,example:string,scenes:string}>
  41. */
  42. public static function getVariableGuideForScene(string $scene): array
  43. {
  44. unset($scene);
  45. return static::getVariableGuide();
  46. }
  47. /**
  48. * 模版变量说明(唯一维护处:右侧「说明」列改这里 label 即可,四个模版弹窗显示相同)
  49. *
  50. * @return array<int, array{tag:string,label:string,example:string,scenes:string}>
  51. */
  52. public static function getVariableGuide(): array
  53. {
  54. return [
  55. ['tag' => '{company_name}', 'label' => '供应商名称', 'example' => '浙江某某印刷有限公司', 'scenes' => '全部'],
  56. ['tag' => '{contact_name}', 'label' => '姓名/业务员', 'example' => '张三', 'scenes' => '全部'],
  57. ['tag' => '{salesman_name}', 'label' => '业务员姓名', 'example' => '张三', 'scenes' => '询价通知业务员'],
  58. ['tag' => '{phone}', 'label' => '手机号', 'example' => '13800138000', 'scenes' => '全部'],
  59. ['tag' => '{email}', 'label' => '邮箱', 'example' => 'user@example.com', 'scenes' => '全部'],
  60. ['tag' => '{ccydh}', 'label' => '订单号/需求编号', 'example' => 'YW20260730001', 'scenes' => '全部'],
  61. ['tag' => '{cyjmc}', 'label' => '印件名称', 'example' => '藏书票2', 'scenes' => '全部'],
  62. ['tag' => '{cgymc}', 'label' => '工序名称(单道工序)', 'example' => '骑马订', 'scenes' => '协助下发/询价通知'],
  63. ['tag' => '{this_quantity}', 'label' => '本次数量', 'example' => '200', 'scenes' => '询价通知'],
  64. ['tag' => '{ceilingPrice}', 'label' => '最高限价', 'example' => '0.7', 'scenes' => '询价通知业务员'],
  65. ['tag' => '{cdw}', 'label' => '单位', 'example' => '本', 'scenes' => '询价通知业务员'],
  66. ['tag' => '{MBZ}', 'label' => '备注', 'example' => '封面颜色深', 'scenes' => '询价通知业务员'],
  67. ['tag' => '{supplier_name}', 'label' => '报价供应商', 'example' => '台州某某有限公司', 'scenes' => '询价通知业务员'],
  68. ['tag' => '{supplier_quotes}', 'label' => '供应商报价表格(名称+单价)', 'example' => '自动生成表格', 'scenes' => '询价通知业务员'],
  69. ['tag' => '{cywyxm}', 'label' => '需求发起人', 'example' => '管理员', 'scenes' => '询价通知业务员'],
  70. ['tag' => '{category}', 'label' => '业务分类', 'example' => '出版物印刷', 'scenes' => '协助下发'],
  71. ['tag' => '{deadline}', 'label' => '截止时间', 'example' => '2026-05-18 14:30', 'scenes' => '协助下发/供应商询价'],
  72. ['tag' => '{process_lines}', 'label' => '订单工序明细(文本)', 'example' => "订单号:YW20240629001\n印件名称:藏书票2\n1.工序名称:做刀版 单位:张 本次数量:500", 'scenes' => '全部'],
  73. ['tag' => '{process_lines_html}', 'label' => '订单工序明细(表格)', 'example' => '<table>…</table>', 'scenes' => '协助下发/供应商询价邮箱'],
  74. ['tag' => '{platform_url}', 'label' => '平台链接', 'example' => 'https://…', 'scenes' => '协助下发/供应商询价邮箱'],
  75. ];
  76. }
  77. }