Forráskód Böngészése

修改创建项目等

yuliang1112 2 éve
szülő
commit
c479bd2080

+ 23 - 5
db/finance.go

@@ -41,7 +41,7 @@ func GetWithdrawRecords(ctx context.Context, pageSize, pageNum int32, req *http_
 		fmt.Println("TalentName:", req.TalentName)
 		db1 := GetReadDB(ctx)
 		var talentId string
-		db1.Model(gorm_model.YoungeeTalentInfo{}).Select("id").Where("talent_wx_nickname = ? ", req.TalentName).Find(&talentId)
+		db1.Model(gorm_model.YoungeeTalentInfo{}).Select("id").Where(fmt.Sprintf("talent_wx_nickname like '%%%s%%'", req.TalentName)).Find(&talentId)
 		db = db.Where("talent_id = ?", talentId)
 	}
 	// 查询总数
@@ -195,6 +195,14 @@ func GetEnterpriseIDByUserId(ctx context.Context, UserId int64) int64 {
 	return EnterpriseID
 }
 
+// GetUserIDByUsername 根据用户名称查UserID
+func GetUserIDByUsername(ctx context.Context, Username string) int64 {
+	db := GetReadDB(ctx)
+	var UserID int64
+	db = db.Model([]gorm_model.YounggeeUser{}).Select("id").Where(fmt.Sprintf("username like '%%%s%%'", Username)).First(&UserID)
+	return UserID
+}
+
 func GetInvoiceRecords(ctx context.Context, req *http_model.InvoiceRecordsRequest, condition *common_model.InvoiceRecordsCondition) (*http_model.InvoiceRecordsData, error) {
 	db := GetReadDB(ctx)
 	var invoiceRecords []*gorm_model.YounggeeInvoiceRecord
@@ -212,8 +220,9 @@ func GetInvoiceRecords(ctx context.Context, req *http_model.InvoiceRecordsReques
 			db = db.Where(fmt.Sprintf("billing_at like '%s%%'", value.Interface()))
 		}
 	}
-	if req.BusinessName != "" {
-		enterpriseId := GetEnterpriseIDByBusiness(ctx, req.BusinessName)
+	if req.Username != "" {
+		UserID := GetUserIDByUsername(ctx, req.Username)
+		enterpriseId := GetEnterpriseIDByUserId(ctx, UserID)
 		db = db.Where("enterprise_id = ?", enterpriseId)
 	}
 	if req.UserId != 0 {
@@ -263,6 +272,7 @@ func GetInvoiceRecords(ctx context.Context, req *http_model.InvoiceRecordsReques
 		InvoiceRecord.ShipmentNumber = invoiceRecord.ShipmentNumber
 		InvoiceRecord.BusinessName = enterpriseIdToUserInfoMap[invoiceRecord.EnterpriseID].BusinessName
 		InvoiceRecord.UserId = enterpriseIdToUserInfoMap[invoiceRecord.EnterpriseID].UserID
+		InvoiceRecord.Username = GetUsernameByUserID(ctx, enterpriseIdToUserInfoMap[invoiceRecord.EnterpriseID].UserID)
 		InvoiceRecord.SubmitAt = conv.MustString(invoiceRecord.SubmitAt, "")[:19]
 		InvoiceRecord.BillingAt = conv.MustString(invoiceRecord.BillingAt, "")[:19]
 		InvoiceRecords = append(InvoiceRecords, InvoiceRecord)
@@ -283,6 +293,12 @@ func ConfirmInvoice(ctx context.Context, request *http_model.ConfirmInvoiceReque
 		}).Error
 }
 
+func GetUsernameByUserID(ctx context.Context, UserID int64) (username string) {
+	db := GetReadDB(ctx)
+	db = db.Model([]gorm_model.YounggeeUser{}).Select("username").Where("id", UserID).First(&username)
+	return username
+}
+
 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
@@ -300,8 +316,9 @@ func GetRechargeRecords(ctx context.Context, req *http_model.GetRechargeRecordsR
 			db = db.Where(fmt.Sprintf("confirm_at like '%s%%'", value.Interface()))
 		}
 	}
