浏览代码

我的样叽

yuliang1112 2 年之前
父节点
当前提交
115da9fa0d
共有 41 个文件被更改,包括 1691 次插入47 次删除
  1. 28 0
      apiclient_key.pem
  2. 27 0
      consts/invoice.go
  3. 36 9
      consts/project.go
  4. 65 0
      db/enterprise.go
  5. 184 0
      db/invoice.go
  6. 29 1
      db/pay_record.go
  7. 24 0
      db/project.go
  8. 1 0
      go.mod
  9. 10 2
      go.sum
  10. 62 0
      handler/addInvoiceRecord.go
  11. 60 0
      handler/addReceiveAddress.go
  12. 60 0
      handler/addReceiveInfo.go
  13. 60 0
      handler/feeDetail.go
  14. 61 0
      handler/getCodeUrl.go
  15. 60 0
      handler/getReceiveAddress.go
  16. 60 0
      handler/getReceiveInfo.go
  17. 64 0
      handler/operateReceiveAddress.go
  18. 64 0
      handler/operateReceiveInfo.go
  19. 55 0
      handler/queryOrderByTradeId.go
  20. 57 0
      handler/rechargeBalance.go
  21. 60 0
      handler/rechargeRecord.go
  22. 19 0
      model/gorm_model/invoice_address.go
  23. 23 0
      model/gorm_model/invoice_info.go
  24. 23 0
      model/gorm_model/invoice_record.go
  25. 24 17
      model/gorm_model/project.go
  26. 23 0
      model/gorm_model/recharge.go
  27. 16 0
      model/http_model/AddInvoiceRecordRequest.go
  28. 16 0
      model/http_model/AddReceiveAddressRequest.go
  29. 20 0
      model/http_model/AddReceiveInfoRequest.go
  30. 27 0
      model/http_model/FeeDetailRequest.go
  31. 21 0
      model/http_model/GetCodeUrlRequest.go
  32. 26 0
      model/http_model/GetReceiveAddressRequest.go
  33. 30 0
      model/http_model/GetReceiveInfoRequest.go
  34. 18 0
      model/http_model/OperateReceiveAddressRequest.go
  35. 22 0
      model/http_model/OperateReceiveInfoRequest.go
  36. 19 0
      model/http_model/QueryOrderByTradeIdRequest.go
  37. 13 0
      model/http_model/RechargeBalanceRequest.go
  38. 28 0
      model/http_model/RechargeRecordRequest.go
  39. 25 13
      route/init.go
  40. 108 0
      service/wechatPay.go
  41. 63 5
      util/type.go

+ 28 - 0
apiclient_key.pem

@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDiS0mOMU85JaH1
+nRsOU57TfKP+3ma7TiEe2jQNHhF1UUW8i1+Hc1NeLe7dh29J5aEa/isu0RG2LHjY
+P73dzPkarAdhmW3ETsbBVazUw7RfhbPawR6EjBArRAojqHLXdSTFeDM6LtmwbWD2
+JEjiBKyTMtsbnap4ubLhR03huPn8V20Hbq3Zg+U8T4XtnK7jrac2SqkuybKheRX8
+OzaefU/nYbxKwyTqKCanAs96ZTFuEceW9Utoa4jb4bqdVVhbc2P5gyyssKfYkfDj
+Pdr2X3vg11qq7bhjQ+xLgUiWwXlqnKY0eHxvx0Zdh5PWdh0oYZtbuHrkPPJaf4zu
+Zkre9VnXAgMBAAECggEASPlaWP5Ru+4E0n29UdtpZm3VPMVff5tsVtSq4GgH3Ts+
+L9UKE1X/Vmmdk9au7recQmYgatKE0ah5t9KmWbZVxmIfZzvhB+MXeRU1zM7nhb5K
+B4srWjcIp8sjMeiKUCy4lO10J5kgHiLHl9iPoEM9m6JUwg0QAipwIvGpjdbm1paH
+esqCyZ2+fyTypO1mkpPOOB6caGwePE0Ppd/U5woPKPS0H5JnBdKPWBh/XYkBigOl
+fMRjJg9BDGPjxI1Rt+F6S359fgfXZJV1m74YVL9HxgfKi+WHdDTtj0094NBqizCg
+goeLZbz6aWYbOBmpFHrK8F2i/pYU658KLCtjjpvnQQKBgQD6JJGRqqF1OLVsjJ+E
++8ts8IdC+OBYY9YHgLw5D2aFUrtJre9Fiktj0hupXPm+01kmc+5OupR3O/L8jhM6
++NTe3fmIzNLk72GeZsiWFrZCN0fKjts421wwyhBrqW/qZN66a1kYA7fvr0ToRjL1
+jLhTqu0a8BGRyaxbqlebo/5FkQKBgQDnl8MYmJoYpJ36WK3Bd1j/9eczDmRXf4RW
+kZjIOeXBN4zHZsvlFtMtcaZAw3Z1KPbM4ncuKwl+pc7oNUfOAU/IOiBEiZR7zSYG
+D8g+UoXfZzv5mFQQBSagfY4Q0bigG1Zt/QPMoN5setiG6BJ+bwN7WfXNjRjyaXtZ
+ovUUniFU5wKBgQDrvu0mcL6MIG7zp7Brf3bf6+w+lRmylBzRo2VBDZ+chTUXooJ/
+cm/M2ubQ/lwtmThLAjWVI0jq+qftl+TNzleo12DmqcsUkfrZc5sVwL/ytfDGGU7I
+TgybusQxA1YDfR9gZ+1msZJ3pSJ3GjnKq93IlK2zlo+oa34yQd8hQzRP0QKBgQDQ
+5TkbNHq6g7HjoJ2KBocGyd2zVeX4bpMGKuouoNq2v86CBh0gFMiDEyItBKIS59JF
+2Hg78qHr1M+e8IBGNzSpnJSCfb6rNM55ZT7vyCvs6QdWCaq5kIvY86dzUFhCQqZh
+K3mD2A8Itn4cobQcyzHOz8RBlmXMMo0Ku0xpPoE+PQKBgEFcy2wvv/saKJ+3t2Cw
+4ckwskhsQ2CizlAlTCNmBzou+IYfcg3VxS7P0EA/ViUXHTOx1pjhS977FLqJxe08
+FU7a3mIzzehJA0VnsZC6lzCqSRxdE4bcEs9Opw+sJS7abJKRU2QeZSJEChqAMUhJ
+3oP15BVjOfW79TL/hp8fRZAt
+-----END PRIVATE KEY-----

+ 27 - 0
consts/invoice.go

@@ -0,0 +1,27 @@
+package consts
+
+var HeadTypeMap = map[string]string{
+	"1": "企业",
+	"2": "个人",
+}
+
+func GetHeadType(HeadType string) string {
+	toast, contain := HeadTypeMap[HeadType]
+	if contain {
+		return toast
+	}
+	return "未知"
+}
+
+var InvoiceTypeMap = map[string]string{
+	"1": "增值税专用发票",
+	"2": "增值税普通发票",
+}
+
+func GetInvoiceType(InvoiceType string) string {
+	toast, contain := InvoiceTypeMap[InvoiceType]
+	if contain {
+		return toast
+	}
+	return "未知"
+}

+ 36 - 9
consts/project.go

@@ -1,15 +1,15 @@
 package consts
 
 var projectStatusMap = map[int64]string{
-	1: "创建中",
-	2: "待审核",
-	3: "审核通过",
-	4: "招募中",
-	5: "招募完毕",
-	6: "待支付",
-	7: "已支付",
-	8: "失效",
-	9: "执行中",
+	1:  "创建中",
+	2:  "待审核",
+	3:  "审核通过",
+	4:  "招募中",
+	5:  "招募完毕",
+	6:  "待支付",
+	7:  "已支付",
+	8:  "失效",
+	9:  "执行中",
 	10: "已结案",
 }
 
@@ -66,3 +66,30 @@ func GetProjectContentType(status int64) string {
 	}
 	return "未知"
 }
+
+var ProjectTypeMap = map[int64]string{
+	1: "全流程项目",
+	2: "专项项目",
+}
+
+func GetProjectType(projectType int64) string {
+	toast, contain := ProjectTypeMap[projectType]
+	if contain {
+		return toast
+	}
+	return "未知"
+}
+
+var RechargeMethod = map[int64]string{
+	1: "对公转账",
+	2: "支付宝",
+	3: "微信",
+}
+
+func GetRechargeMethod(method int64) string {
+	toast, contain := RechargeMethod[method]
+	if contain {
+		return toast
+	}
+	return "未知"
+}

+ 65 - 0
db/enterprise.go

@@ -2,8 +2,11 @@ package db
 
 import (
 	"context"
+	"github.com/issue9/conv"
+	"time"
 	"youngee_b_api/model/gorm_model"
 	"youngee_b_api/model/http_model"
+	"youngee_b_api/util"
 
 	"gorm.io/gorm"
 )
@@ -83,3 +86,65 @@ func UpdateEnterpriseBalance(ctx context.Context, EnterpriseID int64, balance in
 
 	return &enterprise.Balance, nil
 }
