浏览代码

增加系统配置接口

kobe6258 5 月之前
父节点
当前提交
4a8cd37705

+ 1 - 1
models/merchant/user_subscription_access_list.go

@@ -94,7 +94,7 @@ func CloseUserAccess(access UserSubscriptionAccessList) (err error) {
 }
 func ExpireUserAccess(access UserSubscriptionAccessList) (err error) {
 	db := models.Main()
-	err = db.Model(&access).Where("template_user_id=? AND product_id=?", access.TemplateUserId, access.ProductID).Update("status", SubscribeClose).Error
+	err = db.Model(&access).Where("template_user_id=? AND product_id=?", access.TemplateUserId, access.ProductID).Update("status", SubscribeExpired).Error
 	// 执行批量插入或更新操作
 	return
 }

+ 30 - 21
service/report/report_service.go

@@ -326,32 +326,41 @@ func DealReportInfo(report *reportService.ReportDTO, isLogin bool, userId int) (
 	var packageList []productService.MerchantProductDTO
 	//查询产品信息
 	product, pdErr := productService.GetProductBySourceId(report.ReportID, productDao.Report)
-	if pdErr != nil {
-		var permissionIds []int
-		if len(permissions) > 0 {
-			for _, permission := range permissions {
-				permissionIds = append(permissionIds, permission.PermissionId)
-			}
-			//单品不存在的话查套餐
-			packageList, err = productService.GetProductListBySourceIds(permissionIds, "package")
-			if err != nil || len(packageList) == 0 {
-				logger.Error("获取套餐列表失败:%v", err)
-				report.Price = defaultProductPrice
-				report.IsFree = true
-				report.IsSubscribe = false
-				report.IsPackage = false
-			} else {
-				report.Price = packageList[0].Price
-				report.IsFree = false
-				report.IsSubscribe = false
-				report.IsPackage = true
-				report.ProductId = packageList[0].Id
-			}
+	var permissionIds []int
+	if len(permissions) > 0 {
+		for _, permission := range permissions {
+			permissionIds = append(permissionIds, permission.PermissionId)
+		}
+		//单品不存在的话查套餐
+		packageList, err = productService.GetProductListBySourceIds(permissionIds, "package")
+		if err != nil || len(packageList) == 0 {
+			logger.Error("获取套餐列表失败:%v", err)
+			report.Price = defaultProductPrice
+			report.IsFree = true
+			report.IsSubscribe = false
+			report.IsPackage = false
 		} else {
+			report.Price = packageList[0].Price
+			report.IsFree = false
+			report.IsSubscribe = false
+			report.IsPackage = true
+			report.ProductId = packageList[0].Id
+		}
+	}
+	if pdErr != nil {
+		//单品不存在的话查套餐
+		if len(packageList) == 0 {
+			logger.Error("获取套餐列表失败:%v", err)
 			report.Price = defaultProductPrice
 			report.IsFree = true
 			report.IsSubscribe = false
 			report.IsPackage = false
+		} else {
+			report.Price = packageList[0].Price
+			report.IsFree = false
+			report.IsSubscribe = false
+			report.IsPackage = true
+			report.ProductId = packageList[0].Id
 		}
 	} else {
 		report.Price = product.Price

+ 1 - 1
task/product/product_expire_task.go

@@ -10,7 +10,7 @@ import (
 
 var (
 	taskName base.TaskType = "ExpireProductTask"
-	cron                   = "59 59 23 * * *"
+	cron                   = "59 10 09 * * *"
 )
 
 // Execute Task ETA取研报的数据

+ 1 - 0
task/task_starter.go

@@ -8,6 +8,7 @@ import (
 	_ "eta/eta_mini_ht_api/task/eta/permission"
 	_ "eta/eta_mini_ht_api/task/message"
 	_ "eta/eta_mini_ht_api/task/order"
+	_ "eta/eta_mini_ht_api/task/product"
 	_ "eta/eta_mini_ht_api/task/report"
 	_ "eta/eta_mini_ht_api/task/sms"
 	"github.com/beego/beego/v2/server/web"