shenzekai 1 year ago
parent
commit
862d87460e

+ 1 - 0
db/selection.go

@@ -125,6 +125,7 @@ func GetSelectionList(ctx context.Context, enterpriseID string, pageSize, pageNu
 	}
 	var newSelectionInfos []*gorm_model.YounggeeSelectionInfo
 	for _, v := range selectionInfos {
+		fmt.Printf("查询选品列表 %+v\n", v)
 		if searchValue == "" {
 			newSelectionInfos = append(newSelectionInfos, v)
 		} else if strings.Contains(v.SelectionID, searchValue) {

+ 2 - 0
handler/product_findAll.go

@@ -1,6 +1,7 @@
 package handler
 
 import (
+	"fmt"
 	"youngee_b_api/consts"
 	"youngee_b_api/middleware"
 	"youngee_b_api/model/http_model"
@@ -43,6 +44,7 @@ func (h *FindAllProductHandler) getResponse() interface{} {
 func (h *FindAllProductHandler) run() {
 	auth := middleware.GetSessionAuth(h.ctx)
 	enterpriseID := auth.EnterpriseID
+	fmt.Printf("企业ID %+v", enterpriseID)
 	res, err := service.Product.FindAll(h.ctx, enterpriseID)
 	if err != nil {
 		// 数据库查询失败,返回5001

+ 1 - 0
handler/selection_find_all.go

@@ -38,6 +38,7 @@ func (f FindAllSelectionHandler) getRequest() interface{} {
 
 func (f FindAllSelectionHandler) run() {
 	enterpriseID := middleware.GetSessionAuth(f.ctx).EnterpriseID
+	fmt.Printf("2企业ID2 %+v", enterpriseID)
 	condition := pack.HttpFindAllSelectionRequestToCondition(f.req)
 	data, err := selection_service.Selection.GetAllSelection(f.ctx, enterpriseID, f.req.PageSize, f.req.PageNum, condition)
 	if err != nil {

+ 1 - 0
pack/selection.go

@@ -45,6 +45,7 @@ func GormSelectionToHttpSelectionPreview(selectionInfo *gorm_model.YounggeeSelec
 		RewardCondition:  selectionInfo.RewardCondition,
 		SettlementAmount: selectionInfo.SettlementAmount,
 		TaskDdl:          selectionInfo.TaskDdl,
+		TaskMode:         selectionInfo.TaskMode,
 		Detail:           selectionInfo.Detail,
 		ProductSnap:      selectionInfo.ProductSnap,
 		ProductPhotoSnap: selectionInfo.ProductPhotoSnap,

+ 1 - 1
route/init.go

@@ -36,7 +36,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) {
 			c.JSON(200, "ok")
 			// 注意这里只是debug用的 接口要写成handler形式

+ 5 - 5
service/selection_service/selection.go

@@ -130,8 +130,8 @@ func (*selection) Update(ctx context.Context, request http_model.UpdateSelection
 		SampleNum:        conv.MustInt(request.SampleNum, 0),
 		RemainNum:        conv.MustInt(request.SampleNum, 0),
 		CommissionRate:   conv.MustInt(request.CommissionRate, 0),
-		TaskReward:       conv.MustString(request.TaskReward, "0"),
-		SettlementAmount: conv.MustString(request.SettlementAmount, "0"),
+		TaskReward:       conv.MustString(request.TaskReward, ""),
+		SettlementAmount: conv.MustString(request.SettlementAmount, ""),
 		EstimatedCost:    estimatedCostToString,
 		SampleCondition:  request.SampleCondition,
 		RewardCondition:  request.RewardCondition,
@@ -141,7 +141,7 @@ func (*selection) Update(ctx context.Context, request http_model.UpdateSelection
 		ProductPhotoSnap: string(productPhotosToJson),
 		CreatedAt:        selectionInfo.CreatedAt,
 		UpdatedAt:        time.Now(),
-		//SubmitAt:         time.Now(),
+		SubmitAt:         time.Now(),
 	}
 	// 合并传入参数和数据表中原记录,若传入参数字段值为空,则将字段赋值为原记录中值
 	//fmt.Printf("MergeTest %+v %+v", updateSelection, selectionInfo)
@@ -170,7 +170,7 @@ func (*selection) Update(ctx context.Context, request http_model.UpdateSelection
 		for _, v := range request.SecBrief {
 			brief := gorm_model.YounggeeSecBrief{
 				SelectionID: selectionInfo.SelectionID,
-				FileUid:     v.PhotoUid,
+				FileUid:     conv.MustString(v.PhotoUid, ""),
 				FileName:    v.Name,
 				FileUrl:     v.PhotoUrl,
 				CreatedAt:   time.Now(),
@@ -192,7 +192,7 @@ func (*selection) Update(ctx context.Context, request http_model.UpdateSelection
 		for _, v := range request.SecExample {
 			Example := gorm_model.YounggeeSecExample{
 				SelectionID: selectionInfo.SelectionID,
-				FileUid:     v.PhotoUid,
+				FileUid:     conv.MustString(v.PhotoUid, ""),
 				FileName:    v.Name,
 				FileUrl:     v.PhotoUrl,
 				CreatedAt:   time.Now(),