소스 검색

wip:p525 兑换接口调整

fuwencai 1 년 전
부모
커밋
fd3e2ab92f
3개의 변경된 파일10개의 추가작업 그리고 9개의 파일을 삭제
  1. 5 4
      jydocs-back/rpc/stdDocRpc.go
  2. 2 2
      jydocs-back/servers/stdDoc.go
  3. 3 3
      jydocs-back/servers/userDoc.go

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

@@ -121,11 +121,12 @@ type returnDetail struct {
 	DocMemberDiscount int64 `json:"docMemberDiscount"`
 	DocMemberDiscount int64 `json:"docMemberDiscount"`
 }
 }
 
 
-func GetDocDetail(userId, docId string) (*returnDetail, bool, bool, error) {
+func GetDocDetail(userId, docId string, isBuyDetail bool) (*returnDetail, bool, bool, error) {
 	resp, err := jyStdDocStdlib.DocGetCheck(context.Background(), &stdlib.DocGetCheckReq{
 	resp, err := jyStdDocStdlib.DocGetCheck(context.Background(), &stdlib.DocGetCheckReq{
-		AppId:  config.JyDocsAppConfig.AppId,
-		UserId: userId,
-		DocId:  docId,
+		AppId:       config.JyDocsAppConfig.AppId,
+		UserId:      userId,
+		DocId:       docId,
+		IsBuyDetail: isBuyDetail,
 	})
 	})
 	if err != nil {
 	if err != nil {
 		log.Printf("%s GetDocDetail call error %v\n", userId, err)
 		log.Printf("%s GetDocDetail call error %v\n", userId, err)

+ 2 - 2
jydocs-back/servers/stdDoc.go

@@ -101,7 +101,7 @@ func (stdDoc *StdDoc) Detail() {
 		if from != "" { //分享赚积分
 		if from != "" { //分享赚积分
 			go public.OpenShareJydoc(from, userId, docId)
 			go public.OpenShareJydoc(from, userId, docId)
 		}
 		}
-		detail, isBuy, IsCollect, err := rpc.GetDocDetail(userId, docId)
+		detail, isBuy, IsCollect, err := rpc.GetDocDetail(userId, docId, false)
 		if err != nil {
 		if err != nil {
 			return nil, err
 			return nil, err
 		}
 		}
@@ -164,7 +164,7 @@ func (stdDoc *StdDoc) GetDoc(sign string) {
 		if docId == "" {
 		if docId == "" {
 			return nil, fmt.Errorf("参数异常")
 			return nil, fmt.Errorf("参数异常")
 		}
 		}
-		detail, isBuy, _, err := rpc.GetDocDetail(userId, docId)
+		detail, isBuy, _, err := rpc.GetDocDetail(userId, docId, false)
 		if err != nil {
 		if err != nil {
 			return nil, err
 			return nil, err
 		}
 		}

+ 3 - 3
jydocs-back/servers/userDoc.go

@@ -107,7 +107,7 @@ func (userDoc *UserDoc) DocBuy() {
 		usePoint := true    // 是否消耗剑鱼币  会员免费文档且当天100篇以内的或者使用免费下载机会的 不用扣积分
 		usePoint := true    // 是否消耗剑鱼币  会员免费文档且当天100篇以内的或者使用免费下载机会的 不用扣积分
 		useSLTimes := false // 使用留资机会的下载次数
 		useSLTimes := false // 使用留资机会的下载次数
 		//查询文档所需积分及文档类型
 		//查询文档所需积分及文档类型
-		docInfo, isBuy, _, err := rpc.GetDocDetail(userId, docId)
+		docInfo, isBuy, _, err := rpc.GetDocDetail(userId, docId, true)
 		if err != nil {
 		if err != nil {
 			return nil, err
 			return nil, err
 		}
 		}
@@ -119,7 +119,7 @@ func (userDoc *UserDoc) DocBuy() {
 		if err != nil {
 		if err != nil {
 			return nil, err
 			return nil, err
 		}
 		}
-		docMemberStatus :=  docMember["docMemberStatus"].(bool)
+		docMemberStatus := docMember["docMemberStatus"].(bool)
 		freeDownload := common.IntAll(docMember["free_download"])
 		freeDownload := common.IntAll(docMember["free_download"])
 		surplus, use := 0, 0 // 今日下载剩余次数,今日消耗次数
 		surplus, use := 0, 0 // 今日下载剩余次数,今日消耗次数
 		if docMemberStatus {
 		if docMemberStatus {
@@ -198,7 +198,7 @@ func (userDoc *UserDoc) DocBuy() {
 		// 没有ossdocId 说明是还没有下过的 需要先获得地址
 		// 没有ossdocId 说明是还没有下过的 需要先获得地址
 		if docInfo.OssDocId == "" {
 		if docInfo.OssDocId == "" {
 			// 如果是精品 则需要先调购买接口
 			// 如果是精品 则需要先调购买接口
-			if docInfo.ProductType == public.ProductTypePremium {
+			if docInfo.ProductType == public.ProductTypePremium && docInfo.Source == public.SourceDd {
 				_, err2 := rpc.PartUserBuy(docId, userInfo.MgoUserId, userInfo.Phone, userInfo.PositionId)
 				_, err2 := rpc.PartUserBuy(docId, userInfo.MgoUserId, userInfo.Phone, userInfo.PositionId)
 				if err2 != nil {
 				if err2 != nil {
 					return nil, fmt.Errorf("获取失败")
 					return nil, fmt.Errorf("获取失败")