fix
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
package admin_complaint
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/common/xerr"
|
||||
"ycc-server/pkg/lzkit/lzUtils"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type AdminUpdateComplaintStatusLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewAdminUpdateComplaintStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AdminUpdateComplaintStatusLogic {
|
||||
return &AdminUpdateComplaintStatusLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *AdminUpdateComplaintStatusLogic) AdminUpdateComplaintStatus(req *types.AdminUpdateComplaintStatusReq) (resp *types.AdminUpdateComplaintStatusResp, err error) {
|
||||
// 获取投诉主表信息
|
||||
complaint, err := l.svcCtx.ComplaintMainModel.FindOne(l.ctx, req.Id)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "AdminUpdateComplaintStatus, 查询投诉失败 err: %v", err)
|
||||
}
|
||||
|
||||
// 更新状态
|
||||
complaint.Status = lzUtils.StringToNullString(req.Status)
|
||||
if req.StatusDescription != "" {
|
||||
complaint.StatusDescription = lzUtils.StringToNullString(req.StatusDescription)
|
||||
}
|
||||
if req.HandlerId != "" {
|
||||
complaint.HandlerId = lzUtils.StringToNullString(req.HandlerId)
|
||||
complaint.HandleTime = lzUtils.TimeToNullTime(time.Now())
|
||||
}
|
||||
|
||||
// 更新数据库
|
||||
err = l.svcCtx.ComplaintMainModel.UpdateWithVersion(l.ctx, nil, complaint)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "AdminUpdateComplaintStatus, 更新投诉状态失败 err: %v", err)
|
||||
}
|
||||
|
||||
return &types.AdminUpdateComplaintStatusResp{
|
||||
Success: true,
|
||||
}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user