feat: 异常请求处理
This commit is contained in:
@@ -13,30 +13,28 @@ namespace YLErp.Modules.SystemModule
|
||||
public XBondSpreadService()
|
||||
{
|
||||
}
|
||||
|
||||
public XBondSpread Result { get; private set; }
|
||||
|
||||
public void SetXBondSpread(XBondSpread xBondSpread, IYLCache ylCache)
|
||||
{
|
||||
if (ylCache.CacheEnable())
|
||||
try
|
||||
{
|
||||
ylCache.StringSet<XBondSpread>(RedisKey, xBondSpread);
|
||||
ylCache.StringSetWithNoPrefix<XBondSpread>(RedisKey, xBondSpread, null);
|
||||
}
|
||||
else
|
||||
catch(Exception)
|
||||
{
|
||||
Result = xBondSpread;
|
||||
throw new Exception("偏移设置保存失败");
|
||||
}
|
||||
}
|
||||
|
||||
public XBondSpread GetXBondSpread(IYLCache ylCache)
|
||||
{
|
||||
if (ylCache.CacheEnable())
|
||||
try
|
||||
{
|
||||
return ylCache.StringGet<XBondSpread>(RedisKey);
|
||||
return ylCache.StringGetWithNoPrefix<XBondSpread>(RedisKey);
|
||||
}
|
||||
else
|
||||
catch(Exception)
|
||||
{
|
||||
return Result;
|
||||
throw new Exception("偏移设置获取失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,13 +270,28 @@ namespace YLErp.Web.Controllers
|
||||
[MyAuthorize("交易管理-偏移设置")]
|
||||
public ActionResult SpreadSetting()
|
||||
{
|
||||
return View(new XBondSpreadService().GetXBondSpread(_yLCache) ?? new XBondSpread() { bid = 0, ofr = 0 });
|
||||
var result = new XBondSpread() { bid = 0, ofr = 0 };
|
||||
try
|
||||
{
|
||||
result = new XBondSpreadService().GetXBondSpread(_yLCache);
|
||||
}
|
||||
catch(Exception)
|
||||
{
|
||||
}
|
||||
return View(result);
|
||||
}
|
||||
|
||||
public JsonResult AjaxSaveSpreadSetting(XBondSpread data)
|
||||
{
|
||||
new XBondSpreadService().SetXBondSpread(data, _yLCache);
|
||||
return JsonSuccess();
|
||||
try
|
||||
{
|
||||
new XBondSpreadService().SetXBondSpread(data, _yLCache);
|
||||
return JsonSuccess();
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
return JsonError(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,8 +29,12 @@
|
||||
url: "/ExchangeTrade/AjaxSaveSpreadSetting",
|
||||
data: { bid, ofr },
|
||||
success: function (data) {
|
||||
window.parent.showmiddlemessage('偏移设置成功');
|
||||
// 关闭对话框
|
||||
if (!data.success){
|
||||
main.alert(data.msg);
|
||||
return
|
||||
}
|
||||
window.parent.showmiddlemessage('偏移设置成功');
|
||||
// 关闭对话框
|
||||
layer.closeMe();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user