2b19937065
CI / changes (push) Successful in 39s
CI / ad (push) Successful in 1s
CI / admin (push) Successful in 0s
CI / bff (push) Successful in 25s
CI / chore (push) Successful in 24s
CI / equipment (push) Successful in 0s
CI / express (push) Successful in 1s
CI / factory (push) Successful in 0s
CI / payment (push) Successful in 0s
CI / product (push) Successful in 1s
CI / record (push) Successful in 0s
CI / sale (push) Successful in 24s
CI / task (push) Successful in 0s
CI / user (push) Successful in 0s
CI / wecom (push) Successful in 0s
79 lines
1.8 KiB
Go
79 lines
1.8 KiB
Go
package logic
|
|
|
|
import (
|
|
"context"
|
|
"lone-services/pkg/modelbase"
|
|
"lone-services/pkg/utils"
|
|
"lone-services/services/store/internal/dao"
|
|
"lone-services/services/store/internal/model"
|
|
"lone-services/services/store/validator"
|
|
"strconv"
|
|
|
|
"lone-services/rpc/store/pb"
|
|
"lone-services/services/store/internal/svc"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type DepositIgnoreLogic struct {
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
logx.Logger
|
|
BaseLogic
|
|
}
|
|
|
|
func NewDepositIgnoreLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DepositIgnoreLogic {
|
|
return &DepositIgnoreLogic{
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
Logger: logx.WithContext(ctx),
|
|
}
|
|
}
|
|
|
|
func (l *DepositIgnoreLogic) DepositIgnore(in *store.DepositIgnoreRequest) (*store.Response, error) {
|
|
var v validator.DepositIgnoreValidator
|
|
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)
|
|
}
|
|
|
|
var info dao.DepositStatus
|
|
|
|
w := modelbase.Params{Eq: map[string]string{
|
|
"id": strconv.FormatInt(in.Id, utils.NumberTen),
|
|
"status": strconv.Itoa(utils.StatusWaitPass)}}
|
|
modelObj := model.DepositModel{}.Init()
|
|
err := modelObj.GetOne(w, &info)
|
|
if err != nil {
|
|
l.Logger.Error(err)
|
|
return l.fail(utils.Fail)
|
|
}
|
|
if info.Id < utils.NumberOne {
|
|
return l.fail(utils.ErrorNotFund)
|
|
}
|
|
action := utils.ActionAdd{
|
|
OldContent: info,
|
|
Type: utils.LogActionTypeEdit,
|
|
ModuleName: utils.LogActionModuleStore,
|
|
}
|
|
|
|
info.Status = utils.StatusNotPass
|
|
info.Reason = v.Reason
|
|
|
|
row, err := modelObj.Edit(w, &info)
|
|
if err != nil {
|
|
l.Logger.Error(err)
|
|
return l.fail(utils.Fail)
|
|
}
|
|
if row > utils.NumberZero {
|
|
action.NewContent = info
|
|
utils.SetActionLog(adminInfo, action)
|
|
}
|
|
|
|
return l.ok(utils.NumberOne)
|
|
|
|
}
|