diff --git a/README.md b/README.md index a4385ec..25b19d1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -#daily_push +# daily_push——微信每日推送 获取各种参数的过程参考:https://www.coolapk.com/feed/38579891?shareKey=NGI3ZGZlZTM4MDBjNjMwMzdlM2M~&shareUid=3198334&shareFrom=com.coolapk.app_4.10 @@ -7,9 +7,10 @@ npm i node index.js ``` - -可以部署到coding开启自动化构建,以达到每天定时发送消息的效果。参考:https://www.coolapk.com/feed/51238147?shareKey=Zjk0N2UwZTFjNjcwNjU3YThjNjg~&shareUid=1528711&shareFrom=com.coolapk.market_13.2.1
-可以使用GitHub Actions以达到每日自动发送消息,默认发送时间为七点半。 +# 部署方式 +1、可以部署到coding开启自动化构建,以达到每天定时发送消息的效果。参考:https://www.coolapk.com/feed/51238147?shareKey=Zjk0N2UwZTFjNjcwNjU3YThjNjg~&shareUid=1528711&shareFrom=com.coolapk.market_13.2.1
+2、可以使用GitHub Actions以达到每日自动发送消息,默认发送时间为七点半。
+3、青龙面板 config.json配置说明: ```text diff --git a/index.js b/index.js index d40ca10..78b432d 100644 --- a/index.js +++ b/index.js @@ -62,7 +62,7 @@ const basicInfo = async () => { } // 获取城市id const getCityId = async () => { - await axios.get(`https://geoapi.qweather.com/v2/city/lookup?location=${configs.location}&adm=${configs.adm}&key=${configs.key}`) + await axios.get(`https://geoapi.qweather.com/v2/city/lookup?location=${encodeURIComponent(configs.location)}&adm=${encodeURIComponent(configs.adm)}&key=${configs.key}`) .then((res) => { let data = res.data; //这里获得整个请求响应对象 @@ -217,7 +217,7 @@ const sendMessage = async (accessToken,upInfo)=>{ }); } -export async function mainFn() { +async function mainFn() { await oneWords(); await basicInfo(); await getAccessToken(); @@ -239,3 +239,4 @@ mainFn().then(r => { console.log('mainFn', r, configs) }) +module.exports=mainFn; diff --git a/ql-main.js b/ql-main.js index e0e5dae..4be5596 100644 --- a/ql-main.js +++ b/ql-main.js @@ -9,7 +9,7 @@ */ const $ = new Env('微信每日推送'); const ENV = 'dayPush'; -import {mainFn} from "./index"; +const {mainFn} = require('./index.js'); // 读取环境变量: process.env[ENV] // 读取存储文件: const data = $.getdata($.name) || {}; // 写入存储文件: $.setdata(data, $.name); @@ -17,9 +17,7 @@ import {mainFn} from "./index"; !(async () => { // 代码开始 try { - mainFn().then(r => { - console.log('mainFn', r) - }) + await mainFn() }catch (error){ console.log('请检查配置文件是否正确') }