plugins/plugins/wx_cpn/internal/transform.go

72 lines
1.5 KiB
Go

package internal
import (
"codeup.aliyun.com/6552e56cc3b2728a4557fc18/plugin/proto"
"encoding/json"
"fmt"
"go/types"
)
type Config struct {
AppId string `json:"app_id"`
Prk string `json:"prk"`
Npk string `json:"npk"`
}
func transConfig(config *proto.Config) (*Config, error) {
var c Config
err := json.Unmarshal(config.Conf, &c)
if err != nil {
return nil, err
}
return &c, nil
}
func orderReq(order *proto.OrderRequest_Order, product *proto.OrderRequest_Product) (*types.Nil, error) {
type Extra struct {
LogonId string `json:"logon_id"`
PhoneId string `json:"phone_id"`
}
var extra Extra
if order.Extra != nil {
err := json.Unmarshal(order.Extra, &extra)
if err != nil {
return nil, fmt.Errorf("order extra json unmarshal error: %v", err)
}
}
return nil, nil
}
func orderResp(request *proto.OrderRequest) *proto.OrderResponse {
return nil
}
func queryReq(in *proto.QueryRequest_Order) (*types.Nil, error) {
type Extra struct {
LogonId string `json:"logon_id"`
PhoneId string `json:"phone_id"`
ActivityID string `json:"activity_id"`
}
var extra Extra
if in.Extra != nil {
err := json.Unmarshal(in.Extra, &extra)
if err != nil {
return nil, fmt.Errorf("order extra json unmarshal error: %v", err)
}
}
return nil, nil
}
func queryResp(request *proto.QueryRequest) *proto.QueryResponse {
return nil
}
func notifyReq(in *proto.NotifyRequest) *types.Nil {
return nil
}
func notifyResp() *proto.NotifyResponse {
return nil
}