liujiandao
2023-10-17 93714edf943addbded3bccf1c76d1b53f46fc349
Merge branch 'master' of http://192.168.5.5:10010/r/aps/crm
6个文件已修改
77 ■■■■■ 已修改文件
conf/aps-crm.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/clientStatus.go 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/index.go 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/receipt.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/saleStage.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/salesSources.go 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
conf/aps-crm.json
@@ -14,7 +14,7 @@
    "encoder": "console"
  },
  "mysql": {
    "dsn": "root:c++java123@tcp(192.168.20.119:3306)/aps_crm?charset=utf8&parseTime=True&loc=Local",
    "dsn": "root:c++java123@tcp(192.168.20.119:3306)/crm?charset=utf8&parseTime=True&loc=Local",
    "host": "%",
    "logMode": true,
    "maxIdleCon": 50,
model/clientStatus.go
@@ -3,6 +3,7 @@
import (
    "aps_crm/pkg/mysqlx"
    "gorm.io/gorm"
    "sync"
)
type (
@@ -91,3 +92,37 @@
    var db = slf.build()
    return db.Updates(values).Error
}
func (slf *ClientStatusSearch) CreateBatch(records []*ClientStatus) error {
    var db = slf.build()
    return db.Create(records).Error
}
// InitDefaultData 初始化数据
func (slf *ClientStatusSearch) InitDefaultData(errCh chan<- error, wg *sync.WaitGroup) {
    var (
        db          = slf.Orm.Table(slf.TableName())
        total int64 = 0
    )
    defer wg.Done()
    if err := db.Count(&total).Error; err != nil {
        errCh <- err
        return
    }
    if total != 0 {
        return
    }
    records := []*ClientStatus{
        {1, "初期沟通"},
        {2, "需求分析"},
        {3, "方案报价"},
        {4, "商务谈判"},
        {5, "成功结案"},
    }
    err := slf.CreateBatch(records)
    if err != nil {
        errCh <- err
        return
    }
}
model/index.go
@@ -125,6 +125,8 @@
        NewRepositorySearch(),
        NewSaleStageSearch(),
        NewQuotationStatusSearch(),
        NewSalesSourcesSearch(),
        NewClientStatusSearch(),
    }
    for _, model := range models {
model/request/receipt.go
@@ -18,5 +18,5 @@
    PageInfo
    SourceType constvar.ReceiptSourceType `json:"sourceType" form:"sourceType"` //来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单)
    SourceId   int                        `json:"sourceId" form:"sourceId"`
    ClientId   int                        `json:"clientId"` //客户id
    ClientId   int                        `json:"clientId"  form:"clientId"` //客户id
}
model/saleStage.go
@@ -111,7 +111,7 @@
        {2, "需求分析"},
        {3, "商务谈判"},
        {4, "成功关闭"},
        {4, "成功结案"},
        {5, "成功结案"},
    }
    err := slf.CreateBatch(records)
    if err != nil {
model/salesSources.go
@@ -3,6 +3,7 @@
import (
    "aps_crm/pkg/mysqlx"
    "gorm.io/gorm"
    "sync"
)
type (
@@ -84,3 +85,36 @@
    var db = slf.build()
    return db.Updates(data).Error
}
func (slf *SalesSourcesSearch) CreateBatch(records []*SalesSources) error {
    var db = slf.build()
    return db.Create(records).Error
}
// InitDefaultData 初始化数据
func (slf *SalesSourcesSearch) InitDefaultData(errCh chan<- error, wg *sync.WaitGroup) {
    var (
        db          = slf.Orm.Table(slf.TableName())
        total int64 = 0
    )
    defer wg.Done()
    if err := db.Count(&total).Error; err != nil {
        errCh <- err
        return
    }
    if total != 0 {
        return
    }
    records := []*SalesSources{
        {1, "电话来访"},
        {2, "公司分配"},
        {3, "客户介绍"},
        {4, "独立开发"},
    }
    err := slf.CreateBatch(records)
    if err != nil {
        errCh <- err
        return
    }
}