Helius
2021-03-25 cdd14c32d50af9e3ac8454689612f1bf54de8b7f
modify
1 files added
2 files modified
94 ■■■■■ changed files
src/main/java/com/xcong/excoin/common/system/controller/CommonController.java 3 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/coin/service/impl/BlockCoinServiceImpl.java 7 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/utils/mail/ZzSmsSend.java 84 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/common/system/controller/CommonController.java
@@ -14,6 +14,7 @@
import com.xcong.excoin.utils.mail.Sms106Send;
import com.xcong.excoin.utils.mail.SmsSend;
import com.xcong.excoin.utils.mail.SubMailSend;
import com.xcong.excoin.utils.mail.ZzSmsSend;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@@ -61,7 +62,7 @@
        // 发送手机验证码
        if (AppContants.ACCOUNT_TYPE_MOBILE.equals(type)) {
            boolean result = Sms106Send.sendVerifyCode(account, code.toString(), 2);
            boolean result = ZzSmsSend.sendVerifyCode(account, code.toString(), 2);
            if (result) {
                Map<String, Object> map = new HashMap<>();
                boolean flag = redisUtils.set(AppContants.VERIFY_CODE_PREFIX + account, code, 120);
src/main/java/com/xcong/excoin/modules/coin/service/impl/BlockCoinServiceImpl.java
@@ -22,6 +22,7 @@
import com.xcong.excoin.utils.dingtalk.DingTalkUtils;
import com.xcong.excoin.utils.mail.Sms106Send;
import com.xcong.excoin.utils.mail.SubMailSend;
import com.xcong.excoin.utils.mail.ZzSmsSend;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.apache.commons.collections.CollectionUtils;
@@ -445,7 +446,7 @@
        MemberEntity member = memberDao.selectById(memberId);
        if (StrUtil.isNotBlank(member.getPhone())) {
            //String amountEos = amount + "XRP";
            Sms106Send.sendRechargeMsg(member.getPhone(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo);
            ZzSmsSend.sendRechargeMsg(member.getPhone(), new Date(), amount+"USDT-TRC20", orderNo);
        } else {
            SubMailSend.sendRechargeMail(member.getEmail(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo);
        }
@@ -455,7 +456,7 @@
    @Override
    @Transactional
    @Transactional(rollbackFor = Exception.class)
    public void updateEthUsdtNew(EthUsdtChargeDto ethUsdtChargeDto) {
        String address = ethUsdtChargeDto.getAddress();
        String hash = ethUsdtChargeDto.getHash();
@@ -497,7 +498,7 @@
            MemberEntity member = memberDao.selectById(memberId);
            if (StrUtil.isNotBlank(member.getPhone())) {
                String amount = newBalance.toPlainString() + "USDT-ERC20";
                Sms106Send.sendRechargeMsg(member.getPhone(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo);
                ZzSmsSend.sendRechargeMsg(member.getPhone(),new Date(), amount, orderNo);
            } else {
                SubMailSend.sendRechargeMail(member.getEmail(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo);
            }
src/main/java/com/xcong/excoin/utils/mail/ZzSmsSend.java
New file
@@ -0,0 +1,84 @@
package com.xcong.excoin.utils.mail;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.XmlUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.http.HttpUtil;
import com.xcong.excoin.common.exception.GlobalException;
import lombok.extern.slf4j.Slf4j;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
 * @author wzy
 * @date 2021-03-25
 **/
@Slf4j
public class ZzSmsSend {
    private static final String URL = "http://zzsms365.com/v2sms.aspx?action=send";
    private static final String USER_ID = "1654";
    private static final String ACCOUNT = "1369815429";
    private static final String PWD = "1369815429";
    public static boolean sendVerifyCode(String telphone, String code, int time) {
        String content = "【HiBit】您的验证码是{},请在{}分钟内输入,请勿泄露给他人,如非本人操作,请及时修改密码。";
        return send(telphone, StrUtil.format(content, code, time));
    }
    public static boolean sendRechargeMsg(String telphone, Date time, String amount, String orderNo) {
        String content = "【HiBit】尊敬的用户,恭喜您于{}有一笔充值已成功到账,充值数量为{}, 订单号为{}。";
        return send(telphone, StrUtil.format(content, DateUtil.format(time, DatePattern.NORM_DATETIME_MINUTE_PATTERN), amount));
    }
    public static boolean sendWithdrawMsg(String telphone, Date time, String amount) {
        String content = "【HiBit】尊敬的用户,恭喜您于{}提现成功,数量为{}。";
        return send(telphone, StrUtil.format(content, DateUtil.format(time, DatePattern.NORM_DATETIME_MINUTE_PATTERN), amount));
    }
    public static boolean sendForceCloseMsg(String telphone) {
        String content = "【HiBit】尊敬的用户,因市场剧烈波动,您的合约账户已被强制平仓。";
        return send(telphone, content);
    }
    private static boolean send(String telphone, String content) {
        Map<String, Object> data = new HashMap<>();
        Long time = System.currentTimeMillis();
        data.put("userid", USER_ID);
        data.put("timestamp", time);
        data.put("mobile", telphone);
        String signStr = ACCOUNT + PWD + time;
        String sign = SecureUtil.md5(signStr);
        data.put("sign", sign);
        data.put("content", content);
        String response = HttpUtil.post(URL, data);
        log.info("短信发送:{}", response);
        if ("Success".equals(XmlUtil.xmlToMap(response).get("returnstatus"))) {
            return true;
        } else {
//            throw new GlobalException((String) XmlUtil.xmlToMap(response).get("message"));
            return false;
        }
    }
    public static void main(String[] args) {
        Map<String, Object> data = new HashMap<>();
        Long time = System.currentTimeMillis();
        data.put("userid", USER_ID);
        data.put("timestamp", time);
        data.put("mobile", "15773002834");
        String signStr = ACCOUNT + PWD + time;
        String sign = SecureUtil.md5(signStr);
        data.put("sign", sign);
        data.put("content", "【HiBit】尊敬的用户,恭喜您于2010-03-25有一笔充值已成功到账,充值数量为10。");
        String post = HttpUtil.post(URL, data);
        System.out.println(post);
    }
}