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; } } }