feat: initial commit - HJHA game server full source
6 major server modules (PdkFriendServer/GlobalSever/ServerCore/GameModule/GameNetModule) + game logic (GameFix/GameDAL/ServerData) + network layer (NetWorkMessage) + data layer (ObjectModel) + utilities (MrWu/Core/Config/CloudAPI/dll) + adapters (zyxAdapter/base) .NET 8.0 C# solution, 16 projects, 958 source files
This commit is contained in:
29
ObjectModel/Config/HuaWei/AccessTokenServer.cs
Normal file
29
ObjectModel/Config/HuaWei/AccessTokenServer.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ObjectModel.Config.HuaWei
|
||||
{
|
||||
/// <summary>
|
||||
/// 服务器使用的token令牌
|
||||
/// </summary>
|
||||
public class AccessTokenServer
|
||||
{
|
||||
/// <summary>
|
||||
/// 令牌
|
||||
/// </summary>
|
||||
public string access_token;
|
||||
|
||||
/// <summary>
|
||||
/// 过期时间
|
||||
/// </summary>
|
||||
public int expires_in;
|
||||
|
||||
/// <summary>
|
||||
/// 过期的时间
|
||||
/// </summary>
|
||||
public DateTime TimeOut;
|
||||
}
|
||||
}
|
||||
44
ObjectModel/Config/HuaWei/HuaWeiPayDB.cs
Normal file
44
ObjectModel/Config/HuaWei/HuaWeiPayDB.cs
Normal file
@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ObjectModel.Config.HuaWei
|
||||
{
|
||||
public class HuaWeiPayDB
|
||||
{
|
||||
public int id;
|
||||
public int userid;
|
||||
/// <summary>
|
||||
/// 产品id
|
||||
/// </summary>
|
||||
public string productId;
|
||||
/// <summary>
|
||||
/// 订单号
|
||||
/// </summary>
|
||||
public string orderId;
|
||||
public DateTime createTime;
|
||||
|
||||
public HuaWeiPayDB() { }
|
||||
|
||||
public static string GetInsertSql(int userid, string productId, string orderId)
|
||||
{
|
||||
return $"INSERT INTO [HuaWeiPay]([userid], [productId], [orderId]) VALUES ( {userid}, '{productId}', '{orderId}')";
|
||||
}
|
||||
|
||||
public string GetSaveSql()
|
||||
{
|
||||
return $"INSERT INTO [tbIosPay]([userid], [productId], [orderId]) VALUES ( {userid}, '{productId}', '{orderId}')";
|
||||
}
|
||||
|
||||
public HuaWeiPayDB(DataRow row)
|
||||
{
|
||||
this.id = Convert.ToInt32(row["id"]);
|
||||
this.userid = Convert.ToInt32(row["userid"]);
|
||||
this.productId = row["productId"].ToString();
|
||||
this.orderId = row["orderId"].ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
125
ObjectModel/Config/HuaWei/InappPurchaseDetails.cs
Normal file
125
ObjectModel/Config/HuaWei/InappPurchaseDetails.cs
Normal file
@ -0,0 +1,125 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ObjectModel.Config.HuaWei
|
||||
{
|
||||
public class InappPurchaseDetails
|
||||
{
|
||||
/// <summary>
|
||||
/// 消耗型商品或者非消耗型商品:固定为false。
|
||||
/// </summary>
|
||||
public bool autoRenewing { get; set; }
|
||||
/// <summary>
|
||||
/// 订单ID,唯一标识一笔需要收费的收据
|
||||
/// </summary>
|
||||
public string orderId { get; set; }
|
||||
/// <summary>
|
||||
/// 应用安装包名。
|
||||
/// </summary>
|
||||
public string packageName { get; set; }
|
||||
/// <summary>
|
||||
/// 应用ID。
|
||||
/// </summary>
|
||||
public long applicationId { get; set; }
|
||||
/// <summary>
|
||||
/// 应用ID
|
||||
/// </summary>
|
||||
public string applicationIdString { get; set; }
|
||||
/// <summary>
|
||||
/// 商品类别,取值包括
|
||||
/// 0:消耗型商品 1:非消耗型商品 2:订阅型商品
|
||||
/// </summary>
|
||||
public int kind { get; set; }
|
||||
/// <summary>
|
||||
/// 商品ID。每种商品必须有唯一的ID
|
||||
/// </summary>
|
||||
public string productId { get; set; }
|
||||
/// <summary>
|
||||
/// 商品名称。
|
||||
/// </summary>
|
||||
public string productName { get; set; }
|
||||
/// <summary>
|
||||
/// 商品购买时间,UTC时间戳,以毫秒为单位
|
||||
/// </summary>
|
||||
public long purchaseTime { get; set; }
|
||||
/// <summary>
|
||||
/// 历史接口兼容用,同purchaseTime,新接入无需关注本字段。
|
||||
/// </summary>
|
||||
public long purchaseTimeMillis { get; set; }
|
||||
/// <summary>
|
||||
/// 订单交易状态。
|
||||
/// -1:初始化 0:已购买 1:已取消 2:已撤销或已退款 3:待处理
|
||||
/// </summary>
|
||||
public int purchaseState { get; set; }
|
||||
/// <summary>
|
||||
/// 商户侧保留信息,由您在调用支付接口时传入
|
||||
/// </summary>
|
||||
public string developerPayload { get; set; }
|
||||
/// <summary>
|
||||
/// 用于唯一标识商品和用户对应关系的购买令牌,在支付完成时由华为应用内支付服务器生成。
|
||||
/// </summary>
|
||||
public string purchaseToken { get; set; }
|
||||
/// <summary>
|
||||
/// 消耗状态,仅一次性商品存在,取值包括 0:未消耗 1:已消耗
|
||||
/// </summary>
|
||||
public int consumptionState { get; set; }
|
||||
/// <summary>
|
||||
/// 确认状态,取值包括 0 :未确认 1:已确认
|
||||
/// </summary>
|
||||
public int confirmed { get; set; }
|
||||
/// <summary>
|
||||
/// 购买类型。 0:沙盒环境
|
||||
/// </summary>
|
||||
public int purchaseType { get; set; }
|
||||
/// <summary>
|
||||
/// 定价货币的币种 CNY
|
||||
/// </summary>
|
||||
public string currency { get; set; }
|
||||
/// <summary>
|
||||
/// 商品实际价格*100以后的值
|
||||
/// </summary>
|
||||
public long price { get; set; }
|
||||
/// <summary>
|
||||
/// 国家/地区码
|
||||
/// </summary>
|
||||
public string country { get; set; }
|
||||
/// <summary>
|
||||
/// 交易单号,用户支付成功后生成
|
||||
/// </summary>
|
||||
public string payOrderId { get; set; }
|
||||
/// <summary>
|
||||
/// 支付方式,
|
||||
/// </summary>
|
||||
public string payType { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string sdkChannel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 购买的商品是否数据合格
|
||||
/// </summary>
|
||||
/// <returns>true合格,false不合格</returns>
|
||||
public bool IsOk(string id)
|
||||
{
|
||||
bool b = false;
|
||||
b = id == productId;
|
||||
if (!b) return b;
|
||||
b = purchaseState == 0;
|
||||
if (!b) return b;
|
||||
b = consumptionState == 0;
|
||||
if (!b) return b;
|
||||
b = confirmed == 0;
|
||||
if (!b) return b;
|
||||
return b;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"id:{productId},name:{productName},price:{price},orderid:{orderId}";
|
||||
}
|
||||
}
|
||||
}
|
||||
36
ObjectModel/Config/HuaWei/VerifyProductResponse.cs
Normal file
36
ObjectModel/Config/HuaWei/VerifyProductResponse.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ObjectModel.Config.HuaWei
|
||||
{
|
||||
public class VerifyProductResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 0成功 其他失败
|
||||
/// </summary>
|
||||
public string responseCode;
|
||||
|
||||
/// <summary>
|
||||
/// 商品的JSON数据
|
||||
/// </summary>
|
||||
public string purchaseTokenData;
|
||||
|
||||
/// <summary>
|
||||
/// 加密后的字符串
|
||||
/// </summary>
|
||||
public string dataSignature;
|
||||
|
||||
/// <summary>
|
||||
/// 加密方式
|
||||
/// </summary>
|
||||
public string signatureAlgorithm;
|
||||
|
||||
/// <summary>
|
||||
/// 错误信息
|
||||
/// </summary>
|
||||
public string responseMessage;
|
||||
}
|
||||
}
|
||||
18
ObjectModel/Config/HuaWei/VerifyRequest.cs
Normal file
18
ObjectModel/Config/HuaWei/VerifyRequest.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
|
||||
namespace ObjectModel.Config.HuaWei
|
||||
{
|
||||
[Serializable]
|
||||
public class VerifyRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 待下发商品ID。商品ID来源于您在AppGallery Connect中配置商品信息时设置的商品ID。
|
||||
/// </summary>
|
||||
public string productId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 待下发商品的购买Token,发起购买和查询待消费商品信息时均会返回purchaseToken参数。
|
||||
/// </summary>
|
||||
public string purchaseToken { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user