You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
2.0 KiB
86 lines
2.0 KiB
6 months ago
|
package skycrane
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"git.oa00.com/supply-chain/service/client"
|
||
|
"git.oa00.com/supply-chain/service/lib/bean"
|
||
|
)
|
||
|
|
||
|
type address struct {
|
||
|
}
|
||
|
type AddressSearch struct {
|
||
|
AddressId int64
|
||
|
Mate int // 1=已匹配 2=未匹配
|
||
|
}
|
||
|
type ArgsAddressList struct {
|
||
|
Search AddressSearch
|
||
|
Page bean.Page
|
||
|
}
|
||
|
|
||
|
type AddressItem struct {
|
||
|
Id int64 `json:"id"`
|
||
|
ProvinceName string `json:"provinceName"`
|
||
|
CityName string `json:"cityName"`
|
||
|
CountyName string `json:"countyName"`
|
||
|
MateAddressId int64 `json:"mateAddressId"`
|
||
|
MateProvinceName string `json:"mateProvinceName"`
|
||
|
MateCityName string `json:"mateCityName"`
|
||
|
MateCountyName string `json:"mateCountyName"`
|
||
|
}
|
||
|
type ReplyAddressList struct {
|
||
|
Lists []AddressItem `json:"lists"`
|
||
|
Total int64 `json:"total"`
|
||
|
}
|
||
|
|
||
|
// List @Title 地址列表
|
||
|
func (c *address) List(ctx context.Context, args ArgsAddressList) (reply ReplyAddressList, err error) {
|
||
|
xClient, err := client.GetClient(c)
|
||
|
if err != nil {
|
||
|
return
|
||
|
}
|
||
|
xClient.Call(ctx, "List", args, &reply)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
type ArgsAddressMate struct {
|
||
|
AddressId int64 // 地址id
|
||
|
MateAddressID int64 // 修改匹配地址id
|
||
|
}
|
||
|
|
||
|
// Mate @Title 地址匹配
|
||
|
func (c *address) Mate(ctx context.Context, args ArgsAddressMate) error {
|
||
|
reply := 0
|
||
|
xClient, err := client.GetClient(c)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
return xClient.Call(ctx, "Mate", args, &reply)
|
||
|
}
|
||
|
|
||
|
// All @Title 地址
|
||
|
func (c *address) All(ctx context.Context, args AddressSearch) (reply []AddressItem, err error) {
|
||
|
xClient, err := client.GetClient(c)
|
||
|
if err != nil {
|
||
|
return
|
||
|
}
|
||
|
xClient.Call(ctx, "All", args, &reply)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
type MateAddressItem struct {
|
||
|
Id int64 `json:"id"`
|
||
|
ProvinceName string `json:"provinceName"`
|
||
|
CityName string `json:"cityName"`
|
||
|
CountyName string `json:"countyName"`
|
||
|
}
|
||
|
|
||
|
// MateAll @Title 匹配地址
|
||
|
func (c *address) MateAll(ctx context.Context) (reply []MateAddressItem, err error) {
|
||
|
xClient, err := client.GetClient(c)
|
||
|
if err != nil {
|
||
|
return
|
||
|
}
|
||
|
xClient.Call(ctx, "MateAll", 0, &reply)
|
||
|
return
|
||
|
}
|