| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace addons\ScoreBonus\common\models;
- use common\models\user\User;
- use Exception;
- use Yii;
- /**
- * This is the model class for table "qimall_addons_score_bonus_user_weight_log".
- *
- * @property int $id id
- * @property int $mall_id 商城id
- * @property int $user_id 商城id
- * @property int $before_weight 修改前权重
- * @property int $after_weight 修改后权重
- * @property int $status 状态
- * @property int|null $created_at 添加时间
- * @property int|null $updated_at 修改时间
- */
- class ScoreBonusUserWeightContributions extends \common\models\base\BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return 'qimall_addons_score_bonus_weight_contributions';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['mall_id', 'parent_user_id','child_user_id', 'user_level'], 'required'],
- [['mall_id', 'parent_user_id', 'child_user_id','status', 'created_at', 'updated_at'], 'integer'],
- ];
- }
- public function getUser()
- {
- return $this->hasOne(User::class, ['id' => 'user_id']);
- }
- public static function setData(array $params)
- {
- try {
- $model = new self();
- $model->loadDefaultValues();
- if (!$model->load($params, '') || !$model->save()) throw new \Exception($model->getErrorMessage());
- return $model;
- } catch (Exception $e) {
- self::$static_error = $e->getMessage();
- return false;
- }
- }
- }
|