|
@@ -3786,7 +3786,7 @@ func NewBigOrder(subStatus, dateType int, startdate, enddate time.Time, userId,
|
|
|
})
|
|
|
// 企业主体判断是否开通权益
|
|
|
if param.BuySubject == "2" {
|
|
|
- entService, userCount = EntServiceOpen(qutil.IntAll(paramOrder["entId"]), param.BuySubject, param.StartTime)
|
|
|
+ entService, userCount = EntServiceOpen(qutil.IntAll(paramOrder["entId"]), param.Phone, fmt.Sprintf("%s%s", "大会员", sName), param.StartTime)
|
|
|
_d := util.JysqlDB.FindOne("dataexport_order", map[string]interface{}{"order_code": code}, "id", "")
|
|
|
if _d != nil && len(*_d) > 0 {
|
|
|
orderId := qutil.IntAll((*_d)["id"])
|
|
@@ -3804,7 +3804,6 @@ func NewBigOrder(subStatus, dateType int, startdate, enddate time.Time, userId,
|
|
|
}
|
|
|
}
|
|
|
if !entService {
|
|
|
- //ClearBigVipUserPower(userId)
|
|
|
return nil
|
|
|
}
|
|
|
}
|
|
@@ -4085,26 +4084,22 @@ func NewBigOrder(subStatus, dateType int, startdate, enddate time.Time, userId,
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-func EntServiceOpen(entId int, subject string, st int64) (bool, int) {
|
|
|
+func EntServiceOpen(entId int, phone, productType string, st int64) (bool, int) {
|
|
|
if st == 4070880000 {
|
|
|
return false, 0
|
|
|
}
|
|
|
- /*data, _ := util.MQFW.FindById("user", userid, "")
|
|
|
- if data != nil && len(*data) > 0 {
|
|
|
- if qutil.IntAll((*data)["i_vip_status"]) > 0 || qutil.IntAll((*data)["i_member_status"]) > 0 {
|
|
|
- return false, 0
|
|
|
- }
|
|
|
- }*/
|
|
|
- data, _ := util.MQFW.FindOne("entniche_rule", map[string]interface{}{
|
|
|
- "i_userid": map[string]interface{}{
|
|
|
- "$exists": false,
|
|
|
- },
|
|
|
- "i_entid": entId,
|
|
|
- })
|
|
|
- if qutil.IntAll((*data)["i_vip_status"]) > 0 || qutil.IntAll((*data)["i_member_status"]) > 0 {
|
|
|
+ user := util.JysqlDB.FindOne("entniche_user", map[string]interface{}{"phone": phone, "ent_id": entId}, "id", "")
|
|
|
+ if user == nil {
|
|
|
return false, 0
|
|
|
}
|
|
|
- return true, 1
|
|
|
+ sql := "SELECT COUNT(1) FROM entniche_power a INNER JOIN entniche_wait_empower b ON a.wait_empower_id = b.id where a.ent_id=" + qutil.InterfaceToStr(entId) + " and a.ent_user_id=" + qutil.InterfaceToStr((*user)["id"]) + " and a.`status`=1 and b.product_type='" + productType + "'"
|
|
|
+ number := util.JysqlDB.CountBySql(sql)
|
|
|
+ if number == 0 {
|
|
|
+ return true, 1
|
|
|
+ } else {
|
|
|
+ return false, 0
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
func UpdateNewBigOrder(subStatus, dateType int, now, startdate, enddate time.Time, userId, code, sName string, param *Params, return_status int) error {
|
|
|
log.Println("大会员创建订单user表大会员状态更新", subStatus, dateType, now, startdate, enddate, userId, code)
|
|
@@ -4241,7 +4236,7 @@ func UpdateNewBigOrder(subStatus, dateType int, now, startdate, enddate time.Tim
|
|
|
)
|
|
|
//主体为企业
|
|
|
if param.BuySubject == "2" {
|
|
|
- entService, userCount = EntServiceOpen(qutil.IntAll(paramOrder["entId"]), param.BuySubject, param.StartTime)
|
|
|
+ entService, userCount = EntServiceOpen(qutil.IntAll(paramOrder["entId"]), param.Phone, fmt.Sprintf("%s%s", "大会员", sName), param.StartTime)
|
|
|
_d := util.JysqlDB.FindOne("dataexport_order", map[string]interface{}{"order_code": param.OrderCode}, "id", "")
|
|
|
if _d != nil && len(*_d) > 0 {
|
|
|
orderId := qutil.IntAll((*_d)["id"])
|