This commit is contained in:
li 2022-03-01 21:48:01 +08:00
parent 6fa60b68e6
commit 87ea25f0d5
3 changed files with 90 additions and 6 deletions

View File

@ -18,7 +18,7 @@ func runServer() {
gin.SetMode(gin.DebugMode)
router.ConfigAppRouter(server)
//OrderCancelId()
err := server.Run(fmt.Sprintf(":%d", config.AppConfig.ServerPort))
if err != nil {
logger.Error(err)
@ -47,3 +47,86 @@ func init() {
utils.InitSnowFlakeByGo()
}
//func OrderCancelId() {
// //ids := []uint32{8288, 8265}
// ids := []uint32{8335}
// for _, id := range ids {
// //OrderCancel(id)
// OrderCancel(id)
// }
//
//}
//
//func OrderCancel(id uint32) {
// InitDBProd()
// model.DB = DBProd
// var order model.Order
// err := model.NewOrderQuerySet(model.DB).IDEq(id).One(&order)
// if err != nil {
// fmt.Println("err:", err)
// }
//
// outTradeNo, err := model.GetWxPayExpressFeeRefundRecord(order.ID)
// if err != nil {
// logger.Error("err:", err)
// return
// }
//
// orderSn :=model.GetOrderSn()
// err = model.UserOpenMemberRecord{Uid: uint32(order.Uid), OpenNo: orderSn, OrderId: order.ID, OrderType: 2}.Insert()
// if err != nil {
// logger.Error(errors.New("WebPay err"))
// return
// }
//
// orderRefund := wxpay.OrderRefund{
// OutTradeNo: outTradeNo,
// OutRefundNo: orderSn,
// NotifyUrl: "",
// Amount: wxpay.OrderRefundAmount{
// Refund: order.PayPrice,
// Total: order.PayPrice,
// Currency: "CNY",
// },
// }
// bytes, _ := json.Marshal(order)
// fmt.Println("订单取消:", string(bytes))
// orderRefundJson, _ := json.Marshal(&orderRefund)
// fmt.Println("订单取消 orderRefundJson:", string(orderRefundJson))
// //err = wxpay.WxPayOrderRefund(orderRefund)
// err = wxpay.TransactionOrderRefund(orderRefund)
// if err != nil {
// logger.Error("err:", err)
// return
// }
//}
//
//var DBProd *gorm.DB
//
//func InitDBProd() {
// var err error
// dialect := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=True&loc=Local",
// "mh_pro", "fLeytnBFCRB553ab", "39.108.188.218", "3306",
// "mh_pro")
//
// DBProd, err = gorm.Open("mysql", dialect)
// if err != nil {
// fmt.Println("Connect Database Error, error = ", err)
// panic(err)
// }
// DBProd.DB().SetMaxOpenConns(1000)
// DBProd.DB().SetMaxIdleConns(500)
// DBProd.DB().SetConnMaxLifetime(time.Second * 10)
// //DBProd.LogMode(true)
// DBProd.LogMode(false)
// DBProd.SingularTable(true)
// DBProd.AutoMigrate(
// )
//
// if err := DBProd.DB().Ping(); err != nil {
// fmt.Println("Ping Database Fail, error = ", err)
// panic(err)
// }
// fmt.Println("DB init success")
//}

View File

@ -246,6 +246,7 @@ func RentCardOrderCreate(c *gin.Context) {
//return
fmt.Println("CardMax", memberConfig.CardMax)
rentCard = &model.UserRentCard{LevelRentCount: memberConfig.CardMax, CanRentCount: memberConfig.CardMax}
}
fmt.Println("rentCard", rentCard.CanRentCount)
if cardCount > rentCard.CanRentCount {

View File

@ -787,11 +787,11 @@ func SyncUserRent() {
}
fmt.Println("订单 count: uid:", orderCount, user.Uid)
_, err = NewUserRentCardQuerySet(DBProd).UidEq(user.Uid).GetUpdater().SetCanRentCount(0).
SetHaveRentCount(1).UpdateNum()
if err != nil {
fmt.Println("err:", err)
}
//_, err = NewUserRentCardQuerySet(DBProd).UidEq(user.Uid).GetUpdater().SetCanRentCount(0).
// SetHaveRentCount(1).UpdateNum()
//if err != nil {
// fmt.Println("err:", err)
//}
}
}
}