兼容 两种写法

This commit is contained in:
474420502 2024-04-08 18:13:01 +08:00
parent 155de853db
commit 864a4a8b4c
72 changed files with 651 additions and 5 deletions

24
.gitignore vendored Normal file
View File

@ -0,0 +1,24 @@
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Dependency directories (remove the comment below to include it)
vendor/
# Go workspace file
go.work
__debug_bin*
.vscode

4
go.mod
View File

@ -3,9 +3,11 @@ module github.com/iapologizewhenimwrong/Vestmore_GO
go 1.22.1
require (
github.com/474420502/generator v0.0.4
github.com/474420502/generator v0.0.6
github.com/gin-gonic/gin v1.9.1
github.com/go-sql-driver/mysql v1.8.1
github.com/golang-jwt/jwt/v5 v5.2.1
github.com/jmoiron/sqlx v1.3.5
)
require (

13
go.sum
View File

@ -1,7 +1,7 @@
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
github.com/474420502/generator v0.0.4 h1:Nt+EGlFk1NlkXD4mm1PGgL//1t19K+0l8eIHnu4AYuo=
github.com/474420502/generator v0.0.4/go.mod h1:rV16HGKggm3CovKAyjc743G0ZPfNXfiBrYgNHjTn3jA=
github.com/474420502/generator v0.0.6 h1:+KYxG/uxY434ychga3Xy32lSPRhjJdjm/QQg7Ak8M7Y=
github.com/474420502/generator v0.0.6/go.mod h1:rV16HGKggm3CovKAyjc743G0ZPfNXfiBrYgNHjTn3jA=
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
github.com/bytedance/sonic v1.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s=
github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U=
@ -26,14 +26,19 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js=
github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y=
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g=
github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
@ -45,8 +50,12 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0=
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-sqlite3 v1.14.6 h1:dNPt6NO46WmLVt2DLNpwczCmdV5boIZ6g/tlDrlRUbg=
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraAdAppModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraAdLaunchModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraAdPcModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraAdPopupModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraAdXcxModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCatalogAndroidModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCatalogBankModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCatalogCountryModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCatalogCurrencyModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCatalogExportModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCatalogFileModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCatalogHolidayModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCatalogInviteModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCatalogLanguageModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCatalogMerchantModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCatalogNoticeModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCatalogServicefeeModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCommissionModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCustomerAccountModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCustomerBalanceModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCustomerCommissionModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCustomerCommissionWithdrawModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCustomerDepositModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCustomerDeviceLogModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCustomerDeviceModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCustomerDistributorModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCustomerExchangeModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCustomerFavouriteModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCustomerFeedbackModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCustomerFundModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCustomerHoldModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCustomerInternationalModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCustomerIpoModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,23 @@
package model
import (
"context"
"fmt"
"github.com/jmoiron/sqlx"
)
type KillaraCustomerModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}
func (m *KillaraCustomerModel) Find(ctx context.Context) (result []*KillaraCustomer, err error) {
var customer []*KillaraCustomer
err = m.db.SelectContext(ctx, customer, fmt.Sprintf("select * from %s", m.TableName))
if err != nil {
return nil, err
}
return customer, nil
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCustomerNewsModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCustomerPointModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCustomerTokenModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCustomerTransactionModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraCustomerWithdrawModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraFundAchievementModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraFundCategoryModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraFundModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraFundNetModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraHelpCategoryModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraHelpModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraHostingDayModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraHostingMagnificationModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraHostingStocksModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraHundsunFundModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraInfoCategoryModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraInfoModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraInformationTermModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraInternationalModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraIpoModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraIpoQtyModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraIpoRatioModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraSettingModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraStockModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraUserGroupModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraUserModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraUserLoginHistoryModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -1,5 +1,11 @@
package model
import (
"github.com/jmoiron/sqlx"
)
type KillaraUserTokenModel struct {
// fields ...
db *sqlx.DB
TableName string // 表名
}

View File

@ -2,8 +2,77 @@ package model
import (
"time"
"github.com/jmoiron/sqlx"
)
var Models *LogicModels = &LogicModels{}
type LogicModels struct {
KillaraAdAppModel *KillaraAdAppModel
KillaraAdLaunchModel *KillaraAdLaunchModel
KillaraAdPcModel *KillaraAdPcModel
KillaraAdPopupModel *KillaraAdPopupModel
KillaraAdXcxModel *KillaraAdXcxModel
KillaraCatalogAndroidModel *KillaraCatalogAndroidModel
KillaraCatalogBankModel *KillaraCatalogBankModel
KillaraCatalogCountryModel *KillaraCatalogCountryModel
KillaraCatalogCurrencyModel *KillaraCatalogCurrencyModel
KillaraCatalogExportModel *KillaraCatalogExportModel
KillaraCatalogFileModel *KillaraCatalogFileModel
KillaraCatalogHolidayModel *KillaraCatalogHolidayModel
KillaraCatalogInviteModel *KillaraCatalogInviteModel
KillaraCatalogLanguageModel *KillaraCatalogLanguageModel
KillaraCatalogMerchantModel *KillaraCatalogMerchantModel
KillaraCatalogNoticeModel *KillaraCatalogNoticeModel
KillaraCatalogServicefeeModel *KillaraCatalogServicefeeModel
KillaraCommissionModel *KillaraCommissionModel
KillaraCustomerModel *KillaraCustomerModel
KillaraCustomerAccountModel *KillaraCustomerAccountModel
KillaraCustomerBalanceModel *KillaraCustomerBalanceModel
KillaraCustomerCommissionModel *KillaraCustomerCommissionModel
KillaraCustomerCommissionWithdrawModel *KillaraCustomerCommissionWithdrawModel
KillaraCustomerDepositModel *KillaraCustomerDepositModel
KillaraCustomerDeviceModel *KillaraCustomerDeviceModel
KillaraCustomerDeviceLogModel *KillaraCustomerDeviceLogModel
KillaraCustomerDistributorModel *KillaraCustomerDistributorModel
KillaraCustomerExchangeModel *KillaraCustomerExchangeModel
KillaraCustomerFavouriteModel *KillaraCustomerFavouriteModel
KillaraCustomerFeedbackModel *KillaraCustomerFeedbackModel
KillaraCustomerFundModel *KillaraCustomerFundModel
KillaraCustomerHoldModel *KillaraCustomerHoldModel
KillaraCustomerInternationalModel *KillaraCustomerInternationalModel
KillaraCustomerIpoModel *KillaraCustomerIpoModel
KillaraCustomerNewsModel *KillaraCustomerNewsModel
KillaraCustomerPointModel *KillaraCustomerPointModel
KillaraCustomerTokenModel *KillaraCustomerTokenModel
KillaraCustomerTransactionModel *KillaraCustomerTransactionModel
KillaraCustomerWithdrawModel *KillaraCustomerWithdrawModel
KillaraFundModel *KillaraFundModel
KillaraFundAchievementModel *KillaraFundAchievementModel
KillaraFundCategoryModel *KillaraFundCategoryModel
KillaraFundNetModel *KillaraFundNetModel
KillaraHelpModel *KillaraHelpModel
KillaraHelpCategoryModel *KillaraHelpCategoryModel
KillaraHostingDayModel *KillaraHostingDayModel
KillaraHostingMagnificationModel *KillaraHostingMagnificationModel
KillaraHostingStocksModel *KillaraHostingStocksModel
KillaraHundsunFundModel *KillaraHundsunFundModel
KillaraInfoModel *KillaraInfoModel
KillaraInfoCategoryModel *KillaraInfoCategoryModel
KillaraInformationTermModel *KillaraInformationTermModel
KillaraInternationalModel *KillaraInternationalModel
KillaraIpoModel *KillaraIpoModel
KillaraIpoQtyModel *KillaraIpoQtyModel
KillaraIpoRatioModel *KillaraIpoRatioModel
KillaraSettingModel *KillaraSettingModel
KillaraStockModel *KillaraStockModel
KillaraUserModel *KillaraUserModel
KillaraUserGroupModel *KillaraUserGroupModel
KillaraUserLoginHistoryModel *KillaraUserLoginHistoryModel
KillaraUserTokenModel *KillaraUserTokenModel
}
// killara_ad_app
type KillaraAdApp struct {
AppId uint64 `db:"app_id"` //
@ -1178,3 +1247,69 @@ type KillaraUserToken struct {
Data *string `db:"data"` //
Expiry int64 `db:"expiry"` //
}
func (models *LogicModels) SetSqlxDriver(driverName string, dataSourceName string) {
db := sqlx.MustOpen(driverName, dataSourceName)
models.KillaraAdAppModel = &KillaraAdAppModel{db: db, TableName: "killara_ad_app"}
models.KillaraAdLaunchModel = &KillaraAdLaunchModel{db: db, TableName: "killara_ad_launch"}
models.KillaraAdPcModel = &KillaraAdPcModel{db: db, TableName: "killara_ad_pc"}
models.KillaraAdPopupModel = &KillaraAdPopupModel{db: db, TableName: "killara_ad_popup"}
models.KillaraAdXcxModel = &KillaraAdXcxModel{db: db, TableName: "killara_ad_xcx"}
models.KillaraCatalogAndroidModel = &KillaraCatalogAndroidModel{db: db, TableName: "killara_catalog_android"}
models.KillaraCatalogBankModel = &KillaraCatalogBankModel{db: db, TableName: "killara_catalog_bank"}
models.KillaraCatalogCountryModel = &KillaraCatalogCountryModel{db: db, TableName: "killara_catalog_country"}
models.KillaraCatalogCurrencyModel = &KillaraCatalogCurrencyModel{db: db, TableName: "killara_catalog_currency"}
models.KillaraCatalogExportModel = &KillaraCatalogExportModel{db: db, TableName: "killara_catalog_export"}
models.KillaraCatalogFileModel = &KillaraCatalogFileModel{db: db, TableName: "killara_catalog_file"}
models.KillaraCatalogHolidayModel = &KillaraCatalogHolidayModel{db: db, TableName: "killara_catalog_holiday"}
models.KillaraCatalogInviteModel = &KillaraCatalogInviteModel{db: db, TableName: "killara_catalog_invite"}
models.KillaraCatalogLanguageModel = &KillaraCatalogLanguageModel{db: db, TableName: "killara_catalog_language"}
models.KillaraCatalogMerchantModel = &KillaraCatalogMerchantModel{db: db, TableName: "killara_catalog_merchant"}
models.KillaraCatalogNoticeModel = &KillaraCatalogNoticeModel{db: db, TableName: "killara_catalog_notice"}
models.KillaraCatalogServicefeeModel = &KillaraCatalogServicefeeModel{db: db, TableName: "killara_catalog_servicefee"}
models.KillaraCommissionModel = &KillaraCommissionModel{db: db, TableName: "killara_commission"}
models.KillaraCustomerModel = &KillaraCustomerModel{db: db, TableName: "killara_customer"}
models.KillaraCustomerAccountModel = &KillaraCustomerAccountModel{db: db, TableName: "killara_customer_account"}
models.KillaraCustomerBalanceModel = &KillaraCustomerBalanceModel{db: db, TableName: "killara_customer_balance"}
models.KillaraCustomerCommissionModel = &KillaraCustomerCommissionModel{db: db, TableName: "killara_customer_commission"}
models.KillaraCustomerCommissionWithdrawModel = &KillaraCustomerCommissionWithdrawModel{db: db, TableName: "killara_customer_commission_withdraw"}
models.KillaraCustomerDepositModel = &KillaraCustomerDepositModel{db: db, TableName: "killara_customer_deposit"}
models.KillaraCustomerDeviceModel = &KillaraCustomerDeviceModel{db: db, TableName: "killara_customer_device"}
models.KillaraCustomerDeviceLogModel = &KillaraCustomerDeviceLogModel{db: db, TableName: "killara_customer_device_log"}
models.KillaraCustomerDistributorModel = &KillaraCustomerDistributorModel{db: db, TableName: "killara_customer_distributor"}
models.KillaraCustomerExchangeModel = &KillaraCustomerExchangeModel{db: db, TableName: "killara_customer_exchange"}
models.KillaraCustomerFavouriteModel = &KillaraCustomerFavouriteModel{db: db, TableName: "killara_customer_favourite"}
models.KillaraCustomerFeedbackModel = &KillaraCustomerFeedbackModel{db: db, TableName: "killara_customer_feedback"}
models.KillaraCustomerFundModel = &KillaraCustomerFundModel{db: db, TableName: "killara_customer_fund"}
models.KillaraCustomerHoldModel = &KillaraCustomerHoldModel{db: db, TableName: "killara_customer_hold"}
models.KillaraCustomerInternationalModel = &KillaraCustomerInternationalModel{db: db, TableName: "killara_customer_international"}
models.KillaraCustomerIpoModel = &KillaraCustomerIpoModel{db: db, TableName: "killara_customer_ipo"}
models.KillaraCustomerNewsModel = &KillaraCustomerNewsModel{db: db, TableName: "killara_customer_news"}
models.KillaraCustomerPointModel = &KillaraCustomerPointModel{db: db, TableName: "killara_customer_point"}
models.KillaraCustomerTokenModel = &KillaraCustomerTokenModel{db: db, TableName: "killara_customer_token"}
models.KillaraCustomerTransactionModel = &KillaraCustomerTransactionModel{db: db, TableName: "killara_customer_transaction"}
models.KillaraCustomerWithdrawModel = &KillaraCustomerWithdrawModel{db: db, TableName: "killara_customer_withdraw"}
models.KillaraFundModel = &KillaraFundModel{db: db, TableName: "killara_fund"}
models.KillaraFundAchievementModel = &KillaraFundAchievementModel{db: db, TableName: "killara_fund_achievement"}
models.KillaraFundCategoryModel = &KillaraFundCategoryModel{db: db, TableName: "killara_fund_category"}
models.KillaraFundNetModel = &KillaraFundNetModel{db: db, TableName: "killara_fund_net"}
models.KillaraHelpModel = &KillaraHelpModel{db: db, TableName: "killara_help"}
models.KillaraHelpCategoryModel = &KillaraHelpCategoryModel{db: db, TableName: "killara_help_category"}
models.KillaraHostingDayModel = &KillaraHostingDayModel{db: db, TableName: "killara_hosting_day"}
models.KillaraHostingMagnificationModel = &KillaraHostingMagnificationModel{db: db, TableName: "killara_hosting_magnification"}
models.KillaraHostingStocksModel = &KillaraHostingStocksModel{db: db, TableName: "killara_hosting_stocks"}
models.KillaraHundsunFundModel = &KillaraHundsunFundModel{db: db, TableName: "killara_hundsun_fund"}
models.KillaraInfoModel = &KillaraInfoModel{db: db, TableName: "killara_info"}
models.KillaraInfoCategoryModel = &KillaraInfoCategoryModel{db: db, TableName: "killara_info_category"}
models.KillaraInformationTermModel = &KillaraInformationTermModel{db: db, TableName: "killara_information_term"}
models.KillaraInternationalModel = &KillaraInternationalModel{db: db, TableName: "killara_international"}
models.KillaraIpoModel = &KillaraIpoModel{db: db, TableName: "killara_ipo"}
models.KillaraIpoQtyModel = &KillaraIpoQtyModel{db: db, TableName: "killara_ipo_qty"}
models.KillaraIpoRatioModel = &KillaraIpoRatioModel{db: db, TableName: "killara_ipo_ratio"}
models.KillaraSettingModel = &KillaraSettingModel{db: db, TableName: "killara_setting"}
models.KillaraStockModel = &KillaraStockModel{db: db, TableName: "killara_stock"}
models.KillaraUserModel = &KillaraUserModel{db: db, TableName: "killara_user"}
models.KillaraUserGroupModel = &KillaraUserGroupModel{db: db, TableName: "killara_user_group"}
models.KillaraUserLoginHistoryModel = &KillaraUserLoginHistoryModel{db: db, TableName: "killara_user_login_history"}
models.KillaraUserTokenModel = &KillaraUserTokenModel{db: db, TableName: "killara_user_token"}
}

View File

@ -0,0 +1,8 @@
package account
import "github.com/gin-gonic/gin"
// 注册使用email
func PostRegisterWithEmail(ctx *gin.Context) {
}

View File

@ -15,6 +15,7 @@ import (
func BaseGetToken(ctx *gin.Context) {
param := &BaseGetTokenParam{}
ctx.ShouldBind(param)
// model.Models.KillaraCustomerModel.Find()
log.Println()
}
@ -30,7 +31,9 @@ func BaseGetToken(ctx *gin.Context) {
// version?: string;
func AccountLoginWithTelephonePassword(ctx *gin.Context) {
// ctx.ShouldBind()
log.Println()
// model.Models.KillaraCustomerModel.Find()
// log.Println(param)
}
// @Action account/registerSmsCode
@ -62,6 +65,7 @@ func AccountForgetSmsCode(ctx *gin.Context) {
// token: string;
func AccountRegisterEmailCode(ctx *gin.Context) {
// ctx.ShouldBind()
log.Println()
}

View File

@ -4,16 +4,26 @@ import (
"log"
"github.com/gin-gonic/gin"
"github.com/iapologizewhenimwrong/Vestmore_GO/model"
"github.com/iapologizewhenimwrong/Vestmore_GO/server/app/internal/handlers"
_ "github.com/go-sql-driver/mysql"
)
func AppV10(ctx *gin.Context) {
if actionKey, ok := ctx.GetPostForm("action"); ok {
// if token, ok := ctx.GetPostForm("token"); ok {
// }
handlers.HandlersFuncRoutes[actionKey](ctx)
}
}
func main() {
model.Models.SetSqlxDriver("mysql", "php:aFk3i4Dj#76!4sd@tcp(47.243.100.6:3306)/zunxinfinance?charset=utf8mb4&timeout=10s")
r := gin.Default()
v10 := r.Group("app")

View File

@ -1,7 +1,16 @@
package main
import "testing"
import (
"context"
"testing"
"github.com/iapologizewhenimwrong/Vestmore_GO/model"
_ "github.com/go-sql-driver/mysql"
)
func TestMain(t *testing.T) {
model.Models.SetSqlxDriver("mysql", "php:aFk3i4Dj#76!4sd@tcp(47.243.100.6:3306)/zunxinfinance?parseTime=true&charset=utf8mb4&timeout=10s")
model.Models.KillaraCustomerModel.Find(context.TODO())
main()
}

27
utils/auth/auth.go Normal file
View File

@ -0,0 +1,27 @@
package auth
import (
"fmt"
"github.com/golang-jwt/jwt/v5"
)
func ParseToken(tokenstring string, password string, payload jwt.Claims) error {
_, err := jwt.ParseWithClaims(tokenstring, payload, func(t *jwt.Token) (interface{}, error) {
// 验证令牌的签名方法
if _, ok := t.Method.(*jwt.SigningMethodHMAC); !ok {
return nil, fmt.Errorf("unexpected signing method: %v", t.Header["alg"])
}
return []byte(password), nil
})
if err != nil {
return err
}
return nil
}
func SignToken(password string, payload jwt.Claims) (tokenstring string, err error) {
return jwt.NewWithClaims(jwt.SigningMethodHS256, payload).SignedString([]byte(password))
}

34
utils/auth/auth_test.go Normal file
View File

@ -0,0 +1,34 @@
package auth
import (
"log"
"testing"
"time"
"github.com/golang-jwt/jwt/v5"
)
type VestMoreClaims struct {
CustomerId int64 `json:"customer_id"`
Version string `json:"version"`
jwt.RegisteredClaims
}
func TestSignTokenAndParseToken(t *testing.T) {
pwdhash := "123131"
vm := &VestMoreClaims{
RegisteredClaims: jwt.RegisteredClaims{
IssuedAt: jwt.NewNumericDate(time.Now()),
ExpiresAt: jwt.NewNumericDate(time.Now().UTC().Add(1 * time.Hour)), // 设置过期时间为当前时间加24小时
Issuer: "vermore",
},
}
tstr, err := SignToken(pwdhash, vm)
if err != nil {
panic(err)
}
log.Println(tstr)
vmr := &VestMoreClaims{}
log.Println(ParseToken(tstr, pwdhash, vmr))
log.Println(vmr)
}