|
@@ -1041,6 +1041,57 @@ s.resp.get_not_have_file_list_by_list = function(fd,msg_body,user_data)
|
|
|
user_id = user_id},fd
|
|
|
)
|
|
|
end
|
|
|
+
|
|
|
+
|
|
|
+--存储数据
|
|
|
+s.resp.setItem = function(fd,msg_body,user_data)
|
|
|
+ msg_body = cjson.decode(msg_body)
|
|
|
+ if type(user_data) ~= "table" then
|
|
|
+ return tools.response(fd, 200, "token error!")
|
|
|
+ end
|
|
|
+ local user_id = user_data.user_id
|
|
|
+ -- tools.dump(msg_body)
|
|
|
+ if user_id==nil then
|
|
|
+ return tools.response(fd,100,"user_id==nil setItem !")
|
|
|
+ end
|
|
|
+ msg_body["user_id"] = user_id
|
|
|
+ local isok ,key = tools.checkData({"key","base64value"},msg_body)
|
|
|
+ if not isok then
|
|
|
+ return tools.response(fd,200,cjson.encode({code=9001,msg = string.format("缺少字段: %s.", key)}))
|
|
|
+ end
|
|
|
+
|
|
|
+ isok = skynet.call("dbmgr","lua","on_recv","setItem",{
|
|
|
+ key = msg_body.key,
|
|
|
+ base64value = msg_body.base64value,
|
|
|
+ user_id = user_id},fd
|
|
|
+ )
|
|
|
+end
|
|
|
+
|
|
|
+--获取数据
|
|
|
+s.resp.getItem = function(fd,msg_body,user_data)
|
|
|
+ msg_body = cjson.decode(msg_body)
|
|
|
+ if type(user_data) ~= "table" then
|
|
|
+ return tools.response(fd, 200, "token error!")
|
|
|
+ end
|
|
|
+ local user_id = user_data.user_id
|
|
|
+ -- tools.dump(msg_body)
|
|
|
+ if user_id==nil then
|
|
|
+ return tools.response(fd,100,"user_id==nil getItem !")
|
|
|
+ end
|
|
|
+ msg_body["user_id"] = user_id
|
|
|
+ local isok ,key = tools.checkData({"key"},msg_body)
|
|
|
+ if not isok then
|
|
|
+ return tools.response(fd,200,cjson.encode({code=9001,msg = string.format("缺少字段: %s.", key)}))
|
|
|
+ end
|
|
|
+
|
|
|
+ isok = skynet.call("dbmgr","lua","on_recv","getItem",{
|
|
|
+ key = msg_body.key,
|
|
|
+ user_id = user_id},fd
|
|
|
+ )
|
|
|
+end
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
--踢掉
|
|
|
s.resp.kick = function(fd,msg_body,user_data)
|
|
|
|