博客主页 😞
标签

.netcore

下的文章

Count:

计 3 篇
125
.net core小知识(持续更新)
.net core小知识(持续更新)
分类: 后端
简介:如何判断DateTime变量不为空可以使用 DateTime 的默认值 DateTime.MinValue 或 DateTime.MaxValue 来进行比较 DateTime myDateTime = ; if (myDateTime != DateTime.MinValue) { // DateTime 变量不为空,执行相应的操作 } else { // DateTime 变量为空,执行其他操作 } SqlSuagr对数据库的操作 1、创建数据库表 _db.DbMaintenance.CreateDatabase() 2、获取数据库表列表 _db.DbMaintenance.GetTableInfoList() 3、删除数据库表 _db.DbMaintenance.DropTable(表名) 获取配置文件中的指定字符串 // 1、读字符串 string conn = builder.Configuration.GetValue<string>("conn"); // 2、读对象 Person person = builder.Configuration.GetSection("Person").Get<Person>();
167
.netcore用sqlsugar实现3表联查
.netcore用sqlsugar实现3表联查
分类: 后端
简介: var data = await _db.Queryable<DDArShop_User_ShopCartEntity, DDAr_Shop_ShopName_TaoCanEntity, DDAr_Shop_UserEntity>((a, b,c) => new JoinQueryInfos(JoinType.Left, a.ShopNameTaoCanId == b.Id,JoinType.Left, a.TenantId == c.Id)).WhereIF(!string.IsNullOrEmpty(input.shopId), a => a.ShopId.Contains(input.shopId)).WhereIF(!string.IsNullOrEmpty(input.shopNameTaoCanId), a => a.ShopNameTaoCanId.Contains(input.shopNameTaoCanId)).Where((a, b, c) => a.DeleteMark == null && a.Type == 1) .Select((a,b,c) => new { id = a.Id, shopId = a.ShopId, shopNameTaoCanId = a.ShopNameTaoCanId, shopName = b.ShopTitle, chengYiJin = a.ChengYiJin, myPrice = a.MyPrice, type = a.Type, content = a.Content, result = a.Result, userPhone = a.UserPhone, userName = c.Nickname }).MergeTable().Select<DDArShop_ShopCartOutput>().OrderBy(sidx + " " + input.order).ToPagedListAsync(input.page, input.limit);
200
.netcore实现base64转png并保存到指定文件夹
.netcore实现base64转png并保存到指定文件夹
分类: 后端
简介: /// <summary> /// 将传入的base64转化成png /// </summary> [HttpPost("ChangeBase64ToPng")] [AllowAnonymous] public async Task<string> ChangeBase64ToPng(DDARShopCodeKeyInput input) { string data = "a"; try { // 将Base64字符串转换为字节数组 byte[] imageBytes = Convert.FromBase64String(input.base64); string outName = YitIdHelper.NextId().ToString(); string outputPath = @"C:\Users\admin\Desktop\qrcode\type"+ input.type + "\\"+ outName + ".png"; // 创建一个MemoryStream来存储字节数组 using (MemoryStream ms = new MemoryStream(imageBytes)) { // 使用System.Drawing.Bitmap加载图像 using (Bitmap bitmap = new Bitmap(ms)) { // 将图像保存为PNG文件 bitmap.Save(outputPath, ImageFormat.Png); data = "图片已保存到:" + outputPath; } } } catch (Exception ex) { data = "转换并保存图片时出错:" + ex.Message; } return data; }
博客主页 芝麻博客·单人主站 哦哈哟
萌ICP备20220001号 苏ICP备2021051187号-1 本站已运行 3 年 69 天 16 小时 23 分 自豪地使用 Typecho 建站,并搭配 MyDiary 主题 Copyright © 2022 ~ 2026. 芝麻博客·单人主站 All rights reserved.
打赏图
打赏博主
欢迎
欢迎
欢迎访问芝麻博客·单人主站
与其说是博客,不如说是错题集
搜 索
足 迹
分 类
  • 默认分类
  • 前端
  • 后端
  • 模型
  • 游戏
  • 日语
  • 博客