initial crm server
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
package models
|
||||
|
||||
// 分页参数模型
|
||||
type Page struct {
|
||||
PageNum int `form:"pageNum" json:"pageNum"`
|
||||
PageSize int `form:"pageSize" json:"pageSize"`
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"database/sql/driver"
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
type Contract struct {
|
||||
Id int64 `gorm:"primaryKey"`
|
||||
Name string `gorm:"name"`
|
||||
Amount float64 `gorm:"amount"`
|
||||
BeginTime string `gorm:"begin_time"`
|
||||
OverTime string `gorm:"over_time"`
|
||||
Remarks string `gorm:"remarks"`
|
||||
Cid int64 `gorm:"cid"`
|
||||
Productlist *Productlist `gorm:"type:json"`
|
||||
Status int `gorm:"status"`
|
||||
Creator int64 `gorm:"creator"`
|
||||
Created int64 `gorm:"created"`
|
||||
Updated int64 `gorm:"updated"`
|
||||
}
|
||||
|
||||
type ContractCreateParam struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Amount float64 `json:"amount,omitempty"`
|
||||
BeginTime string `json:"beginTime,omitempty"`
|
||||
OverTime string `json:"overTime,omitempty"`
|
||||
Remarks string `json:"remarks,omitempty"`
|
||||
Cid int64 `json:"cid,omitempty"`
|
||||
Productlist *Productlist `json:"productlist,omitempty"`
|
||||
Status int `json:"status,omitempty"`
|
||||
Creator int64 `json:"creator,omitempty"`
|
||||
}
|
||||
|
||||
type ContractUpdateParam struct {
|
||||
Id int64 `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Amount float64 `json:"amount,omitempty"`
|
||||
BeginTime string `json:"beginTime,omitempty"`
|
||||
OverTime string `json:"overTime,omitempty"`
|
||||
Remarks string `json:"remarks,omitempty"`
|
||||
Cid int64 `json:"cid,omitempty"`
|
||||
Productlist *Productlist `json:"productlist,omitempty"`
|
||||
Status int `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
type ContractDeleteParam struct {
|
||||
Ids []int64 `json:"ids,omitempty"`
|
||||
}
|
||||
|
||||
type ContractQueryParam struct {
|
||||
Id int64 `form:"id,omitempty"`
|
||||
Name string `form:"name,omitempty"`
|
||||
Creator int64 `form:"creator,omitempty"`
|
||||
Page Page
|
||||
}
|
||||
|
||||
type ContractList struct {
|
||||
Id int64 `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Amount float64 `json:"amount,omitempty"`
|
||||
BeginTime string `json:"beginTime,omitempty"`
|
||||
OverTime string `json:"overTime,omitempty"`
|
||||
Remarks string `json:"remarks,omitempty"`
|
||||
Cname string `json:"cname,omitempty"`
|
||||
Status int `json:"status,omitempty"`
|
||||
Created int64 `json:"created,omitempty"`
|
||||
Updated int64 `json:"updated,omitempty"`
|
||||
}
|
||||
|
||||
type ContractInfo struct {
|
||||
Id int64 `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Cid int64 `json:"cid,omitempty"`
|
||||
Amount float64 `json:"amount,omitempty"`
|
||||
BeginTime string `json:"beginTime,omitempty"`
|
||||
OverTime string `json:"overTime,omitempty"`
|
||||
Remarks string `json:"remarks,omitempty"`
|
||||
Productlist *Productlist `json:"productlist,omitempty"`
|
||||
Status int `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
type Products struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Type int `json:"type"`
|
||||
Unit string `json:"unit"`
|
||||
Price float64 `json:"price"`
|
||||
Count int `json:"count"`
|
||||
Total float64 `json:"total"`
|
||||
}
|
||||
|
||||
type Productlist []*Products
|
||||
|
||||
func (p *Productlist) Value() (driver.Value, error) {
|
||||
b, err := json.Marshal(p)
|
||||
return string(b), err
|
||||
}
|
||||
|
||||
func (p *Productlist) Scan(src any) error {
|
||||
return json.Unmarshal(src.([]byte), p)
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package models
|
||||
|
||||
type Customer struct {
|
||||
Id int64 `gorm:"primaryKey"`
|
||||
Name string `gorm:"name"`
|
||||
Source string `gorm:"source"`
|
||||
Phone string `gorm:"phone"`
|
||||
Email string `gorm:"email"`
|
||||
Industry string `gorm:"industry"`
|
||||
Level string `gorm:"level"`
|
||||
Remarks string `gorm:"remarks"`
|
||||
Region string `gorm:"region"`
|
||||
Address string `gorm:"address"`
|
||||
Status int `gorm:"status"`
|
||||
Creator int64 `gorm:"creator"`
|
||||
Created int64 `gorm:"created"`
|
||||
Updated int64 `gorm:"updated"`
|
||||
}
|
||||
|
||||
type CustomerCreateParam struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Source string `json:"source,omitempty"`
|
||||
Phone string `json:"phone,omitempty"`
|
||||
Email string `json:"email,omitempty"`
|
||||
Industry string `json:"industry,omitempty"`
|
||||
Level string `json:"level,omitempty"`
|
||||
Remarks string `json:"remarks,omitempty"`
|
||||
Region string `json:"region,omitempty"`
|
||||
Address string `json:"address,omitempty"`
|
||||
Status int `json:"status,omitempty"`
|
||||
Creator int64 `json:"creator,omitempty"`
|
||||
}
|
||||
|
||||
type CustomerUpdateParam struct {
|
||||
Id int64 `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Source string `json:"source,omitempty"`
|
||||
Phone string `json:"phone,omitempty"`
|
||||
Email string `json:"email,omitempty"`
|
||||
Industry string `json:"industry,omitempty"`
|
||||
Level string `json:"level,omitempty"`
|
||||
Remarks string `json:"remarks,omitempty"`
|
||||
Region string `json:"region,omitempty"`
|
||||
Address string `json:"address,omitempty"`
|
||||
Status int `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
type CustomerDeleteParam struct {
|
||||
Ids []int64 `json:"ids,omitempty"`
|
||||
}
|
||||
|
||||
type CustomerQueryParam struct {
|
||||
Id int64 `form:"id,omitempty"`
|
||||
Name string `form:"name,omitempty"`
|
||||
Phone string `form:"phone,omitempty"`
|
||||
Creator int64 `form:"creator"`
|
||||
Page Page
|
||||
}
|
||||
|
||||
type CustomerList struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Source string `json:"source"`
|
||||
Phone string `json:"phone"`
|
||||
Email string `json:"email"`
|
||||
Industry string `json:"industry"`
|
||||
Level string `json:"level"`
|
||||
Remarks string `json:"remarks"`
|
||||
Region string `json:"region"`
|
||||
Address string `json:"address"`
|
||||
Status int `json:"status"`
|
||||
Created int64 `json:"created"`
|
||||
Updated int64 `json:"updated"`
|
||||
}
|
||||
|
||||
type CustomerInfo struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Source string `json:"source"`
|
||||
Phone string `json:"phone"`
|
||||
Email string `json:"email"`
|
||||
Industry string `json:"industry"`
|
||||
Level string `json:"level"`
|
||||
Remarks string `json:"remarks"`
|
||||
Region string `json:"region"`
|
||||
Address string `json:"address"`
|
||||
Status int `json:"status"`
|
||||
}
|
||||
|
||||
type CustomerOption struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package models
|
||||
|
||||
type DashboardSum struct {
|
||||
Customers int `json:"customers"`
|
||||
Contracts int `json:"contracts"`
|
||||
ContractAmount float64 `json:"contractAmount"`
|
||||
Products int `json:"products"`
|
||||
Date [7]string `json:"date"`
|
||||
Amount [7]float64 `json:"amount"`
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package models
|
||||
|
||||
type Product struct {
|
||||
Id int64 `gorm:"primaryKey"`
|
||||
Name string `gorm:"name"`
|
||||
Type int `gorm:"type"`
|
||||
Unit string `gorm:"unit"`
|
||||
Code string `gorm:"code"`
|
||||
Price float64 `gorm:"price"`
|
||||
Description string `gorm:"description"`
|
||||
Status int `gorm:"status"`
|
||||
Creator int64 `gorm:"creator"`
|
||||
Created int64 `gorm:"created"`
|
||||
Updated int64 `gorm:"updated"`
|
||||
}
|
||||
|
||||
type ProductCreateParam struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Type int `json:"type,omitempty"`
|
||||
Unit string `json:"unit,omitempty"`
|
||||
Code string `json:"code,omitempty"`
|
||||
Price float64 `json:"price,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Status int `json:"status,omitempty"`
|
||||
Creator int64 `json:"creator,omitempty"`
|
||||
}
|
||||
|
||||
type ProductUpdateParam struct {
|
||||
Id int64 `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Type int `json:"type,omitempty"`
|
||||
Unit string `json:"unit,omitempty"`
|
||||
Code string `json:"code,omitempty"`
|
||||
Price float64 `json:"price,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Status int `json:"status,omitempty"`
|
||||
Creator int64 `json:"creator,omitempty"`
|
||||
}
|
||||
|
||||
type ProductDeleteParam struct {
|
||||
Ids []int64 `json:"ids,omitempty"`
|
||||
}
|
||||
|
||||
type ProductQueryParam struct {
|
||||
Id int64 `form:"id,omitempty"`
|
||||
Ids []int64 `form:"ids,omitempty"`
|
||||
Name string `form:"name,omitempty"`
|
||||
Status int `form:"status,omitempty"`
|
||||
Creator int64 `form:"creator,omitempty"`
|
||||
Page Page
|
||||
}
|
||||
|
||||
type ProductList struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Type int `json:"type"`
|
||||
Unit string `json:"unit"`
|
||||
Code string `json:"code"`
|
||||
Price float64 `json:"price"`
|
||||
Description string `json:"description"`
|
||||
Status int `json:"status"`
|
||||
Created int64 `json:"created"`
|
||||
Updated int64 `json:"updated"`
|
||||
}
|
||||
|
||||
type ProductInfo struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Type int `json:"type"`
|
||||
Unit string `json:"unit"`
|
||||
Code string `json:"code"`
|
||||
Price float64 `json:"price"`
|
||||
Description string `json:"description"`
|
||||
Status int `json:"status"`
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package models
|
||||
|
||||
type User struct {
|
||||
Id int64 `gorm:"primaryKey"`
|
||||
Email string `gorm:"email"`
|
||||
Password string `gorm:"password"`
|
||||
Name string `gorm:"name"`
|
||||
Version int `gorm:"version"`
|
||||
Expired int64 `gorm:"expired"`
|
||||
Status int `gorm:"status"`
|
||||
Created int64 `gorm:"created"`
|
||||
Updated int64 `gorm:"updated"`
|
||||
}
|
||||
|
||||
type UserCreateParam struct {
|
||||
Email string `json:"email"`
|
||||
Code string `json:"code"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
||||
type UserUpdateParam struct {
|
||||
Id int64 `json:"id"`
|
||||
Email string `json:"email"`
|
||||
Password string `json:"password"`
|
||||
Status int `json:"status"`
|
||||
}
|
||||
|
||||
type UserDeleteParam struct {
|
||||
Id int64 `json:"id"`
|
||||
Email string `json:"email"`
|
||||
Code string `json:"code"`
|
||||
}
|
||||
|
||||
type UserLoginParam struct {
|
||||
Email string `json:"email"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
||||
type UserPassParam struct {
|
||||
Email string `json:"email"`
|
||||
Code string `json:"code"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
||||
type UserMailParam struct {
|
||||
Email string `json:"email"`
|
||||
Code string `json:"code"`
|
||||
NewEmail string `json:"newEmail"`
|
||||
}
|
||||
|
||||
type UserInfo struct {
|
||||
Uid int64 `json:"uid"`
|
||||
Ver int `json:"version"`
|
||||
Token string `json:"token"`
|
||||
}
|
||||
|
||||
type UserPersonInfo struct {
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
Version int `json:"version"`
|
||||
Expired int64 `json:"expired"`
|
||||
}
|
||||
|
||||
type UserVerisonInfo struct {
|
||||
Version int `json:"version"`
|
||||
Expired int64 `json:"expired"`
|
||||
}
|
||||
Reference in New Issue
Block a user