You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
2.7 KiB
Markdown

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# HCRM (.NET 8)
康策 CRM 新一代后端,登录机制对齐 hcrm4。
## 项目结构
```
D:\anzb\hcrm14\
hcrm.sln
src\
Hcrm.Api 表现层Controller、Filter、Cookie/Session、验证码图
Hcrm.Application 应用层AccountService 等业务
Hcrm.Core 核心层实体、DTO、接口契约、工具
Hcrm.Infrastructure 基础设施SqlSugar 仓储实现
```
依赖方向:`Api → Application → Core``Api → Infrastructure → Core`(组合根在 Api 的 Program.cs
## 配置数据库
编辑 `src/Hcrm.Api/appsettings.json`,将连接串改为与 hcrm4 相同的库:
```json
"ConnectionStrings": {
"DBContainer": "Server=.;Database=KHCRM;User Id=sa;Password=你的密码;TrustServerCertificate=True"
}
```
## 运行
```powershell
cd D:\anzb\hcrm14
dotnet build
dotnet run --project src\Hcrm.Api\Hcrm.Api.csproj
```
浏览器访问:`https://localhost:7xxx/login/index.html` 或根路径 `/`(端口见 `src/Hcrm.Api/Properties/launchSettings.json`)。登录成功后进入 `wwwroot/shop/index.html`(店铺装修本地页)。
> 使用与 hcrm4 相同的 `tb_Employee` 表及 MD5 密码,可直接用原系统账号登录。
## 登录 API与 hcrm4 兼容)
| 方法 | 路径 | 说明 |
|------|------|------|
| GET | /Account/CheckCodeImage | 验证码图片 Base64 |
| POST | /Account/Login | 用户名+密码+验证码 |
| POST | /Account/LoginByNoCode | 无验证码登录 |
| POST | /Account/IsLogin | 校验会话,未登录返回 status=401 |
| POST | /Account/WXLogOut | 退出 |
| POST | /Account/ModifyPwd | 修改密码(需登录) |
Cookie 名:`kc_cookie_token`(与 hcrm4 相同);也可在请求头传 `token` 作为会话键。密码为 MD5 小写 32 位。
JSON 响应格式与 hcrm4 一致:`{ "status": 1, "message": null, "data": { ... } }``data` 内字段为 PascalCase登录成功时 `data` 为 Employee 结构(含完整 `SysConfig` 表字段)。
## 店铺装修(新表,仅后端)
在数据库执行:`scripts/Create_tb_ShopRenovate.sql`(新建 `tb_ShopRenovatePage`、`tb_ShopRenovateStyle`,不影响既有表)。前端暂未对接。
| 方法 | 路径 | 说明 |
|------|------|------|
| GET | /ShopRenovate/GetPageList?pageName= | 页面列表 |
| GET | /ShopRenovate/GetPage?id= | 页面详情 |
| POST | /ShopRenovate/CreatePage | 新增JSON |
| POST | /ShopRenovate/UpdatePage | 保存JSON |
| POST | /ShopRenovate/DeletePage | 删除form: id |
| POST | /ShopRenovate/PublishPage | 发布form: id |
| POST | /ShopRenovate/UnpublishPage | 取消发布form: id |
| GET | /ShopRenovate/GetStyleConfig | 风格配置 |
| POST | /ShopRenovate/SaveStyleConfig | 保存风格JSON |