This commit is contained in:
桀尼龟 2025-02-21 13:27:45 +08:00
parent d7047470e4
commit c2cfcd7899
11 changed files with 623 additions and 1055 deletions

View File

@ -31,10 +31,8 @@ func main() {
if err := bootstrap(); err != nil {
panic(err)
}
r := router.NewRouter()
_ = r.Run(config.AppConfig.System.HttpPort)
select {}
}

View File

@ -7,6 +7,85 @@ import (
"github.com/BurntSushi/toml"
"gopkg.in/ini.v1"
"os"
"strconv"
)
var (
AppMode string
HttpPort string
Key string
Cert string
IsHttps bool
RunHttps bool
Domain string
OssDomain string
ServerDM string
Env string
DriverUrl string
AppointUrl string
MaterialHost string
BosAk string
BosSk string
Endpoint string
BosBucketName string
BosBaseDir string
BosUrl string
BosHttp string
BosDomain string
ProjectMapDir string
JaegerHost string
JaegerOpen bool
Cron bool
DingAccessToken string
DingUrl string
HolidayID string
HolidaySecret string
HolidaySingleUrl string
HolidayMultiUrl string
ErpAk string
ErpSk string
// rabbitmq
RabbitmqUser string
RabbitmqPassword string
RabbitmqHost string
RabbitmqPort int
RabbitmqVhost string
RabbitmqVhostArtwork string
RedisDB int
RedisAddr string
RedisPw string
//shop配置
ShopHost string
//ShopDetail string
// 地图
MapAppCode string
// es
ElasticHost string
SendIndexesUrl string
ChatGptHost string
ApiHost string
Level string
Filename string
MaxSize string
MaxAge string
MaxBackups string
YearGiftCheckHost string
Aliyun struct {
AccessKeyId string
AccessKeySecret string
}
Blockchain struct {
Key string
PubKey string
}
)
/********start-配置信息*********/
@ -104,5 +183,80 @@ func GetOptions() {
LoadServer(file)
}
func LoadServer(file *ini.File) {
AppMode = file.Section("service").Key("AppMode").String()
IsHttps, _ = file.Section("service").Key("IsHTTPS").Bool()
RunHttps, _ = file.Section("service").Key("RunHTTPS").Bool()
Key = file.Section("service").Key("Key").String()
Cert = file.Section("service").Key("Cert").String()
HttpPort = file.Section("service").Key("HttpPort").String()
Domain = file.Section("service").Key("Domain").String()
OssDomain = file.Section("service").Key("OssDomain").String()
ServerDM = file.Section("service").Key("ServerDM").String()
DriverUrl = file.Section("service").Key("DriverUrl").String()
Env = file.Section("service").Key("Env").String()
JaegerHost = file.Section("service").Key("JaegerHost").String()
JaegerOpen, _ = file.Section("service").Key("JaegerOpen").Bool()
Cron, _ = file.Section("service").Key("Cron").Bool()
YearGiftCheckHost = file.Section("service").Key("YearGiftCheckHost").String()
ProjectMapDir = file.Section("file").Key("ProjectMapDir").String()
AppointUrl = file.Section("service").Key("AppointUrl").String()
MaterialHost = file.Section("service").Key("MaterialHost").String()
BosAk = file.Section("bos").Key("Ak").String()
BosSk = file.Section("bos").Key("Sk").String()
BosBucketName = file.Section("bos").Key("BucketName").String()
BosBaseDir = file.Section("bos").Key("BosBaseDir").String()
Endpoint = file.Section("bos").Key("Endpoint").String()
BosUrl = file.Section("bos").Key("BosUrl").String()
BosHttp = file.Section("bos").Key("BosHttp").String()
BosDomain = file.Section("bos").Key("BosDomain").String()
DingUrl = file.Section("ding").Key("Url").String()
DingAccessToken = file.Section("ding").Key("AccessToken").String()
//加载获取万年历配置
HolidayID = file.Section("holiday").Key("ID").String()
HolidaySecret = file.Section("holiday").Key("Secret").String()
HolidaySingleUrl = file.Section("holiday").Key("SingleUrl").String()
HolidayMultiUrl = file.Section("holiday").Key("MultiUrl").String()
// 加载 rabbitmq 配置
RabbitmqUser = file.Section("rabbitmq").Key("User").String()
RabbitmqPassword = file.Section("rabbitmq").Key("Password").String()
RabbitmqHost = file.Section("rabbitmq").Key("Host").String()
RabbitmqPort, _ = file.Section("rabbitmq").Key("Port").Int()
RabbitmqVhost = file.Section("rabbitmq").Key("Vhost").String()
RabbitmqVhostArtwork = file.Section("rabbitmq").Key("VhostArtwork").String()
//加载 redis
dbStr := file.Section("redis").Key("RedisDBNAme").String()
RedisDB, _ = strconv.Atoi(dbStr)
RedisAddr = file.Section("redis").Key("RedisAddr").String()
RedisPw = file.Section("redis").Key("RedisPW").String()
ShopHost = file.Section("shop").Key("ShopHost").String()
//ShopDetail = file.Section("shop").Key("ShopDetail").String()
// 地图
MapAppCode = file.Section("service").Key("MapAppCode").String()
// 地图
ElasticHost = file.Section("es").Key("ElasticHost").String()
SendIndexesUrl = file.Section("api").Key("SendIndexesUrl").String()
ChatGptHost = file.Section("api").Key("chatGptHost").String()
ErpAk = file.Section("api").Key("erpak").String()
ErpSk = file.Section("api").Key("erpsk").String()
ApiHost = file.Section("service").Key("ApiHost").String()
// zap
Level = file.Section("zap").Key("Level").String()
Filename = file.Section("zap").Key("Filename").String()
MaxSize = file.Section("zap").Key("MaxSize").String()
MaxAge = file.Section("zap").Key("MaxAge").String()
MaxBackups = file.Section("zap").Key("MaxBackups").String()
Aliyun.AccessKeyId = file.Section("aliyun").Key("accessKeyId").String()
Aliyun.AccessKeySecret = file.Section("aliyun").Key("accessKeySecret").String()
Blockchain.PubKey = file.Section("blockchain").Key("PubKey").String()
Blockchain.Key = file.Section("blockchain").Key("Key").String()
}

