You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
102 lines
2.5 KiB
102 lines
2.5 KiB
package audit
|
|
|
|
import (
|
|
"context"
|
|
"git.oa00.com/supply-chain/service/client"
|
|
)
|
|
|
|
type supply struct {
|
|
}
|
|
|
|
type ArgsSupplyApply struct {
|
|
ApplyUserId uint // 申请人id
|
|
CustomerId uint // 客户id
|
|
RateId uint // 费率id
|
|
ExpirationAt int64 // 到期时间
|
|
Enclosure string // 附件
|
|
}
|
|
|
|
// Apply @Title 申请
|
|
func (s *supply) Apply(ctx context.Context, args ArgsSupplyApply) error {
|
|
reply := 0
|
|
xClient, err := client.GetClient(s)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return xClient.Call(ctx, "Apply", args, &reply)
|
|
}
|
|
|
|
type ArgsSupplyAdopt struct {
|
|
AuditUserId uint // 审核人id
|
|
UserServiceId uint // 客户服务id
|
|
}
|
|
|
|
// Adopt @Title 审核通过
|
|
func (s *supply) Adopt(ctx context.Context, args ArgsSupplyAdopt) error {
|
|
reply := 0
|
|
xClient, err := client.GetClient(s)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return xClient.Call(ctx, "Adopt", args, &reply)
|
|
}
|
|
|
|
type ArgsSupplyReject struct {
|
|
AuditUserId uint // 审核人id
|
|
UserServiceId uint // 客户服务id
|
|
Reason string // 驳回原因
|
|
}
|
|
|
|
// Reject @Title 驳回
|
|
func (s *supply) Reject(ctx context.Context, args ArgsSupplyReject) error {
|
|
reply := 0
|
|
xClient, err := client.GetClient(s)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return xClient.Call(ctx, "Reject", args, &reply)
|
|
}
|
|
|
|
type ReplySupplyInfo struct {
|
|
Id uint `json:"id"`
|
|
UserName string `json:"userName"`
|
|
ApplyUserId uint `json:"applyUserId"`
|
|
ApplyAt int64 `json:"applyAt"`
|
|
ServiceId uint `json:"serviceId"`
|
|
ServiceName string `json:"serviceName"`
|
|
ExpirationAt int64 `json:"expirationAt"`
|
|
RateId uint `json:"rateId"`
|
|
Enclosure string `json:"enclosure"`
|
|
AuditStatus uint `json:"auditStatus"`
|
|
AuditAt int64 `json:"auditAt"`
|
|
Reason string `json:"reason"`
|
|
AuditUserId uint `json:"auditUserId"`
|
|
}
|
|
|
|
// Info @Title 详情
|
|
func (s *supply) Info(ctx context.Context, userServiceId uint) (reply ReplySupplyInfo, err error) {
|
|
xClient, err := client.GetClient(s)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = xClient.Call(ctx, "Info", userServiceId, &reply)
|
|
return
|
|
}
|
|
|
|
type ReplyProof struct {
|
|
Name string `json:"name"`
|
|
ChannelId uint `json:"channelId"` // 用户Id
|
|
AppKey string `json:"appKey"`
|
|
AppSecret string `json:"appSecret"`
|
|
}
|
|
|
|
// GetProof @Title 获取凭证
|
|
func (s *supply) GetProof(ctx context.Context, userServiceId uint) (reply ReplyProof, err error) {
|
|
xClient, err := client.GetClient(s)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = xClient.Call(ctx, "GetProof", userServiceId, &reply)
|
|
return
|
|
}
|