You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
642 B

package invoice
import (
"github.com/gin-gonic/gin"
"recook/internal/back"
"recook/internal/dbc"
"recook/internal/model/user"
"recook/tools"
)
type deleteInvoiceParam struct {
UserID uint `json:"userId"`
InvoiceID uint `json:"invoiceId"`
}
func DeleteInvoice(c *gin.Context) {
var p deleteInvoiceParam
err := tools.ParseParams(&p, c)
if err != nil {
back.Fail(c, err.Error())
return
}
var one user.Invoice
err = dbc.DB.First(&one, "id = ?", p.InvoiceID).Error
if err != nil {
back.Err(c, err.Error())
return
}
if one.UserID != p.UserID {
back.Fail(c, "不存在该信息")
return
}
back.Suc(c, "", nil)
}