WH01243 4 سال پیش
والد
کامیت
685a258b8c
2فایلهای تغییر یافته به همراه34 افزوده شده و 7 حذف شده
  1. 6 1
      rpc/etc/integral.yaml
  2. 28 6
      service/integralService.go

+ 6 - 1
rpc/etc/integral.yaml

@@ -2,8 +2,13 @@ Name: integral.rpc
 ListenOn: 127.0.0.1:8080
 Etcd:
   Hosts:
-  - 127.0.0.1:2379
+    - 127.0.0.1:2379
   Key: integral.rpc
 DataSource: admin:123456@tcp(192.168.3.14:3306)/jyintegral?charset=utf8
 Cache:
   - Host: localhost:6379
+FileSystemConf:
+  Etcd:
+    Hosts:
+      - 127.0.0.1:2379
+    Key: integral.rpc

+ 28 - 6
service/integralService.go

@@ -1,9 +1,31 @@
 package service
 
+import (
+	"log"
+	"points_service/entity"
+	"time"
+)
+type IntegralService struct{}
+//消耗积分流水
+func(service *IntegralService) IntegralConsumeService() bool {
+	flow := entity.Flow{}
+	flow.UserId = "222"
+	flow.PointType = 1
+	flow.BusinessTypeId = 1
+	flow.BusinessType = "1"
+	flow.Point = 2
+	flow.CreateTime = time.Now().Format("2006-01-02 15:04:05")
+	flow.EndDate = time.Now().Format("2006-01-02")
+	flow.AppId = 10000
 
-
-//积分表新增数据
-
-//结存调整
-
-//余额调整
+	af, err := entity.Engine.Table("integral_flow").Insert(&flow)
+	if err != nil {
+		log.Print("消耗积分记录失败")
+		return true
+	}
+	if af >0 {
+		log.Println("消耗积分记录成功")
+		return true
+	}
+	return true
+}