commit 8a618da7eeffd90c2b7c2f260e07656ae2866fdd Author: callmeyan Date: Thu Jun 20 08:40:41 2019 +0800 first commit diff --git a/.example.env b/.example.env new file mode 100644 index 0000000..c27f74c --- /dev/null +++ b/.example.env @@ -0,0 +1 @@ +APP_DEBUG = true [APP] DEFAULT_TIMEZONE = Asia/Shanghai [DATABASE] TYPE = mysql HOSTNAME = 127.0.0.1 DATABASE = test USERNAME = username PASSWORD = password HOSTPORT = 3306 CHARSET = utf8 DEBUG = true [LANG] default_lang = zh-cn \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..78dc72e --- /dev/null +++ b/.gitignore @@ -0,0 +1,19 @@ +.DS_Store +vendor + +# local env files +.env + +# runtime files +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..574a39c --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,32 @@ + +ThinkPHP遵循Apache2开源协议发布,并提供免费使用。 +版权所有Copyright © 2006-2016 by ThinkPHP (http://thinkphp.cn) +All rights reserved。 +ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。 + +Apache Licence是著名的非盈利开源组织Apache采用的协议。 +该协议和BSD类似,鼓励代码共享和尊重原作者的著作权, +允许代码修改,再作为开源或商业软件发布。需要满足 +的条件: +1. 需要给代码的用户一份Apache Licence ; +2. 如果你修改了代码,需要在被修改的文件中说明; +3. 在延伸的代码中(修改和有源代码衍生的代码中)需要 +带有原来代码中的协议,商标,专利声明和其他原来作者规 +定需要包含的说明; +4. 如果再发布的产品中包含一个Notice文件,则在Notice文 +件中需要带有本协议内容。你可以在Notice中增加自己的 +许可,但不可以表现为对Apache Licence构成更改。 +具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0 + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..34e0e3e --- /dev/null +++ b/README.md @@ -0,0 +1,52 @@ +ThinkPHP 6.0 +=============== + +> 运行环境要求PHP7.1+。 + +## 主要新特性 + +* 采用`PHP7`强类型(严格模式) +* 支持更多的`PSR`规范 +* 原生多应用支持 +* 更强大和易用的查询 +* 全新的事件系统 +* 模型事件和数据库事件统一纳入事件系统 +* 模板引擎分离出核心 +* 内部功能中间件化 +* SESSION/Cookie机制改进 +* 对Swoole以及协程支持改进 +* 对IDE更加友好 +* 统一和精简大量用法 + +## 安装 + +~~~ +composer create-project topthink/think tp 6.0.*-dev +~~~ + +如果需要更新框架使用 +~~~ +composer update topthink/framework +~~~ + +## 文档 + +[完全开发手册](https://www.kancloud.cn/manual/thinkphp6_0/content) + +## 参与开发 + +请参阅 [ThinkPHP 核心框架包](https://github.com/top-think/framework)。 + +## 版权信息 + +ThinkPHP遵循Apache2开源协议发布,并提供免费使用。 + +本项目包含的第三方源码和二进制文件之版权信息另行标注。 + +版权所有Copyright © 2006-2019 by ThinkPHP (http://thinkphp.cn) + +All rights reserved。 + +ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。 + +更多细节参阅 [LICENSE.txt](LICENSE.txt) diff --git a/app/.htaccess b/app/.htaccess new file mode 100644 index 0000000..3418e55 --- /dev/null +++ b/app/.htaccess @@ -0,0 +1 @@ +deny from all \ No newline at end of file diff --git a/app/BaseController.php b/app/BaseController.php new file mode 100644 index 0000000..f034776 --- /dev/null +++ b/app/BaseController.php @@ -0,0 +1,117 @@ + +// +---------------------------------------------------------------------- +declare (strict_types = 1); + +namespace app; + +use think\App; +use think\exception\ValidateException; +use think\Validate; + +/** + * 控制器基础类 + */ +abstract class BaseController +{ + /** + * Request实例 + * @var \think\Request + */ + protected $request; + + /** + * 应用实例 + * @var \think\App + */ + protected $app; + + /** + * 是否批量验证 + * @var bool + */ + protected $batchValidate = false; + + /** + * 控制器中间件 + * @var array + */ + protected $middleware = []; + + + /** + * 构造方法 + * @access public + * @param App $app 应用对象 + */ + public function __construct(App $app) + { + $this->app = $app; + $this->request = $this->app->request; + + // 控制器初始化 + $this->initialize(); + } + + // 初始化 + protected function initialize() + {} + + /** + * @param $keys + * @return array + */ + protected function getParams(...$keys){ + $keys = is_string($keys)?explode(','):$keys; + $params = []; + foreach ($keys as $key){ + $params[] = $this->request->param($key); + } + return $params; + } + + /** + * 验证数据 + * @access protected + * @param array $data 数据 + * @param string|array $validate 验证器名或者验证规则数组 + * @param array $message 提示信息 + * @param bool $batch 是否批量验证 + * @return array|string|true + * @throws ValidateException + */ + protected function validate(array $data, $validate, array $message = [], bool $batch = false) + { + if (is_array($validate)) { + $v = new Validate(); + $v->rule($validate); + } else { + if (strpos($validate, '.')) { + // 支持场景 + list($validate, $scene) = explode('.', $validate); + } + $class = false !== strpos($validate, '\\') ? $validate : $this->app->parseClass('validate', $validate); + $v = new $class(); + if (!empty($scene)) { + $v->scene($scene); + } + } + + $v->message($message); + + // 是否批量验证 + if ($batch || $this->batchValidate) { + $v->batch(true); + } + + return $v->failException(true)->check($data); + } + +} diff --git a/app/BaseModel.php b/app/BaseModel.php new file mode 100644 index 0000000..a89bff2 --- /dev/null +++ b/app/BaseModel.php @@ -0,0 +1,29 @@ + + * Date: 2019/6/18 + * Time: 1:53 PM + */ + +namespace app; +use think\Model; + +class BaseModel extends Model +{ + /** + * @param mixed|string $name + * @return array + */ + public function getPartData($name = null) + { + if(is_array($name)){ + $data = []; + foreach ($name as $key){ + $data[$key] = parent::getData($key); + } + return $data; + } + return parent::getData($name); + } +} \ No newline at end of file diff --git a/app/ExceptionHandle.php b/app/ExceptionHandle.php new file mode 100644 index 0000000..375e841 --- /dev/null +++ b/app/ExceptionHandle.php @@ -0,0 +1,68 @@ + +// +---------------------------------------------------------------------- + +namespace app; + +use think\db\exception\DataNotFoundException; +use think\db\exception\ModelNotFoundException; +use think\exception\Handle; +use think\exception\HttpException; +use think\exception\HttpResponseException; +use think\exception\ValidateException; +use think\Response; +use Throwable; + +/** + * 应用异常处理类 + */ +class ExceptionHandle extends Handle +{ + /** + * 不需要记录信息(日志)的异常类列表 + * @var array + */ + protected $ignoreReport = [ + HttpException::class, + HttpResponseException::class, + ModelNotFoundException::class, + DataNotFoundException::class, + ValidateException::class, + ]; + + /** + * 记录异常信息(包括日志或者其它方式记录) + * + * @access public + * @param Throwable $exception + * @return void + */ + public function report(Throwable $exception): void + { + // 使用内置的方式记录异常日志 + parent::report($exception); + } + + /** + * Render an exception into an HTTP response. + * + * @access public + * @param \think\Request $request + * @param Throwable $e + * @return Response + */ + public function render($request, Throwable $e): Response + { + // 添加自定义异常处理机制 + + // 其他错误交给系统处理 + return parent::render($request, $e); + } +} diff --git a/app/Request.php b/app/Request.php new file mode 100644 index 0000000..bf830dc --- /dev/null +++ b/app/Request.php @@ -0,0 +1,17 @@ + +// +---------------------------------------------------------------------- + +namespace app; + +class Request extends \think\Request +{ + +} diff --git a/app/common.php b/app/common.php new file mode 100644 index 0000000..55d22f2 --- /dev/null +++ b/app/common.php @@ -0,0 +1,12 @@ + +// +---------------------------------------------------------------------- + +// 应用公共文件 diff --git a/app/common/ApiController.php b/app/common/ApiController.php new file mode 100644 index 0000000..642ff4a --- /dev/null +++ b/app/common/ApiController.php @@ -0,0 +1,40 @@ + + * Date: 2019/6/19 + * Time: 6:29 PM + */ + +namespace app\common; + +use app\BaseController; +use app\model\UserInfo; +use think\App; + +abstract class ApiController extends BaseController +{ + /** + * @var UserInfo + */ + private $currentUserInfo; + + public function __construct(App $app) + { + parent::__construct($app); + $this->initCurrentUserInfo(); + } + + protected function initCurrentUserInfo() + { + $this->currentUserInfo = $this->request->user; + } + + protected function getCurrentUserInfo() + { + if (empty($this->currentUserInfo)) { + $this->initCurrentUserInfo(); + } + return $this->currentUserInfo; + } +} \ No newline at end of file diff --git a/app/controller/Admin.php b/app/controller/Admin.php new file mode 100644 index 0000000..33969cb --- /dev/null +++ b/app/controller/Admin.php @@ -0,0 +1,84 @@ + + * Date: 2019/6/18 + * Time: 1:42 PM + */ + +namespace app\controller; + + +use app\BaseController; +use app\model\AdminInfo; +use app\Request; +use app\util\ErrorCode; +use app\util\ErrorResponse; +use app\util\StringUtil; +use think\response\Json; + +class Admin extends BaseController +{ + public function postLogin() + { + $username = $this->request->param("username"); + $password = $this->request->param("password"); + if (empty($username) || empty($password)) { + return ErrorResponse::createError(ErrorCode::ERROR_PARAM_REQUIRED, '请提交正确的参数'); + } + usleep(500000); + $user = AdminInfo::where('username', $username)->find(); + + if ($user->isEmpty()) { + return ErrorResponse::createError(ErrorCode::ERROR_ADMIN_LOGIN_PWD, '用户名或者密码错误(1)'); + } + if ($user->password != md5($username . $user->salt)) { + return ErrorResponse::createError(ErrorCode::ERROR_ADMIN_LOGIN_PWD, '用户名或者密码错误(2)');; + } + $data = $user->getPartData(['id', 'username', 'email', 'avatar', 'last_login', 'sex']); + $user->save(['last_login' => time()]); + return Json::create($data); + } + + public function updatePwd() + { + $originPwd = $this->request->post('origin'); + $newPwd = $this->request->post('new_pwd'); + $newPwd2 = $this->request->post('new_pwd2'); + + if ($newPwd != $newPwd2) { + return ErrorResponse::createError( + ErrorCode::ERROR_ADMIN_LOGIN_PWD, '输入密码不一致' + ); + } + $admin = $this->getCurrentLoginAdmin(); + if (!$this->passwordIsCorrect($admin,$originPwd)){ + return ErrorResponse::createError( + ErrorCode::ERROR_ADMIN_PWD_ERROR,'原始密码不正确' + ); + } + $salt = StringUtil::generateRandom(6); + $admin->save([ + 'password'=>StringUtil::getEncryptPassword($originPwd,$salt), + 'salt' => $salt + ]); + return \json(['code'=>0]); + } + + + private function passwordIsCorrect(AdminInfo $admin, string $originPwd) + { + return $admin->password == md5($originPwd . $admin->salt); + } + + /** + * @return AdminInfo + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\ModelNotFoundException + * @throws \think\exception\DbException + */ + private function getCurrentLoginAdmin() + { + return AdminInfo::find(4); + } +} \ No newline at end of file diff --git a/app/controller/Evaluation.php b/app/controller/Evaluation.php new file mode 100644 index 0000000..76eb2bb --- /dev/null +++ b/app/controller/Evaluation.php @@ -0,0 +1,73 @@ + + * Date: 2019/6/19 + * Time: 5:02 PM + */ + +namespace app\controller; + + +use app\BaseController; +use app\common\ApiController; +use app\model\EvaluationHistory; +use app\service\EvaluationService; +use app\util\ErrorCode; +use app\util\ErrorResponse; +use app\util\SuccessResponse; +use think\facade\Config; +use think\facade\Request; + +class Evaluation extends ApiController +{ + /** + * 用户创建评估记录 + * @return \think\Response + */ + public function create() + { + $data = $this->request->post(array_keys($_POST)); + if (empty($data)) { + return ErrorResponse::createError( + ErrorCode::ERROR_PARAM_REQUIRED, '评估数据缺失' + ); + } + $evaluation = EvaluationHistory::create(array_merge([ + 'uid' => $this->getCurrentUserInfo()->id + ], $data)); + if ($evaluation->id > 0) { + return SuccessResponse::create(); + } + return ErrorResponse::createError( + ErrorCode::EVALUATION_SAVE_FAIL, '保存评估数据失败' + ); + } + + /** + * 获取用户评估的所有项目 + * @return \think\response\Json + */ + public function subjects() + { + $subjects = Config::get('app.evaluation.subject'); + return json([ + $subjects['headache'], + $subjects['gastrointestinal'], + $subjects['tired'], + $subjects['dizzy'] + ]); + } + + private function queryByUid($uid) + { + return EvaluationService::findByUser($uid); + } + + public function all() + { + return SuccessResponse::create( + $this->queryByUid($this->getCurrentUserInfo()->id) + ); + } +} \ No newline at end of file diff --git a/app/controller/Index.php b/app/controller/Index.php new file mode 100644 index 0000000..d9d94f3 --- /dev/null +++ b/app/controller/Index.php @@ -0,0 +1,22 @@ + 0, + "message" => "running" + ]); + } + + public function hello($name = 'ThinkPHP6') + { + return 'hello,' . $name; + } +} diff --git a/app/controller/User.php b/app/controller/User.php new file mode 100644 index 0000000..fa44928 --- /dev/null +++ b/app/controller/User.php @@ -0,0 +1,97 @@ + + * Date: 2019/6/18 + * Time: 6:56 PM + */ + +namespace app\controller; + + +use app\BaseController; +use app\model\UserInfo; +use app\util\ErrorCode; +use app\util\ErrorResponse; +use PhpOffice\PhpSpreadsheet\Spreadsheet; +use PhpOffice\PhpSpreadsheet\Writer\Csv; +use PhpOffice\PhpSpreadsheet\Writer\Xlsx; + +class User extends BaseController +{ + + public function search() + { + list($is_first, $gender, $city, $name) = $this->getParams( + 'is_first_to_tibet', 'gender', 'city', 'name' + ); + $user = new UserInfo(); + $userList = UserInfo::with('detail')->select(); + return json($userList +// ->visible([ +// 'detail'=>['address'] +// ]) + ->toArray()); + } + + public function create() + { + $dataType = $this->request->post('type'); +// print_r($data); + + $spreadsheet = new Spreadsheet(); + $sheet = $spreadsheet->getActiveSheet(); + $sheet->setCellValue('A1', 'Hello World !'); +// header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); + $filename = urlencode("评估记录_") . date('mdHi'); +// $ua = $_SERVER["HTTP_USER_AGENT"]; +// $encoded_filename = urlencode($filename); +// $encoded_filename = str_replace("+", "%20", $encoded_filename); +// if (preg_match("/MSIE/", $ua)) { +// header('Content-Disposition: attachment; filename="' . $encoded_filename . '"'); +// } else if (preg_match("/Firefox/", $ua)) { +// header('Content-Disposition: attachment; filename*="utf8\'\'' . $filename . '"'); +// } else { +// header('Content-Disposition: attachment; filename="' . $filename . '"'); +// } + + $writer = new Csv($spreadsheet); + if ($dataType == 'xlsx') { + $writer = new Xlsx($spreadsheet); + $filename .= '.xlsx'; + }else { + $filename .= '.csv'; + } + header('Content-Disposition: attachment;filename=' . $filename); + $writer->save('php://output'); + exit; + } + + public function getExport() + { + + } + + public function update() + { + + } + + public function detail(int $id) + { + if ($id < 1) { + return ErrorResponse::createError( + ErrorCode::ERROR_PARAM_ERROR, '用户编号错误' + ); + } + $user = UserInfo::find($id); + if (empty($user)) { + return ErrorResponse::createError( + ErrorCode::ERROR_USER_NOT_EXISTS, '用户不存在' + ); + } + $userData = $user->getData(); + $userData['detail'] = $user->getParsedDetail(); + return json($userData); + } +} \ No newline at end of file diff --git a/app/event.php b/app/event.php new file mode 100644 index 0000000..26ba7eb --- /dev/null +++ b/app/event.php @@ -0,0 +1,27 @@ + +// +---------------------------------------------------------------------- + +// 事件定义文件 +return [ + 'bind' => [ + ], + + 'listen' => [ + 'AppInit' => [], + 'HttpRun' => [], + 'HttpEnd' => [], + 'LogLevel' => [], + 'LogWrite' => [], + ], + + 'subscribe' => [ + ], +]; diff --git a/app/middleware.php b/app/middleware.php new file mode 100644 index 0000000..c032f2d --- /dev/null +++ b/app/middleware.php @@ -0,0 +1,14 @@ + + * Date: 2019/6/19 + * Time: 6:35 PM + */ + +namespace app\middleware; + +use app\model\UserInfo; +use app\util\ErrorCode; +use app\util\ErrorResponse; +use think\facade\Config; +use think\facade\Env; +use think\Request; + + +class ApiCheck +{ + /** + * 在进行业务前处理用户token + * @param Request $request + * @param \Closure $next + * @return mixed + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\ModelNotFoundException + * @throws \think\exception\DbException + */ + public function handle(Request $request, \Closure $next) + { + $open_id = Env::get('app_debug') ? 'wxaffadsf31Dfaf93' : $request->param('open_id');//'wxaffadsf31Dfaf93'; + + if (empty($open_id)) { + return ErrorResponse::createError( + ErrorCode::ERROR_OPENID_REQUIRED, '缺失参数open_id' + ); + } + $user = UserInfo::where('open_id', $open_id)->find(); + if(empty($user)){ + return ErrorResponse::createError( + ErrorCode::ERROR_USER_NOT_EXISTS, '用户不存在或者open_id错误' + ); + } + $request->user = $user; + //对于 admin -> token + //对于 user -> open_id + $response = $next($request); + return $response; + } +} \ No newline at end of file diff --git a/app/middleware/Cors.php b/app/middleware/Cors.php new file mode 100644 index 0000000..89bb345 --- /dev/null +++ b/app/middleware/Cors.php @@ -0,0 +1,27 @@ + + * Date: 2019/6/19 + * Time: 5:38 PM + */ + +namespace app\middleware; + +use think\App; +use think\Config; +use think\Request; +use think\Response; +use think\response\Redirect; + +class Cors +{ + public function handle(Request $request, \Closure $next) + { + $response = $next($request); + $response->header([ + 'Access-Control-Allow-Origin' => '*' + ]); + return $response; + } +} \ No newline at end of file diff --git a/app/model/AdminInfo.php b/app/model/AdminInfo.php new file mode 100644 index 0000000..a9ce046 --- /dev/null +++ b/app/model/AdminInfo.php @@ -0,0 +1,16 @@ + + * Date: 2019/6/18 + * Time: 1:51 PM + */ + +namespace app\model; + +use app\BaseModel; + +class AdminInfo extends BaseModel +{ + protected $table='admin_info'; +} \ No newline at end of file diff --git a/app/model/EvaluationHistory.php b/app/model/EvaluationHistory.php new file mode 100644 index 0000000..6f53b05 --- /dev/null +++ b/app/model/EvaluationHistory.php @@ -0,0 +1,17 @@ + + * Date: 2019/6/19 + * Time: 5:45 PM + */ + +namespace app\model; + + +use app\BaseModel; + +class EvaluationHistory extends BaseModel +{ + protected $table = 'evaluation_history'; +} \ No newline at end of file diff --git a/app/model/UserDetail.php b/app/model/UserDetail.php new file mode 100644 index 0000000..d826b13 --- /dev/null +++ b/app/model/UserDetail.php @@ -0,0 +1,17 @@ + + * Date: 2019/6/18 + * Time: 7:23 PM + */ + +namespace app\model; + + +use app\BaseModel; + +class UserDetail extends BaseModel +{ + protected $table = 'user_detail'; +} \ No newline at end of file diff --git a/app/model/UserInfo.php b/app/model/UserInfo.php new file mode 100644 index 0000000..04d94c7 --- /dev/null +++ b/app/model/UserInfo.php @@ -0,0 +1,36 @@ + + * Date: 2019/6/18 + * Time: 7:22 PM + */ + +namespace app\model; + + +use app\BaseModel; + +class UserInfo extends BaseModel +{ + protected $table = 'user_info'; + + public function detail() + { + return $this->hasOne('UserDetail', 'uid', 'id'); + } + + public function search() + { + return $this->query("SELECT u.avatar,u.nickname,u.username,u.open_id,d.* from user_detail d , user_info u where u.id = d.uid"); + } + + /** + * 获取已经格式过的用户详情 + * @return UserDetail + */ + public function getParsedDetail(): UserDetail + { + return $this->detail; + } +} \ No newline at end of file diff --git a/app/provider.php b/app/provider.php new file mode 100644 index 0000000..c9b41d3 --- /dev/null +++ b/app/provider.php @@ -0,0 +1,19 @@ + +// +---------------------------------------------------------------------- + +use app\ExceptionHandle; +use app\Request; + +// 容器Provider定义文件 +return [ + 'think\Request' => Request::class, + 'think\exception\Handle' => ExceptionHandle::class, +]; diff --git a/app/service/EvaluationService.php b/app/service/EvaluationService.php new file mode 100644 index 0000000..ab117ca --- /dev/null +++ b/app/service/EvaluationService.php @@ -0,0 +1,74 @@ + + * Date: 2019/6/19 + * Time: 5:47 PM + */ + +namespace app\service; + + +use app\model\EvaluationHistory; +use app\util\DataStatus; +use think\facade\Config; + +class EvaluationService +{ + /** + * @param int $id + * @return EvaluationHistory|null + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\ModelNotFoundException + * @throws \think\exception\DbException + */ + public static function findRecord(int $id) + { + return EvaluationHistory::find($id); + } + + public static function parseEvaluationData($item) + { + $data = []; + $subjects = Config::get('app.evaluation.subject'); + $results = [ + ['未患有急性高原反应', ''], + ['属于轻度高反', '适当休息,每天自评一次'], + ['属于中度高反', '就近就诊(基层医疗机构)'], + ['属于重度高反', '联系120,医院急诊留观或进入抢救室'], + ]; + if (!empty($item)) { + $data = [ + 'score' => 0, + 'options' => [] + ]; + foreach ($subjects as $key => $sub) { + $data['options'][] = array_merge([ + 'subject' => $sub['subject'], + ], $sub['options'][$item[$key]]); + $data['score'] += $sub['options'][$item[$key]]['score']; + } + $level = 0; + if ($data['score'] < 3) $level = 0; + elseif ($data['score'] <= 5) $level = 1; + elseif ($data['score'] <= 9) $level = 2; + else $level = 3; + $data['result'] = $results[$level][0]; + $data['create_time'] = $item['create_time']; + $data['suggest'] = $results[$level][1]; + } + return $data; + } + + public static function findByUser(int $uid) + { + $data = EvaluationHistory::where('uid', $uid) + ->where(DataStatus::NormalCondition()) + ->select()->toArray(); + foreach ($data as $k => $v) { + //array_merge(['raw' => $v], self::parseEvaluationData($v)); + $data[$k] = self::parseEvaluationData($v); + } + return $data; + } +} \ No newline at end of file diff --git a/app/util/DataStatus.php b/app/util/DataStatus.php new file mode 100644 index 0000000..93b492f --- /dev/null +++ b/app/util/DataStatus.php @@ -0,0 +1,43 @@ + + * Date: 2019/6/19 + * Time: 9:41 PM + */ + +namespace app\util; + + +class DataStatus +{ + const Normal = 1; + const Delete = -1; + const Disabled = 2; + /** + * @var string 字段名称 + */ + const FieldKey = 'status'; + + /** + * 正常状态条件 + * @return array + */ + public static function NormalCondition() + { + return [ + self::FieldKey => self::Normal + ]; + } + + /** + * 删除状态条件 + * @return array + */ + public static function DeleteCondition() + { + return [ + self::FieldKey => self::Delete + ]; + } +} \ No newline at end of file diff --git a/app/util/ErrorResponse.php b/app/util/ErrorResponse.php new file mode 100644 index 0000000..0f69fb3 --- /dev/null +++ b/app/util/ErrorResponse.php @@ -0,0 +1,64 @@ + + * Date: 2019/6/18 + * Time: 4:06 PM + */ + +namespace app\util; + + +use think\Response; +use think\response\Json; + +class ErrorCode +{ + /** + * 参数不足 + */ + const ERROR_PARAM_REQUIRED = 10001; + /** + * 参数错误 + */ + const ERROR_PARAM_ERROR = 10002; + /** + * @var 缺失用户openid + */ + const ERROR_OPENID_REQUIRED = 10003; + //用户 + /** + * 用户名或密码错误 + */ + const ERROR_ADMIN_LOGIN_PWD = 2101; + /** + * 原始密码不正确 + */ + const ERROR_ADMIN_PWD_ERROR = 21010; + /** + * 输入的密码不一致 + */ + const ERROR_ADMIN_PWD_UN_EQUAL = 21012; + + //用户 + /** + * 用户不存在 + */ + const ERROR_USER_NOT_EXISTS = 22001; + + /** + * 评估 + */ + const EVALUATION_SAVE_FAIL = 23005; +} + +class ErrorResponse extends Json +{ + public static function createError($errorCode, $errorMessage = ''): Response + { + return parent::create([ + "code" => $errorCode, + "message" => $errorMessage + ]); // TODO: Change the autogenerated stub + } +} \ No newline at end of file diff --git a/app/util/StringUtil.php b/app/util/StringUtil.php new file mode 100644 index 0000000..87c4951 --- /dev/null +++ b/app/util/StringUtil.php @@ -0,0 +1,29 @@ + + * Date: 2019/6/18 + * Time: 5:15 PM + */ + +namespace app\util; + + +class StringUtil +{ + public static function createPassword(string $originPassword,string &$salt = null) + { + $salt = self::generateRandom(6); + return md5($originPassword.$salt); + } + public static function getEncryptPassword(string $originPassword,string $salt = null){ + return md5($originPassword.$salt); + } + + public static function generateRandom(int $len) + { + //取随机10位字符串 + $strings = "QWERTYUIOPASDFGHJKLZXCVBNM1234567890qwertyuiopasdfghjklzxcvbnm"; + return substr(str_shuffle($strings), mt_rand(0, strlen($strings) - $len -1), $len); + } +} \ No newline at end of file diff --git a/app/util/SuccessResponse.php b/app/util/SuccessResponse.php new file mode 100644 index 0000000..889b7b6 --- /dev/null +++ b/app/util/SuccessResponse.php @@ -0,0 +1,22 @@ + + * Date: 2019/6/19 + * Time: 7:46 PM + */ + +namespace app\util; + + +use think\Response; +use think\response\Json; + +class SuccessResponse extends Json +{ + public static function create($data = null, string $type = '', int $code = 200): Response + { + $data = $data ?? ['code' => 0, 'message' => 'success']; + return parent::create($data, $type, $code); + } +} \ No newline at end of file diff --git a/build.example.php b/build.example.php new file mode 100644 index 0000000..0f2222f --- /dev/null +++ b/build.example.php @@ -0,0 +1,26 @@ + +// +---------------------------------------------------------------------- + +/** + * php think build 自动生成应用的目录结构的定义示例 + */ +return [ + // 需要自动创建的文件 + '__file__' => [], + // 需要自动创建的目录 + '__dir__' => ['controller', 'model', 'view'], + // 需要自动创建的控制器 + 'controller' => ['Index'], + // 需要自动创建的模型 + 'model' => ['User'], + // 需要自动创建的模板 + 'view' => ['index/index'], +]; diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..cd5a167 --- /dev/null +++ b/composer.json @@ -0,0 +1,42 @@ +{ + "name": "topthink/think", + "description": "the new thinkphp framework", + "type": "project", + "keywords": [ + "framework", + "thinkphp", + "ORM" + ], + "homepage": "http://thinkphp.cn/", + "license": "Apache-2.0", + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + } + ], + "require": { + "php": ">=7.1.0", + "topthink/framework": "6.0.*-dev", + "topthink/think-view": "^1.0", + "symfony/var-dumper":"^4.2", + "phpoffice/phpspreadsheet": "^1.7" + }, + "autoload": { + "psr-4": { + "app\\": "app" + }, + "psr-0": { + "": "extend/" + } + }, + "config": { + "preferred-install": "dist" + }, + "scripts": { + "post-autoload-dump": [ + "@php think service:discover", + "@php think vendor:publish" + ] + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..ad50157 --- /dev/null +++ b/composer.lock @@ -0,0 +1,1088 @@ +{ + "_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": "bc98a6152e41c38797af30da248f57be", + "packages": [ + { + "name": "league/flysystem", + "version": "1.0.52", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem.git", + "reference": "c5a5097156387970e6f0ccfcdf03f752856f3391" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/c5a5097156387970e6f0ccfcdf03f752856f3391", + "reference": "c5a5097156387970e6f0ccfcdf03f752856f3391", + "shasum": "", + "mirrors": [ + { + "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "ext-fileinfo": "*", + "php": ">=5.5.9" + }, + "conflict": { + "league/flysystem-sftp": "<1.0.6" + }, + "require-dev": { + "phpspec/phpspec": "^3.4", + "phpunit/phpunit": "^5.7.10" + }, + "suggest": { + "ext-fileinfo": "Required for MimeType", + "ext-ftp": "Allows you to use FTP server storage", + "ext-openssl": "Allows you to use FTPS server storage", + "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", + "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", + "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", + "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", + "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", + "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", + "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", + "league/flysystem-webdav": "Allows you to use WebDAV storage", + "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", + "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", + "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Flysystem\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frenky.net" + } + ], + "description": "Filesystem abstraction: Many filesystems, one API.", + "keywords": [ + "Cloud Files", + "WebDAV", + "abstraction", + "aws", + "cloud", + "copy.com", + "dropbox", + "file systems", + "files", + "filesystem", + "filesystems", + "ftp", + "rackspace", + "remote", + "s3", + "sftp", + "storage" + ], + "time": "2019-05-20T20:21:14+00:00" + }, + { + "name": "league/flysystem-cached-adapter", + "version": "1.0.9", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem-cached-adapter.git", + "reference": "08ef74e9be88100807a3b92cc9048a312bf01d6f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem-cached-adapter/zipball/08ef74e9be88100807a3b92cc9048a312bf01d6f", + "reference": "08ef74e9be88100807a3b92cc9048a312bf01d6f", + "shasum": "", + "mirrors": [ + { + "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "league/flysystem": "~1.0", + "psr/cache": "^1.0.0" + }, + "require-dev": { + "mockery/mockery": "~0.9", + "phpspec/phpspec": "^3.4", + "phpunit/phpunit": "^5.7", + "predis/predis": "~1.0", + "tedivm/stash": "~0.12" + }, + "suggest": { + "ext-phpredis": "Pure C implemented extension for PHP" + }, + "type": "library", + "autoload": { + "psr-4": { + "League\\Flysystem\\Cached\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "frankdejonge", + "email": "info@frenky.net" + } + ], + "description": "An adapter decorator to enable meta-data caching.", + "time": "2018-07-09T20:51:04+00:00" + }, + { + "name": "markbaker/complex", + "version": "1.4.7", + "source": { + "type": "git", + "url": "https://github.com/MarkBaker/PHPComplex.git", + "reference": "1ea674a8308baf547cbcbd30c5fcd6d301b7c000" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/1ea674a8308baf547cbcbd30c5fcd6d301b7c000", + "reference": "1ea674a8308baf547cbcbd30c5fcd6d301b7c000", + "shasum": "", + "mirrors": [ + { + "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": "^5.6.0|^7.0.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3", + "phpcompatibility/php-compatibility": "^8.0", + "phpdocumentor/phpdocumentor": "2.*", + "phploc/phploc": "2.*", + "phpmd/phpmd": "2.*", + "phpunit/phpunit": "^4.8.35|^5.4.0", + "sebastian/phpcpd": "2.*", + "squizlabs/php_codesniffer": "^3.3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Complex\\": "classes/src/" + }, + "files": [ + "classes/src/functions/abs.php", + "classes/src/functions/acos.php", + "classes/src/functions/acosh.php", + "classes/src/functions/acot.php", + "classes/src/functions/acoth.php", + "classes/src/functions/acsc.php", + "classes/src/functions/acsch.php", + "classes/src/functions/argument.php", + "classes/src/functions/asec.php", + "classes/src/functions/asech.php", + "classes/src/functions/asin.php", + "classes/src/functions/asinh.php", + "classes/src/functions/atan.php", + "classes/src/functions/atanh.php", + "classes/src/functions/conjugate.php", + "classes/src/functions/cos.php", + "classes/src/functions/cosh.php", + "classes/src/functions/cot.php", + "classes/src/functions/coth.php", + "classes/src/functions/csc.php", + "classes/src/functions/csch.php", + "classes/src/functions/exp.php", + "classes/src/functions/inverse.php", + "classes/src/functions/ln.php", + "classes/src/functions/log2.php", + "classes/src/functions/log10.php", + "classes/src/functions/negative.php", + "classes/src/functions/pow.php", + "classes/src/functions/rho.php", + "classes/src/functions/sec.php", + "classes/src/functions/sech.php", + "classes/src/functions/sin.php", + "classes/src/functions/sinh.php", + "classes/src/functions/sqrt.php", + "classes/src/functions/tan.php", + "classes/src/functions/tanh.php", + "classes/src/functions/theta.php", + "classes/src/operations/add.php", + "classes/src/operations/subtract.php", + "classes/src/operations/multiply.php", + "classes/src/operations/divideby.php", + "classes/src/operations/divideinto.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mark Baker", + "email": "mark@lange.demon.co.uk" + } + ], + "description": "PHP Class for working with complex numbers", + "homepage": "https://github.com/MarkBaker/PHPComplex", + "keywords": [ + "complex", + "mathematics" + ], + "time": "2018-10-13T23:28:42+00:00" + }, + { + "name": "markbaker/matrix", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/MarkBaker/PHPMatrix.git", + "reference": "6ea97472b5baf12119b4f31f802835b820dd6d64" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/MarkBaker/PHPMatrix/zipball/6ea97472b5baf12119b4f31f802835b820dd6d64", + "reference": "6ea97472b5baf12119b4f31f802835b820dd6d64", + "shasum": "", + "mirrors": [ + { + "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": "^5.6.0|^7.0.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3", + "phpcompatibility/php-compatibility": "^8.0", + "phpdocumentor/phpdocumentor": "2.*", + "phploc/phploc": "2.*", + "phpmd/phpmd": "2.*", + "phpunit/phpunit": "^4.8.35|^5.4.0", + "sebastian/phpcpd": "2.*", + "squizlabs/php_codesniffer": "^3.3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Matrix\\": "classes/src/" + }, + "files": [ + "classes/src/functions/adjoint.php", + "classes/src/functions/antidiagonal.php", + "classes/src/functions/cofactors.php", + "classes/src/functions/determinant.php", + "classes/src/functions/diagonal.php", + "classes/src/functions/identity.php", + "classes/src/functions/inverse.php", + "classes/src/functions/minors.php", + "classes/src/functions/trace.php", + "classes/src/functions/transpose.php", + "classes/src/operations/add.php", + "classes/src/operations/directsum.php", + "classes/src/operations/subtract.php", + "classes/src/operations/multiply.php", + "classes/src/operations/divideby.php", + "classes/src/operations/divideinto.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mark Baker", + "email": "mark@lange.demon.co.uk" + } + ], + "description": "PHP Class for working with matrices", + "homepage": "https://github.com/MarkBaker/PHPMatrix", + "keywords": [ + "mathematics", + "matrix", + "vector" + ], + "time": "2018-11-04T22:12:12+00:00" + }, + { + "name": "opis/closure", + "version": "3.3.0", + "source": { + "type": "git", + "url": "https://github.com/opis/closure.git", + "reference": "f846725591203098246276b2e7b9e8b7814c4965" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/opis/closure/zipball/f846725591203098246276b2e7b9e8b7814c4965", + "reference": "f846725591203098246276b2e7b9e8b7814c4965", + "shasum": "", + "mirrors": [ + { + "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": "^5.4 || ^7.0" + }, + "require-dev": { + "jeremeamia/superclosure": "^2.0", + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Opis\\Closure\\": "src/" + }, + "files": [ + "functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marius Sarca", + "email": "marius.sarca@gmail.com" + }, + { + "name": "Sorin Sarca", + "email": "sarca_sorin@hotmail.com" + } + ], + "description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.", + "homepage": "https://opis.io/closure", + "keywords": [ + "anonymous functions", + "closure", + "function", + "serializable", + "serialization", + "serialize" + ], + "time": "2019-05-31T20:04:32+00:00" + }, + { + "name": "phpoffice/phpspreadsheet", + "version": "1.7.0", + "source": { + "type": "git", + "url": "https://github.com/PHPOffice/PhpSpreadsheet.git", + "reference": "84e09df79855ed3da84e2eab6850eb7741d8cbda" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/84e09df79855ed3da84e2eab6850eb7741d8cbda", + "reference": "84e09df79855ed3da84e2eab6850eb7741d8cbda", + "shasum": "", + "mirrors": [ + { + "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "ext-ctype": "*", + "ext-dom": "*", + "ext-fileinfo": "*", + "ext-gd": "*", + "ext-iconv": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-simplexml": "*", + "ext-xml": "*", + "ext-xmlreader": "*", + "ext-xmlwriter": "*", + "ext-zip": "*", + "ext-zlib": "*", + "markbaker/complex": "^1.4", + "markbaker/matrix": "^1.1", + "php": "^5.6|^7.0", + "psr/simple-cache": "^1.0" + }, + "require-dev": { + "doctrine/instantiator": "^1.0.0", + "dompdf/dompdf": "^0.8.0", + "friendsofphp/php-cs-fixer": "@stable", + "jpgraph/jpgraph": "^4.0", + "mpdf/mpdf": "^7.0.0", + "phpcompatibility/php-compatibility": "^8.0", + "phpunit/phpunit": "^5.7", + "squizlabs/php_codesniffer": "^3.3", + "tecnickcom/tcpdf": "^6.2" + }, + "suggest": { + "dompdf/dompdf": "Option for rendering PDF with PDF Writer", + "jpgraph/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers", + "mpdf/mpdf": "Option for rendering PDF with PDF Writer", + "tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer" + }, + "type": "library", + "autoload": { + "psr-4": { + "PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-2.1-or-later" + ], + "authors": [ + { + "name": "Erik Tilt" + }, + { + "name": "Adrien Crivelli" + }, + { + "name": "Maarten Balliauw", + "homepage": "https://blog.maartenballiauw.be" + }, + { + "name": "Mark Baker", + "homepage": "https://markbakeruk.net" + }, + { + "name": "Franck Lefevre", + "homepage": "https://rootslabs.net" + } + ], + "description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine", + "homepage": "https://github.com/PHPOffice/PhpSpreadsheet", + "keywords": [ + "OpenXML", + "excel", + "gnumeric", + "ods", + "php", + "spreadsheet", + "xls", + "xlsx" + ], + "time": "2019-05-26T02:50:36+00:00" + }, + { + "name": "psr/cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "", + "mirrors": [ + { + "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "time": "2016-08-06T20:24:11+00:00" + }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "", + "mirrors": [ + { + "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+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": "", + "mirrors": [ + { + "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "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" + }, + { + "name": "psr/simple-cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "shasum": "", + "mirrors": [ + { + "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\SimpleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for simple caching", + "keywords": [ + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" + ], + "time": "2017-10-23T01:57:42+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.11.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "fe5e94c604826c35a32fa832f35bd036b6799609" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fe5e94c604826c35a32fa832f35bd036b6799609", + "reference": "fe5e94c604826c35a32fa832f35bd036b6799609", + "shasum": "", + "mirrors": [ + { + "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.11-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2019-02-06T07:57:58+00:00" + }, + { + "name": "symfony/polyfill-php72", + "version": "v1.11.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "ab50dcf166d5f577978419edd37aa2bb8eabce0c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/ab50dcf166d5f577978419edd37aa2bb8eabce0c", + "reference": "ab50dcf166d5f577978419edd37aa2bb8eabce0c", + "shasum": "", + "mirrors": [ + { + "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.11-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2019-02-06T07:57:58+00:00" + }, + { + "name": "symfony/var-dumper", + "version": "v4.3.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-dumper.git", + "reference": "f974f448154928d2b5fb7c412bd23b81d063f34b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/f974f448154928d2b5fb7c412bd23b81d063f34b", + "reference": "f974f448154928d2b5fb7c412bd23b81d063f34b", + "shasum": "", + "mirrors": [ + { + "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php72": "~1.5" + }, + "conflict": { + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", + "symfony/console": "<3.4" + }, + "require-dev": { + "ext-iconv": "*", + "symfony/console": "~3.4|~4.0", + "symfony/process": "~3.4|~4.0", + "twig/twig": "~1.34|~2.4" + }, + "suggest": { + "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", + "ext-intl": "To show region name in time zone dump", + "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" + }, + "bin": [ + "Resources/bin/var-dump-server" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.3-dev" + } + }, + "autoload": { + "files": [ + "Resources/functions/dump.php" + ], + "psr-4": { + "Symfony\\Component\\VarDumper\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony mechanism for exploring and dumping PHP variables", + "homepage": "https://symfony.com", + "keywords": [ + "debug", + "dump" + ], + "time": "2019-06-05T02:08:12+00:00" + }, + { + "name": "topthink/framework", + "version": "6.0.x-dev", + "source": { + "type": "git", + "url": "https://github.com/top-think/framework.git", + "reference": "77b111bdcb90aeb8569c367739fc2290cae910a3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/framework/zipball/77b111bdcb90aeb8569c367739fc2290cae910a3", + "reference": "77b111bdcb90aeb8569c367739fc2290cae910a3", + "shasum": "", + "mirrors": [ + { + "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "league/flysystem": "^1.0", + "league/flysystem-cached-adapter": "^1.0", + "opis/closure": "^3.1", + "php": ">=7.1.0", + "psr/cache": "~1.0", + "psr/container": "~1.0", + "psr/log": "~1.0", + "psr/simple-cache": "^1.0" + }, + "require-dev": { + "mikey179/vfsstream": "^1.6", + "mockery/mockery": "^1.2", + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "autoload": { + "files": [], + "psr-4": { + "think\\": "src/think/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + }, + { + "name": "yunwuxin", + "email": "448901948@qq.com" + } + ], + "description": "The ThinkPHP Framework.", + "homepage": "http://thinkphp.cn/", + "keywords": [ + "framework", + "orm", + "thinkphp" + ], + "time": "2019-06-18T05:35:37+00:00" + }, + { + "name": "topthink/think-template", + "version": "v2.0.1", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-template.git", + "reference": "aee66382c62610b11f0694df8b2aef1ba32f064d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/think-template/zipball/aee66382c62610b11f0694df8b2aef1ba32f064d", + "reference": "aee66382c62610b11f0694df8b2aef1ba32f064d", + "shasum": "", + "mirrors": [ + { + "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=7.1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "think\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + } + ], + "description": "the php template engine", + "time": "2019-02-20T06:02:13+00:00" + }, + { + "name": "topthink/think-view", + "version": "v1.0.6", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-view.git", + "reference": "dee408c1924e6e32a435fa058e04cee6668ed6d6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/think-view/zipball/dee408c1924e6e32a435fa058e04cee6668ed6d6", + "reference": "dee408c1924e6e32a435fa058e04cee6668ed6d6", + "shasum": "", + "mirrors": [ + { + "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=7.1.0", + "topthink/think-template": "^2.0" + }, + "type": "library", + "extra": { + "think": { + "config": { + "template": "src/config/template.php" + } + } + }, + "autoload": { + "psr-4": { + "think\\view\\driver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + } + ], + "description": "thinkphp template driver", + "time": "2019-04-17T10:36:32+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": { + "topthink/framework": 20 + }, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=7.1.0" + }, + "platform-dev": [] +} diff --git a/config/app.php b/config/app.php new file mode 100644 index 0000000..6639750 --- /dev/null +++ b/config/app.php @@ -0,0 +1,50 @@ + +// +---------------------------------------------------------------------- + +// +---------------------------------------------------------------------- +// | 应用设置 +// +---------------------------------------------------------------------- + +use think\facade\Env; + +return [ + // 应用地址 + 'app_host' => Env::get('app.host', ''), + // 应用的命名空间 + 'app_namespace' => '', + // 是否启用路由 + 'with_route' => true, + // 是否启用事件 + 'with_event' => true, + // 自动多应用模式 + 'auto_multi_app' => false, + // 应用映射(自动多应用模式有效) + 'app_map' => [], + // 域名绑定(自动多应用模式有效) + 'domain_bind' => [], + // 禁止URL访问的应用列表(自动多应用模式有效) + 'deny_app_list' => [], + // 默认应用 + 'default_app' => 'index', + // 默认时区 + 'default_timezone' => 'Asia/Shanghai', + + // 异常页面的模板文件 + 'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl', + + // 错误显示信息,非调试模式有效 + 'error_message' => '页面错误!请稍后再试~', + // 显示错误信息 + 'show_error_msg' => false, + 'evaluation' => [ + 'subject' => include(__DIR__.'/evaluation_subject.php'), + ] +]; diff --git a/config/cache.php b/config/cache.php new file mode 100644 index 0000000..dc54123 --- /dev/null +++ b/config/cache.php @@ -0,0 +1,39 @@ + +// +---------------------------------------------------------------------- +use think\facade\Env; + +// +---------------------------------------------------------------------- +// | 缓存设置 +// +---------------------------------------------------------------------- + +return [ + // 默认缓存驱动 + 'default' => Env::get('cache.driver', 'file'), + + // 缓存连接方式配置 + 'stores' => [ + 'file' => [ + // 驱动方式 + 'type' => 'File', + // 缓存保存目录 + 'path' => '', + // 缓存前缀 + 'prefix' => '', + // 缓存有效期 0表示永久缓存 + 'expire' => 0, + // 缓存标签前缀 + 'tag_prefix' => 'tag:', + // 序列化机制 例如 ['serialize', 'unserialize'] + 'serialize' => [], + ], + // 更多的缓存连接 + ], +]; diff --git a/config/console.php b/config/console.php new file mode 100644 index 0000000..cf6b4ec --- /dev/null +++ b/config/console.php @@ -0,0 +1,21 @@ + +// +---------------------------------------------------------------------- + +// +---------------------------------------------------------------------- +// | 控制台配置 +// +---------------------------------------------------------------------- +return [ + // 执行用户(Windows下无效) + 'user' => null, + // 指令定义 + 'commands' => [ + ], +]; diff --git a/config/cookie.php b/config/cookie.php new file mode 100644 index 0000000..bbc5819 --- /dev/null +++ b/config/cookie.php @@ -0,0 +1,28 @@ + +// +---------------------------------------------------------------------- + +// +---------------------------------------------------------------------- +// | Cookie设置 +// +---------------------------------------------------------------------- +return [ + // cookie 保存时间 + 'expire' => 0, + // cookie 保存路径 + 'path' => '/', + // cookie 有效域名 + 'domain' => '', + // cookie 启用安全传输 + 'secure' => false, + // httponly设置 + 'httponly' => false, + // 是否使用 setcookie + 'setcookie' => true, +]; diff --git a/config/database.php b/config/database.php new file mode 100644 index 0000000..71774a0 --- /dev/null +++ b/config/database.php @@ -0,0 +1,69 @@ + +// +---------------------------------------------------------------------- + +use think\facade\Env; + +return [ + // 默认使用的数据库连接配置 + 'default' => Env::get('database.driver', 'mysql'), + + // 数据库连接配置信息 + 'connections' => [ + 'mysql' => [ + // 数据库类型 + 'type' => Env::get('database.type', 'mysql'), + // 服务器地址 + 'hostname' => Env::get('database.hostname', '127.0.0.1'), + // 数据库名 + 'database' => Env::get('database.database', ''), + // 用户名 + 'username' => Env::get('database.username', 'root'), + // 密码 + 'password' => Env::get('database.password', ''), + // 端口 + 'hostport' => Env::get('database.hostport', '3306'), + // 连接dsn + 'dsn' => '', + // 数据库连接参数 + 'params' => [], + // 数据库编码默认采用utf8 + 'charset' => Env::get('database.charset', 'utf8'), + // 数据库表前缀 + 'prefix' => Env::get('database.prefix', ''), + // 数据库调试模式 + 'debug' => Env::get('database.debug', true), + // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) + 'deploy' => 0, + // 数据库读写是否分离 主从式有效 + 'rw_separate' => false, + // 读写分离后 主服务器数量 + 'master_num' => 1, + // 指定从服务器序号 + 'slave_no' => '', + // 是否严格检查字段是否存在 + 'fields_strict' => true, + // 是否需要进行SQL性能分析 + 'sql_explain' => false, + // Builder类 + 'builder' => '', + // Query类 + 'query' => '', + // 是否需要断线重连 + 'break_reconnect' => false, + ], + + // 更多的数据库配置信息 + ], + // 自动写入时间戳字段 + 'auto_timestamp' => false, + // 时间字段取出后的默认时间格式 + 'datetime_format' => 'Y-m-d H:i:s', +]; diff --git a/config/evaluation_subject.php b/config/evaluation_subject.php new file mode 100644 index 0000000..da15407 --- /dev/null +++ b/config/evaluation_subject.php @@ -0,0 +1,49 @@ + + * Date: 2019/6/19 + * Time: 5:11 PM + */ +return [ + 'headache' => [ + 'title' => '您是否感到头疼不适?', + 'subject' => '头痛', + 'options' => [ + ['text' => '无头痛', 'score' => 0], + ['text' => '轻度头痛', 'score' => 1], + ['text' => '重度头痛', 'score' => 2], + ['text' => '严重头痛,丧失活动能力', 'score' => 3], + ] + ], + 'gastrointestinal' => [ + 'title' => '您是否感觉到胃肠道不适?', + 'subject' => '胃肠道症状', + 'options' => [ + ['text' => '食欲好', 'score' => 0], + ['text' => '食欲不振或恶心', 'score' => 1], + ['text' => '恶心或呕吐(小于等于5次呕吐)', 'score' => 2], + ['text' => '严重恶心或呕吐(大于5次呕吐),丧失活动能力', 'score' => 3], + ] + ], + 'tired' => [ + 'title' => '您是否感觉到疲劳或虚弱?', + 'subject' => '劳累或虚弱', + 'options' => [ + ['text' => '疲劳或虚弱', 'score' => 0], + ['text' => '轻度疲劳或虚弱', 'score' => 1], + ['text' => '重度疲劳或虚弱', 'score' => 2], + ['text' => '严重疲劳或虚弱,丧失活动能力', 'score' => 3], + ] + ], + 'dizzy' => [ + 'title' => '您是否感觉到头晕或眩晕?', + 'subject' => '头晕或眩晕', + 'options' => [ + ['text' => '无头晕或眩晕', 'score' => 0], + ['text' => '轻度头晕或眩晕', 'score' => 1], + ['text' => '重度头晕或眩晕', 'score' => 2], + ['text' => '严重头晕或眩晕,丧失活动能力', 'score' => 3], + ] + ], +]; \ No newline at end of file diff --git a/config/filesystem.php b/config/filesystem.php new file mode 100644 index 0000000..a0c5744 --- /dev/null +++ b/config/filesystem.php @@ -0,0 +1,20 @@ + Env::get('filesystem.driver', 'local'), + 'disks' => [ + 'local' => [ + 'driver' => 'local', + 'root' => app()->getRuntimePath() . 'storage', + ], + 'public' => [ + 'driver' => 'local', + 'root' => app()->getRootPath() . 'public/storage', + 'url' => '/storage', + 'visibility' => 'public', + ], + // 更多的磁盘配置信息 + ], +]; diff --git a/config/lang.php b/config/lang.php new file mode 100644 index 0000000..7659eaa --- /dev/null +++ b/config/lang.php @@ -0,0 +1,37 @@ + +// +---------------------------------------------------------------------- + +// +---------------------------------------------------------------------- +// | 多语言设置 +// +---------------------------------------------------------------------- + +use think\facade\Env; + +return [ + // 默认语言 + 'default_lang' => Env::get('lang.default_lang', 'zh-cn'), + // 允许的语言列表 + 'allow_lang_list' => [], + // 多语言自动侦测变量名 + 'detect_var' => 'lang', + // 是否使用Cookie记录 + 'use_cookie' => true, + // 多语言cookie变量 + 'cookie_var' => 'think_lang', + // 扩展语言包 + 'extend_list' => [], + // Accept-Language转义为对应语言包名称 + 'accept_language' => [ + 'zh-hans-cn' => 'zh-cn', + ], + // 是否支持语言分组 + 'allow_group' => false, +]; diff --git a/config/log.php b/config/log.php new file mode 100644 index 0000000..478fcfb --- /dev/null +++ b/config/log.php @@ -0,0 +1,30 @@ + +// +---------------------------------------------------------------------- + +// +---------------------------------------------------------------------- +// | 日志设置 +// +---------------------------------------------------------------------- +return [ + // 日志记录方式,内置 file socket 支持扩展 + 'type' => 'File', + // 日志保存目录 + 'path' => '',//dirname(__DIR__).'/runtime', + // 日志记录级别 + 'level' => [], + // 单文件日志写入 + 'single' => false, + // 独立日志级别 + 'apart_level' => ['error','sql'], + // 最大日志文件数量 + 'max_files' => 500, + // 是否关闭日志写入 + 'close' => false, +]; diff --git a/config/route.php b/config/route.php new file mode 100644 index 0000000..1a6048d --- /dev/null +++ b/config/route.php @@ -0,0 +1,65 @@ + +// +---------------------------------------------------------------------- + +// +---------------------------------------------------------------------- +// | 应用设置 +// +---------------------------------------------------------------------- + +return [ + // pathinfo分隔符 + 'pathinfo_depr' => '/', + // URL伪静态后缀 + 'url_html_suffix' => 'html', + // URL普通方式参数 用于自动生成 + 'url_common_param' => true, + // 是否开启路由延迟解析 + 'url_lazy_route' => false, + // 是否强制使用路由 + 'url_route_must' => false, + // 合并路由规则 + 'route_rule_merge' => false, + // 路由是否完全匹配 + 'route_complete_match' => false, + // 使用注解路由 + 'route_annotation' => false, + // 是否开启路由缓存 + 'route_check_cache' => false, + // 路由缓存连接参数 + 'route_cache_option' => [], + // 路由缓存Key + 'route_check_cache_key' => '', + // 访问控制器层名称 + 'controller_layer' => 'controller', + // 空控制器名 + 'empty_controller' => 'Error', + // 是否使用控制器后缀 + 'controller_suffix' => false, + // 默认的路由变量规则 + 'default_route_pattern' => '[\w\.]+', + // 是否自动转换URL中的控制器和操作名 + 'url_convert' => true, + // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则 + 'request_cache' => false, + // 请求缓存有效期 + 'request_cache_expire' => null, + // 全局请求缓存排除规则 + 'request_cache_except' => [], + // 默认控制器名 + 'default_controller' => 'Index', + // 默认操作名 + 'default_action' => 'index', + // 操作方法后缀 + 'action_suffix' => '', + // 默认JSONP格式返回的处理方法 + 'default_jsonp_handler' => 'jsonpReturn', + // 默认JSONP处理方法 + 'var_jsonp_handler' => 'callback', +]; diff --git a/config/session.php b/config/session.php new file mode 100644 index 0000000..7a2527a --- /dev/null +++ b/config/session.php @@ -0,0 +1,27 @@ + +// +---------------------------------------------------------------------- + +// +---------------------------------------------------------------------- +// | 会话设置 +// +---------------------------------------------------------------------- + +return [ + // session name + 'name' => '', + // SESSION_ID的提交变量,解决flash上传跨域 + 'var_session_id' => '', + // 驱动方式 支持file redis memcache memcached + 'type' => 'file', + // 过期时间 + 'expire' => 0, + // 前缀 + 'prefix' => '', +]; diff --git a/config/template.php b/config/template.php new file mode 100644 index 0000000..98fd536 --- /dev/null +++ b/config/template.php @@ -0,0 +1,25 @@ + 'Think', + // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法 + 'auto_rule' => 1, + // 模板路径 + 'view_path' => '', + // 模板后缀 + 'view_suffix' => 'html', + // 模板文件名分隔符 + 'view_depr' => DIRECTORY_SEPARATOR, + // 模板引擎普通标签开始标记 + 'tpl_begin' => '{', + // 模板引擎普通标签结束标记 + 'tpl_end' => '}', + // 标签库标签开始标记 + 'taglib_begin' => '{', + // 标签库标签结束标记 + 'taglib_end' => '}', +]; diff --git a/config/trace.php b/config/trace.php new file mode 100644 index 0000000..2391481 --- /dev/null +++ b/config/trace.php @@ -0,0 +1,27 @@ + +// +---------------------------------------------------------------------- + +// +---------------------------------------------------------------------- +// | Trace设置 开启调试模式后有效 +// +---------------------------------------------------------------------- +return [ + // 内置Html 支持扩展 + 'type' => 'Console', + 'trace_tabs' => [ + 'base'=>'基本', + 'file'=>'文件', + 'info'=>'流程', + 'error'=>'错误', + 'sql'=>'SQL', + 'debug'=>'调试', + 'user'=>'用户' + ] +]; diff --git a/extend/.gitignore b/extend/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/extend/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/public/.htaccess b/public/.htaccess new file mode 100644 index 0000000..cbc7868 --- /dev/null +++ b/public/.htaccess @@ -0,0 +1,8 @@ + + Options +FollowSymlinks -Multiviews + RewriteEngine On + + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] + diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..e71815a Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/index.php b/public/index.php new file mode 100644 index 0000000..e67b8d6 --- /dev/null +++ b/public/index.php @@ -0,0 +1,24 @@ + +// +---------------------------------------------------------------------- + +// [ 应用入口文件 ] +namespace think; + +require __DIR__ . '/../vendor/autoload.php'; + +// 执行HTTP应用并响应 +$http = (new App())->http; + +$response = $http->run(); + +$response->send(); + +$http->end($response); diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..eb05362 --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: diff --git a/public/router.php b/public/router.php new file mode 100644 index 0000000..4f916b4 --- /dev/null +++ b/public/router.php @@ -0,0 +1,17 @@ + +// +---------------------------------------------------------------------- +// $Id$ + +if (is_file($_SERVER["DOCUMENT_ROOT"] . $_SERVER["SCRIPT_NAME"])) { + return false; +} else { + require __DIR__ . "/index.php"; +} diff --git a/public/static/.gitignore b/public/static/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/public/static/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/route/app.php b/route/app.php new file mode 100644 index 0000000..9e59225 --- /dev/null +++ b/route/app.php @@ -0,0 +1,16 @@ + +// +---------------------------------------------------------------------- +use think\facade\Route; + +Route::get('hello', function () { + return 'hello!'; +}); +Route::get('user/detail/:id','User/detail'); \ No newline at end of file diff --git a/runtime/201906/18.log b/runtime/201906/18.log new file mode 100644 index 0000000..4f4035d --- /dev/null +++ b/runtime/201906/18.log @@ -0,0 +1,59 @@ +--------------------------------------------------------------- +[2019-06-18T16:44:05+08:00] ::1 GET localhost:10086/admin/login?username=admin&password=99d310ce9b1326045cf1446c5840a08c +[ sql ] [ DB ] CONNECT:[ UseTime:0.207916s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.135546s ] +[ sql ] [ SQL ] SELECT * FROM `admin_info` WHERE `id` IN (admin,99d310ce9b1326045cf1446c5840a08c) LIMIT 1 [ RunTime:0.129722s ] +--------------------------------------------------------------- +[2019-06-18T16:48:39+08:00] ::1 GET localhost:10086/admin/login?username=admin&password=99d310ce9b1326045cf1446c5840a08c +[ sql ] [ DB ] CONNECT:[ UseTime:0.198592s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.086700s ] +[ sql ] [ SQL ] SELECT * FROM `admin_info` WHERE `username` = 'admin' AND `password` = '99d310ce9b1326045cf1446c5840a08c' LIMIT 1 [ RunTime:0.145541s ] +[ error ] [0]Argument 1 passed to app\BaseModel::getData() must be of the type string or null, array given, called in /Users/keley/dev/altitudereaction/api/app/controller/Admin.php on line 33[/Users/keley/dev/altitudereaction/api/app/BaseModel.php:14] +--------------------------------------------------------------- +[2019-06-18T16:50:07+08:00] ::1 GET localhost:10086/admin/login?username=admin&password=99d310ce9b1326045cf1446c5840a08c +[ sql ] [ DB ] CONNECT:[ UseTime:0.126784s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.101802s ] +[ sql ] [ SQL ] SELECT * FROM `admin_info` WHERE `username` = 'admin' LIMIT 1 [ RunTime:0.079279s ] +[ error ] [0]method not exist:think\db\Query->empty[/Users/keley/dev/altitudereaction/api/vendor/topthink/framework/src/think/db/BaseQuery.php:139] +--------------------------------------------------------------- +[2019-06-18T16:50:29+08:00] ::1 GET localhost:10086/admin/login?username=admin&password=99d310ce9b1326045cf1446c5840a08c +[ sql ] [ DB ] CONNECT:[ UseTime:0.117465s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.092046s ] +[ sql ] [ SQL ] SELECT * FROM `admin_info` WHERE `username` = 'admin' LIMIT 1 [ RunTime:0.122735s ] +[ error ] [0]Argument 1 passed to app\BaseModel::getData() must be of the type string or null, array given, called in /Users/keley/dev/altitudereaction/api/app/controller/Admin.php on line 33[/Users/keley/dev/altitudereaction/api/app/BaseModel.php:14] +--------------------------------------------------------------- +[2019-06-18T16:50:52+08:00] ::1 GET localhost:10086/admin/login?username=admin&password=99d310ce9b1326045cf1446c5840a08c +[ sql ] [ DB ] CONNECT:[ UseTime:0.473969s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.077633s ] +[ sql ] [ SQL ] SELECT * FROM `admin_info` WHERE `username` = 'admin' LIMIT 1 [ RunTime:0.099419s ] +[ error ] [0]Argument 1 passed to app\BaseModel::getData() must be of the type string or null, array given, called in /Users/keley/dev/altitudereaction/api/app/controller/Admin.php on line 33[/Users/keley/dev/altitudereaction/api/app/BaseModel.php:14] +--------------------------------------------------------------- +[2019-06-18T16:50:54+08:00] ::1 GET localhost:10086/admin/login?username=admin&password=99d310ce9b1326045cf1446c5840a08c +[ sql ] [ DB ] CONNECT:[ UseTime:0.124527s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.073547s ] +[ sql ] [ SQL ] SELECT * FROM `admin_info` WHERE `username` = 'admin' LIMIT 1 [ RunTime:0.093094s ] +[ error ] [0]Argument 1 passed to app\BaseModel::getData() must be of the type string or null, array given, called in /Users/keley/dev/altitudereaction/api/app/controller/Admin.php on line 33[/Users/keley/dev/altitudereaction/api/app/BaseModel.php:14] +--------------------------------------------------------------- +[2019-06-18T16:51:07+08:00] ::1 GET localhost:10086/admin/login?username=admin&password=99d310ce9b1326045cf1446c5840a08c +[ sql ] [ DB ] CONNECT:[ UseTime:0.143574s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.306701s ] +[ sql ] [ SQL ] SELECT * FROM `admin_info` WHERE `username` = 'admin' LIMIT 1 [ RunTime:0.143909s ] +[ error ] [0]Argument 1 passed to app\BaseModel::getData() must be of the type string or null, array given, called in /Users/keley/dev/altitudereaction/api/app/controller/Admin.php on line 34[/Users/keley/dev/altitudereaction/api/app/BaseModel.php:14] +--------------------------------------------------------------- +[2019-06-18T16:52:48+08:00] ::1 GET localhost:10086/admin/login?username=admin&password=99d310ce9b1326045cf1446c5840a08c +[ sql ] [ DB ] CONNECT:[ UseTime:0.144833s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.100029s ] +[ sql ] [ SQL ] SELECT * FROM `admin_info` WHERE `username` = 'admin' LIMIT 1 [ RunTime:0.125900s ] +[ error ] [0]Argument 1 passed to app\BaseModel::getPartData() must be of the type string or null, array given, called in /Users/keley/dev/altitudereaction/api/app/controller/Admin.php on line 33[/Users/keley/dev/altitudereaction/api/app/BaseModel.php:15] +--------------------------------------------------------------- +[2019-06-18T16:53:32+08:00] ::1 GET localhost:10086/admin/login?username=admin&password=99d310ce9b1326045cf1446c5840a08c +[ sql ] [ DB ] CONNECT:[ UseTime:0.162204s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.088442s ] +[ sql ] [ SQL ] SELECT * FROM `admin_info` WHERE `username` = 'admin' LIMIT 1 [ RunTime:0.094235s ] +[ error ] [0]Argument 1 passed to app\BaseModel::getPartData() must be an instance of app\object or null, array given, called in /Users/keley/dev/altitudereaction/api/app/controller/Admin.php on line 33[/Users/keley/dev/altitudereaction/api/app/BaseModel.php:15] +--------------------------------------------------------------- +[2019-06-18T16:54:28+08:00] ::1 GET localhost:10086/admin/login?username=admin&password=99d310ce9b1326045cf1446c5840a08c +[ sql ] [ DB ] CONNECT:[ UseTime:0.851370s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.175712s ] +[ sql ] [ SQL ] SELECT * FROM `admin_info` WHERE `username` = 'admin' LIMIT 1 [ RunTime:0.216947s ] +[ sql ] [ SQL ] UPDATE `admin_info` SET `last_login` = 1560848067 WHERE `id` = 4 [ RunTime:0.435021s ] diff --git a/runtime/log/201906/18.log b/runtime/log/201906/18.log new file mode 100644 index 0000000..c8f6934 --- /dev/null +++ b/runtime/log/201906/18.log @@ -0,0 +1,105 @@ +--------------------------------------------------------------- +[2019-06-18T13:54:17+08:00] ::1 GET localhost:10086/admin/login +[ sql ] [ DB ] CONNECT:[ UseTime:0.119652s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.084419s ] +[ sql ] [ SQL ] SELECT * FROM `admin_info` WHERE `id` = 4 LIMIT 1 [ RunTime:0.101957s ] +--------------------------------------------------------------- +[2019-06-18T13:56:35+08:00] ::1 GET localhost:10086/admin/login +[ sql ] [ DB ] CONNECT:[ UseTime:0.188721s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.057082s ] +[ sql ] [ SQL ] SELECT * FROM `admin_info` WHERE `id` = 4 LIMIT 1 [ RunTime:0.182802s ] +--------------------------------------------------------------- +[2019-06-18T13:57:03+08:00] ::1 GET localhost:10086/admin/login +[ sql ] [ DB ] CONNECT:[ UseTime:0.123025s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.089469s ] +[ sql ] [ SQL ] SELECT * FROM `admin_info` WHERE `id` = 4 LIMIT 1 [ RunTime:0.071443s ] +--------------------------------------------------------------- +[2019-06-18T13:58:54+08:00] ::1 GET localhost:10086/admin/login +[ sql ] [ DB ] CONNECT:[ UseTime:0.109069s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.130372s ] +[ sql ] [ SQL ] SELECT * FROM `admin_info` WHERE `id` = 4 LIMIT 1 [ RunTime:0.094987s ] +--------------------------------------------------------------- +[2019-06-18T13:59:55+08:00] ::1 GET localhost:10086/admin/login +[ error ] [2002]SQLSTATE[HY000] [2002] Operation timed out[/Users/keley/dev/altitudereaction/api/vendor/topthink/framework/src/think/db/PDOConnection.php:407] +--------------------------------------------------------------- +[2019-06-18T14:00:08+08:00] ::1 GET localhost:10086/admin/login +[ sql ] [ DB ] CONNECT:[ UseTime:0.145084s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.078654s ] +[ sql ] [ SQL ] SELECT * FROM `admin_info` WHERE `id` = 4 LIMIT 1 [ RunTime:0.083915s ] +--------------------------------------------------------------- +[2019-06-18T14:00:39+08:00] ::1 GET localhost:10086/admin/login +[ sql ] [ DB ] CONNECT:[ UseTime:0.129081s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.080370s ] +[ sql ] [ SQL ] SELECT * FROM `admin_info` WHERE `id` = 4 LIMIT 1 [ RunTime:0.079685s ] +--------------------------------------------------------------- +[2019-06-18T14:00:40+08:00] ::1 GET localhost:10086/admin/login +[ sql ] [ DB ] CONNECT:[ UseTime:0.198407s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.066381s ] +[ sql ] [ SQL ] SELECT * FROM `admin_info` WHERE `id` = 4 LIMIT 1 [ RunTime:0.086930s ] +--------------------------------------------------------------- +[2019-06-18T14:06:06+08:00] ::1 GET localhost:10086/admin/login +[ sql ] [ DB ] CONNECT:[ UseTime:0.444255s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:2.322329s ] +[ sql ] [ SQL ] SELECT * FROM `admin_info` WHERE `id` = 4 LIMIT 1 [ RunTime:0.874633s ] +[ sql ] [ SQL ] UPDATE `admin_info` SET `last_login` = 1560837965 WHERE `id` = 4 [ RunTime:0.502137s ] +--------------------------------------------------------------- +[2019-06-18T14:06:55+08:00] ::1 GET localhost:10086/admin/login +[ sql ] [ DB ] CONNECT:[ UseTime:0.133188s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.070734s ] +[ sql ] [ SQL ] SELECT * FROM `admin_info` WHERE `id` = 4 LIMIT 1 [ RunTime:0.085181s ] +[ sql ] [ SQL ] UPDATE `admin_info` SET `last_login` = 1560838014 WHERE `id` = 4 [ RunTime:0.074748s ] +--------------------------------------------------------------- +[2019-06-18T14:06:56+08:00] ::1 GET localhost:10086/admin/login +[ sql ] [ DB ] CONNECT:[ UseTime:0.109097s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.100254s ] +[ sql ] [ SQL ] SELECT * FROM `admin_info` WHERE `id` = 4 LIMIT 1 [ RunTime:0.100522s ] +[ sql ] [ SQL ] UPDATE `admin_info` SET `last_login` = 1560838016 WHERE `id` = 4 [ RunTime:0.056056s ] +--------------------------------------------------------------- +[2019-06-18T14:06:58+08:00] ::1 GET localhost:10086/admin/login +[ sql ] [ DB ] CONNECT:[ UseTime:0.113885s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.080844s ] +[ sql ] [ SQL ] SELECT * FROM `admin_info` WHERE `id` = 4 LIMIT 1 [ RunTime:0.091781s ] +[ sql ] [ SQL ] UPDATE `admin_info` SET `last_login` = 1560838018 WHERE `id` = 4 [ RunTime:0.087589s ] +--------------------------------------------------------------- +[2019-06-18T15:58:30+08:00] ::1 GET localhost:10086/admin/login +[ error ] [2002]SQLSTATE[HY000] [2002] Network is unreachable[/Users/keley/dev/altitudereaction/api/vendor/topthink/framework/src/think/db/PDOConnection.php:407] +--------------------------------------------------------------- +[2019-06-18T15:59:49+08:00] ::1 GET localhost:10086/admin/login +[ sql ] [ DB ] CONNECT:[ UseTime:0.131684s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.131051s ] +[ sql ] [ SQL ] SELECT * FROM `admin_info` WHERE `id` = 4 LIMIT 1 [ RunTime:0.133464s ] +[ sql ] [ SQL ] UPDATE `admin_info` SET `last_login` = 1560844788 WHERE `id` = 4 [ RunTime:0.179086s ] +--------------------------------------------------------------- +[2019-06-18T16:28:39+08:00] ::1 GET localhost:10086/admin/login +[ error ] [2]Declaration of app\util\ErrorResponse::create($errorCode, $errorMessage = ''): think\Response should be compatible with think\Response::create($data = '', string $type = '', int $code = 200): think\Response[/Users/keley/dev/altitudereaction/api/app/util/ErrorResponse.php:28] +--------------------------------------------------------------- +[2019-06-18T16:29:37+08:00] ::1 GET localhost:10086/admin/login +[ error ] [2]Declaration of app\util\ErrorResponse::Create($errorCode, $errorMessage = ''): think\Response should be compatible with think\Response::create($data = '', string $type = '', int $code = 200): think\Response[/Users/keley/dev/altitudereaction/api/app/util/ErrorResponse.php:28] +--------------------------------------------------------------- +[2019-06-18T16:31:13+08:00] ::1 GET localhost:10086/admin/login?username=123&password=123 +[ sql ] [ DB ] CONNECT:[ UseTime:0.142830s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.082740s ] +[ sql ] [ SQL ] SELECT * FROM `admin_info` WHERE `id` = 123 LIMIT 1 [ RunTime:0.180979s ] +--------------------------------------------------------------- +[2019-06-18T16:31:28+08:00] ::1 GET localhost:10086/admin/login?username=123&password=99d310ce9b1326045cf1446c5840a08c +[ sql ] [ DB ] CONNECT:[ UseTime:0.122548s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.146200s ] +[ sql ] [ SQL ] SELECT * FROM `admin_info` WHERE `id` IN (123,99d310ce9b1326045cf1446c5840a08c) LIMIT 1 [ RunTime:0.213686s ] +--------------------------------------------------------------- +[2019-06-18T16:31:31+08:00] ::1 GET localhost:10086/admin/login?username=admin&password=99d310ce9b1326045cf1446c5840a08c +[ sql ] [ DB ] CONNECT:[ UseTime:0.173646s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.083999s ] +[ sql ] [ SQL ] SELECT * FROM `admin_info` WHERE `id` IN (admin,99d310ce9b1326045cf1446c5840a08c) LIMIT 1 [ RunTime:0.092524s ] +--------------------------------------------------------------- +[2019-06-18T16:42:54+08:00] ::1 GET localhost:10086/admin/login?username=admin&password=99d310ce9b1326045cf1446c5840a08c +[ error ] [2002]SQLSTATE[HY000] [2002] Operation timed out[/Users/keley/dev/altitudereaction/api/vendor/topthink/framework/src/think/db/PDOConnection.php:407] +--------------------------------------------------------------- +[2019-06-18T16:42:58+08:00] ::1 GET localhost:10086/admin/login?username=admin&password=99d310ce9b1326045cf1446c5840a08c +[ sql ] [ DB ] CONNECT:[ UseTime:0.191577s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.096643s ] +[ sql ] [ SQL ] SELECT * FROM `admin_info` WHERE `id` IN (admin,99d310ce9b1326045cf1446c5840a08c) LIMIT 1 [ RunTime:0.081175s ] +--------------------------------------------------------------- +[2019-06-18T16:43:16+08:00] ::1 GET localhost:10086/admin/login?username=admin&password=99d310ce9b1326045cf1446c5840a08c +[ sql ] [ DB ] CONNECT:[ UseTime:0.555144s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.180795s ] +[ sql ] [ SQL ] SELECT * FROM `admin_info` WHERE `id` IN (admin,99d310ce9b1326045cf1446c5840a08c) LIMIT 1 [ RunTime:0.107068s ] diff --git a/runtime/log/201906/18_cli.log b/runtime/log/201906/18_cli.log new file mode 100644 index 0000000..39d5db2 --- /dev/null +++ b/runtime/log/201906/18_cli.log @@ -0,0 +1,4 @@ +[2019-06-18T13:55:41+08:00][ sql ] [ DB ] CONNECT:[ UseTime:0.165426s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[2019-06-18T13:55:41+08:00][ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.073972s ] +[2019-06-18T13:56:29+08:00][ sql ] [ DB ] CONNECT:[ UseTime:0.489670s ] mysql:host=118.113.176.144;port=13306;dbname=altitude_reaction;charset=utf8 +[2019-06-18T13:56:30+08:00][ sql ] [ SQL ] SHOW FULL COLUMNS FROM `admin_info` [ RunTime:0.184201s ] diff --git a/runtime/log/20190619_error.log b/runtime/log/20190619_error.log new file mode 100644 index 0000000..a802bd5 --- /dev/null +++ b/runtime/log/20190619_error.log @@ -0,0 +1,45 @@ +--------------------------------------------------------------- +[2019-06-19T19:18:43+08:00] ::1 POST localhost:10086/evaluation/create?open_id=123 +[ error ] [10501]SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'uid' cannot be null[/Users/keley/dev/altitudereaction/api/vendor/topthink/framework/src/think/db/PDOConnection.php:571] +--------------------------------------------------------------- +[2019-06-19T19:19:01+08:00] ::1 POST localhost:10086/evaluation/create?open_id=123 +[ error ] [10501]SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'uid' cannot be null[/Users/keley/dev/altitudereaction/api/vendor/topthink/framework/src/think/db/PDOConnection.php:571] +--------------------------------------------------------------- +[2019-06-19T19:19:34+08:00] ::1 POST localhost:10086/evaluation/create?open_id=123 +[ error ] [10501]SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'uid' cannot be null[/Users/keley/dev/altitudereaction/api/vendor/topthink/framework/src/think/db/PDOConnection.php:571] +--------------------------------------------------------------- +[2019-06-19T21:45:20+08:00] ::1 GET localhost:10086/evaluation/all +[ error ] [0]Too few arguments to function think\db\BaseQuery::when(), 1 passed in /Users/keley/dev/altitudereaction/api/app/service/EvaluationService.php on line 32 and at least 2 expected[/Users/keley/dev/altitudereaction/api/vendor/topthink/framework/src/think/db/concern/WhereQuery.php:514] +--------------------------------------------------------------- +[2019-06-19T21:47:50+08:00] ::1 GET localhost:10086/evaluation/all +[ error ] [0]Call to undefined method think\model\Collection::getData()[/Users/keley/dev/altitudereaction/api/app/service/EvaluationService.php:33] +--------------------------------------------------------------- +[2019-06-19T21:47:53+08:00] ::1 GET localhost:10086/evaluation/all +[ error ] [0]Call to undefined method think\model\Collection::getData()[/Users/keley/dev/altitudereaction/api/app/service/EvaluationService.php:33] +--------------------------------------------------------------- +[2019-06-19T21:48:34+08:00] ::1 GET localhost:10086/evaluation/all +[ error ] [0]variable type error: array[/Users/keley/dev/altitudereaction/api/vendor/topthink/framework/src/think/Response.php:391] +--------------------------------------------------------------- +[2019-06-19T21:48:39+08:00] ::1 GET localhost:10086/evaluation/all +[ error ] [0]variable type error: array[/Users/keley/dev/altitudereaction/api/vendor/topthink/framework/src/think/Response.php:391] +--------------------------------------------------------------- +[2019-06-19T22:00:04+08:00] ::1 GET localhost:10086/evaluation/all +[ error ] [0]Class 'app\service\Config' not found[/Users/keley/dev/altitudereaction/api/app/service/EvaluationService.php:32] +--------------------------------------------------------------- +[2019-06-19T22:00:08+08:00] ::1 GET localhost:10086/evaluation/all +[ error ] [0]Class 'app\service\Config' not found[/Users/keley/dev/altitudereaction/api/app/service/EvaluationService.php:32] +--------------------------------------------------------------- +[2019-06-19T22:20:15+08:00] ::1 GET localhost:10086/evaluation/all +[ error ] [8]未定义数组索引: create_time[/Users/keley/dev/altitudereaction/api/app/service/EvaluationService.php:48] +--------------------------------------------------------------- +[2019-06-19T22:20:53+08:00] ::1 GET localhost:10086/evaluation/all +[ error ] [8]未定义数组索引: create_time[/Users/keley/dev/altitudereaction/api/app/service/EvaluationService.php:49] +--------------------------------------------------------------- +[2019-06-19T22:21:06+08:00] ::1 GET localhost:10086/evaluation/all +[ error ] [8]未定义数组索引: create_time[/Users/keley/dev/altitudereaction/api/app/service/EvaluationService.php:49] +--------------------------------------------------------------- +[2019-06-19T22:22:30+08:00] ::1 GET localhost:10086/evaluation/all +[ error ] [8]未定义数组索引: create_time[/Users/keley/dev/altitudereaction/api/app/service/EvaluationService.php:49] +--------------------------------------------------------------- +[2019-06-19T22:22:33+08:00] ::1 GET localhost:10086/evaluation/all +[ error ] [8]未定义数组索引: create_time[/Users/keley/dev/altitudereaction/api/app/service/EvaluationService.php:49] diff --git a/runtime/log/20190619_sql.log b/runtime/log/20190619_sql.log new file mode 100644 index 0000000..f64b651 --- /dev/null +++ b/runtime/log/20190619_sql.log @@ -0,0 +1,274 @@ +--------------------------------------------------------------- +[2019-06-19T19:18:43+08:00] ::1 POST localhost:10086/evaluation/create?open_id=123 +[ sql ] [ DB ] CONNECT:[ UseTime:0.072630s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.024094s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.010999s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.011958s ] +--------------------------------------------------------------- +[2019-06-19T19:19:01+08:00] ::1 POST localhost:10086/evaluation/create?open_id=123 +[ sql ] [ DB ] CONNECT:[ UseTime:0.013655s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.012983s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.031214s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.014587s ] +--------------------------------------------------------------- +[2019-06-19T19:19:34+08:00] ::1 POST localhost:10086/evaluation/create?open_id=123 +[ sql ] [ DB ] CONNECT:[ UseTime:0.045469s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.059849s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.019695s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.018596s ] +--------------------------------------------------------------- +[2019-06-19T19:20:31+08:00] ::1 POST localhost:10086/evaluation/create?open_id=123 +[ sql ] [ DB ] CONNECT:[ UseTime:0.016528s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.019317s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.043149s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.059356s ] +[ sql ] [ SQL ] INSERT INTO `evaluation_history` SET `uid` = 1 , `headache` = 1 , `gastrointestinal` = 1 , `tired` = 2 , `dizzy` = 0 [ RunTime:0.013059s ] +--------------------------------------------------------------- +[2019-06-19T19:37:52+08:00] ::1 POST localhost:10086/evaluation/create?open_id=123 +[ sql ] [ DB ] CONNECT:[ UseTime:0.029571s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.021740s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.018945s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.015099s ] +[ sql ] [ SQL ] INSERT INTO `evaluation_history` SET `uid` = 1 , `headache` = 2 , `gastrointestinal` = 2 , `tired` = 3 , `dizzy` = 1 [ RunTime:0.019218s ] +--------------------------------------------------------------- +[2019-06-19T19:53:04+08:00] ::1 POST localhost:10086/evaluation/subject?open_id=123 +[ sql ] [ DB ] CONNECT:[ UseTime:0.075579s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.030715s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.026150s ] +--------------------------------------------------------------- +[2019-06-19T19:53:54+08:00] ::1 POST localhost:10086/evaluation/subjects?open_id=123 +[ sql ] [ DB ] CONNECT:[ UseTime:0.119953s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.014633s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.012796s ] +--------------------------------------------------------------- +[2019-06-19T21:28:32+08:00] ::1 GET localhost:10086/evaluation/create?open_id=123 +[ sql ] [ DB ] CONNECT:[ UseTime:0.036869s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.034939s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.043053s ] +--------------------------------------------------------------- +[2019-06-19T21:28:36+08:00] ::1 GET localhost:10086/evaluation/query +[ sql ] [ DB ] CONNECT:[ UseTime:0.018833s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.017105s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.009106s ] +--------------------------------------------------------------- +[2019-06-19T21:28:59+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.015130s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.015920s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.012891s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.016801s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 [ RunTime:0.011444s ] +--------------------------------------------------------------- +[2019-06-19T21:45:20+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.064861s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.018636s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.019166s ] +--------------------------------------------------------------- +[2019-06-19T21:45:40+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.101759s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.019040s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.019088s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.086840s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.017835s ] +--------------------------------------------------------------- +[2019-06-19T21:46:14+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.018824s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.018760s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.012488s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.013627s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.010498s ] +--------------------------------------------------------------- +[2019-06-19T21:46:30+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.015989s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.012478s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.019381s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.017662s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.018869s ] +--------------------------------------------------------------- +[2019-06-19T21:47:07+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.124592s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.027237s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.101073s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.020917s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 12 AND `status` = 1 [ RunTime:0.013836s ] +--------------------------------------------------------------- +[2019-06-19T21:47:10+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.020126s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.019201s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.029178s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.069939s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 12 AND `status` = 1 [ RunTime:0.013928s ] +--------------------------------------------------------------- +[2019-06-19T21:47:25+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.027166s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.015205s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.010043s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.016089s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.015747s ] +--------------------------------------------------------------- +[2019-06-19T21:47:27+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.023452s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.019672s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.023957s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.023804s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.093308s ] +--------------------------------------------------------------- +[2019-06-19T21:47:50+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.063488s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.076543s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.018069s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.022133s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.020904s ] +--------------------------------------------------------------- +[2019-06-19T21:47:53+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.024639s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.019629s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.020580s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.019869s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.011351s ] +--------------------------------------------------------------- +[2019-06-19T21:48:08+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.019568s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.013925s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.014127s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.015038s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.011410s ] +--------------------------------------------------------------- +[2019-06-19T21:48:34+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.025869s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.021203s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.012263s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.023847s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.012513s ] +--------------------------------------------------------------- +[2019-06-19T21:48:39+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.064609s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.015136s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.011976s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.017592s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.009396s ] +--------------------------------------------------------------- +[2019-06-19T21:49:08+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.054252s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.060107s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.016747s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.036390s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.017989s ] +--------------------------------------------------------------- +[2019-06-19T21:50:04+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.065763s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.015076s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.012303s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.013731s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.012579s ] +--------------------------------------------------------------- +[2019-06-19T21:50:29+08:00] ::1 POST localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.076704s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.016338s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.016505s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.017653s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.015375s ] +--------------------------------------------------------------- +[2019-06-19T22:00:04+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.018964s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.015482s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.023400s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.013782s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.034645s ] +--------------------------------------------------------------- +[2019-06-19T22:00:08+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.044088s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.013052s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.070142s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.029915s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.013846s ] +--------------------------------------------------------------- +[2019-06-19T22:00:23+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.036852s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.083675s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.019821s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.024382s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.014681s ] +--------------------------------------------------------------- +[2019-06-19T22:00:26+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.044411s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.013313s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.013338s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.024562s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.018749s ] +--------------------------------------------------------------- +[2019-06-19T22:00:39+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.046213s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.015595s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.015795s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.015869s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.012787s ] +--------------------------------------------------------------- +[2019-06-19T22:20:15+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.070701s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.017640s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.012036s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.020060s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.011855s ] +--------------------------------------------------------------- +[2019-06-19T22:20:53+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.046068s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.055676s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.014567s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.019149s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.011455s ] +--------------------------------------------------------------- +[2019-06-19T22:21:06+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.040943s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.015285s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.019945s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.047367s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.030720s ] +--------------------------------------------------------------- +[2019-06-19T22:22:30+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.018107s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.017969s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.083855s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.021845s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.044362s ] +--------------------------------------------------------------- +[2019-06-19T22:22:33+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.041565s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.051796s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.009813s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.016085s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.010206s ] +--------------------------------------------------------------- +[2019-06-19T22:24:34+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.018798s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.012571s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.014715s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.019544s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.020720s ] +--------------------------------------------------------------- +[2019-06-19T22:25:08+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.017382s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.011653s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.008427s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.044865s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.017443s ] +--------------------------------------------------------------- +[2019-06-19T22:25:41+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.015503s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.020569s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.015713s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.021426s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.043545s ] +--------------------------------------------------------------- +[2019-06-19T22:26:07+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.097222s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.030871s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.027991s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.031749s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.022143s ] +--------------------------------------------------------------- +[2019-06-19T22:26:58+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.083497s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.020500s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.017747s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.041400s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.016676s ] diff --git a/runtime/log/20190620_sql.log b/runtime/log/20190620_sql.log new file mode 100644 index 0000000..492dcd9 --- /dev/null +++ b/runtime/log/20190620_sql.log @@ -0,0 +1,21 @@ +--------------------------------------------------------------- +[2019-06-20T07:39:15+08:00] ::1 POST localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.087194s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.016463s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.009020s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.032931s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.065017s ] +--------------------------------------------------------------- +[2019-06-20T07:39:48+08:00] ::1 POST localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.043085s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.021843s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.015011s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.122188s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.015018s ] +--------------------------------------------------------------- +[2019-06-20T07:39:54+08:00] ::1 GET localhost:10086/evaluation/all +[ sql ] [ DB ] CONNECT:[ UseTime:0.060226s ] mysql:host=192.168.10.123;port=13306;dbname=altitude_reaction;charset=utf8 +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `user_info` [ RunTime:0.072480s ] +[ sql ] [ SQL ] SELECT * FROM `user_info` WHERE `open_id` = 'wxaffadsf31Dfaf93' LIMIT 1 [ RunTime:0.013577s ] +[ sql ] [ SQL ] SHOW FULL COLUMNS FROM `evaluation_history` [ RunTime:0.017088s ] +[ sql ] [ SQL ] SELECT * FROM `evaluation_history` WHERE `uid` = 1 AND `status` = 1 [ RunTime:0.008955s ] diff --git a/runtime/schema/altitude_reaction.admin_info.php b/runtime/schema/altitude_reaction.admin_info.php new file mode 100644 index 0000000..c8acaa8 --- /dev/null +++ b/runtime/schema/altitude_reaction.admin_info.php @@ -0,0 +1,183 @@ + + array ( + 'name' => 'id', + 'type' => 'smallint(10) unsigned', + 'notnull' => false, + 'default' => NULL, + 'primary' => true, + 'autoinc' => true, + 'comment' => '', + ), + 'user_name' => + array ( + 'name' => 'user_name', + 'type' => 'varchar(60)', + 'notnull' => false, + 'default' => '', + 'primary' => false, + 'autoinc' => false, + 'comment' => '', + ), + 'email' => + array ( + 'name' => 'email', + 'type' => 'varchar(60)', + 'notnull' => false, + 'default' => '', + 'primary' => false, + 'autoinc' => false, + 'comment' => '', + ), + 'password' => + array ( + 'name' => 'password', + 'type' => 'varchar(32)', + 'notnull' => false, + 'default' => '', + 'primary' => false, + 'autoinc' => false, + 'comment' => '', + ), + 'avatar' => + array ( + 'name' => 'avatar', + 'type' => 'varchar(255)', + 'notnull' => false, + 'default' => NULL, + 'primary' => false, + 'autoinc' => false, + 'comment' => '', + ), + 'sex' => + array ( + 'name' => 'sex', + 'type' => 'tinyint(2)', + 'notnull' => false, + 'default' => '0', + 'primary' => false, + 'autoinc' => false, + 'comment' => '', + ), + 'salt' => + array ( + 'name' => 'salt', + 'type' => 'varchar(10)', + 'notnull' => false, + 'default' => NULL, + 'primary' => false, + 'autoinc' => false, + 'comment' => '', + ), + 'add_time' => + array ( + 'name' => 'add_time', + 'type' => 'int(11)', + 'notnull' => false, + 'default' => '0', + 'primary' => false, + 'autoinc' => false, + 'comment' => '', + ), + 'last_login' => + array ( + 'name' => 'last_login', + 'type' => 'int(11)', + 'notnull' => false, + 'default' => '0', + 'primary' => false, + 'autoinc' => false, + 'comment' => '', + ), + 'last_ip' => + array ( + 'name' => 'last_ip', + 'type' => 'varchar(15)', + 'notnull' => false, + 'default' => '', + 'primary' => false, + 'autoinc' => false, + 'comment' => '', + ), + 'action_list' => + array ( + 'name' => 'action_list', + 'type' => 'text', + 'notnull' => false, + 'default' => NULL, + 'primary' => false, + 'autoinc' => false, + 'comment' => '', + ), + 'nav_list' => + array ( + 'name' => 'nav_list', + 'type' => 'text', + 'notnull' => false, + 'default' => NULL, + 'primary' => false, + 'autoinc' => false, + 'comment' => '', + ), + 'company_id' => + array ( + 'name' => 'company_id', + 'type' => 'varchar(128)', + 'notnull' => false, + 'default' => '', + 'primary' => false, + 'autoinc' => false, + 'comment' => '公司idjson字符串', + ), + 'role_id' => + array ( + 'name' => 'role_id', + 'type' => 'smallint(5)', + 'notnull' => false, + 'default' => '0', + 'primary' => false, + 'autoinc' => false, + 'comment' => '', + ), + 'cate_id' => + array ( + 'name' => 'cate_id', + 'type' => 'varchar(128)', + 'notnull' => false, + 'default' => '', + 'primary' => false, + 'autoinc' => false, + 'comment' => 'json 行业数据', + ), + 'region_id' => + array ( + 'name' => 'region_id', + 'type' => 'int(11)', + 'notnull' => false, + 'default' => '0', + 'primary' => false, + 'autoinc' => false, + 'comment' => '', + ), + 'update_time' => + array ( + 'name' => 'update_time', + 'type' => 'int(11)', + 'notnull' => false, + 'default' => '0', + 'primary' => false, + 'autoinc' => false, + 'comment' => '修改时间', + ), + 'is_delete' => + array ( + 'name' => 'is_delete', + 'type' => 'tinyint(4)', + 'notnull' => false, + 'default' => '0', + 'primary' => false, + 'autoinc' => false, + 'comment' => '是否删除', + ), +); \ No newline at end of file diff --git a/runtime/services.php b/runtime/services.php new file mode 100644 index 0000000..f79f752 --- /dev/null +++ b/runtime/services.php @@ -0,0 +1,5 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +// 加载基础文件 +require __DIR__ . '/vendor/autoload.php'; + +// 应用初始化 +(new App())->console->run(); \ No newline at end of file