| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?php
- /**
- * 厦门云联储网络科技有限公司
- * https://www.baokuaiyun.com
- * Copyright (c) 2023 爆块云 All rights reserved.
- */
- namespace app\models;
- use yii\base\ErrorException;
- use yii\db\ActiveRecord;
- use yii\behaviors\TimestampBehavior;
- use Yii;
- /**
- * This is the model class for table "{{%ac_pool_award_record}}".
- *
- * @property integer $id
- * @property integer $currency_id
- * @property integer $money
- * @property integer $pool_id
- * @property integer $saas_id
- * @property string $weight
- * @property string $fee
- * @property string $miss_money
- * @property string $desc
- * @property integer $created_at
- */
- class AcPoolAwardRecord extends \yii\db\ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return '{{%ac_pool_award_record}}';
- }
- public function behaviors()
- {
- return [
- [
- 'class' => TimestampBehavior::class,
- 'attributes' => [
- ActiveRecord::EVENT_BEFORE_INSERT => ['created_at'],
- ]
- ]
- ];
- }
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [[ 'pool_id', 'saas_id','currency_id'], 'integer'],
- [['desc'], 'string'],
- [['money','weight','miss_money','fee'], 'number'],
- [['created_at'], 'safe']
- ];
- }
- public static function createRecord($currency_id,$saas_id,$pool_id,$weight,$desc,$money,$fee,$miss){
- try {
- $record = new self();
- $record->money=$money;
- $record->currency_id=$currency_id;
- $record->pool_id=$pool_id;
- $record->saas_id=$saas_id;
- $record->weight=$weight?:0;
- $record->fee=$fee?:0;
- $record->miss_money=$miss?:0;
- $record->desc=$desc;
- if (!$record->save())throw new ErrorException('保存失败'.json_encode($record->getErrors()));
- return true;
- }catch (ErrorException $e){
- //debug_log([__METHOD__, __LINE__, "发放是失败 {$e->getMessage() }"], "app_debug_partner.log");
- return false;
- }
- }
- }
|