作者 唐旭辉

数据输出格式修改

@@ -142,12 +142,18 @@ func (c *CommonController) DefaultImage() { @@ -142,12 +142,18 @@ func (c *CommonController) DefaultImage() {
142 case 1: 142 case 1:
143 //返回机会分类的图标 143 //返回机会分类的图标
144 imageNames = []string{ 144 imageNames = []string{
145 - imgehost + "/图1.jpg", 145 + imgehost + "/sort/chance_one_channel@2x.png",
  146 + imgehost + "/sort/chance_one_area@2x.png",
  147 + imgehost + "/sort/chance_one_client@2x.png",
  148 + imgehost + "/sort/chance_one_product@2x.png",
146 } 149 }
147 case 2: 150 case 2:
148 //返回机会模板的图标 151 //返回机会模板的图标
149 imageNames = []string{ 152 imageNames = []string{
150 - imgehost + "/图1.jpg", 153 + imgehost + "/template/chance_two_application@x2.png",
  154 + imgehost + "/template/chance_two_follow@x2.png",
  155 + imgehost + "/template/chance_two_improve@x2.png",
  156 + imgehost + "/template/chance_two_original@x2.png",
151 } 157 }
152 } 158 }
153 data := map[string][]string{ 159 data := map[string][]string{
@@ -40,7 +40,7 @@ type ResponseDepartmentInfo struct { @@ -40,7 +40,7 @@ type ResponseDepartmentInfo struct {
40 ID int64 `json:"id"` 40 ID int64 `json:"id"`
41 CompanyID int64 `json:"company_id"` //公司 41 CompanyID int64 `json:"company_id"` //公司
42 Name string `json:"name"` //部门名字 42 Name string `json:"name"` //部门名字
43 - ParantID int64 `json:"parent_id"` //父级部门Id 43 + ParantID int64 `json:"parentId"` //父级部门Id
44 Manages []DepartmentManager `json:"manages"` //部门管理员 44 Manages []DepartmentManager `json:"manages"` //部门管理员
45 Members []DepartmentMember `json:"members"` //部门成员 45 Members []DepartmentMember `json:"members"` //部门成员
46 Member int64 `json:"member"` //成员数 46 Member int64 `json:"member"` //成员数
@@ -14,14 +14,6 @@ import ( @@ -14,14 +14,6 @@ import (
14 14
15 //InitCompanyInfo 初始化公司 15 //InitCompanyInfo 初始化公司
16 func InitCompanyInfo(centerCompany protocol.CenterCompanyInfo) error { 16 func InitCompanyInfo(centerCompany protocol.CenterCompanyInfo) error {
17 - // var (  
18 - // centerCompany CenterCompanyInfo  
19 - // err error  
20 - // )  
21 - // centerCompany, err = GetCenterCompanyInfo(uCompanyid)  
22 - // if err != nil {  
23 - // return protocol.NewErrWithMessage("10051")  
24 - // }  
25 var ( 17 var (
26 newDeparment *models.Department 18 newDeparment *models.Department
27 newRoleGroup *models.Role 19 newRoleGroup *models.Role
@@ -157,7 +149,11 @@ func initAdminUser(centerCompany protocol.CenterCompanyInfo, o orm.Ormer) (*mode @@ -157,7 +149,11 @@ func initAdminUser(centerCompany protocol.CenterCompanyInfo, o orm.Ormer) (*mode
157 return nil, err 149 return nil, err
158 } 150 }
159 } else if err == orm.ErrNoRows { 151 } else if err == orm.ErrNoRows {
160 - ucenterUser, err := ucenter.RequestUCenterAddUser(centerCompany.AdminAccount, centerCompany.AdminName, "") 152 + var (
  153 + ucenterUser = &ucenter.ResponseAddUser{}
  154 + err error
  155 + )
  156 + ucenterUser, err = ucenter.RequestUCenterAddUser(centerCompany.AdminAccount, centerCompany.AdminName, "")
161 if err != nil { 157 if err != nil {
162 log.Error("获取统一用户中心数据失败 :%s", err) 158 log.Error("获取统一用户中心数据失败 :%s", err)
163 return nil, err 159 return nil, err
@@ -353,16 +353,16 @@ func editUserRole(usercompanyid int64, userid int64, companyid int64, roleids [] @@ -353,16 +353,16 @@ func editUserRole(usercompanyid int64, userid int64, companyid int64, roleids []
353 return nil 353 return nil
354 } 354 }
355 355
356 -func editUserCompany(userCompanyid int64, userid int64, nickname string, o orm.Ormer) error {  
357 - m := &models.UserCompany{  
358 - Id: userCompanyid,  
359 - NickName: nickname,  
360 - UserId: userid,  
361 - } 356 +// func editUserCompany(userCompanyid int64, userid int64, nickname string, o orm.Ormer) error {
  357 +// m := &models.UserCompany{
  358 +// Id: userCompanyid,
  359 +// NickName: nickname,
  360 +// UserId: userid,
  361 +// }
362 362
363 - err := models.UpdateUserCompanyById(m, []string{"NickName", "UserId"}, o)  
364 - return err  
365 -} 363 +// err := models.UpdateUserCompanyById(m, []string{"NickName", "UserId"}, o)
  364 +// return err
  365 +// }
366 366
367 //校验user和公司的关系是否正确 367 //校验user和公司的关系是否正确
368 func validUserCompany(userCompanyid int64, companyid int64) (*models.UserCompany, error) { 368 func validUserCompany(userCompanyid int64, companyid int64) (*models.UserCompany, error) {
@@ -406,34 +406,34 @@ func UserEdit(param protocol.RequestUserEdit) error { @@ -406,34 +406,34 @@ func UserEdit(param protocol.RequestUserEdit) error {
406 log.Error(err.Error()) 406 log.Error(err.Error())
407 return err 407 return err
408 } 408 }
409 - //检查用户手机号是否生变更  
410 - var (  
411 - usrData *models.User  
412 - )  
413 - usrData, err = models.GetUserById(ucompany.UserId) 409 + _, err = models.GetUserById(ucompany.UserId)
414 if err != nil { 410 if err != nil {
415 log.Error("获取用户数据失败:%s", err) 411 log.Error("获取用户数据失败:%s", err)
416 return protocol.NewErrWithMessage("1") 412 return protocol.NewErrWithMessage("1")
417 } 413 }
418 o := orm.NewOrm() 414 o := orm.NewOrm()
419 o.Begin() 415 o.Begin()
420 - if usrData.Phone != param.Phone {  
421 - //手机号变更  
422 - uid, err := addNewUser(param.Name, param.Phone, o)  
423 - if err != nil {  
424 - o.Rollback()  
425 - log.Error("手机号变更,新增用户失败;%s", err)  
426 - return protocol.NewErrWithMessage("1")  
427 - }  
428 - ucompany.UserId = uid  
429 - } 416 + //检查用户手机号是否生变更
  417 + // var (
  418 + // usrData *models.User
  419 + // )
  420 + // if usrData.Phone != param.Phone {
  421 + // //手机号变更
  422 + // uid, err := addNewUser(param.Name, param.Phone, o)
  423 + // if err != nil {
  424 + // o.Rollback()
  425 + // log.Error("手机号变更,新增用户失败;%s", err)
  426 + // return protocol.NewErrWithMessage("1")
  427 + // }
  428 + // ucompany.UserId = uid
  429 + // }
430 //用户数据更新 430 //用户数据更新
431 - err = editUserCompany(param.UserCompanyID, ucompany.UserId, param.Name, o)  
432 - if err != nil {  
433 - o.Rollback()  
434 - log.Error("editUserCompany err:%s", err)  
435 - return protocol.NewErrWithMessage("1")  
436 - } 431 + // err = editUserCompany(param.UserCompanyID, ucompany.UserId, param.Name, o)
  432 + // if err != nil {
  433 + // o.Rollback()
  434 + // log.Error("editUserCompany err:%s", err)
  435 + // return protocol.NewErrWithMessage("1")
  436 + // }
437 //添加角色 437 //添加角色
438 err = editUserRole(param.UserCompanyID, ucompany.UserId, param.CompanyId, param.Roles, o) 438 err = editUserRole(param.UserCompanyID, ucompany.UserId, param.CompanyId, param.Roles, o)
439 if err != nil { 439 if err != nil {