ProductGroupUser.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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\common\model\store\product;
  12. use app\common\model\BaseModel;
  13. use app\common\model\store\order\StoreOrder;
  14. class ProductGroupUser extends BaseModel
  15. {
  16. /**
  17. * TODO
  18. * @return string
  19. * @author Qinii
  20. * @day 1/7/21
  21. */
  22. public static function tablePk(): string
  23. {
  24. return '';
  25. }
  26. /**
  27. * TODO
  28. * @return string
  29. * @author Qinii
  30. * @day 1/7/21
  31. */
  32. public static function tableName(): string
  33. {
  34. return 'store_product_group_user';
  35. }
  36. public function orderInfo()
  37. {
  38. return $this->hasOne(StoreOrder::class,'order_id','order_id');
  39. }
  40. public function groupBuying()
  41. {
  42. return $this->hasOne(ProductGroupBuying::class,'group_buying_id','group_buying_id');
  43. }
  44. public function getAvatarAttr($value)
  45. {
  46. return $value ? $value : '/static/f.png';
  47. }
  48. public function searchProductGroupIdAttr($query,$value)
  49. {
  50. $query->where('product_group_id',$value);
  51. }
  52. public function searchGroupBuyingIdAttr($query,$value)
  53. {
  54. $query->where('group_buying_id',$value);
  55. }
  56. public function searchUidAttr($query,$value)
  57. {
  58. $query->where('uid',$value);
  59. }
  60. public function searchIsDelAttr($query,$value)
  61. {
  62. $query->where('is_del',$value);
  63. }
  64. }