Express.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 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\other;
  12. use crmeb\traits\ModelTrait;
  13. use crmeb\basic\BaseModel;
  14. use think\Model;
  15. /**
  16. * 物流公司Model
  17. * Class Express
  18. * @package app\model\other
  19. */
  20. class Express 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 = 'express';
  33. /**
  34. * 物流公司是否显示
  35. * @param Model $query
  36. * @param $value
  37. * @param $data
  38. */
  39. public function searchIsShowAttr($query, $value, $data)
  40. {
  41. $query->where('is_show', $value);
  42. }
  43. /**
  44. * 物流公司信息是否完善
  45. * @param Model $query
  46. * @param $value
  47. */
  48. public function searchStatusAttr($query, $value)
  49. {
  50. $query->where('status', $value);
  51. }
  52. /**
  53. * keyword 搜索器
  54. * @param Model $query
  55. * @param $value
  56. */
  57. public function searchKeywordAttr($query, $value)
  58. {
  59. if ($value) {
  60. $query->whereLike('name|code', '%' . $value . '%');
  61. }
  62. }
  63. public function searchCodeAttr($query, $value)
  64. {
  65. if ($value === '') {
  66. $query->where('code', $value);
  67. }
  68. }
  69. }