使用gorm 实现 php现在的逻辑
This commit is contained in:
parent
13782b799e
commit
ad3c959586
7
go.mod
7
go.mod
|
@ -3,12 +3,13 @@ module github.com/iapologizewhenimwrong/Vestmore_GO
|
||||||
go 1.22.1
|
go 1.22.1
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/474420502/generator v0.0.6
|
github.com/474420502/generator v0.0.10
|
||||||
github.com/gin-gonic/gin v1.9.1
|
github.com/gin-gonic/gin v1.9.1
|
||||||
github.com/go-sql-driver/mysql v1.8.1
|
github.com/go-sql-driver/mysql v1.8.1
|
||||||
github.com/golang-jwt/jwt/v5 v5.2.1
|
github.com/golang-jwt/jwt/v5 v5.2.1
|
||||||
github.com/jmoiron/sqlx v1.3.5
|
|
||||||
github.com/sirupsen/logrus v1.9.3
|
github.com/sirupsen/logrus v1.9.3
|
||||||
|
gorm.io/driver/mysql v1.5.6
|
||||||
|
gorm.io/gorm v1.25.9
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
@ -21,6 +22,8 @@ require (
|
||||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||||
github.com/go-playground/validator/v10 v10.14.0 // indirect
|
github.com/go-playground/validator/v10 v10.14.0 // indirect
|
||||||
github.com/goccy/go-json v0.10.2 // indirect
|
github.com/goccy/go-json v0.10.2 // indirect
|
||||||
|
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||||
|
github.com/jinzhu/now v1.1.5 // indirect
|
||||||
github.com/json-iterator/go v1.1.12 // indirect
|
github.com/json-iterator/go v1.1.12 // indirect
|
||||||
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
|
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
|
||||||
github.com/kr/text v0.2.0 // indirect
|
github.com/kr/text v0.2.0 // indirect
|
||||||
|
|
21
go.sum
21
go.sum
|
@ -1,7 +1,7 @@
|
||||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||||
github.com/474420502/generator v0.0.6 h1:+KYxG/uxY434ychga3Xy32lSPRhjJdjm/QQg7Ak8M7Y=
|
github.com/474420502/generator v0.0.10 h1:ftWAuhTjgibMMVRUW0iJhi92Es9B/NHeZYtn1K8rTaI=
|
||||||
github.com/474420502/generator v0.0.6/go.mod h1:rV16HGKggm3CovKAyjc743G0ZPfNXfiBrYgNHjTn3jA=
|
github.com/474420502/generator v0.0.10/go.mod h1:iQ2V8rik9Ff4XKrxIpKlrVat8H8IaEJc5Lyo2qlcKX0=
|
||||||
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
|
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 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s=
|
||||||
github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U=
|
github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U=
|
||||||
|
@ -26,7 +26,7 @@ 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/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 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js=
|
||||||
github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
|
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.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
|
||||||
github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y=
|
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/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 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
|
||||||
|
@ -37,8 +37,10 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS
|
||||||
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
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/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/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g=
|
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
||||||
github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ=
|
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||||
|
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
|
||||||
|
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
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/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=
|
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||||
|
@ -50,12 +52,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
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 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
|
||||||
github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
|
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 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
|
||||||
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
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-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 h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
|
@ -109,4 +107,9 @@ gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
gorm.io/driver/mysql v1.5.6 h1:Ld4mkIickM+EliaQZQx3uOJDJHtrd70MxAUqWqlx3Y8=
|
||||||
|
gorm.io/driver/mysql v1.5.6/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM=
|
||||||
|
gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
|
||||||
|
gorm.io/gorm v1.25.9 h1:wct0gxZIELDk8+ZqF/MVnHLkA1rvYlBWUMv2EdsK1g8=
|
||||||
|
gorm.io/gorm v1.25.9/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
|
||||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraAdAppModel struct {
|
type KillaraAdAppModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraAdLaunchModel struct {
|
type KillaraAdLaunchModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraAdPcModel struct {
|
type KillaraAdPcModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraAdPopupModel struct {
|
type KillaraAdPopupModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraAdXcxModel struct {
|
type KillaraAdXcxModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCatalogAndroidModel struct {
|
type KillaraCatalogAndroidModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCatalogBankModel struct {
|
type KillaraCatalogBankModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCatalogCountryModel struct {
|
type KillaraCatalogCountryModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCatalogCurrencyModel struct {
|
type KillaraCatalogCurrencyModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCatalogExportModel struct {
|
type KillaraCatalogExportModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCatalogFileModel struct {
|
type KillaraCatalogFileModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCatalogHolidayModel struct {
|
type KillaraCatalogHolidayModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCatalogInviteModel struct {
|
type KillaraCatalogInviteModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCatalogLanguageModel struct {
|
type KillaraCatalogLanguageModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCatalogMerchantModel struct {
|
type KillaraCatalogMerchantModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCatalogNoticeModel struct {
|
type KillaraCatalogNoticeModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCatalogServicefeeModel struct {
|
type KillaraCatalogServicefeeModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCommissionModel struct {
|
type KillaraCommissionModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCustomerAccountModel struct {
|
type KillaraCustomerAccountModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCustomerBalanceModel struct {
|
type KillaraCustomerBalanceModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCustomerCommissionModel struct {
|
type KillaraCustomerCommissionModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCustomerCommissionWithdrawModel struct {
|
type KillaraCustomerCommissionWithdrawModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCustomerDepositModel struct {
|
type KillaraCustomerDepositModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCustomerDeviceLogModel struct {
|
type KillaraCustomerDeviceLogModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCustomerDeviceModel struct {
|
type KillaraCustomerDeviceModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCustomerDistributorModel struct {
|
type KillaraCustomerDistributorModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCustomerExchangeModel struct {
|
type KillaraCustomerExchangeModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCustomerFavouriteModel struct {
|
type KillaraCustomerFavouriteModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCustomerFeedbackModel struct {
|
type KillaraCustomerFeedbackModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCustomerFundModel struct {
|
type KillaraCustomerFundModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCustomerHoldModel struct {
|
type KillaraCustomerHoldModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCustomerInternationalModel struct {
|
type KillaraCustomerInternationalModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCustomerIpoModel struct {
|
type KillaraCustomerIpoModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,49 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"gorm.io/gorm"
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/jmoiron/sqlx"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
/**
|
|
||||||
* 禁止A仓交易,1:是;2:否
|
|
||||||
*/
|
|
||||||
Disable_A_No = 2
|
|
||||||
Type_2 = 2
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCustomerModel struct {
|
type KillaraCustomerModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
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
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *KillaraCustomerModel) InsertCustomer(data *KillaraCustomer) (int64, error) {
|
|
||||||
result, err := m.db.NamedExec(`INSERT INTO customer (type, realname, code, telephone, email, nickname, name, status, disable_a, parent_id)
|
|
||||||
VALUES (:type, :realname, :code, :telephone, :email, :nickname, :name, :status, :disable_a, :parent_id)`, data)
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
id, err := result.LastInsertId()
|
|
||||||
return id, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *KillaraCustomerModel) UpdateCustomer(id int64, data *KillaraCustomer) error {
|
|
||||||
_, err := m.db.NamedExec(
|
|
||||||
`UPDATE customer SET type=:type, realname=:realname, code=:code, telephone=:telephone, email=:email, nickname=:nickname, name=:name, status=:status, disable_a=:disable_a, parent_id=:parent_id WHERE customer_id=:customer_id`,
|
|
||||||
data,
|
|
||||||
)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCustomerNewsModel struct {
|
type KillaraCustomerNewsModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCustomerPointModel struct {
|
type KillaraCustomerPointModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCustomerTokenModel struct {
|
type KillaraCustomerTokenModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCustomerTransactionModel struct {
|
type KillaraCustomerTransactionModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraCustomerWithdrawModel struct {
|
type KillaraCustomerWithdrawModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraFundAchievementModel struct {
|
type KillaraFundAchievementModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraFundCategoryModel struct {
|
type KillaraFundCategoryModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraFundModel struct {
|
type KillaraFundModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraFundNetModel struct {
|
type KillaraFundNetModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraHelpCategoryModel struct {
|
type KillaraHelpCategoryModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraHelpModel struct {
|
type KillaraHelpModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraHostingDayModel struct {
|
type KillaraHostingDayModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraHostingMagnificationModel struct {
|
type KillaraHostingMagnificationModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraHostingStocksModel struct {
|
type KillaraHostingStocksModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraHundsunFundModel struct {
|
type KillaraHundsunFundModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraInfoCategoryModel struct {
|
type KillaraInfoCategoryModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraInfoModel struct {
|
type KillaraInfoModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraInformationTermModel struct {
|
type KillaraInformationTermModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraInternationalModel struct {
|
type KillaraInternationalModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraIpoModel struct {
|
type KillaraIpoModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraIpoQtyModel struct {
|
type KillaraIpoQtyModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraIpoRatioModel struct {
|
type KillaraIpoRatioModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraSettingModel struct {
|
type KillaraSettingModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraStockModel struct {
|
type KillaraStockModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraUserGroupModel struct {
|
type KillaraUserGroupModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraUserModel struct {
|
type KillaraUserModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraUserLoginHistoryModel struct {
|
type KillaraUserLoginHistoryModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jmoiron/sqlx"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KillaraUserTokenModel struct {
|
type KillaraUserTokenModel struct {
|
||||||
// fields ...
|
// fields ...
|
||||||
db *sqlx.DB
|
db *gorm.DB
|
||||||
TableName string // 表名
|
TableName string // 表名
|
||||||
}
|
}
|
||||||
|
|
2107
model/types_gen.go
2107
model/types_gen.go
File diff suppressed because it is too large
Load Diff
13
model/var.go
13
model/var.go
|
@ -1 +1,14 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/driver/mysql"
|
||||||
|
"gorm.io/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ModelInit(mysqlDNS string) {
|
||||||
|
db, err := gorm.Open(mysql.Open(mysqlDNS))
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
Models.SetGormDriver(db)
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
|
|
||||||
|
额外. 邮件验证码传递密钥,验证码的传递
|
||||||
|
|
||||||
# 记录需要修改的问题
|
# 记录需要修改的问题
|
||||||
1. 邮件验证码传递密钥,验证码的传递
|
1. 登录的token实现方式规范设计,可能存在不少漏洞和错误
|
||||||
|
2. 经过workerman的方法失败了也返回正确
|
||||||
|
3. 链接太长
|
||||||
|
4. 日志设计不完善。
|
||||||
|
5. 没事务回滚
|
|
@ -11,6 +11,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
@ -66,6 +67,7 @@ func genFile(tpl *template.Template, executeTemplate string, genFilePath string,
|
||||||
}
|
}
|
||||||
|
|
||||||
type actionsFunc struct {
|
type actionsFunc struct {
|
||||||
|
ModuleName string
|
||||||
ActionName string
|
ActionName string
|
||||||
FuncName string
|
FuncName string
|
||||||
ParamStruct *paramStruct
|
ParamStruct *paramStruct
|
||||||
|
@ -84,8 +86,10 @@ type paramStruct struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func getActionsInfo() map[string]*actionsFunc {
|
func getActionsInfo() map[string]*actionsFunc {
|
||||||
|
|
||||||
regActionRe := regexp.MustCompile(`(?i)action +([^ ]+)`)
|
regActionRe := regexp.MustCompile(`(?i)action +([^ ]+)`)
|
||||||
paramStructRe := regexp.MustCompile(` +([a-zA-Z_\-/]+)(\?{0,1}): +(\w+) ?;`)
|
paramStructRe := regexp.MustCompile(` +([a-zA-Z_\-/]+)(\?{0,1}): +(\w+) ?;`)
|
||||||
|
moduleName := GetModuleName(6)
|
||||||
|
|
||||||
dir := "actions"
|
dir := "actions"
|
||||||
actionsMap := make(map[string]*actionsFunc)
|
actionsMap := make(map[string]*actionsFunc)
|
||||||
|
@ -118,6 +122,7 @@ func getActionsInfo() map[string]*actionsFunc {
|
||||||
matches := regActionRe.FindStringSubmatch(comment.Text)
|
matches := regActionRe.FindStringSubmatch(comment.Text)
|
||||||
if len(matches) != 0 {
|
if len(matches) != 0 {
|
||||||
af = &actionsFunc{
|
af = &actionsFunc{
|
||||||
|
ModuleName: moduleName,
|
||||||
ActionName: matches[1],
|
ActionName: matches[1],
|
||||||
FuncName: fn.Name.Name,
|
FuncName: fn.Name.Name,
|
||||||
}
|
}
|
||||||
|
@ -191,3 +196,42 @@ func toCamelCase(s string) string {
|
||||||
}
|
}
|
||||||
return sb.String()
|
return sb.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetModuleName(maxDepth int) string {
|
||||||
|
gomodPath, err := FindGoModFile(maxDepth, "go.mod")
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
// 解析当前目录
|
||||||
|
data, err := os.ReadFile(gomodPath)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
matches := regexp.MustCompile(`module +([^ \n]+)`).FindStringSubmatch(string(data))
|
||||||
|
if len(matches) == 0 {
|
||||||
|
panic("can't find module name")
|
||||||
|
}
|
||||||
|
return matches[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
func FindGoModFile(maxDepth int, fileName string) (string, error) {
|
||||||
|
_, currentFile, _, ok := runtime.Caller(0)
|
||||||
|
if !ok {
|
||||||
|
return "", fmt.Errorf("failed to get current file path")
|
||||||
|
}
|
||||||
|
|
||||||
|
currentDir := filepath.Dir(currentFile)
|
||||||
|
for i := 0; i < maxDepth; i++ {
|
||||||
|
modFilePath := filepath.Join(currentDir, fileName)
|
||||||
|
_, err := os.Stat(modFilePath)
|
||||||
|
if err == nil {
|
||||||
|
return modFilePath, nil
|
||||||
|
} else if !os.IsNotExist(err) {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
currentDir = filepath.Dir(currentDir)
|
||||||
|
}
|
||||||
|
|
||||||
|
return "", fmt.Errorf("go.mod file not found within %d parent directories", maxDepth)
|
||||||
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@ package actions
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/iapologizewhenimwrong/Vestmore_GO/utils/basic"
|
"{{.ModuleName}}/utils/basic"
|
||||||
"github.com/iapologizewhenimwrong/Vestmore_GO/utils/log"
|
"{{.ModuleName}}/utils/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
var HandlersFuncRoutes map[string]gin.HandlerFunc = make(map[string]gin.HandlerFunc)
|
var HandlersFuncRoutes map[string]gin.HandlerFunc = make(map[string]gin.HandlerFunc)
|
||||||
|
|
|
@ -26,7 +26,8 @@ func AppV1_0(ctx *gin.Context) {
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
log.SetFlags(log.Llongfile)
|
log.SetFlags(log.Llongfile)
|
||||||
model.Models.SetSqlxDriver("mysql", "php:aFk3i4Dj#76!4sd@tcp(47.243.100.6:3306)/zunxinfinance?charset=utf8mb4&timeout=10s")
|
|
||||||
|
model.ModelInit("php:aFk3i4Dj#76!4sd@tcp(47.243.100.6:3306)/zunxinfinance?charset=utf8mb4&timeout=10s")
|
||||||
|
|
||||||
r := gin.Default()
|
r := gin.Default()
|
||||||
cors.SetCors(r)
|
cors.SetCors(r)
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log"
|
||||||
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
_ "github.com/go-sql-driver/mysql"
|
_ "github.com/go-sql-driver/mysql"
|
||||||
|
@ -11,3 +13,12 @@ func TestMain(t *testing.T) {
|
||||||
// model.Models.KillaraCustomerModel.Find(context.TODO())
|
// model.Models.KillaraCustomerModel.Find(context.TODO())
|
||||||
main()
|
main()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestCaseZero(t *testing.T) {
|
||||||
|
var a string = ""
|
||||||
|
var b string
|
||||||
|
var c int = 1
|
||||||
|
a = ""
|
||||||
|
|
||||||
|
log.Println(reflect.ValueOf(a).IsZero(), reflect.ValueOf(b).IsZero(), reflect.ValueOf(c).IsZero())
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user