切换导航条
此项目
正在载入...
登录
mmm-go
/
partnermg
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
唐旭辉
5 years ago
提交
1d5eeaf0dce65d2b294f0c7be8a382e1eebee802
1 个父辈
e7bb0626
更新
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
7 行增加
和
2 行删除
main.go
pkg/application/syncOrder/service/sync_order.go
pkg/infrastructure/dao/pg_order_bestshop.go
main.go
查看文件 @
1d5eeaf
...
...
@@ -4,6 +4,7 @@ import (
"context"
"os"
"os/signal"
"sync"
"syscall"
"github.com/astaxie/beego"
...
...
@@ -26,8 +27,11 @@ func main() {
if
err
:=
consumerRun
.
InitConsumer
();
err
!=
nil
{
logs
.
Error
(
"启动kafka消息消费者失败:%s"
,
err
)
}
wg
:=
&
sync
.
WaitGroup
{}
wg
.
Add
(
1
)
go
func
()
{
consumerRun
.
Start
(
ctx
)
wg
.
Done
()
}()
go
func
()
{
<-
consumerRun
.
IsReady
()
...
...
@@ -37,6 +41,7 @@ func main() {
select
{
case
<-
sigs
:
cancel
()
wg
.
wait
()
return
default
:
}
...
...
pkg/application/syncOrder/service/sync_order.go
查看文件 @
1d5eeaf
...
...
@@ -51,7 +51,7 @@ func (s SyncOrderService) SyncOrderFromBestshop(cmd command.CreateOrderFromBests
}
ok
,
err
:=
orderBestshopDao
.
OrderExist
(
cmd
.
OrderCode
)
if
err
!=
nil
{
return
lib
.
ThrowError
(
lib
.
TRANSACTION_ERROR
,
err
.
Error
())
return
lib
.
ThrowError
(
lib
.
TRANSACTION_ERROR
,
"orderBestshopDao.OrderExist err:"
+
err
.
Error
())
}
if
ok
{
logs
.
Info
(
"订单已存在,order_code=%s"
,
cmd
.
OrderCode
)
...
...
pkg/infrastructure/dao/pg_order_bestshop.go
查看文件 @
1d5eeaf
...
...
@@ -24,7 +24,7 @@ func NewOrderBestshopDao(transactionContext *transaction.TransactionContext) (*O
func
(
dao
OrderBestshopDao
)
OrderExist
(
orderCode
string
)
(
bool
,
error
)
{
tx
:=
dao
.
transactionContext
.
GetDB
()
m
:=
models
.
OrderBestshop
{}
query
:=
tx
.
Model
(
m
)
.
Where
(
"order_code=?"
,
orderCode
)
query
:=
tx
.
Model
(
&
m
)
.
Where
(
"order_code=?"
,
orderCode
)
ok
,
err
:=
query
.
Exists
()
return
ok
,
err
}
...
...
请
注册
或
登录
后发表评论