修改商户审核接口(新增服务到期时间)
This commit is contained in:
@ -1,6 +1,9 @@
|
|||||||
package v1
|
package v1
|
||||||
|
|
||||||
import "github.com/gogf/gf/v2/frame/g"
|
import (
|
||||||
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
|
"github.com/gogf/gf/v2/os/gtime"
|
||||||
|
)
|
||||||
|
|
||||||
type ListReq struct {
|
type ListReq struct {
|
||||||
g.Meta `path:"/merchant" method:"get" tags:"Merchant" summary:"(系统管理员)获取商户列表"`
|
g.Meta `path:"/merchant" method:"get" tags:"Merchant" summary:"(系统管理员)获取商户列表"`
|
||||||
@ -30,10 +33,11 @@ type UpdateRes struct {
|
|||||||
|
|
||||||
type AuditReq struct {
|
type AuditReq struct {
|
||||||
g.Meta `path:"/merchant/audit" method:"post" tags:"Merchant" summary:"(系统管理员)商户审核"`
|
g.Meta `path:"/merchant/audit" method:"post" tags:"Merchant" summary:"(系统管理员)商户审核"`
|
||||||
Id int64 `json:"id" v:"required" dc:"商户ID"`
|
Id int64 `json:"id" v:"required" dc:"商户ID"`
|
||||||
AuditStatus int `json:"auditStatus" v:"required" dc:"审核状态:2=审核通过,3=审核拒绝" `
|
AuditStatus int `json:"auditStatus" v:"required" dc:"审核状态:2=审核通过,3=审核拒绝" `
|
||||||
AuditRemark string `json:"auditRemark" dc:"审核备注"`
|
AuditRemark string `json:"auditRemark" dc:"审核备注"`
|
||||||
RejectReason string `json:"rejectReason" dc:"拒绝原因"`
|
RejectReason string `json:"rejectReason" dc:"拒绝原因"`
|
||||||
|
ExpireAt *gtime.Time `json:"serviceExpire" dc:"商户到期时间"`
|
||||||
}
|
}
|
||||||
type AuditRes struct {
|
type AuditRes struct {
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
func (c *ControllerV1) Audit(ctx context.Context, req *v1.AuditReq) (res *v1.AuditRes, err error) {
|
func (c *ControllerV1) Audit(ctx context.Context, req *v1.AuditReq) (res *v1.AuditRes, err error) {
|
||||||
adminId := g.RequestFromCtx(ctx).GetCtxVar("id").Int64()
|
adminId := g.RequestFromCtx(ctx).GetCtxVar("id").Int64()
|
||||||
_, err = service.Merchant().Audit(ctx, &model.MerchantAuditIn{Id: req.Id, AuditStatus: req.AuditStatus, AuditRemark: req.AuditRemark, AdminId: adminId, RejectReason: req.RejectReason})
|
_, err = service.Merchant().Audit(ctx, &model.MerchantAuditIn{Id: req.Id, AuditStatus: req.AuditStatus, AuditRemark: req.AuditRemark, AdminId: adminId, RejectReason: req.RejectReason, ExpireAt: req.ExpireAt})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,13 +57,17 @@ func (s *sMerchant) Audit(ctx context.Context, in *model.MerchantAuditIn) (out *
|
|||||||
status = 1
|
status = 1
|
||||||
}
|
}
|
||||||
if err = dao.Merchants.Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) {
|
if err = dao.Merchants.Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) {
|
||||||
|
var time *gtime.Time
|
||||||
|
if in.ExpireAt != nil {
|
||||||
|
time = in.ExpireAt.AddDate(1, 0, 0)
|
||||||
|
}
|
||||||
if _, err = tx.Model(dao.Merchants.Table()).WherePri(in.Id).Data(do.Merchants{
|
if _, err = tx.Model(dao.Merchants.Table()).WherePri(in.Id).Data(do.Merchants{
|
||||||
AuditBy: in.AdminId,
|
AuditBy: in.AdminId,
|
||||||
AuditRemark: in.AuditRemark,
|
AuditRemark: in.AuditRemark,
|
||||||
AuditStatus: in.AuditStatus,
|
AuditStatus: in.AuditStatus,
|
||||||
AuditAt: gtime.Now(),
|
AuditAt: gtime.Now(),
|
||||||
ExpireAt: gtime.Now().AddDate(1, 0, 0), // 暂定审核通过后1年
|
ExpireAt: time, // 暂定审核通过后1年
|
||||||
Status: status, // 暂定审核通过商户即可使用
|
Status: status, // 暂定审核通过商户即可使用
|
||||||
RejectReason: in.RejectReason,
|
RejectReason: in.RejectReason,
|
||||||
}).OmitEmptyData().Update(); err != nil {
|
}).OmitEmptyData().Update(); err != nil {
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@ type Merchant struct {
|
|||||||
Address string `json:"address" orm:"address"` // 商户地址
|
Address string `json:"address" orm:"address"` // 商户地址
|
||||||
Status int `json:"status" orm:"status,default:1"` // 状态:1=正常,2=禁用
|
Status int `json:"status" orm:"status,default:1"` // 状态:1=正常,2=禁用
|
||||||
ExpireAt *gtime.Time `json:"expireAt" orm:"expire_at"` // 服务到期时间
|
ExpireAt *gtime.Time `json:"expireAt" orm:"expire_at"` // 服务到期时间
|
||||||
ApplicationReason int64 `json:"applicationReason" orm:"application_reason"` // 申请理由
|
ApplicationReason string `json:"applicationReason" orm:"application_reason"` // 申请理由
|
||||||
CreatedBy int64 `json:"createdBy" orm:"created_by"` // 创建人ID
|
CreatedBy int64 `json:"createdBy" orm:"created_by"` // 创建人ID
|
||||||
CreatedByType int `json:"createdByType" orm:"created_by_type"` // 创建人类型:1=系统管理员,2=商户注册
|
CreatedByType int `json:"createdByType" orm:"created_by_type"` // 创建人类型:1=系统管理员,2=商户注册
|
||||||
AuditStatus int `json:"auditStatus" orm:"audit_status,default:0"` // 审核状态:0=待审核,1=审核通过,2=审核拒绝
|
AuditStatus int `json:"auditStatus" orm:"audit_status,default:0"` // 审核状态:0=待审核,1=审核通过,2=审核拒绝
|
||||||
@ -24,6 +24,7 @@ type Merchant struct {
|
|||||||
AuditAt *gtime.Time `json:"auditAt" orm:"audit_at"` // 审核时间
|
AuditAt *gtime.Time `json:"auditAt" orm:"audit_at"` // 审核时间
|
||||||
AuditRemark string `json:"auditRemark" orm:"audit_remark"` // 审核备注
|
AuditRemark string `json:"auditRemark" orm:"audit_remark"` // 审核备注
|
||||||
RejectReason string `json:"rejectReason" orm:"reject_reason"` // 拒绝原因
|
RejectReason string `json:"rejectReason" orm:"reject_reason"` // 拒绝原因
|
||||||
|
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MerchantCreateIn 创建商户请求
|
// MerchantCreateIn 创建商户请求
|
||||||
@ -59,6 +60,7 @@ type MerchantAuditIn struct {
|
|||||||
AuditStatus int
|
AuditStatus int
|
||||||
AuditRemark string
|
AuditRemark string
|
||||||
RejectReason string
|
RejectReason string
|
||||||
|
ExpireAt *gtime.Time
|
||||||
}
|
}
|
||||||
type MerchantAuditOut struct {
|
type MerchantAuditOut struct {
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user