Browse Source

[WHAT] 使用者頭像回傳加上完整網址 [WHY] 開發 ShowEasy 前台

Dev
Janie 2 years ago
parent
commit
98ecf61dff
  1. 28
      EuroTran/EasyBL.WEBAPP/ShowEasy/MembersService.cs

28
EuroTran/EasyBL.WEBAPP/ShowEasy/MembersService.cs

@ -7,6 +7,7 @@ using Entity;
using Entity.ShowEasyDtos;
using Entity.Sugar;
using Newtonsoft.Json;
using SqlSugar;
using SqlSugar.Base;
using System;
using System.Net;
@ -151,14 +152,22 @@ namespace EasyBL.WEBAPP.SYS
{
do
{
string requestUrl = Common.ConfigGetValue("", "ida:RedirectUri");
var saCountry = db.Queryable<SETB_CMS_Member>()
//搜尋條件
.Where(x => x.OrgID == OrgID && x.Account == Account)
.Single();
var sFilePath = db.Queryable<OTB_SYS_Files>()
.Where(x => x.ParentID == saCountry.MemberID)
.Single();
saCountry.MemberPicture = requestUrl + "/" + sFilePath.FilePath.Replace("\\", "/");
var iRel = db.Insertable(saCountry).ExecuteCommand();
.First();
//返回user信息
srm = new SuccessResponseMessage(null, null);
srm.DATA.Add(BLWording.REL, saCountry);
srm.DATA.Add(BLWording.REL, iRel);
} while (false);
}
@ -212,23 +221,29 @@ namespace EasyBL.WEBAPP.SYS
#region Upload 上傳文件
public HttpResponseMessage UploadAvatar()
public HttpResponseMessage Upload(string OrgID, string Account)
{
SuccessResponseMessage srm = null;
string sError = null;
try
{
var c = HttpContext.Current;
//var c = MemberPicture;
var sGUID = Guid.NewGuid().ToString();
SECommonService commonService = new SECommonService();
// 文件上傳
HttpResponseMessage ret = commonService.Upload(c);
if (ret.StatusCode == HttpStatusCode.OK)
{
// 根據用戶id修改用戶頭像
var db = SugarBase.DB;
SETB_CMS_Member i_crm = new SETB_CMS_Member();
// 缺userid 和orgid
var iRel = db.Updateable(i_crm).ExecuteCommand();
//// 缺userid 和orgid
var iRel = db.Updateable(i_crm)
.Where(i_crm.OrgID == OrgID && i_crm.Accountz)
.ExecuteCommand();
srm = new SuccessResponseMessage(null, null);
srm.DATA.Add(BLWording.REL, iRel);
}
@ -246,6 +261,7 @@ namespace EasyBL.WEBAPP.SYS
return HttpResponseExtension.ToJson(JsonConvert.SerializeObject(srm));
}
#endregion Upload 上傳文件
//註銷帳號

Loading…
Cancel
Save