| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?php
- namespace addons\HiGo\common\models;
- use Yii;
- /**
- * This is the model class for table "{{%addons_higo_mall}}".
- *
- * @property int $id
- * @property int $mall_id 商城id
- * @property float $hi_bei 当前发放嗨呗数量
- * @property float $hi_value 已发放嗨值数量
- * @property float $available_hi_bei 当前可用嗨呗数量
- * @property int|null $status 状态[-1:删除;0:禁用;1启用]
- * @property int $created_at
- * @property int $updated_at
- */
- class HigoMall extends \common\models\base\BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%addons_higo_mall}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['mall_id', 'status', 'created_at', 'updated_at'], 'integer'],
- [['hi_bei', 'hi_value','available_hi_bei'], 'number'],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'mall_id' => 'Mall ID',
- 'hi_bei' => 'Hi Bei',
- 'hi_value' => 'Hi Value',
- 'status' => 'Status',
- 'created_at' => 'Created At',
- 'updated_at' => 'Updated At',
- ];
- }
- /**
- * 保存数据
- * @Author: zmz
- * @DateTime: 2022/11/16 12:13
- * @Copyright: copyright (c) 2022 广东七件事集团
- * @param array $params
- * @return bool
- */
- public static function setData(array $params){
- try{
- if(isset($params['id']) && $params['id']) {
- $model = self::findOne(['id' => $params['id']]);
- if (empty($model)) throw new \Exception('服务不存在或已删除');
- }else{
- $model = new self();
- $model->loadDefaultValues();
- }
- if(!$model->load($params,'') || !$model->save()){
- throw new \Exception($model->getErrorMessage());
- }
- return $model;
- }catch(\Exception $e){
- self::setStaticError($e->getMessage());
- return false;
- }
- }
- }
|