This commit is contained in:
parent
6922b04f70
commit
4497011eba
2
Makefile
2
Makefile
|
@ -24,7 +24,7 @@ apigen:
|
|||
.PHONY: rpcgen
|
||||
# 根据protoc创建rpc文件
|
||||
rpcgen:
|
||||
cd cmd/rpc/pb && goctl rpc protoc transfer.proto --go_out=../pb --go-grpc_out=../pb --zrpc_out=../ --client=false --style=goZero
|
||||
cd cmd/rpc/pb && goctl rpc protoc transfer.proto --go_out=../pb --go-grpc_out=../pb --zrpc_out=../ --client=true --style=goZero
|
||||
|
||||
.PHONY: apiinitrpc
|
||||
# api端生成rpc
|
||||
|
|
|
@ -30,6 +30,7 @@ type TopicList struct {
|
|||
ZLTX TopicConfig
|
||||
RS TopicConfig
|
||||
NewMarket TopicConfig
|
||||
Physical TopicConfig
|
||||
}
|
||||
|
||||
type TopicConfig struct {
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"trasfer_middleware/cmd/rpc/etc"
|
||||
marketTypes "trasfer_middleware/cmd/rpc/internal/logic/po/market/types"
|
||||
newMarketTypes "trasfer_middleware/cmd/rpc/internal/logic/po/new_market/types"
|
||||
physical "trasfer_middleware/cmd/rpc/internal/logic/po/physical/types"
|
||||
rsTypes "trasfer_middleware/cmd/rpc/internal/logic/po/rs/types"
|
||||
zltxTypes "trasfer_middleware/cmd/rpc/internal/logic/po/zltx/types"
|
||||
)
|
||||
|
@ -18,6 +19,7 @@ type Config struct {
|
|||
Market marketTypes.MarketConf
|
||||
RS rsTypes.RSConf
|
||||
NewMarket newMarketTypes.NewMarketConf
|
||||
Physical physical.PhysicalConf
|
||||
DB struct {
|
||||
Master struct {
|
||||
DataSource string
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
package do
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strconv"
|
||||
"trasfer_middleware/cmd/rpc/internal/logic/vo"
|
||||
"trasfer_middleware/genModel"
|
||||
)
|
||||
|
||||
type Res struct {
|
||||
Code float64 `json:"code"`
|
||||
Data map[string]interface{} `json:"data"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
func NewMarketKeyDataSet(order *genModel.ServerOrderNewMarket, resq string, resp string) (err error) {
|
||||
var (
|
||||
orderInfoReq map[string]interface{}
|
||||
orderInfoRes Res
|
||||
)
|
||||
err = json.Unmarshal([]byte(resp), &orderInfoRes)
|
||||
|
||||
if orderInfoRes.Code != vo.NEW_MARKET_SUCCESS {
|
||||
return err
|
||||
}
|
||||
err = json.Unmarshal([]byte(resq), &orderInfoReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
order.Number, err = strconv.ParseInt(orderInfoReq["number"].(string), 16, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
order.AppId = orderInfoReq["app_id"].(string)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
order.ActivityNo = orderInfoReq["activity_no"].(string)
|
||||
|
||||
order.OutBizNo = orderInfoRes.Data["out_biz_no"].(string)
|
||||
order.Key = orderInfoRes.Data["key"].(string)
|
||||
order.TradeNo = orderInfoRes.Data["trade_no"].(string)
|
||||
order.Url = orderInfoRes.Data["url"].(string)
|
||||
return nil
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package do
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"trasfer_middleware/cmd/rpc/internal/logic/vo"
|
||||
"trasfer_middleware/cmd/rpc/pb/transfer"
|
||||
"trasfer_middleware/genModel"
|
||||
)
|
||||
|
||||
type PhysicalRes struct {
|
||||
Code float64 `json:"code"`
|
||||
Data map[string]interface{} `json:"data"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
func PhysicalDataSet(order *genModel.ServerOrderPhysical, resq string, resp string) (err error) {
|
||||
var (
|
||||
orderInfoReq *transfer.PhysicalOrderSubReq
|
||||
orderInfoRes PhysicalRes
|
||||
)
|
||||
err = json.Unmarshal([]byte(resp), &orderInfoRes)
|
||||
|
||||
if orderInfoRes.Code != vo.PHYSICAL_SUCCESS {
|
||||
return err
|
||||
}
|
||||
err = json.Unmarshal([]byte(resq), &orderInfoReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
order.CustomerOrderNum = orderInfoReq.OrderBasic.CustomerOrderNum
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
order.AppId = orderInfoReq.AppId
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
order.CustomerOrderNum = orderInfoReq.OrderBasic.CustomerOrderNum
|
||||
order.OrderNum = orderInfoRes.Data["order_num"].(string)
|
||||
return nil
|
||||
}
|
|
@ -0,0 +1,238 @@
|
|||
package physical
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"trasfer_middleware/cmd/rpc/etc"
|
||||
"trasfer_middleware/cmd/rpc/internal/logic/po"
|
||||
"trasfer_middleware/cmd/rpc/internal/logic/po/physical/types"
|
||||
"trasfer_middleware/cmd/rpc/internal/logic/vo"
|
||||
"trasfer_middleware/cmd/rpc/pb/transfer"
|
||||
"trasfer_middleware/cmd/rpc/pkg/mq"
|
||||
"trasfer_middleware/until/request"
|
||||
"trasfer_middleware/until/sysLog"
|
||||
)
|
||||
|
||||
type Physical struct {
|
||||
Conf *types.PhysicalConf
|
||||
AppId string
|
||||
}
|
||||
|
||||
type PhysicalRequest struct {
|
||||
ctx context.Context
|
||||
*Physical
|
||||
*po.RequestStructWithJson
|
||||
}
|
||||
|
||||
func NewPhysical(conf types.PhysicalConf) *Physical {
|
||||
|
||||
return &Physical{
|
||||
Conf: &conf,
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Physical) SetData(c context.Context, appId string, data map[string]interface{}, config *etc.RockerMqConfig) *PhysicalRequest {
|
||||
|
||||
r.AppId = appId
|
||||
return &PhysicalRequest{
|
||||
ctx: c,
|
||||
Physical: r,
|
||||
RequestStructWithJson: &po.RequestStructWithJson{
|
||||
Config: *config,
|
||||
RequestBody: data,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (r *PhysicalRequest) request(url string) (*request.Response, error) {
|
||||
if len(r.Physical.AppId) == 0 {
|
||||
return nil, fmt.Errorf("未获取到app_id")
|
||||
}
|
||||
reqUrl := fmt.Sprintf("%s%s", r.Conf.Host, url)
|
||||
req := request.Request{
|
||||
Method: "POST",
|
||||
Url: reqUrl,
|
||||
Json: r.RequestBody,
|
||||
Headers: map[string]string{"AppId": r.Physical.AppId},
|
||||
}
|
||||
resp, _ := req.Send()
|
||||
//异步存入请求记录
|
||||
sendMq := mq.AliyunRocketMq{
|
||||
AccessKey: r.Config.AccessKey,
|
||||
SecretKey: r.Config.SecretKey,
|
||||
SecurityToken: r.Config.SecurityToken,
|
||||
ServerAddress: r.Config.Host,
|
||||
}
|
||||
err := sendMq.Produce(r.ctx, r.Config.TopicPrefix+r.Config.Topic.Physical.Name, po.SetMqSendDataPhysical(r.RequestStructWithJson, &resp, url))
|
||||
handlerResCode(&resp.Text)
|
||||
if err != nil {
|
||||
sysLog.LogSendMq(r.ctx, err)
|
||||
}
|
||||
return &resp, err
|
||||
}
|
||||
|
||||
func handlerResCode(respText *string) {
|
||||
var res map[string]interface{}
|
||||
_ = json.Unmarshal([]byte(*respText), &res)
|
||||
if _, ok := res["code"].(string); !ok {
|
||||
if _, ok := res["code"].(float64); ok {
|
||||
res["code"] = fmt.Sprintf("%d", int(res["code"].(float64)))
|
||||
}
|
||||
if _, ok := res["code"].(int); ok {
|
||||
res["code"] = fmt.Sprintf("%d", res["code"].(int))
|
||||
}
|
||||
respByte, _ := json.Marshal(res)
|
||||
*respText = string(respByte)
|
||||
}
|
||||
}
|
||||
|
||||
func (r *PhysicalRequest) GoodsDetail() (*transfer.GoodsStructWithChild, error) {
|
||||
var res transfer.GoodsStructWithChild
|
||||
req, err := r.request(vo.PHYSICAL_GOODS_DETAIL)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_ = json.Unmarshal([]byte(req.Text), &res)
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
func (r *PhysicalRequest) GoodsList() (*transfer.PhysicalGoodsListRes, error) {
|
||||
var res transfer.PhysicalGoodsListRes
|
||||
req, err := r.request(vo.PHYSICAL_GOODS_LIST)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_ = json.Unmarshal([]byte(req.Text), &res)
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
func (r *PhysicalRequest) GoodsStock() (*transfer.PhysicalGoodsStockRes, error) {
|
||||
var res transfer.PhysicalGoodsStockRes
|
||||
req, err := r.request(vo.PHYSICAL_GOODS_STOCK)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_ = json.Unmarshal([]byte(req.Text), &res)
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
func (r *PhysicalRequest) CusBalanceHis() (*transfer.PhysicalCusLogsRes, error) {
|
||||
var res transfer.PhysicalCusLogsRes
|
||||
req, err := r.request(vo.PHYSICAL_CUS_BALANCE_HIS)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_ = json.Unmarshal(req.Content, &res)
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
func (r *PhysicalRequest) CusBalance() (*transfer.PhysicalCusBalanceRes, error) {
|
||||
var res transfer.PhysicalCusBalanceRes
|
||||
req, err := r.request(vo.PHYSICAL_CUS_BALANCE)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_ = json.Unmarshal([]byte(req.Text), &res)
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
func (r *PhysicalRequest) ExpressList() (*transfer.PhysicalExpressListRes, error) {
|
||||
var res transfer.PhysicalExpressListRes
|
||||
req, err := r.request(vo.PHYSICAL_EXPRESS_LIST)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_ = json.Unmarshal([]byte(req.Text), &res)
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
func (r *PhysicalRequest) AddressList() (*transfer.PhysicalAddressListRes, error) {
|
||||
var res transfer.PhysicalAddressListRes
|
||||
req, err := r.request(vo.PHYSICAL_ADDRESS_LIST)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_ = json.Unmarshal([]byte(req.Text), &res)
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
func (r *PhysicalRequest) FinanceBill() (*transfer.PhysicalFinanceBillRes, error) {
|
||||
var res transfer.PhysicalFinanceBillRes
|
||||
req, err := r.request(vo.PHYSICAL_FINANCE_SEARCH)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_ = json.Unmarshal([]byte(req.Text), &res)
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
func (r *PhysicalRequest) OrderInfo() (*transfer.PhysicalOrderInfoRes, error) {
|
||||
var res transfer.PhysicalOrderInfoRes
|
||||
req, err := r.request(vo.PHYSICAL_ORDER_INFO)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_ = json.Unmarshal([]byte(req.Text), &res)
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
func (r *PhysicalRequest) OrderList() (*transfer.PhysicalOrderListRes, error) {
|
||||
var res transfer.PhysicalOrderListRes
|
||||
req, err := r.request(vo.PHYSICAL_ORDER_LIST)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_ = json.Unmarshal([]byte(req.Text), &res)
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
func (r *PhysicalRequest) OrderSubmit() (*transfer.PhysicalOrderSubRes, error) {
|
||||
var res transfer.PhysicalOrderSubRes
|
||||
req, err := r.request(vo.PHYSICAL_ORDER_SUBMIT)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_ = json.Unmarshal([]byte(req.Text), &res)
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
func (r *PhysicalRequest) OrderClose() (*transfer.PhysicalOrderCloseRes, error) {
|
||||
var res transfer.PhysicalOrderCloseRes
|
||||
req, err := r.request(vo.PHYSICAL_ORDER_CLOSE)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_ = json.Unmarshal([]byte(req.Text), &res)
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
func (r *PhysicalRequest) OrderLogisticsLogs() (*transfer.PhysicalOrderLogisticsLogsRes, error) {
|
||||
var res transfer.PhysicalOrderLogisticsLogsRes
|
||||
req, err := r.request(vo.PHYSICAL_ORDER_LOGIC)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_ = json.Unmarshal([]byte(req.Text), &res)
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
func (r *PhysicalRequest) OrderAfterApply() (*transfer.PhysicalOrderAfterApplyRes, error) {
|
||||
var res transfer.PhysicalOrderAfterApplyRes
|
||||
req, err := r.request(vo.PHYSICAL_ORDEAFTER_APPLY)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_ = json.Unmarshal([]byte(req.Text), &res)
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
func (r *PhysicalRequest) OrderAfterReturn() (*transfer.PhysicalOrderAfterReturnRes, error) {
|
||||
var res transfer.PhysicalOrderAfterReturnRes
|
||||
req, err := r.request(vo.PHYSICAL_ORDEAFTER_RETRUN)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_ = json.Unmarshal([]byte(req.Text), &res)
|
||||
return &res, nil
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package types
|
||||
|
||||
type PublicRecharge struct {
|
||||
MerchantId int
|
||||
TimeStamp int
|
||||
Sign string
|
||||
}
|
||||
|
||||
type ExtendParameter struct {
|
||||
ExtendParameter string
|
||||
}
|
||||
|
||||
type PhysicalConf struct {
|
||||
Host string
|
||||
}
|
||||
|
||||
type BaseRes struct {
|
||||
Code string `json:"code"`
|
||||
Message string `json:"message"`
|
||||
}
|
|
@ -15,6 +15,11 @@ type RequestStruct struct {
|
|||
Config etc.RockerMqConfig
|
||||
}
|
||||
|
||||
type RequestStructWithJson struct {
|
||||
RequestBody map[string]interface{}
|
||||
Config etc.RockerMqConfig
|
||||
}
|
||||
|
||||
func SetMqSendDataMarket(reqInfo *RequestStruct, respInfo *request.Response, url string) []byte {
|
||||
log := commonMqSendData(reqInfo, respInfo, url)
|
||||
logByte, _ := json.Marshal(log)
|
||||
|
@ -37,6 +42,11 @@ func SetMqSendDataNewMarket(reqInfo *RequestStruct, respInfo *key.Response, url
|
|||
logByte, _ := json.Marshal(log)
|
||||
return logByte
|
||||
}
|
||||
func SetMqSendDataPhysical(reqInfo *RequestStructWithJson, respInfo *request.Response, url string) []byte {
|
||||
log := commonMqSendData(reqInfo, respInfo, url)
|
||||
logByte, _ := json.Marshal(log)
|
||||
return logByte
|
||||
}
|
||||
|
||||
func SetMqSendDataRs(rsReq *RequestStruct, order *genModel.ServerOrderRs, respInfo *request.Response, url string) []byte {
|
||||
log := commonMqSendData(rsReq, respInfo, url)
|
||||
|
@ -46,9 +56,9 @@ func SetMqSendDataRs(rsReq *RequestStruct, order *genModel.ServerOrderRs, respIn
|
|||
return logByte
|
||||
}
|
||||
|
||||
func commonMqSendData(reqInfo *RequestStruct, respInfo *request.Response, url string) map[string]interface{} {
|
||||
func commonMqSendData(reqData interface{}, respInfo *request.Response, url string) map[string]interface{} {
|
||||
log := make(map[string]interface{}, 5)
|
||||
reqStr, _ := json.Marshal(reqInfo.RequestBody)
|
||||
reqStr, _ := json.Marshal(reqData)
|
||||
log["data"] = string(reqStr)
|
||||
log["url"] = url
|
||||
log["resp"] = respInfo.Text
|
||||
|
|
|
@ -9,4 +9,8 @@ const (
|
|||
|
||||
// 作废
|
||||
NEW_MARKET_DISCARD = "openapi/v1/key/discard"
|
||||
|
||||
NEW_MARKET_LOG_STATU_DEFAULT = 1
|
||||
|
||||
NEW_MARKET_SUCCESS float64 = 200
|
||||
)
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package vo
|
||||
|
||||
const (
|
||||
PHYSICAL_GOODS_DETAIL = "api/v1/open/goods/detail"
|
||||
|
||||
PHYSICAL_GOODS_LIST = "api/v1/open/cus/goods/list"
|
||||
|
||||
PHYSICAL_GOODS_STOCK = "api/v1/open/goods/stocks"
|
||||
|
||||
PHYSICAL_CUS_BALANCE_HIS = "api/v1/open/cus/balance/his"
|
||||
|
||||
PHYSICAL_CUS_BALANCE = "api/v1/open/cus/balance"
|
||||
|
||||
PHYSICAL_EXPRESS_LIST = "api/v1/open/express/list"
|
||||
|
||||
PHYSICAL_ADDRESS_LIST = "api/v1/open/address/list"
|
||||
|
||||
PHYSICAL_FINANCE_SEARCH = "api/v1/open/finance/search_bill_cus"
|
||||
|
||||
PHYSICAL_ORDER_INFO = "api/v1/open/order/info"
|
||||
|
||||
PHYSICAL_ORDER_SUBMIT = "api/v1/open/order/submit"
|
||||
|
||||
PHYSICAL_ORDER_LIST = "api/v1/open/order/list"
|
||||
|
||||
PHYSICAL_ORDER_CLOSE = "api/v1/open/order/close"
|
||||
|
||||
PHYSICAL_ORDER_LOGIC = "api/v1/open/order/logistics"
|
||||
|
||||
PHYSICAL_ORDEAFTER_APPLY = "api/v1/open/orderAfter/apply"
|
||||
|
||||
PHYSICAL_ORDEAFTER_RETRUN = "api/v1/open/orderAfter/return"
|
||||
|
||||
PHYSICAL_LOG_STATU_DEFAULT = 1
|
||||
|
||||
PHYSICAL_SUCCESS float64 = 200
|
||||
)
|
|
@ -36,6 +36,11 @@ type NewMarkets struct {
|
|||
ctx context.Context
|
||||
}
|
||||
|
||||
type Physical struct {
|
||||
svc *mqSvc.ServiceContext
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
func NewMarket(svc *mqSvc.ServiceContext, ctx context.Context) *Market {
|
||||
return &Market{
|
||||
svc: svc,
|
||||
|
@ -64,6 +69,13 @@ func NewNewMarkets(svc *mqSvc.ServiceContext, ctx context.Context) *NewMarkets {
|
|||
}
|
||||
}
|
||||
|
||||
func NewPhysical(svc *mqSvc.ServiceContext, ctx context.Context) *Physical {
|
||||
return &Physical{
|
||||
svc: svc,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
func (m *Market) MessageHandler(tag uint64, ch *amqp.Channel, msg []byte) error {
|
||||
var market = &genModel.ServerMiddleMarketLogs{}
|
||||
err := json.Unmarshal(msg, market)
|
||||
|
@ -189,41 +201,70 @@ func (m *RS) saveRsOrder(logId int64, resq string, resp string) error {
|
|||
|
||||
func (m *NewMarkets) MessageHandler(tag uint64, ch *amqp.Channel, msg []byte) error {
|
||||
var (
|
||||
rs = &genModel.ServerMiddleRsLogs{}
|
||||
rs = &genModel.ServerMiddleNewMarketLogs{}
|
||||
)
|
||||
json.Unmarshal(msg, rs)
|
||||
rs.CreateTime = time.Now()
|
||||
rs.Status = vo.RS_LOG_STATU_DEFAULT
|
||||
logInfo, err := m.svc.DbWrite.RSLogs.Insert(m.ctx, rs)
|
||||
logInfo, err := m.svc.DbWrite.NewMarketLogs.Insert(m.ctx, rs)
|
||||
if err != nil {
|
||||
return fmt.Errorf("rs数据保存失败:%s,原因:%s", msg, err)
|
||||
return fmt.Errorf("new_market数据保存失败:%s,原因:%s", msg, err)
|
||||
}
|
||||
logId, err := logInfo.LastInsertId()
|
||||
if err != nil {
|
||||
return fmt.Errorf("rs日志数据保存失败:%s,原因:%s", msg, err)
|
||||
return fmt.Errorf("new_market日志数据保存失败:%s,原因:%s", msg, err)
|
||||
}
|
||||
err = m.saveRsOrder(logId, rs.Data, rs.Resp)
|
||||
err = m.saveNewMarketOrder(logId, rs.Data, rs.Resp)
|
||||
if err != nil {
|
||||
return fmt.Errorf("rs订单数据保存失败:%s,原因:%s", msg, err)
|
||||
return fmt.Errorf("new_market订单数据保存失败:%s,原因:%s", msg, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *NewMarkets) saveRsOrder(logId int64, resq string, resp string) error {
|
||||
var order = &genModel.ServerOrderRs{}
|
||||
func (m *Physical) MessageHandler(tag uint64, ch *amqp.Channel, msg []byte) error {
|
||||
var (
|
||||
rs = &genModel.ServerMiddlePhysicalLogs{}
|
||||
)
|
||||
json.Unmarshal(msg, rs)
|
||||
rs.CreateTime = time.Now()
|
||||
rs.Status = vo.RS_LOG_STATU_DEFAULT
|
||||
logInfo, err := m.svc.DbWrite.PhysicalLogs.Insert(m.ctx, rs)
|
||||
if err != nil {
|
||||
return fmt.Errorf("new_market数据保存失败:%s,原因:%s", msg, err)
|
||||
}
|
||||
logId, err := logInfo.LastInsertId()
|
||||
if err != nil {
|
||||
return fmt.Errorf("new_market日志数据保存失败:%s,原因:%s", msg, err)
|
||||
}
|
||||
if rs.Url == vo.PHYSICAL_ORDER_SUBMIT {
|
||||
err = m.savePhysicalOrder(logId, rs.Data, rs.Resp)
|
||||
if err != nil {
|
||||
return fmt.Errorf("new_market订单数据保存失败:%s,原因:%s", msg, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *NewMarkets) saveNewMarketOrder(logId int64, resq string, resp string) error {
|
||||
var order = &genModel.ServerOrderNewMarket{}
|
||||
|
||||
order.LogId = logId
|
||||
order.ReqTime = time.Now()
|
||||
order.CreateTime = time.Now()
|
||||
data := do.RsData{Order: order}
|
||||
err := data.SetData(resq, resp)
|
||||
order.Status = vo.MARKET_LOG_STATU_DEFAULT
|
||||
err := do.NewMarketKeyDataSet(order, resq, resp)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = m.svc.DbWrite.OrderRs.FindByOutBizId(m.ctx, order.OutBizNo)
|
||||
_, err = m.svc.DbWrite.OrderNewMarket.FindByOutBizId(m.ctx, order.OutBizNo)
|
||||
if err == sqlx.ErrNotFound {
|
||||
_, err = m.svc.DbWrite.OrderRs.Insert(m.ctx, order)
|
||||
_, err = m.svc.DbWrite.OrderNewMarket.Insert(m.ctx, order)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -255,11 +296,37 @@ func (m *Market) saveMarketOrder(logId int64, resq string, resp string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (m *Physical) savePhysicalOrder(logId int64, resq string, resp string) error {
|
||||
var order = &genModel.ServerOrderPhysical{}
|
||||
|
||||
order.LogId = logId
|
||||
order.ReqTime = time.Now()
|
||||
order.CreateTime = time.Now()
|
||||
order.Status = vo.PHYSICAL_LOG_STATU_DEFAULT
|
||||
err := do.PhysicalDataSet(order, resq, resp)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = m.svc.DbWrite.OrderPhysical.FindByOutBizId(m.ctx, order.CustomerOrderNum)
|
||||
if err == sqlx.ErrNotFound {
|
||||
_, err = m.svc.DbWrite.OrderPhysical.Insert(m.ctx, order)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func AllHandle(c *etc.RockerMqConfig, svc *mqSvc.ServiceContext, ctx context.Context) map[string]Message {
|
||||
result := make(map[string]Message)
|
||||
result[c.TopicPrefix+c.Topic.Market.Name] = NewMarket(svc, ctx)
|
||||
result[c.TopicPrefix+c.Topic.ZLTX.Name] = NewZLTX(svc, ctx)
|
||||
result[c.TopicPrefix+c.Topic.RS.Name] = NewRS(svc, ctx)
|
||||
result[c.TopicPrefix+c.Topic.NewMarket.Name] = NewNewMarkets(svc, ctx)
|
||||
result[c.TopicPrefix+c.Topic.Physical.Name] = NewPhysical(svc, ctx)
|
||||
return result
|
||||
}
|
||||
|
|
|
@ -22,20 +22,28 @@ func NewServiceContext(c config.Config) *ServiceContext {
|
|||
func DbModel(datasource string, c config.Config) *Model {
|
||||
sqlConn := sqlx.NewMysql(datasource)
|
||||
return &Model{
|
||||
MarketLogs: genModel.NewServerMiddleMarketLogsModel(sqlConn),
|
||||
ZLTXLogs: genModel.NewServerMiddleZltxLogsModel(sqlConn),
|
||||
RSLogs: genModel.NewServerMiddleRsLogsModel(sqlConn),
|
||||
OrderRs: genModel.NewServerOrderRsModel(sqlConn),
|
||||
OrderMarket: genModel.NewServerOrderMarketModel(sqlConn),
|
||||
OrderZLTX: genModel.NewServerOrderZltxModel(sqlConn),
|
||||
NewMarketLogs: genModel.NewServerMiddleNewMarketLogsModel(sqlConn),
|
||||
MarketLogs: genModel.NewServerMiddleMarketLogsModel(sqlConn),
|
||||
ZLTXLogs: genModel.NewServerMiddleZltxLogsModel(sqlConn),
|
||||
RSLogs: genModel.NewServerMiddleRsLogsModel(sqlConn),
|
||||
PhysicalLogs: genModel.NewServerMiddlePhysicalLogsModel(sqlConn),
|
||||
OrderRs: genModel.NewServerOrderRsModel(sqlConn),
|
||||
OrderMarket: genModel.NewServerOrderMarketModel(sqlConn),
|
||||
OrderZLTX: genModel.NewServerOrderZltxModel(sqlConn),
|
||||
OrderNewMarket: genModel.NewServerOrderNewMarketModel(sqlConn),
|
||||
OrderPhysical: genModel.NewServerOrderPhysicalModel(sqlConn),
|
||||
}
|
||||
}
|
||||
|
||||
type Model struct {
|
||||
MarketLogs genModel.ServerMiddleMarketLogsModel
|
||||
ZLTXLogs genModel.ServerMiddleZltxLogsModel
|
||||
RSLogs genModel.ServerMiddleRsLogsModel
|
||||
OrderRs genModel.ServerOrderRsModel
|
||||
OrderMarket genModel.ServerOrderMarketModel
|
||||
OrderZLTX genModel.ServerOrderZltxModel
|
||||
NewMarketLogs genModel.ServerMiddleNewMarketLogsModel
|
||||
MarketLogs genModel.ServerMiddleMarketLogsModel
|
||||
ZLTXLogs genModel.ServerMiddleZltxLogsModel
|
||||
RSLogs genModel.ServerMiddleRsLogsModel
|
||||
PhysicalLogs genModel.ServerMiddlePhysicalLogsModel
|
||||
OrderRs genModel.ServerOrderRsModel
|
||||
OrderMarket genModel.ServerOrderMarketModel
|
||||
OrderZLTX genModel.ServerOrderZltxModel
|
||||
OrderNewMarket genModel.ServerOrderNewMarketModel
|
||||
OrderPhysical genModel.ServerOrderPhysicalModel
|
||||
}
|
||||
|
|
|
@ -96,3 +96,78 @@ func (s *TransferServer) NewMarketDiscard(ctx context.Context, in *transfer.NewM
|
|||
l := logic.NewNewMarketDiscardLogic(ctx, s.svcCtx)
|
||||
return l.NewMarketDiscard(in)
|
||||
}
|
||||
|
||||
func (s *TransferServer) PhysicalGoodsList(ctx context.Context, in *transfer.PhysicalGoodsListReq) (*transfer.PhysicalGoodsListRes, error) {
|
||||
l := logic.NewPhysicalGoodsListLogic(ctx, s.svcCtx)
|
||||
return l.PhysicalGoodsList(in)
|
||||
}
|
||||
|
||||
func (s *TransferServer) PhysicalGoodsDetail(ctx context.Context, in *transfer.PhysicalGoodsDetailReq) (*transfer.GoodsStructWithChild, error) {
|
||||
l := logic.NewPhysicalGoodsDetailLogic(ctx, s.svcCtx)
|
||||
return l.PhysicalGoodsDetail(in)
|
||||
}
|
||||
|
||||
func (s *TransferServer) PhysicalGoodsStock(ctx context.Context, in *transfer.PhysicalGoodsStockReq) (*transfer.PhysicalGoodsStockRes, error) {
|
||||
l := logic.NewPhysicalGoodsStockLogic(ctx, s.svcCtx)
|
||||
return l.PhysicalGoodsStock(in)
|
||||
}
|
||||
|
||||
func (s *TransferServer) PhysicalCusLogs(ctx context.Context, in *transfer.PhysicalCusLogsReq) (*transfer.PhysicalCusLogsRes, error) {
|
||||
l := logic.NewPhysicalCusLogsLogic(ctx, s.svcCtx)
|
||||
return l.PhysicalCusLogs(in)
|
||||
}
|
||||
|
||||
func (s *TransferServer) PhysicalCusBalance(ctx context.Context, in *transfer.EmptyReqs) (*transfer.PhysicalCusBalanceRes, error) {
|
||||
l := logic.NewPhysicalCusBalanceLogic(ctx, s.svcCtx)
|
||||
return l.PhysicalCusBalance(in)
|
||||
}
|
||||
|
||||
func (s *TransferServer) PhysicalExpressList(ctx context.Context, in *transfer.PhysicalExpressListReq) (*transfer.PhysicalExpressListRes, error) {
|
||||
l := logic.NewPhysicalExpressListLogic(ctx, s.svcCtx)
|
||||
return l.PhysicalExpressList(in)
|
||||
}
|
||||
|
||||
func (s *TransferServer) PhysicalAddressList(ctx context.Context, in *transfer.PhysicalAddressListReq) (*transfer.PhysicalAddressListRes, error) {
|
||||
l := logic.NewPhysicalAddressListLogic(ctx, s.svcCtx)
|
||||
return l.PhysicalAddressList(in)
|
||||
}
|
||||
|
||||
func (s *TransferServer) PhysicalFinanceBill(ctx context.Context, in *transfer.PhysicalFinanceBillReq) (*transfer.PhysicalFinanceBillRes, error) {
|
||||
l := logic.NewPhysicalFinanceBillLogic(ctx, s.svcCtx)
|
||||
return l.PhysicalFinanceBill(in)
|
||||
}
|
||||
|
||||
func (s *TransferServer) PhysicalOrderInfo(ctx context.Context, in *transfer.PhysicalOrderInfoReq) (*transfer.PhysicalOrderInfoRes, error) {
|
||||
l := logic.NewPhysicalOrderInfoLogic(ctx, s.svcCtx)
|
||||
return l.PhysicalOrderInfo(in)
|
||||
}
|
||||
|
||||
func (s *TransferServer) PhysicalOrderList(ctx context.Context, in *transfer.PhysicalOrderListReq) (*transfer.PhysicalOrderListRes, error) {
|
||||
l := logic.NewPhysicalOrderListLogic(ctx, s.svcCtx)
|
||||
return l.PhysicalOrderList(in)
|
||||
}
|
||||
|
||||
func (s *TransferServer) PhysicalOrderSub(ctx context.Context, in *transfer.PhysicalOrderSubReq) (*transfer.PhysicalOrderSubRes, error) {
|
||||
l := logic.NewPhysicalOrderSubLogic(ctx, s.svcCtx)
|
||||
return l.PhysicalOrderSub(in)
|
||||
}
|
||||
|
||||
func (s *TransferServer) PhysicalOrderClose(ctx context.Context, in *transfer.PhysicalOrderCloseReq) (*transfer.PhysicalOrderCloseRes, error) {
|
||||
l := logic.NewPhysicalOrderCloseLogic(ctx, s.svcCtx)
|
||||
return l.PhysicalOrderClose(in)
|
||||
}
|
||||
|
||||
func (s *TransferServer) PhysicalOrderLogisticsLogs(ctx context.Context, in *transfer.PhysicalOrderLogisticsLogsReq) (*transfer.PhysicalOrderLogisticsLogsRes, error) {
|
||||
l := logic.NewPhysicalOrderLogisticsLogsLogic(ctx, s.svcCtx)
|
||||
return l.PhysicalOrderLogisticsLogs(in)
|
||||
}
|
||||
|
||||
func (s *TransferServer) PhysicalOrderAfterApply(ctx context.Context, in *transfer.PhysicalOrderAfterApplyReq) (*transfer.PhysicalOrderAfterApplyRes, error) {
|
||||
l := logic.NewPhysicalOrderAfterApplyLogic(ctx, s.svcCtx)
|
||||
return l.PhysicalOrderAfterApply(in)
|
||||
}
|
||||
|
||||
func (s *TransferServer) PhysicalOrderAfterReturn(ctx context.Context, in *transfer.PhysicalOrderAfterReturnReq) (*transfer.PhysicalOrderAfterReturnRes, error) {
|
||||
l := logic.NewPhysicalOrderAfterReturnLogic(ctx, s.svcCtx)
|
||||
return l.PhysicalOrderAfterReturn(in)
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"trasfer_middleware/cmd/rpc/internal/config"
|
||||
"trasfer_middleware/cmd/rpc/internal/logic/po/market"
|
||||
"trasfer_middleware/cmd/rpc/internal/logic/po/new_market"
|
||||
"trasfer_middleware/cmd/rpc/internal/logic/po/physical"
|
||||
"trasfer_middleware/cmd/rpc/internal/logic/po/rs"
|
||||
"trasfer_middleware/cmd/rpc/internal/logic/po/zltx"
|
||||
)
|
||||
|
@ -16,6 +17,7 @@ type ServiceContext struct {
|
|||
Market *market.Market
|
||||
RS *rs.RS
|
||||
NewMarket *new_market.NewMarketStruct
|
||||
Physical *physical.Physical
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
|
@ -31,5 +33,6 @@ func NewServiceContext(c config.Config) *ServiceContext {
|
|||
Market: market.NewMarket(c.Market),
|
||||
RS: rs.NewRs(c.RS),
|
||||
NewMarket: new_market.NewNewMarket(c.NewMarket, c.Mq),
|
||||
Physical: physical.NewPhysical(c.Physical),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,8 +37,522 @@ service Transfer {
|
|||
rpc newMarketOrder(NewMarketOrderReq) returns(NewMarketOrderRes);
|
||||
rpc newMarketQuery(NewMarketQueryReq) returns(NewMarketOrderRes);
|
||||
rpc newMarketDiscard(NewMarketDiscardReq) returns(NewMarketDiscardRes);
|
||||
|
||||
rpc physicalGoodsList(PhysicalGoodsListReq) returns(PhysicalGoodsListRes);
|
||||
rpc physicalGoodsDetail(PhysicalGoodsDetailReq) returns(GoodsStructWithChild);
|
||||
rpc physicalGoodsStock(PhysicalGoodsStockReq) returns(PhysicalGoodsStockRes);
|
||||
rpc physicalCusLogs(PhysicalCusLogsReq) returns(PhysicalCusLogsRes);
|
||||
rpc physicalCusBalance(EmptyReqs) returns(PhysicalCusBalanceRes);
|
||||
rpc physicalExpressList(PhysicalExpressListReq) returns(PhysicalExpressListRes);
|
||||
rpc physicalAddressList(PhysicalAddressListReq) returns(PhysicalAddressListRes);
|
||||
rpc physicalFinanceBill(PhysicalFinanceBillReq) returns(PhysicalFinanceBillRes);
|
||||
rpc physicalOrderInfo(PhysicalOrderInfoReq) returns(PhysicalOrderInfoRes);
|
||||
rpc physicalOrderList(PhysicalOrderListReq) returns(PhysicalOrderListRes);
|
||||
rpc physicalOrderSub(PhysicalOrderSubReq) returns(PhysicalOrderSubRes);
|
||||
rpc physicalOrderClose(PhysicalOrderCloseReq) returns(PhysicalOrderCloseRes);
|
||||
rpc physicalOrderLogisticsLogs(PhysicalOrderLogisticsLogsReq) returns(PhysicalOrderLogisticsLogsRes);
|
||||
rpc physicalOrderAfterApply(PhysicalOrderAfterApplyReq) returns(PhysicalOrderAfterApplyRes);
|
||||
rpc physicalOrderAfterReturn(PhysicalOrderAfterReturnReq) returns(PhysicalOrderAfterReturnRes);
|
||||
}
|
||||
|
||||
message PhysicalOrderAfterApplyRes {
|
||||
string code = 1;
|
||||
string message = 2;
|
||||
PhysicalOrderAfterApplyResData data = 3;
|
||||
|
||||
}
|
||||
|
||||
message PhysicalOrderAfterApplyResData {
|
||||
message ApplyOrderAfterByOpenapiReply {
|
||||
repeated string order_after_nums = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
message PhysicalOrderAfterApplyReq {
|
||||
string app_id=3;
|
||||
OrderAfterOpBasic orderAfterBasic = 1;
|
||||
repeated OrderAfterOpGoodsInfo goodsList = 2;
|
||||
}
|
||||
|
||||
message OrderAfterOpBasic {
|
||||
int32 id = 1 [json_name = "id"];
|
||||
string order_after_num = 2 [json_name = "order_after_num"];
|
||||
string operator = 3 [json_name = "operator"];
|
||||
int32 operator_id = 4 [json_name = "operator_id"];
|
||||
int32 type = 5 [json_name = "type"];
|
||||
int32 send_status = 6 [json_name = "send_status"];
|
||||
string reason = 7 [json_name = "reason"];
|
||||
string image = 8 [json_name = "image"];
|
||||
string old_order_num = 9 [json_name = "old_order_num"];
|
||||
string new_order_num = 10 [json_name = "new_order_num"];
|
||||
string return_logistics = 11 [json_name = "return_logistics"];
|
||||
string return_logistics_odd_num = 12 [json_name = "return_logistics_odd_num"];
|
||||
string remark = 13 [json_name = "remark"];
|
||||
int32 status = 14 [json_name = "status"];
|
||||
string audit_at = 15 [json_name = "audit_at"];
|
||||
string created_at = 16 [json_name = "created_at"];
|
||||
}
|
||||
|
||||
message OrderAfterOpGoodsInfo {
|
||||
int32 id = 1 [json_name = "id"];
|
||||
int32 order_after_id = 2 [json_name = "order_after_id"];
|
||||
int32 goods_id = 3 [json_name = "goods_id"];
|
||||
string goods_name = 4 [json_name = "goods_name"];
|
||||
string goods_num = 5 [json_name = "goods_num"];
|
||||
int32 number = 6 [json_name = "number"];
|
||||
int32 total_number = 7;
|
||||
double price = 8 [json_name = "price"];
|
||||
string created_at = 9 [json_name = "created_at"];
|
||||
int32 old_goods_id = 10 [json_name = "old_goods_id"];
|
||||
int32 supplier_id = 11 [json_name = "supplier_id"];
|
||||
string supplier_name = 12 [json_name = "supplier_name"];
|
||||
int32 warehouse_id = 13 [json_name = "warehouse_id"];
|
||||
string warehouse_name = 14 [json_name = "warehouse_name"];
|
||||
string old_goods_name = 15 [json_name = "old_goods_name"];
|
||||
string old_goods_num = 16 [json_name = "old_goods_num"];
|
||||
string new_goods_num = 17 [json_name = "new_goods_num"];
|
||||
}
|
||||
|
||||
message PhysicalOrderAfterReturnRes {
|
||||
string code = 1;
|
||||
string message = 2;
|
||||
PhysicalOrderAfterReturnResData data = 3;
|
||||
|
||||
}
|
||||
|
||||
message PhysicalOrderAfterReturnResData {
|
||||
string order_after_num = 1;
|
||||
}
|
||||
|
||||
message PhysicalOrderAfterReturnReq {
|
||||
string app_id=5;
|
||||
int32 order_after_id = 1 [json_name = "order_after_id"];
|
||||
string return_logistics = 2 [json_name = "return_logistics"];
|
||||
string return_logistics_odd_num = 3 [json_name = "return_logistics_odd_num"];
|
||||
string order_after_num = 4 [json_name = "order_after_num"];
|
||||
}
|
||||
|
||||
message PhysicalOrderLogisticsLogsRes{
|
||||
string code = 1;
|
||||
string message = 2;
|
||||
PhysicalOrderLogisticsLogsResData data = 3;
|
||||
|
||||
}
|
||||
|
||||
message PhysicalOrderLogisticsLogsResData{
|
||||
repeated OrderOpLogistics orderLogistics = 1;
|
||||
}
|
||||
|
||||
message OrderOpLogistics {
|
||||
int32 order_id = 1;
|
||||
string logistics_name = 2;
|
||||
string logistics_odd_num = 3;
|
||||
double logistics_fee = 4;
|
||||
string order_num = 5;
|
||||
int32 status = 9;
|
||||
string created_at = 10;
|
||||
int32 id = 11;
|
||||
string logistics_json = 12;
|
||||
}
|
||||
|
||||
message PhysicalOrderLogisticsLogsReq{
|
||||
string app_id=3;
|
||||
string order_num = 1 [json_name = "order_num"];
|
||||
string customer_order_num = 2 [json_name = "customer_order_num"];
|
||||
}
|
||||
|
||||
message PhysicalOrderCloseRes{
|
||||
string code = 1;
|
||||
string message = 2;
|
||||
PhysicalOrderCloseResData data = 3;
|
||||
|
||||
}
|
||||
|
||||
|
||||
message PhysicalOrderCloseResData{
|
||||
string order_num = 1;
|
||||
int32 status = 2;
|
||||
}
|
||||
|
||||
message PhysicalOrderCloseReq{
|
||||
string app_id=3;
|
||||
string order_num = 1;
|
||||
string message = 2;
|
||||
}
|
||||
|
||||
message PhysicalOrderSubRes{
|
||||
string code = 1;
|
||||
string message = 2;
|
||||
PhysicalOrderSubResData data = 3;
|
||||
|
||||
}
|
||||
|
||||
message PhysicalOrderSubResData{
|
||||
string order_num = 1;
|
||||
}
|
||||
|
||||
message PhysicalOrderSubReq{
|
||||
string app_id=3;
|
||||
OrderOpBasicInfo orderBasic = 1;
|
||||
repeated OrderOpSubmitGoodsInfo goodsList = 2;
|
||||
}
|
||||
|
||||
message OrderOpSubmitGoodsInfo {
|
||||
|
||||
int32 number = 17; // 商品数量
|
||||
|
||||
string goods_num = 19; // 商品编号
|
||||
|
||||
}
|
||||
|
||||
message PhysicalOrderListRes{
|
||||
string code = 1;
|
||||
string message = 2;
|
||||
PhysicalOrderListResData data = 3;
|
||||
|
||||
}
|
||||
|
||||
message PhysicalOrderListResData{
|
||||
repeated PhysicalOrderInfoRes data = 1;
|
||||
int32 total = 2;
|
||||
int32 page = 3;
|
||||
int32 limit = 4;
|
||||
}
|
||||
|
||||
message PhysicalOrderListReq {
|
||||
string app_id=10;
|
||||
int32 page = 1;
|
||||
int32 limit = 2;
|
||||
repeated string order_nums = 3 [json_name = "order_nums"];
|
||||
int32 from = 4 ; //订单来源(1:前端用户订单,2:管理后台订单,3:售后订单)
|
||||
repeated int32 status = 5;
|
||||
int32 is_after = 6;
|
||||
repeated string customer_order_nums = 7;
|
||||
repeated int32 abnormal_status = 8;
|
||||
repeated string created_at = 9;
|
||||
}
|
||||
|
||||
message PhysicalOrderInfoRes {
|
||||
string code = 1;
|
||||
string message = 2;
|
||||
PhysicalOrderInfoResData data = 3;
|
||||
message PhysicalOrderInfoResData {
|
||||
OrderInfoData orderInfo=1;
|
||||
message OrderInfoData{
|
||||
OrderOpBasicInfo orderBasic = 1;
|
||||
repeated OrderOpGoodsInfo goodsList = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
message OrderOpBasicInfo {
|
||||
string customer_order_num = 1 ; // 客户订单编号
|
||||
string customer_name = 3; // 客户名称
|
||||
string consignee = 4; // 收货人
|
||||
string consignee_mobile = 5;
|
||||
string consignee_address = 6; // 收货地址
|
||||
string consignee_province_code = 7; // 省份编码
|
||||
string consignee_city_code = 8; // 市编码
|
||||
string consignee_area_code = 9; // 区编码
|
||||
string consignee_county_code = 10; // 县编码
|
||||
string in_remark = 14; // 客服备注
|
||||
}
|
||||
|
||||
message OrderOpGoodsInfo {
|
||||
int32 order_id = 1;
|
||||
int32 goods_id = 2;
|
||||
string goods_name = 3;
|
||||
string goods_specs = 6; // 商品品牌
|
||||
string goods_unit = 7; // 单位
|
||||
double sale_price = 9; // 销售价
|
||||
int32 compose_goods_id = 10; // 组合商品ID
|
||||
string compose_goods_name = 11; // 组合商品名称
|
||||
int32 is_compose = 16; // 是否组合商品 0 不是, 1 是
|
||||
int32 number = 17; // 商品数量
|
||||
repeated OrderOpSubmitGoodsInfo childrenGoodsList = 18; // 组合商品列表,如果是组合商品,拼接子商品
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
message PhysicalOrderInfoReq{
|
||||
string app_id=5;
|
||||
string order_num = 1 ;
|
||||
}
|
||||
|
||||
message BillCus{
|
||||
string customer_name = 1 [json_name = "customer_name"];
|
||||
string goods_name = 2 [json_name = "goods_name"];
|
||||
double settlement_unit_price = 3 [json_name = "settlement_unit_price"];
|
||||
int32 number = 4;
|
||||
double total_amount = 5 [json_name = "total_amount"];
|
||||
int32 pay_type = 6 [json_name = "pay_type"];
|
||||
int32 receipt_type = 7 [json_name = "receipt_type"];
|
||||
string created_at = 8 [json_name = "created_at"];
|
||||
string updated_at = 9 [json_name = "updated_at"];
|
||||
int32 is_confirm = 10 [json_name = "is_confirm"];
|
||||
int32 is_invoicing = 11 [json_name = "is_invoicing"];
|
||||
}
|
||||
|
||||
message PhysicalFinanceBillReq {
|
||||
string app_id=8;
|
||||
string goods_name = 1;
|
||||
int32 pay_type = 2 ;
|
||||
int32 receipt_type = 3;
|
||||
repeated string created_at = 4;
|
||||
repeated string updated_at = 5;
|
||||
int32 limit = 6;
|
||||
int32 page = 7;
|
||||
}
|
||||
|
||||
message PhysicalFinanceBillRes {
|
||||
string code = 1;
|
||||
string message = 2;
|
||||
PhysicalFinanceBillResData data = 3;
|
||||
|
||||
}
|
||||
|
||||
message PhysicalFinanceBillResData {
|
||||
repeated BillCus data = 1;
|
||||
int32 total = 2;
|
||||
}
|
||||
|
||||
message PhysicalAddressListReq{
|
||||
string app_id=5;
|
||||
string pcode = 1 [json_name = "pcode"];
|
||||
string name = 2 [json_name = "name"];
|
||||
int32 level = 3 [json_name = "level"];
|
||||
}
|
||||
|
||||
message PhysicalAddressListRes{
|
||||
string code = 1;
|
||||
string message = 2;
|
||||
List data = 3;
|
||||
}
|
||||
|
||||
message List{
|
||||
repeated Address list = 1;
|
||||
}
|
||||
|
||||
|
||||
message Address{
|
||||
int64 code = 1 [json_name = "code"];
|
||||
int64 pcode = 2 [json_name = "pcode"];
|
||||
string name = 3 [json_name = "name"];
|
||||
int32 level = 4[json_name = "level"];
|
||||
}
|
||||
|
||||
message PhysicalExpressListRes{
|
||||
string code = 1;
|
||||
string message = 2;
|
||||
List data = 3;
|
||||
|
||||
}
|
||||
message PhysicalExpressListResData{
|
||||
repeated ExpressList express = 1;
|
||||
}
|
||||
|
||||
message ExpressList{
|
||||
string nu = 1;
|
||||
int32 status = 2;
|
||||
repeated Express data = 3;
|
||||
}
|
||||
|
||||
message Express{
|
||||
string time = 1;
|
||||
string context = 2;
|
||||
}
|
||||
|
||||
message PhysicalExpressListReq{
|
||||
string app_id=5;
|
||||
repeated ExpressData express_data = 1;
|
||||
}
|
||||
|
||||
message ExpressData{
|
||||
// 快递单号
|
||||
string nu = 1;
|
||||
// 快递公司名称
|
||||
string com = 2;
|
||||
// 是否强制刷新
|
||||
int32 is_force = 3;
|
||||
|
||||
}
|
||||
|
||||
message EmptyReqs{
|
||||
string app_id=5;
|
||||
}
|
||||
|
||||
message PhysicalCusBalanceRes{
|
||||
string code = 1;
|
||||
string message = 2;
|
||||
PhysicalCusBalanceResData data = 3;
|
||||
}
|
||||
message PhysicalCusBalanceResData{
|
||||
string name = 1;
|
||||
string full_name = 2;
|
||||
float credit_grant = 17;
|
||||
float balance = 18;
|
||||
}
|
||||
|
||||
|
||||
message PhysicalCusLogsReq{
|
||||
string app_id=5;
|
||||
int32 from_type = 1;
|
||||
string order_num=4;
|
||||
repeated string created_at = 2;
|
||||
int32 limit = 6;
|
||||
int32 page = 7;
|
||||
}
|
||||
|
||||
message PhysicalCusLogsRes{
|
||||
string code = 1;
|
||||
string message = 2;
|
||||
PhysicalCusLogsResDataList data = 3;
|
||||
message PhysicalCusLogsResDataList{
|
||||
repeated BalanceLog list = 1;
|
||||
int32 total = 2;
|
||||
}
|
||||
message BalanceLog {
|
||||
int32 from_type=1;
|
||||
float current_balance=2;
|
||||
float amount=3;
|
||||
string remark=4;
|
||||
string created_at=5;
|
||||
string order_num=6;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
message PhysicalGoodsStockReq{
|
||||
string app_id=5;
|
||||
repeated string goods_nums = 1;
|
||||
}
|
||||
|
||||
message PhysicalGoodsStockRes{
|
||||
string code = 1;
|
||||
string message = 2;
|
||||
PhysicalGoodsStockResData data = 3;
|
||||
|
||||
}
|
||||
message PhysicalGoodsStockResData{
|
||||
repeated GoodsStock list = 1;
|
||||
message GoodsStock{
|
||||
string goods_num = 1;
|
||||
bool stock_is_enough = 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
message PhysicalGoodsDetailReq{
|
||||
string app_id=5;
|
||||
string goods_num = 1 ;
|
||||
}
|
||||
|
||||
|
||||
message PhysicalGoodsListReq {
|
||||
string app_id=5;
|
||||
repeated string goods_nums = 3;
|
||||
int32 status = 1;
|
||||
string title = 2;
|
||||
int32 is_hot =4;
|
||||
}
|
||||
|
||||
message PhysicalGoodsListRes {
|
||||
string code = 1;
|
||||
string message = 2;
|
||||
List data = 3;
|
||||
}
|
||||
|
||||
message GoodsStructWithChild {
|
||||
string code = 1;
|
||||
string message = 2;
|
||||
GoodsStructWithChildData data = 3;
|
||||
}
|
||||
message GoodsStructWithChildData {
|
||||
//商品标题
|
||||
string title = 2 ;
|
||||
//商品简介、卖点
|
||||
string introduction = 3 ;
|
||||
//商品品牌
|
||||
string brand = 30;
|
||||
//商品编码
|
||||
string goods_num = 4;
|
||||
//商品货号
|
||||
string goods_code = 5;
|
||||
//商品条形码
|
||||
string goods_bar_code = 6;
|
||||
//是否组合商品
|
||||
int32 is_compose_goods = 7;
|
||||
//市场价
|
||||
float price = 8;
|
||||
//单位
|
||||
string unit = 9 ;
|
||||
//保质期
|
||||
int32 sell_by_date = 10 ;
|
||||
//保质期单位
|
||||
string sell_by_date_unit = 11 ;
|
||||
//外部平台链接
|
||||
string external_url = 12 ;
|
||||
//电商平台价格,单位分
|
||||
float external_price = 14 ;
|
||||
//折扣
|
||||
float discount = 13 ;
|
||||
//销售价
|
||||
float sales_price = 15 ;
|
||||
//商品参数
|
||||
string goods_attributes = 17 ;
|
||||
//商品说明
|
||||
string goods_illustration = 25 ;
|
||||
//状态(1:上架,2:下架)
|
||||
int32 status = 18 ;
|
||||
//是否热销主推(1:是,2:否)
|
||||
int32 is_hot = 19 ;
|
||||
repeated GoodsChild child = 28 ;
|
||||
repeated Media media = 31;
|
||||
message Media{
|
||||
int32 type=6 ;
|
||||
int32 sort =4;
|
||||
string url =9;
|
||||
}
|
||||
}
|
||||
|
||||
message GoodsChild {
|
||||
|
||||
//商品标题
|
||||
string title = 2 ;
|
||||
//商品品牌
|
||||
string brand = 29;
|
||||
//商品简介、卖点
|
||||
string introduction = 3 ;
|
||||
//商品编码
|
||||
string goods_num = 4 ;
|
||||
//商品货号
|
||||
string goods_code = 5 ;
|
||||
//商品条形码
|
||||
string goods_bar_code = 6 ;
|
||||
//市场价,单位分
|
||||
int32 price = 8 ;
|
||||
//单位
|
||||
string unit = 9 ;
|
||||
//保质期
|
||||
int32 sell_by_date = 10 ;
|
||||
//保质期单位
|
||||
string sell_by_date_unit = 11 ;
|
||||
//外部平台链接
|
||||
string external_url = 12 ;
|
||||
//电商平台价格,单位分
|
||||
float external_price = 14 ;
|
||||
//商品参数
|
||||
string goods_attributes = 17 ;
|
||||
//商品说明
|
||||
string goods_illustration = 25;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
message NewMarketDiscardReq {
|
||||
string app_id = 1;
|
||||
string out_biz_no = 2;
|
||||
|
|
|
@ -27,9 +27,7 @@ func main() {
|
|||
serviceGroup := service.NewServiceGroup()
|
||||
defer serviceGroup.Stop()
|
||||
res := mq2.AllHandle(&c.Mq, svcCtx, ctx)
|
||||
|
||||
mqSv := mqServer.NewRocketmq(&c.Mq)
|
||||
|
||||
err := mqSv.Consume(ctx, res)
|
||||
if err != nil {
|
||||
sysLog.ErrQueueLog(ctx, err)
|
||||
|
|
|
@ -11,16 +11,16 @@ import (
|
|||
|
||||
// 请求结构体
|
||||
type Request struct {
|
||||
Method string `json:"method"` // 请求方法
|
||||
Url string `json:"url"` // 请求url
|
||||
Params map[string]string `json:"params"` // Query参数
|
||||
Headers map[string]string `json:"headers"` // 请求头
|
||||
Cookies map[string]string `json:"cookies"` // todo 处理 Cookies
|
||||
Data map[string]string `json:"data"` // 表单格式请求数据
|
||||
Json map[string]string `json:"json"` // JSON格式请求数据 todo 多层 嵌套
|
||||
Files map[string]string `json:"files"` // todo 处理 Files
|
||||
Raw string `json:"raw"` // 原始请求数据
|
||||
JsonByte []byte `json:"json_raw"` // JSON格式请求数据 todo 多层 嵌套
|
||||
Method string `json:"method"` // 请求方法
|
||||
Url string `json:"url"` // 请求url
|
||||
Params map[string]string `json:"params"` // Query参数
|
||||
Headers map[string]string `json:"headers"` // 请求头
|
||||
Cookies map[string]string `json:"cookies"` // todo 处理 Cookies
|
||||
Data map[string]string `json:"data"` // 表单格式请求数据
|
||||
Json map[string]interface{} `json:"json"` // JSON格式请求数据 todo 多层 嵌套
|
||||
Files map[string]string `json:"files"` // todo 处理 Files
|
||||
Raw string `json:"raw"` // 原始请求数据
|
||||
JsonByte []byte `json:"json_raw"` // JSON格式请求数据 todo 多层 嵌套
|
||||
}
|
||||
|
||||
// 响应结构体
|
||||
|
|
Loading…
Reference in New Issue