Преглед на файлове

补充用户详情页面

yuliang1112 преди 2 години
родител
ревизия
34870b6ebc

+ 14 - 0
consts/project.go

@@ -188,3 +188,17 @@ func GetHandleResult(handleResult int) string {
 	}
 	return "未知"
 }
+
+var RechargeMethod = map[int64]string{
+	1: "对公转账",
+	2: "支付宝",
+	3: "微信",
+}
+
+func GetRechargeMethod(method int64) string {
+	toast, contain := RechargeMethod[method]
+	if contain {
+		return toast
+	}
+	return "未知"
+}

+ 120 - 3
db/finance.go

@@ -5,10 +5,12 @@ import (
 	"fmt"
 	"github.com/caixw/lib.go/conv"
 	"github.com/sirupsen/logrus"
+	"gorm.io/gorm"
 	"reflect"
 	"strconv"
 	"strings"
 	"time"
+	"youngee_m_api/consts"
 	"youngee_m_api/model/common_model"
 	"youngee_m_api/model/gorm_model"
 	"youngee_m_api/model/http_model"
@@ -90,7 +92,7 @@ func GetWithdrawRecords(ctx context.Context, pageSize, pageNum int32, req *http_
 
 func GetWithdrawRecord(ctx context.Context, req *http_model.GetWithdrawalRecordRequest) (*http_model.WithdrawalRecordPreview, error) {
 	db := GetReadDB(ctx)
-	fmt.Println("talentId:", req.TalentId)
+	//fmt.Println("talentId:", req.TalentId)
 	var withdrawRecords []*gorm_model.YounggeeWithdrawRecord
 	db = db.Debug().Model(gorm_model.YounggeeWithdrawRecord{}).Where("talent_id = ? AND  status = ?", req.TalentId, 2).Find(&withdrawRecords)
 	var withdrawRecordsPreview http_model.WithdrawalRecordPreview
@@ -149,7 +151,7 @@ func GetBankInfo(ctx context.Context, req *http_model.GetBankInfoRequest) (*http
 	data := new(http_model.BankInfo)
 	data.BankName = infoBank.Name
 	data.BankOpenAddress = province.RegionName + city.RegionName + infoRegion.RegionName
-	db.Model(gorm_model.InfoBank{}).Where("")
+	//db.Model(gorm_model.InfoBank{}).Where("")
 	return data, nil
 }
 
@@ -203,7 +205,7 @@ func GetInvoiceRecords(ctx context.Context, req *http_model.InvoiceRecordsReques
 	if req.InvoiceStatus == 1 {
 		db.Order("submit_at")
 	} else {
-		db.Order("submit_at desc")
+		db.Order("billing_at desc")
 	}
 	// 查询该页数据
 	limit := req.PageSize
@@ -256,3 +258,118 @@ func ConfirmInvoice(ctx context.Context, request *http_model.ConfirmInvoiceReque
 			Status:         2,
 		}).Error
 }
+
+func GetRechargeRecords(ctx context.Context, req *http_model.GetRechargeRecordsRequest, condition *common_model.RechargeRecordsCondition) (*http_model.RechargeRecordsData, error) {
+	db := GetReadDB(ctx)
+	var rechargeRecords []*gorm_model.YounggeeRechargeRecord
+	db = db.Debug().Model(gorm_model.YounggeeRechargeRecord{}).Where("status = ?", req.Status)
+	conditionType := reflect.TypeOf(condition).Elem()
+	conditionValue := reflect.ValueOf(condition).Elem()
+	for i := 0; i < conditionType.NumField(); i++ {
+		field := conditionType.Field(i)
+		tag := field.Tag.Get("condition")
+		value := conditionValue.FieldByName(field.Name)
+		if tag == "commit_at" && value.Interface() != "" {
+			db = db.Where(fmt.Sprintf("commit_at like '%s%%'", value.Interface()))
+		}
+		if tag == "confirm_at" && value.Interface() != "" {
+			db = db.Where(fmt.Sprintf("confirm_at like '%s%%'", value.Interface()))
+		}
+	}
+	if req.BusinessName != "" {
+		enterpriseId := GetEnterpriseIDByBusiness(ctx, req.BusinessName)
+		db = db.Where("enterprise_id = ?", enterpriseId)
+	}
+	if req.UserId != 0 {
+		enterpriseId := GetEnterpriseIDByUserId(ctx, req.UserId)
+		db = db.Where("enterprise_id = ?", enterpriseId)
+	}
+	if req.RechargeMethod == 1 {
+		db = db.Where("recharge_method = ?", 1)
+	} else if req.RechargeMethod == 2 {
+		db = db.Where("recharge_method = ?", 2)
+	} else if req.RechargeMethod == 3 {
+		db = db.Where("recharge_method = ?", 3)
+	}
+	// 查询总数
+	var total int64
+	if err := db.Count(&total).Error; err != nil {
+		logrus.WithContext(ctx).Errorf("[GetRechargeRecords] error query mysql total, err:%+v", err)
+		return nil, err
+	}
+	if req.Status == 1 {
+		db = db.Order("commit_at")
+	} else {
+		db = db.Order("confirm_at desc")
+	}
+	// 查询该页数据
+	limit := req.PageSize
+	offset := req.PageSize * req.PageNum // assert pageNum start with 0
+	err := db.Limit(int(limit)).Offset(int(offset)).Find(&rechargeRecords).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[GetInvoiceRecords] error query mysql limit, err:%+v", err)
+		return nil, err
+	}
+	var enterpriseIds []int64
+	for _, rechargeRecord := range rechargeRecords {
+		enterpriseIds = append(enterpriseIds, rechargeRecord.EnterpriseID)
+	}
+	util.RemoveRepByMap(enterpriseIds)
+	enterpriseIdToUserInfoMap := make(map[int64]gorm_model.Enterprise)
+	db1 := GetReadDB(ctx)
+	for _, v := range enterpriseIds {
+		enterpriseInfo := gorm_model.Enterprise{}
+		db1.Model(gorm_model.Enterprise{}).Where("enterprise_id = ?", v).Find(&enterpriseInfo)
+		enterpriseIdToUserInfoMap[v] = enterpriseInfo
+	}
+	var RechargeRecords []*http_model.RechargeRecordsPreview
+	for _, rechargeRecord := range rechargeRecords {
+		RechargeRecord := new(http_model.RechargeRecordsPreview)
+		RechargeRecord.RechargeId = rechargeRecord.RechargeID
+		RechargeRecord.EnterpriseID = rechargeRecord.EnterpriseID
+		RechargeRecord.RechargeAmount = rechargeRecord.RechargeAmount
+		RechargeRecord.ConfirmAt = conv.MustString(rechargeRecord.ConfirmAt, "")[:19]
+		RechargeRecord.CommitAt = conv.MustString(rechargeRecord.CommitAt, "")[:19]
+		RechargeRecord.Phone = rechargeRecord.Phone
+		RechargeRecord.TransferVoucher = rechargeRecord.TransferVoucherUrl
+		RechargeRecord.RechargeMethod = consts.GetRechargeMethod(rechargeRecord.RechargeMethod)
+		RechargeRecord.UserId = enterpriseIdToUserInfoMap[rechargeRecord.EnterpriseID].UserID
+		RechargeRecord.BusinessName = enterpriseIdToUserInfoMap[rechargeRecord.EnterpriseID].BusinessName
+		RechargeRecords = append(RechargeRecords, RechargeRecord)
+	}
+	var RechargeRecordsData http_model.RechargeRecordsData
+	RechargeRecordsData.RechargeRecordsPreview = RechargeRecords
+	RechargeRecordsData.Total = conv.MustString(total, "")
+	return &RechargeRecordsData, nil
+}
+
+func OperateRecharge(ctx context.Context, req *http_model.OperateRechargeRequest) error {
+	db := GetReadDB(ctx)
+	db1 := GetReadDB(ctx)
+	//rechargeInfo := gorm_model.YounggeeRechargeRecord{}
+	//db = db.Model(gorm_model.YounggeeRechargeRecord{}).Where("recharge_id = ?", req.RechargeId).Find(&rechargeInfo)
+	//enterpriseInfo := gorm_model.Enterprise{}
+	//db1.Model(gorm_model.Enterprise{}).Where("enterprise_id = ?", req.EnterpriseId).Find(&enterpriseInfo)
+	err := db1.Model(gorm_model.Enterprise{}).Where("enterprise_id = ?", req.EnterpriseId).Updates(map[string]interface{}{
+		"balance":           gorm.Expr("balance + ?", req.RechargeAmount),
+		"available_balance": gorm.Expr("available_balance + ?", req.RechargeAmount)}).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[OperateRecharge] error Updates balance, err:%+v", err)
+		return err
+	}
+	err1 := db.Model(gorm_model.YounggeeRechargeRecord{}).Where("recharge_id = ?", req.RechargeId).Updates(gorm_model.YounggeeRechargeRecord{
+		Status:    2,
+		ConfirmAt: time.Now(),
+	}).Error
+	if err1 != nil {
+		logrus.WithContext(ctx).Errorf("[OperateRecharge] error Updates Status, err:%+v", err)
+		return err1
+	}
+	if req.Method == 1 {
+		db2 := GetReadDB(ctx)
+		db2.Model(gorm_model.YounggeeRechargeRecord{}).Where("recharge_id = ?", req.RechargeId).Updates(gorm_model.YounggeeRechargeRecord{
+			RechargeAmount: req.RechargeAmount,
+		})
+	}
+	return nil
+}