+
+func RechargeAmount(ctx context.Context, EnterpriseID int64, Amount float64) error {
+	db := GetReadDB(ctx)
+	err := db.Model(gorm_model.Enterprise{}).Where("enterprise_id", EnterpriseID).
+		Updates(map[string]interface{}{"balance": gorm.Expr("balance + ?", Amount), "available_balance": gorm.Expr("available_balance + ?", Amount)}).Error
+	if err != nil {
+		return err
+	}
+	enterprise := gorm_model.Enterprise{}
+	err = db.Model(gorm_model.Enterprise{}).Where("enterprise_id", EnterpriseID).Scan(&enterprise).Error
+	if err != nil {
+		return err
+	}
+	// 1、年月日
+	year := time.Now().Year()
+	month := time.Now().Month()
+	day := time.Now().Day()
+	yearData, _ := util.GetDayNum("year", year)
+	monthData, _ := util.GetDayNum("month", int(month))
+	dayData, _ := util.GetDayNum("day", day)
+	sum := 0
+	sum += dayData + monthData
+	leap := 0
+	if (yearData%400 == 0) || ((yearData%4 == 0) && (yearData%100 != 0)) {
+		leap = 1
+	}
+	if (leap == 1) && (monthData > 2) {
+		sum += 1
+	}
+	last := ""
+	rechargeIdPrefix := "8" + conv.MustString(EnterpriseID)[len(conv.MustString(EnterpriseID))-2:] + conv.MustString(sum)
+	var rechargeIdLast string
+	err = db.Model(gorm_model.YounggeeRechargeRecord{}).Select("recharge_id").Where("recharge_id like ?", rechargeIdPrefix+"%").
+		Last(&rechargeIdLast).Error
+	if err != nil {
+		last = "0"
+	} else {
+		last = rechargeIdLast[len(rechargeIdLast)-2:]
+	}
+	var lastInt int
+	lastInt = conv.MustInt(last)
+	if lastInt+1 < 10 {
+		last = "0" + conv.MustString(conv.MustInt(last)+1)
+	} else {
+		last = conv.MustString(conv.MustInt(last) + 1)
+	}
+	err = db.Model(gorm_model.YounggeeRechargeRecord{}).Create(&gorm_model.YounggeeRechargeRecord{
+		RechargeID:         rechargeIdPrefix + last,
+		RechargeAmount:     Amount,
+		EnterpriseID:       EnterpriseID,
+		Status:             1,
+		InvoiceStatus:      1,
+		CommitAt:           time.Now(),
+		RechargeMethod:     3,
+		TransferVoucherUrl: "--",
+		ConfirmAt:          time.Now(),
+	}).Error
+	if err != nil {
+		return err
+	}
+	return nil
+}

+ 184 - 0
db/invoice.go

@@ -0,0 +1,184 @@
+package db
+
+import (
+	context "context"
+	"encoding/json"
+	"fmt"
+	"github.com/issue9/conv"
+	"time"
+	"youngee_b_api/consts"
+	"youngee_b_api/model/gorm_model"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/util"
+)
+
+func AddReceiveAddress(ctx context.Context, enterpriseId int64, req *http_model.AddReceiveAddressRequest) error {
+	db := GetReadDB(ctx)
+	return db.Debug().Model(gorm_model.YounggeeInvoiceAddress{}).Create(&gorm_model.YounggeeInvoiceAddress{
+		EnterpriseID: enterpriseId,
+		Name:         req.ReceiveName,
+		RegionCode:   req.RegionCode,
+		Address:      req.ReceiveAddress,
+		Phone:        req.ReceivePhone,
+		UpdateAt:     time.Now(),
+	}).Error
+}
+
+func AddReceiveInfo(ctx context.Context, enterpriseId int64, req *http_model.AddReceiveInfoRequest) error {
+	db := GetReadDB(ctx)
+	return db.Debug().Model(gorm_model.YounggeeInvoiceInfo{}).Create(&gorm_model.YounggeeInvoiceInfo{
+		EnterpriseID:      enterpriseId,
+		HeadType:          consts.GetHeadType(req.HeadType),
+		InvoiceHeader:     req.InvoiceHead,
+		InvoiceType:       consts.GetInvoiceType(req.InvoiceType),
+		TaxCode:           req.TaxNum,
+		Bank:              req.BaseBank,
+		BankCardNumber:    req.BaseBankCardNum,
+		RegisteredAddress: req.EnterpriseAddress,
+		RegisteredPhone:   req.EnterprisePhone,
+		UpdateAt:          time.Now(),
+	}).Error
+}
+
+func GetReceiveAddress(ctx context.Context, enterpriseId int64) (*http_model.ReceiveAddressData, error) {
+	db := GetReadDB(ctx)
+	var InvoiceAddress []*gorm_model.YounggeeInvoiceAddress
+	db = db.Debug().Model(gorm_model.YounggeeInvoiceAddress{}).Where(
+		"enterprise_id = ?",
+		enterpriseId,
+	)
+	db = db.Order("update_at desc").Find(&InvoiceAddress)
+	var receiveAddress http_model.ReceiveAddressData
+	for _, v := range InvoiceAddress {
+		ReceiveAddressPreview := new(http_model.ReceiveAddressPreview)
+		ReceiveAddressPreview.AddressID = v.AddressID
+		ReceiveAddressPreview.ReceiveName = v.Name
+		ReceiveAddressPreview.AddressPhone = v.Phone
+		ReceiveAddressPreview.Address = v.Address
+		ReceiveAddressPreview.RegionCode = v.RegionCode
+		receiveAddress.ReceiveAddressPreview = append(receiveAddress.ReceiveAddressPreview, ReceiveAddressPreview)
+	}
+	return &receiveAddress, nil
+}
+
+func GetReceiveInfo(ctx context.Context, enterpriseId int64) (*http_model.ReceiveInfoData, error) {
+	db := GetReadDB(ctx)
+	var InvoiceInfo []*gorm_model.YounggeeInvoiceInfo
+	db = db.Debug().Model(gorm_model.YounggeeInvoiceInfo{}).Where(
+		"enterprise_id = ?",
+		enterpriseId,
+	)
+	db = db.Order("update_at desc").Find(&InvoiceInfo)
+	var ReceiveInfoData http_model.ReceiveInfoData
+	for _, v := range InvoiceInfo {
+		ReceiveInfoPreview := new(http_model.ReceiveInfoPreview)
+		ReceiveInfoPreview.InvoiceHead = v.InvoiceHeader
+		ReceiveInfoPreview.InvoiceID = v.InvoiceID
+		ReceiveInfoPreview.HeadType = v.HeadType
+		ReceiveInfoPreview.InvoiceType = v.InvoiceType
+		ReceiveInfoPreview.EnterprisePhone = v.RegisteredPhone
+		ReceiveInfoPreview.TaxNum = v.TaxCode
+		ReceiveInfoPreview.BaseBank = v.Bank
+		ReceiveInfoPreview.BaseBankCardNum = v.BankCardNumber
+		ReceiveInfoPreview.EnterpriseAddress = v.RegisteredAddress
+		ReceiveInfoData.ReceiveInfoPreview = append(ReceiveInfoData.ReceiveInfoPreview, ReceiveInfoPreview)
+	}
+	return &ReceiveInfoData, nil
+}
+
+func OperateReceiveInfo(ctx context.Context, enterpriseId int64, req *http_model.OperateReceiveInfoRequest) error {
+	db := GetReadDB(ctx)
+	if req.OperateType == 2 {
+		return db.Debug().Delete(&gorm_model.YounggeeInvoiceInfo{}, req.InvoiceId).Error
+	}
+	return db.Debug().Model(gorm_model.YounggeeInvoiceInfo{}).Where("enterprise_id = ? AND invoice_id = ?", enterpriseId, req.InvoiceId).Updates(
+		&gorm_model.YounggeeInvoiceInfo{
+			HeadType:          consts.GetHeadType(req.HeadType),
+			InvoiceHeader:     req.InvoiceHead,
+			InvoiceType:       consts.GetInvoiceType(req.InvoiceType),
+			TaxCode:           req.TaxNum,
+			Bank:              req.BaseBank,
+			BankCardNumber:    req.BaseBankCardNum,
+			RegisteredAddress: req.EnterpriseAddress,
+			RegisteredPhone:   req.EnterprisePhone,
+			UpdateAt:          time.Now(),
+		}).Error
+}
+
+func OperateReceiveAddress(ctx context.Context, enterpriseId int64, req *http_model.OperateReceiveAddressRequest) error {
+	db := GetReadDB(ctx)
+	if req.OperateType == 2 {
+		return db.Debug().Delete(&gorm_model.YounggeeInvoiceAddress{}, req.AddressID).Error
+	}
+	return db.Debug().Model(gorm_model.YounggeeInvoiceAddress{}).Where("enterprise_id = ? AND address_id = ?", enterpriseId, req.AddressID).Updates(
+		&gorm_model.YounggeeInvoiceAddress{
+			Name:       req.ReceiveName,
+			RegionCode: req.RegionCode,
+			Address:    req.ReceiveAddress,
+			Phone:      req.ReceivePhone,
+			UpdateAt:   time.Now(),
+		}).Error
+}
+
+func AddInvoiceRecord(ctx context.Context, enterpriseId int64, req *http_model.AddInvoiceRecordRequest) error {
+	invoiceInfo := gorm_model.YounggeeInvoiceInfo{}
+	fmt.Println("req:", req)
+	fmt.Println("invoice_id", req.InvoiceID)
+	db1 := GetReadDB(ctx)
+	db1.Debug().Model(gorm_model.YounggeeInvoiceInfo{}).Where("invoice_id = ?", req.InvoiceID).First(&invoiceInfo)
+	invoiceInfoToJson, _ := json.Marshal(invoiceInfo)
+	addressInfo := gorm_model.YounggeeInvoiceAddress{}
+	db2 := GetReadDB(ctx)
+	db2.Debug().Model(gorm_model.YounggeeInvoiceAddress{}).Where("address_id = ?", req.AddressID).First(&addressInfo)
+	addressInfoToJson, _ := json.Marshal(addressInfo)
+	db := GetReadDB(ctx)
+	// 1、年月日
+	year := time.Now().Year()
+	month := time.Now().Month()
+	day := time.Now().Day()
+	yearData, _ := util.GetDayNum("year", year)
+	monthData, _ := util.GetDayNum("month", int(month))
+	dayData, _ := util.GetDayNum("day", day)
+	sum := 0
+	sum += dayData + monthData
+	leap := 0
+	if (yearData%400 == 0) || ((yearData%4 == 0) && (yearData%100 != 0)) {
+		leap = 1
+	}
+	if (leap == 1) && (monthData > 2) {
+		sum += 1
+	}
+	last := ""
+	billingIdPrefix := "9" + conv.MustString(enterpriseId)[len(conv.MustString(enterpriseId))-2:] + conv.MustString(sum)
+	var rechargeIdLast string
+	err := db.Model(gorm_model.YounggeeInvoiceRecord{}).Select("billing_id").Where("billing_id like ?", billingIdPrefix+"%").
+		Last(&rechargeIdLast).Error
+	if err != nil {
+		last = "0"
+	} else {
+		last = rechargeIdLast[len(rechargeIdLast)-2:]
+	}
+	var lastInt int
+	lastInt = conv.MustInt(last)
+	if lastInt+1 < 10 {
+		last = "0" + conv.MustString(conv.MustInt(last)+1)
+	} else {
+		last = conv.MustString(conv.MustInt(last) + 1)
+	}
+	err = db.Debug().Model(gorm_model.YounggeeInvoiceRecord{}).Create(&gorm_model.YounggeeInvoiceRecord{
+		BillingID:     billingIdPrefix + last,
+		EnterpriseID:  enterpriseId,
+		InvoiceAmount: req.Amount,
+		InvoiceSnap:   string(invoiceInfoToJson),
+		AddressSnap:   string(addressInfoToJson),
+		Status:        1,
+		SubmitAt:      time.Now(),
+	}).Error
+	if err != nil {
+		return err
+	}
+	db3 := GetReadDB(ctx)
+	return db3.Debug().Model(gorm_model.YounggeeRechargeRecord{}).Where("recharge_id IN ?", req.RechargeIds).Updates(gorm_model.YounggeeRechargeRecord{
+		InvoiceStatus: 3,
+	}).Error
+}

