Skip to content

Commit e159937

Browse files
authored
Merge pull request #152 from Ada0317/main-dev
fix PaySuccessNotify in cronJob
2 parents 60661d0 + 300dd4f commit e159937

File tree

11 files changed

+22
-21
lines changed

11 files changed

+22
-21
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ I may have contacted go zero earlier. I have been using go zero since about 1000
1616

1717

1818

19-
##### Tips : If you are not familiar with many of the technology stack here, do not be afraid, as long as you will mysql, redis can start these two middleware in the start of the project first run up the project, the other can slowly learn.
19+
##### Tips : If you are unfamiliar with the technologies in the current stack, don't worry. Simply start by mastering MySQL and Redis. Begin your project by running these two middleware components, and gradually expand your knowledge of the remaining technologies as you progress.
2020

2121

2222

app/mqueue/cmd/job/internal/logic/routes.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"looklook/app/mqueue/cmd/job/jobtype"
88
)
99

10-
1110
type CronJob struct {
1211
ctx context.Context
1312
svcCtx *svc.ServiceContext
@@ -26,15 +25,15 @@ func (l *CronJob) Register() *asynq.ServeMux {
2625
mux := asynq.NewServeMux()
2726

2827
//scheduler job
29-
mux.Handle(jobtype.ScheduleSettleRecord,NewSettleRecordHandler(l.svcCtx))
28+
mux.Handle(jobtype.ScheduleSettleRecord, NewSettleRecordHandler(l.svcCtx))
3029

3130
//defer job
32-
mux.Handle(jobtype.DeferCloseHomestayOrder,NewCloseHomestayOrderHandler(l.svcCtx))
31+
mux.Handle(jobtype.DeferCloseHomestayOrder, NewCloseHomestayOrderHandler(l.svcCtx))
3332

33+
//SuccessNotifyUser job
34+
mux.Handle(jobtype.MsgPaySuccessNotifyUser, NewPaySuccessNotifyUserHandler(l.svcCtx))
3435
//queue job , asynq support queue job
3536
// wait you fill..
3637

3738
return mux
3839
}
39-
40-

app/payment/cmd/api/internal/logic/thirdPayment/thirdPaymentwxPayLogic.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func (l *ThirdPaymentwxPayLogic) ThirdPaymentwxPay(req types.ThirdPaymentWxPayRe
5454
return nil, errors.Wrapf(xerr.NewErrMsg("Payment for this business type is not supported"), "Payment for this business type is not supported req: %+v", req)
5555
}
5656

57-
// Create microsoft pre-processing orders
57+
// Create WechatPay pre-processing orders
5858
wechatPrepayRsp, err := l.createWxPrePayOrder(req.ServiceType, req.OrderSn, totalPrice, description)
5959
if err != nil {
6060
return nil, err

app/travel/cmd/api/etc/travel.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Cache:
2929
#rpc
3030
UsercenterRpcConf:
3131
Endpoints:
32-
- 12.0.0.1:2004
32+
- 127.0.0.1:2004
3333
NonBlock: true
3434

3535
TravelRpcConf:

deploy/goctl/1.5.3.zip

-43 Bytes
Binary file not shown.

deploy/script/mysql/genModel.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ modeldir=./genModel
1313

1414
# 数据库配置
1515
host=127.0.0.1
16-
port=3306
16+
port=33069
1717
dbname=looklook_$1
1818
username=root
19-
passwd=
19+
passwd=PXDN93VRKUm8TeE7
2020

2121

2222
echo "开始创建库:$dbname 的表:$2"

doc/chinese/01-开发环境搭建.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ $ docker exec -it kafka /bin/sh
145145
$ cd /opt/kafka/bin/
146146
```
147147

148-
创建3个topic
148+
创建2个topic
149149

150150
```shell
151151
$ ./kafka-topics.sh --create --zookeeper zookeeper:2181 --replication-factor 1 -partitions 1 --topic looklook-log
@@ -235,7 +235,7 @@ Kafka: (发布、订阅|pub、sub)自行客户端工具查看
235235
直接docker-compose去启动可以,但是考虑依赖可能会比较大,会影响启动项目,所以最好先把这个镜像拉取下来再去启动项目
236236

237237
```shell
238-
$ docker pull lyumikael/gomodd:v1.0.0 #这个是app下所有的api+rpc启动服务使用的,如果你是 "mac m1" : lyumikael/go-modd-env:v1.0.0
238+
$ docker pull lyumikael/gomodd:v1.20.3 #这个是app下所有的api+rpc启动服务使用的,如果你是 "mac m1" : lyumikael/go-modd-env:v1.0.0
239239
```
240240

241241
【注】后续如果app下新增业务,要记得在项目根目录下的modd.conf复制添加一份就可以了
@@ -413,14 +413,16 @@ goctl >= 1.3 进入"服务/cmd/rpc/pb"目录下,执行下面命令
413413

414414
```shell
415415
$ goctl rpc protoc *.proto --go_out=../ --go-grpc_out=../ --zrpc_out=../
416-
$ sed -i "" 's/,omitempty//g' *.pb.go
416+
$ sed -i 's/,omitempty//g' *.pb.go #linux
417+
$ sed -i "" 's/,omitempty//g' *.pb.go #mac
417418
```
418419

419420
goctl < 1.3 进入"服务/cmd"目录下,执行下面命令
420421

421422
```shell
422423
$ goctl rpc proto -src rpc/pb/*.proto -dir ./rpc -style=goZero
423-
$ sed -i "" 's/,omitempty//g' ./rpc/pb/*.pb.go
424+
$ sed -i 's/,omitempty//g' ./rpc/pb/*.pb.go #linux
425+
$ sed -i "" 's/,omitempty//g' ./rpc/pb/*.pb.go #mac
424426
```
425427

426428
【注】建议在生成rpc文件时候,在多执行一次下面那个命令,把protobuf生成的omitempty给删除掉,不然字段为nil就不返回了

doc/chinese/03-鉴权服务.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ package handler
4242

4343
```
4444

45-
我们可以看到在路由中给我们使用了rest.WithJwt , 就是针对一组路由使用了jwt鉴权,具体实现可以去看一下rest.WithJwt源码,go-zero jwt还实现了自动刷新token功能,这个留给大家自己去查看源码发现一下
45+
我们可以看到在路由中给我们使用了rest.WithJwt , 就是针对一组路由使用了jwt鉴权,具体实现可以去看一下rest.WithJwt源码。
4646

4747

4848

doc/chinese/10-错误处理.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ func (l *RegisterLogic) Register(req types.RegisterReq) (*types.RegisterResp, er
332332

333333
​ 1)api服务想把rpc返回给前端友好的错误提示信息,我们想直接返回给前端不做任何处理(比如rpc已经返回了“用户已存在”,api不想做什么处理,就想把这个错误信息直接返回给前端)
334334

335-
​ 针对这种情况,直接就像上图这种写就可以了,将rpc调用处的err直接作为errors.Wrapf 第一个参数扔出去,但是第二个参数最好记录一下自己需要的详细日志方便后续在api中国呢查看
335+
​ 针对这种情况,直接就像上图这种写就可以了,将rpc调用处的err直接作为errors.Wrapf 第一个参数扔出去,但是第二个参数最好记录一下自己需要的详细日志方便后续在api中查看
336336

337337
​ 2)api服务不管rpc返回的是什么错误信息,我就想自己在重新定义给前端返回错误信息(比如rpc已经返回了“用户已存在”,api想调用rpc时只要有错误我就返回给前端“用户注册失败”)
338338

@@ -433,7 +433,7 @@ errcode : 返回给前端的错误码
433433

434434
errmsg :返回给前端的友好的错误提示信息
435435

436-
成功直接返回,如果遇到错误了,也是使用github.com/pkg/errors这个包老判断错误,是不是我们自己定义的错误(api中定义的错误直接使用我们自己定义的xerr),还是grpc错误(rpc业务抛出来的),如果是grpc错误在通过uint32转成我们自己错误码,根据错误码再去我们自己定义错误信息中找到定义的错误信息返回给前端,如果是api错误直接返回给前端我们自己定义的错误信息,都找不到那就返回默认错误“服务器开小差了” ,
436+
成功直接返回,如果遇到错误了,也是使用github.com/pkg/errors这个包来判断错误,是不是我们自己定义的错误(api中定义的错误直接使用我们自己定义的xerr),还是grpc错误(rpc业务抛出来的),如果是grpc错误在通过uint32转成我们自己错误码,根据错误码再去我们自己定义错误信息中找到定义的错误信息返回给前端,如果是api错误直接返回给前端我们自己定义的错误信息,都找不到那就返回默认错误“服务器开小差了” ,
437437

438438

439439

doc/english/01-Development-environment-setup.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
- [I. Development environment](#i-development-environment)
44
- [1. Project Profile](#1-project-profile)
55
- [2. Use to technology stack](#2-use-to-technology-stack)
6-
- [Tips : If you are not familiar with many of the technology stack here, do not be afraid, as long as you will mysql, redis can start these two middleware in the start of the project first run up the project, the other can slowly learn.](#tips--if-you-are-not-familiar-with-many-of-the-technology-stack-here-do-not-be-afraid-as-long-as-you-will-mysql-redis-can-start-these-two-middleware-in-the-start-of-the-project-first-run-up-the-project-the-other-can-slowly-learn)
6+
- [Tips : If you are unfamiliar with the technologies in the current stack, don't worry. Simply start by mastering MySQL and Redis. Begin your project by running these two middleware components, and gradually expand your knowledge of the remaining technologies as you progress.](#tips--if-you-are-not-familiar-with-many-of-the-technology-stack-here-do-not-be-afraid-as-long-as-you-will-mysql-redis-can-start-these-two-middleware-in-the-start-of-the-project-first-run-up-the-project-the-other-can-slowly-learn)
77
- [3. Project Architecture Diagram](#3-project-architecture-diagram)
88
- [4. Business Architecture Diagram](#4-business-architecture-diagram)
99
- [5. Project Environment Setup](#5-project-environment-setup)
@@ -65,7 +65,7 @@ The project directory structure is as follows:
6565

6666

6767

68-
##### Tips : If you are not familiar with many of the technology stack here, do not be afraid, as long as you will mysql, redis can start these two middleware in the start of the project first run up the project, the other can slowly learn.
68+
##### Tips : If you are unfamiliar with the technologies in the current stack, don't worry. Simply start by mastering MySQL and Redis. Begin your project by running these two middleware components, and gradually expand your knowledge of the remaining technologies as you progress.
6969

7070

7171

@@ -224,7 +224,7 @@ All API + RPC services under frontend app use modd + golang
224224
Direct docker-compose to start can, but consider the dependencies may be relatively large, will affect the start of the project, so it is best to pull down this image before starting the project
225225

226226
```shell
227-
docker pull lyumikael/gomodd:v1.0.0 #This is used by all API+RPC startup services under the app, if you are "mac m1" : lyumikael/go-modd-env:v1.0.0
227+
docker pull lyumikael/gomodd:v1.20.3 #This is used by all API+RPC startup services under the app, if you are "mac m1" : lyumikael/go-modd-env:v1.0.0
228228
```
229229

230230
Note: If you add new services under the app, remember to add a copy of modd.conf in the root directory of the project.

doc/english/10-Error-handling.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ There are 2 points to note here
325325

326326
1) api service wants to return the rpc to the front-end friendly error message, we want to return directly to the front-end without any processing (for example, the rpc has returned "user already exists", api does not want to do any processing, you want to return this error message directly to the front-end)
327327

328-
Wrapf the first parameter, but the second parameter is best to record the detailed logs you need to facilitate the follow-up in api China it view
328+
Wrapf the first parameter, but the second parameter is best to record the detailed logs you need to facilitate the follow-up in api view
329329

330330
(2) api service regardless of what error information is returned by the rpc, I would like to redefine the error information returned to the front-end (for example, the rpc has returned "user already exists", api want to call the rpc as long as there is an error I will return to the front-end "User registration failed")
331331

0 commit comments

Comments
 (0)