|
@@ -33,6 +33,39 @@ var (
|
|
|
all map[string]string
|
|
|
powerType string
|
|
|
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"},
|
|
|
+ },
|
|
|
+ }
|
|
|
)
|
|
|
|
|
|
func main() {
|
|
@@ -43,24 +76,13 @@ func main() {
|
|
|
dayCount := flag.Int("c", 0, "自定义设置需要开通权益的天数,包含今天")
|
|
|
entName := flag.String("n", "", "企业名称")
|
|
|
isCheck := flag.Int("b", 1, "是否前置校验和后置处理")
|
|
|
+ allIdentity := flag.Int("a", 0, "是否全部身份;0:否 1:是")
|
|
|
flag.Parse()
|
|
|
if *phone == "" {
|
|
|
log.Fatalln("-p 参数无效")
|
|
|
}
|
|
|
- var entity Entity
|
|
|
- if *t == "yxy" {
|
|
|
- entity = &Yxy{}
|
|
|
- } else if *t == "bi_yllyh" {
|
|
|
- entity = &Bi_yllyh{}
|
|
|
- } else if *t == "bi_ldx" {
|
|
|
- entity = &Bi_ldx{}
|
|
|
- } else if *t == "bi_hnyd_fx" {
|
|
|
- entity = &Bi_hnyd_fx{}
|
|
|
- } else if *t == "bi_hnyd_gl" {
|
|
|
- entity = &Bi_hnyd_gl{}
|
|
|
- } else if *t == "ai_helper" {
|
|
|
- entity = &Ai_helper{}
|
|
|
- } else {
|
|
|
+ entity := allEntity[*t]
|
|
|
+ if entity == nil {
|
|
|
log.Fatalln("-t 参数无效")
|
|
|
}
|
|
|
powerType, goodsCode, goodsSpecId, all = entity.init()
|
|
@@ -121,17 +143,28 @@ func main() {
|
|
|
BaseService.Init()
|
|
|
JyOrder.Init()
|
|
|
Mgo.InitPool()
|
|
|
- ur := BaseService.SelectBySql(`select id from base_user where phone=?`, *phone)
|
|
|
+ ur, _ := Mgo.Find("user", map[string]interface{}{
|
|
|
+ "$or": []map[string]interface{}{
|
|
|
+ map[string]interface{}{
|
|
|
+ "s_phone": *phone,
|
|
|
+ },
|
|
|
+ map[string]interface{}{
|
|
|
+ "s_m_phone": *phone,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ }, nil, `{"base_user_id":1}`, false, -1, -1)
|
|
|
if ur == nil || len(*ur) <= 0 {
|
|
|
log.Fatalln("没有找到该用户!")
|
|
|
}
|
|
|
for _, v := range *ur {
|
|
|
- id := Int64All(v["id"])
|
|
|
+ id := Int64All(v["base_user_id"])
|
|
|
for _, identity := range middleground.UserCenter.IdentityList(id) {
|
|
|
- if *entName == "" && identity.PositionType == 1 {
|
|
|
- continue
|
|
|
- } else if *entName != "" && (identity.PositionType == 0 || *entName != identity.Name) {
|
|
|
- continue
|
|
|
+ if *allIdentity == 0 {
|
|
|
+ if *entName == "" && identity.PositionType == 1 {
|
|
|
+ continue
|
|
|
+ } else if *entName != "" && (identity.PositionType == 0 || *entName != identity.Name) {
|
|
|
+ continue
|
|
|
+ }
|
|
|
}
|
|
|
msg := "身份信息:" + fmt.Sprintf("%+v", identity) + " 手机号:" + *phone
|
|
|
var c = resource.NewResource(middleground.ResourceCenter.NewClient())
|
|
@@ -234,94 +267,25 @@ type Entity interface {
|
|
|
afterOpen(phone *string, identity *upb.Identity)
|
|
|
}
|
|
|
|
|
|
-/******************************医疗领域化BI******************************************/
|
|
|
-type Bi_yllyh struct {
|
|
|
-}
|
|
|
-
|
|
|
-//
|
|
|
-func (b *Bi_yllyh) init() (string, string, int64, map[string]string) {
|
|
|
- return "医疗领域化BI", "special_nosale_goods", 14, map[string]string{"医疗领域化BI": "bi_yllyh"}
|
|
|
-}
|
|
|
-
|
|
|
-//
|
|
|
-func (b *Bi_yllyh) beforeOpen(phone *string, identity *upb.Identity) bool {
|
|
|
- return true
|
|
|
-}
|
|
|
-
|
|
|
-//
|
|
|
-func (b *Bi_yllyh) afterOpen(phone *string, identity *upb.Identity) {
|
|
|
-}
|
|
|
-
|
|
|
-/******************************立达信BI分析工具******************************************/
|
|
|
-type Bi_ldx struct {
|
|
|
-}
|
|
|
-
|
|
|
-//
|
|
|
-func (b *Bi_ldx) init() (string, string, int64, map[string]string) {
|
|
|
- return "立达信BI分析工具", "special_nosale_goods", 15, map[string]string{"立达信BI分析工具": "bi_ldx"}
|
|
|
-}
|
|
|
-
|
|
|
-//
|
|
|
-func (b *Bi_ldx) beforeOpen(phone *string, identity *upb.Identity) bool {
|
|
|
- return true
|
|
|
-}
|
|
|
-
|
|
|
-//
|
|
|
-func (b *Bi_ldx) afterOpen(phone *string, identity *upb.Identity) {
|
|
|
-}
|
|
|
-
|
|
|
-/******************************bi_河南移动_数据分析******************************************/
|
|
|
-type Bi_hnyd_fx struct {
|
|
|
-}
|
|
|
-
|
|
|
-//
|
|
|
-func (b *Bi_hnyd_fx) init() (string, string, int64, map[string]string) {
|
|
|
- return "bi_河南移动_数据分析", "special_nosale_goods", 16, map[string]string{"bi_河南移动_数据分析": "bi_hnyd_fx"}
|
|
|
-}
|
|
|
-
|
|
|
-//
|
|
|
-func (b *Bi_hnyd_fx) beforeOpen(phone *string, identity *upb.Identity) bool {
|
|
|
- return true
|
|
|
-}
|
|
|
-
|
|
|
-//
|
|
|
-func (b *Bi_hnyd_fx) afterOpen(phone *string, identity *upb.Identity) {
|
|
|
-}
|
|
|
-
|
|
|
-/******************************bi_河南移动_数据管理******************************************/
|
|
|
-type Bi_hnyd_gl struct {
|
|
|
-}
|
|
|
-
|
|
|
-//
|
|
|
-func (b *Bi_hnyd_gl) init() (string, string, int64, map[string]string) {
|
|
|
- return "bi_河南移动_数据管理", "special_nosale_goods", 17, map[string]string{"bi_河南移动_数据管理": "bi_hnyd_gl"}
|
|
|
-}
|
|
|
-
|
|
|
-//
|
|
|
-func (b *Bi_hnyd_gl) beforeOpen(phone *string, identity *upb.Identity) bool {
|
|
|
- return true
|
|
|
-}
|
|
|
-
|
|
|
-//
|
|
|
-func (b *Bi_hnyd_gl) afterOpen(phone *string, identity *upb.Identity) {
|
|
|
-}
|
|
|
-
|
|
|
-/******************************智能助手******************************************/
|
|
|
-type Ai_helper struct {
|
|
|
+type Common struct {
|
|
|
+ Name string
|
|
|
+ GoodsCode string
|
|
|
+ GoodsSpecId int64
|
|
|
+ All map[string]string
|
|
|
}
|
|
|
|
|
|
//
|
|
|
-func (a *Ai_helper) init() (string, string, int64, map[string]string) {
|
|
|
- return "智能助手", "ai_helper", 18, map[string]string{"智能助手": "ai_helper"}
|
|
|
+func (c *Common) init() (string, string, int64, map[string]string) {
|
|
|
+ return c.Name, c.GoodsCode, c.GoodsSpecId, c.All
|
|
|
}
|
|
|
|
|
|
//
|
|
|
-func (a *Ai_helper) beforeOpen(phone *string, identity *upb.Identity) bool {
|
|
|
+func (c *Common) beforeOpen(phone *string, identity *upb.Identity) bool {
|
|
|
return true
|
|
|
}
|
|
|
|
|
|
//
|
|
|
-func (a *Ai_helper) afterOpen(phone *string, identity *upb.Identity) {
|
|
|
+func (c *Common) afterOpen(phone *string, identity *upb.Identity) {
|
|
|
}
|
|
|
|
|
|
/******************************医械云******************************************/
|