-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e73a905
commit 7155367
Showing
35 changed files
with
309 additions
and
289 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
using Newtonsoft.Json; | ||
using System.Configuration; | ||
|
||
namespace IMaoTai.Core | ||
{ | ||
public class CommonX | ||
{ | ||
public const string CacheDir = "cache"; | ||
|
||
// 内部使用缓存文件 | ||
public static string _productListFile = Path.Combine(CacheDir, "productList.json"); | ||
|
||
public static string _sessionIdFile = Path.Combine(CacheDir, "mtSessionId.txt"); | ||
|
||
// 商店共用缓存文件 | ||
public static string StoreListFile = Path.Combine(CacheDir, "storeList.json"); | ||
|
||
//用户信息缓存 | ||
public static string UserListFile = Path.Combine(CacheDir, "userList.json"); | ||
|
||
//日志信息缓存 | ||
public static string LogListFile = Path.Combine(CacheDir, "logList.json"); | ||
|
||
/// <summary> | ||
/// 订单数据库表名 | ||
/// </summary> | ||
public const string OrderDatabasePath = "cache/imaotai.db"; | ||
|
||
/// <summary> | ||
/// 订单数据库连接字符串 | ||
/// </summary> | ||
public static string OrderDatabaseConnectStr = ConfigurationManager.AppSettings["DefaultConnStr"] ?? "Data Source=cache/imaotai.db;"; | ||
|
||
public static string DbType = ConfigurationManager.AppSettings["DbType"] ?? "Sqlite"; | ||
|
||
//是否启用本地文件存储 | ||
public static bool LoadFromFile = ConfigurationManager.AppSettings["LoadFromFile"].ToString() == "1"; | ||
|
||
/// <summary> | ||
/// 获取Freesql数据库类型 | ||
/// </summary> | ||
/// <returns></returns> | ||
public static FreeSql.DataType GetFreeSqlDataType() | ||
{ | ||
if (DbType == FreeSql.DataType.MySql.ToString()) | ||
{ | ||
return FreeSql.DataType.MySql; | ||
} | ||
else if (DbType == FreeSql.DataType.Oracle.ToString()) | ||
{ | ||
return FreeSql.DataType.Oracle; | ||
} | ||
else if (DbType == FreeSql.DataType.SqlServer.ToString()) | ||
{ | ||
return FreeSql.DataType.SqlServer; | ||
} | ||
return FreeSql.DataType.Sqlite; | ||
} | ||
|
||
/// <summary> | ||
/// 茅台会话ID | ||
/// </summary> | ||
public static string MtSessionId = ""; | ||
|
||
public static void WriteCache(string filename, string content) | ||
{ | ||
var path = Path.Combine(CacheDir, filename); | ||
File.WriteAllText(path, content); | ||
} | ||
|
||
public static List<T> GetListFromFile<T>(string path) where T : class | ||
{ | ||
if (File.Exists(path)) | ||
{ | ||
var json = File.ReadAllText(path); | ||
var result = JsonConvert.DeserializeObject<List<T>>(json); | ||
return result; | ||
} | ||
return new List<T>(); | ||
} | ||
|
||
public static void WriteDataToCache<T>(string path, List<T> list) | ||
{ | ||
File.WriteAllText(path, JsonConvert.SerializeObject(list)); | ||
} | ||
|
||
public static void FileContentClear(string path, string content) | ||
{ | ||
File.WriteAllText(path, content); | ||
} | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
IMaoTai/Domain/AppointProjectViewModel.cs → ...ai.Core/Domain/AppointProjectViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
IMaoTai/Domain/LogListViewModel.cs → IMaoTai.Core/Domain/LogListViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
IMaoTai/Domain/ShopListViewModel.cs → IMaoTai.Core/Domain/ShopListViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
IMaoTai/Domain/UserManageViewModel.cs → IMaoTai.Core/Domain/UserManageViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
IMaoTai/Entity/IMTItemInfo.cs → IMaoTai.Core/Entity/IMTItemInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
namespace IMaoTai.Entity | ||
namespace IMaoTai.Core.Entity | ||
{ | ||
/// <summary> | ||
/// I茅台预约商品信息 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
namespace IMaoTai.Entity | ||
namespace IMaoTai.Core.Entity | ||
{ | ||
public class MapPoint | ||
{ | ||
|
2 changes: 1 addition & 1 deletion
2
IMaoTai/Entity/ProductEntity.cs → IMaoTai.Core/Entity/ProductEntity.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
namespace IMaoTai.Entity | ||
namespace IMaoTai.Core.Entity | ||
{ | ||
public class ProductEntity | ||
{ | ||
|
2 changes: 1 addition & 1 deletion
2
IMaoTai/Entity/ShopEntity.cs → IMaoTai.Core/Entity/ShopEntity.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
IMaoTai/Entity/UserEntity.cs → IMaoTai.Core/Entity/UserEntity.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.