904118851 1 долоо хоног өмнө
parent
commit
2cfc19d9ac

+ 70 - 5
common/dbproxy/tg_main.lua

@@ -64,7 +64,7 @@ end
 
 function M.search(msg_body)
 
-    local isok ,key =  tools.checkData({"tf_new_material_status","tf_landing_type","tf_micro_promotion_type","tf_support_status","internal_advertiser_classify","tg_app_index_list","aigc_status","title_pay_type","is_boost","is_reservation","title_type_id","is_group_record","tf_time_interval","mini_program_platform_id","is_comment","material_rule_id","parent_main_id","tg_day","id","ads_operation_status","statistics_platform_id","converted_time_duration","cbo_status","project_type","oce_product_id",
+    local isok ,key =  tools.checkData({"tf_whitelist_status","tf_gender_status","tf_age_tpl_id","tf_region_tpl_id","tf_new_material_status","tf_landing_type","tf_micro_promotion_type","tf_support_status","internal_advertiser_classify","tg_app_index_list","aigc_status","title_pay_type","is_boost","is_reservation","title_type_id","is_group_record","tf_time_interval","mini_program_platform_id","is_comment","material_rule_id","parent_main_id","tg_day","id","ads_operation_status","statistics_platform_id","converted_time_duration","cbo_status","project_type","oce_product_id",
     "oce_product_platform_id",
     "delivery_mode","material_platform_id","wx_miniapp_create_status","template_bid","cpa_bid","page_size","page_number","main_name","running_status","custom_budget","pay_type","tg_platform_id","butler_id","tg_app_index","is_open_create_link","is_delete"},msg_body)
    
@@ -78,6 +78,26 @@ function M.search(msg_body)
 
     local offset = (page_number - 1) * page_size
 
+    local tf_whitelist_status_param = ""
+    if msg_body.tf_whitelist_status~="" then
+        tf_whitelist_status_param =  " AND tf_whitelist_status = "..msg_body.tf_whitelist_status
+    end
+
+    local tf_gender_status_param = ""
+    if msg_body.tf_gender_status~="" then
+        tf_gender_status_param =  " AND tf_gender_status = "..msg_body.tf_gender_status
+    end
+    
+    local tf_age_tpl_id_param = ""
+    if msg_body.tf_age_tpl_id~="" then
+        tf_age_tpl_id_param =  " AND tf_age_tpl_id = "..msg_body.tf_age_tpl_id
+    end
+
+    local tf_region_tpl_id_param = ""
+    if msg_body.tf_region_tpl_id~="" then
+        tf_region_tpl_id_param =  " AND tf_region_tpl_id = "..msg_body.tf_region_tpl_id
+    end
+
     local tf_new_material_status_param = ""
     if msg_body.tf_new_material_status~="" then
         tf_new_material_status_param =  " AND tf_new_material_status = "..msg_body.tf_new_material_status
@@ -295,7 +315,7 @@ function M.search(msg_body)
     --     genre_param =  string.format(" AND genre = %d ",msg_body.genre) 
     -- end
 
-    local param = tf_new_material_status_param..tf_landing_type_param..tf_micro_promotion_type_param..internal_advertiser_classify_param..tf_support_status_param..tg_app_index_list_param..aigc_status_param..title_pay_type_param..is_boost_param..is_reservation_param..title_type_id_param..is_group_record_param..tf_time_interval_param..mini_program_platform_id_param..is_comment_param..material_rule_id_param..parent_main_id_param..tg_day_param..id_param..ads_operation_status_param..statistics_platform_id_param..converted_time_duration_param..infra_status_param..cbo_script_status_param..cbo_status_param..project_type_param..oce_product_platform_id_param..oce_product_id_param..delivery_mode_param..main_name_param..tg_platform_param..running_status_param..pay_type_param..butler_id_param..tg_app_index_param..is_open_create_link_param..is_delete_param..custom_budget_param..cpa_bid_param..template_bid_param..wx_miniapp_create_status_param..material_platform_id_param;
+    local param = tf_whitelist_status_param..tf_gender_status_param..tf_age_tpl_id_param..tf_region_tpl_id_param..tf_new_material_status_param..tf_landing_type_param..tf_micro_promotion_type_param..internal_advertiser_classify_param..tf_support_status_param..tg_app_index_list_param..aigc_status_param..title_pay_type_param..is_boost_param..is_reservation_param..title_type_id_param..is_group_record_param..tf_time_interval_param..mini_program_platform_id_param..is_comment_param..material_rule_id_param..parent_main_id_param..tg_day_param..id_param..ads_operation_status_param..statistics_platform_id_param..converted_time_duration_param..infra_status_param..cbo_script_status_param..cbo_status_param..project_type_param..oce_product_platform_id_param..oce_product_id_param..delivery_mode_param..main_name_param..tg_platform_param..running_status_param..pay_type_param..butler_id_param..tg_app_index_param..is_open_create_link_param..is_delete_param..custom_budget_param..cpa_bid_param..template_bid_param..wx_miniapp_create_status_param..material_platform_id_param;
     local sql = "SELECT * FROM tg_main where 1=1 "..param..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
     local res = mysqldbx.query(sql)
     skynet.error("sql:",sql)
@@ -318,13 +338,17 @@ end
 -- `daily_new_limit` int DEFAULT '0' COMMENT '今天新上数量上限',
 
 function M.addMain(msg_body)
-    local isok ,key =  tools.checkData({"tf_new_material_status","tf_landing_type","tf_micro_promotion_type","tf_support_status","internal_advertiser_classify","aigc_status","zy_conifg","title_pay_type","is_boost","is_reservation","title_type_id","is_group_record","tf_time_interval","mat_roi","reduce_roi","boost_high_price_end_time","boost_high_price_number","reduce_consume_amount","reduce_bid_amount","is_comment","convert_cnt","material_rule_id","material_rule_number","parent_main_id","valid_timer_like_num","tg_day","ads_operation_status","statistics_platform_id","hide_if_converted","converted_time_duration","cbo_script_time","cbo_script_status","cbo_status","project_type","tf_status","tf_start_time","stat_cost","oce_product_id","oce_product_platform_id","material_platform_id","strategy_config","delivery_mode","price","pack_strategy_status","start_chapter","advertiser_id","wx_miniapp_create_status","ad_act","template_bid","zh_id","roi_goal","ql_bid","infra_status","pay_type","qm_id","ldy_template_site_id","yw_id","parent_platform_id","platform_shared_id","distributor_id","is_delete","ad_convert_type","aweme_id","tg_app_index","butler_id","mini_program_platform_id","landing_page","valid_timer_time","valid_timer_number","channelId","no_bid_budget","max_ad_quantity","tg_link_config","tg_platform_id","app_id","main_name","running_status","ad_quantity","cpa_bid","bid_type","bid_ratio","custom_budget","daily_new_limit","valid_time","group_id"},msg_body)
+    local isok ,key =  tools.checkData({"tf_whitelist_status","tf_gender_status","tf_age_tpl_id","tf_region_tpl_id","tf_new_material_status","tf_landing_type","tf_micro_promotion_type","tf_support_status","internal_advertiser_classify","aigc_status","zy_conifg","title_pay_type","is_boost","is_reservation","title_type_id","is_group_record","tf_time_interval","mat_roi","reduce_roi","boost_high_price_end_time","boost_high_price_number","reduce_consume_amount","reduce_bid_amount","is_comment","convert_cnt","material_rule_id","material_rule_number","parent_main_id","valid_timer_like_num","tg_day","ads_operation_status","statistics_platform_id","hide_if_converted","converted_time_duration","cbo_script_time","cbo_script_status","cbo_status","project_type","tf_status","tf_start_time","stat_cost","oce_product_id","oce_product_platform_id","material_platform_id","strategy_config","delivery_mode","price","pack_strategy_status","start_chapter","advertiser_id","wx_miniapp_create_status","ad_act","template_bid","zh_id","roi_goal","ql_bid","infra_status","pay_type","qm_id","ldy_template_site_id","yw_id","parent_platform_id","platform_shared_id","distributor_id","is_delete","ad_convert_type","aweme_id","tg_app_index","butler_id","mini_program_platform_id","landing_page","valid_timer_time","valid_timer_number","channelId","no_bid_budget","max_ad_quantity","tg_link_config","tg_platform_id","app_id","main_name","running_status","ad_quantity","cpa_bid","bid_type","bid_ratio","custom_budget","daily_new_limit","valid_time","group_id"},msg_body)
     if not isok then
         return false,string.format("缺少字段: %s.", key)
     end
     local current_time = os.date("%Y-%m-%d %H:%M:%S")
     msg_body.create_time = current_time
-    local sql = string.format("INSERT INTO `tg_main` (tf_new_material_status,tf_landing_type,tf_micro_promotion_type,tf_support_status,internal_advertiser_classify,aigc_status,zy_conifg,title_pay_type,is_boost,is_reservation,title_type_id,is_group_record,tf_time_interval,mat_roi,reduce_roi,boost_high_price_end_time,boost_high_price_number,reduce_consume_amount,reduce_bid_amount,is_comment,convert_cnt,material_rule_id,material_rule_number,parent_main_id,valid_timer_like_num,tg_day,ads_operation_status,statistics_platform_id,hide_if_converted,converted_time_duration,cbo_script_time,cbo_script_status,cbo_status,project_type,tf_status,tf_start_time,stat_cost,oce_product_id,oce_product_platform_id,material_platform_id,strategy_config,delivery_mode,price,pack_strategy_status,start_chapter,advertiser_id,wx_miniapp_create_status,genre,ad_act,template_bid,zh_id,roi_goal,ql_bid,infra_status,pay_type,qm_id,ldy_template_site_id,yw_id,parent_platform_id,platform_shared_id,distributor_id,is_delete,ad_convert_type,aweme_id,tg_app_index,butler_id,mini_program_platform_id,landing_page,valid_timer_time,valid_timer_number,channelId,no_bid_budget,max_ad_quantity,tg_link_config,tg_platform_id,app_id,main_name,running_status,ad_quantity,cpa_bid,bid_type,bid_ratio,custom_budget,daily_new_limit,valid_time,group_id)  VALUES (%d, '%s','%s',   %d,'%s',%d,'%s',%d,%d, %d,%d, %d,%d,%f,%f,%d,%d,%f,%f,%d,%d,%d,%d,  %d,%d,%d,'%s',%d, '%s','%s','%s',%d,%d,%d,%d,'%s',%d,'%s','%s',%d,'%s','%s',%d,%d,%d,%s,%d,%d,%d,%d,'%s',%d,%d,%d,%d,'%s','%s','%s',%d,%d,'%s',%d,'%s','%s', %d, %d, %d,'%s', %d, '%s', '%s',%d, %d, '%s', %d, '%s', '%s', %d, %d, %d,%d, '%s', %d, %d, '%s', '%s')",
+    local sql = string.format("INSERT INTO `tg_main` (tf_whitelist_status,tf_gender_status,tf_age_tpl_id,tf_region_tpl_id,tf_new_material_status,tf_landing_type,tf_micro_promotion_type,tf_support_status,internal_advertiser_classify,aigc_status,zy_conifg,title_pay_type,is_boost,is_reservation,title_type_id,is_group_record,tf_time_interval,mat_roi,reduce_roi,boost_high_price_end_time,boost_high_price_number,reduce_consume_amount,reduce_bid_amount,is_comment,convert_cnt,material_rule_id,material_rule_number,parent_main_id,valid_timer_like_num,tg_day,ads_operation_status,statistics_platform_id,hide_if_converted,converted_time_duration,cbo_script_time,cbo_script_status,cbo_status,project_type,tf_status,tf_start_time,stat_cost,oce_product_id,oce_product_platform_id,material_platform_id,strategy_config,delivery_mode,price,pack_strategy_status,start_chapter,advertiser_id,wx_miniapp_create_status,genre,ad_act,template_bid,zh_id,roi_goal,ql_bid,infra_status,pay_type,qm_id,ldy_template_site_id,yw_id,parent_platform_id,platform_shared_id,distributor_id,is_delete,ad_convert_type,aweme_id,tg_app_index,butler_id,mini_program_platform_id,landing_page,valid_timer_time,valid_timer_number,channelId,no_bid_budget,max_ad_quantity,tg_link_config,tg_platform_id,app_id,main_name,running_status,ad_quantity,cpa_bid,bid_type,bid_ratio,custom_budget,daily_new_limit,valid_time,group_id)  VALUES (%d,%d,%d,%d,%d, '%s','%s',   %d,'%s',%d,'%s',%d,%d, %d,%d, %d,%d,%f,%f,%d,%d,%f,%f,%d,%d,%d,%d,  %d,%d,%d,'%s',%d, '%s','%s','%s',%d,%d,%d,%d,'%s',%d,'%s','%s',%d,'%s','%s',%d,%d,%d,%s,%d,%d,%d,%d,'%s',%d,%d,%d,%d,'%s','%s','%s',%d,%d,'%s',%d,'%s','%s', %d, %d, %d,'%s', %d, '%s', '%s',%d, %d, '%s', %d, '%s', '%s', %d, %d, %d,%d, '%s', %d, %d, '%s', '%s')",
+    msg_body.tf_whitelist_status,
+    msg_body.tf_gender_status,
+    msg_body.tf_age_tpl_id,
+    msg_body.tf_region_tpl_id,
     msg_body.tf_new_material_status,
     msg_body.tf_landing_type,
     msg_body.tf_micro_promotion_type,
@@ -534,6 +558,39 @@ function pushAddMainMsg(msg_body)
    
 end
 
+function  M.batch_modify_gender_age_region(msg_body)
+    local isok ,key =  tools.checkData({"id_list","tf_gender_status","tf_age_tpl_id","tf_region_tpl_id"},msg_body)
+    if not isok then
+        return false,string.format("缺少字段: %s.", key)
+    end
+    local idString = table.concat(msg_body.id_list, ",")
+    local param = ""
+    if msg_body.tf_gender_status~="" then
+        param = param..string.format(" tf_gender_status = %d ",msg_body.tf_gender_status)
+    end
+    if msg_body.tf_age_tpl_id~="" then
+        if param~="" then
+            param = param..string.format(" , tf_age_tpl_id = %d ",msg_body.tf_age_tpl_id)
+        else
+            param = param..string.format(" tf_age_tpl_id = %d ",msg_body.tf_age_tpl_id)
+        end
+ 
+    end
+    if msg_body.tf_region_tpl_id~="" then
+        if param~="" then
+            param = param..string.format(" , tf_region_tpl_id = %d ",msg_body.tf_region_tpl_id)
+        else
+            param = param..string.format(" tf_region_tpl_id = %d ",msg_body.tf_region_tpl_id)
+        end
+    end
+    if param=="" then
+        return false,"没有修改的内容!"
+    end
+    local sql = string.format("UPDATE  tg_main SET %s WHERE id IN (%s) ",param,idString)
+    mysqldbx.query(sql)
+    return true, {}
+end
+
 local function combine_query_and_params(query, params)
     -- 将 params 中的值替换到 query 中的占位符 ?
     local combined_query = query:gsub("?", function()
@@ -547,7 +604,7 @@ local function combine_query_and_params(query, params)
     return combined_query
 end
 function M.modifyMain(msg_body)
-    local isok ,key =  tools.checkData({"tf_new_material_status","tf_landing_type","tf_micro_promotion_type","tf_support_status","internal_advertiser_classify","aigc_status","zy_conifg","title_pay_type","is_boost","is_reservation","title_type_id","is_group_record","tf_time_interval","mat_roi","reduce_roi","boost_high_price_end_time","boost_high_price_number","reduce_consume_amount","reduce_bid_amount","is_comment","convert_cnt","material_rule_id","material_rule_number","valid_timer_like_num","tg_day","ads_operation_status" ,"statistics_platform_id","hide_if_converted","converted_time_duration","cbo_script_time","cbo_script_status","cbo_status","project_type","tf_status","tf_start_time","stat_cost","oce_product_id","oce_product_platform_id","material_platform_id","strategy_config","delivery_mode","price","pack_strategy_status","start_chapter","advertiser_id","wx_miniapp_create_status","ad_act","template_bid","zh_id","roi_goal","ql_bid","infra_status","pay_type","pay_type","qm_id","ldy_template_site_id","yw_id","parent_platform_id","platform_shared_id","distributor_id","is_delete","ad_convert_type","aweme_id","tg_app_index","butler_id","mini_program_platform_id","landing_page","valid_timer_time","valid_timer_number","channelId","no_bid_budget","max_ad_quantity","tg_link_config","id","tg_platform_id","app_id","main_name","running_status","ad_quantity","cpa_bid","bid_type","bid_ratio","custom_budget","daily_new_limit","valid_time","group_id"},msg_body)
+    local isok ,key =  tools.checkData({"tf_whitelist_status","tf_gender_status","tf_age_tpl_id","tf_region_tpl_id","tf_new_material_status","tf_landing_type","tf_micro_promotion_type","tf_support_status","internal_advertiser_classify","aigc_status","zy_conifg","title_pay_type","is_boost","is_reservation","title_type_id","is_group_record","tf_time_interval","mat_roi","reduce_roi","boost_high_price_end_time","boost_high_price_number","reduce_consume_amount","reduce_bid_amount","is_comment","convert_cnt","material_rule_id","material_rule_number","valid_timer_like_num","tg_day","ads_operation_status" ,"statistics_platform_id","hide_if_converted","converted_time_duration","cbo_script_time","cbo_script_status","cbo_status","project_type","tf_status","tf_start_time","stat_cost","oce_product_id","oce_product_platform_id","material_platform_id","strategy_config","delivery_mode","price","pack_strategy_status","start_chapter","advertiser_id","wx_miniapp_create_status","ad_act","template_bid","zh_id","roi_goal","ql_bid","infra_status","pay_type","pay_type","qm_id","ldy_template_site_id","yw_id","parent_platform_id","platform_shared_id","distributor_id","is_delete","ad_convert_type","aweme_id","tg_app_index","butler_id","mini_program_platform_id","landing_page","valid_timer_time","valid_timer_number","channelId","no_bid_budget","max_ad_quantity","tg_link_config","id","tg_platform_id","app_id","main_name","running_status","ad_quantity","cpa_bid","bid_type","bid_ratio","custom_budget","daily_new_limit","valid_time","group_id"},msg_body)
     if not isok then
         return false,string.format("缺少字段: %s.", key)
     end
@@ -557,6 +614,10 @@ function M.modifyMain(msg_body)
 
     local query = [[
     UPDATE `tg_main` SET
+        tf_whitelist_status=?,
+        tf_gender_status =?,
+        tf_age_tpl_id =?,
+        tf_region_tpl_id =?,
         tf_new_material_status =?,
         tf_landing_type =?,
         tf_micro_promotion_type =?,
@@ -647,6 +708,10 @@ function M.modifyMain(msg_body)
 ]]
 
 local params = {
+    msg_body.tf_whitelist_status,
+    msg_body.tf_gender_status,
+    msg_body.tf_age_tpl_id,
+    msg_body.tf_region_tpl_id,
     msg_body.tf_new_material_status,
     msg_body.tf_landing_type,
     msg_body.tf_micro_promotion_type,

+ 4 - 0
service/backmgr/init.lua

@@ -55,6 +55,8 @@ local data_manager = require "data_manager"
 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 = {
     
@@ -108,6 +110,8 @@ CMD["review_user"] = review_user;
 CMD["whitelist_books"] = whitelist_books;
 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)

+ 8 - 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,12 @@ 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
         date_param = " AND DATE(publish_time) >= DATE(FROM_UNIXTIME(" .. (msg_body.start_publish_time / 1000) .. ")) AND DATE(publish_time) <= DATE(FROM_UNIXTIME(" .. (msg_body.end_publish_time / 1000) .. ")) "
@@ -103,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 = is_copy_param..date_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..is_copy_param..date_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

+ 10 - 3
service/backmgr/video_product.lua

@@ -115,6 +115,7 @@ end
 --product_name 书名
 function M.search_book_data(msg_body)
     local isok ,key =  tools.checkData({
+        "gender",
         "is_album_link",
         "start_create_at",
         "end_create_at",
@@ -148,6 +149,11 @@ function M.search_book_data(msg_body)
             end
         end
 
+        local gender_param = ""
+        if msg_body.gender~="" then
+            gender_param = string.format(" AND gender = %d ",msg_body.gender)
+        end
+
         local create_date_param = ""
         if msg_body.start_create_at~="" and msg_body.end_create_at~="" then
             create_date_param = " AND DATE(create_at) >= DATE(FROM_UNIXTIME(" .. (msg_body.start_create_at / 1000) .. ")) AND DATE(create_at) <= DATE(FROM_UNIXTIME(" .. (msg_body.end_create_at / 1000) .. ")) "
@@ -218,7 +224,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_album_link_param..create_date_param..is_top_param..status_param..date_param..product_param..product_name_param..tg_platform_param..is_auto_param..is_store_param..genre_param..alias_name_param;
+        local param = gender_param..is_album_link_param..create_date_param..is_top_param..status_param..date_param..product_param..product_name_param..tg_platform_param..is_auto_param..is_store_param..genre_param..alias_name_param;
     
 
         local up_down_param = ""
@@ -397,7 +403,7 @@ end
 
 --添加书籍数据
 function M.add_book_data(msg_body)
-    local isok ,key =  tools.checkData({"list_time","free_time","album_link","fee_mode","episode_price","seq_num","status","tg_platform_id","product_id","product_name"
+    local isok ,key =  tools.checkData({"gender","list_time","free_time","album_link","fee_mode","episode_price","seq_num","status","tg_platform_id","product_id","product_name"
     ,"genre","is_store","start_chapter","publish_time"},msg_body)
     if not isok then
         return false,string.format("缺少字段: %s.", key)
@@ -411,7 +417,8 @@ function M.add_book_data(msg_body)
         return false,"书籍已存在!"
     end
 
-    sql = string.format("INSERT INTO `video_product` (list_time,free_time,album_link,fee_mode,episode_price,seq_num,status,book_platform,product_id, product_name, genre,is_store,is_auto,start_chapter,publish_time)  VALUES ('%s','%s','%s',%d,%d,%d,%d,%d,'%s','%s',%d,%d,0,%d,'%s')",
+    sql = string.format("INSERT INTO `video_product` (gender,list_time,free_time,album_link,fee_mode,episode_price,seq_num,status,book_platform,product_id, product_name, genre,is_store,is_auto,start_chapter,publish_time)  VALUES (%d,'%s','%s','%s',%d,%d,%d,%d,%d,'%s','%s',%d,%d,0,%d,'%s')",
+    msg_body.gender,
     msg_body.list_time,
     msg_body.free_time,
     msg_body.album_link,