ProductGroupUser.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\common\model\store\product;
  12. use app\common\model\BaseModel;
  13. use app\common\model\store\order\StoreOrder;
  14. use app\common\model\user\User;
  15. class ProductGroupUser extends BaseModel
  16. {
  17. /**
  18. *
  19. * @return string
  20. * @author Qinii
  21. * @day 1/7/21
  22. */
  23. public static function tablePk(): string
  24. {
  25. return '';
  26. }
  27. /**
  28. *
  29. * @return string
  30. * @author Qinii
  31. * @day 1/7/21
  32. */
  33. public static function tableName(): string
  34. {
  35. return 'store_product_group_user';
  36. }
  37. public function orderInfo()
  38. {
  39. return $this->hasOne(StoreOrder::class,'order_id','order_id');
  40. }
  41. public function groupBuying()
  42. {
  43. return $this->hasOne(ProductGroupBuying::class,'group_buying_id','group_buying_id');
  44. }
  45. public function productGroup()
  46. {
  47. return $this->hasOne(ProductGroup::class,'product_group_id','product_group_id');
  48. }
  49. public function user()
  50. {
  51. return $this->hasOne(User::class,'uid','uid');
  52. }
  53. // public function getAvatarAttr($value)
  54. // {
  55. // return $value ? $value : '/static/f.png';
  56. // }
  57. public function searchProductGroupIdAttr($query,$value)
  58. {
  59. $query->where('product_group_id',$value);
  60. }
  61. public function searchGroupBuyingIdAttr($query,$value)
  62. {
  63. $query->where('group_buying_id',$value);
  64. }
  65. public function searchUidAttr($query,$value)
  66. {
  67. $query->where('uid',$value);
  68. }
  69. public function searchIsDelAttr($query,$value)
  70. {
  71. $query->where('is_del',$value);
  72. }
  73. }