|
@@ -152,23 +152,17 @@ func (a *Action) Whetherbuy() {
|
|
|
entId := util.IntAll(a.GetSession("entId"))
|
|
|
entUserId := util.IntAll(a.GetSession("entUserId"))
|
|
|
if phone != "" {
|
|
|
- if Mysql.CountBySql("select count(1) as count from entniche_info where phone=? and status=1", phone) == 0 {
|
|
|
- if entId == 0 || VarEntInfo.GetById(entId).Status != 1 || VarUser.GetById(entId, entUserId).Power != 1 {
|
|
|
- list := Mysql.SelectBySql(`select a.id,a.name,b.id as user_id,b.createtime from entniche_info a
|
|
|
+ if entId != 0 && entUserId != 0 && VarEntInfo.GetById(entId).Status == 1 && VarUser.GetById(entId, entUserId).Power == 1 {
|
|
|
+ status = 2
|
|
|
+ isPower = true
|
|
|
+ } else {
|
|
|
+ list := Mysql.SelectBySql(`select a.id,a.name,b.id as user_id,b.createtime from entniche_info a
|
|
|
inner join entniche_user b on (a.status=1 and b.phone=? and b.power=1 and a.id=b.ent_id)
|
|
|
order by b.createtime desc limit 1`, phone)
|
|
|
- if list != nil && len(*list) == 1 {
|
|
|
- ent.SetSess(a.Session(), (*list)[0]["id"], (*list)[0]["name"], (*list)[0]["user_id"])
|
|
|
- }
|
|
|
+ if list != nil && len(*list) == 1 {
|
|
|
+ ent.SetSess(a.Session(), (*list)[0]["id"], (*list)[0]["name"], (*list)[0]["user_id"])
|
|
|
+ isPower = true
|
|
|
}
|
|
|
- entId = util.IntAll(a.GetSession("entId"))
|
|
|
- entUserId = util.IntAll(a.GetSession("entUserId"))
|
|
|
- if VarEntInfo.GetById(entId).Status == 1 && VarUser.GetById(entId, entUserId).Power == 1 {
|
|
|
- isPower = true //用户未购买用户 是否有权限
|
|
|
- }
|
|
|
- status = 1
|
|
|
- } else {
|
|
|
- status = 2
|
|
|
}
|
|
|
}
|
|
|
a.ServeJson(Result{Data: M{
|