Kaynağa Gözat

查询接口

“liushuai” 2 yıl önce
ebeveyn
işleme
9a22f1bf2b

+ 1 - 0
model/http_model/SpecialSettlePayRequest.go

@@ -4,6 +4,7 @@ type SpecialSettlePayRequest struct {
 	EnterPriseId string  `json:"enterprise_id"`
 	TaskId       string  `json:"task_id"`
 	Amount       float64 `json:"amount"`
+	ProjectID    string  `json:"project_id"`
 }
 
 func NewSpecialSettlePayRequest() *SpecialSettlePayRequest {

+ 1 - 1
service/autoTask.go

@@ -9,7 +9,7 @@ import (
 
 func AutoTask() error {
 	c := cron.New(cron.WithSeconds())
-	// spec := "0 */30 * * * ?" //cron表达式,每半小时执行一次
+	//spec := "0 */30 * * * ?" //cron表达式,每半小时执行一次
 	//spec := "0 */1 * * * ?" //cron表达式,每1分钟一次
 	spec := "*/10 * * * * ?" //cron表达式,每10秒一次
 	_, err1 := c.AddFunc(spec, AutoTaskUpdateStatus)

+ 14 - 5
service/project_pay.go

@@ -111,12 +111,21 @@ func (p *projectPay) SpecialSettlePay(ctx *gin.Context, req *http_model.SpecialS
 		if balance < realPay {
 			return errors.New("余额不足")
 		}
+
+		err = tx.Model(&gorm_model.ProjectInfo{}).Where("project_id = ?", req.ProjectID).
+			Updates(map[string]interface{}{"payment_amount": gorm.Expr("payment_amount + ?", req.Amount)}).Error
+		if err != nil {
+			logrus.WithContext(ctx).Errorf("[projectPay service] call SpecialSettlePay error,err:%+v", err)
+			return err
+		}
+
 		err = tx.Model(&gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", req.TaskId).Updates(gorm_model.YoungeeTaskInfo{
-			TaskReward:   req.Amount,
-			SettleAmount: req.Amount,
-			AllPayment:   req.Amount,
-			RealPayment:  req.Amount,
-			SettleStatus: 2,
+			TaskReward:     req.Amount,
+			SettleAmount:   req.Amount,
+			AllPayment:     req.Amount,
+			RealPayment:    req.Amount,
+			SettleStatus:   2,
+			WithdrawStatus: 2,
 		}).Error
 		if err != nil {
 			logrus.WithContext(ctx).Errorf("[projectPay service] call SpecialSettlePay error,err:%+v", err)