...
|
...
|
@@ -14,10 +14,10 @@ import ( |
|
|
//用户信息
|
|
|
func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest) (rsp *protocol.UserInfoResponse, err error) {
|
|
|
var (
|
|
|
PartnerInfoService = service.NewPartnerInfoService(nil)
|
|
|
partnerInfo *domain.PartnerInfo
|
|
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
|
|
CompanyResponsitory, _ = factory.CreateCompanyRepository(transactionContext)
|
|
|
PartnerInfoService, _ = factory.CreatePartnerInfoRepositoryIn(transactionContext)
|
|
|
company *domain.Company
|
|
|
)
|
|
|
if err = transactionContext.StartTransaction(); err != nil {
|
...
|
...
|
@@ -27,7 +27,7 @@ func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest) |
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
rsp = &protocol.UserInfoResponse{}
|
|
|
if partnerInfo, err = PartnerInfoService.GetPartnerInfo(&query.GetPartnerInfoQuery{Id: int(header.UserId)}); err != nil {
|
|
|
if partnerInfo, err = PartnerInfoService.FindOne(map[string]interface{}{"id": header.UserId}); err != nil {
|
|
|
err = protocol.NewErrWithMessage(502, err) //账号不存在
|
|
|
return
|
|
|
}
|
...
|
...
|
@@ -77,9 +77,9 @@ func CheckSmsCode(header *protocol.RequestHeader, request *protocol.CheckSmsCode |
|
|
//修改手机号
|
|
|
func ChangePhone(header *protocol.RequestHeader, request *protocol.ChangePhoneRequest) (rsp *protocol.ChangePhoneResponse, err error) {
|
|
|
var (
|
|
|
PartnerInfoService = service.NewPartnerInfoService(nil)
|
|
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
|
|
PartnerInfoDao, _ = factory.CreatePartnerInfoDao(transactionContext)
|
|
|
PartnerInfoService, _ = factory.CreatePartnerInfoRepositoryIn(transactionContext)
|
|
|
partnerInfo *domain.PartnerInfo
|
|
|
)
|
|
|
if err = transactionContext.StartTransaction(); err != nil {
|
...
|
...
|
@@ -88,11 +88,11 @@ func ChangePhone(header *protocol.RequestHeader, request *protocol.ChangePhoneRe |
|
|
defer func() {
|
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
if partnerInfo, err = PartnerInfoService.GetPartnerInfo(&query.GetPartnerInfoQuery{Id: int(header.UserId)}); err != nil {
|
|
|
if partnerInfo, err = PartnerInfoService.FindOne(map[string]interface{}{"id": header.UserId}); err != nil {
|
|
|
err = protocol.NewErrWithMessage(502, err) //账号不存在
|
|
|
return
|
|
|
}
|
|
|
if _, err = PartnerInfoService.GetPartnerInfo(&query.GetPartnerInfoQuery{Account: request.Phone}); err == nil {
|
|
|
if partnerInfo, err = PartnerInfoService.FindOne(map[string]interface{}{"account": request.Phone}); err == nil {
|
|
|
err = protocol.NewErrWithMessage(2029, err) //账号已存在
|
|
|
return
|
|
|
}
|
...
|
...
|
|