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

Merge branch 'dev4.6.2.17' of http://192.168.3.207:8080/qmx/jy into dev4.6.2.17

zhangyuhan 3 éve
szülő
commit
a5e3168111

+ 6 - 2
src/jfw/modules/app/src/web/templates/weixin/wxinfocontent.html

@@ -1305,7 +1305,7 @@
                               .catch(() => {})
                               return
                             }else{
-                              window.fileNum = window.fileNum - 1;
+                              //window.fileNum = window.fileNum - 1;
                               gotoFilePageOfVip($(this).find('a').text())
                               return
                             }
@@ -1370,8 +1370,12 @@
             },
             success: function (r) {
                 if (r && r.m === '' && r.r) {
-                    var url = r.r.downurl
+                    var url = r.r.downUrl
                     if (url){
+                      if (!r.r.isExists){
+                        window.fileNum = window.fileNum - 1;
+                        $('.file-count').html($('.file-count').text()-1)
+                      }
                         if(mySysIsIos()){
                             iosShow(url)
                         } else {

+ 0 - 2
src/jfw/modules/bigmember/src/service/use/use.go

@@ -624,12 +624,10 @@ func (u *Use) IsAdd() {
 		var notBigFileBool = bigPower.Status <= 0 || !bigPower.PowerMap[3]
 		//超级订阅非大会员用户附件下载本月可用次数
 		uk := qu.If(notBigFileBool && bigPower.VipStatus > 0 && bigPower.Vip_BuySet.Upgrade == 1, "v", "f").(string)
-
 		//附件下载包的剩余次数
 		filePackKey := fmt.Sprintf(jy.FilePackNumKey, userid, fmt.Sprint(time.Now().Month()))
 		filePackNum := redis.GetInt(jy.PowerCacheDb, filePackKey)
 		d["fileNum"] = config.Config.FileUploadNum[uk] - redis.GetInt(jy.PowerCacheDb, fmt.Sprintf(jy.VipFileUploadNumKey, userid, fmt.Sprint(time.Now().Month()))) + filePackNum
-		//
 		//新用户->新订阅设置页面
 		if config.Config.NewFreeUser < bigPower.Registedate {
 			d["isUpgrade"] = true

+ 10 - 8
src/jfw/modules/subscribepay/src/entity/basePack.go

@@ -47,6 +47,7 @@ func (this *UseBalanceStruct) fileConsume() (r map[string]interface{}, m string)
 			delete(this.Remarks, "id")
 			delete(this.Remarks, "title")
 			r = this.Remarks
+			r["isExists"] = true
 			isExists = true
 		}
 		//当月未有消费记录
@@ -63,8 +64,8 @@ func (this *UseBalanceStruct) fileConsume() (r map[string]interface{}, m string)
 			}
 			if isCanConsume_f || isCanConsume_p {
 				r = fileAttachRpc(_fileName, _id)
-				if r["downurl"] != nil {
-					this.Remarks["downUrl"] = r["downurl"]
+				if r["downUrl"] != nil {
+					this.Remarks["downUrl"] = r["downUrl"]
 					this.Remarks["size"] = r["size"]
 					if isCanConsume_p {
 						//中台消费记录
@@ -110,10 +111,11 @@ var jyCC = "jy_consumepack"
 //查询jy 消费日志记录
 func (this *UseBalanceStruct) FindJyConsumePackRecord() bool {
 	query := map[string]interface{}{
-		"s_id":      this.Remarks["id"],
-		"s_userId":  this.UserId,
-		"s_product": this.Name,
-		"s_month":   time.Now().Format("2006-01"),
+		"s_id":       this.Remarks["id"].(string),
+		"s_userId":   this.UserId,
+		"s_product":  this.Name,
+		"s_month":    time.Now().Format("2006-01"),
+		"s_fileName": this.Remarks["fileName"].(string),
 	}
 	res, ok := util.MQFW.FindOne(jyCC, query)
 	if ok && res != nil {
@@ -161,8 +163,8 @@ func fileAttachRpc(fileName, id string) (r map[string]interface{}) {
 			for _, v := range rep.Rep {
 				if qutil.ObjToString(v["filename"]) == fileName {
 					r = map[string]interface{}{
-						"downurl":  qutil.ObjToString(v["downurl"]),
-						"filename": qutil.ObjToString(v["filename"]),
+						"downUrl":  qutil.ObjToString(v["downurl"]),
+						"fileName": qutil.ObjToString(v["filename"]),
 						"size":     qutil.ObjToString(v["size"]),
 					}
 					break

+ 0 - 41
src/jfw/modules/subscribepay/src/entity/basePackAPI.go

@@ -1,41 +0,0 @@
-package entity
-
-import (
-	"config"
-	"fmt"
-	"log"
-	"net/url"
-	qutil "qfw/util"
-)
-
-//账户信息
-func (this *UseBalanceStruct) accountPack() (payCount int) {
-	resMap, err := commonPost(config.JyApiConfig.ApiList.FindBalance, url.Values{
-		"accountId":    []string{this.UserId}, //账户标识*
-		"resourceType": []string{this.Name},   //产品名称
-	})
-	if err != nil {
-		log.Println(fmt.Sprintf("查看账户信息异常:%s,%s"), this.UserId, this.Name)
-		payCount = -1
-		return
-	}
-	listObj, ok := resMap["data"].([]interface{})
-	if !ok {
-		log.Println(fmt.Errorf("packAccount 请求中台返回数据结构异常"))
-		payCount = -1
-		return
-	}
-	if len(listObj) > 0 {
-		for _, obj := range listObj {
-			packMap := qutil.ObjToMap(obj)
-			if packMap == nil || len(*packMap) == 0 {
-				continue
-			}
-			if packType := qutil.ObjToString((*packMap)["name"]); packType != this.Name {
-				continue
-			}
-			payCount = qutil.IntAll((*packMap)["number"]) //总量
-		}
-	}
-	return
-}

+ 32 - 0
src/jfw/modules/subscribepay/src/entity/commonApi.go

@@ -224,3 +224,35 @@ func (this *UpdateVipTimeStruct) UpdateVipEndTime() (bool, error) {
 	log.Println(resMap)
 	return ok, nil
 }
+
+//账户信息
+func (this *UseBalanceStruct) accountPack() (payCount int) {
+	resMap, err := commonPost(config.JyApiConfig.ApiList.FindBalance, url.Values{
+		"accountId":    []string{this.UserId}, //账户标识*
+		"resourceType": []string{this.Name},   //产品名称
+	})
+	if err != nil {
+		log.Println(fmt.Sprintf("查看账户信息异常:%s,%s", this.UserId, this.Name))
+		payCount = -1
+		return
+	}
+	listObj, ok := resMap["data"].([]interface{})
+	if !ok {
+		log.Println(fmt.Errorf("packAccount 请求中台返回数据结构异常"))
+		payCount = -1
+		return
+	}
+	if len(listObj) > 0 {
+		for _, obj := range listObj {
+			packMap := qu.ObjToMap(obj)
+			if packMap == nil || len(*packMap) == 0 {
+				continue
+			}
+			if packType := qu.ObjToString((*packMap)["name"]); packType != this.Name {
+				continue
+			}
+			payCount = qu.IntAll((*packMap)["number"]) //总量
+		}
+	}
+	return
+}

+ 1 - 1
src/jfw/modules/subscribepay/src/service/basePack.go

@@ -20,7 +20,7 @@ func (this *ResourcePack) ConsumePack() {
 			return nil, "请求方式有误"
 		}
 		platform := this.GetString("platform")
-		if productName == "" {
+		if productName == "" || this.GetString("id") == "" {
 			return nil, "参数有误"
 		}
 		vipMsg := jy.GetBigVipUserBaseMsg(userId, util.Mysql, util.MQFW)

+ 1 - 1
src/jfw/modules/subscribepay/src/util/jylog.go

@@ -30,7 +30,7 @@ var LogPath = "./jylog"
 func init() {
 	os.Mkdir(LogPath, os.ModePerm)
 	//默认保留15天内的日志,-1为永久保留
-	// initLog(15)
+	initLog(15)
 }
 
 func initLog(saveDay int) {

+ 37 - 10
src/web/templates/pc/biddetail_rec.html

@@ -925,9 +925,9 @@
           <span style="font-weight: 400;font-size: 16px">附件下载</span>
           <span class="free-download">免费下载1次</span>
           <span class="super-vip-show" style="display:none;">
-            <span class="file-count-tip">本月剩余:<i class="file-count"></i> 个</span>
+            <span class="file-count-tip">本月剩余:  <i class="file-count"></i>个</span>
             <img class="file-icon-help" src="/images/help-b.png" alt="">
-            <span class="concat-kf open-customer">联系客服</span>
+            <span class="concat-kf recharge-new">立即充值</span>
           </span>
         </div>
 				<div class="download-list" style="margin-top: 20px">
@@ -3474,18 +3474,41 @@ function fromwhere(text){
   function cjdyDownload (fname) {
 	  $.ajax({
 		  type:'post',
-		  url:'/publicapply/attachment/get',
+		  //url:'/publicapply/attachment/get',
+		  url:'/jypay/resourcePack/consumePack',
 		  data:{
-			  infoId:{{.T.obj._id}}
+			  id:{{.T.obj._id}},
+        productName:"附件下载包",
+        platform:"PC",
+        fileName:fname,
+        title:{{.T.obj.title}}
   		  },
 		  success:function(data){
-			  if(data.data && data.data.attachment !=null && data.data.attachment.length!==0){
-				  for(var i=0;i<data.data.attachment.length;i++) {
-					  //console.log(fname)
-					  if(fname == data.data.attachment[i].filename){
-						  goDownload(data.data.attachment[i].downurl)
+        if(data){
+          if ((data.m && data.m!="")||data.r["downUrl"]==undefined||data.r["downUrl"]==""){
+            bidVue.$confirm('附件下载异常,请前往联系客服。', {
+							showClose:false,
+							center: true,
+							confirmButtonText: '取消',
+							customClass: 'custom-alert',
+							showCancelButton: true,
+							confirmButtonClass: 'custom-cancel-btn',
+							cancelButtonClass: 'custom-confirm-btn',
+							cancelButtonText: '联系客服'
+						}).then(function(data){
+
+						}).catch(function(){
+							$('.open-customer').trigger('click')
+							$('body').trigger('click')
+						});
+          }else{
+            if(data.r&&fname == data.r["fileName"]){
+              if (!data.r["isExists"]){
+                $(".file-count").text($(".file-count").text()-1);
+              }
+              goDownload(data.r["downUrl"])
 					  }
-				  }
+          }
 			  }
 	  }
   });
@@ -3640,6 +3663,10 @@ function fromwhere(text){
     if (window.vipStatus > 0 && window.viper) {
       $('.super-vip-show').show()
       $('.super-vip-show .file-count').html(window.fileNum)
+      $('.recharge-new').unbind("click").bind("click",function(){
+        //超级订阅附件下载立即充值页面
+        window.open("/swordfish/page_big_pc/free/filePack/buy")
+      })
     }
 	  // 大会员隐藏次数
 	  if(window.memberStatus >0 && window.memberPower.indexOf(3) >= 0){

+ 7 - 3
src/web/templates/weixin/wxinfocontent_rec.html

@@ -1809,7 +1809,7 @@ function andownload() {
                           .catch(() => {})
                           return
                         }else{
-                          window.fileNum = window.fileNum - 1;
+                          //window.fileNum = window.fileNum - 1;
                           gotoFilePageOfVip($(this).find('a').text())
                           return
                         }
@@ -1877,9 +1877,13 @@ function andownload() {
             },
             success: function (r) {
                 if (r && r.m === '' && r.r) {
-                    var url = r.r.downurl
+                    var url = r.r.downUrl
                     if (url){
-						location.href = url
+                      if (!r.r.isExists){
+                        window.fileNum = window.fileNum - 1;
+                        $('.file-count').html($('.file-count').text()-1)
+                      }
+						          location.href = url
                     } else {
                         EasyAlert.show('获取附件地址失败');
                     }