Browse Source

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

zhangyuhan 3 năm trước cách đây
mục cha
commit
8ba8142e2f

+ 2 - 1
src/jfw/modules/subscribepay/src/entity/basePack.go

@@ -223,11 +223,12 @@ func (this *FindRecordStruct) FindJyConsumePackAllRecord() ([]map[string]interfa
 	query := map[string]interface{}{
 		"s_userId":  this.UserId,
 		"s_product": this.Name,
+		"s_month":   this.QueryTime,
 	}
 	//全部
 	total := util.MQFW.Count(jyCC, query)
 	//当月
-	query["s_month"] = this.QueryTime
+	// query["s_month"] = this.QueryTime
 	list, ok := util.MQFW.Find(jyCC, query, `{"l_updateDate":-1,"l_date":-1}`, `{"s_id":1,"s_fileName":1,"s_downUrl":1,"l_date":1,"s_title":1,"l_updateDate":1}`, false, (this.Page-1)*this.PageSize, this.PageSize)
 	if ok && list != nil {
 		if len(*list) >= 1 {

+ 14 - 5
src/jfw/modules/subscribepay/src/entity/commonApi.go

@@ -85,17 +85,26 @@ func (this *FindBalanceStruct) FindBalance() (map[string]interface{}, error) {
 		return rmap, err
 	}
 	if rmap != nil && len(rmap) > 0 && this.ResourceType == "附件下载包" {
-		if rdata, _ := rmap["data"].([]interface{}); len(rdata) > 0 {
-			rdataArr := qu.ObjArrToMapArr(rdata)
+		rdata, _ := rmap["data"].([]interface{})
+		rdataArr := qu.ObjArrToMapArr(rdata)
+		vipFileKey := fmt.Sprintf(jy.VipFileUploadNumKey, this.AccountId, fmt.Sprint(time.Now().Month()))
+		vipFileKeyNum := redis.GetInt(jy.PowerCacheDb, vipFileKey)
+		free_num := config.BidfileConfig.File_number - vipFileKeyNum //free
+		if len(rdata) > 0 {
 			for k, v := range rdataArr {
 				num := qu.IntAll(v["number"]) //buy
-				vipFileKey := fmt.Sprintf(jy.VipFileUploadNumKey, this.AccountId, fmt.Sprint(time.Now().Month()))
-				vipFileKeyNum := redis.GetInt(jy.PowerCacheDb, vipFileKey)
-				free_num := config.BidfileConfig.File_number - vipFileKeyNum //free
 				v["number"] = num + free_num
 				rdataArr[k] = v
 			}
+		} else {
+			rdataArr = append(rdataArr, map[string]interface{}{
+				"name":         "附件下载包",
+				"number":       free_num,
+				"resourceType": "附件下载包",
+				"thirtyNum":    0,
+			})
 		}
+		rmap["data"] = rdataArr
 	}
 	return rmap, err
 }

+ 6 - 0
src/jfw/modules/subscribepay/src/service/resourcePack.go

@@ -9,6 +9,7 @@ import (
 	"log"
 	"pay"
 	qu "qfw/util"
+	"qfw/util/jy"
 	"strconv"
 	"time"
 	"util"
@@ -175,6 +176,11 @@ func (this *ResourcePack) Account() {
 		this.ServeJson(Result{Error_msg: "参数错误"})
 		return
 	}
+	vipMsg := jy.GetBigVipUserBaseMsg(userId, util.Mysql, util.MQFW)
+	if vipMsg.VipStatus <= 0 {
+		this.ServeJson(Result{Error_msg: "无权限,请联系管理员"})
+		return
+	}
 	dbs := &entity.FindBalanceStruct{
 		AccountId:    userId,
 		ResourceType: config.ResConf.Product[product],

+ 27 - 27
src/web/staticres/common-module/file-pack/js/index.js

@@ -191,33 +191,33 @@ var vm = new Vue({
     },
     downFile (item) {
       //location.href = item.s_downUrl
-    $.ajax({
-        type: 'post',
-        url: '/jypay/resourcePack/consumePack',
-        data: {
-            productName: '附件下载包',
-            platform: 'APP',
-            fileName: item.s_fileName,
-            id: item.s_id,
-            title: item.s_title
-        },
-        success: function (r) {
-			if (r && r.m === '' && r.r) {
-     				location.href = r.r.downUrl
-					setTimeout(function(){
-						location.reload();
-					},2000)
-               }else{
-               	vant.Dialog.alert({
-                       message: '附件下载异常,请联系管理员,谢谢!',
-                       className: 'custom-dialog',
-                       confirmButtonText: '我知道了',
-                       confirmButtonColor: '#2ABDD1',
-                       width: 303,
-                     }).then(() => {})
-               }
-		}
-	})
+		   $.ajax({
+		       type: 'post',
+		       url: '/jypay/resourcePack/consumePack',
+		       data: {
+		           productName: '附件下载包',
+		           platform: 'APP',
+		           fileName: item.s_fileName,
+		           id: item.s_id,
+		           title: item.s_title
+		       },
+		       success: function (r) {
+				if (r && r.m === '' && r.r) {
+		    				location.href = r.r.downUrl
+						setTimeout(function(){
+							location.reload();
+						},2000)
+		              }else{
+		              	vant.Dialog.alert({
+		                      message: '附件下载异常,请联系管理员,谢谢!',
+		                      className: 'custom-dialog',
+		                      confirmButtonText: '我知道了',
+		                      confirmButtonColor: '#2ABDD1',
+		                      width: 303,
+		                    }).then(() => {})
+		              }
+			}
+		})
     },
     commonDialogFn (message, confirmText, callBack) {
       if (this.ptype == "1") {