Prechádzať zdrojové kódy

Merge branch 'develop' of k.zhang/duoduo into master

k.zhang 1 rok pred
rodič
commit
c0a0586412

+ 2 - 0
apis/shanghu/base.go

@@ -29,5 +29,7 @@ func InitShangHuRouter(engine *gin.RouterGroup) {
 		v1.POST("/client/merchant/card/list", MerchantClientCardList)       //c端商户卡列表
 		v1.POST("/merchant/card.canvas/get", GetMerchantCanvasCard)         //画布获取详情
 		v1.POST("/upload/picture", UploadPicture)                           //上传图片
+		v1.POST("/client/pay/list", GetPayTransList)                        //交易列表
+		v1.POST("/verification/code", GetVerificationCode)                  //核销码
 	}
 }

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 80 - 0
apis/shanghu/client.trans.go


+ 28 - 0
apis/shanghu/models/client.trans.go

@@ -1 +1,29 @@
 package models
+
+import (
+	"github.com/shopspring/decimal"
+)
+
+type ClientTransRequest struct {
+	OpenId    string `json:"open_id"`
+	PageSize  int    `json:"page_size"`
+	PageIndex int    `json:"page_index"`
+	TypeList  int    `json:"type_list"` //1-未开始 2-进行中 3-已结束
+}
+
+type ClientTransReply struct {
+	MerchantCardID   int64           `json:"merchant_card_id"`   // 商户卡id
+	Amount           decimal.Decimal `json:"amount"`             // 交易金额
+	PayTime          string          `json:"pay_time"`           // 支付时间
+	MerchantCardName string          `json:"merchant_card_name"` // 商户卡名称
+	MerchantCardTime string          `json:"merchant_card_time"` // 商户卡有效期
+	TransId          int64           `json:"trans_id"`           //交易id
+}
+
+type VerificationCodeRequest struct {
+	TransId int64 `json:"trans_id"`
+}
+
+type VerificationCodeReply struct {
+	QR string `json:"qr"`
+}

+ 4 - 0
models/shanghu/client.trans.go

@@ -18,3 +18,7 @@ type MerchantClientTrans struct {
 	UpdatedAt      time.Time `gorm:"column:updated_at;type:datetime(3)" json:"updated_at"`              // 最后更新时间
 	DeletedAt      time.Time `gorm:"column:deleted_at;type:datetime(3);default:null" json:"deleted_at"` // 删除时间
 }
+
+func (m *MerchantClientTrans) TableName() string {
+	return "client_pay_trans"
+}

+ 17 - 0
models/shanghu/pay.go

@@ -125,6 +125,23 @@ func (m *ClientPayTrans) UpdateById(data map[string]interface{}) error {
 	return nil
 }
 
+func (m *ClientPayTrans) GetPayTransSuccessByOpenID(pageSize int, pageIndex int) ([]ClientPayTrans, int, error) {
+	var doc []ClientPayTrans
+
+	table := orm.ShMysql.Table(m.TableName())
+
+	//if m.ActivityStartTime != 0
+
+	table = table.Where("client_open_id = ?  and status = 2", m.ClientOpenID)
+	var count int
+	if err := table.Select("*").Order("id desc").Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Error; err != nil {
+		return nil, 0, err
+	}
+	table.Count(&count)
+	return doc, count, nil
+
+}
+
 func (m *ClientPayTrans) SettleAdd(merchantAmount, clientAmount decimal.Decimal, merchantOpenId, clientOpenId string) error {
 	// 使用事务 添加
 	var err error