| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- namespace addons\Store\common\models;
- use addons\Redpack\common\enums\RedpackEnum;
- use common\enums\RedisKeyEnum;
- use common\enums\StatusEnum;
- use common\helpers\LockHelper;
- use common\models\user\User;
- use addons\Store\common\models\Store;
- use Yii;
- use yii\db\Exception;
- /**
- * This is the model class for table "{{%addons_redpack_wallet}}".
- *
- * @property int $id
- * @property int $mall_id 商城id
- * @property int $user_id 会员id
- * @property string $change_type 操作类型:add-增加,sub-减少
- * @property int $change_num 操作数量
- * @property int $after_num 变动后数量
- * @property int $desc 变动说明
- * @property string $source_table 来源表
- * @property int $source_table_id 操作来源业务id
- * @property int from_type 来源类型
- * @property int|null $status 状态[-1:删除;0:禁用;1启用]
- * @property int $created_at
- * @property int $updated_at
- */
- class StoreServiceRatioLog extends \common\models\base\BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%addons_store_service_ratio_log}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['mall_id', 'store_id', 'created_at', 'updated_at', 'status'], 'integer'],
- [['before_store_service_ratio', 'after_store_service_ratio'], 'number'],
- ];
- }
- public function getStore()
- {
- return $this->hasOne(Store::ClassName(), ['id' => 'store_id']);
- }
- public static function setData($params)
- {
- try {
- $model = new self();
- $model->loadDefaultValues();
- if (!$model->load($params, '')) throw new \Exception($model->getErrorMessage());
- if (!$model->save()) throw new Exception($model->getErrorMessage());
- return true;
- } catch (\Exception $e) {
- self::setStaticError($e->getMessage());
- return false;
- }
- }
- }
|