Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-common
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujiebin
hilo-common
Commits
98e4087e
Commit
98e4087e
authored
Jun 09, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update charge_max.go
parent
62c9eed7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
charge_max.go
script/charge_max.go
+8
-7
No files found.
script/charge_max.go
View file @
98e4087e
...
...
@@ -6,6 +6,7 @@ import (
"git.hilo.cn/hilo-common/script/mysql"
"github.com/tealeg/xlsx"
"gorm.io/gorm"
"time"
)
type
ChargeMaxData
struct
{
...
...
@@ -97,7 +98,7 @@ func GetGroupPowerCode(uid uint64) string {
panic
(
err
)
}
if
groupPowerId
<=
0
{
return
""
return
"
0
"
}
var
ownerId
uint64
if
err
:=
mysql
.
ProdReadOnlyDB
.
Table
(
"group_power_user"
)
.
Where
(
"group_power_id = ? AND role = 2"
,
groupPowerId
)
.
Select
(
"user_id"
)
.
Scan
(
&
ownerId
)
.
Error
;
err
!=
nil
{
...
...
@@ -119,12 +120,12 @@ func GetCpCode(uid uint64) string {
var
cp
Cp
if
err
:=
mysql
.
ProdReadOnlyDB
.
Table
(
"cp"
)
.
Where
(
"user_id1 = ? OR user_id2 = ?"
,
uid
,
uid
)
.
Order
(
"score DESC"
)
.
Limit
(
1
)
.
First
(
&
cp
)
.
Error
;
err
!=
nil
{
if
err
==
gorm
.
ErrRecordNotFound
{
return
""
return
"
0
"
}
panic
(
err
)
}
if
cp
.
Id
<=
0
{
return
""
return
"
0
"
}
cpUid
:=
cp
.
UserId2
if
cpUid
==
uid
{
...
...
@@ -138,19 +139,19 @@ func GetCpCode(uid uint64) string {
}
func
GetLastLoginTime
(
uid
uint64
)
string
{
var
t
string
var
t
time
.
Time
if
err
:=
mysql
.
ProdReadOnlyDB
.
Table
(
"user_request_last"
)
.
Where
(
"user_id = ?"
,
uid
)
.
Select
(
"time_last"
)
.
Scan
(
&
t
)
.
Error
;
err
!=
nil
{
panic
(
err
)
}
return
t
return
t
.
Format
(
"2006-01-02"
)
}
func
GetLastChargeTime
(
uid
uint64
)
string
{
var
t
string
var
t
time
.
Time
if
err
:=
mysql
.
ProdReadOnlyDB
.
Raw
(
"SELECT
\n\t
max(created_time)
\n
FROM
\n\t
(
\n\t\t
SELECT
\n\t\t\t
MAX(created_time) created_time
\n\t\t
FROM
\n\t\t\t
`pay_order`
\n\t\t
WHERE
\n\t\t\t
`status` = '2'
\n\t\t
AND `type` = '0'
\n\t\t
AND created_time >=
\"
2022-07-01
\"\n\t\t
AND user_id = ?
\n\t\t
UNION ALL
\n\t\t\t
SELECT
\n\t\t\t\t
MAX(created_time) created_time
\n\t\t\t
FROM
\n\t\t\t\t
`dealer_transfer_detail`
\n\t\t\t
WHERE
\n\t\t\t\t
created_time >=
\"
2022-07-01
\"\n\t\t\t
AND receiver_id = ?
\n\t
) t"
,
uid
,
uid
)
.
Scan
(
&
t
)
.
Error
;
err
!=
nil
{
panic
(
err
)
}
return
t
return
t
.
Format
(
"2006-01-02"
)
}
func
GetAreaByCode
(
code
string
)
string
{
...
...
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