123456789101112131415161718192021222324252627282930313233 |
- package com.winhc.task.util;
- import com.winhc.task.vo.SmsBean;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Component;
- /**
- * @author: XuJiakai
- * 2020/10/30 16:50
- */
- @Slf4j
- //@Component
- public class SmsUtils {
- @Autowired
- private OkHttpUtils client;
- public boolean send(String msg, String to) {
- return send(msg, new String[]{to});
- }
- public boolean send(String msg, String[] to) {
- try {
- String post = client.post("http://47.101.221.131:8288/sms/send?sign=ansdvhhanvisdnhacamjklvrvrsjka", new SmsBean(to, msg).toString());
- log.info(post);
- return post.contains("true");
- } catch (Exception e) {
- log.error(e.getMessage(), e);
- return false;
- }
- }
- }
|