1
0
Prechádzať zdrojové kódy

Merge branch 'master' of lhm/wxservice into master

李慧明 3 rokov pred
rodič
commit
24d082ba5f

+ 57 - 0
src/main/java/com/ematou/wxservice/common/utils/Md5Util.java

@@ -0,0 +1,57 @@
+package com.ematou.wxservice.common.utils;
+
+import java.security.MessageDigest;
+
+/**
+ * @author lhm
+ * @version 1.0
+ * 2021-05-18 08:56
+ */
+public class Md5Util {
+
+    /**
+     * 生成32位md5
+     * @param str 需要加密的字符串
+     * @return md5
+     */
+    public static String string2Md5(String str) {
+        try {
+            MessageDigest md5 = MessageDigest.getInstance("MD5");
+
+            char[] charArray = str.toCharArray();
+            byte[] byteArray = new byte[charArray.length];
+
+            for (int i = 0; i < charArray.length; i++) {
+                byteArray[i] = (byte) charArray[i];
+            }
+            byte[] md5Bytes = md5.digest(byteArray);
+
+            StringBuilder hexValue = new StringBuilder();
+            for (byte md5Byte : md5Bytes) {
+                int val = ((int) md5Byte) & 0xff;
+                if (val < 16) {
+                    hexValue.append("0");
+                }
+                hexValue.append(Integer.toHexString(val));
+            }
+
+            return hexValue.toString();
+        } catch (Exception e) {
+            e.printStackTrace();
+            return "";
+        }
+
+    }
+
+    /**
+     * 生成16位md5
+     *
+     * @param str str
+     * @return md5
+     */
+    public static String string2Md5_16(String str) {
+        String md5 = string2Md5(str);
+        return md5.substring(8, 24);
+    }
+
+}

+ 8 - 20
src/main/java/com/ematou/wxservice/common/utils/SmsUtil.java

