Purchasesmstemplate.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. namespace app\admin\model;
  3. use think\Model;
  4. class Purchasesmstemplate extends Model
  5. {
  6. // 表名
  7. protected $name = 'purchase_sms_template';
  8. // 自动写入时间戳字段
  9. protected $autoWriteTimestamp = 'datetime';
  10. // 定义时间戳字段名
  11. protected $createTime = 'createtime';
  12. protected $updateTime = 'updatetime';
  13. public function getSceneList()
  14. {
  15. return [
  16. 'review_email' => '协助下发-邮箱',
  17. 'review_sms' => '协助下发-短信',
  18. 'confirm_ok' => '采购确认-通过',
  19. 'confirm_fail' => '采购确认-未通过',
  20. 'confirm_ok_email' => '采购确认通过-邮箱',
  21. 'confirm_fail_email' => '采购确认未通过-邮箱',
  22. 'bid_open' => '开标双重验证',
  23. 'rfq_salesman_email' => '询价通知业务员-邮箱',
  24. 'rfq_supplier_email' => '供应商询价通知',
  25. 'delivery_notify_email' => '交货情况通知生产部-邮箱',
  26. ];
  27. }
  28. /** status:1=正常 0=禁用 */
  29. public function getStatusList()
  30. {
  31. return ['1' => '正常', '0' => '禁用'];
  32. }
  33. public static function isEmailScene(string $scene): bool
  34. {
  35. return in_array($scene, [
  36. 'review_email',
  37. 'review',
  38. 'rfq_salesman_email',
  39. 'rfq_supplier_email',
  40. 'confirm_ok_email',
  41. 'confirm_fail_email',
  42. 'delivery_notify_email',
  43. ], true);
  44. }
  45. public static function isSmsScene(string $scene): bool
  46. {
  47. return in_array($scene, ['review_sms', 'confirm_ok', 'confirm_fail', 'bid_open'], true);
  48. }
  49. /**
  50. * 各场景编辑弹窗右侧变量说明(统一列表,改 getVariableGuide() 一处即可)
  51. *
  52. * @return array<int, array{tag:string,label:string,example:string,scenes:string}>
  53. */
  54. public static function getVariableGuideForScene(string $scene): array
  55. {
  56. unset($scene);
  57. return static::getVariableGuide();
  58. }
  59. /**
  60. * 模版变量说明(唯一维护处:右侧「说明」列改这里 label 即可,四个模版弹窗显示相同)
  61. *
  62. * @return array<int, array{tag:string,label:string,example:string,scenes:string}>
  63. */
  64. public static function getVariableGuide(): array
  65. {
  66. return [
  67. ['tag' => '{company_name}', 'label' => '供应商名称', 'example' => '浙江某某印刷有限公司', 'scenes' => '全部'],
  68. ['tag' => '{contact_name}', 'label' => '姓名/业务员', 'example' => '张三', 'scenes' => '全部'],
  69. ['tag' => '{salesman_name}', 'label' => '业务员姓名', 'example' => '张三', 'scenes' => '询价通知业务员'],
  70. ['tag' => '{phone}', 'label' => '手机号', 'example' => '13800138000', 'scenes' => '全部'],
  71. ['tag' => '{email}', 'label' => '邮箱', 'example' => 'user@example.com', 'scenes' => '全部'],
  72. ['tag' => '{ccydh}', 'label' => '订单号/需求编号', 'example' => 'YW20260730001', 'scenes' => '全部'],
  73. ['tag' => '{cyjmc}', 'label' => '印件名称', 'example' => '藏书票2', 'scenes' => '全部'],
  74. ['tag' => '{cgymc}', 'label' => '工序名称(单道工序)', 'example' => '骑马订', 'scenes' => '协助下发/询价通知/交货通知'],
  75. ['tag' => '{this_quantity}', 'label' => '本次数量/订单数量', 'example' => '200', 'scenes' => '询价通知/交货通知'],
  76. ['tag' => '{ceilingPrice}', 'label' => '最高限价', 'example' => '0.7', 'scenes' => '询价通知业务员'],
  77. ['tag' => '{cdw}', 'label' => '单位', 'example' => '本', 'scenes' => '询价通知业务员'],
  78. ['tag' => '{MBZ}', 'label' => '招标备注', 'example' => '封面颜色深', 'scenes' => '询价通知业务员'],
  79. ['tag' => '{supplier_name}', 'label' => '报价/中标供应商', 'example' => '台州某某有限公司', 'scenes' => '询价通知业务员/交货通知'],
  80. ['tag' => '{supplier_quotes}', 'label' => '供应商报价表格(名称+单价)', 'example' => '自动生成表格', 'scenes' => '询价通知业务员'],
  81. ['tag' => '{cywyxm}', 'label' => '需求发起人', 'example' => '管理员', 'scenes' => '询价通知业务员'],
  82. ['tag' => '{delivery_deadline}', 'label' => '交货截止日期', 'example' => '2026-08-26', 'scenes' => '交货情况通知生产部'],
  83. ['tag' => '{category}', 'label' => '业务分类', 'example' => '出版物印刷', 'scenes' => '协助下发'],
  84. ['tag' => '{deadline}', 'label' => '截止时间', 'example' => '2026-05-18 14:30', 'scenes' => '协助下发/供应商询价'],
  85. ['tag' => '{process_lines}', 'label' => '订单工序明细(文本)', 'example' => "订单号:202605732S\n印件名称:越剧唱腔\n工序名称:数字打包 单位:册 本次数量:40\n工序名称:数字平张单色 单位:P 本次数量:200\n\n订单号:202605713S\n印件名称:……\n工序名称:数字平张单色 单位:P 本次数量:100", 'scenes' => '全部'],
  86. ['tag' => '{process_lines_html}', 'label' => '订单工序明细(表格,多订单按单分组)', 'example' => '<table>…</table>', 'scenes' => '协助下发/供应商询价邮箱'],
  87. ['tag' => '{order_type}', 'label' => '订单类型', 'example' => '普通订单(价格优先)', 'scenes' => '协助下发邮箱'],
  88. ['tag' => '{score_weights}', 'label' => '评分比例', 'example' => '质量30%、价格50%、交货20%', 'scenes' => '协助下发邮箱'],
  89. ['tag' => '{platform_url}', 'label' => '平台链接', 'example' => 'https://…', 'scenes' => '协助下发/供应商询价/业务员询价/采购确认/交货通知邮箱'],
  90. ];
  91. }
  92. }