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
5339e1d8
authored
Jun 05, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
整理目录
parent
aafca9f7
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
97 additions
and
102 deletions
boot/app.go
cmd/user_server.go
Mapper/CourseMapper.go → mapper/course_mapper.go
pkg/config/config.go
protopb/course/course.pb.go
protopb/course/course_topic.pb.go
protos/course.proto
protos/course_topic.proto
service/course_service.go
boot/app.go
View file @
5339e1d8
...
@@ -8,7 +8,7 @@ import (
...
@@ -8,7 +8,7 @@ import (
func
Boot
()
(
err
error
)
{
func
Boot
()
(
err
error
)
{
if
err
=
config
.
SetUp
();
err
!=
nil
{
if
err
=
config
.
SetUp
();
err
!=
nil
{
return
panic
(
err
)
}
}
if
err
=
mysql
.
Setup
();
err
!=
nil
{
if
err
=
mysql
.
Setup
();
err
!=
nil
{
return
return
...
...
cmd/user_server.go
View file @
5339e1d8
...
@@ -3,20 +3,20 @@ package main
...
@@ -3,20 +3,20 @@ package main
import
(
import
(
"context"
"context"
"github.com/micro/go-micro/v2/client"
"github.com/micro/go-micro/v2/client"
"search_server/
C
ourse"
"search_server/
protopb/c
ourse"
"github.com/micro/go-micro/v2"
"github.com/micro/go-micro/v2"
"search_server/
U
sers"
"search_server/
protopb/u
sers"
"log"
"log"
)
)
type
UserService
struct
{
type
UserService
struct
{
client
client
.
Client
client
client
.
Client
}
}
func
(
this
*
UserService
)
Test
(
ctx
context
.
Context
,
req
*
Users
.
UserRequest
,
rsp
*
U
sers
.
UserResponse
)
error
{
func
(
this
*
UserService
)
Test
(
ctx
context
.
Context
,
req
*
users
.
UserRequest
,
rsp
*
u
sers
.
UserResponse
)
error
{
rsp
.
Ret
=
"users"
+
req
.
Id
rsp
.
Ret
=
"users"
+
req
.
Id
c
:=
C
ourse
.
NewCourseService
(
"go.micro.api.jtthink.course"
,
this
.
client
)
c
:=
c
ourse
.
NewCourseService
(
"go.micro.api.jtthink.course"
,
this
.
client
)
course_rsp
,
_
:=
c
.
ListForTop
(
ctx
,
&
C
ourse
.
ListRequest
{
Size
:
10
})
course_rsp
,
_
:=
c
.
ListForTop
(
ctx
,
&
c
ourse
.
ListRequest
{
Size
:
10
})
log
.
Println
(
course_rsp
.
Result
)
log
.
Println
(
course_rsp
.
Result
)
return
nil
return
nil
}
}
...
@@ -31,7 +31,7 @@ func main() {
...
@@ -31,7 +31,7 @@ func main() {
err
:=
U
sers
.
RegisterUserServiceHandler
(
service
.
Server
(),
NewUserService
(
service
.
Client
()))
err
:=
u
sers
.
RegisterUserServiceHandler
(
service
.
Server
(),
NewUserService
(
service
.
Client
()))
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Fatal
(
err
)
log
.
Fatal
(
err
)
}
}
...
...
Mapper/CourseM
apper.go
→
mapper/course_m
apper.go
View file @
5339e1d8
package
M
apper
package
m
apper
import
(
import
(
"github.com/jinzhu/gorm"
"github.com/jinzhu/gorm"
...
...
pkg/config/config.go
View file @
5339e1d8
...
@@ -10,7 +10,7 @@ var (
...
@@ -10,7 +10,7 @@ var (
)
)
func
SetUp
()
(
err
error
)
{
func
SetUp
()
(
err
error
)
{
cfg
,
err
=
ini
.
Load
(
"conf/config.ini"
)
cfg
,
err
=
ini
.
Load
(
"
../
conf/config.ini"
)
return
return
}
}
...
...
protopb/course/course.pb.go
View file @
5339e1d8
...
@@ -28,7 +28,7 @@ type CourseModel struct {
...
@@ -28,7 +28,7 @@ type CourseModel struct {
CoursePrice
float32
`protobuf:"fixed32,5,opt,name=course_price,json=coursePrice,proto3" json:"course_price,omitempty"`
CoursePrice
float32
`protobuf:"fixed32,5,opt,name=course_price,json=coursePrice,proto3" json:"course_price,omitempty"`
CoursePrice2
float32
`protobuf:"fixed32,6,opt,name=course_price2,json=coursePrice2,proto3" json:"course_price2,omitempty"`
CoursePrice2
float32
`protobuf:"fixed32,6,opt,name=course_price2,json=coursePrice2,proto3" json:"course_price2,omitempty"`
// @inject_tag: gorm:"type:timestamp"
// @inject_tag: gorm:"type:timestamp"
Addtime
*
Timestamp
`protobuf:"bytes
,7,opt,name=addtime,proto3" json:"addtime,omitempty" gorm:"type:timestamp"`
Addtime
int64
`protobuf:"varint
,7,opt,name=addtime,proto3" json:"addtime,omitempty" gorm:"type:timestamp"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
XXX_sizecache
int32
`json:"-"`
...
@@ -101,11 +101,11 @@ func (m *CourseModel) GetCoursePrice2() float32 {
...
@@ -101,11 +101,11 @@ func (m *CourseModel) GetCoursePrice2() float32 {
return
0
return
0
}
}
func
(
m
*
CourseModel
)
GetAddtime
()
*
Timestamp
{
func
(
m
*
CourseModel
)
GetAddtime
()
int64
{
if
m
!=
nil
{
if
m
!=
nil
{
return
m
.
Addtime
return
m
.
Addtime
}
}
return
nil
return
0
}
}
type
ListRequest
struct
{
type
ListRequest
struct
{
...
@@ -361,34 +361,32 @@ func init() {
...
@@ -361,34 +361,32 @@ func init() {
func
init
()
{
proto
.
RegisterFile
(
"course.proto"
,
fileDescriptor_ad75674299e1bb1e
)
}
func
init
()
{
proto
.
RegisterFile
(
"course.proto"
,
fileDescriptor_ad75674299e1bb1e
)
}
var
fileDescriptor_ad75674299e1bb1e
=
[]
byte
{
var
fileDescriptor_ad75674299e1bb1e
=
[]
byte
{
// 449 bytes of a gzipped FileDescriptorProto
// 431 bytes of a gzipped FileDescriptorProto
0x1f
,
0x8b
,
0x08
,
0x00
,
0x00
,
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x55
,
0x67
,
0x8d
,
0xa7
,
0x27
,
0x7d
,
0x31
,
0x4c
,
0xf9
,
0x06
,
0xa6
,
0xef
,
0x91
,
0x78
,
0x75
,
0x2d
,
0xfe
,
0xb6
,
0x1a
,
0x3c
,
0xe3
,
0xe2
,
0xf4
,
0x50
,
0x74
,
0x53
,
0xbe
,
0x81
,
0xd9
,
0x7b
,
0x74
,
0xf9
,
0xb0
,
0x45
,
0x7a
,
0xbb
,
0x3d
,
0x7d
,
0x74
,
0x28
,
0x73
,
0xee
,
0xb7
,
0xb1
,
0xff
,
0x63
,
0x24
,
0x1e
,
0x5d
,
0x3c
,
0xea
,
0x91
,
0x83
,
0xb7
,
0x5d
,
0x3c
,
0xbe
,
0x2b
,
0x73
,
0xee
,
0xb7
,
0x89
,
0x5e
,
0xfd
,
0x09
,
0x00
,
0x00
,
0xff
,
0xff
,
0x18
,
0x2c
,
0xe0
,
0xbb
,
0x41
,
0x03
,
0x00
,
0x00
,
0xfd
,
0x79
,
0x5e
,
0xfd
,
0x09
,
0x00
,
0x00
,
0xff
,
0xff
,
0x3d
,
0xb6
,
0x49
,
0xa7
,
0x62
,
0x03
,
0x00
,
0x00
,
}
}
protopb/course/course_topic.pb.go
View file @
5339e1d8
...
@@ -29,8 +29,8 @@ type CourseTopic struct {
...
@@ -29,8 +29,8 @@ type CourseTopic struct {
Title
string
`protobuf:"bytes,6,opt,name=Title,proto3" json:"Title,omitempty"`
Title
string
`protobuf:"bytes,6,opt,name=Title,proto3" json:"Title,omitempty"`
Content
string
`protobuf:"bytes,7,opt,name=Content,proto3" json:"Content,omitempty"`
Content
string
`protobuf:"bytes,7,opt,name=Content,proto3" json:"Content,omitempty"`
UserId
int32
`protobuf:"varint,8,opt,name=UserId,proto3" json:"UserId,omitempty"`
UserId
int32
`protobuf:"varint,8,opt,name=UserId,proto3" json:"UserId,omitempty"`
Addtime
*
Timestamp
`protobuf:"bytes
,9,opt,name=Addtime,proto3" json:"Addtime,omitempty"`
Addtime
int64
`protobuf:"varint
,9,opt,name=Addtime,proto3" json:"Addtime,omitempty"`
Updatetime
*
Timestamp
`protobuf:"bytes
,10,opt,name=Updatetime,proto3" json:"Updatetime,omitempty"`
Updatetime
int64
`protobuf:"varint
,10,opt,name=Updatetime,proto3" json:"Updatetime,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
XXX_sizecache
int32
`json:"-"`
...
@@ -117,18 +117,18 @@ func (m *CourseTopic) GetUserId() int32 {
...
@@ -117,18 +117,18 @@ func (m *CourseTopic) GetUserId() int32 {
return
0
return
0
}
}
func
(
m
*
CourseTopic
)
GetAddtime
()
*
Timestamp
{
func
(
m
*
CourseTopic
)
GetAddtime
()
int64
{
if
m
!=
nil
{
if
m
!=
nil
{
return
m
.
Addtime
return
m
.
Addtime
}
}
return
nil
return
0
}
}
func
(
m
*
CourseTopic
)
GetUpdatetime
()
*
Timestamp
{
func
(
m
*
CourseTopic
)
GetUpdatetime
()
int64
{
if
m
!=
nil
{
if
m
!=
nil
{
return
m
.
Updatetime
return
m
.
Updatetime
}
}
return
nil
return
0
}
}
type
CourseTopicReply
struct
{
type
CourseTopicReply
struct
{
...
@@ -138,7 +138,7 @@ type CourseTopicReply struct {
...
@@ -138,7 +138,7 @@ type CourseTopicReply struct {
UserId
int32
`protobuf:"varint,4,opt,name=UserId,proto3" json:"UserId,omitempty"`
UserId
int32
`protobuf:"varint,4,opt,name=UserId,proto3" json:"UserId,omitempty"`
Likes
int32
`protobuf:"varint,5,opt,name=Likes,proto3" json:"Likes,omitempty"`
Likes
int32
`protobuf:"varint,5,opt,name=Likes,proto3" json:"Likes,omitempty"`
Unlikes
int32
`protobuf:"varint,6,opt,name=Unlikes,proto3" json:"Unlikes,omitempty"`
Unlikes
int32
`protobuf:"varint,6,opt,name=Unlikes,proto3" json:"Unlikes,omitempty"`
Addtime
*
Timestamp
`protobuf:"bytes
,7,opt,name=Addtime,proto3" json:"Addtime,omitempty"`
Addtime
int64
`protobuf:"varint
,7,opt,name=Addtime,proto3" json:"Addtime,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
XXX_sizecache
int32
`json:"-"`
...
@@ -211,11 +211,11 @@ func (m *CourseTopicReply) GetUnlikes() int32 {
...
@@ -211,11 +211,11 @@ func (m *CourseTopicReply) GetUnlikes() int32 {
return
0
return
0
}
}
func
(
m
*
CourseTopicReply
)
GetAddtime
()
*
Timestamp
{
func
(
m
*
CourseTopicReply
)
GetAddtime
()
int64
{
if
m
!=
nil
{
if
m
!=
nil
{
return
m
.
Addtime
return
m
.
Addtime
}
}
return
nil
return
0
}
}
type
TopicRequest
struct
{
type
TopicRequest
struct
{
...
@@ -306,28 +306,27 @@ func init() {
...
@@ -306,28 +306,27 @@ func init() {
func
init
()
{
proto
.
RegisterFile
(
"course_topic.proto"
,
fileDescriptor_f51a07ace88d3cfc
)
}
func
init
()
{
proto
.
RegisterFile
(
"course_topic.proto"
,
fileDescriptor_f51a07ace88d3cfc
)
}
var
fileDescriptor_f51a07ace88d3cfc
=
[]
byte
{
var
fileDescriptor_f51a07ace88d3cfc
=
[]
byte
{
// 360 bytes of a gzipped FileDescriptorProto
// 337 bytes of a gzipped FileDescriptorProto
0x1f
,
0x8b
,
0x08
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x02
,
0xff
,
0x84
,
0x92
,
0x41
,
0x4f
,
0x83
,
0x40
,
0x1f
,
0x8b
,
0x08
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x02
,
0xff
,
0x74
,
0x92
,
0xc1
,
0x4b
,
0xc3
,
0x30
,
0x10
,
0x85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,
0x09
,
0x00
,
0x00
,
0xff
,
0xff
,
0x5e
,
0x1f
,
0xc4
,
0xb7
,
0xa4
,
0x02
,
0x00
,
0x9e
,
0xfe
,
0x72
,
0xf5
,
0xbf
,
0x5f
,
0x5c
,
0xb5
,
0xbf
,
0x57
,
0xdf
,
0x01
,
0x00
,
0x00
,
0xff
,
0xff
,
0x00
,
0x79
,
0x8f
,
0x11
,
0xab
,
0xeb
,
0x02
,
0x00
,
0x00
,
}
}
protos/course.proto
View file @
5339e1d8
syntax
=
"proto3"
;
syntax
=
"proto3"
;
import
"common.proto"
;
package
course
;
package
course
;
service
CourseService
{
service
CourseService
{
rpc
ListForTop
(
ListRequest
)
returns
(
ListResponse
);
rpc
ListForTop
(
ListRequest
)
returns
(
ListResponse
);
rpc
GetDetail
(
DetailRequest
)
returns
(
DetailResponse
);
rpc
GetDetail
(
DetailRequest
)
returns
(
DetailResponse
);
...
@@ -15,7 +13,7 @@ message CourseModel{
...
@@ -15,7 +13,7 @@ message CourseModel{
float
course_price
=
5
;
float
course_price
=
5
;
float
course_price2
=
6
;
float
course_price2
=
6
;
// @inject_tag: gorm:"type:timestamp"
// @inject_tag: gorm:"type:timestamp"
common.Timestamp
addtime
=
7
;
int64
addtime
=
7
;
}
}
message
ListRequest
{
message
ListRequest
{
...
...
protos/course_topic.proto
View file @
5339e1d8
syntax
=
"proto3"
;
syntax
=
"proto3"
;
import
"common.proto"
;
package
course
;
package
course
;
message
CourseTopic
{
message
CourseTopic
{
int32
Id
=
1
;
int32
Id
=
1
;
int32
CourseId
=
2
;
int32
CourseId
=
2
;
int32
CourseDid
=
3
;
int32
CourseDid
=
3
;
int32
Likes
=
4
;
int32
Likes
=
4
;
int32
Unlikes
=
5
;
int32
Unlikes
=
5
;
string
Title
=
6
;
string
Title
=
6
;
string
Content
=
7
;
string
Content
=
7
;
int32
UserId
=
8
;
int32
UserId
=
8
;
common.Timestamp
Addtime
=
9
;
int64
Addtime
=
9
;
common.Timestamp
Updatetime
=
10
;
int64
Updatetime
=
10
;
}
}
message
CourseTopicReply
{
message
CourseTopicReply
{
int32
Id
=
1
;
int32
Id
=
1
;
int32
TopicId
=
2
;
int32
TopicId
=
2
;
string
Content
=
3
;
string
Content
=
3
;
int32
UserId
=
4
;
int32
UserId
=
4
;
int32
Likes
=
5
;
int32
Likes
=
5
;
int32
Unlikes
=
6
;
int32
Unlikes
=
6
;
common.Timestamp
Addtime
=
7
;
int64
Addtime
=
7
;
}
}
message
TopicRequest
{
message
TopicRequest
{
int32
CourseId
=
1
;
int32
CourseId
=
1
;
}
}
message
TopicResponse
{
message
TopicResponse
{
repeated
CourseTopic
result
=
1
;
repeated
CourseTopic
result
=
1
;
}
}
service
CourseTopicService
{
service
CourseTopicService
{
rpc
GetTopic
(
TopicRequest
)
returns
(
TopicResponse
);
rpc
GetTopic
(
TopicRequest
)
returns
(
TopicResponse
);
...
...
service/course_service.go
View file @
5339e1d8
...
@@ -2,7 +2,7 @@ package service
...
@@ -2,7 +2,7 @@ package service
import
(
import
(
"context"
"context"
"search_server/
M
apper"
"search_server/
m
apper"
.
"search_server/protopb/course"
.
"search_server/protopb/course"
)
)
...
@@ -14,7 +14,7 @@ type CourseServiceImpl struct{}
...
@@ -14,7 +14,7 @@ type CourseServiceImpl struct{}
func
(
this
*
CourseServiceImpl
)
ListForTop
(
ctx
context
.
Context
,
req
*
ListRequest
,
rsp
*
ListResponse
)
error
{
func
(
this
*
CourseServiceImpl
)
ListForTop
(
ctx
context
.
Context
,
req
*
ListRequest
,
rsp
*
ListResponse
)
error
{
course
:=
make
([]
*
CourseModel
,
0
)
course
:=
make
([]
*
CourseModel
,
0
)
err
:=
M
apper
.
GetCourseListBySql
(
req
.
Size
)
.
Find
(
&
course
)
.
Error
err
:=
m
apper
.
GetCourseListBySql
(
req
.
Size
)
.
Find
(
&
course
)
.
Error
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
@@ -24,13 +24,13 @@ func (this *CourseServiceImpl) ListForTop(ctx context.Context, req *ListRequest,
...
@@ -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
{
func
(
this
*
CourseServiceImpl
)
GetDetail
(
ctx
context
.
Context
,
req
*
DetailRequest
,
rsp
*
DetailResponse
)
error
{
//只取课程详细
//只取课程详细
if
req
.
FetchType
==
0
||
req
.
FetchType
==
1
||
req
.
FetchType
==
3
{
if
req
.
FetchType
==
0
||
req
.
FetchType
==
1
||
req
.
FetchType
==
3
{
if
err
:=
M
apper
.
GetCourseDetail
(
int
(
req
.
CourseId
))
.
Find
(
rsp
.
Course
)
.
Error
;
err
!=
nil
{
if
err
:=
m
apper
.
GetCourseDetail
(
int
(
req
.
CourseId
))
.
Find
(
rsp
.
Course
)
.
Error
;
err
!=
nil
{
return
err
return
err
}
}
}
}
//只取计数表详细
//只取计数表详细
if
req
.
FetchType
==
2
||
req
.
FetchType
==
3
{
if
req
.
FetchType
==
2
||
req
.
FetchType
==
3
{
if
err
:=
M
apper
.
GetCourseCounts
(
int
(
req
.
CourseId
))
.
Find
(
&
rsp
.
Counts
)
.
Error
;
err
!=
nil
{
if
err
:=
m
apper
.
GetCourseCounts
(
int
(
req
.
CourseId
))
.
Find
(
&
rsp
.
Counts
)
.
Error
;
err
!=
nil
{
return
err
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