904118851 8 kuukautta sitten
vanhempi
sitoutus
9e5401f09f

+ 1 - 1
common/dbproxy/tg_main.lua

@@ -174,7 +174,7 @@ end
 
 --配置主体推广链接
 function M.tgLinkConfig(msg_body)
-    local isok ,key =  tools.checkData({"id","is_open","huichuan_id","chongzhi_id","kadian_id","f_chongzhi_id"},msg_body)
+    local isok ,key =  tools.checkData({"id","is_open","huichuan_id","chongzhi_id","kadian_id","f_chongzhi_id","site_id"},msg_body)
     if not isok then
         return false,string.format("缺少字段: %s.", key)
     end

+ 48 - 1
common/dbproxy/tg_platform.lua

@@ -1,4 +1,4 @@
---小程序
+--书籍平台
 local M = {}
 local skynet = require "skynet"
 local mysqldbx = require "mysqldbx"
@@ -230,6 +230,53 @@ function M.modifyFChongZhiTemplate(msg_body)
     mysqldbx.query(sql)
     return true,obj
 end
+
+
+--添加推广小程序平台
+function M.addMiniProgramPlatform(msg_body)
+    local isok ,key =  tools.checkData({"name","id","value"},msg_body)
+    if not isok then
+        return false,string.format("缺少字段: %s.", key)
+    end
+    local sql = string.format("select m_p_platform from `tg_platform` WHERE id = %d ",msg_body.id)
+    local res = mysqldbx.query(sql)
+    local obj = {}
+    if res[1].m_p_platform~=nil then
+        obj = cjson.decode(res[1].m_p_platform)
+    end
+    local id = #obj+1
+    table.insert(obj,id,{id=id,name=msg_body.name,value=msg_body.value})
+    sql = string.format("UPDATE `tg_platform` SET  m_p_platform = '%s'  WHERE id = %d ",
+    cjson.encode(obj),msg_body.id)
+    mysqldbx.query(sql)
+    return true, obj
+end
+
+--修改推广小程序平台
+function M.modifyMiniProgramPlatform(msg_body)
+    local isok ,key =  tools.checkData({"name","id","table_id","value"},msg_body)
+    if not isok then
+        return false,string.format("缺少字段: %s.", key)
+    end
+    local sql = string.format("select m_p_platform from `tg_platform` WHERE id = %d ",msg_body.id)
+    local res = mysqldbx.query(sql)
+    local obj = {}
+    if res[1].m_p_platform~=nil then
+        obj = cjson.decode(res[1].m_p_platform)
+    end
+    for i = 1, #obj, 1 do
+        if obj[i].id == msg_body.table_id then
+            obj[i].name = msg_body.name
+            obj[i].value = msg_body.value
+            break
+        end
+    end
+    sql = string.format("UPDATE `tg_platform` SET  m_p_platform = '%s'  WHERE id = %d ",
+    cjson.encode(obj),msg_body.id)
+    mysqldbx.query(sql)
+    return true,obj
+end
+
 function M.getTotal()
     local sql = "SELECT COUNT(*) AS total FROM tg_platform"
     local res = mysqldbx.query(sql)

+ 2 - 0
service/backmgr/init.lua

@@ -29,6 +29,7 @@ local origin_video_titles = require "origin_video_titles"
 local promotion_audit_suggestions = require "promotion_audit_suggestions"
 local tg_butler = require "tg_butler"
 local tg_mini_program_platform = require "tg_mini_program_platform"
+local task_material_queue_queue = require "task_material_queue_queue"
 local status_200 = 200
 local CMD = {
     
@@ -56,6 +57,7 @@ CMD["origin_video_titles"] = origin_video_titles;
 CMD["promotion_audit_suggestions"] = promotion_audit_suggestions;
 CMD["tg_butler"] = tg_butler;
 CMD["tg_mini_program_platform"] = tg_mini_program_platform;
+CMD["task_material_queue_queue"] = task_material_queue_queue;
 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)

+ 93 - 0
service/backmgr/task_material_queue_queue.lua

@@ -0,0 +1,93 @@
+--计划队列
+local M = {}
+local mysqldbx = require "mysqldbx"
+local tools = require "tools"
+local skynet = require "skynet"
+local cjson = require "cjson"
+
+function M.set_sweight(msg_body)
+    local isok ,key =  tools.checkData({"id_list","sweight"},msg_body)
+    if not isok then
+        return false,string.format("缺少字段: %s.", key)
+    end
+
+    local idString = table.concat(msg_body.id_list, ",")
+    local sql = string.format("SELECT * FROM task_material_queue_queue WHERE id IN (%s)",idString)
+    local isok,res;
+    res = mysqldbx.query(sql)
+
+    for i = 1, #res, 1 do
+        local id =   res[i].id
+        sql = string.format("UPDATE  task_material_queue_queue SET sweight = %d WHERE id =%d ",msg_body.sweight,id)
+        mysqldbx.query(sql)
+    end
+
+    return true,{}
+end
+
+function M.search_task_material_queue_queue(msg_body)
+    local isok ,key =  tools.checkData({"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
+        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 tg_platform_id_param = ""
+    if msg_body.tg_platform_id~="" then
+        tg_platform_id_param =  " AND tg_platform_id = "..msg_body.tg_platform_id
+    end
+
+    local advertiser_id_param = ""
+    if msg_body.advertiser_id~="" then
+        advertiser_id_param =  " AND advertiser_id = "..msg_body.advertiser_id
+    end
+
+    local advertiser_name_param = ""
+    if msg_body.advertiser_name~="" then
+        advertiser_name_param =   string.format(" AND  ( advertiser_name LIKE CONCAT( '%%%s%%'))  ",msg_body.advertiser_name)
+    end
+    
+    local product_id_param = ""
+    if msg_body.product_id~="" then
+        product_id_param =  " AND product_id = "..msg_body.product_id
+    end
+
+    local product_name_param = ""
+    if msg_body.product_name~="" then
+        product_name_param =   string.format(" AND  ( product_name LIKE CONCAT( '%%%s%%')) ",msg_body.product_name)
+    end
+
+
+    local material_id_param = ""
+    if msg_body.material_id~="" then
+        material_id_param =   " AND material_id = "..msg_body.material_id
+    end
+
+
+    local status_param = ""
+    if msg_body.status~="" then
+        status_param = " AND status = "..msg_body.status
+    end
+
+    local create_date_param = ""
+    if msg_body.start_create_time~="" and msg_body.end_create_time~="" then
+        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 = 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..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
+   
+    local list = mysqldbx.query(sql)
+
+    sql = "SELECT   COUNT(*) AS total  FROM task_material_queue_queue WHERE 1=1  "..param
+
+    local total = mysqldbx.query(sql)
+
+    return true,list,total[1].total
+end
+
+return M