| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- namespace addons\LuckyGroup\common\models;
- use common\models\base\BaseActiveRecord;
- use Yii;
- use yii\db\Exception;
- /**
- * This is the model class for table "qimall_addons_lucky_group_bonus_pool".
- *
- * @property int $id
- * @property float $money 奖金池剩余金额
- * @property float $total_money 奖金池总额
- * @property float $virtual_send_money 虚拟发放金额
- * @property int $mall_id 商城ID
- * @property int $status 状态[-1:删除;0:禁用;1启用]
- * @property int|null $created_at
- * @property int|null $updated_at
- */
- class LuckyGroupBonusPool extends BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%addons_lucky_group_bonus_pool}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['money', 'total_money', 'virtual_send_money'], 'number'],
- [['mall_id'], 'required'],
- [['mall_id', 'status', 'created_at', 'updated_at'], 'integer'],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'money' => '奖金池剩余金额',
- 'total_money' => '奖金池总额',
- 'virtual_send_money' => '虚拟发放金额',
- 'mall_id' => '商城ID',
- 'status' => '状态[-1:删除;0:禁用;1启用]',
- 'created_at' => 'Created At',
- 'updated_at' => 'Updated At',
- ];
- }
- public static function setData($bonus_pool, $mall_id, $money)
- {
- if (!isset($bonus_pool)) {
- $bonus_pool = new LuckyGroupBonusPool();
- $bonus_pool->mall_id = $mall_id;
- $bonus_pool->loadDefaultValues();
- }
- $bonus_pool->money += $money;
- $bonus_pool->total_money += $money;
- $res = $bonus_pool->save();
- if ($res == false) throw new Exception('加入奖金池失败');
- return true;
- }
- }
|