Forráskód Böngészése

Merge branch 'dev2.5.6' of http://192.168.3.207:10080/qmx/jy into dev2.5.6

zhangxinlei1996 6 éve
szülő
commit
bcc8b67e5e

+ 1 - 1
src/jfw/front/dataExport.go

@@ -505,7 +505,7 @@ func (d *DataExport) ToCreateOrderPage(_id string) error {
 	}
 	//手机号
 	phone := d.GetSession("DataExportVerifyPhone_val")
-	if phone != nil {
+	if phone != nil && phone != "" {
 		d.T["phone"] = phone
 	} else {
 		if isPhone(openid) {

+ 1 - 1
src/jfw/front/pchelper.go

@@ -328,7 +328,7 @@ func (l *PcHelper) PushView() error {
 		if lasttime == 1 {
 			lasttime = time.Now().Local().Unix()
 		}
-		thistime, list := getHistorypush(lasttime, 0, myopenid, nil, 0)
+		thistime, list := getHistorypush(lasttime, 0, myopenid, nil, 0, nil)
 		log.Println(logPrefix, "PushView-getHistorypush-size", len(*list))
 		if list != nil && len(*list) > 0 {
 			res["success"] = true

+ 7 - 6
src/jfw/front/swordfish.go

@@ -2635,7 +2635,7 @@ func (f *Front) HasPushHistory() {
 	} else {
 		haskey = true
 	}
-	thistime, list := getHistorypush(nowUnix, 0, myopenid, nil, 0)
+	thistime, list := getHistorypush(nowUnix, 0, myopenid, nil, 0, nil)
 	if haskey && (list == nil || len(*list) == 0) {
 		list = &[]map[string]interface{}{}
 		flag, data := makeHistoryDatas(util.BsonIdToSId((*user)["_id"]), myopenid, o_jy)
@@ -2714,7 +2714,7 @@ func (f *Front) HistorypushPaging() error {
 		if lasttime == 1 {
 			lasttime = time.Now().Local().Unix()
 		}
-		thistime, list := getHistorypush(lasttime, 0, myopenid, nil, 0)
+		thistime, list := getHistorypush(lasttime, 0, myopenid, nil, 0, nil)
 		if list != nil && len(*list) > 0 {
 			res["success"] = true
 			res["data"] = &list
@@ -2724,7 +2724,7 @@ func (f *Front) HistorypushPaging() error {
 	f.ServeJson(&res)
 	return nil
 }
-func getHistorypush(lasttime, infotime int64, openid string, res []map[string]interface{}, count int) (thistime int64, list *[]map[string]interface{}) {
+func getHistorypush(lasttime, infotime int64, openid string, res []map[string]interface{}, count int, vsidList []string) (thistime int64, list *[]map[string]interface{}) {
 	if lasttime < time.Now().Unix()-60*24*60*60 { //最多查询最近60天数据
 		return lasttime, &res
 	}
@@ -2746,8 +2746,9 @@ func getHistorypush(lasttime, infotime int64, openid string, res []map[string]in
 		//			"isopen": true,
 		//		})
 		//获取已浏览记录
-		visited := cassandra.Search("select vsid from jy_pushvisit where openid=? and pdate<? limit 100", openid, date)
-		vsidList := []string{}
+		dateend := date - 24*60*60
+		visited := cassandra.Search("select vsid from jy_pushvisit where openid=? and pdate<? and pdate>? limit 50", openid, date, dateend)
+		//		vsidList := []string{}
 		for _, v := range visited {
 			vsidList = append(vsidList, (v["vsid"]).(string))
 			//			log.Println("vsidList", vsidList)
@@ -2808,7 +2809,7 @@ func getHistorypush(lasttime, infotime int64, openid string, res []map[string]in
 			infotime = 24 * 60 * 60
 		}
 	}
-	return getHistorypush(thistime, infotime, openid, res, count)
+	return getHistorypush(thistime, infotime, openid, res, count, vsidList)
 }
 
 //电脑端招标订阅

+ 14 - 12
src/jfw/modules/app/src/app/front/swordfish.go

@@ -770,7 +770,7 @@ func (f *Front) HasPushHistory() {
 	} else {
 		haskey = true
 	}
-	thistime, list := getHistorypush(nowUnix, 0, myopenid, nil, 0)
+	thistime, list := getHistorypush(nowUnix, 0, myopenid, nil, 0, nil)
 	if haskey && (list == nil || len(*list) == 0) {
 		list = &[]map[string]interface{}{}
 		flag, data := makeHistoryDatas(util.BsonIdToSId((*user)["_id"]), myopenid, o_jy)
@@ -815,7 +815,7 @@ func (f *Front) HistorypushPaging() error {
 			isFirstPage = true
 			lasttime = time.Now().Local().Unix()
 		}
-		thistime, list := getHistorypush(lasttime, 0, myopenid, nil, 0)
+		thistime, list := getHistorypush(lasttime, 0, myopenid, nil, 0, nil)
 		if list != nil && len(*list) > 0 {
 			if isFirstPage {
 				go updateUserApppushunread(myopenid)
@@ -828,7 +828,7 @@ func (f *Front) HistorypushPaging() error {
 	f.ServeJson(&res)
 	return nil
 }
-func getHistorypush(lasttime, infotime int64, openid string, res []map[string]interface{}, count int) (thistime int64, list *[]map[string]interface{}) {
+func getHistorypush(lasttime, infotime int64, openid string, res []map[string]interface{}, count int, vsidList []string) (thistime int64, list *[]map[string]interface{}) {
 	if lasttime < time.Now().Unix()-60*24*60*60 { //最多查询最近60天数据
 		return lasttime, &res
 	}
@@ -844,13 +844,15 @@ func getHistorypush(lasttime, infotime int64, openid string, res []map[string]in
 	//	log.Println("date", date)
 	if date > 0 {
 		//获取已浏览记录
-		visited := ca.Search("select vsid from jy_pushvisit where openid=? and pdate<? limit 100", openid, date)
-		vsidList := []string{}
-		for _, v := range visited {
-			vsidList = append(vsidList, (v["vsid"]).(string))
-			//			log.Println("vsidList", vsidList)
+		dateend := date - 24*60*60
+		visited := ca.Search("select vsid from jy_pushvisit where openid=? and pdate<? and pdate>? limit 50", openid, date, dateend)
+		//		vsidList := []string{}
+		if len(visited) > 0 {
+			for _, v := range visited {
+				vsidList = append(vsidList, (v["vsid"]).(string))
+				//			log.Println("vsidList", vsidList)
+			}
 		}
-
 		dateshort := util.FormatDateByInt64(&lasttime, util.Date_Short_Layout)
 		pinfo := ca.Search("select * from jy_push where id=? and openid=? and date<?", dateshort, openid, lasttime+infotime)
 		if len(pinfo) > 0 {
@@ -858,7 +860,6 @@ func getHistorypush(lasttime, infotime int64, openid string, res []map[string]in
 				info["visit"] = vsidList
 				//				log.Println("info", info)
 				tmp := changeMapKeyForCass(info)
-				//		m.T["data"] = val
 				if ats, ok := tmp["o_pushinfo"].(map[string]interface{}); ok {
 					thistime = util.Int64All(tmp["l_date"])
 					count += len(ats)
@@ -906,7 +907,7 @@ func getHistorypush(lasttime, infotime int64, openid string, res []map[string]in
 			infotime = 24 * 60 * 60
 		}
 	}
-	return getHistorypush(thistime, infotime, openid, res, count)
+	return getHistorypush(thistime, infotime, openid, res, count, vsidList)
 }
 
 func MFollow(userId, pname, pcode, title, openid string) (bool, string) {
@@ -1062,11 +1063,12 @@ func (m *Front) WxpushAjaxReq() error {
 	defer util.Catch()
 	vsid := m.GetString("vsid")
 	pdate := m.GetString("_id")
+	openid := m.Session().Get("s_m_openid")
 	//	log.Println("vsid", vsid)
 	//	log.Println("pdate", pdate)
 	if util.Int64All(pdate) > 0 {
 		visit := map[string]interface{}{
-			"openid": m.Session().Get("s_m_openid"),
+			"openid": openid,
 			"pdate":  pdate,
 			"vsid":   vsid,
 			"date":   time.Now(),

+ 1 - 1
src/jfw/modules/app/src/web/staticres/jyapp/css/wxlist.css

@@ -1,6 +1,6 @@
 /*列表样式*/
 .tslist .bt{
-	color:#1d1d1d;
+	color: #1d1d1d;
 	text-decoration: none;
 	word-break: break-all;
 }

+ 3 - 3
src/jfw/modules/app/src/web/templates/weixin/historypush.html

@@ -4,7 +4,7 @@
 <title>招标订阅</title>
 {{include "/common/inc.html"}}
 <link href="/jyapp/css/dropload.css?v={{Msg "seo" "version"}}" rel="stylesheet">
-<link href="/jyapp/css/wxlist.css?v={{Msg "seo" "version"}}" rel="stylesheet">
+<link href="/jyapp/css/wxlist.css?v={{Msg "seo" "version"}}3" rel="stylesheet">
 <script src="/jyapp/js/jquery.js"></script>
 <script src="/jyapp/js/dropload.js?v={{Msg "seo" "version"}}"></script>
 <script src="/jyapp/js/fastclick.js?v={{Msg "seo" "version"}}"></script>
@@ -119,7 +119,7 @@ function initpage(){
 			noMoreData(wxflag,1);
 		}
 		$(window).scrollTop(scrollTop);
-		// sessionStorage.removeItem("historypushDataCache");
+		sessionStorage.removeItem("historypushDataCache");
 		sessionStorage.removeItem("historypushListCache");
 		sessionStorage.removeItem("historypushTableCache");
 		sessionStorage.removeItem("historypushLasttimeCache");
@@ -554,7 +554,7 @@ function setSessionStorage(){
 
 function setVisitedIndex(obj,eid){
 	// console.log(obj.hasClass("visited")+"--------");
-	if(obj.find("a.bt").hasClass("visit")||obj.hasClass("visited")){
+	if(obj.find("a.bt").hasClass("visited")||obj.hasClass("visited")){
 		return;
 	}
 	obj.find("a.bt").addClass("visited");

+ 67 - 9
src/jfw/pay/weixin.go

@@ -301,12 +301,76 @@ func (p *WxPayAction) SacnPay_CreateOrder() {
 		})
 		return
 	}
+	//
+	data_spec := p.GetString("data_spec")
+	if data_spec == "standard" {
+		data_spec = "标准字段包"
+	} else if data_spec == "senior" {
+		data_spec = "高级字段包"
+	}
+	user_mail, _ := p.GetSession("DataExportVerifyEmail_val").(string)
+	user_phone, _ := p.GetSession("DataExportVerifyPhone").(string)
+	if user_phone != "" {
+		p.SetSession("DataExportVerifyPhone_val", user_phone) //提交后下次默认带出手机号
+	} else {
+		user_phone, _ = p.GetSession("DataExportVerifyPhone_val").(string)
+	}
 	//先看有没有创建过预支付订单
 	oldOrder := public.Mysql.FindOne("dataexport_order", map[string]interface{}{
 		"user_openid": openId,
 		"filter_id":   id,
-	}, "id,order_status,order_code,order_money", "")
+	}, "id,order_status,order_code,order_money,user_mail,user_phone,data_spec,prepay_time", "")
 	if oldOrder != nil {
+		if user_mail != "" && user_mail != util.ObjToString((*oldOrder)["user_mail"]) {
+			public.Mysql.Update("dataexport_order", map[string]interface{}{
+				"user_openid": openId,
+				"filter_id":   id,
+			}, map[string]interface{}{
+				"user_mail": user_mail,
+			})
+		}
+		if user_phone != "" && user_phone != util.ObjToString((*oldOrder)["user_phone"]) {
+			public.Mysql.Update("dataexport_order", map[string]interface{}{
+				"user_openid": openId,
+				"filter_id":   id,
+			}, map[string]interface{}{
+				"user_phone": user_phone,
+			})
+		}
+		if data_spec != "" && data_spec != util.ObjToString((*oldOrder)["data_spec"]) {
+			//
+			data_count := public.GetDataExportSearchCountUseId(id)
+			if data_count > public.ExConf.MsgMaxCount {
+				data_count = public.ExConf.MsgMaxCount
+			}
+			order_money_, original_price_ := float64(0), float64(0)
+			if data_spec == "标准字段包" {
+				original_price_ = float64(data_count) * public.ExConf.UnitPrice_normal
+			} else if data_spec == "高级字段包" {
+				original_price_ = float64(data_count) * public.ExConf.UnitPrice_senior
+			}
+			order_money_ = float64(original_price_) * public.ExConf.Discount
+			if order_money_ < public.ExConf.OrderMinPrice {
+				order_money_ = public.ExConf.OrderMinPrice
+			}
+			if original_price_ < public.ExConf.OrderMinPrice {
+				original_price_ = public.ExConf.OrderMinPrice
+			}
+			order_money := int(order_money_ * 100)
+			original_price := int(original_price_ * 100)
+			prepayTime, _ := time.ParseInLocation(util.Date_Full_Layout, util.ObjToString((*oldOrder)["prepay_time"]), time.Local)
+			surplus_second := prepayTime.Unix() - 7200 //价格变动  支付二维码更新成超时状态--重新生订单二维码
+			public.Mysql.Update("dataexport_order", map[string]interface{}{
+				"user_openid": openId,
+				"filter_id":   id,
+			}, map[string]interface{}{
+				"data_spec":      data_spec,
+				"order_money":    order_money,
+				"original_price": original_price,
+				"prepay_time":    util.FormatDateByInt64(&surplus_second, util.Date_Full_Layout),
+			})
+			(*oldOrder)["order_money"] = order_money
+		}
 		if util.IntAll((*oldOrder)["order_status"]) == 0 {
 			p.ServeJson(map[string]interface{}{
 				"status": "y",
@@ -322,11 +386,7 @@ func (p *WxPayAction) SacnPay_CreateOrder() {
 			return
 		}
 	}
-	//
-	user_mail, _ := p.GetSession("DataExportVerifyEmail_val").(string)
-	user_phone, _ := p.GetSession("DataExportVerifyPhone_val").(string)
 	user_mail_status := p.GetSession("EMVerifySucess").(bool)
-	data_spec := p.GetString("data_spec")
 	pay_way := p.GetString("pay_way")
 	//
 	data_count := public.GetDataExportSearchCountUseId(id)
@@ -334,11 +394,9 @@ func (p *WxPayAction) SacnPay_CreateOrder() {
 		data_count = public.ExConf.MsgMaxCount
 	}
 	order_money_, original_price_ := float64(0), float64(0)
-	if data_spec == "standard" {
-		data_spec = "标准字段包"
+	if data_spec == "标准字段包" {
 		original_price_ = float64(data_count) * public.ExConf.UnitPrice_normal
-	} else if data_spec == "senior" {
-		data_spec = "高级字段包"
+	} else if data_spec == "高级字段包" {
 		original_price_ = float64(data_count) * public.ExConf.UnitPrice_senior
 	}
 	order_money_ = float64(original_price_) * public.ExConf.Discount

+ 1 - 1
src/web/staticres/css/wxlist.css

@@ -1,6 +1,6 @@
 /*列表样式*/
 .tslist .bt{
-	color:#1d1d1d;
+	color: #1d1d1d;
 	text-decoration: none;
 	word-break: break-all;
 }

+ 24 - 4
src/web/templates/pc/createOrderPage.html

@@ -47,7 +47,7 @@
         <div class="guige">
             <div class="title">数据规格<i id="exp" class="iconfont icon-bangzhu"></i></div>
             <div class="inner clearfix switch-dataType">
-                <div class="bz no-select active">
+                <div class="bz no-select">
                     <p>标准字段包</p>
                     <p>
                         <del>{{.T.unitPrice_normal}}元/条</del>&nbsp;<span>{{.T.unitPrice_normal_final}}元/条</span></p>
@@ -169,10 +169,23 @@
 		//数据展示
 		var showCount=FormatNum(msgCount);
 		$(".msgCount").text(showCount);
-		
+		if (sessionStorage.getItem("order_spec"+{{.T._id}})!=null){
+			dataType = sessionStorage.getItem("order_spec"+{{.T._id}});
+		}
+		if(dataType==1){
+			$(".switch-dataType .bz").addClass("active")
+			$(".switch-dataType .gj").removeClass("active")
+		}else{
+			$(".switch-dataType .bz").removeClass("active")
+			$(".switch-dataType .gj").addClass("active")
+		}
 		ChangePayMoney();
 
-		if(email_lastInput!=""){
+		if (sessionStorage.getItem("order_email"+{{.T._id}})!=null){
+			$(".email_check_ok").show();
+			$(".email_input").val(sessionStorage.getItem("order_email"+{{.T._id}}));
+			finishEmailVerity=true;
+		}else if(email_lastInput!=""){
 			$(".email_check_ok").show();
 			$(".email_input").val(email_lastInput);
 			finishEmailVerity=true;
@@ -180,7 +193,11 @@
 		if(email_lastVerity>0){
 			sendemailTimer(email_lastVerity);
 		}
-		if(phone_lastInput!=""){
+		if (sessionStorage.getItem("order_phone"+{{.T._id}})!=null){
+			$(".phone_check_ok").show();
+			$(".phone_input").val(sessionStorage.getItem("order_phone"+{{.T._id}}));
+			finishPhoneVerity=true;
+		}else if(phone_lastInput!=""){
 			$(".phone_check_ok").show();
 			$(".phone_input").val(phone_lastInput);
 			finishPhoneVerity=true;
@@ -396,6 +413,9 @@
 			
 			$.post("/weixin/sacnPay/createOrder",param,function(data){
 				if(data.status=="y"){
+					sessionStorage.setItem("order_spec"+{{.T._id}}, dataType);
+					sessionStorage.setItem("order_email"+{{.T._id}}, $(".email_input").val().replace(/\s*/g,""));
+					sessionStorage.setItem("order_phone"+{{.T._id}}, $(".phone_input").val().replace(/\s*/g,""));
 					window.location.href="/weixin/sacnPay/waitPay?code="+data.code+"&token="+data.token;
 				}else{
 					canpay=true;

+ 2 - 3
src/web/templates/weixin/historypush.html

@@ -4,7 +4,7 @@
 <title>招标订阅</title>
 {{include "/common/inc.html"}}
 <link href="{{Msg "seo" "cdn"}}/css/dropload.css?v={{Msg "seo" "version"}}" rel="stylesheet">
-<link href="{{Msg "seo" "cdn"}}/css/wxlist.css?v={{Msg "seo" "version"}}" rel="stylesheet">
+<link href="{{Msg "seo" "cdn"}}/css/wxlist.css?v={{Msg "seo" "version"}}3" rel="stylesheet">
 {{include "/common/weixin.html"}}
 <script src="/js/jquery.js"></script>
 <script src="{{Msg "seo" "cdn"}}/wxswordfish/share.js?v={{Msg "seo" "version"}}"></script>
@@ -508,7 +508,7 @@ function setSessionStorage(){
 
 function setVisitedIndex(obj,eid){
 	// console.log(obj.hasClass("visited")+"--------");
-	if(obj.find("a.bt").hasClass("visit")||obj.hasClass("visited")){
+	if(obj.find("a.bt").hasClass("visited")||obj.hasClass("visited")){
 		return;
 	}
 	obj.find("a.bt").addClass("visited");
@@ -681,7 +681,6 @@ a{
 	color: #fff;
 	font-size: 1.2rem;
 }
-
 .visited{
 	color: #a0a0a0 !important;
 }