|  |  |  | 
|---|
|  |  |  | package cc.mrbird.febs.mall.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import cc.mrbird.febs.common.entity.FebsResponse; | 
|---|
|  |  |  | 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 net.sf.json.JSONObject; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.validation.annotation.Validated; | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | 
|---|
|  |  |  | public class ApiLoginController { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private final IApiMallMemberService memberService; | 
|---|
|  |  |  | private final IXcxPayService iXcxPayService; | 
|---|
|  |  |  | private final RedisUtils redisUtils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "app注册接口", notes = "app注册接口") | 
|---|
|  |  |  | @PostMapping(value = "/register") | 
|---|
|  |  |  | 
|---|
|  |  |  | *      1:开启,获取范围大小,如果范围内没有团长,不允许打开 | 
|---|
|  |  |  | *      2:关闭,允许打开 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiOperation(value = "小程序是否允许打开", notes = "小程序是否允许打开") | 
|---|
|  |  |  | @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); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|