public static function saveAccoutPower($set, $where) { $table = self::$table; self::initDB(); $sql = " select id from {$table} where {$where} "; $query = self::$dbConn->query($sql); if ($query) { $res = self::$dbConn->fetch_array_all($query); if (count($res) > 0) { $update = "update {$table} {$set} where {$where}"; $query = self::$dbConn->query($update); if (!$query) { self::$errCode = "002"; self::$errMsg = "sql error"; return false; } } else { $set .= ",{$where} "; $insert = "insert into {$table} {$set}"; $query = self::$dbConn->query($insert); if (!$query) { self::$errCode = "002"; self::$errMsg = "sql error"; return false; } } self::$errCode = "200"; self::$errMsg = "success"; return true; } else { self::$errCode = "002"; self::$errMsg = "sql error"; return false; } }
public function act_addUserNmae() { $username = isset($_POST['addusername']) ? trim($_POST['addusername']) : ""; if (empty($username)) { self::$errCode = "002"; self::$errMsg = "请选择用户"; return false; } $res = AccountManageModel::addUserName($username); self::$errCode = AccountManageModel::$errCode; self::$errMsg = AccountManageModel::$errMsg; return $res; }