25
cmd/dev/conf.ini Normal file
View File

@ -0,0 +1,25 @@
[system]
Domain = "fiee"
AppMode = "debug"
HttpPort = ":8085"
Host = "http://127.0.0.1:8085"
RedirectUri = "/api/redirect/url"
[bos]
Ak = "ALTAKxrqOQHnAN525Tb2GX4Bhe"
Sk = "d2ecaa9d75114d3b9f42b99014198306"
BucketName = "dci-file-new"
BosUrl = ".bj.bcebos.com"
BosBaseDir = "fonchain-main"
BosHttp = "https://"
[redis]
RedisDB = "1"
RedisAddr = "127.0.0.1:6379"
RedisPW = ""
RedisDBNAme = "1"
[ai]
Host = "https://erpapi.fontree.cn"
TelNum = "18021272627"
Password = "Gy.123456"

16
cmd/dev/dubbogo.yaml Normal file
View File

@ -0,0 +1,16 @@
dubbo:
registries:
demoZK:
protocol: zookeeper
timeout: 5s
address: 127.0.0.1:2181
consumer:
references:
AccountClientImpl:
protocol: tri
retries: 0
interface: com.fontree.microservices.common.account
# filter: cshutdown,sign,fonDomainFilter,fonValidateFilter
# params:
# .accessKeyId: "Accountksl"
# .secretAccessKey: "BSDY-FDF1-Fontree_account"

16
conf/dubbogo.yaml Normal file
View File

@ -0,0 +1,16 @@
dubbo:
registries:
demoZK:
protocol: zookeeper
timeout: 5s
address: 127.0.0.1:2181
consumer:
references:
AccountClientImpl:
protocol: tri
retries: 0
interface: com.fontree.microservices.common.account
# filter: cshutdown,sign,fonDomainFilter,fonValidateFilter
# params:
# .accessKeyId: "Accountksl"
# .secretAccessKey: "BSDY-FDF1-Fontree_account"

275
go.mod
View File

