Documentation ¶
Index ¶
- Constants
- Variables
- func GetFreeShipLabel(freeShipType string) string
- func StringSliceIsContain(slice []string, str string) bool
- type APIClient
- type Banner
- type BannerService
- func (s *BannerService) AddBanner(label, icon, bannerType, webPage, position string, weight, targetID int) error
- func (s *BannerService) DeleteBanner(bannerID int) error
- func (s *BannerService) GetBanner(bannerID int) (*Banner, error)
- func (s *BannerService) ListAllBanner() ([]Banner, error)
- func (s *BannerService) ListBannerByBannerType(bannerType string) ([]Banner, error)
- func (s *BannerService) ListBannerByPosition(position string) ([]Banner, error)
- func (s *BannerService) UpdateBanner(bannerID int, label, icon, bannerType, webPage string, weight, targetID int) error
- type Cart
- type Category
- type CategoryService
- func (s *CategoryService) AddCategory(c *Category) error
- func (s *CategoryService) DeleteCategory(CategoryID int) error
- func (s *CategoryService) GetCategory(CategoryID int) (*Category, error)
- func (s *CategoryService) ListCategory() ([]Category, error)
- func (s *CategoryService) UpdateCategory(c *Category) error
- type Coupon
- type CouponService
- func (s *CouponService) AddCoupon(c *Coupon) error
- func (s *CouponService) AddUserCoupon(userID, couponID int) error
- func (s *CouponService) DeleteCoupon(couponID int) error
- func (s *CouponService) GetCoupon(couponID int) (*Coupon, error)
- func (s *CouponService) GetUserCoupon(userCouponID int) (*UserCoupon, error)
- func (s *CouponService) ListAllCoupon(used string, offset, limit int) ([]UserCoupon, int, error)
- func (s *CouponService) ListCoupon() ([]Coupon, error)
- func (s *CouponService) ListUserCoupon(userID int) ([]UserCoupon, error)
- func (s *CouponService) RefundUserCoupon(userCouponID int) error
- func (s *CouponService) UpdateCoupon(c *Coupon) error
- func (s *CouponService) UseUserCoupon(userCouponID int, orderID string) error
- type Goods
- type GoodsAttr
- type GoodsImage
- type GoodsService
- func (s *GoodsService) AddGoods(g *Goods) (int, error)
- func (s *GoodsService) AddGoodsAttr(c *GoodsAttr) error
- func (s *GoodsService) AddGoodsImage(g *GoodsImage) error
- func (s *GoodsService) AddGoodsSaleCount(goodsID, count int) error
- func (s *GoodsService) AddGoodsSpec(c *GoodsSpec) error
- func (s *GoodsService) DeleteGoods(goodsID int) error
- func (s *GoodsService) DeleteGoodsAttr(attrID int) error
- func (s *GoodsService) DeleteGoodsImage(imageID int) error
- func (s *GoodsService) DeleteGoodsSpec(goodsID int) error
- func (s *GoodsService) GetGoods(goodsID int) (*Goods, error)
- func (s *GoodsService) GetGoodsAttr(attrID int) (*GoodsAttr, error)
- func (s *GoodsService) GetGoodsDetail(goodsID int) (*Goods, error)
- func (s *GoodsService) GetGoodsSpec(specID int) (*GoodsSpec, error)
- func (s *GoodsService) ListAllGoods(offset, limit int, goodsType string) ([]Goods, int, error)
- func (s *GoodsService) ListAllGoodsBySearchKey(searchKey, status, goodsType, goodsKind string, category, offset, limit int) ([]Goods, int, error)
- func (s *GoodsService) ListAllGoodsImage() ([]GoodsImage, error)
- func (s *GoodsService) ListGoods(goodsType, goodsStatus, goodsKind string, offset, limit int) ([]Goods, int, error)
- func (s *GoodsService) ListGoodsAttr(goodsID int) ([]GoodsAttr, error)
- func (s *GoodsService) ListGoodsByAgent() ([]Goods, error)
- func (s *GoodsService) ListGoodsByCategory(categoryID, offset, limit int, goodsType string) ([]Goods, int, error)
- func (s *GoodsService) ListGoodsByFlash(offset, limit int, goodsType string) ([]Goods, int, error)
- func (s *GoodsService) ListGoodsByHot(offset, limit int, goodsType string) ([]Goods, int, error)
- func (s *GoodsService) ListGoodsByID(goodsID string) ([]Goods, error)
- func (s *GoodsService) ListGoodsBySearchKey(searchKey, goodsType string, offset, limit int) ([]Goods, int, error)
- func (s *GoodsService) ListGoodsImage(goodsID int) ([]GoodsImage, error)
- func (s *GoodsService) ListGoodsImageByType(goodsID int, imageType string) ([]GoodsImage, error)
- func (s *GoodsService) ListGoodsSpec(goodsID int) ([]GoodsSpec, error)
- func (s *GoodsService) ListOnSaleGoods(offset, limit int, goodsType string) ([]Goods, int, error)
- func (s *GoodsService) ListSpecGoodsByID(goodsID ...int) ([]Goods, error)
- func (s *GoodsService) LockGoodsStock(goodsID, count int) error
- func (s *GoodsService) OfflineGoods(goodsID int) error
- func (s *GoodsService) OnlineGoods(goodsID int) error
- func (s *GoodsService) SetGoodsKind(goodsID int, isHot, isFlash, isAgentGift bool, ...) error
- func (s *GoodsService) SubGoodsSaleCount(goodsID, count int) error
- func (s *GoodsService) UnLockGoodsStock(goodsID, count int) error
- func (s *GoodsService) UpdateCommission(goodsID int, hasCommission bool, fatherPercent, grandpaPercent float32) error
- func (s *GoodsService) UpdateGoods(g *Goods) error
- func (s *GoodsService) UpdateGoodsAttr(c *GoodsAttr) error
- func (s *GoodsService) UpdateGoodsImageHeightAndWidth(imageID int, height, width int) error
- func (s *GoodsService) UpdateGoodsImageWeight(imageID int, weight int) error
- func (s *GoodsService) UpdateGoodsSpec(goodsSpec *GoodsSpec) error
- func (s *GoodsService) UpdateGoodsSpecBySlice(goodsID int, goodsSpecs []GoodsSpec) error
- type GoodsSpec
- type Order
- type OrderItem
- type OrderLog
- type OrderPayment
- type OrderProgress
- type OrderService
- func (s *OrderService) AddCart(c *Cart) error
- func (s *OrderService) AddCartCount(c *Cart) error
- func (s *OrderService) AddOrderProgress(order *OrderProgress) error
- func (s *OrderService) AddOrderShip(order *OrderShip) error
- func (s *OrderService) AddPayment(userID int, orderID string, totalFee float32, ...) error
- func (s *OrderService) CancelOrder(orderID string) error
- func (s *OrderService) CompletedOrder(orderID string) error
- func (s *OrderService) CreateOrderByCart(userID, fatherID, grandpaID int, isVip bool, ...) (string, error)
- func (s *OrderService) CreateOrderByGoods(userID, fatherID, grandpaID int, isVip bool, goodsID, specID, count int, ...) (string, error)
- func (s *OrderService) DeleteAllCart(userID int) error
- func (s *OrderService) DeleteCart(cartID int) error
- func (s *OrderService) DeleteSelectedCart(userID int) error
- func (s *OrderService) GenerateOrderID() (string, error)
- func (s *OrderService) GetCart(cartID int) (*Cart, error)
- func (s *OrderService) GetOrder(orderID string) (*Order, error)
- func (s *OrderService) GetOrderDetail(orderID string) (*Order, error)
- func (s *OrderService) GetOrderShip(orderID string) (*OrderShip, error)
- func (s *OrderService) GetPayChannelLabel(payChannel string) string
- func (s *OrderService) GetPayment(orderID, payChannel string) (*OrderPayment, error)
- func (s *OrderService) HasPayedGiftOrder(userID int) (bool, error)
- func (s *OrderService) IsExsitPayment(orderID, payChannel string) (bool, error)
- func (s *OrderService) KeepAdminRemark(orderID, adminName, adminRemark string, adminID int) error
- func (s *OrderService) ListAllCreatedPaymentOrder() ([]Order, error)
- func (s *OrderService) ListAllOrder(orderType, orderState, payState, shipState, orderID, mobile string, ...) ([]Order, int, error)
- func (s *OrderService) ListCart(userID int) ([]Cart, error)
- func (s *OrderService) ListOrder(userID, offset, limit int) ([]Order, int, error)
- func (s *OrderService) ListOrderDetail(userID, offset, limit int) ([]Order, int, error)
- func (s *OrderService) ListOrderItem(orderID string) ([]OrderItem, error)
- func (s *OrderService) ListOrderItemByOrderIDs(orderIDs []string) ([]OrderItem, error)
- func (s *OrderService) ListOrderLogs(orderID string) ([]OrderLog, error)
- func (s *OrderService) ListOrderPaymentByOrderIDs(orderIDs []string) ([]OrderPayment, error)
- func (s *OrderService) ListOrderProgress(orderID string) ([]OrderProgress, error)
- func (s *OrderService) ListOrderShipByOrderIDs(orderIDs []string) ([]OrderShip, error)
- func (s *OrderService) ListPayment(orderID string) ([]OrderPayment, error)
- func (s *OrderService) ListSelectedCart(userID int) ([]Cart, error)
- func (s *OrderService) NoRefundOrder(orderID, refundAdminRemark, payChannel string, adminUserID int, ...) error
- func (s *OrderService) PayOrder(orderID, payChannel, bankType, transactionID string) error
- func (s *OrderService) RefundOrder(orderID, refundAdminRemark, outRefundNo, payChannel string, refundFee float32, ...) error
- func (s *OrderService) RefundingOrder(orderID, refundUserRemark string) error
- func (s *OrderService) ReviewOrderByCart(userID int, isVip bool) ([]OrderItem, UserCouponList, error)
- func (s *OrderService) ReviewOrderByGoods(userID int, isVip bool, goodsID, specID, count int) (*OrderItem, UserCouponList, error)
- func (s *OrderService) SelectedAllCart(userID int) error
- func (s *OrderService) SelectedCart(cartID int) error
- func (s *OrderService) SendOrder(orderID, shipType, shipCompany, shipCode string, adminUserID int, ...) error
- func (s *OrderService) SubCartCount(c *Cart) error
- func (s *OrderService) UnSelectedAllCart(userID int) error
- func (s *OrderService) UnSelectedCart(cartID int) error
- func (s *OrderService) UpdateCart(c *Cart) error
- func (s *OrderService) UpdateOrderShipCompleted(orderID string) error
- func (s *OrderService) UpdateOrderShipIsSend(orderID string) error
- func (s *OrderService) UpdateOrderShipWaitSend(orderID string) error
- func (s *OrderService) ValiateOrderLimit(userID, goodsID, count int) error
- type OrderShip
- type Ship
- type ShipService
- func (s *ShipService) AddShip(sh *Ship) error
- func (s *ShipService) DeleteShip(shipID int) error
- func (s *ShipService) GetShip(shipID int) (*Ship, error)
- func (s *ShipService) GetShipByProvinceCode(provinceCode string) (*Ship, error)
- func (s *ShipService) ListShip() ([]Ship, error)
- func (s *ShipService) UpdateShip(shipID int, shipPrice, freeShipPrice float32, freeShipType string, ...) error
- type Spec
- type Special
- type SpecialGoods
- type SpecialService
- func (s *SpecialService) AddSpecial(label, zoomImg, coverImg, specialType, description string, ...) (int, error)
- func (s *SpecialService) AddSpecialGoods(specialID, goodsID int, label, icon, description string, ...) error
- func (s *SpecialService) DeleteSpecial(specialID int) error
- func (s *SpecialService) DeleteSpecialGoods(specialGoodsID int) error
- func (s *SpecialService) GetSpecial(specialID int) (*Special, error)
- func (s *SpecialService) GetSpecialGoodsByID(specialGoodsID int) (*SpecialGoods, error)
- func (s *SpecialService) ListAllSpecial() ([]Special, error)
- func (s *SpecialService) ListSpecial() ([]Special, error)
- func (s *SpecialService) ListSpecialGoods(specialID, offset, limit int) ([]SpecialGoods, int, error)
- func (s *SpecialService) UpdateSpecial(specialID int, label, zoomImg, coverImg, description string, ...) error
- func (s *SpecialService) UpdateSpecialGoods(specialGoodsID int, label, icon, description string, weight, width, height int) error
- type Supplier
- type SupplierService
- func (s *SupplierService) AddSupplier(su *Supplier) error
- func (s *SupplierService) DeleteSupplier(supplierID int) error
- func (s *SupplierService) GetSupplier(supplierID int) (*Supplier, error)
- func (s *SupplierService) ListSupplier() ([]Supplier, error)
- func (s *SupplierService) UpdateSupplier(su *Supplier) error
- type UserCoupon
- type UserCouponList
Constants ¶
const ( // BannerTypeNormal 普通类型 BannerTypeNormal = "NORMAL" // BannerTypeActivity 活动类型 BannerTypeActivity = "ACTIVITY" // BannerTypeSpecial 专题类型 BannerTypeSpecial = "SPECIAL" // BannerTypeCategory 分类类型 BannerTypeCategory = "CATEGORY" // BannerTypeWebpage 网页类型 BannerTypeWebpage = "WEBPAGE" // BannerTypeImage 图片类型 BannerTypeImage = "IMAGE" // BannerPositionIndex banner的显示位置,INDEX首页 BannerPositionIndex = "INDEX" // BannerPositionActivity banner的显示位置,ACTIVITY首页 BannerPositionActivity = "ACTIVITY" )
const ( // GoodsStatusOnline 已上线 GoodsStatusOnline = "ONLINE" // GoodsStatusOffline 未上线 GoodsStatusOffline = "OFFLINE" // GoodsStatusDelete 已删除无效 GoodsStatusDelete = "DELETE" )
const ( // ImageTypeBanner 轮播图 ImageTypeBanner = "BANNER" // ImageTypeInfo 详情图 ImageTypeInfo = "INFO" )
const ( // OrderTypeNormal 常规订单类型 OrderTypeNormal = "NORMAL" // OrderStateNormal 正常订单状态 OrderStateNormal = "NORMAL" // OrderStateCompleted 已完成订单状态 OrderStateCompleted = "COMPLETED" // OrderStateDeleted 已删除订单状态 OrderStateDeleted = "DELETED" // PayStateWaitPay 订单等待支付 PayStateWaitPay = "WAIT_PAY" // PayStateCompleted 订单支付完成 PayStateCompleted = "COMPLETED" // PayStateCanceled 订单已取消 PayStateCanceled = "CANCELED" // PayStateRefunding 订单申请退款中 PayStateRefunding = "REFUNDING" // PayStateRefunded 订单已退款 PayStateRefunded = "REFUNDED" // ShipStateNone 无物流 ShipStateNone = "NONE" // ShipStateWaitSend 等待发货 ShipStateWaitSend = "WAIT_SEND" // ShipStateIsSend 已发货 ShipStateIsSend = "IS_SEND" // ShipStateCompleted 已完成 ShipStateCompleted = "COMPLETED" // ShipStateCanceled 已取消 ShipStateCanceled = "CANCELED" )
const ( // PayChannelAlipay 支付宝支付渠道 PayChannelAlipay = "ALIPAY" // PayChannelWeixin 微信支付渠道 PayChannelWeixin = "WEIXIN" )
const ( // OrderShipNone 无物流 OrderShipNone = "NONE" // OrderShipWaitSend 等待发货 OrderShipWaitSend = "WAIT_SEND" // OrderShipIsSend 已发货 OrderShipIsSend = "IS_SEND" // OrderShipCompleted 已签收 OrderShipCompleted = "COMPLETED" )
const ( // FreeShipNone 不包邮 FreeShipNone = "NONE" // FreeShipCount 购满数量包邮 FreeShipCount = "COUNT" // FreeShipPrice 购满金额包邮 FreeShipPrice = "PRICE" )
const ( // SpecialTypeGoods 商品列表类型 SpecialTypeGoods = "GOODS" // SpecialTypeDesign 设计图片的类型 SpecialTypeDesign = "DESIGN" )
const ( // CouponNORMAL 未使用 CouponNORMAL = "NORMAL" // CouponCOMPLETED 已使用 CouponCOMPLETED = "COMPLETED" )
const (
// CouponGoodsAll 全场优惠券
CouponGoodsAll = "ALL"
)
const (
// GoodsTypeNormal 普通商品类型
GoodsTypeNormal = "NORMAL"
)
Variables ¶
var ( // ErrorGoodsLowStocks 商品库存不足通用错误码 ErrorGoodsLowStocks = errors.New("商品库存不足") // ErrOrderNightLimitCount 秀丽东方之夜订单超限 ErrOrderNightLimitCount = errors.New("超出订单限制") // ErrOrderNightLimitTime 秀丽东方之夜订单超出开售停售时间限制 ErrOrderNightLimitTime = errors.New("超出入场券开售停售时间限制") // ErrorNoFreeGoodsVoucher 不是0元代金券 ErrorNoFreeGoodsVoucher = errors.New("不是0元代金券") )
Functions ¶
Types ¶
type APIClient ¶
type APIClient struct { DB *sqlx.DB // 数据库链接实例 Goods *GoodsService // 专门处理商品相关接口 Order *OrderService // 专门处理订单的服务 Special *SpecialService // 专门处理专题的服务 Category *CategoryService // 专门处理分类的服务 Supplier *SupplierService // 专门处理提供商的服务 Banner *BannerService // 专门处理Banner相关的服务 Coupon *CouponService // 专门处理Banner相关的服务 Ship *ShipService // 专门处理物流相关的服务 // contains filtered or unexported fields }
APIClient 的所有变量
type Banner ¶
type Banner struct { BannerID int `json:"bannerID,omitempty" db:"banner_id"` // banner自增ID Active bool `json:"active,omitempty" db:"active"` // 是否有效 Label string `json:"label,omitempty" db:"label"` // 名称 Icon string `json:"icon,omitempty" db:"icon"` // 封面图 BannerType string `json:"bannerType,omitempty" db:"banner_type"` // 跳转类型,ACTIVITY活动详情,SPECIAL专题,WEBPAGE网页 WebPage string `json:"webPage,omitempty" db:"web_page"` // 选填,目标网页地址 TargetID int `json:"targetID,omitempty" db:"target_id"` // 选填,目标ID Position string `json:"position,omitempty" db:"position"` // 位置,INDEX首页 Weight int `json:"weight,omitempty" db:"weight"` // 权重,数字越大越靠前 CreateTime time.Time `json:"createTime,omitempty" db:"create_time"` // 创建时间 UpdateTime time.Time `json:"updateTime,omitempty" db:"update_time"` // 更新时间 }
Banner 系统广告结构体
type BannerService ¶
type BannerService service
BannerService 专门处理Banner相关的服务
func (*BannerService) AddBanner ¶
func (s *BannerService) AddBanner(label, icon, bannerType, webPage, position string, weight, targetID int) error
AddBanner 添加banner
func (*BannerService) DeleteBanner ¶
func (s *BannerService) DeleteBanner(bannerID int) error
DeleteBanner 删除banner
func (*BannerService) GetBanner ¶
func (s *BannerService) GetBanner(bannerID int) (*Banner, error)
GetBanner 获取指定banner
func (*BannerService) ListAllBanner ¶
func (s *BannerService) ListAllBanner() ([]Banner, error)
ListAllBanner 列出所有有效banner
func (*BannerService) ListBannerByBannerType ¶
func (s *BannerService) ListBannerByBannerType(bannerType string) ([]Banner, error)
ListBannerByBannerType 列出指定类型的banner
func (*BannerService) ListBannerByPosition ¶
func (s *BannerService) ListBannerByPosition(position string) ([]Banner, error)
ListBannerByPosition 列出指定位置的banner
type Cart ¶
type Cart struct { CartID int `json:"cartID" db:"cart_id"` // 表ID Active bool `json:"active" db:"active"` // 是否可用 Selected bool `json:"selected" db:"selected"` // 是否选中 Count int `json:"count" db:"count"` // 数量 UserID int `json:"userID" db:"user_id"` // 用户ID GoodsID int `json:"goodsID" db:"goods_id"` // 商品ID ZoomImg string `json:"zoomImg" db:"zoom_img"` // 缩放图 GoodsLabel string `json:"goodsLabel" db:"goods_label"` // 商品名称 SpecID int `json:"specID" db:"spec_id"` // 规格ID,0代表没有规格 SpecLabel string `json:"specLabel" db:"spec_label"` // 规格名称,下划线分割,例如:红色_L CreateTime time.Time `json:"createTime" db:"create_time"` // 创建时间 UpdateTime time.Time `json:"updateTime" db:"update_time"` // 更新时间 MarketPrice float32 `json:"marketPrice,omitempty"` // 市场价,不作为购买价格 ShopPrice float32 `json:"shopPrice,omitempty"` // 购买价 VipPrice float32 `json:"vipPrice,omitempty"` // VIP价 }
Cart 购物车
type Category ¶
type Category struct { CategoryID int `json:"categoryID,omitempty" db:"category_id"` // 商品分类ID Active bool `json:"active,omitempty" db:"active"` // 是否可用 ParentID int `json:"parentID,omitempty" db:"parent_id"` // 父级分类ID Level int `json:"level,omitempty" db:"level"` // 分类等级,最多为3 Label string `json:"label,omitempty" db:"label"` // 名称 ZoomImg string `json:"zoomImg,omitempty" db:"zoom_img"` // 缩略图 CoverImg string `json:"coverImg,omitempty" db:"cover_img"` // 封面图 Weight int `json:"weight,omitempty" db:"weight"` // 权重,数字越大越靠前 CreateTime time.Time `json:"createTime,omitempty" db:"create_time"` // 创建时间 UpdateTime time.Time `json:"updateTime,omitempty" db:"update_time"` // 更新时间 }
Category 商品分类
type CategoryService ¶
type CategoryService service
CategoryService 专门处理分类相关服务
func (*CategoryService) AddCategory ¶
func (s *CategoryService) AddCategory(c *Category) error
AddCategory 添加活动商品分类
func (*CategoryService) DeleteCategory ¶
func (s *CategoryService) DeleteCategory(CategoryID int) error
DeleteCategory 删除商品分类
func (*CategoryService) GetCategory ¶
func (s *CategoryService) GetCategory(CategoryID int) (*Category, error)
GetCategory 获取指定商品分类
func (*CategoryService) ListCategory ¶
func (s *CategoryService) ListCategory() ([]Category, error)
ListCategory 列出所有有效商品分类,按照权重和创建开始时间排序
func (*CategoryService) UpdateCategory ¶
func (s *CategoryService) UpdateCategory(c *Category) error
UpdateCategory 更新商品分类信息
type Coupon ¶
type Coupon struct { CouponID int `json:"couponID" db:"coupon_id"` // 优惠券ID Active bool `json:"active" db:"active"` // 是否可用 Label string `json:"label" db:"label"` // 优惠券名称 GoodsID string `json:"goodsID" db:"goods_id"` // 商品ID,以下划线分割,ALL代表全场 Money float32 `json:"money" db:"money"` // 优惠券金额 Requirement float32 `json:"requirement" db:"requirement"` // 优惠券使用条件 ZoomImg string `json:"zoomImg" db:"zoom_img"` // 缩放图 CoverImg string `json:"coverImg" db:"cover_img"` // 封面图 ReceiveCount int `json:"receiveCount" db:"receive_count"` // 已领取的数量 RemainCount int `json:"remainCount" db:"remain_count"` // 库存 UseCount int `json:"useCount" db:"use_count"` // 已使用的数量 OnSendTime time.Time `json:"onSendTime" db:"on_send_time"` // 发放开始时间 OffSendTime time.Time `json:"offSendTime" db:"off_send_time"` // 发放结束时间 OnUseTime time.Time `json:"onUseTime" db:"on_use_time"` // 使用开始时间 OffUseTime time.Time `json:"offUseTime" db:"off_use_time"` // 使用结束时间 ReceiveLimit int `json:"receiveLimit" db:"receive_limit"` // 单人领取上限:-1表示无限制,大于0表示单人可领取的上限 CreateTime time.Time `json:"createTime" db:"create_time"` // 创建时间 UpdateTime time.Time `json:"updateTime" db:"update_time"` // 更新时间 }
Coupon 优惠券
type CouponService ¶
type CouponService service
CouponService 专门处理优惠券相关服务
func (*CouponService) AddCoupon ¶
func (s *CouponService) AddCoupon(c *Coupon) error
AddCoupon 添加活动优惠券
func (*CouponService) AddUserCoupon ¶
func (s *CouponService) AddUserCoupon(userID, couponID int) error
AddUserCoupon 领取优惠券,并减少库存,增加领取量
func (*CouponService) DeleteCoupon ¶
func (s *CouponService) DeleteCoupon(couponID int) error
DeleteCoupon 删除优惠券
func (*CouponService) GetCoupon ¶
func (s *CouponService) GetCoupon(couponID int) (*Coupon, error)
GetCoupon 获取指定优惠券
func (*CouponService) GetUserCoupon ¶
func (s *CouponService) GetUserCoupon(userCouponID int) (*UserCoupon, error)
GetUserCoupon 获取指定用户优惠券
func (*CouponService) ListAllCoupon ¶
func (s *CouponService) ListAllCoupon(used string, offset, limit int) ([]UserCoupon, int, error)
ListAllCoupon 列出所有指定状态优惠券
func (*CouponService) ListCoupon ¶
func (s *CouponService) ListCoupon() ([]Coupon, error)
ListCoupon 列出所有有效优惠券,创建开始时间排序
func (*CouponService) ListUserCoupon ¶
func (s *CouponService) ListUserCoupon(userID int) ([]UserCoupon, error)
ListUserCoupon 列出所有未使用用户优惠券,有效结束时间排序
func (*CouponService) RefundUserCoupon ¶
func (s *CouponService) RefundUserCoupon(userCouponID int) error
RefundUserCoupon 返还优惠券,减少优惠券使用量
func (*CouponService) UpdateCoupon ¶
func (s *CouponService) UpdateCoupon(c *Coupon) error
UpdateCoupon 更新优惠券信息
func (*CouponService) UseUserCoupon ¶
func (s *CouponService) UseUserCoupon(userCouponID int, orderID string) error
UseUserCoupon 使用优惠券,增加优惠券使用量
type Goods ¶
type Goods struct { GoodsID int `json:"goodsID,omitempty" db:"goods_id"` // 商品ID SKU string `json:"sku,omitempty" db:"sku"` // 等于条码,无规格时,该SKU生效,有规格时,使用规格中的SKU,该值无效 GoodsStatus string `json:"goodsStatus,omitempty" db:"goods_status"` // 商品状态,ONLINE已上线,OFFLINE未上线,DELETE已删除无效 GoodsType string `json:"goodsType,omitempty" db:"goods_type"` // 商品类型,NORMAL普通商品,扩展商品有自己的类型,如TICKET、VOUCHER Label string `json:"label,omitempty" db:"label"` // 商品名称 SubLabel string `json:"subLabel,omitempty" db:"sub_label"` // 商品副标题 ZoomImg string `json:"zoomImg,omitempty" db:"zoom_img"` // 缩略图 CoverImg string `json:"coverImg,omitempty" db:"cover_img"` // 封面图 MarketPrice float32 `json:"marketPrice,omitempty" db:"market_price"` // 市场价,不作为购买价格 ShopPrice float32 `json:"shopPrice,omitempty" db:"shop_price"` // 购买价 VipPrice float32 `json:"vipPrice,omitempty" db:"vip_price"` // VIP价 SaleCount int `json:"saleCount,omitempty" db:"sale_count"` // 总销量 RemainCount int `json:"remainCount,omitempty" db:"remain_count"` // 剩余库存数量 CreateTime time.Time `json:"createTime,omitempty" db:"create_time"` // 创建时间 UpdateTime time.Time `json:"updateTime,omitempty" db:"update_time"` // 更新时间 LatestSaleTime time.Time `json:"latestSaleTime,omitempty" db:"latest_sale_time"` // 最近一次上架时间 OnSaleTime time.Time `json:"onSaleTime,omitempty" db:"on_sale_time"` // 开始购买时间 OffSaleTime time.Time `json:"offSaleTime,omitempty" db:"off_sale_time"` // 结束购买时间 SupplierID int `json:"supplierID,omitempty" db:"supplier_id"` // 供应商ID CategoryID int `json:"categoryID,omitempty" db:"category_id"` // 商品分类ID HasSpec bool `json:"hasSpec,omitempty" db:"has_spec"` // 是否有规格 CanCoupon bool `json:"canCoupon,omitempty" db:"can_coupon"` // 是否可使用优惠券 OrderLimit int `json:"orderLimit,omitempty" db:"order_limit"` // 单人购买上限,-1表示无限制,大于0表示单人可购买的上限 CanShip bool `json:"canShip,omitempty" db:"can_ship"` // 是否可支持物流或自提 IsShow bool `json:"isShow,omitempty" db:"is_show"` // 是否支持在列表中显示 Weight int `json:"weight,omitempty" db:"weight"` // 权重,默认为1,越大排序越靠前 IsHot bool `json:"isHot,omitempty" db:"is_hot"` // 是否热销 IsFlash bool `json:"isFlash,omitempty" db:"is_flash"` // 是否秒杀 IsCrossBorder bool `json:"isCrossBorder" db:"is_cross_border"` // 是否跨境商品 IsAgentGift bool `json:"isAgentGift" db:"is_agent_gift"` // 是否是礼包 HasCommission bool `json:"hasCommission" db:"has_commission"` // 是否有提成 FatherPercent float32 `json:"fatherPercent" db:"father_percent"` // 父级提成百分比 GrandpaPercent float32 `json:"grandpaPercent" db:"grandpa_percent"` // 爷爷级提成百分比 GoodsSpecs []GoodsSpec `json:"goodsSpecs,omitempty"` // 商品规格 Specs []Spec `json:"specs,omitempty"` // 商品规格 BannerImages []GoodsImage `json:"bannerImages,omitempty"` // 轮播商品图 InfoImages []GoodsImage `json:"infoImages,omitempty"` // 详情商品图 Attrs []GoodsAttr `json:"attrs,omitempty"` // 商品详情 }
Goods 商品结构体,包括活动、服务、货物
type GoodsAttr ¶
type GoodsAttr struct { AttrID int `json:"attrID" db:"attr_id"` // 属性ID Active bool `json:"active" db:"active"` // 是否可用 GoodsID int `json:"goodsID" db:"goods_id"` // 商品ID AttrKey string `json:"attrKey" db:"attr_key"` // 属性名 AttrValue string `json:"attrValue" db:"attr_value"` // 属性值 Weight int `json:"weight" db:"weight"` // 权重,默认1,越大越靠前 CreateTime time.Time `json:"createTime" db:"create_time"` UpdateTime time.Time `json:"updateTime" db:"update_time"` }
GoodsAttr 商品属性
type GoodsImage ¶
type GoodsImage struct { ImageID int `json:"imageID,omitempty" db:"image_id"` // 相片id Active bool `json:"active,omitempty" db:"active"` // 是否可用 GoodsID int `json:"goodsID,omitempty" db:"goods_id"` // 商品id ImageType string `json:"imageType,omitempty" db:"image_type"` // 图片类型 Icon string `json:"icon,omitempty" db:"icon"` // 地址 Weight int `json:"weight,omitempty" db:"weight"` // 权重,数字越大越靠前 Width int `json:"width,omitempty" db:"width"` // 宽度 Height int `json:"height,omitempty" db:"height"` // 高度 CreateTime time.Time `json:"createTime" db:"create_time"` UpdateTime time.Time `json:"updateTime" db:"update_time"` }
GoodsImage 商品图片详情
type GoodsService ¶
type GoodsService service
GoodsService 专门处理商品的服务
func (*GoodsService) AddGoods ¶
func (s *GoodsService) AddGoods(g *Goods) (int, error)
AddGoods 添加商品
func (*GoodsService) AddGoodsAttr ¶
func (s *GoodsService) AddGoodsAttr(c *GoodsAttr) error
AddGoodsAttr 添加商品属性
func (*GoodsService) AddGoodsImage ¶
func (s *GoodsService) AddGoodsImage(g *GoodsImage) error
AddGoodsImage 添加商品图片
func (*GoodsService) AddGoodsSaleCount ¶
func (s *GoodsService) AddGoodsSaleCount(goodsID, count int) error
AddGoodsSaleCount 增加商品销量
func (*GoodsService) AddGoodsSpec ¶
func (s *GoodsService) AddGoodsSpec(c *GoodsSpec) error
AddGoodsSpec 添加商品规格
func (*GoodsService) DeleteGoods ¶
func (s *GoodsService) DeleteGoods(goodsID int) error
DeleteGoods 删除商品
func (*GoodsService) DeleteGoodsAttr ¶
func (s *GoodsService) DeleteGoodsAttr(attrID int) error
DeleteGoodsAttr 删除商品属性
func (*GoodsService) DeleteGoodsImage ¶
func (s *GoodsService) DeleteGoodsImage(imageID int) error
DeleteGoodsImage 删除商品图片
func (*GoodsService) DeleteGoodsSpec ¶
func (s *GoodsService) DeleteGoodsSpec(goodsID int) error
DeleteGoodsSpec 删除商品规格
func (*GoodsService) GetGoods ¶
func (s *GoodsService) GetGoods(goodsID int) (*Goods, error)
GetGoods 通过商品ID获取商品信息
func (*GoodsService) GetGoodsAttr ¶
func (s *GoodsService) GetGoodsAttr(attrID int) (*GoodsAttr, error)
GetGoodsAttr 获取指定商品属性
func (*GoodsService) GetGoodsDetail ¶
func (s *GoodsService) GetGoodsDetail(goodsID int) (*Goods, error)
GetGoodsDetail 获取商品详情
func (*GoodsService) GetGoodsSpec ¶
func (s *GoodsService) GetGoodsSpec(specID int) (*GoodsSpec, error)
GetGoodsSpec 获取指定商品规格
func (*GoodsService) ListAllGoods ¶
ListAllGoods 分页列出所有有效商品
func (*GoodsService) ListAllGoodsBySearchKey ¶
func (s *GoodsService) ListAllGoodsBySearchKey(searchKey, status, goodsType, goodsKind string, category, offset, limit int) ([]Goods, int, error)
ListAllGoodsBySearchKey 分页列出指定商品
func (*GoodsService) ListAllGoodsImage ¶
func (s *GoodsService) ListAllGoodsImage() ([]GoodsImage, error)
ListAllGoodsImage 列出所有图片
func (*GoodsService) ListGoods ¶
func (s *GoodsService) ListGoods(goodsType, goodsStatus, goodsKind string, offset, limit int) ([]Goods, int, error)
ListGoods 分页列出所有有效商品
func (*GoodsService) ListGoodsAttr ¶
func (s *GoodsService) ListGoodsAttr(goodsID int) ([]GoodsAttr, error)
ListGoodsAttr 列出所有有效商品属性,权重排序
func (*GoodsService) ListGoodsByAgent ¶
func (s *GoodsService) ListGoodsByAgent() ([]Goods, error)
ListGoodsByAgent 列出所有代理礼包商品
func (*GoodsService) ListGoodsByCategory ¶
func (s *GoodsService) ListGoodsByCategory(categoryID, offset, limit int, goodsType string) ([]Goods, int, error)
ListGoodsByCategory 分页列出指定分类商品
func (*GoodsService) ListGoodsByFlash ¶
ListGoodsByFlash 分页列出秒杀商品
func (*GoodsService) ListGoodsByHot ¶
ListGoodsByHot 分页列出热销商品
func (*GoodsService) ListGoodsByID ¶
func (s *GoodsService) ListGoodsByID(goodsID string) ([]Goods, error)
ListGoodsByID 查询多商品
func (*GoodsService) ListGoodsBySearchKey ¶
func (s *GoodsService) ListGoodsBySearchKey(searchKey, goodsType string, offset, limit int) ([]Goods, int, error)
ListGoodsBySearchKey 分页列出指定关键字的商品
func (*GoodsService) ListGoodsImage ¶
func (s *GoodsService) ListGoodsImage(goodsID int) ([]GoodsImage, error)
ListGoodsImage 列出指定商品图片,按权重和创建时间排序
func (*GoodsService) ListGoodsImageByType ¶
func (s *GoodsService) ListGoodsImageByType(goodsID int, imageType string) ([]GoodsImage, error)
ListGoodsImageByType 列出指定类型商品图片,按权重和创建时间排序
func (*GoodsService) ListGoodsSpec ¶
func (s *GoodsService) ListGoodsSpec(goodsID int) ([]GoodsSpec, error)
ListGoodsSpec 列出所有有效商品规格,创建时间排序
func (*GoodsService) ListOnSaleGoods ¶
ListOnSaleGoods 分页列出已上线有效商品
func (*GoodsService) ListSpecGoodsByID ¶
func (s *GoodsService) ListSpecGoodsByID(goodsID ...int) ([]Goods, error)
ListSpecGoodsByID 查询多商品
func (*GoodsService) LockGoodsStock ¶
func (s *GoodsService) LockGoodsStock(goodsID, count int) error
LockGoodsStock 减少指定商品的库存,当订单下单时触发
func (*GoodsService) OfflineGoods ¶
func (s *GoodsService) OfflineGoods(goodsID int) error
OfflineGoods 下架指定商品
func (*GoodsService) OnlineGoods ¶
func (s *GoodsService) OnlineGoods(goodsID int) error
OnlineGoods 上架指定商品
func (*GoodsService) SetGoodsKind ¶
func (s *GoodsService) SetGoodsKind(goodsID int, isHot, isFlash, isAgentGift bool, onSaleTime, offSaleTime time.Time) error
SetGoodsKind 设置商品类型
func (*GoodsService) SubGoodsSaleCount ¶
func (s *GoodsService) SubGoodsSaleCount(goodsID, count int) error
SubGoodsSaleCount 减少商品销量
func (*GoodsService) UnLockGoodsStock ¶
func (s *GoodsService) UnLockGoodsStock(goodsID, count int) error
UnLockGoodsStock 增加商品库存,当订单取消时触发
func (*GoodsService) UpdateCommission ¶
func (s *GoodsService) UpdateCommission(goodsID int, hasCommission bool, fatherPercent, grandpaPercent float32) error
UpdateCommission 更新商品的提成比例信息
func (*GoodsService) UpdateGoods ¶
func (s *GoodsService) UpdateGoods(g *Goods) error
UpdateGoods 更新商品信息
func (*GoodsService) UpdateGoodsAttr ¶
func (s *GoodsService) UpdateGoodsAttr(c *GoodsAttr) error
UpdateGoodsAttr 更新商品属性信息
func (*GoodsService) UpdateGoodsImageHeightAndWidth ¶
func (s *GoodsService) UpdateGoodsImageHeightAndWidth(imageID int, height, width int) error
UpdateGoodsImageHeightAndWidth 更新商品图片宽高
func (*GoodsService) UpdateGoodsImageWeight ¶
func (s *GoodsService) UpdateGoodsImageWeight(imageID int, weight int) error
UpdateGoodsImageWeight 更新商品图片权重
func (*GoodsService) UpdateGoodsSpec ¶
func (s *GoodsService) UpdateGoodsSpec(goodsSpec *GoodsSpec) error
UpdateGoodsSpec 更新单个商品
func (*GoodsService) UpdateGoodsSpecBySlice ¶
func (s *GoodsService) UpdateGoodsSpecBySlice(goodsID int, goodsSpecs []GoodsSpec) error
UpdateGoodsSpecBySlice 更新规格列表
type GoodsSpec ¶
type GoodsSpec struct { SpecID int `json:"specID,omitempty" db:"spec_id"` // 商品规格ID Active bool `json:"active,omitempty" db:"active"` // 是否可用 GoodsID int `json:"goodsID,omitempty" db:"goods_id"` // 商品ID Label string `json:"label,omitempty" db:"label"` // 规格名称,下划线分割,例如:红色_L LabelGroup string `json:"labelGroup,omitempty" db:"label_group"` // 规格组,下划线分割,例如:颜色_尺码 MarketPrice float32 `json:"marketPrice,omitempty" db:"market_price"` // 市场价,不作为购买价格 ShopPrice float32 `json:"shopPrice,omitempty" db:"shop_price"` // 购买价,作为购买时价格 VipPrice float32 `json:"vipPrice,omitempty" db:"vip_price"` // VIP价 RemainCount int `json:"remainCount,omitempty" db:"remain_count"` // 库存数量 SKU string `json:"sku,omitempty" db:"sku"` // 等于条码 CreateTime time.Time `json:"createTime,omitempty" db:"create_time"` UpdateTime time.Time `json:"updateTime,omitempty" db:"update_time"` }
GoodsSpec 商品规格
type Order ¶
type Order struct { OrderID string `json:"orderID,omitempty" db:"order_id"` // 订单ID UserID int `json:"userID,omitempty" db:"user_id"` // 用户ID OrderType string `json:"orderType,omitempty" db:"order_type"` // 订单类型,NORMAL,扩展订单,例如:TICKET、VOUCHER,扩展订单自己维护OrderItem OrderState string `json:"orderState,omitempty" db:"order_state"` // 订单整体状态,NORMAL正常,COMPLETED已完成,DELETED已删除 PayState string `json:"payState,omitempty" db:"pay_state"` // 订单支付状态,WAIT_PAY等待支付,COMPLETED支付完成,CANCELED已取消,REFUNDING退款中,REFUNDED已退款 ShipState string `json:"shipState,omitempty" db:"ship_state"` // 订单物流状态,NONE无物流,WAIT_SEND等待发货,IS_SEND已发货,COMPLETED已签收 OrderBody string `json:"orderBody,omitempty" db:"order_body"` // JSON:[{ItemID,GoodsID,ItemLabeL,ItemCount,ItemPrice,ItemImg}] Province string `json:"province,omitempty" db:"province"` // 省份编码 ProvinceName string `json:"provinceName,omitempty" db:"province_name"` // 省份 City string `json:"city,omitempty" db:"city"` // 城市编码 CityName string `json:"cityName,omitempty" db:"city_name"` // 城市 County string `json:"county,omitempty" db:"county"` // 区、镇编码 CountyName string `json:"countyName,omitempty" db:"county_name"` // 区、镇 Address string `json:"address,omitempty" db:"address"` // 详情地址 Contact string `json:"contact,omitempty" db:"contact"` // 联系人 MobileNumber string `json:"mobileNumber,omitempty" db:"mobile_number"` // 手机号 UserRemark string `json:"userRemark,omitempty" db:"user_remark"` // 用户备注 AdminRemark string `json:"adminRemark,omitempty" db:"admin_remark"` // 管理员备注 TotalFee float32 `json:"totalFee,omitempty" db:"total_fee"` // 订单总金额,商品总金额 UserCouponID int `json:"userCouponID,omitempty" db:"user_coupon_id"` // 使用的用户优惠券ID CouponFee float32 `json:"couponFee,omitempty" db:"coupon_fee"` // 优惠金额 ShipFee float32 `json:"shipFee,omitempty" db:"ship_fee"` // 订单运费 TotalPay float32 `json:"totalPay,omitempty" db:"total_pay"` // 实际支付金额 FeeRemark string `json:"feeRemark,omitempty" db:"fee_remark"` // 金额描述 PayTime time.Time `json:"payTime,omitempty" db:"pay_time"` // 支付时间 CreateTime time.Time `json:"createTime,omitempty" db:"create_time"` // 下单时间 UpdateTime time.Time `json:"updateTime,omitempty" db:"update_time"` // 更新时间 RealName string `json:"realName" db:"real_name"` // 真实姓名 IDCard string `json:"idCard" db:"id_card"` // 身份证 ExpiredTime time.Time `json:"expiredTime,omitempty" db:"expired_time"` // 失效时间 CompletedTime time.Time `json:"completedTime,omitempty" db:"completed_time"` // 订单完结时间 Items interface{} `json:"items,omitempty"` // 订单详情 Progresses []OrderProgress `json:"progresses,omitempty"` // 订单流程 OrderShip *OrderShip `json:"orderShip,omitempty"` // 物流信息 Payments []OrderPayment `json:"payments,omitempty"` // 支付信息 }
Order 订单
func (*Order) GetOrderStateLabel ¶
GetOrderStateLabel 获取订单状态中文描述
func (*Order) GetPayStateLabel ¶
GetPayStateLabel 获取支付状态中文描述
func (*Order) GetShipStateLabel ¶
GetShipStateLabel 获取物流状态中文描述
type OrderItem ¶
type OrderItem struct { ItemID int `json:"itemID,omitempty" db:"item_id"` // 详情ID OrderID string `json:"orderID,omitempty" db:"order_id"` // 订单ID UserID int `json:"userID,omitempty" db:"user_id"` // 用户ID GoodsID int `json:"goodsID,omitempty" db:"goods_id"` // 商品ID IsCrossBorder bool `json:"isCrossBorder,omitempty" db:"is_cross_border"` // 是否跨境商品 Count int `json:"count,omitempty" db:"count"` // 数量 SKU string `json:"sku,omitempty" db:"sku"` // sku GoodsType string `json:"goodsType,omitempty" db:"goods_type"` // 商品类型,NORMAL普通商品,扩展商品,例如:TICKET、VOUCHER Label string `json:"label,omitempty" db:"label"` // 商品名称 ZoomImg string `json:"zoomImg,omitempty" db:"zoom_img"` // 缩放图 CoverImg string `json:"coverImg,omitempty" db:"cover_img"` // 封面图 MarketPrice float32 `json:"marketPrice,omitempty" db:"market_price"` // 市场价,不作为购买价格 PayPrice float32 `json:"payPrice,omitempty" db:"pay_price"` // 购买价,作为购买时价格 SpecID int `json:"specID,omitempty" db:"spec_id"` // 商品规格ID,0代表无规格 SpecLabel string `json:"specLabel,omitempty" db:"spec_label"` // 规格名称,下划线分割,例如:红色_L SpecLabelGroup string `json:"specLabelGroup,omitempty" db:"spec_label_group"` // 规格组,下划线分割,例如:颜色_尺码 CreateTime time.Time `json:"createTime,omitempty" db:"create_time"` // 下单时间 UpdateTime time.Time `json:"updateTime,omitempty" db:"update_time"` // 更新时间 IsAgentGift bool `json:"isAgentGift" db:"is_agent_gift"` // 是否是代理礼包 HasCommission bool `json:"hasCommission" db:"has_commission"` // 是否有提成 FatherID int `json:"fatherID" db:"father_id"` // 父级ID FatherPercent float32 `json:"fatherPercent" db:"father_percent"` // 父级提成百分比 FatherIncome float32 `json:"fatherIncome" db:"father_income"` // 父级提成 GrandpaID int `json:"grandpaID" db:"grandpa_id"` // 爷爷级ID GrandpaPercent float32 `json:"grandpaPercent" db:"grandpa_percent"` // 爷爷级提成百分比 GrandpaIncome float32 `json:"grandpaIncome" db:"grandpa_income"` // 爷爷级提成 }
OrderItem 订单详情
type OrderLog ¶
type OrderLog struct { OrderID string `json:"orderID" db:"order_id"` // 订单ID AdminID int `json:"adminID" db:"admin_id"` // 管理员ID AdminName string `json:"adminName" db:"admin_name"` // 管理员名称 Content string `json:"content" db:"content"` // 操作明细 CreateTime time.Time `json:"createTime" db:"create_time"` // 创建时间 }
OrderLog 订单操作记录
type OrderPayment ¶
type OrderPayment struct { PaymentID int `json:"paymentID,omitempty" db:"payment_id"` // 支付记录id UserID int `json:"userID,omitempty" db:"user_id"` // 用户ID OrderID string `json:"orderID,omitempty" db:"order_id"` // 订单id PayState string `json:"payState,omitempty" db:"pay_state"` // 支付状态,WAIT_PAY:等待支付,COMPLETED:已支付,CANCELED:取消支付 TotalFee float32 `json:"totalFee,omitempty" db:"total_fee"` // 支付金额 BankType string `json:"bankType,omitempty" db:"bank_type"` // 银行编码 TransactionID string `json:"transactionID,omitempty" db:"transaction_id"` // 流水 PayChannel string `json:"payChannel,omitempty" db:"pay_channel"` // 支付渠道,ALIPAY:支付宝,WEIXIN:微信 PrepayID string `json:"prepayID,omitempty" db:"prepay_id"` // 渠道预支付ID ChannelUserID string `json:"channelUserID,omitempty" db:"channel_user_id"` // 渠道用户的id,微信的就是openid CreateTime time.Time `json:"createTime,omitempty" db:"create_time"` // 创建时间 UpdateTime time.Time `json:"updateTime,omitempty" db:"update_time"` // 更新时间 PayTime time.Time `json:"payTime,omitempty" db:"pay_time"` // 支付时间 OutRefundNo string `json:"outRefundNo" db:"out_refund_no"` // 商户退款单号 RefundFee int32 `json:"refundFee" db:"refund_fee"` // 退款金额 RefundTime time.Time `json:"refundTime" db:"refund_time"` // 退款时间 RefundAdminID int `json:"refundAdminID" db:"refund_admin_id"` // 退款操作员ID RefundAdminName string `json:"refundAdminName" db:"refund_admin_name"` // 退款操作员Name RefundUserRemark string `json:"refundUserRemark" db:"refund_user_remark"` // 用户申请退款原因 RefundAdminRemark string `json:"refundAdminRemark" db:"refund_admin_remark"` // 管理员处理结果 }
OrderPayment 订单支付信息结构体
type OrderProgress ¶
type OrderProgress struct { OrderID string `json:"orderID" db:"order_id"` Label string `json:"label" db:"label"` AdminUserID int `json:"adminUserID" db:"admin_user_id"` AdminUserName string `json:"adminUserName" db:"admin_user_name"` UserID int `json:"userID" db:"user_id"` UserName string `json:"userName" db:"user_name"` CreateTime time.Time `json:"createTime" db:"create_time"` // 上次查询时间,半小时内只调用一次API接口 }
OrderProgress 订单操作记录
type OrderService ¶
type OrderService service
OrderService 专门处理订单的服务
func (*OrderService) AddCartCount ¶
func (s *OrderService) AddCartCount(c *Cart) error
AddCartCount 增加购物车数量
func (*OrderService) AddOrderProgress ¶
func (s *OrderService) AddOrderProgress(order *OrderProgress) error
AddOrderProgress 订单操作记录
func (*OrderService) AddOrderShip ¶
func (s *OrderService) AddOrderShip(order *OrderShip) error
AddOrderShip 添加订单物流信息
func (*OrderService) AddPayment ¶
func (s *OrderService) AddPayment(userID int, orderID string, totalFee float32, payChannel, prepayID, channelUserID, userName string) error
AddPayment 添加一条支付信息,如果订单已经生成过支付信息,则覆盖
func (*OrderService) CancelOrder ¶
func (s *OrderService) CancelOrder(orderID string) error
CancelOrder 取消订单
func (*OrderService) CompletedOrder ¶
func (s *OrderService) CompletedOrder(orderID string) error
CompletedOrder 更新订单完成
func (*OrderService) CreateOrderByCart ¶
func (s *OrderService) CreateOrderByCart(userID, fatherID, grandpaID int, isVip bool, province, provinceName, city, cityName, county, countyName, address, contact, mobileNumber string, userCouponID int, userRemark, realName, idCard string) (string, error)
CreateOrderByCart 创建购物车订单
func (*OrderService) CreateOrderByGoods ¶
func (s *OrderService) CreateOrderByGoods(userID, fatherID, grandpaID int, isVip bool, goodsID, specID, count int, province, provinceName, city, cityName, county, countyName, address, contact, mobileNumber, realName, idCard string, userCouponID int, userRemark string) (string, error)
CreateOrderByGoods 创建立即下单订单
func (*OrderService) DeleteAllCart ¶
func (s *OrderService) DeleteAllCart(userID int) error
DeleteAllCart 删除用户所有的购物车
func (*OrderService) DeleteCart ¶
func (s *OrderService) DeleteCart(cartID int) error
DeleteCart 删除购物车
func (*OrderService) DeleteSelectedCart ¶
func (s *OrderService) DeleteSelectedCart(userID int) error
DeleteSelectedCart 删除用户选中的的购物车
func (*OrderService) GenerateOrderID ¶
func (s *OrderService) GenerateOrderID() (string, error)
GenerateOrderID 生成一个新的订单ID
func (*OrderService) GetCart ¶
func (s *OrderService) GetCart(cartID int) (*Cart, error)
GetCart 获取指定购物车
func (*OrderService) GetOrder ¶
func (s *OrderService) GetOrder(orderID string) (*Order, error)
GetOrder 获取订单
func (*OrderService) GetOrderDetail ¶
func (s *OrderService) GetOrderDetail(orderID string) (*Order, error)
GetOrderDetail 获取订单详情
func (*OrderService) GetOrderShip ¶
func (s *OrderService) GetOrderShip(orderID string) (*OrderShip, error)
GetOrderShip 获取指定订单物流信息
func (*OrderService) GetPayChannelLabel ¶
func (s *OrderService) GetPayChannelLabel(payChannel string) string
GetPayChannelLabel 获取支付渠道名称
func (*OrderService) GetPayment ¶
func (s *OrderService) GetPayment(orderID, payChannel string) (*OrderPayment, error)
GetPayment 获取某个支付渠道的支付信息
func (*OrderService) HasPayedGiftOrder ¶
func (s *OrderService) HasPayedGiftOrder(userID int) (bool, error)
HasPayedGiftOrder 用户是否有已支付的代理礼包订单
func (*OrderService) IsExsitPayment ¶
func (s *OrderService) IsExsitPayment(orderID, payChannel string) (bool, error)
IsExsitPayment 是否存在某个支付渠道的支付信息
func (*OrderService) KeepAdminRemark ¶
func (s *OrderService) KeepAdminRemark(orderID, adminName, adminRemark string, adminID int) error
KeepAdminRemark 保存管理员备注
func (*OrderService) ListAllCreatedPaymentOrder ¶
func (s *OrderService) ListAllCreatedPaymentOrder() ([]Order, error)
ListAllCreatedPaymentOrder 列出所有创建过支付信息的订单
func (*OrderService) ListAllOrder ¶
func (s *OrderService) ListAllOrder(orderType, orderState, payState, shipState, orderID, mobile string, startTime, endTime time.Time, offset, limit int) ([]Order, int, error)
ListAllOrder 分页所有订单
func (*OrderService) ListCart ¶
func (s *OrderService) ListCart(userID int) ([]Cart, error)
ListCart 列出所有有效的购物车,按照创建开始时间排序
func (*OrderService) ListOrder ¶
func (s *OrderService) ListOrder(userID, offset, limit int) ([]Order, int, error)
ListOrder 分页列出用户的所有订单
func (*OrderService) ListOrderDetail ¶
func (s *OrderService) ListOrderDetail(userID, offset, limit int) ([]Order, int, error)
ListOrderDetail 分页列出用户的所有订单及详情
func (*OrderService) ListOrderItem ¶
func (s *OrderService) ListOrderItem(orderID string) ([]OrderItem, error)
ListOrderItem 获取订单详情
func (*OrderService) ListOrderItemByOrderIDs ¶
func (s *OrderService) ListOrderItemByOrderIDs(orderIDs []string) ([]OrderItem, error)
ListOrderItemByOrderIDs 列出指定ID的订单详情数据
func (*OrderService) ListOrderLogs ¶
func (s *OrderService) ListOrderLogs(orderID string) ([]OrderLog, error)
ListOrderLogs 列出订单操作记录
func (*OrderService) ListOrderPaymentByOrderIDs ¶
func (s *OrderService) ListOrderPaymentByOrderIDs(orderIDs []string) ([]OrderPayment, error)
ListOrderPaymentByOrderIDs 列出指定ID的订单支付数据
func (*OrderService) ListOrderProgress ¶
func (s *OrderService) ListOrderProgress(orderID string) ([]OrderProgress, error)
ListOrderProgress 获取指定订单操作记录
func (*OrderService) ListOrderShipByOrderIDs ¶
func (s *OrderService) ListOrderShipByOrderIDs(orderIDs []string) ([]OrderShip, error)
ListOrderShipByOrderIDs 列出指定ID的订单详情
func (*OrderService) ListPayment ¶
func (s *OrderService) ListPayment(orderID string) ([]OrderPayment, error)
ListPayment 获取订单所有的支付信息
func (*OrderService) ListSelectedCart ¶
func (s *OrderService) ListSelectedCart(userID int) ([]Cart, error)
ListSelectedCart 列出所有选中的购物车,按照创建开始时间排序
func (*OrderService) NoRefundOrder ¶
func (s *OrderService) NoRefundOrder(orderID, refundAdminRemark, payChannel string, adminUserID int, adminUserName string) error
NoRefundOrder 确认不退款
func (*OrderService) PayOrder ¶
func (s *OrderService) PayOrder(orderID, payChannel, bankType, transactionID string) error
PayOrder 修改订单为支付,已取消和等待支付的订单都可以修改为已支付
func (*OrderService) RefundOrder ¶
func (s *OrderService) RefundOrder(orderID, refundAdminRemark, outRefundNo, payChannel string, refundFee float32, adminUserID int, adminUserName string) error
RefundOrder 确认退款
func (*OrderService) RefundingOrder ¶
func (s *OrderService) RefundingOrder(orderID, refundUserRemark string) error
RefundingOrder 申请退款订单
func (*OrderService) ReviewOrderByCart ¶
func (s *OrderService) ReviewOrderByCart(userID int, isVip bool) ([]OrderItem, UserCouponList, error)
ReviewOrderByCart 预览购物车订单
func (*OrderService) ReviewOrderByGoods ¶
func (s *OrderService) ReviewOrderByGoods(userID int, isVip bool, goodsID, specID, count int) (*OrderItem, UserCouponList, error)
ReviewOrderByGoods 预览立即购买订单
func (*OrderService) SelectedAllCart ¶
func (s *OrderService) SelectedAllCart(userID int) error
SelectedAllCart 选中所有购物车
func (*OrderService) SelectedCart ¶
func (s *OrderService) SelectedCart(cartID int) error
SelectedCart 选中购物车
func (*OrderService) SendOrder ¶
func (s *OrderService) SendOrder(orderID, shipType, shipCompany, shipCode string, adminUserID int, adminUserName string) error
SendOrder 后台确认发货
func (*OrderService) SubCartCount ¶
func (s *OrderService) SubCartCount(c *Cart) error
SubCartCount 减少购物车数量
func (*OrderService) UnSelectedAllCart ¶
func (s *OrderService) UnSelectedAllCart(userID int) error
UnSelectedAllCart 不选中所有购物车
func (*OrderService) UnSelectedCart ¶
func (s *OrderService) UnSelectedCart(cartID int) error
UnSelectedCart 取消选中购物车
func (*OrderService) UpdateCart ¶
func (s *OrderService) UpdateCart(c *Cart) error
UpdateCart 更新购物车信息
func (*OrderService) UpdateOrderShipCompleted ¶
func (s *OrderService) UpdateOrderShipCompleted(orderID string) error
UpdateOrderShipCompleted 修改指定订单为已签收
func (*OrderService) UpdateOrderShipIsSend ¶
func (s *OrderService) UpdateOrderShipIsSend(orderID string) error
UpdateOrderShipIsSend 修改指定订单为已发货
func (*OrderService) UpdateOrderShipWaitSend ¶
func (s *OrderService) UpdateOrderShipWaitSend(orderID string) error
UpdateOrderShipWaitSend 修改指定订单为等待发货
func (*OrderService) ValiateOrderLimit ¶
func (s *OrderService) ValiateOrderLimit(userID, goodsID, count int) error
ValiateOrderLimit 购买限制验证
type OrderShip ¶
type OrderShip struct { OrderID string `json:"orderID" db:"order_id"` // 订单ID ShipState string `json:"shipState" db:"ship_state"` // 订单物流状态,NONE无物流,WAIT_SEND等待发货,IS_SEND已发货,COMPLETED已签收 ShipType string `json:"shipType" db:"ship_type"` // 物流公司代码 ShipCompany string `json:"shipCompany" db:"ship_company"` // 物流公司名称 ShipCode string `json:"shipCode" db:"ship_code"` // 物流单号 Province string `json:"province" db:"province"` // 省份编码 ProvinceName string `json:"provinceName" db:"province_name"` // 省份 City string `json:"city" db:"city"` // 城市编码 CityName string `json:"cityName" db:"city_name"` // 城市 County string `json:"county" db:"county"` // 区、镇编码 CountyName string `json:"countyName" db:"county_name"` // 区、镇 Address string `json:"address" db:"address"` // 详情地址 Contact string `json:"contact" db:"contact"` // 联系人 MobileNumber string `json:"mobileNumber" db:"mobile_number"` // 手机号 CreateTime time.Time `json:"createTime" db:"create_time"` // UpdateTime time.Time `json:"updateTime" db:"update_time"` // QueryTime time.Time `json:"queryTime" db:"query_time"` // 上次调用接口更新物流状态时间 }
OrderShip 订单物流
type Ship ¶
type Ship struct { ShipID int `json:"shipID" db:"ship_id"` // 物流ID Active bool `json:"active" db:"active"` // 是否可用 GroupLabel string `json:"groupLabel" db:"group_label"` // 分组名称,例如:低邮费区域,偏远区域 ProvinceCode string `json:"provinceCode" db:"province_code"` // 省代码 ProvinceName string `json:"provinceName" db:"province_name"` // 省名称 ShipPrice float32 `json:"shipPrice" db:"ship_price"` // 邮费 FreeShipType string `json:"freeShipType" db:"free_ship_type"` // 包邮方式,none不包邮,count购满数量包邮,price购满金额包邮 FreeShipCount int `json:"freeShipCount" db:"free_ship_count"` // 购满数量包邮 FreeShipPrice float32 `json:"freeShipPrice" db:"free_ship_price"` // 购满金额包邮 CreateTime time.Time `json:"createTime" db:"create_time"` // 创建时间 UpdateTime time.Time `json:"updateTime" db:"update_time"` // 更新时间 }
Ship 物流
type ShipService ¶
type ShipService service
ShipService 专门处理订单的服务
func (*ShipService) DeleteShip ¶
func (s *ShipService) DeleteShip(shipID int) error
DeleteShip 删除物流信息
func (*ShipService) GetShip ¶
func (s *ShipService) GetShip(shipID int) (*Ship, error)
GetShip 获取物流信息
func (*ShipService) GetShipByProvinceCode ¶
func (s *ShipService) GetShipByProvinceCode(provinceCode string) (*Ship, error)
GetShipByProvinceCode 通过省代码获取物流信息
type Spec ¶
Spec 商品规格
type Special ¶
type Special struct { SpecialID int `json:"specialId,omitempty" db:"special_id"` // 专题ID Active bool `json:"active,omitempty" db:"active"` // 是否可用 Label string `json:"label,omitempty" db:"label"` // 名称 ZoomImg string `json:"zoomImg,omitempty" db:"zoom_img"` // 缩略图 CoverImg string `json:"coverImg,omitempty" db:"cover_img"` // 封面图 Width int `json:"width,omitempty" db:"width"` // 封面图宽度 Height int `json:"height,omitempty" db:"height"` // 封面图高度 SpecialType string `json:"specialType,omitempty" db:"special_type"` // 专题类型 Description string `json:"description,omitempty" db:"description"` // 文字描述 Weight int `json:"weight,omitempty" db:"weight"` // 权重,数字越大越靠前 StartTime time.Time `json:"startTime,omitempty" db:"start_time"` // 开始时间 EndTime time.Time `json:"endTime,omitempty" db:"end_time"` // 结束时间 CreateTime time.Time `json:"createTime,omitempty" db:"create_time"` // 创建时间 UpdateTime time.Time `json:"updateTime,omitempty" db:"update_time"` // 更新时间 }
Special 专题
type SpecialGoods ¶
type SpecialGoods struct { SpecialGoodsID int `json:"specialGoodsID,omitempty" db:"special_goods_id"` // 是否可用 Active bool `json:"active,omitempty" db:"active"` // 是否可用 SpecialID int `json:"specialID,omitempty" db:"special_id"` // 专题ID GoodsID int `json:"goodsID,omitempty" db:"goods_id"` // 商品ID GoodsType string `json:"goodsType,omitempty" db:"goods_type"` // 商品类型 Label string `json:"label,omitempty" db:"label"` // 商品名称 Icon string `json:"icon,omitempty" db:"icon"` // 商品图片 Description string `json:"description,omitempty" db:"description"` // 商品文字描述 Weight int `json:"weight,omitempty" db:"weight"` // 权重,数字越大越靠前 Width int `json:"width,omitempty" db:"width"` // 封面图宽度 Height int `json:"height,omitempty" db:"height"` // 封面图高度 CreateTime time.Time `json:"createTime,omitempty" db:"create_time"` // 创建时间 UpdateTime time.Time `json:"updateTime,omitempty" db:"update_time"` // 更新时间 }
SpecialGoods 专题商品
type SpecialService ¶
type SpecialService service
SpecialService 专门处理专题相关的服务
func (*SpecialService) AddSpecial ¶
func (s *SpecialService) AddSpecial(label, zoomImg, coverImg, specialType, description string, weight, width, height int, startTime, endTime time.Time) (int, error)
AddSpecial 新增专题
func (*SpecialService) AddSpecialGoods ¶
func (s *SpecialService) AddSpecialGoods(specialID, goodsID int, label, icon, description string, weight, width, height int) error
AddSpecialGoods 专题下添加商品
func (*SpecialService) DeleteSpecial ¶
func (s *SpecialService) DeleteSpecial(specialID int) error
DeleteSpecial 删除专题,不删除专题商品
func (*SpecialService) DeleteSpecialGoods ¶
func (s *SpecialService) DeleteSpecialGoods(specialGoodsID int) error
DeleteSpecialGoods 删除指定专题商品
func (*SpecialService) GetSpecial ¶
func (s *SpecialService) GetSpecial(specialID int) (*Special, error)
GetSpecial 获取指定专题
func (*SpecialService) GetSpecialGoodsByID ¶
func (s *SpecialService) GetSpecialGoodsByID(specialGoodsID int) (*SpecialGoods, error)
GetSpecialGoodsByID 获取指定专题商品
func (*SpecialService) ListAllSpecial ¶
func (s *SpecialService) ListAllSpecial() ([]Special, error)
ListAllSpecial 列出所有有效专题,包括有效期内和有效期外的,按照权重、开始时间、创建时间排序
func (*SpecialService) ListSpecial ¶
func (s *SpecialService) ListSpecial() ([]Special, error)
ListSpecial 列出所有有效专题,时间在有效期内的,按照权重、开始时间、创建时间排序
func (*SpecialService) ListSpecialGoods ¶
func (s *SpecialService) ListSpecialGoods(specialID, offset, limit int) ([]SpecialGoods, int, error)
ListSpecialGoods 分页列出专题下的有效商品,按照权重、创建时间排序
type Supplier ¶
type Supplier struct { SupplierID int `json:"supplierID,omitempty" db:"supplier_id"` // 专题ID Active bool `json:"active,omitempty" db:"active"` // 是否可用 Label string `json:"label,omitempty" db:"label"` // 供应商标签名称 Description string `json:"description,omitempty" db:"description"` // 供应商描述 Icon string `json:"icon,omitempty" db:"icon"` // 图标 Contact string `json:"contact,omitempty" db:"contact"` // 联系人姓名 MobileNumber string `json:"mobileNumber,omitempty" db:"mobile_number"` // 联系人手机号 Address string `json:"address,omitempty" db:"address"` // 供应商地址 CreateTime time.Time `json:"createTime,omitempty" db:"create_time"` // 创建时间 UpdateTime time.Time `json:"updateTime,omitempty" db:"update_time"` // 更新时间 }
Supplier 提供商结构体
type SupplierService ¶
type SupplierService service
SupplierService 专门处理提供商相关服务
func (*SupplierService) AddSupplier ¶
func (s *SupplierService) AddSupplier(su *Supplier) error
AddSupplier 添加供应商
func (*SupplierService) DeleteSupplier ¶
func (s *SupplierService) DeleteSupplier(supplierID int) error
DeleteSupplier 删除供应商
func (*SupplierService) GetSupplier ¶
func (s *SupplierService) GetSupplier(supplierID int) (*Supplier, error)
GetSupplier 获取指定供应商
func (*SupplierService) ListSupplier ¶
func (s *SupplierService) ListSupplier() ([]Supplier, error)
ListSupplier 列出所有有效供应商
func (*SupplierService) UpdateSupplier ¶
func (s *SupplierService) UpdateSupplier(su *Supplier) error
UpdateSupplier 更新供应商信息
type UserCoupon ¶
type UserCoupon struct { UserCouponID int `json:"userCouponID" db:"user_coupon_id"` // 用户优惠券ID UserID int `json:"userID" db:"user_id"` // 用户ID CouponID int `json:"couponID" db:"coupon_id"` // 优惠券ID Label string `json:"label" db:"label"` // 优惠券名称 GoodsID string `json:"goodsID" db:"goods_id"` // 商品ID,以下划线分割,ALL代表全场 Money float32 `json:"money" db:"money"` // 优惠券金额 Requirement float32 `json:"requirement" db:"requirement"` // 优惠券使用条件 ZoomImg string `json:"zoomImg" db:"zoom_img"` // 缩放图 CoverImg string `json:"coverImg" db:"cover_img"` // 封面图 OnUseTime time.Time `json:"onUseTime" db:"on_use_time"` // 使用开始时间 OffUseTime time.Time `json:"offUseTime" db:"off_use_time"` // 使用结束时间 Used bool `json:"used" db:"used"` // 是否已使用 UseTime time.Time `json:"useTime" db:"use_time"` // 使用时间 OrderID string `json:"orderID" db:"order_id"` // 使用时的订单ID CreateTime time.Time `json:"createTime" db:"create_time"` // 创建时间 UpdateTime time.Time `json:"updateTime" db:"update_time"` // 更新时间 }
UserCoupon 用户的优惠券
func (*UserCoupon) GetGoodsIDArr ¶
func (userCoupon *UserCoupon) GetGoodsIDArr() (bool, []int)
GetGoodsIDArr 分割GoodsID为数组
Source Files ¶
- banner.go
- cart.go
- category.go
- coupon.go
- error.go
- goods.go
- goods_attr.go
- goods_image.go
- goods_spec.go
- largess_order.go
- order.go
- order1.go
- order_id.go
- order_log.go
- order_payment.go
- order_progress.go
- order_ship.go
- order_test1.go
- ship.go
- shop.go
- special.go
- special_goods.go
- supplier.go
- user_coupon.go
- utils.go