快速報名

This commit is contained in:
2026-05-21 17:47:47 +08:00
parent 9fa8ef90cf
commit 77f642b2d2
6 changed files with 579 additions and 386 deletions
+99
View File
@@ -138,10 +138,109 @@ public class FollowerController : ApiController
return count;
}
[HttpPost]
[Route("api/follower/GetFollowerNew")]
public IHttpActionResult GetFollowerNew([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");
}
}
//if (!string.IsNullOrEmpty(q.phone_idcode)){
// MyWeb.encrypt enc = new MyWeb.encrypt();
// qry = qry.Where(o => o.phone ==enc.DecryptAutoKey(q.phone_idcode) || o.cellphone==enc.DecryptAutoKey(q.phone_idcode));
//}
// 電話/證號搜尋 (使用 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),
}).ToList()
};
if (ret.list == null) {
return Ok(new {result="N",message="查無信眾"});
} //throw new HttpResponseException(HttpStatusCode);
return Ok(ret);
}
[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();