|
@@ -27,14 +27,15 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
JsonData data = JsonMapper.ToObject(requestMes);
|
|
JsonData data = JsonMapper.ToObject(requestMes);
|
|
|
Dictionary<string, object> req = new Dictionary<string, object>();
|
|
Dictionary<string, object> req = new Dictionary<string, object>();
|
|
|
string PosSn = data["posSn"].ToString();
|
|
string PosSn = data["posSn"].ToString();
|
|
|
- PosMachinesTwo pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.PosSn == PosSn);
|
|
|
|
|
- if(pos == null)
|
|
|
|
|
- {
|
|
|
|
|
- return Json(new AppResultJson() { Status = "-1", Info = "机具号不正确" });
|
|
|
|
|
- }
|
|
|
|
|
- req.Add("PosSnId", pos.Id);
|
|
|
|
|
|
|
+ req.Add("PosSn", PosSn);
|
|
|
req.Add("BrandId", data["brandId"].ToString());
|
|
req.Add("BrandId", data["brandId"].ToString());
|
|
|
req.Add("Deposit", data["deposit"].ToString());
|
|
req.Add("Deposit", data["deposit"].ToString());
|
|
|
|
|
+ string UserId = "0";
|
|
|
|
|
+ if(requestMes.Contains("\"userId\""))
|
|
|
|
|
+ {
|
|
|
|
|
+ UserId = data["userId"].ToString();
|
|
|
|
|
+ }
|
|
|
|
|
+ req.Add("UserId", UserId);
|
|
|
string CallBackUrl = "";
|
|
string CallBackUrl = "";
|
|
|
if(requestMes.Contains("\"callBackUrl\""))
|
|
if(requestMes.Contains("\"callBackUrl\""))
|
|
|
{
|
|
{
|
|
@@ -54,12 +55,7 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
string requestMes = sr.ReadToEnd();
|
|
string requestMes = sr.ReadToEnd();
|
|
|
JsonData data = JsonMapper.ToObject(requestMes);
|
|
JsonData data = JsonMapper.ToObject(requestMes);
|
|
|
string PosSn = data["posSn"].ToString();
|
|
string PosSn = data["posSn"].ToString();
|
|
|
- PosMachinesTwo pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.PosSn == PosSn);
|
|
|
|
|
- if(pos == null)
|
|
|
|
|
- {
|
|
|
|
|
- return Json(new AppResultJson() { Status = "-1", Info = "机具号不正确" });
|
|
|
|
|
- }
|
|
|
|
|
- int PosId = pos.Id;
|
|
|
|
|
|
|
+ string MerNo = data["mchNo"].ToString();
|
|
|
int BrandId = int.Parse(data["brandId"].ToString());
|
|
int BrandId = int.Parse(data["brandId"].ToString());
|
|
|
decimal FeeRate = decimal.Parse(data["feeRate"].ToString());
|
|
decimal FeeRate = decimal.Parse(data["feeRate"].ToString());
|
|
|
int FeeExtra = int.Parse(data["feeExtra"].ToString());
|
|
int FeeExtra = int.Parse(data["feeExtra"].ToString());
|
|
@@ -68,27 +64,6 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
{
|
|
{
|
|
|
CallBackUrl = data["callBackUrl"].ToString();
|
|
CallBackUrl = data["callBackUrl"].ToString();
|
|
|
}
|
|
}
|
|
|
- PosMerchantInfo mer = maindb.PosMerchantInfo.FirstOrDefault(m => m.Id == PosId) ?? new PosMerchantInfo();
|
|
|
|
|
- PosMachinesFeeChangeRecord query = maindb.PosMachinesFeeChangeRecord.FirstOrDefault(m => m.PosId == PosId && m.Status == 0);
|
|
|
|
|
- if(query == null)
|
|
|
|
|
- {
|
|
|
|
|
- query = maindb.PosMachinesFeeChangeRecord.Add(new PosMachinesFeeChangeRecord()
|
|
|
|
|
- {
|
|
|
|
|
- CreateDate = DateTime.Now, //创建时间
|
|
|
|
|
- PosId = PosId, //机具Id
|
|
|
|
|
- }).Entity;
|
|
|
|
|
- maindb.SaveChanges();
|
|
|
|
|
- }
|
|
|
|
|
- query.UpdateDate = DateTime.Now; //创建时间
|
|
|
|
|
- query.Sort = pos.BrandId; //品牌Id
|
|
|
|
|
- query.UserId = pos.BuyUserId; //创客
|
|
|
|
|
- query.PosId = PosId; //机具Id
|
|
|
|
|
- query.PosSn = pos.PosSn;
|
|
|
|
|
- query.MerNo = mer.MerchantNo;
|
|
|
|
|
- query.MerchantId = mer.Id;
|
|
|
|
|
- query.PosUserId = pos.BuyUserId; //机具所属人
|
|
|
|
|
- query.ChangeFee = FeeRate; //调整费率
|
|
|
|
|
- maindb.SaveChanges();
|
|
|
|
|
int ChangeKind = 0;
|
|
int ChangeKind = 0;
|
|
|
if(FeeRate == 0.63M && FeeExtra == 3)
|
|
if(FeeRate == 0.63M && FeeExtra == 3)
|
|
|
{
|
|
{
|
|
@@ -105,8 +80,8 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
// PosId:机具Id
|
|
// PosId:机具Id
|
|
|
// Kind:1或2,1为费率0.63+3,2为费率0.63,3为费率0.6
|
|
// Kind:1或2,1为费率0.63+3,2为费率0.63,3为费率0.6
|
|
|
// OpMan:操作人,app传创客编号,后台传SysUserName
|
|
// OpMan:操作人,app传创客编号,后台传SysUserName
|
|
|
- string info = "{\"RecordId\":\"" + query.Id + "\",\"PosId\":\"" + pos.Id + "\",\"Fee\": \"" + FeeRate.ToString("f0").TrimEnd('0') + "\",\"Kind\": \"" + ChangeKind + "\",\"OpMan\": \"接口\",\"CallBackUrl\":\"" + CallBackUrl + "\"}";
|
|
|
|
|
- RedisDbconn.Instance.AddList("SetDepositQueue", info);
|
|
|
|
|
|
|
+ string info = "{\"RecordId\":\"0\",\"PosSn\":\"" + PosSn + "\",\"MerNo\":\"" + MerNo + "\",\"BrandId\":\"" + BrandId + "\",\"Fee\": \"" + FeeRate.ToString("f0").TrimEnd('0') + "\",\"Kind\": \"" + ChangeKind + "\",\"OpMan\": \"接口\",\"CallBackUrl\":\"" + CallBackUrl + "\"}";
|
|
|
|
|
+ RedisDbconn.Instance.AddList("SetDepositPostQueue", info);
|
|
|
return Json(new AppResultJson() { Status = "1", Info = "" });
|
|
return Json(new AppResultJson() { Status = "1", Info = "" });
|
|
|
}
|
|
}
|
|
|
#endregion
|
|
#endregion
|