|
|
|
@ -626,6 +626,29 @@ function M($name='', $tablePrefix='',$connection='') {
|
|
|
|
|
return $_model[$guid];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 实例化模型,判断是否是子站,如果是,自动接入子站
|
|
|
|
|
*
|
|
|
|
|
* @param string $name Model名称 支持指定基础模型 例如 MongoModel:User
|
|
|
|
|
* @param string $tablePrefix 表前缀
|
|
|
|
|
* @param boolean $is_subsiteTable 是否强制使用子站
|
|
|
|
|
* @return Think\Model
|
|
|
|
|
*/
|
|
|
|
|
function SM($name='', $tablePrefix='tab_',$is_subsiteTable=false)
|
|
|
|
|
{
|
|
|
|
|
if(empty($name)){
|
|
|
|
|
if(IS_SUBSITE){
|
|
|
|
|
return M($name, $tablePrefix,SUBSITE_DB);
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
$tableName = strtolower($tablePrefix.unCamelize($name));
|
|
|
|
|
if(is_subsiteTable($tableName) || $is_subsiteTable){
|
|
|
|
|
return M($name, $tablePrefix,SUBSITE_DB);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return M($name, $tablePrefix);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 解析资源地址并导入类库文件
|
|
|
|
|