|
@@ -33,14 +33,14 @@ func (a *Action) Manager() {
|
|
R.InvalidReqParam(a.ResponseWriter, a.Request, "id")
|
|
R.InvalidReqParam(a.ResponseWriter, a.Request, "id")
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- entId := qutil.IntAll(a.GetSession("entId"))
|
|
|
|
- dept := VarDepartment.GetById(entId, id)
|
|
|
|
|
|
+ frameworkEntId := qutil.IntAll(a.GetSession("frameworkEntId"))
|
|
|
|
+ dept := VarDepartment.GetById(frameworkEntId, id)
|
|
if dept.Id == 0 {
|
|
if dept.Id == 0 {
|
|
- R.NoPermissionReq(a.ResponseWriter, a.Request, fmt.Sprintf("没有找到该部门,企业id %d,部门id %d", entId, id))
|
|
|
|
|
|
+ R.NoPermissionReq(a.ResponseWriter, a.Request, fmt.Sprintf("没有找到该部门,企业id %d,部门id %d", frameworkEntId, id))
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- entName, _ := a.GetSession("entName").(string)
|
|
|
|
- entInfo := VarEntInfo.GetById(entId)
|
|
|
|
|
|
+ frameworkEntName, _ := a.GetSession("frameworkEntName").(string)
|
|
|
|
+ entInfo := VarEntInfo.GetById(frameworkEntId)
|
|
var quota int
|
|
var quota int
|
|
var added int64
|
|
var added int64
|
|
//
|
|
//
|
|
@@ -50,9 +50,9 @@ func (a *Action) Manager() {
|
|
department = dept.Name
|
|
department = dept.Name
|
|
if dept.Pid == 0 {
|
|
if dept.Pid == 0 {
|
|
quota = entInfo.Quota
|
|
quota = entInfo.Quota
|
|
- added = Mysql.CountBySql("select count(1) from entniche_user where ent_id=?", entId)
|
|
|
|
|
|
+ added = Mysql.CountBySql("select count(1) from entniche_user where ent_id=?", frameworkEntId)
|
|
}
|
|
}
|
|
- for _, v := range *VarDepartment.GetUsers(entId, id) {
|
|
|
|
|
|
+ for _, v := range *VarDepartment.GetUsers(frameworkEntId, id) {
|
|
persons = append(persons, M{
|
|
persons = append(persons, M{
|
|
"id": v.Id,
|
|
"id": v.Id,
|
|
"name": v.Name,
|
|
"name": v.Name,
|
|
@@ -60,7 +60,7 @@ func (a *Action) Manager() {
|
|
"role": v.Role,
|
|
"role": v.Role,
|
|
})
|
|
})
|
|
}
|
|
}
|
|
- for _, v := range *VarDepartment.GetDeptAndUser(entId, id) {
|
|
|
|
|
|
+ for _, v := range *VarDepartment.GetDeptAndUser(frameworkEntId, id) {
|
|
departments = append(departments, M{
|
|
departments = append(departments, M{
|
|
"id": v.Id,
|
|
"id": v.Id,
|
|
"name": v.Name,
|
|
"name": v.Name,
|
|
@@ -70,7 +70,7 @@ func (a *Action) Manager() {
|
|
}
|
|
}
|
|
a.ServeJson(Result{
|
|
a.ServeJson(Result{
|
|
Data: M{
|
|
Data: M{
|
|
- "entname": entName,
|
|
|
|
|
|
+ "entname": frameworkEntName,
|
|
"department": department,
|
|
"department": department,
|
|
"quota": quota,
|
|
"quota": quota,
|
|
"added": added,
|
|
"added": added,
|
|
@@ -90,8 +90,8 @@ func (a *Action) Add() {
|
|
R.InvalidReqParam(a.ResponseWriter, a.Request, "id")
|
|
R.InvalidReqParam(a.ResponseWriter, a.Request, "id")
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- entId := qutil.IntAll(a.GetSession("entId"))
|
|
|
|
- if !VarDepartment.IsMyDept(entId, id) {
|
|
|
|
|
|
+ frameworkEntId := qutil.IntAll(a.GetSession("frameworkEntId"))
|
|
|
|
+ if !VarDepartment.IsMyDept(frameworkEntId, id) {
|
|
R.NoPermissionReq(a.ResponseWriter, a.Request)
|
|
R.NoPermissionReq(a.ResponseWriter, a.Request)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -100,14 +100,14 @@ func (a *Action) Add() {
|
|
phone := a.GetString("phone")
|
|
phone := a.GetString("phone")
|
|
mail := a.GetString("mail")
|
|
mail := a.GetString("mail")
|
|
status, user_id := func() (int, int64) {
|
|
status, user_id := func() (int, int64) {
|
|
- if VarUser.AddIsExists(entId, phone) {
|
|
|
|
|
|
+ if VarUser.AddIsExists(frameworkEntId, phone) {
|
|
return -1, 0
|
|
return -1, 0
|
|
} else if VarEntInfo.UserInEntLimit(phone, Config.UserInEntLimit) {
|
|
} else if VarEntInfo.UserInEntLimit(phone, Config.UserInEntLimit) {
|
|
return -2, 0
|
|
return -2, 0
|
|
}
|
|
}
|
|
var user_id int64
|
|
var user_id int64
|
|
if Mysql.ExecTx("新增员工", func(tx *sql.Tx) bool {
|
|
if Mysql.ExecTx("新增员工", func(tx *sql.Tx) bool {
|
|
- uid, ok := VarUser.Add(tx, userId, entId, &User{
|
|
|
|
|
|
+ uid, ok := VarUser.Add(tx, userId, frameworkEntId, &User{
|
|
Dept_id: id,
|
|
Dept_id: id,
|
|
Name: name,
|
|
Name: name,
|
|
Mail: mail,
|
|
Mail: mail,
|
|
@@ -135,14 +135,14 @@ func (a *Action) Del() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
id := a.GetString("id")
|
|
id := a.GetString("id")
|
|
- entId := qutil.IntAll(a.GetSession("entId"))
|
|
|
|
- if !VarUser.IsMyPerson(entId, id) {
|
|
|
|
|
|
+ frameworkEntId := qutil.IntAll(a.GetSession("frameworkEntId"))
|
|
|
|
+ if !VarUser.IsMyPerson(frameworkEntId, id) {
|
|
R.NoPermissionReq(a.ResponseWriter, a.Request)
|
|
R.NoPermissionReq(a.ResponseWriter, a.Request)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
//
|
|
//
|
|
status := 0
|
|
status := 0
|
|
- if VarUser.Del(entId, id) {
|
|
|
|
|
|
+ if VarUser.Del(frameworkEntId, id) {
|
|
status = 1
|
|
status = 1
|
|
}
|
|
}
|
|
a.ServeJson(Result{Data: M{"status": status}})
|
|
a.ServeJson(Result{Data: M{"status": status}})
|
|
@@ -158,16 +158,16 @@ func (a *Action) Move() {
|
|
R.InvalidReqParam(a.ResponseWriter, a.Request, "did")
|
|
R.InvalidReqParam(a.ResponseWriter, a.Request, "did")
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- entId := qutil.IntAll(a.GetSession("entId"))
|
|
|
|
|
|
+ frameworkEntId := qutil.IntAll(a.GetSession("frameworkEntId"))
|
|
ids := a.GetString("id")
|
|
ids := a.GetString("id")
|
|
- if !VarDepartment.IsMyDept(entId, did) || !VarUser.IsMyPerson(entId, ids) {
|
|
|
|
|
|
+ if !VarDepartment.IsMyDept(frameworkEntId, did) || !VarUser.IsMyPerson(frameworkEntId, ids) {
|
|
R.NoPermissionReq(a.ResponseWriter, a.Request)
|
|
R.NoPermissionReq(a.ResponseWriter, a.Request)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
//
|
|
//
|
|
status := 0
|
|
status := 0
|
|
if Mysql.ExecTx("移动部门", func(tx *sql.Tx) bool {
|
|
if Mysql.ExecTx("移动部门", func(tx *sql.Tx) bool {
|
|
- return VarUser.Move(tx, entId, did, ids)
|
|
|
|
|
|
+ return VarUser.Move(tx, frameworkEntId, did, ids)
|
|
}) {
|
|
}) {
|
|
status = 1
|
|
status = 1
|
|
}
|
|
}
|
|
@@ -184,10 +184,10 @@ func (a *Action) Detail() {
|
|
R.InvalidReqParam(a.ResponseWriter, a.Request, "id")
|
|
R.InvalidReqParam(a.ResponseWriter, a.Request, "id")
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- entId := qutil.IntAll(a.GetSession("entId"))
|
|
|
|
- user := VarUser.GetAllInfoById(entId, id)
|
|
|
|
|
|
+ frameworkEntId := qutil.IntAll(a.GetSession("frameworkEntId"))
|
|
|
|
+ user := VarUser.GetAllInfoById(frameworkEntId, id)
|
|
if user.Id == 0 {
|
|
if user.Id == 0 {
|
|
- R.NoPermissionReq(a.ResponseWriter, a.Request, fmt.Sprintf("没有找到该人员,企业id %d,人员id %d", entId, id))
|
|
|
|
|
|
+ R.NoPermissionReq(a.ResponseWriter, a.Request, fmt.Sprintf("没有找到该人员,企业id %d,人员id %d", frameworkEntId, id))
|
|
return
|
|
return
|
|
}
|
|
}
|
|
a.ServeJson(Result{
|
|
a.ServeJson(Result{
|
|
@@ -213,13 +213,13 @@ func (a *Action) Update() {
|
|
R.InvalidReqParam(a.ResponseWriter, a.Request, "id", "did")
|
|
R.InvalidReqParam(a.ResponseWriter, a.Request, "id", "did")
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- entId := qutil.IntAll(a.GetSession("entId"))
|
|
|
|
- if !VarDepartment.IsMyDept(entId, did) || !VarUser.IsMyPerson(entId, id) {
|
|
|
|
|
|
+ frameworkEntId := qutil.IntAll(a.GetSession("frameworkEntId"))
|
|
|
|
+ if !VarDepartment.IsMyDept(frameworkEntId, did) || !VarUser.IsMyPerson(frameworkEntId, id) {
|
|
R.NoPermissionReq(a.ResponseWriter, a.Request)
|
|
R.NoPermissionReq(a.ResponseWriter, a.Request)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
status := 0
|
|
status := 0
|
|
- if VarUser.Update(a.GetString("mail"), id, did, entId) {
|
|
|
|
|
|
+ if VarUser.Update(a.GetString("mail"), id, did, frameworkEntId) {
|
|
status = 1
|
|
status = 1
|
|
}
|
|
}
|
|
a.ServeJson(Result{Data: M{"status": status}})
|
|
a.ServeJson(Result{Data: M{"status": status}})
|