添加客户rpc接口

finance
杨赟 2 years ago
parent b429fd9cfd
commit 0b17d5cdc2

@ -0,0 +1,5 @@
package customer
type Customer struct {
User user
}

@ -0,0 +1,103 @@
package customer
import (
"context"
"git.oa00.com/supply-chain/service/client"
"git.oa00.com/supply-chain/service/lib/bean"
)
const (
UserStatusDisabled = 1 // 停用
UserStatusEnabled = 2 // 启用
UserTypeManage = 1 // 后台创建
UserTypeSelf = 2 // 自主创建
)
type user struct {
}
type UserSearch struct {
Status uint // 状态
Name string // 客户名称
}
type ArgsUserList struct {
Search UserSearch
bean.Page
}
type UserItem struct {
Id uint `json:"id"`
Name string `json:"name"`
Account string `json:"account"`
Liaison string `json:"liaison"`
Phone string `json:"phone"`
Status uint `json:"status"`
CreatedType uint `json:"createdType"`
CreatedUserId uint `json:"createdUserId"`
CreatedAt int64 `json:"createdAt"`
}
type ReplyUserList struct {
Lists []UserItem `json:"lists"`
Total int64 `json:"total"`
}
// Lists @Title 获取客户列表
func (u *user) Lists(ctx context.Context, args ArgsUserList) (reply ReplyUserList, err error) {
err = client.GetClient(u).Call(ctx, "Lists", args, &reply)
return
}
type ArgsUserAdd struct {
Name string // 名称
Account string // 账号
Liaison string // 联系人
Phone string // 手机号
Password string // 密码
CreatedType uint // 创建账号类型 1=后台创建 2=自主创建
CreatedUserId uint // 创建人Id
}
// Add @Title 添加客户
func (u *user) Add(ctx context.Context, args ArgsUserAdd) error {
reply := 0
return client.GetClient(u).Call(ctx, "Add", args, &reply)
}
type ReplyUserInfo struct {
Id uint `json:"id"`
Name string `json:"name"`
Liaison string `json:"liaison"`
Phone string `json:"phone"`
Account string `json:"account"`
}
// Info @Title 客户详情
func (u *user) Info(ctx context.Context, userId uint) (result ReplyUserInfo, err error) {
err = client.GetClient(u).Call(ctx, "Info", userId, &result)
return
}
type ArgsUserEdit struct {
Id uint // 客户id
Name string // 名称
Liaison string // 联系人
Phone string // 手机号
Password string // 密码 空=不修改
}
// Edit @Title 编辑客户
func (u *user) Edit(ctx context.Context, args ArgsUserEdit) error {
reply := 0
return client.GetClient(u).Call(ctx, "Edit", args, &reply)
}
// Enable @Title 启用
func (u *user) Enable(ctx context.Context, userId uint) error {
reply := 0
return client.GetClient(u).Call(ctx, "Enable", userId, &reply)
}
// Disable @Title 停用
func (u *user) Disable(ctx context.Context, userId uint) error {
reply := 0
return client.GetClient(u).Call(ctx, "Disable", userId, &reply)
}

@ -1,6 +1,7 @@
package service
import (
"git.oa00.com/supply-chain/service/customer"
"git.oa00.com/supply-chain/service/jd"
"git.oa00.com/supply-chain/service/supply"
)
@ -10,4 +11,5 @@ var Rpc = &rpc{}
type rpc struct {
Supply supply.Supply
Jd jd.Jd
Customer customer.Customer
}

Loading…
Cancel
Save