正在显示
35 个修改的文件
包含
583 行增加
和
355 行删除
@@ -8,21 +8,22 @@ import ( | @@ -8,21 +8,22 @@ import ( | ||
8 | 8 | ||
9 | //MyConfig 自定义配置选项 | 9 | //MyConfig 自定义配置选项 |
10 | type MyConfig struct { | 10 | type MyConfig struct { |
11 | - ConfigName string //配置名称 | ||
12 | - SqlConn string //数据库连接 | ||
13 | - RedisAddPort string // | ||
14 | - RedisAuth string | ||
15 | - RedisDB int | ||
16 | - LogOutput string | ||
17 | - LogFilename string | ||
18 | - LogLevel string | ||
19 | - UcenterCheckAlt string | ||
20 | - UcenterBaseUrl string | ||
21 | - UcenterSecret string | ||
22 | - UcenterAppKey string | ||
23 | - FileSavePath string | ||
24 | - FileHost string | ||
25 | - FileHostPath string | 11 | + ConfigName string //配置名称 |
12 | + SqlConn string //数据库连接 | ||
13 | + RedisAddPort string // | ||
14 | + RedisAuth string | ||
15 | + RedisDB int | ||
16 | + LogOutput string | ||
17 | + LogFilename string | ||
18 | + LogLevel string | ||
19 | + UcenterCheckAlt string | ||
20 | + UcenterBaseUrl string | ||
21 | + UcenterSecret string | ||
22 | + UcenterAppKey string | ||
23 | + FileSavePath string | ||
24 | + FileHost string | ||
25 | + FileHostPath string | ||
26 | + BusinessAdminUrl string | ||
26 | } | 27 | } |
27 | 28 | ||
28 | //MConfig | 29 | //MConfig |
@@ -39,21 +40,22 @@ func RestMyConfig() *MyConfig { | @@ -39,21 +40,22 @@ func RestMyConfig() *MyConfig { | ||
39 | mysqlUser, mysqlPassword, mysqlHost, mysqlPort, mysqlDBname) | 40 | mysqlUser, mysqlPassword, mysqlHost, mysqlPort, mysqlDBname) |
40 | sqlconn = sqlconn + "?charset=utf8&loc=Asia%2FShanghai" | 41 | sqlconn = sqlconn + "?charset=utf8&loc=Asia%2FShanghai" |
41 | MConfig = &MyConfig{ | 42 | MConfig = &MyConfig{ |
42 | - ConfigName: beego.AppConfig.String("config_name"), | ||
43 | - SqlConn: sqlconn, | ||
44 | - RedisAddPort: fmt.Sprintf("%s:%s", beego.AppConfig.String("redis_add"), beego.AppConfig.String("redis_add_port")), | ||
45 | - RedisAuth: beego.AppConfig.DefaultString("redis_auth", ""), | ||
46 | - RedisDB: beego.AppConfig.DefaultInt("redis_db", 0), | ||
47 | - LogOutput: beego.AppConfig.DefaultString("log_output", "console"), | ||
48 | - LogFilename: beego.AppConfig.DefaultString("log_filename", "./log/ability.log"), | ||
49 | - LogLevel: beego.AppConfig.DefaultString("log_Level", "debug"), | ||
50 | - UcenterCheckAlt: beego.AppConfig.String("ucenter_check_alt"), | ||
51 | - UcenterBaseUrl: beego.AppConfig.String("ucenter_base_url"), | ||
52 | - UcenterSecret: beego.AppConfig.String("ucenter_secret"), | ||
53 | - UcenterAppKey: beego.AppConfig.String("ucenter_app_key"), | ||
54 | - FileSavePath: beego.AppConfig.String("file_save_path"), | ||
55 | - FileHost: beego.AppConfig.String("file_host"), | ||
56 | - FileHostPath: beego.AppConfig.String("file_host_path"), | 43 | + ConfigName: beego.AppConfig.String("config_name"), |
44 | + SqlConn: sqlconn, | ||
45 | + RedisAddPort: fmt.Sprintf("%s:%s", beego.AppConfig.String("redis_add"), beego.AppConfig.String("redis_add_port")), | ||
46 | + RedisAuth: beego.AppConfig.DefaultString("redis_auth", ""), | ||
47 | + RedisDB: beego.AppConfig.DefaultInt("redis_db", 0), | ||
48 | + LogOutput: beego.AppConfig.DefaultString("log_output", "console"), | ||
49 | + LogFilename: beego.AppConfig.DefaultString("log_filename", "./log/ability.log"), | ||
50 | + LogLevel: beego.AppConfig.DefaultString("log_Level", "debug"), | ||
51 | + UcenterCheckAlt: beego.AppConfig.String("ucenter_check_alt"), | ||
52 | + UcenterBaseUrl: beego.AppConfig.String("ucenter_base_url"), | ||
53 | + UcenterSecret: beego.AppConfig.String("ucenter_secret"), | ||
54 | + UcenterAppKey: beego.AppConfig.String("ucenter_app_key"), | ||
55 | + FileSavePath: beego.AppConfig.String("file_save_path"), | ||
56 | + FileHost: beego.AppConfig.String("file_host"), | ||
57 | + FileHostPath: beego.AppConfig.String("file_host_path"), | ||
58 | + BusinessAdminUrl: beego.AppConfig.String("business_admin_url"), | ||
57 | } | 59 | } |
58 | return MConfig | 60 | return MConfig |
59 | } | 61 | } |
@@ -32,6 +32,9 @@ ucenter_base_url = "http://suplus-ucenter-dev.fjmaimaimai.com" | @@ -32,6 +32,9 @@ ucenter_base_url = "http://suplus-ucenter-dev.fjmaimaimai.com" | ||
32 | ucenter_app_key = "39aefef9e22744a3b2d2d3791824ae7b" | 32 | ucenter_app_key = "39aefef9e22744a3b2d2d3791824ae7b" |
33 | ucenter_secret = "cykbjnfqgctn" | 33 | ucenter_secret = "cykbjnfqgctn" |
34 | 34 | ||
35 | +##企业平台相关配置 | ||
36 | +business_admin_url = "http://suplus-business-admin-dev.fjmaimaimai.com" | ||
37 | + | ||
35 | # 上传文件保存路径 | 38 | # 上传文件保存路径 |
36 | file_save_path = "/var/www/oppmg/file/opportunity" | 39 | file_save_path = "/var/www/oppmg/file/opportunity" |
37 | file_host = "http://mmm-oppmg-dev.fjmaimaimai.com" | 40 | file_host = "http://mmm-oppmg-dev.fjmaimaimai.com" |
@@ -32,6 +32,9 @@ ucenter_base_url = "https://public-interface.fjmaimaimai.com/ucenter" | @@ -32,6 +32,9 @@ ucenter_base_url = "https://public-interface.fjmaimaimai.com/ucenter" | ||
32 | ucenter_app_key = "39aefef9e22744a3b2d2d3791824ae7b" | 32 | ucenter_app_key = "39aefef9e22744a3b2d2d3791824ae7b" |
33 | ucenter_secret = "cykbjnfqgctn" | 33 | ucenter_secret = "cykbjnfqgctn" |
34 | 34 | ||
35 | +##企业平台相关配置 | ||
36 | +business_admin_url = "http://suplus-business-admin-prd.fjmaimaimai.com" | ||
37 | + | ||
35 | # 上传文件保存路径 | 38 | # 上传文件保存路径 |
36 | file_save_path = "/var/www/oppmg/file/opportunity" | 39 | file_save_path = "/var/www/oppmg/file/opportunity" |
37 | file_host = "https://public-interface.fjmaimaimai.com/opportunitymg" | 40 | file_host = "https://public-interface.fjmaimaimai.com/opportunitymg" |
@@ -32,6 +32,9 @@ ucenter_base_url = "http://suplus-ucenter-test.fjmaimaimai.com" | @@ -32,6 +32,9 @@ ucenter_base_url = "http://suplus-ucenter-test.fjmaimaimai.com" | ||
32 | ucenter_app_key = "39aefef9e22744a3b2d2d3791824ae7b" | 32 | ucenter_app_key = "39aefef9e22744a3b2d2d3791824ae7b" |
33 | ucenter_secret = "cykbjnfqgctn" | 33 | ucenter_secret = "cykbjnfqgctn" |
34 | 34 | ||
35 | +##企业平台相关配置 | ||
36 | +business_admin_url = "http://suplus-business-admin-test.fjmaimaimai.com" | ||
37 | + | ||
35 | # 上传文件保存路径 | 38 | # 上传文件保存路径 |
36 | file_save_path = "/var/www/oppmg/file/opportunity" | 39 | file_save_path = "/var/www/oppmg/file/opportunity" |
37 | file_host = "http://mmm-oppmg-test.fjmaimaimai.com" | 40 | file_host = "http://mmm-oppmg-test.fjmaimaimai.com" |
@@ -54,22 +54,22 @@ func (c AchievementController) AddAchievement() { | @@ -54,22 +54,22 @@ func (c AchievementController) AddAchievement() { | ||
54 | } | 54 | } |
55 | if len(param.ChanceData) == 0 { | 55 | if len(param.ChanceData) == 0 { |
56 | log.Error("len(param.ChanceData) == 0 ") | 56 | log.Error("len(param.ChanceData) == 0 ") |
57 | - msg = protocol.BadRequestParam("10109") | 57 | + msg = protocol.BadRequestParam("11102") |
58 | return | 58 | return |
59 | } | 59 | } |
60 | if param.ChanceTypeId == 0 { | 60 | if param.ChanceTypeId == 0 { |
61 | log.Error(" param.ChanceTypeId == 0 ") | 61 | log.Error(" param.ChanceTypeId == 0 ") |
62 | - msg = protocol.BadRequestParam("10108") | 62 | + msg = protocol.BadRequestParam("11101") |
63 | return | 63 | return |
64 | } | 64 | } |
65 | if param.GraspScore < 0 || param.GraspScore > 100 { | 65 | if param.GraspScore < 0 || param.GraspScore > 100 { |
66 | log.Error(" param.GraspScore < 0 || param.GraspScore > 100 ") | 66 | log.Error(" param.GraspScore < 0 || param.GraspScore > 100 ") |
67 | - msg = protocol.BadRequestParam("10121") | 67 | + msg = protocol.BadRequestParam("11104") |
68 | return | 68 | return |
69 | } | 69 | } |
70 | if param.UserGraspScore < 0 || param.UserGraspScore > 100 { | 70 | if param.UserGraspScore < 0 || param.UserGraspScore > 100 { |
71 | log.Error("param.UserGraspScore < 0 || param.UserGraspScore > 100") | 71 | log.Error("param.UserGraspScore < 0 || param.UserGraspScore > 100") |
72 | - msg = protocol.BadRequestParam("10122") | 72 | + msg = protocol.BadRequestParam("11105") |
73 | } | 73 | } |
74 | var providerScore float64 | 74 | var providerScore float64 |
75 | for _, v := range param.Provider { | 75 | for _, v := range param.Provider { |
@@ -78,7 +78,7 @@ func (c AchievementController) AddAchievement() { | @@ -78,7 +78,7 @@ func (c AchievementController) AddAchievement() { | ||
78 | remainScore := param.GraspScore - param.UserGraspScore - providerScore | 78 | remainScore := param.GraspScore - param.UserGraspScore - providerScore |
79 | if remainScore < 0 { | 79 | if remainScore < 0 { |
80 | log.Error("分配的总分不可大于把握分") | 80 | log.Error("分配的总分不可大于把握分") |
81 | - msg = protocol.BadRequestParam("10122") | 81 | + msg = protocol.BadRequestParam("11105") |
82 | return | 82 | return |
83 | } | 83 | } |
84 | 84 | ||
@@ -103,22 +103,22 @@ func (c AchievementController) EditAchievement() { | @@ -103,22 +103,22 @@ func (c AchievementController) EditAchievement() { | ||
103 | } | 103 | } |
104 | if len(param.ChanceData) == 0 { | 104 | if len(param.ChanceData) == 0 { |
105 | log.Error("len(param.ChanceData) == 0 ") | 105 | log.Error("len(param.ChanceData) == 0 ") |
106 | - msg = protocol.BadRequestParam("10109") | 106 | + msg = protocol.BadRequestParam("11102") |
107 | return | 107 | return |
108 | } | 108 | } |
109 | if param.ChanceTypeId == 0 { | 109 | if param.ChanceTypeId == 0 { |
110 | log.Error(" param.ChanceTypeId == 0 ") | 110 | log.Error(" param.ChanceTypeId == 0 ") |
111 | - msg = protocol.BadRequestParam("10108") | 111 | + msg = protocol.BadRequestParam("11101") |
112 | return | 112 | return |
113 | } | 113 | } |
114 | if param.GraspScore < 0 || param.GraspScore > 100 { | 114 | if param.GraspScore < 0 || param.GraspScore > 100 { |
115 | log.Error(" param.GraspScore < 0 || param.GraspScore > 100 ") | 115 | log.Error(" param.GraspScore < 0 || param.GraspScore > 100 ") |
116 | - msg = protocol.BadRequestParam("10121") | 116 | + msg = protocol.BadRequestParam("11104") |
117 | return | 117 | return |
118 | } | 118 | } |
119 | if param.UserGraspScore < 0 || param.UserGraspScore > 100 { | 119 | if param.UserGraspScore < 0 || param.UserGraspScore > 100 { |
120 | log.Error("param.UserGraspScore < 0 || param.UserGraspScore > 100") | 120 | log.Error("param.UserGraspScore < 0 || param.UserGraspScore > 100") |
121 | - msg = protocol.BadRequestParam("10122") | 121 | + msg = protocol.BadRequestParam("11105") |
122 | } | 122 | } |
123 | var providerScore float64 | 123 | var providerScore float64 |
124 | for _, v := range param.Provider { | 124 | for _, v := range param.Provider { |
@@ -127,7 +127,7 @@ func (c AchievementController) EditAchievement() { | @@ -127,7 +127,7 @@ func (c AchievementController) EditAchievement() { | ||
127 | remainScore := param.GraspScore - param.UserGraspScore - providerScore | 127 | remainScore := param.GraspScore - param.UserGraspScore - providerScore |
128 | if remainScore < 0 { | 128 | if remainScore < 0 { |
129 | log.Error("分配的总分不可大于把握分") | 129 | log.Error("分配的总分不可大于把握分") |
130 | - msg = protocol.BadRequestParam("10122") | 130 | + msg = protocol.BadRequestParam("11105") |
131 | return | 131 | return |
132 | } | 132 | } |
133 | companyid := c.GetCompanyId() | 133 | companyid := c.GetCompanyId() |
@@ -292,11 +292,11 @@ func (c *AuditController) EditReserveType() { | @@ -292,11 +292,11 @@ func (c *AuditController) EditReserveType() { | ||
292 | } | 292 | } |
293 | nameRune := []rune(param.Name) | 293 | nameRune := []rune(param.Name) |
294 | if len(nameRune) == 0 { | 294 | if len(nameRune) == 0 { |
295 | - msg = protocol.BadRequestParam("10133") | 295 | + msg = protocol.BadRequestParam("11112") |
296 | return | 296 | return |
297 | } | 297 | } |
298 | if len(nameRune) > 20 { | 298 | if len(nameRune) > 20 { |
299 | - msg = protocol.BadRequestParam("10134") | 299 | + msg = protocol.BadRequestParam("11113") |
300 | return | 300 | return |
301 | } | 301 | } |
302 | companyId := c.GetCompanyId() | 302 | companyId := c.GetCompanyId() |
@@ -61,7 +61,7 @@ func (c *AuthController) Login() { | @@ -61,7 +61,7 @@ func (c *AuthController) Login() { | ||
61 | return | 61 | return |
62 | } | 62 | } |
63 | if len(param.Account) == 0 || len(param.Password) == 0 { | 63 | if len(param.Account) == 0 || len(param.Password) == 0 { |
64 | - msg = protocol.BadRequestParam("10021") | 64 | + msg = protocol.BadRequestParam("10201") |
65 | return | 65 | return |
66 | } | 66 | } |
67 | logintoken, err := serveauth.LoginAuthByUCenter(param.Account, param.Password) | 67 | logintoken, err := serveauth.LoginAuthByUCenter(param.Account, param.Password) |
@@ -99,7 +99,7 @@ func (c *AuthController) LoginSms() { | @@ -99,7 +99,7 @@ func (c *AuthController) LoginSms() { | ||
99 | return | 99 | return |
100 | } | 100 | } |
101 | if len(param.Account) == 0 || len(param.Code) == 0 { | 101 | if len(param.Account) == 0 || len(param.Code) == 0 { |
102 | - msg = protocol.BadRequestParam("10021") | 102 | + msg = protocol.BadRequestParam("10201") |
103 | return | 103 | return |
104 | } | 104 | } |
105 | var uclientReturn *ucenter.ResponseLoginSms | 105 | var uclientReturn *ucenter.ResponseLoginSms |
@@ -112,7 +112,7 @@ func (c *AuthController) LoginSms() { | @@ -112,7 +112,7 @@ func (c *AuthController) LoginSms() { | ||
112 | Data: protocol.NullData, | 112 | Data: protocol.NullData, |
113 | } | 113 | } |
114 | } else { | 114 | } else { |
115 | - msg = protocol.NewMessage("10028") | 115 | + msg = protocol.NewMessage("10208") |
116 | } | 116 | } |
117 | return | 117 | return |
118 | } | 118 | } |
@@ -151,7 +151,7 @@ func (c *AuthController) LoginSecretKey() { | @@ -151,7 +151,7 @@ func (c *AuthController) LoginSecretKey() { | ||
151 | return | 151 | return |
152 | } | 152 | } |
153 | if len(param.Secret) == 0 { | 153 | if len(param.Secret) == 0 { |
154 | - msg = protocol.BadRequestParam("10080") | 154 | + msg = protocol.BadRequestParam("10210") |
155 | return | 155 | return |
156 | } | 156 | } |
157 | logintoken, err := serveauth.LoginAuthBySecretKey(param.Secret) | 157 | logintoken, err := serveauth.LoginAuthBySecretKey(param.Secret) |
@@ -36,7 +36,7 @@ func (this *BaseController) Prepare() { | @@ -36,7 +36,7 @@ func (this *BaseController) Prepare() { | ||
36 | companyid := this.GetCompanyId() | 36 | companyid := this.GetCompanyId() |
37 | ok := serveauth.ValidUserPermission(p, userid, companyid) | 37 | ok := serveauth.ValidUserPermission(p, userid, companyid) |
38 | if !ok { | 38 | if !ok { |
39 | - msg := protocol.NewMessage("10080") | 39 | + msg := protocol.NewMessage("10210") |
40 | this.ResposeJson(msg) | 40 | this.ResposeJson(msg) |
41 | return | 41 | return |
42 | } | 42 | } |
@@ -42,7 +42,7 @@ func (this *BulletinController) BulletinRelease() { | @@ -42,7 +42,7 @@ func (this *BulletinController) BulletinRelease() { | ||
42 | return | 42 | return |
43 | } | 43 | } |
44 | if len([]rune(request.Title)) > 30 { | 44 | if len([]rune(request.Title)) > 30 { |
45 | - msg = protocol.BadRequestParam("10278") | 45 | + msg = protocol.BadRequestParam("10618") |
46 | return | 46 | return |
47 | } | 47 | } |
48 | rsp, err := bulletin.BulletinRelease(uid, companyId, request) | 48 | rsp, err := bulletin.BulletinRelease(uid, companyId, request) |
@@ -55,11 +55,11 @@ func (c *CompanyController) DepartmentAdd() { | @@ -55,11 +55,11 @@ func (c *CompanyController) DepartmentAdd() { | ||
55 | } | 55 | } |
56 | s := []rune(param.Name) | 56 | s := []rune(param.Name) |
57 | if len(s) == 0 { | 57 | if len(s) == 0 { |
58 | - msg = protocol.BadRequestParam("10044") | 58 | + msg = protocol.BadRequestParam("10403") |
59 | return | 59 | return |
60 | } | 60 | } |
61 | if len(s) > 20 { | 61 | if len(s) > 20 { |
62 | - msg = protocol.BadRequestParam("10043") | 62 | + msg = protocol.BadRequestParam("10402") |
63 | return | 63 | return |
64 | } | 64 | } |
65 | 65 | ||
@@ -90,16 +90,16 @@ func (c *CompanyController) DepartmentUpdate() { | @@ -90,16 +90,16 @@ func (c *CompanyController) DepartmentUpdate() { | ||
90 | } | 90 | } |
91 | s := []rune(param.Name) | 91 | s := []rune(param.Name) |
92 | if len(s) == 0 { | 92 | if len(s) == 0 { |
93 | - msg = protocol.BadRequestParam("10044") | 93 | + msg = protocol.BadRequestParam("10403") |
94 | return | 94 | return |
95 | } | 95 | } |
96 | if len(s) > 20 { | 96 | if len(s) > 20 { |
97 | - msg = protocol.BadRequestParam("10043") | 97 | + msg = protocol.BadRequestParam("10402") |
98 | return | 98 | return |
99 | } | 99 | } |
100 | // if param.ParentID <= 0 { | 100 | // if param.ParentID <= 0 { |
101 | // //部门必定有上级部门 ,至少是公司一级 | 101 | // //部门必定有上级部门 ,至少是公司一级 |
102 | - // msg = protocol.BadRequestParam("10042") | 102 | + // msg = protocol.BadRequestParam("10401") |
103 | // return | 103 | // return |
104 | // } | 104 | // } |
105 | param.CompanyID = c.GetCompanyId() | 105 | param.CompanyID = c.GetCompanyId() |
@@ -170,7 +170,7 @@ func (c *CompanyController) PositionAdd() { | @@ -170,7 +170,7 @@ func (c *CompanyController) PositionAdd() { | ||
170 | } | 170 | } |
171 | n := []rune(param.Name) | 171 | n := []rune(param.Name) |
172 | if len(n) > 10 || len(n) == 0 { | 172 | if len(n) > 10 || len(n) == 0 { |
173 | - msg = protocol.BadRequestParam("10014") | 173 | + msg = protocol.BadRequestParam("10104") |
174 | return | 174 | return |
175 | } | 175 | } |
176 | param.CompanyID = c.GetCompanyId() | 176 | param.CompanyID = c.GetCompanyId() |
@@ -194,7 +194,7 @@ func (c *CompanyController) PositionEdit() { | @@ -194,7 +194,7 @@ func (c *CompanyController) PositionEdit() { | ||
194 | } | 194 | } |
195 | n := []rune(param.Name) | 195 | n := []rune(param.Name) |
196 | if len(n) > 10 || len(n) == 0 { | 196 | if len(n) > 10 || len(n) == 0 { |
197 | - msg = protocol.BadRequestParam("10014") | 197 | + msg = protocol.BadRequestParam("10104") |
198 | return | 198 | return |
199 | } | 199 | } |
200 | param.CompanyID = c.GetCompanyId() | 200 | param.CompanyID = c.GetCompanyId() |
@@ -261,24 +261,24 @@ func (c *CompanyController) PositionList() { | @@ -261,24 +261,24 @@ func (c *CompanyController) PositionList() { | ||
261 | // } | 261 | // } |
262 | // name := []rune(strings.TrimSpace(param.Name)) | 262 | // name := []rune(strings.TrimSpace(param.Name)) |
263 | // if len(name) == 0 { | 263 | // if len(name) == 0 { |
264 | -// msg = protocol.BadRequestParam("10035") | 264 | +// msg = protocol.BadRequestParam("10305") |
265 | // return | 265 | // return |
266 | // } | 266 | // } |
267 | // if len(name) > 10 { | 267 | // if len(name) > 10 { |
268 | -// msg = protocol.BadRequestParam("10034") | 268 | +// msg = protocol.BadRequestParam("10304") |
269 | // return | 269 | // return |
270 | // } | 270 | // } |
271 | // ok := utils.PhoneMatch.MatchString(param.Phone) | 271 | // ok := utils.PhoneMatch.MatchString(param.Phone) |
272 | // if !ok { | 272 | // if !ok { |
273 | -// msg = protocol.BadRequestParam("10036") | 273 | +// msg = protocol.BadRequestParam("10306") |
274 | // return | 274 | // return |
275 | // } | 275 | // } |
276 | // if len(param.Departments) == 0 { | 276 | // if len(param.Departments) == 0 { |
277 | -// msg = protocol.BadRequestParam("10037") | 277 | +// msg = protocol.BadRequestParam("10307") |
278 | // return | 278 | // return |
279 | // } | 279 | // } |
280 | // if len(param.Roles) == 0 { | 280 | // if len(param.Roles) == 0 { |
281 | -// msg = protocol.BadRequestParam("10038") | 281 | +// msg = protocol.BadRequestParam("10308") |
282 | // return | 282 | // return |
283 | // } | 283 | // } |
284 | // param.CompanyId = c.GetCompanyId() | 284 | // param.CompanyId = c.GetCompanyId() |
@@ -302,20 +302,20 @@ func (c *CompanyController) UserEdit() { | @@ -302,20 +302,20 @@ func (c *CompanyController) UserEdit() { | ||
302 | } | 302 | } |
303 | // name := []rune(strings.TrimSpace(param.Name)) | 303 | // name := []rune(strings.TrimSpace(param.Name)) |
304 | // if len(name) == 0 { | 304 | // if len(name) == 0 { |
305 | - // msg = protocol.BadRequestParam("10035") | 305 | + // msg = protocol.BadRequestParam("10305") |
306 | // return | 306 | // return |
307 | // } | 307 | // } |
308 | // if len(name) > 10 { | 308 | // if len(name) > 10 { |
309 | - // msg = protocol.BadRequestParam("10034") | 309 | + // msg = protocol.BadRequestParam("10304") |
310 | // return | 310 | // return |
311 | // } | 311 | // } |
312 | 312 | ||
313 | // if len(param.Departments) == 0 { | 313 | // if len(param.Departments) == 0 { |
314 | - // msg = protocol.BadRequestParam("10037") | 314 | + // msg = protocol.BadRequestParam("10307") |
315 | // return | 315 | // return |
316 | // } | 316 | // } |
317 | if len(param.Roles) == 0 { | 317 | if len(param.Roles) == 0 { |
318 | - msg = protocol.BadRequestParam("10038") | 318 | + msg = protocol.BadRequestParam("10308") |
319 | return | 319 | return |
320 | } | 320 | } |
321 | param.CompanyId = c.GetCompanyId() | 321 | param.CompanyId = c.GetCompanyId() |
@@ -48,7 +48,7 @@ func (c RankController) EditRankType() { | @@ -48,7 +48,7 @@ func (c RankController) EditRankType() { | ||
48 | param.Name = strings.TrimSpace(param.Name) | 48 | param.Name = strings.TrimSpace(param.Name) |
49 | n := []rune(param.Name) | 49 | n := []rune(param.Name) |
50 | if len(n) > 5 || len(n) == 0 { | 50 | if len(n) > 5 || len(n) == 0 { |
51 | - msg = protocol.BadRequestParam("10103") | 51 | + msg = protocol.BadRequestParam("11003") |
52 | return | 52 | return |
53 | } | 53 | } |
54 | companyid := c.GetCompanyId() | 54 | companyid := c.GetCompanyId() |
@@ -132,17 +132,17 @@ func (c RankController) RankSeasonAdd() { | @@ -132,17 +132,17 @@ func (c RankController) RankSeasonAdd() { | ||
132 | } | 132 | } |
133 | param.Name = strings.TrimSpace(param.Name) | 133 | param.Name = strings.TrimSpace(param.Name) |
134 | if len(param.Name) == 0 { | 134 | if len(param.Name) == 0 { |
135 | - msg = protocol.BadRequestParam("10104") | 135 | + msg = protocol.BadRequestParam("11004") |
136 | return | 136 | return |
137 | } | 137 | } |
138 | param.BeginTime = strings.TrimSpace(param.BeginTime) | 138 | param.BeginTime = strings.TrimSpace(param.BeginTime) |
139 | if len(param.BeginTime) == 0 { | 139 | if len(param.BeginTime) == 0 { |
140 | - msg = protocol.BadRequestParam("10105") | 140 | + msg = protocol.BadRequestParam("11005") |
141 | return | 141 | return |
142 | } | 142 | } |
143 | param.EndTime = strings.TrimSpace(param.EndTime) | 143 | param.EndTime = strings.TrimSpace(param.EndTime) |
144 | if len(param.EndTime) == 0 { | 144 | if len(param.EndTime) == 0 { |
145 | - msg = protocol.BadRequestParam("10106") | 145 | + msg = protocol.BadRequestParam("11006") |
146 | return | 146 | return |
147 | } | 147 | } |
148 | var ( | 148 | var ( |
@@ -151,13 +151,13 @@ func (c RankController) RankSeasonAdd() { | @@ -151,13 +151,13 @@ func (c RankController) RankSeasonAdd() { | ||
151 | ) | 151 | ) |
152 | t1, err := time.ParseInLocation("2006-01-02", param.BeginTime, time.Local) | 152 | t1, err := time.ParseInLocation("2006-01-02", param.BeginTime, time.Local) |
153 | if err != nil { | 153 | if err != nil { |
154 | - msg = protocol.BadRequestParam("10105") | 154 | + msg = protocol.BadRequestParam("11005") |
155 | return | 155 | return |
156 | } | 156 | } |
157 | beginTime = t1.Unix() | 157 | beginTime = t1.Unix() |
158 | t2, err := time.ParseInLocation("2006-01-02", param.EndTime, time.Local) | 158 | t2, err := time.ParseInLocation("2006-01-02", param.EndTime, time.Local) |
159 | if err != nil { | 159 | if err != nil { |
160 | - msg = protocol.BadRequestParam("10106") | 160 | + msg = protocol.BadRequestParam("11006") |
161 | return | 161 | return |
162 | } | 162 | } |
163 | endTime = t2.Unix() + 86399 //60*60*24-1 | 163 | endTime = t2.Unix() + 86399 //60*60*24-1 |
@@ -167,7 +167,7 @@ func (c RankController) RankSeasonAdd() { | @@ -167,7 +167,7 @@ func (c RankController) RankSeasonAdd() { | ||
167 | } | 167 | } |
168 | ok := serverank.RankPeriodCheckTime(param.RankTypeId, beginTime, endTime, 0) | 168 | ok := serverank.RankPeriodCheckTime(param.RankTypeId, beginTime, endTime, 0) |
169 | if !ok { | 169 | if !ok { |
170 | - msg = protocol.BadRequestParam("10101") | 170 | + msg = protocol.BadRequestParam("11001") |
171 | return | 171 | return |
172 | } | 172 | } |
173 | companyid := c.GetCompanyId() | 173 | companyid := c.GetCompanyId() |
@@ -203,12 +203,12 @@ func (c RankController) RankSeasonEdit() { | @@ -203,12 +203,12 @@ func (c RankController) RankSeasonEdit() { | ||
203 | } | 203 | } |
204 | param.BeginTime = strings.TrimSpace(param.BeginTime) | 204 | param.BeginTime = strings.TrimSpace(param.BeginTime) |
205 | if len(param.BeginTime) == 0 { | 205 | if len(param.BeginTime) == 0 { |
206 | - msg = protocol.BadRequestParam("10105") | 206 | + msg = protocol.BadRequestParam("11005") |
207 | return | 207 | return |
208 | } | 208 | } |
209 | param.EndTime = strings.TrimSpace(param.EndTime) | 209 | param.EndTime = strings.TrimSpace(param.EndTime) |
210 | if len(param.EndTime) == 0 { | 210 | if len(param.EndTime) == 0 { |
211 | - msg = protocol.BadRequestParam("10106") | 211 | + msg = protocol.BadRequestParam("11006") |
212 | return | 212 | return |
213 | } | 213 | } |
214 | var ( | 214 | var ( |
@@ -218,14 +218,14 @@ func (c RankController) RankSeasonEdit() { | @@ -218,14 +218,14 @@ func (c RankController) RankSeasonEdit() { | ||
218 | t1, err := time.ParseInLocation("2006-01-02", param.BeginTime, time.Local) | 218 | t1, err := time.ParseInLocation("2006-01-02", param.BeginTime, time.Local) |
219 | if err != nil { | 219 | if err != nil { |
220 | log.Error(err.Error()) | 220 | log.Error(err.Error()) |
221 | - msg = protocol.BadRequestParam("10105") | 221 | + msg = protocol.BadRequestParam("11005") |
222 | return | 222 | return |
223 | } | 223 | } |
224 | beginTime = t1.Unix() | 224 | beginTime = t1.Unix() |
225 | t2, err := time.ParseInLocation("2006-01-02", param.EndTime, time.Local) | 225 | t2, err := time.ParseInLocation("2006-01-02", param.EndTime, time.Local) |
226 | if err != nil { | 226 | if err != nil { |
227 | log.Error(err.Error()) | 227 | log.Error(err.Error()) |
228 | - msg = protocol.BadRequestParam("10106") | 228 | + msg = protocol.BadRequestParam("11006") |
229 | return | 229 | return |
230 | } | 230 | } |
231 | 231 | ||
@@ -236,7 +236,7 @@ func (c RankController) RankSeasonEdit() { | @@ -236,7 +236,7 @@ func (c RankController) RankSeasonEdit() { | ||
236 | } | 236 | } |
237 | ok := serverank.RankPeriodCheckTime(param.RankTypeId, beginTime, endTime, param.Id) | 237 | ok := serverank.RankPeriodCheckTime(param.RankTypeId, beginTime, endTime, param.Id) |
238 | if !ok { | 238 | if !ok { |
239 | - msg = protocol.BadRequestParam("10101") | 239 | + msg = protocol.BadRequestParam("11001") |
240 | return | 240 | return |
241 | } | 241 | } |
242 | companyid := c.GetCompanyId() | 242 | companyid := c.GetCompanyId() |
@@ -290,12 +290,12 @@ func (c RankController) RankRangeAdd() { | @@ -290,12 +290,12 @@ func (c RankController) RankRangeAdd() { | ||
290 | param.Name = strings.TrimSpace(param.Name) | 290 | param.Name = strings.TrimSpace(param.Name) |
291 | n := []rune(param.Name) | 291 | n := []rune(param.Name) |
292 | if len(n) == 0 || len(n) > 5 { | 292 | if len(n) == 0 || len(n) > 5 { |
293 | - msg = protocol.BadRequestParam("10107") | 293 | + msg = protocol.BadRequestParam("11007") |
294 | return | 294 | return |
295 | } | 295 | } |
296 | ok := serverank.RankRangeNameOnlyOne(param.RankTypeId, 0, param.Name) | 296 | ok := serverank.RankRangeNameOnlyOne(param.RankTypeId, 0, param.Name) |
297 | if !ok { | 297 | if !ok { |
298 | - msg = protocol.BadRequestParam("10125") | 298 | + msg = protocol.BadRequestParam("11009") |
299 | return | 299 | return |
300 | } | 300 | } |
301 | switch param.RangeType { | 301 | switch param.RangeType { |
@@ -339,7 +339,7 @@ func (c RankController) RankRangeEdit() { | @@ -339,7 +339,7 @@ func (c RankController) RankRangeEdit() { | ||
339 | param.Name = strings.TrimSpace(param.Name) | 339 | param.Name = strings.TrimSpace(param.Name) |
340 | n := []rune(param.Name) | 340 | n := []rune(param.Name) |
341 | if len(n) == 0 || len(n) > 5 { | 341 | if len(n) == 0 || len(n) > 5 { |
342 | - msg = protocol.BadRequestParam("10107") | 342 | + msg = protocol.BadRequestParam("11007") |
343 | return | 343 | return |
344 | } | 344 | } |
345 | 345 | ||
@@ -488,7 +488,7 @@ func (c RankController) RankItemEdit() { | @@ -488,7 +488,7 @@ func (c RankController) RankItemEdit() { | ||
488 | return | 488 | return |
489 | } | 489 | } |
490 | if len(param.ItemKey) > 4 { | 490 | if len(param.ItemKey) > 4 { |
491 | - msg = protocol.BadRequestParam("10123") | 491 | + msg = protocol.BadRequestParam("11008") |
492 | return | 492 | return |
493 | } | 493 | } |
494 | companyid := c.GetCompanyId() | 494 | companyid := c.GetCompanyId() |
@@ -517,7 +517,7 @@ func (c RankController) RankRangeMove() { | @@ -517,7 +517,7 @@ func (c RankController) RankRangeMove() { | ||
517 | } | 517 | } |
518 | companyid := c.GetCompanyId() | 518 | companyid := c.GetCompanyId() |
519 | if len(param.RelationId) == 0 { | 519 | if len(param.RelationId) == 0 { |
520 | - msg = protocol.BadRequestParam("10126") | 520 | + msg = protocol.BadRequestParam("11010") |
521 | return | 521 | return |
522 | } | 522 | } |
523 | err := serverank.RankRangeMove(param.FromId, param.ToId, param.RelationId, companyid) | 523 | err := serverank.RankRangeMove(param.FromId, param.ToId, param.RelationId, companyid) |
@@ -40,22 +40,22 @@ func (this *TemplateController) TemplateAdd() { | @@ -40,22 +40,22 @@ func (this *TemplateController) TemplateAdd() { | ||
40 | return | 40 | return |
41 | } | 41 | } |
42 | if len([]rune(request.Template.Name)) > 30 { | 42 | if len([]rune(request.Template.Name)) > 30 { |
43 | - msg = protocol.BadRequestParam("10070") | 43 | + msg = protocol.BadRequestParam("10610") |
44 | return | 44 | return |
45 | } | 45 | } |
46 | if len([]rune(request.Template.Doc)) > 30 { | 46 | if len([]rune(request.Template.Doc)) > 30 { |
47 | - msg = protocol.BadRequestParam("10272") | 47 | + msg = protocol.BadRequestParam("10612") |
48 | return | 48 | return |
49 | } | 49 | } |
50 | { | 50 | { |
51 | //审批人配置 | 51 | //审批人配置 |
52 | v := request.AuditFlowConfig.NoApprover | 52 | v := request.AuditFlowConfig.NoApprover |
53 | if !(v == models.NoApproverPass || v == models.NoApproverToAdmin) { | 53 | if !(v == models.NoApproverPass || v == models.NoApproverToAdmin) { |
54 | - msg = protocol.BadRequestParam("10068") | 54 | + msg = protocol.BadRequestParam("10608") |
55 | return | 55 | return |
56 | } | 56 | } |
57 | if len(request.AuditFlowConfig.ProcessConfig) == 0 { | 57 | if len(request.AuditFlowConfig.ProcessConfig) == 0 { |
58 | - msg = protocol.BadRequestParam("10069") | 58 | + msg = protocol.BadRequestParam("10609") |
59 | return | 59 | return |
60 | } | 60 | } |
61 | } | 61 | } |
@@ -116,11 +116,11 @@ func (this *TemplateController) TemplateUpdate() { | @@ -116,11 +116,11 @@ func (this *TemplateController) TemplateUpdate() { | ||
116 | return | 116 | return |
117 | } | 117 | } |
118 | if len([]rune(request.Template.Name)) > 30 { | 118 | if len([]rune(request.Template.Name)) > 30 { |
119 | - msg = protocol.BadRequestParam("10070") | 119 | + msg = protocol.BadRequestParam("10610") |
120 | return | 120 | return |
121 | } | 121 | } |
122 | if len([]rune(request.Template.Doc)) > 30 { | 122 | if len([]rune(request.Template.Doc)) > 30 { |
123 | - msg = protocol.BadRequestParam("10272") | 123 | + msg = protocol.BadRequestParam("10612") |
124 | return | 124 | return |
125 | } | 125 | } |
126 | { | 126 | { |
@@ -304,7 +304,7 @@ func (this *TemplateController) TemplateOperateCategory() { | @@ -304,7 +304,7 @@ func (this *TemplateController) TemplateOperateCategory() { | ||
304 | return | 304 | return |
305 | } | 305 | } |
306 | if len([]rune(request.Name)) > 10 { | 306 | if len([]rune(request.Name)) > 10 { |
307 | - msg = protocol.BadRequestParam("10070") | 307 | + msg = protocol.BadRequestParam("10610") |
308 | return | 308 | return |
309 | } | 309 | } |
310 | rsp, err := audit.TemplateOperateCategory(uid, companyId, request) | 310 | rsp, err := audit.TemplateOperateCategory(uid, companyId, request) |
@@ -448,10 +448,10 @@ func checkSelfCheckData(data []protocol.TemplateSelfCheck) error { | @@ -448,10 +448,10 @@ func checkSelfCheckData(data []protocol.TemplateSelfCheck) error { | ||
448 | for i, v := range data { | 448 | for i, v := range data { |
449 | s := []rune(v.Title) | 449 | s := []rune(v.Title) |
450 | if len(s) == 0 || len(s) > 50 { | 450 | if len(s) == 0 || len(s) > 50 { |
451 | - return protocol.NewErrWithMessage("10127") | 451 | + return protocol.NewErrWithMessage("11106") |
452 | } | 452 | } |
453 | if _, ok := titleMap[v.Title]; ok { | 453 | if _, ok := titleMap[v.Title]; ok { |
454 | - return protocol.NewErrWithMessage("10130") | 454 | + return protocol.NewErrWithMessage("11109") |
455 | } else { | 455 | } else { |
456 | titleMap[v.Title] = 1 | 456 | titleMap[v.Title] = 1 |
457 | } | 457 | } |
@@ -460,10 +460,10 @@ func checkSelfCheckData(data []protocol.TemplateSelfCheck) error { | @@ -460,10 +460,10 @@ func checkSelfCheckData(data []protocol.TemplateSelfCheck) error { | ||
460 | for _, vv := range data[i].Child { | 460 | for _, vv := range data[i].Child { |
461 | ss := []rune(vv.Title) | 461 | ss := []rune(vv.Title) |
462 | if len(ss) == 0 || len(ss) > 50 { | 462 | if len(ss) == 0 || len(ss) > 50 { |
463 | - return protocol.NewErrWithMessage("10127") | 463 | + return protocol.NewErrWithMessage("11106") |
464 | } | 464 | } |
465 | if _, ok := childTitleMap[vv.Title]; ok { | 465 | if _, ok := childTitleMap[vv.Title]; ok { |
466 | - return protocol.NewErrWithMessage("10130") | 466 | + return protocol.NewErrWithMessage("11109") |
467 | } else { | 467 | } else { |
468 | childTitleMap[vv.Title] = 1 | 468 | childTitleMap[vv.Title] = 1 |
469 | } | 469 | } |
@@ -471,7 +471,7 @@ func checkSelfCheckData(data []protocol.TemplateSelfCheck) error { | @@ -471,7 +471,7 @@ func checkSelfCheckData(data []protocol.TemplateSelfCheck) error { | ||
471 | } | 471 | } |
472 | } | 472 | } |
473 | if cnt > 30 { | 473 | if cnt > 30 { |
474 | - return protocol.NewErrWithMessage("10128") | 474 | + return protocol.NewErrWithMessage("11107") |
475 | } | 475 | } |
476 | return nil | 476 | return nil |
477 | } | 477 | } |
@@ -482,7 +482,7 @@ func auditFlowMustActionTypeOr(auditflow protocol.AuditFlowConfig) error { | @@ -482,7 +482,7 @@ func auditFlowMustActionTypeOr(auditflow protocol.AuditFlowConfig) error { | ||
482 | continue | 482 | continue |
483 | } | 483 | } |
484 | if v.AcitonType != models.ActionTypeOr { | 484 | if v.AcitonType != models.ActionTypeOr { |
485 | - return protocol.NewErrWithMessage("10129") | 485 | + return protocol.NewErrWithMessage("11108") |
486 | } | 486 | } |
487 | } | 487 | } |
488 | return nil | 488 | return nil |
@@ -59,14 +59,14 @@ var AuthToken = func(ctx *context.Context) { | @@ -59,14 +59,14 @@ var AuthToken = func(ctx *context.Context) { | ||
59 | storetoken, err = redisdata.GetLoginToken(mtoken.UID, mtoken.CompanyID) | 59 | storetoken, err = redisdata.GetLoginToken(mtoken.UID, mtoken.CompanyID) |
60 | if err != nil { | 60 | if err != nil { |
61 | log.Error("redisdata.GetLoginToken err:%s", err) | 61 | log.Error("redisdata.GetLoginToken err:%s", err) |
62 | - msg = protocol.NewMessage("10024") | 62 | + msg = protocol.NewMessage("10204") |
63 | ctx.Output.JSON(msg, false, false) | 63 | ctx.Output.JSON(msg, false, false) |
64 | return | 64 | return |
65 | } | 65 | } |
66 | if beego.BConfig.RunMode == "prod" { | 66 | if beego.BConfig.RunMode == "prod" { |
67 | //校验是否是单客户端操作 | 67 | //校验是否是单客户端操作 |
68 | if storetoken.AccessToken != accesstoken { | 68 | if storetoken.AccessToken != accesstoken { |
69 | - msg = protocol.NewMessage("10025") | 69 | + msg = protocol.NewMessage("10205") |
70 | ctx.Output.JSON(msg, false, false) | 70 | ctx.Output.JSON(msg, false, false) |
71 | return | 71 | return |
72 | } | 72 | } |
@@ -79,12 +79,12 @@ var AuthToken = func(ctx *context.Context) { | @@ -79,12 +79,12 @@ var AuthToken = func(ctx *context.Context) { | ||
79 | return | 79 | return |
80 | } | 80 | } |
81 | if ok := serveauth.IsJwtErrorExpired(err); ok { | 81 | if ok := serveauth.IsJwtErrorExpired(err); ok { |
82 | - msg := protocol.NewMessage("10024") | 82 | + msg := protocol.NewMessage("10204") |
83 | ctx.Output.JSON(msg, false, false) | 83 | ctx.Output.JSON(msg, false, false) |
84 | return | 84 | return |
85 | } | 85 | } |
86 | log.Error("token 校验失败:%s", err) | 86 | log.Error("token 校验失败:%s", err) |
87 | - msg = protocol.NewMessage("10024") | 87 | + msg = protocol.NewMessage("10204") |
88 | ctx.Output.JSON(msg, false, false) | 88 | ctx.Output.JSON(msg, false, false) |
89 | return | 89 | return |
90 | } | 90 | } |
@@ -16,12 +16,6 @@ type AchievementChance struct { | @@ -16,12 +16,6 @@ type AchievementChance struct { | ||
16 | Code string `json:"code"` | 16 | Code string `json:"code"` |
17 | } | 17 | } |
18 | 18 | ||
19 | -type AchievementImage struct { | ||
20 | - Path string `json:"path"` | ||
21 | - W int `json:"-"` | ||
22 | - H int `json:"-"` | ||
23 | -} | ||
24 | - | ||
25 | //RequestAddAchievement 添加成果 | 19 | //RequestAddAchievement 添加成果 |
26 | type RequestAddAchievement struct { | 20 | type RequestAddAchievement struct { |
27 | ChanceData []AchievementChance `json:"chance_data"` | 21 | ChanceData []AchievementChance `json:"chance_data"` |
@@ -33,7 +27,7 @@ type RequestAddAchievement struct { | @@ -33,7 +27,7 @@ type RequestAddAchievement struct { | ||
33 | UserGraspScore float64 `json:"user_grasp_score"` //把握人总得分 | 27 | UserGraspScore float64 `json:"user_grasp_score"` //把握人总得分 |
34 | Provider []AchievementProvider `json:"provider"` //机会提供者 | 28 | Provider []AchievementProvider `json:"provider"` //机会提供者 |
35 | SourceContent string `json:"source_content"` //成果描述文本 | 29 | SourceContent string `json:"source_content"` //成果描述文本 |
36 | - Images []AchievementImage `json:"image"` //图片 | 30 | + Images []ImageJsonData `json:"image"` //图片 |
37 | } | 31 | } |
38 | 32 | ||
39 | //RequestAddAchievement 添加成果 | 33 | //RequestAddAchievement 添加成果 |
@@ -46,7 +40,7 @@ type RequestEditAchievement struct { | @@ -46,7 +40,7 @@ type RequestEditAchievement struct { | ||
46 | UserGraspScore float64 `json:"user_grasp_score"` //把握人总得分 | 40 | UserGraspScore float64 `json:"user_grasp_score"` //把握人总得分 |
47 | SourceContent string `json:"source_content"` //成果描述文本 | 41 | SourceContent string `json:"source_content"` //成果描述文本 |
48 | Provider []AchievementProvider `json:"provider"` //机会提供者 | 42 | Provider []AchievementProvider `json:"provider"` //机会提供者 |
49 | - Images []AchievementImage `json:"image"` //图片 | 43 | + Images []ImageJsonData `json:"image"` //图片 |
50 | } | 44 | } |
51 | 45 | ||
52 | // ResponseRankSeasonList 赛季列表 | 46 | // ResponseRankSeasonList 赛季列表 |
@@ -83,6 +77,6 @@ type ResponseAchievementInfo struct { | @@ -83,6 +77,6 @@ type ResponseAchievementInfo struct { | ||
83 | UserGraspScore float64 `json:"user_grasp_score"` //把握人总得分 | 77 | UserGraspScore float64 `json:"user_grasp_score"` //把握人总得分 |
84 | Provider []AchievementProvider `json:"provider"` //机会提供者 | 78 | Provider []AchievementProvider `json:"provider"` //机会提供者 |
85 | SourceContent string `json:"source_content"` //成果描述文本 | 79 | SourceContent string `json:"source_content"` //成果描述文本 |
86 | - Images []AchievementImage `json:"image"` //图片 | 80 | + Images []ImageJsonData `json:"image"` //图片 |
87 | CrreateAt string `json:"create_at"` | 81 | CrreateAt string `json:"create_at"` |
88 | } | 82 | } |
@@ -111,3 +111,13 @@ type SelectChanceList struct { | @@ -111,3 +111,13 @@ type SelectChanceList struct { | ||
111 | ResponsePageInfo | 111 | ResponsePageInfo |
112 | List []SelectChanceListItem `json:"lists"` | 112 | List []SelectChanceListItem `json:"lists"` |
113 | } | 113 | } |
114 | + | ||
115 | +type ImageJsonData struct { | ||
116 | + Path string `json:"path"` | ||
117 | + ImageId string `json:"imageId"` | ||
118 | + W int `json:"w"` | ||
119 | + H int `json:"h"` | ||
120 | +} | ||
121 | + | ||
122 | +type VedioJsonData struct { | ||
123 | +} |
@@ -88,7 +88,13 @@ func (e ErrWithMessage) Unwrap() error { | @@ -88,7 +88,13 @@ func (e ErrWithMessage) Unwrap() error { | ||
88 | 88 | ||
89 | //ParseToMessage 实现CustomErrParse的接口 | 89 | //ParseToMessage 实现CustomErrParse的接口 |
90 | func (e ErrWithMessage) ParseToMessage() *ResponseMessage { | 90 | func (e ErrWithMessage) ParseToMessage() *ResponseMessage { |
91 | - return NewMessage(e.Errno) | 91 | + rsp := &ResponseMessage{ |
92 | + Errno: transformCode(e.Errno), | ||
93 | + Errmsg: e.Errmsg, | ||
94 | + Data: NullData, | ||
95 | + OriginErrno: e.Errno, | ||
96 | + } | ||
97 | + return rsp | ||
92 | } | 98 | } |
93 | 99 | ||
94 | func SearchErr(code string) ErrorCode { | 100 | func SearchErr(code string) ErrorCode { |
@@ -4,7 +4,7 @@ var errmessge ErrorMap = map[string]string{ | @@ -4,7 +4,7 @@ var errmessge ErrorMap = map[string]string{ | ||
4 | //操作 | 4 | //操作 |
5 | "0": "ok", | 5 | "0": "ok", |
6 | "1": "网络连接无响应", | 6 | "1": "网络连接无响应", |
7 | - //角色相关 | 7 | + //角色相关 100xx |
8 | "10001": "请先删除该分组下的其他角色", | 8 | "10001": "请先删除该分组下的其他角色", |
9 | "10002": "请先删除该角色下的人员", | 9 | "10002": "请先删除该角色下的人员", |
10 | "10003": "无效角色", | 10 | "10003": "无效角色", |
@@ -18,120 +18,126 @@ var errmessge ErrorMap = map[string]string{ | @@ -18,120 +18,126 @@ var errmessge ErrorMap = map[string]string{ | ||
18 | "10082": "管理员组角色不能移出", | 18 | "10082": "管理员组角色不能移出", |
19 | "10083": "不能将角色添加进管理员组", | 19 | "10083": "不能将角色添加进管理员组", |
20 | "10084": "角色组已存在", | 20 | "10084": "角色组已存在", |
21 | - //职位相关 | ||
22 | - "10011": "该职位已被使用无法删除", | ||
23 | - "10012": "超过10级的职位限制,请重新选择", | ||
24 | - "10013": "同一级职位名称不允许重复", | ||
25 | - "10014": "职位名称最多10个字符", | ||
26 | - "10015": "上级职位不能选择当前职位及其下级职位", | ||
27 | - //安全认证相关 | ||
28 | - "10020": "验证码过期", | ||
29 | - "10021": "账号或密码不正确", | ||
30 | - "10022": "账号已被禁用", | ||
31 | - "10023": "用户无使用权限", | ||
32 | - "10024": "登录凭证失效", | ||
33 | - "10025": "该账号已在其他地方登录", | ||
34 | - "10026": "验证码校验失败", | ||
35 | - "10027": "无操作权限", | ||
36 | - "10028": "请输入正确的验证码", | ||
37 | - "10029": "获取验证码失败", | ||
38 | - "10080": "无操作权限", | ||
39 | - "10111": "获取公司信息失败", | ||
40 | 21 | ||
41 | - //用户相关 | ||
42 | - "10031": "无效角色", | ||
43 | - "10032": "无效部门", | ||
44 | - "10033": "无效职位", | ||
45 | - "10034": "名字限制10个字符以内", | ||
46 | - "10035": "名字是必填项", | ||
47 | - "10036": "请输入正确的手机格式", | ||
48 | - "10037": "用户的部门必填", | ||
49 | - "10038": "用户的角色必填", | ||
50 | - "10039": "用户已存在", | ||
51 | - "10071": "不能删除主管理员", | ||
52 | - "10072": "不能禁用主管理员", | ||
53 | - "10073": "角色组已存在", | ||
54 | - "10074": "删除失败,存在需要用户审批的单子", | ||
55 | - "10075": "禁用失败,存在需要用户审批的单子", | ||
56 | - //部门相关 | ||
57 | - "10041": "无效的主管设置", | ||
58 | - "10042": "上级部门不能选择当前部门及其子部门", | ||
59 | - "10043": "部门名称限制不超过20个字符", | ||
60 | - "10044": "部门名称必填", | ||
61 | - "10045": "同一级部门名称不允许重复", | ||
62 | - "10046": "超过10级的部门限制,请重新选择", | ||
63 | - "10047": "只能删除没有成员的部门,需要先删除部门下的员工,再删除该部门", | ||
64 | - "10048": "请设置上级部门", | ||
65 | - //用户中心相关 | ||
66 | - "10051": "无法从远端接口获取公司数据", | ||
67 | - "10052": "服务调用失败", | ||
68 | - //模板相关 | ||
69 | - "10061": "请先删除该分类下的二级分类", | ||
70 | - "10062": "该分类已被使用无法删除", | ||
71 | - "10063": "该分类已被使用无法禁用", | ||
72 | - "10064": "编码已存在", | ||
73 | - "10065": "编码长度最多6个字符", | ||
74 | - "10067": "一级分类不存在", | ||
75 | - "10068": "审核人为空参数有误", | ||
76 | - "10069": "未设置审核人", | ||
77 | - "10070": "分类名称输入大于10个字符", | ||
78 | - "10271": "模板已存在", | ||
79 | - "10272": "说明信息输入大于30个字符", | ||
80 | - "10273": "表单列最多20个字符", | ||
81 | - "10274": "最多添加10个字段", | ||
82 | - "10275": "最多添加1个节点", | ||
83 | - "10276": "最多选择1个角色", | ||
84 | - "10277": "最多一个小数", | ||
85 | - "10278": "公告标题大于30个字符", | ||
86 | - "10279": "该子分类名称已存在", | ||
87 | - "10280": "请为您选择的特殊人员设置审批流程", | ||
88 | - "10281": "请您选择的审批人员", | ||
89 | - "10282": "请您选择的审批角色", | ||
90 | - "10283": "特殊审批流程被审批人不可重复", | ||
91 | - "10284": "表单字段已经重复", | ||
92 | - "10285": "未设置基础内容", | ||
93 | - "10286": "未设置特殊审批人", | 22 | + //职位相关 101xx |
23 | + "10101": "该职位已被使用无法删除", | ||
24 | + "10102": "超过10级的职位限制,请重新选择", | ||
25 | + "10103": "同一级职位名称不允许重复", | ||
26 | + "10104": "职位名称最多10个字符", | ||
27 | + "10105": "上级职位不能选择当前职位及其下级职位", | ||
94 | 28 | ||
95 | - "10170": "请选择指定成员", | ||
96 | - "10171": "请选择审批人类别", | ||
97 | - "10172": "请选择审批方式", | ||
98 | - "10173": "请选择指定角色", | ||
99 | - "10174": "人数不能超过10个", | ||
100 | - "10175": "请选择一个角色", | ||
101 | - "10176": "至多添加一个审批人", | ||
102 | - //公司相关 | ||
103 | - "12001": "未找到公司信息", | 29 | + //安全认证相关 102xx |
30 | + "10200": "验证码过期", | ||
31 | + "10201": "账号或密码不正确", | ||
32 | + "10202": "账号已被禁用", | ||
33 | + "10203": "用户无使用权限", | ||
34 | + "10204": "登录凭证失效", | ||
35 | + "10205": "该账号已在其他地方登录", | ||
36 | + "10206": "验证码校验失败", | ||
37 | + "10207": "无操作权限", | ||
38 | + "10208": "请输入正确的验证码", | ||
39 | + "10209": "获取验证码失败", | ||
40 | + "10210": "无操作权限", | ||
41 | + "10211": "获取公司信息失败", | ||
42 | + "10212": "公司未启用该模块", | ||
104 | 43 | ||
105 | - //评分配置相关 | ||
106 | - "12101": "分值范围不符合要求", | ||
107 | - "12102": "评分规则不符合要求", | ||
108 | - //权限配置相关 | ||
109 | - "10091": "至少选择一个特定部门", | 44 | + //用户相关 103xx |
45 | + "10301": "无效角色", | ||
46 | + "10302": "无效部门", | ||
47 | + "10303": "无效职位", | ||
48 | + "10304": "名字限制10个字符以内", | ||
49 | + "10305": "名字是必填项", | ||
50 | + "10306": "请输入正确的手机格式", | ||
51 | + "10307": "用户的部门必填", | ||
52 | + "10308": "用户的角色必填", | ||
53 | + "10309": "用户已存在", | ||
54 | + "10310": "不能删除主管理员", | ||
55 | + "10311": "不能禁用主管理员", | ||
56 | + "10312": "角色组已存在", | ||
57 | + "10313": "删除失败,存在需要用户审批的单子", | ||
58 | + "10314": "禁用失败,存在需要用户审批的单子", | ||
59 | + //部门相关 104xx | ||
60 | + "10400": "无效的主管设置", | ||
61 | + "10401": "上级部门不能选择当前部门及其子部门", | ||
62 | + "10402": "部门名称限制不超过20个字符", | ||
63 | + "10403": "部门名称必填", | ||
64 | + "10404": "同一级部门名称不允许重复", | ||
65 | + "10405": "超过10级的部门限制,请重新选择", | ||
66 | + "10406": "只能删除没有成员的部门,需要先删除部门下的员工,再删除该部门", | ||
67 | + "10407": "请设置上级部门", | ||
110 | 68 | ||
111 | - "10101": "赛季周期设置与其他赛季重叠", | ||
112 | - "10102": "参与人类型不一致", | ||
113 | - "10103": "排行榜名称最多5个字符", | ||
114 | - "10104": "赛季名称最多输入20个字符", | ||
115 | - "10105": "赛季开始时间必填", | ||
116 | - "10106": "赛季结束时间必填", | ||
117 | - "10107": "参与范围名称最多输入5个字符", | ||
118 | - "10108": "成果一级分类必填", | ||
119 | - "10109": "成果来源必填", | ||
120 | - "10110": "把握人得分不可大于把握得分", | ||
121 | - "10121": "把握得分必填,0.1-100", | ||
122 | - "10122": "分配的总分不可大于把握分", | ||
123 | - "10123": "排行榜评比项最多4项", | ||
124 | - "10124": "公司未启用该模块", | ||
125 | - "10125": "参与范围名称不能重复", | ||
126 | - "10126": "被转移人员不能为空", | ||
127 | - "10127": "自查内容维度名称最多输入50个字符", | ||
128 | - "10128": "自查内容维度最多输入30个字段", | ||
129 | - "10129": "存在自查内容时只能进行或签设置", | ||
130 | - "10130": "同一级的自查内容不能重复", | ||
131 | - "10131": "储备池分类名称已存在", | ||
132 | - "10132": "无法删除已使用的储备池分类", | ||
133 | - "10133": "储备池分类名称必填", | ||
134 | - "10134": "储备池分类名称最多20个字", | 69 | + // 请求统一用户中心相关 105xx |
70 | + "10501": "无法从远端接口获取公司数据", | ||
71 | + "10502": "服务调用失败", | ||
72 | + | ||
73 | + //模板相关 106xx | ||
74 | + "10601": "请先删除该分类下的二级分类", | ||
75 | + "10602": "该分类已被使用无法删除", | ||
76 | + "10603": "该分类已被使用无法禁用", | ||
77 | + "10604": "编码已存在", | ||
78 | + "10605": "编码长度最多6个字符", | ||
79 | + "10607": "一级分类不存在", | ||
80 | + "10608": "审核人为空参数有误", | ||
81 | + "10609": "未设置审核人", | ||
82 | + "10610": "分类名称输入大于10个字符", | ||
83 | + "10611": "模板已存在", | ||
84 | + "10612": "说明信息输入大于30个字符", | ||
85 | + "10613": "表单列最多20个字符", | ||
86 | + "10614": "最多添加10个字段", | ||
87 | + "10615": "最多添加1个节点", | ||
88 | + "10616": "最多选择1个角色", | ||
89 | + "10617": "最多一个小数", | ||
90 | + "10618": "公告标题大于30个字符", | ||
91 | + "10619": "该子分类名称已存在", | ||
92 | + "10620": "请为您选择的特殊人员设置审批流程", | ||
93 | + "10621": "请您选择的审批人员", | ||
94 | + "10622": "请您选择的审批角色", | ||
95 | + "10623": "特殊审批流程被审批人不可重复", | ||
96 | + "10624": "表单字段已经重复", | ||
97 | + "10625": "未设置基础内容", | ||
98 | + "10626": "未设置特殊审批人", | ||
99 | + "10627": "请选择指定成员", | ||
100 | + "10628": "请选择审批人类别", | ||
101 | + "10629": "请选择审批方式", | ||
102 | + "10630": "请选择指定角色", | ||
103 | + "10631": "人数不能超过10个", | ||
104 | + "10632": "请选择一个角色", | ||
105 | + "10633": "至多添加一个审批人", | ||
106 | + //公司相关 107xx | ||
107 | + "10701": "未找到公司信息", | ||
108 | + | ||
109 | + //评分配置相关 108xx | ||
110 | + "10801": "分值范围不符合要求", | ||
111 | + "10802": "评分规则不符合要求", | ||
112 | + | ||
113 | + //权限配置相关 109xx | ||
114 | + "10901": "至少选择一个特定部门", | ||
115 | + | ||
116 | + //赛季配置相关 110xx | ||
117 | + "11001": "赛季周期设置与其他赛季重叠", | ||
118 | + "11002": "参与人类型不一致", | ||
119 | + "11003": "排行榜名称最多5个字符", | ||
120 | + "11004": "赛季名称最多输入20个字符", | ||
121 | + "11005": "赛季开始时间必填", | ||
122 | + "11006": "赛季结束时间必填", | ||
123 | + "11007": "参与范围名称最多输入5个字符", | ||
124 | + "11008": "排行榜评比项最多4项", | ||
125 | + "11009": "参与范围名称不能重复", | ||
126 | + "11010": "被转移人员不能为空", | ||
127 | + //成果相关 111xx | ||
128 | + "11101": "成果一级分类必填", | ||
129 | + "11102": "成果来源必填", | ||
130 | + "11103": "把握人得分不可大于把握得分", | ||
131 | + "11104": "把握得分必填,0.1-100", | ||
132 | + "11105": "分配的总分不可大于把握分", | ||
133 | + "11106": "自查内容维度名称最多输入50个字符", | ||
134 | + "11107": "自查内容维度最多输入30个字段", | ||
135 | + "11108": "存在自查内容时只能进行或签设置", | ||
136 | + "11109": "同一级的自查内容不能重复", | ||
137 | + "11110": "储备池分类名称已存在", | ||
138 | + "11111": "无法删除已使用的储备池分类", | ||
139 | + "11112": "储备池分类名称必填", | ||
140 | + "11113": "储备池分类名称最多20个字", | ||
135 | } | 141 | } |
136 | 142 | ||
137 | //错误码转换 ,兼容需要 | 143 | //错误码转换 ,兼容需要 |
@@ -139,7 +145,7 @@ func transformCode(code string) int { | @@ -139,7 +145,7 @@ func transformCode(code string) int { | ||
139 | switch code { | 145 | switch code { |
140 | case "0": | 146 | case "0": |
141 | return 0 //登录成功 | 147 | return 0 //登录成功 |
142 | - case "10026", "10024": | 148 | + case "10206", "10204": |
143 | return 2 //token过期 | 149 | return 2 //token过期 |
144 | } | 150 | } |
145 | return -1 //请求成功,但业务检查不通过 | 151 | return -1 //请求成功,但业务检查不通过 |
@@ -310,7 +310,7 @@ func GetAchievementList(pageIndex int, pageSize int, companyId int64, status int | @@ -310,7 +310,7 @@ func GetAchievementList(pageIndex int, pageSize int, companyId int64, status int | ||
310 | 310 | ||
311 | func GetAchievementInfo(id int64, companyId int64) *protocol.ResponseAchievementInfo { | 311 | func GetAchievementInfo(id int64, companyId int64) *protocol.ResponseAchievementInfo { |
312 | rspData := &protocol.ResponseAchievementInfo{ | 312 | rspData := &protocol.ResponseAchievementInfo{ |
313 | - Images: make([]protocol.AchievementImage, 0), | 313 | + Images: make([]protocol.ImageJsonData, 0), |
314 | Provider: make([]protocol.AchievementProvider, 0), | 314 | Provider: make([]protocol.AchievementProvider, 0), |
315 | ChanceData: make([]protocol.AchievementChance, 0), | 315 | ChanceData: make([]protocol.AchievementChance, 0), |
316 | } | 316 | } |
@@ -326,7 +326,7 @@ func GetAchievementInfo(id int64, companyId int64) *protocol.ResponseAchievement | @@ -326,7 +326,7 @@ func GetAchievementInfo(id int64, companyId int64) *protocol.ResponseAchievement | ||
326 | rspData.ChanceTypeId = achievementData.ChanceTypeId | 326 | rspData.ChanceTypeId = achievementData.ChanceTypeId |
327 | rspData.DepartmentId = achievementData.DepartmentId | 327 | rspData.DepartmentId = achievementData.DepartmentId |
328 | rspData.SourceContent = achievementData.SourceContent | 328 | rspData.SourceContent = achievementData.SourceContent |
329 | - img := make([]protocol.AchievementImage, 0) | 329 | + img := make([]protocol.ImageJsonData, 0) |
330 | json.Unmarshal([]byte(achievementData.Images), &img) | 330 | json.Unmarshal([]byte(achievementData.Images), &img) |
331 | rspData.Images = img | 331 | rspData.Images = img |
332 | rspData.GraspScore = achievementData.GraspScore | 332 | rspData.GraspScore = achievementData.GraspScore |
@@ -53,7 +53,7 @@ func GetReserveTypeLsit(pageIndex int, pageSize int, companyid int64) protocol.R | @@ -53,7 +53,7 @@ func GetReserveTypeLsit(pageIndex int, pageSize int, companyid int64) protocol.R | ||
53 | func AddReserveType(name string, companyid int64) error { | 53 | func AddReserveType(name string, companyid int64) error { |
54 | has := models.HasChanceReserveTypeName(name, companyid, 0) | 54 | has := models.HasChanceReserveTypeName(name, companyid, 0) |
55 | if has { | 55 | if has { |
56 | - return protocol.NewErrWithMessage("10131") | 56 | + return protocol.NewErrWithMessage("11110") |
57 | } | 57 | } |
58 | m := &models.ChanceReserveType{ | 58 | m := &models.ChanceReserveType{ |
59 | Name: name, | 59 | Name: name, |
@@ -69,7 +69,7 @@ func AddReserveType(name string, companyid int64) error { | @@ -69,7 +69,7 @@ func AddReserveType(name string, companyid int64) error { | ||
69 | func EditReserveType(id int, name string, companyid int64) error { | 69 | func EditReserveType(id int, name string, companyid int64) error { |
70 | has := models.HasChanceReserveTypeName(name, companyid, id) | 70 | has := models.HasChanceReserveTypeName(name, companyid, id) |
71 | if has { | 71 | if has { |
72 | - return protocol.NewErrWithMessage("10131") | 72 | + return protocol.NewErrWithMessage("11110") |
73 | } | 73 | } |
74 | m := &models.ChanceReserveType{} | 74 | m := &models.ChanceReserveType{} |
75 | var err error | 75 | var err error |
@@ -106,7 +106,7 @@ func DeleteReserveType(id int, companyid int64) error { | @@ -106,7 +106,7 @@ func DeleteReserveType(id int, companyid int64) error { | ||
106 | o := orm.NewOrm() | 106 | o := orm.NewOrm() |
107 | has := o.QueryTable(&models.Chance{}).Filter("reserve_type_id", id).Exist() | 107 | has := o.QueryTable(&models.Chance{}).Filter("reserve_type_id", id).Exist() |
108 | if has { | 108 | if has { |
109 | - return protocol.NewErrWithMessage("10132") | 109 | + return protocol.NewErrWithMessage("11111") |
110 | } | 110 | } |
111 | err = models.DeleteChanceReserveType(id) | 111 | err = models.DeleteChanceReserveType(id) |
112 | if err != nil { | 112 | if err != nil { |
@@ -28,15 +28,15 @@ func TemplateAdd(uid, companyId int64, request *protocol.TemplateAddRequest) (rs | @@ -28,15 +28,15 @@ func TemplateAdd(uid, companyId int64, request *protocol.TemplateAddRequest) (rs | ||
28 | return | 28 | return |
29 | } | 29 | } |
30 | if len([]rune(request.Template.Code)) > 6 { | 30 | if len([]rune(request.Template.Code)) > 6 { |
31 | - err = protocol.NewErrWithMessage("10065") | 31 | + err = protocol.NewErrWithMessage("10605") |
32 | return | 32 | return |
33 | } | 33 | } |
34 | if _, err = models.GetAuditTemplateByCode(companyId, request.Template.Code, request.Template.ChanceTypeId); err == nil { | 34 | if _, err = models.GetAuditTemplateByCode(companyId, request.Template.Code, request.Template.ChanceTypeId); err == nil { |
35 | - err = protocol.NewErrWithMessage("10064") | 35 | + err = protocol.NewErrWithMessage("10604") |
36 | return | 36 | return |
37 | } | 37 | } |
38 | if _, err = models.GetAuditTemplateByName(companyId, request.Template.Name, request.Template.ChanceTypeId); err == nil { | 38 | if _, err = models.GetAuditTemplateByName(companyId, request.Template.Name, request.Template.ChanceTypeId); err == nil { |
39 | - err = protocol.NewErrWithMessage("10279") | 39 | + err = protocol.NewErrWithMessage("10619") |
40 | return | 40 | return |
41 | } | 41 | } |
42 | orm := orm2.NewOrm() | 42 | orm := orm2.NewOrm() |
@@ -390,7 +390,7 @@ func TemplateUpdate(uid, companyId int64, request *protocol.TemplateUpdateReques | @@ -390,7 +390,7 @@ func TemplateUpdate(uid, companyId int64, request *protocol.TemplateUpdateReques | ||
390 | } | 390 | } |
391 | if template.Name != request.Template.Name { | 391 | if template.Name != request.Template.Name { |
392 | if _, err = models.GetAuditTemplateByName(companyId, request.Template.Name, request.Template.ChanceTypeId); err == nil { | 392 | if _, err = models.GetAuditTemplateByName(companyId, request.Template.Name, request.Template.ChanceTypeId); err == nil { |
393 | - err = protocol.NewErrWithMessage("10279") | 393 | + err = protocol.NewErrWithMessage("10619") |
394 | return | 394 | return |
395 | } | 395 | } |
396 | } | 396 | } |
@@ -604,7 +604,7 @@ func TemplateEditVisible(uid, companyId int64, request *protocol.TemplateEditVis | @@ -604,7 +604,7 @@ func TemplateEditVisible(uid, companyId int64, request *protocol.TemplateEditVis | ||
604 | return | 604 | return |
605 | } | 605 | } |
606 | if template.CompanyId != int(companyId) { | 606 | if template.CompanyId != int(companyId) { |
607 | - err = protocol.NewErrWithMessage("10027") | 607 | + err = protocol.NewErrWithMessage("10207") |
608 | log.Error("template_id:%v companyId:%v want:%v not equal.", request.Id, companyId, template.CompanyId) | 608 | log.Error("template_id:%v companyId:%v want:%v not equal.", request.Id, companyId, template.CompanyId) |
609 | return | 609 | return |
610 | } | 610 | } |
@@ -646,7 +646,7 @@ func TemplateEditSort(uid, companyId int64, request *protocol.TemplateEditSortRe | @@ -646,7 +646,7 @@ func TemplateEditSort(uid, companyId int64, request *protocol.TemplateEditSortRe | ||
646 | } | 646 | } |
647 | if template.CompanyId != int(companyId) { | 647 | if template.CompanyId != int(companyId) { |
648 | log.Debug(fmt.Sprintf("template.companyId input:%v want:%v not equal.", companyId, template.CompanyId)) | 648 | log.Debug(fmt.Sprintf("template.companyId input:%v want:%v not equal.", companyId, template.CompanyId)) |
649 | - err = protocol.NewErrWithMessage("10027") | 649 | + err = protocol.NewErrWithMessage("10207") |
650 | return | 650 | return |
651 | } | 651 | } |
652 | if item.SortNum == template.SortNum { | 652 | if item.SortNum == template.SortNum { |
@@ -751,17 +751,17 @@ func TemplateDelete(uid, companyId int64, request *protocol.TemplateDeleteReques | @@ -751,17 +751,17 @@ func TemplateDelete(uid, companyId int64, request *protocol.TemplateDeleteReques | ||
751 | return | 751 | return |
752 | } | 752 | } |
753 | if template.CompanyId != int(companyId) { | 753 | if template.CompanyId != int(companyId) { |
754 | - err = protocol.NewErrWithMessage("10027") | 754 | + err = protocol.NewErrWithMessage("10207") |
755 | return | 755 | return |
756 | } | 756 | } |
757 | //2.判断是否有对应已经发布的机会 | 757 | //2.判断是否有对应已经发布的机会 |
758 | if err = utils.ExecuteQueryOne(&num, sql1, request.TemplateId); err == nil && num > 0 { | 758 | if err = utils.ExecuteQueryOne(&num, sql1, request.TemplateId); err == nil && num > 0 { |
759 | - err = protocol.NewErrWithMessage("10062") | 759 | + err = protocol.NewErrWithMessage("10602") |
760 | return | 760 | return |
761 | } | 761 | } |
762 | //3.判断是否有对应发布的成果 | 762 | //3.判断是否有对应发布的成果 |
763 | if err = utils.ExecuteQueryOne(&num, sql2, request.TemplateId); err == nil && num > 0 { | 763 | if err = utils.ExecuteQueryOne(&num, sql2, request.TemplateId); err == nil && num > 0 { |
764 | - err = protocol.NewErrWithMessage("10062") | 764 | + err = protocol.NewErrWithMessage("10602") |
765 | return | 765 | return |
766 | } | 766 | } |
767 | 767 | ||
@@ -802,13 +802,13 @@ func TemplateEditEnable(uid, companyId int64, request *protocol.TemplateEditEnab | @@ -802,13 +802,13 @@ func TemplateEditEnable(uid, companyId int64, request *protocol.TemplateEditEnab | ||
802 | return | 802 | return |
803 | } | 803 | } |
804 | if template.CompanyId != int(companyId) { | 804 | if template.CompanyId != int(companyId) { |
805 | - err = protocol.NewErrWithMessage("10027") | 805 | + err = protocol.NewErrWithMessage("10207") |
806 | return | 806 | return |
807 | } | 807 | } |
808 | //2.判断是否有对应已经发布的机会 | 808 | //2.判断是否有对应已经发布的机会 |
809 | if request.Enabled == 0 { | 809 | if request.Enabled == 0 { |
810 | if err = utils.ExecuteQueryOne(&num, sql1, request.TemplateId); err == nil && num > 0 { | 810 | if err = utils.ExecuteQueryOne(&num, sql1, request.TemplateId); err == nil && num > 0 { |
811 | - err = protocol.NewErrWithMessage("10063") | 811 | + err = protocol.NewErrWithMessage("10603") |
812 | return | 812 | return |
813 | } | 813 | } |
814 | } | 814 | } |
@@ -832,13 +832,13 @@ func TemplateOperateCategory(uid, companyId int64, request *protocol.TemplateOpe | @@ -832,13 +832,13 @@ func TemplateOperateCategory(uid, companyId int64, request *protocol.TemplateOpe | ||
832 | return | 832 | return |
833 | } | 833 | } |
834 | if chanceType.CompanyId != int(companyId) { | 834 | if chanceType.CompanyId != int(companyId) { |
835 | - err = protocol.NewErrWithMessage("10027") | 835 | + err = protocol.NewErrWithMessage("10207") |
836 | log.Error("template_id:%v companyId:%v want:%v not equal.", request.Id, companyId, chanceType.CompanyId) | 836 | log.Error("template_id:%v companyId:%v want:%v not equal.", request.Id, companyId, chanceType.CompanyId) |
837 | return | 837 | return |
838 | } | 838 | } |
839 | if chanceType.Name != request.Name { | 839 | if chanceType.Name != request.Name { |
840 | if _, err = models.GetChanceTypeByName(companyId, request.Name); err == nil { | 840 | if _, err = models.GetChanceTypeByName(companyId, request.Name); err == nil { |
841 | - err = protocol.NewErrWithMessage("10271") | 841 | + err = protocol.NewErrWithMessage("10611") |
842 | return | 842 | return |
843 | } | 843 | } |
844 | } | 844 | } |
@@ -850,7 +850,7 @@ func TemplateOperateCategory(uid, companyId int64, request *protocol.TemplateOpe | @@ -850,7 +850,7 @@ func TemplateOperateCategory(uid, companyId int64, request *protocol.TemplateOpe | ||
850 | return | 850 | return |
851 | } | 851 | } |
852 | if len([]rune(request.Code)) > 6 { | 852 | if len([]rune(request.Code)) > 6 { |
853 | - err = protocol.NewErrWithMessage("10065") | 853 | + err = protocol.NewErrWithMessage("10605") |
854 | return | 854 | return |
855 | } | 855 | } |
856 | chanceType = &models.ChanceType{ | 856 | chanceType = &models.ChanceType{ |
@@ -862,11 +862,11 @@ func TemplateOperateCategory(uid, companyId int64, request *protocol.TemplateOpe | @@ -862,11 +862,11 @@ func TemplateOperateCategory(uid, companyId int64, request *protocol.TemplateOpe | ||
862 | UpdateAt: time.Now(), | 862 | UpdateAt: time.Now(), |
863 | } | 863 | } |
864 | if _, err = models.GetChanceTypeByCode(companyId, chanceType.Code); err == nil { | 864 | if _, err = models.GetChanceTypeByCode(companyId, chanceType.Code); err == nil { |
865 | - err = protocol.NewErrWithMessage("10064") | 865 | + err = protocol.NewErrWithMessage("10604") |
866 | return | 866 | return |
867 | } | 867 | } |
868 | if _, err = models.GetChanceTypeByName(companyId, chanceType.Name); err == nil { | 868 | if _, err = models.GetChanceTypeByName(companyId, chanceType.Name); err == nil { |
869 | - err = protocol.NewErrWithMessage("10271") | 869 | + err = protocol.NewErrWithMessage("10611") |
870 | return | 870 | return |
871 | } | 871 | } |
872 | if c, e := models.GetChanceTypeMaxSort(companyId); e == nil { | 872 | if c, e := models.GetChanceTypeMaxSort(companyId); e == nil { |
@@ -894,28 +894,28 @@ func TemplateDeleteCategory(uid, companyId int64, request *protocol.TemplateDele | @@ -894,28 +894,28 @@ func TemplateDeleteCategory(uid, companyId int64, request *protocol.TemplateDele | ||
894 | if chanceType, err = models.GetChanceTypeById(request.ChanceTypeId); err != nil { | 894 | if chanceType, err = models.GetChanceTypeById(request.ChanceTypeId); err != nil { |
895 | log.Error(err.Error()) | 895 | log.Error(err.Error()) |
896 | if err == orm2.ErrNoRows { | 896 | if err == orm2.ErrNoRows { |
897 | - err = protocol.NewErrWithMessage("10067") | 897 | + err = protocol.NewErrWithMessage("10607") |
898 | } | 898 | } |
899 | return | 899 | return |
900 | } | 900 | } |
901 | if chanceType.CompanyId != int(companyId) { | 901 | if chanceType.CompanyId != int(companyId) { |
902 | - err = protocol.NewErrWithMessage("10027") | 902 | + err = protocol.NewErrWithMessage("10207") |
903 | return | 903 | return |
904 | } | 904 | } |
905 | 905 | ||
906 | //1.判断分类下面是否有模板 | 906 | //1.判断分类下面是否有模板 |
907 | if err = utils.ExecuteQueryOne(&num, sql1, request.ChanceTypeId); err == nil && num > 0 { | 907 | if err = utils.ExecuteQueryOne(&num, sql1, request.ChanceTypeId); err == nil && num > 0 { |
908 | - err = protocol.NewErrWithMessage("10061") | 908 | + err = protocol.NewErrWithMessage("10601") |
909 | return | 909 | return |
910 | } | 910 | } |
911 | //2.判断是否有对应已经发布的机会 | 911 | //2.判断是否有对应已经发布的机会 |
912 | if err = utils.ExecuteQueryOne(&num, sql2, request.ChanceTypeId); err == nil && num > 0 { | 912 | if err = utils.ExecuteQueryOne(&num, sql2, request.ChanceTypeId); err == nil && num > 0 { |
913 | - err = protocol.NewErrWithMessage("10062") | 913 | + err = protocol.NewErrWithMessage("10602") |
914 | return | 914 | return |
915 | } | 915 | } |
916 | //3.判断是否有对应发布的成果 | 916 | //3.判断是否有对应发布的成果 |
917 | if err = utils.ExecuteQueryOne(&num, sql3, request.ChanceTypeId); err == nil && num > 0 { | 917 | if err = utils.ExecuteQueryOne(&num, sql3, request.ChanceTypeId); err == nil && num > 0 { |
918 | - err = protocol.NewErrWithMessage("10062") | 918 | + err = protocol.NewErrWithMessage("10602") |
919 | return | 919 | return |
920 | } | 920 | } |
921 | 921 | ||
@@ -941,7 +941,7 @@ func CategoryEditSort(uid, companyId int64, request *protocol.CategoryEditSortRe | @@ -941,7 +941,7 @@ func CategoryEditSort(uid, companyId int64, request *protocol.CategoryEditSortRe | ||
941 | } | 941 | } |
942 | if template.CompanyId != int(companyId) { | 942 | if template.CompanyId != int(companyId) { |
943 | log.Debug(fmt.Sprintf("template.companyId input:%v want:%v not equal.", companyId, template.CompanyId)) | 943 | log.Debug(fmt.Sprintf("template.companyId input:%v want:%v not equal.", companyId, template.CompanyId)) |
944 | - err = protocol.NewErrWithMessage("10027") | 944 | + err = protocol.NewErrWithMessage("10207") |
945 | return | 945 | return |
946 | } | 946 | } |
947 | if item.SortNum == template.SortNum { | 947 | if item.SortNum == template.SortNum { |
@@ -968,49 +968,49 @@ func ValidAuditFlowConfig(flowConfig protocol.AuditFlowConfig) (msg *protocol.Re | @@ -968,49 +968,49 @@ func ValidAuditFlowConfig(flowConfig protocol.AuditFlowConfig) (msg *protocol.Re | ||
968 | for i := range flowConfig.ProcessConfig { | 968 | for i := range flowConfig.ProcessConfig { |
969 | config := flowConfig.ProcessConfig[i] | 969 | config := flowConfig.ProcessConfig[i] |
970 | if !(config.ApproveType == models.AuditByDepartmentor || config.ApproveType == models.AuditByUser || config.ApproveType == models.AuditByRole) { | 970 | if !(config.ApproveType == models.AuditByDepartmentor || config.ApproveType == models.AuditByUser || config.ApproveType == models.AuditByRole) { |
971 | - msg = protocol.BadRequestParam("10171") | 971 | + msg = protocol.BadRequestParam("10628") |
972 | return | 972 | return |
973 | } | 973 | } |
974 | if !(config.AcitonType == models.ActionTypeOr || config.AcitonType == models.ActionTypeAnd) { | 974 | if !(config.AcitonType == models.ActionTypeOr || config.AcitonType == models.ActionTypeAnd) { |
975 | - msg = protocol.BadRequestParam("10172") | 975 | + msg = protocol.BadRequestParam("10629") |
976 | return | 976 | return |
977 | } | 977 | } |
978 | if config.ApproveType == models.AuditByUser { | 978 | if config.ApproveType == models.AuditByUser { |
979 | if len(config.ToUser) == 0 { | 979 | if len(config.ToUser) == 0 { |
980 | - msg = protocol.BadRequestParam("10170") | 980 | + msg = protocol.BadRequestParam("10627") |
981 | return | 981 | return |
982 | } | 982 | } |
983 | if len(config.ToUser) > 10 { | 983 | if len(config.ToUser) > 10 { |
984 | - msg = protocol.BadRequestParam("10174") | 984 | + msg = protocol.BadRequestParam("10631") |
985 | return | 985 | return |
986 | } | 986 | } |
987 | } | 987 | } |
988 | if config.ApproveType == models.AuditByRole { | 988 | if config.ApproveType == models.AuditByRole { |
989 | if len(config.ToRole) == 0 { | 989 | if len(config.ToRole) == 0 { |
990 | - msg = protocol.BadRequestParam("10173") | 990 | + msg = protocol.BadRequestParam("10630") |
991 | return | 991 | return |
992 | } | 992 | } |
993 | if len(config.ToRole) > 1 { | 993 | if len(config.ToRole) > 1 { |
994 | - msg = protocol.BadRequestParam("10175") | 994 | + msg = protocol.BadRequestParam("10632") |
995 | return | 995 | return |
996 | } | 996 | } |
997 | } | 997 | } |
998 | if config.ProcessType == models.FlowTypeNormal { | 998 | if config.ProcessType == models.FlowTypeNormal { |
999 | count++ | 999 | count++ |
1000 | if count > 1 { | 1000 | if count > 1 { |
1001 | - msg = protocol.BadRequestParam("10176") | 1001 | + msg = protocol.BadRequestParam("10633") |
1002 | return | 1002 | return |
1003 | } | 1003 | } |
1004 | } | 1004 | } |
1005 | if config.ProcessType == models.FlowTypeSpecail { | 1005 | if config.ProcessType == models.FlowTypeSpecail { |
1006 | if len(config.FromSpecialUser) == 0 { //特殊人为空 | 1006 | if len(config.FromSpecialUser) == 0 { //特殊人为空 |
1007 | - msg = protocol.BadRequestParam("10286") | 1007 | + msg = protocol.BadRequestParam("10626") |
1008 | return | 1008 | return |
1009 | } | 1009 | } |
1010 | for i := range config.FromSpecialUser { | 1010 | for i := range config.FromSpecialUser { |
1011 | u := config.FromSpecialUser[i] | 1011 | u := config.FromSpecialUser[i] |
1012 | if _, ok := specailUser[u.Id]; ok { | 1012 | if _, ok := specailUser[u.Id]; ok { |
1013 | - msg = protocol.BadRequestParam("10283") | 1013 | + msg = protocol.BadRequestParam("10623") |
1014 | return | 1014 | return |
1015 | } else { | 1015 | } else { |
1016 | specailUser[u.Id] = u.Id | 1016 | specailUser[u.Id] = u.Id |
@@ -1029,13 +1029,13 @@ func ValidProcessConfig(config *protocol.ProcessConfig) (msg *protocol.ResponseM | @@ -1029,13 +1029,13 @@ func ValidProcessConfig(config *protocol.ProcessConfig) (msg *protocol.ResponseM | ||
1029 | break | 1029 | break |
1030 | case models.AuditByUser: | 1030 | case models.AuditByUser: |
1031 | if len(config.ToUser) == 0 { | 1031 | if len(config.ToUser) == 0 { |
1032 | - msg = protocol.BadRequestParam("10281") | 1032 | + msg = protocol.BadRequestParam("10621") |
1033 | return | 1033 | return |
1034 | } | 1034 | } |
1035 | break | 1035 | break |
1036 | case models.AuditByRole: | 1036 | case models.AuditByRole: |
1037 | if len(config.ToRole) == 0 { | 1037 | if len(config.ToRole) == 0 { |
1038 | - msg = protocol.BadRequestParam("10282") | 1038 | + msg = protocol.BadRequestParam("10622") |
1039 | return | 1039 | return |
1040 | } | 1040 | } |
1041 | break | 1041 | break |
@@ -1056,12 +1056,12 @@ func ValidFormList(inputs []*protocol.InputElement) (msg *protocol.ResponseMessa | @@ -1056,12 +1056,12 @@ func ValidFormList(inputs []*protocol.InputElement) (msg *protocol.ResponseMessa | ||
1056 | for i := range inputs { | 1056 | for i := range inputs { |
1057 | input := inputs[i] | 1057 | input := inputs[i] |
1058 | if len([]rune(input.Label)) > 50 { | 1058 | if len([]rune(input.Label)) > 50 { |
1059 | - msg = protocol.BadRequestParam("10273") | 1059 | + msg = protocol.BadRequestParam("10613") |
1060 | return | 1060 | return |
1061 | } | 1061 | } |
1062 | key := fmt.Sprintf("%v-%v", input.SectionType, input.Label) | 1062 | key := fmt.Sprintf("%v-%v", input.SectionType, input.Label) |
1063 | if _, ok := mapCheckRe[key]; ok { | 1063 | if _, ok := mapCheckRe[key]; ok { |
1064 | - msg = protocol.BadRequestParam("10284") | 1064 | + msg = protocol.BadRequestParam("10624") |
1065 | return | 1065 | return |
1066 | } else { | 1066 | } else { |
1067 | mapCheckRe[key] = key | 1067 | mapCheckRe[key] = key |
@@ -1077,11 +1077,11 @@ func ValidFormList(inputs []*protocol.InputElement) (msg *protocol.ResponseMessa | @@ -1077,11 +1077,11 @@ func ValidFormList(inputs []*protocol.InputElement) (msg *protocol.ResponseMessa | ||
1077 | } | 1077 | } |
1078 | } | 1078 | } |
1079 | if countBasic == 0 { | 1079 | if countBasic == 0 { |
1080 | - msg = protocol.BadRequestParam("10285") | 1080 | + msg = protocol.BadRequestParam("10625") |
1081 | return | 1081 | return |
1082 | } | 1082 | } |
1083 | if countBasic > 10 || countExtral > 10 { | 1083 | if countBasic > 10 || countExtral > 10 { |
1084 | - msg = protocol.BadRequestParam("10274") | 1084 | + msg = protocol.BadRequestParam("10614") |
1085 | return | 1085 | return |
1086 | } | 1086 | } |
1087 | return | 1087 | return |
@@ -8,6 +8,7 @@ import ( | @@ -8,6 +8,7 @@ import ( | ||
8 | "oppmg/common/log" | 8 | "oppmg/common/log" |
9 | "oppmg/models" | 9 | "oppmg/models" |
10 | "oppmg/protocol" | 10 | "oppmg/protocol" |
11 | + serverplatform "oppmg/services/platform" | ||
11 | serverbac "oppmg/services/rbac" | 12 | serverbac "oppmg/services/rbac" |
12 | "oppmg/services/ucenter" | 13 | "oppmg/services/ucenter" |
13 | "oppmg/storage/redisdata" | 14 | "oppmg/storage/redisdata" |
@@ -120,11 +121,11 @@ func ChangeLoginToken(userid, companyid int64) (protocol.LoginAuthToken, error) | @@ -120,11 +121,11 @@ func ChangeLoginToken(userid, companyid int64) (protocol.LoginAuthToken, error) | ||
120 | } | 121 | } |
121 | if ok := usercompany.IsEnable(); !ok { | 122 | if ok := usercompany.IsEnable(); !ok { |
122 | log.Debug("公司禁用此用户") | 123 | log.Debug("公司禁用此用户") |
123 | - return logintoken, protocol.NewErrWithMessage("10027") | 124 | + return logintoken, protocol.NewErrWithMessage("10207") |
124 | } | 125 | } |
125 | if ok := usercompany.IsDelete(); ok { | 126 | if ok := usercompany.IsDelete(); ok { |
126 | log.Debug("公司删除此用户") | 127 | log.Debug("公司删除此用户") |
127 | - return logintoken, protocol.NewErrWithMessage("10027") | 128 | + return logintoken, protocol.NewErrWithMessage("10207") |
128 | } | 129 | } |
129 | companydata, err = models.GetCompanyById(usercompany.CompanyId) | 130 | companydata, err = models.GetCompanyById(usercompany.CompanyId) |
130 | if err != nil { | 131 | if err != nil { |
@@ -133,7 +134,7 @@ func ChangeLoginToken(userid, companyid int64) (protocol.LoginAuthToken, error) | @@ -133,7 +134,7 @@ func ChangeLoginToken(userid, companyid int64) (protocol.LoginAuthToken, error) | ||
133 | } | 134 | } |
134 | if ok := companydata.IsEnable(); !ok { | 135 | if ok := companydata.IsEnable(); !ok { |
135 | log.Debug("无效公司") | 136 | log.Debug("无效公司") |
136 | - return logintoken, protocol.NewErrWithMessage("10027") | 137 | + return logintoken, protocol.NewErrWithMessage("10207") |
137 | } | 138 | } |
138 | logintoken, err = GenerateAuthToken(userid, companydata.Id, usercompany.Id) | 139 | logintoken, err = GenerateAuthToken(userid, companydata.Id, usercompany.Id) |
139 | if err != nil { | 140 | if err != nil { |
@@ -156,28 +157,28 @@ func LoginAuthByUCenter(account, password string) ( | @@ -156,28 +157,28 @@ func LoginAuthByUCenter(account, password string) ( | ||
156 | var uclientReturn *ucenter.ResponseLogin | 157 | var uclientReturn *ucenter.ResponseLogin |
157 | uclientReturn, err = ucenter.RequestUCenterLogin(account, password) | 158 | uclientReturn, err = ucenter.RequestUCenterLogin(account, password) |
158 | if err != nil { | 159 | if err != nil { |
159 | - return logintoken, protocol.NewErrWithMessage("10021") | 160 | + return logintoken, protocol.NewErrWithMessage("10201") |
160 | } | 161 | } |
161 | userdata, err = models.GetUserByUCenter(uclientReturn.Data.Id) | 162 | userdata, err = models.GetUserByUCenter(uclientReturn.Data.Id) |
162 | if err != nil { | 163 | if err != nil { |
163 | log.Debug("GetUserByUCenter(%d) err:%s", uclientReturn.Data.Id, err) | 164 | log.Debug("GetUserByUCenter(%d) err:%s", uclientReturn.Data.Id, err) |
164 | - return logintoken, protocol.NewErrWithMessage("10021") | 165 | + return logintoken, protocol.NewErrWithMessage("10201") |
165 | } | 166 | } |
166 | if ok := userdata.IsDelete(); ok { | 167 | if ok := userdata.IsDelete(); ok { |
167 | log.Debug("userdata.IsDelete()==true") | 168 | log.Debug("userdata.IsDelete()==true") |
168 | - return logintoken, protocol.NewErrWithMessage("10021") | 169 | + return logintoken, protocol.NewErrWithMessage("10201") |
169 | } | 170 | } |
170 | if ok := userdata.IsEnable(); !ok { | 171 | if ok := userdata.IsEnable(); !ok { |
171 | log.Debug("userdata.IsEnable()==false") | 172 | log.Debug("userdata.IsEnable()==false") |
172 | - return logintoken, protocol.NewErrWithMessage("10022") | 173 | + return logintoken, protocol.NewErrWithMessage("10202") |
173 | } | 174 | } |
174 | if companys, err = getUserCompanyReal(userdata.Id); err != nil { | 175 | if companys, err = getUserCompanyReal(userdata.Id); err != nil { |
175 | log.Error("getUserCompanyReal err:%s", err) | 176 | log.Error("getUserCompanyReal err:%s", err) |
176 | - return logintoken, protocol.NewErrWithMessage("10021") | 177 | + return logintoken, protocol.NewErrWithMessage("10201") |
177 | } | 178 | } |
178 | if len(companys) == 0 { | 179 | if len(companys) == 0 { |
179 | log.Debug("no company") | 180 | log.Debug("no company") |
180 | - return logintoken, protocol.NewErrWithMessage("10022") | 181 | + return logintoken, protocol.NewErrWithMessage("10202") |
181 | } | 182 | } |
182 | //获取上一次登录的公司 | 183 | //获取上一次登录的公司 |
183 | uAuth, err := models.GetUserAuthByUser(userdata.Id) | 184 | uAuth, err := models.GetUserAuthByUser(userdata.Id) |
@@ -200,7 +201,7 @@ func LoginAuthByUCenter(account, password string) ( | @@ -200,7 +201,7 @@ func LoginAuthByUCenter(account, password string) ( | ||
200 | ucompany, err := models.GetUserCompanyBy(userdata.Id, companyid) | 201 | ucompany, err := models.GetUserCompanyBy(userdata.Id, companyid) |
201 | if err != nil { | 202 | if err != nil { |
202 | log.Error("获取user_company失败;%s", err) | 203 | log.Error("获取user_company失败;%s", err) |
203 | - return logintoken, protocol.NewErrWithMessage("10022") | 204 | + return logintoken, protocol.NewErrWithMessage("10202") |
204 | } | 205 | } |
205 | usercompanyid = ucompany.Id | 206 | usercompanyid = ucompany.Id |
206 | logintoken, _ = GenerateAuthToken(userdata.Id, companyid, usercompanyid) | 207 | logintoken, _ = GenerateAuthToken(userdata.Id, companyid, usercompanyid) |
@@ -293,16 +294,19 @@ func UserBaseInfo(userid, companyid int64) (protocol.ResponseMeInfo, error) { | @@ -293,16 +294,19 @@ func UserBaseInfo(userid, companyid int64) (protocol.ResponseMeInfo, error) { | ||
293 | 294 | ||
294 | func UserHasCompanys(userid int64) ([]protocol.MeCompany, error) { | 295 | func UserHasCompanys(userid int64) ([]protocol.MeCompany, error) { |
295 | var ( | 296 | var ( |
296 | - companylist []companybase | ||
297 | - err error | ||
298 | - mecompanys []protocol.MeCompany | 297 | + userData *models.User |
298 | + err error | ||
299 | + mecompanys []protocol.MeCompany | ||
299 | ) | 300 | ) |
300 | - companylist, err = getUserCompanyReal(userid) | 301 | + userData, err = models.GetUserById(userid) |
302 | + if err != nil { | ||
303 | + return mecompanys, fmt.Errorf("获取用户数据失败") | ||
304 | + } | ||
305 | + resp, err := serverplatform.GetUserCompanyDo(userData.Phone) | ||
301 | if err != nil { | 306 | if err != nil { |
302 | - log.Error("getUserCompanyReal(%d) err:%s", userid, err) | ||
303 | - return nil, protocol.NewErrWithMessage("1", err) | 307 | + return mecompanys, fmt.Errorf("获取数据失败:%s", err) |
304 | } | 308 | } |
305 | - for _, v := range companylist { | 309 | + for _, v := range resp.Data.Company { |
306 | t := protocol.MeCompany{ | 310 | t := protocol.MeCompany{ |
307 | Id: v.Id, | 311 | Id: v.Id, |
308 | Name: v.Name, | 312 | Name: v.Name, |
@@ -440,23 +444,23 @@ func LoginAuthBySmsCode(uclientReturn *ucenter.ResponseLoginSms) ( | @@ -440,23 +444,23 @@ func LoginAuthBySmsCode(uclientReturn *ucenter.ResponseLoginSms) ( | ||
440 | userdata, err = models.GetUserByUCenter(uclientReturn.Data.Cuid) | 444 | userdata, err = models.GetUserByUCenter(uclientReturn.Data.Cuid) |
441 | if err != nil { | 445 | if err != nil { |
442 | log.Debug("GetUserByUCenter(%s) err:%s", uclientReturn.Data.Cuid, err) | 446 | log.Debug("GetUserByUCenter(%s) err:%s", uclientReturn.Data.Cuid, err) |
443 | - return logintoken, protocol.NewErrWithMessage("10021") | 447 | + return logintoken, protocol.NewErrWithMessage("10201") |
444 | } | 448 | } |
445 | if ok := userdata.IsDelete(); ok { | 449 | if ok := userdata.IsDelete(); ok { |
446 | log.Debug("userdata.IsDelete()==true") | 450 | log.Debug("userdata.IsDelete()==true") |
447 | - return logintoken, protocol.NewErrWithMessage("10021") | 451 | + return logintoken, protocol.NewErrWithMessage("10201") |
448 | } | 452 | } |
449 | if ok := userdata.IsEnable(); !ok { | 453 | if ok := userdata.IsEnable(); !ok { |
450 | log.Debug("userdata.IsEnable()==false") | 454 | log.Debug("userdata.IsEnable()==false") |
451 | - return logintoken, protocol.NewErrWithMessage("10022") | 455 | + return logintoken, protocol.NewErrWithMessage("10202") |
452 | } | 456 | } |
453 | if companys, err = getUserCompanyReal(userdata.Id); err != nil { | 457 | if companys, err = getUserCompanyReal(userdata.Id); err != nil { |
454 | log.Error("getUserCompanyReal err:%s", err) | 458 | log.Error("getUserCompanyReal err:%s", err) |
455 | - return logintoken, protocol.NewErrWithMessage("10021") | 459 | + return logintoken, protocol.NewErrWithMessage("10201") |
456 | } | 460 | } |
457 | if len(companys) == 0 { | 461 | if len(companys) == 0 { |
458 | log.Debug("no company") | 462 | log.Debug("no company") |
459 | - return logintoken, protocol.NewErrWithMessage("10022") | 463 | + return logintoken, protocol.NewErrWithMessage("10202") |
460 | } | 464 | } |
461 | //获取上一次登录的公司 | 465 | //获取上一次登录的公司 |
462 | uAuth, err := models.GetUserAuthByUser(userdata.Id) | 466 | uAuth, err := models.GetUserAuthByUser(userdata.Id) |
@@ -503,11 +507,11 @@ func SmsCodeSend(phone string) error { | @@ -503,11 +507,11 @@ func SmsCodeSend(phone string) error { | ||
503 | _, err = models.GetUserByPhone(phone) | 507 | _, err = models.GetUserByPhone(phone) |
504 | if err != nil { | 508 | if err != nil { |
505 | log.Error("GetUserByPhone(%s) err:%s", phone, err) | 509 | log.Error("GetUserByPhone(%s) err:%s", phone, err) |
506 | - return protocol.NewErrWithMessage("10027") | 510 | + return protocol.NewErrWithMessage("10207") |
507 | } | 511 | } |
508 | err = ucenter.RequestUCenterSmsCode(phone) | 512 | err = ucenter.RequestUCenterSmsCode(phone) |
509 | if err != nil { | 513 | if err != nil { |
510 | - return protocol.NewErrWithMessage("10029") | 514 | + return protocol.NewErrWithMessage("10209") |
511 | } | 515 | } |
512 | return nil | 516 | return nil |
513 | } | 517 | } |
@@ -515,7 +519,7 @@ func SmsCodeSend(phone string) error { | @@ -515,7 +519,7 @@ func SmsCodeSend(phone string) error { | ||
515 | func SmsCodeCheck(phone string, code string) error { | 519 | func SmsCodeCheck(phone string, code string) error { |
516 | resp, err := ucenter.RequestUCenterSmsCodeCheck(phone, code) | 520 | resp, err := ucenter.RequestUCenterSmsCodeCheck(phone, code) |
517 | if err != nil { | 521 | if err != nil { |
518 | - return protocol.NewErrWithMessage("10026") | 522 | + return protocol.NewErrWithMessage("10206") |
519 | } | 523 | } |
520 | //redis 缓存设置 | 524 | //redis 缓存设置 |
521 | redisdata.SetCaptchAuth(phone, resp.Data.CaptchaCertificate) | 525 | redisdata.SetCaptchAuth(phone, resp.Data.CaptchaCertificate) |
@@ -593,26 +597,44 @@ func LoginAuthBySecretKey(secretKey string) (protocol.LoginAuthToken, error) { | @@ -593,26 +597,44 @@ func LoginAuthBySecretKey(secretKey string) (protocol.LoginAuthToken, error) { | ||
593 | }, | 597 | }, |
594 | } | 598 | } |
595 | } | 599 | } |
600 | + | ||
596 | userdata, err = models.GetUserByPhone(uclientReturn.Data.Phone) | 601 | userdata, err = models.GetUserByPhone(uclientReturn.Data.Phone) |
597 | if err != nil { | 602 | if err != nil { |
598 | log.Debug("GetUserByPhone(%d) err:%s", uclientReturn.Data.Phone, err) | 603 | log.Debug("GetUserByPhone(%d) err:%s", uclientReturn.Data.Phone, err) |
599 | - return logintoken, protocol.NewErrWithMessage("10021") | 604 | + return logintoken, protocol.NewErrWithMessage("10201") |
600 | } | 605 | } |
601 | companyData, err = models.GetCompanyByUCenter(uclientReturn.Data.CompanyId) | 606 | companyData, err = models.GetCompanyByUCenter(uclientReturn.Data.CompanyId) |
602 | if err != nil { | 607 | if err != nil { |
603 | log.Error("获取company数据失败:%s", err) | 608 | log.Error("获取company数据失败:%s", err) |
604 | - return logintoken, protocol.NewErrWithMessage("10111") | 609 | + return logintoken, protocol.NewErrWithMessage("10211") |
605 | } | 610 | } |
606 | if companyData.Enable == models.COMPANY_ENABLE_NO { | 611 | if companyData.Enable == models.COMPANY_ENABLE_NO { |
607 | log.Error("公司未启用机会模块") | 612 | log.Error("公司未启用机会模块") |
608 | - return logintoken, protocol.NewErrWithMessage("10124") | 613 | + return logintoken, protocol.NewErrWithMessage("10212") |
609 | } | 614 | } |
610 | ucompany, err := models.GetUserCompanyBy(userdata.Id, companyData.Id) | 615 | ucompany, err := models.GetUserCompanyBy(userdata.Id, companyData.Id) |
611 | if err != nil { | 616 | if err != nil { |
612 | log.Error("获取user_company失败;%s", err) | 617 | log.Error("获取user_company失败;%s", err) |
613 | - return logintoken, protocol.NewErrWithMessage("10022") | 618 | + return logintoken, protocol.NewErrWithMessage("10202") |
614 | } | 619 | } |
615 | 620 | ||
621 | + businessAdminResp, err := serverplatform.GetuserAuthDo(ucompany.Id) | ||
622 | + if err != nil { | ||
623 | + log.Error("向企业平台获取鉴权结果失败,err:%s", err) | ||
624 | + return logintoken, protocol.NewErrWithMessage("1") | ||
625 | + } | ||
626 | + if ok := businessAdminResp.IsOK(); !ok { | ||
627 | + return logintoken, protocol.ErrWithMessage{ | ||
628 | + ErrorCode: protocol.ErrorCode{ | ||
629 | + Errno: "-1", | ||
630 | + Errmsg: businessAdminResp.Msg, | ||
631 | + }, | ||
632 | + } | ||
633 | + } | ||
634 | + if !businessAdminResp.Data.UserAuth { | ||
635 | + log.Error("用户没有权限进行操作") | ||
636 | + return logintoken, protocol.NewErrWithMessage("10210") | ||
637 | + } | ||
616 | logintoken, _ = GenerateAuthToken(userdata.Id, companyData.Id, ucompany.Id) | 638 | logintoken, _ = GenerateAuthToken(userdata.Id, companyData.Id, ucompany.Id) |
617 | //更新用户数据 | 639 | //更新用户数据 |
618 | userdata.Accid = uclientReturn.Data.Accid | 640 | userdata.Accid = uclientReturn.Data.Accid |
@@ -460,7 +460,7 @@ func OperateBulletin(companyId int64, request *protocol.OperateBulletinRequest) | @@ -460,7 +460,7 @@ func OperateBulletin(companyId int64, request *protocol.OperateBulletinRequest) | ||
460 | return | 460 | return |
461 | } | 461 | } |
462 | if bulletin.CompanyId != companyId { | 462 | if bulletin.CompanyId != companyId { |
463 | - err = protocol.NewErrWithMessage("10027") | 463 | + err = protocol.NewErrWithMessage("10207") |
464 | log.Error("company_id:%v want:%v", companyId, bulletin.CompanyId) | 464 | log.Error("company_id:%v want:%v", companyId, bulletin.CompanyId) |
465 | return | 465 | return |
466 | } | 466 | } |
@@ -527,7 +527,7 @@ func ForbidCompany(ucenterCompany int64) error { | @@ -527,7 +527,7 @@ func ForbidCompany(ucenterCompany int64) error { | ||
527 | companyData, err = models.GetCompanyByUCenter(ucenterCompany) | 527 | companyData, err = models.GetCompanyByUCenter(ucenterCompany) |
528 | if err == orm.ErrNoRows { | 528 | if err == orm.ErrNoRows { |
529 | log.Warn("未查找到公司数据") | 529 | log.Warn("未查找到公司数据") |
530 | - return protocol.NewErrWithMessage("12001") | 530 | + return protocol.NewErrWithMessage("10701") |
531 | } | 531 | } |
532 | if err != nil && err != orm.ErrNoRows { | 532 | if err != nil && err != orm.ErrNoRows { |
533 | log.Error(err.Error()) | 533 | log.Error(err.Error()) |
@@ -553,7 +553,7 @@ func AllowCompany(ucenterCompany int64) error { | @@ -553,7 +553,7 @@ func AllowCompany(ucenterCompany int64) error { | ||
553 | companyData, err = models.GetCompanyByUCenter(ucenterCompany) | 553 | companyData, err = models.GetCompanyByUCenter(ucenterCompany) |
554 | if err == orm.ErrNoRows { | 554 | if err == orm.ErrNoRows { |
555 | log.Warn("未查找到公司数据") | 555 | log.Warn("未查找到公司数据") |
556 | - return protocol.NewErrWithMessage("12001") | 556 | + return protocol.NewErrWithMessage("10701") |
557 | } | 557 | } |
558 | if err != nil && err != orm.ErrNoRows { | 558 | if err != nil && err != orm.ErrNoRows { |
559 | log.Error(err.Error()) | 559 | log.Error(err.Error()) |
@@ -21,7 +21,7 @@ func DepartmentAdd(param protocol.RequestDepartmentAdd) (protocol.ResponseDepart | @@ -21,7 +21,7 @@ func DepartmentAdd(param protocol.RequestDepartmentAdd) (protocol.ResponseDepart | ||
21 | 21 | ||
22 | ok := models.ExistDepartmentName(param.ParentID, param.Name) | 22 | ok := models.ExistDepartmentName(param.ParentID, param.Name) |
23 | if ok { | 23 | if ok { |
24 | - return returndata, protocol.NewErrWithMessage("10045") | 24 | + return returndata, protocol.NewErrWithMessage("10404") |
25 | } | 25 | } |
26 | if param.ParentID > 0 { | 26 | if param.ParentID > 0 { |
27 | parentDepart, err = models.GetDepartmentById(param.ParentID) | 27 | parentDepart, err = models.GetDepartmentById(param.ParentID) |
@@ -39,7 +39,7 @@ func DepartmentAdd(param protocol.RequestDepartmentAdd) (protocol.ResponseDepart | @@ -39,7 +39,7 @@ func DepartmentAdd(param protocol.RequestDepartmentAdd) (protocol.ResponseDepart | ||
39 | r := parentDepart.Relation | 39 | r := parentDepart.Relation |
40 | rs := strings.Split(r, "/") | 40 | rs := strings.Split(r, "/") |
41 | if len(rs) >= 10 { //层级不能超过10级 | 41 | if len(rs) >= 10 { //层级不能超过10级 |
42 | - return returndata, protocol.NewErrWithMessage("10046") | 42 | + return returndata, protocol.NewErrWithMessage("10405") |
43 | } | 43 | } |
44 | } | 44 | } |
45 | 45 | ||
@@ -107,13 +107,13 @@ func DepartmentEdit(param protocol.RequestDepartmentEdit) error { | @@ -107,13 +107,13 @@ func DepartmentEdit(param protocol.RequestDepartmentEdit) error { | ||
107 | param.ParentID = departUpdate.ParentId | 107 | param.ParentID = departUpdate.ParentId |
108 | } else { | 108 | } else { |
109 | if param.ParentID <= 0 { | 109 | if param.ParentID <= 0 { |
110 | - return protocol.NewErrWithMessage("10048") | 110 | + return protocol.NewErrWithMessage("10407") |
111 | } | 111 | } |
112 | } | 112 | } |
113 | if param.Name != departUpdate.Name { | 113 | if param.Name != departUpdate.Name { |
114 | ok := models.ExistDepartmentName(param.ParentID, param.Name) | 114 | ok := models.ExistDepartmentName(param.ParentID, param.Name) |
115 | if ok { | 115 | if ok { |
116 | - return protocol.NewErrWithMessage("10045") | 116 | + return protocol.NewErrWithMessage("10404") |
117 | } | 117 | } |
118 | } | 118 | } |
119 | //确认部门主管变更情况 | 119 | //确认部门主管变更情况 |
@@ -126,19 +126,19 @@ func DepartmentEdit(param protocol.RequestDepartmentEdit) error { | @@ -126,19 +126,19 @@ func DepartmentEdit(param protocol.RequestDepartmentEdit) error { | ||
126 | if err != nil { | 126 | if err != nil { |
127 | e := fmt.Errorf("GetUserCompanyReal err:%s", err) | 127 | e := fmt.Errorf("GetUserCompanyReal err:%s", err) |
128 | log.Error(e.Error()) | 128 | log.Error(e.Error()) |
129 | - return protocol.NewErrWithMessage("10041") | 129 | + return protocol.NewErrWithMessage("10400") |
130 | } | 130 | } |
131 | for i := range uc { | 131 | for i := range uc { |
132 | if uc[i].CompanyId != param.CompanyID { | 132 | if uc[i].CompanyId != param.CompanyID { |
133 | e := fmt.Errorf("managers err") | 133 | e := fmt.Errorf("managers err") |
134 | log.Error(e.Error()) | 134 | log.Error(e.Error()) |
135 | - return protocol.NewErrWithMessage("10041") | 135 | + return protocol.NewErrWithMessage("10400") |
136 | } | 136 | } |
137 | //检查设置的主管是否是部门下的人员 | 137 | //检查设置的主管是否是部门下的人员 |
138 | ok := models.ExistUserDepart(param.ID, uc[i].Id) | 138 | ok := models.ExistUserDepart(param.ID, uc[i].Id) |
139 | if !ok { | 139 | if !ok { |
140 | log.Error("false=aExistUserDepart(departid,usercompanyid) [%d,%d]", param.ID, uc[i].Id) | 140 | log.Error("false=aExistUserDepart(departid,usercompanyid) [%d,%d]", param.ID, uc[i].Id) |
141 | - return protocol.NewErrWithMessage("10041") | 141 | + return protocol.NewErrWithMessage("10400") |
142 | } | 142 | } |
143 | newManage = append(newManage, uc[i].Id) | 143 | newManage = append(newManage, uc[i].Id) |
144 | } | 144 | } |
@@ -231,7 +231,7 @@ func departmentRelationUpdate(departUpdate *models.Department, newparent *models | @@ -231,7 +231,7 @@ func departmentRelationUpdate(departUpdate *models.Department, newparent *models | ||
231 | o.Rollback() | 231 | o.Rollback() |
232 | e := fmt.Errorf("departSubset[i].Id == newparent.Id") | 232 | e := fmt.Errorf("departSubset[i].Id == newparent.Id") |
233 | log.Error(e.Error()) | 233 | log.Error(e.Error()) |
234 | - return protocol.NewErrWithMessage("10042") | 234 | + return protocol.NewErrWithMessage("10401") |
235 | } | 235 | } |
236 | s := strings.TrimPrefix(departSubset[i].Relation, oldRelation) | 236 | s := strings.TrimPrefix(departSubset[i].Relation, oldRelation) |
237 | //重建关系树 | 237 | //重建关系树 |
@@ -240,7 +240,7 @@ func departmentRelationUpdate(departUpdate *models.Department, newparent *models | @@ -240,7 +240,7 @@ func departmentRelationUpdate(departUpdate *models.Department, newparent *models | ||
240 | n := strings.Split(departSubset[i].Relation, "/") | 240 | n := strings.Split(departSubset[i].Relation, "/") |
241 | if len(n) > 10 { | 241 | if len(n) > 10 { |
242 | o.Rollback() | 242 | o.Rollback() |
243 | - return protocol.NewErrWithMessage("10046") | 243 | + return protocol.NewErrWithMessage("10405") |
244 | } | 244 | } |
245 | err = utils.ExecuteSQLWithOrmer(o, dataSql2, departSubset[i].Relation, departSubset[i].Id) | 245 | err = utils.ExecuteSQLWithOrmer(o, dataSql2, departSubset[i].Relation, departSubset[i].Id) |
246 | if err != nil { | 246 | if err != nil { |
@@ -306,7 +306,7 @@ func DepartmentDelete(param protocol.RequestDepartmentDelete) error { | @@ -306,7 +306,7 @@ func DepartmentDelete(param protocol.RequestDepartmentDelete) error { | ||
306 | if cnt > 0 { | 306 | if cnt > 0 { |
307 | e := fmt.Errorf("user in department,relation:%s", subset.Relation) | 307 | e := fmt.Errorf("user in department,relation:%s", subset.Relation) |
308 | log.Error(e.Error()) | 308 | log.Error(e.Error()) |
309 | - return protocol.NewErrWithMessage("10047", e) | 309 | + return protocol.NewErrWithMessage("10406", e) |
310 | } | 310 | } |
311 | if _, ok := toDelete[subset.Id]; ok && subset.Id != pos.Id { | 311 | if _, ok := toDelete[subset.Id]; ok && subset.Id != pos.Id { |
312 | delete(toDelete, subset.Id) | 312 | delete(toDelete, subset.Id) |
@@ -30,7 +30,7 @@ func PositionAdd(param protocol.RequestPositionAdd) (*protocol.ResponsePositionI | @@ -30,7 +30,7 @@ func PositionAdd(param protocol.RequestPositionAdd) (*protocol.ResponsePositionI | ||
30 | } | 30 | } |
31 | ok := models.ExistPositiontName(param.CompanyID, param.ParentID, param.Name) | 31 | ok := models.ExistPositiontName(param.CompanyID, param.ParentID, param.Name) |
32 | if ok { | 32 | if ok { |
33 | - return nil, protocol.NewErrWithMessage("10013") | 33 | + return nil, protocol.NewErrWithMessage("10103") |
34 | } | 34 | } |
35 | //检查上级 | 35 | //检查上级 |
36 | if param.ParentID > 0 { | 36 | if param.ParentID > 0 { |
@@ -48,7 +48,7 @@ func PositionAdd(param protocol.RequestPositionAdd) (*protocol.ResponsePositionI | @@ -48,7 +48,7 @@ func PositionAdd(param protocol.RequestPositionAdd) (*protocol.ResponsePositionI | ||
48 | r := parentPosition.Relation | 48 | r := parentPosition.Relation |
49 | rs := strings.Split(r, "/") | 49 | rs := strings.Split(r, "/") |
50 | if len(rs) >= 10 { //层级不能超过10级 | 50 | if len(rs) >= 10 { //层级不能超过10级 |
51 | - return nil, protocol.NewErrWithMessage("10012") | 51 | + return nil, protocol.NewErrWithMessage("10102") |
52 | } | 52 | } |
53 | } | 53 | } |
54 | 54 | ||
@@ -109,7 +109,7 @@ func PositionEdit(param protocol.RequestPositionEdit) (*protocol.ResponsePositio | @@ -109,7 +109,7 @@ func PositionEdit(param protocol.RequestPositionEdit) (*protocol.ResponsePositio | ||
109 | if positionUpdate.Name != param.Name { | 109 | if positionUpdate.Name != param.Name { |
110 | ok := models.ExistPositiontName(param.CompanyID, param.ParentID, param.Name) | 110 | ok := models.ExistPositiontName(param.CompanyID, param.ParentID, param.Name) |
111 | if ok { | 111 | if ok { |
112 | - return nil, protocol.NewErrWithMessage("10013") | 112 | + return nil, protocol.NewErrWithMessage("10103") |
113 | } | 113 | } |
114 | positionUpdate.Name = param.Name | 114 | positionUpdate.Name = param.Name |
115 | } | 115 | } |
@@ -136,14 +136,14 @@ func PositionEdit(param protocol.RequestPositionEdit) (*protocol.ResponsePositio | @@ -136,14 +136,14 @@ func PositionEdit(param protocol.RequestPositionEdit) (*protocol.ResponsePositio | ||
136 | r := parentPosition.Relation | 136 | r := parentPosition.Relation |
137 | rs := strings.Split(r, "/") | 137 | rs := strings.Split(r, "/") |
138 | if len(rs) >= 10 { //层级不能超过10级 | 138 | if len(rs) >= 10 { //层级不能超过10级 |
139 | - return nil, protocol.NewErrWithMessage("10012") | 139 | + return nil, protocol.NewErrWithMessage("10102") |
140 | } | 140 | } |
141 | } | 141 | } |
142 | //更新部门关系数据 | 142 | //更新部门关系数据 |
143 | if positionUpdate.ParentId != param.ParentID { | 143 | if positionUpdate.ParentId != param.ParentID { |
144 | ok := models.ExistPositiontName(param.CompanyID, param.ParentID, param.Name) | 144 | ok := models.ExistPositiontName(param.CompanyID, param.ParentID, param.Name) |
145 | if ok { | 145 | if ok { |
146 | - return nil, protocol.NewErrWithMessage("10013") | 146 | + return nil, protocol.NewErrWithMessage("10103") |
147 | } | 147 | } |
148 | err = positionRelationUpdate(positionUpdate, parentPosition) | 148 | err = positionRelationUpdate(positionUpdate, parentPosition) |
149 | if err != nil { | 149 | if err != nil { |
@@ -213,7 +213,7 @@ func positionRelationUpdate(positionUpdate *models.Position, newparent *models.P | @@ -213,7 +213,7 @@ func positionRelationUpdate(positionUpdate *models.Position, newparent *models.P | ||
213 | o.Rollback() | 213 | o.Rollback() |
214 | e := fmt.Errorf("departSubset[i].Id == newparent.Id") | 214 | e := fmt.Errorf("departSubset[i].Id == newparent.Id") |
215 | log.Error(e.Error()) | 215 | log.Error(e.Error()) |
216 | - return protocol.NewErrWithMessage("10015", e) | 216 | + return protocol.NewErrWithMessage("10105", e) |
217 | } | 217 | } |
218 | //重建关系树 | 218 | //重建关系树 |
219 | s := strings.TrimPrefix(positionSubset[i].Relation, oldRelation) | 219 | s := strings.TrimPrefix(positionSubset[i].Relation, oldRelation) |
@@ -221,7 +221,7 @@ func positionRelationUpdate(positionUpdate *models.Position, newparent *models.P | @@ -221,7 +221,7 @@ func positionRelationUpdate(positionUpdate *models.Position, newparent *models.P | ||
221 | rs := strings.Split(positionSubset[i].Relation, "/") | 221 | rs := strings.Split(positionSubset[i].Relation, "/") |
222 | if len(rs) > 10 { //层级不能超过10级 | 222 | if len(rs) > 10 { //层级不能超过10级 |
223 | o.Rollback() | 223 | o.Rollback() |
224 | - return protocol.NewErrWithMessage("10012") | 224 | + return protocol.NewErrWithMessage("10102") |
225 | } | 225 | } |
226 | err = utils.ExecuteSQLWithOrmer(o, dataSql2, positionSubset[i].Relation, positionSubset[i].Id) | 226 | err = utils.ExecuteSQLWithOrmer(o, dataSql2, positionSubset[i].Relation, positionSubset[i].Id) |
227 | if err != nil { | 227 | if err != nil { |
@@ -283,7 +283,7 @@ func PositionDelete(param protocol.RequestPositionDelete) error { | @@ -283,7 +283,7 @@ func PositionDelete(param protocol.RequestPositionDelete) error { | ||
283 | if cnt > 0 { | 283 | if cnt > 0 { |
284 | e := fmt.Errorf("user in position,relation:%s", subset.Relation) | 284 | e := fmt.Errorf("user in position,relation:%s", subset.Relation) |
285 | log.Error(e.Error()) | 285 | log.Error(e.Error()) |
286 | - return protocol.NewErrWithMessage("10011", e) | 286 | + return protocol.NewErrWithMessage("10101", e) |
287 | } | 287 | } |
288 | if _, ok := toDelete[subset.Id]; ok && subset.Id != pos.Id { | 288 | if _, ok := toDelete[subset.Id]; ok && subset.Id != pos.Id { |
289 | delete(toDelete, subset.Id) | 289 | delete(toDelete, subset.Id) |
@@ -103,7 +103,7 @@ func validCompanyRole(companyid int64, roleid []int64) error { | @@ -103,7 +103,7 @@ func validCompanyRole(companyid int64, roleid []int64) error { | ||
103 | if err != nil { | 103 | if err != nil { |
104 | e := fmt.Errorf("ValidCompanyRole err:%s [company:%d,role:%d]", err, companyid, v) | 104 | e := fmt.Errorf("ValidCompanyRole err:%s [company:%d,role:%d]", err, companyid, v) |
105 | log.Error(e.Error()) | 105 | log.Error(e.Error()) |
106 | - return protocol.NewErrWithMessage("10031") | 106 | + return protocol.NewErrWithMessage("10301") |
107 | } | 107 | } |
108 | } | 108 | } |
109 | return nil | 109 | return nil |
@@ -123,7 +123,7 @@ func validCompanyDepart(companyid int64, departid []int64) error { | @@ -123,7 +123,7 @@ func validCompanyDepart(companyid int64, departid []int64) error { | ||
123 | if err != nil { | 123 | if err != nil { |
124 | e := fmt.Errorf("ValidCompanyDepart err:%s [company:%d,department:%d]", err, companyid, v) | 124 | e := fmt.Errorf("ValidCompanyDepart err:%s [company:%d,department:%d]", err, companyid, v) |
125 | log.Error(e.Error()) | 125 | log.Error(e.Error()) |
126 | - return protocol.NewErrWithMessage("10032") | 126 | + return protocol.NewErrWithMessage("10302") |
127 | } | 127 | } |
128 | 128 | ||
129 | } | 129 | } |
@@ -145,7 +145,7 @@ func validCompanyPosition(companyid int64, positionid []int64) error { | @@ -145,7 +145,7 @@ func validCompanyPosition(companyid int64, positionid []int64) error { | ||
145 | if err != nil { | 145 | if err != nil { |
146 | e := fmt.Errorf("ValidCompanyPosition err:%s [company:%d,department:%d]", err, companyid, v) | 146 | e := fmt.Errorf("ValidCompanyPosition err:%s [company:%d,department:%d]", err, companyid, v) |
147 | log.Error(e.Error()) | 147 | log.Error(e.Error()) |
148 | - return protocol.NewErrWithMessage("10033") | 148 | + return protocol.NewErrWithMessage("10303") |
149 | } | 149 | } |
150 | 150 | ||
151 | } | 151 | } |
@@ -164,7 +164,7 @@ func existCompanyUser(companyid int64, phone string) error { | @@ -164,7 +164,7 @@ func existCompanyUser(companyid int64, phone string) error { | ||
164 | 164 | ||
165 | ok := models.ExistUserCompany(userdata.Id, companyid) | 165 | ok := models.ExistUserCompany(userdata.Id, companyid) |
166 | if ok { | 166 | if ok { |
167 | - return protocol.NewErrWithMessage("10039") | 167 | + return protocol.NewErrWithMessage("10309") |
168 | } | 168 | } |
169 | return nil | 169 | return nil |
170 | } | 170 | } |
@@ -470,14 +470,14 @@ func UserDelete(userCompanyids []int64, companyid int64) error { | @@ -470,14 +470,14 @@ func UserDelete(userCompanyids []int64, companyid int64) error { | ||
470 | Filter("review_status__in", models.AuditFlowProcessReviewWait, models.AuditFlowProcessReviewIng). | 470 | Filter("review_status__in", models.AuditFlowProcessReviewWait, models.AuditFlowProcessReviewIng). |
471 | Exist() | 471 | Exist() |
472 | if exist { | 472 | if exist { |
473 | - return protocol.NewErrWithMessage("10074") | 473 | + return protocol.NewErrWithMessage("10313") |
474 | } | 474 | } |
475 | var ( | 475 | var ( |
476 | ids []int64 | 476 | ids []int64 |
477 | ) | 477 | ) |
478 | for _, v := range updateIds { | 478 | for _, v := range updateIds { |
479 | if v.UserId == companyInfo.AdminId { | 479 | if v.UserId == companyInfo.AdminId { |
480 | - return protocol.NewErrWithMessage("10071") | 480 | + return protocol.NewErrWithMessage("10310") |
481 | } | 481 | } |
482 | ids = append(ids, v.Id) | 482 | ids = append(ids, v.Id) |
483 | } | 483 | } |
@@ -671,14 +671,14 @@ func UserForbid(userCompanyids []int64, companyid int64) error { | @@ -671,14 +671,14 @@ func UserForbid(userCompanyids []int64, companyid int64) error { | ||
671 | Filter("review_status__in", models.AuditFlowProcessReviewWait, models.AuditFlowProcessReviewIng). | 671 | Filter("review_status__in", models.AuditFlowProcessReviewWait, models.AuditFlowProcessReviewIng). |
672 | Exist() | 672 | Exist() |
673 | if exist { | 673 | if exist { |
674 | - return protocol.NewErrWithMessage("10075") | 674 | + return protocol.NewErrWithMessage("10314") |
675 | } | 675 | } |
676 | var ( | 676 | var ( |
677 | ids []int64 | 677 | ids []int64 |
678 | ) | 678 | ) |
679 | for _, v := range updateIds { | 679 | for _, v := range updateIds { |
680 | if v.UserId == companyInfo.AdminId { | 680 | if v.UserId == companyInfo.AdminId { |
681 | - return protocol.NewErrWithMessage("10072") | 681 | + return protocol.NewErrWithMessage("10311") |
682 | } | 682 | } |
683 | ids = append(ids, v.Id) | 683 | ids = append(ids, v.Id) |
684 | } | 684 | } |
@@ -30,7 +30,7 @@ func ConfigScore(uid, companyId int64, request *protocol.ConfigScoreRequest) (rs | @@ -30,7 +30,7 @@ func ConfigScore(uid, companyId int64, request *protocol.ConfigScoreRequest) (rs | ||
30 | return | 30 | return |
31 | } | 31 | } |
32 | if scoreConfig.CompanyId != int(companyId) { | 32 | if scoreConfig.CompanyId != int(companyId) { |
33 | - err = protocol.NewErrWithMessage("10027") //无权限 | 33 | + err = protocol.NewErrWithMessage("10207") //无权限 |
34 | return | 34 | return |
35 | } | 35 | } |
36 | goto UPDATE | 36 | goto UPDATE |
@@ -38,26 +38,26 @@ func ConfigScore(uid, companyId int64, request *protocol.ConfigScoreRequest) (rs | @@ -38,26 +38,26 @@ func ConfigScore(uid, companyId int64, request *protocol.ConfigScoreRequest) (rs | ||
38 | return | 38 | return |
39 | } | 39 | } |
40 | if !(checkScoreRange(request.BasicScore) && checkScoreRange(request.ExtraScore) && checkScoreRange(request.ValueScore)) { | 40 | if !(checkScoreRange(request.BasicScore) && checkScoreRange(request.ExtraScore) && checkScoreRange(request.ValueScore)) { |
41 | - err = protocol.NewErrWithMessage("12101") | 41 | + err = protocol.NewErrWithMessage("10801") |
42 | return | 42 | return |
43 | } | 43 | } |
44 | if request.DiscoveryScore != nil { | 44 | if request.DiscoveryScore != nil { |
45 | c := request.DiscoveryScore | 45 | c := request.DiscoveryScore |
46 | if !(checkFactor(c.BasicFactor) && checkFactor(c.ExtraFactor) && checkFactor(c.ValueFactor)) { | 46 | if !(checkFactor(c.BasicFactor) && checkFactor(c.ExtraFactor) && checkFactor(c.ValueFactor)) { |
47 | - err = protocol.NewErrWithMessage("12102") | 47 | + err = protocol.NewErrWithMessage("10802") |
48 | return | 48 | return |
49 | } | 49 | } |
50 | } else { | 50 | } else { |
51 | - err = protocol.NewErrWithMessage("12102") | 51 | + err = protocol.NewErrWithMessage("10802") |
52 | return | 52 | return |
53 | } | 53 | } |
54 | if request.SumScore != nil { | 54 | if request.SumScore != nil { |
55 | if !(checkSumScoreFactor(request.SumScore.DiscoveryFactor) && checkSumScoreFactor(request.SumScore.CatchFactor)) { | 55 | if !(checkSumScoreFactor(request.SumScore.DiscoveryFactor) && checkSumScoreFactor(request.SumScore.CatchFactor)) { |
56 | - err = protocol.NewErrWithMessage("12102") | 56 | + err = protocol.NewErrWithMessage("10802") |
57 | return | 57 | return |
58 | } | 58 | } |
59 | } else { | 59 | } else { |
60 | - err = protocol.NewErrWithMessage("12102") | 60 | + err = protocol.NewErrWithMessage("10802") |
61 | return | 61 | return |
62 | } | 62 | } |
63 | if scoreConfig, err = models.GetSysConfigByCompanyId(int(companyId), models.KeyScore); err != nil { | 63 | if scoreConfig, err = models.GetSysConfigByCompanyId(int(companyId), models.KeyScore); err != nil { |
@@ -113,7 +113,7 @@ func GetConfigScore(uid, companyId int64, request *protocol.GetConfigScoreReques | @@ -113,7 +113,7 @@ func GetConfigScore(uid, companyId int64, request *protocol.GetConfigScoreReques | ||
113 | 113 | ||
114 | //检查分值范围 | 114 | //检查分值范围 |
115 | func checkScoreRange(scoreRange *protocol.ScoreRange) (result bool) { | 115 | func checkScoreRange(scoreRange *protocol.ScoreRange) (result bool) { |
116 | - //err = protocol.NewErrWithMessage("12101") | 116 | + //err = protocol.NewErrWithMessage("10801") |
117 | result = false | 117 | result = false |
118 | if scoreRange.Min < 0 { | 118 | if scoreRange.Min < 0 { |
119 | return | 119 | return |
@@ -135,7 +135,7 @@ func checkScoreRange(scoreRange *protocol.ScoreRange) (result bool) { | @@ -135,7 +135,7 @@ func checkScoreRange(scoreRange *protocol.ScoreRange) (result bool) { | ||
135 | //检查发现分计算规则 | 135 | //检查发现分计算规则 |
136 | func checkFactor(factor float64) (result bool) { | 136 | func checkFactor(factor float64) (result bool) { |
137 | result = false | 137 | result = false |
138 | - //err = protocol.NewErrWithMessage("12102") | 138 | + //err = protocol.NewErrWithMessage("10802") |
139 | if factor < 0.1 || factor > 1 { | 139 | if factor < 0.1 || factor > 1 { |
140 | return | 140 | return |
141 | } | 141 | } |
@@ -147,7 +147,7 @@ func checkFactor(factor float64) (result bool) { | @@ -147,7 +147,7 @@ func checkFactor(factor float64) (result bool) { | ||
147 | //检查总分计算规则 | 147 | //检查总分计算规则 |
148 | func checkSumScoreFactor(factor float64) (result bool) { | 148 | func checkSumScoreFactor(factor float64) (result bool) { |
149 | result = false | 149 | result = false |
150 | - //err = protocol.NewErrWithMessage("12102") | 150 | + //err = protocol.NewErrWithMessage("10802") |
151 | if factor < 0.1 || factor > 10 { | 151 | if factor < 0.1 || factor > 10 { |
152 | return | 152 | return |
153 | } | 153 | } |
services/platform/request.go
0 → 100644
1 | +package platform | ||
2 | + | ||
3 | +import ( | ||
4 | + "bytes" | ||
5 | + "encoding/json" | ||
6 | + "errors" | ||
7 | + "fmt" | ||
8 | + "io/ioutil" | ||
9 | + "net/http" | ||
10 | + mconfig "oppmg/common/config" | ||
11 | + "oppmg/common/log" | ||
12 | + "time" | ||
13 | +) | ||
14 | + | ||
15 | +const ( | ||
16 | + ResponseOk int = 0 | ||
17 | +) | ||
18 | + | ||
19 | +//请求企业平台的接口 | ||
20 | +type IBusinessAdminParam interface { | ||
21 | + Format() []byte | ||
22 | + GetPath() (string, string) //返回请求路径path,请求方式mathod | ||
23 | +} | ||
24 | + | ||
25 | +type BusinessAdminClient struct { | ||
26 | + baseUrl string | ||
27 | +} | ||
28 | + | ||
29 | +func NewBusinessAdminClient() *BusinessAdminClient { | ||
30 | + return &BusinessAdminClient{ | ||
31 | + baseUrl: mconfig.MConfig.BusinessAdminUrl, | ||
32 | + } | ||
33 | +} | ||
34 | + | ||
35 | +func (client BusinessAdminClient) buildHeader() http.Header { | ||
36 | + var h = http.Header{} | ||
37 | + h.Set("Content-Type", "application/json") | ||
38 | + h.Set("Accept", "application/json") | ||
39 | + return h | ||
40 | +} | ||
41 | + | ||
42 | +//httpDo post发送json | ||
43 | +func (client BusinessAdminClient) httpDo(path string, mathod string, posts []byte) ([]byte, error) { | ||
44 | + httpclient := http.Client{ | ||
45 | + Timeout: 10 * time.Second, //请求超时时间10秒 | ||
46 | + } | ||
47 | + reqURL := client.baseUrl + path | ||
48 | + req, err := http.NewRequest(mathod, reqURL, bytes.NewReader(posts)) | ||
49 | + if err != nil { | ||
50 | + return nil, err | ||
51 | + } | ||
52 | + req.Header = client.buildHeader() | ||
53 | + resp, err := httpclient.Do(req) | ||
54 | + log.Info("====>Send To URL:%s", reqURL) | ||
55 | + log.Info("====>Send To BusinessAdmin:%s", string(posts)) | ||
56 | + if err != nil { | ||
57 | + return nil, err | ||
58 | + } | ||
59 | + defer resp.Body.Close() | ||
60 | + body, err := ioutil.ReadAll(resp.Body) | ||
61 | + if err != nil { | ||
62 | + return nil, err | ||
63 | + } | ||
64 | + log.Info("<====BusinessAdmin Return:%s", string(body)) | ||
65 | + return body, nil | ||
66 | +} | ||
67 | + | ||
68 | +func (client BusinessAdminClient) Call(param IBusinessAdminParam) ([]byte, error) { | ||
69 | + path, mathod := param.GetPath() | ||
70 | + return client.httpDo(path, mathod, param.Format()) | ||
71 | +} | ||
72 | + | ||
73 | +type CommResponse struct { | ||
74 | + Code int `json:"code"` | ||
75 | + Msg string `json:"msg"` | ||
76 | +} | ||
77 | + | ||
78 | +func (resp CommResponse) IsOK() bool { | ||
79 | + if resp.Code != ResponseOk { | ||
80 | + return false | ||
81 | + } | ||
82 | + return true | ||
83 | +} | ||
84 | + | ||
85 | +//GetuserAuth 企业后台鉴权 | ||
86 | +//userId 企业后台的用户id ,对应机会系统内的user_company表的字段id | ||
87 | +//PlatformId 编号 机会系统固定值18 | ||
88 | +type RequestGetuserAuth struct { | ||
89 | + UserId string `json:"userId"` | ||
90 | + platformId string `json:"platformId"` | ||
91 | +} | ||
92 | + | ||
93 | +type ResponseGetUserAuth struct { | ||
94 | + CommResponse | ||
95 | + Data struct { | ||
96 | + UserAuth bool `json:"userAuth"` | ||
97 | + } `json:"data"` | ||
98 | +} | ||
99 | + | ||
100 | +func (r RequestGetuserAuth) Format() []byte { | ||
101 | + r.platformId = "3" | ||
102 | + var bt []byte | ||
103 | + bt, _ = json.Marshal(r) | ||
104 | + return bt | ||
105 | +} | ||
106 | + | ||
107 | +func (r RequestGetuserAuth) GetPath() (string, string) { | ||
108 | + return "/auth/get-user-auth", "POST" | ||
109 | +} | ||
110 | + | ||
111 | +func GetuserAuthDo(userid int64) (ResponseGetUserAuth, error) { | ||
112 | + param := RequestGetuserAuth{ | ||
113 | + UserId: fmt.Sprint(userid), | ||
114 | + } | ||
115 | + var resp ResponseGetUserAuth | ||
116 | + uclient := NewBusinessAdminClient() | ||
117 | + btBody, err := uclient.Call(param) | ||
118 | + if err != nil { | ||
119 | + log.Error("向企业平台发送请求失败 err:%s", err) | ||
120 | + return resp, errors.New("向企业平台发送请求失败") | ||
121 | + } | ||
122 | + err = json.Unmarshal(btBody, &resp) | ||
123 | + if err != nil { | ||
124 | + log.Error("解析企业平台响应失败 err:%s", err) | ||
125 | + return resp, errors.New("解析企业平台响应失败") | ||
126 | + } | ||
127 | + return resp, nil | ||
128 | +} | ||
129 | + | ||
130 | +//RequestGetUserCompany 从企业平台获取用户的公司 | ||
131 | +type RequestGetUserCompany struct { | ||
132 | + Phone string `json:"phone"` | ||
133 | + platformId string `json:"platformId"` | ||
134 | +} | ||
135 | + | ||
136 | +type ResponseGetUserCompany struct { | ||
137 | + CommResponse | ||
138 | + Data struct { | ||
139 | + Company []struct { | ||
140 | + Id int64 `json:"id"` | ||
141 | + Name string `json:"name"` | ||
142 | + Logo string `json:"logo"` | ||
143 | + } `json:"company"` | ||
144 | + } `json:"data"` | ||
145 | +} | ||
146 | + | ||
147 | +func (r RequestGetUserCompany) Format() []byte { | ||
148 | + r.platformId = "3" | ||
149 | + var bt []byte | ||
150 | + bt, _ = json.Marshal(r) | ||
151 | + return bt | ||
152 | +} | ||
153 | + | ||
154 | +func (r RequestGetUserCompany) GetPath() (string, string) { | ||
155 | + return "/companies/user-company", "POST" | ||
156 | +} | ||
157 | + | ||
158 | +func GetUserCompanyDo(phone string) (ResponseGetUserCompany, error) { | ||
159 | + param := RequestGetUserCompany{ | ||
160 | + Phone: phone, | ||
161 | + } | ||
162 | + var resp ResponseGetUserCompany | ||
163 | + uclient := NewBusinessAdminClient() | ||
164 | + btBody, err := uclient.Call(param) | ||
165 | + if err != nil { | ||
166 | + log.Error("向企业平台发送请求失败 err:%s", err) | ||
167 | + return resp, errors.New("向企业平台发送请求失败") | ||
168 | + } | ||
169 | + err = json.Unmarshal(btBody, &resp) | ||
170 | + if err != nil { | ||
171 | + log.Error("解析企业平台响应失败 err:%s", err) | ||
172 | + return resp, errors.New("解析企业平台响应失败") | ||
173 | + } | ||
174 | + return resp, nil | ||
175 | +} |
@@ -448,7 +448,7 @@ func EditRankRange(id int64, name string, rangetype int8, relationId []int64, co | @@ -448,7 +448,7 @@ func EditRankRange(id int64, name string, rangetype int8, relationId []int64, co | ||
448 | } | 448 | } |
449 | ok := RankRangeNameOnlyOne(rankRange.RankTypeId, rankRange.Id, name) | 449 | ok := RankRangeNameOnlyOne(rankRange.RankTypeId, rankRange.Id, name) |
450 | if !ok { | 450 | if !ok { |
451 | - return protocol.NewErrWithMessage("10125") | 451 | + return protocol.NewErrWithMessage("11009") |
452 | } | 452 | } |
453 | rankRangeDatas, err = models.GetRankRangeDataByRangeId(rankRange.Id) | 453 | rankRangeDatas, err = models.GetRankRangeDataByRangeId(rankRange.Id) |
454 | if err != nil { | 454 | if err != nil { |
@@ -825,7 +825,7 @@ func RankRangeMove(fromId int64, toId int64, relationId []int64, companyid int64 | @@ -825,7 +825,7 @@ func RankRangeMove(fromId int64, toId int64, relationId []int64, companyid int64 | ||
825 | } | 825 | } |
826 | if fromTypeFlag != ToTypeFlag { | 826 | if fromTypeFlag != ToTypeFlag { |
827 | log.Error("RankRange类型不一致") | 827 | log.Error("RankRange类型不一致") |
828 | - return protocol.NewErrWithMessage("10102") | 828 | + return protocol.NewErrWithMessage("11002") |
829 | } | 829 | } |
830 | 830 | ||
831 | var ( | 831 | var ( |
@@ -221,7 +221,7 @@ func UpdateSetOpportunity(param OptionOpportunity, roleid int64, companyid int64 | @@ -221,7 +221,7 @@ func UpdateSetOpportunity(param OptionOpportunity, roleid int64, companyid int64 | ||
221 | 221 | ||
222 | if param.Check == OpportunityCheckLv3 { | 222 | if param.Check == OpportunityCheckLv3 { |
223 | if len(param.CheckOption.Departments) == 0 { | 223 | if len(param.CheckOption.Departments) == 0 { |
224 | - return protocol.NewErrWithMessage("10091") | 224 | + return protocol.NewErrWithMessage("10901") |
225 | } | 225 | } |
226 | } | 226 | } |
227 | 227 |
@@ -189,7 +189,7 @@ func RoleGroupEdit(companyid int64, id int64, name string) (*protocol.ResponseRo | @@ -189,7 +189,7 @@ func RoleGroupEdit(companyid int64, id int64, name string) (*protocol.ResponseRo | ||
189 | if roleinfo.Name != name { | 189 | if roleinfo.Name != name { |
190 | ok := models.ExistRoleName(companyid, name, models.ROLETYPES_GROUP) | 190 | ok := models.ExistRoleName(companyid, name, models.ROLETYPES_GROUP) |
191 | if ok { | 191 | if ok { |
192 | - return nil, protocol.NewErrWithMessage("10073") | 192 | + return nil, protocol.NewErrWithMessage("10312") |
193 | } | 193 | } |
194 | roleinfo.Name = name | 194 | roleinfo.Name = name |
195 | } | 195 | } |
@@ -8,6 +8,8 @@ import ( | @@ -8,6 +8,8 @@ import ( | ||
8 | "oppmg/protocol" | 8 | "oppmg/protocol" |
9 | ) | 9 | ) |
10 | 10 | ||
11 | +// 请求统一用户中心的接口 | ||
12 | + | ||
11 | //RequestUCenterLogin 调用用户中心进行账号密码登录 | 13 | //RequestUCenterLogin 调用用户中心进行账号密码登录 |
12 | func RequestUCenterLogin(account, password string) (*ResponseLogin, error) { | 14 | func RequestUCenterLogin(account, password string) (*ResponseLogin, error) { |
13 | var uclientReturn ResponseLogin | 15 | var uclientReturn ResponseLogin |
@@ -19,7 +21,7 @@ func RequestUCenterLogin(account, password string) (*ResponseLogin, error) { | @@ -19,7 +21,7 @@ func RequestUCenterLogin(account, password string) (*ResponseLogin, error) { | ||
19 | uclient := NewUCenterClient() | 21 | uclient := NewUCenterClient() |
20 | btBody, err := uclient.Call(param) | 22 | btBody, err := uclient.Call(param) |
21 | if err != nil { | 23 | if err != nil { |
22 | - log.Error("统一用户中心请求失败 err:%s", err) | 24 | + log.Error("向统一用户中心发送请求失败 err:%s", err) |
23 | return nil, protocol.NewErrWithMessage("1") | 25 | return nil, protocol.NewErrWithMessage("1") |
24 | } | 26 | } |
25 | err = json.Unmarshal(btBody, &uclientReturn) | 27 | err = json.Unmarshal(btBody, &uclientReturn) |
@@ -27,8 +29,8 @@ func RequestUCenterLogin(account, password string) (*ResponseLogin, error) { | @@ -27,8 +29,8 @@ func RequestUCenterLogin(account, password string) (*ResponseLogin, error) { | ||
27 | log.Error("解析统一用户中心响应失败 err:%s", err) | 29 | log.Error("解析统一用户中心响应失败 err:%s", err) |
28 | return nil, protocol.NewErrWithMessage("1") | 30 | return nil, protocol.NewErrWithMessage("1") |
29 | } | 31 | } |
30 | - if !(uclientReturn.Code == ResponseCode0) { | ||
31 | - return nil, protocol.NewErrWithMessage("10052") | 32 | + if !(uclientReturn.Code == ResponseCodeOk) { |
33 | + return nil, protocol.NewErrWithMessage("10502") | ||
32 | } | 34 | } |
33 | return &uclientReturn, nil | 35 | return &uclientReturn, nil |
34 | } | 36 | } |
@@ -44,7 +46,7 @@ func RequestUCenterLoginBySecret(secret string) (*ResponseLogin, error) { | @@ -44,7 +46,7 @@ func RequestUCenterLoginBySecret(secret string) (*ResponseLogin, error) { | ||
44 | uclient := NewUCenterClient() | 46 | uclient := NewUCenterClient() |
45 | btBody, err := uclient.Call(param) | 47 | btBody, err := uclient.Call(param) |
46 | if err != nil { | 48 | if err != nil { |
47 | - log.Error("统一用户中心请求失败 err:%s", err) | 49 | + log.Error("向统一用户中心发送请求失败 err:%s", err) |
48 | return nil, protocol.NewErrWithMessage("1") | 50 | return nil, protocol.NewErrWithMessage("1") |
49 | } | 51 | } |
50 | err = json.Unmarshal(btBody, &uclientReturn) | 52 | err = json.Unmarshal(btBody, &uclientReturn) |
@@ -52,7 +54,7 @@ func RequestUCenterLoginBySecret(secret string) (*ResponseLogin, error) { | @@ -52,7 +54,7 @@ func RequestUCenterLoginBySecret(secret string) (*ResponseLogin, error) { | ||
52 | log.Error("解析统一用户中心响应失败 err:%s", err) | 54 | log.Error("解析统一用户中心响应失败 err:%s", err) |
53 | return nil, protocol.NewErrWithMessage("1") | 55 | return nil, protocol.NewErrWithMessage("1") |
54 | } | 56 | } |
55 | - if !(uclientReturn.Code == ResponseCode0) { | 57 | + if !(uclientReturn.Code == ResponseCodeOk) { |
56 | return &uclientReturn, protocol.NewErrWithMessage("1") | 58 | return &uclientReturn, protocol.NewErrWithMessage("1") |
57 | } | 59 | } |
58 | return &uclientReturn, nil | 60 | return &uclientReturn, nil |
@@ -75,7 +77,7 @@ func RequestUCenterAddUser(phone string, nickname string, avatar string) (*Respo | @@ -75,7 +77,7 @@ func RequestUCenterAddUser(phone string, nickname string, avatar string) (*Respo | ||
75 | uclient := NewUCenterClient() | 77 | uclient := NewUCenterClient() |
76 | btBody, err := uclient.Call(param) | 78 | btBody, err := uclient.Call(param) |
77 | if err != nil { | 79 | if err != nil { |
78 | - log.Error("统一用户中心请求失败 err:%s", err) | 80 | + log.Error("向统一用户中心发送请求失败 err:%s", err) |
79 | return nil, protocol.NewErrWithMessage("1") | 81 | return nil, protocol.NewErrWithMessage("1") |
80 | } | 82 | } |
81 | err = json.Unmarshal(btBody, &ucenterReturn) | 83 | err = json.Unmarshal(btBody, &ucenterReturn) |
@@ -83,8 +85,8 @@ func RequestUCenterAddUser(phone string, nickname string, avatar string) (*Respo | @@ -83,8 +85,8 @@ func RequestUCenterAddUser(phone string, nickname string, avatar string) (*Respo | ||
83 | log.Error("解析统一用户中心响应失败 err:%s", err) | 85 | log.Error("解析统一用户中心响应失败 err:%s", err) |
84 | return nil, protocol.NewErrWithMessage("1") | 86 | return nil, protocol.NewErrWithMessage("1") |
85 | } | 87 | } |
86 | - if !(ucenterReturn.Code == ResponseCode0) { | ||
87 | - return nil, protocol.NewErrWithMessage("10052") | 88 | + if !(ucenterReturn.Code == ResponseCodeOk) { |
89 | + return nil, protocol.NewErrWithMessage("10502") | ||
88 | } | 90 | } |
89 | return &ucenterReturn, nil | 91 | return &ucenterReturn, nil |
90 | } | 92 | } |
@@ -100,7 +102,7 @@ func RequestUCenterSmsCode(phone string) error { | @@ -100,7 +102,7 @@ func RequestUCenterSmsCode(phone string) error { | ||
100 | uclient := NewUCenterClient() | 102 | uclient := NewUCenterClient() |
101 | btBody, err := uclient.Call(param) | 103 | btBody, err := uclient.Call(param) |
102 | if err != nil { | 104 | if err != nil { |
103 | - log.Error("统一用户中心请求失败 err:%s", err) | 105 | + log.Error("向统一用户中心发送请求失败 err:%s", err) |
104 | return protocol.NewErrWithMessage("1") | 106 | return protocol.NewErrWithMessage("1") |
105 | } | 107 | } |
106 | var ucenterReturn CommResponse | 108 | var ucenterReturn CommResponse |
@@ -109,8 +111,8 @@ func RequestUCenterSmsCode(phone string) error { | @@ -109,8 +111,8 @@ func RequestUCenterSmsCode(phone string) error { | ||
109 | log.Error("解析统一用户中心响应失败 err:%s", err) | 111 | log.Error("解析统一用户中心响应失败 err:%s", err) |
110 | return protocol.NewErrWithMessage("1") | 112 | return protocol.NewErrWithMessage("1") |
111 | } | 113 | } |
112 | - if !(ucenterReturn.Code == ResponseCode0) { | ||
113 | - return protocol.NewErrWithMessage("10052") | 114 | + if !(ucenterReturn.Code == ResponseCodeOk) { |
115 | + return protocol.NewErrWithMessage("10502") | ||
114 | } | 116 | } |
115 | return nil | 117 | return nil |
116 | } | 118 | } |
@@ -125,7 +127,7 @@ func RequestUCenterLoginSms(phone string, captcha string) (*ResponseLoginSms, er | @@ -125,7 +127,7 @@ func RequestUCenterLoginSms(phone string, captcha string) (*ResponseLoginSms, er | ||
125 | uclient := NewUCenterClient() | 127 | uclient := NewUCenterClient() |
126 | btBody, err := uclient.Call(param) | 128 | btBody, err := uclient.Call(param) |
127 | if err != nil { | 129 | if err != nil { |
128 | - log.Error("统一用户中心请求失败 err:%s", err) | 130 | + log.Error("向统一用户中心发送请求失败 err:%s", err) |
129 | return nil, protocol.NewErrWithMessage("1") | 131 | return nil, protocol.NewErrWithMessage("1") |
130 | } | 132 | } |
131 | var ucenterReturn ResponseLoginSms | 133 | var ucenterReturn ResponseLoginSms |
@@ -134,8 +136,8 @@ func RequestUCenterLoginSms(phone string, captcha string) (*ResponseLoginSms, er | @@ -134,8 +136,8 @@ func RequestUCenterLoginSms(phone string, captcha string) (*ResponseLoginSms, er | ||
134 | log.Error("解析统一用户中心响应失败 err:%s", err) | 136 | log.Error("解析统一用户中心响应失败 err:%s", err) |
135 | return nil, protocol.NewErrWithMessage("1") | 137 | return nil, protocol.NewErrWithMessage("1") |
136 | } | 138 | } |
137 | - if !(ucenterReturn.Code == ResponseCode0) { | ||
138 | - return &ucenterReturn, protocol.NewErrWithMessage("10052") | 139 | + if !(ucenterReturn.Code == ResponseCodeOk) { |
140 | + return &ucenterReturn, protocol.NewErrWithMessage("10502") | ||
139 | } | 141 | } |
140 | return &ucenterReturn, nil | 142 | return &ucenterReturn, nil |
141 | } | 143 | } |
@@ -148,7 +150,7 @@ func RequestUCenterSmsCodeCheck(phone string, captcha string) (*ResponseSmsCodeC | @@ -148,7 +150,7 @@ func RequestUCenterSmsCodeCheck(phone string, captcha string) (*ResponseSmsCodeC | ||
148 | uclient := NewUCenterClient() | 150 | uclient := NewUCenterClient() |
149 | btBody, err := uclient.Call(param) | 151 | btBody, err := uclient.Call(param) |
150 | if err != nil { | 152 | if err != nil { |
151 | - log.Error("统一用户中心请求失败 err:%s", err) | 153 | + log.Error("向统一用户中心发送请求失败 err:%s", err) |
152 | return nil, protocol.NewErrWithMessage("1") | 154 | return nil, protocol.NewErrWithMessage("1") |
153 | } | 155 | } |
154 | var ucenterReturn ResponseSmsCodeCheck | 156 | var ucenterReturn ResponseSmsCodeCheck |
@@ -157,8 +159,8 @@ func RequestUCenterSmsCodeCheck(phone string, captcha string) (*ResponseSmsCodeC | @@ -157,8 +159,8 @@ func RequestUCenterSmsCodeCheck(phone string, captcha string) (*ResponseSmsCodeC | ||
157 | log.Error("解析统一用户中心响应失败 err:%s", err) | 159 | log.Error("解析统一用户中心响应失败 err:%s", err) |
158 | return nil, protocol.NewErrWithMessage("1") | 160 | return nil, protocol.NewErrWithMessage("1") |
159 | } | 161 | } |
160 | - if !(ucenterReturn.Code == ResponseCode0) { | ||
161 | - return &ucenterReturn, protocol.NewErrWithMessage("10026") | 162 | + if !(ucenterReturn.Code == ResponseCodeOk) { |
163 | + return &ucenterReturn, protocol.NewErrWithMessage("10206") | ||
162 | } | 164 | } |
163 | return &ucenterReturn, nil | 165 | return &ucenterReturn, nil |
164 | } | 166 | } |
@@ -173,7 +175,7 @@ func RequestUCenterRestPassword(phone, newPwd, confirmPwd, certificate string) e | @@ -173,7 +175,7 @@ func RequestUCenterRestPassword(phone, newPwd, confirmPwd, certificate string) e | ||
173 | uclient := NewUCenterClient() | 175 | uclient := NewUCenterClient() |
174 | btBody, err := uclient.Call(param) | 176 | btBody, err := uclient.Call(param) |
175 | if err != nil { | 177 | if err != nil { |
176 | - log.Error("统一用户中心请求失败 err:%s", err) | 178 | + log.Error("向统一用户中心发送请求失败 err:%s", err) |
177 | return protocol.NewErrWithMessage("1") | 179 | return protocol.NewErrWithMessage("1") |
178 | } | 180 | } |
179 | var ucenterReturn CommResponse | 181 | var ucenterReturn CommResponse |
@@ -182,8 +184,8 @@ func RequestUCenterRestPassword(phone, newPwd, confirmPwd, certificate string) e | @@ -182,8 +184,8 @@ func RequestUCenterRestPassword(phone, newPwd, confirmPwd, certificate string) e | ||
182 | log.Error("解析统一用户中心响应失败 err:%s", err) | 184 | log.Error("解析统一用户中心响应失败 err:%s", err) |
183 | return protocol.NewErrWithMessage("1") | 185 | return protocol.NewErrWithMessage("1") |
184 | } | 186 | } |
185 | - if !(ucenterReturn.Code == ResponseCode0) { | ||
186 | - return protocol.NewErrWithMessage("10052") | 187 | + if !(ucenterReturn.Code == ResponseCodeOk) { |
188 | + return protocol.NewErrWithMessage("10502") | ||
187 | } | 189 | } |
188 | 190 | ||
189 | return nil | 191 | return nil |
@@ -17,7 +17,7 @@ func ResetPasswordBySms(phone string, newPwd string, confirmPwd string) error { | @@ -17,7 +17,7 @@ func ResetPasswordBySms(phone string, newPwd string, confirmPwd string) error { | ||
17 | certificate, err = redisdata.GetCaptchAuth(phone) | 17 | certificate, err = redisdata.GetCaptchAuth(phone) |
18 | if err != nil { | 18 | if err != nil { |
19 | log.Error("从redis获取凭证失败:%s", err) | 19 | log.Error("从redis获取凭证失败:%s", err) |
20 | - return protocol.NewErrWithMessage("10020") | 20 | + return protocol.NewErrWithMessage("10200") |
21 | } | 21 | } |
22 | err = ucenter.RequestUCenterRestPassword(phone, newPwd, confirmPwd, certificate) | 22 | err = ucenter.RequestUCenterRestPassword(phone, newPwd, confirmPwd, certificate) |
23 | if err != nil { | 23 | if err != nil { |
-
请 注册 或 登录 后发表评论