UserAddress.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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\user;
  12. use crmeb\basic\BaseModel;
  13. use crmeb\traits\ModelTrait;
  14. use think\model;
  15. /**
  16. * Class UserAddress
  17. * @package app\model\user
  18. */
  19. class UserAddress extends BaseModel
  20. {
  21. use ModelTrait;
  22. /**
  23. * 数据表主键
  24. * @var string
  25. */
  26. protected $pk = 'id';
  27. /**
  28. * 模型名称
  29. * @var string
  30. */
  31. protected $name = 'user_address';
  32. protected $insert = ['add_time'];
  33. protected $hidden = ['add_time', 'is_del'];
  34. protected function setAddTimeAttr()
  35. {
  36. return time();
  37. }
  38. /**
  39. * 用户uid
  40. * @param $query
  41. * @param $value
  42. */
  43. public function searchUidAttr($query, $value)
  44. {
  45. $query->where('uid', $value);
  46. }
  47. /**
  48. * 是否删除
  49. * @param Model $query
  50. * @param $value
  51. */
  52. public function searchIsDelAttr($query, $value)
  53. {
  54. $query->where('is_del', $value);
  55. }
  56. /**
  57. * 是否默认地址
  58. * @param Model $query
  59. * @param $value
  60. */
  61. public function searchIsDefaultAttr($query, $value)
  62. {
  63. $query->where('is_default', $value);
  64. }
  65. }