fix: wecom types agent
CI / changes (push) Successful in 12s
CI / ad (push) Successful in 0s
CI / admin (push) Successful in 0s
CI / bff (push) Successful in 3s
CI / chore (push) Successful in 0s
CI / express (push) Successful in 0s
CI / product (push) Successful in 1s
CI / sale (push) Successful in 0s
CI / user (push) Successful in 0s
CI / wecom (push) Successful in 31s
CI / changes (push) Successful in 12s
CI / ad (push) Successful in 0s
CI / admin (push) Successful in 0s
CI / bff (push) Successful in 3s
CI / chore (push) Successful in 0s
CI / express (push) Successful in 0s
CI / product (push) Successful in 1s
CI / sale (push) Successful in 0s
CI / user (push) Successful in 0s
CI / wecom (push) Successful in 31s
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"lone-services/pkg/modelbase"
|
||||
"lone-services/pkg/utils"
|
||||
wecom "lone-services/rpc/wecom/pb"
|
||||
"lone-services/services/wecom/internal/dao"
|
||||
"lone-services/services/wecom/internal/model"
|
||||
"lone-services/services/wecom/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ItemsAgentsLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewItemsAgentsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ItemsAgentsLogic {
|
||||
return &ItemsAgentsLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// ItemsAgents 企业微信应用列表
|
||||
func (l *ItemsAgentsLogic) ItemsAgents(_ *wecom.EmptyReq) (*wecom.Response, error) {
|
||||
var rows []dao.WecomAgent
|
||||
m := model.AgentModel{}.Init()
|
||||
if err := m.Items(modelbase.Params{Order: "id desc"}, &rows); err != nil {
|
||||
l.Errorf("wecom items agents: %v", err)
|
||||
return failResponse(utils.Fail), nil
|
||||
}
|
||||
|
||||
items := make([]dao.AgentListItem, 0, len(rows))
|
||||
for _, row := range rows {
|
||||
items = append(items, dao.AgentListItem{
|
||||
Id: row.Id,
|
||||
Name: row.Name,
|
||||
AgentId: row.AgentId,
|
||||
CreatedAt: row.CreatedAt.Format(),
|
||||
})
|
||||
}
|
||||
return okResponse(items), nil
|
||||
}
|
||||
Reference in New Issue
Block a user