DeliveryLimit.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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\model;
  13. use app\common\library\helper;
  14. /**
  15. * 不可配送模板区域模型
  16. * Class DeliveryLimit
  17. * @package app\store\model
  18. */
  19. class DeliveryLimit extends BaseModel
  20. {
  21. // 定义表名
  22. protected $name = 'delivery_limit';
  23. // 定义主键
  24. protected $pk = 'limit_id';
  25. protected $updateTime = false;
  26. const DEFAULT_ID = 1;
  27. /**
  28. * 不可配送模板区域模板详情
  29. * @param int $limitId
  30. * @return null|static
  31. */
  32. public static function detail(int $limitId)
  33. {
  34. return self::get($limitId);
  35. }
  36. /**
  37. * 获取器:不可配送区域转为数组格式
  38. * @param $value
  39. * @return array
  40. */
  41. public function getRegionAttr(string $value)
  42. {
  43. return helper::jsonDecode($value);
  44. }
  45. /**
  46. * 修改器:不可配送区域转为json格式
  47. * @param array $value
  48. * @return string
  49. */
  50. public function setRegionAttr(array $value)
  51. {
  52. return helper::jsonEncode($value);
  53. }
  54. /**
  55. * 获取器:不可配送区域(文字展示)转为数组格式
  56. * @param $value
  57. * @return array
  58. */
  59. public function getRegionTextAttr(string $value)
  60. {
  61. return helper::jsonDecode($value);
  62. }
  63. /**
  64. * 修改器:不可配送区域转(文字展示)为json格式
  65. * @param array $value
  66. * @return string
  67. */
  68. public function setRegionTextAttr(array $value)
  69. {
  70. return helper::jsonEncode($value);
  71. }
  72. }