StoreHangOrder.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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\order;
  12. use app\model\user\User;
  13. use crmeb\basic\BaseModel;
  14. /**
  15. * Class StoreHangOrder
  16. * @package app\model\order
  17. */
  18. class StoreHangOrder extends BaseModel
  19. {
  20. /**
  21. * 表名
  22. * @var string
  23. */
  24. protected $name = 'store_hang_order';
  25. /**
  26. * 主键id
  27. * @var string
  28. */
  29. protected $pk = 'id';
  30. /**
  31. * @return \think\model\relation\HasOne
  32. */
  33. public function user()
  34. {
  35. return $this->hasOne(User::class, 'uid', 'uid')->bind([
  36. 'nickname' => 'nickname',
  37. 'avatar' => 'avatar'
  38. ]);
  39. }
  40. /**
  41. * @param $query
  42. * @param $value
  43. */
  44. public function searchStoreIdAttr($query, $value)
  45. {
  46. $query->where('store_id', $value);
  47. }
  48. /**
  49. * @param $query
  50. * @param $value
  51. */
  52. public function searchStaffIdAttr($query, $value)
  53. {
  54. $query->where('staff_id', $value);
  55. }
  56. /**
  57. * @param $query
  58. * @param $value
  59. */
  60. public function searchUidAttr($query, $value)
  61. {
  62. $query->where('uid', $value);
  63. }
  64. /**
  65. * @param $query
  66. * @param $value
  67. */
  68. public function searchIsCheckAttr($query, $value)
  69. {
  70. $query->where('is_check', $value);
  71. }
  72. }