|
@@ -35,44 +35,53 @@ var (
|
|
|
middleground *Middleground
|
|
|
allEntity = map[string]Entity{
|
|
|
"yxy": &Yxy{},
|
|
|
- "bi_yllyh": &Common{
|
|
|
- Name: "医疗领域化BI",
|
|
|
- GoodsCode: "special_nosale_goods",
|
|
|
- GoodsSpecId: 14,
|
|
|
- All: map[string]string{"医疗领域化BI": "bi_yllyh"},
|
|
|
- },
|
|
|
- "bi_ldx": &Common{
|
|
|
- Name: "立达信BI分析工具",
|
|
|
- GoodsCode: "special_nosale_goods",
|
|
|
- GoodsSpecId: 15,
|
|
|
- All: map[string]string{"立达信BI分析工具": "bi_ldx"},
|
|
|
- },
|
|
|
- "bi_hnyd_fx": &Common{
|
|
|
- Name: "bi_河南移动_数据分析",
|
|
|
- GoodsCode: "special_nosale_goods",
|
|
|
- GoodsSpecId: 16,
|
|
|
- All: map[string]string{"bi_河南移动_数据分析": "bi_hnyd_fx"},
|
|
|
- },
|
|
|
- "bi_hnyd_gl": &Common{
|
|
|
- Name: "bi_河南移动_数据管理",
|
|
|
- GoodsCode: "special_nosale_goods",
|
|
|
- GoodsSpecId: 17,
|
|
|
- All: map[string]string{"bi_河南移动_数据管理": "bi_hnyd_gl"},
|
|
|
- },
|
|
|
- "ai_helper": &Common{
|
|
|
- Name: "智能助手",
|
|
|
- GoodsCode: "ai_helper",
|
|
|
- GoodsSpecId: 18,
|
|
|
- All: map[string]string{"智能助手": "ai_helper"},
|
|
|
- },
|
|
|
}
|
|
|
+ c *Config
|
|
|
)
|
|
|
|
|
|
+type Config struct {
|
|
|
+ EtcdAddr []string
|
|
|
+ Mongodb struct {
|
|
|
+ Main *mgoConf
|
|
|
+ }
|
|
|
+ Mysql struct {
|
|
|
+ Main *mysqlConf
|
|
|
+ Base *mysqlConf
|
|
|
+ }
|
|
|
+ Products map[string]*Common
|
|
|
+}
|
|
|
+
|
|
|
+type mgoConf struct {
|
|
|
+ Address string
|
|
|
+ Size int
|
|
|
+ DbName string
|
|
|
+ ReplSet string
|
|
|
+ UserName string
|
|
|
+ Password string
|
|
|
+ Collection string
|
|
|
+}
|
|
|
+type mysqlConf struct {
|
|
|
+ DbName string
|
|
|
+ Address string
|
|
|
+ UserName string
|
|
|
+ PassWord string
|
|
|
+ MaxOpenConns int
|
|
|
+ MaxIdleConns int
|
|
|
+}
|
|
|
+
|
|
|
+func init() {
|
|
|
+ ReadConfig(&c)
|
|
|
+}
|
|
|
+
|
|
|
func main() {
|
|
|
+ allT := "yxy:医械云"
|
|
|
+ for k, v := range c.Products {
|
|
|
+ allEntity[k] = v
|
|
|
+ allT += " " + k + ":" + v.Name
|
|
|
+ }
|
|
|
phone := flag.String("p", "", "手机号")
|
|
|
m := flag.Int("m", 0, "1:查询权益 2:开通权益 3:取消权益")
|
|
|
- t := flag.String("t", "", "yxy:医械云 bi_yllyh:医疗领域化BI bi_ldx:立达信BI分析工具 bi_hnyd_fx:河南移动_数据分析 bi_hnyd_gl:河南移动_数据管理 ai_helper:智能助手")
|
|
|
- isProduct := flag.Int("d", 0, "是否是线上环境;0:否 1:是")
|
|
|
+ t := flag.String("t", "", allT)
|
|
|
dayCount := flag.Int("c", 0, "自定义设置需要开通权益的天数,包含今天")
|
|
|
entName := flag.String("n", "", "企业名称")
|
|
|
isCheck := flag.Int("b", 1, "是否前置校验和后置处理")
|
|
@@ -86,63 +95,39 @@ func main() {
|
|
|
log.Fatalln("-t 参数无效")
|
|
|
}
|
|
|
powerType, goodsCode, goodsSpecId, all = entity.init()
|
|
|
- if *isProduct == 1 {
|
|
|
- middleground = NewMiddleground([]string{"172.17.4.185:2379", "172.17.4.186:2379", "172.17.148.50:2379"})
|
|
|
- BaseService = &ml.Mysql{
|
|
|
- Address: "172.17.145.164:14000",
|
|
|
- UserName: "root",
|
|
|
- PassWord: "Tibi#20211222",
|
|
|
- DBName: "base_service",
|
|
|
- MaxOpenConns: 2,
|
|
|
- MaxIdleConns: 2,
|
|
|
- }
|
|
|
- Mgo = &mongodb.MongodbSim{
|
|
|
- MongodbAddr: "172.17.4.193:27080,172.17.4.83:27080",
|
|
|
- Size: 1,
|
|
|
- DbName: "qfw",
|
|
|
- ReplSet: "",
|
|
|
- UserName: "",
|
|
|
- Password: "",
|
|
|
- }
|
|
|
- JyOrder = &ml.Mysql{
|
|
|
- Address: "172.17.145.169:3306",
|
|
|
- UserName: "root",
|
|
|
- PassWord: "TopMysql@123",
|
|
|
- DBName: "jianyu",
|
|
|
- MaxOpenConns: 2,
|
|
|
- MaxIdleConns: 2,
|
|
|
- }
|
|
|
- } else {
|
|
|
- middleground = NewMiddleground([]string{"192.168.3.149:2379"})
|
|
|
- BaseService = &ml.Mysql{
|
|
|
- Address: "192.168.3.14:4000",
|
|
|
- UserName: "root",
|
|
|
- PassWord: "=PDT49#80Z!RVv52_z",
|
|
|
- DBName: "base_service",
|
|
|
- MaxOpenConns: 2,
|
|
|
- MaxIdleConns: 2,
|
|
|
- }
|
|
|
- Mgo = &mongodb.MongodbSim{
|
|
|
- MongodbAddr: "192.168.3.206:27080",
|
|
|
- Size: 1,
|
|
|
- DbName: "qfw",
|
|
|
- ReplSet: "",
|
|
|
- UserName: "",
|
|
|
- Password: "",
|
|
|
- }
|
|
|
- JyOrder = &ml.Mysql{
|
|
|
- Address: "192.168.3.11:3366",
|
|
|
- UserName: "root",
|
|
|
- PassWord: "Topnet123",
|
|
|
- DBName: "jianyu",
|
|
|
- MaxOpenConns: 2,
|
|
|
- MaxIdleConns: 2,
|
|
|
- }
|
|
|
- }
|
|
|
+ middleground = NewMiddleground(c.EtcdAddr)
|
|
|
middleground.RegResourceCenter("resource.rpc").RegUserCenter("usercenter.rpc")
|
|
|
+ //
|
|
|
+ BaseService = &ml.Mysql{
|
|
|
+ Address: c.Mysql.Base.Address,
|
|
|
+ UserName: c.Mysql.Base.UserName,
|
|
|
+ PassWord: c.Mysql.Base.PassWord,
|
|
|
+ DBName: c.Mysql.Base.DbName,
|
|
|
+ MaxOpenConns: c.Mysql.Base.MaxOpenConns,
|
|
|
+ MaxIdleConns: c.Mysql.Base.MaxIdleConns,
|
|
|
+ }
|
|
|
BaseService.Init()
|
|
|
+ //
|
|
|
+ JyOrder = &ml.Mysql{
|
|
|
+ Address: c.Mysql.Main.Address,
|
|
|
+ UserName: c.Mysql.Main.UserName,
|
|
|
+ PassWord: c.Mysql.Main.PassWord,
|
|
|
+ DBName: c.Mysql.Main.DbName,
|
|
|
+ MaxOpenConns: c.Mysql.Main.MaxOpenConns,
|
|
|
+ MaxIdleConns: c.Mysql.Main.MaxIdleConns,
|
|
|
+ }
|
|
|
JyOrder.Init()
|
|
|
+ //
|
|
|
+ Mgo = &mongodb.MongodbSim{
|
|
|
+ MongodbAddr: c.Mongodb.Main.Address,
|
|
|
+ Size: c.Mongodb.Main.Size,
|
|
|
+ DbName: c.Mongodb.Main.DbName,
|
|
|
+ ReplSet: c.Mongodb.Main.ReplSet,
|
|
|
+ UserName: c.Mongodb.Main.UserName,
|
|
|
+ Password: c.Mongodb.Main.Password,
|
|
|
+ }
|
|
|
Mgo.InitPool()
|
|
|
+ //
|
|
|
ur, _ := Mgo.Find("user", map[string]interface{}{
|
|
|
"$or": []map[string]interface{}{
|
|
|
map[string]interface{}{
|
|
@@ -243,7 +228,7 @@ func main() {
|
|
|
} else if r.Status == 1 {
|
|
|
log.Println(msg, powerType, "已取消!")
|
|
|
} else {
|
|
|
- log.Println(msg, powerType, "取消失败!")
|
|
|
+ log.Println(msg, powerType, "取消失败!", r.Status)
|
|
|
}
|
|
|
} else {
|
|
|
log.Fatalln("-m 参数无效")
|