浏览代码

Merge branch 'master' of http://192.168.3.207:10080/group3/SwordFish_Interface_Service

wanghuidong 4 年之前
父节点
当前提交
e14579d81b
共有 3 个文件被更改,包括 86 次插入12 次删除
  1. 50 0
      api/v1/userRecharge.go
  2. 0 10
      model/product.go
  3. 36 2
      model/user.go

+ 50 - 0
api/v1/userRecharge.go

@@ -0,0 +1,50 @@
+package v1
+
+import (
+	"encoding/json"
+	"sfbase/global"
+
+	"github.com/gin-gonic/gin"
+	"go.uber.org/zap"
+)
+
+//充值相关接口服务
+func RechargeApiRegister(router *gin.Engine) {
+	routerGroup := router.Group("/sfis/api/v1/user/")
+	routerGroup.Use()
+	{
+		routerGroup.POST("/moneyRecharge", moneyRecharge)
+		routerGroup.POST("/productRecharge", productRecharge)
+	}
+}
+
+//余额充值接口
+func moneyRecharge(c *gin.Context) {
+	appid := c.PostForm("appid")
+	money := c.PostForm("money")
+	p := gin.H{
+		"appid": appid,
+		"money": money,
+	}
+	bs, _ := json.Marshal(p)
+	param := string(bs)
+	global.Logger.Info("api moneyRecharge:", zap.Any("param:", param))
+}
+
+//产品剩余量充值接口
+func productRecharge(c *gin.Context) {
+	appid := c.PostForm("appid")
+	productId := c.PostForm("productId")
+	rechargeNum := c.PostForm("rechargeNum")
+	endTime := c.PostForm("endTime")
+
+	p := gin.H{
+		"appid":       appid,
+		"productId":   productId,
+		"rechargeNum": rechargeNum,
+		"endTime":     endTime,
+	}
+	bs, _ := json.Marshal(p)
+	param := string(bs)
+	global.Logger.Info("api productRecharge:", zap.Any("param:", param))
+}

+ 0 - 10
model/product.go

@@ -33,13 +33,3 @@ type UserProduct struct {
 func (p *UserProduct) TableName() string {
 	return "user_product"
 }
-
-type UserAccount struct {
-	ID    int    `json:"id" gorm:"primaryKey"`
-	AppID string `json:"app_id"`
-	Money int    `json:"money"`
-}
-
-func (p *UserAccount) TableName() string {
-	return "user_account"
-}

+ 36 - 2
model/user.go

@@ -9,10 +9,44 @@ type User struct {
 	IpWhiteList string `json:"ip_white_list"`
 }
 
-
-
 func (user *User) TableName() string {
 	return "user"
 }
 
+type UserAccount struct {
+	ID    int    `json:"id" gorm:"primaryKey"`
+	AppID string `json:"app_id"`
+	Money int    `json:"money"`
+}
+
+func (p *UserAccount) TableName() string {
+	return "user_account"
+}
+
+type UserMoneyRecord struct {
+	ID         int    `json:"id" gorm:"primaryKey"`
+	AppID      string `json:"app_id"`
+	Before     int    `json:"before"`
+	After      int    `json:"after"`
+	TradeMoney int    `json:"tarde_money"`
+}
+
+func (p *UserMoneyRecord) TableName() string {
+	return "user_money_record"
+}
 
+type UserBuyRecord struct {
+	ID               int    `json:"id" gorm:"primaryKey"`
+	AppID            string `json:"app_id"`
+	ProductId        int    `json:"product_id"`
+	UserProductId    int    `json:"user_product_id"`
+	Before           int    `json:"before"`
+	After            int    `json:"after"`
+	TradeMoney       int    `json:"tarde_money"`
+	BuyType          int    `json:"buy_type"`
+	HistoryUnitPrice int    `json:"history_unit_price"`
+}
+
+func (p *UserBuyRecord) TableName() string {
+	return "user_buy_record"
+}