解决冲突

finance
黄伟 2 years ago
commit 1128c7a5da

@ -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
}

@ -37,6 +37,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
}

@ -19,7 +19,11 @@ 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 {
@ -30,7 +34,11 @@ type ArgsSupplyAdopt struct {
// 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 {
@ -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
}

@ -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,20 @@ 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
}

@ -51,6 +51,8 @@ type SkuItem struct {
Profit decimal.Decimal `json:"profit"`
Status uint `json:"status"`
Handle uint `json:"handle"`
SupplyCategoryId uint `json:"supplyCategoryId"`
SupplyBrandId uint `json:"supplyBrandId"`
}
type ReplySkuList struct {
Lists []SkuItem `json:"lists"`
@ -59,10 +61,24 @@ 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
xClient, err := client.GetClient(s)
if err != nil {
return err
}
return xClient.Call(ctx, "Start", skuIds, &reply)
}
type ReplySkuInfo struct {
Id uint `json:"id"`
Name string `json:"name"`
@ -95,7 +111,11 @@ 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
}
@ -111,7 +131,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
}
@ -131,13 +155,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 {
@ -149,6 +181,10 @@ 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
}

@ -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
}
@ -29,7 +33,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 {
@ -41,7 +49,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 {
@ -56,6 +68,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)
}

@ -76,7 +76,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 +93,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 {
@ -138,12 +146,52 @@ type SkuItem struct {
AdjustType uint // 加价类型
AdjustPrice decimal.Decimal // 加价金额
Handle uint // 1=未处理 2=已处理
Imgs []SkuImg
Reason string // 驳回原因
}
// 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
}
type SkuInfo struct {
Id uint `json:"id"`
Name string `json:"name"`
SourceSkuId string `json:"jdSkuId"`
SupplyPrice decimal.Decimal `json:"supplyPrice"`
GuidePrice decimal.Decimal `json:"guidePrice"`
Profit decimal.Decimal `json:"profit"`
UpcCode string `json:"upcCode"`
Color string `json:"color"`
Size string `json:"size"`
FirstCategoryName string `json:"firstCategoryName"`
SecondCategoryName string `json:"secondCategoryName"`
ThirdCategoryName string `json:"thirdCategoryName"`
BrandName string `json:"brandName"`
Content string `json:"content"`
Tax string `json:"tax"`
Unit string `json:"unit"`
Imgs []SkuImg `json:"imgs"`
Reason string `json:"reason"`
Specifications []SkuSpecification `json:"specification"`
PlatformStatus uint `json:"platformStatus"`
SourceName string `json:"sourceName"`
AdjustType uint `json:"adjustType"`
AdjustPrice decimal.Decimal `json:"adjustPrice"`
}
// Info @Title 商品信息
func (s *sku) Info(ctx context.Context, skuId uint) (reply SkuInfo, err error) {
xClient, err := client.GetClient(s)
if err != nil {
return
}
err = xClient.Call(ctx, "Info", skuId, &reply)
return
}
@ -158,13 +206,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 {
@ -177,5 +233,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)
}

@ -23,24 +23,27 @@ type SkuAuditSearch struct {
Status uint // 状态 1=未审核 2=通过 3=驳回
}
type SkuAndAuditItem struct {
AuditId uint `json:"auditId"`
SkuId uint `json:"skuId"`
AfterAdjustType uint `json:"afterAdjustType"`
AfterAdjustPrice decimal.Decimal `json:"afterAdjustPrice"`
Name string `json:"name"`
SupplyPrice decimal.Decimal `json:"supplyPrice"`
GuidePrice decimal.Decimal `json:"guidePrice"`
AdjustType uint `json:"adjustType"`
AdjustPrice decimal.Decimal `json:"adjustPrice"`
CustomerPrice decimal.Decimal `json:"customerPrice"`
Category string `json:"category"`
BrandName string `json:"brandName"`
SourceName string `json:"sourceName"`
AuditUserId uint `json:"auditUserId"`
AuditAt sql.NullTime `json:"auditAt"`
ImgUrl string `json:"imgUrl"`
Reason string `json:"reason"`
CreatedAt time.Time `json:"createdAt"`
AuditId uint `json:"auditId"`
SkuId uint `json:"skuId"`
AfterAdjustType uint `json:"afterAdjustType"`
AfterAdjustPrice decimal.Decimal `json:"afterAdjustPrice"`
Name string `json:"name"`
SupplyPrice decimal.Decimal `json:"supplyPrice"`
GuidePrice decimal.Decimal `json:"guidePrice"`
AdjustType uint `json:"adjustType"`
AdjustPrice decimal.Decimal `json:"adjustPrice"`
CustomerPrice decimal.Decimal `json:"customerPrice"`
Category string `json:"category"`
BrandName string `json:"brandName"`
SourceName string `json:"sourceName"`
AuditUserId uint `json:"auditUserId"`
AuditAt sql.NullTime `json:"auditAt"`
ImgUrl string `json:"imgUrl"`
Reason string `json:"reason"`
FirstCategoryName string `json:"firstCategoryName"`
SecondCategoryName string `json:"secondCategoryName"`
ThirdCategoryName string `json:"thirdCategoryName"`
CreatedAt time.Time `json:"createdAt"`
}
type ReplySkuAuditLists struct {
@ -50,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
}
@ -62,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 {
@ -74,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