Skip to content
This repository has been archived by the owner on Jan 14, 2025. It is now read-only.

Commit

Permalink
test(smoba): task_complete
Browse files Browse the repository at this point in the history
  • Loading branch information
HdShare committed Jun 17, 2024
1 parent a58aa72 commit 4780999
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
31 changes: 18 additions & 13 deletions src/smoba/SmobaEntry.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,20 @@ def task_complete(task_id, task_desc):
# print("每天任意点赞营地1条内容")
list_info_moment = HttpApi.list_info_moment()
if list_info_moment is not None:
i = -1
if list_info_moment["data"]["list"][i]["showType"] == 0:
if HttpApi.like_info(list_info_moment["data"]["list"][i]["infoContent"]["infoId"], "1") is not None:
send_content += ">任务成功: 点赞资讯完成\n"
else:
send_content += ">任务失败: 点赞资讯出错\n"
elif list_info_moment["data"]["list"][i]["showType"] == 1:
if HttpApi.like_moment(list_info_moment["data"]["list"][i]["momentId"], True) is not None:
send_content += ">任务成功: 点赞动态完成\n"
else:
send_content += ">任务失败: 点赞动态出错\n"
is_success = False
for item in reversed(list_info_moment["data"]["list"]):
if item["type"] == 14:
if HttpApi.like_info(item["infoContent"]["infoId"], "1") is not None:
is_success = True
break
elif item["type"] == 2:
if HttpApi.like_moment(item["momentId"], True) is not None:
is_success = True
break
if is_success:
send_content += ">任务成功: 点赞内容完成\n"
else:
send_content += ">任务失败: 未知列表类型\n"
send_content += ">任务失败: 点赞内容出错\n"
else:
send_content += ">任务失败: 获取列表出错\n"
elif task_id == "2024010800001":
Expand All @@ -48,10 +49,14 @@ def task_complete(task_id, task_desc):
if list_info_moment is not None:
is_success = False
for item in reversed(list_info_moment["data"]["list"]):
if item["showType"] == 0:
if item["type"] == 14:
if HttpApi.detail_info(item["infoContent"]["infoId"]) is not None:
is_success = True
break
elif item["type"] == 15:
if HttpApi.detail_post(item["postContent"]["postId"]) is not None:
is_success = True
break
if is_success:
send_content += ">任务成功: 浏览资讯完成\n"
else:
Expand Down
10 changes: 10 additions & 0 deletions src/smoba/http/HttpApi.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ def detail_info(info_id):
return resp_json


def detail_post(info_id):
resp_json = HttpUtil.post_api_data(
"/game/detailinfobbs",
{
"iInfoId": info_id,
}
)
return resp_json


def detail_moment(moment_id):
resp_json = HttpUtil.post_api_json(
"/campcontent/detail",
Expand Down

0 comments on commit 4780999

Please sign in to comment.