小程序接口修改
This commit is contained in:
@@ -350,13 +350,62 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void SaveAttachUrlForApi(string source, string attachUrl, string menuId, string toKeyId)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
string rootUrl = ConfigurationManager.AppSettings["localRoot"];
|
||||
if (string.IsNullOrEmpty(rootUrl))
|
||||
{
|
||||
rootUrl = Funs.RootPath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通过附件路径得到Source
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetSourceByAttachUrl(string attachUrl, int size, string oldSrouce)
|
||||
List<Model.AttachFile> sour = (from x in db.AttachFile
|
||||
where x.MenuId == menuId && x.ToKeyId == toKeyId
|
||||
select x).ToList();
|
||||
if (sour.Count() == 0)
|
||||
{
|
||||
Model.AttachFile att = new Model.AttachFile
|
||||
{
|
||||
AttachFileId = SQLHelper.GetNewID(),
|
||||
ToKeyId = toKeyId,
|
||||
AttachSource = source.ToString(),
|
||||
AttachUrl = attachUrl,
|
||||
MenuId = menuId,
|
||||
// ImageByte= imageByte,
|
||||
//AttachPath= attachPath,
|
||||
};
|
||||
if (menuId == BLL.Const.PersonListMenuId)
|
||||
{
|
||||
att.ImageByte = AttachFileService.SetImageToByteArray(rootUrl + attachUrl.Split(',')[0]);
|
||||
}
|
||||
db.AttachFile.InsertOnSubmit(att);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
else
|
||||
{
|
||||
Model.AttachFile att = db.AttachFile.FirstOrDefault(x => x.MenuId == menuId && x.AttachFileId == sour.First().AttachFileId);
|
||||
if (att != null)
|
||||
{
|
||||
att.ToKeyId = toKeyId;
|
||||
att.AttachSource = source.ToString();
|
||||
att.AttachUrl = attachUrl;
|
||||
att.MenuId = menuId;
|
||||
if (menuId == BLL.Const.PersonListMenuId)
|
||||
{
|
||||
att.ImageByte = AttachFileService.SetImageToByteArray(rootUrl + attachUrl.Split(',')[0]);
|
||||
}
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 通过附件路径得到Source
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetSourceByAttachUrl(string attachUrl, int size, string oldSrouce)
|
||||
{
|
||||
string attachSource = string.Empty;
|
||||
if (!string.IsNullOrEmpty(attachUrl))
|
||||
|
||||
Reference in New Issue
Block a user