1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- package logic
- import (
- "context"
- "jyBXSubscribe/api/internal/svc"
- "jyBXSubscribe/api/internal/types"
- "jyBXSubscribe/rpc/type/bxsubscribe"
- "github.com/zeromicro/go-zero/core/logx"
- )
- type ViewStatusLogic struct {
- logx.Logger
- ctx context.Context
- svcCtx *svc.ServiceContext
- }
- func NewViewStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ViewStatusLogic {
- return &ViewStatusLogic{
- Logger: logx.WithContext(ctx),
- ctx: ctx,
- svcCtx: svcCtx,
- }
- }
- func (l *ViewStatusLogic) ViewStatus(req *types.ViewStatusReq) (resp *types.CommonResp, err error) {
- // todo: add your logic here and delete this line
- res, err := l.svcCtx.Suscribe.GetViewStatus(l.ctx, &bxsubscribe.GetViewStatusReq{
- AppId: req.AppId,
- EntId: req.EntId,
- EntUserId: req.EntUserId,
- InfoId: req.InfoId,
- })
- if err != nil {
- return &types.CommonResp{
- Err_code: res.ErrCode,
- Err_msg: res.ErrMsg,
- Data: nil,
- }, nil
- }
- var data []map[string]interface{}
- for _, v := range res.Items {
- _d := make(map[string]interface{})
- _d["name"] = v.Name
- _d["id"] = v.Id
- _d["visittime"] = v.Visittime
- _d["isvisit"] = v.Isvisit
- _d["date"] = v.Date
- _d["source"] = v.Source
- _d["phone"] = v.Phone
- data = append(data, _d)
- }
- return &types.CommonResp{
- Err_code: res.ErrCode,
- Err_msg: res.ErrMsg,
- Data: data,
- }, nil
- return
- }
|