Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
孙龙
/
golang-queue-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
17e936c6
authored
Oct 20, 2020
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
添加支付记录
parent
236b365d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletions
order/jingdiao/handle/handle.go
order/jingdiao/main.go
order/jingdiao/handle/handle.go
View file @
17e936c6
...
...
@@ -12,7 +12,7 @@ import (
// 随机数
func
RandInt
(
min
,
max
int
)
int
{
if
min
>=
max
||
m
in
==
0
||
max
==
0
{
if
min
>=
max
||
m
ax
==
0
{
return
max
}
...
...
@@ -146,4 +146,12 @@ func GetDiffDay(start, end string) int {
diff_day
,
_
:=
strconv
.
Atoi
(
sub_str
)
return
diff_day
}
// 随机获取支付名称
func
GetRandPayName
()
string
{
var
pay_name
=
[
5
]
string
{
"微信支付"
,
"支付宝"
,
"银联支付(B2B)"
,
"银联支付(B2C)"
,
"交通银行"
}
var
n
=
RandInt
(
0
,
5
)
return
pay_name
[
n
]
}
\ No newline at end of file
order/jingdiao/main.go
View file @
17e936c6
...
...
@@ -214,6 +214,18 @@ func CreateOrder(user_id int, create_time int64) {
return
}
// 添加lie_pay_log 支付记录
pay_name
:=
handle
.
GetRandPayName
()
rand_time
:=
int64
(
handle
.
RandInt
(
200
,
1000
))
last_time
:=
create_time
+
rand_time
// 支付时间
_
,
err
=
conn
.
Exec
(
"insert into lie_pay_log (user_id, order_id, order_sn, pay_name, pay_amount, is_paid, create_time, pay_time) values (?, ?, ?, ?, ?, ?, ?, ?)"
,
user_id
,
order_id
,
order_sn
,
pay_name
,
order_amount
,
1
,
last_time
,
last_time
)
if
err
!=
nil
{
conn
.
Rollback
()
//回滚
return
}
conn
.
Commit
()
// 提交事务
fmt
.
Println
(
"生成竞调订单ID:"
+
strconv
.
Itoa
(
order_id
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment