添加一个增加根结点的操作

ct-mobile-first
赵鹏 4 years ago
parent 12489447a7
commit 0f44ef656f

@ -217,4 +217,30 @@ class InfoStructures_model extends CI_Model
}
}
/**
* @description: 用于生成一个特殊的根结点is_level和is_sort都为0CT移动优先项目用
* @param {type}
* @return:
* @Date Changed:
*/
public function AddRootNote($is_ic_id){
$sql = "INSERT INTO infoStructures \n"
. " ( \n"
. " is_parent_id, is_path, is_level, is_sort, is_sitecode, is_datetime, is_ic_id \n"
. " ) \n"
. "VALUES \n"
. " ( \n"
. " ?, ?, ?, ?, ?, getdate(), ? \n"
. " )";
$query = $this->HT->query($sql, array(-99, '', 0, 0, $this->config->item('site_code'), $is_ic_id));
$this->insert_id = $this->HT->last_id('infoStructures');
//把自己的ID加到path上
$set_sql = "UPDATE infoStructures \n"
. "SET is_path = is_path + CONVERT(VARCHAR(200), is_id) + ',' \n"
. "WHERE is_id = ?";
$query = $this->HT->query($set_sql, array($this->insert_id));
return $this->insert_id;
}
}
Loading…
Cancel
Save