Merge branch 'master' of git.oa00.com:supply-chain/service

finance
黄伟 2 years ago
commit 47f40dca5d

@ -1,6 +1,7 @@
package client
import (
"errors"
"fmt"
"git.oa00.com/supply-chain/service/config"
"github.com/smallnest/rpcx/client"
@ -23,7 +24,7 @@ func init() {
}
// GetClient @Title 获取RPC客户的
func GetClient(s interface{}) client.XClient {
func GetClient(s interface{}) (client.XClient, error) {
path := strings.TrimPrefix(reflect.ValueOf(s).Elem().Type().PkgPath(), basePkgPath)
actionName := reflect.ValueOf(s).Elem().Type().Name()
key := path + "/" + actionName
@ -38,8 +39,7 @@ func GetClient(s interface{}) client.XClient {
d, err := client.NewConsulDiscovery(basePath, servicePath, config.RpcConfig.RegistryServer, nil)
if err != nil {
log.Println(err)
return nil
return nil, errors.New("系统异常")
}
option := client.DefaultOption
option.Retries = 3
@ -51,11 +51,11 @@ func GetClient(s interface{}) client.XClient {
}
mutex.Unlock()
}
return xClient.(client.XClient)
return xClient.(client.XClient), nil
}
// GetClientName @Title 根据服务名获取客户端
func GetClientName(base, service string) client.XClient {
func GetClientName(base, service string) (client.XClient, error) {
key := fmt.Sprintf("%s/%s", base, service)
xClient, ok := mClient.Load(key)
if !ok {
@ -65,7 +65,7 @@ func GetClientName(base, service string) client.XClient {
d, err := client.NewConsulDiscovery(base, service, config.RpcConfig.RegistryServer, nil)
if err != nil {
log.Println(err)
return nil
return nil, errors.New("系统异常")
}
option := client.DefaultOption
option.Retries = 3
@ -77,5 +77,5 @@ func GetClientName(base, service string) client.XClient {
}
mutex.Unlock()
}
return xClient.(client.XClient)
return xClient.(client.XClient), nil
}

@ -1,5 +1,8 @@
package customer
import "git.oa00.com/supply-chain/service/customer/service"
type Customer struct {
User user
User user
Service service.Service
}

@ -3,10 +3,12 @@ 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"
)
type audit struct {
audit2.Audit
}
type AuditSearch struct {
Status uint // 审核状态 1=未审核 2=通过 3=驳回
@ -34,6 +36,10 @@ type ReplyAuditLists struct {
// Lists @Title 服务审核列表
func (a *audit) Lists(ctx context.Context, args ArgsAuditLists) (reply ReplyAuditLists, err error) {
err = client.GetClient(a).Call(ctx, "Lists", args, &reply)
xClient, err := client.GetClient(a)
if err != nil {
return
}
err = xClient.Call(ctx, "Lists", args, &reply)
return
}

@ -0,0 +1,5 @@
package audit
type Audit struct {
Supply supply
}

@ -9,7 +9,7 @@ type supply struct {
}
type ArgsSupplyApply struct {
ApplyId uint // 申请人id
ApplyUserId uint // 申请人id
CustomerId uint // 客户id
RateId uint // 费率id
ExpirationAt int64 // 到期时间
@ -19,22 +19,30 @@ type ArgsSupplyApply struct {
// Apply @Title 申请
func (s *supply) Apply(ctx context.Context, args ArgsSupplyApply) error {
reply := 0
return client.GetClient(s).Call(ctx, "Apply", args, &reply)
xClient, err := client.GetClient(s)
if err != nil {
return err
}
return xClient.Call(ctx, "Apply", args, &reply)
}
type ArgsSupplyAdopt struct {
AuditId uint // 审核人id
AuditUserId uint // 审核人id
UserServiceId uint // 客户服务id
}
// Adopt @Title 审核通过
func (s *supply) Adopt(ctx context.Context, args ArgsSupplyAdopt) error {
reply := 0
return client.GetClient(s).Call(ctx, "Adopt", args, &reply)
xClient, err := client.GetClient(s)
if err != nil {
return err
}
return xClient.Call(ctx, "Adopt", args, &reply)
}
type ArgsSupplyReject struct {
AuditId uint // 审核人id
AuditUserId uint // 审核人id
UserServiceId uint // 客户服务id
Reason string // 驳回原因
}
@ -42,7 +50,11 @@ type ArgsSupplyReject struct {
// Reject @Title 驳回
func (s *supply) Reject(ctx context.Context, args ArgsSupplyReject) error {
reply := 0
return client.GetClient(s).Call(ctx, "Reject", args, &reply)
xClient, err := client.GetClient(s)
if err != nil {
return err
}
return xClient.Call(ctx, "Reject", args, &reply)
}
type ReplySupplyInfo struct {
@ -63,6 +75,10 @@ type ReplySupplyInfo struct {
// Info @Title 详情
func (s *supply) Info(ctx context.Context, userServiceId uint) (reply ReplySupplyInfo, err error) {
err = client.GetClient(s).Call(ctx, "Info", userServiceId, &reply)
xClient, err := client.GetClient(s)
if err != nil {
return
}
err = xClient.Call(ctx, "Info", userServiceId, &reply)
return
}

@ -0,0 +1,5 @@
package service
type Service struct {
Audit audit
}

@ -46,7 +46,11 @@ type ReplyUserList struct {
// Lists @Title 获取客户列表
func (u *user) Lists(ctx context.Context, args ArgsUserList) (reply ReplyUserList, err error) {
err = client.GetClient(u).Call(ctx, "Lists", args, &reply)
xClient, err := client.GetClient(u)
if err != nil {
return
}
err = xClient.Call(ctx, "Lists", args, &reply)
return
}
@ -63,7 +67,11 @@ type ArgsUserAdd struct {
// Add @Title 添加客户
func (u *user) Add(ctx context.Context, args ArgsUserAdd) error {
reply := 0
return client.GetClient(u).Call(ctx, "Add", args, &reply)
xClient, err := client.GetClient(u)
if err != nil {
return err
}
return xClient.Call(ctx, "Add", args, &reply)
}
type ReplyUserInfo struct {
@ -76,7 +84,11 @@ type ReplyUserInfo struct {
// Info @Title 客户详情
func (u *user) Info(ctx context.Context, userId uint) (result ReplyUserInfo, err error) {
err = client.GetClient(u).Call(ctx, "Info", userId, &result)
xClient, err := client.GetClient(u)
if err != nil {
return
}
err = xClient.Call(ctx, "Info", userId, &result)
return
}
@ -91,19 +103,31 @@ type ArgsUserEdit struct {
// Edit @Title 编辑客户
func (u *user) Edit(ctx context.Context, args ArgsUserEdit) error {
reply := 0
return client.GetClient(u).Call(ctx, "Edit", args, &reply)
xClient, err := client.GetClient(u)
if err != nil {
return err
}
return xClient.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)
xClient, err := client.GetClient(u)
if err != nil {
return err
}
return xClient.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)
xClient, err := client.GetClient(u)
if err != nil {
return err
}
return xClient.Call(ctx, "Disable", userId, &reply)
}
type ArgsUserServiceInfo struct {
@ -118,6 +142,10 @@ type ReplyUserServiceInfo struct {
// ServiceInfo @Title 获取服务信息
func (u *user) ServiceInfo(ctx context.Context, args ArgsUserServiceInfo) (reply ReplyUserServiceInfo, err error) {
err = client.GetClient(u).Call(ctx, "ServiceInfo", args, &reply)
xClient, err := client.GetClient(u)
if err != nil {
return
}
err = xClient.Call(ctx, "ServiceInfo", args, &reply)
return
}

@ -31,7 +31,11 @@ type ArgsDepositAdd struct {
// Add @Title 充值
func (d *deposit) Add(ctx context.Context, args ArgsDepositAdd) error {
reply := 0
return client.GetClient(d).Call(ctx, "Add", args, &reply)
xClient, err := client.GetClient(d)
if err != nil {
return err
}
return xClient.Call(ctx, "Add", args, &reply)
}
type ArgsDepositInfo struct {
@ -57,6 +61,10 @@ type ReplyDepositInfo struct {
// Info @Title 详情
func (d *deposit) Info(ctx context.Context, args ArgsDepositInfo) (reply ReplyDepositInfo, err error) {
err = client.GetClient(d).Call(ctx, "Info", args, &reply)
xClient, err := client.GetClient(d)
if err != nil {
return
}
err = xClient.Call(ctx, "Info", args, &reply)
return
}

@ -41,7 +41,11 @@ type DepositAuditItem struct {
// Lists @Title 充值审核列表
func (d *depositAudit) Lists(ctx context.Context, args ArgsDepositAuditLists) (reply ReplyDepositAuditList, err error) {
err = client.GetClient(d).Call(ctx, "Lists", args, &reply)
xClient, err := client.GetClient(d)
if err != nil {
return
}
err = xClient.Call(ctx, "Lists", args, &reply)
return
}
@ -53,7 +57,11 @@ type ArgsDepositAuditAdopt struct {
// Adopt @Title 通过
func (d *depositAudit) Adopt(ctx context.Context, args ArgsDepositAuditAdopt) error {
reply := 0
return client.GetClient(d).Call(ctx, "Adopt", args, &reply)
xClient, err := client.GetClient(d)
if err != nil {
return err
}
return xClient.Call(ctx, "Adopt", args, &reply)
}
@ -66,5 +74,9 @@ type ArgsDepositAuditReject struct {
// Reject @Title 驳回
func (d *depositAudit) Reject(ctx context.Context, args ArgsDepositAuditReject) error {
reply := 0
return client.GetClient(d).Call(ctx, "Reject", args, &reply)
xClient, err := client.GetClient(d)
if err != nil {
return err
}
return xClient.Call(ctx, "Reject", args, &reply)
}

@ -30,5 +30,9 @@ type ArgsWalletDirect struct {
// Direct @Title 直接消费
func (w *wallet) Direct(ctx context.Context, args ArgsDepositAuditReject) error {
reply := 0
return client.GetClient(w).Call(ctx, "Direct", args, &reply)
xClient, err := client.GetClient(w)
if err != nil {
return err
}
return xClient.Call(ctx, "Direct", args, &reply)
}

@ -25,7 +25,11 @@ type ReplyBrandList struct {
// Lists @Title 获取品牌匹配列表
func (b *brand) Lists(ctx context.Context, args ArgsBrandList) (reply ReplyBrandList, err error) {
err = client.GetClient(b).Call(ctx, "Lists", args, &reply)
xClient, err := client.GetClient(b)
if err != nil {
return
}
err = xClient.Call(ctx, "Lists", args, &reply)
return
}
@ -38,7 +42,11 @@ type ArgsBrandEdit struct {
// Edit @Title 编辑品牌匹配
func (b *brand) Edit(ctx context.Context, args ArgsBrandEdit) error {
reply := 0
return client.GetClient(b).Call(ctx, "Edit", args, &reply)
xClient, err := client.GetClient(b)
if err != nil {
return err
}
return xClient.Call(ctx, "Edit", args, &reply)
}
type ArgsImport struct {
@ -48,5 +56,9 @@ type ArgsImport struct {
func (b *brand) Import(ctx context.Context, args []ArgsImport) error {
reply := 0
return client.GetClient(b).Call(ctx, "Import", args, &reply)
xClient, err := client.GetClient(b)
if err != nil {
return err
}
return xClient.Call(ctx, "Import", args, &reply)
}

@ -27,7 +27,11 @@ type ReplyCategoryList struct {
// Lists @Title 获取品牌匹配列表
func (c *category) Lists(ctx context.Context, args ArgsCategoryList) (reply ReplyCategoryList, err error) {
err = client.GetClient(c).Call(ctx, "Lists", args, &reply)
xClient, err := client.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "Lists", args, &reply)
return
}
@ -42,12 +46,56 @@ type ArgsCategoryEdit struct {
// Edit @Title 编辑品牌匹配
func (c *category) Edit(ctx context.Context, args ArgsCategoryEdit) error {
reply := 0
return client.GetClient(c).Call(ctx, "Edit", args, &reply)
xClient, err := client.GetClient(c)
if err != nil {
return err
}
return xClient.Call(ctx, "Edit", args, &reply)
}
// Select @Title 类目筛选
func (c *category) Select(ctx context.Context) (reply []CategoryItem, err error) {
args := 0
err = client.GetClient(c).Call(ctx, "Select", args, &reply)
xClient, err := client.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "Select", args, &reply)
return
}
type ArgsCategoryImport struct {
First string
Second string
Third string
SupplyCategoryId uint
}
// Import @Title 导入
func (c *category) Import(ctx context.Context, args []ArgsCategoryImport) (err error) {
reply := 0
xClient, err := client.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "Import", args, &reply)
return
}
type ArgsCategoryExport struct {
First string
Second string
Third string
SupplyCategoryId uint
}
// Export @Title 导出
func (c *category) Export(ctx context.Context) (reply []ArgsCategoryExport, err error) {
args := 0
xClient, err := client.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "Export", args, &reply)
return
}

@ -61,14 +61,22 @@ type ReplySkuList struct {
// Lists @Title 获取商品列表
func (s *sku) Lists(ctx context.Context, args ArgsSkuList) (reply ReplySkuList, err error) {
err = client.GetClient(s).Call(ctx, "Lists", args, &reply)
xClient, err := client.GetClient(s)
if err != nil {
return
}
err = xClient.Call(ctx, "Lists", args, &reply)
return
}
// Start @Title 开始处理
func (s *sku) Start(ctx context.Context, skuIds []uint) error {
reply := 0
return client.GetClient(s).Call(ctx, "Start", skuIds, &reply)
xClient, err := client.GetClient(s)
if err != nil {
return err
}
return xClient.Call(ctx, "Start", skuIds, &reply)
}
type ReplySkuInfo struct {
@ -103,7 +111,29 @@ type SkuImg struct {
// GetImgs @Title 获取预览图
func (s *sku) GetImgs(ctx context.Context, skuId uint) (reply []SkuImg, err error) {
err = client.GetClient(s).Call(ctx, "GetImgs", skuId, &reply)
xClient, err := client.GetClient(s)
if err != nil {
return
}
err = xClient.Call(ctx, "GetImgs", skuId, &reply)
return
}
type SkusImg struct {
Id uint `json:"id"`
SkuId uint `json:"skuId"`
Path string `json:"path"`
ReplacePath string `json:"replacePath"`
Sort uint `json:"sort"`
}
// GetSkusImgs @Title 批量获取预览图
func (s *sku) GetSkusImgs(ctx context.Context, skuId uint) (reply []SkusImg, err error) {
xClient, err := client.GetClient(s)
if err != nil {
return
}
err = xClient.Call(ctx, "GetSkusImgs", skuId, &reply)
return
}
@ -119,7 +149,11 @@ type SkuAttribute struct {
// Info @Title 获取商品详情
func (s *sku) Info(ctx context.Context, skuId uint) (reply ReplySkuInfo, err error) {
err = client.GetClient(s).Call(ctx, "Info", skuId, &reply)
xClient, err := client.GetClient(s)
if err != nil {
return
}
err = xClient.Call(ctx, "Info", skuId, &reply)
return
}
@ -139,13 +173,21 @@ type SkuImgEdit struct {
// Edit @Title 商品编辑
func (s *sku) Edit(ctx context.Context, args ArgsSkuEdit) error {
reply := 0
return client.GetClient(s).Call(ctx, "Edit", args, &reply)
xClient, err := client.GetClient(s)
if err != nil {
return err
}
return xClient.Call(ctx, "Edit", args, &reply)
}
// Discard @Title 废弃
func (s *sku) Discard(ctx context.Context, skuIds []uint) error {
reply := 0
return client.GetClient(s).Call(ctx, "Discard", skuIds, &reply)
xClient, err := client.GetClient(s)
if err != nil {
return err
}
return xClient.Call(ctx, "Discard", skuIds, &reply)
}
type AdoptItem struct {
@ -157,6 +199,26 @@ type AdoptItem struct {
// Adopt @Title 入库
func (s *sku) Adopt(ctx context.Context, skuIds []uint) (reply []AdoptItem, err error) {
err = client.GetClient(s).Call(ctx, "Adopt", skuIds, &reply)
xClient, err := client.GetClient(s)
if err != nil {
return
}
err = xClient.Call(ctx, "Adopt", skuIds, &reply)
return
}
type ArgsSkuReplaceImg struct {
SkuId uint // 商品id
ImgId uint // 图片id
ImgPath string // 图片路径
}
// ReplaceImg @Title 替换图片
func (s *sku) ReplaceImg(ctx context.Context, args ArgsSkuReplaceImg) error {
reply := 0
xClient, err := client.GetClient(s)
if err != nil {
return err
}
return xClient.Call(ctx, "ReplaceImg", args, &reply)
}

@ -11,11 +11,19 @@ type task struct {
// PullSku @Title 拉取京东商品
func (t *task) PullSku(ctx context.Context) error {
a := 0
return client.GetClient(t).Call(ctx, "PullSku", 0, &a)
xClient, err := client.GetClient(t)
if err != nil {
return err
}
return xClient.Call(ctx, "PullSku", 0, &a)
}
// SkuAdd @Title 添加商品到库
func (t *task) SkuAdd(ctx context.Context) error {
a := 0
return client.GetClient(t).Call(ctx, "SkuAdd", 0, &a)
xClient, err := client.GetClient(t)
if err != nil {
return err
}
return xClient.Call(ctx, "SkuAdd", 0, &a)
}

@ -31,13 +31,21 @@ type BrandSearch struct {
// Lists @Title 品牌列表
func (b *brand) Lists(ctx context.Context, args ArgsBrandList) (result ReplyBrandList, err error) {
err = client.GetClient(b).Call(ctx, "Lists", args, &result)
xClient, err := client.GetClient(b)
if err != nil {
return
}
err = xClient.Call(ctx, "Lists", args, &result)
return
}
// All @Title 全部品牌
func (b *brand) All(ctx context.Context) (result []BrandItem, err error) {
err = client.GetClient(b).Call(ctx, "All", 0, &result)
xClient, err := client.GetClient(b)
if err != nil {
return
}
err = xClient.Call(ctx, "All", 0, &result)
return
}
@ -48,7 +56,11 @@ type ArgsBrandAdd struct {
// Add @Title 添加品牌
func (b *brand) Add(ctx context.Context, args ArgsBrandAdd) (err error) {
reply := 0
return client.GetClient(b).Call(ctx, "Add", args, &reply)
xClient, err := client.GetClient(b)
if err != nil {
return err
}
return xClient.Call(ctx, "Add", args, &reply)
}
type ArgsBrandEdit struct {
@ -59,7 +71,11 @@ type ArgsBrandEdit struct {
// Edit @Title 编辑品牌
func (b *brand) Edit(ctx context.Context, args ArgsBrandEdit) (err error) {
reply := 0
return client.GetClient(b).Call(ctx, "Edit", args, &reply)
xClient, err := client.GetClient(b)
if err != nil {
return err
}
return xClient.Call(ctx, "Edit", args, &reply)
}
type ArgsBrandFindByIds struct {
@ -68,6 +84,10 @@ type ArgsBrandFindByIds struct {
// FindByIds @Title 品牌获取
func (b *brand) FindByIds(ctx context.Context, args ArgsBrandFindByIds) (result []BrandItem, err error) {
err = client.GetClient(b).Call(ctx, "FindByIds", args, &result)
xClient, err := client.GetClient(b)
if err != nil {
return
}
err = xClient.Call(ctx, "FindByIds", args, &result)
return
}

@ -17,7 +17,11 @@ type CategoryItem struct {
// All @Title 获取分类
func (c *category) All(ctx context.Context) (result []CategoryItem, err error) {
err = client.GetClient(c).Call(ctx, "All", 0, &result)
xClient, err := client.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "All", 0, &result)
return
}
@ -39,7 +43,11 @@ type ArgsCategoryAdd struct {
// Add @Title 添加分类
func (c *category) Add(ctx context.Context, args ArgsCategoryAdd) (err error) {
reply := 0
return client.GetClient(c).Call(ctx, "Add", args, &reply)
xClient, err := client.GetClient(c)
if err != nil {
return
}
return xClient.Call(ctx, "Add", args, &reply)
}
type ArgsCategoryEdit struct {
@ -51,7 +59,11 @@ type ArgsCategoryEdit struct {
// Edit @Title 编辑分类
func (c *category) Edit(ctx context.Context, args ArgsCategoryEdit) (err error) {
reply := 0
return client.GetClient(c).Call(ctx, "Edit", args, &reply)
xClient, err := client.GetClient(c)
if err != nil {
return
}
return xClient.Call(ctx, "Edit", args, &reply)
}
type ArgsCategoryFindByIds struct {
@ -66,6 +78,10 @@ type ThirdCategoryItem struct {
// FindByIds @Title 三级分类获取
func (c *category) FindByIds(ctx context.Context, args ArgsCategoryFindByIds) (result []ThirdCategoryItem, err error) {
err = client.GetClient(c).Call(ctx, "FindByIds", args, &result)
xClient, err := client.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "FindByIds", args, &result)
return
}

@ -27,7 +27,11 @@ type ReplyOrderFreightFee struct {
// FreightFee @Title 获取运费
func (o *order) FreightFee(ctx context.Context, channelId string, args ArgsOrderFreightFee) (reply []ReplyOrderFreightFee, err error) {
err = client.GetClient(o).Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "FreightFee", args, &reply)
xClient, err := client.GetClient(o)
if err != nil {
return
}
err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "FreightFee", args, &reply)
return
}
@ -52,6 +56,10 @@ type ReplyOrderSubmit struct {
// Submit @Title 下单
func (o *order) Submit(ctx context.Context, channelId string, args ArgsOrderSubmit) (reply []ReplyOrderSubmit, err error) {
err = client.GetClient(o).Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Submit", args, &reply)
xClient, err := client.GetClient(o)
if err != nil {
return
}
err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Submit", args, &reply)
return
}

@ -51,7 +51,11 @@ type ReplySkuList struct {
// Lists @Title 商品列表
func (s *sku) Lists(ctx context.Context, channelId string, args ArgsSkuList) (reply ReplySkuList, err error) {
err = client.GetClient(s).Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Lists", args, &reply)
xClient, err := client.GetClient(s)
if err != nil {
return
}
err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Lists", args, &reply)
return
}
@ -103,7 +107,11 @@ type SkuAttribute struct {
// Details @Title 获取sku详情
func (s *sku) Details(ctx context.Context, channelId string, args ArgsSkuDetails) (reply []SkuDetailItem, err error) {
err = client.GetClient(s).Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Details", args, &reply)
xClient, err := client.GetClient(s)
if err != nil {
return
}
err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Details", args, &reply)
return
}
@ -124,6 +132,10 @@ type ReplySkuStock struct {
// Stock @Title 库存查询
func (s *sku) Stock(ctx context.Context, channelId string, args ArgsSkuStock) (reply []ReplySkuStock, err error) {
err = client.GetClient(s).Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Stock", args, &reply)
xClient, err := client.GetClient(s)
if err != nil {
return
}
err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Stock", args, &reply)
return
}

@ -17,7 +17,11 @@ type RateItem struct {
// All @Title 全部利率
func (r *rate) All(ctx context.Context) (result []RateItem, err error) {
err = client.GetClient(r).Call(ctx, "All", 0, &result)
xClient, err := client.GetClient(r)
if err != nil {
return
}
err = xClient.Call(ctx, "All", 0, &result)
return
}
@ -29,5 +33,9 @@ type ArgsRateChannel struct {
// Channel @Title 设置渠道利率
func (r *rate) Channel(ctx context.Context, args ArgsRateChannel) error {
reply := 0
return client.GetClient(r).Call(ctx, "Channel", args, &reply)
xClient, err := client.GetClient(r)
if err != nil {
return err
}
return xClient.Call(ctx, "Channel", args, &reply)
}

@ -57,6 +57,7 @@ type ArgsSkuAdd struct {
Content string // 商品详情
Imgs []SkuImg // 商品图片 第一张主图
Specifications []SkuSpecification // 商品参数信息
ImgUrl string // 商品主图
}
type SkuImg struct {
@ -76,7 +77,11 @@ type SkuAttribute struct {
// Add @Title 添加商品
func (s *sku) Add(ctx context.Context, args ArgsSkuAdd) error {
reply := 0
return client.GetClient(s).Call(ctx, "Add", args, &reply)
xClient, err := client.GetClient(s)
if err != nil {
return err
}
return xClient.Call(ctx, "Add", args, &reply)
}
type ArgsSkuAdjust struct {
@ -89,7 +94,11 @@ type ArgsSkuAdjust struct {
// Adjust @Title 加价
func (s *sku) Adjust(ctx context.Context, args ArgsSkuAdjust) error {
reply := 0
return client.GetClient(s).Call(ctx, "Adjust", args, &reply)
xClient, err := client.GetClient(s)
if err != nil {
return err
}
return xClient.Call(ctx, "Adjust", args, &reply)
}
type ArgsSkuLists struct {
@ -115,35 +124,39 @@ type SkuListsSearch struct {
}
type ReplySkuList struct {
Lists []SkuItem
Total int64
Lists []SkuItem `json:"lists"`
Total int64 `json:"total"`
}
type SkuItem struct {
Id uint
Name string // 名称
BrandName string // 品牌名称
FirstCategoryId uint // 一级分类id
SecondCategoryId uint // 二级分类id
ThirdCategoryId uint // 三级分类id
SupplyPrice decimal.Decimal // 采购价
GuidePrice decimal.Decimal // 指导价
ImgUrl string // 商品主图
PlatformStatus uint // 平台状态 1=上架 2=下架
SourceName string // 供应商名称
SourceSkuId string // 源skuId
SourceStatus uint // 供应商状态 1=上架 2=下架
CustomerPrice decimal.Decimal // 供货最高价
CustomerProfitRate decimal.Decimal // 供货利润率 供货利润/供货最高价%
AdjustType uint // 加价类型
AdjustPrice decimal.Decimal // 加价金额
Handle uint // 1=未处理 2=已处理
Reason string // 驳回原因
Id uint `json:"id"`
Name string `json:"name"` // 名称
BrandName string `json:"brandName"` // 品牌名称
FirstCategoryId uint `json:"firstCategoryId"` // 一级分类id
SecondCategoryId uint `json:"secondCategoryId"` // 二级分类id
ThirdCategoryId uint `json:"thirdCategoryId"` // 三级分类id
SupplyPrice decimal.Decimal `json:"supplyPrice"` // 采购价
GuidePrice decimal.Decimal `json:"guidePrice"` // 指导价
ImgUrl string `json:"imgUrl"` // 商品主图
PlatformStatus uint `json:"platformStatus"` // 平台状态 1=上架 2=下架
SourceName string `json:"sourceName"` // 供应商名称
SourceSkuId string `json:"sourceSkuId"` // 源skuId
SourceStatus uint `json:"sourceStatus"` // 供应商状态 1=上架 2=下架
CustomerPrice decimal.Decimal `json:"customerPrice"` // 供货最高价
CustomerProfitRate decimal.Decimal `json:"customerProfitRate"` // 供货利润率 供货利润/供货最高价%
AdjustType uint `json:"adjustType"` // 加价类型
AdjustPrice decimal.Decimal `json:"adjustPrice"` // 加价金额
Handle uint `json:"handle"` // 1=未处理 2=已处理
Reason string `json:"reason"` // 驳回原因
}
// Lists @Title 商品列表
func (s *sku) Lists(ctx context.Context, args ArgsSkuLists) (reply ReplySkuList, err error) {
err = client.GetClient(s).Call(ctx, "Lists", args, &reply)
xClient, err := client.GetClient(s)
if err != nil {
return
}
err = xClient.Call(ctx, "Lists", args, &reply)
return
}
@ -175,7 +188,11 @@ type SkuInfo struct {
// Info @Title 商品信息
func (s *sku) Info(ctx context.Context, skuId uint) (reply SkuInfo, err error) {
err = client.GetClient(s).Call(ctx, "Info", skuId, &reply)
xClient, err := client.GetClient(s)
if err != nil {
return
}
err = xClient.Call(ctx, "Info", skuId, &reply)
return
}
@ -190,13 +207,21 @@ type ArgsSkuDownShelves struct {
// OnShelves @Title 上架
func (s *sku) OnShelves(ctx context.Context, args ArgsSkuOnShelves) error {
reply := 0
return client.GetClient(s).Call(ctx, "OnShelves", args, &reply)
xClient, err := client.GetClient(s)
if err != nil {
return err
}
return xClient.Call(ctx, "OnShelves", args, &reply)
}
// DownShelves @Title 下架
func (s *sku) DownShelves(ctx context.Context, args ArgsSkuDownShelves) error {
reply := 0
return client.GetClient(s).Call(ctx, "DownShelves", args, &reply)
xClient, err := client.GetClient(s)
if err != nil {
return err
}
return xClient.Call(ctx, "DownShelves", args, &reply)
}
type ArgsSkuAdjustType struct {
@ -209,5 +234,9 @@ type ArgsSkuAdjustType struct {
// EditAdjust @Title 修改改价类型
func (s *sku) EditAdjust(ctx context.Context, args ArgsSkuAdjustType) error {
reply := 0
return client.GetClient(s).Call(ctx, "EditAdjust", args, &reply)
xClient, err := client.GetClient(s)
if err != nil {
return err
}
return xClient.Call(ctx, "EditAdjust", args, &reply)
}

@ -53,7 +53,11 @@ type ReplySkuAuditLists struct {
// Lists @Title 审核列表
func (s *skuAudit) Lists(ctx context.Context, args ArgsSkuAuditLists) (reply ReplySkuAuditLists, err error) {
err = client.GetClient(s).Call(ctx, "Lists", args, &reply)
xClient, err := client.GetClient(s)
if err != nil {
return
}
err = xClient.Call(ctx, "Lists", args, &reply)
return
}
@ -65,7 +69,11 @@ type ArgsSkuAuditAdopt struct {
// Adopt @Title 通过
func (s *skuAudit) Adopt(ctx context.Context, args ArgsSkuAuditAdopt) error {
reply := 0
return client.GetClient(s).Call(ctx, "Adopt", args, &reply)
xClient, err := client.GetClient(s)
if err != nil {
return err
}
return xClient.Call(ctx, "Adopt", args, &reply)
}
type ArgsSkuAuditReject struct {
@ -77,7 +85,11 @@ type ArgsSkuAuditReject struct {
// Reject @Title 驳回
func (s *skuAudit) Reject(ctx context.Context, args ArgsSkuAuditReject) error {
reply := 0
return client.GetClient(s).Call(ctx, "Reject", args, &reply)
xClient, err := client.GetClient(s)
if err != nil {
return err
}
return xClient.Call(ctx, "Reject", args, &reply)
}
// Stock @Title 库存查询

Loading…
Cancel
Save