-	if req.BusinessName != "" {
-		enterpriseId := GetEnterpriseIDByBusiness(ctx, req.BusinessName)
+	if req.Username != "" {
+		UserID := GetUserIDByUsername(ctx, req.Username)
+		enterpriseId := GetEnterpriseIDByUserId(ctx, UserID)
 		db = db.Where("enterprise_id = ?", enterpriseId)
 	}
 	if req.UserId != 0 {
@@ -358,6 +375,7 @@ func GetRechargeRecords(ctx context.Context, req *http_model.GetRechargeRecordsR
 		RechargeRecord.TransferVoucher = rechargeRecord.TransferVoucherUrl
 		RechargeRecord.RechargeMethod = consts.GetRechargeMethod(rechargeRecord.RechargeMethod)
 		RechargeRecord.UserId = enterpriseIdToUserInfoMap[rechargeRecord.EnterpriseID].UserID
+		RechargeRecord.Username = GetUsernameByUserID(ctx, enterpriseIdToUserInfoMap[rechargeRecord.EnterpriseID].UserID)
 		RechargeRecord.BusinessName = enterpriseIdToUserInfoMap[rechargeRecord.EnterpriseID].BusinessName
 		RechargeRecords = append(RechargeRecords, RechargeRecord)
 	}

+ 77 - 3
db/operate.go

@@ -20,11 +20,23 @@ import (
 func CreatePricingStrategy(ctx context.Context, req *http_model.AddPricingRequest) (string, string, error) {
 	db := GetReadDB(ctx)
 	project_type, fee_form, platform, fans_low, fans_up, service_charge, base_offer := req.ProjectType, req.ManuscriptForm, req.Platform, req.FansLow, req.FansHigh, req.PlatformFee, req.BaseOffer
-	var IsExclusive gorm_model.InfoPricingStrategy
+	var IsExclusive, IsExclusive2, IsExclusive3, IsExclusive1 gorm_model.InfoPricingStrategy
 	err := db.Where(" fee_form = ? && platform = ? && fans_low <= ? && fans_up >= ?", fee_form, platform, fans_low, fans_up).First(&IsExclusive).Error
 	if err == nil {
 		return "该策略与已经运行的策略互斥,请修改相关字段后重新创建", "", nil
 	}
+	err = db.Where(" fee_form = ? && platform = ? && fans_low <= ? && fans_up >= ?", fee_form, platform, fans_low, fans_low).First(&IsExclusive1).Error
+	if err == nil {
+		return "该策略与已经运行的策略互斥,请修改相关字段后重新创建", "", nil
+	}
+	err = db.Where(" fee_form = ? && platform = ? && fans_low <= ? && fans_up >= ?", fee_form, platform, fans_up, fans_up).First(&IsExclusive2).Error
+	if err == nil {
+		return "该策略与已经运行的策略互斥,请修改相关字段后重新创建", "", nil
+	}
+	err = db.Where(" fee_form = ? && platform = ? && fans_low >= ? && fans_up <= ?", fee_form, platform, fans_low, fans_up).First(&IsExclusive3).Error
+	if err == nil {
+		return "该策略与已经运行的策略互斥,请修改相关字段后重新创建", "", nil
+	}
 	var newStrategy gorm_model.InfoPricingStrategy
 	var strategyInfo gorm_model.InfoPricingStrategy
 	getMonth := time.Now().Format("01") //获取月
@@ -110,10 +122,22 @@ func ModifyPricing(ctx context.Context, req *http_model.ModifyPricingRequest) (s
 	strategyId := req.StrategyId
 	db = db.Model(gorm_model.InfoPricingStrategy{}).Where("strategyId = ?", strategyId)
 	project_type, fee_form, platform, fans_low, fans_up, service_charge, base_offer := req.ProjectType, req.FeeForm, req.Platform, req.FansLow, req.FansHigh, req.PlatformFee, req.BaseOffer
-	var IsExclusive gorm_model.InfoPricingStrategy
+	var IsExclusive, IsExclusive2, IsExclusive3, IsExclusive1 gorm_model.InfoPricingStrategy
 	err := db.Where(" fee_form = ? && platform = ? && fans_low <= ? && fans_up >= ?", fee_form, platform, fans_low, fans_up).First(&IsExclusive).Error
 	if err == nil {
-		return "要修改策略与已经运行的策略互斥,请修改相关字段", nil
+		return "该策略与已经运行的策略互斥,请修改相关字段后重新创建", nil
+	}
+	err = db.Where(" fee_form = ? && platform = ? && fans_low <= ? && fans_up >= ?", fee_form, platform, fans_low, fans_low).First(&IsExclusive1).Error
+	if err == nil {
+		return "该策略与已经运行的策略互斥,请修改相关字段后重新创建", nil
+	}
+	err = db.Where(" fee_form = ? && platform = ? && fans_low <= ? && fans_up >= ?", fee_form, platform, fans_up, fans_up).First(&IsExclusive2).Error
+	if err == nil {
+		return "该策略与已经运行的策略互斥,请修改相关字段后重新创建", nil
+	}
+	err = db.Where(" fee_form = ? && platform = ? && fans_low >= ? && fans_up <= ?", fee_form, platform, fans_low, fans_up).First(&IsExclusive3).Error
+	if err == nil {
+		return "该策略与已经运行的策略互斥,请修改相关字段后重新创建", nil
 	}
 	err = db.Updates(map[string]interface{}{
 		"project_type": project_type, "base_offer": base_offer, "fee_form": fee_form,
@@ -1856,3 +1880,53 @@ func GetAutoCaseCloseDefaultTask() error {
 	}
 	return nil
 }
+
+func GetHours(ctx context.Context) (*http_model.Hours, error) {
+	db := GetReadDB(ctx)
+	infoAuto := gorm_model.InfoAutoTask{}
+	err := db.Model(gorm_model.InfoAutoTask{}).Last(&infoAuto).Error
+	if err != nil {
+		return nil, err
+	}
+	Hours := http_model.Hours{}
+	Hours.DraftDefaultInPic = infoAuto.DraftDefaultInPic
+	Hours.DraftDefaultInMv = infoAuto.DraftDefaultInMv
+	Hours.ScriptDefault = infoAuto.ScriptDefault
+	Hours.Invalid = infoAuto.Invalid
+	Hours.LinkBreach = infoAuto.LinkBreach
+	Hours.CaseClose = infoAuto.CaseClose
+	Hours.CaseCloseDefault = infoAuto.CaseCloseDefault
+	Hours.ReviewInMv = infoAuto.ReviewInMv
+	Hours.ReviewUnlimited = infoAuto.ReviewUnlimited
+	Hours.PostReview = infoAuto.Postreview
+	Hours.SignInVirtual = infoAuto.SignInVirtual
+	Hours.SignInOffline = infoAuto.SignInOffline
+	return &Hours, err
+}
+
+func GetPercents(ctx context.Context) (*http_model.Percents, error) {
+	db := GetReadDB(ctx)
+	percentsInfo := gorm_model.InfoAutoDefaultHandle{}
+	err := db.Model(gorm_model.InfoAutoDefaultHandle{}).Last(&percentsInfo).Error
+	if err != nil {
+		return nil, err
+	}
+	Percents := http_model.Percents{}
+	Percents.DataReplaceNotUpload = percentsInfo.DataReplaceNotUpload
+	Percents.DataReplaceTimeOut = percentsInfo.DataReplaceTimeOut
+	Percents.DataOtherTimeOut = percentsInfo.DataOtherTimeOut
+	Percents.DataOtherNotUpload = percentsInfo.DataOtherNotUpload
+	Percents.LinkReplaceTimeOut = percentsInfo.LinkReplaceTimeOut
+	Percents.LinkReplaceNotUpload = percentsInfo.LinkReplaceNotUpload
+	Percents.LinkOtherTimeOut = percentsInfo.LinkOtherTimeOut
+	Percents.LinkOtherNotUpload = percentsInfo.LinkOtherNotUpload
+	Percents.ScriptReplaceTimeOut = percentsInfo.ScriptReplaceTimeOut
+	Percents.ScriptReplaceNotUpload = percentsInfo.ScriptReplaceNotUpload
+	Percents.ScriptOtherNotUpload = percentsInfo.ScriptOtherNotUpload
+	Percents.ScriptOtherTimeOut = percentsInfo.ScriptOtherTimeOut
+	Percents.SketchReplaceTimeOut = percentsInfo.SketchReplaceTimeOut
+	Percents.SketchOtherNotUpload = percentsInfo.SketchOtherNotUpload
+	Percents.SketchOtherTimeOut = percentsInfo.SketchOtherTimeOut
+	Percents.SketchReplaceNotUpload = percentsInfo.SketchReplaceNotUpload
+	return &Percents, err
+}

+ 2 - 1
db/project.go

@@ -39,7 +39,8 @@ func GetFullProjectList(ctx context.Context, pageSize, pageNum int32, condition
 			db = db.Where(fmt.Sprintf("updated_at like '%s%%'", value.Interface()))
 		}
 		if tag == "project_name" && !util.IsBlank(value) {
-			db = db.Where(fmt.Sprintf("%s = ?", tag), value.Interface())
+			//db = db.Where(fmt.Sprintf("%s = ?", tag), value.Interface())
+			db = db.Where(fmt.Sprintf("project_name like '%%%s%%'", value.Interface()))
 		}
 	}
 	// 查询总数

+ 17 - 2
db/talent.go

@@ -70,10 +70,10 @@ func AccountIncome(ctx context.Context, talentId string) (*http_model.TalentInfo
 				return nil, err
 			}
 		}
-
+		region := GetRegion(ctx, deliveryInfo.RegionCode)
 		data.ReceiverName = deliveryInfo.ReceiverName
 		data.PhoneNumber = deliveryInfo.PhoneNumber
-		data.DetailAddr = deliveryInfo.DetailAddr
+		data.DetailAddr = region + deliveryInfo.DetailAddr
 	} else {
 		data.ReceiverName = "暂未绑定物流地址"
 		data.PhoneNumber = "暂未绑定物流地址"
@@ -114,6 +114,21 @@ func AccountIncome(ctx context.Context, talentId string) (*http_model.TalentInfo
 	return data, err
 }
 
+func GetRegion(ctx context.Context, regionCode int) string {
+	db4 := GetReadDB(ctx)
+	var infoRegion *gorm_model.InfoRegion
+	db4.Debug().Model(gorm_model.InfoRegion{}).Where("self_code = ?", regionCode).First(&infoRegion)
+
+	provinceCode := conv.MustString(regionCode, "")[0:2] + "0000"
+	var province *gorm_model.InfoRegion
+	db4.Debug().Model(gorm_model.InfoRegion{}).Where("self_code = ?", conv.MustInt(provinceCode, 0)).First(&province)
+
+	cityCode := conv.MustString(regionCode, "")[0:4] + "00"
+	var city *gorm_model.InfoRegion
+	db4.Debug().Model(gorm_model.InfoRegion{}).Where("self_code = ?", conv.MustInt(cityCode, 0)).First(&city)
+	return province.RegionName + city.RegionName + infoRegion.RegionName
+}
+
 func GetTaskRecord(ctx context.Context, talentId string) (*http_model.GetTaskRecordResponse, error) {
 	db := GetReadDB(ctx)
 	var taskInfos []*gorm_model.YoungeeTaskInfo

+ 15 - 6
db/user.go

@@ -176,10 +176,14 @@ func GetEnterpriseUserList(ctx context.Context, pageSize, pageNum int32, conditi
 		field := conditionType.Field(i)
 		tag := field.Tag.Get("condition")
 		value := conditionValue.FieldByName(field.Name)
-		if !util.IsBlank(value) && tag != "created_at" {
+		if !util.IsBlank(value) && tag != "created_at" && tag != "username" && tag != "user" {
 			db = db.Where(fmt.Sprintf("%s = ?", tag), value.Interface())
 		} else if tag == "created_at" && value.Interface() != nil {
 			db = db.Where(fmt.Sprintf("created_at like '%s%%'", value.Interface()))
+		} else if (tag == "username" || tag == "user") && value.Interface() != nil {
+			db = db.Where(fmt.Sprintf("username like '%%%s%%'", value.Interface()))
+		} else if tag == "user" && value.Interface() != nil {
+			db = db.Where(fmt.Sprintf("user like '%%%s%%'", value.Interface()))
 		}
 	}
 	var users []gorm_model.YounggeeUser
@@ -188,7 +192,7 @@ func GetEnterpriseUserList(ctx context.Context, pageSize, pageNum int32, conditi
 		logrus.WithContext(ctx).Errorf("[GetEnterpriseUserList] error query mysql total, err:%+v", err)
 		return nil, 0, err
 	}
-	db.Order("user").Find(&users)
+	db.Order("created_at desc").Find(&users)
 
 	// 查询 用户自增的id
 	var userIds []int64
@@ -205,7 +209,7 @@ func GetEnterpriseUserList(ctx context.Context, pageSize, pageNum int32, conditi
 	// 查询该页数据
 	limit := pageSize
 	offset := pageSize * pageNum // assert pageNum start with 0
-	err := db.Order("user").Limit(int(limit)).Offset(int(offset)).Error
+	err := db.Order("created_at desc").Limit(int(limit)).Offset(int(offset)).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[GetEnterpriseUserList] error query mysql total, err:%+v", err)
 		return nil, 0, err
@@ -242,10 +246,12 @@ func GetCreatorList(ctx context.Context, pageSize, pageNum int32, conditions *co
 		field := conditionType.Field(i)
 		tag := field.Tag.Get("condition")
 		value := conditionValue.FieldByName(field.Name)
-		if !util.IsBlank(value) && tag != "create_date" {
+		if !util.IsBlank(value) && tag != "create_date" && tag != "talent_wx_nickname" {
 			db = db.Where(fmt.Sprintf("%s = ?", tag), value.Interface())
 		} else if tag == "create_date" && value.Interface() != nil {
 			db = db.Where(fmt.Sprintf("create_date like '%s%%'", value.Interface()))
+		} else if tag == "talent_wx_nickname" && value.Interface() != nil {
+			db = db.Where(fmt.Sprintf("talent_wx_nickname like '%%%s%%'", value.Interface()))
 		}
 	}
 
@@ -259,7 +265,7 @@ func GetCreatorList(ctx context.Context, pageSize, pageNum int32, conditions *co
 	// 查询该页数据
 	limit := pageSize
 	offset := pageSize * pageNum // assert pageNum start with 0
-	err := db.Order("id").Limit(int(limit)).Offset(int(offset)).Find(&talentList).Error
+	err := db.Order("create_date desc").Limit(int(limit)).Offset(int(offset)).Find(&talentList).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[GetCreatorList] error query mysql total, err:%+v", err)
 		return nil, 0, err
@@ -281,7 +287,7 @@ func AccountInfo(ctx context.Context, pageSize, pageNum int32, conditions *commo
 		field := conditionType.Field(i)
 		tag := field.Tag.Get("condition")
 		value := conditionValue.FieldByName(field.Name)
-		if !util.IsBlank(value) && tag != "bind_date" && tag != "fans_low" && tag != "fans_high" {
+		if !util.IsBlank(value) && tag != "bind_date" && tag != "fans_low" && tag != "fans_high" && tag != "platform_nickname" {
 			db = db.Where(fmt.Sprintf("%s = ?", tag), value.Interface())
 		} else if tag == "bind_date" && value.Interface() != nil {
 			db = db.Where(fmt.Sprintf("bind_date like '%s%%'", value.Interface()))
@@ -292,6 +298,9 @@ func AccountInfo(ctx context.Context, pageSize, pageNum int32, conditions *commo
 		if !util.IsBlank(value) && tag == "fans_high" {
 			db = db.Where(fmt.Sprintf("%s <= ?", "fans_count"), value.Interface())
 		}
+		if !util.IsBlank(value) && tag == "platform_nickname" {
+			db = db.Where(fmt.Sprintf("platform_nickname like '%%%s%%'", value.Interface()))
+		}
 	}
 	db = db.Debug().Where("deleted = ?", 0)
 	var total int64

+ 55 - 0
handler/operate/getHours.go

@@ -0,0 +1,55 @@
+package operate
+
+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 WrapGetHoursHandler(ctx *gin.Context) {
+	handler := newGetHoursHandler(ctx)
+	BaseRun(handler)
+}
+
+type GetHoursHandler struct {
+	ctx  *gin.Context
+	req  *http_model.GetHoursRequest
+	resp *http_model.CommonResponse
+}
+
+func (g GetHoursHandler) getContext() *gin.Context {
+	return g.ctx
+}
+
+func (g GetHoursHandler) getResponse() interface{} {
+	return g.resp
+}
+
+func (g GetHoursHandler) getRequest() interface{} {
+	return g.req
+}
+
+func (g GetHoursHandler) run() {
+	data, err := db.GetHours(g.ctx)
+	if err != nil {
+		logrus.WithContext(g.ctx).Errorf("[GetHoursHandler] error GetHours, err:%+v", err)
+		util.HandlerPackErrorResp(g.resp, consts.ErrorInternal, consts.DefaultToast)
+		return
+	}
+	g.resp.Data = data
+}
+
+func (g GetHoursHandler) checkParam() error {
+	return nil
+}
+
+func newGetHoursHandler(ctx *gin.Context) *GetHoursHandler {
+	return &GetHoursHandler{
+		ctx:  ctx,
+		req:  http_model.NewGetHoursRequest(),
+		resp: http_model.NewGetHoursResponse(),
+	}
+}

+ 55 - 0
handler/operate/getPercents.go

@@ -0,0 +1,55 @@
+package operate
+
+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 WrapGetPercentsHandler(ctx *gin.Context) {
+	handler := newGetPercentsHandler(ctx)
+	BaseRun(handler)
+}
+
+type GetPercentHandler struct {
+	ctx  *gin.Context
+	req  *http_model.GetPercentsRequest
+	resp *http_model.CommonResponse
+}
+
+func (g GetPercentHandler) getContext() *gin.Context {
+	return g.ctx
+}
+
+func (g GetPercentHandler) getResponse() interface{} {
+	return g.resp
+}
+
+func (g GetPercentHandler) getRequest() interface{} {
+	return g.req
+}
+
+func (g GetPercentHandler) run() {
+	data, err := db.GetPercents(g.ctx)
+	if err != nil {
+		logrus.WithContext(g.ctx).Errorf("[GetPercentHandler] error GetPercents, err:%+v", err)
+		util.HandlerPackErrorResp(g.resp, consts.ErrorInternal, consts.DefaultToast)
+		return
+	}
+	g.resp.Data = data
+}
+
+func (g GetPercentHandler) checkParam() error {
+	return nil
+}
+
+func newGetPercentsHandler(ctx *gin.Context) *GetPercentHandler {
+	return &GetPercentHandler{
+		ctx:  ctx,
+		req:  http_model.NewGetPercentsRequest(),
+		resp: http_model.NewGetPercentsResponse(),
+	}
+}

+ 8 - 1
handler/product_create.go

@@ -1,6 +1,7 @@
 package handler
 
 import (
+	"fmt"
 	"github.com/gin-gonic/gin"
 	"github.com/sirupsen/logrus"
 	log "github.com/sirupsen/logrus"
@@ -42,7 +43,9 @@ func (h *CreateProductHandler) getResponse() interface{} {
 func (h *CreateProductHandler) run() {
 	data := http_model.CreateProductRequest{}
 	data = *h.req
+	fmt.Println("ProductId:", h.req.ProductId)
 	enterpriseID := db.GetEnterpriseIDByProductID(h.ctx, h.req.ProductId)
+	fmt.Println("enterpriseID:", enterpriseID)
 	//根据品牌名和商品名查询商品是否存在,若存在则更新,否则新增
 	product, err := service.Product.FindByID(h.ctx, data.ProductId)
 	if err != nil {
@@ -53,6 +56,8 @@ func (h *CreateProductHandler) run() {
 	} else {
 		if product != nil {
 			// 该商品存在,更新
+			fmt.Println("该商品存在,更新")
+			fmt.Println("商品价格:", data.ProductPrice)
 			data.ProductId = product.ProductID
 			res, err := service.Product.Update(h.ctx, data, enterpriseID)
 			if err != nil {
@@ -65,7 +70,9 @@ func (h *CreateProductHandler) run() {
 			h.resp.Data = res
 		} else {
 			// 商品不存在,新增
-			res, err := service.Product.Create(h.ctx, data, enterpriseID)
+			fmt.Println("商品不存在,新增")
+			fmt.Println("data.EnterpriseId:", data.EnterpriseId)
+			res, err := service.Product.Create(h.ctx, data, data.EnterpriseId)
 			if err != nil {
 				logrus.Errorf("[CreateProductHandler] call Create err:%+v\n", err)
 				util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")

+ 4 - 5
model/gorm_model/product.go

@@ -6,14 +6,14 @@ import (
 )
 
 type YounggeeProduct struct {
-	ProductID     int64       `gorm:"column:product_id;primary_key;AUTO_INCREMENT"` // 商品id
+	ProductID     int64     `gorm:"column:product_id;primary_key;AUTO_INCREMENT"` // 商品id
 	ProductName   string    `gorm:"column:product_name"`                          // 商品名称
-	ProductType   int64       `gorm:"column:product_type"`                          // 商品类型
+	ProductType   int64     `gorm:"column:product_type"`                          // 商品类型
 	ShopAddress   string    `gorm:"column:shop_address"`                          // 店铺地址,商品类型为线下品牌时需填写
-	ProductPrice  int64     `gorm:"column:product_price"`                         // 商品价值
+	ProductPrice  float64   `gorm:"column:product_price"`                         // 商品价值
 	ProductDetail string    `gorm:"column:product_detail"`
 	ProductUrl    string    `gorm:"column:product_url"`   // 商品链接,可为电商网址、公司官网、大众点评的店铺地址等可以说明商品信息或者品牌信息的线上地址;
-	EnterpriseID  int64       `gorm:"column:enterprise_id"` // 所属企业id
+	EnterpriseID  int64     `gorm:"column:enterprise_id"` // 所属企业id
 	CreatedAt     time.Time `gorm:"column:created_at"`    // 创建时间
 	UpdatedAt     time.Time `gorm:"column:updated_at"`    // 更新时间
 	BrandName     string    `gorm:"column:brand_name"`
@@ -22,4 +22,3 @@ type YounggeeProduct struct {
 func (m *YounggeeProduct) TableName() string {
 	return "younggee_product"
 }
-

+ 29 - 0
model/http_model/GetHoursRequest.go

@@ -0,0 +1,29 @@
+package http_model
+
+type GetHoursRequest struct {
+}
+
+type Hours struct {
+	SignInOffline     int32 `json:"sign_in_offline"`
+	SignInVirtual     int32 `json:"sign_in_virtual"`
+	ReviewInMv        int32 `json:"review_in_mv"`
+	ReviewUnlimited   int32 `json:"review_unlimited"`
+	PostReview        int32 `json:"post_review"`
+	CaseClose         int32 `json:"case_close"`
+	Invalid           int32 `json:"invalid"`
+	DraftDefaultInPic int32 `json:"draft_default_in_pic"`
+	DraftDefaultInMv  int32 `json:"draft_default_in_mv"`
+	ScriptDefault     int32 `json:"script_default"`
+	LinkBreach        int32 `json:"link_breach"`
+	CaseCloseDefault  int32 `json:"case_close_default"`
+}
+
+func NewGetHoursRequest() *GetHoursRequest {
+	return new(GetHoursRequest)
+}
+
+func NewGetHoursResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(Hours)
+	return resp
+}

+ 33 - 0
model/http_model/GetPercentsRequest.go

@@ -0,0 +1,33 @@
+package http_model
+
+type GetPercentsRequest struct {
+}
+
+type Percents struct {
+	SketchOtherTimeOut     int `json:"sketch_other_time_out"`
+	SketchOtherNotUpload   int `json:"sketch_other_not_upload"`
+	SketchReplaceTimeOut   int `json:"sketch_replace_time_out"`
+	SketchReplaceNotUpload int `json:"sketch_replace_not_upload"`
+	ScriptOtherTimeOut     int `json:"script_other_time_out"`
+	ScriptOtherNotUpload   int `json:"script_other_not_upload"`
+	ScriptReplaceTimeOut   int `json:"script_replace_time_out"`
+	ScriptReplaceNotUpload int `json:"script_replace_not_upload"`
+	LinkOtherTimeOut       int `json:"link_other_time_out"`
+	LinkOtherNotUpload     int `json:"link_other_not_upload"`
+	LinkReplaceTimeOut     int `json:"link_replace_time_out"`
+	LinkReplaceNotUpload   int `json:"link_replace_not_upload"`
+	DataOtherNotUpload     int `json:"data_other_not_upload"`
+	DataOtherTimeOut       int `json:"data_other_time_out"`
+	DataReplaceTimeOut     int `json:"data_replace_time_out"`
+	DataReplaceNotUpload   int `json:"data_replace_not_upload"`
+}
+
+func NewGetPercentsRequest() *GetPercentsRequest {
+	return new(GetPercentsRequest)
+}
+
+func NewGetPercentsResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(Percents)
+	return resp
+}

+ 2 - 0
model/http_model/GetRechargeRecordsRequest.go

@@ -6,6 +6,7 @@ type GetRechargeRecordsRequest struct {
 	Status         int32  `json:"status"`
 	BusinessName   string `json:"business_name"`
 	UserId         int64  `json:"user_id"`
+	Username       string `json:"username"`
 	RechargeMethod int32  `json:"recharge_method"`
 	CommitAt       string `json:"commit_at"`
 	ConfirmAt      string `json:"confirm_at"`
@@ -15,6 +16,7 @@ type RechargeRecordsPreview struct {
 	RechargeId      string  `json:"recharge_id"`
 	EnterpriseID    int64   `json:"enterprise_id"`
 	UserId          int64   `json:"user_id"`
+	Username        string  `json:"username"`
 	BusinessName    string  `json:"business_name"`
 	RechargeAmount  float64 `json:"recharge_amount"`
 	RechargeMethod  string  `json:"recharge_method"`

+ 2 - 0
model/http_model/InvoiceRecordsRequest.go

@@ -6,6 +6,7 @@ type InvoiceRecordsRequest struct {
 	InvoiceStatus int32  `json:"invoice_status"`
 	SubmitAt      string `json:"submit_at"`
 	BusinessName  string `json:"business_name"`
+	Username      string `json:"username"`
 	UserId        int64  `json:"user_id"`
 	BillingAt     string `json:"billing_at"`
 }
@@ -13,6 +14,7 @@ type InvoiceRecordsRequest struct {
 type InvoiceRecordsPreviews struct {
 	BillingId      string  `json:"billing_id"`
 	UserId         int64   `json:"user_id"`
+	Username       string  `json:"username"`
 	BusinessName   string  `json:"business_name"`
 	Amount         float64 `json:"amount"`
 	InvoiceType    string  `json:"invoice_type"`

+ 1 - 0
model/http_model/enterprise_user.go

@@ -13,6 +13,7 @@ type EnterpriseUserRequest struct {
 type EnterpriseUserPreview struct {
 	User             string  `json:"user"`              // 企业用户ID
 	UserID           string  `json:"userID"`            // 用户ID
+	EnterpriseID     int64   `json:"enterprise_id"`     // 企业ID
 	Username         string  `json:"username"`          // 企业名称
 	Balance          float64 `json:"balance"`           // 账户余额
 	FrozenBalance    float64 `json:"frozen_balance"`    // 冻结余额

+ 7 - 6
model/http_model/product_create.go

@@ -7,12 +7,13 @@ type CreateProductPhoto struct {
 }
 
 type CreateProductRequest struct {
-	ProductId     int64                `json:"product_id"`
-	ProductName   string               `json:"product_name"` // 商品名称
-	ProductType   int64                `json:"product_type"` // 商品类型
-	ShopAddress   string               `json:"shop_address"` // 店铺地址,商品类型为线下品牌时需填写
-	ProductDetail string               `json:"product_detail"`
-	ProductPrice  int64                `json:"product_price"`  // 商品价值
+	ProductId     int64                `json:"product_id"`     // 产品id
+	EnterpriseId  int64                `json:"enterprise_id"`  // 要绑定的企业id
+	ProductName   string               `json:"product_name"`   // 商品名称
+	ProductType   int64                `json:"product_type"`   // 商品类型
+	ShopAddress   string               `json:"shop_address"`   // 店铺地址,商品类型为线下品牌时需填写
+	ProductDetail string               `json:"product_detail"` // 商品详细
+	ProductPrice  float64              `json:"product_price"`  // 商品价值
 	ProductPhotos []CreateProductPhoto `json:"product_photos"` // 商品图片列表
 	ProductUrl    string               `json:"product_url"`    // 商品链接,可为电商网址、公司官网、大众点评的店铺地址等可以说明商品信息或者品牌信息的线上地址;
 	BrandName     string               `json:"brand_name"`

+ 7 - 7
model/http_model/product_find.go

@@ -6,17 +6,17 @@ type FindProductRequest struct {
 
 type ProductPhoto struct {
 	PhotoUrl string `json:"photo_url"` // 图片或视频url
-	PhotoUid string `json:"photo_uid"`
-	Symbol   int64  `json:"symbol"` // 图片为主图或详情图标志位,1为主图,2为详情图,3为视频
+	PhotoUid string `json:"photo_uid"` // 图片uuid
+	Symbol   int64  `json:"symbol"`    // 图片为主图或详情图标志位,1为主图,2为详情图,3为视频
 }
 
 type FindProductData struct {
 	ProductID     int64          `json:"product_id"`
-	ProductName   string         `json:"product_name"`  // 商品名称
-	ProductType   int64          `json:"product_type"`  // 商品类型
-	ShopAddress   string         `json:"shop_address"`  // 店铺地址,商品类型为线下品牌时需填写
-	ProductPrice  int64          `json:"product_price"` // 商品价值
-	ProductDetail string         `json:"product_detail"`
+	ProductName   string         `json:"product_name"`   // 商品名称
+	ProductType   int64          `json:"product_type"`   // 商品类型
+	ShopAddress   string         `json:"shop_address"`   // 店铺地址,商品类型为线下品牌时需填写
+	ProductPrice  float64        `json:"product_price"`  // 商品价值
+	ProductDetail string         `json:"product_detail"` // 商品描述
 	ProductPhotos []ProductPhoto `json:"product_photos"` // 商品图片列表
 	ProductUrl    string         `json:"product_url"`    // 商品链接,可为电商网址、公司官网、大众点评的店铺地址等可以说明商品信息或者品牌信息的线上地址;
 	EnterpriseID  int64          `json:"enterprise_id"`  // 所属企业id

+ 1 - 0
pack/user_list.go

@@ -45,6 +45,7 @@ func GetEnterPriseUserStruct(enterpriseUser *http_model.EnterpriseUser) *http_mo
 	return &http_model.EnterpriseUserPreview{
 		User:             enterpriseUser.YoungeeUser.User,
 		UserID:           conv.MustString(enterpriseUser.Enterprise.UserID, ""),
+		EnterpriseID:     enterpriseUser.Enterprise.EnterpriseID,
 		Username:         enterpriseUser.YoungeeUser.Username,
 		Balance:          enterpriseUser.Enterprise.Balance,
 		AvailableBalance: enterpriseUser.Enterprise.AvailableBalance,

+ 2 - 0
route/init.go

@@ -132,6 +132,8 @@ func InitRoute(r *gin.Engine) {
 		o.POST("/dataReplaceTimeOut", operate.WrapDataReplaceTimeOutHandler)
 		o.POST("/dataOtherNotUpload", operate.WrapDataOtherNotUploadHandler)
 		o.POST("/dataOtherTimeOut", operate.WrapDataOtherTimeOutHandler)
+		o.GET("/getHours", operate.WrapGetHoursHandler)
+		o.GET("/getPercents", operate.WrapGetPercentsHandler)
 	}
 	f := r.Group("/youngee/m/finance")
 	{

+ 6 - 2
service/product.go

@@ -2,6 +2,8 @@ package service
 
 import (
 	"context"
+	"fmt"
+	"strconv"
 	"youngee_m_api/consts"
 	"youngee_m_api/db"
 	"youngee_m_api/model/gorm_model"
@@ -62,12 +64,13 @@ func (*product) FindByID(ctx context.Context, productID int64) (*http_model.Find
 	if err != nil {
 		return nil, err
 	}
+	productPrice, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", product.ProductPrice), 64)
 	findProductData := http_model.FindProductData{
 		ProductID:     product.ProductID,
 		ProductName:   product.ProductName,
 		ProductType:   product.ProductType,
 		ShopAddress:   product.ShopAddress,
-		ProductPrice:  product.ProductPrice,
+		ProductPrice:  productPrice,
 		ProductDetail: product.ProductDetail,
 		ProductUrl:    product.ProductUrl,
 		EnterpriseID:  product.EnterpriseID,
@@ -104,12 +107,13 @@ func (*product) FindAll(ctx context.Context, enterpriseID int64) (*http_model.Fi
 }
 
 func (*product) Update(ctx context.Context, newProduct http_model.CreateProductRequest, enterpriseID int64) (*http_model.CreateProductData, error) {
+	productPrice, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", newProduct.ProductPrice), 64)
 	product := gorm_model.YounggeeProduct{
 		ProductID:     newProduct.ProductId,
 		ProductName:   newProduct.ProductName,
 		ProductType:   newProduct.ProductType,
 		ShopAddress:   newProduct.ShopAddress,
-		ProductPrice:  newProduct.ProductPrice,
+		ProductPrice:  productPrice,
 		ProductDetail: newProduct.ProductDetail,
 		ProductUrl:    newProduct.ProductUrl,
 		EnterpriseID:  enterpriseID,