|
@@ -85,7 +85,7 @@ func main() {
|
|
dayCount := flag.Int("c", 0, "自定义设置需要开通权益的天数,包含今天")
|
|
dayCount := flag.Int("c", 0, "自定义设置需要开通权益的天数,包含今天")
|
|
entName := flag.String("n", "", "企业名称")
|
|
entName := flag.String("n", "", "企业名称")
|
|
isCheck := flag.Int("b", 1, "是否前置校验和后置处理")
|
|
isCheck := flag.Int("b", 1, "是否前置校验和后置处理")
|
|
- allIdentity := flag.Int("a", 0, "是否全部身份;0:否 1:是")
|
|
|
|
|
|
+ openWay := flag.Int("a", 0, "开通权益方式;0:只开一个身份 1:开全部身份 2:只开到企业上")
|
|
flag.Parse()
|
|
flag.Parse()
|
|
if *phone == "" {
|
|
if *phone == "" {
|
|
log.Fatalln("-p 参数无效")
|
|
log.Fatalln("-p 参数无效")
|
|
@@ -145,12 +145,18 @@ func main() {
|
|
for _, v := range *ur {
|
|
for _, v := range *ur {
|
|
id := Int64All(v["base_user_id"])
|
|
id := Int64All(v["base_user_id"])
|
|
for _, identity := range middleground.UserCenter.IdentityList(id) {
|
|
for _, identity := range middleground.UserCenter.IdentityList(id) {
|
|
- if *allIdentity == 0 {
|
|
|
|
|
|
+ if *openWay == 0 {
|
|
if *entName == "" && identity.PositionType == 1 {
|
|
if *entName == "" && identity.PositionType == 1 {
|
|
continue
|
|
continue
|
|
} else if *entName != "" && (identity.PositionType == 0 || *entName != identity.Name) {
|
|
} else if *entName != "" && (identity.PositionType == 0 || *entName != identity.Name) {
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
|
|
+ } else if *openWay == 2 {
|
|
|
|
+ if *entName == "" {
|
|
|
|
+ continue
|
|
|
|
+ } else if identity.PositionType == 0 || *entName != identity.Name {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
}
|
|
}
|
|
msg := "身份信息:" + fmt.Sprintf("%+v", identity) + " 手机号:" + *phone
|
|
msg := "身份信息:" + fmt.Sprintf("%+v", identity) + " 手机号:" + *phone
|
|
var c = resource.NewResource(middleground.ResourceCenter.NewClient())
|
|
var c = resource.NewResource(middleground.ResourceCenter.NewClient())
|
|
@@ -194,16 +200,21 @@ func main() {
|
|
end_time = end_time.AddDate(0, 0, *dayCount-1)
|
|
end_time = end_time.AddDate(0, 0, *dayCount-1)
|
|
endTime = date.FormatDate(&end_time, date.Date_Full_Layout)
|
|
endTime = date.FormatDate(&end_time, date.Date_Full_Layout)
|
|
}
|
|
}
|
|
- r, err := c.PowerHandle(context.Background(), &pb.PowerReq{
|
|
|
|
|
|
+ powerReq := &pb.PowerReq{
|
|
Appid: appid,
|
|
Appid: appid,
|
|
GoodsCode: goodsCode,
|
|
GoodsCode: goodsCode,
|
|
GoodsSpecId: goodsSpecId,
|
|
GoodsSpecId: goodsSpecId,
|
|
EntId: 0,
|
|
EntId: 0,
|
|
- AccountId: identity.AccountId,
|
|
|
|
BuyNum: 1,
|
|
BuyNum: 1,
|
|
Type: 1,
|
|
Type: 1,
|
|
EndTime: endTime,
|
|
EndTime: endTime,
|
|
- })
|
|
|
|
|
|
+ }
|
|
|
|
+ if *openWay == 2 {
|
|
|
|
+ powerReq.EntAccountId = identity.EntAccountId
|
|
|
|
+ } else {
|
|
|
|
+ powerReq.AccountId = identity.AccountId
|
|
|
|
+ }
|
|
|
|
+ r, err := c.PowerHandle(context.Background(), powerReq)
|
|
if err != nil {
|
|
if err != nil {
|
|
log.Println(msg, powerType, "开通失败!", err)
|
|
log.Println(msg, powerType, "开通失败!", err)
|
|
} else if r.Status == 1 {
|
|
} else if r.Status == 1 {
|