+ 29 - 1
db/pay_record.go

@@ -2,13 +2,16 @@ package db
 
 import (
 	"context"
+	"github.com/issue9/conv"
 	"time"
+	"youngee_b_api/consts"
 	"youngee_b_api/model/gorm_model"
+	"youngee_b_api/model/http_model"
 
 	"github.com/sirupsen/logrus"
 )
 
-//新增
+// CreatePayRecord 新增
 func CreatePayRecord(ctx context.Context, enterpriseId int64, payment int64, balance int64, payType int64, projectId int64) (*int64, error) {
 	db := GetReadDB(ctx)
 	payRecord := gorm_model.EnterprisePayRecord{
@@ -27,3 +30,28 @@ func CreatePayRecord(ctx context.Context, enterpriseId int64, payment int64, bal
 
 	return &payRecord.ID, nil
 }
+
+func GetRechargeRecord(ctx context.Context, enterpriseID int64, confirmAt string, method int) (*http_model.RechargeRecordPreview, error) {
+	db := GetReadDB(ctx)
+	// 根据企业id过滤
+	db = db.Debug().Model(gorm_model.YounggeeRechargeRecord{}).Where("enterprise_id = ? AND status = 1", enterpriseID)
+	if method == 2 {
+		db = db.Where("invoice_status = 1")
+	}
+	if confirmAt != "" {
+		db = db.Where("confirm_at like ?", confirmAt+"%")
+	}
+	var rechargeRecords []gorm_model.YounggeeRechargeRecord
+	db = db.Order("confirm_at desc").Find(&rechargeRecords)
+	RechargeRecordPreview := http_model.RechargeRecordPreview{}
+	for _, rechargeRecord := range rechargeRecords {
+		RechargeRecordData := new(http_model.RechargeRecordData)
+		RechargeRecordData.RechargeId = rechargeRecord.RechargeID
+		RechargeRecordData.RechargeAmount = conv.MustString(rechargeRecord.RechargeAmount)
+		RechargeRecordData.TransferVoucher = conv.MustString(rechargeRecord.TransferVoucherUrl)
+		RechargeRecordData.PayMethod = consts.GetRechargeMethod(rechargeRecord.RechargeMethod)
+		RechargeRecordData.ConfirmAt = conv.MustString(rechargeRecord.ConfirmAt)[0:19]
+		RechargeRecordPreview.RechargeRecordData = append(RechargeRecordPreview.RechargeRecordData, RechargeRecordData)
+	}
+	return &RechargeRecordPreview, nil
+}

+ 24 - 0
db/project.go

@@ -3,7 +3,9 @@ package db
 import (
 	"context"
 	"fmt"
+	"github.com/issue9/conv"
 	"reflect"
+	"youngee_b_api/consts"
 	"youngee_b_api/model/common_model"
 	"youngee_b_api/model/gorm_model"
 	"youngee_b_api/model/http_model"
@@ -223,3 +225,25 @@ func UpdateProjectStatus(ctx context.Context, projectId int64, status int64) err
 	}
 	return nil
 }
+
+func GetFeeDetail(ctx context.Context, enterpriseID int64, EndTime string) (*http_model.FeeDetailPreview, error) {
+	db := GetReadDB(ctx)
+	// 根据企业id过滤
+	db = db.Debug().Model(gorm_model.ProjectInfo{}).Where("enterprise_id = ? AND project_status = 10", enterpriseID)
+	if EndTime != "" {
+		db = db.Where("updated_at like ?", EndTime+"%")
+	}
+	var projectInfos []gorm_model.ProjectInfo
+	db = db.Order("updated_at desc").Find(&projectInfos)
+	FeeDetailPreview := http_model.FeeDetailPreview{}
+	for _, projectInfo := range projectInfos {
+		FeeDetailData := new(http_model.FeeDetailData)
+		FeeDetailData.ProjectID = projectInfo.ProjectID
+		FeeDetailData.ProjectName = projectInfo.ProjectName
+		FeeDetailData.ProjectType = consts.GetProjectType(projectInfo.ProjectType)
+		FeeDetailData.Payment = conv.MustString(projectInfo.PaymentAmount, "")
+		FeeDetailData.UpdatedAt = conv.MustString(projectInfo.UpdatedAt)[0:19]
+		FeeDetailPreview.FeeDetailData = append(FeeDetailPreview.FeeDetailData, FeeDetailData)
+	}
+	return &FeeDetailPreview, nil
+}

+ 1 - 0
go.mod

@@ -25,6 +25,7 @@ require (
 	github.com/swaggo/swag v1.8.1
 	github.com/tidwall/gjson v1.14.1
 	github.com/ugorji/go v1.2.7 // indirect
+	github.com/wechatpay-apiv3/wechatpay-go v0.2.15
 	golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29 // indirect
 	golang.org/x/net v0.0.0-20220407224826-aac1ed45d8e3 // indirect
 	golang.org/x/sys v0.0.0-20220406163625-3f8b81556e12 // indirect

+ 10 - 2
go.sum

@@ -7,6 +7,8 @@ github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tN
 github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
 github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
 github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
+github.com/agiledragon/gomonkey v2.0.2+incompatible h1:eXKi9/piiC3cjJD1658mEE2o3NjkJ5vDLgYjCQu0Xlw=
+github.com/agiledragon/gomonkey v2.0.2+incompatible/go.mod h1:2NGfXu1a80LLr2cmWXGBDaHEjb1idR6+FVlX5T3D9hw=
 github.com/agiledragon/gomonkey/v2 v2.3.1 h1:k+UnUY0EMNYUFUAQVETGY9uUTxjMdnUkP0ARyJS1zzs=
 github.com/agiledragon/gomonkey/v2 v2.3.1/go.mod h1:ap1AmDzcVOAz1YpeJ3TCzIgstoaWLA6jbbgxfB4w2iY=
 github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
@@ -161,13 +163,16 @@ github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic
 github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
 github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
 github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
 github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
 github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
 github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
-github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
+github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
 github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2 h1:+iNTcqQJy0OZ5jk6a5NLib47eqXK8uYcPX+O4+cBpEM=
 github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2/go.mod h1:lKJPbtWzJ9JhsTN1k1gZgleJWY/cqq0psdoMmaThG3w=
 github.com/swaggo/gin-swagger v1.4.1 h1:F2vJndw+Q+ZBOlsC6CaodqXJV3ZOf6hpg/4Y6MEx5BM=
@@ -188,6 +193,8 @@ github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLY
 github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0=
 github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
 github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
+github.com/wechatpay-apiv3/wechatpay-go v0.2.15 h1:WtlAK8GsLwTveS7c5W8Vd1m4rU1cJ0YW6tqBW2BlKH8=
+github.com/wechatpay-apiv3/wechatpay-go v0.2.15/go.mod h1:Ca9wvI7xFoIWiY163q1jzddarQBS+1NE17OM1ZV24nw=
 github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
 github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
 github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
@@ -296,8 +303,9 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
 gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
 gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
 gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
-gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
 gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
+gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
 gorm.io/driver/mysql v1.3.2 h1:QJryWiqQ91EvZ0jZL48NOpdlPdMjdip1hQ8bTgo4H7I=
 gorm.io/driver/mysql v1.3.2/go.mod h1:ChK6AHbHgDCFZyJp0F+BmVGb06PSIoh9uVYKAlRbb2U=
 gorm.io/gorm v1.23.1/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk=

+ 62 - 0
handler/addInvoiceRecord.go

@@ -0,0 +1,62 @@
+package handler
+
+import (
+	"fmt"
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
+	"youngee_b_api/db"
+	"youngee_b_api/middleware"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/util"
+)
+
+func WrapAddInvoiceRecordHandler(ctx *gin.Context) {
+	handler := newAddInvoiceRecordHandler(ctx)
+	baseRun(handler)
+}
+
+type AddInvoiceRecordHandler struct {
+	ctx  *gin.Context
+	req  *http_model.AddInvoiceRecordRequest
+	resp *http_model.CommonResponse
+}
+
+func (a AddInvoiceRecordHandler) getContext() *gin.Context {
+	return a.ctx
+}
+
+func (a AddInvoiceRecordHandler) getResponse() interface{} {
+	return a.resp
+}
+
+func (a AddInvoiceRecordHandler) getRequest() interface{} {
+	return a.req
+}
+
+func (a AddInvoiceRecordHandler) run() {
+	auth := middleware.GetSessionAuth(a.ctx)
+	enterpriseID := auth.EnterpriseID
+	fmt.Println("req", a.req)
+	err := db.AddInvoiceRecord(a.ctx, enterpriseID, a.req)
+	if err != nil {
+		// 数据库查询失败,返回5001
+		logrus.Errorf("[AddInvoiceRecordHandler] call AddInvoiceRecord err:%+v\n", err)
+		util.HandlerPackErrorResp(a.resp, consts.ErrorInternal, "")
+		logrus.Info("AddInvoiceRecord fail,req:%+v", a.req)
+		return
+	}
+	a.resp.Message = "开票成功"
+}
+
+func (a AddInvoiceRecordHandler) checkParam() error {
+	return nil
+}
+
+func newAddInvoiceRecordHandler(ctx *gin.Context) *AddInvoiceRecordHandler {
+	return &AddInvoiceRecordHandler{
+		ctx:  ctx,
+		req:  http_model.NewAddInvoiceRecordRequest(),
+		resp: http_model.NewAddInvoiceRecordResponse(),
+	}
+}

+ 60 - 0
handler/addReceiveAddress.go

@@ -0,0 +1,60 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
+	"youngee_b_api/db"
+	"youngee_b_api/middleware"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/util"
+)
+
+func WrapAddReceiveAddressHandler(ctx *gin.Context) {
+	handler := newAddReceiveAddressHandler(ctx)
+	baseRun(handler)
+}
+
+type AddReceiveAddressHandler struct {
+	ctx  *gin.Context
+	req  *http_model.AddReceiveAddressRequest
+	resp *http_model.CommonResponse
+}
+
+func (a AddReceiveAddressHandler) getContext() *gin.Context {
+	return a.ctx
+}
+
+func (a AddReceiveAddressHandler) getResponse() interface{} {
+	return a.resp
+}
+
+func (a AddReceiveAddressHandler) getRequest() interface{} {
+	return a.req
+}
+
+func (a AddReceiveAddressHandler) run() {
+	auth := middleware.GetSessionAuth(a.ctx)
+	enterpriseID := auth.EnterpriseID
+	err := db.AddReceiveAddress(a.ctx, enterpriseID, a.req)
+	if err != nil {
+		// 数据库查询失败,返回5001
+		logrus.Errorf("[AddReceiveAddressHandler] call AddReceiveAddress err:%+v\n", err)
+		util.HandlerPackErrorResp(a.resp, consts.ErrorInternal, "")
+		logrus.Info("AddReceiveAddress fail,req:%+v", a.req)
+		return
+	}
+	a.resp.Message = "新增收货地址成功"
+}
+
+func (a AddReceiveAddressHandler) checkParam() error {
+	return nil
+}
+
+func newAddReceiveAddressHandler(ctx *gin.Context) *AddReceiveAddressHandler {
+	return &AddReceiveAddressHandler{
+		ctx:  ctx,
+		req:  http_model.NewAddReceiveAddressRequest(),
+		resp: http_model.NewAddReceiveAddressResponse(),
+	}
+}

+ 60 - 0
handler/addReceiveInfo.go

@@ -0,0 +1,60 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
+	"youngee_b_api/db"
+	"youngee_b_api/middleware"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/util"
+)
+
+func WrapAddReceiveInfoHandler(ctx *gin.Context) {
+	handler := newAddReceiveInfoHandler(ctx)
+	baseRun(handler)
+}
+
+type AddReceiveInfoHandler struct {
+	ctx  *gin.Context
+	req  *http_model.AddReceiveInfoRequest
+	resp *http_model.CommonResponse
+}
+
+func (a AddReceiveInfoHandler) getContext() *gin.Context {
+	return a.ctx
+}
+
+func (a AddReceiveInfoHandler) getResponse() interface{} {
+	return a.resp
+}
+
+func (a AddReceiveInfoHandler) getRequest() interface{} {
+	return a.req
+}
+
+func (a AddReceiveInfoHandler) run() {
+	auth := middleware.GetSessionAuth(a.ctx)
+	enterpriseID := auth.EnterpriseID
+	err := db.AddReceiveInfo(a.ctx, enterpriseID, a.req)
+	if err != nil {
+		// 数据库查询失败,返回5001
+		logrus.Errorf("[AddReceiveInfoHandler] call AddReceiveInfo err:%+v\n", err)
+		util.HandlerPackErrorResp(a.resp, consts.ErrorInternal, "")
+		logrus.Info("AddReceiveInfo fail,req:%+v", a.req)
+		return
+	}
+	a.resp.Message = "新增发票信息成功"
+}
+
+func (a AddReceiveInfoHandler) checkParam() error {
+	return nil
+}
+
+func newAddReceiveInfoHandler(ctx *gin.Context) *AddReceiveInfoHandler {
+	return &AddReceiveInfoHandler{
+		ctx:  ctx,
+		req:  http_model.NewAddReceiveInfoRequest(),
+		resp: http_model.NewAddReceiveInfoResponse(),
+	}
+}

