|
@@ -1193,6 +1193,7 @@ func VipInfo(context *admin.Context) (interface{}, error) {
|
|
Phone string `form:"phone"`
|
|
Phone string `form:"phone"`
|
|
OrderCode string `form:"orderCode"`
|
|
OrderCode string `form:"orderCode"`
|
|
BuySubject string `form:"buySubject"`
|
|
BuySubject string `form:"buySubject"`
|
|
|
|
+ EntName string `form:"entName"` //购买主体 企业
|
|
})
|
|
})
|
|
err := context.Form(param)
|
|
err := context.Form(param)
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -1255,6 +1256,36 @@ func VipInfo(context *admin.Context) (interface{}, error) {
|
|
}
|
|
}
|
|
if userInfo != nil && len(userInfo) > 0 {
|
|
if userInfo != nil && len(userInfo) > 0 {
|
|
userId := mongodb.BsonIdToSId(userInfo["_id"])
|
|
userId := mongodb.BsonIdToSId(userInfo["_id"])
|
|
|
|
+ if param.BuySubject == "2" {
|
|
|
|
+ res := util.JysqlDB.FindOne("entniche_info", map[string]interface{}{
|
|
|
|
+ "phone": param.Phone,
|
|
|
|
+ "name": param.EntName,
|
|
|
|
+ }, "id", "")
|
|
|
|
+ if res == nil {
|
|
|
|
+ return map[string]interface{}{
|
|
|
|
+ "willEffect": false,
|
|
|
|
+ "userData": userInfo,
|
|
|
|
+ "vipExist": false,
|
|
|
|
+ }, nil
|
|
|
|
+ }
|
|
|
|
+ entId := qutil.IntAll((*res)["id"])
|
|
|
|
+ positionData := util.BaseDB.FindOne(util.BasePosition, map[string]interface{}{
|
|
|
|
+ "type": 1,
|
|
|
|
+ "user_id": qutil.IntAll(userInfo["base_user_id"]),
|
|
|
|
+ "ent_id": entId,
|
|
|
|
+ }, "id", "")
|
|
|
|
+ if positionData != nil && len(*positionData) > 0 {
|
|
|
|
+ userId = fmt.Sprint(qutil.Int64All((*positionData)["id"]))
|
|
|
|
+ }
|
|
|
|
+ count := util.JysqlDB.CountBySql("SELECT * FROM dataexport_order WHERE product_type = 'VIP订阅' AND user_id = ? AND vip_starttime > ?", userId, time.Now().Format(qutil.Date_Full_Layout))
|
|
|
|
+ if count > 0 {
|
|
|
|
+ return map[string]interface{}{
|
|
|
|
+ "willEffect": true,
|
|
|
|
+ "userData": userInfo,
|
|
|
|
+ "vipExist": false,
|
|
|
|
+ }, nil
|
|
|
|
+ }
|
|
|
|
+ }
|
|
//查询订单信息获取客户名称
|
|
//查询订单信息获取客户名称
|
|
orderInfo := util.JysqlDB.SelectBySql("SELECT c.customer_name,d.company_name FROM dataexport_order d LEFT JOIN contract c ON c.order_code = d.order_code WHERE product_type = 'VIP订阅' and user_id = ? ORDER BY d.id DESC", userId)
|
|
orderInfo := util.JysqlDB.SelectBySql("SELECT c.customer_name,d.company_name FROM dataexport_order d LEFT JOIN contract c ON c.order_code = d.order_code WHERE product_type = 'VIP订阅' and user_id = ? ORDER BY d.id DESC", userId)
|
|
if len(*orderInfo) == 0 && param.BuySubject != "2" {
|
|
if len(*orderInfo) == 0 && param.BuySubject != "2" {
|