作者 tangxvhui

bug 修复

@@ -35,5 +35,17 @@ func (command CreatePartnerInfoCommand) ValidateCommand() error { @@ -35,5 +35,17 @@ func (command CreatePartnerInfoCommand) ValidateCommand() error {
35 command.PartnerCategory == domain.PARTNER_CATEGORY_3) { 35 command.PartnerCategory == domain.PARTNER_CATEGORY_3) {
36 return lib.ThrowError(lib.ARG_ERROR, "合伙类别错误") 36 return lib.ThrowError(lib.ARG_ERROR, "合伙类别错误")
37 } 37 }
  38 + if len(command.PartnerName) == 0 {
  39 + return lib.ThrowError(lib.ARG_ERROR, "合伙人名称必填")
  40 + }
  41 + if len(command.Account) == 0 {
  42 + return lib.ThrowError(lib.ARG_ERROR, "合伙人账号必填")
  43 + }
  44 + if command.RegionInfo == nil {
  45 + return lib.ThrowError(lib.ARG_ERROR, "区域必填")
  46 + }
  47 + if len(command.Salesman) == 0 {
  48 + return lib.ThrowError(lib.ARG_ERROR, "关联业务员必填")
  49 + }
38 return nil 50 return nil
39 } 51 }
@@ -33,17 +33,19 @@ func (controller BaseController) ResponseError(err error) { @@ -33,17 +33,19 @@ func (controller BaseController) ResponseError(err error) {
33 Data: struct{}{}, 33 Data: struct{}{},
34 } 34 }
35 controller.ServeJSON() 35 controller.ServeJSON()
36 - logs.Error(err) 36 + logs.Error(e.Prefix, e.Message)
37 return 37 return
38 } 38 }
  39 +
  40 + } else {
  41 + controller.Data["json"] = protocol.ResponseData{
  42 + Code: -1,
  43 + Msg: err.Error(),
  44 + Data: struct{}{},
  45 + }
  46 + controller.ServeJSON()
  47 + logs.Error(err)
39 } 48 }
40 - controller.Data["json"] = protocol.ResponseData{  
41 - Code: -1,  
42 - Msg: err.Error(),  
43 - Data: struct{}{},  
44 - }  
45 - controller.ServeJSON()  
46 - logs.Error(err)  
47 return 49 return
48 } 50 }
49 51
@@ -170,8 +170,8 @@ func (c *PartnerInfoController) GetPartnerInfo() { @@ -170,8 +170,8 @@ func (c *PartnerInfoController) GetPartnerInfo() {
170 "area": partnerInfo.RegionInfo.RegionName, 170 "area": partnerInfo.RegionInfo.RegionName,
171 "salesmanName": "", 171 "salesmanName": "",
172 "phone": "", 172 "phone": "",
173 - "createTime": partnerInfo.CreateAt.Format("2006-01-02 15:04:05"),  
174 - "cooperationTime": partnerInfo.CooperateTime.Format("2006-01-02"), 173 + "createTime": partnerInfo.CreateAt.Local().Format("2006-01-02 15:04:05"),
  174 + "cooperationTime": partnerInfo.CooperateTime.Local().Format("2006-01-02"),
175 "state": partnerInfo.Status, 175 "state": partnerInfo.Status,
176 "id": partnerInfo.Id, 176 "id": partnerInfo.Id,
177 } 177 }
@@ -187,8 +187,8 @@ func (c *PartnerInfoController) GetPartnerInfo() { @@ -187,8 +187,8 @@ func (c *PartnerInfoController) GetPartnerInfo() {
187 func (c *PartnerInfoController) PartnerInfoSetState() { 187 func (c *PartnerInfoController) PartnerInfoSetState() {
188 //用与适配前端定义的数据结构 188 //用与适配前端定义的数据结构
189 type Parameter struct { 189 type Parameter struct {
190 - Id int64 `json:"id"`  
191 - status string `json:"status"` 190 + Id int64 `json:"id"`
  191 + status int `json:"status"`
192 } 192 }
193 var ( 193 var (
194 param Parameter 194 param Parameter
@@ -203,10 +203,10 @@ func (c *PartnerInfoController) PartnerInfoSetState() { @@ -203,10 +203,10 @@ func (c *PartnerInfoController) PartnerInfoSetState() {
203 cmd := partnerInfoCmd.StatusPartnerInfoCommand{ 203 cmd := partnerInfoCmd.StatusPartnerInfoCommand{
204 Id: param.Id, 204 Id: param.Id,
205 } 205 }
206 - if param.status == "1" { 206 + if param.status == 1 {
207 //禁用操作 207 //禁用操作
208 cmd.Status = domain.PARTNER_STATUS_NO 208 cmd.Status = domain.PARTNER_STATUS_NO
209 - } else if param.status == "2" { 209 + } else if param.status == 2 {
210 //启用操作 210 //启用操作
211 cmd.Status = domain.PARTNER_STATUS_YES 211 cmd.Status = domain.PARTNER_STATUS_YES
212 } else { 212 } else {
@@ -270,8 +270,8 @@ func (c *PartnerInfoController) ListPartnerInfo() { @@ -270,8 +270,8 @@ func (c *PartnerInfoController) ListPartnerInfo() {
270 "account": partners[i].Account, 270 "account": partners[i].Account,
271 "partnerName": partners[i].PartnerName, 271 "partnerName": partners[i].PartnerName,
272 "area": partners[i].RegionInfo.RegionName, 272 "area": partners[i].RegionInfo.RegionName,
273 - "createTime": partners[i].CreateAt.Format("2006-01-02 15:04:05"),  
274 - "cooperationTime": partners[i].CooperateTime.Format("2006-01-02"), 273 + "createTime": partners[i].CreateAt.Local().Format("2006-01-02 15:04:05"),
  274 + "cooperationTime": partners[i].CooperateTime.Local().Format("2006-01-02"),
275 "state": partners[i].Status, 275 "state": partners[i].Status,
276 "partnerType": partners[i].PartnerCategory, 276 "partnerType": partners[i].PartnerCategory,
277 "salesmanName": "", 277 "salesmanName": "",