+ 60 - 0
handler/feeDetail.go

@@ -0,0 +1,60 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
+	"youngee_b_api/db"
+	"youngee_b_api/middleware"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/util"
+)
+
+func WrapFeeDetailHandler(ctx *gin.Context) {
+	handler := newFeeDetailHandler(ctx)
+	baseRun(handler)
+}
+
+type feeDetailHandler struct {
+	ctx  *gin.Context
+	req  *http_model.FeeDetailRequest
+	resp *http_model.CommonResponse
+}
+
+func (f feeDetailHandler) getContext() *gin.Context {
+	return f.ctx
+}
+
+func (f feeDetailHandler) getResponse() interface{} {
+	return f.resp
+}
+
+func (f feeDetailHandler) getRequest() interface{} {
+	return f.req
+}
+
+func (f feeDetailHandler) run() {
+	auth := middleware.GetSessionAuth(f.ctx)
+	enterpriseID := auth.EnterpriseID
+	data, err := db.GetFeeDetail(f.ctx, enterpriseID, f.req.EndTime)
+	if err != nil {
+		// 数据库查询失败,返回5001
+		logrus.Errorf("[feeDetailHandler] call GetFeeDetail err:%+v\n", err)
+		util.HandlerPackErrorResp(f.resp, consts.ErrorInternal, "")
+		logrus.Info("GetFeeDetail fail,req:%+v", f.req)
+		return
+	}
+	f.resp.Data = data
+}
+
+func (f feeDetailHandler) checkParam() error {
+	return nil
+}
+
+func newFeeDetailHandler(ctx *gin.Context) *feeDetailHandler {
+	return &feeDetailHandler{
+		ctx:  ctx,
+		req:  http_model.NewFeeDetailRequest(),
+		resp: http_model.NewFeeDetailResponse(),
+	}
+}

+ 61 - 0
handler/getCodeUrl.go

@@ -0,0 +1,61 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+	"youngee_b_api/util"
+)
+
+func WrapGetCodeUrlHandler(ctx *gin.Context) {
+	handler := newGetCodeUrlHandler(ctx)
+	baseRun(handler)
+}
+
+type getCodeUrlHandler struct {
+	ctx  *gin.Context
+	req  *http_model.GetCodeUrlRequest
+	resp *http_model.CommonResponse
+}
+
+func (g getCodeUrlHandler) getContext() *gin.Context {
+	return g.ctx
+}
+
+func (g getCodeUrlHandler) getResponse() interface{} {
+	return g.resp
+}
+
+func (g getCodeUrlHandler) getRequest() interface{} {
+	return g.req
+}
+
+func (g getCodeUrlHandler) run() {
+	tradeId := util.GetRandomString(32)
+	if g.req.Type == 1 {
+		data, err := service.NativeApiServicePrepay(tradeId, g.req.Amount)
+		if err != nil {
+			logrus.WithContext(g.ctx).Errorf("[getCodeUrlHandler] error NativeApiServicePrepay, err:%+v", err)
+			util.HandlerPackErrorResp(g.resp, consts.ErrorInternal, consts.DefaultToast)
+			return
+		}
+		codeUrlData := new(http_model.CodeUrl)
+		codeUrlData.CodeUrl = data
+		codeUrlData.TradeId = tradeId
+		g.resp.Data = codeUrlData
+	}
+}
+
+func (g getCodeUrlHandler) checkParam() error {
+	return nil
+}
+
+func newGetCodeUrlHandler(ctx *gin.Context) *getCodeUrlHandler {
+	return &getCodeUrlHandler{
+		ctx:  ctx,
+		req:  http_model.NewGetCodeUrlRequest(),
+		resp: http_model.NewGetCodeUrlResponse(),
+	}
+}

+ 60 - 0
handler/getReceiveAddress.go

@@ -0,0 +1,60 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
+	"youngee_b_api/db"
+	"youngee_b_api/middleware"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/util"
+)
+
+func WrapGetReceiveAddressHandler(ctx *gin.Context) {
+	handler := newGetReceiveAddressHandler(ctx)
+	baseRun(handler)
+}
+
+type GetReceiveAddressHandler struct {
+	ctx  *gin.Context
+	req  *http_model.GetReceiveAddressRequest
+	resp *http_model.CommonResponse
+}
+
+func (g GetReceiveAddressHandler) getContext() *gin.Context {
+	return g.ctx
+}
+
+func (g GetReceiveAddressHandler) getResponse() interface{} {
+	return g.resp
+}
+
+func (g GetReceiveAddressHandler) getRequest() interface{} {
+	return g.req
+}
+
+func (g GetReceiveAddressHandler) run() {
+	auth := middleware.GetSessionAuth(g.ctx)
+	enterpriseID := auth.EnterpriseID
+	data, err := db.GetReceiveAddress(g.ctx, enterpriseID)
+	if err != nil {
+		// 数据库查询失败,返回5001
+		logrus.Errorf("[GetReceiveAddressHandler] call GetReceiveAddress err:%+v\n", err)
+		util.HandlerPackErrorResp(g.resp, consts.ErrorInternal, "")
+		logrus.Info("GetReceiveAddress fail,req:%+v", g.req)
+		return
+	}
+	g.resp.Data = data
+}
+
+func (g GetReceiveAddressHandler) checkParam() error {
+	return nil
+}
+
+func newGetReceiveAddressHandler(ctx *gin.Context) *GetReceiveAddressHandler {
+	return &GetReceiveAddressHandler{
+		ctx:  ctx,
+		req:  http_model.NewGetReceiveAddressRequest(),
+		resp: http_model.NewGetReceiveAddressResponse(),
+	}
+}

+ 60 - 0
handler/getReceiveInfo.go

