更新伪静态文章栏目规则,生成伪静态页面分页代码

This commit is contained in:
2020-05-26 15:15:32 +08:00
parent 4d658ca4ab
commit 8461f9230e
20 changed files with 287 additions and 122 deletions
@@ -69,29 +69,28 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
tip.Message = "文章栏目标题不能为空!";
return Json(tip);
}
if (string.IsNullOrEmpty(model.FilePath))
if (!string.IsNullOrEmpty(model.FilePath))
{
tip.Message = "文章栏目路径不能为空!";
return Json(tip);
if (!model.FilePath.StartsWith("/"))
{
tip.Message = "栏目路径请以/开头!";
return Json(tip);
}
if (model.FilePath.EndsWith("/"))
{
tip.Message = "栏目路径结尾不用加上/";
return Json(tip);
}
if (model.FilePath.Count(x => x == '/') > 4)
{
tip.Message = "最多只能四级路径!";
return Json(tip);
}
}
if (!model.FilePath.StartsWith("/"))
{
tip.Message = "栏目路径请以/开头!";
return Json(tip);
}
if (model.FilePath.EndsWith("/"))
{
tip.Message = "栏目路径结尾不用加上/";
return Json(tip);
}
if (model.FilePath.Count(x => x == '/') > 4)
{
tip.Message = "最多只能四级路径!";
return Json(tip);
}
if (!AdminUtils.CheckFilePathIsOK(model.FilePath, 0, 0))
if (!string.IsNullOrEmpty(model.FilePath) && !AdminUtils.CheckFilePathIsOK(model.FilePath, 0, 0))
{
tip.Message = "栏目路径不可用,请重新填写!";
return Json(tip);
@@ -163,27 +162,29 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
Json(tip);
}
if (string.IsNullOrEmpty(model.FilePath))
if (!string.IsNullOrEmpty(model.FilePath))
{
tip.Message = "文章栏目路径不能为空!";
return Json(tip);
if (!model.FilePath.StartsWith("/"))
{
tip.Message = "栏目路径请以/开头!";
return Json(tip);
}
if (model.FilePath.EndsWith("/"))
{
tip.Message = "栏目路径结尾不用加上/";
return Json(tip);
}
if (model.FilePath.Count(x => x == '/') > 4)
{
tip.Message = "最多只能四级路径!";
return Json(tip);
}
}
if (!model.FilePath.StartsWith("/"))
{
tip.Message = "栏目路径请以/开头!";
return Json(tip);
}
if (model.FilePath.EndsWith("/"))
{
tip.Message = "栏目路径结尾不用加上/";
return Json(tip);
}
if (model.FilePath.Count(x => x == '/') > 4)
{
tip.Message = "最多只能四级路径!";
return Json(tip);
}
if (!AdminUtils.CheckFilePathIsOK(model.FilePath, entity.Id, 0))
if (!string.IsNullOrEmpty(model.FilePath) && !AdminUtils.CheckFilePathIsOK(model.FilePath, entity.Id, 0))
{
tip.Message = "栏目路径不可用,请重新填写!";
return Json(tip);
@@ -16,13 +16,24 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
public class ServerController : AdminBaseController
{
#region 中文转拼音
public IActionResult Hanzi2Pinyin(string name)
[HttpPost]
public IActionResult Hanzi2Pinyin(string name,int pid=0,string t="")
{
string pinyin = "";
string pinyin = "/";
if(t == "articlecategory" && pid>0)
{
ArticleCategory pcategory = ArticleCategory.FindById(pid);
if(pcategory !=null && !string.IsNullOrEmpty(pcategory.FilePath))
{
pinyin = pcategory.FilePath+"/";
}
}
if (!string.IsNullOrEmpty(name))
{
pinyin = PinYinHelper.GetPinyin(name).ToLower().Replace(" ","-");
pinyin += PinYinHelper.GetPinyin(name).ToLower().Replace(" ","-");
}
tip.Status = JsonTip.SUCCESS;
tip.Message = pinyin;
return Json(tip);