+ 15 - 5
db/operate.go

@@ -637,13 +637,23 @@ func GetAutoInvalidTask() error {
 		db1 := GetReadDB(context.Background())
 		project := gorm_model.ProjectInfo{}
 		db1.Model(gorm_model.ProjectInfo{}).Where("project_id = ?", projectId).First(&project)
-		if project.AutoFailAt.IsZero() {
-			dd, _ := time.ParseDuration(conv.MustString(Invalid, "") + "h")
-			t := project.RecruitDdl.Add(dd)
-			db2 := GetReadDB(context.Background())
-			db2.Model(gorm_model.ProjectInfo{}).Where("project_id = ?", projectId).Updates(&gorm_model.ProjectInfo{AutoFailAt: &t})
+		//if project.AutoFailAt.IsZero() {
+		//	dd, _ := time.ParseDuration(conv.MustString(Invalid, "") + "h")
+		//	t := project.RecruitDdl.Add(dd)
+		//	db2 := GetReadDB(context.Background())
+		//	db2.Model(gorm_model.ProjectInfo{}).Where("project_id = ?", projectId).Updates(&gorm_model.ProjectInfo{AutoFailAt: &t})
+		//	fmt.Println("已添加失效自动处理时间")
+		//}
+
+		dd, _ := time.ParseDuration(conv.MustString(Invalid, "") + "h")
+		project.RecruitDdl.Add(dd)
+		t := project.RecruitDdl.Add(dd)
+		if project.AutoFailAt != &t {
+			db3 := GetReadDB(context.Background())
+			db3.Model(gorm_model.ProjectInfo{}).Where("project_id = ?", projectId).Updates(&gorm_model.ProjectInfo{AutoFailAt: &t})
 			fmt.Println("已添加失效自动处理时间")
 		}
+
 		projectNeedMod := gorm_model.ProjectInfo{}
 		db2 := GetReadDB(context.Background())
 		db2.Where("project_id = ?", projectId).First(&projectNeedMod)

+ 37 - 0
db/project.go

@@ -7,7 +7,9 @@ import (
 	"github.com/sirupsen/logrus"
 	"gorm.io/gorm"
 	"reflect"
+	"strconv"
 	"time"
+	"youngee_m_api/consts"
 	"youngee_m_api/model/common_model"
 	"youngee_m_api/model/gorm_model"
 	"youngee_m_api/model/http_model"
@@ -343,3 +345,38 @@ func ChangeProjectStatus(ctx context.Context, projectID int64, projectStatus str
 	}
 	return nil
 }
+
+func GetProjectRecords(ctx context.Context, userId int64, pageSize, pageNum int32) (*http_model.ProjectRecordsData, error) {
+	db := GetReadDB(ctx)
+	enterpriseID := GetEnterpriseIDByUserId(ctx, userId)
+	var projectInfos []*gorm_model.ProjectInfo
+	db = db.Model(&gorm_model.ProjectInfo{}).Where("enterprise_id = ?", enterpriseID)
+	// 查询总数
+	var total int64
+	if err := db.Count(&total).Error; err != nil {
+		logrus.WithContext(ctx).Errorf("[GetProjectRecords] error query mysql total, err:%+v", err)
+		return nil, err
+	}
+	// 查询该页数据
+	limit := pageSize
+	offset := pageSize * pageNum // assert pageNum start with 0
+	err := db.Order("updated_at desc").Limit(int(limit)).Offset(int(offset)).Find(&projectInfos).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[GetProjectRecords] error query mysql limit, err:%+v", err)
+		return nil, err
+	}
+	var projectRecords []*http_model.ProjectRecordsPreview
+	for _, projectInfo := range projectInfos {
+		projectRecordsPreview := new(http_model.ProjectRecordsPreview)
+		projectRecordsPreview.ProjectID = projectInfo.ProjectID
+		projectRecordsPreview.ProjectName = projectInfo.ProjectName
+		projectRecordsPreview.ProjectType = consts.GetProjectType(projectInfo.ProjectType)
+		projectRecordsPreview.UpdatedAt = conv.MustString(projectInfo.UpdatedAt, "")[:19]
+		projectRecordsPreview.ProjectStatus = consts.GetProjectStatus(projectInfo.ProjectStatus)
+		projectRecords = append(projectRecords, projectRecordsPreview)
+	}
+	projectRecordsData := http_model.ProjectRecordsData{}
+	projectRecordsData.ProjectRecordsPreview = projectRecords
+	projectRecordsData.Total = strconv.FormatInt(total, 10)
+	return &projectRecordsData, nil
+}

+ 65 - 0
handler/getProduceRecords.go

@@ -0,0 +1,65 @@
+package handler
+
+import (
+	"errors"
+	"fmt"
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	"youngee_m_api/consts"
+	"youngee_m_api/db"
+	"youngee_m_api/model/http_model"
+	"youngee_m_api/util"
+)
+
+func WrapGetProjectRecordsHandler(ctx *gin.Context) {
+	handler := newGetProductRecordsHandler(ctx)
+	BaseRun(handler)
+}
+
+type GetProductRecordsHandler struct {
+	ctx  *gin.Context
+	req  *http_model.GetProjectRecordsRequest
+	resp *http_model.CommonResponse
+}
+
+func (g GetProductRecordsHandler) getContext() *gin.Context {
+	return g.ctx
+}
+
+func (g GetProductRecordsHandler) getResponse() interface{} {
+	return g.resp
+}
+
+func (g GetProductRecordsHandler) getRequest() interface{} {
+	return g.req
+}
+
+func (g GetProductRecordsHandler) run() {
+	data, err := db.GetProjectRecords(g.ctx, g.req.UserID, g.req.PageSize, g.req.PageNum)
+	if err != nil {
+		logrus.WithContext(g.ctx).Errorf("[GetProductRecordsHandler] error GetProjectRecords, err:%+v", err)
+		util.HandlerPackErrorResp(g.resp, consts.ErrorInternal, consts.DefaultToast)
+		return
+	}
+	g.resp.Data = data
+}
+
+func (g GetProductRecordsHandler) checkParam() error {
+	var errs []error
+	if g.req.PageNum < 0 || g.req.PageSize <= 0 {
+		errs = append(errs, errors.New("page param error"))
+	}
+	g.req.PageNum--
+	if len(errs) != 0 {
+		return fmt.Errorf("check param errs:%+v", errs)
+	}
+	return nil
+}
+
+func newGetProductRecordsHandler(ctx *gin.Context) *GetProductRecordsHandler {
+	return &GetProductRecordsHandler{
+		ctx:  ctx,
+		req:  http_model.NewGetProjectRecordsRequest(),
+		resp: http_model.NewGetProjectRecordsResponse(),
+	}
+}

+ 1 - 2
handler/getWithdrawalRecord.go

@@ -1,7 +1,6 @@
 package handler
 
 import (
-	"fmt"
 	"github.com/gin-gonic/gin"
 	"github.com/sirupsen/logrus"
 	"youngee_m_api/consts"
@@ -34,7 +33,7 @@ func (g GetWithdrawalRecordHandler) getRequest() interface{} {
 }
 
 func (g GetWithdrawalRecordHandler) run() {
-	fmt.Println("talentId1:", g.req.TalentId)
+	//fmt.Println("talentId1:", g.req.TalentId)
 	data, err := db.GetWithdrawRecord(g.ctx, g.req)
 	if err != nil {
 		logrus.WithContext(g.ctx).Errorf("[GetWithdrawalRecordHandler] error GetWithdrawRecord, err:%+v", err)

+ 61 - 0
handler/operateRecharge.go

@@ -0,0 +1,61 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	"youngee_m_api/consts"
+	"youngee_m_api/db"
+	"youngee_m_api/model/http_model"
+	"youngee_m_api/util"
+)
+
+func WrapOperateRechargeHandler(ctx *gin.Context) {
+	handler := newOperateRechargeHandler(ctx)
+	BaseRun(handler)
+}
+
+type OperateRechargeHandler struct {
+	ctx  *gin.Context
+	req  *http_model.OperateRechargeRequest
+	resp *http_model.CommonResponse
+}
+
+func (o OperateRechargeHandler) getContext() *gin.Context {
+	return o.ctx
+}
+
+func (o OperateRechargeHandler) getResponse() interface{} {
+	return o.resp
+}
+
+func (o OperateRechargeHandler) getRequest() interface{} {
+	return o.req
+}
+
+func (o OperateRechargeHandler) run() {
+	err := db.OperateRecharge(o.ctx, o.req)
+	if err != nil {
+		// 数据库查询失败,返回5001
+		logrus.Errorf("[OperateRechargeHandler] call OperateRecharge err:%+v\n", err)
+		util.HandlerPackErrorResp(o.resp, consts.ErrorInternal, "")
+		logrus.Info("OperateRecharge fail,req:%+v", o.req)
+		return
+	}
+	if o.req.Method == 1 {
+		o.resp.Message = "修改充值金额成功"
+	} else {
+		o.resp.Message = "确认充值"
+	}
+}
+
+func (o OperateRechargeHandler) checkParam() error {
+	return nil
+}
+
+func newOperateRechargeHandler(ctx *gin.Context) *OperateRechargeHandler {
+	return &OperateRechargeHandler{
+		ctx:  ctx,
+		req:  http_model.NewOperateRechargeRequest(),
+		resp: http_model.NewOperateRechargeResponse(),
+	}
+}

+ 69 - 0
handler/rechargeRecords.go

@@ -0,0 +1,69 @@
+package handler
+
+import (
+	"errors"
+	"fmt"
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	"youngee_m_api/consts"
+	"youngee_m_api/db"
+	"youngee_m_api/model/http_model"
+	"youngee_m_api/pack"
+	"youngee_m_api/util"
+)
+
+func WrapRechargeRecordsHandler(ctx *gin.Context) {
+	handler := newRechargeRecordsHandler(ctx)
+	BaseRun(handler)
+}
+
+type RechargeRecordsHandler struct {
+	ctx  *gin.Context
+	req  *http_model.GetRechargeRecordsRequest
+	resp *http_model.CommonResponse
+}
+
+func (r RechargeRecordsHandler) getContext() *gin.Context {
+	return r.ctx
+}
+
+func (r RechargeRecordsHandler) getResponse() interface{} {
+	return r.resp
+}
+
+func (r RechargeRecordsHandler) getRequest() interface{} {
+	return r.req
+}
+
+func (r RechargeRecordsHandler) run() {
+	condition := pack.HttpRechargeRecordsRequestToCondition(r.req)
+	data, err := db.GetRechargeRecords(r.ctx, r.req, condition)
+	if err != nil {
+		// 数据库查询失败,返回5001
+		logrus.Errorf("[RechargeRecordsHandler] call GetRechargeRecords err:%+v\n", err)
+		util.HandlerPackErrorResp(r.resp, consts.ErrorInternal, "")
+		logrus.Info("GetRechargeRecords fail,req:%+v", r.req)
+		return
+	}
+	r.resp.Data = data
+}
+
+func (r RechargeRecordsHandler) checkParam() error {
+	var errs []error
+	if r.req.PageNum < 0 || r.req.PageSize <= 0 {
+		errs = append(errs, errors.New("page param error"))
+	}
+	r.req.PageNum--
+	if len(errs) != 0 {
+		return fmt.Errorf("check param errs:%+v", errs)
+	}
+	return nil
+}
+
+func newRechargeRecordsHandler(ctx *gin.Context) *RechargeRecordsHandler {
+	return &RechargeRecordsHandler{
+		ctx:  ctx,
+		req:  http_model.NewGetRechargeRecordsRequest(),
+		resp: http_model.NewGetRechargeRecordsResponse(),
+	}
+}

+ 1 - 1
model/common_model/InvoiceRecordsCondition.go

@@ -2,5 +2,5 @@ package common_model
 
 type InvoiceRecordsCondition struct {
 	SubmitAt  string `condition:"submit_at"`  // 申请提交时间
-	BillingAt string `condition:"billing_at"` // 申请提交时间
+	BillingAt string `condition:"billing_at"` // 开票时间
 }

+ 6 - 0
model/common_model/RechargeRecordsCondition.go

@@ -0,0 +1,6 @@
+package common_model
+
+type RechargeRecordsCondition struct {
+	CommitAt  string `condition:"commit_at"`  // 充值申请提交时间
+	ConfirmAt string `condition:"confirm_at"` // 充值确认时间
+}

+ 9 - 10
model/gorm_model/enterprise.go

@@ -6,18 +6,17 @@ import (
 )
 
 type Enterprise struct {
-	EnterpriseID     int64       `gorm:"column:enterprise_id"` // 企业id
-	Industry         int64       `gorm:"column:industry"`                                 // 行业,1-14分别代表能源、化工、材料、机械设备/军工、企业服务/造纸印刷、运输设备、旅游酒店、媒体/信息通信服务、批发/零售、消费品、卫生保健/医疗、金融、建材/建筑/房地产、公共事业
-	BusinessName     string    `gorm:"column:business_name"`                            // 公司或组织名称
-	UserID           int64       `gorm:"column:user_id"`                                  // 对应用户id
-	Balance          int64       `gorm:"column:balance"`                                  // 账户余额
-	FrozenBalance    int64       `gorm:"column:frozen_balance"`                           // 冻结余额
-	AvailableBalance int64       `gorm:"column:available_balance"`                        // 可用余额
-	CreatedAt        time.Time `gorm:"column:created_at"`                               // 创建时间
-	UpdatedAt        time.Time `gorm:"column:updated_at"`                               // 更新时间
+	EnterpriseID     int64     `gorm:"column:enterprise_id"`     // 企业id
+	Industry         int64     `gorm:"column:industry"`          // 行业,1-14分别代表能源、化工、材料、机械设备/军工、企业服务/造纸印刷、运输设备、旅游酒店、媒体/信息通信服务、批发/零售、消费品、卫生保健/医疗、金融、建材/建筑/房地产、公共事业
+	BusinessName     string    `gorm:"column:business_name"`     // 公司或组织名称
+	UserID           int64     `gorm:"column:user_id"`           // 对应用户id
+	Balance          float64   `gorm:"column:balance"`           // 账户余额
+	FrozenBalance    float64   `gorm:"column:frozen_balance"`    // 冻结余额
+	AvailableBalance float64   `gorm:"column:available_balance"` // 可用余额
+	CreatedAt        time.Time `gorm:"column:created_at"`        // 创建时间
+	UpdatedAt        time.Time `gorm:"column:updated_at"`        // 更新时间
 }
 
 func (m *Enterprise) TableName() string {
 	return "enterprise"
 }
-

+ 24 - 0
model/gorm_model/rechargeRecord.go

@@ -0,0 +1,24 @@
+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"` // 转账凭证图片链接
+	Phone              string    `gorm:"column:phone;NOT NULL"`                // 联系方式
+	RechargeMethod     int64     `gorm:"column:recharge_method;NOT NULL"`      // 充值方式:1为对公转账,2为支付宝在线支付,3为微信支付
+	Status             int64     `gorm:"column:status;NOT NULL"`               // 充值状态:0为充值待确认,1为充值已确认
+	InvoiceStatus      int64     `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"
+}

+ 31 - 0
model/http_model/GetProjectRecordsRequest.go

@@ -0,0 +1,31 @@
+package http_model
+
+type GetProjectRecordsRequest struct {
+	PageSize int32 `json:"page_size"`
+	PageNum  int32 `json:"page_num"`
+	UserID   int64 `json:"user_id"`
+}
+
+type ProjectRecordsPreview struct {
+	ProjectID     int64  `json:"project_id"`
+	EnterpriseID  int64  `json:"enterprise_id"`
+	ProjectName   string `json:"project_name"`
+	ProjectType   string `json:"project_type"`
+	ProjectStatus string `json:"project_status"`
+	UpdatedAt     string `json:"updated_at"`
+}
+
+type ProjectRecordsData struct {
+	ProjectRecordsPreview []*ProjectRecordsPreview `json:"project_records_preview"`
+	Total                 string                   `json:"total"`
+}
+
+func NewGetProjectRecordsRequest() *GetProjectRecordsRequest {
+	return new(GetProjectRecordsRequest)
+}
+
+func NewGetProjectRecordsResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(ProjectRecordsData)
+	return resp
+}

+ 40 - 0
model/http_model/GetRechargeRecordsRequest.go

@@ -0,0 +1,40 @@
+package http_model
+
+type GetRechargeRecordsRequest struct {
+	PageSize       int32  `json:"page_size"`
+	PageNum        int32  `json:"page_num"`
+	Status         int32  `json:"status"`
+	BusinessName   string `json:"business_name"`
+	UserId         int64  `json:"user_id"`
+	RechargeMethod int32  `json:"recharge_method"`
+	CommitAt       string `json:"commit_at"`
+	ConfirmAt      string `json:"confirm_at"`
+}
+
+type RechargeRecordsPreview struct {
+	RechargeId      string  `json:"recharge_id"`
+	EnterpriseID    int64   `json:"enterprise_id"`
+	UserId          int64   `json:"user_id"`
+	BusinessName    string  `json:"business_name"`
+	RechargeAmount  float64 `json:"recharge_amount"`
+	RechargeMethod  string  `json:"recharge_method"`
+	TransferVoucher string  `json:"transfer_voucher"` // 转账凭证
+	Phone           string  `json:"phone"`
+	CommitAt        string  `json:"commit_at"`
+	ConfirmAt       string  `json:"confirm_at"`
+}
+
+type RechargeRecordsData struct {
+	RechargeRecordsPreview []*RechargeRecordsPreview `json:"recharge_records_preview"`
+	Total                  string                    `json:"total"`
+}
+
+func NewGetRechargeRecordsRequest() *GetRechargeRecordsRequest {
+	return new(GetRechargeRecordsRequest)
+}
+
+func NewGetRechargeRecordsResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(RechargeRecordsData)
+	return resp
+}

+ 16 - 0
model/http_model/OperateRechargeRequest.go

@@ -0,0 +1,16 @@
+package http_model
+
+type OperateRechargeRequest struct {
+	Method         int32   `json:"method"`
+	RechargeId     string  `json:"recharge_id"`
+	EnterpriseId   int64   `json:"enterprise_id"`
+	RechargeAmount float64 `json:"recharge_amount"`
+}
+
+func NewOperateRechargeRequest() *OperateRechargeRequest {
+	return new(OperateRechargeRequest)
+}
+
+func NewOperateRechargeResponse() *CommonResponse {
+	return new(CommonResponse)
+}

+ 8 - 8
model/http_model/enterprise_user.go

@@ -11,14 +11,14 @@ type EnterpriseUserRequest struct {
 }
 
 type EnterpriseUserPreview struct {
-	User             string `json:"user"`              // 企业用户ID
-	UserID           string `json:"userID"`            // 用户ID
-	Username         string `json:"username"`          // 企业名称
-	Balance          int64  `json:"balance"`           // 账户余额
-	FrozenBalance    int64  `json:"frozen_balance"`    // 冻结余额
-	AvailableBalance int64  `json:"available_balance"` // 可用余额
-	Phone            string `json:"phone"`             // 联系方式
-	CreatedAt        string `json:"created_at"`        // 创建时间
+	User             string  `json:"user"`              // 企业用户ID
+	UserID           string  `json:"userID"`            // 用户ID
+	Username         string  `json:"username"`          // 企业名称
+	Balance          float64 `json:"balance"`           // 账户余额
+	FrozenBalance    float64 `json:"frozen_balance"`    // 冻结余额
+	AvailableBalance float64 `json:"available_balance"` // 可用余额
+	Phone            string  `json:"phone"`             // 联系方式
+	CreatedAt        string  `json:"created_at"`        // 创建时间
 }
 
 type EnterpriseUserData struct {

+ 7 - 0
pack/finance.go

@@ -20,3 +20,10 @@ func HttpInvoiceRecordsRequestToCondition(request *http_model.InvoiceRecordsRequ
 		BillingAt: request.BillingAt,
 	}
 }
+
+func HttpRechargeRecordsRequestToCondition(request *http_model.GetRechargeRecordsRequest) *common_model.RechargeRecordsCondition {
+	return &common_model.RechargeRecordsCondition{
+		CommitAt:  request.CommitAt,
+		ConfirmAt: request.ConfirmAt,
+	}
+}

+ 29 - 26
route/init.go

@@ -23,7 +23,7 @@ func InitRoute(r *gin.Engine) {
 	})
 	m := r.Group("/youngee/m")
 	{
-		m.Use(middleware.LoginAuthMiddleware)
+		//m.Use(middleware.LoginAuthMiddleware)
 		m.POST("/test", func(c *gin.Context) {
 			resp := http_model.CommonResponse{
 				Status:  0,
@@ -51,22 +51,22 @@ func InitRoute(r *gin.Engine) {
 		m.POST("/project/getdatanumberinfo", handler.WrapGetDataNumberInfoHandler)
 		m.POST("/project/getreviewnumberinfo", handler.WrapGetReviewNumberInfoHandler)
 		m.POST("/project/getdefaultnumberinfo", handler.WrapGetDefaultNumberInfoHandler)
-		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/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/taskdefaultreviewlist", handler.WrapTaskDefaultReviewListHandler) // 查询违约列表-脚本、初稿、链接上传违约
 		m.POST("/project/taskdefaultdatalist", handler.WrapTaskDefaultDataListHandler)     // 查询违约列表-数据违约
 		m.POST("/project/taskteminatinglist", handler.WrapTaskTerminatingListHandler)      // 查询违约列表-解约待处理
@@ -74,7 +74,8 @@ func InitRoute(r *gin.Engine) {
 		m.POST("/project/taskteminate", handler.WrapTaskTerminateHandler)                  // 解约
 		m.POST("/project/getsketchinfo", handler.WrapGetSketchInfoHandler)                 // 获取初稿
 		m.POST("/project/taskfinishlist", handler.WrapTaskFinishListHandler)               // 查询违约列表-数据违约
-		m.POST("/project/getfinishnumberinfo", handler.WrapGetFinishNumberInfoHandler)
+		m.POST("/project/getfinishnumberinfo", handler.WrapGetFinishNumberInfoHandler)     // 获取结案数量
+		m.POST("/project/getProduceRecords", handler.WrapGetProjectRecordsHandler)         // 获取项目记录
 	}
 	u := r.Group("/youngee/m/user")
 	{
@@ -134,13 +135,15 @@ func InitRoute(r *gin.Engine) {
 	f := r.Group("/youngee/m/finance")
 	{
 		//f.Use(middleware.LoginAuthMiddleware)
-		f.POST("/withdrawalRecords", handler.WrapWithdrawalRecordsHandler)
-		f.POST("/getWithdrawalRecord", handler.WrapGetWithdrawalRecordHandler)
-		f.GET("/getWithdrawNums", handler.WrapGetWithdrawNumsHandler)
-		f.POST("/ConfirmWithdrawal", handler.WrapConfirmWithdrawalHandler)
-		f.POST("/getBankInfo", handler.WrapGetBankInfoHandler)
-		f.POST("/getCodeUrl", handler.WrapGetCodeUrlHandler)
-		f.POST("/invoiceRecords", handler.WrapInvoiceRecordsHandler)
-		f.POST("/confirmInvoice", handler.WrapConfirmInvoiceHandler)
+		f.POST("/withdrawalRecords", handler.WrapWithdrawalRecordsHandler)     // 搜索提现记录
+		f.POST("/getWithdrawalRecord", handler.WrapGetWithdrawalRecordHandler) // 查看提现记录
+		f.GET("/getWithdrawNums", handler.WrapGetWithdrawNumsHandler)          // 获取待提现的数量
+		f.POST("/ConfirmWithdrawal", handler.WrapConfirmWithdrawalHandler)     // 确认提现
+		f.POST("/getBankInfo", handler.WrapGetBankInfoHandler)                 // 获取银行开户地信息
+		f.POST("/getCodeUrl", handler.WrapGetCodeUrlHandler)                   // 获取微信支付链接
+		f.POST("/invoiceRecords", handler.WrapInvoiceRecordsHandler)           // 搜索开票记录
+		f.POST("/confirmInvoice", handler.WrapConfirmInvoiceHandler)           // 确认开票
+		f.POST("/rechargeRecords", handler.WrapRechargeRecordsHandler)         // 搜索充值记录
+		f.POST("/operateRecharge", handler.WrapOperateRechargeHandler)         // 充值记录的修改和确认操作
 	}
 }