2022-11-28 16:38:30 +08:00
|
|
|
package service
|
|
|
|
|
|
|
|
|
|
import (
|
2023-01-28 21:17:31 +08:00
|
|
|
"crm/dao"
|
2022-12-17 20:47:35 +08:00
|
|
|
"crm/response"
|
2022-11-28 16:38:30 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
|
|
|
|
|
// 数据库表名
|
2022-12-16 20:35:24 +08:00
|
|
|
USER = "user"
|
|
|
|
|
CUSTOMER = "customer"
|
|
|
|
|
CONTRACT = "contract"
|
|
|
|
|
PRODUCT = "product"
|
|
|
|
|
SUBSCRIBE = "subscribe"
|
2023-01-02 11:00:29 +08:00
|
|
|
NOTICE = "notice"
|
2022-12-16 20:35:24 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
NumberNull = 0
|
|
|
|
|
StringNull = ""
|
2022-11-28 16:38:30 +08:00
|
|
|
)
|
|
|
|
|
|
2022-12-17 20:47:35 +08:00
|
|
|
const (
|
|
|
|
|
Dev = "dev"
|
|
|
|
|
Prod = "prod"
|
|
|
|
|
)
|
|
|
|
|
|
2023-01-02 11:00:29 +08:00
|
|
|
const (
|
|
|
|
|
REGISTER_NOTICE_TEMPLATE = "你注册了账号"
|
|
|
|
|
LOGIN_NOTICE_TEMPLATE = "你登录了账号"
|
|
|
|
|
SUBSCRIBE_NOTICE_TEMPLATE1 = "你订阅了专业版"
|
|
|
|
|
SUBSCRIBE_NOTICE_TEMPLATE2 = "你订阅了高级版"
|
|
|
|
|
)
|
|
|
|
|
|
2023-01-28 21:17:31 +08:00
|
|
|
type CommonService struct {
|
|
|
|
|
commonDao *dao.CommonDao
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func NewCommonService() *CommonService {
|
|
|
|
|
return &CommonService{
|
|
|
|
|
commonDao: dao.NewCommonDao(),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 初始化数据库
|
|
|
|
|
func (c *CommonService) InitDatabase() int {
|
|
|
|
|
if err := c.commonDao.InitDatabase(); err != nil {
|
|
|
|
|
return response.ErrCodeInitDataFailed
|
2022-12-17 20:47:35 +08:00
|
|
|
}
|
|
|
|
|
return response.ErrCodeSuccess
|
|
|
|
|
}
|