using Models; using Models.ModelItems; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Services.Api { //sql static class Help { public static string Init(int keyword, params int[] appid) { string sql = $@"Select DISTINCT AuthotypeId, app.IsValid AppIsValid,a.HeadImg, a.Id, a.Uid, a.Pwd, a.CreateTime, b.AuthorityId, c.AuthorityName, b.HotelId, d.Name HotelName_, d.Code, d.GroupId, e.Name HotelGroupsName from UserInfo a left join UserAuthoes b on a.Id = b.UserId left join Authority c on b.AuthorityId = c.Id left join Hotels d on b.HotelId = d.Id left join HotelGroups e on d.GroupId = e.Id left join AppAutho aa on c.id = aa.AuthorityId left join ApplicationDomain app on aa.AppId =app.Id where a.id = '{keyword}' and b.AuthotypeId <> '1' and aa.AppId in ('{string.Join("','", appid)}') and c.IsValid = 0 and app.IsValid = 0"; return sql; } } public class ResData { public int Id { get; set; } //public string Uid { get; set; } //public string AppName { get; set; } //public DateTime CreateTime { get; set; } public int AuthorityId { get; set; } public string AuthorityName { get; set; } public int HotelId { get; set; } public string HotelName { get { return HotelName_.Trim(); } set { HotelName_ = value.Trim(); } } public string HotelName_ { get; set; } = ""; public string Code { get; set; } public int GroupId { get; set; } public string HotelGroupsName { get; set; } //public int AppIsValid { get; set; } public string HeadImg { get; set; } = "default.png"; public int AuthotypeId { get; set; } } /// /// 写数据库日志 /// public class DBlog { public static void WirtDB(int Count, int uid, int appid) { Task.Run(() => { //using (AuthorityDB db = new AuthorityDB()) //{ // db.AuthoRecordes.Add(new AuthoRecord() { Userid = uid, AppId = appid, Count = Count }); // db.SaveChanges(); //} SqlSugarBase.Db.Insertable(new AuthoRecord() { Userid = uid, AppId = appid, Count = Count }).ExecuteCommand(); //res.Data.Count(); }); } } }