Pārlūkot izejas kodu

feat:剑鱼币 rpc 方法

wangshan 1 gadu atpakaļ
vecāks
revīzija
d64fc82c91
1 mainītis faili ar 68 papildinājumiem un 2 dzēšanām
  1. 68 2
      middleground/jypoints.go

+ 68 - 2
middleground/jypoints.go

@@ -1,10 +1,13 @@
 package middleground
 
 import (
-	"log"
-
+	"app.yhyue.com/moapp/jyPoints/rpc/integral"
+	"app.yhyue.com/moapp/jyPoints/rpc/integralclient"
+	"context"
+	"fmt"
 	"github.com/zeromicro/go-zero/core/discov"
 	"github.com/zeromicro/go-zero/zrpc"
+	"log"
 )
 
 type jyPoints struct {
@@ -39,3 +42,66 @@ func (r *jyPoints) NewClient() zrpc.Client {
 	r.client = client
 	return client
 }
+
+// 积分消费2008
+func (r *jyPoints) PointConsume(userId, appId, endDate, sourceType, abstract string, point, pointType int64, operationType bool) (resp *integral.Resp, err error) {
+	client := r.NewClient()
+	if client == nil {
+		err = fmt.Errorf("jyPoint client err 01")
+		return
+	}
+	resp, err = integralclient.NewIntegral(client).IntegralConsume(context.Background(), &integral.Req{
+		UserId:        userId,
+		AppId:         appId,
+		EndDate:       endDate,
+		SourceType:    sourceType,
+		Point:         point,
+		PointType:     pointType,
+		Abstract:      abstract,
+		OperationType: operationType,
+	})
+	log.Println("消费剑鱼币 请求积分rpc 返回内容:", resp)
+	return
+}
+
+// 积分新增
+func (r *jyPoints) PointHarvest(userId, appId, endDate, sourceType, abstract string, point, pointType int64, operationType bool) (resp *integral.Resp, err error) {
+	client := r.NewClient()
+	if client == nil {
+		err = fmt.Errorf("jyPoint client err 02")
+		return
+	}
+	var (
+		ctx = context.Background()
+	)
+	resp, err = integralclient.NewIntegral(client).IntegralHarvest(ctx, &integral.Req{
+		UserId:        userId,
+		AppId:         appId,
+		EndDate:       endDate,
+		SourceType:    sourceType,
+		Point:         point,
+		PointType:     pointType,
+		Abstract:      abstract,
+		OperationType: operationType,
+	})
+	log.Println("奖励剑鱼币 请求积分rpc 返回内容:", resp)
+	return
+}
+
+// 积分查询
+func (r *jyPoints) PointIntegralBalance(userId, appId string) (resp *integral.Resp, err error) {
+	client := r.NewClient()
+	if client == nil {
+		err = fmt.Errorf("jyPoint client err 03")
+		return
+	}
+	var (
+		ctx = context.Background()
+	)
+	resp, err = integralclient.NewIntegral(client).IntegralBalanceCheck(ctx, &integral.Req{
+		UserId: userId,
+		AppId:  appId,
+	})
+	log.Println("奖励剑鱼币 请求积分rpc 返回内容:", resp)
+	return
+}