StaffController.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using Cksoft.Data;
  2. using Cksoft.Data.Repository;
  3. using Cksoft.Unity;
  4. using Cksoft.Unity.Log4NetConfig;
  5. using DllUfpDal;
  6. using DllUfpEntity;
  7. using Microsoft.AspNetCore.Authorization;
  8. using Microsoft.AspNetCore.Mvc;
  9. using Microsoft.Extensions.Configuration;
  10. using Newtonsoft.Json;
  11. using System;
  12. using System.Collections.Generic;
  13. using System.Text;
  14. namespace WebApplet.Controllers
  15. {
  16. [Route("eap/api/[controller]/[action]")]
  17. public class StaffController : ControllerBase
  18. {
  19. [HttpPost]
  20. public string Login([FromBody] Staff staff)
  21. {
  22. using (IDatabase db = DbFactory.Base("ufp"))
  23. {
  24. var dal = new StaffDal(db);
  25. string errorinfo = string.Empty;
  26. staff = dal.Login(staff, ref errorinfo);
  27. if (staff == null)
  28. return JsonConvert.SerializeObject(new
  29. {
  30. code = -1,
  31. msg = errorinfo,
  32. data = new Staff()
  33. });
  34. return JsonConvert.SerializeObject(new
  35. {
  36. code = 1,
  37. msg = "",
  38. data = new Staff()
  39. {
  40. FCode = staff.FCode,
  41. FName = staff.FName,
  42. FStatus = staff.FStatus,
  43. Remark = staff.Remark,
  44. ModTime = staff.ModTime,
  45. RecTime = staff.RecTime,
  46. IsSA = staff.IsSA
  47. }
  48. });
  49. }
  50. }
  51. }
  52. }