| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- namespace addons\RandomRedPacket\common\models;
- use common\models\user\User;
- use Yii;
- /**
- * This is the model class for table "qimall_addons_random_red_packet_record".
- *
- * @property int $id
- * @property int $mall_id 商城id
- * @property int $uid 用户id
- * @property int $packet_id 红包id
- * @property string $reward_value 奖励值
- * @property int $created_at 创建时间
- * @property int $updated_at 修改时间
- */
- class RandomRedPacketRecord extends \common\models\base\BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return 'qimall_addons_random_red_packet_record';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['uid', 'packet_id', 'reward_value'], 'required'],
- [['uid', 'packet_id', 'created_at', 'updated_at'], 'integer'],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'uid' => 'Uid',
- 'packet_id' => 'Packet ID',
- 'reward_value' => 'Reward Value',
- 'created_at' => 'Created At',
- 'updated_at' => 'Updated At',
- ];
- }
- /**
- * 关联随机红包信息
- * @Author: lun
- * @DateTime: 2023/2/18 0018 9:56
- * @Copyright: copyright (c) 2021 广东七件事集团
- * @return \yii\db\ActiveQuery
- */
- public function getRandomRedPacket()
- {
- return $this->hasOne(RandomRedPacket::class,['id' => 'packet_id']);
- }
- /**
- * 关联用户信息
- * @Author: lun
- * @DateTime: 2023/2/18 0018 9:56
- * @Copyright: copyright (c) 2021 广东七件事集团
- * @return \yii\db\ActiveQuery
- */
- public function getUser()
- {
- return $this->hasOne(User::class, ['id' => 'uid'])->select('nickname,avatar_url,id');
- }
- }
|