mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-24 08:20:31 +08:00
Fix payment owner issue
This commit is contained in:
parent
2d04731622
commit
3c30222fce
@ -34,6 +34,7 @@ import (
|
|||||||
// @router /get-messages [get]
|
// @router /get-messages [get]
|
||||||
func (c *ApiController) GetMessages() {
|
func (c *ApiController) GetMessages() {
|
||||||
owner := c.Input().Get("owner")
|
owner := c.Input().Get("owner")
|
||||||
|
organization := c.Input().Get("organization")
|
||||||
limit := c.Input().Get("pageSize")
|
limit := c.Input().Get("pageSize")
|
||||||
page := c.Input().Get("p")
|
page := c.Input().Get("p")
|
||||||
field := c.Input().Get("field")
|
field := c.Input().Get("field")
|
||||||
@ -41,7 +42,7 @@ func (c *ApiController) GetMessages() {
|
|||||||
sortField := c.Input().Get("sortField")
|
sortField := c.Input().Get("sortField")
|
||||||
sortOrder := c.Input().Get("sortOrder")
|
sortOrder := c.Input().Get("sortOrder")
|
||||||
chat := c.Input().Get("chat")
|
chat := c.Input().Get("chat")
|
||||||
organization := c.Input().Get("organization")
|
|
||||||
if limit == "" || page == "" {
|
if limit == "" || page == "" {
|
||||||
var messages []*object.Message
|
var messages []*object.Message
|
||||||
var err error
|
var err error
|
||||||
|
@ -31,6 +31,7 @@ import (
|
|||||||
// @router /get-payments [get]
|
// @router /get-payments [get]
|
||||||
func (c *ApiController) GetPayments() {
|
func (c *ApiController) GetPayments() {
|
||||||
owner := c.Input().Get("owner")
|
owner := c.Input().Get("owner")
|
||||||
|
organization := c.Input().Get("organization")
|
||||||
limit := c.Input().Get("pageSize")
|
limit := c.Input().Get("pageSize")
|
||||||
page := c.Input().Get("p")
|
page := c.Input().Get("p")
|
||||||
field := c.Input().Get("field")
|
field := c.Input().Get("field")
|
||||||
@ -48,13 +49,13 @@ func (c *ApiController) GetPayments() {
|
|||||||
c.ServeJSON()
|
c.ServeJSON()
|
||||||
} else {
|
} else {
|
||||||
limit := util.ParseInt(limit)
|
limit := util.ParseInt(limit)
|
||||||
count, err := object.GetPaymentCount(owner, field, value)
|
count, err := object.GetPaymentCount(owner, organization, field, value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
paginator := pagination.SetPaginator(c.Ctx, limit, count)
|
paginator := pagination.SetPaginator(c.Ctx, limit, count)
|
||||||
payments, err := object.GetPaginationPayments(owner, paginator.Offset(), limit, field, value, sortField, sortOrder)
|
payments, err := object.GetPaginationPayments(owner, organization, paginator.Offset(), limit, field, value, sortField, sortOrder)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -56,9 +56,9 @@ type Payment struct {
|
|||||||
InvoiceUrl string `xorm:"varchar(255)" json:"invoiceUrl"`
|
InvoiceUrl string `xorm:"varchar(255)" json:"invoiceUrl"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetPaymentCount(owner, field, value string) (int64, error) {
|
func GetPaymentCount(owner, organization, field, value string) (int64, error) {
|
||||||
session := GetSession(owner, -1, -1, field, value, "", "")
|
session := GetSession(owner, -1, -1, field, value, "", "")
|
||||||
return session.Count(&Payment{})
|
return session.Count(&Payment{Organization: organization})
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetPayments(owner string) ([]*Payment, error) {
|
func GetPayments(owner string) ([]*Payment, error) {
|
||||||
@ -81,10 +81,10 @@ func GetUserPayments(owner string, organization string, user string) ([]*Payment
|
|||||||
return payments, nil
|
return payments, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetPaginationPayments(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Payment, error) {
|
func GetPaginationPayments(owner, organization string, offset, limit int, field, value, sortField, sortOrder string) ([]*Payment, error) {
|
||||||
payments := []*Payment{}
|
payments := []*Payment{}
|
||||||
session := GetSession(owner, offset, limit, field, value, sortField, sortOrder)
|
session := GetSession(owner, offset, limit, field, value, sortField, sortOrder)
|
||||||
err := session.Find(&payments)
|
err := session.Find(&payments, &Payment{Organization: organization})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ class PaymentListPage extends BaseListPage {
|
|||||||
newPayment() {
|
newPayment() {
|
||||||
const randomName = Setting.getRandomName();
|
const randomName = Setting.getRandomName();
|
||||||
return {
|
return {
|
||||||
owner: this.props.account.owner,
|
owner: "admin",
|
||||||
name: `payment_${randomName}`,
|
name: `payment_${randomName}`,
|
||||||
createdTime: moment().format(),
|
createdTime: moment().format(),
|
||||||
displayName: `New Payment - ${randomName}`,
|
displayName: `New Payment - ${randomName}`,
|
||||||
@ -265,7 +265,7 @@ class PaymentListPage extends BaseListPage {
|
|||||||
value = params.type;
|
value = params.type;
|
||||||
}
|
}
|
||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
PaymentBackend.getPayments(Setting.isAdminUser(this.props.account) ? "" : this.props.account.owner, params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
PaymentBackend.getPayments("admin", Setting.isAdminUser(this.props.account) ? "" : this.props.account.owner, params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@ -33,7 +33,7 @@ class PaymentResultPage extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getPayment() {
|
getPayment() {
|
||||||
PaymentBackend.getPayment(this.props.account.owner, this.state.paymentName)
|
PaymentBackend.getPayment("admin", this.state.paymentName)
|
||||||
.then((payment) => {
|
.then((payment) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
payment: payment,
|
payment: payment,
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
|
|
||||||
import * as Setting from "../Setting";
|
import * as Setting from "../Setting";
|
||||||
|
|
||||||
export function getPayments(owner, page = "", pageSize = "", field = "", value = "", sortField = "", sortOrder = "") {
|
export function getPayments(owner, organization, page = "", pageSize = "", field = "", value = "", sortField = "", sortOrder = "") {
|
||||||
return fetch(`${Setting.ServerUrl}/api/get-payments?owner=${owner}&p=${page}&pageSize=${pageSize}&field=${field}&value=${value}&sortField=${sortField}&sortOrder=${sortOrder}`, {
|
return fetch(`${Setting.ServerUrl}/api/get-payments?owner=${owner}&organization=${organization}&p=${page}&pageSize=${pageSize}&field=${field}&value=${value}&sortField=${sortField}&sortOrder=${sortOrder}`, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
credentials: "include",
|
credentials: "include",
|
||||||
headers: {
|
headers: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user