更新项目部分结构,新增加DB

This commit is contained in:
2024-12-19 19:20:27 +08:00
parent 0fe2624e6b
commit 992c94250d
539 changed files with 1667 additions and 1906 deletions

View File

@@ -0,0 +1,22 @@
<?php
namespace common\core;
use yii\base\Exception;
use yii\db\ActiveRecord;
/**
* 对框架的AR的扩展,所有前台/后台数据模型都继承自该类
*/
class BaseNewActiveRecord extends ActiveRecord
{
public static function getDb()
{
return \Yii::$app->get('new_db');
}
public function saveOrFail($runValidation = true, $attributeNames = null){
if(!$this->save($runValidation, $attributeNames)){
throw new Exception(implode(',',$this->getFirstErrors()));
}
return true;
}
}