add media url for create donate case
This commit is contained in:
parent
238421c69f
commit
9e4553c6f3
@ -46,6 +46,7 @@ func CreateDonat(donatService model.DonatService) echo.HandlerFunc {
|
|||||||
body.DonatUser,
|
body.DonatUser,
|
||||||
body.TargetID,
|
body.TargetID,
|
||||||
body.Amount,
|
body.Amount,
|
||||||
|
body.MediaUrl,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return request.JSON(http.StatusInternalServerError, err.Error())
|
return request.JSON(http.StatusInternalServerError, err.Error())
|
||||||
@ -91,6 +92,7 @@ func CreateTestDonat(donatService model.DonatService) echo.HandlerFunc {
|
|||||||
body.Text,
|
body.Text,
|
||||||
body.DonatUser,
|
body.DonatUser,
|
||||||
body.TargetID,
|
body.TargetID,
|
||||||
|
body.MediaUrl,
|
||||||
body.Amount,
|
body.Amount,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -76,13 +76,21 @@ type DonatService interface {
|
|||||||
|
|
||||||
CheckToken(request echo.Context) (api.CheckTokenResponse, error)
|
CheckToken(request echo.Context) (api.CheckTokenResponse, error)
|
||||||
|
|
||||||
CreateDonat(ctx context.Context, streamerLogin, text, donatUser string, targetID *int, amount int) (CreateDonatResponse, error)
|
CreateDonat(
|
||||||
|
ctx context.Context,
|
||||||
|
streamerLogin, text,
|
||||||
|
donatUser string,
|
||||||
|
targetID *int,
|
||||||
|
amount int,
|
||||||
|
mediaUrl *string,
|
||||||
|
) (CreateDonatResponse, error)
|
||||||
CreateTestDonat(
|
CreateTestDonat(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
streamerID int,
|
streamerID int,
|
||||||
text string,
|
text string,
|
||||||
donatUser string,
|
donatUser string,
|
||||||
targetID *int,
|
targetID *int,
|
||||||
|
mediaURL *string,
|
||||||
amount int,
|
amount int,
|
||||||
) error
|
) error
|
||||||
|
|
||||||
@ -142,6 +150,7 @@ type DonatRepo interface {
|
|||||||
amount int,
|
amount int,
|
||||||
text string,
|
text string,
|
||||||
donatUser string,
|
donatUser string,
|
||||||
|
mediaUrl *string,
|
||||||
status string,
|
status string,
|
||||||
) error
|
) error
|
||||||
|
|
||||||
|
@ -266,10 +266,11 @@ type DonatAndWidget struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type CreateDonatBody struct {
|
type CreateDonatBody struct {
|
||||||
TargetID *int `json:"targetID"`
|
TargetID *int `json:"targetID"`
|
||||||
Amount int `json:"amount"`
|
Amount int `json:"amount"`
|
||||||
Text string `json:"text"`
|
Text string `json:"text"`
|
||||||
DonatUser string `json:"donatUser"`
|
DonatUser string `json:"donatUser"`
|
||||||
|
MediaUrl *string `json:"mediaUrl"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type DonationStat struct {
|
type DonationStat struct {
|
||||||
|
@ -39,6 +39,7 @@ CREATE TABLE IF NOT EXISTS donats (
|
|||||||
target_id INTEGER,
|
target_id INTEGER,
|
||||||
paid_time TIMESTAMP,
|
paid_time TIMESTAMP,
|
||||||
is_test BOOLEAN DEFAULT 'false',
|
is_test BOOLEAN DEFAULT 'false',
|
||||||
|
media_url VARCHAR(255),
|
||||||
|
|
||||||
status VARCHAR(50) NOT NULL DEFAULT 'pending',
|
status VARCHAR(50) NOT NULL DEFAULT 'pending',
|
||||||
|
|
||||||
|
@ -40,8 +40,8 @@ func GetMediaUrl(mediaType model.MediaType) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var CreateDonat = `
|
var CreateDonat = `
|
||||||
INSERT INTO donats (streamer_id, widget_id, text, amount, donat_user, order_id, target_id, status, paid_time, is_test)
|
INSERT INTO donats (streamer_id, widget_id, text, amount, donat_user, order_id, target_id, status, paid_time, is_test, media_url)
|
||||||
VALUES (@streamer_id, @widget_id, @text, @amount, @donat_user, @order_id, @target_id, @status, @paid_time, @is_test)
|
VALUES (@streamer_id, @widget_id, @text, @amount, @donat_user, @order_id, @target_id, @status, @paid_time, @is_test, @media_url)
|
||||||
RETURNING id;
|
RETURNING id;
|
||||||
`
|
`
|
||||||
var MarkDonatView = `
|
var MarkDonatView = `
|
||||||
|
@ -33,6 +33,7 @@ func (repoDonat *RepoDonat) CreateDonat(
|
|||||||
amount int,
|
amount int,
|
||||||
text string,
|
text string,
|
||||||
donatUser string,
|
donatUser string,
|
||||||
|
mediaUrl *string,
|
||||||
status string,
|
status string,
|
||||||
) error {
|
) error {
|
||||||
args := pgx.NamedArgs{
|
args := pgx.NamedArgs{
|
||||||
@ -44,6 +45,7 @@ func (repoDonat *RepoDonat) CreateDonat(
|
|||||||
"amount": amount,
|
"amount": amount,
|
||||||
"status": status,
|
"status": status,
|
||||||
"donat_user": donatUser,
|
"donat_user": donatUser,
|
||||||
|
"media_url": mediaUrl,
|
||||||
"is_test": false,
|
"is_test": false,
|
||||||
"paid_time": nil,
|
"paid_time": nil,
|
||||||
}
|
}
|
||||||
|
@ -95,6 +95,7 @@ func (donatService *ServiceDonat) CreateDonat(
|
|||||||
donatUser string,
|
donatUser string,
|
||||||
targetID *int,
|
targetID *int,
|
||||||
amount int,
|
amount int,
|
||||||
|
mediaUrl *string,
|
||||||
) (model.CreateDonatResponse, error) {
|
) (model.CreateDonatResponse, error) {
|
||||||
|
|
||||||
donatePage, err := donatService.donatRepo.GetDonatPageByLogin(ctx, streamerLogin)
|
donatePage, err := donatService.donatRepo.GetDonatPageByLogin(ctx, streamerLogin)
|
||||||
@ -128,6 +129,7 @@ func (donatService *ServiceDonat) CreateDonat(
|
|||||||
amount,
|
amount,
|
||||||
text,
|
text,
|
||||||
donatUser,
|
donatUser,
|
||||||
|
mediaUrl,
|
||||||
"pending",
|
"pending",
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -153,6 +155,7 @@ func (donatService *ServiceDonat) CreateTestDonat(
|
|||||||
text string,
|
text string,
|
||||||
donatUser string,
|
donatUser string,
|
||||||
targetID *int,
|
targetID *int,
|
||||||
|
mediaUrl *string,
|
||||||
amount int,
|
amount int,
|
||||||
) error {
|
) error {
|
||||||
orderID := uuid.New()
|
orderID := uuid.New()
|
||||||
@ -180,6 +183,7 @@ func (donatService *ServiceDonat) CreateTestDonat(
|
|||||||
amount,
|
amount,
|
||||||
text,
|
text,
|
||||||
donatUser,
|
donatUser,
|
||||||
|
mediaUrl,
|
||||||
"test_donat",
|
"test_donat",
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user