From 034d2450f8924e84e6d8c8c47b24cc1bc0c6a887 Mon Sep 17 00:00:00 2001 From: Peter Cheng <teed7334@gmail.com> Date: Tue, 25 Jun 2019 12:11:14 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=BF=BD=E5=8A=A0=E8=90=AC=E4=BA=8B=E9=81=94?= =?UTF-8?q?=E9=87=91=E6=B5=81API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2.靽格迤�𡟺������栞���烾𥲤隤文�誯�� --- README.md | 22 ++++ base/curl.go | 39 +++++++ beans/gomypay.pb.go | 227 +++++++++++++++++++++++++++++++++++++++++ beans/gomypay.proto | 25 +++++ beans/punchclock.pb.go | 44 +++----- beans/redis.pb.go | 12 +-- beans/sendMail.pb.go | 14 +-- controllers/gomypay.go | 34 ++++++ route/api.go | 1 + 9 files changed, 373 insertions(+), 45 deletions(-) create mode 100644 base/curl.go create mode 100644 beans/gomypay.pb.go create mode 100644 beans/gomypay.proto create mode 100644 controllers/gomypay.go diff --git a/README.md b/README.md index 6ca524f..55ea5ba 100644 --- a/README.md +++ b/README.md @@ -168,4 +168,26 @@ go get -u -v github.com/gin-gonic/gin ``` //HTTP Header��閮剖�𡁏�𤦊ontent-Type: application/json {} +``` + +��齿鰵閮剖�𡁏���匧摱撌乩�穃������ http://[Your Host Name]:8806/GoMyPay/PayCreditCard +``` +//HTTP Header��閮剖�𡁏�𤦊ontent-Type: application/json +{ + "Send_Type":"1", + "Pay_Mode_No":"2", + "Order_No":"2019062500001", + "Amount":"100", + "TransCode":"00", + "Buyer_Name":"Peter Cheng", + "Buyer_Mail":"teed7334@gmail.com", + "Buyer_Memo":"Omega ��钅薗", + "CardNo":"5509158011124600", + "ExpireDate":"2307", + "CVV":"811", + "TransMode":"1", + "Installment":"0", + "e_return":"1", + "Str_Check":"" +} ``` \ No newline at end of file diff --git a/base/curl.go b/base/curl.go new file mode 100644 index 0000000..35e6a41 --- /dev/null +++ b/base/curl.go @@ -0,0 +1,39 @@ +package base + +import ( + "bytes" + "io/ioutil" + "log" + "net/http" +) + +//GetURL �誯�孴TTP GET��硋�㛖雯��鞈��� +func GetURL(url string) []byte { + request, err := http.NewRequest("GET", url, nil) + if err != nil { + panic(err) + } + client := &http.Client{} + result, err := client.Do(request) + if err != nil { + panic(err) + } + body, _ := ioutil.ReadAll(result.Body) + defer result.Body.Close() + return body +} + +//PostURL �誯�孴TTP POST��磰���嗵策�鸌摰𡁶雯�� +func PostURL(url string, params []byte) []byte { + request, err := http.NewRequest("POST", url, bytes.NewBuffer(params)) + request.Header.Set("X-Custom-Header", "counter") + request.Header.Set("Content-Type", "application/json") + client := &http.Client{} + result, err := client.Do(request) + if err != nil { + log.Panic(err) + } + body, _ := ioutil.ReadAll(result.Body) + defer result.Body.Close() + return body +} diff --git a/beans/gomypay.pb.go b/beans/gomypay.pb.go new file mode 100644 index 0000000..a8aa9be --- /dev/null +++ b/beans/gomypay.pb.go @@ -0,0 +1,227 @@ +// Code generated by protoc-gen-go. +// source: gomypay.proto +// DO NOT EDIT! + +/* +Package beans is a generated protocol buffer package. + +It is generated from these files: + gomypay.proto + punchclock.proto + redis.proto + sendMail.proto + +It has these top-level messages: + CreditCard + Punchclock + TimeStruct + Redis + SendMail +*/ +package beans + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type CreditCard struct { + SendType string `protobuf:"bytes,1,opt,name=SendType" json:"Send_Type,omitempty"` + PayModeNo string `protobuf:"bytes,2,opt,name=PayModeNo" json:"Pay_Mode_No,omitempty"` + CustomerId string `protobuf:"bytes,3,opt,name=CustomerId" json:"CustomerId,omitempty"` + OrderNo string `protobuf:"bytes,4,opt,name=OrderNo" json:"Order_No,omitempty"` + Amount string `protobuf:"bytes,5,opt,name=Amount" json:"Amount,omitempty"` + TransCode string `protobuf:"bytes,6,opt,name=TransCode" json:"TransCode,omitempty"` + BuyerName string `protobuf:"bytes,7,opt,name=BuyerName" json:"Buyer_Name,omitempty"` + BuyerTelm string `protobuf:"bytes,8,opt,name=BuyerTelm" json:"Buyer_Telm,omitempty"` + BuyerMail string `protobuf:"bytes,9,opt,name=BuyerMail" json:"Buyer_Mail,omitempty"` + BuyerMemo string `protobuf:"bytes,10,opt,name=BuyerMemo" json:"Buyer_Memo,omitempty"` + CardNo string `protobuf:"bytes,11,opt,name=CardNo" json:"CardNo,omitempty"` + ExpireDate string `protobuf:"bytes,12,opt,name=ExpireDate" json:"ExpireDate,omitempty"` + CVV string `protobuf:"bytes,13,opt,name=CVV" json:"CVV,omitempty"` + TransMode string `protobuf:"bytes,14,opt,name=TransMode" json:"TransMode,omitempty"` + Installment string `protobuf:"bytes,15,opt,name=Installment" json:"Installment,omitempty"` + ReturnURL string `protobuf:"bytes,16,opt,name=ReturnURL" json:"Return_url,omitempty"` + CallbackURL string `protobuf:"bytes,17,opt,name=CallbackURL" json:"Callback_Url,omitempty"` + EReturn string `protobuf:"bytes,18,opt,name=EReturn" json:"e_return,omitempty"` + StrCheck string `protobuf:"bytes,19,opt,name=StrCheck" json:"Str_Check,omitempty"` +} + +func (m *CreditCard) Reset() { *m = CreditCard{} } +func (m *CreditCard) String() string { return proto.CompactTextString(m) } +func (*CreditCard) ProtoMessage() {} +func (*CreditCard) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *CreditCard) GetSendType() string { + if m != nil { + return m.SendType + } + return "" +} + +func (m *CreditCard) GetPayModeNo() string { + if m != nil { + return m.PayModeNo + } + return "" +} + +func (m *CreditCard) GetCustomerId() string { + if m != nil { + return m.CustomerId + } + return "" +} + +func (m *CreditCard) GetOrderNo() string { + if m != nil { + return m.OrderNo + } + return "" +} + +func (m *CreditCard) GetAmount() string { + if m != nil { + return m.Amount + } + return "" +} + +func (m *CreditCard) GetTransCode() string { + if m != nil { + return m.TransCode + } + return "" +} + +func (m *CreditCard) GetBuyerName() string { + if m != nil { + return m.BuyerName + } + return "" +} + +func (m *CreditCard) GetBuyerTelm() string { + if m != nil { + return m.BuyerTelm + } + return "" +} + +func (m *CreditCard) GetBuyerMail() string { + if m != nil { + return m.BuyerMail + } + return "" +} + +func (m *CreditCard) GetBuyerMemo() string { + if m != nil { + return m.BuyerMemo + } + return "" +} + +func (m *CreditCard) GetCardNo() string { + if m != nil { + return m.CardNo + } + return "" +} + +func (m *CreditCard) GetExpireDate() string { + if m != nil { + return m.ExpireDate + } + return "" +} + +func (m *CreditCard) GetCVV() string { + if m != nil { + return m.CVV + } + return "" +} + +func (m *CreditCard) GetTransMode() string { + if m != nil { + return m.TransMode + } + return "" +} + +func (m *CreditCard) GetInstallment() string { + if m != nil { + return m.Installment + } + return "" +} + +func (m *CreditCard) GetReturnURL() string { + if m != nil { + return m.ReturnURL + } + return "" +} + +func (m *CreditCard) GetCallbackURL() string { + if m != nil { + return m.CallbackURL + } + return "" +} + +func (m *CreditCard) GetEReturn() string { + if m != nil { + return m.EReturn + } + return "" +} + +func (m *CreditCard) GetStrCheck() string { + if m != nil { + return m.StrCheck + } + return "" +} + +func init() { + proto.RegisterType((*CreditCard)(nil), "beans.CreditCard") +} + +func init() { proto.RegisterFile("gomypay.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 326 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x92, 0xcf, 0x4a, 0x03, 0x31, + 0x10, 0x87, 0xa9, 0xfd, 0x9f, 0x5a, 0xad, 0x11, 0x64, 0x10, 0x91, 0xe2, 0xc9, 0x93, 0x17, 0x9f, + 0x40, 0x63, 0x0f, 0x05, 0xbb, 0x4a, 0xad, 0xbd, 0xa7, 0xcd, 0xa0, 0xa5, 0x9b, 0x64, 0xc9, 0x66, + 0xc1, 0x7d, 0x29, 0x9f, 0x51, 0x92, 0xac, 0xd9, 0xdc, 0xf6, 0xf7, 0x7d, 0x3b, 0x24, 0x93, 0x19, + 0x32, 0xfd, 0xd2, 0xb2, 0x2e, 0x78, 0xfd, 0x50, 0x18, 0x6d, 0x35, 0xed, 0xef, 0x90, 0xab, 0xf2, + 0xee, 0xb7, 0x47, 0x08, 0x33, 0x28, 0x0e, 0x96, 0x71, 0x23, 0xe8, 0x35, 0x19, 0x7d, 0xa0, 0x12, + 0x9b, 0xba, 0x40, 0xe8, 0xcc, 0x3b, 0xf7, 0xe3, 0x75, 0xcc, 0xf4, 0x86, 0x8c, 0xdf, 0x79, 0xbd, + 0xd2, 0x02, 0x33, 0x0d, 0x27, 0x5e, 0xb6, 0x80, 0xde, 0x12, 0xc2, 0xaa, 0xd2, 0x6a, 0x89, 0x66, + 0x29, 0xa0, 0xeb, 0x75, 0x42, 0x28, 0x90, 0xe1, 0x9b, 0x11, 0x68, 0x32, 0x0d, 0x3d, 0x2f, 0xff, + 0x23, 0xbd, 0x22, 0x83, 0x27, 0xa9, 0x2b, 0x65, 0xa1, 0xef, 0x45, 0x93, 0xdc, 0x79, 0x1b, 0xc3, + 0x55, 0xc9, 0xb4, 0x40, 0x18, 0x84, 0xf3, 0x22, 0x70, 0xf6, 0xb9, 0xaa, 0xd1, 0x64, 0x5c, 0x22, + 0x0c, 0x83, 0x8d, 0x20, 0xda, 0x0d, 0xe6, 0x12, 0x46, 0x89, 0x75, 0x20, 0xda, 0x15, 0x3f, 0xe4, + 0x30, 0x4e, 0xac, 0x03, 0xad, 0x45, 0xa9, 0x81, 0xa4, 0x16, 0xa5, 0xbf, 0xad, 0x7b, 0xa9, 0x4c, + 0xc3, 0x24, 0xdc, 0x36, 0x24, 0xd7, 0xff, 0xe2, 0xa7, 0x38, 0x18, 0x7c, 0xe1, 0x16, 0xe1, 0x34, + 0xf4, 0xdf, 0x12, 0x3a, 0x23, 0x5d, 0xb6, 0xdd, 0xc2, 0xd4, 0x0b, 0xf7, 0x19, 0xfb, 0x73, 0x0f, + 0x08, 0x67, 0x49, 0x7f, 0x0e, 0xd0, 0x39, 0x99, 0x2c, 0x55, 0x69, 0x79, 0x9e, 0x4b, 0x54, 0x16, + 0xce, 0xbd, 0x4f, 0x91, 0xab, 0x5f, 0xa3, 0xad, 0x8c, 0xfa, 0x5c, 0xbf, 0xc2, 0x2c, 0xd4, 0x47, + 0xe0, 0xea, 0x19, 0xcf, 0xf3, 0x1d, 0xdf, 0x1f, 0x9d, 0xbf, 0x08, 0xf5, 0x09, 0x72, 0x13, 0x59, + 0x84, 0xff, 0x81, 0x86, 0x89, 0x34, 0xd1, 0x6f, 0x81, 0x35, 0xec, 0x1b, 0xf7, 0x47, 0xb8, 0x6c, + 0xb6, 0xa0, 0xc9, 0xbb, 0x81, 0x5f, 0x9f, 0xc7, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xaa, 0x8b, + 0x78, 0xde, 0x4f, 0x02, 0x00, 0x00, +} diff --git a/beans/gomypay.proto b/beans/gomypay.proto new file mode 100644 index 0000000..f78679f --- /dev/null +++ b/beans/gomypay.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; + +package beans; + +message CreditCard { + string SendType = 1; //`json:"Send_Type,omitempty"` + string PayModeNo = 2; //`json:"Pay_Mode_No,omitempty"` + string CustomerId = 3; //`json:"CustomerId,omitempty"` + string OrderNo = 4; //`json:"Order_No,omitempty"` + string Amount = 5; //`json:"Amount,omitempty"` + string TransCode = 6; //`json:"TransCode,omitempty"` + string BuyerName = 7; //`json:"Buyer_Name,omitempty"` + string BuyerTelm = 8; //`json:"Buyer_Telm,omitempty"` + string BuyerMail = 9; //`json:"Buyer_Mail,omitempty"` + string BuyerMemo = 10; //`json:"Buyer_Memo,omitempty"` + string CardNo = 11; //`json:"CardNo,omitempty"` + string ExpireDate = 12; //`json:"ExpireDate,omitempty"` + string CVV = 13; //`json:"CVV,omitempty"` + string TransMode = 14; //`json:"TransMode,omitempty"` + string Installment = 15; //`json:"Installment,omitempty"` + string ReturnURL = 16; //`json:"Return_url,omitempty"` + string CallbackURL = 17; //`json:"Callback_Url,omitempty"` + string EReturn = 18; //`json:"e_return,omitempty"` + string StrCheck = 19; //`json:"Str_Check,omitempty"` +} \ No newline at end of file diff --git a/beans/punchclock.pb.go b/beans/punchclock.pb.go index 0f24b04..fa21346 100644 --- a/beans/punchclock.pb.go +++ b/beans/punchclock.pb.go @@ -2,20 +2,6 @@ // source: punchclock.proto // DO NOT EDIT! -/* -Package beans is a generated protocol buffer package. - -It is generated from these files: - punchclock.proto - redis.proto - sendMail.proto - -It has these top-level messages: - Punchclock - TimeStruct - Redis - SendMail -*/ package beans import proto "github.com/golang/protobuf/proto" @@ -27,21 +13,15 @@ var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - type Punchclock struct { - Begin *TimeStruct `protobuf:"bytes,7,opt,name=Begin" json:"begin"` - End *TimeStruct `protobuf:"bytes,8,opt,name=End" json:"end"` + Begin *TimeStruct `protobuf:"bytes,7,opt,name=Begin" json:"begin"` + End *TimeStruct `protobuf:"bytes,8,opt,name=End" json:"end"` } func (m *Punchclock) Reset() { *m = Punchclock{} } func (m *Punchclock) String() string { return proto.CompactTextString(m) } func (*Punchclock) ProtoMessage() {} -func (*Punchclock) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +func (*Punchclock) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} } func (m *Punchclock) GetBegin() *TimeStruct { if m != nil { @@ -58,18 +38,18 @@ func (m *Punchclock) GetEnd() *TimeStruct { } type TimeStruct struct { - Year string `protobuf:"bytes,1,opt,name=Year" json:"year"` - Month string `protobuf:"bytes,2,opt,name=Month" json:"month"` - Day string `protobuf:"bytes,3,opt,name=Day" json:"day"` - Hour string `protobuf:"bytes,4,opt,name=Hour" json:"hour"` - Minute string `protobuf:"bytes,5,opt,name=Minute" json:"minute"` - Second string `protobuf:"bytes,6,opt,name=Second" json:"second"` + Year string `protobuf:"bytes,1,opt,name=Year" json:"year"` + Month string `protobuf:"bytes,2,opt,name=Month" json:"month"` + Day string `protobuf:"bytes,3,opt,name=Day" json:"day"` + Hour string `protobuf:"bytes,4,opt,name=Hour" json:"hour"` + Minute string `protobuf:"bytes,5,opt,name=Minute" json:"minute"` + Second string `protobuf:"bytes,6,opt,name=Second" json:"second"` } func (m *TimeStruct) Reset() { *m = TimeStruct{} } func (m *TimeStruct) String() string { return proto.CompactTextString(m) } func (*TimeStruct) ProtoMessage() {} -func (*TimeStruct) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +func (*TimeStruct) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} } func (m *TimeStruct) GetYear() string { if m != nil { @@ -118,9 +98,9 @@ func init() { proto.RegisterType((*TimeStruct)(nil), "beans.TimeStruct") } -func init() { proto.RegisterFile("punchclock.proto", fileDescriptor0) } +func init() { proto.RegisterFile("punchclock.proto", fileDescriptor1) } -var fileDescriptor0 = []byte{ +var fileDescriptor1 = []byte{ // 200 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x28, 0x28, 0xcd, 0x4b, 0xce, 0x48, 0xce, 0xc9, 0x4f, 0xce, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x4d, 0x4a, diff --git a/beans/redis.pb.go b/beans/redis.pb.go index 7f2afcb..9129aa3 100644 --- a/beans/redis.pb.go +++ b/beans/redis.pb.go @@ -14,15 +14,15 @@ var _ = fmt.Errorf var _ = math.Inf type Redis struct { - Key string `protobuf:"bytes,1,opt,name=Key" json:"key,omitempty"` - Value string `protobuf:"bytes,2,opt,name=Value" json:"value,omitempty"` - Hkey string `protobuf:"bytes,3,opt,name=Hkey" json:"hkey,omitempty"` + Key string `protobuf:"bytes,1,opt,name=Key" json:"key,omitempty"` + Value string `protobuf:"bytes,2,opt,name=Value" json:"value,omitempty"` + Hkey string `protobuf:"bytes,3,opt,name=Hkey" json:"hkey,omitempty"` } func (m *Redis) Reset() { *m = Redis{} } func (m *Redis) String() string { return proto.CompactTextString(m) } func (*Redis) ProtoMessage() {} -func (*Redis) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} } +func (*Redis) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} } func (m *Redis) GetKey() string { if m != nil { @@ -49,9 +49,9 @@ func init() { proto.RegisterType((*Redis)(nil), "beans.Redis") } -func init() { proto.RegisterFile("redis.proto", fileDescriptor1) } +func init() { proto.RegisterFile("redis.proto", fileDescriptor2) } -var fileDescriptor1 = []byte{ +var fileDescriptor2 = []byte{ // 100 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2e, 0x4a, 0x4d, 0xc9, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x4d, 0x4a, 0x4d, 0xcc, 0x2b, 0x56, 0x72, diff --git a/beans/sendMail.pb.go b/beans/sendMail.pb.go index 582aa58..b8ca39f 100644 --- a/beans/sendMail.pb.go +++ b/beans/sendMail.pb.go @@ -14,16 +14,16 @@ var _ = fmt.Errorf var _ = math.Inf type SendMail struct { - To string ` protobuf:"bytes,1,opt,name=To" json:"To,omitempty" form:"to"` - Cc string ` protobuf:"bytes,2,opt,name=Cc" json:"Cc,omitempty" form:"cc"` - Subject string ` protobuf:"bytes,3,opt,name=Subject" json:"Subject,omitempty" form:"subject"` - Content string ` protobuf:"bytes,4,opt,name=Content" json:"Content,omitempty" form:"content"` + To string ` protobuf:"bytes,1,opt,name=To" json:"To,omitempty" form:"to"` + Cc string ` protobuf:"bytes,2,opt,name=Cc" json:"Cc,omitempty" form:"cc"` + Subject string ` protobuf:"bytes,3,opt,name=Subject" json:"Subject,omitempty" form:"subject"` + Content string ` protobuf:"bytes,4,opt,name=Content" json:"Content,omitempty" form:"content"` } func (m *SendMail) Reset() { *m = SendMail{} } func (m *SendMail) String() string { return proto.CompactTextString(m) } func (*SendMail) ProtoMessage() {} -func (*SendMail) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} } +func (*SendMail) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{0} } func (m *SendMail) GetTo() string { if m != nil { @@ -57,9 +57,9 @@ func init() { proto.RegisterType((*SendMail)(nil), "beans.SendMail") } -func init() { proto.RegisterFile("sendMail.proto", fileDescriptor2) } +func init() { proto.RegisterFile("sendMail.proto", fileDescriptor3) } -var fileDescriptor2 = []byte{ +var fileDescriptor3 = []byte{ // 116 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2b, 0x4e, 0xcd, 0x4b, 0xf1, 0x4d, 0xcc, 0xcc, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x4d, 0x4a, 0x4d, 0xcc, diff --git a/controllers/gomypay.go b/controllers/gomypay.go new file mode 100644 index 0000000..69da23e --- /dev/null +++ b/controllers/gomypay.go @@ -0,0 +1,34 @@ +package controllers + +import ( + "encoding/json" + "log" + "net/http" + + "github.com/gin-gonic/gin" + "github.com/teed7334-restore/homekeeper/base" + "github.com/teed7334-restore/homekeeper/beans" + "github.com/teed7334-restore/homekeeper/env" +) + +//PayCreditCard 雿輻鍂靽∠鍂�㨃隞䀹狡 +func PayCreditCard(c *gin.Context) { + cfg := env.GetEnv() + params := getCreditCardParams(c) + params.CustomerId = cfg.GoMyPay.CustomerID + jsonStr, _ := json.Marshal(params) + jsonByte := []byte(jsonStr) + url := cfg.GoMyPay.URL + jsonByte = base.PostURL(url, jsonByte) + c.JSON(http.StatusOK, jsonByte) +} + +//getCreditCardParams ��硋�鎻TTP POST撣園�𦒘�銋见��彍 +func getCreditCardParams(c *gin.Context) *beans.CreditCard { + params := &beans.CreditCard{} + err := c.BindJSON(params) + if err != nil { + log.Println(err) + } + return params +} diff --git a/route/api.go b/route/api.go index f2c488c..d4cf274 100644 --- a/route/api.go +++ b/route/api.go @@ -28,5 +28,6 @@ func API() *gin.Engine { route.POST("/Redis/LRange", controllers.LRangeRedis) route.POST("/PunchClock/CalcTime", controllers.CalcTime) route.POST("/PunchClock/ResetAllUseMinute", controllers.ResetAllUseMinute) + route.POST("/GoMyPay/PayCreditCard", controllers.PayCreditCard) return route } -- 2.18.1