@@ -0,0 +1,60 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
+	"youngee_b_api/db"
+	"youngee_b_api/middleware"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/util"
+)
+
+func WrapGetReceiveInfoHandler(ctx *gin.Context) {
+	handler := newGetReceiveInfoHandler(ctx)
+	baseRun(handler)
+}
+
+type GetReceiveInfoHandler struct {
+	ctx  *gin.Context
+	req  *http_model.GetReceiveInfoRequest
+	resp *http_model.CommonResponse
+}
+
+func (g GetReceiveInfoHandler) getContext() *gin.Context {
+	return g.ctx
+}
+
+func (g GetReceiveInfoHandler) getResponse() interface{} {
+	return g.resp
+}
+
+func (g GetReceiveInfoHandler) getRequest() interface{} {
+	return g.req
+}
+
+func (g GetReceiveInfoHandler) run() {
+	auth := middleware.GetSessionAuth(g.ctx)
+	enterpriseID := auth.EnterpriseID
+	data, err := db.GetReceiveInfo(g.ctx, enterpriseID)
+	if err != nil {
+		// 数据库查询失败,返回5001
+		logrus.Errorf("[GetReceiveInfoHandler] call GetReceiveInfo err:%+v\n", err)
+		util.HandlerPackErrorResp(g.resp, consts.ErrorInternal, "")
+		logrus.Info("GetReceiveInfo fail,req:%+v", g.req)
+		return
+	}
+	g.resp.Data = data
+}
+
+func (g GetReceiveInfoHandler) checkParam() error {
+	return nil
+}
+
+func newGetReceiveInfoHandler(ctx *gin.Context) *GetReceiveInfoHandler {
+	return &GetReceiveInfoHandler{
+		ctx:  ctx,
+		req:  http_model.NewGetReceiveInfoRequest(),
+		resp: http_model.NewGetReceiveInfoResponse(),
+	}
+}

+ 64 - 0
handler/operateReceiveAddress.go

@@ -0,0 +1,64 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
+	"youngee_b_api/db"
+	"youngee_b_api/middleware"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/util"
+)
+
+func WrapOperateReceiveAddressHandler(ctx *gin.Context) {
+	handler := newOperateReceiveAddressHandler(ctx)
+	baseRun(handler)
+}
+
+type OperateReceiveAddress struct {
+	ctx  *gin.Context
+	req  *http_model.OperateReceiveAddressRequest
+	resp *http_model.CommonResponse
+}
+
+func (o OperateReceiveAddress) getContext() *gin.Context {
+	return o.ctx
+}
+
+func (o OperateReceiveAddress) getResponse() interface{} {
+	return o.resp
+}
+
+func (o OperateReceiveAddress) getRequest() interface{} {
+	return o.req
+}
+
+func (o OperateReceiveAddress) run() {
+	auth := middleware.GetSessionAuth(o.ctx)
+	enterpriseID := auth.EnterpriseID
+	err := db.OperateReceiveAddress(o.ctx, enterpriseID, o.req)
+	if err != nil {
+		// 数据库查询失败,返回5001
+		logrus.Errorf("[OperateReceiveAddress] call OperateReceiveAddress err:%+v\n", err)
+		util.HandlerPackErrorResp(o.resp, consts.ErrorInternal, "")
+		logrus.Info("OperateReceiveAddress fail,req:%+v", o.req)
+		return
+	}
+	if o.req.OperateType == 2 {
+		o.resp.Message = "已删除该地址信息"
+	} else {
+		o.resp.Message = "修改地址信息成功"
+	}
+}
+
+func (o OperateReceiveAddress) checkParam() error {
+	return nil
+}
+
+func newOperateReceiveAddressHandler(ctx *gin.Context) *OperateReceiveAddress {
+	return &OperateReceiveAddress{
+		ctx:  ctx,
+		req:  http_model.NewOperateReceiveAddressRequest(),
+		resp: http_model.NewOperateReceiveAddressResponse(),
+	}
+}

+ 64 - 0
handler/operateReceiveInfo.go

@@ -0,0 +1,64 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
+	"youngee_b_api/db"
+	"youngee_b_api/middleware"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/util"
+)
+
+func WrapOperateReceiveInfoHandler(ctx *gin.Context) {
+	handler := newOperateReceiveInfoHandler(ctx)
+	baseRun(handler)
+}
+
+type OperateReceiveInfo struct {
+	ctx  *gin.Context
+	req  *http_model.OperateReceiveInfoRequest
+	resp *http_model.CommonResponse
+}
+
+func (o OperateReceiveInfo) getContext() *gin.Context {
+	return o.ctx
+}
+
+func (o OperateReceiveInfo) getResponse() interface{} {
+	return o.resp
+}
+
+func (o OperateReceiveInfo) getRequest() interface{} {
+	return o.req
+}
+
+func (o OperateReceiveInfo) run() {
+	auth := middleware.GetSessionAuth(o.ctx)
+	enterpriseID := auth.EnterpriseID
+	err := db.OperateReceiveInfo(o.ctx, enterpriseID, o.req)
+	if err != nil {
+		// 数据库查询失败,返回5001
+		logrus.Errorf("[OperateReceiveInfo] call OperateReceiveInfo err:%+v\n", err)
+		util.HandlerPackErrorResp(o.resp, consts.ErrorInternal, "")
+		logrus.Info("OperateReceiveInfo fail,req:%+v", o.req)
+		return
+	}
+	if o.req.OperateType == 2 {
+		o.resp.Message = "已删除该发票信息"
+	} else {
+		o.resp.Message = "修改发票信息成功"
+	}
+}
+
+func (o OperateReceiveInfo) checkParam() error {
+	return nil
+}
+
+func newOperateReceiveInfoHandler(ctx *gin.Context) *OperateReceiveInfo {
+	return &OperateReceiveInfo{
+		ctx:  ctx,
+		req:  http_model.NewOperateReceiveInfoRequest(),
+		resp: http_model.NewOperateReceiveInfoResponse(),
+	}
+}

+ 55 - 0
handler/queryOrderByTradeId.go

@@ -0,0 +1,55 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+	"youngee_b_api/util"
+)
+
+func WrapQueryOrderByTradeIdHandler(ctx *gin.Context) {
+	handler := newQueryOrderByTradeIdHandler(ctx)
+	baseRun(handler)
+}
+
+type QueryOrderByTradeIdHandler struct {
+	ctx  *gin.Context
+	req  *http_model.QueryOrderByTradeIdRequest
+	resp *http_model.CommonResponse
+}
+
+func (q QueryOrderByTradeIdHandler) getContext() *gin.Context {
+	return q.ctx
+}
+
+func (q QueryOrderByTradeIdHandler) getResponse() interface{} {
+	return q.resp
+}
+
+func (q QueryOrderByTradeIdHandler) getRequest() interface{} {
+	return q.req
+}
+
+func (q QueryOrderByTradeIdHandler) run() {
+	data, err := service.QueryOrderByOutTradeNo(q.req.TradeId)
+	if err != nil {
+		logrus.WithContext(q.ctx).Errorf("[QueryOrderByTradeIdHandler] error QueryOrderByOutTradeNo, err:%+v", err)
+		util.HandlerPackErrorResp(q.resp, consts.ErrorInternal, consts.DefaultToast)
+		return
+	}
+	q.resp.Data = data
+}
+
+func (q QueryOrderByTradeIdHandler) checkParam() error {
+	return nil
+}
+
+func newQueryOrderByTradeIdHandler(ctx *gin.Context) *QueryOrderByTradeIdHandler {
+	return &QueryOrderByTradeIdHandler{
+		ctx:  ctx,
+		req:  http_model.NewQueryOrderByTradeIdRequest(),
+		resp: http_model.NewQueryOrderByTradeIdResponse(),
+	}
+}

+ 57 - 0
handler/rechargeBalance.go

@@ -0,0 +1,57 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
+	"youngee_b_api/db"
+	"youngee_b_api/middleware"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/util"
+)
+
+func WrapRechargeBalanceHandler(ctx *gin.Context) {
+	handler := newRechargeBalanceHandler(ctx)
+	baseRun(handler)
+}
+
+type RechargeBalanceHandler struct {
+	ctx  *gin.Context
+	req  *http_model.RechargeBalanceRequest
+	resp *http_model.CommonResponse
+}
+
+func (r RechargeBalanceHandler) getContext() *gin.Context {
+	return r.ctx
+}
+
+func (r RechargeBalanceHandler) getResponse() interface{} {
+	return r.resp
+}
+
+func (r RechargeBalanceHandler) getRequest() interface{} {
+	return r.req
+}
+
+func (r RechargeBalanceHandler) run() {
+	enterpriseID := middleware.GetSessionAuth(r.ctx).EnterpriseID
+	err := db.RechargeAmount(r.ctx, enterpriseID, r.req.Amount)
+	if err != nil {
+		logrus.WithContext(r.ctx).Errorf("[QueryOrderByTradeIdHandler] error QueryOrderByOutTradeNo, err:%+v", err)
+		util.HandlerPackErrorResp(r.resp, consts.ErrorInternal, consts.DefaultToast)
+		return
+	}
+	r.resp.Message = "充值成功"
+}
+
+func (r RechargeBalanceHandler) checkParam() error {
+	return nil
+}
+
+func newRechargeBalanceHandler(ctx *gin.Context) *RechargeBalanceHandler {
+	return &RechargeBalanceHandler{
+		ctx:  ctx,
+		req:  http_model.NewRechargeBalanceResponse(),
+		resp: http_model.NewRechargeBalanceRequest(),
+	}
+}

+ 60 - 0
handler/rechargeRecord.go

@@ -0,0 +1,60 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
+	"youngee_b_api/db"
+	"youngee_b_api/middleware"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/util"
+)
+
+func WrapRechargeRecordHandler(ctx *gin.Context) {
+	handler := newRechargeRecordHandler(ctx)
+	baseRun(handler)
+}
+
+type RechargeRecordHandler struct {
+	ctx  *gin.Context
+	req  *http_model.RechargeRecordRequest
+	resp *http_model.CommonResponse
+}
+
+func (r RechargeRecordHandler) getContext() *gin.Context {
+	return r.ctx
+}
+
+func (r RechargeRecordHandler) getResponse() interface{} {
+	return r.resp
+}
+
+func (r RechargeRecordHandler) getRequest() interface{} {
+	return r.req
+}
+
+func (r RechargeRecordHandler) run() {
+	auth := middleware.GetSessionAuth(r.ctx)
+	enterpriseID := auth.EnterpriseID
+	data, err := db.GetRechargeRecord(r.ctx, enterpriseID, r.req.ConfirmAt, r.req.Method)
+	if err != nil {
+		// 数据库查询失败,返回5001
+		logrus.Errorf("[RechargeRecordHandler] call GetRechargeRecord err:%+v\n", err)
+		util.HandlerPackErrorResp(r.resp, consts.ErrorInternal, "")
+		logrus.Info("GetRechargeRecord fail,req:%+v", r.req)
+		return
+	}
+	r.resp.Data = data
+}
+
+func (r RechargeRecordHandler) checkParam() error {
+	return nil
+}
+
+func newRechargeRecordHandler(ctx *gin.Context) *RechargeRecordHandler {
+	return &RechargeRecordHandler{
+		ctx:  ctx,
+		req:  http_model.NewRechargeRecordRequest(),
+		resp: http_model.NewRechargeRecordResponse(),
+	}
+}

