| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace app\error\controller;
- use think\Controller;
- use think\Request;
- /**
- * 错误模块 - 解决「模块不存在:error」
- * 当请求被错误路由到 error 模块时,返回 JSON 提示正确访问方式
- */
- class Index extends Controller
- {
- public function index()
- {
- return $this->jsonError();
- }
- public function _500()
- {
- return $this->jsonError();
- }
- private function jsonError()
- {
- $base = rtrim(request()->domain() . request()->root(), '/');
- return json([
- 'code' => 404,
- 'msg' => '接口地址错误,请使用下列任一地址',
- 'data' => [
- 'urls' => [
- $base . '/img2img',
- $base . '/api/img2img',
- $base . '/api/Index/img_to_img'
- ],
- 'method' => 'POST',
- 'params' => ['product_img', 'template_img', 'prompt']
- ]
- ]);
- }
- }
|