|
@@ -1,5 +1,6 @@
|
|
|
package com.gree.mall.contest.controller.pc.common;
|
|
|
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import com.gree.mall.contest.annotation.ApiNotAuth;
|
|
|
import com.gree.mall.contest.constant.Constant;
|
|
|
import com.gree.mall.contest.exception.RemoteServiceException;
|
|
@@ -9,6 +10,7 @@ import com.gree.mall.contest.logic.common.CommonLogic;
|
|
|
import com.gree.mall.contest.logic.common.WechatLogic;
|
|
|
import com.gree.mall.contest.plus.entity.AdminCompanyWechat;
|
|
|
import com.gree.mall.contest.plus.entity.CommonFile;
|
|
|
+import com.gree.mall.contest.plus.entity.Region;
|
|
|
import com.gree.mall.contest.plus.service.AdminCompanyWechatService;
|
|
|
import com.gree.mall.contest.utils.CommonUtils;
|
|
|
import com.gree.mall.contest.utils.RedisUtil;
|
|
@@ -27,13 +29,14 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.constraints.NotBlank;
|
|
|
import java.io.IOException;
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
@RestController
|
|
|
-@Tag(name = "公共API", description = "公共API" )
|
|
|
+@Tag(name = "公共API", description = "公共API")
|
|
|
@RequestMapping(value = "/pc/common", produces = "application/json; charset=utf-8")
|
|
|
@RequiredArgsConstructor
|
|
|
public class CommonController {
|
|
@@ -78,7 +81,7 @@ public class CommonController {
|
|
|
|
|
|
@PostMapping("/companywechat/get")
|
|
|
@Operation(summary = "获取商户配置二维码头像等详情")
|
|
|
- public ResponseHelper<AdminCompanyWechat> getCompanyWechat(){
|
|
|
+ public ResponseHelper<AdminCompanyWechat> getCompanyWechat() {
|
|
|
AdminCompanyWechat one = adminCompanyWechatService.lambdaQuery()
|
|
|
.eq(AdminCompanyWechat::getCompanyWechatId, "1").one();
|
|
|
return ResponseHelper.success(one);
|
|
@@ -94,10 +97,10 @@ public class CommonController {
|
|
|
@Operation(summary = "获取获取前往小程序链接")
|
|
|
@GetMapping("/getUrlScheme")
|
|
|
public ResponseHelper<String> getUrlScheme(
|
|
|
- @Parameter(description = "通过 scheme 码进入小程序时的 query",required = false) @RequestParam(required = false) String query,
|
|
|
+ @Parameter(description = "通过 scheme 码进入小程序时的 query", required = false) @RequestParam(required = false) String query,
|
|
|
@Parameter(required = false) @RequestParam(required = false) String companyWechatId
|
|
|
) throws IOException, WxErrorException {
|
|
|
- return ResponseHelper.success(wechatLogic.getUrlScheme(query,companyWechatId));
|
|
|
+ return ResponseHelper.success(wechatLogic.getUrlScheme(query, companyWechatId));
|
|
|
}
|
|
|
|
|
|
@ApiNotAuth
|
|
@@ -134,30 +137,39 @@ public class CommonController {
|
|
|
|
|
|
@GetMapping("/getVerifi")
|
|
|
@Operation(summary = "获取拖拽式验证码")
|
|
|
- public ResponseHelper<Map<String, Object>> getVerifi(){
|
|
|
+ public ResponseHelper<Map<String, Object>> getVerifi() {
|
|
|
Map<String, Object> map = VerifiUtils.getVerifi();
|
|
|
Integer xWidth = (Integer) map.get("xWidth");
|
|
|
String key = UUID.randomUUID().toString();
|
|
|
- redisUtil.set(Constant.RedisPrefix.VERIFICATION + ":" + key,xWidth,2*60);
|
|
|
+ redisUtil.set(Constant.RedisPrefix.VERIFICATION + ":" + key, xWidth, 2 * 60);
|
|
|
map.remove("xWidth");
|
|
|
- map.put("key",key);
|
|
|
+ map.put("key", key);
|
|
|
return ResponseHelper.success(map);
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
@ApiNotAuth
|
|
|
@PostMapping("/sms/send")
|
|
|
@Operation(summary = "发送验证码(绑定手机号专用)")
|
|
|
public ResponseHelper sendSms(
|
|
|
- @Parameter(description = "手机号码",required = true) @RequestParam String phone,
|
|
|
- @Parameter(description = "滑动验证key",required = false) @RequestParam(required = false) String key,
|
|
|
- @Parameter(description = "滑动验证数值",required = false) @RequestParam(required = false) String vrifyCode,
|
|
|
+ @Parameter(description = "手机号码", required = true) @RequestParam String phone,
|
|
|
+ @Parameter(description = "滑动验证key", required = false) @RequestParam(required = false) String key,
|
|
|
+ @Parameter(description = "滑动验证数值", required = false) @RequestParam(required = false) String vrifyCode,
|
|
|
@Parameter(description = "发送类型 BIND=绑定手机号 RESET=找回密码", required = false) @RequestParam(required = false, defaultValue = "BIND") String sendType
|
|
|
) throws Exception {
|
|
|
|
|
|
- smsLogic.sendSms(phone,key,vrifyCode, sendType);
|
|
|
+ smsLogic.sendSms(phone, key, vrifyCode, sendType);
|
|
|
return ResponseHelper.success();
|
|
|
}
|
|
|
|
|
|
+ @ApiNotAuth
|
|
|
+ @GetMapping("/region/list")
|
|
|
+ @Operation(summary = "地区列表")
|
|
|
+ public ResponseHelper<List<Region>> regionList(
|
|
|
+ @Parameter(description = "父id(第一级传0)", required = true) @RequestParam String pid
|
|
|
+ ) throws RemoteServiceException {
|
|
|
+ List<Region> list = commonLogic.queryRegionList(Lists.newArrayList(pid));
|
|
|
+ return ResponseHelper.success(list);
|
|
|
+ }
|
|
|
+
|
|
|
}
|