+ 19 - 0
model/gorm_model/invoice_address.go

@@ -0,0 +1,19 @@
+package gorm_model
+
+import "time"
+
+// Code generated by sql2gorm. DO NOT EDIT.
+
+type YounggeeInvoiceAddress struct {
+	AddressID    int64     `gorm:"column:address_id;primary_key;AUTO_INCREMENT"` // 发票收件地址id
+	EnterpriseID int64     `gorm:"column:enterprise_id;NOT NULL"`                // 企业id
+	Name         string    `gorm:"column:name;NOT NULL"`                         // 收件人姓名
+	RegionCode   string    `gorm:"column:region_code;NOT NULL"`                  // 所在地区编码
+	Address      string    `gorm:"column:address;NOT NULL"`                      // 详细地址
+	Phone        string    `gorm:"column:phone;NOT NULL"`                        // 手机号码
+	UpdateAt     time.Time `gorm:"column:update_at;NOT NULL"`                    // 创建时间
+}
+
+func (m *YounggeeInvoiceAddress) TableName() string {
+	return "younggee_invoice_address"
+}

+ 23 - 0
model/gorm_model/invoice_info.go

@@ -0,0 +1,23 @@
+package gorm_model
+
+import "time"
+
+// Code generated by sql2gorm. DO NOT EDIT.
+
+type YounggeeInvoiceInfo struct {
+	InvoiceID         int64     `gorm:"column:invoice_id;primary_key;AUTO_INCREMENT"` // 发票信息id
+	EnterpriseID      int64     `gorm:"column:enterprise_id;NOT NULL"`                // 企业id
+	HeadType          string    `gorm:"column:head_type;NOT NULL"`                    // 抬头类型
+	InvoiceHeader     string    `gorm:"column:invoice_header;NOT NULL"`               // 发票抬头
+	InvoiceType       string    `gorm:"column:invoice_type;NOT NULL"`                 // 发票类型
+	TaxCode           string    `gorm:"column:tax_code;NOT NULL"`                     // 税务登记证号/统一社会信用代码
+	Bank              string    `gorm:"column:bank;NOT NULL"`                         // 基本户开户银行
+	BankCardNumber    string    `gorm:"column:bank_card_number;NOT NULL"`             // 基本户开户银行账号
+	RegisteredAddress string    `gorm:"column:registered_address;NOT NULL"`           // 企业注册地址
+	RegisteredPhone   string    `gorm:"column:registered_phone;NOT NULL"`             // 企业注册电话
+	UpdateAt          time.Time `gorm:"column:update_at;NOT NULL"`                    // 更新时间
+}
+
+func (m *YounggeeInvoiceInfo) TableName() string {
+	return "younggee_invoice_info"
+}

+ 23 - 0
model/gorm_model/invoice_record.go

@@ -0,0 +1,23 @@
+package gorm_model
+
+// Code generated by sql2gorm. DO NOT EDIT.
+
+import (
+	"time"
+)
+
+type YounggeeInvoiceRecord struct {
+	BillingID      string     `gorm:"column:billing_id;primary_key"`  // 开票订单ID
+	EnterpriseID   int64      `gorm:"column:enterprise_id;NOT NULL"`  // 企业id
+	InvoiceAmount  float64    `gorm:"column:invoice_amount;NOT NULL"` // 开票金额
+	InvoiceSnap    string     `gorm:"column:invoice_snap;NOT NULL"`   // 开票信息快照
+	AddressSnap    string     `gorm:"column:address_snap;NOT NULL"`   // 邮寄地址快照
+	Status         int64      `gorm:"column:status;NOT NULL"`         // 开票状态:1 为待开票,2为已开票
+	ShipmentNumber string     `gorm:"column:shipment_number"`         // 物流单号
+	SubmitAt       time.Time  `gorm:"column:submit_at;NOT NULL"`      // 申请提交时间
+	BillingAt      *time.Time `gorm:"column:billing_at"`              // 开票时间
+}
+
+func (m *YounggeeInvoiceRecord) TableName() string {
+	return "younggee_invoice_record"
+}

+ 24 - 17
model/gorm_model/project.go

@@ -6,23 +6,30 @@ import (
 )
 
 type ProjectInfo struct {
-	ProjectID       int64     `gorm:"column:project_id;primary_key;AUTO_INCREMENT"` // 项目id
-	ProjectName     string    `gorm:"column:project_name"`                          // 项目名称
-	ProjectStatus   int64     `gorm:"column:project_status"`                        // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、失效、执行中、已结案
-	ProjectType     int64     `gorm:"column:project_type"`                          // 项目类型,1代表全流程项目,2代表专项项目
-	ProjectPlatform int64     `gorm:"column:project_platform"`                      // 项目平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
-	ProjectForm     int64     `gorm:"column:project_form"`                          // 项目形式,1-4分别代表实体商品寄拍、虚拟产品测评、线下探店打卡、素材微原创
-	TalentType      string    `gorm:"column:talent_type"`                           // 达人类型
-	RecruitDdl      time.Time `gorm:"column:recruit_ddl"`                           // 招募截止时间
-	ContentType     int64     `gorm:"column:content_type"`                          // 内容形式,1代表图文,2代表视频
-	ProjectDetail   string    `gorm:"column:project_detail"`                        // 项目详情
-	ApplyNum        int64     `gorm:"column:apply_num;default:0;NOT NULL"`          // 报名人数
-	RecruitNum      int64     `gorm:"column:recruit_num;default:0;NOT NULL"`        // 已招募人数
-	EnterpriseID    int64     `gorm:"column:enterprise_id"`                         // 所属企业id
-	ProductID       int64     `gorm:"column:product_id"`                            // 关联商品id
-	CreatedAt       time.Time `gorm:"column:created_at"`                            // 创建时间
-	UpdatedAt       time.Time `gorm:"column:updated_at"`                            // 修改时间
-	FeeForm         string    `gorm:"column:fee_form"`                              // 稿费形式列表
+	ProjectID         int64     `gorm:"column:project_id;primary_key;AUTO_INCREMENT"` // 项目id
+	ProjectName       string    `gorm:"column:project_name"`                          // 项目名称
+	ProjectStatus     int64     `gorm:"column:project_status"`                        // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、失效、执行中、已结案
+	ProjectType       int64     `gorm:"column:project_type"`                          // 项目类型,1代表全流程项目,2代表专项项目
+	ProjectPlatform   int64     `gorm:"column:project_platform"`                      // 项目平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
+	ProjectForm       int64     `gorm:"column:project_form"`                          // 项目形式,1-4分别代表实体商品寄拍、虚拟产品测评、线下探店打卡、素材微原创
+	TalentType        string    `gorm:"column:talent_type"`                           // 达人类型
+	RecruitDdl        time.Time `gorm:"column:recruit_ddl"`                           // 招募截止时间
+	ContentType       int64     `gorm:"column:content_type"`                          // 内容形式,1代表图文,2代表视频
+	ProjectDetail     string    `gorm:"column:project_detail"`                        // 项目详情
+	ApplyNum          int64     `gorm:"column:apply_num;default:0;NOT NULL"`          // 报名人数
+	RecruitNum        int64     `gorm:"column:recruit_num;default:0;NOT NULL"`        // 已招募人数
+	EnterpriseID      int64     `gorm:"column:enterprise_id"`                         // 所属企业id
+	ProductID         int64     `gorm:"column:product_id"`                            // 关联商品id
+	CreatedAt         time.Time `gorm:"column:created_at"`                            // 创建时间
+	UpdatedAt         time.Time `gorm:"column:updated_at"`                            // 修改时间
+	FeeForm           string    `gorm:"column:fee_form"`                              // 稿费形式列表
+	AutoFailAt        time.Time `gorm:"column:auto_fail_at"`                          // 失效自动处理时间
+	AutoTaskID        int64     `gorm:"column:auto_task_id;NOT NULL"`                 // 定时任务id
+	AutoDefaultID     int64     `gorm:"column:auto_default_id;NOT NULL"`              // 违约状态id
+	PaymentAmount     float64   `gorm:"column:payment_amount"`                        // 支付金额
+	PayAt             time.Time `gorm:"column:pay_at"`                                // 支付时间
+	AutoScriptBreakAt time.Time `gorm:"column:auto_script_break_at"`                  // 脚本违约自动处理时间
+	AutoSketchBreakAt time.Time `gorm:"column:auto_sketch_break_at"`                  // 初稿违约自动处理时间
 }
 
 func (m *ProjectInfo) TableName() string {

+ 23 - 0
model/gorm_model/recharge.go

@@ -0,0 +1,23 @@
+package gorm_model
+
+// Code generated by sql2gorm. DO NOT EDIT.
+
+import (
+	"time"
+)
+
+type YounggeeRechargeRecord struct {
+	RechargeID         string    `gorm:"column:recharge_id;primary_key"`       // 充值订单ID
+	EnterpriseID       int64     `gorm:"column:enterprise_id;NOT NULL"`        // 企业id
+	RechargeAmount     float64   `gorm:"column:recharge_amount;NOT NULL"`      // 充值金额
+	TransferVoucherUrl string    `gorm:"column:transfer_voucher_url;NOT NULL"` // 转账凭证图片链接
+	RechargeMethod     int64     `gorm:"column:recharge_method;NOT NULL"`      // 充值方式:1为对公转账,2为支付宝在线支付,3为微信支付
+	Status             int64     `gorm:"column:status;NOT NULL"`               // 充值状态:0为充值待确认,1为充值已确认
+	InvoiceStatus      int       `gorm:"column:invoice_status;NOT NULL"`       // 开票状态:1为可开票,2为待开票,3为已开票
+	CommitAt           time.Time `gorm:"column:commit_at;NOT NULL"`            // 充值申请提交时间
+	ConfirmAt          time.Time `gorm:"column:confirm_at"`                    // 充值确认时间
+}
+
+func (m *YounggeeRechargeRecord) TableName() string {
+	return "younggee_recharge_record"
+}

+ 16 - 0
model/http_model/AddInvoiceRecordRequest.go

@@ -0,0 +1,16 @@
+package http_model
+
+type AddInvoiceRecordRequest struct {
+	RechargeIds []string `json:"recharge_ids"`
+	Amount      float64  `json:"amount"`
+	InvoiceID   int64    `json:"invoice_id"`
+	AddressID   int64    `json:"address_id"`
+}
+
+func NewAddInvoiceRecordRequest() *AddInvoiceRecordRequest {
+	return new(AddInvoiceRecordRequest)
+}
+
+func NewAddInvoiceRecordResponse() *CommonResponse {
+	return new(CommonResponse)
+}

+ 16 - 0
model/http_model/AddReceiveAddressRequest.go

@@ -0,0 +1,16 @@
+package http_model
+
+type AddReceiveAddressRequest struct {
+	ReceiveName    string `json:"receive_name"`
+	RegionCode     string `json:"region_code"`
+	ReceiveAddress string `json:"receive_address"`
+	ReceivePhone   string `json:"receive_phone"`
+}
+
+func NewAddReceiveAddressRequest() *AddReceiveAddressRequest {
+	return new(AddReceiveAddressRequest)
+}
+
+func NewAddReceiveAddressResponse() *CommonResponse {
+	return new(CommonResponse)
+}

+ 20 - 0
model/http_model/AddReceiveInfoRequest.go

@@ -0,0 +1,20 @@
+package http_model
+
+type AddReceiveInfoRequest struct {
+	HeadType          string `json:"head_type"`
+	InvoiceHead       string `json:"invoice_head"`
+	InvoiceType       string `json:"invoice_type"`
+	TaxNum            string `json:"tax_num"`
+	BaseBank          string `json:"base_bank"`
+	BaseBankCardNum   string `json:"base_bank_card_num"`
+	EnterpriseAddress string `json:"enterprise_address"`
+	EnterprisePhone   string `json:"enterprise_phone"`
+}
+
+func NewAddReceiveInfoRequest() *AddReceiveInfoRequest {
+	return new(AddReceiveInfoRequest)
+}
+
+func NewAddReceiveInfoResponse() *CommonResponse {
+	return new(CommonResponse)
+}

+ 27 - 0
model/http_model/FeeDetailRequest.go

@@ -0,0 +1,27 @@
+package http_model
+
+type FeeDetailRequest struct {
+	EndTime string `json:"end_time"`
+}
+
+type FeeDetailData struct {
+	ProjectID   int64  `json:"project_id"`
+	ProjectName string `json:"project_name"`
+	ProjectType string `json:"project_type"`
+	Payment     string `json:"payment"`
+	UpdatedAt   string `json:"updated_at"`
+}
+
+type FeeDetailPreview struct {
+	FeeDetailData []*FeeDetailData `json:"fee_detail_data"`
+}
+
+func NewFeeDetailRequest() *FeeDetailRequest {
+	return new(FeeDetailRequest)
+}
+
+func NewFeeDetailResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(FeeDetailPreview)
+	return resp
+}

