add apis
CI / changes (push) Successful in 1m31s
CI / ad (push) Successful in 0s
CI / admin (push) Successful in 0s
CI / aiserver (push) Successful in 0s
CI / analysis (push) Successful in 1s
CI / bff (push) Successful in 26s
CI / chore (push) Successful in 0s
CI / equipment (push) Successful in 0s
CI / express (push) Successful in 0s
CI / factory (push) Successful in 0s
CI / message (push) Successful in 1s
CI / order (push) Successful in 0s
CI / payment (push) Successful in 0s
CI / percutaneous (push) Successful in 0s
CI / product (push) Successful in 0s
CI / record (push) Successful in 0s
CI / sale (push) Successful in 0s
CI / store (push) Successful in 1s
CI / support (push) Successful in 0s
CI / task (push) Successful in 0s
CI / user (push) Successful in 0s
CI / water (push) Failing after 8s
CI / wecom (push) Successful in 0s
CI / ws (push) Successful in 0s
CI / changes (push) Successful in 1m31s
CI / ad (push) Successful in 0s
CI / admin (push) Successful in 0s
CI / aiserver (push) Successful in 0s
CI / analysis (push) Successful in 1s
CI / bff (push) Successful in 26s
CI / chore (push) Successful in 0s
CI / equipment (push) Successful in 0s
CI / express (push) Successful in 0s
CI / factory (push) Successful in 0s
CI / message (push) Successful in 1s
CI / order (push) Successful in 0s
CI / payment (push) Successful in 0s
CI / percutaneous (push) Successful in 0s
CI / product (push) Successful in 0s
CI / record (push) Successful in 0s
CI / sale (push) Successful in 0s
CI / store (push) Successful in 1s
CI / support (push) Successful in 0s
CI / task (push) Successful in 0s
CI / user (push) Successful in 0s
CI / water (push) Failing after 8s
CI / wecom (push) Successful in 0s
CI / ws (push) Successful in 0s
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"lone-services/pkg/modelbase"
|
||||
"lone-services/pkg/utils"
|
||||
"lone-services/services/water/internal/dao"
|
||||
"lone-services/services/water/model"
|
||||
"lone-services/services/water/validator"
|
||||
|
||||
"lone-services/rpc/water/pb"
|
||||
"lone-services/services/water/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type WarningStatusLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
BaseLogic
|
||||
}
|
||||
|
||||
func NewWarningStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *WarningStatusLogic {
|
||||
return &WarningStatusLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// 状态
|
||||
func (l *WarningStatusLogic) WarningStatus(in *water.WarningStatusRequest) (*water.Response, error) {
|
||||
var v validator.WarningStatusValidator
|
||||
if fail := l.checkParams(in, &v); fail != nil {
|
||||
return fail, nil
|
||||
}
|
||||
adminInfo := utils.GetUserFromCtx(l.ctx)
|
||||
if adminInfo.ID < utils.NumberOne {
|
||||
return l.fail(utils.ErrorNoLoginInfo)
|
||||
}
|
||||
|
||||
w := modelbase.Params{Eq: map[string]string{"id": string(in.Id)}}
|
||||
|
||||
var info dao.WarningInfo
|
||||
err := model.WarningModel{}.Init().GetOne(w, &info)
|
||||
if err != nil {
|
||||
return l.fail(utils.Fail)
|
||||
}
|
||||
if info.Id < utils.NumberOne {
|
||||
return l.fail(utils.ErrorNotFund)
|
||||
}
|
||||
|
||||
info.Status = in.Status
|
||||
_, err = model.WarningModel{}.Init().Edit(w, &info)
|
||||
if err != nil {
|
||||
return l.fail(utils.Fail)
|
||||
}
|
||||
return l.ok(utils.NumberOne)
|
||||
}
|
||||
Reference in New Issue
Block a user