diff --git a/README.md b/README.md index 1ff3dc8..e968619 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,11 @@ > 对单个签到进行测试,配置好 `config.json` 进入对应的签到脚本目录运行即可 -### 方法二: 腾讯云函数使用 +### 方法二: Docker 使用 + +文档待完成 + +### 方法三: 腾讯云函数使用 > (腾讯云函数相关教程请自行百度) @@ -64,11 +68,7 @@ 4. 上传至【腾讯云函数】 5. 配置定时触发器 -#### TODO - -喜马拉雅极速版脚本运行方式 - -### 方法三: GitHub Action 使用 +### 方法四: GitHub Action 使用 #### 环境变量说明 @@ -93,7 +93,8 @@ |MOTTO|每日一句|非必须|是否开启默认为 false|true| |XMLY_COOKIE_LIST|喜马拉雅极速版|非必须|喜马拉雅极速版 cookie|[ { "xmly_cookie": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" } ]| |ONEPLUSBBS_COOKIE_LIST|一加手机社区官方论坛|非必须|[一加手机社区官方论坛](https://www.oneplusbbs.com/) 账户的 cookie|[ { "oneplusbbs_cookie": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" } ]| -|QQREAD_ACCOUNT_LIST|QQ Read|非必须|QQ Read 账户的 `qqread_bodys`,`qqread_bodys`,`qqread_timeurl` 信息,获取方法参考:[README.md](https://github.com/Water008/qqread/blob/main/README.md#%E4%B8%BB%E8%A6%81%E5%8F%82%E6%95%B0)|[ { "qqread_bodys": { "common": { "appid": "xxxxxxxxxx", "areaid": "xxxxxxxxxx", "qq_ver": "xxxxxxxxxx", "os_ver": "xxxxxxxxxx", "mp_ver": "xxxxxxxxxx", "mpos_ver": "xxxxxxxxxx", "brand": "xxxxxxxxxx", "model": "xxxxxxxxxx", "screenWidth": "xxxxxxxxxx", "screenHeight": "xxxxxxxxxx", "windowWidth": "xxxxxxxxxx", "windowHeight": "xxxxxxxxxx", "openid": "xxxxxxxxxx", "guid": "xxxxxxxxxx", "session": "xxxxxxxxxx", "scene": "xxxxxxxxxx", "source": "xxxxxxxxxx", "hasRedDot": "xxxxxxxxxx", "missions": "xxxxxxxxxx", "caseID": "xxxxxxxxxx" }, "dataList": [ { "click1": "xxxxxxxxxx", "click2": "xxxxxxxxxx", "route": "xxxxxxxxxx", "refer": "xxxxxxxxxx", "options": { "bid": "xxxxxxxxxx", "cid": "xxxxxxxxxx" }, "dis": 1607589409986, "ext6": 26, "eventID": "xxxxxxxxxx", "type": "xxxxxxxxxx", "ccid": 1, "bid": "xxxxxxxxxx", "bookStatus": 1, "bookPay": 0, "chapterStatus": 0, "ext1": { "font": 18, "bg": 0, "pageMode": 1 }, "from": "xxxxxxxxxx" } ] }, "qqread_headers": { "Accept": "*/*", "ywsession": "xxxxxxxxxx", "Connection": "keep-alive", "Content-Type": "application/json", "Cookie": "ywguid=xxxxxxxxxx", "Host": "mqqapi.reader.qq.com", "User-Agent": "xxxxxxxxxx", "Referer": "xxxxxxxxxx", "Accept-Language": "zh-cn", "Accept-Encoding": "gzip, deflate, br", "mpversion": "0.32.5" }, "qqread_timeurl": "https://mqqapi.reader.qq.com/mqq/addReadTimeWithBid?xxxxxxxxxx" } ]| +|QQREAD_ACCOUNT_LIST|QQ Read|非必须|QQ Read 账户的 `qqread_bodys`,`qqread_bodys`,`qqread_timeurl` 信息,获取方法参考:[README.md](https://github.com/Water008/qqread/blob/main/README.md#%E4%B8%BB%E8%A6%81%E5%8F%82%E6%95%B0)|[ { "qqread_bodys": { "common": { "appid": "xxxxxxxxxx", "areaid": "xxxxxxxxxx", "qq_ver": "xxxxxxxxxx", "os_ver": "xxxxxxxxxx", "mp_ver": "xxxxxxxxxx", "mpos_ver": "xxxxxxxxxx", "brand": "xxxxxxxxxx", "model": "xxxxxxxxxx", "screenWidth": "xxxxxxxxxx", "screenHeight": "xxxxxxxxxx", "windowWidth": "xxxxxxxxxx", "windowHeight": "xxxxxxxxxx", "openid": "xxxxxxxxxx", "guid": "xxxxxxxxxx", "session": "xxxxxxxxxx", "scene": "xxxxxxxxxx", "source": "xxxxxxxxxx", "hasRedDot": "xxxxxxxxxx", "missions": "xxxxxxxxxx", "caseID": "xxxxxxxxxx" }, "dataList": [ { "click1": "xxxxxxxxxx", "click2": "xxxxxxxxxx", "route": "xxxxxxxxxx", "refer": "xxxxxxxxxx", "options": { "bid": "xxxxxxxxxx", "cid": "xxxxxxxxxx" }, "dis": 1607589409986, "ext6": 26, "eventID": "xxxxxxxxxx", "type": "xxxxxxxxxx", "ccid": 1, "bid": "xxxxxxxxxx", "bookStatus": 1, "bookPay": 0, "chapterStatus": 0, "ext1": { "font": 18, "bg": 0, "pageMode": 1 }, "from": "xxxxxxxxxx" } ] }, "qqread_headers": { "Accept": "* +/*", "ywsession": "xxxxxxxxxx", "Connection": "keep-alive", "Content-Type": "application/json", "Cookie": "ywguid=xxxxxxxxxx", "Host": "mqqapi.reader.qq.com", "User-Agent": "xxxxxxxxxx", "Referer": "xxxxxxxxxx", "Accept-Language": "zh-cn", "Accept-Encoding": "gzip, deflate, br", "mpversion": "0.32.5" }, "qqread_timeurl": "https://mqqapi.reader.qq.com/mqq/addReadTimeWithBid?xxxxxxxxxx" } ]| ## 获取 Cookie 教程(以爱奇艺为例) diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..481a377 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,27 @@ +FROM python:3.8-alpine +MAINTAINER Sitoi + +WORKDIR /dailycheckin + +ENV CRONTAB_LIST_FILE crontab_list.sh +RUN set -ex \ + && apk update && apk upgrade\ + && apk add --no-cache tzdata moreutils git gcc g++ py-pip mysql-dev linux-headers libffi-dev openssl-dev\ + && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ + && echo "Asia/Shanghai" > /etc/timezone + +RUN git clone https://github.com/Sitoi/DailyCheckIn.git /dailycheckin \ + && cd /dailycheckin \ + && mkdir logs \ + && pip install -r requirements.txt + +COPY . /dailycheckin + +# GitHub Actions 构建 +COPY ./docker/start.sh /usr/local/bin +# 本地构建 +# COPY ./start.sh /usr/local/bin + +RUN chmod +x /usr/local/bin/start.sh + +ENTRYPOINT ["start.sh"] \ No newline at end of file diff --git a/docker/Makefile b/docker/Makefile new file mode 100644 index 0000000..5b4cbbf --- /dev/null +++ b/docker/Makefile @@ -0,0 +1,16 @@ +.PHONY: build up stop pull logs rm exec + +build: + docker-compose build --no-cache +up: + docker-compose up -d +stop: + docker-compose stop +rm: stop + docker-compose rm +pull: + docker-compose pull +logs: + docker-compose logs -f +exec: + docker exec -it dailycheckin sh \ No newline at end of file diff --git a/docker/config.template.json b/docker/config.template.json new file mode 100644 index 0000000..87b1c80 --- /dev/null +++ b/docker/config.template.json @@ -0,0 +1,137 @@ +{ + "dingtalk": { + "dingtalk_secret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "dingtalk_access_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + "server": { + "sckey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + "qmsg": { + "qmsg_key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + "telegram": { + "tg_bot_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "tg_user_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + }, + "weather": [ + "上海" + ], + "motto": true, + "iqiyi": [ + { + "iqiyi_cookie": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + } + ], + "vqq": [ + { + "vqq_cookie": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + } + ], + "52pojie": [ + { + "pojie_cookie": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + } + ], + "youdao": [ + { + "youdao_cookie": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + } + ], + "kgqq": [ + { + "kgqq_cookie": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + } + ], + "music163": [ + { + "music163_phone": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "music163_password": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + } + ], + "xmly": [ + { + "xmly_cookie": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + } + ], + "oneplusbbs": [ + { + "oneplusbbs_cookie": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + } + ], + "qqread": [ + { + "qqread_bodys": { + "common": { + "appid": "xxxxxxxxxx", + "areaid": "xxxxxxxxxx", + "qq_ver": "xxxxxxxxxx", + "os_ver": "xxxxxxxxxx", + "mp_ver": "xxxxxxxxxx", + "mpos_ver": "xxxxxxxxxx", + "brand": "xxxxxxxxxx", + "model": "xxxxxxxxxx", + "screenWidth": "xxxxxxxxxx", + "screenHeight": "xxxxxxxxxx", + "windowWidth": "xxxxxxxxxx", + "windowHeight": "xxxxxxxxxx", + "openid": "xxxxxxxxxx", + "guid": "xxxxxxxxxx", + "session": "xxxxxxxxxx", + "scene": "xxxxxxxxxx", + "source": "xxxxxxxxxx", + "hasRedDot": "xxxxxxxxxx", + "missions": "xxxxxxxxxx", + "caseID": "xxxxxxxxxx" + }, + "dataList": [ + { + "click1": "xxxxxxxxxx", + "click2": "xxxxxxxxxx", + "route": "xxxxxxxxxx", + "refer": "xxxxxxxxxx", + "options": { + "bid": "xxxxxxxxxx", + "cid": "xxxxxxxxxx" + }, + "dis": 1607589409986, + "ext6": 26, + "eventID": "xxxxxxxxxx", + "type": "xxxxxxxxxx", + "ccid": 1, + "bid": "xxxxxxxxxx", + "bookStatus": 1, + "bookPay": 0, + "chapterStatus": 0, + "ext1": { + "font": 18, + "bg": 0, + "pageMode": 1 + }, + "from": "xxxxxxxxxx" + } + ] + }, + "qqread_headers": { + "Accept": "*/*", + "ywsession": "xxxxxxxxxx", + "Connection": "keep-alive", + "Content-Type": "application/json", + "Cookie": "ywguid=xxxxxxxxxx", + "Host": "mqqapi.reader.qq.com", + "User-Agent": "xxxxxxxxxx", + "Referer": "xxxxxxxxxx", + "Accept-Language": "zh-cn", + "Accept-Encoding": "gzip, deflate, br", + "mpversion": "0.32.5" + }, + "qqread_timeurl": "https://mqqapi.reader.qq.com/mqq/addReadTimeWithBid?xxxxxxxxxx" + } + ], + "baidu_url_submit": [ + { + "data_url": "https://cdn.jsdelivr.net/gh/Sitoi/Sitoi.github.io/baidu_urls.txt", + "submit_url": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "times": 10 + } + ] +} \ No newline at end of file diff --git a/docker/crontab_list.sh b/docker/crontab_list.sh new file mode 100644 index 0000000..98a983b --- /dev/null +++ b/docker/crontab_list.sh @@ -0,0 +1,15 @@ +#必须要的默认定时任务请勿删除 +52 */1 * * * sh /dailycheckin/docker/default_task.sh >> /dailycheckin/logs/default_task.log 2>&1 +# 每 3 天的 23:50 分清理一次日志 +50 23 */3 * * rm -rf /dailycheckin/logs/*.log + + +##############每日签到一次任务############## +# 每日签到(8:45 执行一次) +45 9 * * * python /dailycheckin/index.py >> /dailycheckin/logs/dailycheckin.log 2>&1 + +##############每日签到定时任务############## +# 企鹅读书 +*/11 * * * * python /dailycheckin/index.py qqread >> /dailycheckin/logs/qqread.log 2>&1 +# 喜马拉雅极速版 +*/30 * * * * python /dailycheckin/index.py xmly >> /dailycheckin/logs/xmly.log 2>&1 diff --git a/docker/default_task.sh b/docker/default_task.sh new file mode 100644 index 0000000..096a63d --- /dev/null +++ b/docker/default_task.sh @@ -0,0 +1,6 @@ +#!/bin/sh +set -e + +echo "定时任务更新代码,git 拉取最新代码,并安装更新依赖..." +git -C /dailycheckin pull +pip install -r requirements.txt \ No newline at end of file diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..82ac404 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,19 @@ +version: '3' +services: + dailycheckin: + build: + context: . + image: sitoi/dailycheckin:latest + container_name: dailycheckin + restart: always + tty: true + volumes: + - ./config.json:/dailycheckin/config.json + - ./logs:/dailycheckin/logs +# environment: +# - IS_GITHUB_ACTION=true +# - ONLY_MESSAGE=xmly +# - DINGTALK_SECRET=SECb7ee6efb290d5497fe1cf4c023a4c2c15b11e69e7e449b4dc38fd0aa1d18ae47 +# - DINGTALK_ACCESS_TOKEN=c4eb939ba9e3a802abb152e32aeab8cce2b2453cb89105448661ffb78eb8155e +# - SCKEY=SCU95609Tf17dfd3ca51ec0afddd831889067168f5ea58ce80ded2 +# - XMLY_COOKIE_LIST=[{"xmly_cookie":"1&_device=iPhone&7776C49C-5461-4DCB-A826-E9A03CA1C42E&1.1.12; 1&_token=250646404&DB430390140NDACAA6CCAE7A22D60D1CDB29E34C0571ED9ACB921227BA3264F5781424808B3613M36522277A472443_; NSUP=; XUM=7776C49C-5461-4DCB-A826-E9A03CA1C42E; ainr=0; c-oper=%E6%9C%AA%E7%9F%A5; channel=ios-b1; device_model=iPhone 11; idfa=00000000-0000-0000-0000-000000000000; impl=com.ximalaya.tingLite; ip=2409:8804:883a:954c:42:908:100:0; net-mode=WIFI; res=828%2C1792; _xmLog=xm_khcrooun81cmpf"}] diff --git a/docker/start.sh b/docker/start.sh new file mode 100644 index 0000000..d4e0d7e --- /dev/null +++ b/docker/start.sh @@ -0,0 +1,18 @@ +#!/bin/sh +set -e + +export LANG="zh_CN.UTF-8" + +echo "定时任务更新代码,git 拉取最新代码,并安装更新依赖..." +git -C /dailycheckin pull +pip install -r requirements.txt + +sed -i 's/>>/|ts >>/g' $CRONTAB_LIST_FILE +crontab $CRONTAB_LIST_FILE + +echo "Load the latest crontab task file..." +echo "加载最新的定时任务文件..." + +echo "Start crontab task main process..." +echo "启动crondtab定时任务主进程..." +crond -f \ No newline at end of file