Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix run2 argv error #13

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 42 additions & 14 deletions .github/workflows/run.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
name: 刷步数

on:
#push:
# branches: [ main ]
#pull_request:
# branches: [ main ]
schedule:
- cron: '9 0,2,5,7,9,11,13 * * *'
watch:
types: started
- cron: '11 18 * * *'
workflow_dispatch:
inputs:
user:
description: '用户名'
required: true
default: ''
pwd:
description: '密码'
required: true
default: ''
open_get_weather:
description: '是否使用当地天气'
required: false
default: 'True'
area:
description: '地区'
required: false
default: '北京'

jobs:
build:
Expand All @@ -23,17 +34,34 @@ jobs:
run: |
sudo -E apt-get -qq update
sudo -E apt-get install zsh -y

- name: 初始化Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: 开始
run: |
pip3 install requests
user='${{ secrets.USER }}'
passwd='${{ secrets.PWD }}'
open_get_weather='${{ secrets.OPEN_GET_WEATHER }}'
area='${{ secrets.AREA }}'
python3 main.py ${user} ${passwd} ${open_get_weather} ${area}

user='${{ github.event.inputs.user }}'
if [ -z "$user" ]; then
user='${{ secrets.USER }}'
fi

pwd='${{ github.event.inputs.pwd }}'
if [ -z "$pwd" ]; then
pwd='${{ secrets.PWD }}'
fi

open_get_weather='${{ github.event.inputs.open_get_weather }}'
if [ -z "$open_get_weather" ]; then
open_get_weather='${{ secrets.OPEN_GET_WEATHER }}'
fi

area='${{ github.event.inputs.area }}'
if [ -z "$area" ]; then
area='${{ secrets.AREA }}'
fi

python3 main.py ${user} ${pwd} ${open_get_weather} ${area}
51 changes: 0 additions & 51 deletions .github/workflows/run2.yml

This file was deleted.

2 changes: 0 additions & 2 deletions ant-forest-deployment-tool.min.js

This file was deleted.

37 changes: 14 additions & 23 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,24 +127,19 @@ def getBeijinTime():
else:
print("获取北京时间失败")
return
if min_1 != 0 and max_1 != 0:
user_mi = sys.argv[1]
# 登录密码
passwd_mi = sys.argv[2]
user_list = user_mi.split('#')
passwd_list = passwd_mi.split('#')
if len(user_list) == len(passwd_list):
if K != 1.0:
msg_mi = "由于天气" + type + ",已设置降低步数,系数为" + str(K) + "。\n"
else:
msg_mi = ""
for user_mi, passwd_mi in zip(user_list, passwd_list):
msg_mi += main(user_mi,passwd_mi,min_1, max_1)
#print(msg_mi)
else:
print("当前不是主人设定的提交步数时间或者主人设置了0步数呢,本次不提交")
return

step_max = 20480
step_min = 10240
user_mi = sys.argv[1]
# 登录密码
passwd_mi = sys.argv[2]
user_list = user_mi.split('#')
passwd_list = passwd_mi.split('#')
if len(user_list) == len(passwd_list):
if K != 1.0:
print(f'由于天气{type},已设置降低步数,系数为${K}')
for user_mi, passwd_mi in zip(user_list, passwd_list):
main(user_mi, passwd_mi, step_min, step_max)

# 获取登录code
def get_code(location):
Expand Down Expand Up @@ -207,8 +202,8 @@ def main(_user,_passwd,min_1, max_1):
return

if step == '':
print("已设置为随机步数(" + str(min_1) + "~" + str(max_1) + ")")
step = str(random.randint(min_1, max_1))
print("已设置为随机步数(" + step + ")")
else:
step = str(step)
login_token = 0
Expand Down Expand Up @@ -241,7 +236,7 @@ def main(_user,_passwd,min_1, max_1):
response = requests.post(url, data=data, headers=head).json()
# print(response)
result = f"[{now}]\n账号:{user[:3]}****{user[7:]}\n修改步数({step})[" + response['message'] + "]\n"
#print(result)
print(result)
return result


Expand All @@ -262,9 +257,5 @@ def get_app_token(login_token):
# print(app_token)
return app_token


def main_handler(event, context):
getBeijinTime()

if __name__ == "__main__":
getBeijinTime()