wangshan 5 роки тому
батько
коміт
1cc00493f9

+ 1 - 1
src/config.json

@@ -1,7 +1,7 @@
 {
     "nodeName":"node1",
 	"mongodbServers": "192.168.3.128:27080",
-    "mongodbPoolSize": "25",
+    "mongodbPoolSize": "5",
     "mongodbName": "qfw",
     "influxaddr": "http://192.168.3.11:8086",
     "influxdb": "jy_logs",

+ 1 - 0
src/jfw/modules/subscribepay/src/service/afterPay.go

@@ -173,6 +173,7 @@ var oneRemind = int64(1 * 24 * 60 * 60)
 
 //
 func (a *AfterPay) GetUserInfo() error {
+	//	log.Println(util.GetDATE(2, 1, 1576166400))
 	defer qutil.Catch()
 	userId, _ := a.GetSession("userId").(string)
 	var userData *map[string]interface{}

+ 4 - 4
src/jfw/modules/subscribepay/src/util/vrew.go

@@ -261,8 +261,8 @@ func GetDATE(val int, m int, endtime int64) (_endtime time.Time) {
 	date_m, _ := strconv.Atoi(strings.Split(endFormat, "-")[1])
 	date_d, _ := strconv.Atoi(strings.Split(endFormat, "-")[2])
 	if date_m+m > 12 {
-		date_y = date_y + (date_m+m)/12
-		date_m = date_m + m - 12*((date_m+m)/12)
+		date_y = date_y + (date_m+m-1)/12
+		date_m = date_m + m - 12*((date_m+m-1)/12)
 	} else {
 		date_m = date_m + m
 	}
@@ -286,7 +286,7 @@ func GetDATE(val int, m int, endtime int64) (_endtime time.Time) {
 			dstr = "0" + strconv.Itoa(date_d)
 		}
 	}
-	_date = strconv.Itoa(date_y) + "-" + mstr + "-" + dstr
-	lastDate, _ := time.ParseInLocation(qutil.Date_Short_Layout, _date, time.Local)
+	_date = strconv.Itoa(date_y) + "-" + mstr + "-" + dstr + " 23:59:59"
+	lastDate, _ := time.ParseInLocation(qutil.Date_Full_Layout, _date, time.Local)
 	return lastDate
 }

+ 1 - 1
src/jfw/public/historypush.go

@@ -57,7 +57,7 @@ func (h *historyPush) Datas_Mysql(userId string, pageNum int, selectTime, area s
 	countSQL = countSQL + findStr
 	count := Mysql.CountBySql(countSQL)
 	start := (pageNum - 1) * pageSize
-	findStr += " order by infoid desc limit " + fmt.Sprint(start) + "," + fmt.Sprint(pageSize)
+	findStr += " order by id desc limit " + fmt.Sprint(start) + "," + fmt.Sprint(pageSize)
 	findSQL = findSQL + findStr
 	list := Mysql.SelectBySql(findSQL)
 	if len(*list) > 0 {

+ 4 - 1
src/web/staticres/vipsubscribe/css/addition_exclusive_word.css

@@ -61,7 +61,7 @@
 
 .exclusive-word .enter .btn button,
 .addition-word .enter .btn button {
-  width: 100%;
+  width: 50%;
   height: 0.94rem;
   background: #2cb7ca;
   color: #fff;
@@ -345,4 +345,7 @@
     left: 50%;
     margin-left: -25px;
     width: 50px;
+}
+.addkeyWord{
+	margin-bottom:.2rem;
 }

+ 1 - 1
src/web/staticres/vipsubscribe/css/keyWord.css

@@ -90,7 +90,7 @@
 }
 
 .keyWord .add-keyword-container .content .enter .btn button {
-  width: 100%;
+  width: 50%;
   height: 0.94rem;
   background: #2cb7ca;
   color: #fff;

+ 26 - 16
src/web/staticres/vipsubscribe/js/additionWord.js

@@ -11,18 +11,21 @@ $(function(){
         var showKeyWordLength = $(".showKeyWord ul").find('li').length;
         if(showKeyWordLength === 0){
             $(".addkeyWord").show();
+            $('.addKeyWord').hide();
         } else {
             $(".addkeyWord").hide();
+            $('.addKeyWord').show();
         }
     }
     hasWords()
     
     // 添加按钮
     $(".addKeyWord i").on('click',function(){
-        $(".addkeyWord").show()
-        $(".addkeyWord input").focus()
-        $('.showKeyWord').find('.one').show()
-        $('.showKeyWord').find('.modify').hide()
+        $(".addkeyWord").show();
+        $(".addKeyWord").hide();
+        $(".addkeyWord input").focus();
+        $('.showKeyWord').find('.one').show();
+        $('.showKeyWord').find('.modify').hide();
     })
     // 输入框自适应高度
     $('textarea').each(function(i,dom){
@@ -35,7 +38,7 @@ $(function(){
     })
     // 添加keyWords检查输入框内是否有文字,如果有才能点击添加按钮
     $('.addkeyWord input.enterOne').on('input', function() {
-        var buttonDOM = $(this).siblings().find('button')[0]
+        var buttonDOM = $(this).siblings().find('button')[1]
         if ($(this).val().length >= 1) {
             buttonDOM.style.opacity = 1
             buttonDOM.removeAttribute("disabled")
@@ -46,10 +49,16 @@ $(function(){
     })
     
     // 添加 按钮的点击事件
-    $('.addkeyWord .btn button').on('click', function(){
+    $('.addkeyWord .btn button:nth-child(2)').on('click', function(){
         var timestamp = new Date().getTime();//动态生成不同的id,因为id唯一不能重复,所以 用时间戳 代替  防止重复
         var keyWord = $('.addkeyWord input.enterOne').val();
-        _addindex = -1;
+		if(keyWord==""){
+			return
+		}
+		_addindex = 0;
+		if($(".showKeyWord li").length>0){
+        	_addindex =  Number($(".showKeyWord li:first").find(".editKeyWord").attr("dataIndex")) + Number(1);
+		}
 		if(addkws_arr[keyWord]!=undefined){
             weui.toast('您设置的附加词已存在,请调整后再添加。', {
                 duration: 2000,
@@ -60,7 +69,7 @@ $(function(){
 		}
         //保存新附加词
         _addkws = keyWord;
-        saveSession();
+        saveSession("",_addindex);
         var html = `<li>
                         <div class="one">
                             <div>
@@ -68,7 +77,7 @@ $(function(){
                                     <p class="key">${ keyWord }</p>
                                 </span>
                             </div>
-                            <button class="editKeyWord"><i class="iconfont icon-xiugai"></i> 修改</button>
+                            <button class="editKeyWord" dataindex="`+_addindex+`"><i class="iconfont icon-xiugai"></i> 修改</button>
                         </div>
                         <div class="modify">
                             <textarea  name=""  rows="1"  placeholder="" maxlength="20">${ keyWord}</textarea>
@@ -80,8 +89,9 @@ $(function(){
         // 隐藏
         $(".addkeyWord").hide();
         $('.showKeyWord').show();
+        $('.addKeyWord').show();
         $('.enter.addkeyWord > input').val('')
-        var buttonDOM = $('.enter.addkeyWord .btn button')[0]
+        var buttonDOM = $('.enter.addkeyWord .btn button')[1]
         buttonDOM.style.opacity = .5
         buttonDOM.setAttribute("disabled", true)
 
@@ -89,6 +99,7 @@ $(function(){
 
     // 编辑
     $(".showKeyWord").on('click', '.editKeyWord',function(e){
+        _addindex = Number($(this).attr("dataindex"));
         $('.enter.addkeyWord').hide()
         $('.addKeyWord').hide()
 
@@ -104,7 +115,7 @@ $(function(){
     $('.showKeyWord').on('click', '.deleteKey', function(e) {
         var jQueryDOM = $(this).parents('li');
         _addkws = $(this).siblings('textarea').val();
-        _addindex = $(".showKeyWord li").length - $(this).parent().parent('li').index() - 1;
+		var _index =  $('.showKeyWord li').length - $(this).parent().parent("li").index() -1;
         weui.confirm('确定要删除附加词?', {
             buttons: [{
                 label: '取消',
@@ -116,16 +127,15 @@ $(function(){
                 onClick: function () {
                     jQueryDOM.remove();
                     hasWords();
-                    $('.addKeyWord').show();
-                    saveSession("D");
+                    saveSession("D",_addindex,_index);
                 }
             }]
         });
     })
     // 编辑 确定
     $('.showKeyWord').on('click', '.ascertainKey', function(e) {
-        $('.addKeyWord').show()
         var keyWord = $(this).siblings('textarea').val();
+		var _index =  $('.showKeyWord li').length - $(this).parent().parent("li").index() -1;
         if(keyWord.length > 20){
             weui.toast('每组附加词不能超过20字', {
                 duration: 2000,
@@ -133,7 +143,6 @@ $(function(){
                 callback: function () { console.log('close') }
             });
         }else{
-            _addindex = $(".showKeyWord li").length - $(this).parent().parent('li').index() - 1;
 			if(addkws_arr[keyWord]!=undefined&&addkws_arr[keyWord]!=_addindex){
 	            weui.toast('您设置的附加词已存在,请调整后再添加。', {
 	                duration: 2000,
@@ -142,8 +151,9 @@ $(function(){
 	            });
 				return
 			}
+        	$('.addKeyWord').show()
             _addkws = keyWord;
-            saveSession();
+            saveSession("",_addindex,_index);
             $(this).parent().siblings().find('.key').text(keyWord)
             $(this).parent().hide().siblings().show()
         }

+ 19 - 12
src/web/staticres/vipsubscribe/js/exclusiveWord.js

@@ -11,8 +11,10 @@ $(function(){
         var showKeyWordLength = $(".showKeyWord ul").find('li').length;
         if(showKeyWordLength === 0){
             $(".addkeyWord").show();
+            $('.addKeyWord').hide();
         } else {
             $(".addkeyWord").hide();
+            $('.addKeyWord').show();
         }
     }
     hasWords()
@@ -20,6 +22,7 @@ $(function(){
     // 添加按钮
     $(".addKeyWord i").on('click',function(){
         $(".addkeyWord").show()
+        $(".addKeyWord").hide();
         $(".addkeyWord input").focus()
         $('.showKeyWord').find('.one').show()
         $('.showKeyWord').find('.modify').hide()
@@ -39,7 +42,7 @@ $(function(){
             return
         }
 
-        var buttonDOM = $(this).siblings().find('button')[0]
+        var buttonDOM = $(this).siblings().find('button')[1]
         if ($(this).val().length >= 1) {
             buttonDOM.style.opacity = 1
             buttonDOM.removeAttribute("disabled")
@@ -59,9 +62,12 @@ $(function(){
     })
     // 添加 按钮的点击事件
    
-    $('.addkeyWord .btn button').on('click', function(){
+    $('.addkeyWord .btn button:nth-child(2)').on('click', function(){
         var keyWord = $('.addkeyWord input.enterOne').val()
-        _notindex = -1;
+		_notindex = 0;
+		if($(".showKeyWord li").length>0){
+        	_notindex = Number($(".showKeyWord li:first").find(".editKeyWord").attr("dataIndex")) + Number(1);
+		}
         //保存新附加词
         _notkws = keyWord;
 		if(notkws_arr[keyWord]!=undefined){
@@ -72,7 +78,7 @@ $(function(){
             });
 			return
 		}
-        saveSession();
+        saveSession("",_notindex);
         var html = `<li>
                         <div class="one">
                             <div>
@@ -80,7 +86,7 @@ $(function(){
                                     <p class="key">${ keyWord }</p>
                                 </span>
                             </div>
-                            <button class="editKeyWord"><i class="iconfont icon-xiugai"></i> 修改</button>
+                            <button class="editKeyWord" dataindex="`+_notindex+`"><i class="iconfont icon-xiugai"></i> 修改</button>
                         </div>
                         <div class="modify">
                             <textarea  name=""  rows="1"  placeholder="">${ keyWord}</textarea>
@@ -93,8 +99,9 @@ $(function(){
         // 隐藏
         $(".addkeyWord").hide();
         $('.showKeyWord').show();
+        $('.addKeyWord').show();
         $('.enter.addkeyWord > input').val('')
-        var buttonDOM = $('.enter.addkeyWord .btn button')[0]
+        var buttonDOM = $('.enter.addkeyWord .btn button')[1]
         buttonDOM.style.opacity = .5
         buttonDOM.setAttribute("disabled", true)
 
@@ -102,6 +109,7 @@ $(function(){
 
     // 编辑
     $(".showKeyWord").on('click', '.editKeyWord', function(e){
+        _notindex = Number($(this).attr("dataindex"));
         $('.enter.addkeyWord').hide()
         $('.addKeyWord').hide()
 
@@ -116,8 +124,8 @@ $(function(){
     $('.showKeyWord').on('click', '.deleteKey', function(e) {
         var jQueryDOM = $(this).parents('li');
         _notkws = $(this).siblings('textarea').val();
-        _notindex = $(".showKeyWord li").length - $(this).parent().parent('li').index() - 1;
-        weui.confirm('确定要删除关键词?', {
+		var _index =  $('.showKeyWord li').length - $(this).parent().parent("li").index() -1;
+        weui.confirm('确定要删除排除词?', {
             buttons: [{
                 label: '取消',
                 type: 'default',
@@ -128,8 +136,7 @@ $(function(){
                 onClick: function () {
                     jQueryDOM.remove()
                     hasWords()
-                    $('.addKeyWord').show();
-                    saveSession("D");
+                    saveSession("D",_notindex,_index);
                 }
             }]
         });
@@ -139,6 +146,7 @@ $(function(){
     $('.showKeyWord').on('click', '.ascertainKey', function(e) {
         var $this = $(this);
         var keyWord = $(this).siblings('textarea').val();
+		var _index =  $('.showKeyWord li').length - $(this).parent().parent("li").index() -1;
         if(keyWord.length > 20){
             weui.toast('每组排除词不能超过20字', {
                 duration: 2000,
@@ -157,9 +165,8 @@ $(function(){
             $this.parent().siblings().find('.key').text(keyWord);
             $this.parent().hide().siblings().show();
             $('.addKeyWord').show();
-            _notindex = $(".showKeyWord li").length - $(this).parent().parent('li').index() - 1;
             _notkws = keyWord;
-            saveSession();
+            saveSession("",_notindex,_index);
         }
     })
 

+ 22 - 13
src/web/staticres/vipsubscribe/js/keyWord.js

@@ -29,7 +29,7 @@ var reloadFunc = function(){
 
     // 添加keyWords检查输入框内是否有文字,如果有才能点击添加按钮
     $('.content .addkeyWord input.enterOne').on('input', function () {
-        var buttonDOM = $(this).siblings()[1].children[0]
+        var buttonDOM = $(this).siblings()[1].children[1]
         if ($(this).val().length >= 1) {
             buttonDOM.style.opacity = 1
             buttonDOM.removeAttribute("disabled")
@@ -40,8 +40,11 @@ var reloadFunc = function(){
     })
 
     // 添加 确认按钮的点击事件
-    $('.content .addkeyWord .btn button').on('click', function () {
+    $('.content .addkeyWord .btn button:nth-child(2)').on('click', function () {
         var keyWord = $('.addkeyWord input.enterOne').val();
+		if(keyWord==""){
+			return
+		}
 		if(kws_arr[keyWord]!=undefined){
             weui.toast('您设置的关键词已存在,请调整后再添加。', {
                 duration: 2000,
@@ -58,11 +61,15 @@ var reloadFunc = function(){
             });
         }
         kws_name = keyWord;
-        kws_index = $(".showKeyWord li").length;
+		kws_index = $(".showKeyWord li").length;
         if(kws_index==0){
             //分类首次添加关键词需重新获取分类索引
             classify_index = a_items.length;
         }
+		var _index = 0;
+		if($(".showKeyWord li").length>0){
+        	_index =  Number($(".showKeyWord li:first").find(".editKeyWord").attr("dataIndex")) + Number(1);
+		}
         classify_name = $('.classify-r .classify-detail').text();
         //保存关键词
         kws_count = parseInt(kws_count) + 1;
@@ -78,8 +85,8 @@ var reloadFunc = function(){
                 setEmptyHistory();
             }
             //
-            doSessionData();
-            $(".add-keyword-container .addNewKeyword").show();
+            doSessionData("",_index);
+            $(".add-keyword-container .addNewKeyword i").show();
             //点击保存关键词,查看缓存中存的附加词 和排除词。
             $(".kws_count").text(kws_count);
             var html = `<li><div class="one"><div>
@@ -100,7 +107,7 @@ var reloadFunc = function(){
                                 +'</span>'
                 }
                 html +=`</div>
-                        <button class="editKeyWord"  dataIndex=`+kws_index+`><i class="iconfont icon-xiugai"></i> 修改</button>
+                        <button class="editKeyWord"  dataIndex=`+_index+`><i class="iconfont icon-xiugai"></i> 修改</button>
                         </div>
                         <div class="modify">
                         <textarea  name=""  rows="1"  placeholder="" maxlength="20">${keyWord}</textarea>`
@@ -114,7 +121,7 @@ var reloadFunc = function(){
             }else{
                 html +=`<button class="addAdjunctWord" onClick="tonotkey(this)">添加 排除词</button>`
             }
-                html +=`<button class="deleteKey">删除</button><button class="ascertainKey" dataIndex=`+kws_index+` onclick="saveK(this)">确定</button></div></li>`
+                html +=`<button class="deleteKey">删除</button><button class="ascertainKey" dataIndex=`+_index+` onclick="saveK(this)">确定</button></div></li>`
             $('.showKeyWord > ul').prepend(html);
             // 添加完成隐藏输入框
             $(".enter.addkeyWord").hide();
@@ -126,17 +133,17 @@ var reloadFunc = function(){
             addition_kws = [];
             not_kws = [];
 			//
-            var buttonDOM = $('.enter.addkeyWord .btn button')[0]
+            var buttonDOM = $('.enter.addkeyWord .btn button')[1]
             buttonDOM.style.opacity = .5
             buttonDOM.setAttribute("disabled", true)
             //保存关键词 查看关键词数量 未分类 超过20 100提示
             if(classify_name.indexOf("未分类")>-1){
-                if((kws_tips==0&&$(".showKeyWord li").length>=20)||(kws_tips==20&&$(".showKeyWord li").length>=100)){
+                if((kws_tips==1&&$(".showKeyWord li").length>=20)||(kws_tips==20&&$(".showKeyWord li").length>=100)){
                     //未分类 20个关键词提示,100个关键词提示
                     showMeg();
                     var param = {};
                     param.classify_index = classify_index;
-                    if(kws_tips==0){
+                    if(kws_tips==1){
                         param.kws_tips = 20;
                     }else if(kws_tips==20){
                         param.kws_tips = 100;
@@ -172,11 +179,12 @@ var reloadFunc = function(){
         $(this).parent().hide()
         $(this).parent().siblings().show().parent().siblings().children('.modify').hide().siblings('.one').show()
         $(oSpan).val('').focus().val(val) 
-        $('.addKeyWord').hide()
+        $(".add-keyword-container .addNewKeyword i").hide()
     })
 
     // 编辑删除
     $('.showKeyWord').on('click', '.deleteKey', function (e) {
+		var _index = Number($(this).next(".ascertainKey").attr("dataindex"));
         var jQueryDOM = $(this).parents('li')
         weui.confirm('确定要删除关键词?', {
             buttons: [{
@@ -195,10 +203,11 @@ var reloadFunc = function(){
 			                $(".enter.addkeyWord").find(".btnChoose button").eq(0).html('添加 附加词');
 			                $(".enter.addkeyWord").find(".btnChoose button").eq(1).html('添加 附加词');
 			                $(".enter.addkeyWord").find("input").val("");
+						}else{
+							$(".add-keyword-container .addNewKeyword i").show();
 						}
                         hasWords();
-                        $('.addKeyWord').show();
-                        doSessionData('DK');
+                        doSessionData('DK',_index);
 			            //把kws_name,kws_index,addition_kws,not_kws初始化
 			            kws_index = 0;
 			            kws_name = "";

+ 29 - 9
src/web/templates/weixin/vipsubscribe/additionWord.html

@@ -23,6 +23,7 @@
             <div class="enter addkeyWord" style="display: none;">
                 <input type="text" class="enterOne" maxlength="20" placeholder="请输入附加词" />
                 <div class="btn">
+                    <button onclick="Cancel()" style="width:49%;background:#fff;color:#2cb7ca;opacity: 1;">取消</button>
                     <button disabled>确认</button>
                 </div>
             </div>
@@ -37,7 +38,7 @@
                 疑问解答 <i class="iconfont icon-wenhao"></i>
             </div> 
         </section>
-        <div class="addKeyWord">
+        <div class="addKeyWord" style="display:none;">
             <i class="iconfont icon-tianjia"></i>
         </div>
         <!-- 疑难问题弹窗 -->
@@ -85,9 +86,19 @@
                 $(".showKeyWord").hide();
             }
         })
+		//
+		function Cancel(){
+			if($(".showKeyWord li").length==0){
+				window.history.go(-1)
+			}else{
+				$(".content .addkeyWord").hide();
+        		$(".addKeyWord").show();
+			}
+		}
         //
         function appendHtml(data){
             if (data.length>0){
+				$('.addKeyWord').show();
                 var additionHtml = '';
                 for (var i = data.length - 1; i >= 0; i--) {
 					addkws_arr[data[i]]=i
@@ -98,7 +109,7 @@
                                     +'<p class="key">'+data[i]+'</p>'
                                     +'</span>'
                                     +'</div>'
-                                    +'<button class="editKeyWord"><i class="iconfont icon-xiugai"></i> 修改</button>'
+                                    +'<button class="editKeyWord" dataIndex="'+i+'"><i class="iconfont icon-xiugai"></i> 修改</button>'
                                     +'</div>'
                                     +'<div class="modify">'
                                     +'<textarea  name=""  rows="1"  placeholder="" maxlength="20" >'+data[i]+'</textarea>'
@@ -116,19 +127,28 @@
             }
         }
         //
-        function saveSession(t){
+        function saveSession(t,i,index){
             if (_addkws!=""){
                 if(t!="D"){
-                    if(_addindex>=0){
-						addkws_arr[_addkws] = _addindex;
-                        addition_kws[_addindex] = _addkws
+                    if($(".showKeyWord li:first").find(".editKeyWord").attr("dataIndex")!=undefined&&i <= Number($(".showKeyWord li:first").find(".editKeyWord").attr("dataIndex"))){
+						for (var n in addkws_arr){
+							if(addkws_arr[n]==i){
+								delete addkws_arr[n];
+							}
+						}
+						addkws_arr[_addkws] = i;
+                        addition_kws[index] = _addkws
                     }else{
-						addkws_arr[_addkws] = addition_kws.length;
+						addkws_arr[_addkws] = i;
                         addition_kws.push(_addkws)
                     }
                 }else{
-					delete addkws_arr[_addkws];
-                    addition_kws.splice(_addindex,1)
+					for (var n in addkws_arr){
+						if(addkws_arr[n]==i){
+							delete addkws_arr[n];
+						}
+					}
+                    addition_kws.splice(index,1);
                 }
                 sessionStorage.addition_kws = JSON.stringify(addition_kws)
            }

+ 30 - 9
src/web/templates/weixin/vipsubscribe/exclusiveWord.html

@@ -23,6 +23,7 @@
             <div class="enter addkeyWord">
                 <input type="text" class="enterOne" maxlength="20" placeholder="请输入排除词" />
                 <div class="btn">
+				    <button onclick="Cancel()" style="width:49%;background:#fff;color:#2cb7ca;opacity: 1;">取消</button>
                     <button disabled>确认</button>
                 </div>
             </div>
@@ -36,7 +37,7 @@
                 疑问解答 <i class="iconfont icon-wenhao"></i>
             </div>
         </section>
-        <div class="addKeyWord">
+        <div class="addKeyWord" style="display:none;">
             <i class="iconfont icon-tianjia"></i>
         </div>
         <!-- 疑难问题弹窗 -->
@@ -84,9 +85,19 @@
                 $(".showKeyWord").hide();
             }
         })
+		//
+		function Cancel(){
+			if($(".showKeyWord li").length==0){
+				window.history.go(-1)
+			}else{
+				$(".content .addkeyWord").hide();
+        		$(".addKeyWord").show();
+			}
+		}
         //
         function appendHtml(data){
             if (data.length>0){
+				$('.addKeyWord').show();
                 var additionHtml = '';
                 for (var i = data.length - 1; i >= 0; i--) {
 					notkws_arr[data[i]]=i
@@ -97,7 +108,7 @@
                                     +'<p class="key">'+data[i]+'</p>'
                                     +'</span>'
                                     +'</div>'
-                                    +'<button class="editKeyWord"><i class="iconfont icon-xiugai"></i> 修改</button>'
+                                    +'<button class="editKeyWord" dataIndex="'+i+'"><i class="iconfont icon-xiugai"></i> 修改</button>'
                                     +'</div>'
                                     +'<div class="modify">'
                                     +'<textarea  name=""  rows="1"  placeholder="" maxlength="20" >'+data[i]+'</textarea>'
@@ -115,19 +126,29 @@
             }
         }
         //
-        function saveSession(t){
+        function saveSession(t,i,index){
             if (_notkws!=""){
                 if(t!="D"){
-                    if(_notindex>0){
-						notkws_arr[_notkws] = _notindex;
-                        not_kws[_notindex] = _notkws
+                    if($(".showKeyWord li:first").find(".editKeyWord").attr("dataIndex")!=undefined&&i <= Number($(".showKeyWord li:first").find(".editKeyWord").attr("dataIndex"))){
+						for (var n in notkws_arr){
+							if(notkws_arr[n]==i){
+								delete notkws_arr[n];
+							}
+						}
+						notkws_arr[_notkws] = i;
+                        not_kws[index] = _notkws
                     }else{
-						notkws_arr[_notkws] = not_kws.length;
+						notkws_arr[_notkws] = i;
                         not_kws.push(_notkws)
                     }
                 }else{
-					delete notkws_arr[_notkws];
-                    not_kws.splice(_notindex,1)
+					for (var n in notkws_arr){
+						console.log(n,i)
+						if(notkws_arr[n]==i){
+							delete notkws_arr[n];
+						}
+					}
+                    not_kws.splice(index,1)
                 }
                 sessionStorage.not_kws = JSON.stringify(not_kws)
            }

+ 59 - 25
src/web/templates/weixin/vipsubscribe/keyWord.html

@@ -138,6 +138,7 @@
                         <button onclick="tonotkey(this)">添加 排除词</button>
                     </div>
                     <div class="btn">
+                        <button onclick="Cancel()" style="width:49%;background:#fff;color:#2cb7ca;opacity: 1;">取消</button>
                         <button disabled>确认</button>
                     </div>
                 </div>
@@ -153,8 +154,8 @@
                 </div>
             </section>
 
-            <div class="addKeyWord addNewKeyword" style="display: none;">
-                <i class="iconfont icon-tianjia"></i>
+            <div class="addKeyWord addNewKeyword">
+                <i class="iconfont icon-tianjia"  style="display:none;"></i>
                 <p> 关键词添加数量:<em style="color: #2cb7ca;" class="kws_count">0 </em>/ 300</p>
             </div>
         </section>
@@ -164,7 +165,7 @@
                 
             </ul>
 
-            <div class="addKeyWord addNewKeyword" style="display: none;"><div class="addClassify">新增关键词分类</div></div>
+            <div class="addKeyWord addNewKeyword"><div class="addClassify">新增关键词分类</div></div>
         </section>
 
         <!-- 疑难问题弹窗 -->
@@ -251,6 +252,15 @@
             //是否第一次设置关键词
             isFirstSetKeyword: true
         }
+		//
+		function Cancel(){
+			if($(".showKeyWord li").length==0){
+				window.history.go(-1)
+			}else{
+				$(".content .addkeyWord").hide();
+                $(".add-keyword-container .addNewKeyword i").show();
+			}
+		}
 		//
 		function initSess(){
 			weui.loading();
@@ -339,7 +349,7 @@
                 modifyFlag = true;
                 kws_count = sessionStorage.kws_count;
                 $(".kws_count").text(kws_count);
-                $('.addKeyWord').hide();
+               $(".add-keyword-container .addNewKeyword i").hide();
                 toSetKws();
             }else{
                 //获取用户设置信息类型
@@ -380,11 +390,13 @@
             if (state) {
                 $('.add-keyword-container').show()
                 $('.all-classify-column').hide()
+            	$(".addClassify").hide();
             } else {
                 $('.add-keyword-container').hide()
                 $('.all-classify-column').show()
+            	$(".addClassify").show();
+                $(".add-keyword-container .addNewKeyword i").hide();
             }
-            $(".addNewKeyword").show();
         }
         //分类列表
         function appendHtml(kwsdata){
@@ -428,8 +440,10 @@
             var showKeyWordLength = $(".showKeyWord ul").find('li').length;
             if (showKeyWordLength === 0) {
                 $(".content .addkeyWord").show();
+				$(".add-keyword-container .addNewKeyword i").hide();
             } else {
                 $(".content .addkeyWord").hide();
+				$(".add-keyword-container .addNewKeyword i").show();
             }
         }
         //修改关键词内容
@@ -450,6 +464,7 @@
                 }
                 edhtml +='</div>'
                         +'<div class="btn">'
+						+'<button onclick="Cancel()" style="width:49%;background:#fff;color:#2cb7ca;opacity: 1;">取消</button>'
                         +'<button style="opacity: 1;">确认</button>'
                         +'</div>'
                 $(".enter.addkeyWord").html(edhtml);
@@ -554,7 +569,6 @@
         }
         //跳转附加词
         function toappendkey(th){
-			history.replaceState("","","/front/vipsubscribe/toSetKeyWordPage?page=242")
             if(!$('.enter.addkeyWord').is(':hidden')){
                 if($('.addkeyWord input.enterOne').val()==""){
                     return
@@ -567,12 +581,12 @@
                }
                 kws_name = $(th).parent(".modify").find("textarea").val();
             }
+			history.replaceState("","","/front/vipsubscribe/toSetKeyWordPage?page=243")
             setSesstion();
             window.location.href="/front/vipsubscribe/toSetadditionPage";
         }
         //
         function tonotkey(th){
-			history.replaceState("","","/front/vipsubscribe/toSetKeyWordPage?page=242")
             if(!$('.enter.addkeyWord').is(':hidden')){
                 if($('.addkeyWord input.enterOne').val()==""){
                     return
@@ -585,6 +599,7 @@
                }
                 kws_name = $(th).parent(".modify").find("textarea").val();
             }
+			history.replaceState("","","/front/vipsubscribe/toSetKeyWordPage?page=243")
             setSesstion();
             window.location.href='/front/vipsubscribe/toSetexclusivePage';
         }
@@ -621,10 +636,18 @@
         //保存关键词
         function saveK(th){
             var $this = $(th);
-			var yuan_index = $this.attr("dataIndex")
             kws_name = $(th).siblings('textarea').val();
-			console.log(kws_arr[kws_name])
-			if(kws_arr[kws_name]!=undefined&&kws_arr[kws_name]!=(yuan_index+"-"+classify_index)){
+			if(kws_name==""){
+                weui.toast('您设置的关键词不能为空,请调整后再添加。', {
+                    duration: 2000,
+                    className: 'custom-toast',
+                    callback: function () { console.log('close') }
+                });
+				return
+			}
+			var _index =  Number($this.attr("dataindex"));
+			console.log(kws_arr[kws_name],"--",_index)
+			if(kws_arr[kws_name]!=undefined&&kws_arr[kws_name]!=(_index+"-"+classify_index)){
                 weui.toast('您设置的关键词已存在,请调整后再添加。', {
                     duration: 2000,
                     className: 'custom-toast',
@@ -640,12 +663,12 @@
                 });
             }else{
                 if(saveData('SK')){
-					$this.attr("dataindex",kws_index);
+					//$this.attr("dataindex",kws_index);
                     $this.parent().siblings().find('.key').text(kws_name)
                     $this.parent().hide().siblings().show()
-                    $('.addKeyWord').show();
+                	$(".add-keyword-container .addNewKeyword i").show();
                     //
-                    doSessionData();
+                    doSessionData("",_index);
 		            //把kws_name,kws_index,addition_kws,not_kws初始化
 		            kws_index = 0;
 		            kws_name = "";
@@ -690,18 +713,17 @@
             });
             return _flag
         }
-        //处理缓存数据
-        function doSessionData(t){
+        //处理缓存数据  根据新索引和原索引操作----
+        function doSessionData(t,index){
             //删除关键词
             if(t!="DK"){
-				kws_arr[kws_name] = kws_index+"-"+classify_index
-                if(kws_index == $(".showKeyWord li").length){
+                if($(".showKeyWord li:first").find(".editKeyWord").attr("dataIndex")==undefined||index >= Number($(".showKeyWord li:first").find(".editKeyWord").attr("dataIndex"))){
                     //新加
                     var karr = {"key":kws_name.split(" "),"appendkey":addition_kws,"notkey":not_kws}
-                    var keyM = [];
-                    keyM.push(karr);
-                    var classifyArr = {"s_item":classify_name,"a_key":keyM}
-                    if (kws_index==0){
+                    if (index==0){
+                    	var keyM = [];
+                    	keyM.push(karr);
+                    	var classifyArr = {"s_item":classify_name,"a_key":keyM}
                         a_items.push(classifyArr);
                     }else{
                         a_items[classify_index]["a_key"].push(karr);
@@ -711,8 +733,20 @@
                     a_items[classify_index]["a_key"][kws_index]["appendkey"]= addition_kws
                     a_items[classify_index]["a_key"][kws_index]["notkey"]= not_kws
                 }
+					console.log(kws_name)
+				kws_arr[kws_name] = index+"-"+classify_index
             }else{
-				delete kws_arr[kws_name];
+				var akws = a_items[classify_index]["a_key"];
+				for (var n in akws){
+					console.log(akws[n]["key"])
+					var ky = akws[n]["key"].join(" ");
+					var sy = index+"-"+classify_index
+					console.log(kws_arr[ky]==sy,kws_arr[ky],sy)
+					if(kws_arr[ky]==sy){
+						delete kws_arr[ky];
+						break;
+					}
+				}
                 if (a_items[classify_index]["a_key"].length==1){
                     a_items.splice(classify_index,1);
                 }else{
@@ -778,7 +812,7 @@
                 $(".enter.addkeyWord").find(".btnChoose button").eq(1).html('添加 附加词');
                 $(".enter.addkeyWord").find("input").val("");
                 $(".enter.addkeyWord").show();
-                $(".add-keyword-container .addNewKeyword").hide();
+                $(".add-keyword-container .addNewKeyword i").hide();
                 setTimeout(function(){
                     modalOne();
                 },200)
@@ -794,9 +828,8 @@
                     // 还原有数据
                     $('.classify .classify-detail').text('未分类');
                     $('.add-keyword-container .showKeyWord ul').html('');
-                    
                 }
-                $(".add-keyword-container .addNewKeyword").hide();
+                $(".add-keyword-container .addNewKeyword i").hide();
                 $('.add-keyword-container').show();
                 $('.all-classify-column').hide();
                 
@@ -815,6 +848,7 @@
                 classify_name = $(this).find('.classify-item-l').text();
                 classify_index = $(this).index()
                 //展示此关键词信息
+				$(".add-keyword-container .addNewKeyword i").show();
                 toSetKws();
             })
         })

+ 2 - 2
src/web/templates/weixin/vipsubscribe/vip_index.html

@@ -191,7 +191,7 @@
                 if (hasChecked == false) {
                     $(that).addClass('checked');
                     weui.toast('项目匹配已开启',{
-                        duration: 3000,
+                        duration: 1000,
                         className: 'custom-toast',
                     })
 					setprojectmatch(1);
@@ -200,7 +200,7 @@
                     $('.custom-dialog').hide()
                     // $('#auto_renew').hide(500);
                     weui.toast('项目匹配已关闭',{
-                        duration: 3000,
+                        duration: 1000,
                         className: 'custom-toast',
                     })
 					setprojectmatch(0);