作者 yangfu

手机号码修改 , 用户信息修改

@@ -14,10 +14,10 @@ import ( @@ -14,10 +14,10 @@ import (
14 //用户信息 14 //用户信息
15 func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest) (rsp *protocol.UserInfoResponse, err error) { 15 func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest) (rsp *protocol.UserInfoResponse, err error) {
16 var ( 16 var (
17 - PartnerInfoService = service.NewPartnerInfoService(nil)  
18 partnerInfo *domain.PartnerInfo 17 partnerInfo *domain.PartnerInfo
19 transactionContext, _ = factory.CreateTransactionContext(nil) 18 transactionContext, _ = factory.CreateTransactionContext(nil)
20 CompanyResponsitory, _ = factory.CreateCompanyRepository(transactionContext) 19 CompanyResponsitory, _ = factory.CreateCompanyRepository(transactionContext)
  20 + PartnerInfoService, _ = factory.CreatePartnerInfoRepositoryIn(transactionContext)
21 company *domain.Company 21 company *domain.Company
22 ) 22 )
23 if err = transactionContext.StartTransaction(); err != nil { 23 if err = transactionContext.StartTransaction(); err != nil {
@@ -27,7 +27,7 @@ func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest) @@ -27,7 +27,7 @@ func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest)
27 transactionContext.RollbackTransaction() 27 transactionContext.RollbackTransaction()
28 }() 28 }()
29 rsp = &protocol.UserInfoResponse{} 29 rsp = &protocol.UserInfoResponse{}
30 - if partnerInfo, err = PartnerInfoService.GetPartnerInfo(&query.GetPartnerInfoQuery{Id: int(header.UserId)}); err != nil { 30 + if partnerInfo, err = PartnerInfoService.FindOne(map[string]interface{}{"id": header.UserId}); err != nil {
31 err = protocol.NewErrWithMessage(502, err) //账号不存在 31 err = protocol.NewErrWithMessage(502, err) //账号不存在
32 return 32 return
33 } 33 }
@@ -77,9 +77,9 @@ func CheckSmsCode(header *protocol.RequestHeader, request *protocol.CheckSmsCode @@ -77,9 +77,9 @@ func CheckSmsCode(header *protocol.RequestHeader, request *protocol.CheckSmsCode
77 //修改手机号 77 //修改手机号
78 func ChangePhone(header *protocol.RequestHeader, request *protocol.ChangePhoneRequest) (rsp *protocol.ChangePhoneResponse, err error) { 78 func ChangePhone(header *protocol.RequestHeader, request *protocol.ChangePhoneRequest) (rsp *protocol.ChangePhoneResponse, err error) {
79 var ( 79 var (
80 - PartnerInfoService = service.NewPartnerInfoService(nil)  
81 transactionContext, _ = factory.CreateTransactionContext(nil) 80 transactionContext, _ = factory.CreateTransactionContext(nil)
82 PartnerInfoDao, _ = factory.CreatePartnerInfoDao(transactionContext) 81 PartnerInfoDao, _ = factory.CreatePartnerInfoDao(transactionContext)
  82 + PartnerInfoService, _ = factory.CreatePartnerInfoRepositoryIn(transactionContext)
83 partnerInfo *domain.PartnerInfo 83 partnerInfo *domain.PartnerInfo
84 ) 84 )
85 if err = transactionContext.StartTransaction(); err != nil { 85 if err = transactionContext.StartTransaction(); err != nil {
@@ -88,11 +88,11 @@ func ChangePhone(header *protocol.RequestHeader, request *protocol.ChangePhoneRe @@ -88,11 +88,11 @@ func ChangePhone(header *protocol.RequestHeader, request *protocol.ChangePhoneRe
88 defer func() { 88 defer func() {
89 transactionContext.RollbackTransaction() 89 transactionContext.RollbackTransaction()
90 }() 90 }()
91 - if partnerInfo, err = PartnerInfoService.GetPartnerInfo(&query.GetPartnerInfoQuery{Id: int(header.UserId)}); err != nil { 91 + if partnerInfo, err = PartnerInfoService.FindOne(map[string]interface{}{"id": header.UserId}); err != nil {
92 err = protocol.NewErrWithMessage(502, err) //账号不存在 92 err = protocol.NewErrWithMessage(502, err) //账号不存在
93 return 93 return
94 } 94 }
95 - if _, err = PartnerInfoService.GetPartnerInfo(&query.GetPartnerInfoQuery{Account: request.Phone}); err == nil { 95 + if partnerInfo, err = PartnerInfoService.FindOne(map[string]interface{}{"account": request.Phone}); err == nil {
96 err = protocol.NewErrWithMessage(2029, err) //账号已存在 96 err = protocol.NewErrWithMessage(2029, err) //账号已存在
97 return 97 return
98 } 98 }
@@ -77,7 +77,7 @@ func (this *UserController) ChangePhone() { @@ -77,7 +77,7 @@ func (this *UserController) ChangePhone() {
77 return 77 return
78 } 78 }
79 } else { 79 } else {
80 - msg = protocol.NewMesage(1013) //验证码不一致 80 + msg = protocol.NewMesage(1009) //验证码不一致
81 return 81 return
82 } 82 }
83 header := this.GetRequestHeader(this.Ctx) 83 header := this.GetRequestHeader(this.Ctx)
@@ -43,7 +43,8 @@ type ResponseMessage struct { @@ -43,7 +43,8 @@ type ResponseMessage struct {
43 func NewMesage(code int) *ResponseMessage { 43 func NewMesage(code int) *ResponseMessage {
44 return &ResponseMessage{ 44 return &ResponseMessage{
45 ErrorCode: SearchErr(code), 45 ErrorCode: SearchErr(code),
46 - Data: nil, 46 + Data: struct {
  47 + }{},
47 } 48 }
48 } 49 }
49 50