// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); app.UseHsts(); } // app.UseCors("any"); EduConfigReader.SetConfiguration(Configuration); EduEnviroment.SetEnviroment(env); //DefaultFilesOptions options = new DefaultFilesOptions(); //options.DefaultFileNames.Add("/WebBackEnd/Login"); //app.UseDefaultFiles(options); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseSession(); app.UseMvc(); StaticDataSrv.Init(); InitGlobalData(app); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } EduConfigReader.SetConfiguration(Configuration); XYAppConfigReader.SetConfiguration(Configuration); EduEnviroment.SetEnviroment(env); app.UseStaticFiles(); app.UseHttpsRedirection(); app.UseMvc(); StaticDataSrv.Init(); InitGlobalData(app); }
public bool GenQRInvite(string openId, string phone, string headerUrl) { var qr = _dbContext.DBQRInvite.Where(a => a.UserOpenId == openId && a.InviteQRType == InviteQRType.UserInvite).FirstOrDefault(); if (qr != null) { throw new EduException("不能重复创建邀请码"); } string qrDownFilePath = EduEnviroment.GetQRInviteUserFilePath($"OrigUserInvite_{phone}.png"); string qrWithLogoFilePath = EduEnviroment.GetQRInviteUserFilePath($"UserInviteWithLogo_{phone}.png"); string bkFilePath = EduEnviroment.GetQRFilePath("InviteBK.png"); string finalFilePath = EduEnviroment.GetQRInviteUserFilePath($"FinalUserInvite_{phone}.png"); AccessToken accessToken = WXApi.getAccessToken(); WXQRResult result = WXApi.getQR(WxConfig.QR_Invite_User + "_" + openId, accessToken.access_token); WXApi.DownLoadWXQR(result.ticket, qrDownFilePath); //添加Logo ,且添加文字 List <string> text = new List <string>(); text.Add("您的朋友邀请您加入云艺书院"); QRHelper.AddLogoForQR(headerUrl, new Bitmap(qrDownFilePath), qrWithLogoFilePath, text); //添加背景 QRHelper.AddBKForQR(bkFilePath, qrWithLogoFilePath, finalFilePath); qr = new EQRInvite() { OrigFilePath = EduEnviroment.VirPath_QRInviteUser + $"OrigUserInvite_{phone}.png", FileWithLogoPath = EduEnviroment.VirPath_QRInviteUser + $"UserInviteWithLogo_{phone}.png", FinalFilePath = EduEnviroment.VirPath_QRInviteUser + $"FinalUserInvite_{phone}.png", InviteQRType = InviteQRType.UserInvite, RecordStatus = RecordStatus.Normal, TargetUrl = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=" + result.ticket + "", CreateDateTime = DateTime.Now, UserOpenId = openId }; _dbContext.DBQRInvite.Add(qr); _dbContext.SaveChanges(); return(true); }
public void OnPostCreateTecQR() { Msg = "创建成功!"; string qrDownFilePath = EduEnviroment.GetQRInviteTecFilePath("WXInvite.png"); string bkFilePath = EduEnviroment.GetQRFilePath("InviteBK.png"); string finalFilePath = EduEnviroment.GetQRInviteTecFilePath("EduTecInvite.png"); try { AccessToken accessToken = WXApi.getAccessToken(); WXQRResult result = WXApi.getQR(WxConfig.QR_Invite_TecPre, accessToken.access_token); WXApi.DownLoadWXQR(result.ticket, qrDownFilePath); QRHelper.AddBKForQR(bkFilePath, qrDownFilePath, finalFilePath); } catch (Exception ex) { Msg = ex.Message; } }