1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- using Cksoft.Data;
- using Cksoft.Data.Repository;
- using DllEapDal;
- using DllEapEntity;
- using DllEapEntity.Dtos;
- using Microsoft.AspNetCore.Authorization;
- using Microsoft.AspNetCore.Mvc;
- using Newtonsoft.Json;
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace DllUnityWebApi
- {
- /// <summary>
- /// 相关
- /// </summary>
- [Route("Eap/Api/[controller]/[action]")]
- [ApiController]
- public class AccountController : Controller
- {
- private IDatabase db = null;
- private StaffDal dal;
- [HttpPost]
- [AllowAnonymous]
- public string Login([FromBody] Staff staff)
- {
- using (IDatabase db = DbFactory.Base("sqlconn"))
- {
- dal = new StaffDal(db);
- string errorinfo = string.Empty;
- staff = dal.Login(staff, ref errorinfo);
- if (staff == null)
- return JsonConvert.SerializeObject(new
- {
- code = -1,
- msg = errorinfo,
- data = new Staff()
- });
- return JsonConvert.SerializeObject(new
- {
- code = 1,
- msg = "",
- data = staff
- });
- }
- }
- [HttpGet]
- public string SignOut()
- {
- try
- {
- return "1";
- }
- catch (Exception e)
- {
- return e.Message;
- }
- }
- }
- }
|