wangshan 3 роки тому
батько
коміт
b704510dbe

+ 1 - 1
src/jfw/modules/bigmember/src/service/use/use.go

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

+ 1 - 0
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
 		}
 		//当月未有消费记录

+ 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("")
+      })
     }
 	  // 大会员隐藏次数
 	  if(window.memberStatus >0 && window.memberPower.indexOf(3) >= 0){