Compare commits

..
167 Commits
Author SHA1 Message Date
jonah.fu d2a5ab9e3f docs(readme): 更新贡献者兼哲的GitHub账号信息
- 将贡献者兼哲的账号由 ferock 改为 github: ferocknew
- 统一格式,方便识别和联系
- 保持贡献者列表的准确性和及时更新
2025-12-08 10:53:19 +08:00
jonah.fu 4cbd11eb29 fix(compose): 删除无效挂载路径配置
- 移除了 compose.yaml 文件中无效的 ./data:/docker-entrypoint-initdb.d:ro 挂载配置
- 清理了多余的网络声明格式错误
- 优化了健康检查相关配置的格式规范
2025-12-08 10:51:33 +08:00
jonah.fu 9a2123bf47 fix(compose): 优化redis启动命令支持无密码模式
- 修改redis容器启动命令,支持根据环境变量自动启用密码认证
- 使用shell脚本判断REDIS_PASSWORD是否存在,灵活控制启动参数
- 保持健康检查命令不变,确保服务可用性检测正常
- 移除无用的volumes配置,清理compose文件冗余内容
2025-12-08 10:49:34 +08:00
jonah.fu 454c6825fa chore(docker): 优化 compose.yaml 环境变量格式
- 将环境变量从列表形式改为字典形式,提高可读性
- 为连接字符串和缓存配置添加双引号,确保字符串解析正确
- 保持依赖服务健康检测配置不变,确保服务启动顺序
- 优化环境变量声明格式,统一使用冒号分隔符
2025-12-08 10:47:54 +08:00
jonah.fu 97f490e304 refactor(compose): 优化docker compose文件结构和服务配置
- 统一并精简MySQL服务配置,移除冗余命名和字段
- 调整Redis服务命名和healthcheck配置,简化命令行参数
- 修改web服务构建上下文路径,修正Dockerfile引用方式
- 优化环境变量配置,移除重复及无用变量定义
- 重新调整依赖服务条件,保证依赖健全和健康检查
- 规范卷挂载设置,新增数据保护卷配置
- 简化网络和卷声明,保持结构清晰整洁
2025-12-08 10:45:12 +08:00
jonah.fu 3aae9200eb chore(docker): 升级基础镜像及优化运行配置
- 将构建环境镜像升级为 .NET SDK 10.0 版本
- 将运行时基础镜像升级为 .NET ASP.NET 10.0 版本
- 统一设置工作目录和文件复制流程
- 安装 curl 以支持健康检查和 SkiaSharp 依赖
- 修改容器入口点为自定义启动脚本以适应生产环境需求
- 精简 Dockerfile,移除多余目录创建和权限设置步骤
2025-12-08 10:41:41 +08:00
HogenWang 8f4dd7f5ca Merge branch 'docker' of https://github.com/hogenwang/comcms_core into docker
# Conflicts:
#	.gitignore
#	COMCMS.API/COMCMS.API.csproj
#	COMCMS.Common/COMCMS.Common.csproj
#	COMCMS.Core/COMCMS.Core.csproj
#	COMCMS.Web/COMCMS.Web.csproj
#	COMCMS.Web/Dockerfile
#	COMCMS.Web/Views/Home/Install.cshtml
#	COMCMS.Web/appsettings.json
#	Lib.Core/Lib.Core.csproj
#	README.md
#	compose.yaml
2025-12-08 08:41:36 +08:00
jonah.fu df478d3516 chore(docker): 增强 Dockerfile 并完善 README 部署文档
- 在 Dockerfile 中添加 SkiaSharp 依赖的系统库安装
- 更新 README.md,新增 Docker 一键启动指南和访问说明
- 详细说明自动初始化数据库的流程和重新初始化方法
- 补充环境变量配置说明,便于用户定制 MySQL 和 Redis 设置
- 丰富本地开发启动方法和演示地址展示格式,提高用户体验
2025-12-06 21:59:14 +08:00
jonah.fu b08d7c1ede fix(run): 优化运行脚本环境变量加载和启动逻辑
- 改为仅在开发模式加载 .env 文件,避免生产环境不必要加载
- 缺少 .env 文件时调整提示信息为“提示”级别,减少误导
- 生产模式启动时先检查根目录dll文件,存在则直接运行
- 不存在dll时切换到子目录启动,兼容不同部署结构
- 统一输出启动模式提示,提升日志可读性
2025-12-06 21:46:49 +08:00
jonah.fu 991f032502 style(compose): 统一 compose.yaml 中环境变量的格式
- 将环境变量从数组格式改为键值对格式
- 保持配置项的可读性和一致性
- 使环境变量定义更加简洁清晰
- 未改变实际的环境变量内容和数值
- 优化了 docker-compose 文件的格式规范
2025-12-06 21:42:38 +08:00
jonah.fu 61aa025055 fix(docker): 修复compose.yaml中环境变量配置错误
- 删除了多余的ASPNETCORE_ENVIRONMENT配置
- 移除了不必要的MySQL和Redis环境变量设置
- 清理配置文件以简化环境变量管理
- 确保运行脚本自动构建连接字符串正常工作
2025-12-06 21:41:57 +08:00
jonah.fu 75d8402ff8 fix(docker): 修正环境变量注释和Redis密码配置格式
- 更新MySQL配置注释,说明连接字符串由run.sh构建
- 更新Redis配置注释,说明连接字符串由run.sh构建
- 修改Redis密码环境变量为字符串格式,避免为空值错误
- 保持其他环境变量和端口映射不变
2025-12-06 21:41:06 +08:00
jonah.fu c2ef40c4c0 chore(docker): 优化容器配置和启动脚本
- 将MySQL和Redis环境变量从连接字符串拆分为单独变量,便于管理
- 增加run.sh启动脚本,支持生产和开发模式启动选择
- 修改Dockerfile,复制run.sh并设置执行权限,改用脚本作为入口点
- run.sh中构建数据库和缓存连接字符串,增加配置灵活性和安全性
- 启动日志打印更清晰,隐藏敏感信息
- Startup.cs中添加XCode数据库连接字符串配置初始化逻辑
2025-12-06 21:40:14 +08:00
jonah.fu 29ebabdc4e fix(docker): 修复并规范日志目录创建与权限设置
- 新增 /app/Log 和 /appLog 目录的创建
- 设置新增日志目录的所属用户和用户组为 app:app
- 保持原有目录权限设置不变,确保切换用户前目录权限正确
- 优化 Dockerfile 创建目录的命令结构,提高可读性和一致性
2025-12-06 21:34:12 +08:00
jonah.fu a6bbfb4827 fix(compose): 修正Docker Compose中服务启动命令和环境变量配置
- 将端口映射格式调整为缩进的command数组形式
- 使用command参数显式指定dotnet运行COMCMS.Web.dll及其配置参数
- 移除冗余环境变量配置,避免重复定义连接字符串
- 完善Redis缓存和数据库连接字符串的命令行传参格式
- 保持其它服务依赖配置不变,确保启动顺序正确
2025-12-06 21:31:40 +08:00
jonah.fu 632663ce02 chore(config): 更新Redis和数据库连接配置
- Redis连接地址改为127.0.0.1,密码置空,保持默认数据库为2
- 数据库连接地址修改为localhost,数据库名改为comcms
- 数据库用户改为root,密码设为root,端口及字符集保持不变
2025-12-06 21:09:55 +08:00
jonah.fu 831e4666f7 chore(docker): 修改服务名称及环境变量配置
- 将 MySQL 服务名称由 mysql 改为 web_mysql
- 将 Redis 服务名称由 redis 改为 web_redis
- 更新应用环境变量中数据库连接字符串的服务器名称
- 更新 Redis 缓存连接字符串配置,添加密码字段
- 添加日志级别相关环境变量配置
- 修改服务依赖中的服务名称,确保依赖正确
- 保持卷配置不变,继续挂载上传文件数据卷
2025-12-06 20:52:44 +08:00
jonah.fu e69ee64088 chore(docker): 设置 ASP.NET Core 监听端口环境变量
- 在 Dockerfile 中添加 ENV 变量 ASPNETCORE_URLS 以监听 80 端口
- 确保 ASP.NET Core 应用在容器中正确绑定端口
- 增强容器配置的可维护性和灵活性
2025-12-06 20:44:58 +08:00
jonah.fu 9861e1af20 fix(install): 修正 MySQL 安装页面默认选项的操作系统判断
- 根据运行环境自动判断是否为 Linux 操作系统
- 设置 MySQL 类型选择框默认选中对应操作系统选项
- 优化安装页面用户体验,避免手动选择错误的数据库类型
- 更新视图逻辑实现动态默认选项的渲染
2025-12-06 20:39:44 +08:00
jonah.fu 3e8e94147a fix(compose): 修正环境变量格式并启用健康检查
- 修正 environment 部分中连接字符串键的大小写格式
- 取消注释并启用网络的健康检查配置
- 设置健康检查的启动等待时间为40秒
- 保持端口映射和卷配置不变
2025-12-06 20:35:53 +08:00
jonah.fu e5beb6e5a2 fix(config): 更新数据库和Redis连接配置
- 修改appsettings.json中Redis连接字符串为新的服务器地址和密码
- 更新数据库连接字符串为新的服务器地址、数据库名和凭据
- 修正run.sh中数据库连接字符串环境变量的命名格式,使用小写开头
- 添加环境变量检查输出,方便确认配置是否正确加载
2025-12-06 20:35:33 +08:00
jonah.fu f9b31383da chore(env): 添加启动脚本并更新日志配置
- 将 appsettings.json 中的日志级别调整为信息级别
- 新增 run.sh 启动脚本实现环境变量加载
- 通过环境变量设置数据库和 Redis 连接字符串
- 支持配置 JWT 密钥和签名盐
- 输出配置信息,方便调试和确认环境设置
- 运行 dotnet 项目并监听动态端口
2025-12-06 20:33:39 +08:00
jonah.fu 3be384a668 chore(core): 降级项目目标框架及相关依赖至 net9.0
- 统一将 COMCMS.API、COMCMS.Common、COMCMS.Core、COMCMS.Web 和 Lib.Core 项目的目标框架从 net10.0 降级至 net9.0
- 调整 COMCMS.Web 项目中部分 NuGet 包版本号以匹配 net9.0 版本要求
- 更新 Dockerfile 中的基础镜像版本为 .NET 9.0,保持构建和运行环境一致
- 修改 appsettings.json 中数据库服务器地址为 localhost,优化本地连接配置
- 删除敏感信息的 .env 文件,新增示例环境变量文件 .env.example,便于开发者配置环境变量
- 在 .gitignore 中添加 .env 文件,防止敏感信息被提交到代码仓库
2025-12-06 20:27:11 +08:00
jonah.fu 1cdabd1ee7 chore(docker): 暂时移除并注释健康检查配置
- 在 compose.yaml 中注释掉 comcms_network 的健康检查配置以排查问题
- 在 Dockerfile 中注释掉 HEALTHCHECK 指令,因为 aspnet 镜像缺少 curl 命令
- 保留了健康检查相关的配置,以便后续恢复使用
- 保证容器启动逻辑不受影响
2025-12-06 20:12:38 +08:00
jonah.fu e36e5548c1 fix(docker): 优化目录创建与权限设置顺序
- 将目录创建和权限设置合并为单个 RUN 命令执行
- 添加 /home/app/.aspnet/DataProtection-Keys 目录创建
- 设置 /home/app/.aspnet 目录的所有者为 app 用户
- 在切换到 app 用户之前完成目录准备工作
2025-12-06 20:04:22 +08:00
jonah.fu 75f6207ccc chore(docker): 添加数据保护键卷配置
- 在 compose.yaml 中为数据保护键添加卷挂载配置
- 配置本地驱动存储数据保护键卷 dataprotection_keys
- 确保数据保护密钥持久化存储以支持应用安全功能
2025-12-06 20:01:18 +08:00
jonah.fu dc7e7fe41b chore(docker): 优化COMCMS Web服务Docker配置
- 修改docker-compose配置,调整构建上下文和Dockerfile路径
- 重新设计COMCMS.Web Dockerfile,分阶段构建镜像
- 添加依赖还原、构建和发布步骤,实现多阶段构建
- 设置发布文件复制和权限配置,确保容器运行用户安全
- 保留健康检查配置,监控服务状态
2025-12-06 19:50:40 +08:00
jonah.fu 1937f09864 fix(compose): 优化MySQL服务健康检查配置
- 增加健康检查间隔为10秒
- 设置健康检查超时时间为20秒
- 配置重试次数为10次
- 添加启动宽限期为30秒
2025-12-06 19:48:56 +08:00
jonah.fu 7093fe22d1 chore(compose): 简化并固定数据库和缓存服务配置
- 将MySQL镜像版本由8.4.7改为8.0
- 移除环境变量默认值,直接使用固定的数据库连接配置
- 删除MySQL启动命令参数--mysql-native-password=ON
- 优化MySQL健康检查命令,简化认证方式
- 精简Redis启动命令,去除密码判断逻辑
- 简化Redis健康检查命令,统一使用无密码ping命令
- 固定ASP.NET Core环境变量为Production,去除默认值变量
- 精简数据库和Redis连接字符串配置,移除多余参数
2025-12-06 19:41:37 +08:00
jonah.fu ca716ed0dd fix(compose): 修复 compose.yaml 文件中的 RedisCache 配置语法错误
- 删除 RedisCache__InstanceName 中多余的冒号
- 统一配置格式,保证环境变量解析正确
- 优化 Redis 缓存相关的环境变量设置
- 确保依赖关系中的 mysql 服务配置正确
2025-12-06 19:37:44 +08:00
jonah.fu 624214a061 fix(compose): 修复 compose.yaml 文件中的 RedisCache 配置语法错误
- 删除 RedisCache__InstanceName 中多余的冒号
- 统一配置格式,保证环境变量解析正确
- 优化 Redis 缓存相关的环境变量设置
- 确保依赖关系中的 mysql 服务配置正确
2025-12-06 19:29:25 +08:00
jonah.fu c56533c2da chore(docker): 更新 Dockerfile 至 .NET 10 并完善容器配置
- 将基础镜像更新为 mcr.microsoft.com/dotnet/aspnet:10.0
- 创建必要目录 /app/wwwroot/userfiles 和 /app/logs 并设置权限
- 切换容器用户为非 root 的 app 用户以增强安全性
- 添加健康检查指令,定期检测服务状态
- 补充 docker-compose.yaml 服务配置,包含 MySQL、Redis 及 Web 服务
- 新增 .env 文件示例,完善数据库和缓存环境变量配置
- 更新 README.md 贡献者列表和项目说明文档
2025-12-05 17:33:28 +08:00
jonah.fu 8de7d2ca6f chore(docker): 更新 Dockerfile 至 .NET 10 并完善容器配置
- 将基础镜像更新为 mcr.microsoft.com/dotnet/aspnet:10.0
- 创建必要目录 /app/wwwroot/userfiles 和 /app/logs 并设置权限
- 切换容器用户为非 root 的 app 用户以增强安全性
- 添加健康检查指令,定期检测服务状态
- 补充 docker-compose.yaml 服务配置,包含 MySQL、Redis 及 Web 服务
- 新增 .env 文件示例,完善数据库和缓存环境变量配置
- 更新 README.md 贡献者列表和项目说明文档
2025-12-05 17:33:28 +08:00
HogenWang 5e2e12e670 优化后台栏目页面,增加快速显示和隐藏菜单 2025-11-14 18:57:01 +08:00
HogenWang 937bdd0356 优化后台栏目页面,增加快速显示和隐藏菜单 2025-11-14 18:57:01 +08:00
HogenWang 7cd41821c0 升级到.net 10 2025-11-14 09:14:48 +08:00
HogenWang 485d0b07ca 升级到.net 10 2025-11-14 09:14:48 +08:00
jonah.fu e129c76471 Merge branch 'release/1.0.1' 2025-08-15 13:15:27 +08:00
jonah.fu 0d26b9f89f Merge branch 'release/1.0.1' 2025-08-15 13:15:27 +08:00
jonah.fu 68cae8d169 Merge branch 'feature/upgrade_1' into dev 2025-08-15 13:12:09 +08:00
jonah.fu cbb05d5aec Merge branch 'feature/upgrade_1' into dev 2025-08-15 13:12:09 +08:00
jonah.fu b7cafe76e5 fix:优化异常处理和文件操作
- 在安装过程中添加异常处理,提高系统稳定性
- 优化文件读写操作,确保数据安全
- 更新异常处理机制,满足优化建议
2025-08-14 18:38:07 +08:00
jonah.fu f11a2dc840 fix:优化异常处理和文件操作
- 在安装过程中添加异常处理,提高系统稳定性
- 优化文件读写操作,确保数据安全
- 更新异常处理机制,满足优化建议
2025-08-14 18:38:07 +08:00
jonah.fu 7ae5d3e885 feat(SystemSetting): 增加图片扩展名配置项并优化图片判断逻辑
- 在 appsettings.json 中添加 ImageExtensions 配置项,用于指定允许的图片扩展名
- 在 SystemSetting 模型中添加 ImageExtensions 属性
- 优化 Utils.cs 中的 IsImageFile 方法,支持从配置中读取图片扩展名列表
- 新增 TODO 列表,包含项目优化建议和改进任务
2025-08-14 18:22:51 +08:00
jonah.fu 31afac93d3 feat(SystemSetting): 增加图片扩展名配置项并优化图片判断逻辑
- 在 appsettings.json 中添加 ImageExtensions 配置项,用于指定允许的图片扩展名
- 在 SystemSetting 模型中添加 ImageExtensions 属性
- 优化 Utils.cs 中的 IsImageFile 方法,支持从配置中读取图片扩展名列表
- 新增 TODO 列表,包含项目优化建议和改进任务
2025-08-14 18:22:51 +08:00
jonah.fu a57211677d docs(OPTIMIZATION_SUGGESTIONS): 添加 COMCMS_NETCORE项目优化建议文档
- 新增 OPTIMIZATION_SUGGESTIONS.md 文件,提出项目优化建议
- 内容涵盖安全性、性能、代码质量、架构设计、用户体验等方面
- 提供具体的优化方案和实施建议,以提升项目整体质量和可维护性
2025-08-14 18:05:17 +08:00
jonah.fu 8344e3e349 docs(OPTIMIZATION_SUGGESTIONS): 添加 COMCMS_NETCORE项目优化建议文档
- 新增 OPTIMIZATION_SUGGESTIONS.md 文件,提出项目优化建议
- 内容涵盖安全性、性能、代码质量、架构设计、用户体验等方面
- 提供具体的优化方案和实施建议,以提升项目整体质量和可维护性
2025-08-14 18:05:17 +08:00
jonah.fu 1fbe4fc978 feat(caching): 实现分布式缓存服务
- 新增 CacheService 和 ICacheService 接口,提供缓存操作功能
- 在 Startup.cs 中配置缓存服务- 更新 appsettings.json,增加 RedisCache 和 CacheSettings 配置- 修改 XCode.config,调整缓存相关设置
2025-08-14 13:15:50 +08:00
jonah.fu 91b06ec8fe feat(caching): 实现分布式缓存服务
- 新增 CacheService 和 ICacheService 接口,提供缓存操作功能
- 在 Startup.cs 中配置缓存服务- 更新 appsettings.json,增加 RedisCache 和 CacheSettings 配置- 修改 XCode.config,调整缓存相关设置
2025-08-14 13:15:50 +08:00
jonah.fu 2cf41efc0f Merge branch 'master' into dev 2025-08-14 11:55:48 +08:00
jonah.fu 00776ca3a2 Merge branch 'master' into dev 2025-08-14 11:55:48 +08:00
jonah.fu 953ee66e8f chore: 更新 .gitignore 和 README.md
- 在 .gitignore 中添加 .cursorrules 文件忽略项
- 更新 README.md 中的更新日志和贡献者信息
- 添加捐赠信息和新的技术交流群号
2025-08-14 11:50:54 +08:00
jonah.fu 4f1efc489a chore: 更新 .gitignore 和 README.md
- 在 .gitignore 中添加 .cursorrules 文件忽略项
- 更新 README.md 中的更新日志和贡献者信息
- 添加捐赠信息和新的技术交流群号
2025-08-14 11:50:54 +08:00
jonah.fu 38767ae629 docs(README): 添加技术交流群号
在 README.md 文件中添加了技术交流群号 1600800,便于用户加入群进行技术交流。
2025-08-14 11:17:01 +08:00
jonah.fu 73f7c687c2 docs(README): 添加技术交流群号
在 README.md 文件中添加了技术交流群号 1600800,便于用户加入群进行技术交流。
2025-08-14 11:17:01 +08:00
HogenWang bd5374ceec 更新依赖,删除部分没用到的功能 2025-05-26 14:02:00 +08:00
HogenWang a18f26f308 更新依赖,删除部分没用到的功能 2025-05-26 14:02:00 +08:00
HogenWang cb581ee8cc 优化部分代码 2024-10-06 16:23:34 +08:00
HogenWang 20a71ce910 优化部分代码 2024-10-06 16:23:34 +08:00
HogenWang e83b4c01fd 更新组件 2024-10-04 13:32:40 +08:00
HogenWang 00a551f784 更新组件 2024-10-04 13:32:40 +08:00
HogenWang c7205a98d8 增加商品接口 2024-09-24 19:08:08 +08:00
HogenWang c66589574c 增加商品接口 2024-09-24 19:08:08 +08:00
HogenWang eac4f4fbea 修复linux下面路径大小写问题 2024-09-09 19:23:44 +08:00
HogenWang 2aa1c0bcb2 修复linux下面路径大小写问题 2024-09-09 19:23:44 +08:00
HogenWang 96646acd86 更新组件 2024-09-06 19:38:09 +08:00
HogenWang 722e413663 更新组件 2024-09-06 19:38:09 +08:00
HogenWang 1b7a3286e5 更新组件 2024-08-09 19:24:17 +08:00
HogenWang a7febd84ef 更新组件 2024-08-09 19:24:17 +08:00
HogenWang 3a325774d8 增加redis缓存 2024-07-12 18:55:07 +08:00
HogenWang 6deb400144 增加redis缓存 2024-07-12 18:55:07 +08:00
HogenWang 48b68889b0 完善商品栏目管理选择模板,商品栏目、商品伪静态地址生成 2024-06-26 17:48:08 +08:00
HogenWang 6a5ef1226c 完善商品栏目管理选择模板,商品栏目、商品伪静态地址生成 2024-06-26 17:48:08 +08:00
HogenWang 3328ba055b 完善事件权限管理 2024-06-26 00:48:05 +08:00
HogenWang e97763bfab 完善事件权限管理 2024-06-26 00:48:05 +08:00
HogenWang 2543005f96 调整界面 2024-06-21 18:53:54 +08:00
HogenWang 4d5d6fd006 调整界面 2024-06-21 18:53:54 +08:00
HogenWang 63adfbd462 优化后台界面,精简所有不需要用到的js插件 2024-06-14 18:25:16 +08:00
HogenWang 1f22424b78 优化后台界面,精简所有不需要用到的js插件 2024-06-14 18:25:16 +08:00
HogenWang f351dd3c62 更新组件 2024-05-22 18:30:01 +08:00
HogenWang 67fced6dc7 更新组件 2024-05-22 18:30:01 +08:00
HogenWang 62d8608864 优化xcode查询分页,必须指定排序健 2024-05-10 09:17:01 +08:00
HogenWang 543e7d8ee7 优化xcode查询分页,必须指定排序健 2024-05-10 09:17:01 +08:00
HogenWang 4bb00d68e1 更新组件 2024-04-11 19:04:09 +08:00
HogenWang dc1fea5f95 更新组件 2024-04-11 19:04:09 +08:00
HogenWang a1c6145fb4 修复后台登录验证码无效问题 2024-03-27 11:36:52 +08:00
HogenWang 76fe507e18 修复后台登录验证码无效问题 2024-03-27 11:36:52 +08:00
HogenWang 8f9049de7c 增加登录验证码设置 2024-03-07 18:35:05 +08:00
HogenWang 653dffc14f 增加登录验证码设置 2024-03-07 18:35:05 +08:00
HogenWang 20752c97a1 更新组件 2024-03-06 18:33:34 +08:00
HogenWang 01dbb4461d 更新组件 2024-03-06 18:33:34 +08:00
HogenWang 8c7e285180 更新超链接 2024-01-11 18:41:24 +08:00
HogenWang 564ae42a57 更新超链接 2024-01-11 18:41:24 +08:00
HogenWang ccdd1364f1 修复bug 2024-01-05 18:11:06 +08:00
HogenWang 980518df46 修复bug 2024-01-05 18:11:06 +08:00
HogenWang 8b62d8e61e 更新到.net 8 2023-12-12 11:30:53 +08:00
HogenWang d6ea0b35d8 更新到.net 8 2023-12-12 11:30:53 +08:00
HogenWang ef0d81d917 升级组件 2023-09-22 18:44:09 +08:00
HogenWang cb6bf496eb 升级组件 2023-09-22 18:44:09 +08:00
HogenWang 815b3af928 更新组件 2023-09-14 17:37:25 +08:00
HogenWang cd86161c18 更新组件 2023-09-14 17:37:25 +08:00
HogenWang 9014ee0190 更新组件 2023-08-11 18:30:47 +08:00
HogenWang d1af83f95d 更新组件 2023-08-11 18:30:47 +08:00
HogenWang f0f1e3d7b6 更改AESHelper的过期写法和更新jquery到最新版 2023-04-04 14:42:05 +08:00
HogenWang 2e7f71e860 更改AESHelper的过期写法和更新jquery到最新版 2023-04-04 14:42:05 +08:00
HogenWang 02db388433 更新依赖包。并更新editor到最新版 2023-03-29 15:26:35 +08:00
HogenWang 7609e2e525 更新依赖包。并更新editor到最新版 2023-03-29 15:26:35 +08:00
HogenWang dcca21b710 更新组件 2022-12-09 10:40:03 +08:00
HogenWang 29efc22705 更新组件 2022-12-09 10:40:03 +08:00
HogenWang 1be54104cf 升级到.net 7 2022-11-23 18:58:56 +08:00
HogenWang bcd4bca768 升级到.net 7 2022-11-23 18:58:56 +08:00
HogenWang 23a0c4b32e 尝试SkiaSharp替换System.Drawing 2022-10-14 18:02:49 +08:00
HogenWang 6e7f4c7cc3 文章增加设置IP访问限制 2022-10-09 18:33:02 +08:00
HogenWang 9141e861c4 重新更新冲突 2022-10-08 18:48:15 +08:00
HogenWang 81e36f140d Merge branch 'master' of https://github.com/hogenwang/comcms_core
# Conflicts:
#	COMCMS.API/COMCMS.API.csproj
#	COMCMS.Common/COMCMS.Common.csproj
#	COMCMS.Core/COMCMS.Core.csproj
#	COMCMS.Web/COMCMS.Web.csproj
#	COMCMS_NETCORE.sln
#	NewLife.UserGroup.WebUploader/NewLife.UserGroup.WebUploader.csproj
#	XCoder/Entity/data.project.xml
#	XCoder/Model.tt
#	XCoder/Model.xml
#	XCoder/comcmsdata.xml
#	XCoder/data.project.xml
2022-10-08 00:20:35 +08:00
HogenWang 8d9c13b50b 升级到.net 6 2022-10-08 00:10:49 +08:00
HogenWang 97bb7146aa 升级到.net 6.0 2022-01-11 19:00:26 +08:00
HogenWang e87e0d14e1 更新组件,增加密码强度配置 2021-11-30 17:53:35 +08:00
HogenWang 9ecb124f6e 更新部分插件 2021-10-31 23:37:28 +08:00
HogenWang 14ebc3acc7 更新组件 2021-08-26 00:32:56 +08:00
HogenWang 80f7dc994c 修复管理员登录日志为空导致错误 2021-07-20 00:20:01 +08:00
HogenWang fc1fec7fc5 更新组件 2021-07-18 01:01:37 +08:00
HogenWang fcb4b8b027 增加文章Tag标签 2021-02-02 18:49:50 +08:00
HogenWang 9623fb033b 增加图片验证码 2021-01-11 16:02:17 +08:00
HogenWang 269fd4a6fe 增加文章、商品列表修改排序功能 2021-01-11 00:21:24 +08:00
HogenWang ce7b525f1a 升级到.net5;增加文章栏目、商品分类快速修改排序;增加jwt授权登录 2020-12-02 18:11:54 +08:00
HogenWang 3b7b523bec 调整角色如果不选栏目,默认拥有全部栏目权限 2020-11-12 18:41:55 +08:00
HogenWang c1e551b7fb 管理组管理增加控制普通管理组的文章和商品权限,文章、商品操作增加权限判断 2020-11-11 18:15:04 +08:00
HogenWang a5d1eb7cbe 后台去掉多余的列表搜索 2020-11-09 10:37:27 +08:00
HogenWang c3a8b7d57a 更改文章分类选择显示隐藏分类 2020-11-05 18:45:42 +08:00
HogenWang dc4db4da28 更新组件 2020-10-23 15:56:24 +08:00
HogenWang c22c5dd51c 修复cookies删除不成功;修复后台批量操作因更新boottable后无法获取选中id 2020-10-23 14:46:40 +08:00
HogenWang 13c6ee54ab 更新组件,兼容IE11 2020-10-11 18:03:54 +08:00
HogenWang 905f1b37d1 增加一个字典方法 2020-08-10 19:01:40 +08:00
HogenWang 321e055726 完成数据字典后台管理 2020-08-06 20:33:47 +08:00
HogenWang 3d015baa56 数据字典完成一半管理功能 2020-08-06 01:16:39 +08:00
HogenWang 0c1fb6b097 初步增加数据字典 2020-08-05 19:20:47 +08:00
HogenWang 728b4a3bd0 增加部门管理 2020-07-23 20:32:09 +08:00
HogenWang 14a43efb67 增加docker初步支持 2020-07-20 18:52:50 +08:00
HogenWang 1f8e2b1e6e 调整所有图片上传,增加缩略图显示 2020-07-20 00:31:50 +08:00
HogenWang 3af9250443 初步增加后台附件管理功能 2020-07-17 18:08:54 +08:00
HogenWang 3f993c838f 修复后台授权问题,调整后台列表批量操作例子 2020-07-15 19:21:57 +08:00
HogenWang edefa34898 Merge branch 'master' of https://github.com/hogenwang/comcms_core 2020-07-10 17:14:02 +08:00
HogenWang 4fda24f62c 更新组件,webuploader 组件增加支持vue数组形式 2020-07-10 17:11:35 +08:00
HogenWang 92fb899d89 更新伪静态文章栏目规则,生成伪静态页面分页代码 2020-05-26 15:15:32 +08:00
HogenWang 7a89991358 修复提交留言错误 2020-05-25 01:58:14 +08:00
HogenWang 4f48e1dbaa 修复mssql安装时候报错 2020-05-20 19:04:06 +08:00
HogenWang a69621e016 修复显示地址问题。增加sitemap 2020-05-13 15:35:25 +08:00
HogenWang 2a49736cb8 增加sitemap.xml 2020-05-11 19:14:11 +08:00
HogenWang f1080e3618 完善伪静态链接 2020-05-09 19:37:40 +08:00
HogenWang 03fc965929 完成首次运行初始化安装程序 2020-04-27 18:48:31 +08:00
HogenWang f991099b54 实验性增加初始化安装(未完成) 2020-04-27 00:40:54 +08:00
HogenWang 7962ab17a4 Merge branch 'master' of https://github.com/hogenwang/comcms_core 2020-04-21 16:09:29 +08:00
HogenWang 6cd8a0abea 更新编辑器,修复微信公众号管理上传图片问题 2020-04-21 16:06:49 +08:00
HogenWang 26672514f6 Merge branch 'master' of https://github.com/hogenwang/comcms_core 2020-04-11 22:49:17 +08:00
HogenWang a201617a92 更新组件到最新版 2020-04-11 18:17:57 +08:00
HogenWang 0c8f6dc6ed 增加判断服务器类型;更新初始化数据sql 2020-03-20 18:38:39 +08:00
HogenWang c1a935b88e Merge branch 'master' of https://github.com/hogenwang/comcms_core 2020-03-09 22:05:30 +08:00
HogenWang 7d8d2c5461 更新说明,调整demo地址;修复后台添加商品栏目错位 2020-03-06 16:19:24 +08:00
HogenWang 00fd583495 完善微信公众号对接基础功能 2020-02-20 16:31:10 +08:00
HogenWang e693ebe3d1 增加微信公众号基本对接后台管理 2020-02-19 18:16:16 +08:00
HogenWang 14e391e5bb 增加后台微信公众号管理控制器 2020-02-14 19:31:16 +08:00
HogenWang 2292184e9e 更新组件到最新版 2019-12-25 19:45:09 +08:00
HogenWang 206993241a 升级到.net core 3.1;整体组件升级到最新版本 2019-12-06 16:26:46 +08:00
HogenWang d40f0b8eaf 将项目升级到.net core 3.0 2019-10-30 17:14:02 +08:00
HogenWang f6779f2339 更新CKEditor编辑器到最新版本 2019-09-27 17:26:38 +08:00
Stone 25f8e9d643 Merge pull request #1 from lkicesky/dev
修复合作伙伴处轮播脚本问题
2019-09-15 22:48:22 +08:00
415 changed files with 14657 additions and 59761 deletions
+15
View File
@@ -0,0 +1,15 @@
# 数据库配置
MYSQL_ROOT_PASSWORD=root
MYSQL_DATABASE=comcms
MYSQL_USER=comcms
MYSQL_PASSWORD=comcms123
# Redis 配置
REDIS_PASSWORD=
# ASP.NET Core 环境
ASPNETCORE_ENVIRONMENT=Production
# 数据库连接字符串(会被覆盖,但保留作为参考)
# ConnectionStrings__dbconn__ConnectionString=Server=mysql;Port=3306;Database=comcms;Uid=comcms;Pwd=comcms123;charset=utf8mb4;
# ConnectionStrings__dbconn__providerName=MySql.Data.MySqlClient
+21
View File
@@ -0,0 +1,21 @@
# MySQL 配置
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_DATABASE=comcms
MYSQL_USER=root
MYSQL_PASSWORD=your_password_here
# Redis 配置
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
REDIS_PASSWORD=your_redis_password_here
REDIS_DB=2
# JWT 配置
JWT_SECRET=your_jwt_secret_here
# 系统配置
SIGN_SALT=your_salt_here
# ASP.NET Core 环境
ASPNETCORE_ENVIRONMENT=Development
+13
View File
@@ -309,3 +309,16 @@ COMCMS.Web/wwwroot/userfiles/
/COMCMS.Web/UploadTemp
/WebTest/wwwroot
COMCMS.Web/wwwroot/install.lock
# others
.cursorrules
<<<<<<< HEAD
=======
# 环境变量文件(包含敏感信息)
.env
# 环境变量文件(包含敏感信息)
.env
>>>>>>> df478d351626c40c987712d66d991f327a698ff5
+169
View File
@@ -0,0 +1,169 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## 项目概述
COMCMS NetCore 是一个基于 .NET 10 的内容管理系统(CMS),包含后台管理和前台展示功能。支持二次开发扩展为商城系统、小程序、APP服务端等。
## 常用命令
### 构建和运行
```bash
# 构建整个解决方案
dotnet build COMCMS_NETCORE.sln
# 运行 Web 项目(开发模式)
cd COMCMS.Web
dotnet run
# 发布 Web 项目
dotnet publish -c Release -o ./publish
# 使用 Docker 运行
cd COMCMS.Web
docker build -t comcms .
docker run -p 80:80 comcms
```
### 数据库初始化
项目支持 MySQL 5.7/8.0 和 SQL Server 2008+ 数据库。初始化脚本位于 `data` 目录:
- `comcms_for_windows.sql` - Windows 环境的 MySQL 初始化脚本
- `comcms_for_linux.sql` - Linux 环境的 MySQL 初始化脚本
- `comcms_sqlserver.sql` - SQL Server 初始化脚本
### 测试
```bash
# 运行所有测试(如果存在)
dotnet test
# 运行特定项目测试
dotnet test [项目名称]
```
## 项目架构
### 核心组件
1. **COMCMS.Web** - ASP.NET Core MVC 网站,包含前台和后台管理界面
2. **COMCMS.Core** - 核心业务逻辑和数据访问层,使用 XCode ORM
3. **COMCMS.Common** - 通用工具类库
4. **COMCMS.API** - API 接口层(预留)
5. **Lib.Core** - 中间件库
6. **NewLife.UserGroup.WebUploader** - 大文件上传组件
7. **XCoder** - 代码生成器
### 数据层架构
- 使用 **XCode ORM** 进行数据访问,支持 MySQL 和 SQL Server
- 实体类采用部分类设计,包含实体定义(.cs)和业务逻辑(.Biz.cs)
- 每个实体类使用 `[BindTable]` 特性映射到数据库表
- 支持缓存机制,使用 Redis 作为分布式缓存
### Web 层结构
- **前台控制器**:位于 `Controllers/` 目录
- **后台管理**:位于 `Areas/AdminCP/`,使用 MVC Areas 组织
- **API 接口**:位于 `Controllers/api/`,提供 RESTful API
- **视图**:Razor 视图,后台使用 H+ 模板
- **静态资源**:位于 `wwwroot/`,包含编辑器(CKEditor)、上传组件(WebUploader)等
### 功能模块
- **文章系统**:文章管理、栏目管理、标签系统
- **商城模块**:商品管理、订单管理、购物车、优惠券
- **用户系统**:用户管理、角色权限、地址管理、余额管理
- **系统管理**:系统配置、数据字典、菜单权限、日志管理
- **微信集成**:微信公众号、微信支付
## 技术栈
- **.NET 10** - 主框架
- **MySQL/SQL Server** - 数据库
- **XCode ORM** - 数据访问层
- **Redis** - 分布式缓存
- **JWT** - 身份认证
- **CKEditor** - 富文本编辑器
- **WebUploader** - 文件上传
- **Senparc Weixin SDK** - 微信开发
## 配置说明
### 数据库连接
在 `appsettings.json` 中配置数据库连接字符串:
```json
"connectionStrings": {
"dbconn": {
"connectionString": "Server=.;Port=3306;Database=comcms;Uid=root;Pwd=root;charset=utf8mb4",
"providerName": "MySql.Data.MySqlClient"
}
}
```
### Redis 缓存配置
```json
"RedisCache": {
"ConnectionString": "server=127.0.0.1;password=;db=2",
"InstanceName": "COMCMS:",
"DefaultDatabase": 2
}
```
### 系统配置
```json
"SystemSetting": {
"FileAllowedExtensions": "zip,rar,7z,doc,docx,xls,xlsx,ppt,pptx,csv,pdf,txt,gz,gzip,gif,png,jpg,jpeg,bmp,avi,fla,flv,swf,mp4,mp3,mov,mid,mpg,mpeg,rm,rmvb,wma,wav,wmv",
"ImageAllowedExtensions": "gif,png,jpg,jpeg,bmp",
"JwtSecret": "your-jwt-secret",
"COMCMSPrefixKey": "abc_"
}
```
## 开发指南
### 添加新功能模块
1. 在 `COMCMS.Core` 中创建实体类和业务逻辑
2. 使用 XCoder 代码生成器生成基础代码
3. 在 `COMCMS.Web` 中添加控制器和视图
4. 更新菜单权限配置
### 权限控制
- 后台使用 `AdminBaseController` 进行登录验证
- 使用 `[MyAuthorize]` 特性进行权限控制
- 菜单和事件权限在 `后台菜单` 和 `目标事件` 表中配置
### 缓存使用
- 通过 `ICacheService` 接口使用缓存
- 支持分布式缓存(Redis)和内存缓存
- 在 `CacheSettings` 中配置不同类型数据的过期时间
### 文件上传
- 使用 WebUploader 组件处理文件上传
- 在 `UploadController` 中处理上传逻辑
- 支持图片、文件、媒体等多种类型
## 部署说明
### Docker 部署
项目包含 Dockerfile,支持容器化部署:
```dockerfile
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
WORKDIR /app
EXPOSE 80
COPY . .
ENTRYPOINT ["dotnet", "COMCMS.Web.dll"]
```
注意:Dockerfile 中的 .NET 版本需要更新到与项目一致的版本。
### 环境要求
- .NET 10 Runtime 或 SDK
- MySQL 5.7+ 或 SQL Server 2008+
- Redis(可选,用于分布式缓存)
### 默认账号
- 后台管理员账号:admin / admin
- 登录地址:/AdminCP
## 重要提示
- 项目使用中文命名实体类和字段,这是为了便于中文开发者理解
- 修改数据库结构后需要更新相应的实体类
- 部署前确保正确配置数据库连接字符串和系统配置
- 建议使用源码管理保存自定义修改,避免升级时覆盖
+8 -4
View File
@@ -1,13 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<<<<<<< HEAD
<TargetFramework>net10.0</TargetFramework>
=======
<TargetFramework>net9.0</TargetFramework>
>>>>>>> df478d351626c40c987712d66d991f327a698ff5
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NewLife.Core" Version="10.0.2022.1001" />
<PackageReference Include="Senparc.Weixin" Version="6.15.5" />
<PackageReference Include="Senparc.Weixin.MP" Version="16.18.7" />
<PackageReference Include="NewLife.Core" Version="11.9.2025.1112" />
<PackageReference Include="Senparc.Weixin" Version="6.23.0" />
<PackageReference Include="Senparc.Weixin.MP" Version="16.24.0" />
</ItemGroup>
<ItemGroup>
+25 -15
View File
@@ -1,5 +1,7 @@
using System;
using Microsoft.AspNetCore.DataProtection.KeyManagement;
using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Text;
@@ -23,15 +25,18 @@ namespace COMCMS.Common
encryptKey = GetSubString(encryptKey, 0, 32, "");
encryptKey = encryptKey.PadRight(32, ' ');
RijndaelManaged rijndaelProvider = new RijndaelManaged();
rijndaelProvider.Key = Encoding.UTF8.GetBytes(encryptKey.Substring(0, 32));
rijndaelProvider.IV = Keys;
ICryptoTransform rijndaelEncrypt = rijndaelProvider.CreateEncryptor();
byte[] inputData = Encoding.UTF8.GetBytes(encryptString);
byte[] encryptedData = rijndaelEncrypt.TransformFinalBlock(inputData, 0, inputData.Length);
return Convert.ToBase64String(encryptedData);
using Aes aes = Aes.Create();
aes.Key = Encoding.UTF8.GetBytes(encryptKey.Substring(0, 32));
aes.IV = Keys;
using MemoryStream ms = new MemoryStream();
using CryptoStream cs = new CryptoStream(ms, aes.CreateEncryptor(), CryptoStreamMode.Write);
cs.Write(inputData, 0, inputData.Length);
cs.FlushFinalBlock();
return Convert.ToBase64String(ms.ToArray());
}
/// <summary>
/// 解密
@@ -46,15 +51,20 @@ namespace COMCMS.Common
decryptKey = GetSubString(decryptKey, 0, 32, "");
decryptKey = decryptKey.PadRight(32, ' ');
RijndaelManaged rijndaelProvider = new RijndaelManaged();
rijndaelProvider.Key = Encoding.UTF8.GetBytes(decryptKey);
rijndaelProvider.IV = Keys;
ICryptoTransform rijndaelDecrypt = rijndaelProvider.CreateDecryptor();
byte[] inputData = Convert.FromBase64String(decryptString);
byte[] decryptedData = rijndaelDecrypt.TransformFinalBlock(inputData, 0, inputData.Length);
return Encoding.UTF8.GetString(decryptedData);
using Aes aes = Aes.Create();
aes.Key = Encoding.UTF8.GetBytes(decryptKey);
aes.IV = Keys;
using MemoryStream ms = new MemoryStream();
using CryptoStream cs = new CryptoStream(ms, aes.CreateDecryptor(), CryptoStreamMode.Write);
cs.Write(inputData, 0, inputData.Length);
cs.FlushFinalBlock();
return Encoding.UTF8.GetString(ms.ToArray());
}
catch
{
+11 -7
View File
@@ -1,18 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<<<<<<< HEAD
<TargetFramework>net10.0</TargetFramework>
=======
<TargetFramework>net9.0</TargetFramework>
>>>>>>> df478d351626c40c987712d66d991f327a698ff5
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="NewLife.Core" Version="10.0.2022.1001" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NewLife.Core" Version="11.9.2025.1112" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="PinYinConverterCore" Version="1.0.2" />
<PackageReference Include="SkiaSharp" Version="2.88.3" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.88.3" />
<PackageReference Include="SkiaSharp.QrCode" Version="0.6.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.1" />
<PackageReference Include="SkiaSharp" Version="3.119.1" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="3.119.1" />
<PackageReference Include="SkiaSharp.QrCode" Version="0.9.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="10.0.0" />
</ItemGroup>
</Project>
+71 -82
View File
@@ -9,6 +9,10 @@ using System.Text.RegularExpressions;
using Microsoft.AspNetCore.Hosting;
using System.IO;
using NewLife.Log;
using SkiaSharp;
using static System.Net.Mime.MediaTypeNames;
using System.Net.Http;
using System.Security.Policy;
namespace COMCMS.Common
{
@@ -61,7 +65,8 @@ namespace COMCMS.Common
/// <param name="mode">生成缩略图的方式</param>
public static void MakeThumbnailImage(string fileName, string newFileName, int width, int height, CutMode mode)
{
Image originalImage = Image.FromFile(fileName);
//Image originalImage = Image.FromFile(fileName);
var originalImage = SKBitmap.Decode(fileName);
int towidth = width;
int toheight = height;
@@ -114,91 +119,70 @@ namespace COMCMS.Common
break;
}
//新建一个bmp图片
Bitmap b = new Bitmap(towidth, toheight);
try
{
//新建一个画板
Graphics g = Graphics.FromImage(b);
//设置高质量插值法
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
//设置高质量,低速度呈现平滑程度
g.SmoothingMode = SmoothingMode.AntiAlias;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
//清空画布并以透明背景色填充
g.Clear(Color.White);
//g.Clear(Color.Transparent);
//在指定位置并且按指定大小绘制原图片的指定部分
g.DrawImage(originalImage, new Rectangle(0, 0, towidth, toheight), new Rectangle(x, y, ow, oh), GraphicsUnit.Pixel);
SaveImage(b, newFileName, GetCodecInfo("image/" + GetFormat(newFileName).ToString().ToLower()));
}
catch (System.Exception e)
var newImg = originalImage.Resize(new SKSizeI(towidth, toheight), SKFilterQuality.Medium);
using var fs = new FileStream(newFileName, FileMode.Create);
//判断类型
SKEncodedImageFormat imgType = new SKEncodedImageFormat();
string sFullExtension = Utils.GetFileExtName(fileName).ToLower();//扩展名
switch (sFullExtension)
{
throw e;
}
finally
{
originalImage.Dispose();
b.Dispose();
case ".jpg":
case ".jpeg":
imgType = SKEncodedImageFormat.Jpeg;
break;
case ".png":
imgType = SKEncodedImageFormat.Png;
break;
case ".gif":
imgType = SKEncodedImageFormat.Gif;
break;
case ".webp":
imgType = SKEncodedImageFormat.Webp;
break;
case ".bmp":
imgType = SKEncodedImageFormat.Bmp;
break;
default:
imgType = SKEncodedImageFormat.Png;
break;
}
newImg.Encode(fs, imgType, 100);
fs.Flush();
//新建一个bmp图片
//Bitmap b = new Bitmap(towidth, toheight);
//try
//{
// //新建一个画板
// Graphics g = Graphics.FromImage(b);
// //设置高质量插值法
// g.InterpolationMode = InterpolationMode.HighQualityBicubic;
// //设置高质量,低速度呈现平滑程度
// g.SmoothingMode = SmoothingMode.AntiAlias;
// g.PixelOffsetMode = PixelOffsetMode.HighQuality;
// //清空画布并以透明背景色填充
// g.Clear(Color.White);
// //g.Clear(Color.Transparent);
// //在指定位置并且按指定大小绘制原图片的指定部分
// g.DrawImage(originalImage, new Rectangle(0, 0, towidth, toheight), new Rectangle(x, y, ow, oh), GraphicsUnit.Pixel);
// SaveImage(b, newFileName, GetCodecInfo("image/" + GetFormat(newFileName).ToString().ToLower()));
//}
//catch (System.Exception e)
//{
// throw e;
//}
//finally
//{
// originalImage.Dispose();
// b.Dispose();
//}
}
#endregion
#region 帮助方法
/// <summary>
/// 保存图片
/// </summary>
/// <param name="image">Image 对象</param>
/// <param name="savePath">保存路径</param>
/// <param name="ici">指定格式的编解码参数</param>
private static void SaveImage(Image image, string savePath, ImageCodecInfo ici)
{
//设置 原图片 对象的 EncoderParameters 对象
EncoderParameters parameters = new EncoderParameters(1);
parameters.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, ((long)100));
image.Save(savePath, ici, parameters);
parameters.Dispose();
}
/// <summary>
/// 获取图像编码解码器的所有相关信息
/// </summary>
/// <param name="mimeType">包含编码解码器的多用途网际邮件扩充协议 (MIME) 类型的字符串</param>
/// <returns>返回图像编码解码器的所有相关信息</returns>
private static ImageCodecInfo GetCodecInfo(string mimeType)
{
ImageCodecInfo[] CodecInfo = ImageCodecInfo.GetImageEncoders();
foreach (ImageCodecInfo ici in CodecInfo)
{
if (ici.MimeType == mimeType)
return ici;
}
return null;
}
/// <summary>
/// 得到图片格式
/// </summary>
/// <param name="name">文件名称</param>
/// <returns></returns>
public static ImageFormat GetFormat(string name)
{
string ext = name.Substring(name.LastIndexOf(".") + 1);
switch (ext.ToLower())
{
case "jpg":
case "jpeg":
return ImageFormat.Jpeg;
case "bmp":
return ImageFormat.Bmp;
case "png":
return ImageFormat.Png;
case "gif":
return ImageFormat.Gif;
default:
return ImageFormat.Jpeg;
}
}
#endregion
#region 内容远程保存图片
@@ -212,8 +196,8 @@ namespace COMCMS.Common
string recontent = content;
if (string.IsNullOrEmpty(content))
return "";
WebClient client = new WebClient();
//WebClient client = new WebClient();
var _httpClient = new HttpClient();
Regex reg = new Regex("IMG[^>]*?src\\s*=\\s*(?:\"(?<1>[^\"]*)\"|'(?<1>[^\']*)')", RegexOptions.IgnoreCase);
MatchCollection m = reg.Matches(content);
foreach (Match math in m)
@@ -231,7 +215,7 @@ namespace COMCMS.Common
else if (imgsrc.EndsWith("jpeg")) ext = "jpeg";
else if (imgsrc.EndsWith("bmp")) ext = "bmp";
string strNewImgName = Utils.GetOrderNum() + "." + ext;
string savepath = $"{_WebRootPath}\\userfiles\\images\\auto\\{DateTime.Now.Year.ToString()}\\{DateTime.Now.ToString("MM")}";//
string savepath = $"{_WebRootPath}{DirectorySeparatorChar}userfiles{DirectorySeparatorChar}images{DirectorySeparatorChar}auto{DirectorySeparatorChar}{DateTime.Now.Year.ToString()}\\{DateTime.Now.ToString("MM")}";//
string imgNewSrc = $"/userfiles/images/auto/{DateTime.Now.Year.ToString()}/{DateTime.Now.ToString("MM")}/{strNewImgName}";//保存后路径
//判断路径
if (!Directory.Exists(savepath))
@@ -239,8 +223,13 @@ namespace COMCMS.Common
string fullpath = Path.Combine(savepath, strNewImgName);//图片
try
{
System.IO.FileStream fs;
byte[] urlContents = _httpClient.GetByteArrayAsync(imgUrl).Result;
fs = new System.IO.FileStream(fullpath, FileMode.CreateNew);
fs.Write(urlContents, 0, urlContents.Length);
//保存图片
client.DownloadFile(imgUrl, fullpath);
//client.DownloadFile(imgUrl, fullpath);
//_httpClient
recontent = recontent.Replace(imgUrl, imgNewSrc);
}
catch (Exception ex)
+31 -115
View File
@@ -14,6 +14,7 @@ using System.Linq;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using NewLife.Caching;
using System.Net.Http;
namespace COMCMS.Common
{
@@ -208,6 +209,10 @@ namespace COMCMS.Common
{
http = "https://";
}
if (MyHttpContext.Current.Request.Headers["X-Scheme"].ToString() == "https")//增加判断反向代理
{
http = "https://";
}
string port = MyHttpContext.Current.Request.Host.Port.ToString();
if (string.IsNullOrEmpty(port) || port == "80" || port == "443")
return http + MyHttpContext.Current.Request.Host.Host;
@@ -382,7 +387,15 @@ namespace COMCMS.Common
{
return Regex.IsMatch(StrSource, @"^((((1[6-9]|[2-9]\d)\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\d|3[01]))|(((1[6-9]|[2-9]\d)\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\d|30))|(((1[6-9]|[2-9]\d)\d{2})-0?2-(0?[1-9]|1\d|2[0-9]))|(((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29-))$");
}
/// <summary>
/// 是否为日期+时间型字符串
/// </summary>
/// <param name="source"></param>
/// <returns></returns>
public static bool IsDateTime(string StrSource)
{
return Regex.IsMatch(StrSource, @"^((([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29))\s([0-1][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$");
}
/// <summary>
/// 正则手机型号
/// </summary>
@@ -752,7 +765,18 @@ namespace COMCMS.Common
return false;
string extname = filename.Substring(filename.LastIndexOf(".") + 1).ToLower();
return (extname == "jpg" || extname == "jpeg" || extname == "png" || extname == "bmp" || extname == "gif");
// 从配置中获取图片扩展名列表
string imageExtensions = Configuration["SystemSetting:ImageExtensions"];
if (string.IsNullOrEmpty(imageExtensions))
{
// 如果配置中没有设置,则使用默认值
imageExtensions = "jpg,jpeg,png,bmp,gif";
}
// 将扩展名列表分割成数组并检查
string[] extensions = imageExtensions.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
return extensions.Contains(extname);
}
/// <summary>
@@ -1214,127 +1238,19 @@ namespace COMCMS.Common
/// <returns></returns>
public static string HttpGet(string url)
{
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Method = "GET";
//request.ContentType = "application/x-www-form-urlencoded";
request.Accept = "*/*";
request.Proxy = null;
request.Timeout = 15000;
request.AllowAutoRedirect = false;
WebResponse response = null;
//使用webclient http get
string responseStr = null;
try
using (HttpClient client = new HttpClient())
{
response = request.GetResponse();
if (response != null)
var re = client.GetAsync(url).Result;
if (re.IsSuccessStatusCode)
{
StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
responseStr = reader.ReadToEnd();
reader.Close();
responseStr = re.Content.ReadAsStringAsync().Result;
}
}
catch (Exception ex)
{
NewLife.Log.XTrace.WriteException(ex);
throw;
}
finally
{
request = null;
response = null;
}
return responseStr;
}
/// <summary>
/// 后台发送POST请求
/// </summary>
/// <param name="url">服务器地址</param>
/// <param name="data">发送的数据</param>
/// <returns></returns>
public static Stream HttpPost(string url, string data)
{
try
{
//创建post请求
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "POST";
request.ContentType = "application/json;charset=UTF-8";
byte[] payload = Encoding.UTF8.GetBytes(data);
request.ContentLength = payload.Length;
//发送post的请求
Stream writer = request.GetRequestStream();
writer.Write(payload, 0, payload.Length);
writer.Close();
//接受返回来的数据
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream stream = response.GetResponseStream();
return stream;
//StreamReader reader = new StreamReader(stream, Encoding.UTF8);
//string value = reader.ReadToEnd();
//reader.Close();
//stream.Close();
//response.Close();
//return value;
}
catch (Exception ex)
{
NewLife.Log.XTrace.WriteException(ex);
return null;
}
}
/// <summary>
/// 后台发送POST请求
/// </summary>
/// <param name="url">服务器地址</param>
/// <param name="data">发送的数据</param>
/// <returns></returns>
public static string HttpPostAndReturnString(string url, string data)
{
try
{
//创建post请求
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "POST";
request.ContentType = "application/json;charset=UTF-8";
byte[] payload = Encoding.UTF8.GetBytes(data);
request.ContentLength = payload.Length;
//发送post的请求
Stream writer = request.GetRequestStream();
writer.Write(payload, 0, payload.Length);
writer.Close();
//接受返回来的数据
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream stream = response.GetResponseStream();
StreamReader reader = new StreamReader(stream, Encoding.UTF8);
string value = reader.ReadToEnd();
reader.Close();
stream.Close();
response.Close();
return value;
}
catch (Exception ex)
{
NewLife.Log.XTrace.WriteException(ex);
return "";
}
}
/// <summary>
/// 将对象转换为Int32类型
/// </summary>
+33 -13
View File
@@ -8,6 +8,8 @@ using System.IO;
using System.Text;
using NewLife.Log;
using SkiaSharp;
using NewLife.Security;
using static System.Net.Mime.MediaTypeNames;
namespace COMCMS.Common
{
@@ -290,25 +292,44 @@ namespace COMCMS.Common
canvas.DrawLine(random.Next(0, width), random.Next(0, height), random.Next(0, width), random.Next(0, height), drawStyle);
}
// 在图片上写验证码
SKPaint textPaint = new SKPaint
{
IsAntialias = true,
TextAlign = SKTextAlign.Left,
Shader = SKShader.CreateLinearGradient(new SKPoint(0, 0), new SKPoint(width, height), new SKColor[] { SKColors.Blue, SKColors.DarkRed }, SKShaderTileMode.Clamp),
TextSize = 22
};
canvas.DrawText(text, 4, 24, textPaint);
//将文字写到画布上
using (SKPaint drawStyle = new())
//using (SKPaint drawStyle = new())
//{
// drawStyle.Color = SKColors.Red;
// drawStyle.TextSize = height;
// drawStyle.StrokeWidth = 1;
// float emHeight = height - (float)height * (float)0.14;
// float emWidth = ((float)width / text.Length) - ((float)width * (float)0.13);
// canvas.DrawText(text, emWidth, emHeight, drawStyle);
//}
for (int i = 0; i < 5; i++)
{
drawStyle.Color = SKColors.Red;
drawStyle.TextSize = height;
drawStyle.StrokeWidth = 1;
canvas.DrawLine(new SKPoint(random.Next(width), random.Next(height)), new SKPoint(random.Next(width), random.Next(height)), new SKPaint() { Color = SKColor.FromHsv(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)) });
}
float emHeight = height - (float)height * (float)0.14;
float emWidth = ((float)width / text.Length) - ((float)width * (float)0.13);
canvas.DrawText(text, emWidth, emHeight, drawStyle);
// 在图片上随机画100个随机颜色点
for (int i = 0; i < 100; i++)
{
canvas.DrawPoint(new SKPoint(random.Next(width), random.Next(height)), SKColor.FromHsv(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)));
}
//画图片的前景噪音点
for (int i = 0; i < (width * height * 0.6); i++)
{
image.SetPixel(random.Next(0, width), random.Next(0, height), new SKColor(Convert.ToUInt32(random.Next(Int32.MaxValue))));
}
//for (int i = 0; i < (width * height * 0.6); i++)
//{
// image.SetPixel(random.Next(0, width), random.Next(0, height), new SKColor(Convert.ToUInt32(random.Next(Int32.MaxValue))));
//}
using var img = SKImage.FromBitmap(image);
using SKData p = img.Encode(SKEncodedImageFormat.Png, 100);
@@ -335,7 +356,6 @@ namespace COMCMS.Common
vc = Utils.MemoryCahce.Get<string>("code_" + code);// ic.Get<string>("code_" + code);
//XTrace.WriteLine($"从缓存中获取验证码:code_{code}:{vc}");
}
if (!string.IsNullOrEmpty(vc) && !string.IsNullOrEmpty(code))
{
if (vc.ToUpper() == code.ToUpper())
+69 -137
View File
@@ -1,8 +1,11 @@
using System;
using SkiaSharp;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Text;
using static System.Net.Mime.MediaTypeNames;
namespace COMCMS.Common
{
@@ -11,51 +14,30 @@ namespace COMCMS.Common
/// </summary>
public class WatermarkHelper
{
#region 加图片水印
/// <summary>
/// 加图片水印
/// </summary>
/// <p
/// <param name="filename">文件名</param>
/// <param name="watermarkFilename">水印文件名</param>
/// <param name="watermarkStatus">图片水印位置</param>
public static void AddImageSignPic(Image img, string filename, string watermarkFilename, int watermarkStatus, int quality, int watermarkTransparency)
public static void AddImageSignPic(string copyfullpath, string filename, string watermarkFilename, int watermarkStatus, int quality, int watermarkTransparency)
{
Graphics g = Graphics.FromImage(img);
var img = SKBitmap.Decode(copyfullpath);
using SKCanvas canvas = new(img);
//设置高质量插值法
//g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
//设置高质量,低速度呈现平滑程度
//g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
System.Drawing.Image watermark = new Bitmap(watermarkFilename);
var watermarkBitmap = SKBitmap.Decode(watermarkFilename);
SKImage watermark = SKImage.FromBitmap(watermarkBitmap);
if (watermark.Height >= img.Height || watermark.Width >= img.Width)
return;
ImageAttributes imageAttributes = new ImageAttributes();
ColorMap colorMap = new ColorMap();
colorMap.OldColor = Color.FromArgb(255, 0, 255, 0);
colorMap.NewColor = Color.FromArgb(0, 0, 0, 0);
ColorMap[] remapTable = { colorMap };
imageAttributes.SetRemapTable(remapTable, ColorAdjustType.Bitmap);
float transparency = 0.5F;
if (watermarkTransparency >= 1 && watermarkTransparency <= 10)
transparency = (watermarkTransparency / 10.0F);
float[][] colorMatrixElements = {
new float[] {1.0f, 0.0f, 0.0f, 0.0f, 0.0f},
new float[] {0.0f, 1.0f, 0.0f, 0.0f, 0.0f},
new float[] {0.0f, 0.0f, 1.0f, 0.0f, 0.0f},
new float[] {0.0f, 0.0f, 0.0f, transparency, 0.0f},
new float[] {0.0f, 0.0f, 0.0f, 0.0f, 1.0f}
};
ColorMatrix colorMatrix = new ColorMatrix(colorMatrixElements);
imageAttributes.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
int xpos = 0;
int ypos = 0;
@@ -98,124 +80,74 @@ namespace COMCMS.Common
ypos = (int)((img.Height * (float).99) - watermark.Height);
break;
}
g.DrawImage(watermark, new Rectangle(xpos, ypos, watermark.Width, watermark.Height), 0, 0, watermark.Width, watermark.Height, GraphicsUnit.Pixel, imageAttributes);
ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders();
ImageCodecInfo ici = null;
foreach (ImageCodecInfo codec in codecs)
SKPoint point = new SKPoint()
{
if (codec.MimeType.IndexOf("jpeg") > -1)
ici = codec;
X = xpos,
Y = ypos
};
canvas.DrawImage(watermark, point);
//var newImg = SKImage.fo originalImage.Resize(new SKSizeI(towidth, toheight), SKFilterQuality.Medium);
//canvas.
using var fs = new FileStream(filename, FileMode.Create);
SKEncodedImageFormat imgType = new SKEncodedImageFormat();
string sFullExtension = Utils.GetFileExtName(filename).ToLower();//扩展名
switch (sFullExtension)
{
case ".jpg":
case ".jpeg":
imgType = SKEncodedImageFormat.Jpeg;
break;
case ".png":
imgType = SKEncodedImageFormat.Png;
break;
case ".gif":
imgType = SKEncodedImageFormat.Gif;
break;
case ".webp":
imgType = SKEncodedImageFormat.Webp;
break;
case ".bmp":
imgType = SKEncodedImageFormat.Bmp;
break;
default:
imgType = SKEncodedImageFormat.Png;
break;
}
EncoderParameters encoderParams = new EncoderParameters();
long[] qualityParam = new long[1];
if (quality < 0 || quality > 100)
quality = 80;
img.Encode(fs, imgType, 100);
fs.Flush();
qualityParam[0] = quality;
EncoderParameter encoderParam = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, qualityParam);
encoderParams.Param[0] = encoderParam;
////g.DrawImage(watermark, new Rectangle(xpos, ypos, watermark.Width, watermark.Height), 0, 0, watermark.Width, watermark.Height, GraphicsUnit.Pixel, imageAttributes);
if (ici != null)
img.Save(filename, ici, encoderParams);
else
img.Save(filename);
//ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders();
//ImageCodecInfo ici = null;
//foreach (ImageCodecInfo codec in codecs)
//{
// if (codec.MimeType.IndexOf("jpeg") > -1)
// ici = codec;
//}
//EncoderParameters encoderParams = new EncoderParameters();
//long[] qualityParam = new long[1];
//if (quality < 0 || quality > 100)
// quality = 80;
//qualityParam[0] = quality;
//EncoderParameter encoderParam = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, qualityParam);
//encoderParams.Param[0] = encoderParam;
//if (ici != null)
// img.Save(filename, ici, encoderParams);
//else
// img.Save(filename);
g.Dispose();
img.Dispose();
watermark.Dispose();
imageAttributes.Dispose();
}
#endregion
#region 增加文字水印
/// <summary>
/// 增加图片文字水印
/// </summary>
/// <param name="filename">文件名</param>
/// <param name="watermarkText">水印文字</param>
/// <param name="watermarkStatus">图片水印位置</param>
public static void AddImageSignText(Image img, string filename, string watermarkText, int watermarkStatus, int quality, string fontname, int fontsize)
{
Graphics g = Graphics.FromImage(img);
Font drawFont = new Font(fontname, fontsize, FontStyle.Regular, GraphicsUnit.Pixel);
SizeF crSize;
crSize = g.MeasureString(watermarkText, drawFont);
float xpos = 0;
float ypos = 0;
switch (watermarkStatus)
{
case 1:
xpos = (float)img.Width * (float).01;
ypos = (float)img.Height * (float).01;
break;
case 2:
xpos = ((float)img.Width * (float).50) - (crSize.Width / 2);
ypos = (float)img.Height * (float).01;
break;
case 3:
xpos = ((float)img.Width * (float).99) - crSize.Width;
ypos = (float)img.Height * (float).01;
break;
case 4:
xpos = (float)img.Width * (float).01;
ypos = ((float)img.Height * (float).50) - (crSize.Height / 2);
break;
case 5:
xpos = ((float)img.Width * (float).50) - (crSize.Width / 2);
ypos = ((float)img.Height * (float).50) - (crSize.Height / 2);
break;
case 6:
xpos = ((float)img.Width * (float).99) - crSize.Width;
ypos = ((float)img.Height * (float).50) - (crSize.Height / 2);
break;
case 7:
xpos = (float)img.Width * (float).01;
ypos = ((float)img.Height * (float).99) - crSize.Height;
break;
case 8:
xpos = ((float)img.Width * (float).50) - (crSize.Width / 2);
ypos = ((float)img.Height * (float).99) - crSize.Height;
break;
case 9:
xpos = ((float)img.Width * (float).99) - crSize.Width;
ypos = ((float)img.Height * (float).99) - crSize.Height;
break;
}
g.DrawString(watermarkText, drawFont, new SolidBrush(Color.White), xpos + 1, ypos + 1);
g.DrawString(watermarkText, drawFont, new SolidBrush(Color.Black), xpos, ypos);
ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders();
ImageCodecInfo ici = null;
foreach (ImageCodecInfo codec in codecs)
{
if (codec.MimeType.IndexOf("jpeg") > -1)
ici = codec;
}
EncoderParameters encoderParams = new EncoderParameters();
long[] qualityParam = new long[1];
if (quality < 0 || quality > 100)
quality = 80;
qualityParam[0] = quality;
EncoderParameter encoderParam = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, qualityParam);
encoderParams.Param[0] = encoderParam;
if (ici != null)
img.Save(filename, ici, encoderParams);
else
img.Save(filename);
g.Dispose();
img.Dispose();
}
#endregion
}
}
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -7,6 +7,7 @@ using System.Xml.Serialization;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+7 -3
View File
@@ -1,12 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<<<<<<< HEAD
<TargetFramework>net10.0</TargetFramework>
=======
<TargetFramework>net9.0</TargetFramework>
>>>>>>> df478d351626c40c987712d66d991f327a698ff5
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NewLife.XCode" Version="11.3.2022.1001" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NewLife.XCode" Version="11.22.2025.1112" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
</ItemGroup>
<ItemGroup>
+1
View File
@@ -7,6 +7,7 @@ using System.Xml.Serialization;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -7,6 +7,7 @@ using System.Xml.Serialization;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+39 -1
View File
@@ -75,7 +75,22 @@ namespace COMCMS.Core
/// <returns></returns>
public static string EchoURL(Product model)
{
return $"/product/detail/{model.Id}";
if (model == null)
return "javascript:;";
Category categoty = Category.FindById(model.KId);
if (categoty != null && !string.IsNullOrEmpty(categoty.FilePath))
{
string url = $"{categoty.FilePath}/{model.Id}.html";
if (!string.IsNullOrEmpty(model.FileName))
{
url = $"{categoty.FilePath}/{model.FileName}";
}
return url;
}
else
return $"/product/detail/{model.Id}";
}
/// <summary>
@@ -149,5 +164,28 @@ namespace COMCMS.Core
}
#endregion
#region 生成商品地址
/// <summary>
/// 生成商品分类地址
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public static string EchoCategoryURL(int id)
{
Category model = Category.FindById(id);
return EchoURL(model);
}
/// <summary>
/// 生成商品详情地址
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public static string EchoProductURL(int id)
{
Product model = Product.FindById(id);
return EchoURL(model);
}
#endregion
}
}
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
-112
View File
@@ -1,112 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Xml.Serialization;
using NewLife;
using NewLife.Data;
using NewLife.Log;
using NewLife.Model;
using NewLife.Reflection;
using NewLife.Threading;
using NewLife.Web;
using XCode;
using XCode.Cache;
using XCode.Configuration;
using XCode.DataAccessLayer;
using XCode.Membership;
namespace COMCMS.Core
{
/// <summary>小程序Session</summary>
public partial class WXAppSession : Entity<WXAppSession>
{
#region 对象操作
static WXAppSession()
{
// 累加字段
//Meta.Factory.AdditionalFields.Add(__.Logins);
// 过滤器 UserModule、TimeModule、IPModule
}
/// <summary>验证数据,通过抛出异常的方式提示验证失败。</summary>
/// <param name="isNew">是否插入</param>
public override void Valid(Boolean isNew)
{
// 如果没有脏数据,则不需要进行任何处理
if (!HasDirty) return;
// 在新插入数据或者修改了指定字段时进行修正
}
///// <summary>首次连接数据库时初始化数据,仅用于实体类重载,用户不应该调用该方法</summary>
//[EditorBrowsable(EditorBrowsableState.Never)]
//protected override void InitData()
//{
// // InitData一般用于当数据表没有数据时添加一些默认数据,该实体类的任何第一次数据库操作都会触发该方法,默认异步调用
// if (Meta.Count > 0) return;
// if (XTrace.Debug) XTrace.WriteLine("开始初始化WXAppSession[小程序Session]数据……");
// var entity = new WXAppSession();
// entity.Id = 0;
// entity.UId = 0;
// entity.IP = "abc";
// entity.Key = "abc";
// entity.SessionKey = "abc";
// entity.OpenId = "abc";
// entity.AddTime = DateTime.Now;
// entity.Insert();
// if (XTrace.Debug) XTrace.WriteLine("完成初始化WXAppSession[小程序Session]数据!");
//}
///// <summary>已重载。基类先调用Valid(true)验证数据,然后在事务保护内调用OnInsert</summary>
///// <returns></returns>
//public override Int32 Insert()
//{
// return base.Insert();
//}
///// <summary>已重载。在事务保护范围内处理业务,位于Valid之后</summary>
///// <returns></returns>
//protected override Int32 OnDelete()
//{
// return base.OnDelete();
//}
#endregion
#region 扩展属性
#endregion
#region 扩展查询
/// <summary>根据编号查找</summary>
/// <param name="id">编号</param>
/// <returns>实体对象</returns>
public static WXAppSession FindById(Int32 id)
{
if (id <= 0) return null;
// 实体缓存
if (Meta.Count < 1000) return Meta.Cache.Find(e => e.Id == id);
// 单对象缓存
//return Meta.SingleCache[id];
return Find(_.Id == id);
}
#endregion
#region 高级查询
#endregion
#region 业务操作
#endregion
}
}
-200
View File
@@ -1,200 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
namespace COMCMS.Core
{
/// <summary>小程序Session</summary>
[Serializable]
[DataObject]
[Description("小程序Session")]
[BindTable("WXAppSession", Description = "小程序Session", ConnName = "dbconn", DbType = DatabaseType.SqlServer)]
public partial class WXAppSession : IWXAppSession
{
#region 属性
private Int32 _Id;
/// <summary>编号</summary>
[DisplayName("编号")]
[Description("编号")]
[DataObjectField(true, true, false, 0)]
[BindColumn("Id", "编号", "int")]
public Int32 Id { get { return _Id; } set { if (OnPropertyChanging(__.Id, value)) { _Id = value; OnPropertyChanged(__.Id); } } }
private Int32 _UId;
/// <summary>用户ID</summary>
[DisplayName("用户ID")]
[Description("用户ID")]
[DataObjectField(false, false, false, 0)]
[BindColumn("UId", "用户ID", "int")]
public Int32 UId { get { return _UId; } set { if (OnPropertyChanging(__.UId, value)) { _UId = value; OnPropertyChanged(__.UId); } } }
private String _IP;
/// <summary>登录IP</summary>
[DisplayName("登录IP")]
[Description("登录IP")]
[DataObjectField(false, false, true, 20)]
[BindColumn("IP", "登录IP", "nvarchar(20)")]
public String IP { get { return _IP; } set { if (OnPropertyChanging(__.IP, value)) { _IP = value; OnPropertyChanged(__.IP); } } }
private String _Key;
/// <summary>系统生成Key</summary>
[DisplayName("系统生成Key")]
[Description("系统生成Key")]
[DataObjectField(false, false, true, 50)]
[BindColumn("Key", "系统生成Key", "nvarchar(50)")]
public String Key { get { return _Key; } set { if (OnPropertyChanging(__.Key, value)) { _Key = value; OnPropertyChanged(__.Key); } } }
private String _SessionKey;
/// <summary>微信SessionKey</summary>
[DisplayName("微信SessionKey")]
[Description("微信SessionKey")]
[DataObjectField(false, false, true, 50)]
[BindColumn("SessionKey", "微信SessionKey", "nvarchar(50)")]
public String SessionKey { get { return _SessionKey; } set { if (OnPropertyChanging(__.SessionKey, value)) { _SessionKey = value; OnPropertyChanged(__.SessionKey); } } }
private String _OpenId;
/// <summary>微信小程序OpenId</summary>
[DisplayName("微信小程序OpenId")]
[Description("微信小程序OpenId")]
[DataObjectField(false, false, true, 50)]
[BindColumn("OpenId", "微信小程序OpenId", "nvarchar(50)")]
public String OpenId { get { return _OpenId; } set { if (OnPropertyChanging(__.OpenId, value)) { _OpenId = value; OnPropertyChanged(__.OpenId); } } }
private DateTime _AddTime;
/// <summary>添加时间</summary>
[DisplayName("添加时间")]
[Description("添加时间")]
[DataObjectField(false, false, true, 0)]
[BindColumn("AddTime", "添加时间", "datetime")]
public DateTime AddTime { get { return _AddTime; } set { if (OnPropertyChanging(__.AddTime, value)) { _AddTime = value; OnPropertyChanged(__.AddTime); } } }
#endregion
#region 获取/设置 字段值
/// <summary>获取/设置 字段值</summary>
/// <param name="name">字段名</param>
/// <returns></returns>
public override Object this[String name]
{
get
{
switch (name)
{
case __.Id : return _Id;
case __.UId : return _UId;
case __.IP : return _IP;
case __.Key : return _Key;
case __.SessionKey : return _SessionKey;
case __.OpenId : return _OpenId;
case __.AddTime : return _AddTime;
default: return base[name];
}
}
set
{
switch (name)
{
case __.Id : _Id = Convert.ToInt32(value); break;
case __.UId : _UId = Convert.ToInt32(value); break;
case __.IP : _IP = Convert.ToString(value); break;
case __.Key : _Key = Convert.ToString(value); break;
case __.SessionKey : _SessionKey = Convert.ToString(value); break;
case __.OpenId : _OpenId = Convert.ToString(value); break;
case __.AddTime : _AddTime = Convert.ToDateTime(value); break;
default: base[name] = value; break;
}
}
}
#endregion
#region 字段名
/// <summary>取得小程序Session字段信息的快捷方式</summary>
public partial class _
{
/// <summary>编号</summary>
public static readonly Field Id = FindByName(__.Id);
/// <summary>用户ID</summary>
public static readonly Field UId = FindByName(__.UId);
/// <summary>登录IP</summary>
public static readonly Field IP = FindByName(__.IP);
/// <summary>系统生成Key</summary>
public static readonly Field Key = FindByName(__.Key);
/// <summary>微信SessionKey</summary>
public static readonly Field SessionKey = FindByName(__.SessionKey);
/// <summary>微信小程序OpenId</summary>
public static readonly Field OpenId = FindByName(__.OpenId);
/// <summary>添加时间</summary>
public static readonly Field AddTime = FindByName(__.AddTime);
static Field FindByName(String name) { return Meta.Table.FindByName(name); }
}
/// <summary>取得小程序Session字段名称的快捷方式</summary>
public partial class __
{
/// <summary>编号</summary>
public const String Id = "Id";
/// <summary>用户ID</summary>
public const String UId = "UId";
/// <summary>登录IP</summary>
public const String IP = "IP";
/// <summary>系统生成Key</summary>
public const String Key = "Key";
/// <summary>微信SessionKey</summary>
public const String SessionKey = "SessionKey";
/// <summary>微信小程序OpenId</summary>
public const String OpenId = "OpenId";
/// <summary>添加时间</summary>
public const String AddTime = "AddTime";
}
#endregion
}
/// <summary>小程序Session接口</summary>
public partial interface IWXAppSession
{
#region 属性
/// <summary>编号</summary>
Int32 Id { get; set; }
/// <summary>用户ID</summary>
Int32 UId { get; set; }
/// <summary>登录IP</summary>
String IP { get; set; }
/// <summary>系统生成Key</summary>
String Key { get; set; }
/// <summary>微信SessionKey</summary>
String SessionKey { get; set; }
/// <summary>微信小程序OpenId</summary>
String OpenId { get; set; }
/// <summary>添加时间</summary>
DateTime AddTime { get; set; }
#endregion
#region 获取/设置 字段值
/// <summary>获取/设置 字段值</summary>
/// <param name="name">字段名</param>
/// <returns></returns>
Object this[String name] { get; set; }
#endregion
}
}
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -7,6 +7,7 @@ using System.Xml.Serialization;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -7,6 +7,7 @@ using System.Xml.Serialization;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+28
View File
@@ -198,6 +198,34 @@ namespace COMCMS.Core
#endregion
#region 业务操作
/// <summary>
/// 获取前几条数据
/// </summary>
/// <param name="kid">栏目id</param>
/// <param name="records">条数</param>
/// <returns></returns>
public static IList<Product> FindTopList(int kid, int records, bool isShowSub = false)
{
if (!isShowSub)
return FindAll(_.KId == kid & _.IsHide == 0, _.Id.Desc(), null, 0, records);
else
{
Expression ex = _.IsHide == 0;
List<int> kids = new List<int>();
kids.Add(kid);
IList<Category> subkinds = Category.FindByParentID(kid);
if (subkinds != null && subkinds.Count > 0)
{
foreach (var item in subkinds)
{
kids.Add(item.Id);
}
}
ex &= _.KId.In(kids);
return FindAll(ex, _.Id.Desc(), null, 0, records);
}
}
#endregion
}
}
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
-178
View File
@@ -1,178 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Xml.Serialization;
using NewLife;
using NewLife.Data;
using NewLife.Log;
using NewLife.Model;
using NewLife.Reflection;
using NewLife.Threading;
using NewLife.Web;
using XCode;
using XCode.Cache;
using XCode.Configuration;
using XCode.DataAccessLayer;
using XCode.Membership;
namespace COMCMS.Core
{
/// <summary>快餐</summary>
public partial class Food : Entity<Food>
{
#region 对象操作
static Food()
{
// 累加字段
//Meta.Factory.AdditionalFields.Add(__.Logins);
// 过滤器 UserModule、TimeModule、IPModule
Meta.Modules.Add<TimeModule>();
}
/// <summary>验证数据,通过抛出异常的方式提示验证失败。</summary>
/// <param name="isNew">是否插入</param>
public override void Valid(Boolean isNew)
{
// 如果没有脏数据,则不需要进行任何处理
if (!HasDirty) return;
// 在新插入数据或者修改了指定字段时进行修正
// 货币保留6位小数
Price = Math.Round(Price, 6);
MarketPrice = Math.Round(MarketPrice, 6);
SpecialPrice = Math.Round(SpecialPrice, 6);
Fare = Math.Round(Fare, 6);
Discount = Math.Round(Discount, 6);
//if (!Dirtys[nameof(UpdateTime)]) nameof(UpdateTime) = DateTime.Now;
}
///// <summary>首次连接数据库时初始化数据,仅用于实体类重载,用户不应该调用该方法</summary>
//[EditorBrowsable(EditorBrowsableState.Never)]
//protected override void InitData()
//{
// // InitData一般用于当数据表没有数据时添加一些默认数据,该实体类的任何第一次数据库操作都会触发该方法,默认异步调用
// if (Meta.Count > 0) return;
// if (XTrace.Debug) XTrace.WriteLine("开始初始化Food[快餐]数据……");
// var entity = new Food();
// entity.Id = 0;
// entity.KId = 0;
// entity.BId = 0;
// entity.ShopId = 0;
// entity.CId = 0;
// entity.SupportId = 0;
// entity.Title = "abc";
// entity.ItemNO = "abc";
// entity.SubTitle = "abc";
// entity.Unit = "abc";
// entity.Spec = "abc";
// entity.Color = "abc";
// entity.Weight = "abc";
// entity.Price = 0.0;
// entity.MarketPrice = 0.0;
// entity.SpecialPrice = 0.0;
// entity.Fare = 0.0;
// entity.Discount = 0.0;
// entity.Material = "abc";
// entity.Front = "abc";
// entity.Credits = 0;
// entity.Stock = 0;
// entity.WarnStock = 0;
// entity.IsSubProduct = 0;
// entity.PPId = 0;
// entity.Content = "abc";
// entity.Parameters = "abc";
// entity.Keyword = "abc";
// entity.Description = "abc";
// entity.LinkURL = "abc";
// entity.TitleColor = "abc";
// entity.TemplateFile = "abc";
// entity.IsRecommend = 0;
// entity.IsHide = 0;
// entity.IsLock = 0;
// entity.IsDel = 0;
// entity.IsTop = 0;
// entity.IsBest = 0;
// entity.IsComment = 0;
// entity.IsMember = 0;
// entity.IsNew = 0;
// entity.IsSpecial = 0;
// entity.IsPromote = 0;
// entity.IsHotSales = 0;
// entity.IsBreakup = 0;
// entity.IsShelves = 0;
// entity.IsVerify = 0;
// entity.Hits = 0;
// entity.IsGift = 0;
// entity.IsPart = 0;
// entity.Sequence = 0;
// entity.CommentCount = 0;
// entity.Icon = "abc";
// entity.ClassName = "abc";
// entity.BannerImg = "abc";
// entity.Pic = "abc";
// entity.AdsId = 0;
// entity.Tags = "abc";
// entity.ItemImg = "abc";
// entity.Service = "abc";
// entity.AuthorId = 0;
// entity.AddTime = DateTime.Now;
// entity.UpdateTime = DateTime.Now;
// entity.Location = "abc";
// entity.FilePath = "abc";
// entity.Insert();
// if (XTrace.Debug) XTrace.WriteLine("完成初始化Food[快餐]数据!");
//}
///// <summary>已重载。基类先调用Valid(true)验证数据,然后在事务保护内调用OnInsert</summary>
///// <returns></returns>
//public override Int32 Insert()
//{
// return base.Insert();
//}
///// <summary>已重载。在事务保护范围内处理业务,位于Valid之后</summary>
///// <returns></returns>
//protected override Int32 OnDelete()
//{
// return base.OnDelete();
//}
#endregion
#region 扩展属性
#endregion
#region 扩展查询
/// <summary>根据编号查找</summary>
/// <param name="id">编号</param>
/// <returns>实体对象</returns>
public static Food FindById(Int32 id)
{
if (id <= 0) return null;
// 实体缓存
if (Meta.Count < 1000) return Meta.Cache.Find(e => e.Id == id);
// 单对象缓存
//return Meta.SingleCache[id];
return Find(_.Id == id);
}
#endregion
#region 高级查询
#endregion
#region 业务操作
#endregion
}
}
File diff suppressed because it is too large Load Diff
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
+1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
-180
View File
@@ -1,180 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Xml.Serialization;
using NewLife;
using NewLife.Data;
using NewLife.Log;
using NewLife.Model;
using NewLife.Reflection;
using NewLife.Threading;
using NewLife.Web;
using XCode;
using XCode.Cache;
using XCode.Configuration;
using XCode.DataAccessLayer;
using XCode.Membership;
namespace COMCMS.Core
{
/// <summary>酒店房间</summary>
public partial class HotelRoom : Entity<HotelRoom>
{
#region 对象操作
static HotelRoom()
{
// 累加字段
//Meta.Factory.AdditionalFields.Add(__.Logins);
// 过滤器 UserModule、TimeModule、IPModule
Meta.Modules.Add<TimeModule>();
}
/// <summary>验证数据,通过抛出异常的方式提示验证失败。</summary>
/// <param name="isNew">是否插入</param>
public override void Valid(Boolean isNew)
{
// 如果没有脏数据,则不需要进行任何处理
if (!HasDirty) return;
// 在新插入数据或者修改了指定字段时进行修正
// 货币保留6位小数
Price = Math.Round(Price, 6);
MarketPrice = Math.Round(MarketPrice, 6);
SpecialPrice = Math.Round(SpecialPrice, 6);
Fare = Math.Round(Fare, 6);
Discount = Math.Round(Discount, 6);
//if (!Dirtys[nameof(UpdateTime)]) nameof(UpdateTime) = DateTime.Now;
}
///// <summary>首次连接数据库时初始化数据,仅用于实体类重载,用户不应该调用该方法</summary>
//[EditorBrowsable(EditorBrowsableState.Never)]
//protected override void InitData()
//{
// // InitData一般用于当数据表没有数据时添加一些默认数据,该实体类的任何第一次数据库操作都会触发该方法,默认异步调用
// if (Meta.Count > 0) return;
// if (XTrace.Debug) XTrace.WriteLine("开始初始化HotelRoom[酒店房间]数据……");
// var entity = new HotelRoom();
// entity.Id = 0;
// entity.KId = 0;
// entity.BId = 0;
// entity.ShopId = 0;
// entity.CId = 0;
// entity.SupportId = 0;
// entity.Title = "abc";
// entity.ItemNO = "abc";
// entity.SubTitle = "abc";
// entity.Unit = "abc";
// entity.Spec = "abc";
// entity.Color = "abc";
// entity.Weight = "abc";
// entity.Price = 0.0;
// entity.MarketPrice = 0.0;
// entity.SpecialPrice = 0.0;
// entity.Fare = 0.0;
// entity.Discount = 0.0;
// entity.Material = "abc";
// entity.Front = "abc";
// entity.Credits = 0;
// entity.Stock = 0;
// entity.WarnStock = 0;
// entity.IsSubProduct = 0;
// entity.PPId = 0;
// entity.Content = "abc";
// entity.Parameters = "abc";
// entity.Keyword = "abc";
// entity.Description = "abc";
// entity.LinkURL = "abc";
// entity.TitleColor = "abc";
// entity.TemplateFile = "abc";
// entity.IsRecommend = 0;
// entity.IsHide = 0;
// entity.IsLock = 0;
// entity.IsDel = 0;
// entity.IsTop = 0;
// entity.IsBest = 0;
// entity.IsComment = 0;
// entity.IsMember = 0;
// entity.IsNew = 0;
// entity.IsSpecial = 0;
// entity.IsPromote = 0;
// entity.IsHotSales = 0;
// entity.IsBreakup = 0;
// entity.IsShelves = 0;
// entity.IsVerify = 0;
// entity.Hits = 0;
// entity.IsGift = 0;
// entity.IsPart = 0;
// entity.Sequence = 0;
// entity.CommentCount = 0;
// entity.Icon = "abc";
// entity.ClassName = "abc";
// entity.BannerImg = "abc";
// entity.Pic = "abc";
// entity.AdsId = 0;
// entity.Tags = "abc";
// entity.ItemImg = "abc";
// entity.Service = "abc";
// entity.AuthorId = 0;
// entity.AddTime = DateTime.Now;
// entity.UpdateTime = DateTime.Now;
// entity.Location = "abc";
// entity.FilePath = "abc";
// entity.PriceList = "abc";
// entity.Insert();
// if (XTrace.Debug) XTrace.WriteLine("完成初始化HotelRoom[酒店房间]数据!");
//}
///// <summary>已重载。基类先调用Valid(true)验证数据,然后在事务保护内调用OnInsert</summary>
///// <returns></returns>
//public override Int32 Insert()
//{
// return base.Insert();
//}
///// <summary>已重载。在事务保护范围内处理业务,位于Valid之后</summary>
///// <returns></returns>
//protected override Int32 OnDelete()
//{
// return base.OnDelete();
//}
#endregion
#region 扩展属性
#endregion
#region 扩展查询
/// <summary>根据编号查找</summary>
/// <param name="id">编号</param>
/// <returns>实体对象</returns>
public static HotelRoom FindById(Int32 id)
{
if (id <= 0) return null;
// 实体缓存
if (Meta.Count < 1000) return Meta.Cache.Find(e => e.Id == id);
// 单对象缓存
//return Meta.SingleCache[id];
return Find(_.Id == id);
}
#endregion
#region 高级查询
#endregion
#region 业务操作
#endregion
}
}
File diff suppressed because it is too large Load Diff
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
@@ -4,6 +4,7 @@ using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
using NewLife;
namespace COMCMS.Core
{
View File
@@ -43,7 +43,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
foreach (var asmItem in asms)
{
string fullName = asmItem.GetName().ToString();
if (fullName.IndexOf("COMCMS.Web.Views") > -1)
if (fullName.IndexOf("COMCMS.Web") > -1)
{
var types = asmItem.GetTypes().Where(e => e.Name.StartsWith("Views_Article")).ToList();
if (types.Count == 0) continue;
@@ -174,7 +174,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
foreach (var asmItem in asms)
{
string fullName = asmItem.GetName().ToString();
if (fullName.IndexOf("COMCMS.Web.Views") > -1)
if (fullName.IndexOf("COMCMS.Web") > -1)
{
var types = asmItem.GetTypes().Where(e => e.Name.StartsWith("Views_Article")).ToList();
if (types.Count == 0) continue;
@@ -251,7 +251,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
entity.Location = ArticleCategory.GetNewLocation(model.PId);
entity.Level = ArticleCategory.GetNewLevel(model.PId);
//修改文章的location
IList<Article> alist = Article.FindAll(Article._.KId == model.Id, null, null, 0, 0);
IList<Article> alist = Article.FindAll(Article._.KId == model.Id, Article._.Id.Desc(), null, 0, 0);
if (alist != null && alist.Count > 0)
{
foreach (var a in alist)
@@ -347,7 +347,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
//修改所有文章的路径
if (idNeedUpdateAllArticleFilePath)
{
IList<Article> listArticles = Article.FindAll(Article._.KId == entity.Id, null, null, 0, 0);
IList<Article> listArticles = Article.FindAll(Article._.KId == entity.Id, Article._.Id.Desc(), null, 0, 0);
if(listArticles !=null && listArticles.Count > 0)
{
foreach (var item in listArticles)
@@ -24,6 +24,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
public IndexController(IWebHostEnvironment env)
{
_env = env;
MachineInfo.RegisterAsync();
}
#region 后台首页
[AllowAnonymous]
@@ -55,7 +56,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
#region 后台主界面
public IActionResult Main()
{
string remoteip = Request.HttpContext.Connection.RemoteIpAddress.ToString();
string remoteip = Utils.GetIP();
string host = Request.HttpContext.Request.Host.Host;
string port = Request.HttpContext.Connection.RemotePort.ToString();
@@ -50,6 +50,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
{
string strUserName = Request.Form["username"];
string strPassWord = Request.Form["password"];
string code = Request.Form["code"];
if (strUserName.Length % 8 != 0)
{
@@ -69,6 +70,21 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
tip.Other = "reload";
return Json(tip);
}
if (Utils.GetSetting("SystemSetting:AdminLoginWithCode") == "1")
{
if (string.IsNullOrEmpty(code))
{
tip.Message = "请输入验证码!";
return Json(tip);
}
if (!VerifyCodeHelper.GetSingleObj().VerifyCodeIsOK(code))
{
tip.Message = "验证码错误!";
return Json(tip);
}
}
//解密
string username = "";
string password = "";
@@ -502,7 +502,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
if (!string.IsNullOrWhiteSpace(keyword))
ex &= Core.Admin._.UserName.Contains(keyword);
IList<Core.Admin> list = Core.Admin.FindAll(ex, null, null, startRowIndex, numPerPage);
IList<Core.Admin> list = Core.Admin.FindAll(ex, Admin._.Id.Desc(), null, startRowIndex, numPerPage);
totalCount = Core.Admin.FindCount(ex, null, null, startRowIndex, numPerPage);
return Content(JsonConvert.SerializeObject(new { total = totalCount, rows = list }), "text/plain");
}
@@ -948,7 +948,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
}
}
IList<Member> list = Member.FindAll(ex, null, null, startRowIndex, numPerPage);
IList<Member> list = Member.FindAll(ex, Member._.Id.Desc(), null, startRowIndex, numPerPage);
totalCount = Member.FindCount(ex, null, null, startRowIndex, numPerPage);
return Content(JsonConvert.SerializeObject(new { total = totalCount, rows = list }), "text/plain");
}
@@ -45,7 +45,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
if (!string.IsNullOrWhiteSpace(keyword))
ex &= (Order._.Title.Contains(keyword) | Order._.OrderNum.Contains(keyword) | Order._.RealName.Contains(keyword) | Order._.Address.Contains(keyword));
IList<Order> list = Order.FindAll(ex, null, null, startRowIndex, numPerPage);
IList<Order> list = Order.FindAll(ex, Order._.Id.Desc(), null, startRowIndex, numPerPage);
long totalCount = Order.FindCount(ex, null, null, startRowIndex, numPerPage);
return Content(Newtonsoft.Json.JsonConvert.SerializeObject(new { total = totalCount, rows = list }), "text/plain");
//return Json(new { total = totalCount, rows = list }, JsonRequestBehavior.AllowGet);
@@ -327,7 +327,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
if (!string.IsNullOrWhiteSpace(keyword))
ex &= OnlinePayOrder._.Title.Contains(keyword);
IList<OnlinePayOrder> list = OnlinePayOrder.FindAll(ex, null, null, startRowIndex, numPerPage);
IList<OnlinePayOrder> list = OnlinePayOrder.FindAll(ex, OnlinePayOrder._.Id.Desc(), null, startRowIndex, numPerPage);
long totalCount = OnlinePayOrder.FindCount(ex, null, null, startRowIndex, numPerPage);
return Content(Newtonsoft.Json.JsonConvert.SerializeObject(new { total = totalCount, rows = list }), "text/plain");
//return Json(new { total = totalCount, rows = list }, JsonRequestBehavior.AllowGet);
@@ -115,6 +115,85 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
return Json(tip);
}
#region 编辑事件详情
[HttpGet]
[MyAuthorize("add", "eventkey")]
public IActionResult EditEventKey(int id)
{
TargetEvent entity = TargetEvent.Find(TargetEvent._.Id == id);
if (entity == null)
{
return EchoTipPage("系统找不到本记录!");
}
Admin.WriteLogActions("查看/编辑事件详情(id:" + entity.Id + ");");
return View(entity);
}
[HttpPost]
[MyAuthorize("add", "eventkey","JSON")]
public IActionResult EditEventKey(TargetEvent model)
{
if (string.IsNullOrWhiteSpace(model.EventKey))
{
tip.Message = "请填写事件KEY";
return Json(tip);
}
if (string.IsNullOrWhiteSpace(model.EventName))
{
tip.Message = "请填写事件名称";
return Json(tip);
}
TargetEvent entity = TargetEvent.Find(TargetEvent._.Id == model.Id);
if (entity == null)
{
tip.Message = "系统找不到本记录!";
return Json(tip);
}
if (entity.EventKey != model.EventKey)
{
if (TargetEvent.FindCount(TargetEvent._.EventKey == model.EventKey, null, null, 0, 0) > 0)
{
tip.Message = "事件key已经存在,请重新填写一个";
return Json(tip);
}
}
entity.EventKey = model.EventKey;
entity.EventName = model.EventName;
entity.Rank = model.Rank;
if (string.IsNullOrWhiteSpace(Request.Form["IsDisable"]) || Request.Form["IsDisable"] != "1")
entity.IsDisable = 0;
else
entity.IsDisable = 1;
entity.Update();
Admin.WriteLogActions("编辑事件详情(id:" + entity.Id + ");");
tip.Status = JsonTip.SUCCESS;
tip.Message = "编辑事件权限详情成功";
tip.ReturnUrl = "close";
return Json(tip);
}
#endregion
#region 删除事件权限
[HttpPost]
[MyAuthorize("del", "eventkey", "JSON")]
public JsonResult DelEventKey(int id)
{
TargetEvent entity = TargetEvent.Find(TargetEvent._.Id == id);
if (entity == null)
{
tip.Message = "系统找不到本记录!";
return Json(tip);
}
Admin.WriteLogActions("删除事件详情(" + JsonConvert.SerializeObject(entity) + ");");
entity.Delete();
tip.Status = JsonTip.SUCCESS;
tip.Message = "删除事件权限详情成功";
return Json(tip);
}
#endregion
#endregion
#region 后台栏目管理
@@ -339,6 +418,27 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
tip.Message = "删除后台菜单成功";
return Json(tip);
}
//修改栏目是否隐藏
[HttpPost]
[MyAuthorize("edit", "adminmenu", "JSON")]
public IActionResult DoChangeAdminMenuHide(int id)
{
AdminMenu entity = AdminMenu.Find(AdminMenu._.Id == id);
if (entity == null)
{
tip.Message = "系统找不到本记录!";
return Json(tip);
}
if (entity.IsHide == 1)
entity.IsHide = 0;
else
entity.IsHide = 1;
entity.Update();
tip.Status = JsonTip.SUCCESS;
tip.Message = "修改菜单隐藏状态成功";
return Json(tip);
}
#endregion
#region 系统运行日志
@@ -36,6 +36,24 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
//获取上级栏目
IList<Category> list = Category.GetListTree(0, -1, true, false);
ViewBag.ListTree = list;
//获取模板 模板规则,以Index_开头的,为栏目列表,以Detial_开头的为文章详情
List<string> listTpls = new List<string>();
var asms = AppDomain.CurrentDomain.GetAssemblies();
foreach (var asmItem in asms)
{
string fullName = asmItem.GetName().ToString();
if (fullName.IndexOf("COMCMS.Web") > -1)
{
var types = asmItem.GetTypes().Where(e => e.Name.StartsWith("Views_Product")).ToList();
if (types.Count == 0) continue;
foreach (var type in types)
{
string viewName = type.Name.Replace("Views_Product_", "") + ".cshtml";
listTpls.Add(viewName);
}
}
}
ViewBag.ListTpl = listTpls;
//获取模板
//List<string> listtpl = COMCMS.Common.IOHelper.GetDirFiles(new DirectoryInfo(Server.MapPath("~/Views/article")));
//ViewBag.ListTpl = listtpl;
@@ -53,6 +71,33 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
tip.Message = "商品栏目标题不能为空!";
return Json(tip);
}
if (!string.IsNullOrEmpty(model.FilePath))
{
if (!model.FilePath.StartsWith("/"))
{
tip.Message = "栏目路径请以/开头!";
return Json(tip);
}
if (model.FilePath.EndsWith("/"))
{
tip.Message = "栏目路径结尾不用加上/";
return Json(tip);
}
if (model.FilePath.Count(x => x == '/') > 4)
{
tip.Message = "最多只能四级路径!";
return Json(tip);
}
}
if (!string.IsNullOrEmpty(model.FilePath) && !AdminUtils.CheckFilePathIsOK(model.FilePath, 0, 1))
{
tip.Message = "栏目路径不可用,请重新填写!";
return Json(tip);
}
model.Insert();
Core.Admin.WriteLogActions("添加商品栏目(id:" + model.Id + ");");
tip.Status = JsonTip.SUCCESS;
@@ -74,9 +119,25 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
//获取上级栏目
IList<Category> list = Category.GetListTree(0, -1, true, false);
ViewBag.ListTree = list;
//获取模板
//List<string> listtpl = COMCMS.Common.IOHelper.GetDirFiles(new DirectoryInfo(Server.MapPath("~/Views/article")));
//ViewBag.ListTpl = listtpl;
//获取模板 模板规则,以Index_开头的,为栏目列表,以Detial_开头的为文章详情
List<string> listTpls = new List<string>();
var asms = AppDomain.CurrentDomain.GetAssemblies();
foreach (var asmItem in asms)
{
string fullName = asmItem.GetName().ToString();
if (fullName.IndexOf("COMCMS.Web") > -1)
{
var types = asmItem.GetTypes().Where(e => e.Name.StartsWith("Views_Product")).ToList();
if (types.Count == 0) continue;
foreach (var type in types)
{
string viewName = type.Name.Replace("Views_Product_", "") + ".cshtml";
listTpls.Add(viewName);
}
}
}
ViewBag.ListTpl = listTpls;
Core.Admin.WriteLogActions("查看/编辑商品栏目(id:" + id + ")页面;");
return View(entity);
}
@@ -102,6 +163,30 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
tip.Message = "系统找不到本记录!";
Json(tip);
}
if (!string.IsNullOrEmpty(model.FilePath))
{
if (!model.FilePath.StartsWith("/"))
{
tip.Message = "栏目路径请以/开头!";
return Json(tip);
}
if (model.FilePath.EndsWith("/"))
{
tip.Message = "栏目路径结尾不用加上/";
return Json(tip);
}
if (model.FilePath.Count(x => x == '/') > 4)
{
tip.Message = "最多只能四级路径!";
return Json(tip);
}
}
if (!string.IsNullOrEmpty(model.FilePath) && !AdminUtils.CheckFilePathIsOK(model.FilePath, entity.Id, 1))
{
tip.Message = "栏目路径不可用,请重新填写!";
return Json(tip);
}
if (entity.PId != model.PId)
{
@@ -147,6 +232,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
entity.KindDomain = model.KindDomain;
entity.Rank = model.Rank;
entity.Pic = model.Pic;
entity.FilePath = model.FilePath;
entity.Save();
@@ -28,6 +28,14 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
pinyin = pcategory.FilePath+"/";
}
}
else if(t == "category" && pid > 0)
{
Category pcategory = Category.FindById(pid);
if (pcategory != null && !string.IsNullOrEmpty(pcategory.FilePath))
{
pinyin = pcategory.FilePath + "/";
}
}
if (!string.IsNullOrEmpty(name))
{
@@ -222,7 +222,15 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
string content = "";
if (System.IO.File.Exists(file))
{
content = System.IO.File.ReadAllText(file);
try
{
content = System.IO.File.ReadAllText(file);
}
catch (Exception ex)
{
NewLife.Log.XTrace.WriteException(ex);
// 如果读取文件失败,继续使用空内容
}
}
ViewBag.content = content;
Admin.WriteLogActions("查看Robots.txt;");
@@ -233,15 +241,18 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
public IActionResult Robots(string content)
{
string file = Path.Combine(_env.WebRootPath, "robots.txt");
if (System.IO.File.Exists(file))
try
{
//写入覆盖
System.IO.File.WriteAllText(file, content);
}
else
catch (Exception ex)
{
System.IO.File.WriteAllText(file, content);
NewLife.Log.XTrace.WriteException(ex);
tip.Message = "修改Robots.txt失败:" + ex.Message;
return Json(tip);
}
tip.Status = JsonTip.SUCCESS;
tip.Message = "修改Robots.txt成功";
Admin.WriteLogActions("修改Robots.txt成功;");
@@ -17,6 +17,7 @@ using System.Text;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Primitives;
using NewLife.UserGroup.WebUploader;
using SkiaSharp;
namespace COMCMS.Web.Areas.AdminCP.Controllers
{
@@ -81,7 +82,11 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
return Json(errorJson);
//return Content(string.Format(tpl, "", callback, "请上传一张图片!"), "text/html");
}
if (!Utils.IsImgFilename(upload.FileName))
{
errorJson.error.message = "请选择一张图片!";
return Json(errorJson);
}
var data = Request.Form.Files["upload"];
string filepath = $"{_env.WebRootPath}{Path.DirectorySeparatorChar}{attach.AttachPatch}{Path.DirectorySeparatorChar}images{Path.DirectorySeparatorChar}";
string thumbsFilePath = $"{_env.WebRootPath}{Path.DirectorySeparatorChar}{attach.AttachPatch}{Path.DirectorySeparatorChar}_thumbs{Path.DirectorySeparatorChar}images{Path.DirectorySeparatorChar}";
@@ -155,15 +160,15 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
string copyfullpath = fullpath.Replace(sFullExtension, "_copy" + sFullExtension);
System.IO.File.Copy(fullpath, copyfullpath);
Image waterpic = new Bitmap(watermarkimg);
Image srcPic = new Bitmap(copyfullpath);
var waterpic = SKBitmap.Decode(watermarkimg);
var srcPic = SKBitmap.Decode(copyfullpath);
if (waterpic.Width < srcPic.Width && waterpic.Height < srcPic.Height)
{
waterpic.Dispose();
//srcPic.Dispose();
try
{
WatermarkHelper.AddImageSignPic(srcPic, fullpath, watermarkimg, attach.WaterMarkPlace, attach.WaterMarkQty, attach.WaterMarkDiaphaneity);
WatermarkHelper.AddImageSignPic(copyfullpath, fullpath, watermarkimg, attach.WaterMarkPlace, attach.WaterMarkQty, attach.WaterMarkDiaphaneity);
srcPic.Dispose();
System.IO.File.Delete(copyfullpath);
}
@@ -318,15 +323,15 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
string copyfullpath = fullpath.Replace(sFullExtension, "_copy" + sFullExtension);
System.IO.File.Copy(fullpath, copyfullpath);
Image waterpic = new Bitmap(watermarkimg);
Image srcPic = new Bitmap(copyfullpath);
var waterpic = SKBitmap.Decode(watermarkimg);
var srcPic = SKBitmap.Decode(copyfullpath);
if (waterpic.Width < srcPic.Width && waterpic.Height < srcPic.Height)
{
waterpic.Dispose();
//srcPic.Dispose();
try
{
WatermarkHelper.AddImageSignPic(srcPic, fullpath, watermarkimg, attach.WaterMarkPlace, attach.WaterMarkQty, attach.WaterMarkDiaphaneity);
WatermarkHelper.AddImageSignPic(copyfullpath, fullpath, watermarkimg, attach.WaterMarkPlace, attach.WaterMarkQty, attach.WaterMarkDiaphaneity);
srcPic.Dispose();
System.IO.File.Delete(copyfullpath);
}
@@ -383,161 +388,161 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
// }
//}
#region 二进制上传图片
/// <summary>
/// 二进制上传图片(未实现)
/// </summary>
/// <returns></returns>
public IActionResult DoWebuploaderImageByBinary()
{
var fileinfo = "";
var msg = "上传失败!";
var status = 0;
var name = "";
var path = "";
var thumb = "";
var size = "";
var ext = "";
try
{
string upname = Request.Query["name"];
//判断是否是允许文件扩展名
string sAllowedExtensions = _attachsetting.ImageAllowedExtensions;
List<string> listAllowedExtensions = new List<string>();
string[] arrAllowedExtensions = sAllowedExtensions.Split(new string[] { "," }, StringSplitOptions.None);
//#region 二进制上传图片
///// <summary>
///// 二进制上传图片(未实现)
///// </summary>
///// <returns></returns>
//public IActionResult DoWebuploaderImageByBinary()
//{
// var fileinfo = "";
// var msg = "上传失败!";
// var status = 0;
// var name = "";
// var path = "";
// var thumb = "";
// var size = "";
// var ext = "";
// try
// {
// string upname = Request.Query["name"];
// //判断是否是允许文件扩展名
// string sAllowedExtensions = _attachsetting.ImageAllowedExtensions;
// List<string> listAllowedExtensions = new List<string>();
// string[] arrAllowedExtensions = sAllowedExtensions.Split(new string[] { "," }, StringSplitOptions.None);
string sFileNameNoExt = Utils.GetFileNameWithoutExtension(upname);//文件名字,不带扩展名
string sFullExtension = Utils.GetFileExtName(upname);//扩展名
// string sFileNameNoExt = Utils.GetFileNameWithoutExtension(upname);//文件名字,不带扩展名
// string sFullExtension = Utils.GetFileExtName(upname);//扩展名
if (arrAllowedExtensions != null && arrAllowedExtensions.Length > 0)
{
foreach (var s in arrAllowedExtensions)
{
listAllowedExtensions.Add(s);
}
}
if (listAllowedExtensions.Find(x => x == sFullExtension.ToLower().Replace(".", "")) == null)
{
return Json(new { status = status, msg = $"{sFullExtension}的文件类型,不允许上传,请上传一张图片!", name = name, path = path, thumb = thumb, size = size, ext = ext });
}
var req = HttpContext.Request;
var f = Request.Form.Files[0];
// if (arrAllowedExtensions != null && arrAllowedExtensions.Length > 0)
// {
// foreach (var s in arrAllowedExtensions)
// {
// listAllowedExtensions.Add(s);
// }
// }
// if (listAllowedExtensions.Find(x => x == sFullExtension.ToLower().Replace(".", "")) == null)
// {
// return Json(new { status = status, msg = $"{sFullExtension}的文件类型,不允许上传,请上传一张图片!", name = name, path = path, thumb = thumb, size = size, ext = ext });
// }
// var req = HttpContext.Request;
// var f = Request.Form.Files[0];
//Request.EnableRewind();
Image image = null;
using (StreamReader reader = new StreamReader(req.Body, Encoding.UTF8, true, 1024, true))
{
var bytes = ConvertToBinary(reader.BaseStream);
image = ReturnPic(bytes);
size = bytes.Length.ToString();
}
// //Request.EnableRewind();
// Image image = null;
// using (StreamReader reader = new StreamReader(req.Body, Encoding.UTF8, true, 1024, true))
// {
// var bytes = ConvertToBinary(reader.BaseStream);
// image = ReturnPic(bytes);
// size = bytes.Length.ToString();
// }
string filepath = $"{_env.WebRootPath}{Path.DirectorySeparatorChar}{attach.AttachPatch}{Path.DirectorySeparatorChar}images{Path.DirectorySeparatorChar}";
string thumbsFilePath = $"{_env.WebRootPath}{Path.DirectorySeparatorChar}{attach.AttachPatch}{Path.DirectorySeparatorChar}_thumbs{Path.DirectorySeparatorChar}images{Path.DirectorySeparatorChar}";
//根据附件配置,设置上传图片目录
string imgPath = DateTime.Now.Year.ToString();//默认按年
switch (attach.SaveType)
{
case 1://按月份
imgPath = $"{DateTime.Now.Year.ToString()}{Path.DirectorySeparatorChar}{DateTime.Now.ToString("MM")}";
break;
case 2:
imgPath = $"{DateTime.Now.Year.ToString()}{Path.DirectorySeparatorChar}{DateTime.Now.ToString("MM")}{Path.DirectorySeparatorChar}{DateTime.Now.ToString("dd")}";
break;
}
filepath += imgPath;//存放路径
thumbsFilePath += imgPath;//缩略图路径
//图片名字
string imgname = Utils.GetOrderNum() + Utils.GetFileExtName(upname);
switch (attach.IsRandomFileName)
{
case 0://不随机
imgname = upname;
//判断是否存在
if (System.IO.File.Exists(Path.Combine(filepath, imgname)))
{
imgname = sFileNameNoExt + "(1)" + sFullExtension;
}
break;
case 1://随机字符串
imgname = Utils.GetShortGUId() + sFullExtension;
break;
case 2://时间
imgname = Utils.GetOrderNum() + sFullExtension;
break;
}
string fullpath = Path.Combine(filepath, imgname);//图片
string fullThumbPath = Path.Combine(thumbsFilePath, imgname);//缩略图
// string filepath = $"{_env.WebRootPath}{Path.DirectorySeparatorChar}{attach.AttachPatch}{Path.DirectorySeparatorChar}images{Path.DirectorySeparatorChar}";
// string thumbsFilePath = $"{_env.WebRootPath}{Path.DirectorySeparatorChar}{attach.AttachPatch}{Path.DirectorySeparatorChar}_thumbs{Path.DirectorySeparatorChar}images{Path.DirectorySeparatorChar}";
// //根据附件配置,设置上传图片目录
// string imgPath = DateTime.Now.Year.ToString();//默认按年
// switch (attach.SaveType)
// {
// case 1://按月份
// imgPath = $"{DateTime.Now.Year.ToString()}{Path.DirectorySeparatorChar}{DateTime.Now.ToString("MM")}";
// break;
// case 2:
// imgPath = $"{DateTime.Now.Year.ToString()}{Path.DirectorySeparatorChar}{DateTime.Now.ToString("MM")}{Path.DirectorySeparatorChar}{DateTime.Now.ToString("dd")}";
// break;
// }
// filepath += imgPath;//存放路径
// thumbsFilePath += imgPath;//缩略图路径
// //图片名字
// string imgname = Utils.GetOrderNum() + Utils.GetFileExtName(upname);
// switch (attach.IsRandomFileName)
// {
// case 0://不随机
// imgname = upname;
// //判断是否存在
// if (System.IO.File.Exists(Path.Combine(filepath, imgname)))
// {
// imgname = sFileNameNoExt + "(1)" + sFullExtension;
// }
// break;
// case 1://随机字符串
// imgname = Utils.GetShortGUId() + sFullExtension;
// break;
// case 2://时间
// imgname = Utils.GetOrderNum() + sFullExtension;
// break;
// }
// string fullpath = Path.Combine(filepath, imgname);//图片
// string fullThumbPath = Path.Combine(thumbsFilePath, imgname);//缩略图
//判断路径
if (!Directory.Exists(filepath))
Directory.CreateDirectory(filepath);
//缩略图路径
if (!Directory.Exists(thumbsFilePath))
Directory.CreateDirectory(thumbsFilePath);
// //判断路径
// if (!Directory.Exists(filepath))
// Directory.CreateDirectory(filepath);
// //缩略图路径
// if (!Directory.Exists(thumbsFilePath))
// Directory.CreateDirectory(thumbsFilePath);
//保存图片
image.Save(filepath);
//生成缩略图
if (attach.IsCreateThum == 1)
{
ThumbnailHelper.MakeThumbnailImage(fullpath, fullThumbPath, attach.ThumMaxWidth, attach.ThumMaxHeight, ThumbnailHelper.CutMode.Cut);
}
//添加水印
if (attach.IsWaterMark == 1 && !string.IsNullOrEmpty(attach.WaterMarkImg))
{
string watermarkimg = _env.WebRootPath + attach.WaterMarkImg.Replace("/", Path.DirectorySeparatorChar.ToString());
if (System.IO.File.Exists(watermarkimg))
{
//先复制一张图片出来
string copyfullpath = fullpath.Replace(sFullExtension, "_copy" + sFullExtension);
System.IO.File.Copy(fullpath, copyfullpath);
// //保存图片
// image.Save(filepath);
// //生成缩略图
// if (attach.IsCreateThum == 1)
// {
// ThumbnailHelper.MakeThumbnailImage(fullpath, fullThumbPath, attach.ThumMaxWidth, attach.ThumMaxHeight, ThumbnailHelper.CutMode.Cut);
// }
// //添加水印
// if (attach.IsWaterMark == 1 && !string.IsNullOrEmpty(attach.WaterMarkImg))
// {
// string watermarkimg = _env.WebRootPath + attach.WaterMarkImg.Replace("/", Path.DirectorySeparatorChar.ToString());
// if (System.IO.File.Exists(watermarkimg))
// {
// //先复制一张图片出来
// string copyfullpath = fullpath.Replace(sFullExtension, "_copy" + sFullExtension);
// System.IO.File.Copy(fullpath, copyfullpath);
Image waterpic = new Bitmap(watermarkimg);
Image srcPic = new Bitmap(copyfullpath);
if (waterpic.Width < srcPic.Width && waterpic.Height < srcPic.Height)
{
waterpic.Dispose();
//srcPic.Dispose();
try
{
WatermarkHelper.AddImageSignPic(srcPic, fullpath, watermarkimg, attach.WaterMarkPlace, attach.WaterMarkQty, attach.WaterMarkDiaphaneity);
srcPic.Dispose();
System.IO.File.Delete(copyfullpath);
}
catch
{
if (System.IO.File.Exists(copyfullpath))
{
System.IO.File.Delete(copyfullpath);
}
}
// var waterpic = SKBitmap.Decode(watermarkimg);
// var srcPic = SKBitmap.Decode(copyfullpath);
// if (waterpic.Width < srcPic.Width && waterpic.Height < srcPic.Height)
// {
// waterpic.Dispose();
// //srcPic.Dispose();
// try
// {
// WatermarkHelper.AddImageSignPic(copyfullpath, fullpath, watermarkimg, attach.WaterMarkPlace, attach.WaterMarkQty, attach.WaterMarkDiaphaneity);
// srcPic.Dispose();
// System.IO.File.Delete(copyfullpath);
// }
// catch
// {
// if (System.IO.File.Exists(copyfullpath))
// {
// System.IO.File.Delete(copyfullpath);
// }
// }
}
else
{
waterpic.Dispose();
srcPic.Dispose();
}
}
}
image.Dispose();
status = 1;
name = imgname;
path = $"/{attach.AttachPatch}/images/{imgPath.Replace("\\", "/")}/" + imgname;
thumb = $"/{attach.AttachPatch}/_thumbs/images/{imgPath.Replace("\\", "/")}/" + imgname;
ext = sFullExtension;
fileinfo = $"/{attach.AttachPatch}/images/{imgPath.Replace("\\", "/")}/" + imgname;
msg = "上传成功!";
}
catch (Exception ex)
{
msg = ex.Message;
}
// }
// else
// {
// waterpic.Dispose();
// srcPic.Dispose();
// }
// }
// }
// image.Dispose();
// status = 1;
// name = imgname;
// path = $"/{attach.AttachPatch}/images/{imgPath.Replace("\\", "/")}/" + imgname;
// thumb = $"/{attach.AttachPatch}/_thumbs/images/{imgPath.Replace("\\", "/")}/" + imgname;
// ext = sFullExtension;
// fileinfo = $"/{attach.AttachPatch}/images/{imgPath.Replace("\\", "/")}/" + imgname;
// msg = "上传成功!";
// }
// catch (Exception ex)
// {
// msg = ex.Message;
// }
return Json(new { status = status, msg = msg, name = name, path = path, thumb = thumb, size = size, ext = ext });
}
#endregion
// return Json(new { status = status, msg = msg, name = name, path = path, thumb = thumb, size = size, ext = ext });
//}
//#endregion
/// <summary>
/// 上传图片
@@ -562,6 +567,11 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
msg = "只能上传一张图片格式文件!";
return Content(JsonConvert.SerializeObject(new { status = status, msg = msg, name = name, path = path, thumb = thumb, size = size, ext = ext }), "text/plain");
}
if (!Utils.IsImgFilename(data.FileName))
{
msg = "只能上传一张图片格式文件!";
return Content(JsonConvert.SerializeObject(new { status = status, msg = msg, name = name, path = path, thumb = thumb, size = size, ext = ext }), "text/plain");
}
string filepath = $"{_env.WebRootPath}{Path.DirectorySeparatorChar}{attach.AttachPatch}{Path.DirectorySeparatorChar}images{Path.DirectorySeparatorChar}";
string thumbsFilePath = $"{_env.WebRootPath}{Path.DirectorySeparatorChar}{attach.AttachPatch}{Path.DirectorySeparatorChar}_thumbs{Path.DirectorySeparatorChar}images{Path.DirectorySeparatorChar}";
//根据附件配置,设置上传图片目录
@@ -635,15 +645,15 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
string copyfullpath = fullpath.Replace(sFullExtension, "_copy" + sFullExtension);
System.IO.File.Copy(fullpath, copyfullpath);
Image waterpic = new Bitmap(watermarkimg);
Image srcPic = new Bitmap(copyfullpath);
var waterpic = SKBitmap.Decode(watermarkimg);
var srcPic = SKBitmap.Decode(copyfullpath);
if (waterpic.Width < srcPic.Width && waterpic.Height < srcPic.Height)
{
waterpic.Dispose();
//srcPic.Dispose();
try
{
WatermarkHelper.AddImageSignPic(srcPic, fullpath, watermarkimg, attach.WaterMarkPlace, attach.WaterMarkQty, attach.WaterMarkDiaphaneity);
WatermarkHelper.AddImageSignPic(copyfullpath, fullpath, watermarkimg, attach.WaterMarkPlace, attach.WaterMarkQty, attach.WaterMarkDiaphaneity);
srcPic.Dispose();
System.IO.File.Delete(copyfullpath);
}
@@ -839,7 +849,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
var tempDir = "UploadTemp";
var targetDir = "UploadFile";
var (res,msg) = tempDir.Merge(targetDir, fileName, md5, chunks);
var (res, msg) = tempDir.Merge(targetDir, fileName, md5, chunks);
if (!res)
{
@@ -886,7 +896,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
return Json(new
{
Data = fileName!=null && exists ? (object)new { md5 = md5, url = Path.Combine("/", targetDir, fileName) } : null,
Data = fileName != null && exists ? (object)new { md5 = md5, url = Path.Combine("/", targetDir, fileName) } : null,
Result = exists
});
}
@@ -908,12 +918,12 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
/// </summary>
/// <param name="streamByte"></param>
/// <returns></returns>
public Image ReturnPic(byte[] streamByte)
{
MemoryStream ms = new MemoryStream(streamByte);
Image img = Image.FromStream(ms);
return img;
}
//public Image ReturnPic(byte[] streamByte)
//{
// MemoryStream ms = new MemoryStream(streamByte);
// Image img = Image.FromStream(ms);
// return img;
//}
#endregion
}
}
@@ -16,6 +16,8 @@ using Senparc.Weixin.MP.Containers;
using Senparc.Weixin.MP.Entities.Menu;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
namespace COMCMS.Web.Areas.AdminCP.Controllers
{
@@ -73,7 +75,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
//修改菜单
[HttpPost]
[MyAuthorize("edit", "wxmenu", "JSON")]
public IActionResult DoPostMenuData(string allmenu)
public async Task<IActionResult> DoPostMenuData(string allmenu)
{
Config cfg = Config.GetSystemConfig();
@@ -102,13 +104,18 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
//Senparc.Weixin.MP.CommonAPIs.CommonApi.CreateMenu()
string posturl = $"https://api.weixin.qq.com/cgi-bin/menu/create?access_token={accessToken}";
Stream retunStream = Utils.HttpPost(posturl, allmenu);
StreamReader reader = new StreamReader(retunStream, Encoding.UTF8);
string value = reader.ReadToEnd();
reader.Close();
HttpContent content = new StringContent(allmenu);
string value = string.Empty;
using (HttpClient client = new HttpClient())
{
content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
var re = await client.PostAsync(posturl, content);
string responseString = re.Content.ReadAsStringAsync().Result;
if (!string.IsNullOrEmpty(responseString))
{
value = responseString;
}
}
XTrace.WriteLine("创建公众号菜单回传:" + value);
dynamic rejson = Newtonsoft.Json.Linq.JToken.Parse(value) as dynamic;
@@ -319,7 +326,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
}
}
IList<WeixinRequestRule> list = WeixinRequestRule.FindAll(ex, null, null, startRowIndex, numPerPage);
IList<WeixinRequestRule> list = WeixinRequestRule.FindAll(ex, WeixinRequestRule._.Id.Desc(), null, startRowIndex, numPerPage);
long totalCount = WeixinRequestRule.FindCount(ex, null, null, startRowIndex, numPerPage);
Admin.WriteLogActions($"查看公众号自定义回复规则({page});");
return Content(JsonConvert.SerializeObject(new { total = totalCount, rows = list }), "text/plain");
@@ -663,7 +670,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
ex &= WeixinRequestRule._.Keywords.Contains(keyword);
}
}
IList<WeixinRequestRule> list = WeixinRequestRule.FindAll(ex, null, null, startRowIndex, numPerPage);
IList<WeixinRequestRule> list = WeixinRequestRule.FindAll(ex, WeixinRequestRule._.Id.Desc(), null, startRowIndex, numPerPage);
long totalCount = WeixinRequestRule.FindCount(ex, null, null, startRowIndex, numPerPage);
Admin.WriteLogActions($"查看公众号点击事件自定义回复规则({page});");
return Content(JsonConvert.SerializeObject(new { total = totalCount, rows = list }), "text/plain");
@@ -5,9 +5,6 @@
<div class="wrapper wrapper-content">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>@ViewBag.Title</h5>
</div>
<div class="ibox-content">
<div id="toolbar" class="btn-group">
<button id="btn_add" type="button" class="btn btn-outline btn-default" onclick="showDialog('addarticlekind','添加文章栏目','/AdminCP/Article/AddArticleCategory',0,0);">
@@ -38,12 +35,12 @@
@foreach (var m in Model)
{
<tr class="treegrid-@m.Id @(m.PId !=0?"treegrid-parent-"+m.PId:"") ">
<td>@m.KindName</td>
<td><a href="@ViewsHelper.EchoURL(m)" target="_blank" title="新窗口打开栏目">@m.KindName</a></td>
<td>
@m.Id
</td>
<td class="text-center">
<div class="input-group"><input type="number" class="form-control" id="ac_rank_@(m.Id)" name="ac_rank_@(m.Id)" value="@m.Rank" placeholder="请输入一个数字,越小排越前"><a class="input-group-addon btn btn-primary" title="修改保存" href="javascript:;" onclick="doSaveRank(@(m.Id))"><i class="fa fa-save"></i></a></div>
<div class="input-group"><input type="number" class="form-control input-sm" id="ac_rank_@(m.Id)" name="ac_rank_@(m.Id)" value="@m.Rank" placeholder="请输入一个数字,越小排越前"><a class="input-group-addon btn btn-primary" title="修改保存" href="javascript:;" onclick="doSaveRank(@(m.Id))"><i class="fa fa-save"></i></a></div>
</td>
<td class="text-center">@m.Counts</td>
<td class="text-center">
@@ -9,25 +9,17 @@
}
}
<div class="wrapper wrapper-content ">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>@ViewBag.Title</h5>
<div class="ibox-tools">
</div>
</div>
<div class="ibox-content">
<div class="panel panel-default">
<div class="panel-heading">筛选条件</div>
<div class="panel-body">
<form id="formSearch" class="form-horizontal form-inline" onsubmit="return doSearch(); return false;">
<div>
<label class="control-label">文章栏目:</label>
<select class="form-control" name="kid" id="kid">
<div class="row">
<div class="search-collapse">
<form id="formSearch" onsubmit="return doSearch(); return false;">
<div class="select-list">
<ul>
<li>
文章栏目:<select name="kid" id="kid">
<option value="0">所有栏目</option>
@foreach (var m in ViewBag.ListKinds)
{
if (my.Roles.IsSuperAdmin != 1 && aclist.Count>0)
if (my.Roles.IsSuperAdmin != 1 && aclist.Count > 0)
{
if (aclist.FindIndex(x => x == m.Id) > -1)
{
@@ -40,16 +32,26 @@
}
}
</select>
<label class="checkbox-inline i-checks">
</li>
<li>
<label class="checkbox-inline i-checks" for="isshowsub">
<input type="checkbox" value="1" name="isshowsub" id="isshowsub" /> 显示下级栏目文章
</label>
<label class="control-label">关键字:</label>
<input type="text" placeholder="标题关键字" name="keyword" id="keyword" class="form-control">
<button type="button" style="margin-left:50px" id="btn_query" class="btn btn-primary" onclick="doSearch();">查询</button>
</div>
</form>
</li>
<li>
关键字:
<input type="text" placeholder="标题关键字" name="keyword" id="keyword">
</li>
<li>
<button type="button" id="btn_query" class="btn btn-primary btn-sm" onclick="doSearch();">查询</button>
</li>
</ul>
</div>
</div>
</form>
</div>
</div>
<div class="ibox float-e-margins">
<div class="ibox-content">
<div id="toolbar" class="btn-group">
@if (AdminUtils.CheckAdminPower("add", "article"))
{
@@ -151,7 +153,7 @@
title: '排序',
width: 130,
formatter: function (value, row, index) {
return '<div class="input-group"><input type="number" class="form-control" id="ac_rank_' + row["id"] + '" name="ac_rank_' + row["id"] + '" value="' + value + '" placeholder="请输入一个数字,越小排越前"><a class="input-group-addon btn btn-primary" title="修改保存" href="javascript:;" onclick="doSaveSequence(' + row["id"] + ')"><i class="fa fa-save"></i></a></div>'
return '<div class="input-group"><input type="number" class="form-control input-sm" id="ac_rank_' + row["id"] + '" name="ac_rank_' + row["id"] + '" value="' + value + '" placeholder="请输入一个数字,越小排越前"><a class="input-group-addon btn btn-primary" title="修改保存" href="javascript:;" onclick="doSaveSequence(' + row["id"] + ')"><i class="fa fa-save"></i></a></div>'
}
}, {
field: 'addTime',
@@ -2,8 +2,9 @@
ViewBag.title = "数据字典管理";
}
<script src="~/js/vue/vue.min.js"></script>
<div class="wrapper wrapper-content ">
<div class="row" id="app">
<div class="wrapper wrapper-content " id="app">
<div class="row">
<div class="col-sm-6">
<div class="ibox float-e-margins">
<div class="ibox-title">
@@ -5,9 +5,6 @@
<div class="wrapper wrapper-content">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>@ViewBag.Title</h5>
</div>
<div class="ibox-content">
<div id="toolbar" class="btn-group">
<button id="btn_add" type="button" class="btn btn-outline btn-default" onclick="showDialog('adddepartment','添加部门','/AdminCP/Department/AddDepartment',0,0);">
@@ -5,9 +5,6 @@
<div class="wrapper wrapper-content ">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>@ViewBag.title</h5>
</div>
<div class="ibox-content">
<div id="toolbar" class="btn-group">
<button id="btn_add" type="button" class="btn btn-outline btn-default" onclick="showAddRow();">
@@ -3,36 +3,37 @@
ViewBag.title = "留言管理";
}
<div class="wrapper wrapper-content ">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>@ViewBag.title</h5>
<div class="ibox-tools">
</div>
</div>
<div class="ibox-content">
<div class="panel panel-default">
<div class="panel-heading">筛选条件</div>
<div class="panel-body">
<form id="formSearch" class="form-horizontal form-inline" onsubmit="doSearch(); return false; ">
<div>
<label class="control-label">留言分类:</label>
<select class="form-control" name="kid" id="kid">
<div class="row">
<div class="search-collapse">
<form id="formSearch" onsubmit="return doSearch(); return false;">
<div class="select-list">
<ul>
<li>
留言分类:
<select name="kid" id="kid">
<option value="0">所有分类</option>
@foreach (var m in ViewBag.ListKinds)
{
<option value="@m.Id">@m.KindName</option>
}
</select>
<label class="control-label">关键字:</label>
<input type="text" placeholder="标题关键字" name="keyword" id="keyword" class="form-control">
<button type="button" style="margin-left:50px" id="btn_query" class="btn btn-primary" onclick="doSearch();">查询</button>
</div>
</form>
</li>
<li>
关键字:
<input type="text" placeholder="标题关键字" name="keyword" id="keyword">
</li>
<li>
<button type="button" id="btn_query" class="btn btn-primary btn-sm" onclick="doSearch();">查询</button>
</li>
</ul>
</div>
</div>
<table id="tb_departments"></table>
</form>
</div>
</div>
<div class="ibox float-e-margins">
<div class="ibox-content">
<table id="tb_departments"></table>
<script>
$(function () {
@@ -17,6 +17,7 @@
<link href="~/hplus/css/style.css" rel="stylesheet" />
<link href="~/hplus/css/font-awesome.min.css" rel="stylesheet" />
<link href="~/hplus/css/animate.css" rel="stylesheet" />
<link href="~/hplus/js/plugins/metisMenu/metisMenu.min.css" rel="stylesheet" />
<script>if (window.top !== window.self) { window.top.location = window.location; }</script>
</head>
@@ -77,7 +78,7 @@
{
var l2 = Model.FindAll(s => s.PId == m1.Id && s.IsHide != 1);
<li>
<a href="/AdminCP/@(m1.Link)" id="@m1.MenuKey" @(m1.Link != "#" ? "class=J_menuItem" : "")>
<a href="@(m1.Link=="#"?"javascript:;":"/AdminCP/"+m1.Link)" id="@m1.MenuKey" @(m1.Link != "#" ? "class=J_menuItem" : "")>
@if (!string.IsNullOrWhiteSpace(m1.ClassName))
{
<i class="fa @m1.ClassName"></i>
@@ -176,7 +176,7 @@
<tr>
<td class="text-center small">客户端IP地址</td>
<td>
@ViewBag.remoteip
@(Utils.GetIP())
</td>
</tr>
</tbody>
@@ -35,6 +35,15 @@
<div class="form-group">
<input type="password" name="password" id="password" class="form-control" placeholder="密码" required="">
</div>
@if (Utils.GetSetting("SystemSetting:AdminLoginWithCode") == "1")
{
<div class="form-group input-group">
<input type="text" name="code" id="code" class="form-control" placeholder="验证码" required="">
<span class="input-group-addon" style="padding:0px;">
<img src="~/VerifyCode/MixVerifyCode" onclick="this.src='/VerifyCode/MixVerifyCode?'+Math.random()" style="cursor:pointer;" />
</span>
</div>
}
<button type="submit" class="btn btn-primary block full-width m-b">登 录</button>
<p class="text-muted text-center">
COMCMS © 2014-@DateTime.Now.Year
@@ -3,30 +3,25 @@
ViewBag.title = "后台管理日志";
}
<div class="wrapper wrapper-content ">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>@ViewBag.title</h5>
<div class="ibox-tools">
</div>
</div>
<div class="ibox-content">
<div class="panel panel-default">
<div class="panel-heading">筛选条件</div>
<div class="panel-body">
<form id="formSearch" class="form-horizontal form-inline" onsubmit="doSearch(); return false; ">
<div>
@*<label class="control-label">留言分类:</label>
<select class="form-control" name="kid" id="kid">
<option value="0">所有分类</option>
</select>*@
<label class="control-label">关键字:</label>
<input type="text" placeholder="标题关键字" name="keyword" id="keyword" class="form-control">
<button type="button" style="margin-left:50px" id="btn_query" class="btn btn-primary" onclick="doSearch();">查询</button>
</div>
</form>
<div class="row">
<div class="search-collapse">
<form id="formSearch" onsubmit="return doSearch(); return false;">
<div class="select-list">
<ul>
<li>
关键字:
<input type="text" placeholder="标题关键字" name="keyword" id="keyword">
</li>
<li>
<button type="button" id="btn_query" class="btn btn-primary btn-sm" onclick="doSearch();">查询</button>
</li>
</ul>
</div>
</div>
</form>
</div>
</div>
<div class="ibox float-e-margins">
<div class="ibox-content">
<table id="tb_departments"></table>
<script>
@@ -4,9 +4,6 @@
}
<div class="wrapper wrapper-content">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>@ViewBag.title</h5>
</div>
<div class="ibox-content">
<div id="toolbar" class="btn-group">
<button id="btn_add" type="button" class="btn btn-outline btn-default" onclick="top.showDialog('addadminrole', '添加管理组', '/AdminCP/Member/AddAdminRole', 0, 0)">
@@ -3,34 +3,36 @@
ViewBag.title = "管理员管理";
}
<div class="wrapper wrapper-content ">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>@ViewBag.title</h5>
<div class="ibox-tools">
</div>
</div>
<div class="ibox-content">
<div class="panel panel-default">
<div class="panel-heading">筛选条件</div>
<div class="panel-body">
<form id="formSearch" class="form-horizontal form-inline">
<div>
<label class="control-label">管理组:</label>
<select class="form-control" name="roleid" id="roleid">
<div class="row">
<div class="search-collapse">
<form id="formSearch" onsubmit="return doSearch(); return false;">
<div class="select-list">
<ul>
<li>
管理组:
<select name="roleid" id="roleid">
<option value="0">所有管理组</option>
@foreach (var m in ViewBag.RoleList)
{
<option value="@m.Id">@m.RoleName</option>
}
</select>
<label class="control-label">关键字:</label>
<input type="text" placeholder="用户名关键字" name="keyword" id="keyword" class="form-control">
<button type="button" style="margin-left:50px" id="btn_query" class="btn btn-primary" onclick="doSearch();">查询</button>
</div>
</form>
</li>
<li>
关键字:
<input type="text" placeholder="标题关键字" name="keyword" id="keyword">
</li>
<li>
<button type="button" id="btn_query" class="btn btn-primary btn-sm" onclick="doSearch();">查询</button>
</li>
</ul>
</div>
</div>
</form>
</div>
</div>
<div class="ibox float-e-margins">
<div class="ibox-content">
<div id="toolbar" class="btn-group">
<button id="btn_add" type="button" class="btn btn-outline btn-default" onclick="top.showDialog('addadmins', '添加管理员', '/AdminCP/Member/AddAdmin', 0, 0)">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
@@ -4,9 +4,6 @@
}
<div class="wrapper wrapper-content ">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>@ViewBag.Title</h5>
</div>
<div class="ibox-content">
<div id="toolbar" class="btn-group">
<button id="btn_add" type="button" class="btn btn-outline btn-default" onclick="top.showDialog('addmemberrole', '添加用户组', '/AdminCP/Member/AddMemberRole', 0, 0)">
@@ -3,34 +3,36 @@
ViewBag.title = "用户管理";
}
<div class="wrapper wrapper-content">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>@ViewBag.Title</h5>
<div class="ibox-tools">
</div>
</div>
<div class="ibox-content">
<div class="panel panel-default">
<div class="panel-heading">筛选条件</div>
<div class="panel-body">
<form id="formSearch" class="form-horizontal form-inline">
<div>
<label class="control-label">用户组:</label>
<select class="form-control" name="roleid" id="roleid">
<div class="row">
<div class="search-collapse">
<form id="formSearch" onsubmit="return doSearch(); return false;">
<div class="select-list">
<ul>
<li>
用户组:
<select name="roleid" id="roleid">
<option value="0">所有用户组</option>
@foreach (var m in ViewBag.RoleList)
{
<option value="@m.Id">@m.RoleName</option>
}
</select>
<label class="control-label">关键字:</label>
<input type="text" placeholder="用户名关键字" name="keyword" id="keyword" class="form-control">
<button type="button" style="margin-left:50px" id="btn_query" class="btn btn-primary" onclick="doSearch();">查询</button>
</div>
</form>
</li>
<li>
关键字:
<input type="text" placeholder="标题关键字" name="keyword" id="keyword">
</li>
<li>
<button type="button" id="btn_query" class="btn btn-primary btn-sm" onclick="doSearch();">查询</button>
</li>
</ul>
</div>
</div>
</form>
</div>
</div>
<div class="ibox float-e-margins">
<div class="ibox-content">
@*<div id="toolbar" class="btn-group">
<button id="btn_add" type="button" class="btn btn-outline btn-default" onclick="top.showDialog('addads', '添加用户', '/AdminCP/Member/AddMember', 0, 0)">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
@@ -4,38 +4,43 @@
}
<div class="wrapper wrapper-content">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>@ViewBag.Title</h5>
<div class="ibox-tools">
</div>
</div>
<div class="ibox-content">
<div class="panel panel-default">
<div class="panel-heading">筛选条件</div>
<div class="panel-body">
<form id="formSearch" class="form-horizontal form-inline" onsubmit="return doSearch();">
<div>
<label class="control-label">订单状态:</label>
<select class="form-control" name="status" id="status">
<div class="row">
<div class="search-collapse">
<form id="formSearch" onsubmit="return doSearch(); return false;">
<div class="select-list">
<ul>
<li>
订单状态:
<select name="status" id="status">
<option value="">不限状态</option>
<option value="未确认">未确认</option>
<option value="已确认">已确认</option>
<option value="已完成">已完成</option>
</select>
<label class="control-label">支付状态:</label>
<select class="form-control" name="paystatus" id="paystatus">
</li>
<li>
支付状态:
<select name="paystatus" id="paystatus">
<option value="">不限状态</option>
<option value="未支付">未支付</option>
<option value="已支付">已支付</option>
</select>
<label class="control-label">关键字:</label>
<input type="text" placeholder="标题关键字" name="keyword" id="keyword" class="form-control">
<button type="button" style="margin-left:50px" id="btn_query" class="btn btn-primary" onclick="doSearch();">查询</button>
</div>
</form>
</li>
<li>
关键字:
<input type="text" placeholder="标题关键字" name="keyword" id="keyword">
</li>
<li>
<button type="button" id="btn_query" class="btn btn-primary btn-sm" onclick="doSearch();">查询</button>
</li>
</ul>
</div>
</div>
</form>
</div>
</div>
<div class="ibox float-e-margins">
<div class="ibox-content">
<table id="tb_departments"></table>
<script>
@@ -4,33 +4,45 @@
}
<div class="wrapper wrapper-content">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>@ViewBag.Title</h5>
<div class="ibox-tools">
</div>
</div>
<div class="ibox-content">
<div class="panel panel-default">
<div class="panel-heading">筛选条件</div>
<div class="panel-body">
<form id="formSearch" class="form-horizontal form-inline" onsubmit="return doSearch();">
<div>
<label class="control-label">支付类型:</label>
<select class="form-control" name="mytype" id="mytype">
<div class="row">
<div class="search-collapse">
<form id="formSearch" onsubmit="return doSearch(); return false;">
<div class="select-list">
<ul>
<li>
支付类型:
<select name="mytype" id="mytype">
<option value="0">不限状态</option>
<option value="1">商品订单</option>
<option value="2">快餐订单</option>
<option value="3">酒店预定</option>
<option value="99" selected>代理商认证费订单</option>
</select>
<label class="control-label">关键字:</label>
<input type="text" placeholder="标题关键字" name="keyword" id="keyword" class="form-control">
<button type="button" style="margin-left:50px" id="btn_query" class="btn btn-primary" onclick="doSearch();">查询</button>
</div>
</form>
</li>
<li>
支付状态:
<select name="paystatus" id="paystatus">
<option value="">不限状态</option>
<option value="未支付">未支付</option>
<option value="已支付">已支付</option>
</select>
</li>
<li>
关键字:
<input type="text" placeholder="标题关键字" name="keyword" id="keyword">
</li>
<li>
<button type="button" id="btn_query" class="btn btn-primary btn-sm" onclick="doSearch();">查询</button>
</li>
</ul>
</div>
</div>
</form>
</div>
</div>
<div class="ibox float-e-margins">
<div class="ibox-content">
<table id="tb_departments"></table>
<script>
@@ -54,7 +66,8 @@
limit: params.limit, //页面大小
page: (params.offset / params.limit) + 1, //页码
mytype: $("#mytype").val(),
keyword: $("#keyword").val()
keyword: $("#keyword").val(),
paystatus: $("#paystatus").val()
};
return temp;
}
@@ -165,7 +178,7 @@
limit: params.limit, //页面大小
page: (params.offset / params.limit) + 1, //页码
mytype: $("#mytype").val(),
departmentname: $("#keyword").val()
paystatus: $("#paystatus").val()
};
return temp;
};
@@ -4,9 +4,6 @@
}
<div class="wrapper wrapper-content ">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>@ViewBag.title</h5>
</div>
<div class="ibox-content">
<div id="toolbar" class="btn-group">
<button id="btn_add" type="button" class="btn btn-outline btn-default" onclick="showAddRow();">
@@ -3,34 +3,36 @@
ViewBag.title = "广告管理";
}
<div class="wrapper wrapper-content ">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>@ViewBag.title</h5>
<div class="ibox-tools">
</div>
</div>
<div class="ibox-content">
<div class="panel panel-default">
<div class="panel-heading">筛选条件</div>
<div class="panel-body">
<form id="formSearch" class="form-horizontal form-inline">
<div>
<label class="control-label">广告分类:</label>
<select class="form-control" name="kid" id="kid">
<div class="row">
<div class="search-collapse">
<form id="formSearch" onsubmit="return doSearch(); return false;">
<div class="select-list">
<ul>
<li>
广告分类:
<select name="kid" id="kid">
<option value="0">所有栏目</option>
@foreach (var m in ViewBag.ListKinds)
{
<option value="@m.Id">@m.KindName</option>
}
</select>
<label class="control-label">关键字:</label>
<input type="text" placeholder="标题关键字" name="keyword" id="keyword" class="form-control">
<button type="button" style="margin-left:50px" id="btn_query" class="btn btn-primary" onclick="doSearch();">查询</button>
</div>
</form>
</li>
<li>
关键字:
<input type="text" placeholder="标题关键字" name="keyword" id="keyword">
</li>
<li>
<button type="button" id="btn_query" class="btn btn-primary btn-sm" onclick="doSearch();">查询</button>
</li>
</ul>
</div>
</div>
</form>
</div>
</div>
<div class="ibox float-e-margins">
<div class="ibox-content">
<div id="toolbar" class="btn-group">
<button id="btn_add" type="button" class="btn btn-outline btn-default" onclick="top.showDialog('addads','添加广告','/AdminCP/Other/AddAds',0,0)">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
@@ -5,9 +5,6 @@
}
<div class="wrapper wrapper-content">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>@ViewBag.title</h5>
</div>
<div class="ibox-content">
<div id="toolbar" class="btn-group">
<button id="btn_add" type="button" class="btn btn-outline btn-default" onclick="showAddRow();">
@@ -3,34 +3,36 @@
ViewBag.title = "友情链接管理";
}
<div class="wrapper wrapper-content">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>@ViewBag.title</h5>
<div class="ibox-tools">
</div>
</div>
<div class="ibox-content">
<div class="panel panel-default">
<div class="panel-heading">筛选条件</div>
<div class="panel-body">
<form id="formSearch" class="form-horizontal form-inline">
<div>
<label class="control-label">友情链接分类:</label>
<select class="form-control" name="kid" id="kid">
<div class="row">
<div class="search-collapse">
<form id="formSearch" onsubmit="return doSearch(); return false;">
<div class="select-list">
<ul>
<li>
友情链接分类:
<select name="kid" id="kid">
<option value="0">所有分类</option>
@foreach (var m in ViewBag.ListKinds)
{
<option value="@m.Id">@m.KindName</option>
}
</select>
<label class="control-label">关键字:</label>
<input type="text" placeholder="标题关键字" name="keyword" id="keyword" class="form-control">
<button type="button" style="margin-left:50px" id="btn_query" class="btn btn-primary">查询</button>
</div>
</form>
</li>
<li>
关键字:
<input type="text" placeholder="标题关键字" name="keyword" id="keyword">
</li>
<li>
<button type="button" id="btn_query" class="btn btn-primary btn-sm" onclick="doSearch();">查询</button>
</li>
</ul>
</div>
</div>
</form>
</div>
</div>
<div class="ibox float-e-margins">
<div class="ibox-content">
<div id="toolbar" class="btn-group">
<button id="btn_add" type="button" class="btn btn-outline btn-default" onclick="top.showDialog('addads', '添加友情链接', '/AdminCP/Other/AddLink', 0, 0)">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
@@ -50,6 +52,21 @@
oButtonInit.Init();
});
function doSearch() {
var params = $('#tb_departments').bootstrapTable('getOptions');
//console.log(params);
params.queryParams = function (params) {
var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
limit: params.limit, //页面大小
page: (params.offset / params.limit) + 1, //页码
kid: $("#kid").val(),
keyword: $("#keyword").val(),
};
return temp;
}
$('#tb_departments').bootstrapTable('refresh', params);
}
var TableInit = function () {
var oTableInit = new Object();
//初始化Table
@@ -68,7 +85,7 @@
pageNumber: 1, //初始化加载第一页,默认第一页
pageSize: 25, //每页的记录行数(*)
pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
search: true, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
strictSearch: true,
showColumns: true, //是否显示所有的列
showRefresh: true, //是否显示刷新按钮
@@ -113,7 +130,7 @@
limit: params.limit, //页面大小
page: (params.offset / params.limit) + 1, //页码
kid:$("#kid").val(),
departmentname: $("#keyword").val()
keyword: $("#keyword").val()
};
return temp;
};
@@ -33,7 +33,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">禁用:</label>
<div class="col-sm-8">
<label>
<label class="checkbox-inline i-checks">
<input type="checkbox" value="1" name="IsDisable" id="IsDisable"> 禁用
</label>
</div>
@@ -4,9 +4,6 @@
}
<div class="wrapper wrapper-content">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>@ViewBag.title</h5>
</div>
<div class="ibox-content">
<div id="toolbar" class="btn-group">
<button id="btn_add" type="button" class="btn btn-outline btn-default" onclick="showDialog('addadminmenu','添加后台菜单','/AdminCP/Permission/AddAdminMenu',0,0);">
@@ -19,7 +16,7 @@
<span class="fa fa-refresh" aria-hidden="true"></span>刷新
</button>
</div>
<table class="tree table table-striped table-bordered">
<table class="tree table table-striped table-bordered table-hover">
<thead>
<tr>
<th>菜单名称</th>
@@ -51,7 +48,11 @@
<td class="text-center">
@if (m.IsHide == 1)
{
<i class="fa fa-eye-slash"></i>
<i class="fa fa-eye-slash text-danger" style="cursor:pointer" onclick="doChangeHide(@(m.Id))" title="点击取消隐藏该菜单"></i>
}
else
{
<i class="fa fa-eye text-success" style="cursor:pointer" onclick="doChangeHide(@(m.Id))" title="点击隐藏该菜单"></i>
}
</td>
<td>
@@ -72,6 +73,30 @@
$(document).ready(function () {
$('.tree').treegrid();
});
function doChangeHide(id) {
var loading = layer.load(0, {
shade: [0.2, '#000'] //0.1透明度的背景
});
$.ajax({
type: "POST",
url: "/AdminCP/Permission/DoChangeAdminMenuHide",
data: { id: id },
dataType: "JSON",
success: function (data) {
if (data.status == "success") {
layer.close(loading);
window.location.href = window.location.href;
} else {
layer.close(loading);
layer.alert(data.message, { icon: 2 });
}
},
error: function () {
layer.close(loading);
layer.alert('执行错误,请联系管理员!', { icon: 2 });
}
});
}
</script>
</div>
</div>
@@ -0,0 +1,56 @@
@model TargetEvent
@{
ViewBag.title = "查看/编辑权限事件";
}
<div class="wrapper wrapper-content">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>@(ViewBag.title)</h5>
<div class="ibox-tools">
</div>
</div>
<div class="ibox-content">
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "editEventKeyForm", @class = "form-horizontal m-t" }))
{
<div class="form-group">
<label class="col-sm-3 control-label">事件key:</label>
<div class="col-sm-8">
<input id="EventKey" name="EventKey" minlength="2" maxlength="50" type="text" class="form-control" required aria-required="true" value="@Model.EventKey">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">事件名称:</label>
<div class="col-sm-8">
<input id="EventName" type="text" class="form-control" name="EventName" required aria-required="true" value="@Model.EventName">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">排序:</label>
<div class="col-sm-8">
<input id="Rank" type="number" class="form-control" name="Rank" value="@Model.Rank" required aria-required="true">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">禁用:</label>
<div class="col-sm-8">
<label class="checkbox-inline i-checks">
<input type="checkbox" value="1" name="IsDisable" id="IsDisable" @(Model.IsDisable == 1 ? "checked" : "")> 禁用
</label>
</div>
</div>
<div class="form-group">
<div class="col-sm-4 col-sm-offset-3">
<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 提交 </button>
<button class="btn btn-default" type="button" onclick="closethisdialog();"><i class="fa fa-close"></i> 取消 </button>
</div>
</div>
}
</div>
</div>
</div>
<script>
$(function () {
DoPost("editEventKeyForm");
})
</script>
@@ -1,25 +1,24 @@
<div class="wrapper wrapper-content">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>权限事件管理</h5>
</div>
<div class="ibox-content">
<div class="panel panel-default">
<div class="panel-heading">查询条件</div>
<div class="panel-body">
<form id="formSearch" class="form-horizontal">
<div class="form-group" style="margin-top:15px">
<label class="control-label col-sm-1" for="txt_search_departmentname">权限名称</label>
<div class="col-sm-3">
<input type="text" class="form-control" id="keyword">
</div>
<div class="col-sm-4" style="text-align:left;">
<button type="button" style="margin-left:50px" id="btn_query" class="btn btn-primary">查询</button>
</div>
</div>
</form>
<div class="row">
<div class="search-collapse">
<form id="formSearch" onsubmit="return doSearch(); return false;">
<div class="select-list">
<ul>
<li>
关键字:
<input type="text" placeholder="标题关键字" name="keyword" id="keyword">
</li>
<li>
<button type="button" id="btn_query" class="btn btn-primary btn-sm" onclick="doSearch();">查询</button>
</li>
</ul>
</div>
</div>
</form>
</div>
</div>
<div class="ibox float-e-margins">
<div class="ibox-content">
<div id="toolbar" class="btn-group">
<button id="btn_add" type="button" class="btn btn-outline btn-default" onclick="top.showDialog('addventkey','添加权限','/AdminCP/Permission/AddEventKey',0,0)">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
@@ -69,8 +68,6 @@
cardView: false, //是否显示详细视图
detailView: false, //是否显示父子表
columns: [{
checkbox: true
}, {
field: 'EventName',
title: '事件名称'
}, {
@@ -81,8 +78,22 @@
title: '排序'
}, {
field: 'IsDisable',
title: '是否禁用'
}, ]
title: '是否禁用',
formatter: function (value, row, index) {
if (value == 0) {
return '<span class="label label-primary">启用</span>';
} else {
return '<span class="label label-danger">禁用</span>';
}
}
},
{
field: 'Id',
title: '操作',
formatter: 'actionFormatter',
width: 140
}
]
});
};
@@ -97,7 +108,12 @@
};
return oTableInit;
};
function actionFormatter(value, row, index) {
return [
'<a href="javascript:;" class="btn btn-xs btn-primary" title="编辑" onclick="top.showDialog(\'eidtEventKey\', \'编辑事件权限详情\', \'/AdminCP/Permission/EditEventKey/' + value + '\', 0, 0)"><i class="fa fa-edit"></i> 编辑</a>',
'<a href="javascript:;" class="btn btn-xs btn-danger m-l-xs" title="删除" onclick="doDel(\'/AdminCP/Permission/DelEventKey\',' + value + ');"><i class="fa fa-close"></i> 删除</a>',
].join('');
}
var ButtonInit = function () {
var oInit = new Object();

Some files were not shown because too many files have changed in this diff Show More