package db import ( "context" "youngee_b_api/model/gorm_model" ) // GetSupplierPaymentInfoById 根据服务商ID查询提现账号信息 func GetSupplierPaymentInfoById(ctx context.Context, supplierId int) (*gorm_model.SupplierPaymentInfo, error) { db := GetWriteDB(ctx) var supplierPaymentInfo *gorm_model.SupplierPaymentInfo whereCondition := gorm_model.SupplierPaymentInfo{SupplierID: supplierId} err := db.Model(gorm_model.SupplierPaymentInfo{}).Where(whereCondition).Find(&supplierPaymentInfo).Error if err != nil { return nil, err } return supplierPaymentInfo, nil } // CreateSupplierPayment 新建提现收款信息 func CreateSupplierPayment(ctx context.Context, paymentInfo *gorm_model.SupplierPaymentInfo) error { db := GetWriteDB(ctx) err := db.Create(&paymentInfo).Error if err != nil { return err } return nil } // UpdateSupplierPayment 更新提现收款信息 func UpdateSupplierPayment(ctx context.Context, paymentInfo *gorm_model.SupplierPaymentInfo) error { db := GetWriteDB(ctx) whereCondition := gorm_model.SupplierPaymentInfo{PaymentInfoID: paymentInfo.PaymentInfoID} err := db.Model(&gorm_model.SupplierPaymentInfo{}).Where(whereCondition).Updates(paymentInfo).Error if err != nil { return err } return nil }