快速報名

This commit is contained in:
2026-05-19 17:32:46 +08:00
parent a1751e4b99
commit 9fa8ef90cf
9 changed files with 1506 additions and 25 deletions
+93
View File
@@ -137,6 +137,99 @@ public class FollowerController : ApiController
var count = _db.followers.Count();
return count;
}
[HttpPost]
[Route("api/follower/GetFollower")]
public IHttpActionResult GetFollower([FromBody] Model.ViewModel.follower q)
{
////var qry = _db.followers.Where(a => a.IsDel == false).AsQueryable();////不確定是否新增欄位? 先註解
var qry = _db.followers.AsQueryable();
if (!string.IsNullOrEmpty(q.f_number))
qry = qry.Where(o => o.f_number.Contains(q.f_number.Trim()));
if (!string.IsNullOrEmpty(q.u_name))
qry = qry.Where(o => o.u_name.Contains(q.u_name.Trim()));
if (q.birthday.HasValue)
qry = qry.Where(o => o.birthday >= q.birthday.Value);
if (q.birthday2.HasValue)
{
var tmpBirthday2 = Convert.ToDateTime(q.birthday2.Value).AddDays(1);
qry = qry.Where(o => o.birthday < tmpBirthday2);
}
if (!string.IsNullOrEmpty(q.address))
qry = qry.Where(o => o.address != null && o.address.Contains(q.address.Trim()));
//if (q.num.HasValue && q.num.Value>0)
// qry = qry.Where(o => o.num==q.num.Value);
if (q.ept_self.HasValue && q.ept_self.Value)//排除自己
{
qry = qry.Where(o => o.num != q.num.Value);
}
if (!string.IsNullOrEmpty(q.country))
qry = qry.Where(o => o.country == q.country);
if (!string.IsNullOrEmpty(q.country2))
{
if (q.country2 == "1")
{
qry = qry.Where(o => o.country == "158");
}
else if (q.country2 == "2")
{
qry = qry.Where(o => o.country != "158");
}
}
// 電話/證號搜尋 (使用 search_keywords HEX 編碼)
if (!string.IsNullOrEmpty(q.phone_idcode) && GlobalVariables.UseSearchKeywords)
{
MyWeb.encrypt enc = new MyWeb.encrypt();
string hexSearch = enc.ConvertToHex(q.phone_idcode.Trim());
if (!string.IsNullOrEmpty(hexSearch))
{
qry = qry.Where(o => o.search_keywords != null && o.search_keywords.Contains(hexSearch));
}
}
MyWeb.encrypt encrypt = new MyWeb.encrypt();
var tdesc = publicFun.enum_desc<Model.follower.type>();
var ret = new
{
list = qry.AsEnumerable().Select(x => new
{
num = x.num,
f_number = x.f_number,
u_name = x.u_name,
sex = x.sex,
birthday = x.birthday, //?.ToString("yyyy/MM/dd"),
birthday2 = publicFun.chagenDate(x.birthday), //?.ToString("yyyy/MM/dd"),
sign = Model.follower.chagenSign(x.birthday), //NULL??
sexagenary = Model.follower.sexagenary(x.birthday),
identity_type = x.identity_type,
identity_type_desc = tdesc[x.identity_type ?? 1],//TryGetValue..
id_code=x.id_code,
id_codeDes=encrypt.DecryptAutoKey(x.id_code),
passport=x.passport,
passportDes=encrypt.DecryptAutoKey(x.passport),
phone = x.phone,
phoneDes = encrypt.DecryptAutoKey(x.phone), //--MyWeb.function X
refugedate = x.refugedate,
refuge_name = x.refuge_name,
email = x.email,
address = x.address,
cellphone = x.cellphone,
cellphoneDes = encrypt.DecryptAutoKey(x.cellphone),
}).FirstOrDefault()
};
if (ret.list == null) throw new HttpResponseException(HttpStatusCode.NotFound);
return Ok(ret);
}
[HttpPost]
[Route("api/follower/GetList")]
public IHttpActionResult GetList([FromBody] Model.ViewModel.follower q,