904118851 2 долоо хоног өмнө
parent
commit
681b099b5f

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 35 - 7
common/dbproxy/tg_main.lua


+ 6 - 0
service/backmgr/init.lua

@@ -49,6 +49,9 @@ local statistics_platform = require "statistics_platform"
 local review_user = require "review_user"
 local log = require "log"
 local product_task = require "product_task"
+local tf_age_tpl = require "tf_age_tpl"
+local tf_region_tpl = require "tf_region_tpl"
+
 local status_200 = 200
 local CMD = {
     
@@ -97,6 +100,9 @@ CMD["review_user"] = review_user;
 CMD["log"] = log;
 CMD["product_task"] = product_task;
 
+CMD["tf_age_tpl"] = tf_age_tpl;
+CMD["tf_region_tpl"] = tf_region_tpl;
+
 function run(target,fun,msg_body,fd)
     if target~=nil and fun~=nil and target[fun]~=nil then
         local isok,data,total = target[fun](msg_body)

+ 7 - 2
service/backmgr/task_material_queue_queue.lua

@@ -26,7 +26,7 @@ function M.set_sweight(msg_body)
 end
 
 function M.search_task_material_queue_queue(msg_body)
-    local isok ,key =  tools.checkData({  "is_copy", "start_publish_time",
+    local isok ,key =  tools.checkData({ "error_msg", "is_copy", "start_publish_time",
     "end_publish_time","id","butler_id","tg_main_id","page_size","page_number","start_create_time","end_create_time",
     "tg_platform_id","advertiser_id","advertiser_name","product_id","product_name","material_id","status"},msg_body)
     if not isok then
@@ -36,6 +36,11 @@ function M.search_task_material_queue_queue(msg_body)
     local page_number = msg_body.page_number
     local offset = (page_number - 1) * page_size
 
+    local error_msg_param = ""
+    if msg_body.error_msg~="" then
+        local searchTerm = string.gsub(msg_body.error_msg, "%%", "\\%%")
+        error_msg_param = string.format("  AND error_msg LIKE CONCAT('%%', '%s', '%%')  ",searchTerm)
+    end
 
     local date_param = ""
     if msg_body.start_publish_time~="" and msg_body.end_publish_time~="" then
@@ -104,7 +109,7 @@ function M.search_task_material_queue_queue(msg_body)
         create_date_param = " AND DATE(created_at) >= DATE(FROM_UNIXTIME(" .. (msg_body.start_create_time / 1000) .. ")) AND DATE(created_at) <= DATE(FROM_UNIXTIME(" .. (msg_body.end_create_time / 1000) .. "))"
     end
 
-    local param = date_param..is_copy_param..id_param..tg_main_id_param..butler_id_param..tg_platform_id_param..advertiser_id_param..advertiser_name_param..product_id_param..product_name_param..material_id_param..status_param..create_date_param
+    local param = error_msg_param..date_param..is_copy_param..id_param..tg_main_id_param..butler_id_param..tg_platform_id_param..advertiser_id_param..advertiser_name_param..product_id_param..product_name_param..material_id_param..status_param..create_date_param
 
     local sql = "SELECT * FROM task_material_queue_queue WHERE 1=1 "..param.." ORDER BY id DESC "..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
    

+ 45 - 0
service/backmgr/tf_age_tpl.lua

@@ -0,0 +1,45 @@
+--投放年龄模版
+local M = {}
+local mysqldbx = require "mysqldbx"
+local tools = require "tools"
+local skynet = require "skynet"
+
+
+function M.add(msg_body)
+    local isok ,key =  tools.checkData({"name","age"},msg_body)
+    if not isok then
+        return false,string.format("缺少字段: %s.", key)
+    end
+    local sql = string.format("INSERT INTO `tf_age_tpl` (name,age)  VALUES ('%s','%s')",msg_body.name,msg_body.age)
+    mysqldbx.query(sql)
+    return true, {}
+end
+
+
+function M.modify(msg_body)
+    local isok ,key =  tools.checkData({"age","name","id"},msg_body)
+    if not isok then
+        return false,string.format("缺少字段: %s.", key)
+    end
+    local sql = string.format("UPDATE  tf_age_tpl SET age = '%s' , name = '%s' WHERE id = %d ",msg_body.age,msg_body.name,msg_body.id)
+    mysqldbx.query(sql)
+    return true, {}
+end
+
+function M.search(msg_body)
+    local isok ,key =  tools.checkData({"page_size","page_number"},msg_body)
+    if not isok then
+        return false,string.format("缺少字段: %s.", key)
+    end
+    local page_size = msg_body.page_size
+    local page_number = msg_body.page_number
+    local offset = (page_number - 1) * page_size
+    
+    local sql = "SELECT * FROM tf_age_tpl "..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
+    local list = mysqldbx.query(sql)
+    sql = "SELECT   COUNT(*) AS total  FROM tf_age_tpl "
+    local total = mysqldbx.query(sql)
+    return true,list,total[1].total
+end
+
+return M

+ 45 - 0
service/backmgr/tf_region_tpl.lua

@@ -0,0 +1,45 @@
+--投放地区模版
+local M = {}
+local mysqldbx = require "mysqldbx"
+local tools = require "tools"
+local skynet = require "skynet"
+
+
+function M.add(msg_body)
+    local isok ,key =  tools.checkData({"name","city","location_type","region_version"},msg_body)
+    if not isok then
+        return false,string.format("缺少字段: %s.", key)
+    end
+    local sql = string.format("INSERT INTO `tf_region_tpl` (name,city,location_type,region_version)  VALUES ('%s','%s','%s','%s')",msg_body.name,msg_body.city,msg_body.location_type,msg_body.region_version)
+    mysqldbx.query(sql)
+    return true, {}
+end
+
+
+function M.modify(msg_body)
+    local isok ,key =  tools.checkData({"name","city","location_type","region_version","id"},msg_body)
+    if not isok then
+        return false,string.format("缺少字段: %s.", key)
+    end
+    local sql = string.format("UPDATE  tf_region_tpl SET name = '%s' , city = '%s' ,location_type = '%s' , region_version = '%s' WHERE id = %d ",msg_body.name,msg_body.city,msg_body.location_type,msg_body.region_version,msg_body.id)
+    mysqldbx.query(sql)
+    return true, {}
+end
+
+function M.search(msg_body)
+    local isok ,key =  tools.checkData({"page_size","page_number"},msg_body)
+    if not isok then
+        return false,string.format("缺少字段: %s.", key)
+    end
+    local page_size = msg_body.page_size
+    local page_number = msg_body.page_number
+    local offset = (page_number - 1) * page_size
+    
+    local sql = "SELECT * FROM tf_region_tpl where 1=1 "..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
+    local list = mysqldbx.query(sql)
+    sql = "SELECT   COUNT(*) AS total  FROM tf_region_tpl "
+    local total = mysqldbx.query(sql)
+    return true,list,total[1].total
+end
+
+return M

+ 13 - 5
service/backmgr/video_product.lua

@@ -15,6 +15,7 @@ local mysqldtaskbx = {}
 --product_name 书名
 function M.search_book_data(msg_body)
     local isok ,key =  tools.checkData({
+    "gender",
     "is_match",
     "start_create_at",
     "end_create_at",
@@ -52,6 +53,12 @@ function M.search_book_data(msg_body)
         
     end
 
+    
+    local gender_param = ""
+    if msg_body.gender~="" then
+        gender_param = string.format(" AND gender = %d ",msg_body.gender)
+    end
+
     local product_parent_id_param = ""
     if msg_body.product_parent_id~="" then
         product_parent_id_param = string.format(" AND product_parent_id = '%s' ",msg_body.product_parent_id)
@@ -139,7 +146,7 @@ function M.search_book_data(msg_body)
         alias_name_param = string.format(" AND  ( alias_name LIKE CONCAT( '%%%s%%')) ",msg_body.alias_name)
     end
 
-    local param = is_match_param..create_date_param..product_parent_id_param..is_top_param..status_param..date_param..totalChapterNum_param..product_param..product_name_param..tg_platform_param..is_auto_param..is_store_param..genre_param..alias_name_param..word_param;
+    local param = gender_param..is_match_param..create_date_param..product_parent_id_param..is_top_param..status_param..date_param..totalChapterNum_param..product_param..product_name_param..tg_platform_param..is_auto_param..is_store_param..genre_param..alias_name_param..word_param;
 
     if stat_cost_param~="" and up_or_down_publish_time_param ~="" then
         up_or_down_publish_time_param = " , "..up_or_down_publish_time_param
@@ -378,14 +385,14 @@ function M.set_album_link(msg_body)
 end
 
 function M.modify_product_info(msg_body)
-    local isok ,key =  tools.checkData({"id","list_time","words","author","fee_unit","default_price","default_pay_section","publish_time","status","product_parent_id",
+    local isok ,key =  tools.checkData({"totalChapterNum","gender","id","list_time","words","author","fee_unit","default_price","default_pay_section","publish_time","status","product_parent_id",
     "genre","is_store"},msg_body)
     if not isok then
         return false,string.format("缺少字段: %s.", key)
     end
     local sql ;
     local isok,res;
-    sql = string.format("UPDATE  `video_product` SET list_time = '%s' , words = '%s' , author = '%s' ,fee_unit = %d , default_price = %f , default_pay_section = %d , publish_time = '%s' , status = %d , product_parent_id = '%s' , genre = %d , is_store = %d  WHERE id = %d ",msg_body.list_time,msg_body.words,msg_body.author,msg_body.fee_unit,msg_body.default_price,msg_body.default_pay_section,msg_body.publish_time,msg_body.status,msg_body.product_parent_id,msg_body.genre,msg_body.is_store,msg_body.id) 
+    sql = string.format("UPDATE  `video_product` SET totalChapterNum = %d , gender = %d , list_time = '%s' , words = '%s' , author = '%s' ,fee_unit = %d , default_price = %f , default_pay_section = %d , publish_time = '%s' , status = %d , product_parent_id = '%s' , genre = %d , is_store = %d  WHERE id = %d ",msg_body.totalChapterNum,msg_body.gender,msg_body.list_time,msg_body.words,msg_body.author,msg_body.fee_unit,msg_body.default_price,msg_body.default_pay_section,msg_body.publish_time,msg_body.status,msg_body.product_parent_id,msg_body.genre,msg_body.is_store,msg_body.id) 
     res = mysqldtaskbx.Singleton().query(sql)
     return true,{}
 end
@@ -423,7 +430,7 @@ end
 
 --添加书籍数据
 function M.add_book_data(msg_body)
-    local isok ,key =  tools.checkData({"list_time","words","author","fee_unit","default_price","default_pay_section","publish_time","status","product_parent_id","tg_platform_id","product_id","product_name"
+    local isok ,key =  tools.checkData({"gender","list_time","words","author","fee_unit","default_price","default_pay_section","publish_time","status","product_parent_id","tg_platform_id","product_id","product_name"
     ,"genre","is_store"},msg_body)
     if not isok then
         return false,string.format("缺少字段: %s.", key)
@@ -451,7 +458,8 @@ function M.add_book_data(msg_body)
         return false,"书籍已存在!"
     end
 
-    sql = string.format("INSERT INTO `video_product` (list_time,totalChapterNum,match_book,words,author,album_link,fee_unit,default_price,default_pay_section,publish_time,status,product_parent_id,book_platform,product_id, product_name, genre,is_store,is_auto)  VALUES ('%s',%d,'%s','%s','%s','%s',%d,%f,%d,'%s',%d,'%s',%d,'%s','%s',%d,%d,0)",
+    sql = string.format("INSERT INTO `video_product` (gender,list_time,totalChapterNum,match_book,words,author,album_link,fee_unit,default_price,default_pay_section,publish_time,status,product_parent_id,book_platform,product_id, product_name, genre,is_store,is_auto)  VALUES (%d,'%s',%d,'%s','%s','%s','%s',%d,%f,%d,'%s',%d,'%s',%d,'%s','%s',%d,%d,0)",
+        msg_body.gender,
         msg_body.list_time,
         totalChapterNum,
         match_book,

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно