Browse Source

修改剑鱼积分

renzheng 9 years ago
parent
commit
d0aa6d7faf

+ 0 - 1
common/src/qfw/util/credit/credit.go

@@ -3,7 +3,6 @@ package credit
 
 
 import (
 import (
 	"fmt"
 	"fmt"
-	"github.com/go-xweb/xweb"
 	"qfw/util"
 	"qfw/util"
 	mogo "qfw/util/mongodb"
 	mogo "qfw/util/mongodb"
 	"qfw/util/rpc"
 	"qfw/util/rpc"

+ 3 - 2
core/src/qfw/coreutil/weixinrpc_test.go

@@ -107,9 +107,10 @@ func Test_credit(t *testing.T) {
 	client, _ := rpc.DialHTTP("tcp", "127.0.0.1:8765")
 	client, _ := rpc.DialHTTP("tcp", "127.0.0.1:8765")
 	defer client.Close()
 	defer client.Close()
 	data := qrpc.CreditData{}
 	data := qrpc.CreditData{}
-	data.Code = "d1"
+	data.Code = "b2"
 	data.Uid = "55a39942af53740186000004"
 	data.Uid = "55a39942af53740186000004"
-	data.Num = 3000
+	//data.Num = 3000
 	var reply int
 	var reply int
 	client.Call("CreditRpc.InCreadit", &data, &reply)
 	client.Call("CreditRpc.InCreadit", &data, &reply)
+	log.Println("reply:", reply)
 }
 }

+ 3 - 2
core/src/qfw/mobile/wxmenu.go

@@ -94,7 +94,7 @@ func getMsgSetById(userId string) map[string]interface{} {
 }
 }
 
 
 //扣分操作
 //扣分操作
-func (m *Mobile) SwordfishPay() {
+func (m *Mobile) SwordfishPay() error {
 	userId := m.GetSession("userId")
 	userId := m.GetSession("userId")
 	res := map[string]interface{}{}
 	res := map[string]interface{}{}
 	if userId != nil {
 	if userId != nil {
@@ -156,7 +156,8 @@ func (m *Mobile) SwordfishPay() {
 	} else {
 	} else {
 		res["flag"] = false
 		res["flag"] = false
 	}
 	}
-
+	m.ServeJson(&res)
+	return nil
 }
 }
 
 
 //剑鱼保存
 //剑鱼保存

+ 1 - 1
core/src/timetask.json

@@ -1 +1 @@
-{"comment":{"c_rate":10,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-01-15 13:30:53"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-01-15 13:30:53"}},"marketisstart":true,"marketrate":300}
+{"comment":{"c_rate":10,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-01-15 15:10:53"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-01-15 15:10:53"}},"marketisstart":true,"marketrate":300}

+ 68 - 21
core/src/web/staticres/wxswordfish/main.js

@@ -1,6 +1,5 @@
 //招标公告
 //招标公告
 var Tender = {
 var Tender = {
-	status:false,
 	keyWordDialog: null,
 	keyWordDialog: null,
 	getKeyWordDialog: function(clickLi){
 	getKeyWordDialog: function(clickLi){
 		if(this.keyWordDialog == null){
 		if(this.keyWordDialog == null){
@@ -18,7 +17,6 @@ var Tender = {
 };
 };
 //中标公告
 //中标公告
 var Bid = {
 var Bid = {
-	status:false,
 	keyWordDialog: null,
 	keyWordDialog: null,
 	getKeyWordDialog: function(clickLi){
 	getKeyWordDialog: function(clickLi){
 		if(this.keyWordDialog == null){
 		if(this.keyWordDialog == null){
@@ -153,10 +151,70 @@ function getCredit(){
 }
 }
 var snopshot=[];
 var snopshot=[];
 
 
-function showSnopshot(){
+function showAlls(){
+	var n=0,str=[];
+	for(var i in snopshot){
+		if(snopshot[i]){
+			n++;
+			str.push((i=="tender")?"招标公告":"中标公告")
+		}
+	}
+	if(n>0){
+		var num=getCredit();
+		var pay=1000*n, rem=num-pay,strs="扣除后将剩余"+rem+"积分";
+		if(rem<0){
+			$("#credit_yes").hide()
+			strs="请充值或去赚积分。";
+		}
+		$("#txt_tip").text("您添加了"+n+"个信息栏目("+str.join("、")+"),确认后系统将每月扣除"+pay+"积分,您目前的积分余额是"+num+"积分,"+strs)
+		$(".visible").show()
+	}else{
+		$(".visible").hide()		
+	}
+}
+
+function showSnopshot(module,type,on){
 	//提示扣积分
 	//提示扣积分
-	alert(getCredit())
-	$(".credit-tip").show()
+	//alert(getCredit())
+	if(type==0){//初始化
+		//是开启状态
+		if (!eval("msgset."+module+".i_status")){
+			snopshot[module]=true
+			showAlls()
+		}
+	}else if(type==1){//提交修改时
+		if(on){
+			if(module=="tender"){
+				if(typeof(msgset.tender) != "undefined"){
+					if(!msgset.tender.i_status){
+						if (!msgset.tender.i_status){
+							snopshot[module]=true
+						}else{
+							snopshot[module]=false
+						}
+					}
+				}else{
+					snopshot[module]=true
+				}
+			}else if(module=="bid"){
+				if(typeof(msgset.bid) != "undefined"){
+					if(!msgset.bid.i_status){
+						if (!msgset.bid.i_status){
+							snopshot[module]=true
+						}else{
+							snopshot[module]=false
+						}
+					}
+				}else{
+					snopshot[module]=true
+				}
+			}
+			showAlls()
+		}else{
+			snopshot[module]=false
+			showAlls()
+		}		
+	}
 }
 }
 
 
 function commonAjaxReq(object,module){
 function commonAjaxReq(object,module){
@@ -167,21 +225,9 @@ function commonAjaxReq(object,module){
 	};
 	};
 	if($("#"+module+"-on-off").hasClass("open")){
 	if($("#"+module+"-on-off").hasClass("open")){
 		//开服务要校验
 		//开服务要校验
-		if(module=="tender"){
-			if(typeof(msgset.tender) != "undefined"){
-				if(!msgset.tender.i_switchstatus){
-					snopshot["tender"]=true	
-					showSnopshot()
-				}
-			}
-		}else if(module=="bid"){
-			if(typeof(msgset.bid) != "undefined"){
-				if(!msgset.bid.i_switchstatus){
-					snopshot["bid"]=true
-					showSnopshot()	
-				}
-			}
-		}
+		showSnopshot(module,1,1)
+	}else{
+		showSnopshot(module,1,0)
 	}
 	}
 	var keysString = "",scopeString = "";
 	var keysString = "",scopeString = "";
 	var thisClass = this;
 	var thisClass = this;
@@ -318,7 +364,7 @@ $(function(){
 		if(msgset.tender.i_switchstatus){
 		if(msgset.tender.i_switchstatus){
 			turnOn($("#tender-on-off"));
 			turnOn($("#tender-on-off"));
 			//判断要不要还原提示
 			//判断要不要还原提示
-			if
+			showSnopshot("tender",0)
 		}
 		}
 	}
 	}
 	if(typeof(msgset.bid) != "undefined"){
 	if(typeof(msgset.bid) != "undefined"){
@@ -327,6 +373,7 @@ $(function(){
 		if(msgset.bid.i_switchstatus){
 		if(msgset.bid.i_switchstatus){
 			turnOn($("#bid-on-off"));
 			turnOn($("#bid-on-off"));
 			//判断要不要还原提示
 			//判断要不要还原提示
+			showSnopshot("bid",0)
 		}
 		}
 	}
 	}
 	//开关
 	//开关

+ 1 - 1
core/src/web/templates/swordfish/wxrssset.html

@@ -16,7 +16,7 @@
 <body>
 <body>
 <div class="credit-tip visible">
 <div class="credit-tip visible">
 	<div class="tip">
 	<div class="tip">
-		<div>您添加了1个信息栏目(招标公告),确认后系统将每月扣除1000积分,您目前的积分余额是1500积分,扣除后将剩余500积分。</div>
+		<div id="txt_tip"></div>
 		<div class="tip-button">
 		<div class="tip-button">
 		<span id="credit_yes">提交</span>
 		<span id="credit_yes">提交</span>
 		<span id="credit_no">取消</span>
 		<span id="credit_no">取消</span>