|
@@ -14,44 +14,32 @@ import (
|
|
|
|
|
|
type Action struct {
|
|
|
*xweb.Action
|
|
|
- myents xweb.Mapper `xweb:"/ent/myents"` //当前登录用户的所在的企业
|
|
|
- entinfo xweb.Mapper `xweb:"/ent/entinfo"` //企业信息
|
|
|
- selectent xweb.Mapper `xweb:"/ent/selectent"` //选择企业
|
|
|
+ myEnts xweb.Mapper `xweb:"/ent/myents"` //当前登录用户的所在的企业
|
|
|
+ entInfo xweb.Mapper `xweb:"/ent/entinfo"` //企业信息
|
|
|
+ selectEnt xweb.Mapper `xweb:"/ent/selectent"` //选择企业
|
|
|
framework xweb.Mapper `xweb:"/ent/framework"` //进入企业架构
|
|
|
association xweb.Mapper `xweb:"/ent/association"` //联想
|
|
|
- isexists xweb.Mapper `xweb:"/ent/isexists"` //企业是否存在
|
|
|
+ isExists xweb.Mapper `xweb:"/ent/isexists"` //企业是否存在
|
|
|
//
|
|
|
- mail xweb.Mapper `xweb:"/ent/set/mail"` //设置企业邮箱
|
|
|
industryclass xweb.Mapper `xweb:"/ent/set/industryclass"` //设置企业所属行业
|
|
|
}
|
|
|
|
|
|
//当前登录用户的所在的企业
|
|
|
-func (a *Action) Myents() {
|
|
|
+func (a *Action) MyEnts() {
|
|
|
userId, _ := a.GetSession("userId").(string)
|
|
|
- entId := qutil.IntAll(a.GetSession("selectEntId"))
|
|
|
+ entId := qutil.IntAll(a.GetSession("entId"))
|
|
|
phone := VarCurrentUser.Phone(userId)
|
|
|
if phone == "" {
|
|
|
R.NoPermissionReq(a.ResponseWriter, a.Request, "手机号不存在")
|
|
|
return
|
|
|
}
|
|
|
- data := M{
|
|
|
+ a.ServeJson(Result{Data: M{
|
|
|
"ents": VarEntInfo.MyEnts(phone, entId, true),
|
|
|
- }
|
|
|
- user, ok := MQFW.FindById("user", userId, `{"i_vip_status":1,"l_vip_starttime":1,"l_vip_endtime":1,"o_vipjy":1}`)
|
|
|
- if ok && user != nil && qutil.IntAll((*user)["i_vip_status"]) > 0 {
|
|
|
- o_vipjy, _ := (*user)["o_vipjy"].(map[string]interface{})
|
|
|
- data["vip"] = M{
|
|
|
- "area": o_vipjy["o_area"],
|
|
|
- "buyerclass": o_vipjy["a_buyerclass"],
|
|
|
- "startdate": (*user)["l_vip_starttime"],
|
|
|
- "enddate": (*user)["l_vip_endtime"],
|
|
|
- }
|
|
|
- }
|
|
|
- a.ServeJson(Result{Data: data})
|
|
|
+ }})
|
|
|
}
|
|
|
|
|
|
//企业信息
|
|
|
-func (a *Action) Entinfo() {
|
|
|
+func (a *Action) EntInfo() {
|
|
|
userId, _ := a.GetSession("userId").(string)
|
|
|
entName, _ := a.GetSession("entName").(string)
|
|
|
entId := qutil.IntAll(a.GetSession("entId"))
|
|
@@ -71,17 +59,18 @@ func (a *Action) Entinfo() {
|
|
|
m["mail"] = entInfo.Ent.Mail
|
|
|
m["industryclass"] = entInfo.Ent.Industryclass
|
|
|
m["quota"] = entInfo.Ent.Quota
|
|
|
+ m["ent_auth_status"] = entInfo.Ent.Auth_status
|
|
|
+ m["ent_auth_reason"] = entInfo.Ent.Auth_reason
|
|
|
m["power_checked"] = Mysql.Count(Entniche_user, map[string]interface{}{"ent_id": entId, "power": 1})
|
|
|
}
|
|
|
a.ServeJson(Result{Data: m})
|
|
|
}
|
|
|
|
|
|
//切换所在的企业
|
|
|
-func (a *Action) Selectent() {
|
|
|
+func (a *Action) SelectEnt() {
|
|
|
if !R.CheckReqParam(a.ResponseWriter, a.Request, "id") {
|
|
|
return
|
|
|
}
|
|
|
- a.SetSession("prevSelectEntId", a.GetSession("selectEntId"))
|
|
|
if a.GetString("id") == "0" {
|
|
|
ClearSess(a.Session())
|
|
|
} else {
|
|
@@ -91,7 +80,7 @@ func (a *Action) Selectent() {
|
|
|
R.NoPermissionReq(a.ResponseWriter, a.Request)
|
|
|
return
|
|
|
}
|
|
|
- SetSess(a.Session(), true, ent["id"], ent["name"], ent["user_id"])
|
|
|
+ SetSess(a.Session(), ent["id"], ent["name"], ent["user_id"])
|
|
|
}
|
|
|
a.ServeJson(Result{Data: M{"status": 1}})
|
|
|
}
|
|
@@ -107,7 +96,7 @@ func (a *Action) Framework() {
|
|
|
R.NoPermissionReq(a.ResponseWriter, a.Request)
|
|
|
return
|
|
|
}
|
|
|
- SetSess(a.Session(), false, ent["id"], ent["name"], ent["user_id"])
|
|
|
+ SetSess(a.Session(), ent["id"], ent["name"], ent["user_id"])
|
|
|
a.ServeJson(Result{Data: M{"status": 1}})
|
|
|
}
|
|
|
|
|
@@ -120,7 +109,7 @@ func (a *Action) Association() {
|
|
|
}
|
|
|
|
|
|
//企业是否存在
|
|
|
-func (a *Action) Isexists() {
|
|
|
+func (a *Action) IsExists() {
|
|
|
if !R.CheckReqParam(a.ResponseWriter, a.Request, "name") {
|
|
|
return
|
|
|
}
|
|
@@ -136,18 +125,6 @@ func (a *Action) Isexists() {
|
|
|
a.ServeJson(Result{Data: m})
|
|
|
}
|
|
|
|
|
|
-//设置企业邮箱
|
|
|
-func (a *Action) Mail() {
|
|
|
- if !R.CheckReqParam(a.ResponseWriter, a.Request, "mail") {
|
|
|
- return
|
|
|
- }
|
|
|
- status := 0
|
|
|
- if Mysql.UpdateOrDeleteBySql(`update entniche_info set mail=? where id=?`, a.GetString("mail"), qutil.IntAll(a.GetSession("entId"))) > -1 {
|
|
|
- status = 1
|
|
|
- }
|
|
|
- a.ServeJson(Result{Data: M{"status": status}})
|
|
|
-}
|
|
|
-
|
|
|
//设置企业所属行业
|
|
|
func (a *Action) Industryclass() {
|
|
|
if !R.CheckReqParam(a.ResponseWriter, a.Request, "industryclass") {
|
|
@@ -161,18 +138,12 @@ func (a *Action) Industryclass() {
|
|
|
}
|
|
|
|
|
|
/****************************************************/
|
|
|
-func SetSess(sess *httpsession.Session, isSelect bool, entId, entName, entUserId interface{}) {
|
|
|
- if isSelect {
|
|
|
- sess.Set("selectEntId", entId)
|
|
|
- sess.Set("selectEntName", entName)
|
|
|
- }
|
|
|
+func SetSess(sess *httpsession.Session, entId, entName, entUserId interface{}) {
|
|
|
sess.Set("entId", entId)
|
|
|
sess.Set("entName", entName)
|
|
|
sess.Set("entUserId", entUserId)
|
|
|
}
|
|
|
func ClearSess(sess *httpsession.Session) {
|
|
|
- sess.Del("selectEntId")
|
|
|
- sess.Del("selectEntName")
|
|
|
sess.Del("entId")
|
|
|
sess.Del("entName")
|
|
|
sess.Del("entUserId")
|