Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
A
aidso-data
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yaowentong
aidso-data
Commits
c161fbd6
Commit
c161fbd6
authored
Jun 03, 2026
by
Yaowentong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
c8aad3b3
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
198 additions
and
67 deletions
+198
-67
down_load_bot.py
aidso_geo/core/down_load_bot.py
+72
-16
feishu_interface.py
aidso_geo/core/routes/feishu_interface.py
+102
-5
interface.py
aidso_geo/core/routes/interface.py
+0
-32
process.py
aidso_geo/models/process.py
+24
-14
No files found.
aidso_geo/core/down_load_bot.py
View file @
c161fbd6
...
...
@@ -93,10 +93,10 @@ plat_form_map = {
"WXYY"
:
"文心一言"
,
"BDAI"
:
"百度ai"
,
"DYAI"
:
"抖音ai"
,
"DOUBA"
:
"豆包
安卓
版"
,
"DPA"
:
"deepseek
安卓
版"
,
"TXYBA"
:
"腾讯元宝
安卓
版"
,
"TYQWA"
:
"通义千问
安卓
版"
,
"DOUBA"
:
"豆包
手机
版"
,
"DPA"
:
"deepseek
手机
版"
,
"TXYBA"
:
"腾讯元宝
手机
版"
,
"TYQWA"
:
"通义千问
手机
版"
,
}
...
...
@@ -144,8 +144,8 @@ def to_excel(req_data_list, file_name, output_dir):
"WXYY"
:
"文心一言"
,
"BDAI"
:
"百度ai"
,
"DYAI"
:
"抖音ai"
,
"DOUBA"
:
"豆包
安卓
版"
,
"DPA"
:
"deepseek
安卓
版"
,
"DOUBA"
:
"豆包
手机
版"
,
"DPA"
:
"deepseek
手机
版"
,
}
task_list
=
[]
...
...
@@ -184,6 +184,9 @@ def export_all_brand_excel(data_list, phone, begin):
def
get_req_id
(
phone
,
begin
,
end
):
print
(
phone
)
print
(
begin
)
print
(
end
)
url
=
f
"https://openapi.aidso.com/openapi/ywt/geoReqList?phone={phone}&begin={begin} 00:00:00&end={end} 23:59:59"
payload
=
{}
...
...
@@ -508,7 +511,9 @@ def cha_report(phone_list, begin, end):
result
.
append
(
item
)
for
r
in
result
:
platforms
=
[
"DB"
,
"DOUBA"
,
"TYQW"
,
"TXYB"
]
# platforms = ["DB", "DOUBA", "TYQW", "TXYB"]
platforms
=
[
"DB"
,
"DOUBA"
,
"TYQW"
,
"TXYB"
,
"DP"
,
"DPA"
,
"TXYBA"
,
"TYQWA"
,
"BDAI"
,
"WXYY"
,
"KIMI"
,
"DYAI"
]
for
p
in
platforms
:
t_data
=
get_url_top40
(
r
.
get
(
'user_id'
),
r
.
get
(
'brand_library_id'
),
de
,
de
,
p
)
fields
=
[
"site_name"
,
"log_count"
,
"quote_ratio_percent"
]
...
...
@@ -518,7 +523,41 @@ def cha_report(phone_list, begin, end):
writer
.
write_batch_rows
(
result
)
writer
.
close
()
def
zhou_report_suggestion
(
phone
,
begin
,
end
,
brand_name
,
platform
=
None
):
req_list
=
get_req_id
(
phone
,
begin
,
end
)
req_time_map
=
{}
req_ids
=
[]
for
item
in
req_list
:
print
(
item
)
if
item
.
get
(
'brand_name'
)
==
brand_name
:
req_id
=
item
.
get
(
"req_id"
)
created_at
=
item
.
get
(
"created_at"
)
req_ids
.
append
(
req_id
)
req_time_map
[
req_id
]
=
created_at
req_id_sql
=
","
.
join
([
f
"'{req_id}'"
for
req_id
in
req_ids
])
if
platform
:
platform_list
=
","
.
join
([
f
"'{p}'"
for
p
in
platform
])
query_sql
=
f
"select * from geo_commit_task where reqId in ({req_id_sql}) and platform in ({platform_list}) "
else
:
query_sql
=
f
"select * from geo_commit_task where reqId in ({req_id_sql})"
query_list
=
bh_utils
.
query_data
(
query_sql
)
result
=
[]
if
query_list
:
for
q
in
query_list
:
r
=
{
"prompt"
:
q
.
get
(
'prompt'
),
"platform"
:
plat_form_map
[
q
.
get
(
'platform'
)],
"suggestions"
:
tos_utils
.
get_string_from_tos
(
f
"geo/{q.get('taskId')}/{q.get('platform')}/suggestions.txt"
),
"created_at"
:
req_time_map
[
q
.
get
(
'reqId'
)],
}
result
.
append
(
r
)
all_file
=
f
"/Users/yaowentong/Desktop/{brand_name}_all.txt"
with
open
(
all_file
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
for
item
in
result
:
f
.
write
(
json
.
dumps
(
item
,
ensure_ascii
=
False
)
+
"
\n\n\n
"
)
def
qian_report
(
phone
,
begin
,
end
,
brand_name
,
platform
=
None
):
req_list
=
get_req_id
(
phone
,
begin
,
end
)
...
...
@@ -533,7 +572,6 @@ def qian_report(phone, begin, end, brand_name,platform=None):
req_time_map
[
req_id
]
=
created_at
req_id_sql
=
","
.
join
([
f
"'{req_id}'"
for
req_id
in
req_ids
])
if
platform
:
platform_list
=
","
.
join
([
f
"'{p}'"
for
p
in
platform
])
query_sql
=
f
"select * from geo_commit_task where reqId in ({req_id_sql}) and platform in ({platform_list}) "
...
...
@@ -558,7 +596,7 @@ def qian_report(phone, begin, end, brand_name,platform=None):
for
item
in
result
:
f
.
write
(
json
.
dumps
(
item
,
ensure_ascii
=
False
)
+
"
\n\n\n
"
)
remove_keys
=
{
"
url"
,
"
site_icon"
,
"task_id"
,
"quto_id"
}
remove_keys
=
{
"site_icon"
,
"task_id"
,
"quto_id"
}
data
=
[]
with
open
(
all_file
,
"r"
,
encoding
=
"utf-8"
)
as
f
:
for
line
in
f
:
...
...
@@ -599,7 +637,7 @@ def zhou_report(phone, begin, end, brand_name):
created_at
=
item
.
get
(
"created_at"
)
req_ids
.
append
(
req_id
)
req_time_map
[
req_id
]
=
created_at
print
(
req_ids
)
result
=
[]
platform_data
=
get_platforms
(
brand_id
,
user_id
,
begin
,
end
)
...
...
@@ -727,6 +765,18 @@ def zhou_report(phone, begin, end, brand_name):
"引用网站"
:
quto_statistics
.
get
(
'site_count'
),
})
print
(
quto_statistics_result
)
return
{
"brand_overview_result"
:
brand_overview_result
,
"result"
:
result
,
"all_word_result"
:
all_word_result
,
"overview_result"
:
overview_result
,
"platform_sentiment_result"
:
platform_sentiment_result
,
"url_top_40_result"
:
url_top_40_result
,
"site_category_result"
:
site_category_result
,
"positive_top_result"
:
positive_top_result
,
"negative_top_result"
:
negative_top_result
,
"quto_statistics_result"
:
quto_statistics_result
}
def
cha_report_video
(
videoId
):
...
...
@@ -898,10 +948,16 @@ if __name__ == "__main__":
# AIDSO爱搜 这个品牌
# 最近7天
# 所有问题
phone
=
13810898434
begin
=
'2026-05-13'
end
=
'2026-05-20'
brand_name
=
'AIDSO爱搜'
platform
=
[
'DB'
]
dao_report
(
phone
,
begin
,
end
,
brand_name
,
platform
)
phone
=
15652410076
begin
=
'2026-05-11'
end
=
'2026-06-02'
brand_name
=
[
'葆蝶家-第一批'
,
'葆蝶家-第二批'
,
'BV葆蝶家'
,
'葆蝶家'
]
for
b
in
brand_name
:
zhou_report
(
phone
,
begin
,
end
,
b
)
qian_report
(
phone
,
begin
,
end
,
b
)
# qian_report(phone,begin,end,b)
# brand_name = 'AIDSO爱搜'
# platform = ['DB']
# dao_report(phone, begin, end, brand_name, platform)
# qian_report(start, end, keyword_list, file_name)
\ No newline at end of file
aidso_geo/core/routes/feishu_interface.py
View file @
c161fbd6
import
json
import
secrets
from
datetime
import
datetime
from
flask
import
request
,
jsonify
,
Flask
,
Blueprint
import
requests
from
aidso_geo.core.feishu_snipaste
import
init_redis4
,
send_message
,
webhook_snipaste
from
aidso_geo.utils
import
bh_utils
,
tos_utils
feishu_app
=
Blueprint
(
"feishu_app"
,
__name__
)
from
loguru
import
logger
...
...
@@ -62,6 +61,104 @@ def webhook():
send_message
(
"----格式错误需要用 ||| 分割每一个问题-----"
)
return
jsonify
({
"code"
:
0
})
if
__name__
==
'__main__'
:
print
(
r
.
scard
(
'mt_third_task'
))
plat_form_map
=
{
"DP"
:
"deepseek网页版"
,
"DB"
:
"豆包网页版"
,
"TXYB"
:
"腾讯元宝"
,
"TYQW"
:
"通义千问"
,
"KIMI"
:
"kimi"
,
"WXYY"
:
"文心一言"
,
"BDAI"
:
"百度ai"
,
"DYAI"
:
"抖音ai"
,
"DOUBA"
:
"豆包手机版"
,
"DPA"
:
"deepseek手机版"
,
}
def
get_req_id
(
phone
,
begin
,
end
):
url
=
f
"https://openapi.aidso.com/openapi/ywt/geoReqList?phone={phone}&begin={begin} 00:00:00&end={end} 23:59:59"
payload
=
{}
headers
=
{
'Authorization'
:
''
}
response
=
requests
.
request
(
"GET"
,
url
,
headers
=
headers
,
data
=
payload
)
return
response
.
json
()
.
get
(
'data'
)
def
success
(
data
=
None
,
msg
=
"success"
):
return
jsonify
({
"code"
:
200
,
"data"
:
data
,
"msg"
:
msg
})
def
fail
(
msg
=
"fail"
,
data
=
None
):
return
jsonify
({
"code"
:
400
,
"data"
:
data
,
"msg"
:
msg
})
@
feishu_app
.
route
(
"/feishu/export"
,
methods
=
[
"POST"
])
def
qian_report
():
data
=
request
.
get_json
()
or
{}
phone
=
data
.
get
(
"phone"
)
begin
=
data
.
get
(
"begin"
)
end
=
data
.
get
(
"end"
)
brand_name
=
data
.
get
(
"brand_name"
,
[])
platform
=
data
.
get
(
"platform"
)
# 非必填,可能是 None
if
not
phone
:
return
fail
(
"phone不能为空"
)
if
not
begin
:
return
fail
(
"begin不能为空"
)
if
not
end
:
return
fail
(
"end不能为空"
)
if
not
brand_name
:
return
fail
(
"brand_name不能为空"
)
if
not
isinstance
(
brand_name
,
list
):
return
fail
(
"brand_name必须是数组"
)
if
platform
and
not
isinstance
(
platform
,
list
):
return
fail
(
"platform必须是数组"
)
req_list
=
get_req_id
(
phone
,
begin
,
end
)
try
:
req_time_map
=
{}
req_brand_map
=
{}
req_ids
=
[]
for
b
in
brand_name
:
for
item
in
req_list
:
if
item
.
get
(
'brand_name'
)
==
b
:
req_id
=
item
.
get
(
"req_id"
)
created_at
=
item
.
get
(
"created_at"
)
req_ids
.
append
(
req_id
)
req_time_map
[
req_id
]
=
created_at
req_brand_map
[
req_id
]
=
b
req_id_sql
=
","
.
join
([
f
"'{req_id}'"
for
req_id
in
req_ids
])
if
platform
:
platform_list
=
","
.
join
([
f
"'{p}'"
for
p
in
platform
])
query_sql
=
f
"select * from geo_commit_task where reqId in ({req_id_sql}) and platform in ({platform_list})"
else
:
query_sql
=
f
"select * from geo_commit_task where reqId in ({req_id_sql})"
query_list
=
bh_utils
.
query_data
(
query_sql
)
result
=
[]
if
query_list
:
for
q
in
query_list
:
r
=
{
"prompt"
:
q
.
get
(
'prompt'
),
"platform"
:
plat_form_map
[
q
.
get
(
'platform'
)],
"content"
:
tos_utils
.
get_string_from_tos
(
f
"geo/{q.get('taskId')}/{q.get('platform')}/context.txt"
),
"quote"
:
tos_utils
.
get_string_from_tos
(
f
"geo/{q.get('taskId')}/{q.get('platform')}/quote.txt"
),
"created_at"
:
req_time_map
[
q
.
get
(
'reqId'
)],
"brand_name"
:
req_brand_map
[
q
.
get
(
'reqId'
)],
}
result
.
append
(
r
)
return
success
(
result
)
except
Exception
as
e
:
return
fail
(
'fail'
)
aidso_geo/core/routes/interface.py
View file @
c161fbd6
...
...
@@ -155,31 +155,6 @@ def task_commit():
"status"
:
f
"缺少必要字段:{', '.join(missing_fields)}"
,
"reqId"
:
req_id
})
# logger.success(f"{req_id}--{platform}--{prompt}--{type}")
# ret = redis_client8.lpush("geo:task_commit:list",json.dumps(data, ensure_ascii=False))
# if ret and ret > 0:
# resp_cache_key = f"geo:task_check:resp:{req_id}"
# resp = {
# "code": 200,
# "msg": "success",
# "data": {
# "status": 'ING',
# "result": {}
# }
# }
# _cache_set_json(resp_cache_key, resp, 10)
# return jsonify({
# "code": 200,
# "msg": "任务已提交",
# "reqId": req_id
# })
#
# else:
# return jsonify({
# "code": 400,
# "msg": "提交失败",
# "reqId": req_id
# })
if
type
==
'stream'
:
insert_ok
=
commit_task
(
data
,
'ING'
)
ok
=
submit_background_task
(
main_process
,
data
)
...
...
@@ -211,13 +186,6 @@ def task_commit():
"msg"
:
"任务已提交"
,
"reqId"
:
req_id
})
# ok = submit_background_task(main_process, data)
# if ok:
# return jsonify({
# "code": 200,
# "msg": 'success',
# "reqId": req_id
# })
return
jsonify
({
"code"
:
503
,
...
...
aidso_geo/models/process.py
View file @
c161fbd6
...
...
@@ -1197,6 +1197,7 @@ def attach_favorability_score(score_list, word_list):
def
attach_favorability_brand_score
(
score_list
,
word_list
):
# 先构建品牌分数字典
score_map
=
{
item
.
get
(
"brand_name"
):
item
.
get
(
"favorability_score"
,
0
)
for
item
in
score_list
...
...
@@ -1435,7 +1436,6 @@ def result_v2(response_content, data):
product_map_list_with_rank
,
all_product_list_with_rank
=
merge_com_and_ai_by_subset
(
product_map_list_with_rank
,
all_product_list_with_rank
)
# 获取产品词的分
product_map_list_with_rank
=
attach_favorability_brand_score
(
all_product_sentiment_and_mentions_score
,
...
...
@@ -1508,14 +1508,21 @@ def result_v2(response_content, data):
"totalCompetitorCount"
:
com_count_sum
,
"mentionsList"
:
mentionsList
}
# 修复里外不一致
result
[
"productVos"
]
=
rebuild_count_and_rank
(
result
.
get
(
"productVos"
)
or
[])
# 情感分
pos_count
=
len
(
mentionsList
[
0
]
.
get
(
"positiveMentions"
,
[])
or
[])
neg_count
=
len
(
mentionsList
[
0
]
.
get
(
"negativeMentions"
,
[])
or
[])
total
=
pos_count
+
neg_count
sentimentScore
=
int
((
pos_count
/
total
)
*
100
)
if
total
>
0
else
50
result
[
'sentimentScore'
]
=
sentimentScore
# 品牌情感倾向
if
brand_words_list_with_rank
:
sentiment_result
=
get_first_sentiment
(
brand_words_list_with_rank
)
if
sentiment_result
:
result
[
'sentiment'
]
=
sentiment_result
score_result
=
get_first_score
(
brand_words_list_with_rank
)
if
score_result
:
result
[
'sentimentScore'
]
=
score_result
# ---------------------------------结果整合-----------------------------
...
...
@@ -1639,7 +1646,9 @@ def main_process(data):
req_id
=
data
.
get
(
'reqId'
)
prompt
=
data
.
get
(
'prompt'
)
data
[
"prompt"
]
=
prompt
.
strip
()
data
[
"search_enabled"
]
=
data
.
get
(
'searchEnabled'
,
'1'
)
if
data
.
get
(
'thinkingEnabled'
):
data
[
"thinking_enabled"
]
=
data
.
get
(
'thinkingEnabled'
)
check
=
bh_utils
.
query_data
(
f
"select status from geo_commit_task where taskId ='{task_id}' and platform = '{platform}'"
)
...
...
@@ -1829,8 +1838,8 @@ if __name__ == '__main__':
from
concurrent.futures
import
ThreadPoolExecutor
,
as_completed
#
# begin = '2026-05-2
2
'
# end = '2026-05-2
2
'
# begin = '2026-05-2
3
'
# end = '2026-05-2
9
'
# req_list = get_req_id(15100000026,begin,end)
#
# req_ids = []
...
...
@@ -1838,14 +1847,15 @@ if __name__ == '__main__':
# req_id = item.get("req_id")
# req_ids.append(req_id)
# req_id_sql = ",".join([f"'{req_id}'" for req_id in req_ids])
query_sql
=
f
"select * from geo_commit_task where type = 'stream_batch' and status != 'SUCCESS'"
data_list
=
bh_utils
.
query_data
(
query_sql
)
# print(len(data_list))
#
# query_sql = f"select * from geo_commit_task where reqId in ({req_id_sql}) "
# data_list = bh_utils.query_data(query_sql)
#
data_list
=
bh_utils
.
query_data
(
f
"select * from geo_commit_task where reqId='38a293ed-407c-477a-a7b9-2a22d02e6de7' "
)
# #
# #
# # # #
# data_list = bh_utils.query_data(f"select * from geo_commit_task where status !='SUCCESS' and type = 'stream_batch' ")
# # #
# # #
# # # # #
def
handle_item
(
i
):
if
i
.
get
(
'comWordsMap'
):
i
[
'comWordsMap'
]
=
json
.
loads
(
i
.
get
(
'comWordsMap'
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment