...
|
...
|
@@ -118,8 +118,9 @@ func GetUserByUcid(ucid int64) (v *User, err error) { |
|
|
//按公司编号获取管理员编号
|
|
|
func GetUserByCompanyId(cid int64) (v *User, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := "select id,nick_name from `user` where id = (select admin_id from company where id=? and enable=1) and enable_status=1"
|
|
|
if err = o.Raw(sql, cid).QueryRow(&v); err == nil {
|
|
|
sql := `select id,nick_name from user_company
|
|
|
where user_id = (select admin_id from company where id=? and enable=1) and user_company.enable=1 and user_company.company_id=?`
|
|
|
if err = o.Raw(sql, cid, cid).QueryRow(&v); err == nil {
|
|
|
return v, nil
|
|
|
}
|
|
|
return nil, err
|
...
|
...
|
|