+ 21 - 0
model/http_model/GetCodeUrlRequest.go

@@ -0,0 +1,21 @@
+package http_model
+
+type GetCodeUrlRequest struct {
+	Amount int64 `json:"amount"`
+	Type   int64 `json:"type"`
+}
+
+type CodeUrl struct {
+	CodeUrl string `json:"code_url"`
+	TradeId string `json:"trade_id"`
+}
+
+func NewGetCodeUrlRequest() *GetCodeUrlRequest {
+	return new(GetCodeUrlRequest)
+}
+
+func NewGetCodeUrlResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(CodeUrl)
+	return resp
+}

+ 26 - 0
model/http_model/GetReceiveAddressRequest.go

@@ -0,0 +1,26 @@
+package http_model
+
+type GetReceiveAddressRequest struct {
+}
+
+type ReceiveAddressPreview struct {
+	AddressID    int64  `json:"address_id"`
+	ReceiveName  string `json:"receive_name"`
+	AddressPhone string `json:"address_phone"`
+	Address      string `json:"address"`
+	RegionCode   string `json:"region_code"`
+}
+
+type ReceiveAddressData struct {
+	ReceiveAddressPreview []*ReceiveAddressPreview `json:"receive_address_preview"`
+}
+
+func NewGetReceiveAddressRequest() *GetReceiveAddressRequest {
+	return new(GetReceiveAddressRequest)
+}
+
+func NewGetReceiveAddressResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(ReceiveAddressData)
+	return resp
+}

+ 30 - 0
model/http_model/GetReceiveInfoRequest.go

@@ -0,0 +1,30 @@
+package http_model
+
+type GetReceiveInfoRequest struct {
+}
+
+type ReceiveInfoPreview struct {
+	InvoiceID         int64  `json:"invoice_id"`
+	InvoiceHead       string `json:"invoice_head"`
+	HeadType          string `json:"head_type"`
+	InvoiceType       string `json:"invoice_type"`
+	TaxNum            string `json:"tax_num"`
+	BaseBank          string `json:"base_bank"`
+	BaseBankCardNum   string `json:"base_bank_card_num"`
+	EnterpriseAddress string `json:"enterprise_address"`
+	EnterprisePhone   string `json:"enterprise_phone"`
+}
+
+type ReceiveInfoData struct {
+	ReceiveInfoPreview []*ReceiveInfoPreview `json:"receive_info_preview"`
+}
+
+func NewGetReceiveInfoRequest() *GetReceiveInfoRequest {
+	return new(GetReceiveInfoRequest)
+}
+
+func NewGetReceiveInfoResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(ReceiveInfoData)
+	return resp
+}

+ 18 - 0
model/http_model/OperateReceiveAddressRequest.go

@@ -0,0 +1,18 @@
+package http_model
+
+type OperateReceiveAddressRequest struct {
+	OperateType    int64  `json:"operate_type"`
+	AddressID      int64  `json:"address_id"`
+	ReceiveName    string `json:"receive_name"`
+	RegionCode     string `json:"region_code"`
+	ReceiveAddress string `json:"receive_address"`
+	ReceivePhone   string `json:"receive_phone"`
+}
+
+func NewOperateReceiveAddressRequest() *OperateReceiveAddressRequest {
+	return new(OperateReceiveAddressRequest)
+}
+
+func NewOperateReceiveAddressResponse() *CommonResponse {
+	return new(CommonResponse)
+}

+ 22 - 0
model/http_model/OperateReceiveInfoRequest.go

@@ -0,0 +1,22 @@
+package http_model
+
+type OperateReceiveInfoRequest struct {
+	OperateType       int64  `json:"operate_type"`
+	InvoiceId         int64  `json:"invoice_id"`
+	HeadType          string `json:"head_type"`
+	InvoiceHead       string `json:"invoice_head"`
+	InvoiceType       string `json:"invoice_type"`
+	TaxNum            string `json:"tax_num"`
+	BaseBank          string `json:"base_bank"`
+	BaseBankCardNum   string `json:"base_bank_card_num"`
+	EnterpriseAddress string `json:"enterprise_address"`
+	EnterprisePhone   string `json:"enterprise_phone"`
+}
+
+func NewOperateReceiveInfoRequest() *OperateReceiveInfoRequest {
+	return new(OperateReceiveInfoRequest)
+}
+
+func NewOperateReceiveInfoResponse() *CommonResponse {
+	return new(CommonResponse)
+}

+ 19 - 0
model/http_model/QueryOrderByTradeIdRequest.go

@@ -0,0 +1,19 @@
+package http_model
+
+type QueryOrderByTradeIdRequest struct {
+	TradeId string `json:"trade_id"`
+}
+
+type OrderStatus struct {
+	Status string `json:"status"`
+}
+
+func NewQueryOrderByTradeIdRequest() *QueryOrderByTradeIdRequest {
+	return new(QueryOrderByTradeIdRequest)
+}
+
+func NewQueryOrderByTradeIdResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(OrderStatus)
+	return resp
+}

+ 13 - 0
model/http_model/RechargeBalanceRequest.go

@@ -0,0 +1,13 @@
+package http_model
+
+type RechargeBalanceRequest struct {
+	Amount float64 `json:"amount"`
+}
+
+func NewRechargeBalanceResponse() *RechargeBalanceRequest {
+	return new(RechargeBalanceRequest)
+}
+
+func NewRechargeBalanceRequest() *CommonResponse {
+	return new(CommonResponse)
+}

+ 28 - 0
model/http_model/RechargeRecordRequest.go

@@ -0,0 +1,28 @@
+package http_model
+
+type RechargeRecordRequest struct {
+	ConfirmAt string `json:"confirm_at"`
+	Method    int    `json:"method"`
+}
+
+type RechargeRecordData struct {
+	RechargeId      string `json:"recharge_id"`
+	RechargeAmount  string `json:"recharge_amount"`
+	PayMethod       string `json:"pay_method"`
+	TransferVoucher string `json:"transfer_voucher"`
+	ConfirmAt       string `json:"confirm_at"`
+}
+
+type RechargeRecordPreview struct {
+	RechargeRecordData []*RechargeRecordData `json:"recharge_record_data"`
+}
+
+func NewRechargeRecordRequest() *RechargeRecordRequest {
+	return new(RechargeRecordRequest)
+}
+
+func NewRechargeRecordResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(RechargeRecordPreview)
+	return resp
+}

+ 25 - 13
route/init.go

