|
@@ -40,6 +40,7 @@ func main() {
|
|
|
m := flag.Int("m", 0, "1:查询权益 2:开通权益 3:取消权益")
|
|
|
t := flag.String("t", "", "yxy:医械云 bi_yllyh:医疗领域化BI bi_ldx:立达信BI分析工具")
|
|
|
isProduct := flag.Int("d", 0, "是否是线上环境;0:否 1:是")
|
|
|
+ dayCount := flag.Int("c", 0, "自定义设置需要开通权益的天数,包含今天")
|
|
|
flag.Parse()
|
|
|
if *phone == "" {
|
|
|
log.Fatalln("-p 参数无效")
|
|
@@ -83,7 +84,7 @@ func main() {
|
|
|
MaxIdleConns: 2,
|
|
|
}
|
|
|
} else {
|
|
|
- etcdAddress = []string{"192.168.3.206:2379"}
|
|
|
+ etcdAddress = []string{"127.0.0.1:2379"}
|
|
|
BaseService = &ml.Mysql{
|
|
|
Address: "192.168.3.14:4000",
|
|
|
UserName: "root",
|
|
@@ -162,6 +163,13 @@ func main() {
|
|
|
if !entity.beforeOpen(phone, u) {
|
|
|
return
|
|
|
}
|
|
|
+ endTime := ""
|
|
|
+ if *dayCount > 0 {
|
|
|
+ now := time.Now()
|
|
|
+ end_time := time.Date(now.Year(), now.Month(), now.Day(), 23, 59, 59, 0, time.Local)
|
|
|
+ end_time = end_time.AddDate(0, 0, *dayCount-1)
|
|
|
+ endTime = date.FormatDate(&end_time, date.Date_Full_Layout)
|
|
|
+ }
|
|
|
r, err := c.PowerHandle(context.Background(), &pb.PowerReq{
|
|
|
Appid: appid,
|
|
|
GoodsCode: goodsCode,
|
|
@@ -170,6 +178,7 @@ func main() {
|
|
|
UserId: id,
|
|
|
BuyNum: 1,
|
|
|
Type: 1,
|
|
|
+ EndTime: endTime,
|
|
|
})
|
|
|
if err != nil {
|
|
|
log.Println(msg, powerType, "开通失败!", err)
|