package v1 import ( "encoding/json" "sfbase/global" "sfis/service" "strconv" "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, _ := strconv.Atoi(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)) service.MoneyRecharge(appid, money, c) } //产品剩余量充值接口 func productRecharge(c *gin.Context) { appid := c.PostForm("appid") productId, _ := strconv.Atoi(c.PostForm("productId")) rechargeNum, _ := strconv.Atoi(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)) service.ProductRecharge(appid, productId, rechargeNum, endTime, c) }