| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- namespace addons\ScoreBonus\common\models;
- use Exception;
- use Yii;
- /**
- * This is the model class for table "qimall_addons_score_bonus_capital_pool".
- *
- * @property int $id id
- * @property int $mall_id 商城id
- * @property float $bonus_price 当前分红池总额
- * @property float $total_price 已发放分红总额
- * @property int $status 状态
- * @property int|null $created_at 添加时间
- * @property int|null $updated_at 修改时间
- */
- class ScoreBonusCapitalPool extends \common\models\base\BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return 'qimall_addons_score_bonus_capital_pool';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['mall_id', 'bonus_price', 'total_price'], 'required'],
- [['mall_id', 'status', 'created_at', 'updated_at'], 'integer'],
- [['bonus_price', 'total_price'], 'number'],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'mall_id' => 'Mall ID',
- 'bonus_price' => 'Bonus Price',
- 'total_price' => 'Total Price',
- 'status' => 'Status',
- 'created_at' => 'Created At',
- 'updated_at' => 'Updated At',
- ];
- }
- public static function setData(array $params)
- {
- try {
- if (!empty($params['id'])) {
- $model = self::findOne(['mall_id' => $params['mall_id'], 'id' => $params['id']]);
- if (empty($model)) throw new \Exception('服务不存在或已删除');
- } else {
- $model = new self();
- $model->loadDefaultValues();
- }
- if (!$model->load($params, '')) throw new \Exception($model->getErrorMessage());
- if (!$model->save()) throw new \Exception($model->getErrorMessage());
- return $model;
- } catch (Exception $e) {
- self::$static_error = $e->getMessage();
- return false;
- }
- }
- }
|