Ver código fonte

刷卡端店铺信息

Lishi
xxe 2 anos atrás
pai
commit
052926d5c5
6 arquivos alterados com 90 adições e 16 exclusões
  1. +2
    -0
      HKCardOUT/Bootstrapper.cs
  2. +4
    -5
      HKCardOUT/Helper/DataBus.cs
  3. +70
    -0
      HKCardOUT/Logic/RemoteModel/StoreInfoResponse.cs
  4. +5
    -11
      HKCardOUT/Logic/RemoteService.cs
  5. +8
    -0
      HKCardOUT/ViewModels/RootViewModel.cs
  6. +1
    -0
      HKCardOUT/options.json

+ 2
- 0
HKCardOUT/Bootstrapper.cs Ver arquivo

@@ -38,7 +38,9 @@ namespace HKCardOUT
DataBus.ConnectionString = configer.GetConnectionString("Sqlite");
DataBus.Cron = configer["Cron"];
DataBus.SaasRoute = configer["SaasRoute"];
DataBus.StoreId = configer["StoreId"];
DbContext.InitTable();
//RemoteService.PullShopInfo();
base.Configure();
}



+ 4
- 5
HKCardOUT/Helper/DataBus.cs Ver arquivo

@@ -1,4 +1,5 @@
using HKCardOUT.Views;
using Logic.RemoteModel;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -25,7 +26,9 @@ namespace HKCardOUT.Helper
}
public static bool NetWordState { get; set; } = false;
public static string Cron { get; set; }
public static string StoreId { get; set; }
public static string SaasRoute { get; set; }
public static StoreInfoResponse StoreInfo { get; set; }
public static Dictionary<string, AdWindow> AdStatus { get; set; } = new Dictionary<string, AdWindow>();
}
public class ApiRoute
@@ -39,13 +42,9 @@ namespace HKCardOUT.Helper
/// </summary>
public static string SyncSaleLog = DataBus.SaasRoute + "";
/// <summary>
/// 获取档口信息
/// </summary>
public static string PullWindow = DataBus.SaasRoute + "";
/// <summary>
/// 获取店铺信息
/// </summary>
public static string PullShopInfo = DataBus.SaasRoute + "";
public static string PullShopInfo = DataBus.SaasRoute + $"api/StoreHelper/GeBasisGateList?StoreId={DataBus.StoreId}";
}
public class HKConverter : IValueConverter
{


+ 70
- 0
HKCardOUT/Logic/RemoteModel/StoreInfoResponse.cs Ver arquivo

@@ -0,0 +1,70 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;

namespace Logic.RemoteModel
{
public class StoreInfoResponse
{
/// <summary>
/// 档口
/// </summary>
[JsonProperty("gateList")]
public List<StallModelResponse> Stalls { get; set; }
/// <summary>
/// 设备
/// </summary>
[JsonProperty("payCardList")]
public List<DeviceModelResponse> Devices { get; set; }
}
public class StallModelResponse
{

public string Id { get; set; }
/// <summary>
/// 档口名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 归属门店
/// </summary>
public string StoreId { get; set; }
/// <summary>
/// 收费方式(1,固定金额2,自由设定)
/// </summary>
public int Mode { get; set; }
/// <summary>
/// 收款金额
/// </summary>
public decimal Price { get; set; }
/// <summary>
/// 广告
/// </summary>
public string Remaek { get; set; }
/// <summary>
///状态0正常,1停用
/// </summary>
public int Status { get; set; }
}
public class DeviceModelResponse
{
public string Id { get; set; }
/// <summary>
/// 刷卡设备名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 档口id
/// </summary>
public string GateId { get; set; }
/// <summary>
/// 刷卡间隔时间
/// </summary>
public int SleepTime { get; set; }
/// <summary>
/// 状态0正常,1停用
/// </summary>
public int Status { get; set; }
}
}

+ 5
- 11
HKCardOUT/Logic/RemoteService.cs Ver arquivo

@@ -1,10 +1,13 @@
using HKCardOUT.Helper;
using Logic.RemoteModel;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XExten.Advance.HttpFramework.MultiFactory;
using XExten.Advance.LinqFramework;

namespace HKCardOUT.Logic
{
@@ -33,16 +36,6 @@ namespace HKCardOUT.Logic
}).Build().RunStringFirst();
}
/// <summary>
/// 获取档口信息
/// </summary>
public static void PullWindow()
{
IHttpMultiClient.HttpMulti.AddNode(t =>
{
t.NodePath = ApiRoute.PullWindow;
}).Build().RunStringFirst();
}
/// <summary>
/// 获取店铺信息
/// </summary>
public static void PullShopInfo()
@@ -50,7 +43,8 @@ namespace HKCardOUT.Logic
IHttpMultiClient.HttpMulti.AddNode(t =>
{
t.NodePath = ApiRoute.PullShopInfo;
}).Build().RunStringFirst();
}).Build().RunStringFirst()
.ToModel<JObject>()["data"].ToJson().ToModel<StoreInfoResponse>();
}
}
}

+ 8
- 0
HKCardOUT/ViewModels/RootViewModel.cs Ver arquivo

@@ -29,6 +29,14 @@ namespace HKCardOUT.ViewModels
Result = new ObservableCollection<SaleLog>(this.Container.Get<HKCore>().PullDaySaleLog());
Thread.Sleep(3000);
}, "消费记录查询");
var Init = DataBus.StoreInfo?.Devices.Join(DataBus.StoreInfo?.Stalls, t => t.GateId, x => x.Id, (t, x) => new AdDTO
{
Ad = x.Remaek,
IsActive = false,
Device = $"{x.Name}({t.Name})"
}).ToList();
if (Init != null)
Ad = new ObservableCollection<AdDTO>(Init);
}

#region 属性


+ 1
- 0
HKCardOUT/options.json Ver arquivo

@@ -1,6 +1,7 @@
{
"SaasRoute": "",
"Cron": "0 0 11,15 * * ? ",
"StoreId": "",
"ConnectionStrings": {
"Sqlite": "HKSQL.db3"
}


Carregando…
Cancelar
Salvar