Преглед на файлове

feat:查看原文权限

wangshan преди 1 година
родител
ревизия
2e930ffc72
променени са 2 файла, в които са добавени 24 реда и са изтрити 0 реда
  1. 4 0
      entity/power.go
  2. 20 0
      service/power.go

+ 4 - 0
entity/power.go

@@ -33,6 +33,7 @@ type Free struct {
 	EntnicheApppushunread int64 //已读未读
 	Apppushunread         int64 //已读未读
 	OjyLength             int64 //ojy的长度
+	Original              int64 //查看原文次数/每月
 }
 
 //超级订阅相关
@@ -49,6 +50,7 @@ type Vip struct {
 	FileNum         int64   //超级订阅用户附件下载包的剩余次数
 	HasKey          bool    //是否有关键词
 	NewCitys        []int64 //城市数量
+	Original        int64   //查看原文次数/每月
 }
 
 //大会员相关
@@ -70,6 +72,7 @@ type Member struct {
 	Pid             string  //主帐号id
 	Used            bool    //是否使用过大会员初始化
 	HasKey          bool    //是否有关键词
+	Original        int64   //查看原文次数/每月
 }
 
 //商机管理相关
@@ -82,6 +85,7 @@ type Entniche struct {
 	IsNew       int64 //是否是新版商机管理 0不是 1是
 	HasKey      bool  //是否有关键词
 	Model       int64 //1:统一订阅,2:个人订阅
+	Original    int64 //查看原文次数/每月
 }
 
 //企业相关

+ 20 - 0
service/power.go

@@ -386,6 +386,26 @@ func (this *PowerService) Power(userid string, baseUserId, accountId, entId, pos
 			} else {
 				free.IsFree = false
 			}
+			//查看原文
+			var (
+				originalData = this.Conn.BaseMysql.SelectBySql(`SELECT user_type,total FROM original_power WHERE state = 0`)
+			)
+			if originalData != nil && len(*originalData) > 0 {
+				for _, ov := range *originalData {
+					total := common.Int64All(ov["total"])
+					switch common.IntAll(ov["user_type"]) {
+					case 1:
+						vip.Original = total
+					case 2:
+						member.Original = total
+					case 3:
+						entniche.Original = total
+					default:
+						free.Original = total
+					}
+				}
+			}
+
 		}
 		userPower = entity.Power{
 			Vip:      vip,