@ -1,158 +1,191 @@
module fonchain-fiee
go 1.21.0
go 1.18
toolchain go1.22rc1
replace (
//github.com/fonchain_enterprise/utils/aes => ./docs/utils/aes
//github.com/fonchain_enterprise/utils/chain => ./docs/utils/chain
//github.com/fonchain_enterprise/utils/jwt => ./docs/utils/jwt
//github.com/fonchain_enterprise/utils/logger => ./docs/utils/logger
//github.com/fonchain_enterprise/utils/rand => ./docs/utils/rand
github.com/fonchain/electronic-contract => ../../electronic-contract
github.com/fonchain_enterprise/utils/aes => ../utils/aes
github.com/fonchain_enterprise/utils/baidu => ../utils/baidu
github.com/fonchain_enterprise/utils/bankQuery => ../utils/bankQuery
github.com/fonchain_enterprise/utils/chain => ../utils/chain
github.com/fonchain_enterprise/utils/feie => ../utils/feie
github.com/fonchain_enterprise/utils/ipAddrQuery => ../utils/ipAddrQuery
github.com/fonchain_enterprise/utils/jwt => ../utils/jwt
github.com/fonchain_enterprise/utils/logger => ../utils/logger
github.com/fonchain_enterprise/utils/objstorage => ../utils/objstorage
github.com/fonchain_enterprise/utils/ocr => ../utils/ocr
github.com/fonchain_enterprise/utils/pay => ../utils/pay
github.com/fonchain_enterprise/utils/rand => ../utils/rand
github.com/fonchain_enterprise/utils/utils => ../utils/utils
require (
dubbo.apache.org/dubbo-go/v3 v3.1.1
github.com/BurntSushi/toml v1.4.0
github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/dubbogo/grpc-go v1.42.10
github.com/dubbogo/triple v1.2.2-rc3
github.com/gin-contrib/gzip v1.2.2
github.com/gin-contrib/pprof v1.5.2
github.com/gin-gonic/gin v1.10.0
github.com/go-redis/redis v6.15.9+incompatible
github.com/golang/protobuf v1.5.4
github.com/mwitkow/go-proto-validators v0.3.2
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
github.com/spf13/viper v1.7.0
google.golang.org/protobuf v1.36.5
gopkg.in/ini.v1 v1.66.2
)
require (
cloud.google.com/go/compute v1.14.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
github.com/RoaringBitmap/roaring v1.2.3 // indirect
dubbo.apache.org/dubbo-go/v3 v3.0.2
github.com/dubbogo/grpc-go v1.42.9
github.com/dubbogo/triple v1.1.8
//github.com/fonchain_enterprise/utils/jwt v0.0.0-00010101000000-000000000000
//github.com/fonchain_enterprise/utils/logger v0.0.0-00010101000000-000000000000
github.com/gin-contrib/gzip v0.0.5
github.com/gin-gonic/gin v1.9.1
github.com/golang/protobuf v1.5.2
github.com/mwitkow/go-proto-validators v0.3.2
github.com/pkg/errors v0.9.1 // indirect
google.golang.org/protobuf v1.31.0
gopkg.in/ini.v1 v1.67.0
)
require (
contrib.go.opencensus.io/exporter/prometheus v0.4.1 // indirect
github.com/RoaringBitmap/roaring v1.1.0 // indirect
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
github.com/Workiva/go-datastructures v1.0.52 // indirect
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 // indirect
github.com/alibaba/sentinel-golang v1.0.4 // indirect
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1704 // indirect
github.com/apache/dubbo-getty v1.4.9 // indirect
github.com/apache/dubbo-go-hessian2 v1.12.2 // indirect
github.com/aliyun/aliyun-oss-go-sdk v2.2.6+incompatible
github.com/apache/dubbo-getty v1.4.8 // indirect
github.com/apache/dubbo-go-hessian2 v1.11.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.2.0 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/bytedance/sonic v1.12.7 // indirect
github.com/bytedance/sonic/loader v0.2.2 // indirect
github.com/census-instrumentation/opencensus-proto v0.4.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe // indirect
github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/creasty/defaults v1.5.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dlclark/regexp2 v1.7.0 // indirect
github.com/dubbogo/go-zookeeper v1.0.4-0.20211212162352-f9d2183d89d5 // indirect
github.com/dubbogo/gost v1.14.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/emicklei/go-restful/v3 v3.10.1 // indirect
github.com/envoyproxy/go-control-plane v0.11.0 // indirect
github.com/envoyproxy/protoc-gen-validate v0.10.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.8 // indirect
github.com/gin-contrib/sse v1.0.0 // indirect
github.com/go-co-op/gocron v1.9.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/dubbogo/gost v1.11.25 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-kit/log v0.1.0 // indirect
github.com/go-logfmt/logfmt v0.5.0 // indirect
github.com/go-ole/go-ole v1.2.4 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.24.0 // indirect
github.com/go-resty/resty/v2 v2.7.0 // indirect
github.com/goccy/go-json v0.10.4 // indirect
github.com/go-playground/validator/v10 v10.14.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/vault/sdk v0.7.0 // indirect
github.com/influxdata/tdigest v0.0.1 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/jinzhu/copier v0.3.5 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/k0kubun/pp v3.0.1+incompatible // indirect
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
github.com/knadh/koanf v1.5.0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/knadh/koanf v1.4.1 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mschoch/smat v0.2.0 // indirect
github.com/nacos-group/nacos-sdk-go/v2 v2.2.2 // indirect
github.com/natefinch/lumberjack v2.0.0+incompatible // indirect
github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852 // indirect
github.com/nacos-group/nacos-sdk-go v1.1.1 // indirect
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/openzipkin/zipkin-go v0.4.0 // indirect
github.com/pelletier/go-toml v1.9.3 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/polarismesh/polaris-go v1.3.0 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/prometheus/client_golang v1.13.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/pelletier/go-toml v1.7.0 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/prometheus/client_golang v1.12.2 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/prometheus/statsd_exporter v0.21.0 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/shirou/gopsutil/v3 v3.22.2 // indirect
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b // indirect
github.com/shirou/gopsutil v3.20.11+incompatible // indirect
github.com/uber/jaeger-client-go v2.29.1+incompatible // indirect
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
go.opencensus.io v0.23.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.21.0 // indirect
golang.org/x/crypto v0.19.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247 // indirect
google.golang.org/grpc v1.47.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
require (
github.com/BurntSushi/toml v1.2.1
github.com/gin-contrib/pprof v1.4.0
github.com/go-redis/redis v6.15.9+incompatible
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
github.com/spf13/viper v1.7.1
)
require (
cloud.google.com/go v0.65.0 // indirect
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 // indirect
github.com/alibaba/sentinel-golang v1.0.4 // indirect
github.com/aliyun/alibaba-cloud-sdk-go v1.61.18 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/bytedance/sonic v1.9.1 // indirect
github.com/census-instrumentation/opencensus-proto v0.2.1 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4 // indirect
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/dubbogo/go-zookeeper v1.0.4-0.20211212162352-f9d2183d89d5 // indirect
github.com/emicklei/go-restful/v3 v3.7.4 // indirect
github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1 // indirect
github.com/envoyproxy/protoc-gen-validate v0.1.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-co-op/gocron v1.9.0 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-resty/resty/v2 v2.7.0 // indirect
github.com/golang/mock v1.5.0 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 // indirect
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/vault/sdk v0.3.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/natefinch/lumberjack v2.0.0+incompatible // indirect
github.com/nxadm/tail v1.4.11 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/onsi/gomega v1.18.1 // indirect
github.com/pierrec/lz4 v2.5.2+incompatible // indirect
github.com/polarismesh/polaris-go v1.1.0 // indirect
github.com/shirou/gopsutil/v3 v3.21.6 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/smartystreets/assertions v1.1.1 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.9.2 // indirect
github.com/spf13/afero v1.3.3 // indirect
github.com/spf13/cast v1.3.0 // indirect
github.com/spf13/jwalterweatherman v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/tklauser/numcpus v0.4.0 // indirect
github.com/tklauser/go-sysconf v0.3.6 // indirect
github.com/tklauser/numcpus v0.2.2 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/uber/jaeger-client-go v2.29.1+incompatible // indirect
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.etcd.io/etcd/api/v3 v3.5.7 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.7 // indirect
go.etcd.io/etcd/client/v3 v3.5.7 // indirect
go.opentelemetry.io/contrib/propagators/b3 v1.10.0 // indirect
go.opentelemetry.io/otel v1.10.0 // indirect
go.opentelemetry.io/otel/exporters/jaeger v1.10.0 // indirect
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.10.0 // indirect
go.opentelemetry.io/otel/exporters/zipkin v1.10.0 // indirect
go.opentelemetry.io/otel/sdk v1.10.0 // indirect
go.opentelemetry.io/otel/trace v1.10.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.21.0 // indirect
golang.org/x/arch v0.13.0 // indirect
golang.org/x/crypto v0.32.0 // indirect
golang.org/x/net v0.34.0 // indirect
golang.org/x/oauth2 v0.6.0 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.1.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef // indirect
google.golang.org/grpc v1.52.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
github.com/zouyx/agollo/v3 v3.4.5 // indirect
go.etcd.io/etcd/api/v3 v3.5.4 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.4 // indirect
go.etcd.io/etcd/client/v3 v3.5.4 // indirect
go.opentelemetry.io/otel v1.7.0 // indirect
go.opentelemetry.io/otel/trace v1.7.0 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.6 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

1115
go.sum

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,8 @@ func CheckLogin(provider *api.AccountClientImpl) gin.HandlerFunc {
//1 获取用户的账号信息
infoReq := &api.UserByTelRequest{
Tel: jwt.Phone,
Tel: jwt.Phone,
Domain: jwt.Domain,
}
infoRes, err := service.AccountProvider.UserByTel(ctx, infoReq)

View File

@ -44,12 +44,17 @@ func NewRouter() *gin.Engine {
r.POST("user/register", account.UserRegister) //h5注册登录
r.POST("user/login", account.UserLogin) //后台登录
r.POST("user/send", account.SendMsg) //发送验证码
r.POST("user/logout", account.UserLogout) //登出
r.POST("user/check/msg", account.CheckMsg) //校验验证码
acRoute := r.Group("/user")
acRoute.POST("logout", account.UserLogout) //登出
acRoute.Use(middleware.CheckLogin(service.AccountProvider))
{
acRoute.POST("real-name", account.RealName) //实名
acRoute.POST("check", account.CheckMsg) //校验验证码
acRoute.POST("info", account.UserInfo) //用户详情
}
{
acRoute.POST("list", account.UserList) //用户列表
acRoute.POST("approval", account.UserApproval) //用户列表
}
}
{
@ -84,11 +89,11 @@ func NewRouter() *gin.Engine {
// 套餐
{
bundleRoute := r.Group("bundle")
//bundleRoute := r.Group("bundle")
bundleClientRoute := bundleRoute.Group("system")
//bundleClientRoute := bundleRoute.Group("system")
{
bundleClientRoute.POST("create", bundle.CreateBundle)
//bundleClientRoute.POST("create", bundle.CreateBundle)
}
}

View File

@ -5,12 +5,59 @@ import (
"fonchain-fiee/api/account"
"fonchain-fiee/pkg/config"
"fonchain-fiee/pkg/e"
"fonchain-fiee/pkg/model/login"
"fonchain-fiee/pkg/model/union"
"fonchain-fiee/pkg/service"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
)
func UserApproval(c *gin.Context) {
var req account.CheckRealNameRequest
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
service.Error(c, err)
return
}
res, err := service.AccountProvider.CheckRealName(context.Background(), &req)
if err != nil {
service.Error(c, err)
return
}
service.Success(c, res)
return
}
func UserList(c *gin.Context) {
var req account.UserListRequest
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
service.Error(c, err)
return
}
req.Domain = "app"
res, err := service.AccountProvider.UserList(context.Background(), &req)
if err != nil {
service.Error(c, err)
return
}
service.Success(c, res)
return
}
func UserInfo(c *gin.Context) {
var req account.InfoRequest
user := login.GetUserInfoFromC(c)
req.ID = user.ID
req.Domain = user.Domain
res, err := service.AccountProvider.Info(context.Background(), &req)
if err != nil {
service.Error(c, err)
return
}
service.Success(c, res)
return
}
// SendMsg 用户登录操作
func SendMsg(c *gin.Context) {
@ -20,7 +67,7 @@ func SendMsg(c *gin.Context) {
service.Error(c, err)
return
}
//req.Domain = "app"
req.SignNo = uint32(config.DefaultSignNo)
res, err := service.AccountProvider.SendMsg(context.Background(), &req)
if err != nil {
@ -38,6 +85,8 @@ func RealName(c *gin.Context) {
service.Error(c, err)
return
}
user := login.GetUserInfoFromC(c)
req.Id = user.ID
res, err := service.AccountProvider.RealName(context.Background(), &req)
if err != nil {
service.Error(c, err)
@ -90,6 +139,7 @@ func UserRegister(c *gin.Context) {
res, err := service.AccountProvider.Register(context.Background(), &req)
if err != nil {
service.Error(c, err)
return
}
tokenInfo, err := service.AccountProvider.Login(context.Background(), &account.LoginRequest{
Domain: req.Domain,
@ -98,9 +148,11 @@ func UserRegister(c *gin.Context) {
})
if err != nil {
service.Error(c, err)
return
}
res.Token = tokenInfo.Token
service.Success(c, res)
return
}
// UserLogin 用户登录操作

View File

@ -12,11 +12,12 @@ import (
)
var AccountProvider = new(account.AccountClientImpl)
var BundleProvider = new(bundle.BundleClientImpl)
func init() {
config.SetConsumerService(AccountProvider)
config.SetConsumerService(BundleProvider)
//config.SetConsumerService(BundleProvider)
if err := config.Load(); err != nil {
panic(err)