@@ -59,18 +59,30 @@ func InitRoute(r *gin.Engine) {
 		m.POST("/project/tasklogisticslist", handler.WrapTaskLogisticsListHandler) //物流信息查询
 		m.POST("/project/createlogistics", handler.WrapCreateLogisticsHandler)     //创建物流信息
 		m.POST("/project/signforreceipt", handler.WrapSignForReceiptHandler)
-		m.POST("/project/taskscriptlist", handler.WrapTaskScriptListHandler)   //查询脚本列表
-		m.POST("/project/scriptopinion", handler.WrapScriptOpinionHandler)     //脚本审核意见提交
-		m.POST("/project/acceptscript", handler.WrapAcceptScriptHandler)       //同意脚本
-		m.POST("/project/tasksketchlist", handler.WrapTaskSketchListHandler)   //查询初稿列表
-		m.POST("/project/findsketchphoto", handler.WrapFindSketchPhotoHandler) //查询脚本配图和视频demo
-		m.POST("/project/sketchopinion", handler.WrapSketchOpinionHandler)     //脚本审核意见提交
-		m.POST("/project/acceptsketch", handler.WrapAcceptSketchHandler)       //同意脚本
-		m.POST("/project/tasklinklist", handler.WrapTaskLinkListHandler)       //查询链接列表
-		m.POST("/project/linkopinion", handler.WrapLinkOpinionHandler)         //链接审核意见提交
-		m.POST("/project/acceptlink", handler.WrapAcceptLinkHandler)           //同意链接
-		m.POST("/project/taskdatalist", handler.WrapTaskDataListHandler)       //查询数据列表
-		m.POST("/project/dataopinion", handler.WrapDataOpinionHandler)         //数据审核意见提交
-		m.POST("/project/acceptdata", handler.WrapAcceptDataHandler)           //同意数据
+		m.POST("/project/taskscriptlist", handler.WrapTaskScriptListHandler)               //查询脚本列表
+		m.POST("/project/scriptopinion", handler.WrapScriptOpinionHandler)                 //脚本审核意见提交
+		m.POST("/project/acceptscript", handler.WrapAcceptScriptHandler)                   //同意脚本
+		m.POST("/project/tasksketchlist", handler.WrapTaskSketchListHandler)               //查询初稿列表
+		m.POST("/project/findsketchphoto", handler.WrapFindSketchPhotoHandler)             //查询脚本配图和视频demo
+		m.POST("/project/sketchopinion", handler.WrapSketchOpinionHandler)                 //脚本审核意见提交
+		m.POST("/project/acceptsketch", handler.WrapAcceptSketchHandler)                   //同意脚本
+		m.POST("/project/tasklinklist", handler.WrapTaskLinkListHandler)                   //查询链接列表
+		m.POST("/project/linkopinion", handler.WrapLinkOpinionHandler)                     //链接审核意见提交
+		m.POST("/project/acceptlink", handler.WrapAcceptLinkHandler)                       //同意链接
+		m.POST("/project/taskdatalist", handler.WrapTaskDataListHandler)                   //查询数据列表
+		m.POST("/project/dataopinion", handler.WrapDataOpinionHandler)                     //数据审核意见提交
+		m.POST("/project/acceptdata", handler.WrapAcceptDataHandler)                       //同意数据
+		m.POST("/pay/getCodeUrl", handler.WrapGetCodeUrlHandler)                           // 获取微信支付codeURL
+		m.POST("/pay/queryOrderByTradeId", handler.WrapQueryOrderByTradeIdHandler)         //根据交易id查询微信是否扫码付款
+		m.POST("/pay/rechargeBalance", handler.WrapRechargeBalanceHandler)                 // 支付成功后修改企业余额
+		m.POST("/project/feeDetail", handler.WrapFeeDetailHandler)                         // 查看结项的费用明细
+		m.POST("/pay/rechargeRecord", handler.WrapRechargeRecordHandler)                   // 查看充值记录
+		m.POST("/invoice/addReceiveAddress", handler.WrapAddReceiveAddressHandler)         // 新增收货地址
+		m.POST("/invoice/addReceiveInfo", handler.WrapAddReceiveInfoHandler)               // 新增发票信息
+		m.GET("/invoice/getReceiveAddress", handler.WrapGetReceiveAddressHandler)          // 获取收货地址
+		m.GET("/invoice/getReceiveInfo", handler.WrapGetReceiveInfoHandler)                // 获取发票信息
+		m.POST("/invoice/operateReceiveInfo", handler.WrapOperateReceiveInfoHandler)       // 修改或删除发票信息
+		m.POST("/invoice/operateReceiveAddress", handler.WrapOperateReceiveAddressHandler) // 修改或删除发票信息
+		m.POST("/invoice/addInvoiceRecord", handler.WrapAddInvoiceRecordHandler)           // 修改或删除发票信息
 	}
 }

+ 108 - 0
service/wechatPay.go

@@ -0,0 +1,108 @@
+package service
+
+import (
+	"context"
+	"github.com/wechatpay-apiv3/wechatpay-go/core"
+	"github.com/wechatpay-apiv3/wechatpay-go/core/option"
+	"github.com/wechatpay-apiv3/wechatpay-go/services/payments/native"
+	"github.com/wechatpay-apiv3/wechatpay-go/utils"
+	"log"
+	"time"
+)
+
+func NativeApiServicePrepay(tradeId string, amount int64) (codeUrl string, err error) {
+
+	var (
+		mchID                      string = "1615933939"                               // 商户号
+		mchCertificateSerialNumber string = "33DDFEC51BF5412F663B9B56510FD567B625FC68" // 商户证书序列号
+		mchAPIv3Key                string = "fvV2xDHuM8ch3QagCkLChEMsikUTSNiI"         // 商户APIv3密钥
+	)
+
+	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
+	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("./apiclient_key.pem")
+	if err != nil {
+		log.Print("load merchant private key error")
+	}
+
+	ctx := context.Background()
+	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
+	opts := []core.ClientOption{
+		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
+	}
+	client, err := core.NewClient(ctx, opts...)
+	if err != nil {
+		log.Printf("new wechat pay client err:%s", err)
+	}
+
+	svc := native.NativeApiService{Client: client}
+	resp, result, err := svc.Prepay(ctx,
+		native.PrepayRequest{
+			Appid:         core.String("wxac396a3be7a16844"),
+			Mchid:         core.String("1615933939"),
+			Description:   core.String("样叽微信支付充值"),
+			OutTradeNo:    core.String(tradeId),
+			TimeExpire:    core.Time(time.Now()),
+			Attach:        core.String("微信支付充值"),
+			NotifyUrl:     core.String("https://www.weixin.qq.com/wxpay/pay.php"),
+			SupportFapiao: core.Bool(true),
+			Amount: &native.Amount{
+				Currency: core.String("CNY"),
+				Total:    core.Int64(amount * 100),
+			},
+		},
+	)
+
+	if err != nil {
+		// 处理错误
+		log.Printf("call Prepay err:%s", err)
+		return "", err
+	} else {
+		// 处理返回结果
+		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
+		log.Println("codeUrl:", *resp.CodeUrl)
+	}
+	return *resp.CodeUrl, nil
+}
+
+func QueryOrderByOutTradeNo(tradeId string) (status string, err error) {
+
+	var (
+		mchID                      string = "1615933939"                               // 商户号
+		mchCertificateSerialNumber string = "33DDFEC51BF5412F663B9B56510FD567B625FC68" // 商户证书序列号
+		mchAPIv3Key                string = "fvV2xDHuM8ch3QagCkLChEMsikUTSNiI"         // 商户APIv3密钥
+	)
+
+	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
+	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("./apiclient_key.pem")
+	if err != nil {
+		log.Print("load merchant private key error")
+	}
+
+	ctx := context.Background()
+	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
+	opts := []core.ClientOption{
+		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
+	}
+	client, err := core.NewClient(ctx, opts...)
+	if err != nil {
+		log.Printf("new wechat pay client err:%s", err)
+	}
+
+	svc := native.NativeApiService{Client: client}
+	resp, result, err := svc.QueryOrderByOutTradeNo(ctx,
+		native.QueryOrderByOutTradeNoRequest{
+			OutTradeNo: core.String(tradeId),
+			Mchid:      core.String("1615933939"),
+		},
+	)
+
+	if err != nil {
+		// 处理错误
+		log.Printf("call QueryOrderByOutTradeNo err:%s", err)
+		return "", err
+	} else {
+		// 处理返回结果
+		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
+	}
+	return *resp.TradeState, nil
+}

+ 63 - 5
util/type.go

@@ -1,16 +1,21 @@
 package util
 
-import "reflect"
+import (
+	"fmt"
+	"math/rand"
+	"reflect"
+	"time"
+)
 
-// 判断是否为空字符串
+// IsNull 判断是否为空字符串
 func IsNull(s string) string {
-	if s == ""{
+	if s == "" {
 		return "0"
 	}
 	return s
 }
 
-// 判断 reflect.Value 是否为空
+// IsBlank 判断 reflect.Value 是否为空
 func IsBlank(value reflect.Value) bool {
 	switch value.Kind() {
 	case reflect.String:
@@ -27,4 +32,57 @@ func IsBlank(value reflect.Value) bool {
 		return value.IsNil()
 	}
 	return reflect.DeepEqual(value.Interface(), reflect.Zero(value.Type()).Interface())
-}
+}
+
+func GetNumString(num int64) string {
+	if num < 10000 {
+		return fmt.Sprintf("%v.00", num)
+	} else if num >= 10000 && num < 100000000 {
+		mean := float32(num) / float32(10000)
+		str := fmt.Sprintf("%.1f", mean)
+		return str + "万"
+	} else {
+		mean := float32(num) / float32(100000000)
+		str := fmt.Sprintf("%.1f", mean)
+		return str + "亿"
+	}
+}
+
+func GetRandomString(l int) string {
+	str := "0123456789"
+	bytes := []byte(str)
+	var result []byte
+	r := rand.New(rand.NewSource(time.Now().UnixNano()))
+	for i := 0; i < l; i++ {
+		result = append(result, bytes[r.Intn(len(bytes))])
+	}
+	return string(result)
+}
+
+func GetDayNum(inputType string, inputData int) (int, error) {
+	result := 0
+	switch inputType {
+	case "year":
+		if inputData < 1 {
+			fmt.Println("年份错误!")
+			break
+		}
+		result = inputData
+	case "month":
+		months := []int{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}
+		if (inputData <= 12) && (inputData < 0) {
+			fmt.Println("月份错误!")
+			break
+		}
+		result = months[inputData-1]
+	case "day":
+		if (inputData < 0) && (inputData > 31) {
+			fmt.Println("日期错误!")
+			break
+		}
+		result = inputData
+	default:
+		return 0, fmt.Errorf("输入参数非法:%s", inputType)
+	}
+	return result, nil
+}