diff --git a/austin-common/src/main/java/com/java3y/austin/common/enums/IdType.java b/austin-common/src/main/java/com/java3y/austin/common/enums/IdType.java index d3b1961..3b9aea5 100644 --- a/austin-common/src/main/java/com/java3y/austin/common/enums/IdType.java +++ b/austin-common/src/main/java/com/java3y/austin/common/enums/IdType.java @@ -21,6 +21,7 @@ public enum IdType { EMAIL(50, "email"), ENTERPRISE_USER_ID(60, "enterprise_user_id"), DING_DING_USER_ID(70, "ding_ding_user_id"), + CID(80, "cid"), ; private Integer code; diff --git a/austin-web/src/main/java/com/java3y/austin/web/controller/RefreshTokenController.java b/austin-web/src/main/java/com/java3y/austin/web/controller/RefreshTokenController.java new file mode 100644 index 0000000..e0f89a5 --- /dev/null +++ b/austin-web/src/main/java/com/java3y/austin/web/controller/RefreshTokenController.java @@ -0,0 +1,46 @@ +package com.java3y.austin.web.controller; + + +import com.java3y.austin.common.enums.ChannelType; +import com.java3y.austin.common.vo.BasicResultVO; +import com.java3y.austin.cron.handler.RefreshDingDingAccessTokenHandler; +import com.java3y.austin.cron.handler.RefreshGeTuiAccessTokenHandler; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + + +/** + * @Author 3y + */ +@Api(tags = {"手动刷新token的接口"}) +@RestController +public class RefreshTokenController { + + + @Autowired + private RefreshDingDingAccessTokenHandler refreshDingDingAccessTokenHandler; + @Autowired + private RefreshGeTuiAccessTokenHandler refreshGeTuiAccessTokenHandler; + + /** + * 按照不同的渠道刷新对应的Token,channelType取值来源com.java3y.austin.common.enums.ChannelType + * @param channelType + * @return + */ + @ApiOperation(value = "手动刷新token", notes = "钉钉/个推 token刷新") + @GetMapping("/refresh") + public BasicResultVO refresh(Integer channelType) { + if (ChannelType.PUSH.getCode().equals(channelType)) { + refreshGeTuiAccessTokenHandler.execute(); + } + if (ChannelType.DING_DING_WORK_NOTICE.getCode().equals(channelType)) { + refreshDingDingAccessTokenHandler.execute(); + + } + return BasicResultVO.success("刷新成功"); + } + +}