kvstorage 버그 수정
This commit is contained in:
+1
-1
@@ -1496,7 +1496,7 @@ function updateOnline() {
|
||||
}
|
||||
|
||||
//접속중인 국가
|
||||
$gameStor->online = $onlinenume;
|
||||
$gameStor->online = $onlinenum;
|
||||
$gameStor->onlinenation = $onnationstr;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ function processSpring() {
|
||||
function processGoldIncome() {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
$gameStor = new KVStorage($db, 'game_env');
|
||||
|
||||
$admin = $gameStor->getValues(['year','month','gold_rate']);
|
||||
$adminLog = [];
|
||||
|
||||
@@ -140,10 +140,10 @@ class ChangeCity extends \sammo\Event\Action{
|
||||
|
||||
if($targetType == 'cities'){
|
||||
if(is_numeric($this->targetArgs)){
|
||||
return DB::db()->queryFirstColumn('SELECT city FROM city WHERE city IN (%ls)', $this->targetArgs);
|
||||
return DB::db()->queryFirstColumn('SELECT city FROM city WHERE city IN %ls', $this->targetArgs);
|
||||
}
|
||||
else{
|
||||
return DB::db()->queryFirstColumn('SELECT city FROM city WHERE name IN (%ls)', $this->targetArgs);
|
||||
return DB::db()->queryFirstColumn('SELECT city FROM city WHERE name IN %ls', $this->targetArgs);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+19
-7
@@ -138,6 +138,9 @@ class KVStorage{
|
||||
}
|
||||
|
||||
public function getValuesAsArray(array $keys, bool $onlyCache=false): array{
|
||||
if(!$keys){
|
||||
return [];
|
||||
}
|
||||
$dictResult = $this->getValues($keys, $onlyCache);
|
||||
$result = [];
|
||||
foreach($keys as $key){
|
||||
@@ -147,6 +150,9 @@ class KVStorage{
|
||||
}
|
||||
|
||||
public function getValues(array $keys, bool $onlyCache=false): array{
|
||||
if(!$keys){
|
||||
return [];
|
||||
}
|
||||
if ($this->cacheData === null) {
|
||||
return $this->getDBValues($keys);
|
||||
}
|
||||
@@ -224,7 +230,11 @@ class KVStorage{
|
||||
}
|
||||
|
||||
private function getDBValues(array $keys): array{
|
||||
if(!$keys){
|
||||
return [];
|
||||
}
|
||||
$result = [];
|
||||
$keys = array_map('strval', $keys);
|
||||
foreach($this->db->queryAllLists(
|
||||
'SELECT `key`, `value` FROM %b WHERE `namespace`=%s AND `key` IN %ls',
|
||||
$this->tableName,
|
||||
@@ -243,6 +253,7 @@ class KVStorage{
|
||||
}
|
||||
|
||||
private function getDBValue($key){
|
||||
$key = (string)$key;
|
||||
$value = $this->db->queryFirstField(
|
||||
'SELECT `value` FROM %b WHERE `namespace`=%s AND `key`=%s',
|
||||
$this->tableName,
|
||||
@@ -268,17 +279,18 @@ class KVStorage{
|
||||
}
|
||||
|
||||
private function deleteDBValue($key):self{
|
||||
$this->db->delete($this->tableName, [
|
||||
'namespace'=>$this->storNamespace,
|
||||
'key'=>$key
|
||||
]);
|
||||
$key = (string)$key;
|
||||
$this->db->delete(
|
||||
$this->tableName,
|
||||
'`namespace`=%s AND `key`=%s',
|
||||
$this->storNamespace,
|
||||
$key
|
||||
);
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function resetDBNamespace():self{
|
||||
$this->db->delete($this->tableName, [
|
||||
'namespace'=>$this->storNamespace
|
||||
]);
|
||||
$this->db->delete($this->tableName, 'namespace=%s', $this->storNamespace);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
+2
@@ -645,6 +645,8 @@ class MeekroDB {
|
||||
'code' => $db->errno
|
||||
));
|
||||
}
|
||||
|
||||
echo $sql."<br>\n";
|
||||
|
||||
if ($this->throw_exception_on_error) {
|
||||
$e = new MeekroDBException($db->error, $sql, $db->errno);
|
||||
|
||||
Reference in New Issue
Block a user