Documentation ¶
Overview ¶
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Generate by scripts/generate_area.js. DO NOT MODIFY.
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Index ¶
- Variables
- func AreaList() (res schema.Response)
- func Create(c helper.Context, input CreateAddressParams) (res schema.Response)
- func Delete(c helper.Context, addressId string) (res schema.Response)
- func DeleteAddressById(id string)
- func GetAddressListByUser(c helper.Context, input Query) (res schema.Response)
- func GetDefault(c helper.Context) (res schema.Response)
- func GetDetail(c helper.Context, id string) (res schema.Response)
- func Update(c helper.Context, addressId string, input UpdateParams) (res schema.Response)
- type Area
- type AreaStruct
- type CreateAddressParams
- type Query
- type UpdateParams
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ProvinceCode = map[string]string{"110000": "北京市", "120000": "天津市", "130000": "河北省", "140000": "山西省", "150000": "内蒙古自治区", "210000": "辽宁省", "220000": "吉林省", "230000": "黑龙江省", "310000": "上海市", "320000": "江苏省", "330000": "浙江省", "340000": "安徽省", "350000": "福建省", "360000": "江西省", "370000": "山东省", "410000": "河南省", "420000": "湖北省", "430000": "湖南省", "440000": "广东省", "450000": "广西壮族自治区", "460000": "海南省", "500000": "重庆市", "510000": "四川省", "520000": "贵州省", "530000": "云南省", "540000": "西藏自治区", "610000": "陕西省", "620000": "甘肃省", "630000": "青海省", "640000": "宁夏回族自治区", "650000": "新疆维吾尔自治区", "710000": "台湾省", "810000": "香港特别行政区", "820000": "澳门特别行政区"} CityCode = map[string]string{} /* 369 elements not displayed */ CountryCode = map[string]string{} /* 3386 elements not displayed */ )
View Source
var AreaListRouter = router.Handler(func(c router.Context) { c.ResponseFunc(nil, func() schema.Response { return AreaList() }) })
View Source
var CreateRouter = router.Handler(func(c router.Context) { var ( input CreateAddressParams ) c.ResponseFunc(c.ShouldBindJSON(&input), func() schema.Response { return Create(helper.NewContext(&c), input) }) })
View Source
var DeleteRouter = router.Handler(func(c router.Context) { id := c.Param("address_id") c.ResponseFunc(nil, func() schema.Response { return Delete(helper.NewContext(&c), id) }) })
View Source
var FindAddressRouter = router.Handler(func(c router.Context) { var ( err error res = schema.Response{} area *Area ) code := c.Param("area_code") area, err = FindAddress(code) res.Data = area c.ResponseFunc(err, func() schema.Response { return res }) })
View Source
var GetAddressListByUserRouter = router.Handler(func(c router.Context) { var ( input Query ) c.ResponseFunc(c.ShouldBindQuery(&input), func() schema.Response { return GetAddressListByUser(helper.NewContext(&c), input) }) })
View Source
var GetDefaultRouter = router.Handler(func(c router.Context) { c.ResponseFunc(nil, func() schema.Response { return GetDefault(helper.NewContext(&c)) }) })
View Source
var GetDetailRouter = router.Handler(func(c router.Context) { id := c.Param("address_id") c.ResponseFunc(nil, func() schema.Response { return GetDetail(helper.NewContext(&c), id) }) })
View Source
var UpdateRouter = router.Handler(func(c router.Context) { var ( input UpdateParams ) id := c.Param("address_id") c.ResponseFunc(c.ShouldBindJSON(&input), func() schema.Response { return Update(helper.NewContext(&c), id, input) }) })
Functions ¶
func DeleteAddressById ¶
func DeleteAddressById(id string)
func GetAddressListByUser ¶
Types ¶
type Area ¶
type Area struct { Province AreaStruct `json:"province"` City AreaStruct `json:"city"` Country AreaStruct `json:"country"` Addr string `json:"addr"` }
type AreaStruct ¶
type CreateAddressParams ¶
type CreateAddressParams struct { Name string `json:"name" valid:"required~请填写收货人"` // 收货人 Phone string `json:"phone" valid:"required~请输入收货人电话号码"` // 收货人手机号 ProvinceCode string `json:"province_code" valid:"required~请选择省份"` // 省份代码 CityCode string `json:"city_code" valid:"required~请选择城市"` // 城市代码 AreaCode string `json:"area_code" valid:"required~请选择区域"` // 区域代码 Address string `json:"address" valid:"required~请输入详细地址"` // 详细的地址 IsDefault *bool `json:"is_default"` // 是否是默认地址 }
Click to show internal directories.
Click to hide internal directories.