...
|
...
|
@@ -9,38 +9,38 @@ import ( |
|
|
"github.com/astaxie/beego/orm"
|
|
|
)
|
|
|
|
|
|
type CenterCompanyInfo struct {
|
|
|
CompanyId int64
|
|
|
CompanyName string
|
|
|
AdminId int64
|
|
|
AdminAccount string
|
|
|
AdminName string
|
|
|
}
|
|
|
// type CenterCompanyInfo struct {
|
|
|
// CompanyId int64
|
|
|
// CompanyName string
|
|
|
// AdminId int64
|
|
|
// AdminAccount string
|
|
|
// AdminName string
|
|
|
// }
|
|
|
|
|
|
func GetCenterCompanyInfo(companyid int64) (CenterCompanyInfo, error) {
|
|
|
// func GetCenterCompanyInfo(companyid int64) (CenterCompanyInfo, error) {
|
|
|
|
|
|
//TODO 调用统一用户中心的数据
|
|
|
data := CenterCompanyInfo{
|
|
|
CompanyId: 9999 + companyid,
|
|
|
CompanyName: "调试用公司数据",
|
|
|
AdminId: 9999 + companyid,
|
|
|
AdminAccount: "调试用自己修改",
|
|
|
AdminName: "调试用自己修改",
|
|
|
}
|
|
|
return data, nil
|
|
|
}
|
|
|
// //TODO 调用统一用户中心的数据
|
|
|
// data := CenterCompanyInfo{
|
|
|
// CompanyId: 9999 + companyid,
|
|
|
// CompanyName: "调试用公司数据",
|
|
|
// AdminId: 9999 + companyid,
|
|
|
// AdminAccount: "调试用自己修改",
|
|
|
// AdminName: "调试用自己修改",
|
|
|
// }
|
|
|
// return data, nil
|
|
|
// }
|
|
|
|
|
|
//InitCompanyInfo 初始化公司
|
|
|
//@uCompanyid 从统一用户中心获取的公司id companyid,
|
|
|
func InitCompanyInfo(uCompanyid int64) error {
|
|
|
var (
|
|
|
centerCompany CenterCompanyInfo
|
|
|
err error
|
|
|
)
|
|
|
centerCompany, err = GetCenterCompanyInfo(uCompanyid)
|
|
|
if err != nil {
|
|
|
return protocol.NewErrWithMessage("10051")
|
|
|
}
|
|
|
func InitCompanyInfo(centerCompany protocol.CenterCompanyInfo) error {
|
|
|
// var (
|
|
|
// centerCompany CenterCompanyInfo
|
|
|
// err error
|
|
|
// )
|
|
|
// centerCompany, err = GetCenterCompanyInfo(uCompanyid)
|
|
|
// if err != nil {
|
|
|
// return protocol.NewErrWithMessage("10051")
|
|
|
// }
|
|
|
var (
|
|
|
newDeparment *models.Department
|
|
|
//newUserDepart = &models.UserDepartment{}
|
...
|
...
|
@@ -49,6 +49,7 @@ func InitCompanyInfo(uCompanyid int64) error { |
|
|
newUser *models.User
|
|
|
newCompany *models.Company
|
|
|
newUserCompany *models.UserCompany
|
|
|
err error
|
|
|
)
|
|
|
o := orm.NewOrm()
|
|
|
o.Begin()
|
...
|
...
|
@@ -112,7 +113,7 @@ func InitCompanyInfo(uCompanyid int64) error { |
|
|
return nil
|
|
|
}
|
|
|
|
|
|
func initCompany(centerCompany CenterCompanyInfo, admininfo *models.User, o orm.Ormer) (*models.Company, error) {
|
|
|
func initCompany(centerCompany protocol.CenterCompanyInfo, admininfo *models.User, o orm.Ormer) (*models.Company, error) {
|
|
|
var (
|
|
|
err error
|
|
|
newCompany = &models.Company{}
|
...
|
...
|
@@ -152,7 +153,7 @@ func initCompany(centerCompany CenterCompanyInfo, admininfo *models.User, o orm. |
|
|
return newCompany, nil
|
|
|
}
|
|
|
|
|
|
func initAdminUser(centerCompany CenterCompanyInfo, o orm.Ormer) (*models.User, error) {
|
|
|
func initAdminUser(centerCompany protocol.CenterCompanyInfo, o orm.Ormer) (*models.User, error) {
|
|
|
var (
|
|
|
err error
|
|
|
newUser = &models.User{}
|
...
|
...
|
@@ -437,3 +438,15 @@ func CompanyBaseInfo(companyid int64) (*protocol.ResponseCompanyBase, error) { |
|
|
}
|
|
|
return companyinfo, nil
|
|
|
}
|
|
|
|
|
|
func ForbidCompany(ucenterCompany int64) error {
|
|
|
// var (
|
|
|
// err error
|
|
|
// companyData *models.Company
|
|
|
// )
|
|
|
// companyData, err = models.GetCompanyByUCenter(ucenterCompany)
|
|
|
// if err == orm.ErrNoRows {
|
|
|
// // log.Info()
|
|
|
// }
|
|
|
return nil
|
|
|
} |
...
|
...
|
|