Compare commits
No commits in common. "dev" and "main" have entirely different histories.
|
@ -3,69 +3,36 @@
|
||||||
namespace app\controller;
|
namespace app\controller;
|
||||||
|
|
||||||
use support\Request;
|
use support\Request;
|
||||||
use app\result\Result;
|
use support\Db;
|
||||||
use Carbon\Carbon;
|
|
||||||
|
|
||||||
use app\model\Timetable;
|
|
||||||
use support\Log;
|
|
||||||
use Curl\Curl;
|
|
||||||
class IndexController
|
class IndexController
|
||||||
{
|
{
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
static $readme;
|
static $readme;
|
||||||
if (!$readme) {
|
if (!$readme) {
|
||||||
$readme = '700';
|
$readme = '70';
|
||||||
// $readme = file_get_contents(base_path('README.md'));
|
// $readme = file_get_contents(base_path('README.md'));
|
||||||
}
|
}
|
||||||
Log::info('log test');
|
|
||||||
return $readme;
|
return $readme;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function view(Request $request)
|
||||||
* 更新时间
|
|
||||||
*/
|
|
||||||
public function updated($whether_manual = 1)
|
|
||||||
{
|
{
|
||||||
// 获取当前时间
|
return view('index/view', ['name' => 'webman']);
|
||||||
$current = Carbon::now();
|
|
||||||
|
|
||||||
// 添加 21 天到当前时间
|
|
||||||
$trialExpires = $current->addDays(21);
|
|
||||||
$timetable=new Timetable;
|
|
||||||
$timetable->date=$trialExpires->toDateString();
|
|
||||||
$timetable->tip=$whether_manual==0?'自动提交':'手动提交';
|
|
||||||
$timetable->save();
|
|
||||||
return Result::show(200, 'ok', ['time' => $timetable]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function json(Request $request)
|
||||||
* 每天访问一次的任务
|
|
||||||
*/
|
|
||||||
public function scheduled_tasks($name = 'ThinkPHP6')
|
|
||||||
{
|
{
|
||||||
$db_time = Timetable::where('id', Timetable::where('id','>',0)->max('id'))->first();
|
$assets = Db::table('asset')->where('scan_time', null)->count();
|
||||||
$time = $db_time['date'];
|
|
||||||
// 获取当前时间
|
return json(['code' => 0, 'msg' => 'ok','data'=>$assets]);
|
||||||
$current = Carbon::now();
|
|
||||||
for ($i = 0; $i < 8; $i++) {
|
|
||||||
$current->subDay($i);
|
|
||||||
if (strcmp($current->toDateString(), $time) == 0) {
|
|
||||||
$i == 7 ? $this->updated(0) : '';
|
|
||||||
return Result::show(200, 'ok', ['time' => $current->toDateString(), 'time2' => $time]);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return Result::show(200,'ok','');
|
public function text(Request $request)
|
||||||
}
|
|
||||||
public function send_msg($title='', $body='')
|
|
||||||
{
|
{
|
||||||
$brak_key='3vrp4DbTGmSWxVbzHnUnPB';
|
|
||||||
$curl = new Curl();
|
return json(['code' => 0, 'msg' => 'ok','data'=>'text']);
|
||||||
$curl->get('https://api.day.app/3vrp4DbTGmSWxVbzHnUnPB/'.$title.'/'.$body);
|
|
||||||
if ($curl->error) {
|
|
||||||
$curl->diagnose();
|
|
||||||
Log::info('消息发送失败', $curl->errorMessage);
|
|
||||||
}
|
|
||||||
return Result::show(200,'ok','');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace app\model;
|
|
||||||
|
|
||||||
use support\Model;
|
|
||||||
|
|
||||||
class Timetable extends Model
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The table associated with the model.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $table = 'timetable';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The primary key associated with the table.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $primaryKey = 'id';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates if the model should be timestamped.
|
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
public $timestamps = true;
|
|
||||||
}
|
|
|
@ -1,57 +0,0 @@
|
||||||
<?php
|
|
||||||
/*
|
|
||||||
统一格式的返回json数据
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace app\result;
|
|
||||||
|
|
||||||
class Result
|
|
||||||
{
|
|
||||||
//success:code值为0,data:数据
|
|
||||||
static public function Success($data)
|
|
||||||
{
|
|
||||||
$rs = [
|
|
||||||
'code' => 0,
|
|
||||||
'msg' => "",
|
|
||||||
'data' => $data,
|
|
||||||
];
|
|
||||||
return json($rs);
|
|
||||||
}
|
|
||||||
//ErrorCode:需要code/msg参数
|
|
||||||
static public function ErrorCode($code, $msg)
|
|
||||||
{
|
|
||||||
$rs = [
|
|
||||||
'code' => $code,
|
|
||||||
'msg' => $msg,
|
|
||||||
'data' => "",
|
|
||||||
];
|
|
||||||
return json($rs);
|
|
||||||
}
|
|
||||||
//error,传入定义的数组常量
|
|
||||||
static public function Error($arr)
|
|
||||||
{
|
|
||||||
$rs = [
|
|
||||||
'code' => $arr['code'],
|
|
||||||
'msg' => $arr['msg'],
|
|
||||||
'data' => "",
|
|
||||||
];
|
|
||||||
return json($rs);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 通用化API数据格式输出
|
|
||||||
* @param $status
|
|
||||||
* @param string $message
|
|
||||||
* @param array $data
|
|
||||||
* @param int $httpStatus
|
|
||||||
* @return \think\response\Json
|
|
||||||
*/
|
|
||||||
static public function show($status, $message = 'error', $data = [], $httpStatus = 200)
|
|
||||||
{
|
|
||||||
$result = [
|
|
||||||
"status" => $status,
|
|
||||||
"message" => $message,
|
|
||||||
"result" => $data
|
|
||||||
];
|
|
||||||
return json($result, $httpStatus);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -30,9 +30,7 @@
|
||||||
"illuminate/database": "^8.83",
|
"illuminate/database": "^8.83",
|
||||||
"illuminate/pagination": "^8.83",
|
"illuminate/pagination": "^8.83",
|
||||||
"illuminate/events": "^8.83",
|
"illuminate/events": "^8.83",
|
||||||
"symfony/var-dumper": "^5.4",
|
"symfony/var-dumper": "^5.4"
|
||||||
"nesbot/carbon": "^2.72",
|
|
||||||
"php-curl-class/php-curl-class": "^9.19"
|
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"ext-event": "For better performance. "
|
"ext-event": "For better performance. "
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "870860f947931c0bd3591102a01cf66e",
|
"content-hash": "d19de0b71c97f1ea3e3daa830cd58c6a",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "carbonphp/carbon-doctrine-types",
|
"name": "carbonphp/carbon-doctrine-types",
|
||||||
|
@ -966,86 +966,6 @@
|
||||||
},
|
},
|
||||||
"time": "2018-02-13T20:26:39+00:00"
|
"time": "2018-02-13T20:26:39+00:00"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "php-curl-class/php-curl-class",
|
|
||||||
"version": "9.19.2",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/php-curl-class/php-curl-class.git",
|
|
||||||
"reference": "c41efeb4ea2dc3cf8f90f8f967b0fcf45a41e294"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/php-curl-class/php-curl-class/zipball/c41efeb4ea2dc3cf8f90f8f967b0fcf45a41e294",
|
|
||||||
"reference": "c41efeb4ea2dc3cf8f90f8f967b0fcf45a41e294",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"ext-curl": "*",
|
|
||||||
"php": ">=7.0"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"dealerdirect/phpcodesniffer-composer-installer": "*",
|
|
||||||
"ext-gd": "*",
|
|
||||||
"friendsofphp/php-cs-fixer": "*",
|
|
||||||
"phpcompatibility/php-compatibility": "dev-develop",
|
|
||||||
"phpcsstandards/phpcsutils": "@alpha",
|
|
||||||
"phpunit/phpunit": "*",
|
|
||||||
"squizlabs/php_codesniffer": "*",
|
|
||||||
"vimeo/psalm": ">=0.3.63"
|
|
||||||
},
|
|
||||||
"suggest": {
|
|
||||||
"ext-mbstring": "*"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"Curl\\": "src/Curl/"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"Unlicense"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Zach Borboa"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Contributors",
|
|
||||||
"homepage": "https://github.com/php-curl-class/php-curl-class/graphs/contributors"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs.",
|
|
||||||
"homepage": "https://github.com/php-curl-class/php-curl-class",
|
|
||||||
"keywords": [
|
|
||||||
"API-Client",
|
|
||||||
"api",
|
|
||||||
"class",
|
|
||||||
"client",
|
|
||||||
"curl",
|
|
||||||
"framework",
|
|
||||||
"http",
|
|
||||||
"http-client",
|
|
||||||
"http-proxy",
|
|
||||||
"json",
|
|
||||||
"php",
|
|
||||||
"php-curl",
|
|
||||||
"php-curl-library",
|
|
||||||
"proxy",
|
|
||||||
"requests",
|
|
||||||
"restful",
|
|
||||||
"web-scraper",
|
|
||||||
"web-scraping ",
|
|
||||||
"web-service",
|
|
||||||
"xml"
|
|
||||||
],
|
|
||||||
"support": {
|
|
||||||
"issues": "https://github.com/php-curl-class/php-curl-class/issues",
|
|
||||||
"source": "https://github.com/php-curl-class/php-curl-class/tree/9.19.2"
|
|
||||||
},
|
|
||||||
"time": "2024-04-09T18:03:13+00:00"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "psr/clock",
|
"name": "psr/clock",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
'driver' => 'mysql',
|
'driver' => 'mysql',
|
||||||
'host' => '127.0.0.1',
|
'host' => '127.0.0.1',
|
||||||
'port' => 3306,
|
'port' => 3306,
|
||||||
'database' => 'sql',
|
'database' => 'kunkun_shagain_c',
|
||||||
'username' => 'sql',
|
'username' => 'kunkun_shagain_c',
|
||||||
'password' => 'arxYBLyp3nMePn5C',
|
'password' => 'JcAT8frcGfrrrJBN',
|
||||||
'unix_socket' => '',
|
'unix_socket' => '',
|
||||||
'charset' => 'utf8',
|
'charset' => 'utf8',
|
||||||
'collation' => 'utf8_unicode_ci',
|
'collation' => 'utf8_unicode_ci',
|
||||||
|
|
Loading…
Reference in New Issue