partner_info.go
2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package controllers
import (
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/application/partnerInfo/command"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/application/partnerInfo/query"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/application/partnerInfo/service"
)
type PartnerInfoController struct {
BaseController
}
//CreatePartnerInfo 创建合伙人
func (controller *PartnerInfoController) CreatePartnerInfo() {
var (
service = service.NewPartnerInfoService(nil)
command = &command.CreatePartnerInfoCommand{}
)
controller.JsonUnmarshal(command)
controller.HandlerResponse(service.CreatePartnerInfo(command))
}
//UpdatePartnerInfo 更新合伙人
func (controller *PartnerInfoController) UpdatePartnerInfo() {
var (
service = service.NewPartnerInfoService(nil)
command = &command.UpdatePartnerInfoCommand{}
)
controller.JsonUnmarshal(command)
id, _ := controller.GetInt(":id")
command.Id = id
controller.HandlerResponse(service.UpdatePartnerInfo(command))
}
//GetPartnerInfo 获取合伙人
func (controller *PartnerInfoController) GetPartnerInfo() {
var (
service = service.NewPartnerInfoService(nil)
command = &query.GetPartnerInfoQuery{}
)
uid, _ := controller.GetInt(":id")
command.Id = uid
controller.HandlerResponse(service.GetPartnerInfo(command))
}
//GetPartnerInfo 移除合伙人
func (controller *PartnerInfoController) RemovePartnerInfo() {
var (
service = service.NewPartnerInfoService(nil)
command = &command.RemovePartnerInfoCommand{}
)
uid, _ := controller.GetInt(":id")
command.Id = uid
controller.HandlerResponse(service.RemovePartnerInfo(command))
}
//ListPartnerInfo 合伙人列表
func (controller *PartnerInfoController) ListPartnerInfo() {
var (
service = service.NewPartnerInfoService(nil)
command = &query.ListPartnerInfoQuery{}
)
command.PartnerCategory, _ = controller.GetInt("partnerCategory")
command.Status, _ = controller.GetInt("status")
command.SortByCreateTime = controller.GetString("sortByCreateTime")
command.SortByUpdateTime = controller.GetString("sortByUpdateTime")
command.Offset, command.Limit = controller.GetLimitInfo()
controller.HandlerResponse(service.ListPartnerInfo(command))
}