| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?php
- namespace addons\Happiness\common\models;
- use Yii;
- /**
- * This is the model class for table "qimall_addons_happiness_voucher_log".
- *
- * @property int $id
- * @property int $mall_id
- * @property int $store_id
- * @property int $level 商品标签权重
- * @property string $wallet_type
- * @property string $change_type 操作类型:add-增加,sub-减少
- * @property float $change_num 操作数量
- * @property float $after_num 变动后数量
- * @property string $desc 变动说明
- * @property string $source_table 来源表
- * @property int $source_table_id 操作来源业务id
- * @property string $from_type 来源类型
- * @property int $status 状态,-1:失效,1:正常,2:冻结
- * @property string $order_no 订单号
- * @property int $created_at 添加时间戳
- * @property int $updated_at 更新时间戳
- * @property string $addon_name 来源插件名称
- */
- class HappinessVoucherLog extends \common\models\base\BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return 'qimall_addons_happiness_voucher_log';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['mall_id', 'store_id', 'source_table_id', 'status', 'level','created_at', 'updated_at',], 'integer'],
- [['change_num'], 'required'],
- [['change_num', 'after_num'], 'number'],
- [['wallet_type'], 'string', 'max' => 20],
- [['change_type'], 'string', 'max' => 12],
- [['desc', 'source_table', 'from_type'], 'string', 'max' => 255],
- [['order_no'], 'string', 'max' => 100],
- [['addon_name'], 'string', 'max' => 64],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'mall_id' => 'Mall ID',
- 'store_id' => 'Store ID',
- 'level'=>'Level',
- 'wallet_type' => 'Wallet Type',
- 'change_type' => 'Change Type',
- 'change_num' => 'Change Num',
- 'after_num' => 'After Num',
- 'desc' => 'Desc',
- 'source_table' => 'Source Table',
- 'source_table_id' => 'Source Table ID',
- 'from_type' => 'From Type',
- 'status' => 'Status',
- 'order_no' => 'Order No',
- 'created_at' => 'Created At',
- 'updated_at' => 'Updated At',
- 'addon_name' => 'Addon Name',
- ];
- }
- /**
- * 保存数据
- * @param array $params
- * @return bool
- */
- 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;
- }
- }
- }
|