904118851 1 жил өмнө
parent
commit
86c39b4913

+ 18 - 18
lualib/tools.lua

@@ -46,25 +46,25 @@ M.checkData= function(origin,table)
 end
 
 M.dump = function(res, tab)
-    tab = tab or 0
-    if(tab == 0) then
-        skynet.error("............dump...........")
-    end
+    -- tab = tab or 0
+    -- if(tab == 0) then
+    --     skynet.error("............dump...........")
+    -- end
     
-    if type(res) == "table" then
-        skynet.error(string.rep("\t", tab).."{")
-        for k,v in pairs(res) do
-            if type(v) == "table" then
-                skynet.error(k.."=")
-                M.dump(v, tab + 1)
-             else
-                skynet.error(string.rep("\t", tab), k, "=", v, ",")
-            end
-        end
-        skynet.error(string.rep("\t", tab).."}")
-    else
-        skynet.error(string.rep("\t", tab) , res)
-    end
+    -- if type(res) == "table" then
+    --     skynet.error(string.rep("\t", tab).."{")
+    --     for k,v in pairs(res) do
+    --         if type(v) == "table" then
+    --             skynet.error(k.."=")
+    --             M.dump(v, tab + 1)
+    --          else
+    --             skynet.error(string.rep("\t", tab), k, "=", v, ",")
+    --         end
+    --     end
+    --     skynet.error(string.rep("\t", tab).."}")
+    -- else
+    --     skynet.error(string.rep("\t", tab) , res)
+    -- end
 end
 
 M.getDbResData = function(res)

+ 7 - 3
service/dbmgr/init.lua

@@ -337,7 +337,7 @@ s.resp.folder_res_list = function(msg_body,fd,call_back)
     skynet.fork(function(_fd) 
         local sql_duration = ""
         if msg_body.duration~=nil then
-            sql_duration = string.format("AND duration >= %d",msg_body.duration)
+            sql_duration = string.format(" AND duration >= %d",msg_body.duration)
         end
         local sql = string.format("select * from res_list_tab where user_id = %d AND folder_id = %d AND is_public = %d  AND is_delete = 0"..sql_duration,msg_body.user_id,msg_body.folder_id,msg_body.is_public)
         local res = db:query(sql)
@@ -459,8 +459,12 @@ end
 --搜索资源 
 s.resp.search_res = function(msg_body,fd)
     skynet.fork(function(_fd)
-        local sql = string.format("SELECT * FROM res_list_tab WHERE file_type = %d AND file_name LIKE '%%%s%%'  AND is_delete = 0 AND classification_id = %d",msg_body.type ,msg_body.search_content,msg_body.classification_id)
-        skynet.error("sql",sql)
+        local sql_duration = ""
+        if msg_body.duration~=nil then
+            sql_duration = string.format(" AND duration >= %f",msg_body.duration)
+        end
+        local sql = string.format("SELECT * FROM res_list_tab WHERE file_type = %d AND file_name LIKE '%%%s%%'  AND is_delete = 0 AND classification_id = %d"..sql_duration,msg_body.type ,msg_body.search_content,msg_body.classification_id)
+        -- skynet.error("sql",sql)
         local res = db:query(sql)
         if res and #res > 0 then
             local tab =  {}

+ 2 - 2
service/doc/mysql_use.sql

@@ -77,7 +77,7 @@ SELECT * FROM users;  --查询用户表的所有内容
 	user_id int not null COMMENT '用户id',
 	folder_id int not null COMMENT '文件夹ID',
 	file_type int not null COMMENT '文件类型',
-	file_name varchar(30) not null COMMENT '文件名字',	
+	file_name varchar(100) not null COMMENT '文件名字',	
 	file_info JSON COMMENT '文件详情',
 	is_public int DEFAULT 0 COMMENT '是否公共资源',
 	duration  float DEFAULT 0 COMMENT '时长 单位秒,保留2位小数',
@@ -126,7 +126,7 @@ SELECT * FROM users;  --查询用户表的所有内容
 	user_id int not null COMMENT '用户id',
 	folder_id int not null COMMENT '文件夹ID',
 	file_type int not null COMMENT '文件类型',
-	file_name varchar(30) not null COMMENT '文件名字',	
+	file_name varchar(100) not null COMMENT '文件名字',	
 	file_info JSON COMMENT '文件详情',
 	duration  float DEFAULT 0 COMMENT '时长 单位秒,保留2位小数',
 	create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',

+ 4 - 4
service/public_mgr/init.lua

@@ -189,12 +189,12 @@ end
 s.resp.db_public_folder_res_list = function(msg_body,fd,call_back)
     skynet.fork(function(_fd) 
         local sql_duration = ""
-        if msg_body.duration~=nil then
-            sql_duration = string.format("AND duration >= %d",msg_body.duration)
-        end
+        -- if msg_body.duration~=nil then
+        --     sql_duration = string.format(" AND duration >= %d",msg_body.duration)
+        -- end
         local sql = string.format("select * from public_res_list_tab where user_id = %d AND folder_id = %d  AND is_delete = 0"..sql_duration,-1,msg_body.folder_id)
         local res = db:query(sql)
-        skynet.error('db_public_folder_res_list',sql)
+        -- skynet.error('db_public_folder_res_list',sql)
         -- 判断是否找到数据
         if res and #res > 0 then
             local tab =  {}