Commit 4d090d85 authored by renjie's avatar renjie

注册用户发短信

parent 25401d34
......@@ -332,7 +332,7 @@ public class AdministratorController {
return resultDto;
}
//获取用户企业认证的信息
//设置用户企业认证的信息
@PreAuthorize(Securitys.ADMIN_EL)
@RequestMapping(path = "/0xadministrator/authorize/set", method = RequestMethod.PUT)
public ResultDto setAuthorize(Principal principal, @RequestParam("username") String username, @RequestParam("isAgree") boolean isAgree) {
......
......@@ -522,6 +522,14 @@ public class AccountServiceImpl implements AccountService {
userAuthService.create(new com.edgec.browserbackend.auth.domain.User(user));
repository.save(account);
JSONObject param = new JSONObject();
param.put("newuser", account.getName());
if (inviter != null)
param.put("referral", inviter.getName() + "(" + user.getPromotionCode() + ")");
else
param.put("referral", "");
com.edgec.browserbackend.common.commons.utils.SmsUtils.sendNewAccountSms("15919921106", com.edgec.browserbackend.common.commons.utils.SmsUtils.SmsTemplateCode.NEWACCOUNT, param);
if (inviter != null) {
paymentService.bankTransferInsertion(account.getName(), 12);
}
......
......@@ -394,6 +394,7 @@ public class AdministratorServiceImpl implements AdministratorService {
Promotion promotion = new Promotion();
accounts.forEach(x -> {
promotion.setInvitedUsers(promotion.getInvitedUsers() + 1);
promotion.setTotalCommission(promotion.getTotalCommission() + x.getPromotion().getTotalCommission());
promotion.setCommission(promotion.getCommission() + x.getPromotion().getCommission());
promotion.setWithdrawn(promotion.getWithdrawn() + x.getPromotion().getWithdrawn());
......
......@@ -28,6 +28,7 @@ public class SmsUtils {
AUTHCODE("SMS_185841618"),
IPWILLEXPIRE_EXPIRE("SMS_185821567"),
IPEXPIRED("SMS_185841667"),
NEWACCOUNT("SMS_187750800");
;
......@@ -90,6 +91,28 @@ public class SmsUtils {
// }
// }
public static void sendNewAccountSms(String phoneNum, SmsTemplateCode smsTemplateCode, JSONObject param) {
CommonRequest request = new CommonRequest();
//request.setProtocol(ProtocolType.HTTPS);
request.setMethod(MethodType.POST);
request.setDomain("dysmsapi.aliyuncs.com");
request.setVersion("2017-05-25");
request.setAction("SendSms");
request.putQueryParameter("PhoneNumbers", phoneNum);
request.putQueryParameter("SignName", "防关联浏览器");
request.putQueryParameter("TemplateCode", smsTemplateCode.getCode());
request.putQueryParameter("TemplateParam", param.toJSONString());
try {
CommonResponse response = iAcsClient.getCommonResponse(request);
if (response.getHttpStatus() == 200 && response.getData().contains("OK")) {
return;
} else {
log.error("Send SMS Error,{}, {}, {}, {}", phoneNum, smsTemplateCode, param, response.getData());
}
} catch (Exception e) {
log.error("Send SMS Error,{}, {}, {}", phoneNum, smsTemplateCode, param);
}
}
public static void sendIpSms(String phoneNum, SmsTemplateCode smsTemplateCode, JSONObject param) {
CommonRequest request = new CommonRequest();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment