合并分支 'dev' 到 'master'
Dev 查看合并请求 !46
正在显示
26 个修改的文件
包含
676 行增加
和
50 行删除
@@ -66,6 +66,8 @@ spec: | @@ -66,6 +66,8 @@ spec: | ||
66 | value: "31543" | 66 | value: "31543" |
67 | - name: LOG_LEVEL | 67 | - name: LOG_LEVEL |
68 | value: "debug" | 68 | value: "debug" |
69 | + - name: LOG_PREFIX | ||
70 | + value: "[partner_dev]" | ||
69 | - name: ERROR_BASE_CODE | 71 | - name: ERROR_BASE_CODE |
70 | value: "1" | 72 | value: "1" |
71 | - name: ERROR_BASE_CODE_MULTIPLE | 73 | - name: ERROR_BASE_CODE_MULTIPLE |
@@ -66,6 +66,8 @@ spec: | @@ -66,6 +66,8 @@ spec: | ||
66 | value: "31544" | 66 | value: "31544" |
67 | - name: LOG_LEVEL | 67 | - name: LOG_LEVEL |
68 | value: "debug" | 68 | value: "debug" |
69 | + - name: LOG_PREFIX | ||
70 | + value: "[partner_prd]" | ||
69 | - name: ERROR_BASE_CODE | 71 | - name: ERROR_BASE_CODE |
70 | value: "1" | 72 | value: "1" |
71 | - name: ERROR_BASE_CODE_MULTIPLE | 73 | - name: ERROR_BASE_CODE_MULTIPLE |
@@ -66,6 +66,8 @@ spec: | @@ -66,6 +66,8 @@ spec: | ||
66 | value: "31543" | 66 | value: "31543" |
67 | - name: LOG_LEVEL | 67 | - name: LOG_LEVEL |
68 | value: "debug" | 68 | value: "debug" |
69 | + - name: LOG_PREFIX | ||
70 | + value: "[partner_test]" | ||
69 | - name: ERROR_BASE_CODE | 71 | - name: ERROR_BASE_CODE |
70 | value: "1" | 72 | value: "1" |
71 | - name: ERROR_BASE_CODE_MULTIPLE | 73 | - name: ERROR_BASE_CODE_MULTIPLE |
@@ -2,6 +2,10 @@ package auth | @@ -2,6 +2,10 @@ package auth | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | + "strconv" | ||
6 | + "strings" | ||
7 | + "time" | ||
8 | + | ||
5 | "github.com/tiptok/gocomm/xa/eda" | 9 | "github.com/tiptok/gocomm/xa/eda" |
6 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/application/factory" | 10 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/application/factory" |
7 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/application/userAuth" | 11 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/application/userAuth" |
@@ -14,9 +18,6 @@ import ( | @@ -14,9 +18,6 @@ import ( | ||
14 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/log" | 18 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/log" |
15 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol" | 19 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol" |
16 | protocolx "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol/auth" | 20 | protocolx "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol/auth" |
17 | - "strconv" | ||
18 | - "strings" | ||
19 | - "time" | ||
20 | ) | 21 | ) |
21 | 22 | ||
22 | // 该方法废弃 | 23 | // 该方法废弃 |
@@ -301,50 +302,127 @@ func UCenterRevoke(header *protocol.RequestHeader, userId int64) (rsp *protocol. | @@ -301,50 +302,127 @@ func UCenterRevoke(header *protocol.RequestHeader, userId int64) (rsp *protocol. | ||
301 | return | 302 | return |
302 | } | 303 | } |
303 | 304 | ||
304 | -// 企业平台-多公司登录 | 305 | +// 企业平台-密码校验 |
306 | +func PasswordLogin(header *protocol.RequestHeader, request *protocol.LoginRequest) (v interface{}, err error) { | ||
307 | + var ( | ||
308 | + transactionContext, _ = factory.CreateTransactionContext(nil) | ||
309 | + loginSvr = domain_service.NewPgLoginService(transactionContext) | ||
310 | + ) | ||
311 | + | ||
312 | + if err = transactionContext.StartTransaction(); err != nil { | ||
313 | + log.Error(err) | ||
314 | + return nil, err | ||
315 | + } | ||
316 | + | ||
317 | + defer func() { | ||
318 | + transactionContext.RollbackTransaction() | ||
319 | + }() | ||
320 | + | ||
321 | + // loginSvr 初始化 | ||
322 | + loginSvr.Init(request.Phone) | ||
323 | + | ||
324 | + if len(loginSvr.Users) == 0 && len(loginSvr.PartnerInfo) == 0 { | ||
325 | + v = map[string]interface{}{} | ||
326 | + err = protocol.NewErrWithMessage(10001) | ||
327 | + return | ||
328 | + } | ||
329 | + | ||
330 | + if len(request.Password) == 0 { | ||
331 | + v = map[string]interface{}{} | ||
332 | + err = protocol.NewCustomMessage(1, "密码不能为空!") | ||
333 | + return | ||
334 | + } | ||
335 | + | ||
336 | + if loginSvr.ManagerLogin(request.Phone, request.Password) != nil && loginSvr.PartnerLogin(request.Phone, request.Password) != nil { | ||
337 | + v = map[string]interface{}{} | ||
338 | + err = protocol.NewCustomMessage(1, "密码输入有误!") | ||
339 | + return | ||
340 | + } | ||
341 | + | ||
342 | + v = map[string]interface{}{} | ||
343 | + err = transactionContext.CommitTransaction() | ||
344 | + return | ||
345 | +} | ||
346 | + | ||
347 | +/** | ||
348 | + * @Author SteveChan | ||
349 | + * @Description // 企业平台-多公司登录,判断是否高管 | ||
350 | + * @Date 15:01 2021/1/12 | ||
351 | + * @Param | ||
352 | + * @return | ||
353 | + **/ | ||
305 | func CompaniesLogin(header *protocol.RequestHeader, request *protocolx.CenterCompanysRequest) (v interface{}, err error) { | 354 | func CompaniesLogin(header *protocol.RequestHeader, request *protocolx.CenterCompanysRequest) (v interface{}, err error) { |
355 | + | ||
306 | var ( | 356 | var ( |
307 | transactionContext, _ = factory.CreateTransactionContext(nil) | 357 | transactionContext, _ = factory.CreateTransactionContext(nil) |
308 | imInfo *domain.ImInfo | 358 | imInfo *domain.ImInfo |
309 | loginSvr = domain_service.NewPgLoginService(transactionContext) | 359 | loginSvr = domain_service.NewPgLoginService(transactionContext) |
310 | ) | 360 | ) |
361 | + | ||
362 | + // 转换手机号码 | ||
311 | phoneId, e := strconv.Atoi(request.Phone) | 363 | phoneId, e := strconv.Atoi(request.Phone) |
312 | if e != nil { | 364 | if e != nil { |
313 | log.Error(e) | 365 | log.Error(e) |
314 | e = protocol.NewErrWithMessage(2) | 366 | e = protocol.NewErrWithMessage(2) |
315 | return | 367 | return |
316 | } | 368 | } |
369 | + | ||
317 | rsp := &protocolx.CenterCompanysResponse{} | 370 | rsp := &protocolx.CenterCompanysResponse{} |
371 | + | ||
372 | + // 启动事务 | ||
318 | if err = transactionContext.StartTransaction(); err != nil { | 373 | if err = transactionContext.StartTransaction(); err != nil { |
319 | log.Error(err) | 374 | log.Error(err) |
320 | return nil, err | 375 | return nil, err |
321 | } | 376 | } |
377 | + | ||
322 | defer func() { | 378 | defer func() { |
323 | transactionContext.RollbackTransaction() | 379 | transactionContext.RollbackTransaction() |
324 | }() | 380 | }() |
325 | - // 通过短信验证码登录的游客,注册一个账号到配置的公司去(ios审核使用) | ||
326 | - if request.GrantType == protocol.LoginBySmsCode { | ||
327 | - e := loginSvr.RegistryGuest(request.Phone) | ||
328 | - if e != nil { | ||
329 | - log.Error(e) | 381 | + |
382 | + // 通过密码或校验码登录的普通用户或通过校验码登录的游客,注册一个账号到配置的公司去 | ||
383 | + if request.GrantType == protocol.LoginBySmsCode || request.GrantType == protocol.LoginByPassword { | ||
384 | + userErr := loginSvr.RegistryUser(request.Phone) | ||
385 | + if userErr != nil { | ||
386 | + log.Error(userErr) | ||
330 | } | 387 | } |
331 | } | 388 | } |
389 | + | ||
332 | // loginSvr 初始化 | 390 | // loginSvr 初始化 |
333 | - loginSvr.Init(request.Phone) | ||
334 | - if len(loginSvr.Users) == 0 && len(loginSvr.PartnerInfo) == 0 { | ||
335 | - err = protocol.NewErrWithMessage(10001) | 391 | + _ = loginSvr.Init(request.Phone) |
392 | + | ||
393 | + // 所有公司有效用户不存在、所有公司有效合伙人不存在、所有公司合伙人不存在 | ||
394 | + if len(loginSvr.Users) == 0 && len(loginSvr.PartnerInfo) == 0 && len(loginSvr.NormalPartnerInfo) == 0 { | ||
395 | + err = protocol.NewErrWithMessage(10001) // 用户不存在 | ||
336 | return | 396 | return |
337 | } | 397 | } |
398 | + | ||
338 | switch request.GrantType { | 399 | switch request.GrantType { |
339 | case protocol.LoginByPassword: | 400 | case protocol.LoginByPassword: |
340 | if len(request.Password) == 0 { | 401 | if len(request.Password) == 0 { |
341 | err = protocol.NewCustomMessage(1, "密码不能为空!") | 402 | err = protocol.NewCustomMessage(1, "密码不能为空!") |
342 | return | 403 | return |
343 | } | 404 | } |
344 | - if loginSvr.ManagerLogin(request.Phone, request.Password) != nil && loginSvr.PartnerLogin(request.Phone, request.Password) != nil { | 405 | + |
406 | + manageLoginErr := loginSvr.ManagerLogin(request.Phone, request.Password) | ||
407 | + fmt.Print("用户登录:", manageLoginErr, "\n") | ||
408 | + partnerLoginErr := loginSvr.PartnerLogin(request.Phone, request.Password) | ||
409 | + fmt.Print("合伙人登录:", partnerLoginErr, "\n") | ||
410 | + | ||
411 | + if manageLoginErr != nil && partnerLoginErr != nil { | ||
412 | + if len(loginSvr.PartnerInfo) == 0 { // 不存在有效用户 | ||
413 | + err = protocol.NewErrWithMessage(10008) | ||
414 | + return | ||
415 | + } | ||
416 | + err = protocol.NewCustomMessage(1, "密码输入有误!") | ||
417 | + return | ||
418 | + } else if manageLoginErr != nil && partnerLoginErr == nil { | ||
419 | + if len(loginSvr.PartnerInfo) == 1 && len(loginSvr.NormalUsers) == 0 { | ||
420 | + if loginSvr.PartnerInfo[0].CompanyId == int64(constant.DEFAULT_GUEST_COMPANY) { | ||
345 | err = protocol.NewCustomMessage(1, "密码输入有误!") | 421 | err = protocol.NewCustomMessage(1, "密码输入有误!") |
346 | return | 422 | return |
347 | } | 423 | } |
424 | + } | ||
425 | + } | ||
348 | break | 426 | break |
349 | case protocol.LoginBySmsCode: | 427 | case protocol.LoginBySmsCode: |
350 | if _, err = CheckSmsCode(request.Phone, request.Captcha); err != nil { | 428 | if _, err = CheckSmsCode(request.Phone, request.Captcha); err != nil { |
@@ -372,8 +450,9 @@ func CompaniesLogin(header *protocol.RequestHeader, request *protocolx.CenterCom | @@ -372,8 +450,9 @@ func CompaniesLogin(header *protocol.RequestHeader, request *protocolx.CenterCom | ||
372 | // 获取统计信息(合伙人/高管) | 450 | // 获取统计信息(合伙人/高管) |
373 | rsp.Partner, _ = loginSvr.PartnerStaticInfo() | 451 | rsp.Partner, _ = loginSvr.PartnerStaticInfo() |
374 | rsp.Manager, _ = loginSvr.ManagerStaticInfo() | 452 | rsp.Manager, _ = loginSvr.ManagerStaticInfo() |
375 | - if !loginSvr.HasAvailableCompany { | ||
376 | - err = protocol.NewErrWithMessage(10008) //账号禁用 | 453 | + |
454 | + if !loginSvr.HasAvailableCompany && !loginSvr.HasAvailableManagerCompany { // 判断合伙人或者高管是否有可访问的公司 | ||
455 | + err = protocol.NewErrWithMessage(10008) //账号禁用, 抱歉,企业管理员未帮您开通权限。如需访问,请联系企业管理员 | ||
377 | return | 456 | return |
378 | } | 457 | } |
379 | 458 | ||
@@ -395,33 +474,45 @@ func CompaniesLogin(header *protocol.RequestHeader, request *protocolx.CenterCom | @@ -395,33 +474,45 @@ func CompaniesLogin(header *protocol.RequestHeader, request *protocolx.CenterCom | ||
395 | rsp.Phone = request.Phone | 474 | rsp.Phone = request.Phone |
396 | rsp.Credentials, _ = utils.GenerateToken(int64(phoneId), request.Phone, protocol.RefreshTokenExipre*time.Second) | 475 | rsp.Credentials, _ = utils.GenerateToken(int64(phoneId), request.Phone, protocol.RefreshTokenExipre*time.Second) |
397 | 476 | ||
398 | - //添加手机对应的凭证 | 477 | + // 添加手机对应的凭证 |
399 | userAuth.NewRedisUserCredential(request.Phone).AddAuth(rsp.Credentials) | 478 | userAuth.NewRedisUserCredential(request.Phone).AddAuth(rsp.Credentials) |
400 | 479 | ||
401 | v = map[string]interface{}{"center": rsp} | 480 | v = map[string]interface{}{"center": rsp} |
481 | + | ||
402 | err = transactionContext.CommitTransaction() | 482 | err = transactionContext.CommitTransaction() |
403 | return | 483 | return |
404 | } | 484 | } |
405 | 485 | ||
406 | -// 企业平台-多公司登录 - 通过凭证 | 486 | +/** |
487 | + * @Author SteveChan | ||
488 | + * @Description // 企业平台-多公司登录 - 通过凭证,判断是否高管 | ||
489 | + * @Date 15:00 2021/1/12 | ||
490 | + * @Param | ||
491 | + * @return | ||
492 | + **/ | ||
407 | func CompaniesLoginByCredential(header *protocol.RequestHeader, request *protocolx.CompanysRequest) (rsp *protocolx.CompanysResponse, err error) { | 493 | func CompaniesLoginByCredential(header *protocol.RequestHeader, request *protocolx.CompanysRequest) (rsp *protocolx.CompanysResponse, err error) { |
408 | var ( | 494 | var ( |
409 | transactionContext, _ = factory.CreateTransactionContext(nil) | 495 | transactionContext, _ = factory.CreateTransactionContext(nil) |
410 | loginSvr = domain_service.NewPgLoginService(transactionContext) | 496 | loginSvr = domain_service.NewPgLoginService(transactionContext) |
411 | claim *utils.UserTokenClaims | 497 | claim *utils.UserTokenClaims |
412 | ) | 498 | ) |
499 | + | ||
413 | rsp = &protocolx.CompanysResponse{} | 500 | rsp = &protocolx.CompanysResponse{} |
501 | + | ||
414 | if err = transactionContext.StartTransaction(); err != nil { | 502 | if err = transactionContext.StartTransaction(); err != nil { |
415 | log.Error(err) | 503 | log.Error(err) |
416 | return nil, err | 504 | return nil, err |
417 | } | 505 | } |
506 | + | ||
418 | defer func() { | 507 | defer func() { |
419 | transactionContext.RollbackTransaction() | 508 | transactionContext.RollbackTransaction() |
420 | }() | 509 | }() |
510 | + | ||
421 | if claim, err = utils.ParseJWTToken(request.Credentials); err != nil { | 511 | if claim, err = utils.ParseJWTToken(request.Credentials); err != nil { |
422 | err = protocol.NewErrWithMessage(4140, err) | 512 | err = protocol.NewErrWithMessage(4140, err) |
423 | return | 513 | return |
424 | } | 514 | } |
515 | + | ||
425 | //凭证是否存在 | 516 | //凭证是否存在 |
426 | if constant.DISENABLE_MULTI_DEVICE_LOGIN { | 517 | if constant.DISENABLE_MULTI_DEVICE_LOGIN { |
427 | if credential, e := userAuth.NewRedisUserCredential(claim.Phone).GetAuth(); e != nil || !strings.EqualFold(credential, request.Credentials) { | 518 | if credential, e := userAuth.NewRedisUserCredential(claim.Phone).GetAuth(); e != nil || !strings.EqualFold(credential, request.Credentials) { |
@@ -432,10 +523,23 @@ func CompaniesLoginByCredential(header *protocol.RequestHeader, request *protoco | @@ -432,10 +523,23 @@ func CompaniesLoginByCredential(header *protocol.RequestHeader, request *protoco | ||
432 | } | 523 | } |
433 | 524 | ||
434 | // loginSvr 初始化 | 525 | // loginSvr 初始化 |
435 | - loginSvr.Init(claim.Phone) | 526 | + _ = loginSvr.Init(claim.Phone) |
527 | + | ||
528 | + // 高管标志位初始化 | ||
529 | + _ = loginSvr.InitSenior(claim.Phone) | ||
530 | + | ||
531 | + // 合伙人标志位初始化 | ||
532 | + _ = loginSvr.InitPartner(claim.Phone) | ||
533 | + | ||
534 | + if len(loginSvr.PartnerInfo) == 0 && len(loginSvr.Users) == 0 { | ||
535 | + err = protocol.NewErrWithMessage(4104) | ||
536 | + return | ||
537 | + } | ||
538 | + | ||
436 | rsp.Partner, _ = loginSvr.PartnerStaticInfo() | 539 | rsp.Partner, _ = loginSvr.PartnerStaticInfo() |
437 | rsp.Manager, _ = loginSvr.ManagerStaticInfo() | 540 | rsp.Manager, _ = loginSvr.ManagerStaticInfo() |
438 | - if !loginSvr.HasAvailableCompany { | 541 | + |
542 | + if !loginSvr.HasAvailableCompany && !loginSvr.HasAvailableManagerCompany { | ||
439 | err = protocol.NewErrWithMessage(4140, err) //账号禁用 | 543 | err = protocol.NewErrWithMessage(4140, err) //账号禁用 |
440 | return | 544 | return |
441 | } | 545 | } |
@@ -444,7 +548,13 @@ func CompaniesLoginByCredential(header *protocol.RequestHeader, request *protoco | @@ -444,7 +548,13 @@ func CompaniesLoginByCredential(header *protocol.RequestHeader, request *protoco | ||
444 | return | 548 | return |
445 | } | 549 | } |
446 | 550 | ||
447 | -// 登录 | 551 | +/** |
552 | + * @Author SteveChan | ||
553 | + * @Description //TODO 登录 | ||
554 | + * @Date 15:05 2021/1/15 | ||
555 | + * @Param | ||
556 | + * @return | ||
557 | + **/ | ||
448 | func LoginV2(header *protocol.RequestHeader, request *protocol.LoginRequestV2) (rsp *protocol.LoginResponse, err error) { | 558 | func LoginV2(header *protocol.RequestHeader, request *protocol.LoginRequestV2) (rsp *protocol.LoginResponse, err error) { |
449 | var ( | 559 | var ( |
450 | claim *utils.UserTokenClaims | 560 | claim *utils.UserTokenClaims |
@@ -480,6 +590,15 @@ func LoginV2(header *protocol.RequestHeader, request *protocol.LoginRequestV2) ( | @@ -480,6 +590,15 @@ func LoginV2(header *protocol.RequestHeader, request *protocol.LoginRequestV2) ( | ||
480 | } | 590 | } |
481 | switch request.IdType { | 591 | switch request.IdType { |
482 | case int(protocolx.AdminTypePartner): | 592 | case int(protocolx.AdminTypePartner): |
593 | + // 用户信息检索 | ||
594 | + //if u, e := UsersRepository.FindOne(map[string]interface{}{"phone": claim.Phone, "companyId": request.Cid, "deleteAtIsNull": true}); e == nil { | ||
595 | + // userId = u.Id | ||
596 | + // if !u.IsEnable() { | ||
597 | + // err = protocol.NewErrWithMessage(10006, err) //当前账号已被禁用 | ||
598 | + // return | ||
599 | + // } | ||
600 | + //} | ||
601 | + // 合伙人检索 | ||
483 | if p, e := PartnerInfoRepository.FindOne(map[string]interface{}{"account": claim.Phone, "companyId": request.Cid, "deleteAtIsNull": true}); e == nil { | 602 | if p, e := PartnerInfoRepository.FindOne(map[string]interface{}{"account": claim.Phone, "companyId": request.Cid, "deleteAtIsNull": true}); e == nil { |
484 | userId = p.Id | 603 | userId = p.Id |
485 | if !p.IsEnable() { | 604 | if !p.IsEnable() { |
@@ -500,9 +619,10 @@ func LoginV2(header *protocol.RequestHeader, request *protocol.LoginRequestV2) ( | @@ -500,9 +619,10 @@ func LoginV2(header *protocol.RequestHeader, request *protocol.LoginRequestV2) ( | ||
500 | } | 619 | } |
501 | break | 620 | break |
502 | case int(protocolx.AdminTypeManager): | 621 | case int(protocolx.AdminTypeManager): |
622 | + // 用户信息检索 | ||
503 | if p, e := UsersRepository.FindOne(map[string]interface{}{"phone": claim.Phone, "companyId": request.Cid, "deleteAtIsNull": true}); e == nil { | 623 | if p, e := UsersRepository.FindOne(map[string]interface{}{"phone": claim.Phone, "companyId": request.Cid, "deleteAtIsNull": true}); e == nil { |
504 | userId = p.Id | 624 | userId = p.Id |
505 | - if !p.IsEnable() { | 625 | + if !p.IsEnable() || !p.IsUserSenior() { |
506 | err = protocol.NewErrWithMessage(10006, err) //当前账号已被禁用 | 626 | err = protocol.NewErrWithMessage(10006, err) //当前账号已被禁用 |
507 | return | 627 | return |
508 | } | 628 | } |
@@ -520,6 +640,7 @@ func LoginV2(header *protocol.RequestHeader, request *protocol.LoginRequestV2) ( | @@ -520,6 +640,7 @@ func LoginV2(header *protocol.RequestHeader, request *protocol.LoginRequestV2) ( | ||
520 | err = protocol.NewErrWithMessage(2, fmt.Errorf("idType :%v not in range (1,2)", request.IdType)) //用户类型有误 | 640 | err = protocol.NewErrWithMessage(2, fmt.Errorf("idType :%v not in range (1,2)", request.IdType)) //用户类型有误 |
521 | return | 641 | return |
522 | } | 642 | } |
643 | + | ||
523 | if userId == 0 { | 644 | if userId == 0 { |
524 | err = protocol.NewErrWithMessage(10001, err) //账号不存在 | 645 | err = protocol.NewErrWithMessage(10001, err) //账号不存在 |
525 | return | 646 | return |
@@ -68,6 +68,7 @@ func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest) | @@ -68,6 +68,7 @@ func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest) | ||
68 | rsp.User.Salesman = map[string]interface{}{} | 68 | rsp.User.Salesman = map[string]interface{}{} |
69 | } | 69 | } |
70 | } | 70 | } |
71 | + | ||
71 | funcManagerInfo := func() { | 72 | funcManagerInfo := func() { |
72 | if user, err = UsersRepository.FindOne(map[string]interface{}{"id": header.UserId}); err != nil { | 73 | if user, err = UsersRepository.FindOne(map[string]interface{}{"id": header.UserId}); err != nil { |
73 | err = protocol.NewErrWithMessage(502, err) //账号不存在 | 74 | err = protocol.NewErrWithMessage(502, err) //账号不存在 |
@@ -196,25 +197,33 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques | @@ -196,25 +197,33 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques | ||
196 | UsersRepository, _ = factory.CreateUsersRepository(transactionContext) | 197 | UsersRepository, _ = factory.CreateUsersRepository(transactionContext) |
197 | company *domain.Company | 198 | company *domain.Company |
198 | user *domain.Users | 199 | user *domain.Users |
200 | + //loginSvr = domain_service.NewPgLoginService(transactionContext) | ||
199 | ) | 201 | ) |
202 | + | ||
200 | if err = transactionContext.StartTransaction(); err != nil { | 203 | if err = transactionContext.StartTransaction(); err != nil { |
201 | return nil, err | 204 | return nil, err |
202 | } | 205 | } |
206 | + | ||
203 | defer func() { | 207 | defer func() { |
204 | transactionContext.RollbackTransaction() | 208 | transactionContext.RollbackTransaction() |
205 | }() | 209 | }() |
210 | + | ||
206 | rsp = &protocol.UserInfoResponse{} | 211 | rsp = &protocol.UserInfoResponse{} |
207 | rspMap := make(map[string]interface{}) | 212 | rspMap := make(map[string]interface{}) |
208 | 213 | ||
214 | + // 获取合伙人信息 | ||
209 | funcPartnerInfo := func() { | 215 | funcPartnerInfo := func() { |
210 | if partnerInfo, err = PartnerInfoService.FindOne(map[string]interface{}{"id": header.UserId}); err != nil { | 216 | if partnerInfo, err = PartnerInfoService.FindOne(map[string]interface{}{"id": header.UserId}); err != nil { |
211 | err = protocol.NewErrWithMessage(502, err) //账号不存在 | 217 | err = protocol.NewErrWithMessage(502, err) //账号不存在 |
212 | return | 218 | return |
213 | } | 219 | } |
220 | + | ||
214 | if company, err = CompanyRepository.FindOne(map[string]interface{}{"id": header.CompanyId}); err != nil { | 221 | if company, err = CompanyRepository.FindOne(map[string]interface{}{"id": header.CompanyId}); err != nil { |
215 | return | 222 | return |
216 | } | 223 | } |
224 | + | ||
217 | var miniProgram map[string]interface{} | 225 | var miniProgram map[string]interface{} |
226 | + | ||
218 | if len(company.Applets) > 0 { | 227 | if len(company.Applets) > 0 { |
219 | if company.Applets[0].Valid() { | 228 | if company.Applets[0].Valid() { |
220 | miniProgram = make(map[string]interface{}) | 229 | miniProgram = make(map[string]interface{}) |
@@ -228,6 +237,7 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques | @@ -228,6 +237,7 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques | ||
228 | miniProgram["title"] = company.Applets[0].Name | 237 | miniProgram["title"] = company.Applets[0].Name |
229 | } | 238 | } |
230 | } | 239 | } |
240 | + | ||
231 | u := userx.User{ | 241 | u := userx.User{ |
232 | Id: partnerInfo.Id, | 242 | Id: partnerInfo.Id, |
233 | PartnerName: partnerInfo.PartnerName, | 243 | PartnerName: partnerInfo.PartnerName, |
@@ -265,18 +275,22 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques | @@ -265,18 +275,22 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques | ||
265 | } else { | 275 | } else { |
266 | u.CooperateCompany.Salesman = map[string]interface{}{} | 276 | u.CooperateCompany.Salesman = map[string]interface{}{} |
267 | } | 277 | } |
278 | + | ||
268 | rspMap["user"] = u | 279 | rspMap["user"] = u |
269 | rsp = rspMap | 280 | rsp = rspMap |
270 | } | 281 | } |
271 | 282 | ||
283 | + // 获取管理员信息 | ||
272 | funcManagerInfo := func() { | 284 | funcManagerInfo := func() { |
273 | if user, err = UsersRepository.FindOne(map[string]interface{}{"id": header.UserId}); err != nil { | 285 | if user, err = UsersRepository.FindOne(map[string]interface{}{"id": header.UserId}); err != nil { |
274 | err = protocol.NewErrWithMessage(502, err) //账号不存在 | 286 | err = protocol.NewErrWithMessage(502, err) //账号不存在 |
275 | return | 287 | return |
276 | } | 288 | } |
289 | + | ||
277 | if company, err = CompanyRepository.FindOne(map[string]interface{}{"id": header.CompanyId}); err != nil { | 290 | if company, err = CompanyRepository.FindOne(map[string]interface{}{"id": header.CompanyId}); err != nil { |
278 | return | 291 | return |
279 | } | 292 | } |
293 | + | ||
280 | rspMap["user"] = userx.User{ | 294 | rspMap["user"] = userx.User{ |
281 | Id: user.Id, | 295 | Id: user.Id, |
282 | PartnerName: user.Name, | 296 | PartnerName: user.Name, |
@@ -288,9 +302,14 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques | @@ -288,9 +302,14 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques | ||
288 | MiniProgram: nil, | 302 | MiniProgram: nil, |
289 | }, | 303 | }, |
290 | } | 304 | } |
305 | + | ||
291 | rsp = rspMap | 306 | rsp = rspMap |
292 | } | 307 | } |
293 | 308 | ||
309 | + //判断是否高管 | ||
310 | + //phone := strconv.Itoa(header.SimNum) | ||
311 | + //ok, _ := loginSvr.CheckIsSenior(phone, header.CompanyId) | ||
312 | + | ||
294 | switch header.AdminType { | 313 | switch header.AdminType { |
295 | case int(protocolx.AdminTypePartner): | 314 | case int(protocolx.AdminTypePartner): |
296 | funcPartnerInfo() | 315 | funcPartnerInfo() |
@@ -302,6 +321,7 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques | @@ -302,6 +321,7 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques | ||
302 | funcPartnerInfo() | 321 | funcPartnerInfo() |
303 | break | 322 | break |
304 | } | 323 | } |
324 | + | ||
305 | err = transactionContext.CommitTransaction() | 325 | err = transactionContext.CommitTransaction() |
306 | return | 326 | return |
307 | } | 327 | } |
@@ -9,6 +9,7 @@ const SERVICE_NAME = "partner" | @@ -9,6 +9,7 @@ const SERVICE_NAME = "partner" | ||
9 | 9 | ||
10 | var LOG_LEVEL = "debug" | 10 | var LOG_LEVEL = "debug" |
11 | var LOG_File = "app.log" | 11 | var LOG_File = "app.log" |
12 | +var LOG_PREFIX = "[partner_dev]" | ||
12 | 13 | ||
13 | var MMM_SMS_SERVICE_HOST = "https://sms.fjmaimaimai.com:9897" | 14 | var MMM_SMS_SERVICE_HOST = "https://sms.fjmaimaimai.com:9897" |
14 | var UCENTER_SERVICE_HOST = "https://suplus-ucenter-test.fjmaimaimai.com" | 15 | var UCENTER_SERVICE_HOST = "https://suplus-ucenter-test.fjmaimaimai.com" |
@@ -17,7 +18,7 @@ var UCENTER_APP_KEY = "0c2c2a23dfc64ae230f5c54ab243ab52" | @@ -17,7 +18,7 @@ var UCENTER_APP_KEY = "0c2c2a23dfc64ae230f5c54ab243ab52" | ||
17 | var BUSINESS_ADMIN_SERVICE_HOST = "http://suplus-business-admin-test.fjmaimaimai.com" | 18 | var BUSINESS_ADMIN_SERVICE_HOST = "http://suplus-business-admin-test.fjmaimaimai.com" |
18 | var BUSINESS_ADMIN_PLATFORM_ID = "25" //合伙人模块 | 19 | var BUSINESS_ADMIN_PLATFORM_ID = "25" //合伙人模块 |
19 | 20 | ||
20 | -var DEFAULT_GUEST_COMPANY int = 10011 | 21 | +var DEFAULT_GUEST_COMPANY int = 358 |
21 | 22 | ||
22 | var SHARE_SHOP_PREVIEW_IMADGE = "https://media.fjmaimaimai.com/image/default/3E0C7050C13147CE8C7AF86C75F904E9-6-2.jpg" //分享店铺预览图 | 23 | var SHARE_SHOP_PREVIEW_IMADGE = "https://media.fjmaimaimai.com/image/default/3E0C7050C13147CE8C7AF86C75F904E9-6-2.jpg" //分享店铺预览图 |
23 | var WEHAT_MINI_PROGRAM_VERSION_TYPE = 2 //0:正式版 1:开发版 2:体验版 | 24 | var WEHAT_MINI_PROGRAM_VERSION_TYPE = 2 //0:正式版 1:开发版 2:体验版 |
@@ -28,6 +29,9 @@ func init() { | @@ -28,6 +29,9 @@ func init() { | ||
28 | if os.Getenv("LOG_LEVEL") != "" { | 29 | if os.Getenv("LOG_LEVEL") != "" { |
29 | LOG_LEVEL = os.Getenv("LOG_LEVEL") | 30 | LOG_LEVEL = os.Getenv("LOG_LEVEL") |
30 | } | 31 | } |
32 | + if os.Getenv("LOG_PREFIX") != "" { | ||
33 | + LOG_PREFIX = os.Getenv("LOG_PREFIX") | ||
34 | + } | ||
31 | if os.Getenv("UCENTER_SERVICE_HOST") != "" { | 35 | if os.Getenv("UCENTER_SERVICE_HOST") != "" { |
32 | UCENTER_SERVICE_HOST = os.Getenv("UCENTER_SERVICE_HOST") | 36 | UCENTER_SERVICE_HOST = os.Getenv("UCENTER_SERVICE_HOST") |
33 | } | 37 | } |
@@ -46,6 +46,8 @@ type Users struct { | @@ -46,6 +46,8 @@ type Users struct { | ||
46 | AccessPartners []*PartnerInfo | 46 | AccessPartners []*PartnerInfo |
47 | // 1普通用户 2主管理员 | 47 | // 1普通用户 2主管理员 |
48 | AdminType int8 `json:"adminType"` | 48 | AdminType int8 `json:"adminType"` |
49 | + // 是否高管 | ||
50 | + IsSenior int8 `json:"isSenior"` | ||
49 | } | 51 | } |
50 | 52 | ||
51 | func (Users *Users) AccessPartnerIds() []int64 { | 53 | func (Users *Users) AccessPartnerIds() []int64 { |
@@ -71,6 +73,11 @@ func (m *Users) IsEnable() bool { | @@ -71,6 +73,11 @@ func (m *Users) IsEnable() bool { | ||
71 | return m.Status == 1 | 73 | return m.Status == 1 |
72 | } | 74 | } |
73 | 75 | ||
76 | +// 账号是否是高管 | ||
77 | +func (m *Users) IsUserSenior() bool { | ||
78 | + return m.IsSenior == 1 | ||
79 | +} | ||
80 | + | ||
74 | func (m *Users) Identify() interface{} { | 81 | func (m *Users) Identify() interface{} { |
75 | if m.Id == 0 { | 82 | if m.Id == 0 { |
76 | return nil | 83 | return nil |
@@ -21,8 +21,8 @@ func NewPgAuthService(ctx *transaction.TransactionContext) *PgAuthService { | @@ -21,8 +21,8 @@ func NewPgAuthService(ctx *transaction.TransactionContext) *PgAuthService { | ||
21 | } | 21 | } |
22 | 22 | ||
23 | func (s *PgAuthService) ChangeUserPhone(userId int64, newPhone, oldPhone string) (err error) { | 23 | func (s *PgAuthService) ChangeUserPhone(userId int64, newPhone, oldPhone string) (err error) { |
24 | - errPartner := s.partner.ChangeUserPhone(userId, newPhone, oldPhone) | ||
25 | - errManager := s.manager.ChangeUserPhone(userId, newPhone, oldPhone) | 24 | + errPartner := s.partner.ChangeUserPhone(userId, newPhone, oldPhone) // 合伙人修改手机号 |
25 | + errManager := s.manager.ChangeUserPhone(userId, newPhone, oldPhone) // 高管修改手机号 | ||
26 | return errResolve(errPartner, errManager) | 26 | return errResolve(errPartner, errManager) |
27 | } | 27 | } |
28 | func (s *PgAuthService) ChangeUserPassword(userId int64, newPwd, oldPwd, phone string) (err error) { | 28 | func (s *PgAuthService) ChangeUserPassword(userId int64, newPwd, oldPwd, phone string) (err error) { |
1 | package domain_service | 1 | package domain_service |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + "fmt" | ||
4 | "github.com/tiptok/gocomm/xa/eda" | 5 | "github.com/tiptok/gocomm/xa/eda" |
5 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant" | 6 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant" |
6 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain" | 7 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain" |
@@ -20,11 +21,19 @@ import ( | @@ -20,11 +21,19 @@ import ( | ||
20 | type PgLoginService struct { | 21 | type PgLoginService struct { |
21 | Phone string | 22 | Phone string |
22 | eda.EventCenterPublisher | 23 | eda.EventCenterPublisher |
23 | - PartnerInfo []*domain.PartnerInfo | ||
24 | - Users []*domain.Users | 24 | + PartnerInfo []*domain.PartnerInfo // 所有公司有效合伙人 |
25 | + GuestPartnerInfo []*domain.PartnerInfo // 游客公司合伙人 | ||
26 | + GuestPartnerInfoAvailable []*domain.PartnerInfo // 游客公司有效合伙人 | ||
27 | + NormalPartnerInfo []*domain.PartnerInfo // 所有公司合伙人 | ||
28 | + IsPartnerInfo []*domain.PartnerInfo // 真实公司有效合伙人 | ||
29 | + Users []*domain.Users // 所有公司有效用户 | ||
30 | + NormalUsers []*domain.Users // 所有公司用户 | ||
31 | + IsSenior []*domain.Users // 所有公司有效高管 | ||
32 | + IsRealSenior []*domain.Users // 真实公司的有效高管 | ||
25 | transactionContext *transaction.TransactionContext | 33 | transactionContext *transaction.TransactionContext |
26 | // 标识:登录的账号信息是否有可用的公司, true:有 false:没有 | 34 | // 标识:登录的账号信息是否有可用的公司, true:有 false:没有 |
27 | - HasAvailableCompany bool | 35 | + HasAvailableCompany bool // 是否有可访问的合伙公司 |
36 | + HasAvailableManagerCompany bool // 是否有可访问的高管公司 | ||
28 | } | 37 | } |
29 | 38 | ||
30 | func (svr *PgLoginService) Init(phone string) (err error) { | 39 | func (svr *PgLoginService) Init(phone string) (err error) { |
@@ -32,12 +41,118 @@ func (svr *PgLoginService) Init(phone string) (err error) { | @@ -32,12 +41,118 @@ func (svr *PgLoginService) Init(phone string) (err error) { | ||
32 | PartnerInfoService, _ = repository.NewPartnerInfoRepository(svr.transactionContext) | 41 | PartnerInfoService, _ = repository.NewPartnerInfoRepository(svr.transactionContext) |
33 | UsersRepository, _ = repository.NewUsersRepository(svr.transactionContext) | 42 | UsersRepository, _ = repository.NewUsersRepository(svr.transactionContext) |
34 | ) | 43 | ) |
44 | + | ||
35 | svr.Phone = phone | 45 | svr.Phone = phone |
46 | + | ||
47 | + // 所有公司合伙人 | ||
48 | + _, svr.NormalPartnerInfo, err = PartnerInfoService.Find(map[string]interface{}{"account": phone, "sortByCreateTime": "ASC"}) | ||
49 | + // 所有公司有效合伙人 | ||
36 | _, svr.PartnerInfo, err = PartnerInfoService.Find(map[string]interface{}{"account": phone, "status": 1, "sortByCreateTime": "ASC"}) | 50 | _, svr.PartnerInfo, err = PartnerInfoService.Find(map[string]interface{}{"account": phone, "status": 1, "sortByCreateTime": "ASC"}) |
51 | + // 真实公司有效合伙人 | ||
52 | + _, svr.IsPartnerInfo, err = PartnerInfoService.Find(map[string]interface{}{"account": phone, "status": 1, "sortByCreateTime": "ASC", "isNot": constant.DEFAULT_GUEST_COMPANY}) | ||
53 | + // 游客公司合伙人 | ||
54 | + _, svr.GuestPartnerInfo, err = PartnerInfoService.Find(map[string]interface{}{"account": phone, "sortByCreateTime": "ASC", "companyId": constant.DEFAULT_GUEST_COMPANY}) | ||
55 | + // 游客公司有效合伙人 | ||
56 | + _, svr.GuestPartnerInfoAvailable, err = PartnerInfoService.Find(map[string]interface{}{"account": phone, "status": 1, "sortByCreateTime": "ASC", "companyId": constant.DEFAULT_GUEST_COMPANY}) | ||
57 | + | ||
58 | + // 所有公司用户 | ||
59 | + _, svr.NormalUsers, err = UsersRepository.Find(map[string]interface{}{"phone": phone, "sortByCreateTime": "ASC", "deleteAtIsNull": true}) | ||
60 | + // 所有公司有效用户 | ||
37 | _, svr.Users, err = UsersRepository.Find(map[string]interface{}{"phone": phone, "status": 1, "sortByCreateTime": "ASC", "deleteAtIsNull": true}) | 61 | _, svr.Users, err = UsersRepository.Find(map[string]interface{}{"phone": phone, "status": 1, "sortByCreateTime": "ASC", "deleteAtIsNull": true}) |
62 | + // 所有公司有效高管 | ||
63 | + _, svr.IsSenior, err = UsersRepository.Find(map[string]interface{}{"phone": phone, "status": 1, "sortByCreateTime": "ASC", "deleteAtIsNull": true, "isSenior": 1}) | ||
64 | + // 真实公司有效高管 | ||
65 | + _, svr.IsRealSenior, err = UsersRepository.Find(map[string]interface{}{"phone": phone, "status": 1, "sortByCreateTime": "ASC", "deleteAtIsNull": true, "isSenior": 1, "isNot": constant.DEFAULT_GUEST_COMPANY}) | ||
66 | + | ||
67 | + return nil | ||
68 | +} | ||
69 | + | ||
70 | +func (svr *PgLoginService) InitNormal(phone string) (err error) { | ||
71 | + var ( | ||
72 | + PartnerInfoService, _ = repository.NewPartnerInfoRepository(svr.transactionContext) | ||
73 | + ) | ||
74 | + | ||
75 | + svr.Phone = phone | ||
76 | + | ||
77 | + _, svr.NormalPartnerInfo, err = PartnerInfoService.Find(map[string]interface{}{"account": phone, "sortByCreateTime": "ASC"}) | ||
78 | + | ||
79 | + return nil | ||
80 | +} | ||
81 | + | ||
82 | +func (svr *PgLoginService) InitSenior(phone string) (err error) { | ||
83 | + var ( | ||
84 | + UsersRepository, _ = repository.NewUsersRepository(svr.transactionContext) | ||
85 | + ) | ||
86 | + | ||
87 | + svr.Phone = phone | ||
88 | + | ||
89 | + _, svr.IsSenior, err = UsersRepository.Find(map[string]interface{}{"phone": phone, "status": 1, "sortByCreateTime": "ASC", "deleteAtIsNull": true, "isSenior": 1}) | ||
90 | + | ||
91 | + return nil | ||
92 | +} | ||
93 | + | ||
94 | +func (svr *PgLoginService) InitPartner(phone string) (err error) { | ||
95 | + var ( | ||
96 | + PartnerInfoService, _ = repository.NewPartnerInfoRepository(svr.transactionContext) | ||
97 | + ) | ||
98 | + | ||
99 | + svr.Phone = phone | ||
100 | + | ||
101 | + _, svr.IsPartnerInfo, err = PartnerInfoService.Find(map[string]interface{}{"account": phone, "status": 1, "sortByCreateTime": "ASC", "isNot": constant.DEFAULT_GUEST_COMPANY}) | ||
102 | + | ||
38 | return nil | 103 | return nil |
39 | } | 104 | } |
40 | 105 | ||
106 | +/** | ||
107 | + * @Author SteveChan | ||
108 | + * @Description // 判断是否是高管 | ||
109 | + * @Date 10:44 2021/1/12 | ||
110 | + * @Param | ||
111 | + * @return | ||
112 | + **/ | ||
113 | +func (svr *PgLoginService) CheckIsSenior(phone string, companyId int64) (ok bool, err error) { | ||
114 | + var ( | ||
115 | + UsersRepository, _ = repository.NewUsersRepository(svr.transactionContext) | ||
116 | + ) | ||
117 | + svr.Phone = phone | ||
118 | + user, err := UsersRepository.FindOne(map[string]interface{}{"phone": phone, "status": 1, "companyId": companyId, "deleteAtIsNull": true}) | ||
119 | + if err != nil { | ||
120 | + return false, err | ||
121 | + } else { | ||
122 | + if user.IsSenior == 1 { | ||
123 | + ok = true | ||
124 | + } else if user.IsSenior == 2 { | ||
125 | + ok = false | ||
126 | + } | ||
127 | + } | ||
128 | + return ok, nil | ||
129 | +} | ||
130 | + | ||
131 | +/** | ||
132 | + * @Author SteveChan | ||
133 | + * @Description // 判断是否合伙人 | ||
134 | + * @Date 13:25 2021/1/13 | ||
135 | + * @Param | ||
136 | + * @return | ||
137 | + **/ | ||
138 | +func (svr *PgLoginService) CheckIsPartner(phone string, companyId int64) (ok bool, err error) { | ||
139 | + var ( | ||
140 | + PartnerInfoRepository, _ = repository.NewPartnerInfoRepository(svr.transactionContext) | ||
141 | + ) | ||
142 | + svr.Phone = phone | ||
143 | + user, err := PartnerInfoRepository.FindOne(map[string]interface{}{"account": phone, "status": 1}) | ||
144 | + if err != nil { | ||
145 | + return false, err | ||
146 | + } | ||
147 | + if user != nil { | ||
148 | + ok = true | ||
149 | + } else { | ||
150 | + ok = false | ||
151 | + } | ||
152 | + | ||
153 | + return ok, nil | ||
154 | +} | ||
155 | + | ||
41 | //合伙人登录 | 156 | //合伙人登录 |
42 | func (svr *PgLoginService) PartnerLogin(phone string, password string) (err error) { | 157 | func (svr *PgLoginService) PartnerLogin(phone string, password string) (err error) { |
43 | if len(svr.PartnerInfo) == 0 { | 158 | if len(svr.PartnerInfo) == 0 { |
@@ -46,7 +161,7 @@ func (svr *PgLoginService) PartnerLogin(phone string, password string) (err erro | @@ -46,7 +161,7 @@ func (svr *PgLoginService) PartnerLogin(phone string, password string) (err erro | ||
46 | return | 161 | return |
47 | } | 162 | } |
48 | if !strings.EqualFold(svr.PartnerInfo[0].Password, password) { | 163 | if !strings.EqualFold(svr.PartnerInfo[0].Password, password) { |
49 | - err = protocol.NewCustomMessage(1, "密码输入有误!") | 164 | + err = protocol.NewCustomMessage(1, "密码输入错误!") |
50 | return | 165 | return |
51 | } | 166 | } |
52 | return | 167 | return |
@@ -73,10 +188,12 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { | @@ -73,10 +188,12 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { | ||
73 | response := make(map[string]interface{}) | 188 | response := make(map[string]interface{}) |
74 | response["id"] = protocolx.AdminTypePartner | 189 | response["id"] = protocolx.AdminTypePartner |
75 | response["name"] = protocolx.AdminTypePartnerName | 190 | response["name"] = protocolx.AdminTypePartnerName |
191 | + | ||
76 | if len(svr.PartnerInfo) == 0 { | 192 | if len(svr.PartnerInfo) == 0 { |
77 | response["companys"] = make([]struct{}, 0) | 193 | response["companys"] = make([]struct{}, 0) |
78 | return response, nil | 194 | return response, nil |
79 | } | 195 | } |
196 | + | ||
80 | var ( | 197 | var ( |
81 | OrderDao, _ = dao.NewOrderBaseDao(svr.transactionContext) | 198 | OrderDao, _ = dao.NewOrderBaseDao(svr.transactionContext) |
82 | BusinessBonusDao, _ = dao.NewBusinessBonusDao(svr.transactionContext) | 199 | BusinessBonusDao, _ = dao.NewBusinessBonusDao(svr.transactionContext) |
@@ -87,6 +204,7 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { | @@ -87,6 +204,7 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { | ||
87 | UsersRepository, _ = repository.NewUsersRepository(svr.transactionContext) | 204 | UsersRepository, _ = repository.NewUsersRepository(svr.transactionContext) |
88 | adminApiGateway = http_gateway.NewHttplibBusinessAdminApiServiceGateway() | 205 | adminApiGateway = http_gateway.NewHttplibBusinessAdminApiServiceGateway() |
89 | ) | 206 | ) |
207 | + | ||
90 | doGetCompanyIds := func() []int64 { | 208 | doGetCompanyIds := func() []int64 { |
91 | var companies []int64 | 209 | var companies []int64 |
92 | for i := range svr.PartnerInfo { | 210 | for i := range svr.PartnerInfo { |
@@ -94,6 +212,7 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { | @@ -94,6 +212,7 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { | ||
94 | } | 212 | } |
95 | return companies | 213 | return companies |
96 | } | 214 | } |
215 | + | ||
97 | doGetPartnerIds := func() []int64 { | 216 | doGetPartnerIds := func() []int64 { |
98 | var array []int64 | 217 | var array []int64 |
99 | for i := range svr.PartnerInfo { | 218 | for i := range svr.PartnerInfo { |
@@ -101,17 +220,21 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { | @@ -101,17 +220,21 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { | ||
101 | } | 220 | } |
102 | return array | 221 | return array |
103 | } | 222 | } |
223 | + | ||
104 | companyList = svr.GetCompanyList(doGetCompanyIds) | 224 | companyList = svr.GetCompanyList(doGetCompanyIds) |
105 | if len(companyList) == 0 { | 225 | if len(companyList) == 0 { |
106 | return response, nil | 226 | return response, nil |
107 | } | 227 | } |
228 | + | ||
108 | totalBonus, e := OrderDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: doGetPartnerIds(), OrderTypes: domain.UserOrderTypes(domain.Career)}) | 229 | totalBonus, e := OrderDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: doGetPartnerIds(), OrderTypes: domain.UserOrderTypes(domain.Career)}) |
109 | if e != nil { | 230 | if e != nil { |
110 | return response, e | 231 | return response, e |
111 | } | 232 | } |
233 | + | ||
112 | if businessBonus, e := BusinessBonusDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: doGetPartnerIds(), IsDisable: 1}); e == nil { | 234 | if businessBonus, e := BusinessBonusDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: doGetPartnerIds(), IsDisable: 1}); e == nil { |
113 | totalBonus.Bonus += businessBonus.Bonus | 235 | totalBonus.Bonus += businessBonus.Bonus |
114 | } | 236 | } |
237 | + | ||
115 | _, allPartnerCategory, e = PartnerCategoryInfoRepository.Find(map[string]interface{}{"sortById": domain.ASC}) | 238 | _, allPartnerCategory, e = PartnerCategoryInfoRepository.Find(map[string]interface{}{"sortById": domain.ASC}) |
116 | var mapPartnerBussinessBonus = make(map[int64]*domain.BusinessBonus) | 239 | var mapPartnerBussinessBonus = make(map[int64]*domain.BusinessBonus) |
117 | if _, bussinessBonus, e := BusinessBonusRepository.Find(map[string]interface{}{"inPartnerIds": doGetPartnerIds(), "isDisable": 1}); e == nil { | 240 | if _, bussinessBonus, e := BusinessBonusRepository.Find(map[string]interface{}{"inPartnerIds": doGetPartnerIds(), "isDisable": 1}); e == nil { |
@@ -129,6 +252,7 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { | @@ -129,6 +252,7 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { | ||
129 | mapCompanyAdminUsers[adminUsers[i].CompanyId] = adminUsers[i] | 252 | mapCompanyAdminUsers[adminUsers[i].CompanyId] = adminUsers[i] |
130 | } | 253 | } |
131 | } | 254 | } |
255 | + | ||
132 | var companys = make([]*Company, 0) | 256 | var companys = make([]*Company, 0) |
133 | for i := range companyList { | 257 | for i := range companyList { |
134 | c := companyList[i] | 258 | c := companyList[i] |
@@ -166,13 +290,26 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { | @@ -166,13 +290,26 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { | ||
166 | } | 290 | } |
167 | companys = append(companys, item) | 291 | companys = append(companys, item) |
168 | } | 292 | } |
293 | + | ||
169 | if len(companys) > 0 { | 294 | if len(companys) > 0 { |
170 | svr.HasAvailableCompany = true | 295 | svr.HasAvailableCompany = true |
171 | } | 296 | } |
172 | 297 | ||
298 | + if len(companys) > 1 || len(svr.IsRealSenior) > 0 { // 有真实合伙公司或高管公司时,过滤游客公司 | ||
299 | + var companies = make([]*Company, 0) | ||
300 | + for _, company := range companys { | ||
301 | + if company.CompanyBase.Id != int64(constant.DEFAULT_GUEST_COMPANY) { | ||
302 | + companies = append(companies, company) | ||
303 | + } | ||
304 | + } | ||
305 | + companys = companies | ||
306 | + } | ||
307 | + | ||
173 | response["companys"] = companys | 308 | response["companys"] = companys |
174 | return response, nil | 309 | return response, nil |
175 | } | 310 | } |
311 | + | ||
312 | +// 高管统计信息 | ||
176 | func (svr *PgLoginService) ManagerStaticInfo() (interface{}, error) { | 313 | func (svr *PgLoginService) ManagerStaticInfo() (interface{}, error) { |
177 | response := make(map[string]interface{}) | 314 | response := make(map[string]interface{}) |
178 | response["id"] = protocolx.AdminTypeManager | 315 | response["id"] = protocolx.AdminTypeManager |
@@ -187,8 +324,8 @@ func (svr *PgLoginService) ManagerStaticInfo() (interface{}, error) { | @@ -187,8 +324,8 @@ func (svr *PgLoginService) ManagerStaticInfo() (interface{}, error) { | ||
187 | ) | 324 | ) |
188 | doGetCompanyIds := func() []int64 { | 325 | doGetCompanyIds := func() []int64 { |
189 | var companies []int64 | 326 | var companies []int64 |
190 | - for i := range svr.Users { | ||
191 | - companies = append(companies, svr.Users[i].CompanyId) | 327 | + for i := range svr.IsSenior { |
328 | + companies = append(companies, svr.IsSenior[i].CompanyId) | ||
192 | } | 329 | } |
193 | return companies | 330 | return companies |
194 | } | 331 | } |
@@ -200,9 +337,9 @@ func (svr *PgLoginService) ManagerStaticInfo() (interface{}, error) { | @@ -200,9 +337,9 @@ func (svr *PgLoginService) ManagerStaticInfo() (interface{}, error) { | ||
200 | if constant.POSTGRESQL_DB_NAME != "partner_dev" { | 337 | if constant.POSTGRESQL_DB_NAME != "partner_dev" { |
201 | //通过企业平台 校验模块权限 | 338 | //通过企业平台 校验模块权限 |
202 | var user *domain.Users | 339 | var user *domain.Users |
203 | - for j := range svr.Users { | ||
204 | - if svr.Users[j].CompanyId == c.Id { | ||
205 | - user = svr.Users[j] | 340 | + for j := range svr.IsSenior { |
341 | + if svr.IsSenior[j].CompanyId == c.Id { | ||
342 | + user = svr.IsSenior[j] | ||
206 | break | 343 | break |
207 | } | 344 | } |
208 | } | 345 | } |
@@ -219,12 +356,23 @@ func (svr *PgLoginService) ManagerStaticInfo() (interface{}, error) { | @@ -219,12 +356,23 @@ func (svr *PgLoginService) ManagerStaticInfo() (interface{}, error) { | ||
219 | companys = append(companys, item) | 356 | companys = append(companys, item) |
220 | } | 357 | } |
221 | if len(companys) > 0 { | 358 | if len(companys) > 0 { |
222 | - svr.HasAvailableCompany = true | 359 | + svr.HasAvailableManagerCompany = true |
360 | + } | ||
361 | + | ||
362 | + if len(companys) > 1 || len(svr.IsPartnerInfo) > 0 { // 有真实合伙公司或高管公司时,过滤游客公司 | ||
363 | + var companies = make([]protocol.CompanyBase, 0) | ||
364 | + for _, company := range companys { | ||
365 | + if company.Id != int64(constant.DEFAULT_GUEST_COMPANY) { | ||
366 | + companies = append(companies, company) | ||
367 | + } | ||
368 | + } | ||
369 | + companys = companies | ||
223 | } | 370 | } |
224 | 371 | ||
225 | response["companys"] = companys | 372 | response["companys"] = companys |
226 | return response, nil | 373 | return response, nil |
227 | } | 374 | } |
375 | + | ||
228 | func (svr *PgLoginService) GetCompanyList(funcGetCompanyIds func() []int64) []*domain.Company { | 376 | func (svr *PgLoginService) GetCompanyList(funcGetCompanyIds func() []int64) []*domain.Company { |
229 | var ( | 377 | var ( |
230 | CompanyRepository, _ = repository.NewCompanyRepository(svr.transactionContext) | 378 | CompanyRepository, _ = repository.NewCompanyRepository(svr.transactionContext) |
@@ -242,6 +390,7 @@ func (svr *PgLoginService) GetCompanyList(funcGetCompanyIds func() []int64) []*d | @@ -242,6 +390,7 @@ func (svr *PgLoginService) GetCompanyList(funcGetCompanyIds func() []int64) []*d | ||
242 | } | 390 | } |
243 | return companyList | 391 | return companyList |
244 | } | 392 | } |
393 | + | ||
245 | func (svr *PgLoginService) GetJoinWays(partnerCategory []*domain.PartnerCategoryInfo, partnerInfo *domain.PartnerInfo, bonus float64) []joinWay { | 394 | func (svr *PgLoginService) GetJoinWays(partnerCategory []*domain.PartnerCategoryInfo, partnerInfo *domain.PartnerInfo, bonus float64) []joinWay { |
246 | searchCategory := func(partnerCategory []*domain.PartnerCategoryInfo, id int64) *domain.PartnerCategoryInfo { | 395 | searchCategory := func(partnerCategory []*domain.PartnerCategoryInfo, id int64) *domain.PartnerCategoryInfo { |
247 | for i := range partnerCategory { | 396 | for i := range partnerCategory { |
@@ -285,16 +434,182 @@ func computeBonusPercent(totalBonus float64, bonus float64) float64 { | @@ -285,16 +434,182 @@ func computeBonusPercent(totalBonus float64, bonus float64) float64 { | ||
285 | return utils.Decimal(bonus / totalBonus) | 434 | return utils.Decimal(bonus / totalBonus) |
286 | } | 435 | } |
287 | 436 | ||
437 | +/** | ||
438 | + * @Author SteveChan | ||
439 | + * @Description // 注册用户到合伙人 | ||
440 | + * @Date 13:52 2021/1/13 | ||
441 | + * @Param | ||
442 | + * @return | ||
443 | + **/ | ||
444 | +func (svr *PgLoginService) RegistryUser(phone string) error { | ||
445 | + var ( | ||
446 | + PartnerInfoService, _ = repository.NewPartnerInfoRepository(svr.transactionContext) | ||
447 | + UsersRepository, _ = repository.NewUsersRepository(svr.transactionContext) | ||
448 | + isPartner bool | ||
449 | + isPartnerAvailable bool | ||
450 | + isGuestPartner bool | ||
451 | + isGuestPartnerAvailable bool | ||
452 | + isUser bool | ||
453 | + isUserAvailable bool | ||
454 | + isUserSenior bool | ||
455 | + ) | ||
456 | + | ||
457 | + partnerInfo, _ := PartnerInfoService.FindOne(map[string]interface{}{"account": phone, "isNot": constant.DEFAULT_GUEST_COMPANY}) // 合伙人在正常公司是否存在 | ||
458 | + if partnerInfo == nil { | ||
459 | + isPartner = false | ||
460 | + } else { | ||
461 | + isPartner = true | ||
462 | + } | ||
463 | + partnerAvailableInfo, errPartner := PartnerInfoService.FindOne(map[string]interface{}{"account": phone, "status": 1, "isNot": constant.DEFAULT_GUEST_COMPANY}) // 合伙人在正常公司是否有效 | ||
464 | + if partnerAvailableInfo == nil { | ||
465 | + isPartnerAvailable = false | ||
466 | + } else { | ||
467 | + isPartnerAvailable = true | ||
468 | + } | ||
469 | + | ||
470 | + guestInfo, _ := PartnerInfoService.FindOne(map[string]interface{}{"account": phone, "companyId": constant.DEFAULT_GUEST_COMPANY}) // 合伙人是否存在游客公司 | ||
471 | + if guestInfo == nil { | ||
472 | + isGuestPartner = false | ||
473 | + } else { | ||
474 | + isGuestPartner = true | ||
475 | + } | ||
476 | + guestAvailableInfo, _ := PartnerInfoService.FindOne(map[string]interface{}{"account": phone, "status": 1, "companyId": constant.DEFAULT_GUEST_COMPANY}) // 合伙人在游客公司是否有效 | ||
477 | + if guestAvailableInfo == nil { | ||
478 | + isGuestPartnerAvailable = false | ||
479 | + } else { | ||
480 | + isGuestPartnerAvailable = true | ||
481 | + } | ||
482 | + | ||
483 | + user, _ := UsersRepository.FindOne(map[string]interface{}{"phone": phone, "deleteAtIsNull": true}) // 用户是否存在 | ||
484 | + if user == nil { | ||
485 | + isUser = false | ||
486 | + } else { | ||
487 | + isUser = true | ||
488 | + } | ||
489 | + userAvailable, _ := UsersRepository.FindOne(map[string]interface{}{"phone": phone, "status": 1, "deleteAtIsNull": true}) // 用户是否有效 | ||
490 | + if userAvailable == nil { | ||
491 | + isUserAvailable = false | ||
492 | + } else { | ||
493 | + isUserAvailable = true | ||
494 | + } | ||
495 | + senior, _ := UsersRepository.FindOne(map[string]interface{}{"phone": phone, "status": 1, "isSenior": 1, "deleteAtIsNull": true}) // 用户是否是高管 | ||
496 | + if senior == nil { | ||
497 | + isUserSenior = false | ||
498 | + } else { | ||
499 | + isUserSenior = true | ||
500 | + } | ||
501 | + | ||
502 | + fmt.Print("合伙人在正常公司存在?", isPartner, "\n") | ||
503 | + fmt.Print("合伙人在正常公司有效?", isPartnerAvailable, "\n") | ||
504 | + | ||
505 | + fmt.Print("合伙人在游客公司存在?", isGuestPartner, "\n") | ||
506 | + fmt.Print("合伙人在游客公司有效?", isGuestPartnerAvailable, "\n") | ||
507 | + | ||
508 | + fmt.Print("用户存在?", isUser, "\n") | ||
509 | + fmt.Print("用户有效?", isUserAvailable, "\n") | ||
510 | + fmt.Print("用户高管?", isUserSenior, "\n") | ||
511 | + | ||
512 | + // 用户在正常公司存在且无效或者不存在、合伙人在正常公司存在且无效或者不存在、合伙人在游客公司存在且无效,更新游客公司合伙人状态 | ||
513 | + //if (isUser && !isUserAvailable || !isUser) && (isPartner && !isPartnerAvailable || !isPartner) && (isGuestPartner && !isGuestPartnerAvailable) { | ||
514 | + // _, err := svr.transactionContext.PgTx.Model(&models.PartnerInfo{ | ||
515 | + // CompanyId: int64(constant.DEFAULT_GUEST_COMPANY), | ||
516 | + // PartnerName: phone, | ||
517 | + // Account: phone, | ||
518 | + // Password: "7c4a8d09ca3762af61e59520943dc26494f8941b", | ||
519 | + // PartnerCategory: 1, | ||
520 | + // RegionInfo: &domain.RegionInfo{ | ||
521 | + // RegionName: "客户区域", | ||
522 | + // RegionId: 0, | ||
523 | + // }, | ||
524 | + // Status: 1, | ||
525 | + // CooperateTime: time.Now(), | ||
526 | + // CreateAt: time.Now(), | ||
527 | + // UpdateAt: time.Now(), | ||
528 | + // PartnerCategoryInfos: []*models.PartnerCategoryInfo{&models.PartnerCategoryInfo{Id: 1, Code: phone}}, | ||
529 | + // Salesman: []*domain.Salesman{&domain.Salesman{Name: phone, Telephone: phone}}}). | ||
530 | + // Where("partner_info.account = ?", phone). | ||
531 | + // Where("partner_info.company_id = ?", constant.DEFAULT_GUEST_COMPANY). | ||
532 | + // Update() | ||
533 | + // if err != nil { | ||
534 | + // return err | ||
535 | + // } | ||
536 | + //} | ||
537 | + | ||
538 | + // 合伙人存在、用户存在、是高管(高管合伙人) | ||
539 | + // 合伙人不存在、用户存在、是高管(高管)|| partnerInfo == nil && user != nil && senior != nil | ||
540 | + // 合伙人存在、用户存在、非高管(合伙人) | ||
541 | + // 游客公司合伙人存在 | ||
542 | + //if partnerInfo != nil && user != nil && senior != nil || partnerInfo != nil && user != nil && senior == nil || guestInfo != nil { | ||
543 | + // return nil | ||
544 | + //} | ||
545 | + if guestInfo != nil { | ||
546 | + return nil | ||
547 | + } | ||
548 | + | ||
549 | + // 用户在正常公司存在且无效或者存在非高管或者不存在、合伙人在正常公司存在且无效或者不存在、合伙人在游客公司不存在、注册合伙人到游客公司 | ||
550 | + if !isGuestPartner && (isUser && !isUserAvailable || isUser && !isUserSenior || !isUser) && (isPartner && !isPartnerAvailable || !isPartner) { | ||
551 | + id := time.Now().Unix() | ||
552 | + errPartner = svr.transactionContext.PgDd.Insert(&models.PartnerInfo{ | ||
553 | + Id: id, | ||
554 | + CompanyId: int64(constant.DEFAULT_GUEST_COMPANY), | ||
555 | + PartnerName: phone, | ||
556 | + Account: phone, | ||
557 | + Password: "7c4a8d09ca3762af61e59520943dc26494f8941b", | ||
558 | + Status: 1, | ||
559 | + PartnerCategory: 1, | ||
560 | + RegionInfo: &domain.RegionInfo{ | ||
561 | + RegionName: "客户区域", | ||
562 | + RegionId: 0, | ||
563 | + }, | ||
564 | + CooperateTime: time.Now(), | ||
565 | + CreateAt: time.Now(), | ||
566 | + UpdateAt: time.Now(), | ||
567 | + PartnerCategoryInfos: []*models.PartnerCategoryInfo{&models.PartnerCategoryInfo{Id: 1, Code: phone}}, | ||
568 | + Salesman: []*domain.Salesman{&domain.Salesman{Name: phone, Telephone: phone}}, | ||
569 | + }) | ||
570 | + } | ||
571 | + | ||
572 | + // 合伙人不存在、用户存在、非高管(普通用户)-> 注册用户 | ||
573 | + // 合伙人不存在、用户不存在(游客)-> 注册用户 | ||
574 | + //if errPartner != nil && errUser == nil && errSenior == nil || errPartner != nil && errUser != nil { | ||
575 | + // id := time.Now().Unix() | ||
576 | + // errPartner = svr.transactionContext.PgDd.Insert(&models.PartnerInfo{ | ||
577 | + // Id: id, | ||
578 | + // CompanyId: int64(constant.DEFAULT_GUEST_COMPANY), | ||
579 | + // PartnerName: phone, | ||
580 | + // Account: phone, | ||
581 | + // Password: "7c4a8d09ca3762af61e59520943dc26494f8941b", | ||
582 | + // Status: 1, | ||
583 | + // PartnerCategory: 1, | ||
584 | + // RegionInfo: &domain.RegionInfo{ | ||
585 | + // RegionName: "客户区域", | ||
586 | + // RegionId: 0, | ||
587 | + // }, | ||
588 | + // CooperateTime: time.Now(), | ||
589 | + // CreateAt: time.Now(), | ||
590 | + // UpdateAt: time.Now(), | ||
591 | + // PartnerCategoryInfos: []*models.PartnerCategoryInfo{&models.PartnerCategoryInfo{Id: 1, Code: phone}}, | ||
592 | + // Salesman: []*domain.Salesman{&domain.Salesman{Name: phone, Telephone: phone}}, | ||
593 | + // }) | ||
594 | + //} | ||
595 | + | ||
596 | + return errPartner | ||
597 | +} | ||
598 | + | ||
599 | +// 注册游客到指定的公司 | ||
288 | func (svr *PgLoginService) RegistryGuest(phone string) error { | 600 | func (svr *PgLoginService) RegistryGuest(phone string) error { |
289 | var ( | 601 | var ( |
290 | PartnerInfoService, _ = repository.NewPartnerInfoRepository(svr.transactionContext) | 602 | PartnerInfoService, _ = repository.NewPartnerInfoRepository(svr.transactionContext) |
291 | UsersRepository, _ = repository.NewUsersRepository(svr.transactionContext) | 603 | UsersRepository, _ = repository.NewUsersRepository(svr.transactionContext) |
292 | ) | 604 | ) |
605 | + | ||
293 | partnerInfo, errPartner := PartnerInfoService.FindOne(map[string]interface{}{"account": phone}) | 606 | partnerInfo, errPartner := PartnerInfoService.FindOne(map[string]interface{}{"account": phone}) |
294 | - user, errUser := UsersRepository.FindOne(map[string]interface{}{"phone": phone}) | 607 | + user, errUser := UsersRepository.FindOne(map[string]interface{}{"phone": phone, "deleteAtIsNull": true}) |
608 | + | ||
295 | if partnerInfo != nil || user != nil { | 609 | if partnerInfo != nil || user != nil { |
296 | return nil | 610 | return nil |
297 | } | 611 | } |
612 | + | ||
298 | if errUser != nil && errPartner != nil { | 613 | if errUser != nil && errPartner != nil { |
299 | id := time.Now().Unix() | 614 | id := time.Now().Unix() |
300 | errPartner = svr.transactionContext.PgDd.Insert(&models.PartnerInfo{ | 615 | errPartner = svr.transactionContext.PgDd.Insert(&models.PartnerInfo{ |
@@ -57,6 +57,7 @@ func (repository *PartnerInfoRepository) FindOne(queryOptions map[string]interfa | @@ -57,6 +57,7 @@ func (repository *PartnerInfoRepository) FindOne(queryOptions map[string]interfa | ||
57 | query.SetWhere("partner_info.account = ?", "account") | 57 | query.SetWhere("partner_info.account = ?", "account") |
58 | query.SetWhere("partner_info.status = ?", "status") | 58 | query.SetWhere("partner_info.status = ?", "status") |
59 | query.SetWhere("partner_info.company_id = ?", "companyId") | 59 | query.SetWhere("partner_info.company_id = ?", "companyId") |
60 | + query.SetWhere("partner_info.company_id <> ?", "isNot") | ||
60 | //if inParterIds,ok :=queryOptions["inParterIds"];ok{ | 61 | //if inParterIds,ok :=queryOptions["inParterIds"];ok{ |
61 | // query.Relation("PartnerInfo", func(q *orm.Query) (*orm.Query, error) { | 62 | // query.Relation("PartnerInfo", func(q *orm.Query) (*orm.Query, error) { |
62 | // return q.Where("id in (?)",pg.In(inParterIds.([]int64))),nil | 63 | // return q.Where("id in (?)",pg.In(inParterIds.([]int64))),nil |
@@ -80,6 +81,7 @@ func (repository *PartnerInfoRepository) Find(queryOptions map[string]interface{ | @@ -80,6 +81,7 @@ func (repository *PartnerInfoRepository) Find(queryOptions map[string]interface{ | ||
80 | SetWhere("partner_info.account = ?", "account"). | 81 | SetWhere("partner_info.account = ?", "account"). |
81 | SetWhere(`partner_info.status = ?`, "status"). | 82 | SetWhere(`partner_info.status = ?`, "status"). |
82 | SetWhere(`partner_info.partner_category = ?`, "partnerCategory"). | 83 | SetWhere(`partner_info.partner_category = ?`, "partnerCategory"). |
84 | + SetWhere("partner_info.company_id <> ?", "isNot"). | ||
83 | SetLimit(). | 85 | SetLimit(). |
84 | SetOrder("partner_info.create_at", "sortByCreateTime"). | 86 | SetOrder("partner_info.create_at", "sortByCreateTime"). |
85 | SetOrder("partner_info.update_at", "sortByUpdateTime") | 87 | SetOrder("partner_info.update_at", "sortByUpdateTime") |
@@ -55,6 +55,8 @@ func (repository *UsersRepository) FindOne(queryOptions map[string]interface{}) | @@ -55,6 +55,8 @@ func (repository *UsersRepository) FindOne(queryOptions map[string]interface{}) | ||
55 | query.SetWhere("phone = ?", "phone") | 55 | query.SetWhere("phone = ?", "phone") |
56 | query.SetWhere("company_id = ?", "companyId") | 56 | query.SetWhere("company_id = ?", "companyId") |
57 | query.SetWhere(`delete_at is null`, "deleteAtIsNull") | 57 | query.SetWhere(`delete_at is null`, "deleteAtIsNull") |
58 | + query.SetWhere("is_senior = ?", "isSenior") | ||
59 | + | ||
58 | if err := query.First(); err != nil { | 60 | if err := query.First(); err != nil { |
59 | return nil, fmt.Errorf("query row not found") | 61 | return nil, fmt.Errorf("query row not found") |
60 | } | 62 | } |
@@ -74,6 +76,8 @@ func (repository *UsersRepository) Find(queryOptions map[string]interface{}) (in | @@ -74,6 +76,8 @@ func (repository *UsersRepository) Find(queryOptions map[string]interface{}) (in | ||
74 | SetWhere("company_id = ?", "companyId"). | 76 | SetWhere("company_id = ?", "companyId"). |
75 | SetWhere(`status = ?`, "status"). | 77 | SetWhere(`status = ?`, "status"). |
76 | SetWhere(`delete_at is null`, "deleteAtIsNull"). | 78 | SetWhere(`delete_at is null`, "deleteAtIsNull"). |
79 | + SetWhere("is_senior = ?", "isSenior"). | ||
80 | + SetWhere("company_id <> ?", "isNot"). | ||
77 | SetOrder("create_at", "sortByCreateTime"). | 81 | SetOrder("create_at", "sortByCreateTime"). |
78 | SetOrder("update_at", "sortByUpdateTime") | 82 | SetOrder("update_at", "sortByUpdateTime") |
79 | 83 |
@@ -81,6 +81,7 @@ func (serviceGateway *HttplibUCenterApiServiceGateway) ChangePassword(phone, new | @@ -81,6 +81,7 @@ func (serviceGateway *HttplibUCenterApiServiceGateway) ChangePassword(phone, new | ||
81 | } | 81 | } |
82 | return serviceGateway.handlerError(response) | 82 | return serviceGateway.handlerError(response) |
83 | } | 83 | } |
84 | + | ||
84 | func (serviceGateway *HttplibUCenterApiServiceGateway) ChangePhone(newPhone, oldPhone string) (int, error) { | 85 | func (serviceGateway *HttplibUCenterApiServiceGateway) ChangePhone(newPhone, oldPhone string) (int, error) { |
85 | url := strings.Join([]string{serviceGateway.baseURL, "user", "change-phone"}, "/") | 86 | url := strings.Join([]string{serviceGateway.baseURL, "user", "change-phone"}, "/") |
86 | request := serviceGateway.createRequest(url, "post") | 87 | request := serviceGateway.createRequest(url, "post") |
@@ -39,6 +39,7 @@ func NewBeegoLogger(conf LoggerConfig) *logs.BeeLogger { | @@ -39,6 +39,7 @@ func NewBeegoLogger(conf LoggerConfig) *logs.BeeLogger { | ||
39 | log.SetLevel(ilv) | 39 | log.SetLevel(ilv) |
40 | log.EnableFuncCallDepth(true) | 40 | log.EnableFuncCallDepth(true) |
41 | log.SetLogFuncCallDepth(5) | 41 | log.SetLogFuncCallDepth(5) |
42 | + log.SetPrefix(constant.LOG_PREFIX) | ||
42 | return log | 43 | return log |
43 | } | 44 | } |
44 | 45 |
@@ -272,3 +272,32 @@ func (this *AuthController) UCenterRevoke() { | @@ -272,3 +272,32 @@ func (this *AuthController) UCenterRevoke() { | ||
272 | } | 272 | } |
273 | msg = protocol.NewReturnResponse(auth.UCenterRevoke(nil, int64(uid))) | 273 | msg = protocol.NewReturnResponse(auth.UCenterRevoke(nil, int64(uid))) |
274 | } | 274 | } |
275 | + | ||
276 | +/** | ||
277 | + * @Author SteveChan | ||
278 | + * @Description //校验密码 | ||
279 | + * @Date 01:00 2021/1/8 | ||
280 | + * @Param | ||
281 | + * @return | ||
282 | + **/ | ||
283 | +func (this *AuthController) CheckPassword() { | ||
284 | + var msg *protocol.ResponseMessage | ||
285 | + defer func() { | ||
286 | + this.Resp(msg) | ||
287 | + }() | ||
288 | + var request *protocol.LoginRequest | ||
289 | + if err := this.JsonUnmarshal(&request); err != nil { | ||
290 | + msg = protocol.BadRequestParam(1) | ||
291 | + return | ||
292 | + } | ||
293 | + if b, m := this.Valid(request); !b { | ||
294 | + msg = m | ||
295 | + return | ||
296 | + } | ||
297 | + header := this.GetRequestHeader(this.Ctx) | ||
298 | + data, err := auth.PasswordLogin(header, request) | ||
299 | + if err != nil { | ||
300 | + log.Error(err) | ||
301 | + } | ||
302 | + msg = protocol.NewReturnResponse(data, err) | ||
303 | +} |
@@ -2,9 +2,11 @@ package controllers | @@ -2,9 +2,11 @@ package controllers | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | + "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/application/auth" | ||
5 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/application/user" | 6 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/application/user" |
6 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol" | 7 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol" |
7 | "strings" | 8 | "strings" |
9 | + "time" | ||
8 | ) | 10 | ) |
9 | 11 | ||
10 | type UserController struct { | 12 | type UserController struct { |
@@ -51,14 +53,25 @@ func (this *UserController) CheckSmsCode() { | @@ -51,14 +53,25 @@ func (this *UserController) CheckSmsCode() { | ||
51 | msg = protocol.NewReturnResponse(user.CheckSmsCode(header, request)) | 53 | msg = protocol.NewReturnResponse(user.CheckSmsCode(header, request)) |
52 | } | 54 | } |
53 | 55 | ||
54 | -//ChangePhone | ||
55 | -// @router /changePhone [post] | 56 | +/** |
57 | + * @Author SteveChan | ||
58 | + * @Description //TODO 修改手机号 | ||
59 | + * @Date 00:29 2021/1/8 | ||
60 | + * @Param | ||
61 | + * @return | ||
62 | + * @router /changePhone [post] | ||
63 | + **/ | ||
56 | func (this *UserController) ChangePhone() { | 64 | func (this *UserController) ChangePhone() { |
57 | var msg *protocol.ResponseMessage | 65 | var msg *protocol.ResponseMessage |
66 | + | ||
58 | defer func() { | 67 | defer func() { |
59 | this.Resp(msg) | 68 | this.Resp(msg) |
60 | }() | 69 | }() |
70 | + | ||
61 | var request *protocol.ChangePhoneRequest | 71 | var request *protocol.ChangePhoneRequest |
72 | + | ||
73 | + header := this.GetRequestHeader(this.Ctx) | ||
74 | + | ||
62 | if err := this.JsonUnmarshal(&request); err != nil { | 75 | if err := this.JsonUnmarshal(&request); err != nil { |
63 | msg = protocol.BadRequestParam(1) | 76 | msg = protocol.BadRequestParam(1) |
64 | return | 77 | return |
@@ -67,20 +80,42 @@ func (this *UserController) ChangePhone() { | @@ -67,20 +80,42 @@ func (this *UserController) ChangePhone() { | ||
67 | msg = m | 80 | msg = m |
68 | return | 81 | return |
69 | } | 82 | } |
70 | - if !CacheSms.IsExist(request.OldPhone) { | ||
71 | - msg = protocol.NewMesage(1009) //验证码失效 | 83 | + |
84 | + // 校验短信验证码 | ||
85 | + var authCheckSmsCodeRequest *protocol.AuthCheckSmsCodeRequest | ||
86 | + if err := this.JsonUnmarshal(&authCheckSmsCodeRequest); err != nil { | ||
87 | + msg = protocol.BadRequestParam(1) | ||
72 | return | 88 | return |
73 | } | 89 | } |
74 | - if v := CacheSms.Get(request.OldPhone); v != nil { | ||
75 | - if !strings.EqualFold(fmt.Sprintf("%v", v), strings.TrimSpace(request.CaptchaCertificate)) { | ||
76 | - msg = protocol.NewMesage(1012) //验证码不一致 | 90 | + if b, m := this.Valid(authCheckSmsCodeRequest); !b { |
91 | + msg = m | ||
77 | return | 92 | return |
78 | } | 93 | } |
94 | + rsp, err := auth.AuthCheckSmsCode(header, authCheckSmsCodeRequest) | ||
95 | + if err != nil { | ||
96 | + msg = protocol.NewReturnResponse(rsp, err) | ||
97 | + return | ||
98 | + } | ||
99 | + err = CacheSms.Put(request.Phone, rsp.CaptchaCertificate, 5*time.Minute) | ||
100 | + if err != nil { | ||
101 | + msg = protocol.NewReturnResponse(rsp, err) | ||
102 | + return | ||
103 | + } | ||
104 | + | ||
105 | + if !CacheSms.IsExist(request.Phone) { | ||
106 | + msg = protocol.NewMesage(1009) //验证码失效 | ||
107 | + return | ||
108 | + } | ||
109 | + if v := CacheSms.Get(request.Phone); v != nil { | ||
110 | + //if !strings.EqualFold(fmt.Sprintf("%v", v), strings.TrimSpace(request.CaptchaCertificate)) { | ||
111 | + // msg = protocol.NewMesage(1012) //验证码不一致 | ||
112 | + // return | ||
113 | + //} | ||
79 | } else { | 114 | } else { |
80 | msg = protocol.NewMesage(1009) //验证码不一致 | 115 | msg = protocol.NewMesage(1009) //验证码不一致 |
81 | return | 116 | return |
82 | } | 117 | } |
83 | - header := this.GetRequestHeader(this.Ctx) | 118 | + |
84 | data, err := user.ChangePhone(header, request) | 119 | data, err := user.ChangePhone(header, request) |
85 | if err == nil { | 120 | if err == nil { |
86 | msg = protocol.NewResponseMessage(0, "修改手机号成功") | 121 | msg = protocol.NewResponseMessage(0, "修改手机号成功") |
@@ -6,6 +6,7 @@ import ( | @@ -6,6 +6,7 @@ import ( | ||
6 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant" | 6 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant" |
7 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/utils" | 7 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/utils" |
8 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol" | 8 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol" |
9 | + "net/url" | ||
9 | "strconv" | 10 | "strconv" |
10 | "strings" | 11 | "strings" |
11 | ) | 12 | ) |
@@ -15,7 +16,22 @@ func CheckJWTToken(ctx *context.Context) { | @@ -15,7 +16,22 @@ func CheckJWTToken(ctx *context.Context) { | ||
15 | var ( | 16 | var ( |
16 | msg *protocol.ResponseMessage | 17 | msg *protocol.ResponseMessage |
17 | ) | 18 | ) |
19 | + | ||
20 | + // 需要被过滤的地址 一定要写键值 | ||
21 | + filterMap := map[string]string{ | ||
22 | + "/v1/auth/checkPassword": "校验密码", | ||
23 | + } | ||
24 | + | ||
25 | + urlStr := "" | ||
26 | + tmpUrl, err := url.Parse(ctx.Request.RequestURI) | ||
27 | + if err == nil { | ||
28 | + urlStr = tmpUrl.Path | ||
29 | + } | ||
30 | + | ||
31 | + if res := filterMap[urlStr]; res == "" { | ||
32 | + /** 不在 Map 内对请求进行处理 **/ | ||
18 | token := ctx.Input.Header("x-mmm-accesstoken") | 33 | token := ctx.Input.Header("x-mmm-accesstoken") |
34 | + | ||
19 | if strings.HasSuffix(ctx.Request.RequestURI, "login") || | 35 | if strings.HasSuffix(ctx.Request.RequestURI, "login") || |
20 | strings.HasSuffix(ctx.Request.RequestURI, "accessToken") || | 36 | strings.HasSuffix(ctx.Request.RequestURI, "accessToken") || |
21 | strings.HasSuffix(ctx.Request.RequestURI, "refreshToken") || | 37 | strings.HasSuffix(ctx.Request.RequestURI, "refreshToken") || |
@@ -29,11 +45,13 @@ func CheckJWTToken(ctx *context.Context) { | @@ -29,11 +45,13 @@ func CheckJWTToken(ctx *context.Context) { | ||
29 | strings.HasSuffix(ctx.Request.RequestURI, "changePassword") { | 45 | strings.HasSuffix(ctx.Request.RequestURI, "changePassword") { |
30 | return | 46 | return |
31 | } | 47 | } |
48 | + | ||
32 | defer func() { | 49 | defer func() { |
33 | if msg != nil { | 50 | if msg != nil { |
34 | ctx.Output.JSON(msg, false, false) | 51 | ctx.Output.JSON(msg, false, false) |
35 | } | 52 | } |
36 | }() | 53 | }() |
54 | + | ||
37 | if u, err := utils.ParseJWTToken(token); err != nil { | 55 | if u, err := utils.ParseJWTToken(token); err != nil { |
38 | msg = protocol.NewMesage(4141) | 56 | msg = protocol.NewMesage(4141) |
39 | return | 57 | return |
@@ -53,5 +71,6 @@ func CheckJWTToken(ctx *context.Context) { | @@ -53,5 +71,6 @@ func CheckJWTToken(ctx *context.Context) { | ||
53 | } | 71 | } |
54 | } | 72 | } |
55 | } | 73 | } |
74 | + } | ||
56 | return | 75 | return |
57 | } | 76 | } |
@@ -8,6 +8,7 @@ import ( | @@ -8,6 +8,7 @@ import ( | ||
8 | func init() { | 8 | func init() { |
9 | nsV1 := beego.NewNamespace("v1") //, beego.NSBefore(middleware.CheckJWTToken) | 9 | nsV1 := beego.NewNamespace("v1") //, beego.NSBefore(middleware.CheckJWTToken) |
10 | nsV1.Router("/auth/login", &controllers.AuthController{}, "Post:Login") | 10 | nsV1.Router("/auth/login", &controllers.AuthController{}, "Post:Login") |
11 | + nsV1.Router("/auth/checkPassword", &controllers.AuthController{}, "Post:CheckPassword") // 校验密码 | ||
11 | nsV1.Router("/auth/smsCode", &controllers.AuthController{}, "Post:SmsCode") | 12 | nsV1.Router("/auth/smsCode", &controllers.AuthController{}, "Post:SmsCode") |
12 | nsV1.Router("/auth/accessToken", &controllers.AuthController{}, "Post:AccessToken") | 13 | nsV1.Router("/auth/accessToken", &controllers.AuthController{}, "Post:AccessToken") |
13 | nsV1.Router("/auth/refreshToken", &controllers.AuthController{}, "Post:RefreshToken") | 14 | nsV1.Router("/auth/refreshToken", &controllers.AuthController{}, "Post:RefreshToken") |
@@ -2,9 +2,21 @@ package routers | @@ -2,9 +2,21 @@ package routers | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "github.com/astaxie/beego" | 4 | "github.com/astaxie/beego" |
5 | + "github.com/astaxie/beego/context" | ||
5 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant" | 6 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant" |
7 | + "net/http" | ||
6 | ) | 8 | ) |
7 | 9 | ||
8 | func init() { | 10 | func init() { |
9 | - beego.SetStaticPath("/log", constant.LOG_File) | 11 | + //beego.SetStaticPath("/log", constant.LOG_File) |
12 | + beego.Get("/log", func(ctx *context.Context) { | ||
13 | + var s string | ||
14 | + _ = ctx.Input.Bind(&s, "id") | ||
15 | + if s != "12345" { | ||
16 | + ctx.Output.SetStatus(http.StatusBadRequest) | ||
17 | + return | ||
18 | + } | ||
19 | + http.ServeFile(ctx.ResponseWriter, ctx.Request, constant.LOG_File) | ||
20 | + return | ||
21 | + }) | ||
10 | } | 22 | } |
@@ -2,10 +2,10 @@ package messageHandler | @@ -2,10 +2,10 @@ package messageHandler | ||
2 | 2 | ||
3 | import "github.com/Shopify/sarama" | 3 | import "github.com/Shopify/sarama" |
4 | 4 | ||
5 | -type UcenterMessageCommand struct { | 5 | +type UCenterMessageCommand struct { |
6 | } | 6 | } |
7 | 7 | ||
8 | -func (c *UcenterMessageCommand) ChangePhoneHandler(message interface{}) error { | 8 | +func (c *UCenterMessageCommand) ChangePhoneHandler(message interface{}) error { |
9 | msg, ok := message.(*sarama.Message) | 9 | msg, ok := message.(*sarama.Message) |
10 | if !ok && msg == nil { | 10 | if !ok && msg == nil { |
11 | return nil | 11 | return nil |
1 | package sarama | 1 | package sarama |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + "fmt" | ||
4 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant" | 5 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant" |
5 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/message/kafkax" | 6 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/message/kafkax" |
7 | + "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/message/models" | ||
8 | + "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg/transaction" | ||
6 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/log" | 9 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/log" |
7 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/port/sarama/messageHandler" | 10 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/port/sarama/messageHandler" |
8 | //"suplus-message/pkg/constant" | 11 | //"suplus-message/pkg/constant" |
9 | //"suplus-message/pkg/port/sarama/messageHandler" | 12 | //"suplus-message/pkg/port/sarama/messageHandler" |
10 | ) | 13 | ) |
11 | 14 | ||
15 | +type PgMessageReceiverRepository struct { | ||
16 | + transactionContext *transaction.TransactionContext | ||
17 | +} | ||
18 | + | ||
19 | +func NewPgMessageReceiverRepository(transactionContext *transaction.TransactionContext) *PgMessageReceiverRepository { | ||
20 | + return &PgMessageReceiverRepository{ | ||
21 | + transactionContext: transactionContext, | ||
22 | + } | ||
23 | +} | ||
24 | + | ||
25 | +func (repository *PgMessageReceiverRepository) ReceiveMessage(params map[string]interface{}) error { | ||
26 | + var num int | ||
27 | + checkSql := `select count(0) from sys_message_consume where "offset" =? and topic=?` | ||
28 | + _, err := repository.transactionContext.PgDd.Query(&num, checkSql, params["offset"], params["topic"]) | ||
29 | + if err != nil { | ||
30 | + return err | ||
31 | + } | ||
32 | + if num > 0 { | ||
33 | + return fmt.Errorf("receive repeate message [%v]", params) | ||
34 | + } | ||
35 | + | ||
36 | + sql := `insert into sys_message_consume(topic,partition,"offset",key,value,msg_time,create_at,status)values(?,?,?,?,?,?,?,?)` | ||
37 | + _, err = repository.transactionContext.PgDd.Exec(sql, params["topic"], params["partition"], params["offset"], params["key"], params["value"], params["msg_time"], params["create_at"], params["status"]) | ||
38 | + return err | ||
39 | +} | ||
40 | + | ||
41 | +func (repository *PgMessageReceiverRepository) ConfirmReceive(params map[string]interface{}) error { | ||
42 | + fmt.Println(params) | ||
43 | + _, err := repository.transactionContext.PgDd.Exec(`update sys_message_consume set status=? where "offset" =? and topic=?`, int(models.Finished), params["offset"], params["topic"]) | ||
44 | + return err | ||
45 | +} | ||
46 | + | ||
12 | func Run() { | 47 | func Run() { |
13 | var ( | 48 | var ( |
14 | - ucenterMessage = &messageHandler.UcenterMessageCommand{} | 49 | + uCenterMessage = &messageHandler.UCenterMessageCommand{} |
15 | ) | 50 | ) |
16 | 51 | ||
17 | saramaConsumer := kafkax.NewSaramaConsumer(constant.KAFKA_HOSTS, constant.SERVICE_NAME) | 52 | saramaConsumer := kafkax.NewSaramaConsumer(constant.KAFKA_HOSTS, constant.SERVICE_NAME) |
18 | - saramaConsumer.WithTopicHandler(constant.TOPIC_UCENT_USER_CHANGE_PHONE, ucenterMessage.ChangePhoneHandler) | 53 | + saramaConsumer.WithTopicHandler(constant.TOPIC_UCENT_USER_CHANGE_PHONE, uCenterMessage.ChangePhoneHandler) |
54 | + saramaConsumer.WithMessageReceiver(NewPgMessageReceiverRepository(nil)) // 持久化 | ||
19 | 55 | ||
20 | err := saramaConsumer.StartConsume() | 56 | err := saramaConsumer.StartConsume() |
21 | if err != nil { | 57 | if err != nil { |
@@ -56,8 +56,9 @@ type ChangePhoneRequest struct { | @@ -56,8 +56,9 @@ type ChangePhoneRequest struct { | ||
56 | Captcha string `json:"captcha" valid:"Required"` | 56 | Captcha string `json:"captcha" valid:"Required"` |
57 | 57 | ||
58 | OldPhone string `json:"oldPhone" valid:"Required"` | 58 | OldPhone string `json:"oldPhone" valid:"Required"` |
59 | - CaptchaCertificate string `json:"captchaCertificate" valid:"Required"` | 59 | + //CaptchaCertificate string `json:"captchaCertificate" valid:"Required"` |
60 | } | 60 | } |
61 | + | ||
61 | type ChangePhoneResponse struct { | 62 | type ChangePhoneResponse struct { |
62 | } | 63 | } |
63 | 64 |
tags
0 → 100644
此 diff 太大无法显示。
-
请 注册 或 登录 后发表评论