|
@@ -40,7 +40,7 @@ func (c *PartnerInfoController) CreatePartnerInfo() { |
|
@@ -40,7 +40,7 @@ func (c *PartnerInfoController) CreatePartnerInfo() { |
40
|
PartnerType int `json:"partnerType"`
|
40
|
PartnerType int `json:"partnerType"`
|
41
|
Area string `json:"area"`
|
41
|
Area string `json:"area"`
|
42
|
Account string `json:"account"`
|
42
|
Account string `json:"account"`
|
43
|
- State string `json:"state"`
|
43
|
+ State int `json:"state"`
|
44
|
CooperationTime string `json:"cooperationTime"`
|
44
|
CooperationTime string `json:"cooperationTime"`
|
45
|
SalesmanName string `json:"salesmanName"`
|
45
|
SalesmanName string `json:"salesmanName"`
|
46
|
Phone string `json:"phone"`
|
46
|
Phone string `json:"phone"`
|
|
@@ -55,10 +55,9 @@ func (c *PartnerInfoController) CreatePartnerInfo() { |
|
@@ -55,10 +55,9 @@ func (c *PartnerInfoController) CreatePartnerInfo() { |
55
|
return
|
55
|
return
|
56
|
}
|
56
|
}
|
57
|
defaultPwd := fmt.Sprintf("%x", sha1.Sum([]byte("123456")))
|
57
|
defaultPwd := fmt.Sprintf("%x", sha1.Sum([]byte("123456")))
|
58
|
- state, _ := strconv.Atoi(param.State)
|
|
|
59
|
cooperateTime, err := time.ParseInLocation("2006-01-02", param.CooperationTime, time.Local)
|
58
|
cooperateTime, err := time.ParseInLocation("2006-01-02", param.CooperationTime, time.Local)
|
60
|
if err != nil {
|
59
|
if err != nil {
|
61
|
- e := lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
60
|
+ e := lib.ThrowError(lib.ARG_ERROR, err.Error())
|
62
|
c.ResponseError(e)
|
61
|
c.ResponseError(e)
|
63
|
return
|
62
|
return
|
64
|
}
|
63
|
}
|
|
@@ -66,12 +65,9 @@ func (c *PartnerInfoController) CreatePartnerInfo() { |
|
@@ -66,12 +65,9 @@ func (c *PartnerInfoController) CreatePartnerInfo() { |
66
|
PartnerName: param.PartnerName,
|
65
|
PartnerName: param.PartnerName,
|
67
|
Account: param.Account,
|
66
|
Account: param.Account,
|
68
|
Password: defaultPwd,
|
67
|
Password: defaultPwd,
|
69
|
- Status: state,
|
68
|
+ Status: param.State,
|
70
|
PartnerCategory: param.PartnerType,
|
69
|
PartnerCategory: param.PartnerType,
|
71
|
CooperateTime: cooperateTime,
|
70
|
CooperateTime: cooperateTime,
|
72
|
- RegionInfo: &domain.RegionInfo{
|
|
|
73
|
- RegionName: param.Area,
|
|
|
74
|
- },
|
|
|
75
|
Salesman: []domain.Salesman{
|
71
|
Salesman: []domain.Salesman{
|
76
|
domain.Salesman{
|
72
|
domain.Salesman{
|
77
|
Name: param.SalesmanName,
|
73
|
Name: param.SalesmanName,
|
|
@@ -79,6 +75,11 @@ func (c *PartnerInfoController) CreatePartnerInfo() { |
|
@@ -79,6 +75,11 @@ func (c *PartnerInfoController) CreatePartnerInfo() { |
79
|
},
|
75
|
},
|
80
|
},
|
76
|
},
|
81
|
}
|
77
|
}
|
|
|
78
|
+ if len(param.Area) > 0 {
|
|
|
79
|
+ cmd.RegionInfo = &domain.RegionInfo{
|
|
|
80
|
+ RegionName: param.Area,
|
|
|
81
|
+ }
|
|
|
82
|
+ }
|
82
|
serve := partnerInfoService.NewPartnerInfoService(nil)
|
83
|
serve := partnerInfoService.NewPartnerInfoService(nil)
|
83
|
_, err = serve.CreatePartnerInfo(&cmd)
|
84
|
_, err = serve.CreatePartnerInfo(&cmd)
|
84
|
if err != nil {
|
85
|
if err != nil {
|
|
@@ -96,7 +97,7 @@ func (c *PartnerInfoController) UpdatePartnerInfo() { |
|
@@ -96,7 +97,7 @@ func (c *PartnerInfoController) UpdatePartnerInfo() { |
96
|
ID int64 `json:"id"`
|
97
|
ID int64 `json:"id"`
|
97
|
PartnerType int `json:"partnerType"`
|
98
|
PartnerType int `json:"partnerType"`
|
98
|
Area string `json:"area"`
|
99
|
Area string `json:"area"`
|
99
|
- State string `json:"state"`
|
100
|
+ State int `json:"state"`
|
100
|
CooperationTime string `json:"cooperationTime"`
|
101
|
CooperationTime string `json:"cooperationTime"`
|
101
|
SalesmanName string `json:"salesmanName"`
|
102
|
SalesmanName string `json:"salesmanName"`
|
102
|
Phone string `json:"phone"`
|
103
|
Phone string `json:"phone"`
|
|
@@ -110,7 +111,6 @@ func (c *PartnerInfoController) UpdatePartnerInfo() { |
|
@@ -110,7 +111,6 @@ func (c *PartnerInfoController) UpdatePartnerInfo() { |
110
|
c.ResponseError(errors.New("json数据解析失败"))
|
111
|
c.ResponseError(errors.New("json数据解析失败"))
|
111
|
return
|
112
|
return
|
112
|
}
|
113
|
}
|
113
|
- state, _ := strconv.Atoi(param.State)
|
|
|
114
|
cooperateTime, err := time.ParseInLocation("2006-01-02", param.CooperationTime, time.Local)
|
114
|
cooperateTime, err := time.ParseInLocation("2006-01-02", param.CooperationTime, time.Local)
|
115
|
if err != nil {
|
115
|
if err != nil {
|
116
|
e := lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
116
|
e := lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
@@ -118,7 +118,8 @@ func (c *PartnerInfoController) UpdatePartnerInfo() { |
|
@@ -118,7 +118,8 @@ func (c *PartnerInfoController) UpdatePartnerInfo() { |
118
|
return
|
118
|
return
|
119
|
}
|
119
|
}
|
120
|
cmd := partnerInfoCmd.UpdatePartnerInfoCommand{
|
120
|
cmd := partnerInfoCmd.UpdatePartnerInfoCommand{
|
121
|
- Status: state,
|
121
|
+ Id: param.ID,
|
|
|
122
|
+ Status: param.State,
|
122
|
PartnerCategory: param.PartnerType,
|
123
|
PartnerCategory: param.PartnerType,
|
123
|
CooperateTime: cooperateTime,
|
124
|
CooperateTime: cooperateTime,
|
124
|
RegionInfo: &domain.RegionInfo{
|
125
|
RegionInfo: &domain.RegionInfo{
|
|
@@ -168,13 +169,13 @@ func (c *PartnerInfoController) GetPartnerInfo() { |
|
@@ -168,13 +169,13 @@ func (c *PartnerInfoController) GetPartnerInfo() { |
168
|
rspResult := map[string]interface{}{
|
169
|
rspResult := map[string]interface{}{
|
169
|
"account": partnerInfo.Account,
|
170
|
"account": partnerInfo.Account,
|
170
|
"partnerName": partnerInfo.PartnerName,
|
171
|
"partnerName": partnerInfo.PartnerName,
|
171
|
- "partnertype": partnerInfo.PartnerCategory,
|
172
|
+ "partnerType": partnerInfo.PartnerCategory,
|
172
|
"area": partnerInfo.RegionInfo.RegionName,
|
173
|
"area": partnerInfo.RegionInfo.RegionName,
|
173
|
"salesmanName": "",
|
174
|
"salesmanName": "",
|
174
|
"phone": "",
|
175
|
"phone": "",
|
175
|
- "createTime": partnerInfo.CreateAt.Format("2006-01-02 15:04:05"),
|
|
|
176
|
- "cooperationTime": partnerInfo.CooperateTime.Format("2006-01-02"),
|
|
|
177
|
- "state": fmt.Sprint(partnerInfo.Status),
|
176
|
+ "createTime": partnerInfo.CreateAt.Local().Format("2006-01-02 15:04:05"),
|
|
|
177
|
+ "cooperationTime": partnerInfo.CooperateTime.Local().Format("2006-01-02"),
|
|
|
178
|
+ "state": partnerInfo.Status,
|
178
|
"id": partnerInfo.Id,
|
179
|
"id": partnerInfo.Id,
|
179
|
}
|
180
|
}
|
180
|
if len(partnerInfo.Salesman) > 0 {
|
181
|
if len(partnerInfo.Salesman) > 0 {
|
|
@@ -185,12 +186,12 @@ func (c *PartnerInfoController) GetPartnerInfo() { |
|
@@ -185,12 +186,12 @@ func (c *PartnerInfoController) GetPartnerInfo() { |
185
|
return
|
186
|
return
|
186
|
}
|
187
|
}
|
187
|
|
188
|
|
188
|
-//GetPartnerInfo 移除合伙人
|
189
|
+//PartnerInfoSetState 合伙人禁用启用
|
189
|
func (c *PartnerInfoController) PartnerInfoSetState() {
|
190
|
func (c *PartnerInfoController) PartnerInfoSetState() {
|
190
|
//用与适配前端定义的数据结构
|
191
|
//用与适配前端定义的数据结构
|
191
|
type Parameter struct {
|
192
|
type Parameter struct {
|
192
|
Id int64 `json:"id"`
|
193
|
Id int64 `json:"id"`
|
193
|
- status string `json:"status"`
|
194
|
+ Status int `json:"status"`
|
194
|
}
|
195
|
}
|
195
|
var (
|
196
|
var (
|
196
|
param Parameter
|
197
|
param Parameter
|
|
@@ -205,10 +206,10 @@ func (c *PartnerInfoController) PartnerInfoSetState() { |
|
@@ -205,10 +206,10 @@ func (c *PartnerInfoController) PartnerInfoSetState() { |
205
|
cmd := partnerInfoCmd.StatusPartnerInfoCommand{
|
206
|
cmd := partnerInfoCmd.StatusPartnerInfoCommand{
|
206
|
Id: param.Id,
|
207
|
Id: param.Id,
|
207
|
}
|
208
|
}
|
208
|
- if param.status == "1" {
|
209
|
+ if param.Status == 1 {
|
209
|
//禁用操作
|
210
|
//禁用操作
|
210
|
cmd.Status = domain.PARTNER_STATUS_NO
|
211
|
cmd.Status = domain.PARTNER_STATUS_NO
|
211
|
- } else if param.status == "2" {
|
212
|
+ } else if param.Status == 2 {
|
212
|
//启用操作
|
213
|
//启用操作
|
213
|
cmd.Status = domain.PARTNER_STATUS_YES
|
214
|
cmd.Status = domain.PARTNER_STATUS_YES
|
214
|
} else {
|
215
|
} else {
|
|
@@ -272,9 +273,10 @@ func (c *PartnerInfoController) ListPartnerInfo() { |
|
@@ -272,9 +273,10 @@ func (c *PartnerInfoController) ListPartnerInfo() { |
272
|
"account": partners[i].Account,
|
273
|
"account": partners[i].Account,
|
273
|
"partnerName": partners[i].PartnerName,
|
274
|
"partnerName": partners[i].PartnerName,
|
274
|
"area": partners[i].RegionInfo.RegionName,
|
275
|
"area": partners[i].RegionInfo.RegionName,
|
275
|
- "createTime": partners[i].CreateAt.Format("2006-01-02 15:04:05"),
|
|
|
276
|
- "cooperationTime": partners[i].CooperateTime.Format("2006-01-02"),
|
|
|
277
|
- "state": fmt.Sprint(partners[i].Status),
|
276
|
+ "createTime": partners[i].CreateAt.Local().Format("2006-01-02 15:04:05"),
|
|
|
277
|
+ "cooperationTime": partners[i].CooperateTime.Local().Format("2006-01-02"),
|
|
|
278
|
+ "state": partners[i].Status,
|
|
|
279
|
+ "partnerType": partners[i].PartnerCategory,
|
278
|
"salesmanName": "",
|
280
|
"salesmanName": "",
|
279
|
"phone": "",
|
281
|
"phone": "",
|
280
|
}
|
282
|
}
|