public Task GetRecordInfo([FromForm] int id, [FromForm] int siteId) { DomainRecord record = SiteAgent.Instance().GetRecordInfo(id); if (record == null) { return(this.ShowError("记录不存在")); } SiteDomain domain = SiteAgent.Instance().GetDomainInfo(siteId, record.DomainID); if (domain == null) { return(this.ShowError("记录数据错误")); } return(this.GetResult(new { record.ID, record.DomainID, record.CDNType, record.CName, record.Status, record.SubName, domain.Domain })); }
public Task GetCDNInfo([FromForm] int recordId, [FromForm] CDNProviderType type) { DomainCDN cdn = SiteAgent.Instance().GetDomainCDNInfo(recordId, type); if (cdn == null) { return(this.ShowError("没有记录")); } return(this.GetResult(cdn)); }
public Task Save([FromForm] int id, [FromForm] string name, [FromForm] Currency currency, [FromForm] Language language) { Site site = SiteAgent.Instance().GetSiteInfo(id); site.Setting = this.context.Request.Form.Fill(site.Setting, "Setting.", false); site.Name = name; site.Currency = currency; site.Language = language; return(this.GetResult(SiteAgent.Instance().SaveSiteInfo(site))); }
public Task GetWhiteIP([FromForm] int id) { Site detail = SiteAgent.Instance().GetSiteInfo(id); return(this.GetResult(new { detail.ID, detail.WhiteIP, detail.SecretKey })); }
public Task SaveSiteDetail([FromForm] int id, [FromForm] string mobile, [FromForm] string email) { SiteDetail sitedetail = new SiteDetail() { SiteID = id, Mobile = mobile, Email = email }; return(this.GetResult(SiteAgent.Instance().SaveDetail(sitedetail))); }
public Task Save([FromForm] int id, [FromForm] string name, [FromForm] Currency currency, [FromForm] Language language, [FromForm] string prefix) { Site site = SiteAgent.Instance().GetSiteInfo(id); site.Name = name; site.Currency = currency; site.Language = language; site.Prefix = prefix; return(this.GetResult(SiteAgent.Instance().SaveSiteInfo(site))); }
public override void OnActionExecuting(ActionExecutingContext context) { MethodInfo method = (context.ActionDescriptor as ControllerActionDescriptor).MethodInfo; // 如果带有游客标记则不需要做验证判断 if (method.HasAttribute <GuestAttribute>()) { return; } //#1 从Http头中得到商户信息 bool isSite = context.HttpContext.GetAuth(out string merchant, out string secretKey); if (!isSite) { context.Result = (ContentResult) new Result(false, ResultStatus.SecretKey.ToString()); return; } int siteId = merchant.GetValue <int>(); Site site = SiteAgent.Instance().GetSiteInfo(siteId); if (site == null || site.SecretKey != secretKey) { context.Result = (ContentResult) new Result(false, ResultStatus.SecretKey.ToString()); return; } //#2 固定参数判断(自动在游戏中创建账户) string gameCode = context.HttpContext.Request.Form["GameCode"]; string userName = context.HttpContext.Request.Form["UserName"]; if (!string.IsNullOrEmpty(gameCode)) { GameSetting game = GameAgent.Instance().GetGameSetting(gameCode); if (game == null) { context.Result = (ContentResult) new Result(false, ResultStatus.NoGame.ToString()); return; } if (!string.IsNullOrEmpty(userName)) { ResultStatus registerStatus = APIAgent.Instance().Register(siteId, userName, game, out UserGame user); if (registerStatus != ResultStatus.Success) { context.Result = (ContentResult) new Result(false, registerStatus.ToString()); return; } context.HttpContext.SetItem(user); } context.HttpContext.SetItem(game); } context.HttpContext.SetItem(site); }
/// <summary> /// 注册接口(自动) /// 在 FilterAttribute 中判断是否存在,如果不存在则自动注册 /// </summary> /// <param name="siteId">所属商户</param> /// <param name="userName">用户名</param> /// <param name="gameinfo">要进入的游戏接口</param> /// <returns></returns> public ResultStatus Register(int siteId, string userName, GameSetting game, out UserGame userGame) { int userId = UserAgent.Instance().GetUserID(siteId, userName); if (userId == 0) { if (!WebAgent.IsUserName(userName, 2, 16)) { userGame = null; return(ResultStatus.BadUserName); } // 用户主表注册 User user = new User() { SiteID = siteId, UserName = userName, CreateAt = DateTime.Now, Status = UserStatus.Normal }; this.WriteDB.InsertIdentity(user); userId = user.ID; } //#2 写入游戏表 userGame = UserAgent.Instance().GetUserGameInfo(userId, game.ID); if (userGame == null) { Site site = SiteAgent.Instance().GetSiteInfo(siteId); RegisterResult result = game.Setting.Register(new RegisterUser() { Prefix = site.Prefix, UserName = userName }); if (result) { userGame = new UserGame() { SiteID = siteId, UserID = userId, Account = result.Account, Password = result.Password, GameID = game.ID, Status = UserGameStatus.Normal, UpdateAt = DateTime.Now }; this.WriteDB.Insert(userGame); } return(result.Status); } return(ResultStatus.Success); }
public Task GetWhiteIP([FromForm] int id) { SiteDetail detail = SiteAgent.Instance().GetDetailInfo(id) ?? new SiteDetail() { SiteID = id }; return(this.GetResult(new { detail.SiteID, detail.WhiteIP })); }
public Task DomainList([FromForm] int id) { List <SiteDomain> domains = SiteAgent.Instance().GetDomainList(id); List <DomainRecord> records = BDC.DomainRecord.Where(t => BDC.SiteDomain.Any(p => p.SiteID == id && p.ID == t.DomainID)).ToList(); return(this.GetResult(this.ShowResult(domains, t => new { t.ID, t.SiteID, t.Domain, Records = records.Where(p => p.DomainID == t.ID) }))); }
public Task GetAdminUrl([FromForm] int id) { SiteDetail detail = SiteAgent.Instance().GetDetailInfo(id) ?? new SiteDetail() { SiteID = id }; return(this.GetResult(new { detail.SiteID, detail.AdminURL, Domain = (SettingAgent.Instance().GetSetting(SettingType.AdminDomain) ?? string.Empty).Split(',') })); }
public Task TemplateList([FromForm] int siteId, [FromForm] PlatformSource?platform) { var list = BDC.ViewSiteTemplate.Where(t => t.SiteID == siteId) .Where(platform, t => t.Platform == platform.Value); Site site = SiteAgent.Instance().GetSiteInfo(siteId); return(this.GetResult(this.ShowResult(list, t => new { t.ID, t.Name, t.Platform, t.Domain, IsDefault = site.GetTemplateID(t.Platform) == t.ID }))); }
public Task AddSite([FromForm] int id, [FromForm] string name, [FromForm] Currency currency, [FromForm] Language language, [FromForm] string prefix) { Site site = new Site() { ID = id, Name = name, Currency = currency, Language = language, Status = Site.SiteStatus.Open, Prefix = prefix }; return(this.GetResult(SiteAgent.Instance().AddSite(site))); }
public Task GetTemplate([FromForm] int templateId) { ViewSiteTemplate template = SiteAgent.Instance().GetTemplateInfo(templateId); Site site = SiteAgent.Instance().GetSiteInfo(template.SiteID); return(this.GetResult(new { template.ID, template.SiteID, template.Name, template.Platform, template.Domain, IsDefault = site.GetTemplateID(template.Platform) == templateId, Models = template.Configs.ToDictionary(t => t.ViewID, t => new { t.ModelID, t.ID }) })); }
public Task AddSite([FromForm] int id, [FromForm] string name, [FromForm] Currency currency, [FromForm] Language language, [FromForm] int pcTemplate, [FromForm] int h5Template, [FromForm] int appTemplate) { Site site = new Site() { ID = id, Name = name, Currency = currency, Language = language, PCTemplate = pcTemplate, H5Template = h5Template, APPTemplate = appTemplate, Status = Site.SiteStatus.Normal }; return(this.GetResult(SiteAgent.Instance().AddSite(site))); }
public Task AddTemplate([FromForm] string name, [FromForm] int siteId, [FromForm] PlatformSource source, [FromForm] int isDefault, [FromForm] string domain, [FromForm] int templateId) { if (templateId == 0) { return(this.ShowError("请选择来源模板")); } ViewSiteTemplate template = new ViewSiteTemplate() { SiteID = siteId, Name = name, Platform = source, Domain = domain }; return(this.GetResult(SiteAgent.Instance().AddTemplate(template, isDefault == 1, templateId))); }
public Task GetDomainClipboard([FromForm] int siteId, [FromForm] int domainId) { SiteDomain domain = SiteAgent.Instance().GetDomainInfo(siteId, domainId); if (domain == null) { return(this.ShowError("域名错误")); } IEnumerable <DomainRecord> records = SiteAgent.Instance().GetDomainRecordList(domainId).Where(t => t.Status == DomainRecord.RecordStatus.Finish); if (records.Count() == 0) { return(this.ShowError("没有已完成的记录")); } List <string> clipboard = new List <string>(); foreach (DomainRecord record in records) { clipboard.Add($"域名:{record.SubName}.{domain.Domain} 指向到(别名记录) {record.CName}"); } return(this.GetResult(clipboard)); }
/// <summary> /// 删除记录 /// </summary> /// <param name="id"></param> /// <returns></returns> public Task DeleteRecord([FromForm] int id) { return(this.GetResult(SiteAgent.Instance().DeleteRecord(id))); }
public Task Info([FromForm] int id) { Site site = SiteAgent.Instance().GetSiteInfo(id); return(this.GetResult(site)); }
public Task SitePayMul([FromForm] string IDs, [FromForm] decimal money) { return(this.GetResult(SiteAgent.Instance().SitePayMul(IDs, money))); }
public Task SitePay([FromForm] int id, [FromForm] decimal money) { return(this.GetResult(SiteAgent.Instance().SitePay(id, money))); }
public Task GetSiteGameSetting([FromForm] int id) { return(this.GetResult(SiteAgent.Instance().GetSiteGameSetting(id))); }
public Task LoadSiteGameSetting([FromForm] int siteid) { return(this.GetResult(SiteAgent.Instance().LoadSiteGameSetting(siteid))); }
public Task SaveSiteGameSetting([FromForm] int id, [FromForm] SiteGameStatus status, [FromForm] decimal rate, [FromForm] byte sort) { return(this.GetResult(SiteAgent.Instance().SaveSiteGameSetting(id, status, rate, sort))); }
public Task SaveStatus([FromForm] int id, [FromForm] SiteStatus status) { return(this.GetResult(SiteAgent.Instance().SaveStatus(id, status))); }
public Task SaveWhiteIP([FromForm] int id, [FromForm] string whiteIP, [FromForm] string secretKey) { return(this.GetResult(SiteAgent.Instance().SaveWhiteIP(id, whiteIP, secretKey))); }
/// <returns></returns> public Task AddDomain([FromForm] int siteId, [FromForm] string domain, [FromForm] string subName, [FromForm] CDNProviderType provider) { return(this.GetResult(SiteAgent.Instance().AddDomain(siteId, domain, (subName ?? string.Empty).Split(','), provider))); }
public Task UpdateCDNProvider([FromForm] int recordId, [FromForm] CDNProviderType provider, [FromForm] string cname) { return(this.GetResult(SiteAgent.Instance().UpdateCDNProvider(recordId, provider, cname))); }
public Task SaveAdminUrl([FromForm] int id, [FromForm] string adminURL) { return(this.GetResult(SiteAgent.Instance().SaveAdminUrl(id, adminURL))); }
public Task AddRecord([FromForm] int siteId, [FromForm] int domainId, [FromForm] string subName, [FromForm] CDNProviderType provider) { return(this.GetResult(SiteAgent.Instance().AddDomainRecord(siteId, domainId, subName, provider))); }