|
@@ -5,10 +5,12 @@ import (
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/gin-gonic/gin"
|
|
"hongze/hongze_yb/controller/response"
|
|
"hongze/hongze_yb/controller/response"
|
|
"hongze/hongze_yb/global"
|
|
"hongze/hongze_yb/global"
|
|
|
|
+ "hongze/hongze_yb/models/tables/company_product"
|
|
"hongze/hongze_yb/services/purchase"
|
|
"hongze/hongze_yb/services/purchase"
|
|
userService "hongze/hongze_yb/services/user"
|
|
userService "hongze/hongze_yb/services/user"
|
|
"hongze/hongze_yb/utils"
|
|
"hongze/hongze_yb/utils"
|
|
"strconv"
|
|
"strconv"
|
|
|
|
+ "strings"
|
|
)
|
|
)
|
|
|
|
|
|
func List(c *gin.Context) {
|
|
func List(c *gin.Context) {
|
|
@@ -18,10 +20,21 @@ func List(c *gin.Context) {
|
|
response.Fail("无权操作", c)
|
|
response.Fail("无权操作", c)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // 判断用户状态是否是正常和永续
|
|
|
|
+ companyProduct, err := company_product.GetByCompany2ProductId(userinfo.CompanyID, 1)
|
|
|
|
+ if err != nil {
|
|
|
|
+ response.Fail("无权查看", c)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ // 已购仅付费用户可见
|
|
|
|
+ if ! strings.Contains("永续,正式", companyProduct.Status) {
|
|
|
|
+ response.Fail("无权查看", c)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
list, err := purchase.GetLatestReportAndActivity(userinfo)
|
|
list, err := purchase.GetLatestReportAndActivity(userinfo)
|
|
if err !=nil {
|
|
if err !=nil {
|
|
response.Fail(err.Error(), c)
|
|
response.Fail(err.Error(), c)
|
|
- global.LOG.Critical(fmt.Sprintf("userId=%d, errMsg:%s", userinfo.UserID, err.Error()))
|
|
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -77,7 +90,17 @@ func Detail(c *gin.Context) {
|
|
response.Fail("无权操作", c)
|
|
response.Fail("无权操作", c)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ // 判断用户状态是否是正常和永续
|
|
|
|
+ companyProduct, err := company_product.GetByCompany2ProductId(userinfo.CompanyID, 1)
|
|
|
|
+ if err != nil {
|
|
|
|
+ response.Fail("无权查看", c)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ // 已购仅付费用户可见
|
|
|
|
+ if ! strings.Contains("永续,正式", companyProduct.Status) {
|
|
|
|
+ response.Fail("无权查看", c)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
list, err := purchase.GetDetail(userinfo, classifyIdFirst, activityId, pageIndex, pageSize)
|
|
list, err := purchase.GetDetail(userinfo, classifyIdFirst, activityId, pageIndex, pageSize)
|
|
if err != nil {
|
|
if err != nil {
|
|
response.Fail(err.Error(), c)
|
|
response.Fail(err.Error(), c)
|