-
Notifications
You must be signed in to change notification settings - Fork 282
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
676 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package livebroadcast | ||
|
||
import "github.com/medivhzhan/weapp/v3/request" | ||
|
||
const apiGoodsVideo = "/wxaapi/broadcast/goods/getVideo" | ||
|
||
type GoodsVideoRequest struct { | ||
// 必填 商品ID | ||
GoodsId int64 `json:"goodsId"` | ||
// 必填 房间ID | ||
RoomId int64 `json:"roomId"` | ||
} | ||
|
||
type GoodsVideoResponse struct { | ||
request.CommonError | ||
// 必填 讲解链接 | ||
Url int64 `json:"url"` | ||
} | ||
|
||
// 更新商品 | ||
func (cli *LiveBroadcast) GoodsVideo(req *GoodsVideoRequest) (*GoodsVideoResponse, error) { | ||
|
||
api, err := cli.conbineURI(apiGoodsVideo, nil) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
res := new(GoodsVideoResponse) | ||
err = cli.request.Post(api, req, res) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return res, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package livebroadcast | ||
|
||
import "github.com/medivhzhan/weapp/v3/request" | ||
|
||
const apiGoodsAudit = "/wxaapi/broadcast/goods/audit" | ||
|
||
type GoodsAuditRequest struct { | ||
// 商品ID | ||
GoodsId int64 `json:"goodsId"` | ||
} | ||
|
||
type GoodsAuditResponse struct { | ||
request.CommonError | ||
// 审核单ID | ||
AuditId int64 `json:"auditId"` | ||
} | ||
|
||
// 重新提交审核 | ||
func (cli *LiveBroadcast) GoodsAudit(req *GoodsAuditRequest) (*GoodsAuditResponse, error) { | ||
|
||
api, err := cli.conbineURI(apiGoodsAudit, nil) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
res := new(GoodsAuditResponse) | ||
err = cli.request.Post(api, req, res) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return res, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package livebroadcast | ||
|
||
import "github.com/medivhzhan/weapp/v3/request" | ||
|
||
const apiGoodsDelete = "/wxaapi/broadcast/goods/delete" | ||
|
||
type GoodsDeleteRequest struct { | ||
// 商品ID | ||
GoodsId int64 `json:"goodsId"` | ||
} | ||
|
||
type GoodsDeleteResponse struct { | ||
request.CommonError | ||
} | ||
|
||
// 删除商品 | ||
func (cli *LiveBroadcast) GoodsDelete(req *GoodsDeleteRequest) (*GoodsDeleteResponse, error) { | ||
|
||
api, err := cli.conbineURI(apiGoodsDelete, nil) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
res := new(GoodsDeleteResponse) | ||
err = cli.request.Post(api, req, res) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return res, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package livebroadcast | ||
|
||
import "github.com/medivhzhan/weapp/v3/request" | ||
|
||
const apiGoodsInfo = "/wxa/business/getgoodswarehouse" | ||
|
||
type GoodsInfoRequest struct { | ||
// 商品ID | ||
GoodsIds []int64 `json:"goods_ids"` | ||
} | ||
|
||
type GoodsInfoResponse struct { | ||
request.CommonError | ||
// 商品个数 | ||
Total int64 `json:"total"` | ||
|
||
// 商品 | ||
Goods []struct { | ||
// 商品ID | ||
GoodsId int64 `json:"goods_id"` | ||
// 商品名称 | ||
Name string `json:"name"` | ||
// 商品图片url | ||
CoverImgUrl string `json:"cover_img_url"` | ||
// 商品详情页的小程序路径 | ||
Url string `json:"url"` | ||
// 1:一口价,此时读price字段; 2:价格区间,此时price字段为左边界,price2字段为右边界; 3:折扣价,此时price字段为原价,price2字段为现价; | ||
PriceType uint8 `json:"priceType"` | ||
// 价格左区间,单位“元” | ||
Price float64 `json:"price"` | ||
// 价格右区间,单位“元” | ||
Price2 float64 `json:"price2"` | ||
// 0:未审核,1:审核中,2:审核通过,3审核失败 | ||
AuditStatus uint8 `json:"audit_status"` | ||
// 1、2:表示是为 API 添加商品,否则是直播控制台添加的商品 | ||
ThirdPartyTag uint8 `json:"third_party_tag"` | ||
// 当商品为第三方小程序的商品则为对应第三方小程序的appid,自身小程序商品则为'' | ||
ThirdPartyAppid string `json:"thirdPartyAppid"` | ||
} `json:"goods"` | ||
} | ||
|
||
// 获取商品状态 | ||
func (cli *LiveBroadcast) GoodsInfo(req *GoodsInfoRequest) (*GoodsInfoResponse, error) { | ||
|
||
api, err := cli.conbineURI(apiGoodsInfo, nil) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
res := new(GoodsInfoResponse) | ||
err = cli.request.Post(api, req, res) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return res, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package livebroadcast | ||
|
||
import "github.com/medivhzhan/weapp/v3/request" | ||
|
||
const apiGoodsList = "/wxaapi/broadcast/goods/getapproved" | ||
|
||
type GoodsListRequest struct { | ||
// 必填 分页条数起点 | ||
Offset int `query:"offset"` | ||
// 非必填 分页大小,默认30,不超过100 | ||
Limit int `query:"limit"` | ||
// 必填 商品状态,0:未审核。1:审核中,2:审核通过,3:审核驳回 | ||
Status uint8 `query:"status"` | ||
} | ||
|
||
type GoodsListResponse struct { | ||
request.CommonError | ||
// 商品个数 | ||
Total int64 `json:"total"` | ||
// 商品 | ||
Goods []struct { | ||
// 商品ID | ||
GoodsId int64 `json:"goodsId"` | ||
// 商品图片url | ||
CoverImgUrl string `json:"coverImgUrl"` | ||
// 商品名称 | ||
Name string `json:"name"` | ||
// 价格左区间,单位“元” | ||
Price float64 `json:"price"` | ||
// 价格右区间,单位“元” | ||
Price2 float64 `json:"price2"` | ||
// 商品详情页的小程序路径 | ||
Url string `json:"url"` | ||
// 1:一口价,此时读price字段; 2:价格区间,此时price字段为左边界,price2字段为右边界; 3:折扣价,此时price字段为原价,price2字段为现价; | ||
PriceType uint8 `json:"priceType"` | ||
// 1、2:表示是为 API 添加商品,否则是直播控制台添加的商品 | ||
ThirdPartyTag uint8 `json:"thirdPartyTag"` | ||
// 当商品为第三方小程序的商品则为对应第三方小程序的appid,自身小程序商品 则为'' | ||
ThirdPartyAppid string `json:"thirdPartyAppid"` | ||
} `json:"goods"` | ||
} | ||
|
||
// 获取商品列表 | ||
func (cli *LiveBroadcast) GoodsList(req *GoodsListRequest) (*GoodsListResponse, error) { | ||
|
||
api, err := cli.conbineURI(apiGoodsList, req) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
res := new(GoodsListResponse) | ||
err = cli.request.Get(api, res) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return res, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package livebroadcast | ||
|
||
import "github.com/medivhzhan/weapp/v3/request" | ||
|
||
const apiGoodsPush = "/wxaapi/broadcast/goods/push" | ||
|
||
type GoodsPushRequest struct { | ||
// 必填 商品ID | ||
GoodsId int64 `json:"goodsId"` | ||
// 必填 房间ID | ||
RoomId int64 `json:"roomId"` | ||
} | ||
|
||
type GoodsPushResponse struct { | ||
request.CommonError | ||
} | ||
|
||
// 推送商品 | ||
func (cli *LiveBroadcast) GoodsPush(req *GoodsPushRequest) (*GoodsPushResponse, error) { | ||
|
||
api, err := cli.conbineURI(apiGoodsPush, nil) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
res := new(GoodsPushResponse) | ||
err = cli.request.Post(api, req, res) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return res, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package livebroadcast | ||
|
||
import "github.com/medivhzhan/weapp/v3/request" | ||
|
||
const apiGoodsResetAudit = "/wxaapi/broadcast/goods/resetaudit" | ||
|
||
type GoodsResetAuditRequest struct { | ||
// 必填 商品ID | ||
GoodsId int64 `json:"goodsId"` | ||
// 必填 审核单ID | ||
AuditId int64 `json:"auditId"` | ||
} | ||
|
||
type GoodsResetAuditResponse struct { | ||
request.CommonError | ||
} | ||
|
||
// 撤回商品审核 | ||
func (cli *LiveBroadcast) GoodsResetAudit(req *GoodsResetAuditRequest) (*GoodsResetAuditResponse, error) { | ||
|
||
api, err := cli.conbineURI(apiGoodsResetAudit, nil) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
res := new(GoodsResetAuditResponse) | ||
err = cli.request.Post(api, req, res) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return res, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package livebroadcast | ||
|
||
import "github.com/medivhzhan/weapp/v3/request" | ||
|
||
const apiGoodsSale = "/wxaapi/broadcast/goods/onsale" | ||
|
||
type GoodsSaleRequest struct { | ||
// 必填 商品ID | ||
GoodsId int64 `json:"goodsId"` | ||
// 必填 审核单ID | ||
AuditId int64 `json:"auditId"` | ||
// 必填 上下架 【0:下架,1:上架】 | ||
OnSale uint8 `json:"onSale"` | ||
} | ||
|
||
type GoodsSaleResponse struct { | ||
request.CommonError | ||
} | ||
|
||
// 上下架商品 | ||
func (cli *LiveBroadcast) GoodsSale(req *GoodsSaleRequest) (*GoodsSaleResponse, error) { | ||
|
||
api, err := cli.conbineURI(apiGoodsSale, nil) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
res := new(GoodsSaleResponse) | ||
err = cli.request.Post(api, req, res) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return res, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package livebroadcast | ||
|
||
import "github.com/medivhzhan/weapp/v3/request" | ||
|
||
const apiGoodsSort = "/wxaapi/broadcast/goods/sort" | ||
|
||
type GoodsSortRequest struct { | ||
// 必填 房间ID | ||
RoomId int64 `json:"roomId"` | ||
|
||
// 必填 房间ID | ||
Goods []*SortGoods `json:"goods"` | ||
} | ||
|
||
type SortGoods struct { | ||
// 必填 商品ID | ||
GoodsId int64 `json:"goodsId"` | ||
} | ||
|
||
type GoodsSortResponse struct { | ||
request.CommonError | ||
} | ||
|
||
// 直播间商品排序 | ||
func (cli *LiveBroadcast) GoodsSort(req *GoodsSortRequest) (*GoodsSortResponse, error) { | ||
|
||
api, err := cli.conbineURI(apiGoodsSort, nil) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
res := new(GoodsSortResponse) | ||
err = cli.request.Post(api, req, res) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return res, nil | ||
} |
Oops, something went wrong.