| | |
| | | package cc.mrbird.febs.mall.controller; |
| | | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.mall.dto.LoginDto; |
| | | import cc.mrbird.febs.mall.dto.RegisterDto; |
| | | import cc.mrbird.febs.common.utils.RedisUtils; |
| | | import cc.mrbird.febs.mall.dto.*; |
| | | import cc.mrbird.febs.mall.service.IApiMallMemberService; |
| | | import cc.mrbird.febs.pay.model.WxGenerateQrCodeDto; |
| | | import cc.mrbird.febs.pay.service.IXcxPayService; |
| | | import cc.mrbird.febs.pay.util.WechatConfigure; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.util.Dictionary; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author wzy |
| | | * @date 2021-09-16 |
| | | **/ |
| | | @Slf4j |
| | | @Validated |
| | | @CrossOrigin("*") |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping(value = "/api/login") |
| | |
| | | public class ApiLoginController { |
| | | |
| | | private final IApiMallMemberService memberService; |
| | | private final IXcxPayService iXcxPayService; |
| | | private final RedisUtils redisUtils; |
| | | |
| | | @ApiOperation(value = "app注册接口", notes = "app注册接口") |
| | | @PostMapping(value = "/register") |
| | |
| | | return memberService.register(registerDto); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "账号密码登录接口", notes = "账号密码登录接口") |
| | | @PostMapping(value = "/toLogin") |
| | | public FebsResponse login(@RequestBody LoginDto loginDto) { |
| | | return memberService.toLogin(loginDto); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "忘记/修改密码", notes = "忘记/修改密码") |
| | | @PostMapping(value = "/forgetPwd") |
| | | public FebsResponse forgetPwd(@RequestBody ForgetPwdDto forgetPwdDto) { |
| | | return memberService.forgetPwd(forgetPwdDto); |
| | | } |
| | | |
| | | @ApiOperation(value = "提交注册申诉", notes = "提交注册申诉") |
| | | @PostMapping(value = "addRegisterAppeal") |
| | | public FebsResponse addRegisterAppeal(@RequestBody RegisterAppealDto registerAppeal) { |
| | | memberService.addRegisterAppeal(registerAppeal); |
| | | return new FebsResponse().success().message("申请成功"); |
| | | } |
| | | |
| | | /** |
| | | * 小程序登录 |
| | | */ |
| | | @ApiOperation(value = "小程序登录", notes = "小程序登录") |
| | | @PostMapping(value = "/xcxLogin") |
| | | public FebsResponse xcxLogin(@RequestBody ApiXcxLoginDto apiXcxLoginDto) throws IOException { |
| | | return memberService.xcxLogin(apiXcxLoginDto); |
| | | } |
| | | |
| | | /** |
| | | * 小程序手机号登录 |
| | | */ |
| | | @ApiOperation(value = "小程序手机号登录", notes = "小程序手机号登录") |
| | | @PostMapping(value = "/xcxPhoneLogin") |
| | | public FebsResponse xcxPhoneLogin(@RequestBody ApiXcxPhoneLoginDto apiXcxPhoneLoginDto){ |
| | | return memberService.xcxPhoneLogin(apiXcxPhoneLoginDto); |
| | | } |
| | | |
| | | /** |
| | | * 小程序接收用户数据,更新用户信息 |
| | | */ |
| | | @ApiOperation(value = "小程序接收用户数据", notes = "小程序接收用户数据") |
| | | @PostMapping(value = "/xcxSaveInfo") |
| | | public FebsResponse xcxSaveInfo(@RequestBody ApiXcxSaveInfoDto apiXcxSaveInfoDto){ |
| | | return memberService.xcxSaveInfo(apiXcxSaveInfoDto); |
| | | } |
| | | |
| | | /** |
| | | * 小程序是否允许打开 |
| | | * 先获取系统设置的范围访问开关 |
| | | * 1:开启,获取范围大小,如果范围内没有团长,不允许打开 |
| | | * 2:关闭,允许打开 |
| | | */ |
| | | @ApiOperation(value = "小程序是否允许打开(1:允许 2:不允许)", notes = "小程序是否允许打开") |
| | | @PostMapping(value = "/xcxOpen") |
| | | public FebsResponse xcxOpen(@RequestBody ApiXcxOpenDto apiXcxOpenDto){ |
| | | return memberService.xcxOpen(apiXcxOpenDto); |
| | | } |
| | | |
| | | /** |
| | | * 获取分享二维码 |
| | | */ |
| | | @ApiOperation(value = "获取分享二维码", notes = "获取分享二维码") |
| | | @PostMapping(value = "/generateQrCode") |
| | | public FebsResponse generateQrCode(@RequestBody WxGenerateQrCodeDto wxGenerateQrCodeDto){ |
| | | return iXcxPayService.generateQrCode(wxGenerateQrCodeDto); |
| | | } |
| | | |
| | | /** |
| | | * 获取ACCESS_TOKEN |
| | | */ |
| | | @ApiOperation(value = "获取ACCESS_TOKEN", notes = "获取ACCESS_TOKEN") |
| | | @GetMapping(value = "/getAccessToken") |
| | | public FebsResponse getAccessToken(){ |
| | | return new FebsResponse().success().data(redisUtils.get(WechatConfigure.WX_ACCESS_TOKEN_REDIS_KEY).toString()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取分享二维码(不上传服务器) |
| | | */ |
| | | @ApiOperation(value = "获取分享二维码(不上传服务器)", notes = "获取分享二维码(不上传服务器)") |
| | | @PostMapping(value = "/getQrCode") |
| | | public FebsResponse getQrCode(@RequestBody WxGenerateQrCodeDto wxGenerateQrCodeDto) { |
| | | return iXcxPayService.getQrCode(wxGenerateQrCodeDto); |
| | | } |
| | | |
| | | } |