Przeglądaj źródła

修复支付错误

lt 1 miesiąc temu
rodzic
commit
b8616f67e2

+ 5 - 1
RO_Server_Trunk-branch_0.1.39/roserver/game/model/role.go

@@ -3755,7 +3755,11 @@ func (this *Role) PayInfoGet(goodsType, goodsId, count int32, rushStage, rushRou
 		ordeinfo.GameSign = info
 		b, _ := json.Marshal(ordeinfo)
 		payOrderInfo.GoodsName = string(b)
-
+		payOrderInfo.PayChannel = strconv.Itoa(guid)
+		payOrderInfo.PayCurrency = this.GetRoleBase().GetRoleName()
+		if payOrderInfo.PayCurrency == "" {
+			payOrderInfo.PayCurrency = "Player"
+		}
 		util.ErrorF("uid:%v pay info platform:%v order:%v", this.GetUUid(), this.platform, payOrderInfo)
 		ssSaveReqMsg := &serverproto.SSPayInfoSaveReq{
 			PayOrderInfo: payOrderInfo,

+ 2 - 2
RO_Server_Trunk-branch_0.1.39/roserver/game/model/role_rune.go

@@ -3049,7 +3049,7 @@ func (this *RoleRune) AddMonthCardItem(goodId, cnt int32) {
 		if data.GoodsId == goodId {
 			//首次充值
 			if data.EndTime == 0 {
-				data.EndTime = (int64(util.GetLatest5Hour()) + 29*24*3600*1000)
+				data.EndTime = (int64(util.GetLatest5Hour()) + 6*24*3600*1000)
 				data.NextRewardTime = int64(util.GetLatest5Hour())
 
 				//非续时,给邮件奖励
@@ -3063,7 +3063,7 @@ func (this *RoleRune) AddMonthCardItem(goodId, cnt int32) {
 						reward, []int32{29}, "", "")
 				}
 			} else {
-				data.EndTime += 30 * 24 * 3600 * 1000 //30天d
+				data.EndTime += 7 * 24 * 3600 * 1000 //30天d
 			}
 			data.BuyNum += cnt
 			data.HistoryBuy += cnt

+ 54 - 13
RO_Server_Trunk-branch_0.1.39/roserver/gmweb/msg/web_paymsg.go

@@ -360,7 +360,7 @@ func WebPayHwXiaoQiNotify(c *gin.Context) {
 	params := make(map[string]string)
 	if err := c.Request.ParseForm(); err != nil {
 		util.InfoF("parseForm falied")
-		c.String(http.StatusOK, "FAILED")
+		c.String(http.StatusOK, "failed:order error")
 		return
 	}
 	util.DebugF("支付回调信息2:%v", c.Request.PostForm)
@@ -382,13 +382,13 @@ func WebPayHwXiaoQiNotify(c *gin.Context) {
 		b, err2 := VerifySignature(params, xiaoqiIoskey)
 		if err2 != nil || !b {
 			util.ErrorF("签名错误%v", err2)
-			c.String(http.StatusOK, "FAILED")
+			c.String(http.StatusOK, "sign_data_verify_failed")
 			return
 		}
 		myData, err3 = DecryptDataToMap(params["encryp_data"], xiaoqiIoskey)
 		if err3 != nil {
 			util.ErrorF("解析encryp_data error:%v", err3)
-			c.String(http.StatusOK, "FAILED")
+			c.String(http.StatusOK, "encryp_data_decrypt_failed")
 			return
 		}
 	} else {
@@ -396,18 +396,20 @@ func WebPayHwXiaoQiNotify(c *gin.Context) {
 		b, err2 := VerifySignature(params, xiaoqiAndroidkey)
 		if err2 != nil || !b {
 			util.ErrorF("签名错误%v", err2)
-			c.String(http.StatusOK, "FAILED")
+			c.String(http.StatusOK, "sign_data_verify_failed")
 			return
 		}
 		myData, err3 = DecryptDataToMap(params["encryp_data"], xiaoqiAndroidkey)
 		if err3 != nil {
 			util.ErrorF("解析encryp_data error:%v", err3)
-			c.String(http.StatusOK, "FAILED")
+			c.String(http.StatusOK, "encryp_data_decrypt_failed")
 			return
 		}
 	}
 
-	uid := myData["uid"]
+	util.ErrorF("xiaoqi mydata:%v", myData)
+
+	uid := params["game_role_id"]
 	cpOrderId := myData["game_orderid"]
 	if cpOrderId == "" {
 		if extras.CpOrderId != "" {
@@ -416,8 +418,19 @@ func WebPayHwXiaoQiNotify(c *gin.Context) {
 			util.ErrorF("mycard pay cporderId is nil extras:%v", extras)
 		}
 	}
-	orderNo := myData["xiao7_goid"]
+	orderNo := params["xiao7_goid"]
 	payCurrency := myData["game_currency"]
+	//if payCurrency != "USD" {
+	//	util.ErrorF("xiaoqi pay currency is not USD:%v", payCurrency)
+	//	c.String(http.StatusOK, "failed:game_currency error")
+	//	return
+	//}
+	server := params["game_area"]
+	if server != strconv.Itoa(service.GetServiceConfig().Node.Zone/2) {
+		util.ErrorF("xiaoqi pay server is not correct:%v", server)
+		c.String(http.StatusOK, "failed:game_area error")
+		return
+	}
 	payType := myData["game_currency"]
 	usdAmount := myData["pay_price"]
 	ntfData := &WebNotifyData{}
@@ -427,16 +440,25 @@ func WebPayHwXiaoQiNotify(c *gin.Context) {
 	ntfData.PayCurrency = payCurrency
 	ntfData.PayTime = uint64(util.GetTimeSeconds())
 	ntfData.PayChannel = "xiaoqi"
+	ntfData.Guid = myData["guid"]
+	ntfData.RoleName = params["game_role_name"]
+	roleId, _ := strconv.ParseUint(params["game_role_id"], 10, 64)
+	ntfData.GameRoleId = roleId
 	util.WarnF("paycallback uid=%v cpOrderNo=%v orderNo=%v payAmount=%v payCurrency=%v payType=%v usdAmount=%v",
 		uid, cpOrderId, orderNo, usdAmount, payCurrency, payType, usdAmount)
 	f64, err := strconv.ParseFloat(usdAmount, 32)
 	if err != nil {
 		fmt.Println("Error:", err)
+		c.String(http.StatusOK, "failed:order error")
 		return
 	}
-	webPayNotify(ntfData, float32(f64), c)
+	s := webPayNotify(ntfData, float32(f64), c)
+	if s != "SUCCESS" {
+		c.String(http.StatusOK, s)
+	} else {
+		c.String(http.StatusOK, "success")
+	}
 
-	c.String(http.StatusOK, "success")
 }
 
 // 使用公钥解密(对应 PHP 的 openssl_public_decrypt)
@@ -1302,6 +1324,8 @@ type WebNotifyData struct {
 	GameRoleId  uint64
 	GoodsType   uint64
 	GoodsID     uint64
+	Guid        string
+	RoleName    string
 }
 
 func webPayNotify(webNtf *WebNotifyData, payAmount float32, c *gin.Context) string {
@@ -1318,7 +1342,7 @@ func webPayNotify(webNtf *WebNotifyData, payAmount float32, c *gin.Context) stri
 		//c.JSON(http.StatusOK, "FAILED")
 
 		//return "FAILED"
-		return fmt.Sprintf("FAILED,cpOrderId=%v err=%v", webNtf.CpOrderId, err)
+		return "failed:game_orderid error"
 	}
 
 	payInfo := &serverproto.PayOrderSaveInfo{}
@@ -1331,6 +1355,18 @@ func webPayNotify(webNtf *WebNotifyData, payAmount float32, c *gin.Context) stri
 		return fmt.Sprintf("FAILED,cpOrderId=%v err=%v", webNtf.CpOrderId, err)
 	}
 	if payInfo.OrderState == int32(serverproto.PayOrderState_EPayOrderState_Gen) {
+		if payInfo.PayChannel != webNtf.Guid && payInfo.PayChannel != "xiaoqi" {
+			util.ErrorF("WebPayQuickNotify order channel error order=%v, webNtf=%v", payInfo, webNtf)
+			return "failed:guid error"
+		}
+		if payInfo.Uid != webNtf.GameRoleId {
+			util.ErrorF("WebPayQuickNotify order uid error order=%v, webNtf=%v", payInfo, webNtf)
+			return "failed:game_role_id error"
+		}
+		if payInfo.PayCurrency != webNtf.RoleName {
+			util.ErrorF("WebPayQuickNotify order role name error order=%v, webNtf=%v", payInfo, webNtf)
+			return "failed:game_role_name error"
+		}
 		//实际支付 == 订单的钱,否则为支付失败
 		//payAmount := int32(payAmount * 100) //该渠道是以分为单位(游戏以卢布为单位)
 		//服务器订单实际金额:
@@ -1340,12 +1376,12 @@ func webPayNotify(webNtf *WebNotifyData, payAmount float32, c *gin.Context) stri
 		} else {
 			payInfo.OrderState = int32(serverproto.PayOrderState_EPayOrderState_PayFailed)
 			util.ErrorF("uid=%v WebPayQuickNotify failed payAmount:%v order=%v", payInfo.Uid, payAmount, payInfo)
-			return "FAILED"
+			return "failed:pay_price error"
 		}
 		payInfo.OrderProcessTime = util.GetTimeMilliseconds()
 		payInfo.SdkOrderId = webNtf.SdkOrderId //sdk订单id\
 		payInfo.PayMethod = webNtf.PayMethod
-		payInfo.PayCurrency = webNtf.PayCurrency
+		payInfo.PayCurrency = webNtf.RoleName
 		payInfo.PayTime = webNtf.PayTime
 		payInfo.PayChannel = webNtf.PayChannel
 
@@ -1369,7 +1405,12 @@ func webPayNotify(webNtf *WebNotifyData, payAmount float32, c *gin.Context) stri
 	} else {
 		util.ErrorF("WebPayQuickNotify uid=%v state error state=%v", payInfo.Uid, payInfo.OrderState)
 		//return "FAILED"
-		return fmt.Sprintf("FAILED,cpOrderId=%v state error=%v", webNtf.CpOrderId, payInfo.OrderState)
+		if payInfo.SdkOrderId == webNtf.SdkOrderId {
+			return "SUCCESS"
+		} else {
+			util.ErrorF("WebPayQuickNotify uid=%v order is completed but sdkOrderId not same order=%v,sdkOrderId=%v", payInfo.Uid, payInfo, webNtf.SdkOrderId)
+			return "failed:xiao7_goid error"
+		}
 	}
 	return "SUCCESS"
 }

+ 3 - 0
操作命令/仙境服务器2.txt

@@ -8,6 +8,9 @@ R6Hm7Bb!&NUWDgfHZDTF
  内网面板地址:     https://10.7.95.196:16477/1a677acc
  username: 4wfjmg1m
  password: 562221715
+jenkins启动命令:nohup /www/server/java/jdk-17.0.8/bin/java -jar jenkins.war --httpPort=12567 > jenkins.log 2>&1 &
+
+关闭注册:hset server:reg registerclose 1
 
 
 gm