MODEL_LOG::mdl_alert_table PHP Method

mdl_alert_table() public method

修改表 mdl_alert_table function.
public mdl_alert_table ( ) : void
return void
    function mdl_alert_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_col = $this->mdl_column();
        $_arr_alert = array();
        if (in_array("log_operator_id", $_arr_col)) {
            $_arr_alert["log_operator_id"] = array("CHANGE", "smallint NOT NULL COMMENT '操作者 ID'", "log_operator_id");
        }
        if (in_array("log_target_type", $_arr_col)) {
            $_arr_alert["log_target_type"] = array("CHANGE", "enum('" . $_str_targets . "') NOT NULL COMMENT '目标类型'", "log_target_type");
        }
        if (in_array("log_type", $_arr_col)) {
            $_arr_alert["log_type"] = array("CHANGE", "enum('" . $_str_types . "') NOT NULL COMMENT '目标类型'", "log_type");
        }
        if (in_array("log_status", $_arr_col)) {
            $_arr_alert["log_status"] = array("CHANGE", "enum('" . $_str_status . "')", "log_status");
        }
        $_str_alert = "y060111";
        if ($_arr_alert) {
            $_reselt = $this->obj_db->alert_table(BG_DB_TABLE . "log", $_arr_alert);
            if ($_reselt) {
                $_str_alert = "y060106";
                $_arr_logData = array("log_target_type" => $_arr_targets[0]);
                $this->obj_db->update(BG_DB_TABLE . "log", $_arr_logData, "LENGTH(log_target_type) < 1");
                //更新数据
                $_arr_logData = array("log_type" => $_arr_types[0]);
                $this->obj_db->update(BG_DB_TABLE . "log", $_arr_logData, "LENGTH(log_type) < 1");
                //更新数据
                $_arr_logData = array("log_status" => $_arr_status[0]);
                $this->obj_db->update(BG_DB_TABLE . "log", $_arr_logData, "LENGTH(log_status) < 1");
                //更新数据
            }
        }
        return array("alert" => $_str_alert);
    }

Usage Example

コード例 #1
0
ファイル: upgrade.class.php プロジェクト: gorgee/baigoADS
 private function table_log()
 {
     include_once BG_PATH_MODEL . "log.class.php";
     //载入管理帐号模型
     $_mdl_log = new MODEL_LOG();
     $_arr_logTable = $_mdl_log->mdl_alert_table();
     $this->tplData["db_alert"]["log_table"] = array("alert" => $_arr_logTable["alert"], "status" => substr($_arr_logTable["alert"], 0, 1));
 }