|
@@ -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
|
|
|
+}
|