Commit 78939766 by 朱继来

添加crm初始化领取配置

parent 7845c213
[Crm_domain]
crm_url="http://crmnew.liexindev.net"
send_mail="http://crm.liexin.net/api/sendCaiGouEmailByOrderAdmin"
[Ding_msg]
......
[Crm_domain]
crm_url="http://crm.ichunt.net"
send_mail="http://crm.ichunt.net/api/sendCaiGouEmailByOrderAdmin"
[Ding_msg]
......
......@@ -11,6 +11,12 @@ dns="lie_labels:lie_labels#zsyM@tcp(192.168.1.252:3306)/lie_labels?parseTime=tru
[Liexincms_databases]
dns="ichuntcms:ichuntcms#zsyM@tcp(192.168.1.252:3306)/ichuntcms?parseTime=true"
[Liexincrm_databases]
dns="liexin_crm:liexin_crm#zsyM@tcp(192.168.1.234:3306)/liexin_crm?parseTime=true"
[Liexincrmv2_databases]
dns="liexin_crmv2:liexin_crmv2#zsyM@tcp(192.168.1.234:3306)/liexin_crmv2?parseTime=true"
[Bom_databases]
dns="root:root@tcp(192.168.2.239:3306)/lie_bom?parseTime=true"
......
......@@ -14,6 +14,8 @@ dns="dtuser:dAtaL#ym2902m2lLX2y33@tcp(appdb-master.ichunt.db:3306)/icdata?parseT
[Liexincrm_databases]
dns="LxCrmUser:xUTmu0XsdUqoZIim2y@tcp(172.18.137.21:3306)/liexin_crm?parseTime=true"
[Liexincrmv2_databases]
dns="LxCrmUserV2:xUTmu0XsdUqoZIim2yV2@tcp(192.168.1.234:3306)/liexin_crm?parseTime=true"
[Bom_databases]
dns="BomUserIc:mLssyDxmsymBomy@tcp(172.18.137.21:3306)/liexin_bom?parseTime=true"
......
package main
import (
"flag"
"fmt"
"github.com/ichunt2019/logger"
"go-queue-server/util"
"io/ioutil"
"net/http"
"strings"
)
/**
每月1号,初始化领取配置
*/
var ConfigDir string
var LogDir string
// 解析命令行参数
func initArgs() {
flag.StringVar(&ConfigDir, "configDir", "", "配置文件")
flag.StringVar(&LogDir, "logDir", "", "日志目录")
flag.Parse()
}
func main() {
initArgs()
//初始化配置文件
util.Init(ConfigDir)
logConfig := make(map[string]string)
logConfig["log_path"] = LogDir + "crm/receive_config"
logConfig["log_chan_size"] = "1000"
logger.InitLogger("file", logConfig)
logger.Init()
// crm 初始化领取配置接口
url := util.Configs.Crm_domain.CrmUrl + "/open/initReceiveConfig"
resp, err := http.Post(url, "application/x-www-form-urlencoded", strings.NewReader(""))
if err != nil {
fmt.Println(err.Error())
logger.Error("请求crm初始化领取配置接口失败")
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}
......@@ -6,11 +6,11 @@ import (
)
var (
DB *sqlx.DB
DB *sqlx.DB
LabelDB *sqlx.DB
CmsDB *sqlx.DB
CrmDB *sqlx.DB
BomDB *sqlx.DB
CmsDB *sqlx.DB
CrmDB *sqlx.DB
BomDB *sqlx.DB
OrderDB *sqlx.DB
)
......@@ -30,7 +30,7 @@ func Init(dns string) error {
return nil
}
func InitLabelDB(dns string) error{
func InitLabelDB(dns string) error {
var err error
LabelDB, err = sqlx.Open("mysql", dns)
if err != nil {
......@@ -45,7 +45,7 @@ func InitLabelDB(dns string) error{
LabelDB.SetMaxIdleConns(5)
return nil
}
func InitBomDB(dns string) error{
func InitBomDB(dns string) error {
var err error
BomDB, err = sqlx.Open("mysql", dns)
if err != nil {
......@@ -60,7 +60,7 @@ func InitBomDB(dns string) error{
BomDB.SetMaxIdleConns(5)
return nil
}
func InitOrderDB(dns string) error{
func InitOrderDB(dns string) error {
var err error
OrderDB, err = sqlx.Open("mysql", dns)
if err != nil {
......@@ -75,7 +75,7 @@ func InitOrderDB(dns string) error{
OrderDB.SetMaxIdleConns(5)
return nil
}
func InitCmslDB(dns string) error{
func InitCmslDB(dns string) error {
var err error
CmsDB, err = sqlx.Open("mysql", dns)
if err != nil {
......@@ -91,7 +91,7 @@ func InitCmslDB(dns string) error{
return nil
}
func InitCrmDB(dns string) error{
func InitCrmDB(dns string) error {
var err error
CrmDB, err = sqlx.Open("mysql", dns)
if err != nil {
......@@ -107,22 +107,21 @@ func InitCrmDB(dns string) error{
return nil
}
func CreateDB(action string,dns string) error{
func CreateDB(action, dns string) error {
var err error
switch action {
case "Init":
err = Init(dns)
case "InitLabelDB":
err = InitLabelDB(dns)
case "InitCmsDB":
err = InitCmslDB(dns)
case "InitCrmDB":
err = InitCrmDB(dns)
case "BomDB":
err = InitBomDB(dns)
case "OrderDb":
err = InitOrderDB(dns)
case "Init":
err = Init(dns)
case "InitLabelDB":
err = InitLabelDB(dns)
case "InitCmsDB":
err = InitCmslDB(dns)
case "InitCrmDB":
err = InitCrmDB(dns)
case "BomDB":
err = InitBomDB(dns)
case "OrderDb":
err = InitOrderDB(dns)
}
return err
}
......@@ -19,7 +19,7 @@ type Config struct {
Rabbitmq_order_push_stock *RabbitmqOrderPushStock
Rabbitmq_yaohaoyou *RabbitmqYaoHaoYou
Rabbitmq_bomcreateorder *RabbitmqBomCreateOrder
Crm_domain *SendMail
Crm_domain *CrmDomain
Cms_user_domain *SendUserLoginMail
Ding_msg *Ding
Api_domain *ApiDomain
......@@ -86,8 +86,9 @@ type RabbitmqBomCreateOrder struct {
Dns string `toml:"dns"`
}
type SendMail struct {
type CrmDomain struct {
SendMailUrl string `toml:"send_mail"`
CrmUrl string `toml:"crm_url"`
}
type SendUserLoginMail struct {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment