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
213d0b62
Commit
213d0b62
authored
Mar 16, 2020
by
szh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新feedlist接口 添加历史接口和表
parent
805b21f9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
97 additions
and
4 deletions
+97
-4
raspberry.sql
docs/sql/raspberry.sql
+29
-2
raspFeedBackList.go
models/raspFeedBackList.go
+43
-0
pai.go
routers/api/v1/pai.go
+24
-1
router.go
routers/router.go
+1
-1
No files found.
docs/sql/raspberry.sql
View file @
213d0b62
...
@@ -98,4 +98,31 @@ CREATE TABLE `rasp_version` (
...
@@ -98,4 +98,31 @@ CREATE TABLE `rasp_version` (
`type`
tinyint
(
3
)
DEFAULT
'0'
COMMENT
'类型 1 bityuan 2 chain33-pai'
,
`type`
tinyint
(
3
)
DEFAULT
'0'
COMMENT
'类型 1 bityuan 2 chain33-pai'
,
`addtime`
int
(
11
)
DEFAULT
NULL
COMMENT
'添加时间'
,
`addtime`
int
(
11
)
DEFAULT
NULL
COMMENT
'添加时间'
,
PRIMARY
KEY
(
`Id`
)
PRIMARY
KEY
(
`Id`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
2
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'程序版本更新控制'
;
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
2
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'程序版本更新控制'
;
\ No newline at end of file
-- ----------------------------
-- Table structure for rasp_feedback
-- ----------------------------
DROP
TABLE
IF
EXISTS
`rasp_feedback`
;
CREATE
TABLE
`rasp_feedback`
(
`id`
varchar
(
25
)
NOT
NULL
DEFAULT
''
,
`description`
text
,
`complete`
tinyint
(
1
)
DEFAULT
NULL
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
;
-- ----------------------------
-- Table structure for rasp_feedback_list
-- ----------------------------
DROP
TABLE
IF
EXISTS
`rasp_feedback_list`
;
CREATE
TABLE
`rasp_feedback_list`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`addr`
varchar
(
255
)
NOT
NULL
DEFAULT
''
,
`description`
text
NOT
NULL
,
`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
models/raspFeedBackList.go
0 → 100644
View file @
213d0b62
package
models
import
(
"log"
"github.com/jinzhu/gorm"
)
type
RaspFeedbackList
struct
{
Id
string
`json:"id" gorm:"PRIMARY_KEY"`
Addr
string
`json:"addr"`
Description
string
`json:"description"`
Addtime
int64
`json:"addtime"`
}
type
ReqRaspFeedbackList
struct
{
Addr
string
`json:"addr" binding:"required"`
Page
int32
`json:"page"`
Pagesize
int32
`json:"pagesize"`
}
func
AddFeedBackList
(
fd
RaspFeedbackList
)
bool
{
err
:=
db
.
Create
(
&
fd
)
if
err
!=
nil
{
db
.
Save
(
&
fd
)
log
.
Println
(
err
)
return
false
}
return
true
}
func
GetAddrFeedBackList
(
req
*
ReqRaspFeedbackList
)
([]
*
RaspFeedbackList
,
error
)
{
var
txs
[]
*
RaspFeedbackList
maps
:=
map
[
string
]
interface
{}{
"return_addr"
:
req
.
Addr
}
err
:=
db
.
Where
(
maps
)
.
Order
(
"id "
+
"desc"
)
.
Offset
((
req
.
Page
-
1
)
*
req
.
Pagesize
)
.
Limit
(
req
.
Pagesize
)
.
Find
(
&
txs
)
.
Error
if
err
!=
nil
&&
err
!=
gorm
.
ErrRecordNotFound
{
return
nil
,
err
}
return
txs
,
nil
}
\ No newline at end of file
routers/api/v1/pai.go
View file @
213d0b62
...
@@ -12,6 +12,7 @@ import (
...
@@ -12,6 +12,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin"
"log"
"log"
"net/http"
"net/http"
"time"
)
)
func
GetDevdetail
(
c
*
gin
.
Context
)
{
func
GetDevdetail
(
c
*
gin
.
Context
)
{
...
@@ -156,6 +157,10 @@ func FeedBack(c *gin.Context){
...
@@ -156,6 +157,10 @@ func FeedBack(c *gin.Context){
Description
:
KP
[
"description"
],
Description
:
KP
[
"description"
],
Complete
:
false
,
Complete
:
false
,
})
})
models
.
AddFeedBackList
(
models
.
RaspFeedbackList
{
Description
:
KP
[
"description"
],
Addtime
:
time
.
Now
()
.
Unix
(),
})
appG
.
C
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
appG
.
C
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
"msg"
:
"ok"
,
"msg"
:
"ok"
,
"code"
:
"200"
,
"code"
:
"200"
,
...
@@ -164,4 +169,22 @@ func FeedBack(c *gin.Context){
...
@@ -164,4 +169,22 @@ func FeedBack(c *gin.Context){
})
})
}
}
func
GetFeedList
(
c
*
gin
.
Context
){
appG
:=
app
.
Gin
{
C
:
c
}
var
req
models
.
ReqRaspFeedbackList
err
:=
appG
.
C
.
ShouldBindJSON
(
&
req
)
if
err
!=
nil
{
appG
.
Response
(
http
.
StatusOK
,
e
.
INVALID_PARAMS
,
nil
)
return
}
list
,
err
:=
models
.
GetAddrFeedBackList
(
&
models
.
ReqRaspFeedbackList
{
Addr
:
req
.
Addr
,
Pagesize
:
req
.
Pagesize
,
Page
:
req
.
Page
,
})
if
err
!=
nil
{
appG
.
Response
(
http
.
StatusOK
,
e
.
ERROR
,
nil
)
return
}
appG
.
Response
(
http
.
StatusOK
,
e
.
SUCCESS
,
list
)
}
routers/router.go
View file @
213d0b62
...
@@ -34,7 +34,7 @@ func InitRouter() *gin.Engine {
...
@@ -34,7 +34,7 @@ func InitRouter() *gin.Engine {
apiv1
.
POST
(
"/latestversion"
,
v1
.
GetVersion
)
apiv1
.
POST
(
"/latestversion"
,
v1
.
GetVersion
)
apiv1
.
POST
(
"/feedback"
,
v1
.
FeedBack
)
apiv1
.
POST
(
"/feedback"
,
v1
.
FeedBack
)
apiv1
.
POST
(
"/iscomplete"
,
v1
.
IsComplete
)
apiv1
.
POST
(
"/iscomplete"
,
v1
.
IsComplete
)
apiv1
.
POST
(
"/getfeedlist"
,
v1
.
GetFeedList
)
return
r
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