WechatVideoShopSharer.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. namespace addons\WechatVideoShop\common\models;
  3. use common\models\user\User;
  4. use Yii;
  5. /**
  6. * This is the model class for table "qimall_addons_wechat_video_shop_sharer".
  7. *
  8. * @property int $id
  9. * @property int $mall_id
  10. * @property int $status 状态[1启用 0禁用 -1删除]
  11. * @property int $created_at 创建时间
  12. * @property int $updated_at 更新事件
  13. * @property int $user_id 用户ID
  14. * @property int $shop_id 店铺ID
  15. * @property float $total_sales 累计销售额
  16. * @property float $total_commission 累计销售额
  17. * @property float $total_score 累计销售额
  18. * @property int $total_customers 累计客户数
  19. * @property int $invite_at 分销员接受邀请时间
  20. * @property int $bind_at 分销员/导购员绑定时间
  21. * @property int $sharer_type 分销员/导购员绑定时间
  22. * @property int $total_order 分销员/导购员绑定时间
  23. * @property int $level 分销员/导购员绑定时间
  24. * @property int $upgrade_level_at 分销员/导购员绑定时间
  25. * @property int $upgrade_status 分销员/导购员绑定时间
  26. * @property string $openid openid
  27. * @property string $unionid unionid
  28. * @property string $nickname unionid
  29. * @property User $user
  30. * @property WechatVideoShop $shop
  31. */
  32. class WechatVideoShopSharer extends \common\models\base\BaseActiveRecord
  33. {
  34. /**
  35. * {@inheritdoc}
  36. */
  37. public static function tableName()
  38. {
  39. return 'qimall_addons_wechat_video_shop_sharer';
  40. }
  41. /**
  42. * {@inheritdoc}
  43. */
  44. public function rules()
  45. {
  46. return [
  47. [['mall_id', 'status', 'created_at', 'updated_at', 'user_id', 'shop_id', 'total_customers', 'invite_at',
  48. 'bind_at', 'sharer_type', 'total_order', 'level', 'upgrade_status', 'upgrade_level_at'], 'integer'],
  49. [['openid', 'unionid', 'nickname'], 'string', 'max' => 50],
  50. [['total_sales', 'total_commission', 'total_score'], 'number'],
  51. ];
  52. }
  53. /**
  54. * {@inheritdoc}
  55. */
  56. public function attributeLabels()
  57. {
  58. return [
  59. 'id' => 'ID',
  60. 'mall_id' => 'Mall ID',
  61. 'status' => 'Status',
  62. 'created_at' => 'Created At',
  63. 'updated_at' => 'Updated At',
  64. 'user_id' => 'User ID',
  65. 'openid' => 'Openid',
  66. 'unionid' => 'Unionid',
  67. 'shop_id' => 'Shop ID',
  68. 'total_sales' => 'Total Sales',
  69. 'total_customers' => 'Total Customers',
  70. 'bind_at' => 'Bind At',
  71. 'invite_at' => 'Invite At',
  72. ];
  73. }
  74. public function getUser(){
  75. return $this->hasOne(User::class, ['id' => 'user_id'])->select('id, username, nickname, avatar_url, mobile');
  76. }
  77. public function getShop(){
  78. return $this->hasOne(WechatVideoShop::class, ['id' => 'shop_id']);
  79. }
  80. public function getLevel()
  81. {
  82. return $this->hasOne(WechatVideoShopLevel::class, ['level' => 'level']);
  83. }
  84. }