| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?php
- namespace addons\DoubleCopy\common\models;
- use Yii;
- use yii\db\Exception;
- /**
- * This is the model class for table "{{%addons_double_copy_pool_send}}".
- *
- * @property int $id
- * @property int $mall_id 商城ID
- * @property int $level 等级(权重)
- * @property float|null $total_bonus_money 本次分红总额,单位:元
- * @property int|null $bonus_num 分红人数
- * @property float|null $bonus_money 每人可得分红金额,单位:元
- * @property int $cycle_type 分红周期[1=日,2=周,3=月]
- * @property int $date 执行日期,如:20220919
- * @property int $status 状态[-1:删除;0:禁用;1启用]
- * @property int|null $created_at 创建时间
- * @property int|null $updated_at 更新时间
- * @property string $reward_currency 奖励类型:佣金-commission,积分-score
- */
- class DoubleCopyPoolSend extends \common\models\base\BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%addons_double_copy_pool_send}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['mall_id', 'level', 'bonus_num', 'cycle_type', 'date', 'status', 'created_at', 'updated_at'], 'integer'],
- [['total_bonus_money', 'bonus_money'], 'number'],
- [['reward_currency'],'string']
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'mall_id' => '商城ID',
- 'level' => '等级(权重)',
- 'total_bonus_money' => '本次分红总额,单位:元',
- 'bonus_num' => '分红人数',
- 'bonus_money' => '每人可得分红金额,单位:元',
- 'cycle_type' => '分红周期[1=日,2=周,3=月]',
- 'date' => '执行日期,如:20220919',
- 'status' => '状态[-1:删除;0:禁用;1启用]',
- 'created_at' => '创建时间',
- 'updated_at' => '更新时间',
- ];
- }
- /**
- * 生成数据
- * @Author: lun
- * @DateTime: 2022/9/19 0019 16:37
- * @Copyright: copyright (c) 2021 广东七件事集团
- * @param $params
- * @return array|bool
- */
- public static function create($params)
- {
- try {
- $model = new self();
- $model->loadDefaultValues();
- if (!$model->load($params, '') || !$model->save()) throw new Exception($model->getErrorMessage());
- return $model->toArray();
- } catch (\Exception $e) {
- self::setStaticError($e->getMessage());
- return false;
- }
- }
- }
|