|
@@ -229,16 +229,24 @@ class get_ad_layout_local(BaseHandler):
|
|
|
'local_layout_info': result_})
|
|
|
|
|
|
|
|
|
-# TODO:wechat_info,human_info 这两张表有空时需要进行对应改进
|
|
|
-# TODO:ad_human_info ,ad_wecaht_info 两个的行为需要与create_ad_plan 进行交互
|
|
|
+class get_scan_status(BaseHandler):
|
|
|
+ # 获取到扫码状态
|
|
|
+ def get(self):
|
|
|
+ sql_session = db.DBSession()
|
|
|
+ user_id = self.get_argument("user_id", None)
|
|
|
+ status = sql_tools.get_scan_action_status(user_id, sql_session)
|
|
|
+ if user_id is None:
|
|
|
+ self.write({'status': {'msg': 'url parameter error', "RetCode": 400}})
|
|
|
+ return
|
|
|
+ self.write({'status': {'msg': 'success', "RetCode": 200},
|
|
|
+ 'scan_action_status': status})
|
|
|
+
|
|
|
|
|
|
+# TODO:wechat_info,human_info 这两张表有空时需要进行对应改进
|
|
|
class ad_human_info(BaseHandler):
|
|
|
# TODO:设置一下update---table,如果失败了sql_session需要关闭
|
|
|
-
|
|
|
@staticmethod
|
|
|
def refresh_wechat_cookies(tornado_web, user_id):
|
|
|
- # TODO:添加互动接口,添加状态字段,打开selenium就变换
|
|
|
-
|
|
|
# 1.返回二维码链接
|
|
|
# ----1.查看cookie是否可用
|
|
|
sql_session = db.DBSession()
|
|
@@ -254,6 +262,7 @@ class ad_human_info(BaseHandler):
|
|
|
if not log_ad.wechat_cookies_check_alive(cookie_db):
|
|
|
# cookie 不能使用
|
|
|
wechat_code = log_ad.log_in()
|
|
|
+ sql_tools.update_user_scan_action(user_id, sql_session)
|
|
|
tornado_web.write({'status': {'msg': 'success', "RetCode": 200},
|
|
|
'wechat_code': wechat_code})
|
|
|
logging.info('cookie can not use')
|
|
@@ -265,6 +274,7 @@ class ad_human_info(BaseHandler):
|
|
|
else:
|
|
|
# cookie 不能使用
|
|
|
wechat_code = log_ad.log_in()
|
|
|
+ sql_tools.update_user_scan_action(user_id, sql_session)
|
|
|
tornado_web.write({'status': {'msg': 'success', "RetCode": 200},
|
|
|
'wechat_code': wechat_code})
|
|
|
return log_ad, cookie_canuse
|
|
@@ -563,6 +573,7 @@ def make_app():
|
|
|
("/get_ad_plan_local", get_ad_plan_local),
|
|
|
("/delete_layout_local", delete_ad_layout),
|
|
|
("/delete_ad_plan_local", delete_ad_plan),
|
|
|
+ ("/get_scan_status", get_scan_status),
|
|
|
# ("/create_ad_layout_remote", create_ad_layout_remote),
|
|
|
("/ad_human_info", ad_human_info),
|
|
|
("/ad_wechat_info", ad_wechat_info),
|