milimoe 2827c53d14
补全数据库表、查询常量类 (#118)
* 补充数据库表

* 更新sqlite

* 添加商店相关的数据库常量类

* add Update_UpdateRoomMaster

* 修改常量类

* 添加  NOTICE 文件

* 添加市场、报价、库存的数据库常量类

* 优化表结构和查询常量类

* 添加 UserCenter 和 Inventory 相关枚举;数据表和 Query 常量类修改

* 添加报价的核心操作

* 涉及库存的物品获取应该使用 Guid 而不是 ItemId

---------

Co-authored-by: yeziuku <yezi@wrss.org>
2025-04-04 23:39:49 +08:00

44 lines
2.3 KiB
C#

using Milimoe.FunGame.Core.Api.Transmittal;
namespace Milimoe.FunGame.Core.Library.SQLScript.Common
{
public class ApiTokens : Constant
{
public const string TableName = "ApiTokens";
public const string Column_TokenID = "TokenID";
public const string Column_SecretKey = "SecretKey";
public const string Column_Reference1 = "Reference1";
public const string Column_Reference2 = "Reference2";
public static string Insert_APIToken(SQLHelper SQLHelper, string TokenID, string SecretKey = "", string Reference1 = "", string Reference2 = "")
{
SQLHelper.Parameters["@TokenID"] = TokenID;
SQLHelper.Parameters["@SecretKey"] = SecretKey;
SQLHelper.Parameters["@Reference1"] = Reference1;
SQLHelper.Parameters["@Reference2"] = Reference2;
return $"{Command_Insert} {Command_Into} {TableName} ({Column_TokenID}, {Column_SecretKey}, {Column_Reference1}, {Column_Reference2}) {Command_Values} (@TokenID, @SecretKey, @Reference1, @Reference2)";
}
public static string Select_GetAPIToken(SQLHelper SQLHelper, string TokenID)
{
SQLHelper.Parameters["@TokenID"] = TokenID;
return $"{Command_Select} {Command_All} {Command_From} {TableName} {Command_Where} {Column_TokenID} = @TokenID";
}
public static string Select_GetAPISecretKey(SQLHelper SQLHelper, string SecretKey)
{
SQLHelper.Parameters["@SecretKey"] = SecretKey;
return $"{Command_Select} {Command_All} {Command_From} {TableName} {Command_Where} {Column_SecretKey} = @SecretKey";
}
public static string Update_APIToken(SQLHelper SQLHelper, string TokenID, string SecretKey, string Reference1 = "", string Reference2 = "")
{
SQLHelper.Parameters["@TokenID"] = TokenID;
SQLHelper.Parameters["@SecretKey"] = SecretKey;
SQLHelper.Parameters["@Reference1"] = Reference1;
SQLHelper.Parameters["@Reference2"] = Reference2;
return $"{Command_Update} {TableName} {Command_Set} {Column_TokenID} = @TokenID, {Column_SecretKey} = @SecretKey, {Column_Reference1} = @Reference1, {Column_Reference2} = @Reference2 {Command_Where} {Column_TokenID} = @TokenID";
}
}
}