|
@@ -85,7 +85,7 @@ func main() {
|
|
|
dayCount := flag.Int("c", 0, "自定义设置需要开通权益的天数,包含今天")
|
|
|
entName := flag.String("n", "", "企业名称")
|
|
|
isCheck := flag.Int("b", 1, "是否前置校验和后置处理")
|
|
|
- openWay := flag.Int("a", 0, "开通权益方式;0:只开一个身份 1:开全部身份 2:只开到企业上")
|
|
|
+ powerWay := flag.Int("a", 0, "权益开通/取消方式;0:一个身份 1:全部身份 2:仅仅企业上")
|
|
|
flag.Parse()
|
|
|
if *phone == "" {
|
|
|
log.Fatalln("-p 参数无效")
|
|
@@ -145,13 +145,13 @@ func main() {
|
|
|
for _, v := range *ur {
|
|
|
id := Int64All(v["base_user_id"])
|
|
|
for _, identity := range middleground.UserCenter.IdentityList(id) {
|
|
|
- if *openWay == 0 {
|
|
|
+ if *powerWay == 0 {
|
|
|
if *entName == "" && identity.PositionType == 1 {
|
|
|
continue
|
|
|
} else if *entName != "" && (identity.PositionType == 0 || *entName != identity.Name) {
|
|
|
continue
|
|
|
}
|
|
|
- } else if *openWay == 2 {
|
|
|
+ } else if *powerWay == 2 {
|
|
|
if *entName == "" {
|
|
|
continue
|
|
|
} else if identity.PositionType == 0 || *entName != identity.Name {
|
|
@@ -208,7 +208,7 @@ func main() {
|
|
|
Type: 1,
|
|
|
EndTime: endTime,
|
|
|
}
|
|
|
- if *openWay == 2 {
|
|
|
+ if *powerWay == 2 {
|
|
|
powerReq.EntAccountId = identity.EntAccountId
|
|
|
powerReq.EntId = identity.EntId
|
|
|
} else {
|
|
@@ -226,16 +226,20 @@ func main() {
|
|
|
log.Println(msg, powerType, "开通失败!")
|
|
|
}
|
|
|
} else if *m == 3 {
|
|
|
- r, err := c.PowerHandle(context.Background(), &pb.PowerReq{
|
|
|
- Appid: appid,
|
|
|
- GoodsCode: goodsCode,
|
|
|
- GoodsSpecId: goodsSpecId,
|
|
|
- EntId: identity.EntId,
|
|
|
- AccountId: identity.AccountId,
|
|
|
- BuyNum: 1,
|
|
|
- Type: -1,
|
|
|
- EntAccountId: identity.EntAccountId,
|
|
|
- })
|
|
|
+ powerReq := &pb.PowerReq{
|
|
|
+ Appid: appid,
|
|
|
+ GoodsCode: goodsCode,
|
|
|
+ GoodsSpecId: goodsSpecId,
|
|
|
+ BuyNum: 1,
|
|
|
+ Type: -1,
|
|
|
+ }
|
|
|
+ if *powerWay == 2 {
|
|
|
+ powerReq.EntAccountId = identity.EntAccountId
|
|
|
+ powerReq.EntId = identity.EntId
|
|
|
+ } else {
|
|
|
+ powerReq.AccountId = identity.AccountId
|
|
|
+ }
|
|
|
+ r, err := c.PowerHandle(context.Background(), powerReq)
|
|
|
if err != nil {
|
|
|
log.Println(msg, powerType, "取消失败!", err)
|
|
|
} else if r.Status == 1 {
|