Răsfoiți Sursa

Merge branch 'master' of https://app.yhyue.com/moapp/jyPoints

李哲 4 ani în urmă
părinte
comite
5430a201e0

+ 7 - 4
api/integral.api

@@ -26,6 +26,7 @@ type Point {
 	CreateTime string `form:"createTime"`
 	EndDate    string `form:"endDate"`
 	Sort       int64  `form:"sort"`
+	Abstract   string `form:"abstract"`
 	Name       string `form:"name"`
 }
 
@@ -55,9 +56,10 @@ type (
 		PointType     int64  `form:"pointType"`
 		SourceId      string `form:"sourceId,optional"`
 		SourceType    string `form:"sourceType,optional"`
-		Point         int64  `form:"point"`
+		Point         int64  `form:"point,range=[0:100000000]"`
 		EndDate       string `form:"endDate,optional"`
-		OperationType bool   `form:"operationType"`
+		OperationType bool   `form:"operationType" `
+		Abstract      string `form:"abstract,optional"`
 	}
 
 	addResp {
@@ -70,10 +72,11 @@ type (
 		UserId     string `form:"userId"`
 		AppId      string `form:"appId"`
 		PointType  int64  `form:"pointType"`
-		SourceId   string `form:"sourceId"`
-		SourceType string `form:"sourceType"`
+		SourceId   string `form:"sourceId,optional"`
+		SourceType string `form:"sourceType,optional"`
 		Point      int64  `form:"point,range=[0:100000000]"`
 		EndDate    string `form:"endDate,optional"`
+		Abstract   string `form:"abstract,optional"`
 	}
 
 	ConsumeResp {

+ 0 - 1
api/internal/handler/integralbalancecheckhandler.go

@@ -9,7 +9,6 @@ import (
 
 	"github.com/tal-tech/go-zero/rest/httpx"
 )
-
 func IntegralBalanceCheckHandler(ctx *svc.ServiceContext) http.HandlerFunc {
 	return func(w http.ResponseWriter, r *http.Request) {
 		var req types.CheckReq

+ 1 - 0
api/internal/logic/integralconsumelogic.go

@@ -37,6 +37,7 @@ func (l *IntegralConsumeLogic) IntegralConsume(req types.ConsumeReq) (*types.Con
 		SourceId:   req.SourceId,
 		PointType:  req.PointType,
 		Point:      req.Point,
+		Abstract:   req.Abstract,
 	})
 	if err != nil {
 		return nil, err

+ 1 - 0
api/internal/logic/integraldetailedchecklogic.go

@@ -51,6 +51,7 @@ func (l *IntegralDetailedCheckLogic) IntegralDetailedCheck(req types.DetailedReq
 		point.SourceId=value.SourceId
 		point.SourceType=value.SourceType
 		point.Name=value.Name
+		point.Abstract=value.Abstract
 		data=append(data,&point)
 	}
 	result.Data=data

+ 1 - 0
api/internal/logic/integralharvestlogic.go

@@ -36,6 +36,7 @@ func (l *IntegralHarvestLogic) IntegralHarvest(req types.AddReq) (*types.AddResp
 		SourceId:      req.SourceId,
 		Point:         req.Point,
 		PointType:     req.PointType,
+		Abstract:      req.Abstract,
 		OperationType: req.OperationType,
 	})
 	if err != nil {

+ 6 - 3
api/internal/types/types.go

@@ -25,6 +25,7 @@ type Point struct {
 	CreateTime string `form:"createTime"`
 	EndDate    string `form:"endDate"`
 	Sort       int64  `form:"sort"`
+	Abstract   string `form:"abstract"`
 	Name       string `form:"name"`
 }
 
@@ -52,9 +53,10 @@ type AddReq struct {
 	PointType     int64  `form:"pointType"`
 	SourceId      string `form:"sourceId,optional"`
 	SourceType    string `form:"sourceType,optional"`
-	Point         int64  `form:"point"`
+	Point         int64  `form:"point,range=[0:100000000]"`
 	EndDate       string `form:"endDate,optional"`
 	OperationType bool   `form:"operationType"`
+	Abstract      string `form:"abstract,optional"`
 }
 
 type AddResp struct {
@@ -66,10 +68,11 @@ type ConsumeReq struct {
 	UserId     string `form:"userId"`
 	AppId      string `form:"appId"`
 	PointType  int64  `form:"pointType"`
-	SourceId   string `form:"sourceId"`
-	SourceType string `form:"sourceType"`
+	SourceId   string `form:"sourceId,optional"`
+	SourceType string `form:"sourceType,optional"`
 	Point      int64  `form:"point,range=[0:100000000]"`
 	EndDate    string `form:"endDate,optional"`
+	Abstract   string `form:"abstract,optional"`
 }
 
 type ConsumeResp struct {

+ 37 - 33
entity/integral.go

@@ -38,31 +38,34 @@ type BalanceUpdate struct {
 
 //积分流水
 type Flow struct {
-	Id           int64  `xorm:"pk autoincr id" form:"id" json:"id"`
-	UserId       string `xorm:"userId" form:"userId" json:"userId"`                   //用户标识
-	PointType    int64  `xorm:"pointType" form:"pointType" json:"pointType"`          //积分类型
-	SourceId   string `xorm:"sourceId" form:"sourceId" json:"sourceId"`               //来源标识
-	SourceType string `xorm:"sourceType" form:"sourceType" json:"sourceType"` 		  //来源类型
-	Point        int64  `xorm:"point" form:"point" json:"point"`                      //积分
-	CreateTime   string `xorm:"createTime" form:"createTime" json:"createTime"`       //创建时间
-	EndDate      string `xorm:"endDate" form:"endDate" json:"endDate"`                //截止时间
-	AppId        string `xorm:"appId" form:"appId" json:"appId"`                      //剑鱼标识
-	Sort         int64  `xorm:"sort" form:"sort" json:"sort"`                         //操作类型1加-1减
+	Id            int64  `xorm:"pk autoincr id" form:"id" json:"id"`
+	UserId        string `xorm:"userId" form:"userId" json:"userId"`                      //用户标识
+	PointType     int64  `xorm:"pointType" form:"pointType" json:"pointType"`             //积分类型
+	SourceId      string `xorm:"sourceId" form:"sourceId" json:"sourceId"`                //来源标识
+	SourceType    string `xorm:"sourceType" form:"sourceType" json:"sourceType"`          //来源类型
+	Point         int64  `xorm:"point" form:"point" json:"point"`                         //积分
+	CreateTime    string `xorm:"createTime" form:"createTime" json:"createTime"`          //创建时间
+	EndDate       string `xorm:"endDate" form:"endDate" json:"endDate"`                   //截止时间
+	AppId         string `xorm:"appId" form:"appId" json:"appId"`                         //剑鱼标识
+	Sort          int64  `xorm:"sort" form:"sort" json:"sort"`                            //操作类型1加-1减
+	OperationType int64  `xorm:"OperationType" form:"OperationType" json:"OperationType"` //1永久2时效
+	Abstract      string `xorm:"abstract" form:"abstract" json:"abstract"`                //积分类型名称
 }
 
 //积分流水
 type FlowReq struct {
-	Id             int64  `xorm:"pk autoincr id" form:"id" json:"id"`
-	UserId         string `xorm:"userId" form:"userId" json:"userId"`                         //用户标识
-	PointType      int64  `xorm:"pointType" form:"pointType" json:"pointType"`                //积分类型
-	SourceId   string `xorm:"sourceId" form:"sourceId" json:"sourceId"`               //来源标识
-	SourceType string `xorm:"sourceType" form:"sourceType" json:"sourceType"` 		  //来源类型
-	Point          int64  `xorm:"point" form:"point" json:"point"`                            //积分
-	CreateTime     time.Time `xorm:"createTime" form:"createTime" json:"createTime"`             //创建时间
-	EndDate        string `xorm:"endDate" form:"endDate" json:"endDate"`                      //截止时间
-	AppId          string `xorm:"appId" form:"appId" json:"appId"`                            //剑鱼标识
-	Sort           int64  `xorm:"sort" form:"sort" json:"sort"`                               //操作类型1加-1减
-	Name           string `xorm:"name" form:"name" json:"name"`                               //积分类型名称
+	Id         int64     `xorm:"pk autoincr id" form:"id" json:"id"`
+	UserId     string    `xorm:"userId" form:"userId" json:"userId"`             //用户标识
+	PointType  int64     `xorm:"pointType" form:"pointType" json:"pointType"`    //积分类型
+	SourceId   string    `xorm:"sourceId" form:"sourceId" json:"sourceId"`       //来源标识
+	SourceType string    `xorm:"sourceType" form:"sourceType" json:"sourceType"` //来源类型
+	Point      int64     `xorm:"point" form:"point" json:"point"`                //积分
+	CreateTime time.Time `xorm:"createTime" form:"createTime" json:"createTime"` //创建时间
+	EndDate    string    `xorm:"endDate" form:"endDate" json:"endDate"`          //截止时间
+	AppId      string    `xorm:"appId" form:"appId" json:"appId"`                //剑鱼标识
+	Sort       int64     `xorm:"sort" form:"sort" json:"sort"`                   //操作类型1加-1减
+	Name       string    `xorm:"name" form:"name" json:"name"`                   //积分类型名称
+	Abstract   string    `xorm:"abstract" form:"abstract" json:"abstract"`       //积分类型名称
 }
 
 //积分结存
@@ -77,18 +80,19 @@ type Solde struct {
 
 //积分流水
 type FlowJSON struct {
-	UserId         string `xorm:"userId" form:"userId" json:"userId"`                         //用户标识
-	PointType      int64  `xorm:"pointType" form:"pointType" json:"pointType"`                //积分类型
-	SourceId   string `xorm:"sourceId" form:"sourceId" json:"sourceId"`               //来源标识
-	SourceType string `xorm:"sourceType" form:"sourceType" json:"sourceType"` 		  //来源类型
-	Point          int64  `xorm:"point" form:"point" json:"point"`                            //积分
-	EndDate        string `xorm:"endDate" form:"endDate" json:"endDate"`                      //截止时间
-	AppId          string `xorm:"appId" form:"appId" json:"appId"`                            //剑鱼标识
-	OperationType  bool   `xorm:"operationType" form:"operationType" json:"operationType"`    //永久:true、时效:false
-	Sort           int64  `xorm:"sort" form:"sort" json:"sort"`                               //操作类型1加-1减
-	Page           int64  `xorm:"page" form:"page" json:"page"`                               //当前页数
-	PageSize       int64  `xorm:"pageSize" form:"pageSize" json:"pageSize"`                   //每页数量
-	SearchType     int64  `xorm:"searchType" form:"searchType" json:"searchType"`             //searchType 0全部 1新增 -1消耗
+	UserId        string `xorm:"userId" form:"userId" json:"userId"`                      //用户标识
+	PointType     int64  `xorm:"pointType" form:"pointType" json:"pointType"`             //积分类型
+	SourceId      string `xorm:"sourceId" form:"sourceId" json:"sourceId"`                //来源标识
+	SourceType    string `xorm:"sourceType" form:"sourceType" json:"sourceType"`          //来源类型
+	Point         int64  `xorm:"point" form:"point" json:"point"`                         //积分
+	EndDate       string `xorm:"endDate" form:"endDate" json:"endDate"`                   //截止时间
+	AppId         string `xorm:"appId" form:"appId" json:"appId"`                         //剑鱼标识
+	OperationType bool   `xorm:"operationType" form:"operationType" json:"operationType"` //永久:true、时效:false
+	Sort          int64  `xorm:"sort" form:"sort" json:"sort"`                            //操作类型1加-1减
+	Page          int64  `xorm:"page" form:"page" json:"page"`                            //当前页数
+	PageSize      int64  `xorm:"pageSize" form:"pageSize" json:"pageSize"`                //每页数量
+	Abstract      string `xorm:"abstract" form:"abstract" json:"abstract"`                //积分类型名称
+	SearchType    int64  `xorm:"searchType" form:"searchType" json:"searchType"`          //searchType 0全部 1新增 -1消耗
 }
 
 //到期积分查询

+ 1 - 0
go.mod

@@ -8,6 +8,7 @@ require (
 	github.com/golang/protobuf v1.4.3
 	github.com/tal-tech/go-zero v1.1.5
 	go.uber.org/automaxprocs v1.4.0 // indirect
+	golang.org/x/time v0.0.0-20191024005414-555d28b269f0
 	google.golang.org/grpc v1.29.1
 	google.golang.org/protobuf v1.25.0
 

+ 2 - 0
rpc/etc/integral.yaml

@@ -1,5 +1,7 @@
 Name: integral.rpc
 ListenOn: 127.0.0.1:8087
+Log:
+  Mode: console
 Etcd:
   Hosts:
     - 127.0.0.1:2379

+ 11 - 0
rpc/integral.go

@@ -7,12 +7,14 @@ import (
 	"app.yhyue.com/moapp/jyPoints/rpc/internal/server"
 	"app.yhyue.com/moapp/jyPoints/rpc/internal/svc"
 	"app.yhyue.com/moapp/jyPoints/service"
+	"context"
 	"flag"
 	"fmt"
 	_ "github.com/go-sql-driver/mysql"
 	"github.com/go-xorm/xorm"
 	"github.com/tal-tech/go-zero/core/conf"
 	"github.com/tal-tech/go-zero/zrpc"
+	"golang.org/x/time/rate"
 	"google.golang.org/grpc"
 	"log"
 )
@@ -22,6 +24,7 @@ var c config.Config
 var (
 	integralService = &service.IntegralService{}
 )
+var limiter = rate.NewLimiter(rate.Limit(100), 100)
 
 
 func main() {
@@ -31,6 +34,7 @@ func main() {
 	s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
 		integral.RegisterIntegralServer(grpcServer, srv)
 	})
+	s.AddUnaryInterceptors(rateLimitInterceptor)
 	defer s.Stop()
 	fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
 	s.Start()
@@ -46,4 +50,11 @@ func init() {
 		log.Fatal("数据库连接失败:", err)
 	}
 	fmt.Println(c.DataSource+"链接成功")
+}
+
+
+func rateLimitInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {
+	fmt.Println("拦截器")
+	log.Println("方法名:",info.FullMethod,"  参数:",req)
+	return handler(ctx, req)
 }

+ 3 - 2
rpc/integral.proto

@@ -14,8 +14,7 @@ message Req {
   int64 pageSize = 9;
   bool operationType = 10;
   int64 SearchType=11;
-
-
+  string Abstract=12;
 }
 
 message Resp {
@@ -41,6 +40,8 @@ message Point {
     string endDate = 7;
     int64 Sort = 8;
     string name=9;
+    string abstract=10;
+
 }
 
 service Integral {

+ 69 - 51
rpc/integral/integral.pb.go

@@ -33,7 +33,6 @@ type Req struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
-
 	UserId        string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"`
 	AppId         string `protobuf:"bytes,2,opt,name=appId,proto3" json:"appId,omitempty"`
 	PointType     int64  `protobuf:"varint,3,opt,name=pointType,proto3" json:"pointType,omitempty"`
@@ -45,6 +44,7 @@ type Req struct {
 	PageSize      int64  `protobuf:"varint,9,opt,name=pageSize,proto3" json:"pageSize,omitempty"`
 	OperationType bool   `protobuf:"varint,10,opt,name=operationType,proto3" json:"operationType,omitempty"`
 	SearchType    int64  `protobuf:"varint,11,opt,name=SearchType,proto3" json:"SearchType,omitempty"`
+	Abstract      string `protobuf:"bytes,12,opt,name=Abstract,proto3" json:"Abstract,omitempty"`
 }
 
 func (x *Req) Reset() {
@@ -156,6 +156,13 @@ func (x *Req) GetSearchType() int64 {
 	return 0
 }
 
+func (x *Req) GetAbstract() string {
+	if x != nil {
+		return x.Abstract
+	}
+	return ""
+}
+
 type Resp struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -312,6 +319,7 @@ type Point struct {
 	EndDate    string `protobuf:"bytes,7,opt,name=endDate,proto3" json:"endDate,omitempty"`
 	Sort       int64  `protobuf:"varint,8,opt,name=Sort,proto3" json:"Sort,omitempty"`
 	Name       string `protobuf:"bytes,9,opt,name=name,proto3" json:"name,omitempty"`
+	Abstract   string `protobuf:"bytes,10,opt,name=abstract,proto3" json:"abstract,omitempty"`
 }
 
 func (x *Point) Reset() {
@@ -409,11 +417,18 @@ func (x *Point) GetName() string {
 	return ""
 }
 
+func (x *Point) GetAbstract() string {
+	if x != nil {
+		return x.Abstract
+	}
+	return ""
+}
+
 var File_integral_proto protoreflect.FileDescriptor
 
 var file_integral_proto_rawDesc = []byte{
 	0x0a, 0x0e, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
-	0x12, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x22, 0xb3, 0x02, 0x0a, 0x03, 0x52,
+	0x12, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x22, 0xcf, 0x02, 0x0a, 0x03, 0x52,
 	0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
 	0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70,
 	0x70, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64,
@@ -433,56 +448,59 @@ var file_integral_proto_rawDesc = []byte{
 	0x08, 0x52, 0x0d, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65,
 	0x12, 0x1e, 0x0a, 0x0a, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0b,
 	0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65,
-	0x22, 0x60, 0x0a, 0x04, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65,
-	0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07,
-	0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d,
-	0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03,
-	0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x78,
-	0x70, 0x69, 0x72, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x65, 0x78, 0x70, 0x69,
-	0x72, 0x65, 0x22, 0x73, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x12,
-	0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f,
-	0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20,
-	0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05,
-	0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75,
-	0x6e, 0x74, 0x12, 0x23, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b,
-	0x32, 0x0f, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x2e, 0x50, 0x6f, 0x69, 0x6e,
-	0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0xe9, 0x01, 0x0a, 0x05, 0x50, 0x6f, 0x69, 0x6e,
-	0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69,
-	0x64, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02,
-	0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12,
-	0x1a, 0x0a, 0x08, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28,
-	0x09, 0x52, 0x08, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x73,
-	0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
-	0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70,
-	0x6f, 0x69, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x6f, 0x69, 0x6e,
-	0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18,
-	0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d,
-	0x65, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x64, 0x44, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01,
-	0x28, 0x09, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x44, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x53,
-	0x6f, 0x72, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x53, 0x6f, 0x72, 0x74, 0x12,
-	0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,
-	0x61, 0x6d, 0x65, 0x32, 0xc7, 0x02, 0x0a, 0x08, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c,
-	0x12, 0x30, 0x0a, 0x0f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x48, 0x61, 0x72, 0x76,
-	0x65, 0x73, 0x74, 0x12, 0x0d, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x2e, 0x52,
-	0x65, 0x71, 0x1a, 0x0e, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x2e, 0x52, 0x65,
-	0x73, 0x70, 0x12, 0x30, 0x0a, 0x0f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x43, 0x6f,
-	0x6e, 0x73, 0x75, 0x6d, 0x65, 0x12, 0x0d, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c,
-	0x2e, 0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x2e,
-	0x52, 0x65, 0x73, 0x70, 0x12, 0x35, 0x0a, 0x14, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c,
-	0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x0d, 0x2e, 0x69,
-	0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x2e, 0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e, 0x69, 0x6e,
-	0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x3a, 0x0a, 0x15, 0x69,
-	0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x43,
+	0x12, 0x1a, 0x0a, 0x08, 0x41, 0x62, 0x73, 0x74, 0x72, 0x61, 0x63, 0x74, 0x18, 0x0c, 0x20, 0x01,
+	0x28, 0x09, 0x52, 0x08, 0x41, 0x62, 0x73, 0x74, 0x72, 0x61, 0x63, 0x74, 0x22, 0x60, 0x0a, 0x04,
+	0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01,
+	0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73,
+	0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61,
+	0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03,
+	0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65,
+	0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x22, 0x73,
+	0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f,
+	0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18,
+	0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
+	0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e,
+	0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x23,
+	0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x69,
+	0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x2e, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x04, 0x64,
+	0x61, 0x74, 0x61, 0x22, 0x85, 0x02, 0x0a, 0x05, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x0e, 0x0a,
+	0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a,
+	0x09, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03,
+	0x52, 0x09, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73,
+	0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73,
+	0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63,
+	0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x6f, 0x75,
+	0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x6f, 0x69, 0x6e, 0x74,
+	0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1e, 0x0a,
+	0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28,
+	0x09, 0x52, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a,
+	0x07, 0x65, 0x6e, 0x64, 0x44, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
+	0x65, 0x6e, 0x64, 0x44, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6f, 0x72, 0x74, 0x18,
+	0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x53, 0x6f, 0x72, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e,
+	0x61, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
+	0x1a, 0x0a, 0x08, 0x61, 0x62, 0x73, 0x74, 0x72, 0x61, 0x63, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28,
+	0x09, 0x52, 0x08, 0x61, 0x62, 0x73, 0x74, 0x72, 0x61, 0x63, 0x74, 0x32, 0xc7, 0x02, 0x0a, 0x08,
+	0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x12, 0x30, 0x0a, 0x0f, 0x69, 0x6e, 0x74, 0x65,
+	0x67, 0x72, 0x61, 0x6c, 0x48, 0x61, 0x72, 0x76, 0x65, 0x73, 0x74, 0x12, 0x0d, 0x2e, 0x69, 0x6e,
+	0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x2e, 0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e, 0x69, 0x6e, 0x74,
+	0x65, 0x67, 0x72, 0x61, 0x6c, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x30, 0x0a, 0x0f, 0x69, 0x6e,
+	0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x12, 0x0d, 0x2e,
+	0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x2e, 0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e, 0x69,
+	0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x35, 0x0a, 0x14,
+	0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x43,
 	0x68, 0x65, 0x63, 0x6b, 0x12, 0x0d, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x2e,
-	0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x2e, 0x52,
-	0x65, 0x73, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2e, 0x0a, 0x0d, 0x69, 0x6e, 0x74, 0x65, 0x67,
-	0x72, 0x61, 0x6c, 0x47, 0x75, 0x61, 0x72, 0x64, 0x12, 0x0d, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x67,
-	0x72, 0x61, 0x6c, 0x2e, 0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72,
-	0x61, 0x6c, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x34, 0x0a, 0x13, 0x69, 0x6e, 0x74, 0x65, 0x67,
-	0x72, 0x61, 0x6c, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x0d,
-	0x2e, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x2e, 0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e,
-	0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x62, 0x06, 0x70,
-	0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x2e, 0x52,
+	0x65, 0x73, 0x70, 0x12, 0x3a, 0x0a, 0x15, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x44,
+	0x65, 0x74, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x0d, 0x2e, 0x69,
+	0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x2e, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x69, 0x6e,
+	0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x12,
+	0x2e, 0x0a, 0x0d, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x47, 0x75, 0x61, 0x72, 0x64,
+	0x12, 0x0d, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x2e, 0x52, 0x65, 0x71, 0x1a,
+	0x0e, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x12,
+	0x34, 0x0a, 0x13, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x45, 0x78, 0x70, 0x69, 0x72,
+	0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x0d, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61,
+	0x6c, 0x2e, 0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c,
+	0x2e, 0x52, 0x65, 0x73, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (

+ 2 - 2
rpc/internal/logic/integralbalancechecklogic.go

@@ -1,9 +1,9 @@
 package logic
 
 import (
-	"context"
 	"app.yhyue.com/moapp/jyPoints/rpc/integral"
 	"app.yhyue.com/moapp/jyPoints/rpc/internal/svc"
+	"context"
 
 	"github.com/tal-tech/go-zero/core/logx"
 )
@@ -26,7 +26,7 @@ func NewIntegralBalanceCheckLogic(ctx context.Context, svcCtx *svc.ServiceContex
 func (l *IntegralBalanceCheckLogic) IntegralBalanceCheck(in *integral.Req) (*integral.Resp, error) {
 	// todo: add your logic here and delete this line
 	result := &integral.Resp{}
-	flag,total,expire := integralService.IntegralBalanceCheckService(in.UserId,in.AppId)
+	flag, total, expire := integralService.IntegralBalanceCheckService(in.UserId, in.AppId)
 	if flag {
 		result.Code = 1
 		result.Data = total

+ 1 - 0
rpc/internal/logic/integralconsumelogic.go

@@ -41,6 +41,7 @@ func (l *IntegralConsumeLogic) IntegralConsume(in *integral.Req) (*integral.Resp
 	dat.Point = in.Point
 	dat.EndDate = in.EndDate
 	dat.AppId = in.AppId
+	dat.Abstract=in.Abstract
 	code,msg := integralService.IntegralConsumeService(dat)
 	result.Code = code
 	result.Message = msg

+ 1 - 0
rpc/internal/logic/integralharvestlogic.go

@@ -36,6 +36,7 @@ func (l *IntegralHarvestLogic) IntegralHarvest(in *integral.Req) (*integral.Resp
 	dat.OperationType = in.OperationType
 	dat.UserId = in.UserId
 	dat.Point = in.Point
+	dat.Abstract=in.Abstract
 	code, msg := integralService.IntegralAddService(dat)
 	fmt.Println(code, msg)
 	result.Code = code

+ 25 - 17
service/integralService.go

@@ -20,13 +20,17 @@ func (service *IntegralService) IntegralAddService(data entity.FlowJSON) (int64,
 	flow.SourceId = data.SourceId
 	//flow.SourceType = data.SourceType
 	flow.PointType = data.PointType
-	flow.SourceType=fmt.Sprint(data.PointType)
+	flow.SourceType = fmt.Sprint(data.PointType)
 	flow.Point = data.Point
-	flow.EndDate=data.EndDate
+	flow.EndDate = data.EndDate
 	flow.CreateTime = time.Now().Format("2006-01-02 15:04:05")
 	flow.AppId = data.AppId
 	flow.Sort = entity.AddCode
+	flow.Abstract = data.Abstract
 	var numb = int64(0)
+	if data.OperationType {
+		flow.OperationType = 1
+	}
 	numb, err = orm.Table("integral_flow").Insert(flow)
 	if err != nil && numb == 0 {
 		log.Print("新增流水失败:", err)
@@ -40,6 +44,7 @@ func (service *IntegralService) IntegralAddService(data entity.FlowJSON) (int64,
 	if data.OperationType {
 		//永久积分
 		//先查看是否有EndDate的积分
+
 		soldelist := []entity.Solde{}
 		err = orm.Table("integral_solde").Where("appId=? and  userId=? and endDate='' and perManEntPoints != 0 AND timePoints = 0 ", data.AppId, data.UserId).Find(&soldelist)
 		if len(soldelist) > 0 {
@@ -61,6 +66,7 @@ func (service *IntegralService) IntegralAddService(data entity.FlowJSON) (int64,
 		}
 
 	} else {
+		flow.OperationType = 0
 		solde.EndDate = data.EndDate
 		//先查看是否有EndDate的积分
 		soldelist := []entity.Solde{}
@@ -127,11 +133,11 @@ func (service *IntegralService) IntegralConsumeService(data entity.FlowJSON) (in
 	b, err := orm.Table("integral_balance").Select("countPoints,id").
 		Where("userId = ? AND appId = ?", data.UserId, data.AppId).
 		Get(&balance)
-	if  err != nil {
+	if err != nil {
 		log.Printf("积分余额查询出错,userId:[%s],err:[%v]", data.UserId, err)
 		return entity.ErrorCode, "积分余额查询出错"
 	}
-	if !b{
+	if !b {
 		log.Printf("没有查询到[%s]的积分记录,err:[%v]", data.UserId, err)
 		return entity.ErrorCode, "没有查询到积分记录"
 	}
@@ -160,7 +166,7 @@ func (service *IntegralService) IntegralConsumeService(data entity.FlowJSON) (in
 				//够消耗
 				solde.PerManEntPoints = solde.PerManEntPoints - point
 				point = 0
-				af, err =  orm.Table("integral_solde").
+				af, err = orm.Table("integral_solde").
 					ID(solde.Id).
 					Cols("perManEntPoints").
 					Update(solde)
@@ -217,9 +223,10 @@ func (service *IntegralService) IntegralConsumeService(data entity.FlowJSON) (in
 	//消耗积分流水记录
 	flow := entity.Flow{}
 	flow.UserId = data.UserId
-	flow.SourceType=fmt.Sprint(data.PointType)
+	flow.SourceType = fmt.Sprint(data.PointType)
 	flow.PointType = data.PointType
 	flow.SourceId = data.SourceId
+	flow.Abstract = data.Abstract
 	//flow.SourceType = data.SourceType
 	flow.Point = data.Point
 	flow.CreateTime = time.Now().Format("2006-01-02 15:04:05")
@@ -227,7 +234,7 @@ func (service *IntegralService) IntegralConsumeService(data entity.FlowJSON) (in
 	flow.AppId = data.AppId
 	flow.Sort = entity.ReduceCode
 	af, err = orm.Table("integral_flow").Insert(&flow)
-	if err != nil || af == 0{
+	if err != nil || af == 0 {
 		log.Print("积分记录失败")
 		orm.Rollback()
 		return entity.ErrorCode, "积分记录失败"
@@ -468,7 +475,7 @@ func (service *IntegralService) IntegralGuardService(endDate string) bool {
 }
 
 //积分余额查询
-func (service *IntegralService) IntegralBalanceCheckService(userId,appId string  ) (bool, int64,int64) {
+func (service *IntegralService) IntegralBalanceCheckService(userId, appId string) (bool, int64, int64) {
 	orm := entity.Engine
 	//积分总余额
 	balance := entity.Balance{}
@@ -477,7 +484,7 @@ func (service *IntegralService) IntegralBalanceCheckService(userId,appId string
 		Get(&balance)
 	if err != nil {
 		log.Println("积分查询出错")
-		return false, 0,0
+		return false, 0, 0
 	}
 	//积分30天内到期余额
 	var solde entity.Solde
@@ -487,9 +494,9 @@ func (service *IntegralService) IntegralBalanceCheckService(userId,appId string
 		Get(&solde)
 	if err != nil {
 		log.Println(err)
-		return false, 0,0
+		return false, 0, 0
 	}
-	return true, balance.CountPoints,solde.TimePoints
+	return true, balance.CountPoints, solde.TimePoints
 }
 
 //按月查询积分使用情况
@@ -497,11 +504,11 @@ func (service *IntegralService) IntegralDetailedCheck(data entity.FlowJSON) ([]*
 	orm := entity.Engine.NewSession()
 	//查询时间范围内的
 	//查询新增消耗的积分和消耗积分 searchType 0全部 1新增 -1消耗
-	searchCode :="1=1"
-	if data.SearchType==1{
-		searchCode="   flow.Sort=1"
-	}else if data.SearchType==-1{
-		searchCode="   flow.Sort=-1"
+	searchCode := "1=1"
+	if data.SearchType == 1 {
+		searchCode = "   flow.Sort=1"
+	} else if data.SearchType == -1 {
+		searchCode = "   flow.Sort=-1"
 	}
 	var flowList []*entity.FlowReq
 	numb, err := orm.Table("integral_flow").Alias("flow").
@@ -510,7 +517,7 @@ func (service *IntegralService) IntegralDetailedCheck(data entity.FlowJSON) ([]*
 		Where("flow.userId = ? AND flow.appId = ?", data.UserId, data.AppId).
 		And(searchCode).
 		Desc("flow.createTime").
-		Limit(int(data.PageSize), (int(data.Page-1))*int(data.PageSize)).
+		Limit(int(data.PageSize), (int(data.Page - 1))*int(data.PageSize)).
 		FindAndCount(&flowList)
 	var flowReq []*integral.Point
 	for _, value := range flowList {
@@ -524,6 +531,7 @@ func (service *IntegralService) IntegralDetailedCheck(data entity.FlowJSON) ([]*
 		point.SourceId = value.SourceId
 		point.SourceType = value.SourceType
 		point.Name = value.Name
+		point.Abstract = value.Abstract
 		flowReq = append(flowReq, &point)
 	}
 	fmt.Println(flowList)