MODEL_APP::mdl_submit PHP Method

mdl_submit() public method

提交 mdl_submit function.
public mdl_submit ( ) : void
return void
    function mdl_submit()
    {
        $_arr_appData = array("app_name" => $this->appSubmit["app_name"], "app_url_notify" => $this->appSubmit["app_url_notify"], "app_url_sync" => $this->appSubmit["app_url_sync"], "app_note" => $this->appSubmit["app_note"], "app_status" => $this->appSubmit["app_status"], "app_ip_allow" => $this->appSubmit["app_ip_allow"], "app_ip_bad" => $this->appSubmit["app_ip_bad"], "app_sync" => $this->appSubmit["app_sync"], "app_allow" => $this->appSubmit["app_allow"]);
        if ($this->appSubmit["app_id"] < 1) {
            $_str_appKey = fn_rand(64);
            $_arr_insert = array("app_key" => $_str_appKey, "app_time" => time());
            $_arr_data = array_merge($_arr_appData, $_arr_insert);
            $_num_appId = $this->obj_db->insert(BG_DB_TABLE . "app", $_arr_data);
            //更新数据
            if ($_num_appId > 0) {
                $_str_alert = "y050101";
                //更新成功
            } else {
                return array("alert" => "x050101");
            }
        } else {
            $_str_appKey = "";
            $_num_appId = $this->appSubmit["app_id"];
            $_num_mysql = $this->obj_db->update(BG_DB_TABLE . "app", $_arr_appData, "app_id=" . $_num_appId);
            //更新数据
            if ($_num_mysql > 0) {
                $_str_alert = "y050103";
                //更新成功
            } else {
                return array("alert" => "x050103");
            }
        }
        return array("app_id" => $_num_appId, "app_key" => $_str_appKey, "alert" => $_str_alert);
    }

Usage Example

Example #1
0
 private function record_app()
 {
     include_once BG_PATH_MODEL . "app.class.php";
     //载入管理帐号模型
     $_mdl_app = new MODEL_APP();
     $_arr_appRow = $_mdl_app->api_add();
     if ($_arr_appRow["alert"] != "ok") {
         $this->obj_api->halt_re($_arr_appRow);
     }
     $this->appRecord = $_mdl_app->mdl_submit();
     if ($this->appRecord["alert"] != "y050101") {
         $this->obj_api->halt_re($this->appRecord);
     }
 }