diff --git a/customer/service.go b/customer/service.go index 1712f31..cbc50ab 100644 --- a/customer/service.go +++ b/customer/service.go @@ -3,7 +3,8 @@ package customer type serviceId uint const ( - ServiceSupply serviceId = 1 // 供应链 + ServiceSupply serviceId = 1 // 供应链 + ServiceWholesale serviceId = 2 // 批发 UserServiceStatusNone = 0 // 无 UserServiceStatusWait = 1 // 待审核 diff --git a/customer/service/audit.go b/customer/service/audit.go index 13032f2..8df40eb 100644 --- a/customer/service/audit.go +++ b/customer/service/audit.go @@ -3,12 +3,11 @@ package service import ( "context" "git.oa00.com/supply-chain/service/client" - audit2 "git.oa00.com/supply-chain/service/customer/service/audit" "git.oa00.com/supply-chain/service/lib/bean" + "time" ) type audit struct { - audit2.Audit } type AuditSearch struct { ApplyUserId uint // 申请人 @@ -72,3 +71,74 @@ func (a *audit) History(ctx context.Context, args ArgsHistory) (reply ReplyHisto err = xClient.Call(ctx, "History", args, &reply) return } + +type ArgsAuditApply struct { + ServiceId uint `json:"serviceId"` // 服务id + ApplyUserId uint `json:"applyUserId"` // 申请人id + CustomerId uint `json:"customerId"` // 客户id + ExpirationAt time.Time `json:"expirationAt"` // 到期时间 + Expand any `json:"expand"` // 拓展参数 +} + +// Apply @Title 申请 +func (a *audit) Apply(ctx context.Context, args ArgsAuditApply) error { + reply := 0 + xClient, err := client.GetClient(a) + if err != nil { + return err + } + return xClient.Call(ctx, "Apply", args, &reply) +} + +type ArgsAuditAdopt struct { + AuditUserId uint // 审核人id + UserServiceId uint // 客户服务id +} + +// Adopt @Title 审核通过 +func (a *audit) Adopt(ctx context.Context, args ArgsAuditAdopt) error { + reply := 0 + xClient, err := client.GetClient(a) + if err != nil { + return err + } + return xClient.Call(ctx, "Adopt", args, &reply) +} + +type ArgsAuditReject struct { + AuditUserId uint // 审核人id + UserServiceId uint // 客户服务id + Reason string // 驳回原因 +} + +// Reject @Title 驳回 +func (a *audit) Reject(ctx context.Context, args ArgsAuditReject) error { + reply := 0 + xClient, err := client.GetClient(a) + if err != nil { + return err + } + return xClient.Call(ctx, "Reject", args, &reply) +} + +type ReplyAuditInfo 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"` + AuditStatus uint `json:"auditStatus"` + AuditAt int64 `json:"auditAt"` + Reason string `json:"reason"` + AuditUserId uint `json:"auditUserId"` + Expand any `json:"expand"` +} + +type ReplyProof struct { + Name string `json:"name"` + ChannelId uint `json:"channelId"` // 用户Id + AppKey string `json:"appKey"` + AppSecret string `json:"appSecret"` +} diff --git a/customer/service/audit/audit.go b/customer/service/audit/audit.go deleted file mode 100644 index ccbd49d..0000000 --- a/customer/service/audit/audit.go +++ /dev/null @@ -1,5 +0,0 @@ -package audit - -type Audit struct { - Supply supply -} diff --git a/customer/service/audit/supply.go b/customer/service/audit/supply.go deleted file mode 100644 index 3113f90..0000000 --- a/customer/service/audit/supply.go +++ /dev/null @@ -1,101 +0,0 @@ -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 string // 到期时间 - 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 -} diff --git a/customer/user.go b/customer/user.go index e0e571f..4bfdabc 100644 --- a/customer/user.go +++ b/customer/user.go @@ -31,7 +31,6 @@ type UserItem struct { Id uint `json:"id"` Name string `json:"name"` Account string `json:"account"` - RateId uint `json:"rateId"` Liaison string `json:"liaison"` Phone string `json:"phone"` Amount decimal.Decimal `json:"amount"` diff --git a/supply/setting/rate.go b/supply/setting/rate.go index 8ffb1fa..07717b5 100644 --- a/supply/setting/rate.go +++ b/supply/setting/rate.go @@ -25,6 +25,16 @@ func (r *rate) All(ctx context.Context) (result []RateItem, err error) { return } +// Get @Title 获取利率信息 +func (r *rate) Get(ctx context.Context, rateId uint) (result RateItem, err error) { + xClient, err := client.GetClient(r) + if err != nil { + return + } + err = xClient.Call(ctx, "Get", rateId, &result) + return +} + type ArgsRateChannel struct { ChannelId uint // 渠道id RateId uint // 费率id diff --git a/wholesale/setting/rate.go b/wholesale/setting/rate.go index 8ffb1fa..07717b5 100644 --- a/wholesale/setting/rate.go +++ b/wholesale/setting/rate.go @@ -25,6 +25,16 @@ func (r *rate) All(ctx context.Context) (result []RateItem, err error) { return } +// Get @Title 获取利率信息 +func (r *rate) Get(ctx context.Context, rateId uint) (result RateItem, err error) { + xClient, err := client.GetClient(r) + if err != nil { + return + } + err = xClient.Call(ctx, "Get", rateId, &result) + return +} + type ArgsRateChannel struct { ChannelId uint // 渠道id RateId uint // 费率id