Ver código fonte

wip:文库会员信息

wangshan 1 ano atrás
pai
commit
dcf0324dc4
6 arquivos alterados com 70 adições e 0 exclusões
  1. 8 0
      .idea/.gitignore
  2. 8 0
      .idea/modules.xml
  3. 9 0
      .idea/powerCheckCenter.iml
  4. 6 0
      .idea/vcs.xml
  5. 8 0
      entity/power.go
  6. 31 0
      service/power.go

+ 8 - 0
.idea/.gitignore

@@ -0,0 +1,8 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
+# 基于编辑器的 HTTP 客户端请求
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml

+ 8 - 0
.idea/modules.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/powerCheckCenter.iml" filepath="$PROJECT_DIR$/.idea/powerCheckCenter.iml" />
+    </modules>
+  </component>
+</project>

+ 9 - 0
.idea/powerCheckCenter.iml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="WEB_MODULE" version="4">
+  <component name="Go" enabled="true" />
+  <component name="NewModuleRootManager">
+    <content url="file://$MODULE_DIR$" />
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>

+ 6 - 0
.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
+  </component>
+</project>

+ 8 - 0
entity/power.go

@@ -112,4 +112,12 @@ type Power struct {
 	Entniche *Entniche
 	Ent      *Ent
 	Free     *Free
+	Docs     *Docs
+}
+
+type Docs struct {
+	DocStatus    int   //文库会员状态
+	StartDate    int64 //会员开始时间
+	EndDate      int64 //会员结束时间
+	FreeDownload int   // 免费下载次数
 }

+ 31 - 0
service/power.go

@@ -55,6 +55,7 @@ func (this *PowerService) Power(userid string, baseUserId, accountId, entId, pos
 	member := &entity.Member{}
 	free := &entity.Free{}
 	userPower := entity.Power{}
+	docs := &entity.Docs{}
 	if positionId == 0 {
 		free.IsFree = true
 		return &entity.Power{
@@ -63,6 +64,7 @@ func (this *PowerService) Power(userid string, baseUserId, accountId, entId, pos
 			Free:     free,
 			Ent:      ent,
 			Entniche: entniche,
+			Docs:     docs,
 		}
 	}
 	cacheBl := false
@@ -119,6 +121,10 @@ func (this *PowerService) Power(userid string, baseUserId, accountId, entId, pos
 			mgoUserFields["i_apppushunread"] = 1
 			mgoUserFields["i_member_starttime"] = 1
 			mgoUserFields["i_member_endtime"] = 1
+			mgoUserFields["i_doc_status"] = 1
+			mgoUserFields["l_doc_starttime"] = 1
+			mgoUserFields["l_doc_endtime"] = 1
+			mgoUserFields["i_doc_free_download"] = 1
 		} else {
 			bigmemberServiceUserQuery["s_userid"] = positionId
 		}
@@ -217,6 +223,13 @@ func (this *PowerService) Power(userid string, baseUserId, accountId, entId, pos
 				}
 				//获取大会员版本名称
 				member.MemberName = level_map[memberStatus]
+				//文库
+				docs = &entity.Docs{
+					DocStatus:    common.IntAll((*data)["i_doc_status"]),
+					StartDate:    common.Int64All((*data)["l_doc_starttime"]),
+					EndDate:      common.Int64All((*data)["l_doc_endtime"]),
+					FreeDownload: common.IntAll((*data)["i_doc_free_download"]),
+				}
 			} else if positionType == 1 {
 				entnicheUserId := this.GetEntnicheUserId(entId, phone)
 				//免费
@@ -298,6 +311,15 @@ func (this *PowerService) Power(userid string, baseUserId, accountId, entId, pos
 							member.Used = true
 						}
 					}
+					//文库
+					if common.Int64All((*eudata)["i_doc_status"]) > 0 {
+						docs = &entity.Docs{
+							DocStatus:    common.IntAll((*data)["i_doc_status"]),
+							StartDate:    common.Int64All((*data)["l_doc_starttime"]),
+							EndDate:      common.Int64All((*data)["l_doc_endtime"]),
+							FreeDownload: common.IntAll((*data)["i_doc_free_download"]),
+						}
+					}
 				}
 			}
 			//大会员相关权益数量
@@ -410,6 +432,14 @@ func (this *PowerService) Power(userid string, baseUserId, accountId, entId, pos
 				}
 			}
 
+			//文库  非文库会员,确认免费下载机会状态  免费下载机会没有被消耗
+			//FreeDownload 0:未留资 有一次留资免费机会;2:已留资 下载机会未使用
+			if userPower.Docs.DocStatus <= 0 && userPower.Docs.FreeDownload == 0 {
+				sc := this.MgoJy.Count("saleLeads", map[string]interface{}{"userid": userid, "source": map[string]interface{}{"$in": []string{"pc_library_details_free", "app_library_details_free", "wx_library_details_free", "h5_library_details_free"}}})
+				if sc > 0 {
+					userPower.Docs.FreeDownload = 1 //已留资  未使用下载机会
+				}
+			}
 		}
 		userPower = entity.Power{
 			Vip:      vip,
@@ -417,6 +447,7 @@ func (this *PowerService) Power(userid string, baseUserId, accountId, entId, pos
 			Free:     free,
 			Ent:      ent,
 			Entniche: entniche,
+			Docs:     docs,
 		}
 	}
 	//存储缓存