|
@@ -16,20 +16,27 @@ class Model
|
|
protected $db = null;
|
|
protected $db = null;
|
|
protected $fields = array();
|
|
protected $fields = array();
|
|
protected $unoptions = true; //是否清空参数项,默认清除
|
|
protected $unoptions = true; //是否清空参数项,默认清除
|
|
- private $is_cls = false;
|
|
|
|
|
|
|
|
public function __construct($table = null)
|
|
public function __construct($table = null)
|
|
{
|
|
{
|
|
- if (!is_null($table)){
|
|
|
|
- $this->table_name = $table;
|
|
|
|
- $this->tableInfo($table);
|
|
|
|
- }
|
|
|
|
- $this->table_prefix = DBPRE;
|
|
|
|
- if (!is_object($this->db)){
|
|
|
|
- $this->db = new ModelDb();
|
|
|
|
- }
|
|
|
|
|
|
+ $this->table_prefix = DBPRE;
|
|
|
|
+ $this->init($table);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public function init($table)
|
|
|
|
+ {
|
|
|
|
+ $this->options = [];
|
|
|
|
+ $this->fields = [];
|
|
|
|
+
|
|
|
|
+ if (!is_null($table)){
|
|
|
|
+ $this->table_name = $table;
|
|
|
|
+ $this->tableInfo($table);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!is_object($this->db)){
|
|
|
|
+ $this->db = new ModelDb();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
/**
|
|
/**
|
|
* 删除表主键缓存
|
|
* 删除表主键缓存
|
|
*/
|
|
*/
|
|
@@ -658,14 +665,9 @@ class Model
|
|
public function cls(){
|
|
public function cls(){
|
|
$this->options = array();
|
|
$this->options = array();
|
|
$this->table_name = '';
|
|
$this->table_name = '';
|
|
- $this->is_cls = true;
|
|
|
|
return $this;
|
|
return $this;
|
|
}
|
|
}
|
|
|
|
|
|
- public function has_cls() {
|
|
|
|
- return $this->is_cls;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
public function checkActive($host = 'master') {
|
|
public function checkActive($host = 'master') {
|
|
$this->db->checkActive($host);
|
|
$this->db->checkActive($host);
|
|
}
|
|
}
|
|
@@ -1191,9 +1193,6 @@ class ModelDb
|
|
}
|
|
}
|
|
|
|
|
|
protected function parseDistinct($distinct) {
|
|
protected function parseDistinct($distinct) {
|
|
-// $ret = !empty($distinct)? ' DISTINCT '.$distinct.',' :'';
|
|
|
|
-// Log::record("parseDistinct ret = {$ret}",Log::DEBUG);
|
|
|
|
-// return $ret;
|
|
|
|
return !empty($distinct)? ' DISTINCT '.$distinct.',' :'';
|
|
return !empty($distinct)? ' DISTINCT '.$distinct.',' :'';
|
|
}
|
|
}
|
|
|
|
|