Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
search_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
90466744
authored
Jun 08, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修改文件名和目录
parent
9a24f6fb
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
14 additions
and
11 deletions
cmd/course_http_server.go
conf/config.ini
lib/course_lib.go → controller/course_controller.go
lib/course_topic_lib.go → controller/course_topic_controller.go
lib/middleware_lib.go → controller/middleware_controller.go
mapper/course_mapper.go → dao/course_dao.go
service/course_service.go
cmd/course_http_server.go
View file @
90466744
...
...
@@ -5,7 +5,7 @@ import (
"github.com/micro/go-micro/v2/web"
"search_server/boot"
"search_server/framework/gin_"
_
"search_server/
lib
"
_
"search_server/
controller
"
"log"
)
...
...
conf/config.ini
View file @
90466744
...
...
@@ -13,4 +13,7 @@ write_password = icDb29mLy2s
read_password
=
icDb29mLy2s
max_idle
=
10
max_active
=
10
idle_timeout
=
20
\ No newline at end of file
idle_timeout
=
20
[mongo]
host
=
\ No newline at end of file
lib/course_lib
.go
→
controller/course_controller
.go
View file @
90466744
package
lib
package
controller
import
(
"github.com/gin-gonic/gin"
...
...
lib/course_topic_lib
.go
→
controller/course_topic_controller
.go
View file @
90466744
package
lib
package
controller
import
(
"github.com/gin-gonic/gin"
...
...
lib/middleware_lib
.go
→
controller/middleware_controller
.go
View file @
90466744
package
lib
package
controller
import
(
"fmt"
...
...
mapper/course_mapper
.go
→
dao/course_dao
.go
View file @
90466744
package
mapper
package
dao
import
(
"github.com/jinzhu/gorm"
...
...
service/course_service.go
View file @
90466744
...
...
@@ -2,7 +2,7 @@ package service
import
(
"context"
"search_server/
mapper
"
"search_server/
dao
"
.
"search_server/protopb/course"
)
...
...
@@ -14,7 +14,7 @@ type CourseServiceImpl struct{}
func
(
this
*
CourseServiceImpl
)
ListForTop
(
ctx
context
.
Context
,
req
*
ListRequest
,
rsp
*
ListResponse
)
error
{
course
:=
make
([]
*
CourseModel
,
0
)
err
:=
mapper
.
GetCourseListBySql
(
req
.
Size
)
.
Find
(
&
course
)
.
Error
err
:=
dao
.
GetCourseListBySql
(
req
.
Size
)
.
Find
(
&
course
)
.
Error
if
err
!=
nil
{
return
err
}
...
...
@@ -24,13 +24,13 @@ func (this *CourseServiceImpl) ListForTop(ctx context.Context, req *ListRequest,
func
(
this
*
CourseServiceImpl
)
GetDetail
(
ctx
context
.
Context
,
req
*
DetailRequest
,
rsp
*
DetailResponse
)
error
{
//只取课程详细
if
req
.
FetchType
==
0
||
req
.
FetchType
==
1
||
req
.
FetchType
==
3
{
if
err
:=
mapper
.
GetCourseDetail
(
int
(
req
.
CourseId
))
.
Find
(
rsp
.
Course
)
.
Error
;
err
!=
nil
{
if
err
:=
dao
.
GetCourseDetail
(
int
(
req
.
CourseId
))
.
Find
(
rsp
.
Course
)
.
Error
;
err
!=
nil
{
return
err
}
}
//只取计数表详细
if
req
.
FetchType
==
2
||
req
.
FetchType
==
3
{
if
err
:=
mapper
.
GetCourseCounts
(
int
(
req
.
CourseId
))
.
Find
(
&
rsp
.
Counts
)
.
Error
;
err
!=
nil
{
if
err
:=
dao
.
GetCourseCounts
(
int
(
req
.
CourseId
))
.
Find
(
&
rsp
.
Counts
)
.
Error
;
err
!=
nil
{
return
err
}
}
...
...
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