|
@@ -80,13 +80,17 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
}
|
|
|
public AppResultJson BindDo(string value)
|
|
|
{
|
|
|
- function.WriteLog(value, "商户-绑定收款码");
|
|
|
JsonData data = JsonMapper.ToObject(value);
|
|
|
int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString())); //商户
|
|
|
string SnNo = data["SnNo"].ToString(); //Sn编号
|
|
|
string MachineNo = data["Machine"].ToString(); //音箱码
|
|
|
Dictionary<string, object> Obj = new Dictionary<string, object>();
|
|
|
MerchantQrCode query = new MerchantQrCodeService().Query(SnNo);
|
|
|
+ PosMachinesTwo pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.PosSn == SnNo);
|
|
|
+ if(pos == null)
|
|
|
+ {
|
|
|
+ return new AppResultJson() { Status = "-1", Info = "绑定失败" };
|
|
|
+ }
|
|
|
if (query.Id > 0)
|
|
|
{
|
|
|
if (query.MerchantId > 0)
|
|
@@ -94,7 +98,8 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
return new AppResultJson() { Status = "-1", Info = "此二维码已被绑定,请勿重复绑定" };
|
|
|
}
|
|
|
}
|
|
|
- query = maindb.MerchantQrCode.Add(new MerchantQrCode(){
|
|
|
+ query = maindb.MerchantQrCode.Add(new MerchantQrCode()
|
|
|
+ {
|
|
|
CreateDate = DateTime.Now, //绑定时间
|
|
|
MerchantId = MerchantId, //商户
|
|
|
SnNo = SnNo,
|
|
@@ -141,7 +146,11 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
maindb.SaveChanges();
|
|
|
return new AppResultJson() { Status = "2", Info = "", Data = Obj };
|
|
|
}
|
|
|
- return new AppResultJson() { Status = "-1", Info = "绑定失败" };
|
|
|
+ pos.BindingTime = DateTime.Now;
|
|
|
+ pos.BindingState = 1;
|
|
|
+ pos.BindMerchantId = MerchantId;
|
|
|
+ maindb.SaveChanges();
|
|
|
+ return new AppResultJson() { Status = "1", Info = "绑定成功" };
|
|
|
}
|
|
|
#endregion
|
|
|
|