Initial commit

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-15 13:57:10 +08:00
co-authored by Claude Opus 5
commit 8679200f41
1897 changed files with 257900 additions and 0 deletions
+52
View File
@@ -0,0 +1,52 @@
package rechargectrl
import (
"errors"
"fmt"
"net/http"
"strconv"
"time"
"91porn-server/common/log"
"91porn-server/common/rchgutil"
"91porn-server/web/service/rechargeser"
"github.com/gin-gonic/gin"
)
// ZhongFuCallBack 金鱼结构回调函数
func ZhongFuCallBack(ctx *gin.Context) {
if err := func() error {
rchg := rchgutil.ZhongFuRes{}
if err := ctx.ShouldBind(&rchg); err != nil {
log.Error(fmt.Sprintf("ZhongFu callback parameter bind fail error:%+v:", err))
return err
}
log.Info(fmt.Sprintf("ZhongFu callback parameter data:%+v:", rchg))
if rchg.Sign != rchg.ToSign() {
log.Error("ZhongFu callback sign verify fail")
return errors.New("check sign fail")
}
payMoneyf, err := strconv.ParseFloat(rchg.PayMoney, 64)
if err != nil {
log.Error(fmt.Sprintf("ZhongFu callback ParseFloat fail error:%+v:", err))
return fmt.Errorf("invalid payMoney %s", rchg.PayMoney)
}
payMoneyf = payMoneyf * 100
payMoney := int64(payMoneyf)
var status int = 200
if rchg.Code != "00" {
return nil
}
loc, _ := time.LoadLocation("Local")
paymentAt, _ := time.ParseInLocation("20060102150405", rchg.PayTime, loc)
if err = rechargeser.RechargeCallBack(ctx, rchg.OID, payMoney, rchg.TradeNo, status, paymentAt); err != nil {
log.Error(fmt.Sprintf("ZhongFu RechargeCallBack fail error:%+v:", err))
}
return err
}(); err != nil {
ctx.String(http.StatusBadRequest, "fail")
return
}
ctx.String(http.StatusOK, "OK")
}