Bläddra i källkod

feat:兑换接口调整

fuwencai 1 år sedan
förälder
incheckning
8371a695a3
2 ändrade filer med 7 tillägg och 3 borttagningar
  1. 5 2
      jydocs-back/rpc/stdDocRpc.go
  2. 2 1
      jydocs-back/servers/userDoc.go

+ 5 - 2
jydocs-back/rpc/stdDocRpc.go

@@ -118,8 +118,9 @@ return
 
 type returnDetail struct {
 	*stdlib.DocInfo
-	DocMemberPrice    int64 `json:"docMemberPrice"`
-	DocMemberDiscount int64 `json:"docMemberDiscount"`
+	DocMemberPrice    int64  `json:"docMemberPrice"`
+	DocMemberDiscount int64  `json:"docMemberDiscount"`
+	ImgId             string `json:"imgId"`
 }
 
 func GetDocDetail(userId, docId string, isBuyDetail bool) (*returnDetail, bool, bool, error) {
@@ -141,6 +142,7 @@ func GetDocDetail(userId, docId string, isBuyDetail bool) (*returnDetail, bool,
 		return nil, false, false, fmt.Errorf("查询文档异常")
 	}
 	detail := resp.DocDeail
+	imgId := detail.PreviewImgId
 	if detail.Source == public.SourceDd {
 		priceConfig := config.JyDocsAppConfig.Price[detail.Source][detail.ProductType]
 		// 豆丁的预览图和价格需要重新计算
@@ -153,6 +155,7 @@ func GetDocDetail(userId, docId string, isBuyDetail bool) (*returnDetail, bool,
 	rs := returnDetail{
 		DocInfo:           detail,
 		DocMemberDiscount: config.JyDocsAppConfig.DocMember.Discount,
+		ImgId:             imgId,
 	}
 	// 会员免费
 	if detail.ProductType == public.ProductTypeMemberFree {

+ 2 - 1
jydocs-back/servers/userDoc.go

@@ -193,8 +193,9 @@ func (userDoc *UserDoc) DocBuy() {
 			bytes, err := json.Marshal(map[string]interface{}{
 				"name":    docInfo.DocName,
 				"summary": docInfo.DocSummary,
-				"img":     docInfo.PreviewImgId,
+				"img":     docInfo.ImgId,
 				"fType":   docInfo.DocFileType,
+				"source":  docInfo.Source,
 			})
 			if err != nil {
 				return nil, fmt.Errorf("文库异常")