commit
b3e02a497b
@ -0,0 +1,73 @@ |
|||||||
|
# Created by .ignore support plugin (hsz.mobi) |
||||||
|
### JetBrains template |
||||||
|
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm |
||||||
|
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 |
||||||
|
|
||||||
|
# User-specific stuff |
||||||
|
.idea/**/workspace.xml |
||||||
|
.idea/**/tasks.xml |
||||||
|
.idea/**/usage.statistics.xml |
||||||
|
.idea/**/dictionaries |
||||||
|
.idea/**/shelf |
||||||
|
|
||||||
|
# Generated files |
||||||
|
.idea/**/contentModel.xml |
||||||
|
|
||||||
|
# Sensitive or high-churn files |
||||||
|
.idea/**/dataSources/ |
||||||
|
.idea/**/dataSources.ids |
||||||
|
.idea/**/dataSources.local.xml |
||||||
|
.idea/**/sqlDataSources.xml |
||||||
|
.idea/**/dynamic.xml |
||||||
|
.idea/**/uiDesigner.xml |
||||||
|
.idea/**/dbnavigator.xml |
||||||
|
|
||||||
|
# Gradle |
||||||
|
.idea/**/gradle.xml |
||||||
|
.idea/**/libraries |
||||||
|
|
||||||
|
# Gradle and Maven with auto-import |
||||||
|
# When using Gradle or Maven with auto-import, you should exclude module files, |
||||||
|
# since they will be recreated, and may cause churn. Uncomment if using |
||||||
|
# auto-import. |
||||||
|
# .idea/modules.xml |
||||||
|
# .idea/*.iml |
||||||
|
# .idea/modules |
||||||
|
# *.iml |
||||||
|
# *.ipr |
||||||
|
|
||||||
|
# CMake |
||||||
|
cmake-build-*/ |
||||||
|
|
||||||
|
# Mongo Explorer plugin |
||||||
|
.idea/**/mongoSettings.xml |
||||||
|
|
||||||
|
# File-based project format |
||||||
|
*.iws |
||||||
|
|
||||||
|
# IntelliJ |
||||||
|
out/ |
||||||
|
|
||||||
|
# mpeltonen/sbt-idea plugin |
||||||
|
.idea_modules/ |
||||||
|
|
||||||
|
# JIRA plugin |
||||||
|
atlassian-ide-plugin.xml |
||||||
|
|
||||||
|
# Cursive Clojure plugin |
||||||
|
.idea/replstate.xml |
||||||
|
|
||||||
|
# Crashlytics plugin (for Android Studio and IntelliJ) |
||||||
|
com_crashlytics_export_strings.xml |
||||||
|
crashlytics.properties |
||||||
|
crashlytics-build.properties |
||||||
|
fabric.properties |
||||||
|
|
||||||
|
# Editor-based Rest Client |
||||||
|
.idea/httpRequests |
||||||
|
|
||||||
|
# Android studio 3.1+ serialized cache file |
||||||
|
.idea/caches/build_file_checksums.ser |
||||||
|
/vendor |
||||||
|
.idea |
||||||
|
/log/ |
@ -0,0 +1,51 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
require 'vendor/autoload.php'; |
||||||
|
|
||||||
|
use Monolog\Formatter\LineFormatter; |
||||||
|
use Monolog\Handler\StreamHandler; |
||||||
|
use Monolog\Logger; |
||||||
|
|
||||||
|
date_default_timezone_set("Asia/Shanghai"); |
||||||
|
|
||||||
|
function getStream($path) |
||||||
|
{ |
||||||
|
// the default date format is "Y-m-d\TH:i:sP" |
||||||
|
$dateFormat = "Y-n-j H:i:s"; |
||||||
|
// the default output format is "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n" |
||||||
|
$output = "%datetime% > %level_name% > %message% %context% %extra%\n"; |
||||||
|
// finally, create a formatter |
||||||
|
$formatter = new LineFormatter($output, $dateFormat); |
||||||
|
// create a log channel |
||||||
|
|
||||||
|
try { |
||||||
|
$stream = new StreamHandler($path, Logger::INFO); |
||||||
|
$stream->setFormatter($formatter); |
||||||
|
} catch (Exception $e) { |
||||||
|
error_log("init Monolog Stream config error"); |
||||||
|
} |
||||||
|
return $stream; |
||||||
|
} |
||||||
|
|
||||||
|
function getLogger() |
||||||
|
{ |
||||||
|
$log = new Logger('name'); |
||||||
|
$log->pushHandler(getStream(__ROOT__ . "/log/run.log")); |
||||||
|
$log->pushHandler(getStream("php://stdout")); // <<< uses a stream |
||||||
|
return $log; |
||||||
|
} |
||||||
|
|
||||||
|
function info($msg) |
||||||
|
{ |
||||||
|
getLogger()->info($msg); |
||||||
|
} |
||||||
|
|
||||||
|
function error($msg) |
||||||
|
{ |
||||||
|
getLogger()->error($msg); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,10 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
|
||||||
|
namespace admin; |
||||||
|
|
||||||
|
//题目管理 |
||||||
|
class Question |
||||||
|
{ |
||||||
|
|
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
|
||||||
|
namespace admin; |
||||||
|
|
||||||
|
//垃圾分类百科 |
||||||
|
class WasteSorting |
||||||
|
{ |
||||||
|
|
||||||
|
} |
||||||
|
|
@ -0,0 +1,14 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
header("Content-type:application/json"); |
||||||
|
|
||||||
|
if (isset($_POST["image"])) { |
||||||
|
|
||||||
|
echo <<<EOF |
||||||
|
{"msg":"合法图片参数"} |
||||||
|
EOF; |
||||||
|
} else { |
||||||
|
echo <<<EOF |
||||||
|
{"msg":"缺少图片参数"} |
||||||
|
EOF; |
||||||
|
} |
@ -0,0 +1,93 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
//require "../database/config.php"; |
||||||
|
//百度token管理 |
||||||
|
class ApiToken |
||||||
|
{ |
||||||
|
private $refresh_token; |
||||||
|
private $expires_in; |
||||||
|
private $end_time; |
||||||
|
|
||||||
|
/** |
||||||
|
* @return false|string |
||||||
|
*/ |
||||||
|
public function getEndTime() |
||||||
|
{ |
||||||
|
return $this->end_time; |
||||||
|
} |
||||||
|
|
||||||
|
private $scope; |
||||||
|
private $session_key; |
||||||
|
private $access_token; |
||||||
|
private $session_secret; |
||||||
|
|
||||||
|
/** |
||||||
|
* ApiToken constructor. |
||||||
|
* @param $refresh_token |
||||||
|
* @param $expires_in |
||||||
|
* @param $scope |
||||||
|
* @param $session_key |
||||||
|
* @param $access_token |
||||||
|
* @param $session_secret |
||||||
|
*/ |
||||||
|
public function __construct($refresh_token, $expires_in, $scope, $session_key, $access_token, $session_secret) |
||||||
|
{ |
||||||
|
$this->refresh_token = $refresh_token; |
||||||
|
$this->expires_in = $expires_in; |
||||||
|
$this->end_time = date_format(date_create(date(default_format))->add(date_interval_create_from_date_string($expires_in . " seconds")), default_format); |
||||||
|
$this->scope = $scope; |
||||||
|
$this->session_key = $session_key; |
||||||
|
$this->access_token = $access_token; |
||||||
|
$this->session_secret = $session_secret; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* @return mixed |
||||||
|
*/ |
||||||
|
public function getRefreshToken() |
||||||
|
{ |
||||||
|
return $this->refresh_token; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* @return mixed |
||||||
|
*/ |
||||||
|
public function getExpiresIn() |
||||||
|
{ |
||||||
|
return $this->expires_in; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* @return mixed |
||||||
|
*/ |
||||||
|
public function getScope() |
||||||
|
{ |
||||||
|
return $this->scope; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* @return mixed |
||||||
|
*/ |
||||||
|
public function getSessionKey() |
||||||
|
{ |
||||||
|
return $this->session_key; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* @return mixed |
||||||
|
*/ |
||||||
|
public function getAccessToken() |
||||||
|
{ |
||||||
|
return $this->access_token; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* @return mixed |
||||||
|
*/ |
||||||
|
public function getSessionSecret() |
||||||
|
{ |
||||||
|
return $this->session_secret; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,88 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
require "ApiToken.php"; |
||||||
|
require "../database/DbUtil.php"; |
||||||
|
|
||||||
|
|
||||||
|
//api请求 |
||||||
|
class BaiduAiRequest |
||||||
|
{ |
||||||
|
private static $client_id = "keaVPslHREMgVd6FwiEQqcCx"; |
||||||
|
private static $client_secret = "vtsDKjRVbcALDc61GAflw8UAtmGYkIPX"; |
||||||
|
private $url; |
||||||
|
|
||||||
|
/** |
||||||
|
* BaiduAiRequest constructor. |
||||||
|
* @param $url |
||||||
|
*/ |
||||||
|
public function __construct($url) |
||||||
|
{ |
||||||
|
$this->url = $url; |
||||||
|
} |
||||||
|
|
||||||
|
function request() |
||||||
|
{ |
||||||
|
try { |
||||||
|
if (empty(self::$client_id) or empty(self::$client_secret)) { |
||||||
|
throw new Exception(""); |
||||||
|
} |
||||||
|
$post_data['grant_type'] = 'client_credentials'; |
||||||
|
$post_data['client_id'] = self::$client_id; |
||||||
|
$post_data['client_secret'] = self::$client_secret; |
||||||
|
$o = ""; |
||||||
|
foreach ($post_data as $k => $v) { |
||||||
|
$o .= "$k=" . urlencode($v) . "&"; |
||||||
|
} |
||||||
|
$param = substr($o, 0, -1); |
||||||
|
if (empty($this->url) || empty($param)) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
return $this->request_with_param($param); |
||||||
|
} catch (Exception $e) { |
||||||
|
$GLOBALS["default_log"]->error($e); |
||||||
|
return <<<EOF |
||||||
|
{"msg":"百度API请求失败,请联系管理员"} |
||||||
|
EOF; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// 发送请求 |
||||||
|
function request_with_param($param) |
||||||
|
{ |
||||||
|
|
||||||
|
try { |
||||||
|
$curlPost = $param; |
||||||
|
$curl = curl_init($this->url);//初始化curl |
||||||
|
curl_setopt($curl, CURLOPT_HEADER, 0);//设置header |
||||||
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
||||||
|
curl_setopt($curl, CURLOPT_POST, 1);//post提交方式 |
||||||
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $curlPost); |
||||||
|
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); |
||||||
|
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); |
||||||
|
$data = curl_exec($curl);//运行curl |
||||||
|
curl_close($curl); |
||||||
|
$json_res = json_decode($data, true); |
||||||
|
info("接口响应结果:" . $data); |
||||||
|
if (array_key_exists("error", $json_res)) { |
||||||
|
throw new Exception("请求异常"); |
||||||
|
} else { |
||||||
|
$token = new ApiToken($json_res["refresh_token"], $json_res["expires_in"], $json_res["session_key"], $json_res["access_token"], $json_res["scope"], $json_res["session_secret"]); |
||||||
|
DbUtil::insert("insert into api_token (refresh_token, expires_in, end_time, scope, session_key, access_token, session_secret) values (?,?,?,?,?,?,?)", |
||||||
|
"sisssss", $token->getRefreshToken(), $token->getExpiresIn(), $token->getEndTime(), $token->getScope(), $token->getSessionKey(), $token->getAccessToken(), $token->getSessionSecret()); |
||||||
|
info("token保存成功"); |
||||||
|
return $token; |
||||||
|
} |
||||||
|
} catch (Exception $e) { |
||||||
|
error($e); |
||||||
|
return <<<EOF |
||||||
|
{"msg":"百度API请求失败,请联系管理员"} |
||||||
|
EOF; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
$obj = new BaiduAiRequest("https://aip.baidubce.com/oauth/2.0/token"); |
||||||
|
$obj->request(); |
||||||
|
|
||||||
|
|
@ -0,0 +1,14 @@ |
|||||||
|
{ |
||||||
|
"require": { |
||||||
|
"monolog/monolog": "2.0.0", |
||||||
|
"ext-curl": "*", |
||||||
|
"ext-json": "*", |
||||||
|
"ext-mysqli": "*" |
||||||
|
}, |
||||||
|
"repositories": { |
||||||
|
"packagist": { |
||||||
|
"type": "composer", |
||||||
|
"url": "https://packagist.phpcomposer.com" |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,146 @@ |
|||||||
|
{ |
||||||
|
"_readme": [ |
||||||
|
"This file locks the dependencies of your project to a known state", |
||||||
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", |
||||||
|
"This file is @generated automatically" |
||||||
|
], |
||||||
|
"content-hash": "1c68c6483ff3ed85c01c0292266ded18", |
||||||
|
"packages": [ |
||||||
|
{ |
||||||
|
"name": "monolog/monolog", |
||||||
|
"version": "2.0.0", |
||||||
|
"source": { |
||||||
|
"type": "git", |
||||||
|
"url": "https://github.com/Seldaek/monolog.git", |
||||||
|
"reference": "68545165e19249013afd1d6f7485aecff07a2d22" |
||||||
|
}, |
||||||
|
"dist": { |
||||||
|
"type": "zip", |
||||||
|
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/68545165e19249013afd1d6f7485aecff07a2d22", |
||||||
|
"reference": "68545165e19249013afd1d6f7485aecff07a2d22", |
||||||
|
"shasum": "" |
||||||
|
}, |
||||||
|
"require": { |
||||||
|
"php": "^7.2", |
||||||
|
"psr/log": "^1.0.1" |
||||||
|
}, |
||||||
|
"provide": { |
||||||
|
"psr/log-implementation": "1.0.0" |
||||||
|
}, |
||||||
|
"require-dev": { |
||||||
|
"aws/aws-sdk-php": "^2.4.9 || ^3.0", |
||||||
|
"doctrine/couchdb": "~1.0@dev", |
||||||
|
"elasticsearch/elasticsearch": "^6.0", |
||||||
|
"graylog2/gelf-php": "^1.4.2", |
||||||
|
"jakub-onderka/php-parallel-lint": "^0.9", |
||||||
|
"php-amqplib/php-amqplib": "~2.4", |
||||||
|
"php-console/php-console": "^3.1.3", |
||||||
|
"phpspec/prophecy": "^1.6.1", |
||||||
|
"phpunit/phpunit": "^8.3", |
||||||
|
"predis/predis": "^1.1", |
||||||
|
"rollbar/rollbar": "^1.3", |
||||||
|
"ruflin/elastica": ">=0.90 <3.0", |
||||||
|
"swiftmailer/swiftmailer": "^5.3|^6.0" |
||||||
|
}, |
||||||
|
"suggest": { |
||||||
|
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", |
||||||
|
"doctrine/couchdb": "Allow sending log messages to a CouchDB server", |
||||||
|
"elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client", |
||||||
|
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", |
||||||
|
"ext-mbstring": "Allow to work properly with unicode symbols", |
||||||
|
"ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)", |
||||||
|
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", |
||||||
|
"mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", |
||||||
|
"php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", |
||||||
|
"php-console/php-console": "Allow sending log messages to Google Chrome", |
||||||
|
"rollbar/rollbar": "Allow sending log messages to Rollbar", |
||||||
|
"ruflin/elastica": "Allow sending log messages to an Elastic Search server" |
||||||
|
}, |
||||||
|
"type": "library", |
||||||
|
"extra": { |
||||||
|
"branch-alias": { |
||||||
|
"dev-master": "2.x-dev" |
||||||
|
} |
||||||
|
}, |
||||||
|
"autoload": { |
||||||
|
"psr-4": { |
||||||
|
"Monolog\\": "src/Monolog" |
||||||
|
} |
||||||
|
}, |
||||||
|
"notification-url": "https://packagist.org/downloads/", |
||||||
|
"license": [ |
||||||
|
"MIT" |
||||||
|
], |
||||||
|
"authors": [ |
||||||
|
{ |
||||||
|
"name": "Jordi Boggiano", |
||||||
|
"email": "j.boggiano@seld.be", |
||||||
|
"homepage": "http://seld.be" |
||||||
|
} |
||||||
|
], |
||||||
|
"description": "Sends your logs to files, sockets, inboxes, databases and various web services", |
||||||
|
"homepage": "http://github.com/Seldaek/monolog", |
||||||
|
"keywords": [ |
||||||
|
"log", |
||||||
|
"logging", |
||||||
|
"psr-3" |
||||||
|
], |
||||||
|
"time": "2019-08-30T09:56:44+00:00" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"name": "psr/log", |
||||||
|
"version": "1.1.0", |
||||||
|
"source": { |
||||||
|
"type": "git", |
||||||
|
"url": "https://github.com/php-fig/log.git", |
||||||
|
"reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd" |
||||||
|
}, |
||||||
|
"dist": { |
||||||
|
"type": "zip", |
||||||
|
"url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", |
||||||
|
"reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", |
||||||
|
"shasum": "" |
||||||
|
}, |
||||||
|
"require": { |
||||||
|
"php": ">=5.3.0" |
||||||
|
}, |
||||||
|
"type": "library", |
||||||
|
"extra": { |
||||||
|
"branch-alias": { |
||||||
|
"dev-master": "1.0.x-dev" |
||||||
|
} |
||||||
|
}, |
||||||
|
"autoload": { |
||||||
|
"psr-4": { |
||||||
|
"Psr\\Log\\": "Psr/Log/" |
||||||
|
} |
||||||
|
}, |
||||||
|
"notification-url": "https://packagist.org/downloads/", |
||||||
|
"license": [ |
||||||
|
"MIT" |
||||||
|
], |
||||||
|
"authors": [ |
||||||
|
{ |
||||||
|
"name": "PHP-FIG", |
||||||
|
"homepage": "http://www.php-fig.org/" |
||||||
|
} |
||||||
|
], |
||||||
|
"description": "Common interface for logging libraries", |
||||||
|
"homepage": "https://github.com/php-fig/log", |
||||||
|
"keywords": [ |
||||||
|
"log", |
||||||
|
"psr", |
||||||
|
"psr-3" |
||||||
|
], |
||||||
|
"time": "2018-11-20T15:27:04+00:00" |
||||||
|
} |
||||||
|
], |
||||||
|
"packages-dev": [], |
||||||
|
"aliases": [], |
||||||
|
"minimum-stability": "stable", |
||||||
|
"stability-flags": [], |
||||||
|
"prefer-stable": false, |
||||||
|
"prefer-lowest": false, |
||||||
|
"platform": [], |
||||||
|
"platform-dev": [] |
||||||
|
} |
Binary file not shown.
@ -0,0 +1,13 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
define("db_config", array( |
||||||
|
"servername" => "mylinux", |
||||||
|
"username" => "sukura", |
||||||
|
"password" => "123456", |
||||||
|
"dbname" => "waste_sorting" |
||||||
|
)); |
||||||
|
|
||||||
|
define("default_format", "Y-m-d H:i:s"); |
||||||
|
|
||||||
|
define("__ROOT__", dirname(__FILE__)); |
||||||
|
|
@ -0,0 +1,53 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
require "../config.php"; |
||||||
|
require "../Log.php"; |
||||||
|
|
||||||
|
class DbUtil |
||||||
|
{ |
||||||
|
|
||||||
|
private static function getConn() |
||||||
|
{ |
||||||
|
try { |
||||||
|
$conn = new mysqli(db_config["servername"], db_config["username"], db_config["password"], db_config["dbname"]); |
||||||
|
if ($conn->connect_error) { |
||||||
|
error("数据库连接失败"); |
||||||
|
} else { |
||||||
|
info("数据库连接成功"); |
||||||
|
} |
||||||
|
return $conn; |
||||||
|
} catch (Exception $e) { |
||||||
|
error("数据库连接异常"); |
||||||
|
die("数据库连接异常"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private static function closeConn(mysqli $conn) |
||||||
|
{ |
||||||
|
try { |
||||||
|
if ($conn->close()) { |
||||||
|
info("成功关闭数据库"); |
||||||
|
} else { |
||||||
|
error("无法关闭数据库"); |
||||||
|
} |
||||||
|
} catch (Exception $e) { |
||||||
|
error("关闭数据库连接出现异常:" . $e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// 插入数据 |
||||||
|
public static function insert($sql, $types, ...$_) |
||||||
|
{ |
||||||
|
|
||||||
|
try {// 创建连接 |
||||||
|
$conn = self::getConn(); |
||||||
|
$stmt = $conn->prepare("$sql");// 参数绑定 |
||||||
|
$stmt->bind_param($types, ...$_);// 执行sql |
||||||
|
$stmt->execute();// 关闭连接 |
||||||
|
info("执行sql.$sql.成功"); |
||||||
|
self::closeConn($conn); |
||||||
|
} catch (Exception $e) { |
||||||
|
error("插入数据异常" . $e); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,14 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
function getMenu($menu) |
||||||
|
{ |
||||||
|
echo <<<EOF |
||||||
|
<head> |
||||||
|
<title>$menu</title> |
||||||
|
<link rel="stylesheet" type="text/css" href="static/css/bootstrap.min.css"> |
||||||
|
<script src="static/js/jquery-3.4.1.min.js"></script> |
||||||
|
<script src="static/js/bootstrap.min.js"></script> |
||||||
|
</head> |
||||||
|
EOF; |
||||||
|
} |
||||||
|
|
@ -0,0 +1,30 @@ |
|||||||
|
<?php |
||||||
|
$menus = array("API" => "百度API配置", "WasteSorting" => "垃圾分类管理", "Question" => "题目管理"); |
||||||
|
require "head.php"; |
||||||
|
getMenu("后台管理"); |
||||||
|
|
||||||
|
|
||||||
|
echo <<<EOF |
||||||
|
<nav class="navbar navbar-expand-lg navbar-light bg-light"> |
||||||
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> |
||||||
|
<span class="navbar-toggler-icon"></span> |
||||||
|
</button> |
||||||
|
<div class="collapse navbar-collapse" id="navbarNav"> |
||||||
|
<ul class="navbar-nav"> |
||||||
|
EOF; |
||||||
|
foreach ($menus as $key => $value) { |
||||||
|
echo <<<EOF |
||||||
|
<li class="nav-item"> |
||||||
|
<a class="nav-link" href="#">$value</a> |
||||||
|
</li> |
||||||
|
EOF; |
||||||
|
|
||||||
|
} |
||||||
|
echo <<<EOF |
||||||
|
<li class="nav-item"> |
||||||
|
<a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> |
||||||
|
</li> |
||||||
|
</ul> |
||||||
|
</div> |
||||||
|
</nav> |
||||||
|
EOF; |
@ -0,0 +1,61 @@ |
|||||||
|
# token管理表 |
||||||
|
create table api_token |
||||||
|
( |
||||||
|
id int auto_increment primary key, |
||||||
|
refresh_token varchar(256), |
||||||
|
# Access Token的有效期(秒为单位,一般为1个月); |
||||||
|
expires_in int, |
||||||
|
# 有效时间 |
||||||
|
end_time datetime, |
||||||
|
scope varchar(256), |
||||||
|
session_key varchar(256), |
||||||
|
# 要获取的Access Token; |
||||||
|
access_token varchar(1024), |
||||||
|
session_secret varchar(32) |
||||||
|
); |
||||||
|
|
||||||
|
# 垃圾分类表 |
||||||
|
create table garbage |
||||||
|
( |
||||||
|
# 垃圾名 |
||||||
|
name varchar(32) primary key, |
||||||
|
# 类别 |
||||||
|
category int, |
||||||
|
# 创建时间 |
||||||
|
create_at datetime, |
||||||
|
# 更新时间 |
||||||
|
update_at datetime |
||||||
|
); |
||||||
|
|
||||||
|
# 参数表 |
||||||
|
create table param |
||||||
|
( |
||||||
|
# 参数名 |
||||||
|
param_key varchar(16) primary key, |
||||||
|
# 参数值 |
||||||
|
param_value varchar(16), |
||||||
|
# 参数描述 |
||||||
|
param_desc varchar(32) |
||||||
|
); |
||||||
|
|
||||||
|
# 问题管理 |
||||||
|
create table question |
||||||
|
( |
||||||
|
# 问题id |
||||||
|
question_id int auto_increment primary key, |
||||||
|
# 问题 |
||||||
|
question_title varchar(32) not null |
||||||
|
); |
||||||
|
|
||||||
|
# 答案管理 |
||||||
|
create table answer |
||||||
|
( |
||||||
|
# 答案id |
||||||
|
answer_id int auto_increment primary key, |
||||||
|
# 问题id |
||||||
|
question_id int, |
||||||
|
# 答案, |
||||||
|
answer varchar(32) not null, |
||||||
|
# 是否正确答案 |
||||||
|
is_true bool |
||||||
|
); |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,332 @@ |
|||||||
|
/*! |
||||||
|
* Bootstrap Reboot v4.3.1 (https://getbootstrap.com/) |
||||||
|
* Copyright 2011-2019 The Bootstrap Authors |
||||||
|
* Copyright 2011-2019 Twitter, Inc. |
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
||||||
|
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) |
||||||
|
*/ |
||||||
|
*, |
||||||
|
*::before, |
||||||
|
*::after { |
||||||
|
box-sizing: border-box; |
||||||
|
} |
||||||
|
|
||||||
|
html { |
||||||
|
font-family: sans-serif; |
||||||
|
line-height: 1.15; |
||||||
|
-webkit-text-size-adjust: 100%; |
||||||
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); |
||||||
|
} |
||||||
|
|
||||||
|
article, aside, figcaption, figure, footer, header, hgroup, main, nav, section { |
||||||
|
display: block; |
||||||
|
} |
||||||
|
|
||||||
|
body { |
||||||
|
margin: 0; |
||||||
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; |
||||||
|
font-size: 1rem; |
||||||
|
font-weight: 400; |
||||||
|
line-height: 1.5; |
||||||
|
color: #212529; |
||||||
|
text-align: left; |
||||||
|
background-color: #fff; |
||||||
|
} |
||||||
|
|
||||||
|
[tabindex="-1"]:focus { |
||||||
|
outline: 0 !important; |
||||||
|
} |
||||||
|
|
||||||
|
hr { |
||||||
|
box-sizing: content-box; |
||||||
|
height: 0; |
||||||
|
overflow: visible; |
||||||
|
} |
||||||
|
|
||||||
|
h1, h2, h3, h4, h5, h6 { |
||||||
|
margin-top: 0; |
||||||
|
margin-bottom: 0.5rem; |
||||||
|
} |
||||||
|
|
||||||
|
p { |
||||||
|
margin-top: 0; |
||||||
|
margin-bottom: 1rem; |
||||||
|
} |
||||||
|
|
||||||
|
abbr[title], |
||||||
|
abbr[data-original-title] { |
||||||
|
text-decoration: underline; |
||||||
|
-webkit-text-decoration: underline dotted; |
||||||
|
text-decoration: underline dotted; |
||||||
|
cursor: help; |
||||||
|
border-bottom: 0; |
||||||
|
-webkit-text-decoration-skip-ink: none; |
||||||
|
text-decoration-skip-ink: none; |
||||||
|
} |
||||||
|
|
||||||
|
address { |
||||||
|
margin-bottom: 1rem; |
||||||
|
font-style: normal; |
||||||
|
line-height: inherit; |
||||||
|
} |
||||||
|
|
||||||
|
ol, |
||||||
|
ul, |
||||||
|
dl { |
||||||
|
margin-top: 0; |
||||||
|
margin-bottom: 1rem; |
||||||
|
} |
||||||
|
|
||||||
|
ol ol, |
||||||
|
ul ul, |
||||||
|
ol ul, |
||||||
|
ul ol { |
||||||
|
margin-bottom: 0; |
||||||
|
} |
||||||
|
|
||||||
|
dt { |
||||||
|
font-weight: 700; |
||||||
|
} |
||||||
|
|
||||||
|
dd { |
||||||
|
margin-bottom: .5rem; |
||||||
|
margin-left: 0; |
||||||
|
} |
||||||
|
|
||||||
|
blockquote { |
||||||
|
margin: 0 0 1rem; |
||||||
|
} |
||||||
|
|
||||||
|
b, |
||||||
|
strong { |
||||||
|
font-weight: bolder; |
||||||
|
} |
||||||
|
|
||||||
|
small { |
||||||
|
font-size: 80%; |
||||||
|
} |
||||||
|
|
||||||
|
sub, |
||||||
|
sup { |
||||||
|
position: relative; |
||||||
|
font-size: 75%; |
||||||
|
line-height: 0; |
||||||
|
vertical-align: baseline; |
||||||
|
} |
||||||
|
|
||||||
|
sub { |
||||||
|
bottom: -.25em; |
||||||
|
} |
||||||
|
|
||||||
|
sup { |
||||||
|
top: -.5em; |
||||||
|
} |
||||||
|
|
||||||
|
a { |
||||||
|
color: #007bff; |
||||||
|
text-decoration: none; |
||||||
|
background-color: transparent; |
||||||
|
} |
||||||
|
|
||||||
|
a:hover { |
||||||
|
color: #0056b3; |
||||||
|
text-decoration: underline; |
||||||
|
} |
||||||
|
|
||||||
|
a:not([href]):not([tabindex]) { |
||||||
|
color: inherit; |
||||||
|
text-decoration: none; |
||||||
|
} |
||||||
|
|
||||||
|
a:not([href]):not([tabindex]):hover, a:not([href]):not([tabindex]):focus { |
||||||
|
color: inherit; |
||||||
|
text-decoration: none; |
||||||
|
} |
||||||
|
|
||||||
|
a:not([href]):not([tabindex]):focus { |
||||||
|
outline: 0; |
||||||
|
} |
||||||
|
|
||||||
|
pre, |
||||||
|
code, |
||||||
|
kbd, |
||||||
|
samp { |
||||||
|
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; |
||||||
|
font-size: 1em; |
||||||
|
} |
||||||
|
|
||||||
|
pre { |
||||||
|
margin-top: 0; |
||||||
|
margin-bottom: 1rem; |
||||||
|
overflow: auto; |
||||||
|
} |
||||||
|
|
||||||
|
figure { |
||||||
|
margin: 0 0 1rem; |
||||||
|
} |
||||||
|
|
||||||
|
img { |
||||||
|
vertical-align: middle; |
||||||
|
border-style: none; |
||||||
|
} |
||||||
|
|
||||||
|
svg { |
||||||
|
overflow: hidden; |
||||||
|
vertical-align: middle; |
||||||
|
} |
||||||
|
|
||||||
|
table { |
||||||
|
border-collapse: collapse; |
||||||
|
} |
||||||
|
|
||||||
|
caption { |
||||||
|
padding-top: 0.75rem; |
||||||
|
padding-bottom: 0.75rem; |
||||||
|
color: #6c757d; |
||||||
|
text-align: left; |
||||||
|
caption-side: bottom; |
||||||
|
} |
||||||
|
|
||||||
|
th { |
||||||
|
text-align: inherit; |
||||||
|
} |
||||||
|
|
||||||
|
label { |
||||||
|
display: inline-block; |
||||||
|
margin-bottom: 0.5rem; |
||||||
|
} |
||||||
|
|
||||||
|
button { |
||||||
|
border-radius: 0; |
||||||
|
} |
||||||
|
|
||||||
|
button:focus { |
||||||
|
outline: 1px dotted; |
||||||
|
outline: 5px auto -webkit-focus-ring-color; |
||||||
|
} |
||||||
|
|
||||||
|
input, |
||||||
|
button, |
||||||
|
select, |
||||||
|
optgroup, |
||||||
|
textarea { |
||||||
|
margin: 0; |
||||||
|
font-family: inherit; |
||||||
|
font-size: inherit; |
||||||
|
line-height: inherit; |
||||||
|
} |
||||||
|
|
||||||
|
button, |
||||||
|
input { |
||||||
|
overflow: visible; |
||||||
|
} |
||||||
|
|
||||||
|
button, |
||||||
|
select { |
||||||
|
text-transform: none; |
||||||
|
} |
||||||
|
|
||||||
|
select { |
||||||
|
word-wrap: normal; |
||||||
|
} |
||||||
|
|
||||||
|
button, |
||||||
|
[type="button"], |
||||||
|
[type="reset"], |
||||||
|
[type="submit"] { |
||||||
|
-webkit-appearance: button; |
||||||
|
} |
||||||
|
|
||||||
|
button:not(:disabled), |
||||||
|
[type="button"]:not(:disabled), |
||||||
|
[type="reset"]:not(:disabled), |
||||||
|
[type="submit"]:not(:disabled) { |
||||||
|
cursor: pointer; |
||||||
|
} |
||||||
|
|
||||||
|
button::-moz-focus-inner, |
||||||
|
[type="button"]::-moz-focus-inner, |
||||||
|
[type="reset"]::-moz-focus-inner, |
||||||
|
[type="submit"]::-moz-focus-inner { |
||||||
|
padding: 0; |
||||||
|
border-style: none; |
||||||
|
} |
||||||
|
|
||||||
|
input[type="radio"], |
||||||
|
input[type="checkbox"] { |
||||||
|
box-sizing: border-box; |
||||||
|
padding: 0; |
||||||
|
} |
||||||
|
|
||||||
|
input[type="date"], |
||||||
|
input[type="time"], |
||||||
|
input[type="datetime-local"], |
||||||
|
input[type="month"] { |
||||||
|
-webkit-appearance: listbox; |
||||||
|
} |
||||||
|
|
||||||
|
textarea { |
||||||
|
overflow: auto; |
||||||
|
resize: vertical; |
||||||
|
} |
||||||
|
|
||||||
|
fieldset { |
||||||
|
min-width: 0; |
||||||
|
padding: 0; |
||||||
|
margin: 0; |
||||||
|
border: 0; |
||||||
|
} |
||||||
|
|
||||||
|
legend { |
||||||
|
display: block; |
||||||
|
width: 100%; |
||||||
|
max-width: 100%; |
||||||
|
padding: 0; |
||||||
|
margin-bottom: .5rem; |
||||||
|
font-size: 1.5rem; |
||||||
|
line-height: inherit; |
||||||
|
color: inherit; |
||||||
|
white-space: normal; |
||||||
|
} |
||||||
|
|
||||||
|
progress { |
||||||
|
vertical-align: baseline; |
||||||
|
} |
||||||
|
|
||||||
|
[type="number"]::-webkit-inner-spin-button, |
||||||
|
[type="number"]::-webkit-outer-spin-button { |
||||||
|
height: auto; |
||||||
|
} |
||||||
|
|
||||||
|
[type="search"] { |
||||||
|
outline-offset: -2px; |
||||||
|
-webkit-appearance: none; |
||||||
|
} |
||||||
|
|
||||||
|
[type="search"]::-webkit-search-decoration { |
||||||
|
-webkit-appearance: none; |
||||||
|
} |
||||||
|
|
||||||
|
::-webkit-file-upload-button { |
||||||
|
font: inherit; |
||||||
|
-webkit-appearance: button; |
||||||
|
} |
||||||
|
|
||||||
|
output { |
||||||
|
display: inline-block; |
||||||
|
} |
||||||
|
|
||||||
|
summary { |
||||||
|
display: list-item; |
||||||
|
cursor: pointer; |
||||||
|
} |
||||||
|
|
||||||
|
template { |
||||||
|
display: none; |
||||||
|
} |
||||||
|
|
||||||
|
[hidden] { |
||||||
|
display: none !important; |
||||||
|
} |
||||||
|
|
||||||
|
/*# sourceMappingURL=bootstrap-reboot.css.map */ |
File diff suppressed because one or more lines are too long
@ -0,0 +1,8 @@ |
|||||||
|
/*! |
||||||
|
* Bootstrap Reboot v4.3.1 (https://getbootstrap.com/) |
||||||
|
* Copyright 2011-2019 The Bootstrap Authors |
||||||
|
* Copyright 2011-2019 Twitter, Inc. |
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
||||||
|
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) |
||||||
|
*/*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus{outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent}a:hover{color:#0056b3;text-decoration:underline}a:not([href]):not([tabindex]){color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus,a:not([href]):not([tabindex]):hover{color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus{outline:0}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg{overflow:hidden;vertical-align:middle}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}select{word-wrap:normal}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important} |
||||||
|
/*# sourceMappingURL=bootstrap-reboot.min.css.map */ |
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue