Quellcode durchsuchen

Merge branch 'dev' into 'mp-server-test'

推广员邀请注册链接

See merge request quanshu/mp-server!983
jiang hao vor 2 Jahren
Ursprung
Commit
981e5b6be8

+ 16 - 8
mp-admin/src/main/java/com/qs/mp/web/controller/api/channel/ChannelInviteController.java

@@ -16,6 +16,7 @@ import com.qs.mp.framework.web.service.SysLoginService;
 import com.qs.mp.utils.SecurityUtils;
 import com.qs.mp.web.controller.common.BaseApiController;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import java.util.Map;
 import ma.glasnost.orika.MapperFacade;
 import org.apache.commons.lang3.StringUtils;
@@ -53,6 +54,20 @@ public class ChannelInviteController extends BaseApiController {
 	@Autowired
 	private SysLoginService sysLoginService;
 
+	@PostMapping("promoter/generate")
+	@ApiOperation("生成推广员邀请注册链接")
+	public AjaxResult generatePromoterRegistry(@RequestBody  JSONObject jsonObject) {
+		Long channelId = SecurityUtils.getLoginUser().getChannelId();
+		Channel channel = channelService.getById(channelId);
+		if (channel == null) {
+			return AjaxResult.error("门店信息不正确");
+		}
+		String type = jsonObject.getString("type");
+		String commRate = jsonObject.getString("commRate");
+		String rst = wxUrlLinkService.generateCode("pages/login/invitation", "id=" + channelId + "&type=" + type + "&commRage=" + commRate, channelAppId);
+		return AjaxResult.success("", rst);
+	}
+
 	/**
 	 * 生成邀请码
 	 *
@@ -65,15 +80,8 @@ public class ChannelInviteController extends BaseApiController {
 		if (StringUtils.isNotBlank(channel.getInvitePic())){
 			return new AjaxResult(Type.SUCCESS, "", channel.getInvitePic());
 		}
-
 		String type = jsonObject.getString("type");
-		String commRate = jsonObject.getString("commRate");
-		String rst = "";
-		if (StringUtils.isNotBlank(commRate)) {
-			rst = wxUrlLinkService.generateCode("pages/login/invitation", "id=" + channelId + "&type=" + type + "&commRate=" + commRate, channelAppId);
-		} else {
-			rst = wxUrlLinkService.generateCode("pages/login/invitation", "id=" + channelId + "&type=" + type, channelAppId);
-		}
+		String rst = wxUrlLinkService.generateCode("pages/login/invitation", "id=" + channelId + "&type=" + type, channelAppId);
 		channel.setInvitePic(rst);
 		channelService.updateById(channel);
 		return new AjaxResult(Type.SUCCESS, "", rst);