|
@@ -7,6 +7,7 @@ import (
|
|
|
"encoding/json"
|
|
|
"errors"
|
|
|
"fmt"
|
|
|
+ "jy-docs/config"
|
|
|
"jy-docs/public"
|
|
|
"jy-docs/rpc"
|
|
|
"log"
|
|
@@ -19,7 +20,7 @@ type UserDoc struct {
|
|
|
collectAdd xweb.Mapper `xweb:"/user/collect/add"` //收藏文库
|
|
|
collectRemove xweb.Mapper `xweb:"/user/collect/remove"` //取消收藏
|
|
|
docBuy xweb.Mapper `xweb:"/user/buy"` //文库购买
|
|
|
- info xweb.Mapper `xweb:"/user/info"` //文库购买
|
|
|
+ info xweb.Mapper `xweb:"/user/info"` //文库会员信息
|
|
|
}
|
|
|
|
|
|
// 用户文库列表
|
|
@@ -162,13 +163,32 @@ func (userDoc *UserDoc) DocBuy() {
|
|
|
func (userDoc *UserDoc) Info() {
|
|
|
userId := common.ObjToString(userDoc.GetSession("userId"))
|
|
|
rData, errMsg := func() (interface{}, error) {
|
|
|
- mData := public.Compatible.Select(userId, `{"i_doc_status":1,"l_doc_endtime":1,"l_doc_starttime":1}`)
|
|
|
+ if userId == "" {
|
|
|
+ return map[string]interface{}{
|
|
|
+ "docMemberStatus": false,
|
|
|
+ "startTime": 0,
|
|
|
+ "endTime": 0,
|
|
|
+ "free_download": public.FreeDownloadNoSL,
|
|
|
+ }, nil
|
|
|
+ }
|
|
|
+ mData := public.Compatible.Select(userId, `{"i_doc_status":1,"l_doc_endtime":1,"l_doc_starttime":1,"i_doc_free_download":1}`)
|
|
|
if mData != nil && len(*mData) > 0 {
|
|
|
+ free_download := common.IntAll((*mData)["i_doc_free_download"])
|
|
|
+ if (*mData)["i_doc_free_download"] == 0 { // 没有使用过一次免费下载机会
|
|
|
+ // 查留资
|
|
|
+ count := public.MQFW.Count("saleLeads", map[string]interface{}{"userid": userId, "source": map[string]interface{}{"$in": config.JyDocsAppConfig.DocMember.Source}})
|
|
|
+ if count > 0 {
|
|
|
+ free_download = public.Free_download_HasFreeTimes
|
|
|
+ } else {
|
|
|
+ free_download = public.FreeDownloadNoSL
|
|
|
+ }
|
|
|
+ }
|
|
|
vipStatus := common.IntAll((*mData)["i_doc_status"])
|
|
|
return map[string]interface{}{
|
|
|
"docMemberStatus": vipStatus > 0,
|
|
|
"startTime": (*mData)["l_doc_starttime"],
|
|
|
"endTime": (*mData)["l_doc_endtime"],
|
|
|
+ "free_download": free_download,
|
|
|
}, nil
|
|
|
}
|
|
|
return nil, errors.New("获取文库会员状态失败")
|