|
@@ -2,11 +2,12 @@ package user
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
"context"
|
|
"context"
|
|
|
-
|
|
|
|
|
|
|
+ "fmt"
|
|
|
"git.i2edu.net/i2/i2-bill-api/internal/svc"
|
|
"git.i2edu.net/i2/i2-bill-api/internal/svc"
|
|
|
"git.i2edu.net/i2/i2-bill-api/internal/types"
|
|
"git.i2edu.net/i2/i2-bill-api/internal/types"
|
|
|
"git.i2edu.net/i2/i2-bill-api/model"
|
|
"git.i2edu.net/i2/i2-bill-api/model"
|
|
|
"git.i2edu.net/i2/i2-bill-erp/transform"
|
|
"git.i2edu.net/i2/i2-bill-erp/transform"
|
|
|
|
|
+ "strings"
|
|
|
|
|
|
|
|
"git.i2edu.net/i2/go-zero/core/logx"
|
|
"git.i2edu.net/i2/go-zero/core/logx"
|
|
|
)
|
|
)
|
|
@@ -29,6 +30,7 @@ func NewGetUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) GetUserLog
|
|
|
|
|
|
|
|
func (l *GetUserLogic) GetUser() (*types.InfoResponse, error) {
|
|
func (l *GetUserLogic) GetUser() (*types.InfoResponse, error) {
|
|
|
var user model.User
|
|
var user model.User
|
|
|
|
|
+ info := &types.InfoResponse{}
|
|
|
err := l.svcCtx.SqlConn.QueryRowPartial(&user, "select id, erp_id, avatar, birthday, username, nickname, gender, mobile from i2bill_user where `id` = ? limit 1", l.UserId)
|
|
err := l.svcCtx.SqlConn.QueryRowPartial(&user, "select id, erp_id, avatar, birthday, username, nickname, gender, mobile from i2bill_user where `id` = ? limit 1", l.UserId)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
logx.Error(err)
|
|
logx.Error(err)
|
|
@@ -49,13 +51,31 @@ func (l *GetUserLogic) GetUser() (*types.InfoResponse, error) {
|
|
|
return nil, err
|
|
return nil, err
|
|
|
}
|
|
}
|
|
|
if len(res) > 0 {
|
|
if len(res) > 0 {
|
|
|
|
|
+ //兼职信息
|
|
|
|
|
+ resp.UserName, _ = res[0]["name"].(string)
|
|
|
|
|
+ cityId, _ := res[0]["city_id"].(int64)
|
|
|
|
|
+ cityNodes, err := l.svcCtx.GetErpCity()
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ logx.Error(err)
|
|
|
|
|
+ return nil, err
|
|
|
|
|
+ }
|
|
|
|
|
+ for _, node := range cityNodes {
|
|
|
|
|
+ if node.Id == cityId {
|
|
|
|
|
+ resp.CityName = node.Text
|
|
|
|
|
+ break
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ resp.Gender = res[0]["sex"].(int64)
|
|
|
resp.ErpRoleType = 2
|
|
resp.ErpRoleType = 2
|
|
|
} else {
|
|
} else {
|
|
|
resp.ErpRoleType = 0
|
|
resp.ErpRoleType = 0
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
- info := &types.InfoResponse{}
|
|
|
|
|
|
|
+ if !strings.HasPrefix(user.Avatar, "http") && user.Avatar != "" {
|
|
|
|
|
+ domain := strings.TrimRight(l.svcCtx.Config.Domain, "/")
|
|
|
|
|
+ filePath := strings.TrimLeft(user.Avatar, "/")
|
|
|
|
|
+ user.Avatar = fmt.Sprintf("%s/%s", domain, filePath)
|
|
|
|
|
+ }
|
|
|
info.ID = user.Id
|
|
info.ID = user.Id
|
|
|
info.Avatar = user.Avatar
|
|
info.Avatar = user.Avatar
|
|
|
info.Birthday = user.Birthday
|
|
info.Birthday = user.Birthday
|