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

修复BUG,并新增Vercel部署方式 #3

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Next Next commit
修复BUG,并新增Vercel部署方式
天气推送内容缺失部分修复
Readme可以一键克隆部署
测试vercel-php@0.4.0因php版本过高无法正常运行weather.php
KurococLiu committed Sep 15, 2021
commit 65c114a5d85b58b4d81633b64f42a937d5e8c486
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Vercel部署

直接 New Project - Import Third-Party Git Repository → - 在 Enter the URL of a Git repository to deploy it: 填入:`https://github.com/6isixi/WxWork_Push.git` - 填入你的仓库名字,保持 Create private Git Repository 勾选,然后进自己克隆的库里面 `/index.php` 填写 `cropid` `secret` `agentid`三 个值即可。

<a href="https://vercel.com/new/clone?s=https%3A%2F%2Fgithub.com%2F6isixi%2FWxWork_Push"><img src="https://vercel.com/button"></a>

## WxWork_Push是什么

利用企业微信的Api,实现推送消息到微信上
12 changes: 12 additions & 0 deletions api/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
$file= __DIR__ . '/..'.$_SERVER["PHP_SELF"];

if(file_exists($file))
{
return false;
}
else
{
require_once __DIR__ . '/../index.php';
}
#echo $_SERVER["PHP_SELF"];
10 changes: 10 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"functions": {
"api/index.php": {
"runtime": "vercel-php@0.2.0"
}
},
"routes": [
{ "src": "/(.*)", "dest": "/api/index.php" }
]
}
6 changes: 3 additions & 3 deletions weather.php
Original file line number Diff line number Diff line change
@@ -15,15 +15,15 @@

$rules = [
// 位置
'location' => ['.hhx_index_newHead_l>text', 'text'],
'location' => ['.hhx_index_newHead_l>h1', 'text'],
// 更新时间
'date' => ['#nowHour', 'text'],
// 温度
'temp' => ['.now', 'text'],
// 湿度
'shidu' => ['.b2', 'text'],
// 今日温度
'today' => ['.temp>.txt', 'text'],
'today' => ['.temp>div>.txt', 'text'],
// 风向
'wind' => ['.b3', 'text'],
// 空气质量
@@ -50,4 +50,4 @@ function geturldata($url)
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
$content = curl_exec($ch);
return $content;
}
}