|
@@ -32,11 +32,12 @@ function M.db_set(msg_body)
|
|
return false,string.format("缺少字段: %s.", key)
|
|
return false,string.format("缺少字段: %s.", key)
|
|
end
|
|
end
|
|
|
|
|
|
- local sql = string.format("SELECT * FROM data_manager WHERE key = '%s' LIMIT 1", msg_body.key)
|
|
|
|
|
|
+ local sql = string.format("SELECT * FROM data_manager WHERE db_key = '%s' LIMIT 1", msg_body.key)
|
|
local isok,res;
|
|
local isok,res;
|
|
res = mysqldbx.query(sql)
|
|
res = mysqldbx.query(sql)
|
|
|
|
+ skynet.error("sql:",sql)
|
|
if #res > 0 then
|
|
if #res > 0 then
|
|
- sql = string.format("UPDATE data_manager SET db_value = '%s' WHERE db_key = '%s' ",msg_body.value,msg_body.key)
|
|
|
|
|
|
+ sql = string.format("UPDATE data_manager SET db_value = '%s' WHERE db_key = '%s' ",cjson.encode(msg_body.value),msg_body.key)
|
|
else
|
|
else
|
|
sql = string.format("INSERT INTO `data_manager` (db_key,db_value) VALUES ('%s','%s')",msg_body.key,cjson.encode(msg_body.value))
|
|
sql = string.format("INSERT INTO `data_manager` (db_key,db_value) VALUES ('%s','%s')",msg_body.key,cjson.encode(msg_body.value))
|
|
end
|
|
end
|