| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php
- namespace addons\Seed\common\models;
- use Yii;
- use yii\db\Exception;
- /**
- * This is the model class for table "{{%addons_seed_refund}}".
- *
- * @property int $id ID
- * @property int $seed_order_id seed_order.id
- * @property int $seed_num 退款种子金数量
- * @property float|null $seed_cost 退款种子金总价值,单位:元
- * @property float|null $percent 退款比例,单位:百分比
- * @property int $status 状态【-1删除 0禁用,1正常】
- * @property int $created_at 创建时间
- * @property int $updated_at 更新数据时间
- */
- class SeedRefund extends \common\models\base\BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%addons_seed_refund}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['seed_order_id', 'seed_num', 'status', 'created_at', 'updated_at'], 'integer'],
- [['seed_cost','percent'], 'number'],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'seed_order_id' => 'seed_order.id',
- 'seed_num' => '退款种子金数量',
- 'seed_cost' => '退款种子金总价值,单位:元',
- 'percent' => '退款比例,单位:百分比',
- 'status' => '状态【-1删除 0禁用,1正常】',
- 'created_at' => '创建时间',
- 'updated_at' => '更新数据时间',
- ];
- }
- /**
- * 保存数据
- * @Author: lun
- * @DateTime: 2022/8/30 0030 10:34
- * @Copyright: copyright (c) 2021 广东七件事集团
- * @param $params
- * @return bool
- */
- public static function setData($params)
- {
- try {
- $model = new self();
- $model->loadDefaultValues();
- if (!$model->load($params, '') || !$model->save()) throw new Exception($model->getErrorMessage());
- return true;
- } catch (\Exception $e) {
- self::setStaticError('种子金退款记录:'.$e->getMessage());
- return false;
- }
- }
- }
|