2026-01-13 18:07:50 +08:00
2026-01-26 11:15:12 +08:00
2026-01-16 18:59:19 +08:00
2026-01-28 20:48:50 +08:00
2026-01-26 11:46:06 +08:00
2026-01-26 11:46:06 +08:00
2026-01-13 18:07:50 +08:00
2026-01-13 18:02:43 +08:00
2026-01-13 18:07:50 +08:00
2026-01-13 18:02:43 +08:00
2026-01-26 11:46:06 +08:00
2026-01-07 17:34:34 +08:00
2026-01-13 18:02:43 +08:00
2026-01-26 11:46:06 +08:00

CRM Customer Management System

A web-based CRM system built with Go backend and HTML/CSS/JavaScript frontend.

Features

  1. Customer Management

    • Create customers with fields: Customer Name, Intended Product
    • Customer list with fields: Time, Customer, Version, Description, Solution, Type, Module, Status & Progress, Reporter (all editable)
    • Import customers from CSV files
  2. Customer Dashboard

    • Visual charts (pie charts, line charts) for data analysis
    • Filter data by date range
    • View customer distribution by status, trends, product interest, and customer types

Technology Stack

  • Backend: Go
  • Frontend: HTML, CSS, JavaScript
  • Charts: Chart.js (via CDN)
  • Data Storage: MySQL数据库默认或本地JSON文件

数据存储

系统支持两种存储模式:

1. MySQL数据库推荐

  1. 创建数据库并执行迁移脚本:

    mysql -u root -p < ./data/migration.sql
    
  2. 配置环境变量:

    export DB_HOST=localhost
    export DB_PORT=3306
    export DB_USER=root
    export DB_PASSWORD=your_password
    export DB_NAME=crm_db
    export STORAGE_MODE=mysql
    

2. JSON文件存储向后兼容

设置环境变量使用JSON存储

export STORAGE_MODE=json

数据将存储在 ./data/ 目录下的JSON文件中。

How to Run

方法一:使用启动脚本

  1. 复制并修改配置文件:

    cp .env.example .env
    # 编辑 .env 文件设置数据库密码等
    
  2. 运行启动脚本:

    ./start.sh
    

方法二:手动启动

  1. 设置环境变量:

    export DB_PASSWORD=your_password
    export STORAGE_MODE=mysql
    
  2. 构建并运行:

    go build -o crm-server ./cmd/server/
    ./crm-server
    
  3. Open your browser and go to:

    http://localhost:8081
    

环境变量说明

变量名 说明 默认值
STORAGE_MODE 存储模式: mysqljson mysql
DB_HOST MySQL主机地址 localhost
DB_PORT MySQL端口 3306
DB_USER MySQL用户名 root
DB_PASSWORD MySQL密码
DB_NAME 数据库名称 crm_db
PORT 服务端口 8081

Usage

Customer Management

  • Click "Customer Management" in the navigation
  • Add new customers using the form
  • Edit existing customers by clicking "Edit" button
  • Delete customers by clicking "Delete" button
  • Import customers from CSV file using the import form

Dashboard

  • Click "Dashboard" in the navigation
  • View various charts showing customer data
  • Filter data by date range

Data Storage

Customer data is stored in ./data/customers.json in JSON format.

File Structure

crm-go/
├── cmd/
│   └── server/
│       └── main.go          # Main application entry point
├── models/
│   └── customer.go          # Customer data models
├── internal/
│   ├── handlers/
│   │   └── customer_handler.go  # HTTP request handlers
│   └── storage/
│       └── customer_storage.go  # Data storage implementation
├── frontend/
│   ├── index.html           # Main HTML page
│   ├── css/
│       └── style.css        # Stylesheet
│   └── js/
│       └── main.js          # Client-side JavaScript
├── data/
│   └── customers.json       # Customer data storage
├── bin/
│   └── server               # Compiled binary
└── go.mod                   # Go module file
Description
这是一个神奇的仓库
Readme 20 MiB
Languages
JavaScript 39.8%
Go 29.4%
HTML 17.8%
CSS 12.2%
Shell 0.8%