mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-01-23 02:40:23 +08:00
commit
ffce905371
@ -10,7 +10,7 @@ gf run main.go
|
||||
|
||||
# web端
|
||||
cd web
|
||||
yarn dev
|
||||
pnpm run dev 或 npm run dev
|
||||
```
|
||||
|
||||
以下是一个关联表的CURD生成流程
|
||||
|
@ -10,7 +10,7 @@ gf run main.go
|
||||
|
||||
# web端
|
||||
cd web
|
||||
yarn dev
|
||||
pnpm run dev 或 npm run dev
|
||||
```
|
||||
|
||||
以下是一个基本的CURD生成流程
|
||||
|
@ -10,7 +10,7 @@ gf run main.go
|
||||
|
||||
# web端
|
||||
cd web
|
||||
yarn dev
|
||||
pnpm run dev 或 npm run dev
|
||||
```
|
||||
|
||||
以下是一个基本的树形CURD生成流程
|
||||
|
@ -41,7 +41,7 @@ cd server && make build
|
||||
cd server # 切换到服务端目录下
|
||||
rm -rf ./resource/public/admin/ # 删除之前的web资源
|
||||
mkdir ./resource/public/admin/ # 重新创建web资源存放目录,除首次编译后续可以跳过执行此步骤
|
||||
cd ../web && yarn build # 切换到web项目下,编译web项目
|
||||
cd ../web && pnpm run build # 切换到web项目下,编译web项目
|
||||
\cp -rf ./dist/* ../server/resource/public/admin/ # 将编译好的web资源复制到server对应的资源存放路径下
|
||||
cd ../server # 切换回服务端目录下
|
||||
echo "y" | gf build # 编译hotgo服务端
|
||||
@ -58,7 +58,7 @@ echo "y" | gf build # 编译hotgo服务端
|
||||
|
||||
# 编译web端
|
||||
cd web
|
||||
yarn build
|
||||
pnpm run build 或 npm run build
|
||||
|
||||
# web端编译完成后,将web/dist/*中的文件上传到`server`端线上运行目录:/resource/public/admin即可
|
||||
# 至此,web端和server端都可以独立覆盖更新
|
||||
|
@ -11,8 +11,8 @@
|
||||
1. 前往https://nodejs.org/zh-cn/下载当前版本node
|
||||
2. 命令行运行 `node -v` 若控制台输出版本号则node安装成功
|
||||
3. node 版本需大于等于 `16.0`
|
||||
4. 安装yarn:`npm install -g yarn`
|
||||
5. 命令行运行 `yarn -v` 若控制台输出版本号则前端环境搭建成功
|
||||
4. 安装pnpm:`npm install -g pnpm`
|
||||
5. 命令行运行 `pnpm -v` 若控制台输出版本号则前端环境搭建成功
|
||||
|
||||
### 后端环境
|
||||
1. 下载golang安装 版本号需>=1.21
|
||||
|
@ -88,13 +88,13 @@ gfcli:
|
||||
2、web前端:
|
||||
```shell script
|
||||
cd web
|
||||
# 首先确定你以安装node16.0以上版本并安装了包[npm、yarn],否则可能会出现一些未知报错
|
||||
# 首先确定你以安装node16.0以上版本并安装了包[npm、pnpm],否则可能会出现一些未知报错
|
||||
|
||||
# 安装依赖
|
||||
yarn install
|
||||
pnpm install
|
||||
|
||||
# 启动web项目
|
||||
yarn dev
|
||||
pnpm run dev
|
||||
|
||||
# 如果顺利,至此到浏览器打开:http://你的IP:8001/admin
|
||||
# 登录账号:admin, 密码:123456
|
||||
|
@ -128,7 +128,7 @@ gfcli:
|
||||
### 生成CRUD表格
|
||||
|
||||
- 推荐使用热编译方式启动HotGo,这样生成完成页面自动刷新即可看到新生成内容,无需手动重启
|
||||
- 服务端热编译启动:`gf run main.go`, web前端启动:`yarn dev`
|
||||
- 服务端热编译启动:`gf run main.go`, web前端启动:`pnpm run dev` 或 `npm run dev`
|
||||
|
||||
1、创建数据表
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
项目开发完成之后,执行以下命令进行构建
|
||||
```shell
|
||||
yarn build
|
||||
pnpm run build 或 npm run build
|
||||
```
|
||||
构建打包成功之后,会在根目录生成 dist 文件夹,里面就是构建打包好的文件
|
||||
|
||||
@ -40,15 +40,15 @@ VITE_LEGACY = true
|
||||
使用项目自定的命令进行预览(推荐)
|
||||
```shell
|
||||
# 先打包在进行预览
|
||||
yarn preview
|
||||
pnpm run preview 或 npm run preview
|
||||
# 直接预览本地 dist 文件目录
|
||||
yarn preview:dist
|
||||
pnpm run preview:dist 或 npm run preview:dist
|
||||
```
|
||||
|
||||
- 本地服务器预览(通过 live-server)
|
||||
```shell
|
||||
# 1.全局安装live-server
|
||||
yarn global add live-server
|
||||
npm -g install live-server
|
||||
# 2. 进入打包的后目录
|
||||
cd ./dist
|
||||
# 本地预览,默认端口8080
|
||||
@ -60,7 +60,7 @@ live-server --port 9000
|
||||
### 分析构建文件体积
|
||||
如果你的构建文件很大,可以通过项目内置 [rollup-plugin-analyzer](https://github.com/doesdev/rollup-plugin-analyzer) 插件进行代码体积分析,从而优化你的代码。
|
||||
```shell
|
||||
yarn report
|
||||
pnpm run report 或 npm run report
|
||||
```
|
||||
运行之后,在自动打开的页面可以看到具体的体积分布,以分析哪些依赖有问题。
|
||||
|
||||
|
@ -9,7 +9,7 @@ ADMIN_RESOURCE_PATH = "/resource/public/admin/"
|
||||
build:
|
||||
@rm -rf ./$(ADMIN_RESOURCE_PATH)
|
||||
@mkdir ./$(ADMIN_RESOURCE_PATH)
|
||||
@cd ../web && yarn build && \cp -rf ./dist/* ../server$(ADMIN_RESOURCE_PATH)
|
||||
@cd ../web && pnpm run build && \cp -rf ./dist/* ../server$(ADMIN_RESOURCE_PATH)
|
||||
@cd ../server
|
||||
@echo "y" | gf build
|
||||
|
||||
@ -37,7 +37,7 @@ auth:
|
||||
# 启动web服务
|
||||
.PHONY: web
|
||||
web:
|
||||
@cd ../web && yarn dev
|
||||
@cd ../web && pnpm run dev
|
||||
|
||||
# 刷新casbin权限
|
||||
.PHONY: refresh
|
||||
|
153
server/go.mod
153
server/go.mod
@ -1,85 +1,92 @@
|
||||
module hotgo
|
||||
|
||||
go 1.21
|
||||
|
||||
toolchain go1.22.1
|
||||
go 1.23.0
|
||||
|
||||
require (
|
||||
github.com/Shopify/sarama v1.34.1
|
||||
github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.8
|
||||
github.com/alibabacloud-go/dysmsapi-20170525/v3 v3.0.5
|
||||
github.com/alibabacloud-go/tea v1.2.1
|
||||
github.com/alibabacloud-go/tea-utils/v2 v2.0.5
|
||||
github.com/aliyun/aliyun-oss-go-sdk v2.2.6+incompatible
|
||||
github.com/IBM/sarama v1.43.3
|
||||
github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.9
|
||||
github.com/alibabacloud-go/dysmsapi-20170525/v3 v3.0.6
|
||||
github.com/alibabacloud-go/tea v1.2.2
|
||||
github.com/alibabacloud-go/tea-utils/v2 v2.0.6
|
||||
github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible
|
||||
github.com/apache/rocketmq-client-go/v2 v2.1.2
|
||||
github.com/casbin/casbin/v2 v2.55.0
|
||||
github.com/forgoer/openssl v1.4.0
|
||||
github.com/go-pay/gopay v1.5.91
|
||||
github.com/casbin/casbin/v2 v2.99.0
|
||||
github.com/forgoer/openssl v1.6.0
|
||||
github.com/go-pay/crypto v0.0.1
|
||||
github.com/go-pay/gopay v1.5.104
|
||||
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.7.2
|
||||
github.com/gogf/gf/contrib/nosql/redis/v2 v2.7.2
|
||||
github.com/gogf/gf/contrib/trace/jaeger/v2 v2.7.2
|
||||
github.com/gogf/gf/v2 v2.7.2
|
||||
github.com/gogf/selfupdate v0.0.0-20231215043001-5c48c528462f
|
||||
github.com/golang-jwt/jwt/v5 v5.2.0
|
||||
github.com/golang-jwt/jwt/v5 v5.2.1
|
||||
github.com/gorilla/websocket v1.5.3
|
||||
github.com/kayon/iploc v0.0.0-20200312105652-bda3e968a794
|
||||
github.com/minio/minio-go/v7 v7.0.63
|
||||
github.com/minio/minio-go/v7 v7.0.76
|
||||
github.com/mojocn/base64Captcha v1.3.6
|
||||
github.com/olekukonko/tablewriter v0.0.5
|
||||
github.com/qiniu/go-sdk/v7 v7.14.0
|
||||
github.com/shirou/gopsutil/v3 v3.23.3
|
||||
github.com/silenceper/wechat/v2 v2.1.4
|
||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.633
|
||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sms v1.0.633
|
||||
github.com/tencentyun/cos-go-sdk-v5 v0.7.45
|
||||
github.com/ufilesdk-dev/ufile-gosdk v1.0.3
|
||||
github.com/qiniu/go-sdk/v7 v7.21.1
|
||||
github.com/shirou/gopsutil/v3 v3.24.5
|
||||
github.com/silenceper/wechat/v2 v2.1.6
|
||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.993
|
||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sms v1.0.993
|
||||
github.com/tencentyun/cos-go-sdk-v5 v0.7.54
|
||||
github.com/ufilesdk-dev/ufile-gosdk v1.0.4
|
||||
github.com/xuri/excelize/v2 v2.6.0
|
||||
go.opentelemetry.io/otel v1.28.0
|
||||
golang.org/x/mod v0.17.0
|
||||
golang.org/x/net v0.27.0
|
||||
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d
|
||||
go.opentelemetry.io/otel v1.29.0
|
||||
golang.org/x/mod v0.20.0
|
||||
golang.org/x/net v0.28.0
|
||||
golang.org/x/tools v0.24.0
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
)
|
||||
|
||||
require (
|
||||
aead.dev/minisign v0.2.0 // indirect
|
||||
aead.dev/minisign v0.3.0 // indirect
|
||||
filippo.io/edwards25519 v1.1.0 // indirect
|
||||
github.com/BurntSushi/toml v1.4.0 // indirect
|
||||
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible // indirect
|
||||
github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4 // indirect
|
||||
github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 // indirect
|
||||
github.com/alibabacloud-go/endpoint-util v1.1.0 // indirect
|
||||
github.com/alibabacloud-go/openapi-util v0.1.0 // indirect
|
||||
github.com/alibabacloud-go/tea-utils v1.3.1 // indirect
|
||||
github.com/alex-ant/gomath v0.0.0-20160516115720-89013a210a82 // indirect
|
||||
github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.5 // indirect
|
||||
github.com/alibabacloud-go/debug v1.0.1 // indirect
|
||||
github.com/alibabacloud-go/endpoint-util v1.1.1 // indirect
|
||||
github.com/alibabacloud-go/openapi-util v0.1.1 // indirect
|
||||
github.com/alibabacloud-go/tea-xml v1.1.3 // indirect
|
||||
github.com/aliyun/credentials-go v1.3.1 // indirect
|
||||
github.com/bradfitz/gomemcache v0.0.0-20220106215444-fb4bf637b56d // indirect
|
||||
github.com/aliyun/credentials-go v1.3.9 // indirect
|
||||
github.com/bmatcuk/doublestar/v4 v4.6.1 // indirect
|
||||
github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874 // indirect
|
||||
github.com/casbin/govaluate v1.2.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/clbanning/mxj v1.8.4 // indirect
|
||||
github.com/clbanning/mxj/v2 v2.7.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||
github.com/eapache/go-resiliency v1.2.0 // indirect
|
||||
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
|
||||
github.com/eapache/go-resiliency v1.7.0 // indirect
|
||||
github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3 // indirect
|
||||
github.com/eapache/queue v1.1.0 // indirect
|
||||
github.com/emirpasic/gods v1.18.1 // indirect
|
||||
github.com/fatih/color v1.17.0 // indirect
|
||||
github.com/fatih/structs v1.1.0 // indirect
|
||||
github.com/fsnotify/fsnotify v1.7.0 // indirect
|
||||
github.com/go-ini/ini v1.67.0 // indirect
|
||||
github.com/go-logr/logr v1.4.2 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-ole/go-ole v1.2.6 // indirect
|
||||
github.com/go-ole/go-ole v1.3.0 // indirect
|
||||
github.com/go-pay/errgroup v0.0.2 // indirect
|
||||
github.com/go-pay/util v0.0.4 // indirect
|
||||
github.com/go-pay/xlog v0.0.3 // indirect
|
||||
github.com/go-pay/xtime v0.0.2 // indirect
|
||||
github.com/go-redis/redis/v8 v8.11.5 // indirect
|
||||
github.com/go-sql-driver/mysql v1.8.1 // indirect
|
||||
github.com/goccy/go-json v0.10.3 // indirect
|
||||
github.com/gofrs/flock v0.12.1 // indirect
|
||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
|
||||
github.com/golang/mock v1.6.0 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/google/btree v1.1.2 // indirect
|
||||
github.com/google/go-querystring v1.0.0 // indirect
|
||||
github.com/google/btree v1.1.3 // indirect
|
||||
github.com/google/go-querystring v1.1.0 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/grokify/html-strip-tags-go v0.1.0 // indirect
|
||||
github.com/hashicorp/errwrap v1.0.0 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/go-uuid v1.0.3 // indirect
|
||||
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
|
||||
@ -88,54 +95,54 @@ require (
|
||||
github.com/jcmturner/gokrb5/v8 v8.4.4 // indirect
|
||||
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/klauspost/compress v1.17.2 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
|
||||
github.com/klauspost/compress v1.17.9 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
|
||||
github.com/lufia/plan9stats v0.0.0-20240819163618-b1d8f4d146e7 // indirect
|
||||
github.com/magiconair/properties v1.8.7 // indirect
|
||||
github.com/matishsiao/goInfo v0.0.0-20210923090445-da2e3fa8d45f // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.15 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.16 // indirect
|
||||
github.com/minio/md5-simd v1.1.2 // indirect
|
||||
github.com/minio/sha256-simd v1.0.1 // indirect
|
||||
github.com/mitchellh/mapstructure v1.4.3 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
|
||||
github.com/mozillazg/go-httpheader v0.2.1 // indirect
|
||||
github.com/mozillazg/go-httpheader v0.4.0 // indirect
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
|
||||
github.com/pierrec/lz4/v4 v4.1.18 // indirect
|
||||
github.com/pierrec/lz4/v4 v4.1.21 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
|
||||
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
|
||||
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
|
||||
github.com/redis/go-redis/v9 v9.6.0 // indirect
|
||||
github.com/redis/go-redis/v9 v9.6.1 // indirect
|
||||
github.com/richardlehane/mscfb v1.0.4 // indirect
|
||||
github.com/richardlehane/msoleps v1.0.1 // indirect
|
||||
github.com/richardlehane/msoleps v1.0.3 // indirect
|
||||
github.com/rivo/uniseg v0.4.7 // indirect
|
||||
github.com/rs/xid v1.5.0 // indirect
|
||||
github.com/shoenig/go-m1cpu v0.1.4 // indirect
|
||||
github.com/rs/xid v1.6.0 // indirect
|
||||
github.com/shoenig/go-m1cpu v0.1.6 // indirect
|
||||
github.com/sirupsen/logrus v1.9.3 // indirect
|
||||
github.com/spf13/cast v1.4.1 // indirect
|
||||
github.com/tidwall/gjson v1.14.1 // indirect
|
||||
github.com/spf13/cast v1.7.0 // indirect
|
||||
github.com/tidwall/gjson v1.17.3 // indirect
|
||||
github.com/tidwall/match v1.1.1 // indirect
|
||||
github.com/tidwall/pretty v1.2.0 // indirect
|
||||
github.com/tjfoc/gmsm v1.3.2 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.11 // indirect
|
||||
github.com/tklauser/numcpus v0.6.0 // indirect
|
||||
github.com/xuri/efp v0.0.0-20220407160117-ad0f7a785be8 // indirect
|
||||
github.com/xuri/nfp v0.0.0-20220409054826-5e722a1d9e22 // indirect
|
||||
github.com/yusufpapurcu/wmi v1.2.2 // indirect
|
||||
github.com/tidwall/pretty v1.2.1 // indirect
|
||||
github.com/tjfoc/gmsm v1.4.1 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.14 // indirect
|
||||
github.com/tklauser/numcpus v0.8.0 // indirect
|
||||
github.com/xuri/efp v0.0.0-20240408161823-9ad904a10d6d // indirect
|
||||
github.com/xuri/nfp v0.0.0-20240318013403-ab9948c2c4a7 // indirect
|
||||
github.com/yusufpapurcu/wmi v1.2.4 // indirect
|
||||
go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.28.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.28.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.28.0 // indirect
|
||||
go.uber.org/atomic v1.7.0 // indirect
|
||||
golang.org/x/crypto v0.25.0 // indirect
|
||||
golang.org/x/image v0.13.0 // indirect
|
||||
golang.org/x/sync v0.7.0 // indirect
|
||||
golang.org/x/sys v0.22.0 // indirect
|
||||
golang.org/x/text v0.16.0 // indirect
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.29.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.29.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.29.0 // indirect
|
||||
go.uber.org/atomic v1.11.0 // indirect
|
||||
golang.org/x/crypto v0.26.0 // indirect
|
||||
golang.org/x/image v0.19.0 // indirect
|
||||
golang.org/x/sync v0.8.0 // indirect
|
||||
golang.org/x/sys v0.24.0 // indirect
|
||||
golang.org/x/text v0.17.0 // indirect
|
||||
golang.org/x/time v0.6.0 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||
stathat.com/c/consistent v1.0.0 // indirect
|
||||
)
|
||||
|
669
server/go.sum
669
server/go.sum
File diff suppressed because it is too large
Load Diff
@ -62,10 +62,10 @@ func Install(m Module) (err error) {
|
||||
}
|
||||
return g.DB().Transaction(m.Ctx(), func(ctx context.Context, tx gdb.TX) error {
|
||||
if record != nil {
|
||||
_, _ = GetModel(m.Ctx()).Where("id", record.Id).Delete()
|
||||
_, _ = GetModel(ctx).Where("id", record.Id).Delete()
|
||||
}
|
||||
|
||||
if _, err = GetModel(m.Ctx()).Data(data).OmitEmptyData().Insert(); err != nil {
|
||||
if _, err = GetModel(ctx).Data(data).OmitEmptyData().Insert(); err != nil {
|
||||
return err
|
||||
}
|
||||
return m.Install(ctx)
|
||||
@ -87,7 +87,7 @@ func Upgrade(m Module) (err error) {
|
||||
"version": m.GetSkeleton().Version,
|
||||
}
|
||||
return g.DB().Transaction(m.Ctx(), func(ctx context.Context, tx gdb.TX) error {
|
||||
if _, err = GetModel(m.Ctx()).Where("id", record.Id).Data(data).Update(); err != nil {
|
||||
if _, err = GetModel(ctx).Where("id", record.Id).Data(data).Update(); err != nil {
|
||||
return err
|
||||
}
|
||||
return m.Upgrade(ctx)
|
||||
@ -110,7 +110,7 @@ func UnInstall(m Module) (err error) {
|
||||
"status": consts.AddonsInstallStatusUn,
|
||||
}
|
||||
return g.DB().Transaction(m.Ctx(), func(ctx context.Context, tx gdb.TX) error {
|
||||
if _, err = GetModel(m.Ctx()).Where("id", record.Id).Data(data).Update(); err != nil {
|
||||
if _, err = GetModel(ctx).Where("id", record.Id).Data(data).Update(); err != nil {
|
||||
return err
|
||||
}
|
||||
return m.UnInstall(ctx)
|
||||
|
@ -111,14 +111,19 @@ func loadPermissions(ctx context.Context) {
|
||||
}
|
||||
|
||||
func Clear(ctx context.Context) (err error) {
|
||||
_, err = Enforcer.RemovePolicies(Enforcer.GetPolicy())
|
||||
policy, err := Enforcer.GetPolicy()
|
||||
if err != nil {
|
||||
g.Log().Warningf(ctx, "Enforcer RemovePolicies err:%+v", err)
|
||||
return
|
||||
}
|
||||
_, err = Enforcer.RemovePolicies(policy)
|
||||
if err != nil {
|
||||
g.Log().Warningf(ctx, "Enforcer RemovePolicies err:%+v", err)
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否清理干净
|
||||
if len(Enforcer.GetPolicy()) > 0 {
|
||||
if len(policy) > 0 {
|
||||
return Clear(ctx)
|
||||
}
|
||||
return
|
||||
|
@ -8,8 +8,8 @@ package wxpay
|
||||
import (
|
||||
"context"
|
||||
"crypto/rsa"
|
||||
"github.com/go-pay/crypto/xpem"
|
||||
"github.com/go-pay/gopay"
|
||||
"github.com/go-pay/gopay/pkg/xpem"
|
||||
"github.com/go-pay/gopay/wechat/v3"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
@ -88,7 +88,7 @@ func (h *wxPay) Notify(ctx context.Context, in payin.NotifyInp) (res *payin.Noti
|
||||
return
|
||||
}
|
||||
|
||||
notify, err := notifyReq.DecryptCipherText(h.config.WxPayAPIv3Key)
|
||||
notify, err := notifyReq.DecryptPayCipherText(h.config.WxPayAPIv3Key)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ package queue
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/Shopify/sarama"
|
||||
"github.com/IBM/sarama"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/consts"
|
||||
|
Loading…
Reference in New Issue
Block a user