Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
chain33-pai
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
szh
chain33-pai
Commits
5b550f00
Commit
5b550f00
authored
Mar 30, 2020
by
szh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加接口 版本统计
parent
ca42f747
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
3 deletions
+71
-3
raspberry.sql
docs/sql/raspberry.sql
+16
-3
raspDevVersion.go
models/raspDevVersion.go
+19
-0
pai.go
routers/api/v1/pai.go
+34
-0
router.go
routers/router.go
+2
-0
No files found.
docs/sql/raspberry.sql
View file @
5b550f00
/*
/*
Navicat MySQL Data Transfer
Source Server : localhost
...
...
@@ -126,4 +126,17 @@ CREATE TABLE `rasp_feedback_list` (
`addtime`
int
(
11
)
NOT
NULL
DEFAULT
'0'
,
PRIMARY
KEY
(
`id`
),
KEY
`addr`
(
`addr`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'用户反馈历史'
;
\ No newline at end of file
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'用户反馈历史'
;
-- ----------------------------
-- Table structure for rasp_dev_version
-- ----------------------------
DROP
TABLE
IF
EXISTS
`rasp_dev_version`
;
CREATE
TABLE
`rasp_dev_version`
(
`Id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`addr`
varchar
(
255
)
NOT
NULL
DEFAULT
''
,
`version`
varchar
(
255
)
NOT
NULL
DEFAULT
''
,
PRIMARY
KEY
(
`Id`
),
KEY
`addr`
(
`addr`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'设备版本统计表'
;
\ No newline at end of file
models/raspDevVersion.go
0 → 100644
View file @
5b550f00
package
models
type
RaspDevVersion
struct
{
//Model
Id
int64
`json:"id" gorm:"PRIMARY_KEY"`
Version
string
`json:"version"`
Addr
string
`json:"addr"`
}
//
func
UpdateDevVersion
(
params
map
[
string
]
string
)
error
{
var
version
RaspDevVersion
err
:=
db
.
Where
(
RaspDevVersion
{
Addr
:
params
[
"addr"
]})
.
Assign
(
RaspDevVersion
{
Version
:
params
[
"version"
]})
.
FirstOrCreate
(
&
version
)
.
Error
if
err
!=
nil
{
return
err
}
return
nil
}
routers/api/v1/pai.go
View file @
5b550f00
...
...
@@ -199,3 +199,36 @@ func GetFeedList(c *gin.Context){
"count"
:
count
,
})
}
func
GetUploadInfo
(
c
*
gin
.
Context
){
appG
:=
app
.
Gin
{
C
:
c
}
err
:=
appG
.
C
.
ShouldBindJSON
(
&
KP
)
if
err
!=
nil
{
appG
.
Response
(
http
.
StatusOK
,
e
.
INVALID_PARAMS
,
nil
)
return
}
if
KP
[
"version"
]
==
""
||
KP
[
"addr"
]
==
""
{
appG
.
Response
(
http
.
StatusOK
,
e
.
INVALID_PARAMS
,
nil
)
return
}
err
=
models
.
UpdateDevVersion
(
KP
)
if
err
!=
nil
{
appG
.
Response
(
http
.
StatusOK
,
e
.
ERROR
,
nil
)
return
}
appG
.
Response
(
http
.
StatusOK
,
e
.
SUCCESS
,
nil
)
}
func
GetUploadTest
(
c
*
gin
.
Context
){
appG
:=
app
.
Gin
{
C
:
c
}
err
:=
appG
.
C
.
ShouldBindJSON
(
&
KP
)
if
err
!=
nil
{
appG
.
Response
(
http
.
StatusOK
,
e
.
INVALID_PARAMS
,
nil
)
return
}
logging
.
Info
(
"uploadtest"
,
"report"
,
KP
)
appG
.
Response
(
http
.
StatusOK
,
e
.
SUCCESS
,
nil
)
}
\ No newline at end of file
routers/router.go
View file @
5b550f00
...
...
@@ -35,6 +35,8 @@ func InitRouter() *gin.Engine {
apiv1
.
POST
(
"/feedback"
,
v1
.
FeedBack
)
apiv1
.
POST
(
"/iscomplete"
,
v1
.
IsComplete
)
apiv1
.
POST
(
"/getfeedlist"
,
v1
.
GetFeedList
)
apiv1
.
POST
(
"/uploadinfo"
,
v1
.
GetUploadInfo
)
apiv1
.
POST
(
"/uploadtest"
,
v1
.
GetUploadTest
)
return
r
}
...
...
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