Browse Source

feature1.0.0:img服务打通swagger

master
chengkun 4 years ago
parent
commit
11f486b220
  1. 8
      bnyer-auth/src/main/resources/bootstrap.yml
  2. 10
      bnyer-gateway/src/main/resources/bootstrap.yml
  3. 8
      bnyer-services/bnyer-file/src/main/resources/bootstrap.yml
  4. 30
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/config/TiktokConfig.java
  5. 12
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/controller/BannerController.java
  6. 10
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/controller/FeedBackController.java
  7. 12
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/controller/TiktokImgController.java
  8. 40
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/controller/TiktokMiniController.java
  9. 10
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/controller/TiktokUserController.java
  10. 12
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/controller/TypeController.java
  11. 2
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/dto/BannerDto.java
  12. 2
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/dto/BannerPageDto.java
  13. 2
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/dto/TiktokBindPhoneDto.java
  14. 6
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/dto/TiktokImgPageDto.java
  15. 2
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/dto/TiktokUserPageDto.java
  16. 108
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/handler/TokenCheckHandler.java
  17. 8
      bnyer-services/bnyer-img/src/main/resources/bootstrap.yml
  18. 8
      bnyer-services/bnyer-system/src/main/resources/bootstrap.yml

8
bnyer-auth/src/main/resources/bootstrap.yml

@ -17,18 +17,18 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:6231
server-addr: http://117.50.61.7:8848
# 命名空间地址
namespace: 52a72b07-7081-445b-b500-76976957abbc
namespace: c4f53d8c-0a91-4249-a804-f16f543ec3b0
# 命名空间
group: dev
config:
# 配置中心地址
server-addr: 127.0.0.1:6231
server-addr: http://117.50.61.7:8848
# 配置文件格式
file-extension: yml
# 命名空间地址
namespace: 52a72b07-7081-445b-b500-76976957abbc
namespace: c4f53d8c-0a91-4249-a804-f16f543ec3b0
# 命名空间
group: dev
# 共享配置

10
bnyer-gateway/src/main/resources/bootstrap.yml

@ -17,18 +17,18 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:6231
server-addr: http://117.50.61.7:8848
# 命名空间地址
namespace: 52a72b07-7081-445b-b500-76976957abbc
namespace: c4f53d8c-0a91-4249-a804-f16f543ec3b0
# 命名空间分组
group: dev
config:
# 配置中心地址
server-addr: 127.0.0.1:6231
server-addr: http://117.50.61.7:8848
# 配置文件格式
file-extension: yml
# 命名空间地址
namespace: 52a72b07-7081-445b-b500-76976957abbc
namespace: c4f53d8c-0a91-4249-a804-f16f543ec3b0
# 命名空间分组
group: dev
# 共享配置
@ -44,7 +44,7 @@ spring:
datasource:
ds1:
nacos:
server-addr: 127.0.0.1:6231
server-addr: http://117.50.61.7:8848
dataId: sentinel-bnyer-gateway
groupId: DEFAULT_GROUP
data-type: json

8
bnyer-services/bnyer-file/src/main/resources/bootstrap.yml

@ -17,18 +17,18 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:6231
server-addr: http://117.50.61.7:8848
# 命名空间地址
namespace: 52a72b07-7081-445b-b500-76976957abbc
namespace: c4f53d8c-0a91-4249-a804-f16f543ec3b0
# 命名空间
group: dev
config:
# 配置中心地址
server-addr: 127.0.0.1:6231
server-addr: http://117.50.61.7:8848
# 配置文件格式
file-extension: yml
# 命名空间地址
namespace: 52a72b07-7081-445b-b500-76976957abbc
namespace: c4f53d8c-0a91-4249-a804-f16f543ec3b0
# 命名空间
group: dev
# 共享配置

30
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/config/TiktokConfig.java

