MODEL_LOG::mdl_create_table PHP Method

mdl_create_table() public method

创建表 mdl_create function.
public mdl_create_table ( ) : void
return void
    function mdl_create_table()
    {
        foreach ($this->logStatus as $_key => $_value) {
            $_arr_status[] = $_key;
        }
        $_str_status = implode("','", $_arr_status);
        foreach ($this->logTypes as $_key => $_value) {
            $_arr_types[] = $_key;
        }
        $_str_types = implode("','", $_arr_types);
        foreach ($this->logTargets as $_key => $_value) {
            $_arr_targets[] = $_key;
        }
        $_str_targets = implode("','", $_arr_targets);
        $_arr_logCreate = array("log_id" => "int NOT NULL AUTO_INCREMENT COMMENT 'ID'", "log_time" => "int NOT NULL COMMENT '时间'", "log_operator_id" => "smallint NOT NULL COMMENT '操作者 ID'", "log_targets" => "text NOT NULL COMMENT '目标 JSON'", "log_target_type" => "enum('" . $_str_targets . "') NOT NULL COMMENT '目标类型'", "log_title" => "varchar(1000) NOT NULL COMMENT '操作标题'", "log_result" => "varchar(1000) NOT NULL COMMENT '操作结果'", "log_type" => "enum('" . $_str_types . "') NOT NULL COMMENT '日志类型'", "log_status" => "enum('" . $_str_status . "') NOT NULL COMMENT '状态'", "log_level" => "varchar(30) NOT NULL COMMENT '日志级别'");
        $_num_mysql = $this->obj_db->create_table(BG_DB_TABLE . "log", $_arr_logCreate, "log_id", "应用");
        if ($_num_mysql > 0) {
            $_str_alert = "y060105";
            //更新成功
        } else {
            $_str_alert = "x060105";
            //更新成功
        }
        return array("alert" => $_str_alert);
    }

Usage Example

Exemplo n.º 1
0
 private function table_log()
 {
     include_once BG_PATH_MODEL . "log.class.php";
     //载入管理帐号模型
     $_mdl_log = new MODEL_LOG();
     $_arr_logTable = $_mdl_log->mdl_create_table();
     if ($_arr_logTable["alert"] != "y060105") {
         $this->obj_api->halt_re($_arr_logTable);
     }
 }
All Usage Examples Of MODEL_LOG::mdl_create_table