|
@@ -63,10 +63,14 @@ func (stdDoc *StdDoc) Detail() {
|
|
|
userId := common.ObjToString(stdDoc.GetSession("userId"))
|
|
|
rData, errMsg := func() (interface{}, error) {
|
|
|
docId := stdDoc.GetString("docId")
|
|
|
+ from := stdDoc.GetString("from")
|
|
|
if docId == "" {
|
|
|
return nil, fmt.Errorf("参数异常")
|
|
|
}
|
|
|
- detail, isBuy, err := rpc.GetDocDetail(userId, docId)
|
|
|
+ if from != "" { //分享赚积分
|
|
|
+ go public.OpenShareJydoc(from, userId, docId)
|
|
|
+ }
|
|
|
+ detail, isBuy, IsCollect, err := rpc.GetDocDetail(userId, docId)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
@@ -74,9 +78,11 @@ func (stdDoc *StdDoc) Detail() {
|
|
|
detail.OssPdfId = ""
|
|
|
detail.OssDocId = ""
|
|
|
detail.PreviewImgId = fmt.Sprintf("https://%s.%s/%s", config.JyDocsAppConfig.OssBucket.Priv, config.JyDocsAppConfig.OssAdmin, detail.PreviewImgId)
|
|
|
+
|
|
|
return map[string]interface{}{
|
|
|
- "status": common.If(isBuy, 1, 0),
|
|
|
- "detail": detail,
|
|
|
+ "status": common.If(isBuy, 1, 0),
|
|
|
+ "collect": common.If(IsCollect, 1, 0),
|
|
|
+ "detail": detail,
|
|
|
}, nil
|
|
|
}()
|
|
|
if errMsg != nil {
|
|
@@ -92,7 +98,7 @@ func (stdDoc *StdDoc) GetDoc(sign string) {
|
|
|
if docId == "" {
|
|
|
return nil, fmt.Errorf("参数异常")
|
|
|
}
|
|
|
- detail, isBuy, err := rpc.GetDocDetail(userId, docId)
|
|
|
+ detail, isBuy, _, err := rpc.GetDocDetail(userId, docId)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
@@ -107,6 +113,9 @@ func (stdDoc *StdDoc) GetDoc(sign string) {
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
+ if strings.HasPrefix(url, "http://") {
|
|
|
+ url = strings.Replace(url, "http://", "https://", 1)
|
|
|
+ }
|
|
|
return url, nil
|
|
|
}()
|
|
|
if errMsg != nil {
|
|
@@ -132,7 +141,6 @@ func (stdDoc *StdDoc) TopList() {
|
|
|
return nil, fmt.Errorf("未知请求")
|
|
|
}
|
|
|
//存入redis缓存
|
|
|
-
|
|
|
list, _, err := rpc.GetDocQuery(userId, "", "", 1, num, reqSort)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
@@ -160,8 +168,10 @@ func (stdDoc *StdDoc) ActivityList() {
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
- for i := 0; i < len(list); i++ {
|
|
|
- list[i].DocImg = fmt.Sprintf("https://%s.%s/%s", config.JyDocsAppConfig.OssBucket.Priv, config.JyDocsAppConfig.OssAdmin, list[i].DocImg)
|
|
|
+ if list != nil && len(list) > 0 {
|
|
|
+ for i := 0; i < len(list); i++ {
|
|
|
+ list[i].DocImg = fmt.Sprintf("https://%s.%s/%s", config.JyDocsAppConfig.OssBucket.Priv, config.JyDocsAppConfig.OssAdmin, list[i].DocImg)
|
|
|
+ }
|
|
|
}
|
|
|
return list, nil
|
|
|
}()
|