|
@@ -127,6 +127,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"),
|
|
|
EstimatedCost: estimatedCostToString,
|
|
|
SampleCondition: request.SampleCondition,
|
|
|
RewardCondition: request.RewardCondition,
|
|
@@ -139,9 +141,9 @@ func (*selection) Update(ctx context.Context, request http_model.UpdateSelection
|
|
|
SubmitAt: time.Now(),
|
|
|
}
|
|
|
// 合并传入参数和数据表中原记录,若传入参数字段值为空,则将字段赋值为原记录中值
|
|
|
- result := util.MergeStructValue(&updateSelection, &selectionInfo)
|
|
|
+ result := util.MergeStructValue(&updateSelection, selectionInfo)
|
|
|
// 利用反射机制将interface类型转换为结构体类型
|
|
|
- v := reflect.ValueOf(result).Elem()
|
|
|
+ v := reflect.ValueOf(&result).Elem()
|
|
|
if v.Kind() == reflect.Struct {
|
|
|
updateSelection = v.Interface().(gorm_model.YounggeeSelectionInfo)
|
|
|
//fmt.Println(p)
|
|
@@ -193,6 +195,22 @@ func (*selection) Pay(ctx context.Context, request http_model.PaySelectionReques
|
|
|
return res, nil
|
|
|
}
|
|
|
|
|
|
+func (*selection) Submit(ctx context.Context, request http_model.SubmitSelectionRequest) (*http_model.SubmitSelectionData, error) {
|
|
|
+ updateSelection := gorm_model.YounggeeSelectionInfo{
|
|
|
+ SelectionID: request.SelectionId,
|
|
|
+ SelectionStatus: request.SelectionStatus,
|
|
|
+ SubmitAt: time.Now(),
|
|
|
+ }
|
|
|
+
|
|
|
+ err := db.UpdateSelection(ctx, updateSelection)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ res := &http_model.SubmitSelectionData{}
|
|
|
+ return res, nil
|
|
|
+}
|
|
|
+
|
|
|
func (s *selection) GetAllSelection(ctx context.Context, enterpriseID string, pageSize, pageNum int64, conditions *common_model.SelectionConditions) (*http_model.SelectionData, error) {
|
|
|
SelectionList, total, err := db.GetSelectionList(ctx, enterpriseID, pageSize, pageNum, conditions)
|
|
|
if err != nil {
|