Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2021-1-capstone-design2
/
2016104120
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Ma Suhyeon
2021-06-14 22:03:51 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b05c99536dcd6dc39ddcf97096e44b0ee64b19be
b05c9953
1 parent
66b4aca8
Fix some omissions
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
1 deletions
src/server/app.go
src/server/data.go
src/server/extraction.go
src/server/app.go
View file @
b05c995
...
...
@@ -75,6 +75,7 @@ func NewApp(config Config) *App {
extraction
.
DELETE
(
"/messages/:id"
,
app
.
DeleteMessage
)
extraction
.
GET
(
"/calls/analyses"
,
app
.
GetCallsAnalyses
)
extraction
.
GET
(
"/regions"
,
app
.
GetRegions
)
extraction
.
GET
(
"/apps/analyses"
,
app
.
GetAppsAnalyses
)
extraction
.
POST
(
"/apps/analyses"
,
app
.
PostAppAnalysis
)
...
...
src/server/data.go
View file @
b05c995
...
...
@@ -403,6 +403,25 @@ func (app *App) GetDailyContacts(c echo.Context) error {
return
c
.
JSON
(
http
.
StatusOK
,
result
)
}
type
RegionStats
struct
{
Region
string
`json:"region" db:"region"`
Incoming
int
`json:"incoming" db:"incoming"`
Outgoing
int
`json:"outgoing" db:"outgoing"`
Duration
int
`json:"duration" db:"duration"`
Receive
int
`json:"receive" db:"receive"`
Send
int
`json:"send" db:"send"`
}
func
(
app
*
App
)
GetRegions
(
c
echo
.
Context
)
error
{
regions
:=
[]
RegionStats
{}
query
:=
"SELECT * FROM region_stats WHERE `extraction_no`=?"
if
err
:=
app
.
db
.
Unsafe
()
.
Select
(
&
regions
,
query
,
c
.
Param
(
"no"
));
err
!=
nil
{
return
err
}
return
c
.
JSON
(
http
.
StatusOK
,
regions
)
}
func
NormalizeNumber
(
number
string
)
string
{
if
len
(
number
)
>
0
&&
number
[
0
]
==
'+'
{
return
number
...
...
src/server/extraction.go
View file @
b05c995
...
...
@@ -183,5 +183,5 @@ func (app *App) PostExtractions(c echo.Context) error {
exec
.
Command
(
app
.
Config
.
PythonBin
,
"process.py"
,
fmt
.
Sprint
(
extNo
))
.
Run
()
return
c
.
NoContent
(
http
.
StatusNoContent
)
return
c
.
JSON
(
http
.
StatusOK
,
echo
.
Map
{
"extraction_no"
:
extNo
}
)
}
...
...
Please
register
or
login
to post a comment