@ -1,9 +1,10 @@
package com.bnyer.img.config;
import com.bnyer.img.handler.TokenCheckHandler;
//import com.bnyer.img.handler.TokenCheckHandler;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@ -17,6 +18,7 @@ import javax.annotation.Resource;
@Configuration
@ConfigurationProperties(prefix = "bnyer.img.tiktok")
@Getter
@RefreshScope
public class TiktokConfig implements WebMvcConfigurer {
@Value("${bnyer.img.tiktok.appId}")
@ -31,19 +33,19 @@ public class TiktokConfig implements WebMvcConfigurer {
@Value("${bnyer.img.tiktok.tokenUrl}")
public String tokenUrl;
@Resource
private TokenCheckHandler tokenCheckHandler;
// @Resource
// private TokenCheckHandler tokenCheckHandler;
/** 不需要拦截地址 */
public static final String[] excludeUrls = { "/mini/tiktok/login", "/mini/tiktok/insertFeedback"};
@Override
public void addInterceptors(InterceptorRegistry registry) {
// 注册Token拦截器
registry.addInterceptor(tokenCheckHandler)
.addPathPatterns("/**")
.excludePathPatterns(excludeUrls)
.order(-10);
}
// public static final String[] excludeUrls = { "/mini/tiktok/loginTiktok", "/mini/tiktok/insertFeedback"};
//
// @Override
// public void addInterceptors(InterceptorRegistry registry) {
// // 注册Token拦截器
// registry.addInterceptor(tokenCheckHandler)
// .addPathPatterns("/**")
// .excludePathPatterns(excludeUrls)
// .order(-10);
//
// }
}

12
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/controller/BannerController.java

@ -21,7 +21,7 @@ import java.util.List;
@Api("img-banner-【后端】接口")
@RestController
@RequestMapping("/banner")
@RequestMapping("/img/banner")
@Slf4j
public class BannerController extends BaseController {
@ -31,7 +31,7 @@ public class BannerController extends BaseController {
//@RequiresPermissions("system:config:list")
@ApiOperation(value="查询banner分页")
@PostMapping("/page")
public TableDataInfo list(BannerPageDto dto){
public TableDataInfo pageBanner(@RequestBody @ApiParam("分页对象") BannerPageDto dto){
startPage();
List<Banner> banners = bannerService.queryPage(dto);
return getDataTable(banners);
@ -40,7 +40,7 @@ public class BannerController extends BaseController {
//@RequiresPermissions("system:config:list")
@ApiOperation(value="新增banner")
@PostMapping(value = "/insert")
public AjaxResult insert(@Validated @RequestBody @ApiParam("banner对象")BannerDto dto){
public AjaxResult insertBanner(@Validated @RequestBody @ApiParam("banner对象")BannerDto dto){
log.debug("新增banner参数为:{}", JSON.toJSONString(dto));
return AjaxResult.success(bannerService.insert(dto.extractParam()));
}
@ -48,7 +48,7 @@ public class BannerController extends BaseController {
//@RequiresPermissions("system:config:list")
@ApiOperation(value="修改banner")
@PostMapping(value = "/update")
public AjaxResult update(@Validated @RequestBody @ApiParam("banner对象")BannerDto dto){
public AjaxResult updateBanner(@Validated @RequestBody @ApiParam("banner对象")BannerDto dto){
log.debug("修改banner参数为:{}", JSON.toJSONString(dto));
return AjaxResult.success(bannerService.update(dto.extractParam()));
}
@ -56,7 +56,7 @@ public class BannerController extends BaseController {
//@RequiresPermissions("system:config:list")
@ApiOperation(value="删除banner")
@DeleteMapping(value = "/delete/{ids}")
public AjaxResult delete(@PathVariable @ApiParam("主键ids") List<Long> ids){
public AjaxResult deleteBanner(@PathVariable @ApiParam("主键ids") List<Long> ids){
log.debug("删除banner参数为:{}", JSON.toJSONString(ids));
return AjaxResult.success(bannerService.delete(ids));
}
@ -64,7 +64,7 @@ public class BannerController extends BaseController {
//@RequiresPermissions("system:config:list")
@ApiOperation(value="查询banner详情")
@GetMapping(value = "/details/{id}")
public AjaxResult details(@PathVariable @ApiParam("主键id") Long id){
public AjaxResult detailsBanner(@PathVariable @ApiParam("主键id") Long id){
log.debug("查询banner详情参数为:{}", id);
return AjaxResult.success(bannerService.queryDetails(id));
}

10
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/controller/FeedBackController.java

@ -22,7 +22,7 @@ import java.util.List;
@Api("img-feedback-【后端】反馈接口")
@RestController
@RequestMapping("/feedback")
@RequestMapping("/img/feedback")
@Slf4j
public class FeedBackController extends BaseController {
@ -32,7 +32,7 @@ public class FeedBackController extends BaseController {
//@RequiresPermissions("system:config:list")
@ApiOperation(value="查询feedback分页")
@PostMapping("/page")
public TableDataInfo list(){
public TableDataInfo listFeedBack(){
startPage();
List<Feedback> feedback = feedBackService.queryPage("0");
return getDataTable(feedback);
@ -41,7 +41,7 @@ public class FeedBackController extends BaseController {
//@RequiresPermissions("system:config:list")
@ApiOperation(value="修改feedback")
@PostMapping(value = "/update")
public AjaxResult update(@Validated @RequestBody @ApiParam("feedback对象") FeedBackDto dto){
public AjaxResult updateFeedBack(@Validated @RequestBody @ApiParam("feedback对象") FeedBackDto dto){
log.debug("修改feedback参数为:{}", JSON.toJSONString(dto));
return AjaxResult.success(feedBackService.update(dto.extractParam()));
}
@ -49,7 +49,7 @@ public class FeedBackController extends BaseController {
//@RequiresPermissions("system:config:list")
@ApiOperation(value="删除feedback")
@DeleteMapping(value = "/delete/{ids}")
public AjaxResult delete(@PathVariable @ApiParam("主键ids") List<Long> ids){
public AjaxResult deleteFeedBack(@PathVariable @ApiParam("主键ids") List<Long> ids){
log.debug("删除feedback参数为:{}", JSON.toJSONString(ids));
return AjaxResult.success(feedBackService.delete(ids));
}
@ -57,7 +57,7 @@ public class FeedBackController extends BaseController {
//@RequiresPermissions("system:config:list")
@ApiOperation(value="查询feedback详情")
@GetMapping(value = "/details/{id}")
public AjaxResult details(@PathVariable @ApiParam("主键ids") Long id){
public AjaxResult detailsFeedBack(@PathVariable @ApiParam("主键ids") Long id){
log.debug("查询feedback详情参数为:{}", id);
return AjaxResult.success(feedBackService.queryDetails(id));
}

12
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/controller/TiktokImgController.java

@ -20,7 +20,7 @@ import java.util.List;
@Api("img-tiktokImg-【后端】抖音图片接口")
@RestController
@RequestMapping("/tiktokImg")
@RequestMapping("/img/tiktokImg")
@Slf4j
public class TiktokImgController extends BaseController {
@ -30,7 +30,7 @@ public class TiktokImgController extends BaseController {
//@RequiresPermissions("system:config:list")
@ApiOperation(value="查询TiktokImg分页")
@PostMapping("/page")
public TableDataInfo list(TiktokImgPageDto dto){
public TableDataInfo pageTiktokImg(@RequestBody @ApiParam("分页对象") TiktokImgPageDto dto){
startPage();
List<TiktokImg> tiktokImg = tiktokImgService.queryPage(dto);
return getDataTable(tiktokImg);
@ -39,7 +39,7 @@ public class TiktokImgController extends BaseController {
//@RequiresPermissions("system:config:list")
@ApiOperation(value="新增TiktokImg")
@PostMapping(value = "/insert")
public AjaxResult insert(@Validated @RequestBody @ApiParam("TiktokImg对象") TiktokImgDto dto){
public AjaxResult addTiktokImg(@Validated @RequestBody @ApiParam("TiktokImg对象") TiktokImgDto dto){
log.debug("后台管理系统新增TiktokImg参数为:{}", JSON.toJSONString(dto));
return AjaxResult.success(tiktokImgService.insert(dto.extractParam()));
}
@ -47,7 +47,7 @@ public class TiktokImgController extends BaseController {
//@RequiresPermissions("system:config:list")
@ApiOperation(value="修改TiktokImg")
@PostMapping(value = "/update")
public AjaxResult update(@Validated @RequestBody @ApiParam("TiktokImg对象") TiktokImgDto dto){
public AjaxResult editTiktokImg(@Validated @RequestBody @ApiParam("TiktokImg对象") TiktokImgDto dto){
log.debug("后台管理系统修改TiktokImg参数为:{}", JSON.toJSONString(dto));
return AjaxResult.success(tiktokImgService.update(dto.extractParam()));
}
@ -55,7 +55,7 @@ public class TiktokImgController extends BaseController {
//@RequiresPermissions("system:config:list")
@ApiOperation(value="删除TiktokImg")
@DeleteMapping(value = "/delete/{ids}")
public AjaxResult delete(@PathVariable @ApiParam("主键ids") List<Long> ids){
public AjaxResult delTiktokImg(@PathVariable @ApiParam("主键ids") List<Long> ids){
log.debug("后台管理系统删除TiktokImg参数为:{}", ids);
return AjaxResult.success(tiktokImgService.delete(ids));
}
@ -63,7 +63,7 @@ public class TiktokImgController extends BaseController {
//@RequiresPermissions("system:config:list")
@ApiOperation(value="查询TiktokImg详情")
@GetMapping(value = "/details/{id}")
public AjaxResult details(@PathVariable @ApiParam("主键id") Long id){
public AjaxResult detailTiktokImg(@PathVariable @ApiParam("主键id") Long id){
log.debug("查询TiktokImg详情参数为:{}", id);
return AjaxResult.success(tiktokImgService.queryDetails(id));
}

40
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/controller/TiktokMiniController.java

@ -21,7 +21,7 @@ import java.util.List;
@Api("img-抖音平台-【小程序】接口")
@RestController
@RequestMapping("/mini/tiktok")
@RequestMapping("/img/mini/tiktok")
@Slf4j
public class TiktokMiniController extends BaseController {
@ -46,7 +46,7 @@ public class TiktokMiniController extends BaseController {
@Autowired
private TiktokLikeService tiktokLikeService;
@TokenCheck
//@TokenCheck
@ApiOperation(value="查询banner列表")
@GetMapping(value = "/listBanner")
public AjaxResult listBanner(){
@ -62,14 +62,14 @@ public class TiktokMiniController extends BaseController {
return AjaxResult.success(feedBackService.insert(feedback));
}
@TokenCheck
//@TokenCheck
@ApiOperation(value="查询type列表")
@GetMapping(value = "/listType")
public AjaxResult listType(){
return AjaxResult.success(typeService.queryList());
}
@TokenCheck
//@TokenCheck
@ApiOperation(value="新增TiktokImg")
@PostMapping(value = "/insertTiktokImg")
public AjaxResult insertTiktokImg(@Validated @RequestBody @ApiParam("TiktokImg对象") TiktokImgMiniDto dto){
@ -79,7 +79,7 @@ public class TiktokMiniController extends BaseController {
return AjaxResult.success(tiktokImgService.insert(tiktokImg));
}
@TokenCheck
//@TokenCheck
@ApiOperation(value="修改TiktokImg")
@PostMapping(value = "/updateTiktokImg")
public AjaxResult updateTiktokImg(@Validated @RequestBody @ApiParam("TiktokImg对象") TiktokImgMiniDto dto){
@ -89,7 +89,7 @@ public class TiktokMiniController extends BaseController {
return AjaxResult.success(tiktokImgService.update(dto.extractParam()));
}
@TokenCheck
//@TokenCheck
@ApiOperation(value="删除TiktokImg")
@DeleteMapping(value = "/deleteTiktokImg/{ids}")
public AjaxResult deleteTiktokImg(@PathVariable @ApiParam("主键ids") List<Long> ids){
@ -97,35 +97,35 @@ public class TiktokMiniController extends BaseController {
return AjaxResult.success(tiktokImgService.delete(ids));
}
@TokenCheck
//@TokenCheck
@ApiOperation(value="查询指定用户对内的图片集合")
@PostMapping(value = "/listTiktokImgIn")
public AjaxResult listTiktokImgIn(@Validated @RequestBody @ApiParam("TiktokImg对象") TiktokImgListMiniDto dto){
return AjaxResult.success(tiktokImgService.queryInList(dto.getUserId(),dto.getTypeId()));
}
@TokenCheck
//@TokenCheck
@ApiOperation(value="查询指定用户对外的图片集合")
@PostMapping(value = "/listTiktokImgOut")
public AjaxResult listTiktokImgOut(@Validated @RequestBody @ApiParam("TiktokImg对象") TiktokImgListMiniDto dto){
return AjaxResult.success(tiktokImgService.queryOutList(dto.getUserId(),dto.getTypeId()));
}
@TokenCheck
//@TokenCheck
@ApiOperation(value="查询小程序审核通过图片详情")
@GetMapping(value = "/detailsTiktokImg/{id}")
public AjaxResult detailsTiktokImg(@ApiParam("图片id") @PathVariable Long id){
return AjaxResult.success(tiktokImgService.queryImgDetails(String.valueOf(id)));
}
@TokenCheck
//@TokenCheck
@ApiOperation(value="查询小程序用户图片列表")
@GetMapping(value = "/tiktokUserImgs")
public AjaxResult tiktokUserImgs(){
return AjaxResult.success(tiktokUserService.queryUserImgList());
}
@TokenCheck
//@TokenCheck
@ApiOperation(value="收藏")
@PostMapping(value = "/tiktokCollect")
public AjaxResult tiktokCollect(@Validated @RequestBody @ApiParam("收藏对象") CollectionDto dto){
@ -134,7 +134,7 @@ public class TiktokMiniController extends BaseController {
return AjaxResult.success();
}
@TokenCheck
//@TokenCheck
@ApiOperation(value="取消收藏")
@PostMapping(value = "/tiktokUnCollect")
public AjaxResult tiktokUnCollect(@Validated @RequestBody @ApiParam("收藏对象") CollectionDto dto){
@ -143,7 +143,7 @@ public class TiktokMiniController extends BaseController {
return AjaxResult.success();
}
@TokenCheck
//@TokenCheck
@ApiOperation(value="查询是否收藏过")
@PostMapping(value = "/judgeTiktokCollect")
public AjaxResult judgeTiktokCollect(@Validated @RequestBody @ApiParam("收藏对象") CollectionDto dto){
@ -151,7 +151,7 @@ public class TiktokMiniController extends BaseController {
return AjaxResult.success(tiktokCollectionService.judgeCollect(dto.getUserId(),dto.getImgId()));
}
@TokenCheck
//@TokenCheck
@ApiOperation(value="查看用户收藏列表")
@PostMapping(value = "/listTiktokCollection")
public AjaxResult listTiktokCollection(@Validated @RequestBody @ApiParam("用户收藏对象") CollectionUserDto dto){
@ -159,7 +159,7 @@ public class TiktokMiniController extends BaseController {
return AjaxResult.success(tiktokCollectionService.getCollectionByUserId(dto.getUserId()));
}
@TokenCheck
//@TokenCheck
@ApiOperation(value="点赞")
@PostMapping(value = "/tiktokLike")
public AjaxResult tiktokLike(@Validated @RequestBody @ApiParam("点赞对象") CollectionDto dto){
@ -168,7 +168,7 @@ public class TiktokMiniController extends BaseController {
return AjaxResult.success();
}
@TokenCheck
//@TokenCheck
@ApiOperation(value="取消点赞")
@PostMapping(value = "/tiktokUnLike")
public AjaxResult tiktokUnLike(@Validated @RequestBody @ApiParam("点赞对象") CollectionDto dto){
@ -177,7 +177,7 @@ public class TiktokMiniController extends BaseController {
return AjaxResult.success();
}
@TokenCheck
//@TokenCheck
@ApiOperation(value="查询是否点赞过")
@PostMapping(value = "/judgeTiktokLike")
public AjaxResult judgeTiktokLike(@Validated @RequestBody @ApiParam("点赞对象") CollectionDto dto){
@ -187,13 +187,13 @@ public class TiktokMiniController extends BaseController {
@ApiOperation(value="用户登录")
@PostMapping(value = "/login")
public AjaxResult login(@Validated @RequestBody @ApiParam("登录对象") TiktokLoginDto dto){
@PostMapping(value = "/loginTiktok")
public AjaxResult loginTiktok(@Validated @RequestBody @ApiParam("登录对象") TiktokLoginDto dto){
log.debug("用户登录参数为:{}", JSON.toJSONString(dto));
return AjaxResult.success(tiktokUserService.login(dto));
}
@TokenCheck
//@TokenCheck
@ApiOperation(value="绑定手机号")
@PostMapping(value = "/bindPhone")
public AjaxResult bindPhone(@Validated @RequestBody @ApiParam("绑定对象") TiktokBindPhoneDto dto){

10
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/controller/TiktokUserController.java

@ -22,7 +22,7 @@ import java.util.List;
@Api("img-tiktokUser-【后端】抖音平台用户接口")
@RestController
@RequestMapping("/tiktokUser")
@RequestMapping("/img/tiktokUser")
@Slf4j
public class TiktokUserController extends BaseController {
@ -32,7 +32,7 @@ public class TiktokUserController extends BaseController {
//@RequiresPermissions("system:config:list")
@ApiOperation(value="查询user分页")
@PostMapping("/page")
public TableDataInfo list(TiktokUserPageDto dto){
public TableDataInfo pageTiktokUser(@RequestBody @ApiParam("分页对象") TiktokUserPageDto dto){
startPage();
List<TiktokUser> tiktokUsers = tiktokUserService.queryPage(dto);
for (TiktokUser tiktokUser : tiktokUsers) {
@ -45,7 +45,7 @@ public class TiktokUserController extends BaseController {
//@RequiresPermissions("system:config:list")
@ApiOperation(value="成为艺术家")
@PostMapping(value = "/insert")
public AjaxResult insert(@Validated @RequestBody @ApiParam("user对象") TiktokCreaterDto dto){
public AjaxResult insertTiktokUser(@Validated @RequestBody @ApiParam("user对象") TiktokCreaterDto dto){
log.debug("成为艺术家参数为:{}", JSON.toJSONString(dto));
return AjaxResult.success(tiktokUserService.insertCreator(dto));
}
@ -61,7 +61,7 @@ public class TiktokUserController extends BaseController {
//@RequiresPermissions("system:config:list")
@ApiOperation(value="删除user")
@DeleteMapping(value = "/delete/{ids}")
public AjaxResult delete(@PathVariable @ApiParam("主键ids") List<Long> ids){
public AjaxResult deleteTiktokUser(@PathVariable @ApiParam("主键ids") List<Long> ids){
log.debug("删除user参数为:{}", ids);
return AjaxResult.success(tiktokUserService.delete(ids));
}
@ -69,7 +69,7 @@ public class TiktokUserController extends BaseController {
//@RequiresPermissions("system:config:list")
@ApiOperation(value="查询user详情")
@GetMapping(value = "/details/{id}")
public AjaxResult details(@PathVariable @ApiParam("主键id") Long id){
public AjaxResult detailsTiktokUser(@PathVariable @ApiParam("主键id") Long id){
TiktokUser tiktokUser = tiktokUserService.queryDetails(id);
tiktokUser.setPhone(Sm4Util.sm4Decrypt(tiktokUser.getPhone()));
tiktokUser.setTiktokCode(Sm4Util.sm4Decrypt(tiktokUser.getTiktokCode()));

12
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/controller/TypeController.java

@ -20,7 +20,7 @@ import java.util.List;
@Api("img-type-【后端】图片类型接口")
@RestController
@RequestMapping("/type")
@RequestMapping("/img/type")
@Slf4j
public class TypeController extends BaseController {
@ -30,7 +30,7 @@ public class TypeController extends BaseController {
//@RequiresPermissions("system:config:list")
@ApiOperation(value="查询type分页")
@PostMapping("/page")
public TableDataInfo list(TypePageDto dto){
public TableDataInfo pageType(@RequestBody @ApiParam("分页对象") TypePageDto dto){
startPage();
List<Type> types = typeService.queryPage(dto.getTypeName());
return getDataTable(types);
@ -39,7 +39,7 @@ public class TypeController extends BaseController {
//@RequiresPermissions("system:config:list")
@ApiOperation(value="新增type")
@PostMapping(value = "/insert")
public AjaxResult insert(@Validated @RequestBody @ApiParam("type对象") TypeDto dto){
public AjaxResult insertType(@Validated @RequestBody @ApiParam("type对象") TypeDto dto){
log.debug("新增type参数为:{}", JSON.toJSONString(dto));
return AjaxResult.success(typeService.insert(dto.extractParam()));
}
@ -47,7 +47,7 @@ public class TypeController extends BaseController {
//@RequiresPermissions("system:config:list")
@ApiOperation(value="修改type")
@PostMapping(value = "/update")
public AjaxResult update(@Validated @RequestBody @ApiParam("type对象") TypeDto dto){
public AjaxResult updateType(@Validated @RequestBody @ApiParam("type对象") TypeDto dto){
log.debug("修改type参数为:{}", JSON.toJSONString(dto));
return AjaxResult.success(typeService.update(dto.extractParam()));
}
@ -55,7 +55,7 @@ public class TypeController extends BaseController {
//@RequiresPermissions("system:config:list")
@ApiOperation(value="删除type")
@DeleteMapping(value = "/delete/{ids}")
public AjaxResult delete(@PathVariable @ApiParam("主键ids") List<Long> ids){
public AjaxResult deleteType(@PathVariable @ApiParam("主键ids") List<Long> ids){
log.debug("删除type参数为:{}", ids);
return AjaxResult.success(typeService.delete(ids));
}
@ -63,7 +63,7 @@ public class TypeController extends BaseController {
//@RequiresPermissions("system:config:list")
@ApiOperation(value="查询type详情")
@GetMapping(value = "/details/{id}")
public AjaxResult details(@PathVariable @ApiParam("主键id") Long id){
public AjaxResult detailsType(@PathVariable @ApiParam("主键id") Long id){
log.debug("查询type详情参数为:{}", id);
return AjaxResult.success(typeService.queryDetails(id));
}

2
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/dto/BannerDto.java

@ -13,7 +13,7 @@ import java.io.Serializable;
@Getter
@Setter
@ApiModel("banner响应类")
@ApiModel("banner接收类")
public class BannerDto implements Serializable {
@ApiModelProperty(value="id")

2
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/dto/BannerPageDto.java

@ -10,7 +10,7 @@ import java.io.Serializable;
@Getter
@Setter
@ApiModel("banner响应类")
@ApiModel("banner分页接收类")
public class BannerPageDto implements Serializable {
@ApiModelProperty(value="banner名称")

2
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/dto/TiktokBindPhoneDto.java

@ -10,7 +10,7 @@ import java.io.Serializable;
@Getter
@Setter
@ApiModel("抖音登录入参")
@ApiModel("抖音绑定手机入参")
public class TiktokBindPhoneDto implements Serializable {
@NotNull(message = "用户Id不能为空!")

6
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/dto/TiktokImgPageDto.java

@ -1,16 +1,16 @@
package com.bnyer.img.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
@Getter
@Setter
@ApiModel("抖音图片接收类")
@ApiModel("抖音图片分页接收类")
public class TiktokImgPageDto implements Serializable {
@ApiModelProperty(value="用户id")

2
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/dto/TiktokUserPageDto.java

@ -10,7 +10,7 @@ import java.io.Serializable;
@Getter
@Setter
@ApiModel("抖音用户响应类")
@ApiModel("抖音用户分页接收类")
public class TiktokUserPageDto implements Serializable {
@ApiModelProperty(value="用户昵称")

108
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/handler/TokenCheckHandler.java

@ -1,54 +1,54 @@
package com.bnyer.img.handler;
import com.bnyer.common.core.annotation.TokenCheck;
import com.bnyer.common.core.exception.ServiceException;
import com.bnyer.common.redis.service.RedisService;
import com.bnyer.img.constants.RedisKeyConstant;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @author chengkun
* @date 2022/4/22 15:04
*/
@Component
public class TokenCheckHandler implements HandlerInterceptor {
String tokenKey = RedisKeyConstant.TIKTOK_USER_LOGIN_KEY;
@Autowired
private RedisService redisService;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
// 判断访问的方法上是否有注解
HandlerMethod handlerMethod = (HandlerMethod) handler;
boolean tokenCheck = handlerMethod.hasMethodAnnotation(TokenCheck.class);
// 尝试从请求头从获取token值
String token = request.getHeader("token");
if(StringUtils.isEmpty(token)){
if(tokenCheck){
throw new ServiceException("token为空,无权访问!");
}
}
String[] split = token.split("#");
//从token中获取openId
String openId = split[1];
//组装redisKey
String redisKey = tokenKey+openId;
//判断redis中是否存在该key,存在则放行,不存在则过期
if(redisService.hasKey(redisKey)){
return true;
}else{
throw new ServiceException("token失效,请重新授权!");
}
}
}
//package com.bnyer.img.handler;
//
//import com.bnyer.common.core.annotation.TokenCheck;
//import com.bnyer.common.core.exception.ServiceException;
//import com.bnyer.common.redis.service.RedisService;
//import com.bnyer.img.constants.RedisKeyConstant;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//import org.springframework.web.method.HandlerMethod;
//import org.springframework.web.servlet.HandlerInterceptor;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
///**
// * @author chengkun
// * @date 2022/4/22 15:04
// */
//@Component
//public class TokenCheckHandler implements HandlerInterceptor {
//
// String tokenKey = RedisKeyConstant.TIKTOK_USER_LOGIN_KEY;
//
// @Autowired
// private RedisService redisService;
//
// @Override
// public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//
// // 判断访问的方法上是否有注解
// HandlerMethod handlerMethod = (HandlerMethod) handler;
// boolean tokenCheck = handlerMethod.hasMethodAnnotation(TokenCheck.class);
//
// // 尝试从请求头从获取token值
// String token = request.getHeader("token");
// if(StringUtils.isEmpty(token)){
// if(tokenCheck){
// throw new ServiceException("token为空,无权访问!");
// }
// }
// String[] split = token.split("#");
// //从token中获取openId
// String openId = split[1];
// //组装redisKey
// String redisKey = tokenKey+openId;
// //判断redis中是否存在该key,存在则放行,不存在则过期
// if(redisService.hasKey(redisKey)){
// return true;
// }else{
// throw new ServiceException("token失效,请重新授权!");
// }
// }
//}

8
bnyer-services/bnyer-img/src/main/resources/bootstrap.yml

@ -17,18 +17,18 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:6231
server-addr: http://117.50.61.7:8848
# 命名空间地址
namespace: 52a72b07-7081-445b-b500-76976957abbc
namespace: c4f53d8c-0a91-4249-a804-f16f543ec3b0
# 命名空间
group: dev
config:
# 配置中心地址
server-addr: 127.0.0.1:6231
server-addr: http://117.50.61.7:8848
# 配置文件格式
file-extension: yml
# 命名空间地址
namespace: 52a72b07-7081-445b-b500-76976957abbc
namespace: c4f53d8c-0a91-4249-a804-f16f543ec3b0
# 命名空间
group: dev
# 共享配置

8
bnyer-services/bnyer-system/src/main/resources/bootstrap.yml

@ -17,18 +17,18 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:6231
server-addr: http://117.50.61.7:8848
# 命名空间地址
namespace: 52a72b07-7081-445b-b500-76976957abbc
namespace: c4f53d8c-0a91-4249-a804-f16f543ec3b0
# 命名空间
group: dev
config:
# 配置中心地址
server-addr: 127.0.0.1:6231
server-addr: http://117.50.61.7:8848
# 配置文件格式
file-extension: yml
# 命名空间地址
namespace: 52a72b07-7081-445b-b500-76976957abbc
namespace: c4f53d8c-0a91-4249-a804-f16f543ec3b0
# 命名空间
group: dev
# 共享配置

Loading…
Cancel
Save