@@ -14,6 +14,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * @author huangyaqin
@@ -21,17 +22,17 @@ import java.util.Map;
  * 2018-10-16 11:27
  */
 public class SmsUtil {
+
     //编码格式。发送编码格式统一用UTF-8
     private static String ENCODING = "UTF-8";
 
-
-    // 请求地址
-    private static String SMS_URL = "https://sms.yunpian.com/v2/sms/single_send.json";
+    public static String COMPANY_NAME = "e码头";
 
     // 中网cw apikey
-    private static String API_KEY = "1dd75986321871d706334e60b89c4021";
-
+    private static String API_KEY = "2e5c9d259b92e842c8d6b6a7e30dda4f";
 
+    // 一分钟隔离区域
+    public static Map<String, Long> map = new ConcurrentHashMap<>();
 
     /**
      * 发送短信消息
@@ -43,10 +44,10 @@ public class SmsUtil {
      * @return String
      */
     @SuppressWarnings("deprecation")
-    public static String sendMsg(String phones,String text) {
+    public static String sendMsg(String phones, String smsUrl,String text) {
         System.out.println(text);
         String apikey = API_KEY;
-        String url = SMS_URL;
+        String url = smsUrl;
         if(apikey != null && url != null){
             Map<String, String> params = new HashMap<String, String>();
             params.put("apikey", apikey);
@@ -117,17 +118,4 @@ public class SmsUtil {
         return responseText;
     }
 
-
-    /**
-     * 测试
-     * 方法说明
-     * @Discription:扩展说明
-     * @param args
-     * @return void
-     */
-    public static void main(String[] args) {
-//      System.out.println(SendMsgUtil.createRandomVcode());
-//      System.out.println("&ecb=12".substring(1));
-        System.out.println(sendMsg("18316287403", "【CW惠州门店】惠州港惠店 尊敬的CW会员,您购买的订单56151,已清关成功,感谢您的耐心等待。"));
-    }
 }

+ 44 - 0
src/main/java/com/ematou/wxservice/config/SmsConfig.java

@@ -0,0 +1,44 @@
+package com.ematou.wxservice.config;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * 短信平台配置
+ * @author lhm
+ * @version 1.0
+ * 2021-05-17 10:39
+ */
+@Configuration
+public class SmsConfig {
+
+    @Value("${sms.singleUrl}")
+    private String smsUrl;
+
+    @Value("${sms.smsContent}")
+    private String smsContent;
+
+    public String getSmsUrl() {
+        return smsUrl;
+    }
+
+    public void setSmsUrl(String smsUrl) {
+        this.smsUrl = smsUrl;
+    }
+
+    public String getSmsContent() {
+        return smsContent;
+    }
+
+    public void setSmsContent(String smsContent) {
+        this.smsContent = smsContent;
+    }
+
+    @Override
+    public String toString() {
+        return "SmsConfig{" +
+                "smsUrl='" + smsUrl + '\'' +
+                ", smsContent='" + smsContent + '\'' +
+                '}';
+    }
+}

+ 6 - 0
src/main/java/com/ematou/wxservice/controller/UserInfoController.java

@@ -32,4 +32,10 @@ public class UserInfoController {
 
     }
 
+    @GetMapping("/user/send")
+    public R<?> sendMsg(String phoneNumber) {
+        String msg = userInfoService.sendMsg(phoneNumber);
+        return new R<>().success(msg);
+    }
+
 }

+ 12 - 3
src/main/java/com/ematou/wxservice/controller/WeChatViewController.java

@@ -1,7 +1,10 @@
 package com.ematou.wxservice.controller;
 
 import com.ematou.wxservice.entity.vo.BindingInfo;
+import com.ematou.wxservice.service.UserInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -28,9 +31,11 @@ public class WeChatViewController {
         return "binding";
     }
 
+    @Autowired
+    UserInfoService userInfoService;
 
     @PostMapping("/binding")
-    public String binding(HttpServletRequest request) {
+    public String binding(HttpServletRequest request, Model model) {
         String phone = request.getParameter("phone1");
         String openid = request.getParameter("btnSendCode2");
         String code1 = request.getParameter("code1");
@@ -39,9 +44,13 @@ public class WeChatViewController {
         bindingInfo.setOpenId(openid);
         bindingInfo.setTellPhoneNumber(phone);
         bindingInfo.setValidateCode(code1);
-        System.out.println(bindingInfo);
 
-        return "return";
+        boolean result = userInfoService.binding(bindingInfo);
+        if (result) {
+            return "return";
+        }
+        model.addAttribute("errmsg", "验证码错误!");
+        return "binding";
     }
 
 }

+ 32 - 15
src/main/java/com/ematou/wxservice/entity/pojo/UserInfo.java

@@ -17,18 +17,19 @@ public class UserInfo {
     private Integer subscribe;
     private String openId;
     private String tellPhoneNumber;
+    private String validateCode;
     private String nickName;
     private Integer sex;
-    private String language;
+    private String userLanguage;
     private String city;
     private String province;
     private String country;
     private String headimgurl;
-    private Long subscribeTime;
+    private Timestamp subscribeTime;
     private String unionId;
     private String remark;
     private Integer groupId;
-    private List<Integer> tagIdList;
+    private List<Integer> tagidList;
     private String subscribeScene;
     private Long qrScene;
     private String qrSceneStr;
@@ -38,6 +39,14 @@ public class UserInfo {
     private String modTime;
     private Timestamp tmst;
 
+    public UserInfo() {
+    }
+
+    public UserInfo(String tellPhoneNumber, String validateCode) {
+        this.tellPhoneNumber = tellPhoneNumber;
+        this.validateCode = validateCode;
+    }
+
     public Integer getSubscribe() {
         return subscribe;
     }
@@ -62,6 +71,14 @@ public class UserInfo {
         this.tellPhoneNumber = tellPhoneNumber;
     }
 
+    public String getValidateCode() {
+        return validateCode;
+    }
+
+    public void setValidateCode(String validateCode) {
+        this.validateCode = validateCode;
+    }
+
     public String getNickName() {
         return nickName;
     }
@@ -78,12 +95,12 @@ public class UserInfo {
         this.sex = sex;
     }
 
-    public String getLanguage() {
-        return language;
+    public String getUserLanguage() {
+        return userLanguage;
     }
 
-    public void setLanguage(String language) {
-        this.language = language;
+    public void setUserLanguage(String userLanguage) {
+        this.userLanguage = userLanguage;
     }
 
     public String getCity() {
@@ -118,11 +135,11 @@ public class UserInfo {
         this.headimgurl = headimgurl;
     }
 
-    public Long getSubscribeTime() {
+    public Timestamp getSubscribeTime() {
         return subscribeTime;
     }
 
-    public void setSubscribeTime(Long subscribeTime) {
+    public void setSubscribeTime(Timestamp subscribeTime) {
         this.subscribeTime = subscribeTime;
     }
 
@@ -150,12 +167,12 @@ public class UserInfo {
         this.groupId = groupId;
     }
 
-    public List<Integer> getTagIdList() {
-        return tagIdList;
+    public List<Integer> getTagidList() {
+        return tagidList;
     }
 
-    public void setTagIdList(List<Integer> tagIdList) {
-        this.tagIdList = tagIdList;
+    public void setTagidList(List<Integer> tagIdList) {
+        this.tagidList = tagIdList;
     }
 
     public String getSubscribeScene() {
@@ -230,7 +247,7 @@ public class UserInfo {
                 ", tellPhoneNumber='" + tellPhoneNumber + '\'' +
                 ", nickName='" + nickName + '\'' +
                 ", sex=" + sex +
-                ", language='" + language + '\'' +
+                ", userLanguage='" + userLanguage + '\'' +
                 ", city='" + city + '\'' +
                 ", province='" + province + '\'' +
                 ", country='" + country + '\'' +
@@ -239,7 +256,7 @@ public class UserInfo {
                 ", unionId='" + unionId + '\'' +
                 ", remark='" + remark + '\'' +
                 ", groupId=" + groupId +
-                ", tagIdList=" + tagIdList +
+                ", tagidList=" + tagidList +
                 ", subscribeScene='" + subscribeScene + '\'' +
                 ", qrScene=" + qrScene +
                 ", qrSceneStr='" + qrSceneStr + '\'' +

+ 4 - 0
src/main/java/com/ematou/wxservice/mapper/UserInfoMapper.java

@@ -18,6 +18,10 @@ public interface UserInfoMapper {
 
     int insertUserInfo(@Param("userInfo") UserInfo userInfo);
 
+    int updateOrInsertUserInfo(@Param("userInfo") UserInfo userInfo);
+
     UserInfo queryUserInfoByOpenIdOrPhoneNumber(@Param("param") Map<String, String> param);
 
+    UserInfo queryUserInfoByPhoneNumber(@Param("phoneNumber") String phoneNumber);
+
 }

+ 79 - 0
src/main/java/com/ematou/wxservice/service/UserInfoService.java

@@ -1,6 +1,9 @@
 package com.ematou.wxservice.service;
 
+import com.ematou.wxservice.common.utils.SmsUtil;
+import com.ematou.wxservice.config.SmsConfig;
 import com.ematou.wxservice.entity.pojo.UserInfo;
+import com.ematou.wxservice.entity.vo.BindingInfo;
 import com.ematou.wxservice.mapper.UserInfoMapper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -9,6 +12,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 
 import java.util.HashMap;
+import java.util.Map;
 
 /**
  * @author lhm
@@ -21,6 +25,12 @@ public class UserInfoService {
     private static final Logger logger = LoggerFactory.getLogger(UserInfoService.class);
 
     @Autowired
+    SmsConfig smsConfig;
+
+    @Autowired
+    WeChatService weChatService;
+
+    @Autowired
     UserInfoMapper userInfoMapper;
 
     public UserInfo get(String openId, String phoneNumber){
@@ -35,4 +45,73 @@ public class UserInfoService {
         return userInfoMapper.queryUserInfoByOpenIdOrPhoneNumber(map);
     }
 
+    public String sendMsg(String phoneNumber){
+        long time = System.currentTimeMillis();
+        if (StringUtils.hasLength(phoneNumber)) {
+            // 一分钟内不允许再次发送
+            Long before = SmsUtil.map.get(phoneNumber);
+            if (null != before && time - before <= (1000 * 60)) {
+                return "短信已经发送过,请注意查收!";
+            }
+            String code = SmsUtil.createRandomVcode();
+            String msg = SmsUtil.sendMsg(phoneNumber, smsConfig.getSmsUrl(), String.format(smsConfig.getSmsContent(), SmsUtil.COMPANY_NAME, code));
+            if (!StringUtils.hasLength(msg)) {
+                SmsUtil.map.remove(phoneNumber);
+                return "短信发送失败,请重新发送!";
+            }
+            SmsUtil.map.remove(phoneNumber);
+            updateOrInsertUserInfo(new UserInfo(phoneNumber, code));
+            return "";
+        }
+        SmsUtil.map.remove(phoneNumber);
+        return "请输入手机号!";
+    }
+
+    public UserInfo queryUserInfoByPhoneNumber(String phoneNumber){
+        return userInfoMapper.queryUserInfoByPhoneNumber(phoneNumber);
+    }
+
+    public UserInfo updateOrInsertUserInfo(UserInfo userInfo) {
+        if (null == userInfo) {
+            logger.error("用户信息为空,不能为空!");
+            return null;
+        }
+        UserInfo info = queryUserInfoByPhoneNumber(userInfo.getTellPhoneNumber());
+        if (null != info) {
+//            System.currentTimeMillis() - info.getTmst().getTime() > (1000 * 60 * 3)
+            userInfoMapper.updateOrInsertUserInfo(userInfo);
+            return userInfo;
+        } else {
+            userInfoMapper.insertUserInfo(userInfo);
+            return userInfo;
+        }
+
+    }
+
+    public boolean binding(BindingInfo bindingInfo) {
+        if (null == bindingInfo) {
+            logger.error("绑定信息不能为空!");
+            return false;
+        }
+
+        Map<String, String> map = new HashMap<>();
+        map.put("phoneNumber", bindingInfo.getTellPhoneNumber());
+        UserInfo userInfo = userInfoMapper.queryUserInfoByOpenIdOrPhoneNumber(map);
+
+        if (null == userInfo) {
+            logger.error("使用手机号未查询到此用户信息!");
+            return false;
+        }
+        if (!userInfo.getValidateCode().equals(bindingInfo.getValidateCode())) {
+            logger.error("验证码错误!");
+            return false;
+        }
+        UserInfo info = weChatService.getUserInfo(bindingInfo);
+        info.setValidateCode(bindingInfo.getValidateCode());
+        info.setTellPhoneNumber(bindingInfo.getTellPhoneNumber());
+        userInfoMapper.updateOrInsertUserInfo(info);
+
+        return true;
+    }
+
 }

+ 8 - 5
src/main/java/com/ematou/wxservice/service/WeChatService.java

@@ -7,6 +7,7 @@ import com.ematou.wxservice.api.WeChatApiRestTemplate;
 import com.ematou.wxservice.common.constant.WeChatConstant;
 import com.ematou.wxservice.config.WeChatGeneralConfig;
 import com.ematou.wxservice.entity.vo.AccessToken;
+import com.ematou.wxservice.entity.vo.BindingInfo;
 import com.ematou.wxservice.entity.vo.TemplateMessage;
 import com.ematou.wxservice.entity.pojo.UserInfo;
 import com.ematou.wxservice.mapper.UserInfoMapper;
@@ -61,12 +62,12 @@ public class WeChatService {
 
     /**
      * 获取用户信息
-     * @param openId openId
+     * @param bindingInfo bindingInfo
      * @return 用户信息
      * @throws RuntimeException 异常
      */
-    public UserInfo getUserInfo(String openId) throws RuntimeException {
-        if (!StringUtils.hasLength(openId)) {
+    public UserInfo getUserInfo(BindingInfo bindingInfo) throws RuntimeException {
+        if (!StringUtils.hasLength(bindingInfo.getOpenId())) {
             logger.error("获取用户信息的openId为空");
             return null;
         }
@@ -75,9 +76,11 @@ public class WeChatService {
         UserInfo userInfo;
         String response = null;
         try {
-            response = weChatApiRestTemplate.getForOther(String.format(WeChatApi.GET_USER_INFO.getUrl(), accessToken, openId));
+            response = weChatApiRestTemplate.getForOther(String.format(WeChatApi.GET_USER_INFO.getUrl(), accessToken, bindingInfo.getOpenId()));
             userInfo = JSON.parseObject(response, UserInfo.class);
-            userInfoMapper.insertUserInfo(userInfo);
+            userInfo.setTellPhoneNumber(bindingInfo.getTellPhoneNumber());
+            userInfo.setValidateCode(bindingInfo.getValidateCode());
+            userInfoMapper.updateOrInsertUserInfo(userInfo);
         } catch (RuntimeException e) {
             logger.error("请求微信平台获取用户信息出错!response:" + response + ",error message:" + e.getMessage());
             throw new RuntimeException("请求微信平台获取用户信息出错!");

+ 11 - 5
src/main/resources/application.yml

@@ -5,14 +5,15 @@ wx:
   general:
     appId: wxf9360d70bc1406ee
     appSecret: 78413a82d0332ecbf7fdf475d0a8b08e
-#    appId: wx2215996b5fe1ec10
-#    appSecret: 8622b470fe3b779ffafe3baeb204fe41
 spring:
   datasource:
     driver-class-name: com.mysql.cj.jdbc.Driver
-    username: tuser
-    password: Qq!123
-    url: jdbc:mysql://120.76.84.45:3306/wx_base?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
+#    username: tuser
+#    password: Qq!123
+#    url: jdbc:mysql://120.76.84.45:3306/wx_base?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
+    username: root
+    password: root
+    url: jdbc:mysql://127.0.0.1:3306/wx_service?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
   thymeleaf:
     cache: false
     prefix: classpath:/templates/
@@ -28,3 +29,8 @@ mybatis:
     map-underscore-to-camel-case: true
 logging:
   config: classpath:logback.xml
+sms:
+  # 单条短信请求url
+  singleUrl: https://sms.yunpian.com/v2/sms/single_send.json
+  # 短信模板
+  smsContent: 【前海电商】欢迎绑定%s公众号,您的手机验证码是%s。本条信息无需回复

+ 82 - 5
src/main/resources/mybatis/UserInfoMapper.xml

@@ -5,18 +5,91 @@
 <mapper namespace="com.ematou.wxservice.mapper.UserInfoMapper">
 
     <sql id="Base_Column_List">
-        open_id,union_id,group_id,nick_name,sex,city,country,province,language,head_img_url,subscribe_time,tagid_list,
+        open_id,union_id,tell_phone_number,validate_code,group_id,nick_name,sex,city,country,province,user_language,headimgurl,subscribe_time,tagid_list,
         subscribe,remark,subscribe_scene,qr_scene,qr_scene_str,creator_id,create_time,moder_id,mod_time,tmst
     </sql>
 
     <insert id="insertUserInfo" >
         insert into user_info ( <include refid="Base_Column_List"/> )
-        values (#{userInfo.openId}, #{userInfo.unionId}, #{userInfo.groupId}, #{userInfo.nickName}, #{userInfo.sex}, #{userInfo.city},
-        #{userInfo.country}, #{userInfo.province}, #{userInfo.language}, #{userInfo.headImgUrl}, #{userInfo.subscribeTime}, #{userInfo.tagIdList},
-        #{userInfo.subscribe}, #{userInfo.remark}, #{userInfo.subscribeScene}, #{userInfo.qrScene}, #{userInfo.qrSceneStr}, #{userInfo.creatorId},
-        #{userInfo.createTime},  #{userInfo.moderId}, #{userInfo.modTime}, #{userInfo.tmst})
+        values (#{userInfo.openId}, #{userInfo.unionId}, #{userInfo.tellPhoneNumber}, #{userInfo.validateCode}, #{userInfo.groupId}, #{userInfo.nickName},
+        #{userInfo.sex}, #{userInfo.city}, #{userInfo.country}, #{userInfo.province}, #{userInfo.userLanguage}, #{userInfo.headimgurl}, #{userInfo.subscribeTime},
+        #{userInfo.tagidList}, #{userInfo.subscribe}, #{userInfo.remark}, #{userInfo.subscribeScene}, #{userInfo.qrScene}, #{userInfo.qrSceneStr},
+        #{userInfo.creatorId}, #{userInfo.createTime}, #{userInfo.moderId}, #{userInfo.modTime}, #{userInfo.tmst})
     </insert>
 
+
+    <update id="updateOrInsertUserInfo">
+        update user_info
+        <set>
+            <if test="userInfo.openId != null">
+                open_id=#{userInfo.openId},
+            </if>
+            <if test="userInfo.unionId != null">
+                union_id=#{userInfo.unionId},
+            </if>
+            <if test="userInfo.validateCode != null">
+                validate_code=#{userInfo.validateCode},
+            </if>
+            <if test="userInfo.groupId != null">
+                group_id=#{userInfo.groupId},
+            </if>
+            <if test="userInfo.nickName != null">
+                nick_name=#{userInfo.nickName},
+            </if>
+            <if test="userInfo.sex != null">
+                sex=#{userInfo.sex},
+            </if>
+            <if test="userInfo.city != null">
+                city=#{userInfo.city},
+            </if>
+            <if test="userInfo.country != null">
+                country=#{userInfo.country},
+            </if>
+            <if test="userInfo.province != null">
+                province=#{userInfo.province},
+            </if>
+            <if test="userInfo.userLanguage != null">
+                user_language=#{userInfo.userLanguage},
+            </if>
+            <if test="userInfo.headimgurl != null">
+                headimgurl=#{userInfo.headimgurl},
+            </if>
+            <if test="userInfo.subscribeTime != null">
+                subscribe_time=#{userInfo.subscribeTime},
+            </if>
+            <if test="userInfo.tagidList != null">
+                tagid_list=#{userInfo.tagidList},
+            </if>
+            <if test="userInfo.subscribe != null">
+                subscribe=#{userInfo.subscribe},
+            </if>
+            <if test="userInfo.remark != null">
+                remark=#{userInfo.remark},
+            </if>
+            <if test="userInfo.subscribeScene != null">
+                subscribe_scene=#{userInfo.subscribeScene},
+            </if>
+            <if test="userInfo.qrScene != null">
+                qr_scene=#{userInfo.qrScene},
+            </if>
+            <if test="userInfo.qrSceneStr != null">
+                qr_scene_str=#{userInfo.qrSceneStr},
+            </if>
+            <if test="userInfo.moderId != null">
+                moder_id=#{userInfo.moderId},
+            </if>
+            <if test="userInfo.modTime != null">
+                mod_time=#{userInfo.modTime},
+            </if>
+            <if test="userInfo.tmst != null">
+                tmst=#{userInfo.tmst},
+            </if>
+        </set>
+        <if test="userInfo.tellPhoneNumber">
+            where tell_phone_number=#{userInfo.tellPhoneNumber}
+        </if>
+    </update>
+
     <select id="queryUserInfoByOpenIdOrPhoneNumber" resultType="com.ematou.wxservice.entity.pojo.UserInfo">
         select
         <include refid="Base_Column_List"/>
@@ -30,4 +103,8 @@
         </if>
     </select>
 
+    <select id="queryUserInfoByPhoneNumber" resultType="com.ematou.wxservice.entity.pojo.UserInfo">
+        select <include refid="Base_Column_List"/> from user_info where tell_phone_number=#{phoneNumber}
+    </select>
+
 </mapper>

+ 6 - 1
src/main/resources/static/js/clean.js

@@ -61,11 +61,16 @@ function sendMessage1() {
     curCount1 = count;
     var phone = $.trim($('#phone1').val());
     if (!phoneReg.test(phone)) {
-        alert(" 请输入有效的手机号码");
+        alert("请输入有效的手机号码");
         return false;
     }
     $("#btnSendCode1").attr("disabled", "true");
     $("#btnSendCode1").val(+curCount1 + "秒再获取");
+
+    $.get("http://f3dhion.nat.ipyingshe.com/user/send?phoneNumber=" + phone, function (res) {
+        alert(res.data);
+    })
+
     InterValObj1 = window.setInterval(SetRemainTime1, 1000);
 
 }