UserCollageCodePartake.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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\activity\collage;
  12. use app\model\product\product\StoreProduct;
  13. use app\model\user\User;
  14. use app\model\product\sku\StoreProductAttrValue;
  15. use crmeb\basic\BaseModel;
  16. use crmeb\traits\ModelTrait;
  17. /**
  18. * 用户参与拼单Model
  19. * Class UserCollagePartake
  20. * @package app\model\collage
  21. */
  22. class UserCollageCodePartake extends BaseModel
  23. {
  24. use ModelTrait;
  25. /**
  26. * 数据表主键
  27. * @var string
  28. */
  29. protected $pk = 'id';
  30. /**
  31. * 模型名称
  32. * @var string
  33. */
  34. protected $name = 'user_collage_code_partake';
  35. /**
  36. * 一对一关联
  37. * 购物车关联商品商品详情
  38. * @return \think\model\relation\HasOne
  39. */
  40. public function productInfo()
  41. {
  42. return $this->hasOne(StoreProduct::class, 'id', 'product_id');
  43. }
  44. /**
  45. * 一对一关联
  46. * 购物车关联商品商品规格
  47. * @return \think\model\relation\HasOne
  48. */
  49. public function attrInfo()
  50. {
  51. return $this->hasOne(StoreProductAttrValue::class, 'unique', 'product_attr_unique');
  52. }
  53. /**
  54. * 一对一关联
  55. * 关联用户信息
  56. * @return \think\model\relation\HasOne
  57. */
  58. public function userInfo()
  59. {
  60. return $this->hasOne(User::class, 'uid', 'uid');
  61. }
  62. }