This commit is contained in:
苏尹岚
2021-02-23 16:07:46 +08:00
parent e3ff21f49e
commit e106a982a1
5 changed files with 101 additions and 14 deletions

View File

@@ -3,10 +3,12 @@ package mtpsapi
import "git.rosy.net.cn/baseapi/utils"
const (
ShopStatusAuditRejected = 10 // 审核驳回
ShopStatusAuditPassed = 20 // 审核通过
ShopStatusAuditCreated = 30 // 创建成功
ShopStatusAuditOnline = 40 // 上线可发单
ShopStatusAuditRejected = 10 // 审核驳回
ShopStatusAuditPassed = 20 // 审核通过
ShopStatusAuditCreated = 30 // 创建成功
ShopStatusAuditOnline = 40 // 上线可发单
ShopStatusAuditUpdateRejected = 50 // 修改审核驳回
ShopStatusAuditUpdatePassed = 60 // 修改审核通过
)
const (
@@ -55,6 +57,15 @@ func (a *API) ShopCreate(shopInfo *ShopInfo) (status int, err error) {
return status, err
}
func (a *API) ShopUpdate(shopInfo *ShopInfo) (status int, err error) {
params := utils.Struct2MapByJson(shopInfo)
result, err := a.AccessAPI("shop/update", params)
if err == nil {
status = int(utils.Interface2Int64WithDefault(result.Data["status"], 0))
}
return status, err
}
func (a *API) ShopQuery(shopID string) (shopInfo *ShopInfo, err error) {
result, err := a.AccessAPI("shop/query", map[string]interface{}{
"shop_id": shopID,

View File

@@ -18,7 +18,7 @@ func TestShopQuery(t *testing.T) {
// if err == nil {
// t.Fatal("应该报错找不到门店")
// }
shopInfo, err := api.ShopQuery("666972")
shopInfo, err := api.ShopQuery("667018")
if err != nil {
t.Fatal(err)
}
@@ -46,6 +46,18 @@ func TestShopCreate(t *testing.T) {
}
}
func TestShopUpdate(t *testing.T) {
shopInfo := &ShopInfo{
ShopID: "667018",
ShopLng: 113015935,
ShopLat: 25776427,
}
_, err := api.ShopUpdate(shopInfo)
if err != nil {
t.Fatal(err)
}
}
func TestSimulateArrange(t *testing.T) {
err := api.SimulateArrange(123456789, "1529387562097059")
handleError(t, err)