| | |
| | | package cn.iocoder.yudao.module.member.controller.app.social; |
| | | |
| | | import cn.hutool.core.codec.Base64; |
| | | import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.member.controller.app.social.vo.*; |
| | | import cn.iocoder.yudao.module.system.api.social.SocialClientApi; |
| | | import cn.iocoder.yudao.module.system.api.social.SocialUserApi; |
| | | import cn.iocoder.yudao.module.system.api.social.dto.*; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| | |
| | | |
| | | @Resource |
| | | private SocialUserApi socialUserApi; |
| | | @Resource |
| | | private SocialClientApi socialClientApi; |
| | | |
| | | @PostMapping("/bind") |
| | | @Operation(summary = "社交绑定,使用 code 授权码") |
| | |
| | | public CommonResult<AppSocialUserRespVO> getSocialUser(@RequestParam("type") Integer type) { |
| | | SocialUserRespDTO socialUser = socialUserApi.getSocialUserByUserId(UserTypeEnum.MEMBER.getValue(), getLoginUserId(), type); |
| | | return success(BeanUtils.toBean(socialUser, AppSocialUserRespVO.class)); |
| | | } |
| | | |
| | | @PostMapping("/wxa-qrcode") |
| | | @Operation(summary = "获得微信小程序码(base64 image)") |
| | | @PermitAll |
| | | public CommonResult<String> getWxaQrcode(@RequestBody @Valid AppSocialWxaQrcodeReqVO reqVO) { |
| | | byte[] wxQrcode = socialClientApi.getWxaQrcode(BeanUtils.toBean(reqVO, SocialWxQrcodeReqDTO.class)); |
| | | return success(Base64.encode(wxQrcode)); |
| | | } |
| | | |
| | | @GetMapping("/get-subscribe-template-list") |
| | | @Operation(summary = "获得微信小程订阅模板列表") |
| | | @PermitAll |
| | | public CommonResult<List<AppSocialWxaSubscribeTemplateRespVO>> getSubscribeTemplateList() { |
| | | List<SocialWxaSubscribeTemplateRespDTO> template = socialClientApi.getWxaSubscribeTemplateList(UserTypeEnum.MEMBER.getValue()); |
| | | return success(BeanUtils.toBean(template, AppSocialWxaSubscribeTemplateRespVO.class)); |
| | | } |
| | | |
| | | } |