|
@@ -4,6 +4,7 @@ import com.jpsoft.picc.modules.base.entity.CompanyUser;
|
|
import com.jpsoft.picc.modules.common.config.WeixinConfig;
|
|
import com.jpsoft.picc.modules.common.config.WeixinConfig;
|
|
import com.jpsoft.picc.modules.common.constant.WeixinEvent;
|
|
import com.jpsoft.picc.modules.common.constant.WeixinEvent;
|
|
import com.jpsoft.picc.modules.common.dto.MessageResult;
|
|
import com.jpsoft.picc.modules.common.dto.MessageResult;
|
|
|
|
+import com.jpsoft.picc.modules.common.dto.MsgResult;
|
|
import com.jpsoft.picc.modules.common.utils.DES3;
|
|
import com.jpsoft.picc.modules.common.utils.DES3;
|
|
import com.jpsoft.picc.modules.common.utils.WeixinUtil;
|
|
import com.jpsoft.picc.modules.common.utils.WeixinUtil;
|
|
import com.jpsoft.picc.modules.sys.entity.User;
|
|
import com.jpsoft.picc.modules.sys.entity.User;
|
|
@@ -217,34 +218,33 @@ public class JwtsUserController {
|
|
|
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
@ApiOperation(value = "推广码生成")
|
|
@ApiOperation(value = "推广码生成")
|
|
- @GetMapping(value="/pub/qrcode/login/create")
|
|
|
|
|
|
+ @PostMapping(value="/pub/qrcode/promotion/create")
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
- @ApiImplicitParam(name = "loginCode",value = "6位随机数", required = true, paramType = "query")
|
|
|
|
|
|
+ @ApiImplicitParam(name = "promoter",value = "推广者用户名", required = true, paramType = "query")
|
|
})
|
|
})
|
|
- public MessageResult<String> createQrcodeLogin(@RequestParam(value = "loginCode") String loginCode){
|
|
|
|
- MessageResult<String> msgResult = new MessageResult<>();
|
|
|
|
|
|
+ public MsgResult<String> createPromotionCode(@RequestParam(value = "promoter") String promoter){
|
|
|
|
+ MsgResult<String> msgResult = new MsgResult<>();
|
|
|
|
|
|
- log.warn("收到登录请求码:" + loginCode);
|
|
|
|
|
|
+ log.warn("收到推广码生成:" + promoter);
|
|
|
|
|
|
try {
|
|
try {
|
|
- if (loginCode.length()>10){
|
|
|
|
- throw new Exception("登录请求码长度不能大于10!");
|
|
|
|
- }
|
|
|
|
|
|
+ long expireSeconds = 24*60*60; //24小时
|
|
|
|
|
|
- long expireSeconds = 3000; //5分钟
|
|
|
|
- String url = WeixinUtil.createQrcode(weixinConfig, WeixinEvent.PICC_ADMIN_SCAN_QRCODE_LOGIN + "," + loginCode, expireSeconds);
|
|
|
|
|
|
+ String eventKey = WeixinEvent.PICC_ADMIN_SCAN_QRCODE_PROMOTION + "," + promoter;
|
|
|
|
+
|
|
|
|
+ String url = WeixinUtil.createQrcode(weixinConfig, eventKey, expireSeconds);
|
|
|
|
|
|
if(StringUtils.isNotEmpty(url)){
|
|
if(StringUtils.isNotEmpty(url)){
|
|
- valueOperations.set(WeixinConfig.SCAN_QRCODE_LOGIN_PREFIX + loginCode,"0",expireSeconds, TimeUnit.SECONDS);
|
|
|
|
|
|
+ valueOperations.set(eventKey,"0",expireSeconds, TimeUnit.SECONDS);
|
|
|
|
|
|
msgResult.setData(url);
|
|
msgResult.setData(url);
|
|
- msgResult.setResult(true);
|
|
|
|
|
|
+ msgResult.setSuccess(true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex){
|
|
catch (Exception ex){
|
|
log.error(ex.getMessage(),ex);
|
|
log.error(ex.getMessage(),ex);
|
|
- msgResult.setMessage(ex.getMessage());
|
|
|
|
- msgResult.setResult(false);
|
|
|
|
|
|
+ msgResult.setMsg(ex.getMessage());
|
|
|
|
+ msgResult.setSuccess(false);
|
|
}
|
|
}
|
|
|
|
|
|
return msgResult;
|
|
return msgResult;
|