ShippingTemplatesRegion.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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\model\shipping;
  12. use crmeb\traits\ModelTrait;
  13. use crmeb\basic\BaseModel;
  14. use think\Model;
  15. /**
  16. * 地区运费Model
  17. * Class ShippingTemplatesRegion
  18. * @package app\model\shipping
  19. */
  20. class ShippingTemplatesRegion extends BaseModel
  21. {
  22. use ModelTrait;
  23. /**
  24. * 数据表主键
  25. * @var string
  26. */
  27. protected $pk = 'id';
  28. /**
  29. * 模型名称
  30. * @var string
  31. */
  32. protected $name = 'shipping_templates_region';
  33. /**
  34. * 城市ID搜索器
  35. * @param Model $query
  36. * @param $value
  37. * @param $data
  38. */
  39. public function searchCityIdAttr($query, $value)
  40. {
  41. $query->where('city_id', $value);
  42. }
  43. /**
  44. * uniqid 搜索器
  45. * @param Model $query
  46. * @param $value
  47. */
  48. public function searchUniqidAttr($query, $value)
  49. {
  50. if (is_array($value)) {
  51. $query->whereIn('uniqid', $value);
  52. } else {
  53. $query->where('uniqid', $value);
  54. }
  55. }
  56. /**
  57. * 模板id搜索
  58. * @param Model $query
  59. * @param $value
  60. */
  61. public function searchTempIdAttr($query, $value)
  62. {
  63. $query->where('temp_id', $value);
  64. }
  65. }