Ver Fonte

Merge branch 'feature_yf' of HolaBIP/youngee_m_api into develop

houyunfeng há 2 anos atrás
pai
commit
618db50b19
2 ficheiros alterados com 14 adições e 3 exclusões
  1. 7 0
      db/default.go
  2. 7 3
      db/finance.go

+ 7 - 0
db/default.go

@@ -253,6 +253,13 @@ func ContractBreach(ctx context.Context, req *http_model.ContractBreachRequest)
 			}
 		}
 	}
+	if req.DefaultStatus == 5 {
+		err = SetTalentIncome(context.Background(), taskIds)
+		if err != nil {
+			logrus.WithContext(ctx).Errorf("[BreachPending] call SetTalentIncome error, err:%+v", err)
+			return err
+		}
+	}
 	return nil
 }
 

+ 7 - 3
db/finance.go

@@ -151,11 +151,15 @@ func ConfirmWithdrawal(ctx context.Context, withdrawId string) error {
 	db = db.Debug().Model(gorm_model.YounggeeWithdrawRecord{}).Where("withdraw_id = ?", withdrawId).Find(&withdrawInfo)
 	db2.Debug().Where("withdraw_id = ?", withdrawId).Updates(gorm_model.YounggeeWithdrawRecord{Status: 2, WithdrawAt: time.Now()})
 	taskIdLists := strings.Split(withdrawInfo.TaskIDList, ",")
-	for _, taskIdList := range taskIdLists {
+	for _, taskId := range taskIdLists {
 		db1 := GetReadDB(ctx)
-		db1.Debug().Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", taskIdList).Updates(gorm_model.YoungeeTaskInfo{WithdrawStatus: 4})
+		err := db1.Debug().Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", taskId).Updates(gorm_model.YoungeeTaskInfo{WithdrawStatus: 4}).Error
+		if err != nil {
+			logrus.WithContext(ctx).Errorf("[finance db] Update YoungeeTaskInfo error,err:%+v", err)
+			return err
+		}
 
-		err := CreateMessageByTaskId(ctx, 6, 1, taskIdList)
+		err = CreateMessageByTaskId(ctx, 6, 1, taskId)
 		if err != nil {
 			logrus.WithContext(ctx).Errorf("[ConfirmWithdrawal] call CreateMessageByTaskId error,err:%+v", err)
 			return err