mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-19 09:14:27 +08:00
format code
This commit is contained in:
@@ -260,13 +260,13 @@ func (a *TransactionsApi) TransactionModifyHandler(c *core.Context) (interface{}
|
|||||||
removeTransactionTagIds := utils.Int64SliceMinus(transactionTagIds, tagIds)
|
removeTransactionTagIds := utils.Int64SliceMinus(transactionTagIds, tagIds)
|
||||||
|
|
||||||
newTransaction := &models.Transaction{
|
newTransaction := &models.Transaction{
|
||||||
TransactionId: transaction.TransactionId,
|
TransactionId: transaction.TransactionId,
|
||||||
Uid: uid,
|
Uid: uid,
|
||||||
CategoryId: transactionModifyReq.CategoryId,
|
CategoryId: transactionModifyReq.CategoryId,
|
||||||
TransactionTime: utils.GetMinTransactionTimeFromUnixTime(transactionModifyReq.Time),
|
TransactionTime: utils.GetMinTransactionTimeFromUnixTime(transactionModifyReq.Time),
|
||||||
AccountId: transactionModifyReq.SourceAccountId,
|
AccountId: transactionModifyReq.SourceAccountId,
|
||||||
Amount: transactionModifyReq.SourceAmount,
|
Amount: transactionModifyReq.SourceAmount,
|
||||||
Comment: transactionModifyReq.Comment,
|
Comment: transactionModifyReq.Comment,
|
||||||
}
|
}
|
||||||
|
|
||||||
if transaction.Type == models.TRANSACTION_DB_TYPE_TRANSFER_OUT {
|
if transaction.Type == models.TRANSACTION_DB_TYPE_TRANSFER_OUT {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ func JWTAuthorization(c *core.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// JWTAuthorizationByQueryString verifies whether current request is valid by jwt token
|
// JWTAuthorizationByQueryString verifies whether current request is valid by jwt token
|
||||||
func JWTAuthorizationByQueryString(c *core.Context) {
|
func JWTAuthorizationByQueryString(c *core.Context) {
|
||||||
token, exists := c.GetQuery(tokenQueryStringParam)
|
token, exists := c.GetQuery(tokenQueryStringParam)
|
||||||
|
|
||||||
if !exists {
|
if !exists {
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ func (s *TransactionService) GetTransactionsByMaxTime(uid int64, maxTime int64,
|
|||||||
|
|
||||||
if keyword != "" {
|
if keyword != "" {
|
||||||
condition = condition + " AND comment LIKE ?"
|
condition = condition + " AND comment LIKE ?"
|
||||||
conditionParams = append(conditionParams, "%%" + keyword + "%%")
|
conditionParams = append(conditionParams, "%%"+keyword+"%%")
|
||||||
}
|
}
|
||||||
|
|
||||||
if maxTime > 0 {
|
if maxTime > 0 {
|
||||||
@@ -174,7 +174,7 @@ func (s *TransactionService) GetTransactionsInMonthByPage(uid int64, year int, m
|
|||||||
|
|
||||||
if keyword != "" {
|
if keyword != "" {
|
||||||
condition = condition + " AND comment LIKE ?"
|
condition = condition + " AND comment LIKE ?"
|
||||||
conditionParams = append(conditionParams, "%%" + keyword + "%%")
|
conditionParams = append(conditionParams, "%%"+keyword+"%%")
|
||||||
}
|
}
|
||||||
|
|
||||||
err = s.UserDataDB(uid).Where(condition, conditionParams...).Limit(count, count*(page-1)).OrderBy("transaction_time desc").Find(&transactions)
|
err = s.UserDataDB(uid).Where(condition, conditionParams...).Limit(count, count*(page-1)).OrderBy("transaction_time desc").Find(&transactions)
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@ func PrintJsonSuccessResult(c *core.Context, result interface{}) {
|
|||||||
// PrintDataSuccessResult writes success response in custom content type to current http context
|
// PrintDataSuccessResult writes success response in custom content type to current http context
|
||||||
func PrintDataSuccessResult(c *core.Context, contentType string, fileName string, result []byte) {
|
func PrintDataSuccessResult(c *core.Context, contentType string, fileName string, result []byte) {
|
||||||
if fileName != "" {
|
if fileName != "" {
|
||||||
c.Header("Content-Disposition", "attachment;filename=" + fileName)
|
c.Header("Content-Disposition", "attachment;filename="+fileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data(http.StatusOK, contentType, result)
|
c.Data(http.StatusOK, contentType, result)
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package utils
|
|||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
unixTimeFormat = "1136239445"
|
unixTimeFormat = "1136239445"
|
||||||
longDateTimeFormat = "2006-01-02 15:04:05"
|
longDateTimeFormat = "2006-01-02 15:04:05"
|
||||||
longDateTimeWithoutSecondFormat = "2006-01-02 15:04"
|
longDateTimeWithoutSecondFormat = "2006-01-02 15:04"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user