Browse Source

附件下载包处理

WH01243 1 year ago
parent
commit
4b86b3356f

+ 16 - 9
src/jfw/modules/subscribepay/src/entity/basePack.go

@@ -26,7 +26,7 @@ func (this *UseBalanceStruct) defaultConsume() (r map[string]interface{}, m stri
 	return
 }
 
-//附件下载消费 fui:免费赠送已使用次数;pui:付费权限已使用次数
+// 附件下载消费 fui:免费赠送已使用次数;pui:付费权限已使用次数
 func (this *UseBalanceStruct) fileConsume() (r map[string]interface{}, m string, c int) {
 	_fileName := this.Remarks["fileName"].(string)
 	_id := this.Remarks["id"].(string)
@@ -140,7 +140,7 @@ func (this *UseBalanceStruct) fileConsume() (r map[string]interface{}, m string,
 
 var jyCC = "jy_consumepack"
 
-//查询jy 消费日志记录
+// 查询jy 消费日志记录
 func (this *UseBalanceStruct) FindJyConsumePackRecord() string {
 	query := map[string]interface{}{
 		"s_id":       this.Remarks["id"].(string),
@@ -161,7 +161,7 @@ func (this *UseBalanceStruct) FindJyConsumePackRecord() string {
 	return BsonIdToSId((*res)["_id"])
 }
 
-//保存日志
+// 保存日志
 func (this *UseBalanceStruct) saveJyConsumePackList() (b bool) {
 	saveMap := map[string]interface{}{
 		"s_id":         this.Remarks["id"],
@@ -184,7 +184,7 @@ func (this *UseBalanceStruct) saveJyConsumePackList() (b bool) {
 	return
 }
 
-//调rpc 获取附件信息
+// 调rpc 获取附件信息
 func fileAttachRpc(fileName, id string) (r map[string]interface{}) {
 	r = make(map[string]interface{})
 	// 调用rpc 获取附件信息
@@ -210,7 +210,7 @@ func fileAttachRpc(fileName, id string) (r map[string]interface{}) {
 	return
 }
 
-//供应信息附件
+// 供应信息附件
 func SupplyInfoFile(fileName, msgId string) (r map[string]interface{}) {
 	//查数据
 	data := util.InfoMysql.FindOne("supply_info", map[string]interface{}{"id": msgId}, "", "")
@@ -236,7 +236,14 @@ func SupplyInfoFile(fileName, msgId string) (r map[string]interface{}) {
 	return
 }
 
-//消费
+// 兑换作废
+func JyexchangeCance(userId, product, platform, queryTime string, pageSize, pageNum int) (list []map[string]interface{}, total int, err error) {
+	RStruct := InitFindRecord(userId, product, queryTime, platform, pageSize, pageNum, 2)
+	list, total = RStruct.DefaultData()
+	return list, total, nil
+}
+
+// 消费
 func JyConsumePack(userId, product, platform string, remarks map[string]interface{}, session *httpsession.Session) (r map[string]interface{}, m string, c int) {
 	CStruct := InitUseBalance(userId, product, product, "", "", nil, remarks, 1, platform, session)
 	switch product {
@@ -248,7 +255,7 @@ func JyConsumePack(userId, product, platform string, remarks map[string]interfac
 	return
 }
 
-//流水
+// 流水
 func JyFindRecordPack(userId, productName, queryTime, platform string, pageSize, pageNum int) (list []map[string]interface{}, total int, err error) {
 	RStruct := InitFindRecord(userId, productName, queryTime, platform, pageSize, pageNum, 0)
 	switch productName {
@@ -260,7 +267,7 @@ func JyFindRecordPack(userId, productName, queryTime, platform string, pageSize,
 	return list, total, nil
 }
 
-//数据处理-附件下载包
+// 数据处理-附件下载包
 func (this *FindRecordStruct) FindJyConsumePackAllRecord() ([]map[string]interface{}, int) {
 	var articleAddMap = map[string]string{
 		"PC":  "/article/content/%s.html",
@@ -301,7 +308,7 @@ func (this *FindRecordStruct) FindJyConsumePackAllRecord() ([]map[string]interfa
 	return *list, total
 }
 
-//数据处理-default
+// 数据处理-default
 func (this *FindRecordStruct) DefaultData() ([]map[string]interface{}, int) {
 	returnList, total, err := this.FindRecord()
 	if err != nil {

+ 1 - 1
src/jfw/modules/subscribepay/src/go.mod

@@ -1,6 +1,6 @@
 module jy/src/jfw/modules/subscribepay/src
 
-go 1.18
+go 1.20
 
 require (
 	app.yhyue.com/moapp/jybase v0.0.0-20230718012114-37013054344b

+ 28 - 4
src/jfw/modules/subscribepay/src/service/basePack.go

@@ -13,7 +13,31 @@ import (
 	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
 )
 
-//“包”的消费
+// “包”的兑换过期记录
+func (this *ResourcePack) ExchangeCancelList() {
+	userId, _ := this.GetSession("userId").(string)
+	productName := this.GetString("productName")
+	pageSize, _ := this.GetInteger("pageSize")
+	pageNum, _ := this.GetInteger("pageNum")
+	queryTime := this.GetString("queryTime")
+	rData, errMsg := func() (interface{}, error) {
+		if this.Method() != "POST" {
+			return "请求方式有误", nil
+		}
+		returnList, total, err := entity.JyexchangeCance(userId, productName, "", queryTime, pageSize, pageNum)
+		returnData := map[string]interface{}{
+			"list": returnList,
+		}
+		returnData["total"] = total
+		return returnData, err
+	}()
+	if errMsg != nil {
+		log.Printf("%s %s RecordList 异常:%s\n", userId, productName, errMsg.Error())
+	}
+	this.ServeJson(NewResult(rData, errMsg))
+}
+
+// “包”的消费
 func (this *ResourcePack) ConsumePack() {
 	userId, _ := this.GetSession("userId").(string)
 	productName := this.GetString("productName")
@@ -51,7 +75,7 @@ func (this *ResourcePack) ConsumePack() {
 	})
 }
 
-//“包”的使用记录
+// “包”的使用记录
 func (this *ResourcePack) RecordList() {
 	userId, _ := this.GetSession("userId").(string)
 	productName := this.GetString("productName")
@@ -67,9 +91,9 @@ func (this *ResourcePack) RecordList() {
 			return "参数有误", nil
 		}
 		vipMsg := jy.GetBigVipUserBaseMsg(this.Session(), *config.Middleground)
-		if vipMsg.VipStatus <= 0 {
+		/*if vipMsg.VipStatus <= 0 {
 			return "无权限,请联系管理员", nil
-		}
+		}*/
 		if queryTime == "" {
 			queryTime = time.Now().Format("2006-01")
 		}

+ 9 - 9
src/jfw/modules/subscribepay/src/service/resourcePack.go

@@ -15,18 +15,18 @@ import (
 	qu "app.yhyue.com/moapp/jybase/common"
 	. "app.yhyue.com/moapp/jybase/date"
 	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
-	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
 )
 
 //资源包相关(数据流量包,附件下载包,采购单位流量包...)
 
 type ResourcePack struct {
 	*xweb.Action
-	price       xweb.Mapper `xweb:"/resourcePack/price"`       //价格
-	createOrder xweb.Mapper `xweb:"/resourcePack/createOrder"` //线上自助数据包充值-创建订单
-	account     xweb.Mapper `xweb:"/resourcePack/account"`     //个人账户
-	recordList  xweb.Mapper `xweb:"/resourcePack/recordList"`  //“资源包”使用记录
-	consumePack xweb.Mapper `xweb:"/resourcePack/consumePack"` //“资源包”消费
+	price              xweb.Mapper `xweb:"/resourcePack/price"`              //价格
+	createOrder        xweb.Mapper `xweb:"/resourcePack/createOrder"`        //线上自助数据包充值-创建订单
+	account            xweb.Mapper `xweb:"/resourcePack/account"`            //个人账户
+	recordList         xweb.Mapper `xweb:"/resourcePack/recordList"`         //“资源包”使用记录
+	consumePack        xweb.Mapper `xweb:"/resourcePack/consumePack"`        //“资源包”消费
+	exchangeCancelList xweb.Mapper `xweb:"/resourcePack/exchangeCancelList"` //“资源包”兑换作废
 }
 
 const (
@@ -166,11 +166,11 @@ func (this *ResourcePack) Account() {
 		this.ServeJson(Result{Error_msg: "参数错误"})
 		return
 	}
-	vipMsg := jy.GetBigVipUserBaseMsg(this.Session(), *config.Middleground)
-	if vipMsg.VipStatus <= 0 {
+	//vipMsg := jy.GetBigVipUserBaseMsg(this.Session(), *config.Middleground)
+	/*if vipMsg.VipStatus <= 0 {
 		this.ServeJson(Result{Error_msg: "无权限,请联系管理员"})
 		return
-	}
+	}*/
 	dbs := &entity.FindBalanceStruct{
 		AccountId:    userId,
 		ResourceType: config.ResConf.Product[product],

+ 0 - 1
src/jfw/modules/subscribepay/src/util/db.go

@@ -8,7 +8,6 @@ import (
 	mg "app.yhyue.com/moapp/jybase/mongodb"
 	"app.yhyue.com/moapp/jybase/mysql"
 	"app.yhyue.com/moapp/jybase/redis"
-	"app.yhyue.com/moapp/jypkg/compatible"
 )
 
 var MQFW mg.MongodbSim