wangchuanjin 2 жил өмнө
parent
commit
95843c6846
2 өөрчлөгдсөн 10 нэмэгдсэн , 1 устгасан
  1. BIN
      rpc/rpc
  2. 10 1
      test/openPower.go

BIN
rpc/rpc


+ 10 - 1
test/openPower.go

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