feat: add facepp
CI / changes (push) Successful in 1m31s
CI / ad (push) Successful in 26s
CI / admin (push) Successful in 17s
CI / analysis (push) Successful in 24s
CI / bff (push) Successful in 16s
CI / chore (push) Successful in 14s
CI / equipment (push) Successful in 15s
CI / express (push) Successful in 13s
CI / factory (push) Successful in 13s
CI / message (push) Successful in 10s
CI / order (push) Successful in 10s
CI / payment (push) Successful in 11s
CI / percutaneous (push) Successful in 11s
CI / product (push) Successful in 12s
CI / record (push) Successful in 12s
CI / sale (push) Successful in 11s
CI / store (push) Successful in 11s
CI / support (push) Successful in 11s
CI / task (push) Successful in 10s
CI / user (push) Successful in 18s
CI / water (push) Successful in 13s
CI / wecom (push) Successful in 13s
CI / ws (push) Successful in 6s
CI / changes (push) Successful in 1m31s
CI / ad (push) Successful in 26s
CI / admin (push) Successful in 17s
CI / analysis (push) Successful in 24s
CI / bff (push) Successful in 16s
CI / chore (push) Successful in 14s
CI / equipment (push) Successful in 15s
CI / express (push) Successful in 13s
CI / factory (push) Successful in 13s
CI / message (push) Successful in 10s
CI / order (push) Successful in 10s
CI / payment (push) Successful in 11s
CI / percutaneous (push) Successful in 11s
CI / product (push) Successful in 12s
CI / record (push) Successful in 12s
CI / sale (push) Successful in 11s
CI / store (push) Successful in 11s
CI / support (push) Successful in 11s
CI / task (push) Successful in 10s
CI / user (push) Successful in 18s
CI / water (push) Successful in 13s
CI / wecom (push) Successful in 13s
CI / ws (push) Successful in 6s
This commit is contained in:
@@ -2,10 +2,13 @@ package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"lone-services/pkg/modelbase"
|
||||
"lone-services/pkg/utils"
|
||||
user "lone-services/rpc/user/pb"
|
||||
"lone-services/services/user/internal/dao"
|
||||
"lone-services/services/user/internal/model"
|
||||
"lone-services/services/user/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
@@ -66,6 +69,15 @@ func (l *InfoLogic) Info(in *user.InfoReq) (*user.Response, error) {
|
||||
ret.Detail = &dao.ProfileDetail{}
|
||||
}
|
||||
|
||||
if loginUser.ClientCode != utils.StringEmpty {
|
||||
clientInfo, clientErr := loadProfileClient(row.Id, loginUser.ClientCode)
|
||||
if clientErr != nil {
|
||||
l.Errorf("info load user client: %v", clientErr)
|
||||
return failResponse(utils.Fail), nil
|
||||
}
|
||||
ret.Client = clientInfo
|
||||
}
|
||||
|
||||
switch userType {
|
||||
case dao.TypeUser:
|
||||
return okResponse(ret), nil
|
||||
@@ -103,3 +115,24 @@ func (l *InfoLogic) loadSaleProfile(loginUser utils.UserInfo) (*dao.ProfileSaleD
|
||||
}
|
||||
return toProfileSale(data), nil
|
||||
}
|
||||
|
||||
func loadProfileClient(userId int64, clientCode string) (*dao.ProfileClient, error) {
|
||||
var row dao.UserClient
|
||||
err := model.UserClientModel{}.Init().GetOne(modelbase.Params{
|
||||
Eq: map[string]string{
|
||||
"user_id": strconv.FormatInt(userId, utils.NumberTen),
|
||||
"client_code": clientCode,
|
||||
"status": strconv.Itoa(int(dao.StatusEnabled)),
|
||||
},
|
||||
}, &row)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if row.Id < utils.NumberOne {
|
||||
return nil, nil
|
||||
}
|
||||
return &dao.ProfileClient{
|
||||
ClientCode: row.ClientCode,
|
||||
OpenedAt: row.OpenedAt.Format(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user