|
@@ -8,7 +8,6 @@ using Microsoft.Extensions.Options;
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
using System.Web;
|
|
|
using MySystem.Models.Main;
|
|
|
-using MySystem.Models.Main1;
|
|
|
using LitJson;
|
|
|
using Library;
|
|
|
using MySystem.Service.Main;
|
|
@@ -43,8 +42,8 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
int PageSize = int.Parse(function.CheckInt(data.getItem("PageSize").ToString()));
|
|
|
int PageNum = int.Parse(function.CheckInt(data.getItem("PageNum").ToString()));
|
|
|
List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
|
|
|
- Models.Main.MerchantInfo merchant = MerchantInfoDbconn.Instance.Get(MerchantId) ?? new Models.Main.MerchantInfo();
|
|
|
- IQueryable<Models.Main.MerchantQrCode> query = maindb.MerchantQrCode.Where(m => m.MerchantId == MerchantId && m.QueryCount == 2);
|
|
|
+ MerchantInfo merchant = MerchantInfoDbconn.Instance.Get(MerchantId) ?? new MerchantInfo();
|
|
|
+ IQueryable<MerchantQrCode> query = maindb.MerchantQrCode.Where(m => m.MerchantId == MerchantId && m.QueryCount == 2);
|
|
|
if (PageNum == 1)
|
|
|
{
|
|
|
query = query.Take(PageSize);
|
|
@@ -54,7 +53,7 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
int skipNum = PageSize * (PageNum - 1);
|
|
|
query = query.Skip(skipNum).Take(PageSize);
|
|
|
}
|
|
|
- foreach (Models.Main.MerchantQrCode subdata in query.ToList())
|
|
|
+ foreach (MerchantQrCode subdata in query.ToList())
|
|
|
{
|
|
|
Dictionary<string, object> curData = new Dictionary<string, object>();
|
|
|
curData.Add("SnNo", subdata.SnNo); //Sn编号
|
|
@@ -113,10 +112,10 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
}
|
|
|
}
|
|
|
Dictionary<string, object> Obj = new Dictionary<string, object>();
|
|
|
- Models.Main.MerchantQrCode query = MerchantQrCodeService.Query(" SnNo='" + SnNo + "'");
|
|
|
+ MerchantQrCode query = MerchantQrCodeService.Query(" SnNo='" + SnNo + "'");
|
|
|
Models.Main1.PosMachinesTwo pos = PosMachinesTwoService.Query(" PosSn='" + SnNo + "'");
|
|
|
Models.Main1.PosMachines machines = PosMachinesService.Query(" PosSn='" + SnNo + "'");
|
|
|
- Models.Main.MerchantInfo merchant = MerchantInfoService.Query(MerchantId);
|
|
|
+ MerchantInfo merchant = MerchantInfoService.Query(MerchantId);
|
|
|
int PosId = 0;
|
|
|
if (SnNo == MachineNo || string.IsNullOrEmpty(MachineNo))
|
|
|
{
|
|
@@ -152,10 +151,10 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
else
|
|
|
{
|
|
|
string DataId = PosId + "_2";
|
|
|
- Models.Main.MachineForQrCode forQrCode = maindb.MachineForQrCode.FirstOrDefault(m => m.DataId == DataId);
|
|
|
+ MachineForQrCode forQrCode = maindb.MachineForQrCode.FirstOrDefault(m => m.DataId == DataId);
|
|
|
if (forQrCode == null)
|
|
|
{
|
|
|
- forQrCode = maindb.MachineForQrCode.Add(new Models.Main.MachineForQrCode()
|
|
|
+ forQrCode = maindb.MachineForQrCode.Add(new MachineForQrCode()
|
|
|
{
|
|
|
DataId = DataId,
|
|
|
SnNo = SnNo,
|
|
@@ -195,7 +194,7 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
// string deviceId = jsonObj["alipay_commerce_iot_device_baseinfo_query_response"]["device_id"].ToString();
|
|
|
if(machines.BrandId == 1)
|
|
|
{
|
|
|
- Models.Main.MerchantAddInfo addinfo = MerchantAddInfoService.Query(MerchantId);
|
|
|
+ MerchantAddInfo addinfo = MerchantAddInfoService.Query(MerchantId);
|
|
|
//通过商户smid(好哒认证成功后台提供)绑定支付宝设备
|
|
|
var result = AliIotFunction.Instance.IotBind(addinfo.AliMerchantId, MachineNo);
|
|
|
JsonData jsonObj = JsonMapper.ToObject(result);
|
|
@@ -251,11 +250,11 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
int MachineId = int.Parse(function.CheckInt(data.getItem("MachineId").ToString())); //设备
|
|
|
int QrCodeId = int.Parse(function.CheckInt(data.getItem("QrCodeId").ToString())); //收款码Id
|
|
|
Dictionary<string, object> Obj = new Dictionary<string, object>();
|
|
|
- Models.Main.MerchantQrCode query = MerchantQrCodeService.Query(QrCodeId) ?? new Models.Main.MerchantQrCode();
|
|
|
+ MerchantQrCode query = MerchantQrCodeService.Query(QrCodeId) ?? new MerchantQrCode();
|
|
|
Models.Main1.PosMachines machine = PosMachinesDbconn.Instance.Get(MachineId) ?? new Models.Main1.PosMachines();
|
|
|
query.MerchantId = MerchantId; //商户
|
|
|
query.MachineId = MachineId; //设备
|
|
|
- Models.Main.MachineForQrCode qrcode = new Models.Main.MachineForQrCode()
|
|
|
+ MachineForQrCode qrcode = new MachineForQrCode()
|
|
|
{
|
|
|
MerchantId = MerchantId,
|
|
|
DataId = QrCodeId + "_" + MachineId,
|
|
@@ -288,12 +287,12 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
var list = maindb.MachineForQrCode.Select(m => new { m.MerchantId, m.DataId }).Where(m => m.MerchantId == MerchantId && m.DataId.StartsWith(CheckKey)).ToList();
|
|
|
foreach (var sub in list)
|
|
|
{
|
|
|
- Models.Main.MachineForQrCode edit = maindb.MachineForQrCode.FirstOrDefault(m => m.DataId == sub.DataId);
|
|
|
+ MachineForQrCode edit = maindb.MachineForQrCode.FirstOrDefault(m => m.DataId == sub.DataId);
|
|
|
if (edit != null)
|
|
|
{
|
|
|
if (edit.SnNo != edit.MachineSnNo)
|
|
|
{
|
|
|
- Models.Main.MerchantAddInfo addinfo = MerchantAddInfoService.Query(edit.MerchantId);
|
|
|
+ MerchantAddInfo addinfo = MerchantAddInfoService.Query(edit.MerchantId);
|
|
|
Models.Main1.PosMachines machine = PosMachinesService.Query(" PosSn='" + edit.MachineSnNo + "'");
|
|
|
string result = AliIotFunction.Instance.IotUnBind(addinfo.AliMerchantId, machine.PosSn);
|
|
|
JsonData jsonObj = JsonMapper.ToObject(result);
|
|
@@ -310,7 +309,7 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
}
|
|
|
maindb.MachineForQrCode.Remove(edit);
|
|
|
int MachineId = int.Parse(function.CheckInt(edit.DataId.Split('_')[1]));
|
|
|
- Models.Main.MerchantQrCode qrCode = maindb.MerchantQrCode.FirstOrDefault(m => m.MerchantId == MachineId);
|
|
|
+ MerchantQrCode qrCode = maindb.MerchantQrCode.FirstOrDefault(m => m.MerchantId == MachineId);
|
|
|
if (qrCode != null)
|
|
|
{
|
|
|
qrCode.MerchantId = 0;
|