├── src
├── configs
│ ├── __init__.py
│ ├── circulate.conf
│ ├── ocr.conf
│ ├── weight.conf
│ ├── screen.conf
│ └── config.py
├── models
│ ├── __init__.py
│ ├── result.py
│ ├── question.py
│ ├── timer.py
│ └── answer.py
├── units
│ ├── __init__.py
│ ├── sqlite.py
│ ├── ocr.py
│ ├── method.py
│ └── adb.py
├── controllers
│ ├── __init__.py
│ ├── reviewController.py
│ ├── controller.py
│ ├── aiSwitchController.py
│ └── answerController.py
├── daos
│ ├── reviewDao.py
│ ├── questionDao.py
│ └── answerDao.py
├── services
│ ├── reviewService.py
│ └── answerService.py
└── spiders
│ ├── ucSpider.py
│ ├── sogouSpider.py
│ └── kuakeSpider.py
├── favicon.ico
├── images
├── ai_analysis.png
├── answer_view.png
├── answer-introduce.png
└── customize_answer.png
├── .gitignore
├── allinone
├── sogou
│ └── weball
│ │ └── assets
│ │ ├── images
│ │ └── process_bg2-84fc1b78.png
│ │ └── js
│ │ └── app-assistant-v5-https-cheat-sheet-ef2e8d53.js
├── uc
│ ├── uc.js
│ ├── static
│ │ └── js
│ │ │ ├── manifest.60.js
│ │ │ ├── chunk.3.60.js
│ │ │ ├── chunk.4.60.js
│ │ │ ├── chunk.2.60.js
│ │ │ └── chunk.0.60.js
│ └── uc.css
├── analysis
│ ├── index.html
│ └── analysis.js
├── index.js
├── baidu
│ ├── baidu.css
│ └── baidu.js
└── index.html
├── start.py
├── gui
├── loop.py
└── main.py
├── server.py
├── index.html
├── README.md
└── servers
├── sogou_proxy.py
├── web_server.py
└── baidu_websocket.py
/src/configs/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/models/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/units/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/controllers/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SmileSmith/autoAnswer/HEAD/favicon.ico
--------------------------------------------------------------------------------
/images/ai_analysis.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SmileSmith/autoAnswer/HEAD/images/ai_analysis.png
--------------------------------------------------------------------------------
/images/answer_view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SmileSmith/autoAnswer/HEAD/images/answer_view.png
--------------------------------------------------------------------------------
/images/answer-introduce.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SmileSmith/autoAnswer/HEAD/images/answer-introduce.png
--------------------------------------------------------------------------------
/images/customize_answer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SmileSmith/autoAnswer/HEAD/images/customize_answer.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Python #
2 | *.bak
3 | *.pyc
4 |
5 |
6 | # IDE #
7 | .vscode
8 |
9 | # Screenshot #
10 | screenshot*.png
11 |
12 | # DB #
13 | *.db
--------------------------------------------------------------------------------
/src/daos/reviewDao.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | """
4 | #Author: smilesmith
5 | #Date: 2018-02-05
6 | #Desc: 回顾分析数据层
7 | """
--------------------------------------------------------------------------------
/allinone/sogou/weball/assets/images/process_bg2-84fc1b78.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SmileSmith/autoAnswer/HEAD/allinone/sogou/weball/assets/images/process_bg2-84fc1b78.png
--------------------------------------------------------------------------------
/src/configs/circulate.conf:
--------------------------------------------------------------------------------
1 | [circulate]
2 | # 匹配尝试prop前3个最大的答案
3 | try_times = 3
4 |
5 | # OCR字符匹配阈值
6 | ocr_threshold = 0.5
7 |
8 | # 等待答案时间
9 | wait_time = 5.5
10 |
--------------------------------------------------------------------------------
/src/configs/ocr.conf:
--------------------------------------------------------------------------------
1 | [tesseract]
2 | # windows
3 | # tesseract 安装路径
4 | tesseract_cmd = C:\\Program Files (x86)\\Tesseract-OCR\\tesseract
5 |
6 | # 语言包目录和参数
7 | tessdata_dir = --tessdata-dir "C:\\Program Files (x86)\\Tesseract-OCR\\tessdata" --psm 6
--------------------------------------------------------------------------------
/src/configs/weight.conf:
--------------------------------------------------------------------------------
1 | [weight]
2 | # 对百度AI的信任度权重
3 | # 由于单个答案和百分比答案的逻辑是累加,建议baidu的两个数值之和不超过1
4 | baidu = 0.5
5 | baidu_percentage = 0.3
6 |
7 | # 对UC-AI的信任度权重
8 | # 考虑到UC在个性题上的表现,总体上更信任UC的个性题答案
9 | uc = 0.8
10 | uc_individual = 2
11 |
12 | # 对SOGOU-AI的信任度权重
13 | sogou = 0.8
--------------------------------------------------------------------------------
/start.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | """程序主进程"""
4 |
5 | from gui import main
6 | from src.units import adb, sqlite
7 |
8 | def run():
9 | """主函数"""
10 | adb.init()
11 | sqlite.init_table()
12 | main.init_gui()
13 |
14 |
15 | if __name__ == '__main__':
16 | run()
--------------------------------------------------------------------------------
/src/controllers/reviewController.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | """
4 | #Author: smilesmith
5 | #Date: 2018-02-05
6 | #Desc: 回顾分析控制器
7 | """
8 | from src.services import reviewService
9 |
10 | def get_review_datas():
11 | """获取所有结果"""
12 | return reviewService.get_review_datas()
--------------------------------------------------------------------------------
/src/controllers/controller.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | """
4 | #Author: smilesmith
5 | #Date: 2018-01-26
6 | #Desc: 控制器
7 | """
8 | from .answerController import handle_answer as handle_answer
9 | from .answerController import save_correct_result as save_correct_result
10 | from .aiSwitchController import toggle_ai as toggle_ai
11 | from .reviewController import get_review_datas as get_review_datas
12 |
--------------------------------------------------------------------------------
/src/configs/screen.conf:
--------------------------------------------------------------------------------
1 | [region]
2 | # 题目与选项区域
3 | # 三星S8 NOTE8
4 | question_region = 50, 320, 1000, 500
5 | choices_region = 75, 650, 1000, 1200
6 |
7 | # 普通 1080P手机
8 | # question_region = 50, 350, 1000, 560
9 | # choices_region = 75, 535, 1000, 1200
10 |
11 | # 题目和选项一起的区域
12 | combine_region = 50, 350, 1000, 1200
13 |
14 | [tap]
15 | # 三星S8 NOTE8 2220*1080 或 普通 1920*1080
16 | start = 540, 555
17 | gap = 200
18 |
19 | # 普通 2k手机
20 | # start = 540, 535
21 | # gap = 155
22 |
--------------------------------------------------------------------------------
/src/services/reviewService.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | """
4 | #Author: smilesmith
5 | #Date: 2018-02-05
6 | #Desc: 回顾分析服务
7 | """
8 |
9 | from src.daos import answerDao
10 | from src.units.method import log_info
11 |
12 | def get_review_datas():
13 | """获取所有结果"""
14 | ai_results = answerDao.get_all_result()
15 |
16 | correct_results = answerDao.get_all_correct_result()
17 |
18 | log_info(">>> Get Review Datas Success...")
19 |
20 | return {'ai_results': ai_results, 'correct_results': correct_results}
21 |
--------------------------------------------------------------------------------
/src/models/result.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | """
4 | #Author: smilesmith
5 | #Date: 2018-01-25
6 | #Desc: 答案类
7 | """
8 | class Result(object):
9 | """AI结果"""
10 | def __init__(self, index, text, prop, question_id):
11 | self.index = index
12 | self.text = text
13 | self.prop = prop
14 | self.question_id = question_id
15 | self.ai_type = ""
16 | self.type = "single"
17 |
18 | def set_type(self, ai_type, result_type="single"):
19 | """设置类型"""
20 | self.ai_type = ai_type
21 | self.type = result_type
22 |
--------------------------------------------------------------------------------
/src/controllers/aiSwitchController.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | """
4 | #Author: smilesmith
5 | #Date: 2018-01-26
6 | #Desc: AI控制器
7 | """
8 | from src.units.method import log_warn
9 |
10 | AUTO_AI = False
11 |
12 |
13 | def toggle_ai(datas):
14 | switcher = str(datas["switch"])
15 | """切换自动AI答题"""
16 | global AUTO_AI
17 | result = False
18 | if switcher == "ON":
19 | result = True
20 | if result != AUTO_AI:
21 | AUTO_AI = result
22 | log_warn("> AI Auto: %s", switcher)
23 |
24 |
25 | def is_auto():
26 | """返回是否自动AI答题"""
27 | return AUTO_AI
28 |
--------------------------------------------------------------------------------
/src/models/question.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | """
4 | #Author: smilesmith
5 | #Date: 2018-01-26
6 | #Desc: 问题类
7 | """
8 |
9 | class Question(object):
10 | """问题类"""
11 | def __init__(self, text, question_round, question_phase):
12 | self.id = 0
13 | self.text = text
14 | self.round = question_round
15 | self.phase = question_phase
16 | self.individual = 0
17 |
18 | def set_individual(self, flag):
19 | """设置是否是个性题"""
20 | self.individual = flag
21 |
22 | def set_id(self, question_id):
23 | """设置ID"""
24 | self.id = question_id
25 |
--------------------------------------------------------------------------------
/src/controllers/answerController.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | """
4 | #Author: smilesmith
5 | #Date: 2018-01-26
6 | #Desc: 回答控制器
7 | """
8 | from src.services import answerService
9 | from .aiSwitchController import is_auto
10 |
11 | def handle_answer(apipath, datas):
12 | """处理答题请求"""
13 | answer_type = apipath.split("-").pop()
14 |
15 | if answer_type == "human":
16 | answerService.answer_by_human(datas, answer_type)
17 | elif is_auto():
18 | answerService.answer_by_ai(datas, answer_type)
19 |
20 |
21 | def save_correct_result(apipath, datas):
22 | """保存正确结果"""
23 | answer_type = apipath.split("-").pop()
24 |
25 | if answer_type == "uc":
26 | answerService.save_correct_result(datas)
27 |
--------------------------------------------------------------------------------
/gui/loop.py:
--------------------------------------------------------------------------------
1 | from src.services import answerService
2 | from src.spiders import sogouSpider, ucSpider
3 | import time
4 |
5 | MAX_ROUND = 12
6 |
7 | def loop_sogou():
8 | now_round = 0
9 | while now_round < 12:
10 | result = sogouSpider.start_sogou()
11 | print(result)
12 | result_round = int(result['question']['round'])
13 | if now_round != result_round:
14 | answerService.answer_by_ai(result, 'sogou')
15 | now_round = result_round
16 |
17 |
18 |
19 | def loop_uc():
20 | now_round = 0
21 | while now_round < 12:
22 | result = ucSpider.start_uc()
23 | print(result)
24 | result_round = int(result['question']['round'])
25 | if now_round != result_round:
26 | answerService.answer_by_ai(result, 'uc')
27 | now_round = result_round
28 |
--------------------------------------------------------------------------------
/allinone/uc/uc.js:
--------------------------------------------------------------------------------
1 | window.sm = window.sm || {};
2 | $.ajax({
3 | type: 'get',
4 | async: false,
5 | url:'./uc/answer/index?activity=million#/index',
6 | success: (data)=> {
7 | // insert sm.COMMON_PARAMS
8 | var params_code = data.match(/(sm\.COMMON_PARAMS[\s\S]*?)<\/script>/)[1];
9 | try {
10 | eval(params_code);
11 | // change api to nginx proxy_pass
12 | sm.COMMON_PARAMS.API = {
13 | current: './uc/answer/curr?format=json&activity=million',
14 | review: './uc/answer/detail?format=json',
15 | index: './uc/answer/index?format=json'
16 | };
17 | sm.COMMON_PARAMS.banner = "//sm01.alicdn.com/L1/272/6837/static/wap/img/dream/million.png";
18 | sm.COMMON_PARAMS.activityName = "million";
19 | } catch(e) {
20 | console.log(e);
21 | }
22 | }
23 | });
--------------------------------------------------------------------------------
/src/daos/questionDao.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | """
4 | #Author: smilesmith
5 | #Date: 2018-01-31
6 | #Desc: 数据库访问接口
7 | """
8 |
9 | from src.units import sqlite
10 |
11 | def get_question_id(question_round, question_phase):
12 | """获取题目ID"""
13 | question_ids = sqlite.execute_sql(
14 | 'select id from question where round=? and phase=?', (question_round, question_phase))
15 | if not question_ids:
16 | return None
17 | return question_ids[0][0]
18 |
19 | def save_question(question):
20 | """保存答题结果"""
21 | sqlite.execute_sql('insert into question (\
22 | id, question_text, individual, round, phase) \
23 | values (null, ?, ?, ?, ?)',
24 | (question.text, question.individual, question.round, question.phase))
25 |
26 | question_id = get_question_id(question.round, question.phase)
27 | return question_id
28 |
--------------------------------------------------------------------------------
/src/models/timer.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | """
4 | #Author: smilesmith
5 | #Date: 2018-01-25
6 | #Desc: 计时器类
7 | """
8 | import time
9 |
10 | class Timer(object):
11 | """定时器,定时执行指定的函数
12 | """
13 |
14 | def __init__(self, start, interval=0):
15 | """
16 | @start, int, 延迟执行的秒数
17 | @interval, int, 每次执行的间隔秒数
18 | """
19 | self.start = start
20 | self.interval = interval
21 |
22 | def run_interval(self, func, *args, **kwargs):
23 | """运行定时器
24 | :param func: callable, 要执行的函数
25 | """
26 | time.sleep(self.start)
27 | while True:
28 | func(*args, **kwargs)
29 | time.sleep(self.interval)
30 |
31 | def run_timeout(self, func, *args, **kwargs):
32 | """运行计时器,只执行一次
33 | :param func: callable, 要执行的函数
34 | """
35 | time.sleep(self.start)
36 | while True:
37 | func(*args, **kwargs)
38 |
--------------------------------------------------------------------------------
/src/daos/answerDao.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | """
4 | #Author: smilesmith
5 | #Date: 2018-01-31
6 | #Desc: 数据库访问接口
7 | """
8 |
9 | from src.units import sqlite
10 |
11 |
12 | def save_result(result):
13 | """保存答题结果"""
14 | sqlite.execute_sql('insert into ai_result (\
15 | id, ai_type, result_index, result_text, result_type, result_prop, question_id) \
16 | values (null, ?, ?, ?, ?, ?, ?)',
17 | (result.ai_type, result.index, result.text, result.type, result.prop, result.question_id))
18 |
19 | def get_all_result():
20 | """获取所有正确结果"""
21 | ai_results = sqlite.execute_sql('select * from ai_result')
22 | return ai_results
23 |
24 | def save_correct_result(result):
25 | """保存正确的答案"""
26 | sqlite.execute_sql('insert into correct_result (\
27 | id, correct_text, question_id) \
28 | values (null, ?, ?)',
29 | (result.text, result.question_id))
30 |
31 | def get_all_correct_result():
32 | """获取所有正确结果"""
33 | correct_results = sqlite.execute_sql('select * from correct_result')
34 | return correct_results
35 |
--------------------------------------------------------------------------------
/server.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | """程序主进程"""
4 |
5 | from multiprocessing import Process
6 | import webbrowser
7 | from servers.web_server import run_server
8 | from servers.sogou_proxy import run_sogou_proxy
9 | from servers.baidu_websocket import run_baidu_websocket
10 | from src.units import adb, sqlite
11 | from src.units.method import check_hosts
12 |
13 | PORT = 8080
14 | PROXY_PORT = 8888
15 |
16 | # HOST = 'dev.secr.baidu.com'
17 |
18 | HOST = 'localhost'
19 |
20 | def run():
21 | """主函数"""
22 | #if check_hosts(HOST):
23 | try:
24 | adb.init()
25 | sqlite.init_table()
26 | baidu_process = Process(target=run_baidu_websocket)
27 | baidu_process.start()
28 | sub_process = Process(target=run_sogou_proxy)
29 | sub_process.start()
30 | webbrowser.open("http://%s:%s/index.html" % (HOST, PORT))
31 | run_server(port=PORT)
32 | except KeyboardInterrupt:
33 | baidu_process.terminate()
34 | sub_process.terminate()
35 | print("\n\
36 | ------------------------------------------------------------\n\
37 | 已终止所有进程,谢谢~ \n\
38 | ------------------------------------------------------------")
39 | exit()
40 |
41 |
42 | if __name__ == '__main__':
43 | run()
44 |
--------------------------------------------------------------------------------
/src/models/answer.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | """
4 | #Author: smilesmith
5 | #Date: 2018-01-25
6 | #Desc: 综合答案类
7 | """
8 | from src.units.adb import tap_android_all, start_answer_all
9 | from .result import Result
10 |
11 | class MyAnswer(object):
12 | """综合考虑各AI的答案"""
13 | def __init__(self, question):
14 | self.question = question
15 | self.options = {'baidu': [], 'sogou': [], 'uc': [],}
16 | self.results = []
17 | self.corrects = []
18 |
19 | def start_answer_all(self):
20 | self.results_queue = start_answer_all()
21 |
22 | def set_option(self, option, ai_type):
23 | """设置选项"""
24 | self.options[ai_type] = option
25 |
26 | def add_result(self, result):
27 | """添加答案"""
28 | if self.results_queue.full():
29 | self.results_queue.get(False)
30 | self.results.append(result)
31 | if self.results_queue.empty():
32 | self.results_queue.put(self.results)
33 |
34 | def answer_single(self):
35 | """非个性题,选取最佳答案"""
36 | tap_android_all(self.corrects)
37 |
38 | def try_answer_by_ai(self):
39 | """尝试AI答题"""
40 | print("> try to answer by ai")
41 | if self.question.is_individual:
42 | pass # TODO:根据屏幕的结果选取corrects中结果
43 | else:
44 | self.answer_single()
45 |
--------------------------------------------------------------------------------
/allinone/analysis/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | 助手分析
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Answer Help
7 |
56 |
57 |
58 |
59 |
60 |
Welcome to Answer
61 |
All In One Page
62 |
AI Analysis
63 |
64 | 1、开启Py的Sever接受数据,Sever中调用adb命令点击手机
65 |
66 |
67 | 2、数据手机分析开发中...
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/allinone/index.js:
--------------------------------------------------------------------------------
1 | $(function() {
2 | function replyResult(event) {
3 | console.log(new Date().getTime());
4 | const result = this.value * 1;
5 | const buttonLabels = [' A ', ' B ', ' C '];
6 | const answerData = {
7 | question: {
8 | text: '自己答题,来不及敲题目...',
9 | round: 0
10 | },
11 | result: result
12 | };
13 | this.textContent = '...'
14 | $.ajax({
15 | type:'POST',
16 | url:"reply-answer-human",
17 | headers: {
18 | "Content-Type": "application/json;charset=utf-8",
19 | "dataType": "json"
20 | },
21 | data: JSON.stringify(answerData),
22 | success: (response) => {
23 | console.log("reply success ...");
24 | }
25 | });
26 | setTimeout(() => {
27 | this.textContent = buttonLabels[result];
28 | }, 500);
29 | }
30 |
31 | $("#result-zero").click(replyResult);
32 | $("#result-one").click(replyResult);
33 | $("#result-two").click(replyResult);
34 |
35 |
36 | function postAISwitcher(switcher, callback) {
37 | $.ajax({
38 | type:'POST',
39 | url:"toggle-ai",
40 | headers: {
41 | "Content-Type": "application/json;charset=utf-8",
42 | "dataType": "json"
43 | },
44 | data: JSON.stringify({ switch: switcher }),
45 | success: callback
46 | });
47 | }
48 |
49 | function toggleAI(event) {
50 | const $span = $(this).find("span");
51 | let switcherText = $span.text() === "OFF" ? "ON" : "OFF";
52 | const callback = function(response,status,xhr) {
53 | if (switcherText === "ON") {
54 | $(this).addClass("on");
55 | } else {
56 | $(this).removeClass("on");
57 | }
58 | $span.text(switcherText);
59 | };
60 | postAISwitcher(switcherText, callback.bind(this));
61 | }
62 |
63 | $("#ai-result-toggle").click(toggleAI);
64 |
65 | postAISwitcher("OFF")
66 |
67 | });
68 |
--------------------------------------------------------------------------------
/src/configs/config.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | """
4 | #Author: smilesmith
5 | #Date: 2018-01-25
6 | #Desc: 配置信息
7 | """
8 | import configparser
9 |
10 | _SCREENT_CONFIG = configparser.ConfigParser()
11 | _SCREENT_CONFIG.read('./src/configs/screen.conf', encoding='utf-8')
12 |
13 | QUESTION_REGION = _SCREENT_CONFIG.get("region", "question_region").replace(' ', '').split(',')
14 | QUESTION_REGION = list(map(int, QUESTION_REGION))
15 |
16 | CHOICES_REGION = _SCREENT_CONFIG.get("region", "choices_region").replace(' ', '').split(',')
17 | CHOICES_REGION = list(map(int, CHOICES_REGION))
18 |
19 | COMBINE_REGION = _SCREENT_CONFIG.get("region", "combine_region").replace(' ', '').split(',')
20 | COMBINE_REGION = list(map(int, COMBINE_REGION))
21 |
22 | TAP_START = _SCREENT_CONFIG.get("tap", "start")
23 | TAP_GAP = _SCREENT_CONFIG.get("tap", "gap")
24 |
25 |
26 | _OCR_CONFIG = configparser.ConfigParser()
27 | _OCR_CONFIG.read('./src/configs/ocr.conf', encoding='utf-8')
28 |
29 | TESSERACT_CMD = _OCR_CONFIG.get("tesseract", "tesseract_cmd")
30 | TESSDATA_DIR = _OCR_CONFIG.get("tesseract", "tessdata_dir")
31 |
32 | _WEIGHT_CONFIG = configparser.ConfigParser()
33 | _WEIGHT_CONFIG.read('./src/configs/weight.conf', encoding='utf-8')
34 |
35 | BAIDU_WEIGHT = _WEIGHT_CONFIG.getfloat("weight", "baidu")
36 | BAIDU_P_WEIGHT = _WEIGHT_CONFIG.getfloat("weight", "baidu_percentage")
37 | SOGOU_WEIGHT = _WEIGHT_CONFIG.getfloat("weight", "sogou")
38 | UC_WEIGHT = _WEIGHT_CONFIG.getfloat("weight", "uc")
39 | UC_I_WEIGHT = _WEIGHT_CONFIG.getfloat("weight", "uc_individual")
40 |
41 |
42 | _CIRCULATE_CONFIG = configparser.ConfigParser()
43 | _CIRCULATE_CONFIG.read('./src/configs/circulate.conf', encoding='utf-8')
44 |
45 | TRY_TIMES = int(_CIRCULATE_CONFIG.get("circulate", "try_times"))
46 | OCR_THRESHOLD = float(_CIRCULATE_CONFIG.get("circulate", "ocr_threshold"))
47 | WAIT_TIME = float(_CIRCULATE_CONFIG.get("circulate", "wait_time"))
--------------------------------------------------------------------------------
/allinone/uc/static/js/manifest.60.js:
--------------------------------------------------------------------------------
1 | !(function(e) {
2 | function n(r) {
3 | if (t[r]) return t[r].exports;
4 | var o = (t[r] = { i: r, l: !1, exports: {} });
5 | return e[r].call(o.exports, o, o.exports, n), (o.l = !0), o.exports;
6 | }
7 | var r = window.webpackJsonp;
8 | window.webpackJsonp = function(t, c, a) {
9 | for (var i, u, f, s = 0, l = []; s < t.length; s++)
10 | (u = t[s]), o[u] && l.push(o[u][0]), (o[u] = 0);
11 | for (i in c) Object.prototype.hasOwnProperty.call(c, i) && (e[i] = c[i]);
12 | for (r && r(t, c, a); l.length; ) l.shift()();
13 | if (a) for (s = 0; s < a.length; s++) f = n((n.s = a[s]));
14 | return f;
15 | };
16 | var t = {},
17 | o = { 8: 0 };
18 | (n.e = function(e) {
19 | function r() {
20 | (i.onerror = i.onload = null), clearTimeout(u);
21 | var n = o[e];
22 | 0 !== n &&
23 | (n && n[1](new Error("Loading chunk " + e + " failed.")),
24 | (o[e] = void 0));
25 | }
26 | var t = o[e];
27 | if (0 === t)
28 | return new Promise(function(e) {
29 | e();
30 | });
31 | if (t) return t[2];
32 | var c = new Promise(function(n, r) {
33 | t = o[e] = [n, r];
34 | });
35 | t[2] = c;
36 | var a = document.getElementsByTagName("head")[0],
37 | i = document.createElement("script");
38 | (i.type = "text/javascript"),
39 | (i.charset = "utf-8"),
40 | (i.async = !0),
41 | (i.timeout = 12e4),
42 | n.nc && i.setAttribute("nonce", n.nc),
43 | (i.src = n.p + "static/js/chunk." + e + ".60.js");
44 | var u = setTimeout(r, 12e4);
45 | return (i.onerror = i.onload = r), a.appendChild(i), c;
46 | }),
47 | (n.m = e),
48 | (n.c = t),
49 | (n.d = function(e, r, t) {
50 | n.o(e, r) ||
51 | Object.defineProperty(e, r, {
52 | configurable: !1,
53 | enumerable: !0,
54 | get: t
55 | });
56 | }),
57 | (n.n = function(e) {
58 | var r =
59 | e && e.__esModule
60 | ? function() {
61 | return e.default;
62 | }
63 | : function() {
64 | return e;
65 | };
66 | return n.d(r, "a", r), r;
67 | }),
68 | (n.o = function(e, n) {
69 | return Object.prototype.hasOwnProperty.call(e, n);
70 | }),
71 | (n.p = "./uc/"),
72 | (n.oe = function(e) {
73 | throw (console.error(e), e);
74 | });
75 | })([]);
76 | //# sourceMappingURL=manifest.60.js.map
77 |
--------------------------------------------------------------------------------
/src/spiders/ucSpider.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | """
4 | #Author: smilesmith
5 | #Date: 2018-02-01
6 | #Desc: UC爬虫
7 | """
8 | import json
9 | import time
10 | from urllib.request import Request, urlopen
11 |
12 | ANDROID_USER_AGENT = "Mozilla/5.0 (Linux; Android 7.1.1; Google Pixel - \
13 | 7.1.0 - API 25 - 1080x1920 Build/NMF26Q; wv) AppleWebKit/537.36 (KHTML, like Gecko) \
14 | Version/4.0 Chrome/52.0.2743.100 Mobile Safari/537.36 SogouSearch Android1.0 version3.0 AppVersion/5802"
15 |
16 | HEADERS = {
17 | 'Host': 'answer.sm.cn',
18 | 'Connection': 'keep-alive',
19 | 'Cache-Control': 'max-age=0',
20 | 'Accept': 'text/html, */*; q=0.01',
21 | 'User-Agent': ANDROID_USER_AGENT,
22 | 'Referer': 'http://answer.sm.cn/',
23 | 'Accept-Encoding': 'gzip, deflate',
24 | 'Accept-Language': 'zh-CN,zh;q=0.9'
25 | }
26 |
27 |
28 | def mock_request(path, **my_headers):
29 | """反向代理"""
30 | headers = HEADERS.copy()
31 | for key in my_headers:
32 | headers[key] = my_headers[key]
33 |
34 | req = Request(path, headers=headers)
35 | res = urlopen(req)
36 | res_str = str(res.read(), 'UTF-8')
37 | return res_str
38 |
39 |
40 | def format_uc_data(res_str):
41 | """整理uc助手的答案"""
42 | data = json.loads(res_str)['data']
43 |
44 | if not data['options']:
45 | return None
46 |
47 | options = []
48 | results = []
49 | total_confidence = 0
50 |
51 | for option in data['options']:
52 | options.append(option['title'])
53 | total_confidence += float(option['score'])
54 |
55 | results = map(lambda item: {
56 | 'text': item['title'],
57 | 'prop': round(float(int(item['score']) / total_confidence), 2)
58 | }, data['options'])
59 |
60 |
61 | return {
62 | 'question': {
63 | 'round': data['round'],
64 | 'text': data['title']
65 | },
66 | 'result': data['correct'],
67 | 'options': options,
68 | 'results': results
69 | }
70 |
71 |
72 | def get_uc_result():
73 | """获取UC助手答案"""
74 | res_str = mock_request('http://answer.sm.cn/answer/curr?format=json&activity=million',
75 | Referer="http://answer.sm.cn/answer/index?activity=million",
76 | Host="answer.sm.cn")
77 | res_data = format_uc_data(res_str)
78 | return res_data
79 |
80 |
81 | def start_uc():
82 | """开始抓取UC的答案数据"""
83 | uc_result = None
84 | while uc_result is None:
85 | result_data = get_uc_result()
86 | if result_data:
87 | uc_result = result_data
88 | return result_data
89 | time.sleep(0.2)
90 |
91 | if __name__ == '__main__':
92 | print(start_uc())
93 |
94 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # autoAnswer
2 |
3 | 和简单搜索、汪仔助手、UC答题助手一起答题。支持AI自动答题,支持个性化题。
4 |
5 | ##### 注:近期各个答题助手都升级了安全策略,如有问题请随时反馈 ~ ~**
6 |
7 | AI自动答题的详细流程说明请打开[(见图)](images/answer-introduce.png)
8 |
9 | AI自动答题的结果预览[(见图)](images/ai_analysis.png)
10 |
11 | 答题界面见预览:
12 |
13 | 
14 |
15 |
16 | ## Before
17 |
18 | #### 1. 确保正常的python3环境,并安装pytesseract
19 |
20 | `pip install pytesseract`
21 |
22 | #### 2. 安装 ADB,确保执行adb device能出现您的设备
23 |
24 | 下载地址:https://adb.clockworkmod.com/ ,并配置环境变量
25 |
26 | #### 3. 安装 谷歌 Tesseract
27 |
28 | Windows下链接: 推荐使用安装版,在安装时选择增加中文简体语言包
29 |
30 | 安装版:https://digi.bib.uni-mannheim.de/tesseract/tesseract-ocr-setup-3.05.01.exe
31 |
32 | 其他系统: https://github.com/tesseract-ocr/tesseract/wiki
33 |
34 | ## Start
35 |
36 | 完成所有 Before
37 |
38 | PS:注意根据需要,修改screen.conf中的分辨率,默认1080P(包括全面屏1080P)。
39 |
40 | + 1、连接手机adb(可选,如果需要AI答题)
41 |
42 | + 2、开启Py的Sever做静态托管和反向代理。
43 |
44 | `py server.py`
45 |
46 | + 3、点击All in One Page进入答题页面
47 |
48 | `1) 可点击切换 AI自动答题`
49 |
50 | `2) 可选择自己答题`
51 |
52 | + 4、点击AI Analysis进入助手分析页面
53 |
54 | ## Config
55 |
56 | 在src.config目录下修改对应参数
57 |
58 | #### circulate:
59 |
60 | `try_times` - 考虑到OCR错误的情况,匹配尝试最优选的前几个答案
61 |
62 | `ocr_threshold` - OCR识别与AI返回的匹配数/总字符数>ocr_threshold时,认为是正确答
63 |
64 | `wait_time` - 百度返回题目,到点击屏幕的时间,根据网络情况配置`
65 |
66 | #### screen:
67 |
68 | `choices_region` - 选项OCR区域、|换行长度`
69 |
70 | `star` - 点击答案的纵轴开始点
71 |
72 | `gap` - 每个选项的间距
73 |
74 | #### weight:
75 |
76 | 对AI助手答案 信任的权重值
77 |
78 | #### ocr:
79 |
80 | tesseract安装路径和语言包路径
81 |
82 | ## Update Log
83 |
84 | 20180213: 升级百度websocket代理,去除hosts映射的校验修改逻辑
85 |
86 | 20180211: 修复因百度、UC、搜狗升级安全策略导致api失效的问题
87 |
88 | 20180209: 初始化GUI界面
89 |
90 | 20180206: 用Echarts统计各个答题助手的表现
91 |
92 | 20180131: 用sqlit3保存AI答题的结果
93 |
94 | 20180127: http接口改为标准JSON-String通讯。删除基本上没用的单独AI助手
95 |
96 | 20180126: 增加控制器层,抽离逻辑代码。添加adb未连接的提示,添加截图分析选项的功能
97 |
98 | 20180125: 重构Python代码,为后续功能挖坑(预留能力)
99 |
100 | 20180122: sogou的api更新,样式更新
101 |
102 | 20180120: python服务器支持反向代理,去除nginx
103 |
104 | ## Roadmap
105 |
106 | + ~~1、完成AI自动答题的逻辑,将缓存的答案用mapReduce的形式转为最佳答案。~~ 20180129 完成 √
107 |
108 | + ~~2、用sqlite3存储结果,用图表展示各个AI助手的表现。~~ 20180206 完成 √
109 |
110 | + 3、用爬虫直接抓取AI答题的结果
111 |
112 | + 4、添加百度搜索的结果用放在界面旁展示
113 |
114 | ## Thanks
115 |
116 | 截图和OCR代码参考[https://github.com/Skyexu/TopSup](https://github.com/Skyexu/TopSup)
117 |
118 | ## Q&A
119 |
120 | - 为什么要做这个?
121 |
122 | 西瓜视频目前不支持分屏应用,得用两个手机,一个看答案一个答题。这个项目可以让这些助手在电脑上运行。
123 |
124 | - 为什么要采用hack客户端的方式?
125 |
126 | 直接调用Api获取数据要先分析整个鉴权认证过程(模拟cookies,sessionId,和一些不知道的XXId)。客户端模拟的方式去开发,能够快速实现需求:抓到需要的数据。
127 |
128 | 后续会采用爬虫方式,直接抓取API结果。
129 |
130 | - AI如何自动化处理西瓜视频的个性化题?
131 |
132 | 目前的做法是收到答案后,子进程并行截图OCR识别答案,同时主进程不断接收答案。在OCR完成后,计算出优选答案,点击不同的设备。
133 |
--------------------------------------------------------------------------------
/src/units/sqlite.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | """
4 | #Author: smilesmith
5 | #Date: 2018-01-31
6 | #Desc: Sqlite3
7 | """
8 |
9 | import sqlite3
10 |
11 | CONNECT = sqlite3.connect('sqlite.db', check_same_thread=False)
12 |
13 |
14 | def execute_sql(sql, *args):
15 | """执行语句"""
16 | try:
17 | cursor = CONNECT.cursor()
18 | cursor.execute(str(sql), (*args))
19 | execute_result = cursor.fetchall()
20 | cursor.close()
21 | CONNECT.commit()
22 | return execute_result
23 | except sqlite3.Error as sqlit_error:
24 | print(sqlit_error)
25 |
26 |
27 | def close_connection():
28 | """关闭连接"""
29 | CONNECT.close()
30 |
31 |
32 | def init_table():
33 | """初始化表结构"""
34 | execute_sql('create table if not exists question (\
35 | id INTEGER PRIMARY KEY AUTOINCREMENT, \
36 | question_text varchar(400), \
37 | individual int(1),\
38 | round int(2), \
39 | phase varchar(20))')
40 |
41 | # 答题结果表
42 | execute_sql('create table if not exists ai_result (\
43 | id INTEGER PRIMARY KEY AUTOINCREMENT, \
44 | ai_type varchar(20), \
45 | result_index int(1), \
46 | result_text varchar(20), \
47 | result_type varchar(20), \
48 | result_prop decimal(3,2), \
49 | question_id int(8))')
50 |
51 | # 正确结果表
52 | execute_sql('create table if not exists correct_result (\
53 | id INTEGER PRIMARY KEY AUTOINCREMENT, \
54 | correct_index int(1), \
55 | correct_text varchar(20), \
56 | question_id int(8))')
57 |
58 |
59 | if __name__ == '__main__':
60 | # 新建表
61 | execute_sql('create table if not exists ai_result_test (\
62 | id INTEGER PRIMARY KEY AUTOINCREMENT, \
63 | ai_type varchar(20), \
64 | result int(1), \
65 | result_text varchar(20), \
66 | result_type varchar(20), \
67 | round int(2), \
68 | phase varchar(8))')
69 |
70 | # 增
71 | execute_sql('insert into ai_result_test (\
72 | id, ai_type, result, result_text, result_type, round, phase) \
73 | values (null, ?, ?, ?, ?, ?, ?)',
74 | ('human', 0, '答案', 'single', 0, '20180131'))
75 |
76 | print('add data...')
77 | # 查
78 | print(execute_sql('select * from ai_result_test where result_type =?', ('single',)))
79 |
80 | # 改
81 | execute_sql('update ai_result_test set result_type =? where result_type =?',
82 | ('percentage', 'single'))
83 |
84 | print('update data...')
85 | print(execute_sql('select * from ai_result_test where result_type =?', ('percentage',)))
86 |
87 | # 删
88 | execute_sql('delete from ai_result_test where result_type =?',
89 | ('percentage',))
90 | print('delete data...')
91 | print(execute_sql('select * from ai_result_test'))
92 |
93 | close_connection()
94 |
--------------------------------------------------------------------------------
/src/spiders/sogouSpider.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | """
4 | #Author: smilesmith
5 | #Date: 2018-02-01
6 | #Desc: SOGOU爬虫
7 | """
8 | import json
9 | import time
10 | import base64
11 | from urllib.request import Request, urlopen
12 |
13 | ANDROID_USER_AGENT = "Mozilla/5.0 (Linux; Android 7.1.1; Google Pixel - \
14 | 7.1.0 - API 25 - 1080x1920 Build/NMF26Q; wv) AppleWebKit/537.36 (KHTML, like Gecko) \
15 | Version/4.0 Chrome/52.0.2743.100 Mobile Safari/537.36 SogouSearch Android1.0 version3.0 AppVersion/5802"
16 |
17 | HEADERS = {
18 | 'Host': 'answer.sm.cn',
19 | 'Connection': 'keep-alive',
20 | 'Cache-Control': 'max-age=0',
21 | 'Accept': 'text/html, */*; q=0.01',
22 | 'User-Agent': ANDROID_USER_AGENT,
23 | 'Referer': 'http://answer.sm.cn/',
24 | 'Accept-Encoding': 'gzip, deflate',
25 | 'Accept-Language': 'zh-CN,zh;q=0.9'
26 | }
27 |
28 |
29 | def mock_request(path, **my_headers):
30 | """反向代理"""
31 | headers = HEADERS.copy()
32 | for key in my_headers:
33 | headers[key] = my_headers[key]
34 |
35 | req = Request(path, headers=headers)
36 | res = urlopen(req)
37 | res_str = str(res.read(), 'UTF-8')
38 | return res_str
39 |
40 |
41 | def format_sogou_data(args):
42 | """整理SOUGOU助手的答案"""
43 | result = args['result']
44 | result = json.loads(base64.b64decode(result).decode('utf-8'))
45 |
46 | data = json.loads(result[-1])
47 |
48 | if not data['choices']:
49 | return None
50 |
51 | # 答案
52 | choices = data['choices'].split(":-1|")
53 | result = 0
54 | for index, choice in enumerate(choices):
55 | if data['result'] == choice:
56 | result = index
57 |
58 | # 题目
59 | question_round, question_text = data['title'].split(".")
60 | question = {
61 | 'round': question_round,
62 | 'text': question_text,
63 | }
64 |
65 | # 选项
66 | options = data['answers']
67 |
68 | return {
69 | 'question': question,
70 | 'options': options,
71 | 'result': result
72 | }
73 |
74 |
75 | def get_sogou_result():
76 | """获取SOGOU助手答案"""
77 | res_str = mock_request('https://wdpush.sogoucdn.com/api/anspush?key=xigua&wdcallback=format_sogou_data',
78 | Referer="https://assistant.sogoucdn.com/v5/cheat-sheet?channel=bwyx",
79 | Host="wdpush.sogoucdn.com",
80 | Cookie="APP-SGS-ID=7d5f1515979422199%257C948922")
81 | res_str = res_str.replace('true', 'True')
82 | return eval(res_str)
83 |
84 |
85 | def start_sogou():
86 | """开始抓取SOGOU的答案数据"""
87 | sogou_result = None
88 | while sogou_result is None:
89 | result_data = get_sogou_result()
90 | if result_data:
91 | sogou_result = result_data
92 | break
93 | time.sleep(0.2)
94 | return sogou_result
95 |
96 | if __name__ == '__main__':
97 | print(start_sogou())
98 |
99 |
--------------------------------------------------------------------------------
/allinone/uc/uc.css:
--------------------------------------------------------------------------------
1 | * {
2 | -webkit-tap-highlight-color: transparent;
3 | }
4 | *,
5 | :after,
6 | :before {
7 | box-sizing: border-box;
8 | }
9 | article,
10 | aside,
11 | blockquote,
12 | body,
13 | button,
14 | dd,
15 | details,
16 | div,
17 | dl,
18 | dt,
19 | fieldset,
20 | figcaption,
21 | figure,
22 | footer,
23 | form,
24 | h1,
25 | h2,
26 | h3,
27 | h4,
28 | h5,
29 | h6,
30 | header,
31 | hgroup,
32 | hr,
33 | input,
34 | legend,
35 | li,
36 | menu,
37 | nav,
38 | ol,
39 | p,
40 | section,
41 | td,
42 | textarea,
43 | th,
44 | ul {
45 | margin: 0;
46 | padding: 0;
47 | }
48 | button,
49 | input,
50 | select,
51 | textarea {
52 | font-family: inherit;
53 | font-size: inherit;
54 | line-height: inherit;
55 | }
56 | a {
57 | text-decoration: none;
58 | color: inherit;
59 | }
60 | ol,
61 | ul {
62 | list-style: none;
63 | }
64 | input::-ms-clear,
65 | input::-ms-reveal {
66 | display: none;
67 | }
68 | body,
69 | html {
70 | margin: 0;
71 | position: relative;
72 | font-family: Helvetica, Arial, sans-serif;
73 | font-size: 14px;
74 | -webkit-font-smoothing: antialiased;
75 | -moz-osx-font-smoothing: grayscale;
76 | text-align: center;
77 | color: #2c3e50;
78 | }
79 | [v-cloak] {
80 | display: none;
81 | opacity: 0;
82 | }
83 | #app {
84 | -webkit-font-smoothing: antialiased;
85 | -moz-osx-font-smoothing: grayscale;
86 | text-align: center;
87 | color: #fff;
88 | position: relative;
89 | opacity: 1;
90 | transition: opacity 0.1s;
91 | margin: 0 auto;
92 | }
93 | .fade-enter-active,
94 | .fade-leave-active {
95 | transition: opacity 0.5s;
96 | }
97 | .fade-enter,
98 | .fade-leave-active {
99 | opacity: 0;
100 | }
101 | .banner[data-v-a4cfecb4] {
102 | display: block;
103 | padding-top: 27px;
104 | padding-bottom: 20%;
105 | background-repeat: no-repeat;
106 | background-position: bottom;
107 | background-size: 100% 71px;
108 | position: relative;
109 | z-index: 99;
110 | width: 100%;
111 | }
112 | .banner a[data-v-a4cfecb4] {
113 | position: absolute;
114 | display: block;
115 | width: 32px;
116 | height: 32px;
117 | border-radius: 40px;
118 | left: 20px;
119 | top: 20px;
120 | background: hsla(0, 0%, 100%, 0.1)
121 | url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAcCAYAAABoMT8aAAAAAXNSR0IArs4c6QAAAWBJREFUOBGVlL1KA0EURpP49wYWiooECUgqGysrK20kT2BnaWsj2FqmsAgIKggKAcHCwqewFVFBjPiDgqCIiOJ6BubCcLnMdQc+ZufuOV8WdkmlUnIVRbFOXskZmSqlI7RJurr/KsCokq3UjNd+QZQ7hvzMrJF9gihvG/ITs6Yn14B2DfmB2bQn9wHtG/I9M/exg3xgyHfM8q8NoJ90DfmWWd177AGgI0O+YTbpyYNAx4Z8zWzCk4eATgz5ktlYVg43gXYM+YLZqCvHgndV8MnZ/2VpBz5VBeF4SGrCZHfAYXJO9NpjUM3KchNwhFzpBs4dYdwdeJyEd65X25UFwKyT8MnqtSmMu2M2yKNu4LzhygIAN8mLUbImjLsjz5Dw56nXqisLgDlL3nQD5xVh3B14jnyokl/Oy64sAPA8CZ94un44tIRxd+BF8pU2cN1zxRRAaJHvpKRcQShDXiK9mIU/9o7VxEwlQnsAAAAASUVORK5CYII=)
122 | no-repeat 50%;
123 | background-size: 6px 12px;
124 | }
125 | .fade-enter-active[data-v-016509fc],
126 | .fade-leave-active[data-v-016509fc] {
127 | transition: opacity 0.4s;
128 | }
129 | .fade-enter[data-v-016509fc],
130 | .fade-leave-active[data-v-016509fc] {
131 | opacity: 0;
132 | }
133 | .progress[data-v-c318817c] {
134 | position: fixed;
135 | top: 0;
136 | left: 0;
137 | right: 0;
138 | height: 2px;
139 | width: 0;
140 | transition: width 0.2s, opacity 0.4s;
141 | -webkit-transition: width 0.2s, opacity 0.4s;
142 | opacity: 1;
143 | background-color: #efc14e;
144 | z-index: 999999;
145 | }
146 | /*# sourceMappingURL=dream.60.css.map*/
147 |
--------------------------------------------------------------------------------
/src/spiders/kuakeSpider.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | """
4 | #Author: smilesmith
5 | #Date: 2019-12-14
6 | #Desc: 夸克答题助手爬虫
7 | """
8 | import json
9 | import time
10 | import base64
11 | import gzip
12 | from io import BytesIO
13 | from urllib.request import Request, urlopen
14 |
15 | ANDROID_USER_AGENT = "Mozilla/5.0 (Linux; U; Android 9; zh-CN; MI CC 9 Build/PKQ1.181121.001) \
16 | AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 Quark/3.7.0.123 Mobile Safari/537.36"
17 |
18 | HEADERS = {
19 | 'Host': 'answer-quark.sm.cn',
20 | 'Connection': 'keep-alive',
21 | 'Cache-Control': 'max-age=0',
22 | 'Accept': 'application/json',
23 | 'X-Requested-With': 'XMLHttpRequest',
24 | 'User-Agent': ANDROID_USER_AGENT,
25 | 'Referer': 'https://answer-quark.sm.cn/answer/?uc_param_str=dnntnwvepffrgibijbprsvdsdicheiniut&source=mini',
26 | 'Accept-Encoding': 'gzip, deflate',
27 | 'Accept-Language': 'zh-CN,en-US;q=0.8'
28 | }
29 |
30 | def ungzip(data):
31 | """Gzip解压"""
32 | try:
33 | data = gzip.GzipFile(fileobj = BytesIO(data))
34 | except:
35 | pass
36 | return data
37 |
38 |
39 | def mock_request(path, **my_headers):
40 | """反向代理"""
41 | headers = HEADERS.copy()
42 | for key in my_headers:
43 | headers[key] = my_headers[key]
44 |
45 | req = Request(path, headers=headers)
46 | res = ungzip(urlopen(req).read())
47 | res_str = str(res.read(), 'UTF-8')
48 | return res_str
49 |
50 |
51 | def format_kuake_data(res_str):
52 | """整理夸克助手的答案"""
53 | data = json.loads(res_str)['data']
54 | print(data)
55 | if not data['options']:
56 | return None
57 |
58 | # 选项 & 答案
59 | options = data['options']
60 | result = 0
61 | for index, option in enumerate(options):
62 | if data['correct'] == option:
63 | result = index
64 |
65 | # 题目
66 | question = {
67 | 'round': data['round'],
68 | 'text': data['title'],
69 | }
70 |
71 | return {
72 | 'question': question,
73 | 'options': options,
74 | 'result': result
75 | }
76 |
77 |
78 | def get_kuake_result():
79 | """获取SOGOU助手答案"""
80 | t = str(int(time.time() * 1000))
81 | res_str = mock_request('https://answer-quark.sm.cn/answer/curr?format=json&activity=thyx&_t=' + t,
82 | Referer="https://answer-quark.sm.cn/answer/?uc_param_str=dnntnwvepffrgibijbprsvdsdicheiniut&source=mini",
83 | Host="answer-quark.sm.cn",
84 | Cookie="__wpkreporterwid_=11273d6c-a5fb-41e3-86b9-9d8273baec26; cna=nXzQFb7BxF8CAXBhPe8b4qmy; isg=BA4OyY293yDuKGsEnhnMPmO6VObQj9KJyulxmDhWH5Y8m9T1oB_emBdZ1oF9xcqh; sm_diu=61862a13ee7d838f41aa08d7cd09686f%7C27322012586%7C1351f3ec4ef823a637%7C1575694517; sm_sid=93c2b094834ffae5957b8df0ff395c7e; sm_uuid=131a4188c54ddf74202c7990c96914a2%7C27322012586%7C%7C1576414976")
85 | res_str = res_str.replace('true', 'True')
86 | return res_str
87 |
88 |
89 | def start_kuake():
90 | """开始抓取SOGOU的答案数据"""
91 | kuake_result = None
92 | while kuake_result is None:
93 | result_data = get_kuake_result()
94 | if result_data:
95 | kuake_result = result_data
96 | print(format_kuake_data(kuake_result));
97 | break
98 | time.sleep(0.2)
99 | return kuake_result
100 |
101 | if __name__ == '__main__':
102 | print(start_kuake())
103 |
104 |
--------------------------------------------------------------------------------
/allinone/uc/static/js/chunk.3.60.js:
--------------------------------------------------------------------------------
1 | webpackJsonp([3], {
2 | 468: function(e, r, n) {
3 | function A(e) {
4 | n(556), n(558);
5 | }
6 | var t = n(49)(n(560), n(561), A, "data-v-49678e9c", null);
7 | e.exports = t.exports;
8 | },
9 | 556: function(e, r, n) {
10 | var A = n(557);
11 | "string" == typeof A && (A = [[e.i, A, ""]]),
12 | A.locals && (e.exports = A.locals);
13 | n(462)("ed2c2a4e", A, !0);
14 | },
15 | 557: function(e, r, n) {
16 | (r = e.exports = n(461)(!0)),
17 | r.push([
18 | e.i,
19 | "#app{height:100%;background:#321579}",
20 | "",
21 | {
22 | version: 3,
23 | sources: ["/Users/gml/mywork/gitlab/dream/src/views/Error.vue"],
24 | names: [],
25 | mappings: "AACA,KACI,YAAa,AACb,kBAA6B,CAChC",
26 | file: "Error.vue",
27 | sourcesContent: [
28 | "\n#app {\n height: 100%;\n background: rgb(50, 21, 121);\n}\n"
29 | ],
30 | sourceRoot: ""
31 | }
32 | ]);
33 | },
34 | 558: function(e, r, n) {
35 | var A = n(559);
36 | "string" == typeof A && (A = [[e.i, A, ""]]),
37 | A.locals && (e.exports = A.locals);
38 | n(462)("5d1b441c", A, !0);
39 | },
40 | 559: function(e, r, n) {
41 | (r = e.exports = n(461)(!0)),
42 | r.push([
43 | e.i,
44 | '.novel-error[data-v-49678e9c]{display:block;position:absolute;top:50%;width:100%;-webkit-transform:translateY(-50%);transform:translateY(-50%);z-index:100}.novel-error[data-v-49678e9c]:before{content:"";display:block;width:46px;height:58px;background-size:46px 58px;margin:0 auto 10px}.novel-error .error-text[data-v-49678e9c]{font-size:14px;color:#fff;text-align:center}.novel-error .error-btn[data-v-49678e9c]{display:block;width:88px;height:34px;line-height:34px;border:1px solid #fff;border-radius:4px;color:#fff;text-align:center;margin:20px auto}',
45 | "",
46 | {
47 | version: 3,
48 | sources: ["/Users/gml/mywork/gitlab/dream/src/views/Error.vue"],
49 | names: [],
50 | mappings:
51 | "AACA,8BACE,cAAe,AACf,kBAAmB,AACnB,QAAS,AACT,WAAY,AACZ,mCAAsC,AACtC,2BAA8B,AAC9B,WAAa,CACd,AACD,qCACI,WAAY,AACZ,cAAe,AACf,WAAY,AACZ,YAAa,AACb,0BAA2B,AAC3B,kBAAoB,CACvB,AACD,0CACI,eAAgB,AAChB,WAAY,AACZ,iBAAmB,CACtB,AACD,yCACI,cAAe,AACf,WAAY,AACZ,YAAa,AACb,iBAAkB,AAClB,sBAAuB,AACvB,kBAAmB,AACnB,WAAY,AACZ,kBAAmB,AACnB,gBAAkB,CACrB",
52 | file: "Error.vue",
53 | sourcesContent: [
54 | "\n.novel-error[data-v-49678e9c] {\n display: block;\n position: absolute;\n top: 50%;\n width: 100%;\n -webkit-transform: translate(0, -50%);\n transform: translate(0, -50%);\n z-index: 100;\n}\n.novel-error[data-v-49678e9c]::before {\n content: '';\n display: block;\n width: 46px;\n height: 58px;\n background-size: 46px 58px;\n margin: 0 auto 10px;\n}\n.novel-error .error-text[data-v-49678e9c] {\n font-size: 14px;\n color: #fff;\n text-align: center;\n}\n.novel-error .error-btn[data-v-49678e9c] {\n display: block;\n width: 88px;\n height: 34px;\n line-height: 34px;\n border: 1px solid #fff;\n border-radius: 4px;\n color: #fff;\n text-align: center;\n margin: 20px auto;\n}\n"
55 | ],
56 | sourceRoot: ""
57 | }
58 | ]);
59 | },
60 | 560: function(e, r, n) {
61 | "use strict";
62 | Object.defineProperty(r, "__esModule", { value: !0 }),
63 | (r.default = {
64 | name: "error",
65 | created: function() {
66 | location.href = "http://m.sm.cn/s?q=答题助手";
67 | }
68 | });
69 | },
70 | 561: function(e, r) {
71 | e.exports = {
72 | render: function() {
73 | var e = this,
74 | r = e.$createElement;
75 | return (e._self._c || r)("div", { staticClass: "novel-error" });
76 | },
77 | staticRenderFns: []
78 | };
79 | }
80 | });
81 | //# sourceMappingURL=chunk.3.60.js.map
82 |
--------------------------------------------------------------------------------
/src/units/ocr.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # @Author : Skye
4 | # @Time : 2018/1/9 19:34
5 | # @desc :
6 |
7 | import time
8 | import pytesseract
9 | from colorama import Fore
10 | from src.configs import config
11 | from .method import log_info, log_warn
12 |
13 | # 二值化算法
14 |
15 |
16 | def binarizing(img, threshold):
17 | pixdata = img.load()
18 | w, h = img.size
19 | for y in range(h):
20 | for x in range(w):
21 | if pixdata[x, y] < threshold:
22 | pixdata[x, y] = 0
23 | else:
24 | pixdata[x, y] = 255
25 | return img
26 |
27 |
28 | # 去除干扰线算法
29 | def depoint(img): # input: gray image
30 | pixdata = img.load()
31 | w, h = img.size
32 | for y in range(1, h - 1):
33 | for x in range(1, w - 1):
34 | count = 0
35 | if pixdata[x, y - 1] > 245:
36 | count = count + 1
37 | if pixdata[x, y + 1] > 245:
38 | count = count + 1
39 | if pixdata[x - 1, y] > 245:
40 | count = count + 1
41 | if pixdata[x + 1, y] > 245:
42 | count = count + 1
43 | if count > 2:
44 | pixdata[x, y] = 255
45 | return img
46 |
47 |
48 | def ocr_img_tess_choices(image):
49 | """只运行一次 Tesseract"""
50 |
51 | choices_region = config.CHOICES_REGION
52 |
53 | # 切割选项区域,左上角坐标和右下角坐标,自行测试分辨率
54 | region_im = image.crop(
55 | (choices_region[0], choices_region[1], choices_region[2], choices_region[3]))
56 |
57 | # 转化为灰度图
58 | region_im = region_im.convert('L')
59 |
60 | # 把图片变成二值图像
61 | region_im = binarizing(region_im, 190)
62 |
63 | # region_im.show()
64 |
65 | # win环境
66 | # tesseract 路径
67 |
68 | pytesseract.pytesseract.tesseract_cmd = config.TESSERACT_CMD
69 |
70 | # 语言包目录和参数
71 | tessdata_dir_config = config.TESSDATA_DIR
72 |
73 | # lang 指定中文简体
74 | region_text = pytesseract.image_to_string(
75 | region_im, lang='chi_sim', config=tessdata_dir_config)
76 |
77 | region_text = region_text.replace("_", "一").split("\n")
78 | texts = [x for x in region_text if x != '']
79 |
80 | choices = []
81 |
82 | if len(texts) > 2:
83 | choices = texts
84 | else:
85 | print(Fore.RED + '截图区域设置错误,请重新设置' + Fore.RESET)
86 |
87 | return choices
88 |
89 |
90 | def ocr_img_tess(image):
91 | """只运行一次 Tesseract"""
92 |
93 | combine_region = config.COMBINE_REGION
94 |
95 | # 切割题目+选项区域,左上角坐标和右下角坐标,自行测试分辨率
96 | region_im = image.crop(
97 | (combine_region[0], combine_region[1], combine_region[2], combine_region[3]))
98 |
99 | # 转化为灰度图
100 | region_im = region_im.convert('L')
101 |
102 | # 把图片变成二值图像
103 | region_im = binarizing(region_im, 190)
104 |
105 | # region_im.show()
106 |
107 | # win环境
108 | # tesseract 路径
109 |
110 | pytesseract.pytesseract.tesseract_cmd = config.TESSERACT_CMD
111 |
112 | # 语言包目录和参数
113 | tessdata_dir_config = config.TESSDATA_DIR
114 |
115 | # lang 指定中文简体
116 | region_text = pytesseract.image_to_string(
117 | region_im, lang='chi_sim', config=tessdata_dir_config)
118 |
119 | region_text = region_text.replace("_", "一").split("\n")
120 | texts = [x for x in region_text if x != '']
121 | # print(texts)
122 | question = ""
123 | choices = []
124 |
125 | if len(texts) > 2:
126 | question = texts[0]
127 | choices = texts[1:]
128 | else:
129 | print(Fore.RED + '截图区域设置错误,请重新设置' + Fore.RESET)
130 |
131 | if not choices:
132 | return "", []
133 |
134 | # 意外出现问题为两行或三行
135 | if choices[0].endswith('?'):
136 | question += choices[0]
137 | choices.pop(0)
138 | elif choices[1].endswith('?'):
139 | question += choices[0]
140 | question += choices[1]
141 | choices.pop(0)
142 | choices.pop(0)
143 |
144 | return question, choices
145 |
--------------------------------------------------------------------------------
/servers/sogou_proxy.py:
--------------------------------------------------------------------------------
1 | import socket
2 | from http.server import BaseHTTPRequestHandler, HTTPServer
3 | from urllib.parse import urlparse
4 | from urllib.request import Request, urlopen
5 | from urllib.error import HTTPError, URLError
6 | from http import HTTPStatus
7 |
8 | ANDROID_USER_AGENT = "Mozilla/5.0 (Linux; Android 7.1.1; Google Pixel - \
9 | 7.1.0 - API 25 - 1080x1920 Build/NMF26Q; wv) AppleWebKit/537.36 (KHTML, like Gecko) \
10 | Version/4.0 Chrome/52.0.2743.100 Mobile Safari/537.36 SogouSearch Android1.0 version3.0 AppVersion/5802"
11 |
12 | PORT = 8888
13 |
14 | socket.setdefaulttimeout(3.0)
15 |
16 | class MySogouPushHandler(BaseHTTPRequestHandler):
17 | """处理各类请求的控制器"""
18 |
19 | def do_GET(self):
20 | """处理GET请求"""
21 | querypath = urlparse(self.path)
22 | apipath = querypath.path
23 | if apipath.startswith("/allinone/sogou/api/anspush"):
24 | self.proxy_pass("/allinone/sogou/api/anspush", "https://wdpush.sogoucdn.com/api/anspush",
25 | Referer="https://assistant.sogoucdn.com/v5/cheat-sheet?channel=bwyx",
26 | Host="wdpush.sogoucdn.com",
27 | Cookie="APP-SGS-ID=7d5f1515979422199%257C948922")
28 |
29 | def proxy_pass(self, orgin_path, target_host_path, **my_headers):
30 | """反向代理"""
31 | headers = self.headers
32 | for key in my_headers:
33 | if headers.get(key):
34 | headers.replace_header(key, my_headers[key])
35 | else:
36 | headers.add_header(key, my_headers[key])
37 | headers.replace_header("User-Agent", ANDROID_USER_AGENT)
38 | req = Request(self.path.replace(
39 | orgin_path, target_host_path), headers=headers)
40 | data = None
41 | try:
42 | res = urlopen(req, timeout=3)
43 | except HTTPError as http_error:
44 | print("%s - %s" % (http_error, target_host_path))
45 | except URLError as url_error:
46 | print("%s - %s" % (url_error, target_host_path))
47 | else:
48 | data = res.readline()
49 | finally:
50 | self.send_response_only(200)
51 | self.end_headers()
52 | try:
53 | if not data:
54 | self.wfile.write(b"console.log('Remote Server Error')")
55 | else:
56 | self.wfile.write(data)
57 | except ConnectionAbortedError:
58 | pass
59 |
60 | def handle_one_request(self):
61 | """Handle a single HTTP request.
62 |
63 | Overloaded: Do Not Log Timeout
64 |
65 | You normally don't need to override this method; see the class
66 | __doc__ string for information on how to handle specific HTTP
67 | commands such as GET and POST.
68 |
69 | """
70 | try:
71 | self.raw_requestline = self.rfile.readline(65537)
72 | if len(self.raw_requestline) > 65536:
73 | self.requestline = ''
74 | self.request_version = ''
75 | self.command = ''
76 | self.send_error(HTTPStatus.REQUEST_URI_TOO_LONG)
77 | return
78 | if not self.raw_requestline:
79 | self.close_connection = True
80 | return
81 | if not self.parse_request():
82 | # An error code has been sent, just exit
83 | return
84 | mname = 'do_' + self.command
85 | if not hasattr(self, mname):
86 | self.send_error(
87 | HTTPStatus.NOT_IMPLEMENTED,
88 | "Unsupported method (%r)" % self.command)
89 | return
90 | method = getattr(self, mname)
91 | method()
92 | self.wfile.flush() #actually send the response if not already done.
93 | except socket.timeout:
94 | #a read or a write timed out. Discard this connection
95 | #self.log_error("Request timed out: %r", e)
96 | self.close_connection = True
97 | return
98 |
99 |
100 | def run_sogou_proxy(port=PORT):
101 | """启动本地服务器"""
102 | server_address = ('', port)
103 | httpd = HTTPServer(server_address, MySogouPushHandler)
104 | print('> Running Server On Port: ', port)
105 | print('> Press Ctrl + C to exit...\n')
106 | httpd.serve_forever()
107 |
--------------------------------------------------------------------------------
/allinone/baidu/baidu.css:
--------------------------------------------------------------------------------
1 |
2 | .dt {
3 | font-size: 12px;
4 | text-align: left;
5 | background: url('//gss0.baidu.com/9rkZbzqaKgQUohGko9WTAnF6hhy/mms-res/secr/home/img/bg.95f8e339.png') no-repeat;
6 | background-size: contain;
7 | }
8 | .dtpadding {
9 | padding: 0 20px;
10 | }
11 | .title {
12 | font-size: 14px;
13 | padding-bottom: 30px;
14 | }
15 | .smalltitle {
16 | height: 47px;
17 | line-height: 47px;
18 | color: #333;
19 | font-size: 25px;
20 | text-align: center;
21 | margin-left: -.1rem;
22 | }
23 | .answerBox {
24 | margin-bottom: 16px;
25 | }
26 | .answerBox .answerText {
27 | background: #fff;
28 | border:1px solid #f1f1f1;
29 | box-shadow: 0 6px 14px 2px rgba(0,0,0,0.05);
30 | position: relative;
31 | margin-bottom: 13px;
32 | padding: 12px 80px 12px 17px;
33 | }
34 | .answerBox .answerText.active {
35 | color: #FE0060;
36 | border-left: solid 2px #ff2376;
37 | }
38 | .answerBox .answerText span{
39 | position: absolute;
40 | right: 17px;
41 | }
42 | .query {
43 | font-size: 18px;
44 | color: #000;
45 | line-height:29px;
46 | display: -webkit-box;
47 | -webkit-box-orient: vertical;
48 | -webkit-line-clamp: 3;
49 | overflow: hidden;
50 | }
51 | .answerText {
52 | overflow: hidden;
53 | opacity: 0.8;
54 | font-size: 18px;
55 | color: #999999;
56 | overflow: hidden;
57 | text-overflow:ellipsis;
58 | white-space: nowrap;
59 | position: relative;
60 | }
61 | .rightBox {
62 | font-size: 13px;
63 | opacity:0.8;
64 | color: #999;
65 | }
66 | .rightBox p {
67 | padding-bottom: 10px;
68 | }
69 | .rightBox_tip {
70 | color:#555555;
71 | }
72 | .other {
73 | line-height: 1.5;
74 | }
75 | .querytitle {
76 | font-size: 18px;
77 | color: #000000;
78 | margin-bottom: 30px;
79 | line-height: 29px;
80 | }
81 | .endbox {
82 | margin-bottom: 10px;
83 | }
84 | .otherBox {
85 | position: relative;
86 | }
87 | .moreshare {
88 | font-size: 14px;
89 | color: #3388ff;
90 | }
91 | .nostart a{
92 | display: block;
93 | height: 50px;
94 | line-height: 50px;
95 | font-size: 18px;
96 | color: #fff;
97 | text-align: center;
98 | text-decoration: none;
99 | background: #FF2376;
100 | box-shadow: 0 6px 14px 2px rgba(0,0,0,0.04);
101 | border-radius: 5px;
102 | }
103 | .showrender {
104 | text-align: center;
105 | padding-top: 14px;
106 | font-size: 13px;
107 | color:#999;
108 | }
109 | .broadcast {
110 | position: relative;
111 | overflow: hidden;
112 | padding-right: .24rem;
113 | }
114 | .otherboxImg {
115 | width: 70px;
116 | position: absolute;
117 | right: 0;
118 | left: 0;
119 | bottom: 0;
120 | margin: auto;
121 | top: 0;
122 | padding-top: 22px;
123 | }
124 | .broadcast-wrap img {
125 | width: 100%;
126 | display: none;
127 | }
128 | .broadcast-wrap img.active {
129 | display: block;
130 | transform: scale(.9);
131 | margin-left: -1px;
132 | }
133 | .broadcast-wrap {
134 | float: left;
135 | margin-right: 70px;
136 | }
137 | .otherimgbox {
138 | width: 70px;
139 | position: absolute;
140 | top: 0;
141 | right: 25px;
142 | height: 100%;
143 | }
144 | .broadcast-text {
145 | position: absolute;
146 | bottom: 35px;
147 | left: 48px;
148 | font-size: 15px;
149 | color: #fff;
150 | height: 22px;
151 | overflow: hidden;
152 | vertical-align: middle;
153 | }
154 | .clickto a{
155 | color: #3388ff;
156 | }
157 | .answerText.hiok {
158 | color: #fff;
159 | background-image: linear-gradient(30deg, #FF2B72 0%, #FF6264 100%);
160 | box-shadow: 0 6px 7px 2px rgba(0,0,0,0.04);
161 | border: 1px solid #F1F1F1;
162 | }
163 | .broadcast-text-wrap {
164 | transition: transform 1s;
165 | }
166 | .broadcast-text-animite {
167 | font-size: 15px;
168 | height: 22px;
169 | line-height: 22px;
170 | overflow:hidden;
171 | margin:0;
172 | padding:0;
173 | }
174 | .loaddingbox {
175 | position:absolute;
176 | top: 0px;
177 | left: 0px;
178 | bottom: 0px;
179 | right: 0px;
180 | z-index: 1000;
181 | font-size: 12px;
182 | }
183 | .loaddingbox img {
184 | width: 84px;
185 | left: 0px;
186 | bottom: 0;
187 | top: 0px;
188 | right: 0px;
189 | position: absolute;
190 | margin: auto;
191 | }
192 | .zhuanqi {
193 | -webkit-animation:gogogo .9s infinite linear;
194 | }
195 | .answerBoxwarp {
196 | position: relative;
197 | }
198 |
199 | .noshow {
200 | display:none;
201 | }
--------------------------------------------------------------------------------
/gui/main.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 |
4 | import tkinter as tk
5 | from tkinter import font
6 |
7 | from threading import Thread
8 |
9 | from src.controllers import controller
10 | from src.spiders import sogouSpider
11 | from src.units import adb
12 |
13 | from gui.loop import loop_sogou, loop_uc
14 |
15 | APP_NAME = 'AI Answer Help'
16 | APP_SIZE = '1300x700'
17 |
18 | COLOR_BG = '#328294'
19 | COLOR_FONT = '#fff'
20 |
21 | FONT_FAMIY = "微软雅黑"
22 | FONT_BASE = None
23 | FONT_TITLE = None
24 |
25 | root = None
26 |
27 | class Window(tk.Tk):
28 | """窗口"""
29 |
30 | def __init__(self, master=None):
31 | super().__init__(master)
32 | self.title(APP_NAME)
33 | self.geometry(APP_SIZE)
34 | self.create_fonts()
35 |
36 | def create_fonts(self):
37 | global FONT_BASE
38 | FONT_BASE = font.Font(root=self, family=FONT_FAMIY,)
39 | global FONT_TITLE
40 | FONT_TITLE = font.Font(
41 | root=self, family=FONT_FAMIY, size=30, weight="bold")
42 |
43 |
44 | class Application(tk.Frame):
45 | """主应用"""
46 |
47 | def __init__(self, master=None):
48 | super().__init__(master)
49 | self['bg'] = COLOR_BG
50 | self.pack(expand=True, fill='both')
51 | self.create_frames()
52 |
53 | def create_frames(self):
54 | title = Title(self)
55 | title.pack(side='top', fill='x')
56 | config_frame = ConfigFrame(self)
57 | config_frame.pack(side='left', expand=True, fill='y')
58 | content_frame = ContentFrame(self, width=700)
59 | content_frame.pack(side='left', expand=True, fill='y')
60 | controller_frame = ControllerFrame(self)
61 | controller_frame.pack(side='left', expand=True, fill='y')
62 |
63 |
64 | class Title(tk.Frame):
65 | """标题区域"""
66 |
67 | def __init__(self, master=None):
68 | super().__init__(master)
69 | self.create_widgets()
70 |
71 | def create_widgets(self):
72 | title = tk.Label(self, height=2)
73 | title['text'] = APP_NAME
74 | title['font'] = FONT_TITLE
75 | title['bg'] = COLOR_BG
76 | title['fg'] = COLOR_FONT
77 | title['bd'] = 1
78 | title.pack(expand=True, fill='x')
79 |
80 |
81 | class BaseFrame(tk.Frame):
82 | def __init__(self, master=None, bg=COLOR_BG, width=300):
83 | super().__init__(master)
84 | self['width'] = width
85 | self['bg'] = bg
86 | self.create_widgets()
87 |
88 | def create_widgets(self):
89 | pass
90 |
91 |
92 | class ConfigFrame(BaseFrame):
93 | """配置区域"""
94 |
95 | def create_widgets(self):
96 | base = BaseFrame(self, bg=COLOR_FONT)
97 | base.pack(pady=20)
98 | self.ai_auto = tk.Checkbutton(self, text="AI Auto", )
99 | self.ai_auto['font'] = FONT_BASE
100 | self.ai_auto.pack(fill='x', padx=50, ipady=10, pady=30)
101 | self.ai_save = tk.Checkbutton(self, text="Save Result", )
102 | self.ai_save['font'] = FONT_BASE
103 | self.ai_save.pack(fill='x', padx=50, ipady=10, pady=30)
104 | controller.toggle_ai({'switch': 'ON'})
105 |
106 |
107 | class ContentFrame(BaseFrame):
108 | """内容区域"""
109 |
110 | def create_widgets(self):
111 | base = BaseFrame(self, bg=COLOR_FONT, width=700)
112 | base.pack(pady=20)
113 | adb.DEVICES_LIST
114 | text = 'Hello! App Has Inited. Try Start~'
115 | self.log = tk.Message(self, text=text, justify='left', anchor='nw', width=600)
116 | self.log['font'] = FONT_BASE
117 | self.log['bg'] = COLOR_BG
118 | self.log['fg'] = COLOR_FONT
119 | self.log.pack(pady=30, expand=True, fill='both')
120 |
121 | class ControllerFrame(BaseFrame):
122 | """操作区域"""
123 |
124 | def create_widgets(self):
125 | self.round = 1
126 |
127 | base = BaseFrame(self, bg=COLOR_FONT)
128 | base.pack(pady=20)
129 | self.start = tk.Button(self, text="Start", command=self.start_loop)
130 | self.start['font'] = FONT_BASE
131 | self.start.pack(fill='x', padx=50, ipady=10, pady=30)
132 | self.start = tk.Button(self, text="Stop", command=self.stop_loop)
133 | self.start['font'] = FONT_BASE
134 | self.start.pack(fill='x', padx=50, ipady=10, pady=30)
135 | self.quit = tk.Button(self, text="Quit", command=self.quit_all)
136 | self.quit.pack(side='bottom', fill='x', padx=50, ipady=10, pady=30,)
137 |
138 | def start_loop(self):
139 | self.sogou = Thread(target=loop_sogou)
140 | self.sogou.setDaemon(True)
141 | self.sogou.start()
142 | self.uc = Thread(target=loop_uc)
143 | self.uc.setDaemon(True)
144 | self.uc.start()
145 |
146 | def stop_loop(self):
147 | self.sogou.stopped = True
148 | self.uc.stopped = True
149 |
150 | def quit_all(self):
151 | self.stop_loop()
152 | root.destroy()
153 |
154 |
155 |
156 | def init_gui():
157 | global root
158 | root = Window()
159 | app = Application(master=root)
160 | app.mainloop()
161 |
162 |
163 | if __name__ == '__main__':
164 | init_gui()
--------------------------------------------------------------------------------
/src/units/method.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | """
4 | #Author: smilesmith
5 | #Date: 2018-01-29
6 | #Desc: 公共方法
7 | """
8 | import time
9 | from urllib.request import Request, urlopen
10 | from colorama import Fore
11 | from src.configs import config
12 |
13 |
14 | def date_time_string():
15 | """Return the current time formatted """
16 | now = time.time()
17 | year, month, day, hh, mm, ss, x, y, z = time.localtime(now)
18 | s = "%04d%02d%02d-%02d" % (year, month, day, hh)
19 | return s
20 |
21 |
22 | def __log_date_time_string():
23 | """Return the current time formatted for logging."""
24 | monthname = [None,
25 | 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
26 | 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
27 | now = time.time()
28 | year, month, day, hh, mm, ss, x, y, z = time.localtime(now)
29 | s = "%02d/%3s/%04d %02d:%02d:%02d" % (
30 | day, monthname[month], year, hh, mm, ss)
31 | return s
32 |
33 |
34 | def log_info(log_format, *args):
35 | """自定义日志"""
36 | print("[%s] %s" %
37 | (__log_date_time_string(), log_format % args))
38 |
39 |
40 | def log_error(log_format, *args):
41 | """错误日志"""
42 | print(Fore.LIGHTRED_EX + ("[%s] %s" %
43 | (__log_date_time_string(), log_format % args)) + Fore.RESET)
44 |
45 |
46 | def log_warn(log_format, *args):
47 | """警告日志"""
48 | print(Fore.YELLOW + ("[%s] %s" %
49 | (__log_date_time_string(), log_format % args)) + Fore.RESET)
50 |
51 |
52 | def get_prefer_result(results, options):
53 | """返回优选答案"""
54 | pri_obj = {}
55 | for result in results:
56 | if result.text not in pri_obj:
57 | pri_obj[result.text] = result.prop
58 | else:
59 | pri_obj[result.text] += result.prop
60 |
61 | prefer_results = sorted(pri_obj.items(), key=lambda item: -item[1])
62 |
63 | try_times = min(config.TRY_TIMES, len(prefer_results))
64 |
65 | # 尝试 信任度prop最大的三个选项
66 | for try_num in range(try_times):
67 |
68 | # 匹配的字符数,初始化为0
69 | match_counts = [0, 0, 0]
70 | prefer_option = prefer_results[try_num][0]
71 | prefer_prop = prefer_results[try_num][1]
72 |
73 |
74 | # 1、信任度prop从大到小依次寻找匹配
75 | if prefer_option in options:
76 | print("[%s] PROP [%s] Exactly..." % (prefer_option, prefer_prop))
77 | return options.index(prefer_option)
78 |
79 |
80 | # 2、OCR识别错误,导致AI答案,没有匹配答题手机中的选项
81 | for char in prefer_option:
82 | for index, option in enumerate(options):
83 | if str(char) in option:
84 | # 如果字符存在于手机的选项中,计数+1
85 | match_counts[index] += 1
86 |
87 | # 寻找匹配字符数量最大的选项
88 | max_count = 0
89 | max_count_index = 0
90 | for index, count in enumerate(match_counts):
91 | if count > max_count:
92 | max_count = count
93 | max_count_index = index
94 |
95 | # 匹配字符比例超过阈值则认为是可信任的选项
96 | if max_count / len(prefer_option) >= config.OCR_THRESHOLD:
97 | print("[%s] PROP [%s] Likely..." % (prefer_option, prefer_prop))
98 | return max_count_index
99 |
100 | # 3、某些个性题,AI返回的答案不全,没有包含答题手机中的选项
101 | # 我也很绝望啊~~
102 | # 是不是要来个随机数??
103 |
104 | return None
105 |
106 |
107 | ANDROID_USER_AGENT = "Mozilla/5.0 (Linux; Android 7.1.1; Google Pixel - \
108 | 7.1.0 - API 25 - 1080x1920 Build/NMF26Q; wv) AppleWebKit/537.36 (KHTML, like Gecko) \
109 | Version/4.0 Chrome/52.0.2743.100 Mobile Safari/537.36 SogouSearch Android1.0 version3.0 AppVersion/5802"
110 |
111 | HEADERS = {
112 | 'Host': 'answer.sm.cn',
113 | 'Connection': 'keep-alive',
114 | 'Cache-Control': 'max-age=0',
115 | 'Accept': 'text/html, */*; q=0.01',
116 | 'User-Agent': ANDROID_USER_AGENT,
117 | 'Referer': 'http://answer.sm.cn/',
118 | 'Accept-Encoding': 'gzip, deflate',
119 | 'Accept-Language': 'zh-CN,zh;q=0.9'
120 | }
121 |
122 |
123 | def mock_request(path, **my_headers):
124 | """伪装请求"""
125 | headers = HEADERS.copy()
126 | for key in my_headers:
127 | headers[key] = my_headers[key]
128 |
129 | req = Request(path, headers=headers)
130 | res = urlopen(req)
131 | res_str = str(res.read(), 'UTF-8')
132 | return res_str
133 |
134 |
135 | def check_hosts(host_name='dev.secr.baidu.com'):
136 | """检查host"""
137 | try:
138 | read_file = open("C:\\Windows\\System32\\drivers\\etc\\hosts", "r", encoding='utf-8')
139 | read_content = read_file.read()
140 | if host_name in read_content:
141 | return True
142 | except UnicodeDecodeError:
143 | print("不支持的编码类型,请切换解码放式或自行修改文件编码类型")
144 |
145 | # 不存在的情况下尝试添加
146 | try:
147 | file = open("C:\\Windows\\System32\\drivers\\etc\\hosts", "r+", encoding='utf-8')
148 | except PermissionError as error:
149 | print(error)
150 | print('\n缺少权限修改您电脑上的hots文件,请尝试以下两种方式:\n\
151 | (1)以管理员权限打开命令行窗口\n\
152 | (2)手动在hosts文件中添加一行: 127.0.0.1 dev.secr.baidu.com')
153 | return False
154 | else:
155 | content = file.read()
156 | if host_name not in content:
157 | file.write("\n127.0.0.1 " + host_name)
158 | file.close()
159 | return True
160 |
161 |
162 |
163 |
164 |
--------------------------------------------------------------------------------
/src/services/answerService.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | """
4 | #Author: smilesmith
5 | #Date: 2018-01-30
6 | #Desc: 答题服务
7 | """
8 |
9 | # 突然发现有些逻辑放model和controller都会有较大的耦合,着手抽离:)
10 | # model里放更纯粹的数据操作
11 | # controller放更纯粹的区分操作(AI还是Human)
12 | from src.configs import config
13 | from src.models.question import Question
14 | from src.models.answer import MyAnswer
15 | from src.models.result import Result
16 | from src.units import adb
17 | from src.units.method import log_info, date_time_string
18 | from src.daos import answerDao, questionDao
19 |
20 | CUR_ANSWER = MyAnswer(Question('start', '0', '19700101'))
21 |
22 |
23 | def answer_by_ai(datas, ai_type):
24 | """处理AI答题"""
25 | # 解析数据
26 | question_round = str(datas["question"]["round"])
27 | question_text = datas["question"]["text"]
28 | options = datas["options"]
29 | phase = date_time_string()
30 | if not options:
31 | return
32 |
33 | # 刷新或读取问题
34 | if (not isinstance(CUR_ANSWER, MyAnswer)) or CUR_ANSWER.question.round != question_round:
35 | question = Question(question_text, question_round, phase)
36 | log_info("> step 1: start [No.%s] ...", question_round)
37 |
38 | question_id = refresh_answer(question)
39 | question.set_id(question_id)
40 | log_info("> step 2: get question ")
41 | print("[%s. %s]" % (question_round, question_text))
42 | else:
43 | question = CUR_ANSWER.question
44 |
45 | # 设置选项
46 | CUR_ANSWER.set_option(options, ai_type)
47 |
48 | # 填充答案
49 | if ai_type == "baidu":
50 | # 百度Step-0 只有题目
51 | if 'results' not in datas:
52 | return
53 | results = datas["results"]
54 | result = int(datas["result"])
55 | add_result_baidu(result, options, question)
56 | add_result_baidu_percentage(results, question)
57 |
58 | elif ai_type == "sogou":
59 | result = int(datas["result"])
60 | add_result_sogou(result, options, question)
61 |
62 | elif ai_type == "uc":
63 | result = int(datas["result"])
64 | add_result_uc(result, options, question)
65 |
66 | # adb.tap_android_all(result)
67 | log_info("> step 3: add results: %s by %s",
68 | result, ai_type)
69 |
70 |
71 | def refresh_answer(question):
72 | global CUR_ANSWER
73 | CUR_ANSWER = MyAnswer(question)
74 | CUR_ANSWER.start_answer_all()
75 |
76 | question_id = questionDao.get_question_id(question.round, question.phase)
77 |
78 | if not question_id:
79 | question_id = questionDao.save_question(question)
80 | return question_id
81 |
82 |
83 | def add_result_baidu(index, options, question):
84 | """添加百度AI答案"""
85 | prop = config.BAIDU_WEIGHT
86 | text = options[index]
87 | result = Result(index, text, prop, question.id)
88 | result.set_type("baidu")
89 | answerDao.save_result(result)
90 | CUR_ANSWER.add_result(result)
91 |
92 |
93 | def add_result_baidu_percentage(results, question):
94 | """添加百度百分比答案"""
95 | for index, result in enumerate(results):
96 | result = Result(index, result['text'], result['prop'] * config.BAIDU_P_WEIGHT, question.id)
97 | result.set_type("baidu", "percentage")
98 | answerDao.save_result(result)
99 | CUR_ANSWER.add_result(result)
100 |
101 |
102 | def add_result_sogou(index, options, question):
103 | """添加搜狗AI答案"""
104 | prop = config.SOGOU_WEIGHT
105 | text = options[index]
106 | result = Result(index, text, prop, question.id)
107 | result.set_type("sogou")
108 | answerDao.save_result(result)
109 | CUR_ANSWER.add_result(result)
110 |
111 |
112 | def add_result_uc(index, options, question):
113 | """添加UC-AI答案"""
114 | if '|-|' in options[0]:
115 | new_results = options[0].split("|-|")
116 | log_info("> step 3: add results individual")
117 | prop = config.UC_I_WEIGHT
118 | for index, result_text in enumerate(new_results):
119 | result = Result(index, result_text, prop, question.id)
120 | result.set_type("uc", "single")
121 | answerDao.save_result(result)
122 | CUR_ANSWER.add_result(result)
123 | else:
124 | prop = config.UC_WEIGHT
125 | text = options[index]
126 | result = Result(index, text, prop, question.id)
127 | result.set_type("uc")
128 | answerDao.save_result(result)
129 | CUR_ANSWER.add_result(result)
130 |
131 |
132 | def answer_by_human(datas, answer_type):
133 | """处理人工答题"""
134 | result = int(datas["result"])
135 | question_round = str(datas["question"]["round"])
136 | adb.tap_android_all(result)
137 | log_info(">>> No.%s %s Human Answer : %s",
138 | question_round, answer_type, result)
139 |
140 |
141 | def save_correct_result(datas):
142 | """保存正确结果"""
143 | questions = datas['question']
144 | question_phase = date_time_string()
145 | for question in questions:
146 | question_id = questionDao.get_question_id(str(question['id']), question_phase)
147 | if isinstance(question['answer'], list):
148 | for answer in question['answer']:
149 | result = Result(0, answer, 1, question_id)
150 | answerDao.save_correct_result(result)
151 | else:
152 | result = Result(0, question['answer'], 1, question_id)
153 | answerDao.save_correct_result(result)
154 | log_info(">>> Save Correct Result Success...")
155 |
--------------------------------------------------------------------------------
/allinone/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | 答题助手大家庭
23 |
24 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
98 |
Dan哥热身中,题目还在路上...
99 |
100 |
101 |
暂无答案0%
102 |
暂无答案0%
103 |
暂无答案0%
104 |
105 |
106 |

107 |

108 |
109 |
110 |
111 |
112 |

113 |
114 |
115 |
我是机器哥dandan,外号Dan哥
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 | AI自动答题: OFF
125 | 自己答题:
126 |
127 | - A
128 | - B
129 | - C
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
--------------------------------------------------------------------------------
/src/units/adb.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | """
4 | #Author: smilesmith
5 | #Date: 2018-01-25
6 | #Desc: ADB相关命令
7 | """
8 | import subprocess
9 | import time
10 | import random
11 | import os
12 | import sys
13 | from multiprocessing import Process, Queue
14 | from PIL import Image
15 | from src.configs import config
16 | from .method import log_info, log_warn, get_prefer_result
17 | from .ocr import ocr_img_tess, ocr_img_tess_choices
18 |
19 | DEVICES_LIST = []
20 |
21 |
22 | def init():
23 | """初始化adb"""
24 | global DEVICES_LIST
25 | DEVICES_LIST = get_device_infos()
26 |
27 |
28 | def get_device_infos():
29 | """获取设备信息"""
30 | devices_list = []
31 | device_infos = subprocess.Popen(
32 | 'adb devices', shell=True, stdout=subprocess.PIPE)
33 | out, err = device_infos.communicate()
34 | print('\n' + str(out.decode("utf-8")))
35 | for line in out.decode("utf-8").splitlines()[1:-1]:
36 | devices_list.append(line.split("\t")[0])
37 | return devices_list
38 |
39 |
40 | def start_answer_individual(device_id, index, shared_queue):
41 | """获取选项"""
42 | start = time.time()
43 | check_screenshot(device_id, index)
44 | img = Image.open("./screenshot" + index + ".png")
45 | # question, options = ocr_img_tess(img)
46 | options = ocr_img_tess_choices(img)
47 | log_warn("> step 4: get device[%s] options time: %ss", index, str(time.time() - start)[:4])
48 | print(str(options))
49 |
50 | # 等待接收各个AI的答案
51 | while time.time() - start < config.WAIT_TIME:
52 | time.sleep(0.2)
53 | results = shared_queue.get(False)
54 | shared_queue.put(results, False)
55 |
56 | # 计算最佳答案
57 | result_index = get_prefer_result(results, options)
58 | if result_index is None:
59 | log_warn("> step 5: can not get device[%s] result, try random...", index)
60 | time.sleep(0.2)
61 | result_index = random.randint(0, 2)
62 | else:
63 | log_info("> step 5: get device[%s] prefer result is %s", index, result_index)
64 |
65 | log_info("> step 6: tap device[%s] result: %s", index, result_index)
66 | tap_android_individual(device_id, result_index)
67 |
68 | def start_answer_all():
69 | """获取所有选项"""
70 | shared_queue = Queue(1)
71 | for index, device_id in enumerate(DEVICES_LIST):
72 | sub_process = Process(target=start_answer_individual, args=(device_id, str(index), shared_queue))
73 | sub_process.start()
74 | return shared_queue
75 |
76 |
77 | def tap_android_individual(device_id, result_index):
78 | """根据不同的安卓设备点击"""
79 | left_start, top_start = config.TAP_START.replace(" ", "").split(",")
80 | target_left = int(left_start)
81 | top_start = int(top_start)
82 | top_gap = int(config.TAP_GAP)
83 | target_top = top_start + top_gap * (result_index + 1)
84 |
85 | command = "adb -s " + device_id + " shell input tap " + \
86 | str(target_left) + " " + str(target_top)
87 | subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
88 |
89 |
90 | def tap_android_all(result_index):
91 | """根据答案点击安卓设备"""
92 | if not DEVICES_LIST:
93 | log_warn("No device found, Please check your adb")
94 | return
95 | left_start, top_start = config.TAP_START.replace(" ", "").split(",")
96 | target_left = int(left_start)
97 | top_start = int(top_start)
98 | top_gap = int(config.TAP_GAP)
99 | target_top = top_start + top_gap * (result_index + 1)
100 |
101 | for device_id in DEVICES_LIST:
102 | command = "adb -s " + device_id + " shell input tap " + \
103 | str(target_left) + " " + str(target_top)
104 | subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
105 |
106 |
107 | # SCREENSHOT_WAY 是截图方法,经过 check_screenshot 后,会自动递减,不需手动修改
108 | SCREENSHOT_WAY = 3
109 |
110 |
111 | def pull_screenshot(device_id, index):
112 | """
113 | 获取屏幕截图,目前有 0 1 2 3 四种方法,未来添加新的平台监测方法时,
114 | 可根据效率及适用性由高到低排序
115 | """
116 | global SCREENSHOT_WAY
117 | if 1 <= SCREENSHOT_WAY <= 3:
118 | process = subprocess.Popen(
119 | "adb -s " + device_id + " shell screencap -p",
120 | shell=True, stdout=subprocess.PIPE)
121 | binary_screenshot = process.stdout.read()
122 | if SCREENSHOT_WAY == 2:
123 | binary_screenshot = binary_screenshot.replace(b'\r\n', b'\n')
124 | # binary_screenshot = binary_screenshot.split(b' ')
125 | # binary_screenshot = binary_screenshot[len(binary_screenshot) - 1]
126 | # print(binary_screenshot)
127 | elif SCREENSHOT_WAY == 1:
128 | binary_screenshot = binary_screenshot.replace(b'\r\r\n', b'\n')
129 | f = open("screenshot" + index + ".png", 'wb')
130 | f.write(binary_screenshot)
131 | f.close()
132 | elif SCREENSHOT_WAY == 0:
133 | os.system("adb -s " + device_id +
134 | " shell screencap -p /sdcard/screenshot" + index + ".png")
135 | os.system("adb -s " + device_id +
136 | " pull /sdcard/screenshot" + index + ".png .")
137 |
138 |
139 | def check_screenshot(device_id, index):
140 | """
141 | 检查获取截图的方式
142 | """
143 | global SCREENSHOT_WAY
144 | if os.path.isfile('screenshot.png'):
145 | try:
146 | os.remove('screenshot.png')
147 | except Exception:
148 | pass
149 | if SCREENSHOT_WAY < 0:
150 | print('暂不支持当前设备')
151 | sys.exit()
152 | pull_screenshot(device_id, index)
153 | try:
154 | Image.open("./screenshot" + index + ".png").load()
155 | except Exception:
156 | SCREENSHOT_WAY -= 1
157 | check_screenshot(device_id, index)
158 |
--------------------------------------------------------------------------------
/allinone/uc/static/js/chunk.4.60.js:
--------------------------------------------------------------------------------
1 | webpackJsonp([4], {
2 | 466: function(t, e, n) {
3 | function a(t) {
4 | n(550);
5 | }
6 | var i = n(49)(n(552), n(553), a, "data-v-0531630a", null);
7 | t.exports = i.exports;
8 | },
9 | 550: function(t, e, n) {
10 | var a = n(551);
11 | "string" == typeof a && (a = [[t.i, a, ""]]),
12 | a.locals && (t.exports = a.locals);
13 | n(462)("f8ce590a", a, !0);
14 | },
15 | 551: function(t, e, n) {
16 | (e = t.exports = n(461)(!0)),
17 | e.push([
18 | t.i,
19 | ".wrap[data-v-0531630a]{color:#fff;padding-bottom:50px}.wrap .content[data-v-0531630a]{margin-top:41px}.wrap .content>p[data-v-0531630a]{margin-top:30px;margin-bottom:14px;text-align:left;padding:0 30px}.wrap ul[data-v-0531630a]{text-align:left;padding:0 30px}.wrap ul li[data-v-0531630a]{padding:20px 0;border-bottom:1px solid hsla(0,0%,100%,.1)}.wrap ul li[data-v-0531630a]:last-child{border:none}",
20 | "",
21 | {
22 | version: 3,
23 | sources: [
24 | "/Users/gml/mywork/gitlab/dream/src/views/dream/review.vue"
25 | ],
26 | names: [],
27 | mappings:
28 | "AACA,uBACE,WAAe,AACf,mBAAqB,CACtB,AACD,gCACI,eAAiB,CACpB,AACD,kCACM,gBAAiB,AACjB,mBAAoB,AACpB,gBAAiB,AACjB,cAA2B,CAChC,AACD,0BACI,gBAAiB,AACjB,cAA2B,CAC9B,AACD,6BACM,eAAkB,AAClB,0CAAkD,CACvD,AACD,wCACQ,WAAa,CACpB",
29 | file: "review.vue",
30 | sourcesContent: [
31 | "\n.wrap[data-v-0531630a] {\n color: #ffffff;\n padding-bottom: 50px;\n}\n.wrap .content[data-v-0531630a] {\n margin-top: 41px;\n}\n.wrap .content > p[data-v-0531630a] {\n margin-top: 30px;\n margin-bottom: 14px;\n text-align: left;\n padding: 0px 30px 0px 30px;\n}\n.wrap ul[data-v-0531630a] {\n text-align: left;\n padding: 0px 30px 0px 30px;\n}\n.wrap ul li[data-v-0531630a] {\n padding: 20px 0px;\n border-bottom: 1px solid rgba(255, 255, 255, 0.1);\n}\n.wrap ul li[data-v-0531630a]:nth-last-child(1) {\n border: none;\n}\n"
32 | ],
33 | sourceRoot: ""
34 | }
35 | ]);
36 | },
37 | 552: function(t, e, n) {
38 | "use strict";
39 | function a(t) {
40 | return t && t.__esModule ? t : { default: t };
41 | }
42 | Object.defineProperty(e, "__esModule", { value: !0 });
43 | var i = n(51),
44 | r = a(i),
45 | o = n(116),
46 | p = a(o),
47 | d = n(117),
48 | s = n(50),
49 | u = a(s),
50 | l = n(175),
51 | A = n(173),
52 | c = a(A),
53 | f = n(176),
54 | v = a(f),
55 | w = n(471),
56 | C = a(w),
57 | m = n(469),
58 | x = a(m),
59 | g = n(473),
60 | B = a(g);
61 | e.default = {
62 | name: "review",
63 | computed: (0, p.default)(
64 | {},
65 | (0, d.mapState)("review", {
66 | review: function(t) {
67 | return t.review;
68 | }
69 | }),
70 | {
71 | hasReview: function() {
72 | return (
73 | !u.default.isEmptyObject(this.review) &&
74 | !u.default.isEmptyObject(this.review.question)
75 | );
76 | },
77 | banner: function() {
78 | return u.default.getCommonParamByKey("banner");
79 | },
80 | title: function() {
81 | if (this.hasReview)
82 | return this.review.info.cnname + this.review.info.order;
83 | }
84 | }
85 | ),
86 | mixins: [c.default],
87 | initData: c.default.initData,
88 | asyncData: function(t) {
89 | return new r.default(function(e, n) {
90 | var a = t.route.params.activity,
91 | i = t.route.params.sid;
92 | i
93 | ? (0, l.getReviewData)(a, i)
94 | .then(function(a) {
95 | t.store
96 | .dispatch("review/updateReview", a)
97 | .then(function() {
98 | e();
99 | })
100 | .catch(function(t) {
101 | n(t);
102 | });
103 | })
104 | .catch(function(t) {
105 | n(t);
106 | })
107 | : n();
108 | });
109 | },
110 | mounted: function() {
111 | window.scrollTo(0, 1);
112 | },
113 | components: {
114 | DButton: x.default,
115 | DTitle: C.default,
116 | DBanner: v.default,
117 | DReview: B.default
118 | }
119 | };
120 | },
121 | 553: function(t, e) {
122 | t.exports = {
123 | render: function() {
124 | var t = this,
125 | e = t.$createElement,
126 | n = t._self._c || e;
127 | return n("div", { staticClass: "wrap" }, [
128 | n(
129 | "div",
130 | { staticClass: "content" },
131 | [
132 | t.hasReview
133 | ? n("d-title", { attrs: { title: t.title, status: "2" } })
134 | : t._e(),
135 | t._v(" "),
136 | n("p", [t._v("\n 回顾题目\n ")]),
137 | t._v(" "),
138 | t.hasReview
139 | ? n(
140 | "ul",
141 | t._l(t.review.question, function(t, e) {
142 | return n(
143 | "li",
144 | { key: e },
145 | [
146 | n("d-review", {
147 | attrs: {
148 | question: t.id + "、" + t.title,
149 | answer: t.answer
150 | }
151 | })
152 | ],
153 | 1
154 | );
155 | })
156 | )
157 | : n("div", [t._v("\n 暂时无题\n ")])
158 | ],
159 | 1
160 | )
161 | ]);
162 | },
163 | staticRenderFns: []
164 | };
165 | }
166 | });
167 | //# sourceMappingURL=chunk.4.60.js.map
168 |
--------------------------------------------------------------------------------
/servers/web_server.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | """程序主进程"""
4 | from http.server import BaseHTTPRequestHandler, HTTPServer
5 | from urllib.parse import urlparse
6 | from urllib.request import Request, urlopen
7 | from urllib.error import HTTPError, URLError
8 | from multiprocessing import Process
9 | from os import path
10 | import json
11 | from src.controllers import controller
12 |
13 | CURRENT_DIR = path.dirname(path.realpath(__file__))
14 |
15 | PORT = 8080
16 |
17 | ANDROID_USER_AGENT = "Mozilla/5.0 (Linux; Android 7.0; SM-C7010 Build/NRD90M; wv) \
18 | AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/48.0.2564.116 \
19 | Mobile Safari/537.36 T7/9.3 SearchCraft/2.0.0 (Baidu; P1 7.0)"
20 |
21 | class MyHandler(BaseHTTPRequestHandler):
22 | """处理各类请求的控制器"""
23 |
24 | def do_GET(self):
25 | """处理GET请求"""
26 | querypath = urlparse(self.path)
27 | apipath = querypath.path
28 | if apipath.startswith("/allinone/uc/answer"):
29 | self.proxy_pass("/allinone/uc/answer", "http://answer.sm.cn/answer",
30 | Referer="http://answer.sm.cn/answer/index?activity=million", Host="answer.sm.cn")
31 | elif apipath.startswith("/allinone/baidu/answer"):
32 | self.proxy_pass("/allinone/baidu/answer", "https://secr.baidu.com/answer",
33 | Referer="https://secr.baidu.com/entry?status=1-1-1-1-1-1&version=7",
34 | Host="secr.baidu.com",
35 | Cookie="BAIDUCUID=0OSCilaABulxaHutluBS8_ae2t_Ruv8NliHgigiTvaKQLBd5B; BAIDUID=5F187DAC496719041F90FD90536CCC9F:FG=1;")
36 | else:
37 | self.handle_static()
38 | self.close_connection = True
39 |
40 | def do_POST(self):
41 | """处理POST请求"""
42 | body = self.rfile.readline(int(self.headers['content-length']))
43 | datas = json.loads(str(body, 'UTF-8'))
44 | querypath = urlparse(self.path)
45 | apipath = querypath.path
46 | res = None
47 | if apipath.startswith("/allinone/reply-answer"):
48 | controller.handle_answer(apipath, datas)
49 | elif apipath.startswith('/allinone/reply-correct'):
50 | controller.save_correct_result(apipath, datas)
51 | elif apipath.startswith('/allinone/analysis/review-answer'):
52 | res = controller.get_review_datas()
53 | elif apipath.startswith('/allinone/toggle-ai'):
54 | controller.toggle_ai(datas)
55 | self.send_response_only(200)
56 | self.send_header('Content-type', 'json')
57 | self.send_header('Access-Control-Allow-Origin', '*')
58 | self.end_headers()
59 | if res:
60 | self.wfile.write(json.dumps(res).encode('utf-8'))
61 | else:
62 | self.wfile.write(b"ok")
63 | self.close_connection = True
64 |
65 | def proxy_pass(self, orgin_path, target_host_path, **my_headers):
66 | """反向代理"""
67 | headers = self.headers
68 | for key in my_headers:
69 | if headers.get(key):
70 | headers.replace_header(key, my_headers[key])
71 | else:
72 | headers.add_header(key, my_headers[key])
73 | headers.replace_header("User-Agent", ANDROID_USER_AGENT)
74 | req = Request(self.path.replace(
75 | orgin_path, target_host_path), headers=headers)
76 | data = None
77 | try:
78 | res = urlopen(req)
79 | except HTTPError as http_error:
80 | print("%s - %s" % (http_error, target_host_path))
81 | except URLError as url_error:
82 | print("%s - %s" % (url_error, target_host_path))
83 | else:
84 | data = res.read()
85 | # TODO:当是AI自动代替的模式时,直接解析结果调用相关控制器逻辑
86 | finally:
87 | self.send_response_only(200)
88 | self.end_headers()
89 | if not data:
90 | self.wfile.write(b"console.log('Remote Server Error')")
91 | else:
92 | self.wfile.write(data)
93 |
94 |
95 | def handle_static(self):
96 | """处理静态文件请求"""
97 | send_reply = False
98 | querypath = urlparse(self.path)
99 | filepath = querypath.path
100 |
101 | if filepath.endswith('/'):
102 | filepath += 'index.html'
103 | if filepath.endswith(".html"):
104 | mimetype = 'text/html'
105 | send_reply = True
106 | if filepath.endswith(".jpg"):
107 | mimetype = 'image/jpg'
108 | send_reply = True
109 | if filepath.endswith(".gif"):
110 | mimetype = 'image/gif'
111 | send_reply = True
112 | if filepath.endswith(".png"):
113 | mimetype = 'image/png'
114 | send_reply = True
115 | if filepath.endswith(".ico"):
116 | mimetype = 'image/ico'
117 | send_reply = True
118 | if filepath.endswith(".js"):
119 | mimetype = 'application/javascript'
120 | send_reply = True
121 | if filepath.endswith(".css"):
122 | mimetype = 'text/css'
123 | send_reply = True
124 | if filepath.endswith(".json"):
125 | mimetype = 'application/json'
126 | send_reply = True
127 | if send_reply is True:
128 | # Open the static file requested and send it
129 | try:
130 | with open(path.realpath(CURRENT_DIR + '/../' + filepath), 'rb') as file:
131 | content = file.read()
132 | self.send_response_only(200)
133 | self.send_header('Content-type', mimetype)
134 | self.end_headers()
135 | self.wfile.write(content)
136 | except IOError:
137 | self.send_error(404, 'File Not Found: %s' % self.path)
138 |
139 |
140 |
141 | def run_server(port=PORT):
142 | """启动本地服务器"""
143 | server_address = ('', port)
144 | httpd = HTTPServer(server_address, MyHandler)
145 | print('> Running Server On Port: ', port)
146 | print('> Press Ctrl + C to exit...\n')
147 | httpd.serve_forever()
148 |
149 |
150 |
151 | if __name__ == '__main__':
152 | run_server()
153 |
--------------------------------------------------------------------------------
/allinone/analysis/analysis.js:
--------------------------------------------------------------------------------
1 | $(function() {
2 | var dom = document.getElementById("container");
3 | var myChart = echarts.init(dom);
4 |
5 | var seriesLabel = {
6 | normal: {
7 | show: true,
8 | textBorderColor: "#333",
9 | textBorderWidth: 2
10 | }
11 | };
12 |
13 | var option = {
14 | color: ['#2f4554', '#c23531', '#dd6b66', ],
15 | title: {
16 | text: "AI Analysis",
17 | textStyle: {
18 | fontSize: 40
19 | },
20 | left: 'center',
21 | top: '3%'
22 | },
23 | tooltip: {
24 | trigger: "axis",
25 | axisPointer: {
26 | type: "shadow"
27 | }
28 | },
29 | legend: {
30 | data: ["All", "Correct", "Correct Prop"],
31 | left: 100,
32 | top: '5%'
33 | },
34 | grid: {
35 | left: 100,
36 | height: '80%',
37 | top: '10%'
38 | },
39 | toolbox: {
40 | show: true,
41 | feature: {
42 | saveAsImage: {}
43 | }
44 | },
45 | xAxis: {
46 | type: "value",
47 | name: "Count/Prop",
48 | axisLabel: {
49 | formatter: "{value}"
50 | }
51 | },
52 | yAxis: {
53 | type: "category",
54 | inverse: true,
55 | data: ["- Baidu -", "- Baidu Per-", "-Sougou-", "- UC -"]
56 | },
57 | series: [
58 | {
59 | name: "All",
60 | type: "bar",
61 | data: [0, 0, 0, 0],
62 | label: seriesLabel
63 | },
64 | {
65 | name: "Correct",
66 | type: "bar",
67 | data: [ 0, 0, 0, 0],
68 | label: seriesLabel
69 | },
70 | {
71 | name: "Correct Prop",
72 | type: "bar",
73 | label: seriesLabel,
74 | data: [0, 0, 0, 0]
75 | }
76 | ]
77 | };
78 |
79 | $.ajax({
80 | type: "POST",
81 | url: "review-answer",
82 | headers: {
83 | "Content-Type": "application/json;charset=utf-8",
84 | dataType: "json"
85 | },
86 | data: JSON.stringify({ date: "all" }),
87 | success: function(response, status, xhr) {
88 | var data = JSON.parse(response);
89 | var ai_results = data.ai_results;
90 | var correct_results = data.correct_results;
91 | var correct_obj = {};
92 | var all_count = 0;
93 |
94 | correct_results.forEach((correct) => {
95 | question_id = correct[3];
96 | correct_text = correct[2];
97 | if (!correct_obj[question_id]) {
98 | all_count += 1;
99 | correct_obj[question_id] = correct_text;
100 | } else {
101 | if (typeof(correct_obj[question_id]) === "string") {
102 | correct_obj[question_id] = [correct_obj[question_id], correct_text];
103 | }
104 | correct_obj[question_id].push(correct_text);
105 | }
106 | });
107 |
108 | // 过滤无效结果
109 | ai_results = ai_results.filter((item) => {
110 | return correct_obj[item[6]];
111 | });
112 |
113 | ai_results = ai_results.map((item) => {
114 | ai_type = item[1]
115 | result_text = item[3];
116 | result_type = item[4];
117 | result_prop = item[5];
118 | question_id = item[6];
119 | correct_text = correct_obj[question_id];
120 | return {
121 | question_id,
122 | ai_type,
123 | result_type,
124 | result_text,
125 | result_prop,
126 | correct: correct_text.indexOf(result_text) >= 0
127 | };
128 | });
129 |
130 | // 单个答案的正确计数对象
131 | var single_obj = {
132 | baidu: {},
133 | sogou: {},
134 | uc: {},
135 | };
136 |
137 | var percentage_temp_obj = {
138 | baidu: {},
139 | };
140 |
141 | ai_results.forEach((item) => {
142 | var question_id = item.question_id;
143 | var ai_type = item.ai_type;
144 | var result_type = item.result_type;
145 |
146 | if (result_type === 'percentage') {
147 | if (!percentage_temp_obj[ai_type][question_id]) {
148 | percentage_temp_obj[ai_type][question_id] = {
149 | text: item.result_text,
150 | prop: item.result_prop
151 | };
152 | } else if (item.result_prop > percentage_temp_obj[ai_type][question_id].prop) {
153 | percentage_temp_obj[ai_type][question_id] = {
154 | text: item.result_text,
155 | prop: item.result_prop
156 | };
157 | }
158 | return;
159 | }
160 |
161 | if (single_obj[ai_type][question_id] === undefined) {
162 | single_obj[ai_type][question_id] = true;
163 | }
164 | // 个性题错一个即为答案错误
165 | if (!item.correct) {
166 | single_obj[ai_type][question_id] = false;
167 | }
168 | });
169 |
170 | // 百分比答案的正确计数对象
171 | var percentage_obj = {
172 | baidu: {},
173 | };
174 |
175 | for (ai_type in percentage_temp_obj) {
176 | for (question_id in percentage_temp_obj[ai_type]) {
177 | text = percentage_temp_obj[ai_type][question_id].text;
178 | percentage_obj[ai_type][question_id] = correct_obj[question_id].indexOf(text) >= 0
179 | }
180 | }
181 |
182 | // ==========开始计数==========
183 |
184 | var correct_count_array = [0, 0, 0, 0]
185 | var all_count_array = [0, 0, 0, 0]
186 |
187 | for (ai_type in percentage_obj) {
188 | for (question_id in percentage_obj[ai_type]) {
189 | if (ai_type === 'baidu') {
190 | all_count_array[1] += 1;
191 | if (percentage_obj[ai_type][question_id]){
192 | correct_count_array[1] += 1;
193 | }
194 | }
195 | }
196 | }
197 |
198 | for (ai_type in single_obj) {
199 | for (question_id in single_obj[ai_type]) {
200 | let index = -1;
201 | if (ai_type === 'baidu') {
202 | index = 0
203 | } else if (ai_type === 'sogou') {
204 | index = 2
205 | } else if (ai_type === 'uc') {
206 | index = 3
207 | }
208 | all_count_array[index] += 1;
209 | if (single_obj[ai_type][question_id]){
210 | correct_count_array[index] += 1;
211 | }
212 | }
213 | }
214 |
215 |
216 | var correct_prop_array = correct_count_array.map((item, index)=> {
217 | return parseFloat((item/all_count_array[index]).toFixed(2))
218 | });
219 |
220 | option.series[0].data = all_count_array;
221 | option.series[1].data = correct_count_array;
222 | option.series[2].data = correct_prop_array;
223 |
224 | myChart.setOption(option, true);
225 |
226 | console.log({correct_count_array, correct_prop_array});
227 | }
228 | });
229 |
230 | if (option && typeof option === "object") {
231 | myChart.setOption(option, true);
232 | }
233 | });
234 |
--------------------------------------------------------------------------------
/servers/baidu_websocket.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 |
4 | import threading
5 | import hashlib
6 | import socket
7 | import base64
8 | import struct
9 | import time
10 | from websocket import create_connection
11 |
12 | '''
13 | +-+-+-+-+-------+-+-------------+-------------------------------+
14 | 0 1 2 3
15 | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
16 | +-+-+-+-+-------+-+-------------+-------------------------------+
17 | |F|R|R|R| opcode|M| Payload len | Extended payload length |
18 | |I|S|S|S| (4) |A| (7) | (16/64) |
19 | |N|V|V|V| |S| | (if payload len==126/127) |
20 | | |1|2|3| |K| | |
21 | +-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - +
22 | | Extended payload length continued, if payload len == 127 |
23 | + - - - - - - - - - - - - - - - +-------------------------------+
24 | | Payload Data continued ... |
25 | +---------------------------------------------------------------+
26 | '''
27 |
28 | FIN = 0x80
29 | OPCODE = 0x0f
30 | MASKED = 0x80
31 | PAYLOAD_LEN = 0x7f
32 | PAYLOAD_LEN_EXT16 = 0x7e
33 | PAYLOAD_LEN_EXT64 = 0x7f
34 |
35 | OPCODE_CONTINUATION = 0x0
36 | OPCODE_TEXT = 0x1
37 | OPCODE_BINARY = 0x2
38 | OPCODE_CLOSE_CONN = 0x8
39 | OPCODE_PING = 0x9
40 | OPCODE_PONG = 0xA
41 |
42 |
43 |
44 | class websocket_thread(threading.Thread):
45 | """websocket线程"""
46 |
47 | def __init__(self, connection):
48 | super(websocket_thread, self).__init__()
49 | self.connection = connection
50 | self.heart_alive = False
51 |
52 | def run(self):
53 | try:
54 | self.websocket_client = create_connection("wss://selab.baidu.com/nv/answer.sock/?xc=2e7c627ea035793709242ce812d0a659&EIO=3&transport=websocket",
55 | header=[
56 | "User-Agent:"+ANDROID_USER_AGENT,
57 | "Sec-WebSocket-Extensions:permessage-deflate; client_max_window_bits",
58 | "Pragma:no-cache",
59 | "Cache-Control:no-cache",
60 | "Accept-Encoding:gzip, deflate, br",
61 | "Accept-Language:zh-CN,zh;q=0.9"],
62 | cookie="BAIDUCUID=0OSCilaABulxaHutluBS8_ae2t_Ruv8NliHgigiTvaKQLBd5B; BAIDUID=5F187DAC496719041F90FD90536CCC9F:FG=1;",
63 | origin="http://secr.baidu.com:80",
64 | host="selab.baidu.com")
65 |
66 | while True:
67 | baidu_result = self.websocket_client.recv()
68 |
69 | if "sid" in baidu_result:
70 | self.websocket_client.send("40/nv/xiguashipin/answer?xc=2e7c627ea035793709242ce812d0a659")
71 |
72 | if "step" in baidu_result:
73 | if not self.heart_alive:
74 | heart_thread = threading.Thread(target=self.heart_break)
75 | heart_thread.setDaemon(True)
76 | heart_thread.start()
77 | result = package_data(baidu_result)
78 | self.connection.send(result)
79 | # data = self.connection.recv(8192)
80 | # re = parse_data(data)
81 | except KeyboardInterrupt:
82 | self.connection.close()
83 | self.websocket_client.close()
84 |
85 | def heart_break(self):
86 | self.heart_alive = True
87 | while True:
88 | time.sleep(20)
89 | self.websocket_client.send("40")
90 |
91 |
92 | def package_data(msg):
93 | """数据包装
94 | 丶固定部分 ‘\x81’
95 | 丶报文内容长度
96 | 小于127, 填充8bit表示内容长度
97 | 小于2^16-1, 填充第一个8bit为126的十六进制表示,后面16bit表示内容长度
98 | 小于2^64-1, 填充第一个8bit为127的十六进制表示,后面64bit表示内容长度
99 | 丶报文内容
100 | """
101 | if msg:
102 | msg = str(msg)
103 | else:
104 | return False
105 |
106 | opcode = OPCODE_TEXT
107 |
108 | header = bytearray()
109 | payload = msg.encode('utf-8')
110 | payload_length = len(payload)
111 |
112 | # Normal payload
113 | if payload_length <= 125:
114 | header.append(FIN | opcode)
115 | header.append(payload_length)
116 |
117 | # Extended payload
118 | elif payload_length >= 126 and payload_length <= 65535:
119 | header.append(FIN | opcode)
120 | header.append(PAYLOAD_LEN_EXT16)
121 | header.extend(struct.pack(">H", payload_length))
122 |
123 | # Huge extended payload
124 | elif payload_length < 18446744073709551616:
125 | header.append(FIN | opcode)
126 | header.append(PAYLOAD_LEN_EXT64)
127 | header.extend(struct.pack(">Q", payload_length))
128 |
129 | else:
130 | raise Exception("Message is too big. Consider breaking it into chunks.")
131 | return
132 |
133 | return header + payload
134 |
135 |
136 | def parse_data(msg):
137 | """数据解析
138 | 丶固定部分 ‘\x81’
139 | 丶报文内容长度
140 | 小于127, 填充8bit表示内容长度
141 | 小于2^16-1, 填充第一个8bit为126的十六进制表示,后面16bit表示内容长度
142 | 小于2^64-1, 填充第一个8bit为127的十六进制表示,后面64bit表示内容长度
143 | 丶掩码mask
144 | mask由四字节组成
145 | 丶报文内容content
146 | """
147 | if not len(msg):
148 | return False
149 | length = msg[1] & 127
150 | if length == 126:
151 | mask = msg[4:8]
152 | raw = msg[8:]
153 | elif length == 127:
154 | mask = msg[10:14]
155 | raw = msg[14:]
156 | else:
157 | mask = msg[2:6]
158 | raw = msg[6:]
159 | ret = ''
160 | for cnt, d in enumerate(raw):
161 | ret += chr(d ^ mask[cnt % 4])
162 | return ret
163 |
164 |
165 | def parse_headers(msg):
166 | """头部解析"""
167 | headers = {}
168 | header, data = msg.decode().split('\r\n\r\n', 1)
169 | for line in header.split('\r\n')[1:]:
170 | key, value = line.split(': ', 1)
171 | headers[key] = value
172 | headers['data'] = data
173 | return headers
174 |
175 |
176 | def generate_token(msg):
177 | """生成key,用的公开的盐"""
178 | key = msg + '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'
179 | ser_key = hashlib.sha1(key.encode()).digest()
180 | return base64.b64encode(ser_key)
181 |
182 |
183 | ANDROID_USER_AGENT = "Mozilla/5.0 (Linux; Android 7.0; SM-C7010 Build/NRD90M; wv) \
184 | AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/48.0.2564.116 \
185 | Mobile Safari/537.36 T7/9.3 SearchCraft/2.0.0 (Baidu; P1 7.0)"
186 |
187 |
188 | def run_baidu_websocket(port=8880, max_thread=5):
189 | """websocket"""
190 | websocket_server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
191 | websocket_server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
192 | websocket_server.bind(('127.0.0.1', port))
193 | websocket_server.listen(max_thread)
194 | websocket_server.settimeout(None)
195 |
196 | print('> Running Server On Port: ', port)
197 | print('> Press Ctrl + [Pause/Break] to exit...\n')
198 |
199 | while True:
200 | connection, address = websocket_server.accept()
201 | try:
202 | data = connection.recv(1024)
203 | headers = parse_headers(data)
204 | token = generate_token(headers['Sec-WebSocket-Key'])
205 | connection.send(b'\
206 | HTTP/1.1 101 WebSocket Protocol Hybi-10\r\n\
207 | Upgrade: WebSocket\r\n\
208 | Connection: Upgrade\r\n\
209 | Sec-WebSocket-Accept: %s\r\n\r\n' % token)
210 | thread = websocket_thread(connection)
211 | thread.setDaemon(True)
212 | thread.start()
213 | except socket.timeout:
214 | print('websocket connection timeout')
215 | except KeyboardInterrupt:
216 | connection.close()
217 |
218 |
219 | if __name__ == '__main__':
220 | run_baidu_websocket(8880, 5)
221 |
--------------------------------------------------------------------------------
/allinone/baidu/baidu.js:
--------------------------------------------------------------------------------
1 | $(function() {
2 |
3 | document.cookie = "BAIDUCUID=0OSCilaABulxaHutluBS8_ae2t_Ruv8NliHgigiTvaKQLBd5B; domain=.baidu.com; path=/;";
4 | document.cookie = "BAIDUID=5F187DAC496719041F90FD90536CCC9F:FG=1; domain=.baidu.com; path=/;";
5 |
6 | // 获取动态生成的XC码
7 | var xc = '';
8 | $.ajax({
9 | type: 'get',
10 | async: false,
11 | url:'baidu/answer?app=xiguashipin',
12 | success: (data)=> {
13 | xc = data.match(/xc: \'(.*?)\'/)[1]
14 | }
15 | });
16 |
17 | /* function parseUrl() {
18 | var query = {};
19 | var urlSearch = window.location.search || "";
20 | var queryStr = urlSearch.split("?")[1];
21 | if (queryStr) {
22 | var queryArr = queryStr.split("&");
23 | queryArr.forEach(function(val) {
24 | var key = val.split("=")[0];
25 | var value = val.split("=")[1];
26 | if (key && value) {
27 | query[key] = decodeURIComponent(value);
28 | }
29 | });
30 | }
31 | return query;
32 | }
33 | function urlMaker() {
34 | var url = "https://selab.baidu.com/nv/{path}/answer";
35 | var path = parseUrl().app;
36 | if (path) {
37 | url = url.replace("{path}", path);
38 | } else {
39 | url = "https://selab.baidu.com/nv/xiguashipin/answer";
40 | }
41 | return url;
42 | }
43 |
44 | var url = urlMaker();
45 | var socket = io.connect(url, {
46 | path: "/nv/answer.sock",
47 | transports: ['websocket'],
48 | query: {
49 | xc: xc
50 | }
51 | });
52 | socket.on("answer", function(data) { */
53 | ws = new WebSocket("ws://localhost:8880/baidu-websocket");
54 | ws.onopen = function (msg) {
55 | console.log('webSocket opened');
56 | };
57 | ws.onerror = function (error) {
58 | console.log('error :' + error.name + error.number);
59 | };
60 |
61 | ws.onclose = function () {
62 | console.log('webSocket closed');
63 | };
64 | ws.onmessage = function (message) {
65 | // console.log('receive message : ' + message.data);
66 | data_str = message.data.match(/nv\/xiguashipin\/answer,(.*)$/)[1]
67 | data = eval(data_str)[1]
68 | if (data.step == 0) {
69 | data.options = data.answers.map((answer) => {
70 | return answer.text;
71 | });
72 | data.question.round = data.question.questionId
73 | $.ajax({
74 | type:'POST',
75 | url:'reply-answer-baidu',
76 | headers: {
77 | "Content-Type": "application/json;charset=utf-8",
78 | "dataType": "json"
79 | },
80 | data: JSON.stringify(data),
81 | success:function(response,status,xhr){
82 | // console.log("reply success ..." + JSON.stringify(data));
83 | }
84 | });
85 | stepOne(data);
86 | } else if (data.step == 1) {
87 | stepTow(data);
88 | } else if (data.step == 2) {
89 | if (data.result === 9999) return;
90 | var totalProp = 0
91 | data.options = data.answers.map((answer, index) => {
92 | totalProp += answer.prop;
93 | return answer.text;
94 | });
95 | data.results = data.answers.map((answer) => {
96 | answer.prop = parseFloat((answer.prop / totalProp).toFixed(2))
97 | return answer
98 | });
99 | data.question.round = data.question.questionId
100 | $.ajax({
101 | type:'POST',
102 | url:'reply-answer-baidu',
103 | headers: {
104 | "Content-Type": "application/json;charset=utf-8",
105 | "dataType": "json"
106 | },
107 | data: JSON.stringify(data),
108 | success:function(response,status,xhr){
109 | // console.log("reply success ..." + JSON.stringify(data));
110 | }
111 | });
112 | stepThree(data);
113 | } else if (data.step == 3) {
114 | stepFour(data);
115 | } else if (data.step == 5) {
116 | nostart();
117 | } else {
118 | steperror();
119 | }
120 | };
121 | function stepOne(data) {
122 | spliHtml(
123 | data.question.questionId + "." + data.question.text,
124 | data.answers,
125 | "社会我Dan哥,人美话还多"
126 | );
127 | $(".loaddingbox").removeClass("noshow");
128 | }
129 |
130 | function stepTow(data) {
131 | spliHtml(
132 | data.question.questionId + "." + data.question.text,
133 | data.answers,
134 | data.tips
135 | );
136 | }
137 |
138 | function stepThree(data) {
139 | spliHtml(
140 | data.question.questionId + "." + data.question.text,
141 | data.answers,
142 | data.tips,
143 | Number(data.result) + 1
144 | );
145 | $(".loaddingbox").addClass("noshow");
146 | }
147 |
148 | function stepFour(data) {
149 | endshow(
150 | data.question.questionId + "." + data.question.text,
151 | data.answers,
152 | data.tips,
153 | { dqa: data.result, finalindex: data.final_index }
154 | );
155 | }
156 |
157 | var scrollStart = 0;
158 | function nostart(data) {
159 | var html = [
160 | '',
161 | '
我是机器哥dandan,外号Dan哥
',
162 | '
欢迎围观我的答题直播
',
163 | '
通过答题来锻炼我的AI大脑
',
164 | '
百分比是我分析的答案准确率
',
165 | '
红色突出答案是我最终的选择
',
166 | '
请大家给我加油,老铁666
',
167 | "
"
168 | ].join("");
169 | if (!scrollStart) {
170 | spliHtml(
171 | "Dan哥热身中,题目还在路上...",
172 | [
173 | { text: "暂无答案", prop: "0" },
174 | { text: "暂无答案", prop: "0" },
175 | { text: "暂无答案", prop: "0" }
176 | ],
177 | html
178 | );
179 | scrollStart = 1;
180 | scrollAnimateTimer = setInterval(talkAnimate, 2500);
181 | }
182 | }
183 |
184 | function steperror(data) {}
185 | // 页面刷新时时
186 | function spliHtml(title, answer, showText, high) {
187 | clearInterval(scrollAnimateTimer);
188 | scrollStart = 0;
189 | // 显示title部分
190 | $(".querytitle").html(title);
191 | // 拼接答案list
192 | var answerStr = "";
193 | var chose = ["A. ", "B. ", "C. ", "D. "];
194 | for (var i = 0; i < answer.length; i++) {
195 | if (high - 1 !== 9999) {
196 | answerStr +=
197 | "" +
198 | chose[i] +
199 | answer[i].text +
200 | "" +
201 | answer[i].prop +
202 | "%
";
203 | } else {
204 | answerStr +=
205 | "" +
206 | chose[i] +
207 | answer[i].text +
208 | "" +
209 | answer[i].prop +
210 | "
";
211 | }
212 | }
213 | $(".answerBox").html(answerStr);
214 |
215 | $(".broadcast-text").html(showText);
216 |
217 | if (high && high - 1 !== 9999) {
218 | $($(".answerText").get(high - 1)).addClass("active highborder");
219 | }
220 | }
221 |
222 | function endshow(title, answer, showText, high) {
223 | clearInterval(scrollAnimateTimer);
224 | // 显示title部分
225 | $(".querytitle").html(title);
226 | // 拼接答案list
227 | var answerStr = "";
228 | var chose = ["A. ", "B. ", "C. ", "D. "];
229 | for (var i = 0; i < answer.length; i++) {
230 | var propText = "";
231 | var boxClass = "";
232 | if (i == high.finalindex) {
233 | propText = "正确";
234 | boxClass = "answerText hiok";
235 | } else if (
236 | i == Number(high.dqa) &&
237 | high.finalindex !== Number(high.dqa)
238 | ) {
239 | propText = "错误";
240 | boxClass = "answerText active";
241 | } else {
242 | boxClass = "answerText";
243 | }
244 | answerStr +=
245 | "" +
248 | chose[i] +
249 | answer[i].text +
250 | "" +
251 | propText +
252 | "
";
253 | }
254 | $(".answerBox").html(answerStr);
255 | $(".broadcast-text").html(showText);
256 | }
257 |
258 | // 首页播报动
259 | var boxTran = $(".broadcast-text-wrap");
260 | var tranValue = 0;
261 | var maxHeight = boxTran.offset().height;
262 | var perStep = boxTran.find(".broadcast-text-animite").offset().height;
263 | var scrollAnimateTimer;
264 | function talkAnimate() {
265 | boxTran = $(".broadcast-text-wrap");
266 | if (boxTran.find(".broadcast-text-animite").length == 0) {
267 | return;
268 | }
269 | maxHeight = boxTran.offset().height;
270 | perStep = 22;
271 | tranValue = tranValue - perStep;
272 | if (tranValue + maxHeight <= 0) {
273 | tranValue = 0;
274 | boxTran.css({ transform: "translateY(0px)" });
275 | } else {
276 | boxTran.css({ transform: "translateY(" + tranValue + "px)" });
277 | }
278 | }
279 | });
280 |
--------------------------------------------------------------------------------
/allinone/uc/static/js/chunk.2.60.js:
--------------------------------------------------------------------------------
1 | webpackJsonp([2], {
2 | 464: function(t, e, i) {
3 | function n(t) {
4 | i(474), i(476);
5 | }
6 | var a = i(49)(i(480), i(510), n, "data-v-535211f0", null);
7 | t.exports = a.exports;
8 | },
9 | 474: function(t, e, i) {
10 | var n = i(475);
11 | "string" == typeof n && (n = [[t.i, n, ""]]),
12 | n.locals && (t.exports = n.locals);
13 | i(462)("4973630a", n, !0);
14 | },
15 | 475: function(t, e, i) {
16 | (e = t.exports = i(461)(!0)),
17 | e.push([
18 | t.i,
19 | "",
20 | "",
21 | {
22 | version: 3,
23 | sources: [],
24 | names: [],
25 | mappings: "",
26 | file: "Index.vue",
27 | sourceRoot: ""
28 | }
29 | ]);
30 | },
31 | 476: function(t, e, i) {
32 | var n = i(477);
33 | "string" == typeof n && (n = [[t.i, n, ""]]),
34 | n.locals && (t.exports = n.locals);
35 | i(462)("3bb0678c", n, !0);
36 | },
37 | 477: function(t, e, i) {
38 | var n = i(463);
39 | (e = t.exports = i(461)(!0)),
40 | e.push([
41 | t.i,
42 | '.wrap[data-v-535211f0]{color:#fff;padding-bottom:30px}.wrap.no-p-b[data-v-535211f0]{padding-bottom:60px}.wrap .rule[data-v-535211f0]{text-align:left;margin:14px 30px}.wrap .rule p[data-v-535211f0]{font-weight:700}.wrap .rule>div[data-v-535211f0]{display:-webkit-box;display:-ms-flexbox;display:flex}.wrap .rule>div ul[data-v-535211f0]{-webkit-box-flex:1;-ms-flex:1;flex:1}.wrap .rule>div>div[data-v-535211f0]{padding-top:14px;margin-left:28px}@media screen and (max-width:320px){.wrap .rule[data-v-535211f0]{margin:15px 20px 14px}.wrap .rule>div>div[data-v-535211f0]{margin-left:8px}}.wrap .rule li[data-v-535211f0]{line-height:22px;margin-top:10px;position:relative;padding-left:15px;color:hsla(0,0%,100%,.9)}.wrap .rule li[data-v-535211f0]:before{content:"";position:absolute;left:0;top:10px;width:6px;height:6px;background:hsla(0,0%,100%,.4);border-radius:6px;display:inline-block}.wrap .split[data-v-535211f0]{height:6px;background:rgba(0,0,0,.12)}.wrap .list[data-v-535211f0]{padding:41px 30px 0}@media screen and (max-width:320px){.wrap .list[data-v-535211f0]{padding:20px 20px 0}}.wrap .trailer[data-v-535211f0]{color:#fff}.wrap .trailer.mb[data-v-535211f0]{padding-bottom:30px}.wrap .trailer ul[data-v-535211f0]{margin-top:6px}.wrap .trailer ul li[data-v-535211f0]{padding:14px 4px 14px 0;box-sizing:border-box;border-bottom:1px solid hsla(0,0%,100%,.1);background:url(' +
43 | n(i(478)) +
44 | ") no-repeat 100%;background-size:8px 15px}.wrap .trailer ul li[data-v-535211f0]:last-child{border:none}.wrap .trailer ul li>div[data-v-535211f0]{display:-webkit-box;display:-ms-flexbox;display:flex;height:34px;line-height:34px}.wrap .trailer ul li>div>div[data-v-535211f0]{text-align:right;-webkit-box-flex:1;-ms-flex:1;flex:1}.wrap .trailer ul li>div>div>div[data-v-535211f0]{display:inline-block;width:80px}.wrap .trailer ul li>div>span[data-v-535211f0]{display:block;font-size:18px;font-weight:700;height:100%;line-height:34px;padding-right:20px}.wrap .trailer .current[data-v-535211f0]{font-size:35px;line-height:36px;height:36px;display:-webkit-box;display:-ms-flexbox;display:flex;font-weight:700;margin:20px 0;position:relative}@media screen and (max-width:320px){.wrap .trailer .current[data-v-535211f0]{margin:20px 0}}.wrap .trailer .current span[data-v-535211f0]{display:block;text-align:center;position:relative}.wrap .trailer .current span[data-v-535211f0]:first-of-type{-webkit-box-flex:1;-ms-flex:1;flex:1;width:50%;padding-left:5px;text-align:left}.wrap .trailer .current span[data-v-535211f0]:nth-of-type(2){-webkit-box-flex:1;-ms-flex:1;flex:1;width:50%;padding-right:15px;text-align:right}@media screen and (max-width:320px){.wrap .trailer .current[data-v-535211f0]{font-size:30px}}.wrap .dream-list ul li[data-v-535211f0]{height:60px;margin-bottom:10px}.wrap .dream-list ul li a[data-v-535211f0]{display:-webkit-box;display:-ms-flexbox;display:flex;height:100%;width:100%}.wrap .dream-list ul li a .image[data-v-535211f0]{display:block;width:60px;background-repeat:no-repeat;background-position:50% 20%;background-size:cover}.wrap .dream-list ul li a .ctx[data-v-535211f0]{-webkit-box-flex:1;-ms-flex:1;flex:1;padding-right:20px;margin-left:10px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;background:url(" +
45 | n(i(479)) +
46 | ") no-repeat 100%;background-size:10px 18px}.wrap .dream-list ul li a .ctx p[data-v-535211f0]{text-align:left}.wrap .dream-list ul li a .ctx p[data-v-535211f0]:first-child{font-size:16px;font-weight:700}",
47 | "",
48 | {
49 | version: 3,
50 | sources: ["/Users/gml/mywork/gitlab/dream/src/views/dream/Index.vue"],
51 | names: [],
52 | mappings:
53 | "AACA,uBACE,WAAe,AACf,mBAAqB,CACtB,AACD,8BACI,mBAAqB,CACxB,AACD,6BACI,gBAAiB,AACjB,gBAAuB,CAC1B,AACD,+BACM,eAAkB,CACvB,AACD,iCACM,oBAAqB,AACrB,oBAAqB,AACrB,YAAc,CACnB,AACD,oCACQ,mBAAoB,AAChB,WAAY,AACR,MAAQ,CACvB,AACD,qCACQ,iBAAkB,AAClB,gBAAkB,CACzB,AACD,oCACA,6BACQ,qBAAuB,CAC9B,AACD,qCACU,eAAiB,CAC1B,CACA,AACD,gCACM,iBAAkB,AAClB,gBAAiB,AACjB,kBAAmB,AACnB,kBAAmB,AACnB,wBAAgC,CACrC,AACD,uCACQ,WAAY,AACZ,kBAAmB,AACnB,OAAU,AACV,SAAU,AACV,UAAW,AACX,WAAY,AACZ,8BAAqC,AACrC,kBAAmB,AACnB,oBAAsB,CAC7B,AACD,8BACI,WAAY,AACZ,0BAAgC,CACnC,AACD,6BACI,mBAA4B,CAC/B,AACD,oCACA,6BACQ,mBAA4B,CACnC,CACA,AACD,gCACI,UAAe,CAClB,AACD,mCACM,mBAAqB,CAC1B,AACD,mCACM,cAAgB,CACrB,AACD,sCACQ,wBAA2B,AAC3B,sBAAuB,AACvB,2CAAkD,AAClD,wDAA2E,AAC3E,wBAA0B,CACjC,AACD,iDACU,WAAa,CACtB,AACD,0CACU,oBAAqB,AACrB,oBAAqB,AACrB,aAAc,AACd,YAAa,AACb,gBAAkB,CAC3B,AACD,8CACY,iBAAkB,AAClB,mBAAoB,AAChB,WAAY,AACR,MAAQ,CAC3B,AACD,kDACc,qBAAsB,AACtB,UAAY,CACzB,AACD,+CACY,cAAe,AACf,eAAgB,AAChB,gBAAkB,AAClB,YAAa,AACb,iBAAkB,AAClB,kBAAoB,CAC/B,AACD,yCACM,eAAgB,AAChB,iBAAkB,AAClB,YAAa,AACb,oBAAqB,AACrB,oBAAqB,AACrB,aAAc,AACd,gBAAkB,AAClB,cAAiB,AACjB,iBAAmB,CACxB,AACD,oCACA,yCACU,aAAiB,CAC1B,CACA,AACD,8CACQ,cAAe,AACf,kBAAmB,AACnB,iBAAmB,CAC1B,AACD,4DACU,mBAAoB,AAChB,WAAY,AACR,OAAQ,AAChB,UAAW,AACX,iBAAkB,AAClB,eAAiB,CAC1B,AACD,6DACU,mBAAoB,AAChB,WAAY,AACR,OAAQ,AAChB,UAAW,AACX,mBAAoB,AACpB,gBAAkB,CAC3B,AACD,oCACA,yCACU,cAAgB,CACzB,CACA,AACD,yCACI,YAAa,AACb,kBAAoB,CACvB,AACD,2CACM,oBAAqB,AACrB,oBAAqB,AACrB,aAAc,AACd,YAAa,AACb,UAAY,CACjB,AACD,kDACQ,cAAe,AACf,WAAY,AACZ,4BAA6B,AAC7B,4BAA6B,AAC7B,qBAAuB,CAC9B,AACD,gDACQ,mBAAoB,AAChB,WAAY,AACR,OAAQ,AAChB,mBAAoB,AACpB,iBAAkB,AAClB,oBAAqB,AACrB,oBAAqB,AACrB,aAAc,AACd,wBAAyB,AACrB,qBAAsB,AAClB,uBAAwB,AAChC,4BAA6B,AAC7B,6BAA8B,AAC1B,0BAA2B,AACvB,sBAAuB,AAC/B,wDAA8E,AAC9E,yBAA2B,CAClC,AACD,kDACU,eAAiB,CAC1B,AACD,8DACY,eAAgB,AAChB,eAAkB,CAC7B",
54 | file: "Index.vue",
55 | sourcesContent: [
56 | '\n.wrap[data-v-535211f0] {\n color: #ffffff;\n padding-bottom: 30px;\n}\n.wrap.no-p-b[data-v-535211f0] {\n padding-bottom: 60px;\n}\n.wrap .rule[data-v-535211f0] {\n text-align: left;\n margin: 14px 30px 14px;\n}\n.wrap .rule p[data-v-535211f0] {\n font-weight: bold;\n}\n.wrap .rule > div[data-v-535211f0] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.wrap .rule > div ul[data-v-535211f0] {\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n}\n.wrap .rule > div > div[data-v-535211f0] {\n padding-top: 14px;\n margin-left: 28px;\n}\n@media screen and (max-width: 320px) {\n.wrap .rule[data-v-535211f0] {\n margin: 15px 20px 14px;\n}\n.wrap .rule > div > div[data-v-535211f0] {\n margin-left: 8px;\n}\n}\n.wrap .rule li[data-v-535211f0] {\n line-height: 22px;\n margin-top: 10px;\n position: relative;\n padding-left: 15px;\n color: rgba(255, 255, 255, 0.9);\n}\n.wrap .rule li[data-v-535211f0]::before {\n content: "";\n position: absolute;\n left: 0px;\n top: 10px;\n width: 6px;\n height: 6px;\n background: rgba(255, 255, 255, 0.4);\n border-radius: 6px;\n display: inline-block;\n}\n.wrap .split[data-v-535211f0] {\n height: 6px;\n background: rgba(0, 0, 0, 0.12);\n}\n.wrap .list[data-v-535211f0] {\n padding: 41px 30px 0px 30px;\n}\n@media screen and (max-width: 320px) {\n.wrap .list[data-v-535211f0] {\n padding: 20px 20px 0px 20px;\n}\n}\n.wrap .trailer[data-v-535211f0] {\n color: #ffffff;\n}\n.wrap .trailer.mb[data-v-535211f0] {\n padding-bottom: 30px;\n}\n.wrap .trailer ul[data-v-535211f0] {\n margin-top: 6px;\n}\n.wrap .trailer ul li[data-v-535211f0] {\n padding: 14px 4px 14px 0px;\n box-sizing: border-box;\n border-bottom: 1px solid rgba(255, 255, 255, 0.1);\n background: url("../../assets/img/right-arrow.png") no-repeat right center;\n background-size: 8px 15px;\n}\n.wrap .trailer ul li[data-v-535211f0]:nth-last-child(1) {\n border: none;\n}\n.wrap .trailer ul li > div[data-v-535211f0] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n height: 34px;\n line-height: 34px;\n}\n.wrap .trailer ul li > div > div[data-v-535211f0] {\n text-align: right;\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n}\n.wrap .trailer ul li > div > div > div[data-v-535211f0] {\n display: inline-block;\n width: 80px;\n}\n.wrap .trailer ul li > div > span[data-v-535211f0] {\n display: block;\n font-size: 18px;\n font-weight: bold;\n height: 100%;\n line-height: 34px;\n padding-right: 20px;\n}\n.wrap .trailer .current[data-v-535211f0] {\n font-size: 35px;\n line-height: 36px;\n height: 36px;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n font-weight: bold;\n margin: 20px 0px;\n position: relative;\n}\n@media screen and (max-width: 320px) {\n.wrap .trailer .current[data-v-535211f0] {\n margin: 20px 0px;\n}\n}\n.wrap .trailer .current span[data-v-535211f0] {\n display: block;\n text-align: center;\n position: relative;\n}\n.wrap .trailer .current span[data-v-535211f0]:nth-of-type(1) {\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n width: 50%;\n padding-left: 5px;\n text-align: left;\n}\n.wrap .trailer .current span[data-v-535211f0]:nth-of-type(2) {\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n width: 50%;\n padding-right: 15px;\n text-align: right;\n}\n@media screen and (max-width: 320px) {\n.wrap .trailer .current[data-v-535211f0] {\n font-size: 30px;\n}\n}\n.wrap .dream-list ul li[data-v-535211f0] {\n height: 60px;\n margin-bottom: 10px;\n}\n.wrap .dream-list ul li a[data-v-535211f0] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n height: 100%;\n width: 100%;\n}\n.wrap .dream-list ul li a .image[data-v-535211f0] {\n display: block;\n width: 60px;\n background-repeat: no-repeat;\n background-position: 50% 20%;\n background-size: cover;\n}\n.wrap .dream-list ul li a .ctx[data-v-535211f0] {\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n padding-right: 20px;\n margin-left: 10px;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n background: url("../../assets/img/right.png?__inline") no-repeat right center;\n background-size: 10px 18px;\n}\n.wrap .dream-list ul li a .ctx p[data-v-535211f0] {\n text-align: left;\n}\n.wrap .dream-list ul li a .ctx p[data-v-535211f0]:nth-child(1) {\n font-size: 16px;\n font-weight: bold;\n}\n'
57 | ],
58 | sourceRoot: ""
59 | }
60 | ]);
61 | },
62 | 478: function(t, e) {
63 | t.exports =
64 | "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAeCAYAAAAl+Z4RAAAAAXNSR0IArs4c6QAAAe1JREFUOBGdlcsrRHEYhucgopBIKWVBlIUFslCSlJFrKJEsFKEQ/gh7yTWXJllYKInIgg0hKZKkKOUvsHHJZTzvNDN1jHPmHF89vYf53scxzfmNx+/3e2EC8jz/mBg6CZAOI0jy3Tok2IZTkGgYSQHpeAxtUpKoG8rhA6YNw7glo05AoC0kuu6CCviEGSQ3pO2EBdoKSjq5rARJ5pBck5ZjEoS2EHVwXQVfMI/kKvTa7/xToCUk7UQ1SLKA5JKMGEuBNpG0ETXwDYtILkjT2Aq0iaSFqAVJlpGck+GJKtAmkiaiXpewguSMDIwjgTaRNBCNugQfkhPS41igZSR1RLMuYRXJsSsBJUm8RKuumVXXArWQ9BGl8KxnwNVQLqNQEiztuRJQLqbYA7rzTd6DA8cCykWUekGdHcq7ZOAHpe1QLmShH2Jhn/JWqBD1DijrlBqEODikvBEqK20FlHPZGYJ4OIJ1MI2lgHIOm8OQADry1vjr+gCZ5k8B5Wy2RiER9AT6KOthipgIAeUstlROAh0kS1ZlXjO/B5Qz+d0YJIPOQx0kOlAsJ3wHlPXdMA6pcAezlHUu2k5AQDmNLZWV96BjXcd71ImhnMKWyhnwCFOU30lHozsYAP3vTzBJ+Y10PPp0vcID6IvkxXEzuPgDlPulBZ/NaM4AAAAASUVORK5CYII=";
65 | },
66 | 479: function(t, e) {
67 | t.exports =
68 | "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAkCAYAAACJ8xqgAAAAAXNSR0IArs4c6QAAAklJREFUSA2dlVlPFEEQx3dgxQNDQDxBCW98CuOLcvoF+J4eMcYQEkATHkggISyJcYmJccXryYvV9fefdG96ijl6ppKijq36TXUz3ZMMBoO5Vqt1H5VsJ0nSTb2Gf0boE2zc6SMeMI/fWAQMJSF4CPRemKzjC7hjGpRbBDpj8lHhCHv2jspNUz1KvAz0tslXhumSgXao3DLVbeIVoDdMvjQc7iHQQyrfmOoLxKtAp02+MBwCVQF0H7Nrqi8SrwGdMvncMANUBdA9jDSUSwSCToTJPP8cUEVANeWBabhC/BjoVZPPhLlAVQB9jdG+hiKYoDoIuVIIdNXb2GPTqWVr+ZdNPg1LgUw5oErv6FvTPEksqPY2I6VAVTroBm5XcSDX8PVKjQW5ViVQxUD/YV6h7xUHch1fL7/e11SigKoE+hfzEv2gOJBb+EtAdbLiJvTNQPv4L9Cezzmri0QXyqiuq9ri9m2NRnvOjxoBNQFQvejrqG4mL/3oPfQdsloa5gEawvRTL91IebECTD2L6F3T8514o9aSK2BP+Kf9iAY62BJTzJrJvhEL9lP5KKCDLVNvvzNfyT31sChgBUyT/RLIS+mEwHSkNNkd3+DsF6wmy8D0WyHQwVaosV++QlghsAT2mSZN9lvNeXJuQmC6jjSZDn0olTAVZ4AOtkr+ZkjCP0WflU3m64fAEtgnB/vjm8psCnSwvNujFkwPagPT2cyD6c57zjKjJhNMItgCau+1j+QEO8PWkrzrqzFMTxawg56gut71uWw0GX2p/AeSRbsNZJUdGwAAAABJRU5ErkJggg==";
69 | },
70 | 480: function(t, e, i) {
71 | "use strict";
72 | function n(t) {
73 | return t && t.__esModule ? t : { default: t };
74 | }
75 | Object.defineProperty(e, "__esModule", { value: !0 });
76 | var a = i(116),
77 | A = n(a),
78 | r = i(117),
79 | l = i(50),
80 | o = n(l),
81 | p = i(175),
82 | s = i(173),
83 | d = n(s),
84 | C = i(176),
85 | u = n(C),
86 | c = i(471),
87 | x = n(c),
88 | f = i(469),
89 | B = n(f),
90 | v = i(472),
91 | g = n(v);
92 | e.default = {
93 | name: "index",
94 | mixins: [d.default],
95 | initData: d.default.initData,
96 | data: function() {
97 | return { staticTxtType: "", entryType: "" };
98 | },
99 | computed: (0, A.default)(
100 | {},
101 | (0, r.mapState)("index", {
102 | currentCC: function(t) {
103 | return t.currentCC;
104 | },
105 | nextCC: function(t) {
106 | return t.nextCC;
107 | },
108 | activities: function(t) {
109 | return t.activities;
110 | },
111 | reviewCC: function(t) {
112 | return t.reviewCC;
113 | },
114 | timeout: function(t) {
115 | return t.timeout;
116 | }
117 | }),
118 | {
119 | floatUC: function() {
120 | return this.isAndroid
121 | ? {
122 | title: "使用UC小窗神器",
123 | subTitle: "只要一台手机边看边答",
124 | button: { type: 8, text: "立即打开" }
125 | }
126 | : {
127 | title: "上UC搜“答题助手”",
128 | subTitle: "答题成功率再翻一倍",
129 | button: { type: 8, text: "立即打开" }
130 | };
131 | },
132 | bannerUC: function() {
133 | var t = "";
134 | return (
135 | (t = this.uc.isSupportFloat ? "点击开启" : "升级UC"),
136 | {
137 | title: "开启UC小窗答题",
138 | subTitle: "一台手机边看边答",
139 | button: { type: 1, text: t }
140 | }
141 | );
142 | },
143 | qrcodeUC: function() {
144 | return { button: { type: "7", text: "下载UC" } };
145 | },
146 | hasOtherAc: function() {
147 | return !o.default.isEmptyObject(this.activities);
148 | },
149 | hasCurCC: function() {
150 | return !o.default.isEmptyObject(this.currentCC);
151 | },
152 | title: function() {
153 | return this.activityTitle + " " + this.currentDate;
154 | },
155 | startTime: function() {
156 | return 1e3 * Number(this.activityStartTime);
157 | },
158 | staticTxt: function() {
159 | return this.staticTxtType ? "直播中,看答案" : "未开始, 别着急";
160 | },
161 | isAndroid: function() {
162 | return (0, l.isAndroid)();
163 | },
164 | isIOS: function() {
165 | return (0, l.isIOS)();
166 | },
167 | isSupportMiniWin: function() {
168 | if (!this.uc.isSupportFloat) return !1;
169 | }
170 | }
171 | ),
172 | methods: (0, A.default)(
173 | {},
174 | (0, r.mapActions)("index", ["updateCurrentCC", "updateTimeout"]),
175 | {
176 | entryMatch: function() {
177 | 1 == this.currentCC.status &&
178 | this.isStart() &&
179 | this.$router.push({
180 | name: "Match",
181 | params: { activity: this.activityName }
182 | });
183 | },
184 | entryReview: function(t) {
185 | this.$router.push({
186 | name: "Review",
187 | params: { activity: this.activityName, sid: t }
188 | });
189 | },
190 | href: function(t) {
191 | return location.href.replace(
192 | "activity=" + this.activityName,
193 | "activity=" + t.type
194 | );
195 | },
196 | back: function() {
197 | window.history.back();
198 | },
199 | updateStatus: function() {
200 | var t = this;
201 | if (0 == this.currentCC.status && "Index" == this.$route.name) {
202 | var e = setTimeout(function() {
203 | (0, p.getCurAnswer)(t.activityName)
204 | .then(function(e) {
205 | (e.reward = t.currentReward),
206 | (e.order = t.currentOrder),
207 | t.updateCurrentCC(e),
208 | 0 == t.currentCC.status
209 | ? t.updateStatus()
210 | : ((t.staticTxtType = 1),
211 | (t.entryType = 3),
212 | clearTimeout(t.timeout));
213 | })
214 | .catch(function(t) {});
215 | }, p.REFRESH.CUR);
216 | this.updateTimeout(e);
217 | } else
218 | 1 == this.currentCC.status &&
219 | ((this.staticTxtType = 1), (this.entryType = 3));
220 | },
221 | canStart: function() {
222 | return 1 == this.currentCC.status && this.isStart();
223 | },
224 | refresh: function() {
225 | var t = this,
226 | e = this.startTime,
227 | i = void 0,
228 | n = Date.now(),
229 | a = e - n;
230 | a < 1.5 * p.REFRESH.HOUR
231 | ? (a >= 10 * p.REFRESH.MINUTE
232 | ? (i = 3 * p.REFRESH.MINUTE)
233 | : a >= 3 * p.REFRESH.MINUTE && (i = p.REFRESH.MINUTE),
234 | console.log("频率" + i),
235 | i
236 | ? setTimeout(function() {
237 | t.refresh();
238 | }, i)
239 | : this.updateStatus())
240 | : setTimeout(function() {
241 | location.reload();
242 | }, p.REFRESH.HOUR);
243 | }
244 | }
245 | ),
246 | created: function() {
247 | this.canStart()
248 | ? ((this.staticTxtType = 1), (this.entryType = 3))
249 | : ((this.staticTxtType = 0), (this.entryType = 5));
250 | },
251 | mounted: function() {
252 | if (!this.startTime)
253 | return console.log("没有数据"), void this.$router.push("/error");
254 | (0 != this.currentCC.status && this.isStart()) || this.refresh();
255 | },
256 | components: {
257 | DBanner: u.default,
258 | DTitle: x.default,
259 | DButton: B.default,
260 | DUc: g.default
261 | }
262 | };
263 | },
264 | 510: function(t, e) {
265 | t.exports = {
266 | render: function() {
267 | var t = this,
268 | e = t.$createElement,
269 | i = t._self._c || e;
270 | return i(
271 | "div",
272 | { staticClass: "wrap", class: { "no-p-b": !t.uc.isUC } },
273 | [
274 | i(
275 | "div",
276 | { staticClass: "list" },
277 | [
278 | t.title ? i("d-title", { attrs: { title: t.title } }) : t._e(),
279 | t._v(" "),
280 | i(
281 | "div",
282 | {
283 | staticClass: "trailer",
284 | class: { mb: 0 == t.reviewCC.length }
285 | },
286 | [
287 | t.hasCurCC
288 | ? i("div", { staticClass: "current" }, [
289 | i("span", {
290 | domProps: { textContent: t._s(t.currentOrder) }
291 | }),
292 | t._v(" "),
293 | i("span", {
294 | domProps: { textContent: t._s(t.currentReward) }
295 | })
296 | ])
297 | : t._e(),
298 | t._v(" "),
299 | t.hasCurCC
300 | ? i("d-button", {
301 | attrs: { type: t.entryType, text: t.staticTxt },
302 | on: { click: t.entryMatch }
303 | })
304 | : t._e(),
305 | t._v(" "),
306 | t.reviewCC.length
307 | ? i(
308 | "ul",
309 | t._l(t.reviewCC, function(e, n) {
310 | return i(
311 | "li",
312 | {
313 | key: n,
314 | on: {
315 | click: function(i) {
316 | t.entryReview(e.sid);
317 | }
318 | }
319 | },
320 | [
321 | i("div", [
322 | i("span", {
323 | domProps: { textContent: t._s(e.order) }
324 | }),
325 | t._v(" "),
326 | i("span", {
327 | domProps: { textContent: t._s(e.reward) }
328 | }),
329 | t._v(" "),
330 | i("div", [
331 | i(
332 | "div",
333 | [
334 | i("d-button", {
335 | attrs: {
336 | type: "7",
337 | text: "回顾题目"
338 | },
339 | on: {
340 | click: function(i) {
341 | t.entryReview(e.sid);
342 | }
343 | }
344 | })
345 | ],
346 | 1
347 | )
348 | ])
349 | ])
350 | ]
351 | );
352 | })
353 | )
354 | : t._e()
355 | ],
356 | 1
357 | )
358 | ],
359 | 1
360 | ),
361 | t._v(" "),
362 | t._e(),
363 | t._v(" "),
364 | t.uc.isUC && t.isAndroid
365 | ? t._e()
366 | : i("div", { staticClass: "split" }),
367 | t._v(" "),
368 | i("div", { staticClass: "rule" }, [
369 | i("p", [t._v("答题助手使用方法")]),
370 | t._v(" "),
371 | i("div", [
372 | t._m(0),
373 | t._v(" "),
374 | t._e()
375 | ])
376 | ]),
377 | t._v(" "),
378 | t._e(),
379 | t._v(" "),
380 | t.hasOtherAc ? i("div", { staticClass: "split" }) : t._e(),
381 | t._v(" "),
382 | t.hasOtherAc
383 | ? i("div", { staticClass: "list dream-list" }, [
384 | i(
385 | "ul",
386 | t._l(t.activities, function(e, n) {
387 | return i("li", { key: n }, [
388 | i("a", { attrs: { href: t.href(e) } }, [
389 | i("span", {
390 | directives: [
391 | {
392 | name: "lazy",
393 | rawName: "v-lazy:background-image",
394 | value: e.icon,
395 | expression: "item.icon",
396 | arg: "background-image"
397 | }
398 | ],
399 | staticClass: "image"
400 | }),
401 | t._v(" "),
402 | i("div", { staticClass: "ctx" }, [
403 | i("p", {
404 | domProps: { textContent: t._s(e.cnname) }
405 | }),
406 | t._v(" "),
407 | e.order
408 | ? i("p", {
409 | domProps: { textContent: t._s(e.order) }
410 | })
411 | : t._e()
412 | ])
413 | ])
414 | ]);
415 | })
416 | )
417 | ])
418 | : t._e()
419 | ],
420 | 1
421 | );
422 | },
423 | staticRenderFns: [
424 | function() {
425 | var t = this,
426 | e = t.$createElement,
427 | i = t._self._c || e;
428 | return i("ul", [
429 | i("li", [
430 | t._v(
431 | "\n 答题助手将在答题直播过程中基于搜索大数据实时计算答案\n "
432 | )
433 | ]),
434 | t._v(" "),
435 | i("li", [
436 | t._v(
437 | "\n 用手机或电脑进入本页面,直播开始时点击按钮看答案,保持屏幕常亮页面将实时展示答案~\n "
438 | )
439 | ])
440 | ]);
441 | }
442 | ]
443 | };
444 | }
445 | });
446 | //# sourceMappingURL=chunk.2.60.js.map
447 |
--------------------------------------------------------------------------------
/allinone/sogou/weball/assets/js/app-assistant-v5-https-cheat-sheet-ef2e8d53.js:
--------------------------------------------------------------------------------
1 | ! function(n) {
2 | function e(t) {
3 | if (o[t]) return o[t].exports;
4 | var i = o[t] = {
5 | i: t,
6 | l: !1,
7 | exports: {}
8 | };
9 | return n[t].call(i.exports, i, i.exports, e), i.l = !0, i.exports
10 | }
11 | var o = {};
12 | e.m = n, e.c = o, e.d = function(n, o, t) {
13 | e.o(n, o) || Object.defineProperty(n, o, {
14 | configurable: !1,
15 | enumerable: !0,
16 | get: t
17 | })
18 | }, e.n = function(n) {
19 | var o = n && n.__esModule ? function() {
20 | return n.
21 | default
22 | } : function() {
23 | return n
24 | };
25 | return e.d(o, "a", o), o
26 | }, e.o = function(n, e) {
27 | return Object.prototype.hasOwnProperty.call(n, e)
28 | }, e.p = "/allinone/sogou/weball/assets/", e(e.s = 57)
29 | }({
30 | 1: function(n, e, o) {
31 | "use strict";
32 | ! function() {
33 | function n(n) {
34 | if (document.cookie.length > 0) {
35 | var e = document.cookie.indexOf(n + "=");
36 | if (-1 !== e) {
37 | var e = e + n.length + 1,
38 | o = document.cookie.indexOf(";", e);
39 | return -1 === o && (o = document.cookie.length), decodeURIComponent(document.cookie.substring(e, o))
40 | }
41 | }
42 | return ""
43 | }
44 | function e() {
45 | try {
46 | return window.JSInvoker.getMid()
47 | } catch (n) {
48 | return ""
49 | }
50 | }
51 | function o() {
52 | try {
53 | return window.JSInvoker.h5.getMid()
54 | } catch (n) {
55 | return ""
56 | }
57 | }
58 | function t() {
59 | try {
60 | var t = e() || o();
61 | return w && t ? t : n("SGS_FE_WAID")
62 | } catch (n) {
63 | return ""
64 | }
65 | }
66 | function i(n, e) {
67 | var o = {
68 | pv: d + "//sa.sogou.com/pv",
69 | cl: d + "//sa.sogou.com/cl"
70 | };
71 | window.SGS_FE_DATA && 0 === window.SGS_FE_DATA.NODE_ENV.indexOf("dev") && (o = {
72 | pv: "/pv",
73 | cl: "/cl"
74 | });
75 | }
76 | function r(n) {
77 |
78 | }
79 | function a(n) {
80 |
81 | }
82 | function s(n) {
83 | window.performance && window.performance.timing ? r(n) : a({
84 | productid: c.felab,
85 | page: n,
86 | type: "notiming"
87 | }), a({
88 | productid: c.felab,
89 | page: n,
90 | type: "oncePbPerformance"
91 | }), a(window.Worker ? {
92 | productid: c.felab,
93 | page: n,
94 | type: "Worker"
95 | } : {
96 | productid: c.felab,
97 | page: n,
98 | type: "noWorker"
99 | })
100 | }
101 | var c = {
102 | felab: "sgsdevfe"
103 | }, d = location.protocol;
104 | window.SgsPb = window.SgsPb || {};
105 | var u = window.SgsPb,
106 | l = navigator.userAgent,
107 | p = null !== l.match(/(ios)|(iphone)|(ipod)|(ipad)/i),
108 | h = null !== l.match(/android/i),
109 | w = null !== l.match(/sogousearch/i),
110 | g = h ? "android" : p ? "ios" : "unknown",
111 | f = w ? "sgs" : "";
112 | u.directPb = i, u.pbPerformance = s
113 | }()
114 | },
115 | 10: function(n, e, o) {
116 | n.exports = o.p + "images/xg_logo_none-6e22a37a.png"
117 | },
118 | 11: function(n, e, o) {
119 | n.exports = o.p + "images/logo_hj_none-b48d4e2f.png"
120 | },
121 | 12: function(n, e, o) {
122 | n.exports = o.p + "images/logo_zs_none-d72109e8.png"
123 | },
124 | 13: function(n, e, o) {
125 | n.exports = o.p + "images/logo_hjsm-cd0b8aed.png"
126 | },
127 | 2: function(n, e, o) {
128 | "use strict";
129 |
130 | function t(n, e, o) {
131 | if (!n) return console.log("Not exists"), !1;
132 | var t = null;
133 | document.addEventListener ? t = "addEventListener" : document.attachEvent && (t = "attachEvent", e = "on" + e), n[t](e, o)
134 | }
135 | function i(n) {
136 | return window.getComputedStyle(n, null)
137 | }
138 | function r(n, e) {
139 | var o = i(n),
140 | t = !0,
141 | r = !1,
142 | a = void 0;
143 | try {
144 | for (var s, c = _[Symbol.iterator](); !(t = (s = c.next()).done); t = !0) {
145 | var d = s.value,
146 | u = o.getPropertyValue("" + d + e);
147 | if (u) return u
148 | }
149 | } catch (n) {
150 | r = !0, a = n
151 | } finally {
152 | try {
153 | !t && c.
154 | return &&c.
155 | return ()
156 | } finally {
157 | if (r) throw a
158 | }
159 | }
160 | return !1
161 | }
162 | function a(n) {
163 | var e = n.split("(")[1],
164 | e = e.split(")")[0],
165 | e = e.split(","),
166 | o = e[0],
167 | t = e[1];
168 | e[2], e[3];
169 | return Math.round(Math.atan2(t, o) * (180 / Math.PI))
170 | }
171 | function s(n) {
172 | var e = r(n, "height");
173 | return -1 !== e.indexOf("px") && parseInt(e.split("px")[0])
174 | }
175 | function c(n) {
176 | n = n || window.event, n.preventDefault && n.preventDefault(), n.returnValue = !1
177 | }
178 | function d(n) {
179 | if (E[n.keyCode]) return c(n), !1
180 | }
181 | function u() {
182 | window.addEventListener && window.addEventListener("DOMMouseScroll", c, !1), window.onwheel = c, window.onmousewheel = document.onmousewheel = c, window.ontouchmove = c, document.onkeydown = d
183 | }
184 | function l() {
185 | window.removeEventListener && window.removeEventListener("DOMMouseScroll", c, !1), window.onmousewheel = document.onmousewheel = null, window.onwheel = null, window.ontouchmove = null, document.onkeydown = null
186 | }
187 | function p() {
188 | for (var n = 3, e = document.createElement("b"), o = e.all || []; e.innerHTML = "\x3c!--[if gt IE " + ++n + "]> 4 ? n : document.documentMode
190 | }
191 | function h(n, e, o, t, i) {
192 | var r = new Date,
193 | a = null;
194 | r.setTime(r.getTime() + 864e5 * o), a = n + "=" + encodeURIComponent(e) + ";expires=" + r.toUTCString(), t && (a += ";path=" + t), i && (a += ";domain=" + i), document.cookie = a
195 | }
196 | function w(n, e, o) {
197 | var t = new Date;
198 | t.setTime(t.getTime() - 1e4);
199 | var i = [n, "=nothing;expires=", t.toGMTString()];
200 | e && i.push(";domain=" + e), o && i.push(";path=" + o), document.cookie = i.join("")
201 | }
202 | function g(n) {
203 | if (document.cookie.length <= 0) return "";
204 | var e = document.cookie.indexOf(n + "=");
205 | if (-1 === e) return "";
206 | e = e + n.length + 1;
207 | var o = document.cookie.indexOf(";", e);
208 | o = -1 === o ? document.cookie.length : o;
209 | try {
210 | return decodeURIComponent(document.cookie.substring(e, o))
211 | } catch (n) {
212 | return ""
213 | }
214 | }
215 | function f(n, e) {
216 | -1 === n.className.indexOf(e) && (n.className += e)
217 | }
218 | function v(n, e) {
219 | var o = n.className;
220 | if (-1 !== o.indexOf(e)) {
221 | var t = o.split(" ");
222 | t.splice(t.indexOf(e), 1), n.className = t.join(" ")
223 | }
224 | }
225 | function m(n, e, o) {
226 | return e *= 2, o *= 2, ["http://img03.sogoucdn.com/v2/thumb", "/resize/w/" + e + "/h/" + o + "/t/2", "/crop/y/0/w/" + e + "/h/" + o, "/retype/ext/auto/q/75", "?appid=200556&url=" + encodeURIComponent(n)].join("")
227 | }
228 | function S(n, e) {
229 | var o = n.width,
230 | t = o / e;
231 | n.style.height = t + "px", n.style.width = o + "px", n.style.background = "#e2e2e2"
232 | }
233 | function y(n) {
234 | if (!Number.isInteger(n) || n <= 9999) return n;
235 | return n % 1e4 == 0 ? Math.floor(n / 1e4) + "w" : n % 1e3 == 0 ? Math.floor(n / 1e3) / 10 + "w" : n > 1e3 * Math.floor(n / 1e3) ? (Math.floor(n / 1e3) + 1) / 10 + "w" : Math.floor(n / 1e3) / 10 + "w"
236 | }
237 | function k(n) {
238 | for (var e = n || 5, o = "", t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", i = t.length, r = 0; r < e; r++) o += t.charAt(Math.floor(Math.random() * i));
239 | return o
240 | }
241 | var I = window.navigator.userAgent,
242 | b = /(ios)|(iphone)|(ipad)|(ipod)/i.test(I),
243 | J = /android/i.test(I),
244 | A = /sogousearch/i.test(I),
245 | T = /micromessenger/i.test(I),
246 | P = J ? "android" : b ? "ios" : "unknown",
247 | x = {
248 | ua: I,
249 | isIos: b,
250 | isAndroid: J,
251 | isSgs: A,
252 | isWechat: T,
253 | osType: P
254 | }, _ = ["-webkit-", "-moz-", "-ms-", "-o-", ""],
255 | C = {
256 | timeout: {
257 | response: 3e3,
258 | deadline: 6e3
259 | }
260 | }, N = {
261 | sgs: "appsearch"
262 | };
263 | Number.isInteger = Number.isInteger || function(n) {
264 | return "number" == typeof n && isFinite(n) && Math.floor(n) === n
265 | }, Array.isArray = Array.isArray || function(n) {
266 | return "[object Array]" === Object.prototype.toString.call(n)
267 | };
268 | var E = {
269 | 37: 1,
270 | 38: 1,
271 | 39: 1,
272 | 40: 1
273 | }, O = function() {
274 | var n = 0;
275 | return window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(e) {
276 | var o, t = (new Date).getTime();
277 | return o = Math.max(0, 16 - (t - n)), n = t + o, setTimeout(function() {
278 | e(t + o)
279 | }, o)
280 | }
281 | }();
282 | n.exports = {
283 | uaInfo: x,
284 | superagentConfig: C,
285 | pidMapper: N,
286 | defaultBase64Img: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP4+u37PwAJpwPhC2EnZwAAAABJRU5ErkJggg==",
287 | getComputedStyle: i,
288 | getPropertyValue: r,
289 | getRotateAngle: a,
290 | getHeight: s,
291 | disableScroll: u,
292 | enableScroll: l,
293 | getIENumber: p,
294 | setCookie: h,
295 | getCookie: g,
296 | delCookie: w,
297 | addClass: f,
298 | removeClass: v,
299 | on: t,
300 | yuntuProcess: m,
301 | processPostInt: y,
302 | imgError: S,
303 | rAFShim: O,
304 | makeID: k
305 | }
306 | },
307 | 4: function(n, e) {},
308 | 5: function(n, e, o) {
309 | "use strict";
310 | ! function() {
311 | window.SgsAPI = window.SgsAPI || {};
312 | var n = window.SgsAPI,
313 | e = navigator.userAgent,
314 | o = null !== e.match(/(ios)|(iphone)|(ipad)|(ipod)/i),
315 | t = null !== e.match(/android/i),
316 | i = !1,
317 | r = function(n) {
318 | try {
319 | JSON.parse(n)
320 | } catch (n) {}
321 | };
322 | n.init = function(e, o) {
323 | i || (n.initAllAPIs(e, o), i = !0)
324 | }, n.initAllAPIs = function(e, i) {
325 | if (o) {
326 | if (!i && !window.JSInvoker) return !1;
327 | n.sgsGetVersionCode = function() {
328 | try {
329 | if (window.JSInvoker.h5) {
330 | if (window.JSInvoker.h5.getVersionCode) return window.JSInvoker.h5.getVersionCode()
331 | } else if (window.JSInvoker.getVersionCode) return window.JSInvoker.getVersionCode()
332 | } catch (n) {
333 | return ""
334 | }
335 | }, n.openBookshelf = function() {
336 | try {
337 | window.JSInvoker.novel.openBookshelf()
338 | } catch (n) {}
339 | }, n.showToast = function(n) {
340 | setTimeout(function() {
341 | try {
342 | window.JSInvoker.toast(n)
343 | } catch (n) {}
344 | }, 5)
345 | }, n.openAnotherPage = function(n, e, o) {
346 | try {
347 | "novel" === n ? window.JSInvoker.openAnotherPage(n, encodeURIComponent(e)) : window.JSInvoker.openAnotherPage(n, e)
348 | } catch (n) {}
349 | }, n.showToast = function(n) {
350 | setTimeout(function() {
351 | try {
352 | window.JSInvoker.toast(n)
353 | } catch (n) {}
354 | }, 5)
355 | }, n.sgs = {
356 | shareToWechat: function(n, e) {
357 | try {
358 | window.JSInvoker.shareToWeixin ? window.JSInvoker.shareToWeixin(n, e) : window.JSInvoker.h5 && window.JSInvoker.h5.shareToWeixin && window.JSInvoker.h5.shareToWeixin(n, e)
359 | } catch (n) {}
360 | },
361 | shareToQQ: function(n, e) {
362 | try {
363 | window.JSInvoker.shareToQQ ? window.JSInvoker.shareToQQ(n, e) : window.JSInvoker.h5 && window.JSInvoker.h5.shareToQQ && window.JSInvoker.h5.shareToQQ(n, e)
364 | } catch (n) {}
365 | },
366 | shareToQzone: function(n, e) {
367 | try {
368 | window.JSInvoker.shareToQzone ? window.JSInvoker.shareToQzone(n, e) : window.JSInvoker.h5 && window.JSInvoker.h5.shareToQzone && window.JSInvoker.h5.shareToQzone(n, e)
369 | } catch (n) {}
370 | },
371 | shareToWeibo: function(n, e) {
372 | try {
373 | window.JSInvoker.shareToWeibo ? window.JSInvoker.shareToWeibo(n, e) : window.JSInvoker.h5 && window.JSInvoker.h5.shareToWeibo && window.JSInvoker.h5.shareToWeibo(n, e)
374 | } catch (n) {}
375 | },
376 | shareToCustomed: function(e, o, t) {
377 | var i = o.title || "搜狗搜索",
378 | r = o.desc || "搜狗搜索",
379 | a = o.icon || "http://app.sastatic.sogoucdn.com/logo/sogou.png",
380 | s = o.link || "http://sa.sogou.com";
381 | "wechat" === e || "Wechat" === e ? n.sgs.shareToWechat(JSON.stringify({
382 | title: i,
383 | description: r,
384 | img_url: a,
385 | url: s
386 | }), t) : "moment" === e || "Moment" === e ? n.sgs.shareToWechat(JSON.stringify({
387 | title: r,
388 | description: i,
389 | img_url: a,
390 | url: s,
391 | to_app: 8
392 | }), t) : "weibo" === e || "Weibo" === e ? n.sgs.shareToWeibo(JSON.stringify({
393 | title: r,
394 | description: i,
395 | img_url: a,
396 | url: s
397 | }), t) : "qq" === e || "Qq" === e ? n.sgs.shareToQQ(JSON.stringify({
398 | title: i,
399 | description: r,
400 | img_url: a,
401 | url: s
402 | }), t) : "qzone" !== e && "Qzone" !== e || n.sgs.shareToQzone(JSON.stringify({
403 | title: i,
404 | description: r,
405 | img_url: a,
406 | url: s
407 | }), t)
408 | }
409 | }, n.sgsIsNovelSub = function(n, e) {
410 | try {
411 | setTimeout(function() {
412 | window.JSInvoker.novel.isNovelSub(n, e)
413 | }, 5)
414 | } catch (n) {}
415 | }, n.addOriginalNovelItem = function(n, e) {
416 | try {
417 | window.JSInvoker.novel.addBook(n, e)
418 | } catch (n) {}
419 | }, n.addBookNovelVr = function(n, e) {
420 | try {
421 | window.JSInvoker.novel.addBookNovelVr(n, e)
422 | } catch (n) {}
423 | }, n.openFeedPage = function(n) {
424 | try {
425 | window.JSInvoker.weixin && window.JSInvoker.weixin.openWeixinNews ? window.JSInvoker.weixin.openWeixinNews(n) : window.JSInvoker.openWeixinNews(n)
426 | } catch (e) {
427 | r(n)
428 | }
429 | }, n.sgs.openAppScan = function(n) {}, n.sgs.openChannel = function(n) {}, n.sgs.openCartoonPage = function() {}
430 | } else if (t) {
431 | if (!i && !window.JSInvoker) return !1;
432 | n.openDatiAlertWindow = function() {
433 | try {
434 | return window.JSInvoker.openDatiAlertWindow()
435 | } catch (n) {
436 | return ""
437 | }
438 | }, n.sgsGetVersionCode = function() {
439 | debugger;
440 | try {
441 | return window.JSInvoker.getVersionCode()
442 | } catch (n) {
443 | return ""
444 | }
445 | }, n.openBookshelf = function() {
446 | try {
447 | window.JSInvoker.openBookshelf()
448 | } catch (n) {}
449 | }, n.showToast = function(n) {
450 | try {
451 | window.JSInvoker.showToast(n)
452 | } catch (n) {}
453 | }, n.openAnotherPage = function(n, e, o) {
454 | try {
455 | "novel" === n || "mishuo" === n ? window.JSInvoker.openAnotherPage(n, e) : "cartoon" === n && window.JSInvoker.cartoonOpenUrl(e, o)
456 | } catch (n) {}
457 | }, n.showToast = function(n) {
458 | try {
459 | window.JSInvoker.showToast(n)
460 | } catch (n) {}
461 | }, n.sgs = {
462 | shareToWechat: function(n, e) {
463 | try {
464 | window.JSInvoker.shareToWeixin(n, e)
465 | } catch (n) {}
466 | },
467 | shareToQQ: function(n, e) {
468 | try {
469 | window.JSInvoker.shareToQQ(n, e)
470 | } catch (n) {}
471 | },
472 | shareToQzone: function(n, e) {
473 | try {
474 | window.JSInvoker.shareToQzone(n, e)
475 | } catch (n) {}
476 | },
477 | shareToWeibo: function(n, e) {
478 | try {
479 | window.JSInvoker.shareToWeibo(n, e)
480 | } catch (n) {}
481 | },
482 | shareToCustomed: function(e, o, t) {
483 | var i = o.title || "搜狗搜索",
484 | r = o.desc || "搜狗搜索",
485 | a = o.icon || "http://app.sastatic.sogoucdn.com/logo/sogou.png",
486 | s = o.link || "http://sa.sogou.com";
487 | "wechat" === e || "Wechat" === e ? n.sgs.shareToWechat(JSON.stringify({
488 | title: i,
489 | description: r,
490 | img_url: a,
491 | url: s,
492 | to_app: 1
493 | }), t) : "moment" === e || "Moment" === e ? n.sgs.shareToWechat(JSON.stringify({
494 | title: i,
495 | description: r,
496 | img_url: a,
497 | url: s,
498 | to_app: 8
499 | }), t) : "weibo" === e || "Weibo" === e ? n.sgs.shareToWeibo(JSON.stringify({
500 | title: i,
501 | description: r,
502 | img_url: a,
503 | url: s
504 | }), t) : "qq" === e || "Qq" === e ? n.sgs.shareToQQ(JSON.stringify({
505 | title: i,
506 | description: r,
507 | img_url: a,
508 | url: s
509 | }), t) : "qzone" !== e && "Qzone" !== e || n.sgs.shareToQzone(JSON.stringify({
510 | title: i,
511 | description: r,
512 | img_url: a,
513 | url: s
514 | }), t)
515 | }
516 | }, n.sgsIsNovelSub = function(n, e) {
517 | try {
518 | return window.JSInvoker.isNovelSub(n)
519 | } catch (n) {}
520 | }, n.sgsAddGiftNovel = function(n, e) {
521 | try {
522 | return window.JSInvoker.addGiftNovel(n, e)
523 | } catch (n) {}
524 | }, n.addOriginalNovelItem = function(n, e) {
525 | try {
526 | window.JSInvoker.addNovelItem(n, e)
527 | } catch (n) {}
528 | }, n.addBookNovelVr = function(n, e, o) {
529 | try {
530 | window.JSInvoker.addVrNovel(n, e, o)
531 | } catch (n) {}
532 | }, n.openFeedPage = function(n) {
533 | try {
534 | window.JSInvoker.weixin_openWeixinNews(n)
535 | } catch (e) {
536 | r(n)
537 | }
538 | }, n.sgs.openAppScan = function(n) {
539 | try {
540 | window.JSInvoker.openQRCode(n)
541 | } catch (n) {
542 | console.log(n)
543 | }
544 | }, n.sgs.openChannel = function(n) {
545 | try {
546 | window.JSInvoker.openChannelUrl(JSON.stringify(n))
547 | } catch (n) {
548 | console.log(n)
549 | }
550 | }, n.sgs.openCartoonPage = function() {
551 | try {
552 | window.JSInvoker.openCartoonPage()
553 | } catch (n) {
554 | console.log(n)
555 | }
556 | }
557 | }
558 | n.getMid = function() {
559 | try {
560 | return window.JSInvoker.getMid()
561 | } catch (n) {
562 | return ""
563 | }
564 | }, e && e()
565 | }, n.forgeAllAPIs = function(e) {
566 | n.getMid = function() {
567 | return "65b5teaera"
568 | }, n.openFeedPage = function(n) {
569 | try {
570 | console.group("微信阅读页"), console.log(n), console.groupEnd()
571 | } catch (e) {
572 | console.log("微信阅读页"), console.log(n)
573 | }
574 | }, n.sgs = {}, n.sgs.shareToCustomed = function(n, e, o) {
575 | try {
576 | console.group("独立分享接口"), console.log(n), console.log(e), console.log(o), console.groupEnd()
577 | } catch (t) {
578 | console.log("独立分享接口"), console.log(n), console.log(e), console.log(o)
579 | }
580 | }, n.sgs.openAppScan = function(n) {
581 | try {
582 | console.group("打开后置摄像头扫描功能"), console.log(n), console.groupEnd()
583 | } catch (e) {
584 | console.log("打开后置摄像头扫描功能"), console.log(n)
585 | }
586 | }, n.sgs.openChannel = function(n) {
587 | try {
588 | console.group("打开垂搜页面"), console.log(JSON.stringify(n)), console.groupEnd()
589 | } catch (e) {
590 | console.log("打开垂搜页面"), console.log(n)
591 | }
592 | }, n.sgs.openCartoonPage = function() {
593 | try {
594 | console.group("打开native漫画垂搜"), console.groupEnd()
595 | } catch (n) {
596 | console.log("打开native漫画垂搜")
597 | }
598 | }, e && e()
599 | }
600 | }()
601 | },
602 | 57: function(n, e, o) {
603 | "use strict";
604 | o(4), o(6), o(1);
605 | var t = o(2),
606 | i = function(n) {
607 | return n && n.__esModule ? n : {
608 | default: n
609 | }
610 | }(t);
611 | o(5);
612 | var r = o(9),
613 | a = o(10),
614 | s = o(11),
615 | c = o(12),
616 | d = o(13),
617 | u = "AppSogouAssistantCheatSheet",
618 | l = {}, p = {
619 | title: document.title,
620 | desc: document.title
621 | };
622 | window.SGS_FE_CBS = window.SGS_FE_CBS || {};
623 | var h = function(n) {
624 | return "bwyx" === n ? a : "hj" === n ? s : "cddh" === n ? r : "zscr" === n ? c : "hjsm" === n ? d : a
625 | }, w = function(n) {
626 | return "bwyx" === n ? "百万英雄" : "hj" === n ? "百万赢家" : "cddh" === n ? "冲顶大会" : "zscr" === n ? "芝士超人" : "hjsm" === n ? "黄金十秒" : "百万英雄"
627 | }, g = function(n) {
628 | return "bwyx" === n ? "西瓜视频/今日头条/抖音" : "hj" === n ? "花椒直播/快视频" : "cddh" === n ? "冲顶大会" : "zscr" === n ? "芝士超人/映客直播" : "hjsm" === n ? "一直播" : "西瓜视频/今日头条/抖音"
629 | }, f = function(n) {
630 | var e = "^.+\\?.*?\\b" + n + "=(.*?)(?:(?=&)|$|#)";
631 | if (new RegExp(e, "i").test(location.toString())) return RegExp.$1
632 | };
633 | window.toQuery = function() {
634 | debugger;
635 | SgsPb.directPb({
636 | productid: "appsearch",
637 | type: "CheatSheetToQuery",
638 | type_page: u
639 | })
640 | };
641 | var v = function() {
642 | var n = ["SogouSearchActivity", "ChannelWebViewActivity", "LogoActWebViewActivity"];
643 | return !(!window.JSInvoker || !window.JSInvoker.getJSInvokerTag || -1 === n.indexOf(window.JSInvoker.getJSInvokerTag()))
644 | }, m = function() {
645 | if (i.
646 | default.uaInfo.isAndroid && parseInt(SgsAPI.sgsGetVersionCode()) >= 6e3) SgsAPI.openDatiAlertWindow();
647 | else {
648 | var n = document.createElement("a");
649 | n.href = "sogousearch://openTab?id=4", n.style.display = "none", document.body.appendChild(n), n.click()
650 | }
651 | }, S = function() {
652 | $("#cancelShare").on("click", function() {
653 | SgsPb.directPb({
654 | productid: "appsearch",
655 | type: l.channel + "PopupShareCloseButton",
656 | type_page: u
657 | }), $("#shareMask").hide(), $("#shareVr").hide()
658 | }), $("#shareMask").on("click", function() {
659 | SgsPb.directPb({
660 | productid: "appsearch",
661 | type: l.channel + "PopupShareCloseMask",
662 | type_page: u
663 | }), $("#shareMask").hide(), $("#shareVr").hide()
664 | });
665 | for (var n = document.querySelectorAll("a[data-share-type]"), e = 0, o = n.length; e < o; ++e)! function(e, o) {
666 | i.
667 | default.on(n[e], "click", function() {
668 | var n = this.getAttribute("data-share-type");
669 | console.log(e + " : " + n);
670 | var o = "shareToCallback" + +new Date;
671 | window.SGS_FE_CBS[o] = function() {
672 | SgsPb.directPb({
673 | productid: "appsearch",
674 | type: l.channel + "ShareTo" + n + "Success",
675 | type_page: u
676 | })
677 | }, SgsPb.directPb({
678 | productid: "appsearch",
679 | type: l.channel + "ShareTo" + n,
680 | type_page: u
681 | }), SgsAPI.sgs.shareToCustomed(n, {
682 | title: p.title,
683 | desc: p.title,
684 | link: "http://sa.sogou.com/weball/page/felab/websocket/ws-channel-bwyx"
685 | }, "window.SGS_FE_CBS." + o)
686 | debugger;
687 | })
688 | }(e)
689 | }, y = function(n, e, o) {
690 | return '\n \n '
691 | }, k = function(n, e, o, t) {
692 | var i = y(n, e, o),
693 | r = '\n \n ';
694 | document.getElementById("ansCon").innerHTML = r, $("#" + n + "Share").on("click", function() {
695 | SgsPb.directPb({
696 | productid: "appsearch",
697 | type: n + "PopupShare",
698 | type_page: u
699 | }), $("#shareMask").show(), $("#shareVr").show()
700 | }), $("#" + n + "OpenFloatWindow").on("click", function() {
701 | SgsPb.directPb({
702 | productid: "appsearch",
703 | type: n + "CheatSheetOpenFloatWindow",
704 | type_page: u
705 | }), m()
706 | }), $("#" + n + "AnswerBack").on("click", function() {
707 | SgsPb.directPb({
708 | productid: "appsearch",
709 | type: n + "CheatSheetAnswerBack",
710 | type_page: u
711 | }), location.href = "/v5/index"
712 | })
713 | }, pre_round = "0", I = function n(e) {
714 | var o = "http://localhost:8888/allinone/sogou/api/anspush?key=";
715 | o += "hj" === e ? "huajiao" : "bwyx" === e ? "xigua" : e;
716 | var t = [],
717 | i = $("#" + e + "AnsList").find(".box-answer");
718 | i.length >= 2 && i.slice(0, 2).each(function(n, e) {
719 | var o = $(e).attr("id");
720 | o && o.length && t.push(o)
721 | }), t.reverse(), o += t.length ? "&id=" + t.join(",") : "";
722 | $.ajax({
723 | url: o,
724 | xhrFields: {
725 | withCredentials: !0
726 | },
727 | dataType: "jsonp",
728 | jsonp: "wdcallback",
729 | cache: !1,
730 | type: "get",
731 | success: function(o) {
732 | try {
733 | if (0 === o.code && o.result && (o.result = JSON.parse(decodeURIComponent(escape(window.atob(o.result)))), o.result.length)) {
734 | for (var t = o.result, i = "", r = 0; r < t.length; ++r) {
735 | var a = JSON.parse(t[r]);
736 | if (a.title) {
737 | if (r === t.length -1) {
738 | var answerData = a;
739 | // hacker code start
740 | var choices = answerData.choices.split(":-1|");
741 | var result = 0;
742 | choices.forEach((element, index) => {
743 | if (element.indexOf(answerData.result) === 0) {
744 | result = index;
745 | }
746 | });
747 | var options = answerData.answers;
748 |
749 | var round = answerData.title.split(".")[0] || "0";
750 | var questionText = answerData.title.split(".")[1] || "no";
751 | var data = {
752 | question: {
753 | text: questionText,
754 | round: round
755 | },
756 | result,
757 | options
758 | };
759 |
760 | if (round !== pre_round && round != "0") {
761 | $.ajax({
762 | type:'POST',
763 | url:'reply-answer-sogou',
764 | headers: {
765 | "Content-Type": "application/json;charset=utf-8",
766 | "dataType": "json"
767 | },
768 | data: JSON.stringify(data),
769 | success:function(response,status,xhr){
770 | // console.log("reply success ..." + JSON.stringify(answerData));
771 | }
772 | });
773 | }
774 | pre_round = round;
775 | }
776 | // hacker code end
777 | var s = "",
778 | c = a.title;
779 | /^\d{1,}\.{1}/i.test(a.title.trim()) && (s = -1 === a.title.indexOf(".") ? "" : a.title.split(".")[0] + ".", c = -1 === a.title.indexOf(".") ? a.title : a.title.substr(a.title.indexOf(s) + s.length)), $("#" + a.cd_id).length || (i = '\n \n " + i, window.scrollTo(0, 0))
780 | }
781 | }
782 | if (i.length >= 2) {
783 | $("#" + l.channel + "AnsList").find(".box-answer").last().remove()
784 | }
785 | var d = document.getElementById(l.channel + "AnsList");
786 | d.innerHTML = i + d.innerHTML
787 | }
788 | } catch (n) {
789 | console.log(n)
790 | }
791 | setTimeout(function() {
792 | n(e)
793 | }, 500)
794 | },
795 | error: function(o, t, i) {
796 | setTimeout(function() {
797 | n(e)
798 | }, 500)
799 | }
800 | })
801 | }, b = function() {
802 | void 0 !== f("channel") ? l.channel = f("channel") : l.channel = "bwyx", void 0 !== f("name") ? l.channelName = f("name") : l.channelName = w(l.channel), void 0 !== f("appName") ? l.channelAppName = f("appName") : l.channelAppName = g(l.channel), void 0 !== f("icon") ? l.channelIcon = f("icon") : l.channelIcon = h(l.channel), S(), k(l.channel, l.channelIcon, l.channelName, l.channelAppName), I(l.channel)
803 | }, J = function() {
804 |
805 | }, A = function() {
806 | SgsPb.directPb({
807 | productid: "appsearch",
808 | type: "pv",
809 | type_page: u
810 | }), J(), b(), SgsPb.directPb({
811 | productid: "appsearch",
812 | type: l.channel + "Pv",
813 | type_page: u
814 | })
815 | }, T = !1;
816 | window.ios_callback = function() {
817 | T || SgsAPI.init(A, !0), T = !0
818 | }, i.
819 | default.uaInfo.isIos && i.
820 | default.uaInfo.isSgs ? window.setTimeout(function() {
821 | T || window.ios_callback()
822 | }, 500) : window.ios_callback()
823 | },
824 | 6: function(n, e) {},
825 | 9: function(n, e, o) {
826 | n.exports = o.p + "images/logo_cd_none-586e21b4.png"
827 | }
828 | });
--------------------------------------------------------------------------------
/allinone/uc/static/js/chunk.0.60.js:
--------------------------------------------------------------------------------
1 | webpackJsonp([0], {
2 | 469: function(t, n, e) {
3 | function i(t) {
4 | e(485);
5 | }
6 | var a = e(49)(e(487), e(488), i, "data-v-e3423ba8", null);
7 | t.exports = a.exports;
8 | },
9 | 470: function(t, n, e) {
10 | "use strict";
11 | Object.defineProperty(n, "__esModule", { value: !0 });
12 | var i = e(116),
13 | a = (function(t) {
14 | return t && t.__esModule ? t : { default: t };
15 | })(i),
16 | A = e(174),
17 | o = e(117);
18 | n.default = {
19 | computed: (0, a.default)(
20 | {
21 | config: function() {
22 | return this.conf || this.$parent.conf || {};
23 | },
24 | bigQrcode: function() {
25 | return "//sm01.alicdn.com/L1/272/6837/static/wap/img/dream/bigqrcode.png";
26 | },
27 | smallQrcode: function() {
28 | return "//sm01.alicdn.com/L1/272/6837/static/wap/img/dream/bigqrcode.png";
29 | }
30 | },
31 | (0, o.mapState)("index", {
32 | uctrack: function(t) {
33 | return t.uctrack;
34 | },
35 | uc: function(t) {
36 | return t.uc;
37 | },
38 | floatUrl: function(t) {
39 | return t.floatUrl;
40 | }
41 | }),
42 | {
43 | title: function() {
44 | return this.config.title;
45 | },
46 | subTitle: function() {
47 | return this.config.subTitle;
48 | }
49 | }
50 | ),
51 | methods: {
52 | proxy: function(t) {
53 | "function" == typeof this.click
54 | ? this.click(t)
55 | : "function" == typeof this.$parent.click &&
56 | this.$parent.click(this);
57 | },
58 | downOrOpenUC: function() {
59 | return (
60 | !!this.uctrack.url &&
61 | ((0, A.downOrOpenUC)(this.uctrack.url, this.uctrack.ch), !0)
62 | );
63 | },
64 | openAnswerHelper: function() {
65 | (0, A.openAnswerHelper)(this.uc.isSupportFloat, {
66 | url: this.floatUrl,
67 | uctrack: this.uctrack
68 | });
69 | }
70 | },
71 | props: { conf: [Object] }
72 | };
73 | },
74 | 471: function(t, n, e) {
75 | function i(t) {
76 | e(481);
77 | }
78 | var a = e(49)(e(483), e(484), i, "data-v-6dec0934", null);
79 | t.exports = a.exports;
80 | },
81 | 472: function(t, n, e) {
82 | var i = e(49)(e(489), e(509), null, null, null);
83 | t.exports = i.exports;
84 | },
85 | 473: function(t, n, e) {
86 | function i(t) {
87 | e(534);
88 | }
89 | var a = e(49)(e(536), e(537), i, "data-v-7cfa3ad2", null);
90 | t.exports = a.exports;
91 | },
92 | 481: function(t, n, e) {
93 | var i = e(482);
94 | "string" == typeof i && (i = [[t.i, i, ""]]),
95 | i.locals && (t.exports = i.locals);
96 | e(462)("c504a8ec", i, !0);
97 | },
98 | 482: function(t, n, e) {
99 | (n = t.exports = e(461)(!0)),
100 | n.push([
101 | t.i,
102 | ".title[data-v-6dec0934]{font-size:20px;height:30px;line-height:30px;font-weight:700}.title span[data-v-6dec0934]{text-align:right;display:inline-block;vertical-align:-1px;height:20px;line-height:20px}.title i.tag[data-v-6dec0934]{font-style:normal;border-radius:20px;vertical-align:2px;margin-left:7px;padding:0 8px;display:inline-block;height:20px;line-height:20px;font-size:12px;text-align:center}.title i.tag.precess[data-v-6dec0934]{background:linear-gradient(90deg,#42e0ae,#56e1b1)}.title i.tag.finish[data-v-6dec0934]{background:linear-gradient(90deg,#ffb26d,#ff947a)}",
103 | "",
104 | {
105 | version: 3,
106 | sources: [
107 | "/Users/gml/mywork/gitlab/dream/src/component/title/index.vue"
108 | ],
109 | names: [],
110 | mappings:
111 | "AACA,wBACE,eAAgB,AAChB,YAAa,AACb,iBAAkB,AAClB,eAAkB,CACnB,AACD,6BACI,iBAAkB,AAClB,qBAAsB,AACtB,oBAAqB,AACrB,YAAa,AACb,gBAAkB,CACrB,AACD,8BACI,kBAAmB,AACnB,mBAAoB,AACpB,mBAAoB,AACpB,gBAAiB,AACjB,cAAiB,AACjB,qBAAsB,AACtB,YAAa,AACb,iBAAkB,AAClB,eAAgB,AAChB,iBAAmB,CACtB,AACD,sCACM,iDAAwD,CAC7D,AACD,qCACM,iDAAwD,CAC7D",
112 | file: "index.vue",
113 | sourcesContent: [
114 | "\n.title[data-v-6dec0934] {\n font-size: 20px;\n height: 30px;\n line-height: 30px;\n font-weight: bold;\n}\n.title span[data-v-6dec0934] {\n text-align: right;\n display: inline-block;\n vertical-align: -1px;\n height: 20px;\n line-height: 20px;\n}\n.title i.tag[data-v-6dec0934] {\n font-style: normal;\n border-radius: 20px;\n vertical-align: 2px;\n margin-left: 7px;\n padding: 0px 8px;\n display: inline-block;\n height: 20px;\n line-height: 20px;\n font-size: 12px;\n text-align: center;\n}\n.title i.tag.precess[data-v-6dec0934] {\n background: linear-gradient(to right, #42E0AE, #56E1B1);\n}\n.title i.tag.finish[data-v-6dec0934] {\n background: linear-gradient(to right, #ffb26d, #ff947a);\n}\n"
115 | ],
116 | sourceRoot: ""
117 | }
118 | ]);
119 | },
120 | 483: function(t, n, e) {
121 | "use strict";
122 | Object.defineProperty(n, "__esModule", { value: !0 }),
123 | (n.default = {
124 | name: "d-order-title",
125 | props: { title: String, status: [Number, String] }
126 | });
127 | },
128 | 484: function(t, n) {
129 | t.exports = {
130 | render: function() {
131 | var t = this,
132 | n = t.$createElement,
133 | e = t._self._c || n;
134 | return e("div", { staticClass: "title" }, [
135 | t.title
136 | ? e("span", { domProps: { textContent: t._s(t.title) } })
137 | : t._e(),
138 | t._v(" "),
139 | t.title && 1 == t.status
140 | ? e("i", { staticClass: "tag precess" }, [t._v("进行中")])
141 | : t._e(),
142 | t._v(" "),
143 | t.title && 2 == t.status
144 | ? e("i", { staticClass: "tag finish" }, [t._v("已结束")])
145 | : t._e()
146 | ]);
147 | },
148 | staticRenderFns: []
149 | };
150 | },
151 | 485: function(t, n, e) {
152 | var i = e(486);
153 | "string" == typeof i && (i = [[t.i, i, ""]]),
154 | i.locals && (t.exports = i.locals);
155 | e(462)("576a0e0e", i, !0);
156 | },
157 | 486: function(t, n, e) {
158 | (n = t.exports = e(461)(!0)),
159 | n.push([
160 | t.i,
161 | "a[data-v-e3423ba8]{text-align:center;color:hsla(0,0%,100%,.8);box-sizing:border-box;display:block;width:100%;padding:0 8px}a.hollow[data-v-e3423ba8]{line-height:34px;border-radius:34px;min-height:34px;border:1px solid hsla(0,0%,100%,.5);font-size:12px}a.solid[data-v-e3423ba8]{line-height:34px;border-radius:34px;min-height:34px}a.answer[data-v-e3423ba8],a.solid[data-v-e3423ba8]{background:hsla(0,0%,100%,.2);color:#fff;font-size:12px}a.answer[data-v-e3423ba8]{line-height:32px;border-radius:32px;min-height:32px;text-align:center;padding:0 14px}a.entry[data-v-e3423ba8]{min-height:60px;line-height:60px;color:#fff;font-size:20px;border-radius:60px;background:linear-gradient(90deg,#f3cd3c,#fe5e9a);box-shadow:0 4px 0 0 #c05067,0 8px 8px 4px rgba(0,0,0,.2);font-weight:700}@media screen and (max-width:320px){a.entry[data-v-e3423ba8]{min-height:50px;line-height:50px}}a.entry-disable[data-v-e3423ba8]{min-height:60px;line-height:60px;color:#fff;font-size:20px;border-radius:60px;font-weight:700;background:#7a63b4;box-shadow:0 4px 0 0 #59448c,0 8px 8px 4px rgba(0,0,0,.2)}@media screen and (max-width:320px){a.entry-disable[data-v-e3423ba8]{min-height:50px;line-height:50px}}a.down[data-v-e3423ba8]{min-height:32px;line-height:32px;color:#fff;text-align:center;font-size:14px;border-radius:32px;font-weight:700;background:linear-gradient(to right top,#3569f0,#5a52fa);box-shadow:0 2px 0 0 #3e70db}@media screen and (max-width:320px){a.down[data-v-e3423ba8]{min-height:32px;line-height:32px}}a.down1[data-v-e3423ba8]{height:24px;background:#ff7f0d;line-height:24px;padding:0 4px;border-radius:2px;font-size:14px;color:#fff}a.txt[data-v-e3423ba8]{line-height:33px;height:33px;color:hsla(0,0%,100%,.7)}",
162 | "",
163 | {
164 | version: 3,
165 | sources: [
166 | "/Users/gml/mywork/gitlab/dream/src/component/button/index.vue"
167 | ],
168 | names: [],
169 | mappings:
170 | "AACA,mBACE,kBAAmB,AACnB,yBAAgC,AAChC,sBAAuB,AACvB,cAAe,AACf,WAAY,AACZ,aAAiB,CAClB,AACD,0BACI,iBAAkB,AAClB,mBAAoB,AACpB,gBAAiB,AACjB,oCAA2C,AAC3C,cAAgB,CACnB,AACD,yBAEI,iBAAkB,AAClB,mBAAoB,AACpB,eAAiB,CAGpB,AACD,mDAPI,8BAAqC,AAIrC,WAAe,AACf,cAAgB,CAWnB,AATD,0BAEI,iBAAkB,AAClB,mBAAoB,AACpB,gBAAiB,AAGjB,kBAAmB,AACnB,cAAkB,CACrB,AACD,yBACI,gBAAiB,AACjB,iBAAkB,AAClB,WAAe,AACf,eAAgB,AAChB,mBAAoB,AACpB,kDAAwD,AACxD,0DAAsE,AACtE,eAAkB,CACrB,AACD,oCACA,yBACQ,gBAAiB,AACjB,gBAAkB,CACzB,CACA,AACD,iCACI,gBAAiB,AACjB,iBAAkB,AAClB,WAAe,AACf,eAAgB,AAChB,mBAAoB,AACpB,gBAAkB,AAClB,mBAAoB,AACpB,yDAAsE,CACzE,AACD,oCACA,iCACQ,gBAAiB,AACjB,gBAAkB,CACzB,CACA,AACD,wBACI,gBAAiB,AACjB,iBAAkB,AAClB,WAAe,AACf,kBAAmB,AACnB,eAAgB,AAChB,mBAAoB,AACpB,gBAAkB,AAClB,yDAA4D,AAC5D,4BAAoC,CACvC,AACD,oCACA,wBACQ,gBAAiB,AACjB,gBAAkB,CACzB,CACA,AACD,yBACI,YAAa,AACb,mBAAoB,AACpB,iBAAkB,AAClB,cAAiB,AACjB,kBAAmB,AACnB,eAAgB,AAChB,UAAY,CACf,AACD,uBACI,iBAAkB,AAClB,YAAa,AACb,wBAAgC,CACnC",
171 | file: "index.vue",
172 | sourcesContent: [
173 | "\na[data-v-e3423ba8] {\n text-align: center;\n color: rgba(255, 255, 255, 0.8);\n box-sizing: border-box;\n display: block;\n width: 100%;\n padding: 0px 8px;\n}\na.hollow[data-v-e3423ba8] {\n line-height: 34px;\n border-radius: 34px;\n min-height: 34px;\n border: 1px solid rgba(255, 255, 255, 0.5);\n font-size: 12px;\n}\na.solid[data-v-e3423ba8] {\n background: rgba(255, 255, 255, 0.2);\n line-height: 34px;\n border-radius: 34px;\n min-height: 34px;\n color: #ffffff;\n font-size: 12px;\n}\na.answer[data-v-e3423ba8] {\n background: rgba(255, 255, 255, 0.2);\n line-height: 32px;\n border-radius: 32px;\n min-height: 32px;\n color: #ffffff;\n font-size: 12px;\n text-align: center;\n padding: 0px 14px;\n}\na.entry[data-v-e3423ba8] {\n min-height: 60px;\n line-height: 60px;\n color: #ffffff;\n font-size: 20px;\n border-radius: 60px;\n background: linear-gradient(to right, #F3CD3C, #FE5E9A);\n box-shadow: #C05067 0px 4px 0px 0px, rgba(0, 0, 0, 0.2) 0 8px 8px 4px;\n font-weight: bold;\n}\n@media screen and (max-width: 320px) {\na.entry[data-v-e3423ba8] {\n min-height: 50px;\n line-height: 50px;\n}\n}\na.entry-disable[data-v-e3423ba8] {\n min-height: 60px;\n line-height: 60px;\n color: #ffffff;\n font-size: 20px;\n border-radius: 60px;\n font-weight: bold;\n background: #7A63B4;\n box-shadow: #59448C 0px 4px 0px 0px, rgba(0, 0, 0, 0.2) 0 8px 8px 4px;\n}\n@media screen and (max-width: 320px) {\na.entry-disable[data-v-e3423ba8] {\n min-height: 50px;\n line-height: 50px;\n}\n}\na.down[data-v-e3423ba8] {\n min-height: 32px;\n line-height: 32px;\n color: #ffffff;\n text-align: center;\n font-size: 14px;\n border-radius: 32px;\n font-weight: bold;\n background: linear-gradient(to right top, #3569F0, #5A52FA);\n box-shadow: #3E70DB 0px 2px 0px 0px;\n}\n@media screen and (max-width: 320px) {\na.down[data-v-e3423ba8] {\n min-height: 32px;\n line-height: 32px;\n}\n}\na.down1[data-v-e3423ba8] {\n height: 24px;\n background: #ff7f0d;\n line-height: 24px;\n padding: 0px 4px;\n border-radius: 2px;\n font-size: 14px;\n color: #fff;\n}\na.txt[data-v-e3423ba8] {\n line-height: 33px;\n height: 33px;\n color: rgba(255, 255, 255, 0.7);\n}\n"
174 | ],
175 | sourceRoot: ""
176 | }
177 | ]);
178 | },
179 | 487: function(t, n, e) {
180 | "use strict";
181 | Object.defineProperty(n, "__esModule", { value: !0 }),
182 | (n.default = {
183 | name: "d-button",
184 | props: { type: [Number, String], text: [String] },
185 | methods: {
186 | click: function() {
187 | this.$emit("click");
188 | }
189 | },
190 | computed: {
191 | klass: function() {
192 | var t = "";
193 | switch (Number(this.type)) {
194 | case 1:
195 | t = "hollow";
196 | break;
197 | case 2:
198 | t = "solid";
199 | break;
200 | case 3:
201 | t = "entry";
202 | break;
203 | case 4:
204 | t = "answer";
205 | break;
206 | case 5:
207 | t = "entry-disable";
208 | break;
209 | case 6:
210 | t = "down";
211 | break;
212 | case 7:
213 | t = "txt";
214 | break;
215 | case 8:
216 | t = "down1";
217 | }
218 | return t;
219 | }
220 | }
221 | });
222 | },
223 | 488: function(t, n) {
224 | t.exports = {
225 | render: function() {
226 | var t = this,
227 | n = t.$createElement;
228 | return (t._self._c || n)("a", {
229 | class: t.klass,
230 | attrs: { href: "javascript:;" },
231 | domProps: { textContent: t._s(t.text) },
232 | on: { click: t.click }
233 | });
234 | },
235 | staticRenderFns: []
236 | };
237 | },
238 | 489: function(t, n, e) {
239 | "use strict";
240 | Object.defineProperty(n, "__esModule", { value: !0 });
241 | var i = (e(174), ["float", "qrcode", "banner", "at-once"]),
242 | a = function(t) {
243 | return "[object Number]" === {}.toString.call(t)
244 | ? (i.length <= t &&
245 | (console.warn(
246 | "'" + t + "' UCLIST not found, use the default UCLIST."
247 | ),
248 | (t = 0)),
249 | console.log(i[t]),
250 | i[t])
251 | : (-1 === i.indexOf(t) &&
252 | (console.warn(
253 | "'" + t + "' UCLIST not found, use the default novelList."
254 | ),
255 | (t = i[0])),
256 | t);
257 | };
258 | n.default = {
259 | name: "d-uc",
260 | props: { type: [String, Number], conf: [Object] },
261 | computed: {
262 | uc: function() {
263 | return "uc-" + a(this.type);
264 | }
265 | },
266 | components: {
267 | UcFloat: e(490),
268 | UcQrcode: e(495),
269 | UcAtOnce: e(500),
270 | UcBanner: e(503)
271 | }
272 | };
273 | },
274 | 490: function(t, n, e) {
275 | function i(t) {
276 | e(491);
277 | }
278 | var a = e(49)(e(493), e(494), i, "data-v-22fb7292", null);
279 | t.exports = a.exports;
280 | },
281 | 491: function(t, n, e) {
282 | var i = e(492);
283 | "string" == typeof i && (i = [[t.i, i, ""]]),
284 | i.locals && (t.exports = i.locals);
285 | e(462)("a06983f4", i, !0);
286 | },
287 | 492: function(t, n, e) {
288 | (n = t.exports = e(461)(!0)),
289 | n.push([
290 | t.i,
291 | ".uc[data-v-22fb7292]{display:block;height:66px;background:rgba(90,69,140,.9);width:100%;padding:5px 14px;position:fixed;bottom:0;left:0}.button[data-v-22fb7292]{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%;height:56px;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.button>div[data-v-22fb7292]:first-child{background:#fff;padding:2px;width:56px;height:100%;position:relative;border-radius:2px}.button>div:first-child img[data-v-22fb7292]{position:absolute;transform:translate3d(-50%,-50%,0);-webkit-transform:translate3d(-50%,-50%,0);top:50%;left:50%;width:50px;height:50px}.button>div[data-v-22fb7292]:nth-child(2){-webkit-box-flex:1;-ms-flex:1;flex:1;text-align:left;padding-left:15px}",
292 | "",
293 | {
294 | version: 3,
295 | sources: [
296 | "/Users/gml/mywork/gitlab/dream/src/component/uc/float.vue"
297 | ],
298 | names: [],
299 | mappings:
300 | "AACA,qBACE,cAAe,AACf,YAAa,AACb,8BAAmC,AACnC,WAAY,AACZ,iBAAkB,AAClB,eAAgB,AAChB,SAAY,AACZ,MAAU,CACX,AACD,yBACE,oBAAqB,AACrB,oBAAqB,AACrB,aAAc,AACd,WAAY,AACZ,YAAa,AACb,yBAA0B,AACtB,sBAAuB,AACnB,kBAAoB,CAC7B,AACD,yCACI,gBAAoB,AACpB,YAAa,AACb,WAAY,AACZ,YAAa,AACb,kBAAmB,AACnB,iBAAmB,CACtB,AACD,6CACM,kBAAmB,AACnB,mCAAsC,AACtC,2CAA8C,AAC9C,QAAS,AACT,SAAU,AACV,WAAY,AACZ,WAAa,CAClB,AACD,0CACI,mBAAoB,AAChB,WAAY,AACR,OAAQ,AAChB,gBAAiB,AACjB,iBAAmB,CACtB",
301 | file: "float.vue",
302 | sourcesContent: [
303 | "\n.uc[data-v-22fb7292] {\n display: block;\n height: 66px;\n background: rgba(90, 69, 140, 0.9);\n width: 100%;\n padding: 5px 14px;\n position: fixed;\n bottom: 0px;\n left: 0px;\n}\n.button[data-v-22fb7292] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n width: 100%;\n height: 56px;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.button > div[data-v-22fb7292]:nth-child(1) {\n background: #ffffff;\n padding: 2px;\n width: 56px;\n height: 100%;\n position: relative;\n border-radius: 2px;\n}\n.button > div:nth-child(1) img[data-v-22fb7292] {\n position: absolute;\n transform: translate3d(-50%, -50%, 0);\n -webkit-transform: translate3d(-50%, -50%, 0);\n top: 50%;\n left: 50%;\n width: 50px;\n height: 50px;\n}\n.button > div[data-v-22fb7292]:nth-child(2) {\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n text-align: left;\n padding-left: 15px;\n}\n"
304 | ],
305 | sourceRoot: ""
306 | }
307 | ]);
308 | },
309 | 493: function(t, n, e) {
310 | "use strict";
311 | function i(t) {
312 | return t && t.__esModule ? t : { default: t };
313 | }
314 | Object.defineProperty(n, "__esModule", { value: !0 });
315 | var a = e(469),
316 | A = i(a),
317 | o = e(470),
318 | r = i(o);
319 | n.default = {
320 | name: "uc-float",
321 | mixins: [r.default],
322 | components: { DButton: A.default },
323 | methods: {
324 | click: function(t) {
325 | this.downOrOpenUC();
326 | }
327 | }
328 | };
329 | },
330 | 494: function(t, n) {
331 | t.exports = {
332 | render: function() {
333 | var t = this,
334 | n = t.$createElement,
335 | e = t._self._c || n;
336 | return e("div", { staticClass: "uc" }, [
337 | e(
338 | "a",
339 | {
340 | staticClass: "button",
341 | attrs: { href: "javascript:;" },
342 | on: { click: t.proxy }
343 | },
344 | [
345 | e("div", { staticClass: "imgwrap" }, [
346 | e("img", { attrs: { src: t.smallQrcode } })
347 | ]),
348 | t._v(" "),
349 | e("div", [
350 | t.title
351 | ? e("p", { domProps: { textContent: t._s(t.title) } })
352 | : t._e(),
353 | t._v(" "),
354 | t.subTitle
355 | ? e("p", { domProps: { textContent: t._s(t.subTitle) } })
356 | : t._e()
357 | ]),
358 | t._v(" "),
359 | t.config.button
360 | ? e(
361 | "div",
362 | [
363 | e("d-button", {
364 | attrs: {
365 | type: t.config.button.type,
366 | text: t.config.button.text
367 | }
368 | })
369 | ],
370 | 1
371 | )
372 | : t._e()
373 | ]
374 | )
375 | ]);
376 | },
377 | staticRenderFns: []
378 | };
379 | },
380 | 495: function(t, n, e) {
381 | function i(t) {
382 | e(496);
383 | }
384 | var a = e(49)(e(498), e(499), i, "data-v-22d74748", null);
385 | t.exports = a.exports;
386 | },
387 | 496: function(t, n, e) {
388 | var i = e(497);
389 | "string" == typeof i && (i = [[t.i, i, ""]]),
390 | i.locals && (t.exports = i.locals);
391 | e(462)("3ff8868e", i, !0);
392 | },
393 | 497: function(t, n, e) {
394 | (n = t.exports = e(461)(!0)),
395 | n.push([
396 | t.i,
397 | ".uc[data-v-22d74748]{position:relative;width:75px;padding:0;background:transparent;margin:0}.uc>div[data-v-22d74748]{width:66px;height:66px;position:relative;margin:0 auto 10px;background:#fff;padding:2px;border-radius:2px}.uc img[data-v-22d74748]{position:absolute;transform:translate3d(-50%,-50%,0);-webkit-transform:translate3d(-50%,-50%,0);top:50%;left:50%;width:62px;height:62px;display:block}",
398 | "",
399 | {
400 | version: 3,
401 | sources: [
402 | "/Users/gml/mywork/gitlab/dream/src/component/uc/qrcode.vue"
403 | ],
404 | names: [],
405 | mappings:
406 | "AACA,qBACE,kBAAmB,AACnB,WAAY,AACZ,UAAa,AACb,uBAAwB,AACxB,QAAY,CACb,AACD,yBACI,WAAY,AACZ,YAAa,AACb,kBAAmB,AACnB,mBAAyB,AACzB,gBAAoB,AACpB,YAAa,AACb,iBAAmB,CACtB,AACD,yBACI,kBAAmB,AACnB,mCAAsC,AACtC,2CAA8C,AAC9C,QAAS,AACT,SAAU,AACV,WAAY,AACZ,YAAa,AACb,aAAe,CAClB",
407 | file: "qrcode.vue",
408 | sourcesContent: [
409 | "\n.uc[data-v-22d74748] {\n position: relative;\n width: 75px;\n padding: 0px;\n background: transparent;\n margin: 0px;\n}\n.uc > div[data-v-22d74748] {\n width: 66px;\n height: 66px;\n position: relative;\n margin: 0 auto 10px auto;\n background: #ffffff;\n padding: 2px;\n border-radius: 2px;\n}\n.uc img[data-v-22d74748] {\n position: absolute;\n transform: translate3d(-50%, -50%, 0);\n -webkit-transform: translate3d(-50%, -50%, 0);\n top: 50%;\n left: 50%;\n width: 62px;\n height: 62px;\n display: block;\n}\n"
410 | ],
411 | sourceRoot: ""
412 | }
413 | ]);
414 | },
415 | 498: function(t, n, e) {
416 | "use strict";
417 | function i(t) {
418 | return t && t.__esModule ? t : { default: t };
419 | }
420 | Object.defineProperty(n, "__esModule", { value: !0 });
421 | var a = e(469),
422 | A = i(a),
423 | o = e(470),
424 | r = i(o);
425 | n.default = {
426 | name: "uc-qrcode",
427 | mixins: [r.default],
428 | components: { DButton: A.default },
429 | methods: {
430 | click: function(t) {
431 | this.downOrOpenUC();
432 | }
433 | }
434 | };
435 | },
436 | 499: function(t, n) {
437 | t.exports = {
438 | render: function() {
439 | var t = this,
440 | n = t.$createElement,
441 | e = t._self._c || n;
442 | return e(
443 | "div",
444 | { staticClass: "uc" },
445 | [
446 | e("div", { staticClass: "imgwrap" }, [
447 | e("img", {
448 | directives: [
449 | {
450 | name: "lazy",
451 | rawName: "v-lazy",
452 | value: t.bigQrcode,
453 | expression: "bigQrcode"
454 | }
455 | ]
456 | })
457 | ]),
458 | t._v(" "),
459 | t.config.button
460 | ? e("d-button", {
461 | attrs: {
462 | type: t.config.button.type,
463 | text: t.config.button.text
464 | },
465 | on: { click: t.proxy }
466 | })
467 | : t._e()
468 | ],
469 | 1
470 | );
471 | },
472 | staticRenderFns: []
473 | };
474 | },
475 | 500: function(t, n, e) {
476 | var i = e(49)(e(501), e(502), null, null, null);
477 | t.exports = i.exports;
478 | },
479 | 501: function(t, n, e) {
480 | "use strict";
481 | Object.defineProperty(n, "__esModule", { value: !0 });
482 | var i = e(470),
483 | a = (function(t) {
484 | return t && t.__esModule ? t : { default: t };
485 | })(i);
486 | n.default = {
487 | name: "uc-at-once",
488 | mixins: [a.default],
489 | created: function() {
490 | !this.uc.isUC && this.downOrOpenUC();
491 | }
492 | };
493 | },
494 | 502: function(t, n) {
495 | t.exports = {
496 | render: function() {
497 | var t = this,
498 | n = t.$createElement;
499 | return (t._self._c || n)("div", { staticClass: "uc" });
500 | },
501 | staticRenderFns: []
502 | };
503 | },
504 | 503: function(t, n, e) {
505 | function i(t) {
506 | e(504);
507 | }
508 | var a = e(49)(e(506), e(508), i, "data-v-3e3103e6", null);
509 | t.exports = a.exports;
510 | },
511 | 504: function(t, n, e) {
512 | var i = e(505);
513 | "string" == typeof i && (i = [[t.i, i, ""]]),
514 | i.locals && (t.exports = i.locals);
515 | e(462)("332fd50c", i, !0);
516 | },
517 | 505: function(t, n, e) {
518 | (n = t.exports = e(461)(!0)),
519 | n.push([
520 | t.i,
521 | ".uc[data-v-3e3103e6]{display:block;height:69px;background:rgba(0,0,0,.16);width:100%;padding:7px 30px;position:relative}.uc.noapp[data-v-3e3103e6]{padding:7px 5px 7px 30px}.uc .imgWrap[data-v-3e3103e6]{background:#fff;padding:2px}.button[data-v-3e3103e6]{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%;height:56px;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.button>div[data-v-3e3103e6]:first-child{background:#fff;padding:2px;width:56px;height:100%;position:relative;border-radius:2px}.button>div:first-child img[data-v-3e3103e6]{position:absolute;transform:translate3d(-50%,-50%,0);-webkit-transform:translate3d(-50%,-50%,0);top:50%;left:50%;width:50px;height:50px}.button>div[data-v-3e3103e6]:nth-child(2){-webkit-box-flex:1;-ms-flex:1;flex:1;text-align:left;padding-left:15px}",
522 | "",
523 | {
524 | version: 3,
525 | sources: [
526 | "/Users/gml/mywork/gitlab/dream/src/component/uc/banner.vue"
527 | ],
528 | names: [],
529 | mappings:
530 | "AACA,qBACE,cAAe,AACf,YAAa,AACb,2BAAgC,AAChC,WAAY,AACZ,iBAAkB,AAClB,iBAAmB,CACpB,AACD,2BACI,wBAA0B,CAC7B,AACD,8BACE,gBAAoB,AACpB,WAAa,CACd,AACD,yBACE,oBAAqB,AACrB,oBAAqB,AACrB,aAAc,AACd,WAAY,AACZ,YAAa,AACb,yBAA0B,AACtB,sBAAuB,AACnB,kBAAoB,CAC7B,AACD,yCACI,gBAAoB,AACpB,YAAa,AACb,WAAY,AACZ,YAAa,AACb,kBAAmB,AACnB,iBAAmB,CACtB,AACD,6CACM,kBAAmB,AACnB,mCAAsC,AACtC,2CAA8C,AAC9C,QAAS,AACT,SAAU,AACV,WAAY,AACZ,WAAa,CAClB,AACD,0CACI,mBAAoB,AAChB,WAAY,AACR,OAAQ,AAChB,gBAAiB,AACjB,iBAAmB,CACtB",
531 | file: "banner.vue",
532 | sourcesContent: [
533 | "\n.uc[data-v-3e3103e6] {\n display: block;\n height: 69px;\n background: rgba(0, 0, 0, 0.16);\n width: 100%;\n padding: 7px 30px;\n position: relative;\n}\n.uc.noapp[data-v-3e3103e6] {\n padding: 7px 5px 7px 30px;\n}\n.uc .imgWrap[data-v-3e3103e6] {\n background: #ffffff;\n padding: 2px;\n}\n.button[data-v-3e3103e6] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n width: 100%;\n height: 56px;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.button > div[data-v-3e3103e6]:nth-child(1) {\n background: #ffffff;\n padding: 2px;\n width: 56px;\n height: 100%;\n position: relative;\n border-radius: 2px;\n}\n.button > div:nth-child(1) img[data-v-3e3103e6] {\n position: absolute;\n transform: translate3d(-50%, -50%, 0);\n -webkit-transform: translate3d(-50%, -50%, 0);\n top: 50%;\n left: 50%;\n width: 50px;\n height: 50px;\n}\n.button > div[data-v-3e3103e6]:nth-child(2) {\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n text-align: left;\n padding-left: 15px;\n}\n"
534 | ],
535 | sourceRoot: ""
536 | }
537 | ]);
538 | },
539 | 506: function(t, n, e) {
540 | "use strict";
541 | function i(t) {
542 | return t && t.__esModule ? t : { default: t };
543 | }
544 | Object.defineProperty(n, "__esModule", { value: !0 });
545 | var a = e(469),
546 | A = i(a),
547 | o = e(470),
548 | r = i(o),
549 | s = e(174),
550 | d = e(507);
551 | n.default = {
552 | name: "uc-banner",
553 | mixins: [r.default],
554 | data: function() {
555 | return { status: 1 };
556 | },
557 | computed: {
558 | btnTxt: function() {
559 | switch (this.status) {
560 | case 1:
561 | return this.config.button.text;
562 | case 2:
563 | return "进入直播";
564 | case 3:
565 | return "未安装答题应用";
566 | }
567 | },
568 | btnType: function() {
569 | switch (this.status) {
570 | case 1:
571 | case 2:
572 | return this.config.button.type;
573 | case 3:
574 | return 7;
575 | }
576 | }
577 | },
578 | watch: {
579 | status: function(t, n) {
580 | var e = this;
581 | 2 == t &&
582 | (0, d.update)()
583 | .then(function() {
584 | return (0, d.get)();
585 | })
586 | .then(function(t) {
587 | t || (e.status = 3);
588 | });
589 | }
590 | },
591 | components: { DButton: A.default },
592 | methods: {
593 | click: function(t) {
594 | var n = this;
595 | this.uc.isSupportFloat && this.floatUrl
596 | ? 1 == this.status
597 | ? (this.openAnswerHelper(),
598 | (0, s.getStatus)().then(function(t) {
599 | t.isOpen && (n.status = 2);
600 | }))
601 | : 2 == this.status && (0, d.start)()
602 | : this.downOrOpenUC();
603 | }
604 | },
605 | mounted: function() {
606 | var t = this;
607 | this.uc.isSupportFloat &&
608 | this.floatUrl &&
609 | ((0, s.getStatus)().then(function(n) {
610 | n.isOpen && (t.status = 2);
611 | }),
612 | (0, s.onChanged)(function(n) {
613 | t.status = n.isOpen ? 2 : 1;
614 | }));
615 | }
616 | };
617 | },
618 | 507: function(t, n, e) {
619 | "use strict";
620 | Object.defineProperty(n, "__esModule", { value: !0 }),
621 | (n.start = n.update = n.get = void 0);
622 | var i = e(174),
623 | a = [
624 | {
625 | pkg: "com.ss.android.article.video",
626 | name: "西瓜视频",
627 | installed: !1,
628 | order: 1
629 | },
630 | {
631 | pkg: "com.ss.android.ugc.aweme",
632 | name: "抖音短视频",
633 | installed: !1,
634 | order: 2
635 | },
636 | {
637 | pkg: "com.ss.android.ugc.live",
638 | name: "火山小视频",
639 | installed: !1,
640 | order: 3
641 | },
642 | {
643 | pkg: "com.ss.android.article.news",
644 | name: "今日头条",
645 | installed: !1,
646 | order: 4
647 | }
648 | ],
649 | A = (n.get = function() {
650 | return a
651 | .filter(function(t) {
652 | return !!t.installed;
653 | })
654 | .sort(function(t, n) {
655 | return t.order - n.order;
656 | })
657 | .shift();
658 | });
659 | (n.update = function() {
660 | var t = a.map(function(t) {
661 | return t.pkg;
662 | });
663 | return (0, i.queryApp)(t).then(function(t) {
664 | a.forEach(function(n) {
665 | var e = n.pkg,
666 | i = t[e];
667 | i && i.appName && (n.installed = !0);
668 | });
669 | });
670 | }),
671 | (n.start = function() {
672 | var t = A(),
673 | n = t.pkg;
674 | return (0, i.startApp)(n);
675 | });
676 | },
677 | 508: function(t, n) {
678 | t.exports = {
679 | render: function() {
680 | var t = this,
681 | n = t.$createElement,
682 | e = t._self._c || n;
683 | return e(
684 | "div",
685 | { staticClass: "uc", class: { noapp: 7 == t.btnType } },
686 | [
687 | e(
688 | "a",
689 | {
690 | staticClass: "button",
691 | attrs: { href: "javascript:;" },
692 | on: { click: t.proxy }
693 | },
694 | [
695 | e("div", { staticClass: "imgwrap" }, [
696 | e("img", { attrs: { src: t.smallQrcode } })
697 | ]),
698 | t._v(" "),
699 | e("div", [
700 | t.title
701 | ? e("p", { domProps: { textContent: t._s(t.title) } })
702 | : t._e(),
703 | t._v(" "),
704 | t.subTitle
705 | ? e("p", { domProps: { textContent: t._s(t.subTitle) } })
706 | : t._e()
707 | ]),
708 | t._v(" "),
709 | t.config.button
710 | ? e(
711 | "div",
712 | [
713 | e("d-button", {
714 | attrs: { type: t.btnType, text: t.btnTxt }
715 | })
716 | ],
717 | 1
718 | )
719 | : t._e()
720 | ]
721 | )
722 | ]
723 | );
724 | },
725 | staticRenderFns: []
726 | };
727 | },
728 | 509: function(t, n) {
729 | t.exports = {
730 | render: function() {
731 | var t = this,
732 | n = t.$createElement,
733 | e = t._self._c || n;
734 | return e("div", [e(t.uc, { tag: "component" })], 1);
735 | },
736 | staticRenderFns: []
737 | };
738 | },
739 | 534: function(t, n, e) {
740 | var i = e(535);
741 | "string" == typeof i && (i = [[t.i, i, ""]]),
742 | i.locals && (t.exports = i.locals);
743 | e(462)("f36c4806", i, !0);
744 | },
745 | 535: function(t, n, e) {
746 | (n = t.exports = e(461)(!0)),
747 | n.push([
748 | t.i,
749 | "p[data-v-7cfa3ad2]{word-break:break-all}.b-wrap[data-v-7cfa3ad2]{margin-top:14px}.b-wrap>div[data-v-7cfa3ad2]{display:inline-block;min-width:68px}",
750 | "",
751 | {
752 | version: 3,
753 | sources: [
754 | "/Users/gml/mywork/gitlab/dream/src/component/review/index.vue"
755 | ],
756 | names: [],
757 | mappings:
758 | "AACA,mBACE,oBAAsB,CACvB,AACD,yBACE,eAAiB,CAClB,AACD,6BACI,qBAAsB,AACtB,cAAgB,CACnB",
759 | file: "index.vue",
760 | sourcesContent: [
761 | "\np[data-v-7cfa3ad2] {\n word-break: break-all;\n}\n.b-wrap[data-v-7cfa3ad2] {\n margin-top: 14px;\n}\n.b-wrap > div[data-v-7cfa3ad2] {\n display: inline-block;\n min-width: 68px;\n}\n"
762 | ],
763 | sourceRoot: ""
764 | }
765 | ]);
766 | },
767 | 536: function(t, n, e) {
768 | "use strict";
769 | Object.defineProperty(n, "__esModule", { value: !0 });
770 | var i = e(469),
771 | a = (function(t) {
772 | return t && t.__esModule ? t : { default: t };
773 | })(i);
774 | n.default = {
775 | name: "d-review",
776 | props: { answer: [String], question: [String] },
777 | components: { DButton: a.default }
778 | };
779 | },
780 | 537: function(t, n) {
781 | t.exports = {
782 | render: function() {
783 | var t = this,
784 | n = t.$createElement,
785 | e = t._self._c || n;
786 | return e("div", [
787 | e("p", { domProps: { textContent: t._s(t.question) } }),
788 | t._v(" "),
789 | e("div", { staticClass: "b-wrap" }, [
790 | e(
791 | "div",
792 | [e("d-button", { attrs: { text: t.answer, type: "4" } })],
793 | 1
794 | )
795 | ])
796 | ]);
797 | },
798 | staticRenderFns: []
799 | };
800 | }
801 | });
802 | //# sourceMappingURL=chunk.0.60.js.map
803 |
--------------------------------------------------------------------------------