|
@@ -1,5 +1,6 @@
|
|
|
package com.qs.mp.web.controller.api.channel;
|
|
|
|
|
|
+import cn.jsms.api.ValidSMSResult;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.qs.mp.channel.domain.Channel;
|
|
|
import com.qs.mp.channel.domain.param.PromoterCreateParam;
|
|
@@ -7,6 +8,7 @@ import com.qs.mp.channel.domain.param.PromoterQueryParam;
|
|
|
import com.qs.mp.channel.service.IChannelService;
|
|
|
import com.qs.mp.common.core.domain.AjaxResult;
|
|
|
import com.qs.mp.common.core.page.TableDataInfo;
|
|
|
+import com.qs.mp.common.jsms.JSMSUtils;
|
|
|
import com.qs.mp.utils.SecurityUtils;
|
|
|
import com.qs.mp.web.controller.common.BaseApiController;
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -79,9 +81,39 @@ public class PromoterController extends BaseApiController {
|
|
|
// 创建推广员
|
|
|
channelService.createPromoter(param);
|
|
|
|
|
|
- return AjaxResult.success(param);
|
|
|
+ return AjaxResult.success();
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @PostMapping("/register")
|
|
|
+ @ApiOperation("邀请链接注册推广员接口")
|
|
|
+ @ApiResponses(
|
|
|
+ @ApiResponse(code = 200, message = "成功")
|
|
|
+ )
|
|
|
+ public AjaxResult promoterRegister(@Validated @RequestBody PromoterCreateParam param) {
|
|
|
+ Long channelId = param.getChannelId();
|
|
|
+ Channel channel = channelService.getById(channelId);
|
|
|
+ if (channel == null) {
|
|
|
+ return AjaxResult.error("门店信息不正确");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 校验短信
|
|
|
+ ValidSMSResult res = JSMSUtils.sendValidSMSCode(param.getMessageId(), param.getCode());
|
|
|
+ if (res == null || !res.getIsValid()) {
|
|
|
+ return AjaxResult.error("短信验证码错误");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 校验推广员信息合法性
|
|
|
+ String checkRes = channelService.checkPromoter(param);
|
|
|
+ if (StringUtils.isNotBlank(checkRes)) {
|
|
|
+ return AjaxResult.error(checkRes);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 创建推广员
|
|
|
+ channelService.createPromoter(param);
|
|
|
+
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|