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
023ab72f
authored
Apr 17, 2020
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
temp
parent
de4c9c78
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
0 deletions
dal/user/UserMain/UserMain.go
user/userRepeat/main.go
dal/user/UserMain/UserMain.go
0 → 100644
View file @
023ab72f
package
UserMain
import
(
"database/sql"
_
"encoding/json"
"fmt"
_
"github.com/ichunt2019/logger"
"go-queue-server/dal/db"
"go-queue-server/util"
"log"
)
type
UserMain
struct
{
UserId
int
`db:"user_id"`
Mobile
string
`db:"mobile"`
Email
string
`db:"email"`
CreateTime
int
`db:"create_time"`
Count
int
`db:"count"`
}
func
initDb
(
dns
string
)
(
err
error
)
{
err
=
db
.
Init
(
dns
)
if
err
!=
nil
{
return
}
return
}
// 多行查询
func
QueryRepeatAccount
(
field
string
)
{
initDb
(
util
.
Configs
.
Liexin_databases
.
Dns
)
//初始化db
var
user_main
[]
*
UserMain
err
:=
db
.
DB
.
Select
(
&
user_main
,
"select "
+
field
+
", count(*) as count from lie_user_main where ? != '' group by ? having count > 1"
,
field
,
field
)
if
err
==
sql
.
ErrNoRows
{
log
.
Printf
(
"not found data of the id:%d"
,
1
)
}
if
err
!=
nil
{
panic
(
err
)
}
if
user_main
==
nil
{
return
}
for
_
,
v
:=
range
user_main
{
fmt
.
Println
(
v
)
}
}
\ No newline at end of file
user/userRepeat/main.go
0 → 100644
View file @
023ab72f
package
main
import
(
"flag"
_
"fmt"
"github.com/ichunt2019/logger"
"go-queue-server/dal/user/UserMain"
"go-queue-server/util"
)
var
ConfigDir
string
var
LogDir
string
// 解析命令行参数
func
initArgs
()
{
// worker -config ./worker.json
// worker -h
flag
.
StringVar
(
&
ConfigDir
,
"configDir"
,
""
,
"配置文件"
)
flag
.
StringVar
(
&
LogDir
,
"logDir"
,
""
,
"日志目录"
)
flag
.
Parse
()
}
func
main
()
{
initArgs
()
//初始化配置文件
util
.
Init
(
ConfigDir
)
logConfig
:=
make
(
map
[
string
]
string
)
logConfig
[
"log_path"
]
=
LogDir
+
"user/userRepeat"
logConfig
[
"log_chan_size"
]
=
"1000"
logger
.
InitLogger
(
"file"
,
logConfig
)
logger
.
Init
()
UserMain
.
QueryRepeatAccount
(
"mobile"
)
}
\ No newline at end of file
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