👽 由于外部API的改变而更新代码
This commit is contained in:
1 parent
0d443a2f1a
commit
5a24512655
5 files changed
+62
-15
No files matched your search
+4
-4
@@ -40,19 +40,19 @@ v 1.4.0 提供了代码图形化生成功能。
|
||||
|
||||
1. 代码生成模块
|
||||
|
||||

|
||||

|
||||
|
||||
2. 选择要生成的表
|
||||
|
||||
> 以下为空则从**pigx-codegen/generator.properties** 获取
|
||||
|
||||

|
||||

|
||||
|
||||
3. 解压下载的**pigx_code_gen.zip**
|
||||
|
||||
> 生成代码结构,安装前后端 maven 、vue-cli 目录生成,可以覆盖到指定业务模块
|
||||
|
||||

|
||||

|
||||
|
||||
4. **重点讲解生成的SQL使用**
|
||||
|
||||
@@ -72,7 +72,7 @@ v 1.4.0 提供了代码图形化生成功能。
|
||||
├── 14
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
5. **配置路由**
|
||||
前端 index.js
|
||||
|
||||
+5
-5
@@ -12,7 +12,7 @@
|
||||
|
||||
1. 修改为80
|
||||
|
||||

|
||||

|
||||
|
||||
2. 使用mac 的同学,nginx 代理一下
|
||||
|
||||
@@ -30,11 +30,11 @@ http://daoweicloud.com
|
||||
|
||||
1. 首先使用账号密码登录系统绑定微信
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
|
||||

|
||||

|
||||
|
||||
2. 绑定后使用退出,使用社交等 选择微信登录即可。
|
||||
|
||||
@@ -46,8 +46,8 @@ http://daoweicloud.com
|
||||
|
||||
1. 选择社交登录 提示回调地址错误。 请使用 http://daoweicloud.com 访问
|
||||
|
||||

|
||||

|
||||
|
||||
1. 选择微信登录提示: 未绑定账户,请使用密码登录后绑定,需要先登录后绑定微信,才可以使用微信
|
||||
|
||||

|
||||

|
||||
+50
-3
@@ -114,7 +114,7 @@ swagger:
|
||||
|
||||
- 通过界面的形式
|
||||
|
||||

|
||||

|
||||
|
||||
- 直接操作**sys_oauth_client_details**表
|
||||
|
||||
@@ -159,9 +159,56 @@ ignore:
|
||||
- test
|
||||
```
|
||||
|
||||
#### 访问swagger-ui页面
|
||||
|
||||
从```1.6.3```版本开始,要求通过```hosts```进行访问,在pigx的默认配置下,可以访问```http://pigx-gateway:9999/swagger-ui.html```打开swagger页面。
|
||||
|
||||
#### 填写客户端信息
|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
### Swagger FAQ
|
||||
|
||||
- 为何要进行认证的操作?
|
||||
|
||||
认证后Spring Security的上下文对象中才会有值,很多操作如获取当前用户信息都依赖于Spring Security上下文。
|
||||
|
||||
- 刷新页面后认证失效?
|
||||
|
||||
官方UI比较蠢萌,虽然提供了Oauth2.0的认证功能,但是没有存储的措施,所以刷新页面后相关参数就会丢失。解决办法暴力一点的措施是修改官方UI添加存储措施,但是这个我肯定不会了。目前比较可行的就是修改代码进行swagger全局参数配置。
|
||||
|
||||
- 切换swagger分组文档页面报错
|
||||
|
||||

|
||||
|
||||
出现这个问题要么是你对应的服务没有启动,要么是你访问的服务还没有启动完毕,如果还没启动完毕的话,不妨等个十几二十秒再进行访问,最新的master-mp3分支支持在```pigx-gateway-dev.yml```中配置ignore.swagger-providers属性来屏蔽掉不希望生成swaager文档的微服务。
|
||||
|
||||
- 认证过程中出现```Auth ErrorError: Upgrade Required```?
|
||||
|
||||
这个不用怀疑,原因一般不外乎三个。
|
||||
|
||||
一、用户名或密码错误
|
||||
|
||||
可以打开谷歌开发者工具,观察request详情和response详情以及返回的状态码,如果是426的话,就证明获取用户信息的时候失败了,可以判断是作为缓存中间件的redis并没有启动,那么只要启动redis,另一个原因是redis中有脏数据,这个时候清空redis即可。清空的具体步骤如下:
|
||||
|
||||
windows平台下可以打开redis-cli.exe,然后执行```flushdb```或者```flushall```命令即可。
|
||||
|
||||
二、使用了需要验证码的客户端
|
||||
|
||||
除了上面的原因,还有可能返回428的状态码,而会出现这个问题就是使用了需要验证码的客户端。
|
||||
|
||||
三、跨域
|
||||
|
||||
排除所有不可能,剩下的那个不管多不可思议,都是事实真相。除开这两个原因,还有可能会出问题的,只有一种情况,那就是出现了跨域问题。
|
||||
|
||||
如果本地启动出现了问题,可以观察请求头里是否存在跨域,如果是OPTIONS请求基本就是跨域了。然后从以下两个解决方案中选择一个适合的:
|
||||
|
||||
- 方案一
|
||||
|
||||
处理配置中心的```application-dev.yml```中的Spring Security Oauth相关的地址配置```security.auth.server```,修改掉认证中心的地址。
|
||||
|
||||
- 方案二
|
||||
|
||||
解决方案就是启动前端工程利用VUE的路由处理掉跨域,或者配置nginx添加反向代理。
|
||||
+1
-1
@@ -83,7 +83,7 @@ public class ValidateCodeGatewayFilter extends AbstractGatewayFilterFactory {
|
||||
return response.writeWith(Mono.just(response.bufferFactory()
|
||||
.wrap(objectMapper.writeValueAsBytes(
|
||||
R.builder().msg(e.getMessage())
|
||||
.code(CommonConstant.FAIL).build()))));
|
||||
.code(CommonConstants.FAIL).build()))));
|
||||
} catch (JsonProcessingException e1) {
|
||||
log.error("对象输出异常", e1);
|
||||
}
|
||||
|
||||
+2
-2
@@ -17,7 +17,7 @@
|
||||
|
||||
package com.pig4cloud.pigx.gateway.handler;
|
||||
|
||||
import com.pig4cloud.pigx.common.core.constant.CommonConstant;
|
||||
import com.pig4cloud.pigx.common.core.constant.CommonConstants;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -51,7 +51,7 @@ public class HystrixFallbackHandler implements HandlerFunction<ServerResponse> {
|
||||
.contentType(MediaType.APPLICATION_JSON_UTF8)
|
||||
.body(BodyInserters.fromObject(R.builder()
|
||||
.msg("服务异常")
|
||||
.code(CommonConstant.FAIL)
|
||||
.code(CommonConstants.FAIL)
|
||||
.build()));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user