Quellcode durchsuchen

依据定向自动创建广告计划-广告组-广告创意 服务

liyuyi@c-top.com.cn vor 4 Jahren
Ursprung
Commit
2656c1a300
2 geänderte Dateien mit 91 neuen und 0 gelöschten Zeilen
  1. 64 0
      ai_target_combine_handler.py
  2. 27 0
      ai_target_server.py

+ 64 - 0
ai_target_combine_handler.py

@@ -0,0 +1,64 @@
+import tornado
+import json
+
+
+class AiTargetCombine(tornado.web.RequestHandler):
+    def post(self):
+        res = {'code': 0,
+               'message': "SUCCESS"}
+
+        data = self.request.body
+        data = str(data, 'utf8')
+        data = json.loads(data, encoding='utf8')
+        # logger.info("call back of add group, the raw data from request is %s" % data)
+
+        try:
+            pass
+        except Exception:
+            pass
+
+        # 返回接口结果
+        self.write(json.dumps(res))
+        self.flush()
+
+
+class GetTargetAndAssemblyParameters(object):
+    def __init__(self):
+        pass
+
+    def add_campaign(self):
+        """
+        新增广告计划,如果存在则跳过
+        """
+        pass
+
+    def get_signature_and_target(self):
+        """
+        从 ctop_ai_kuaishou_signature_recommended_target_combine 表中读取素材和对应的定向
+        """
+        pass
+
+    def get_advertiser_strategy_info(self):
+        """
+        从 ctop_ai_kuaishou_advertiser_strategy 读取账户的基本配置信息
+        """
+        pass
+
+    def write_intelligence_strategy_table(self):
+        """
+        拼接好的组创意的参数写入到 ctop_ai_kuaishou_intelligence_strategy 中的 ai_strategy_request_content
+        """
+        pass
+
+    def get_target_intersection(self):
+        """
+        两个表中读取的定向取交集,还是子集?
+        """
+        pass
+
+    def assembly_group_and_creative_params(self):
+        """
+        拼接参数,请求创建接口
+        """
+        pass
+

+ 27 - 0
ai_target_server.py

@@ -0,0 +1,27 @@
+import tornado.ioloop
+import tornado.log
+import tornado.options
+import tornado.web
+import platform
+from ai_target_combine_handler import AiTargetCombine
+
+
+def create_application():
+    web_application = tornado.web.Application([
+        # (r"/ai_callback_add_group", AiCallBackAddGroup),
+        # (r"/ai_callback_add_creative", AiCallBackAddCreative),
+        (r"/ai_target_combine", AiTargetCombine),
+    ])
+    return web_application
+
+
+if __name__ == "__main__":
+    application = create_application()
+    http_server = tornado.httpserver.HTTPServer(application)
+    http_server.bind(31012, None)
+    if platform.system() == 'Windows':
+        http_server.start()
+    else:
+        http_server.start(num_processes=5)
+    tornado.ioloop.IOLoop.instance().start()
+