作者 tangxvhui

bug 修复

... ... @@ -35,5 +35,17 @@ func (command CreatePartnerInfoCommand) ValidateCommand() error {
command.PartnerCategory == domain.PARTNER_CATEGORY_3) {
return lib.ThrowError(lib.ARG_ERROR, "合伙类别错误")
}
if len(command.PartnerName) == 0 {
return lib.ThrowError(lib.ARG_ERROR, "合伙人名称必填")
}
if len(command.Account) == 0 {
return lib.ThrowError(lib.ARG_ERROR, "合伙人账号必填")
}
if command.RegionInfo == nil {
return lib.ThrowError(lib.ARG_ERROR, "区域必填")
}
if len(command.Salesman) == 0 {
return lib.ThrowError(lib.ARG_ERROR, "关联业务员必填")
}
return nil
}
... ...
... ... @@ -33,17 +33,19 @@ func (controller BaseController) ResponseError(err error) {
Data: struct{}{},
}
controller.ServeJSON()
logs.Error(err)
logs.Error(e.Prefix, e.Message)
return
}
} else {
controller.Data["json"] = protocol.ResponseData{
Code: -1,
Msg: err.Error(),
Data: struct{}{},
}
controller.ServeJSON()
logs.Error(err)
}
controller.Data["json"] = protocol.ResponseData{
Code: -1,
Msg: err.Error(),
Data: struct{}{},
}
controller.ServeJSON()
logs.Error(err)
return
}
... ...
... ... @@ -170,8 +170,8 @@ func (c *PartnerInfoController) GetPartnerInfo() {
"area": partnerInfo.RegionInfo.RegionName,
"salesmanName": "",
"phone": "",
"createTime": partnerInfo.CreateAt.Format("2006-01-02 15:04:05"),
"cooperationTime": partnerInfo.CooperateTime.Format("2006-01-02"),
"createTime": partnerInfo.CreateAt.Local().Format("2006-01-02 15:04:05"),
"cooperationTime": partnerInfo.CooperateTime.Local().Format("2006-01-02"),
"state": partnerInfo.Status,
"id": partnerInfo.Id,
}
... ... @@ -187,8 +187,8 @@ func (c *PartnerInfoController) GetPartnerInfo() {
func (c *PartnerInfoController) PartnerInfoSetState() {
//用与适配前端定义的数据结构
type Parameter struct {
Id int64 `json:"id"`
status string `json:"status"`
Id int64 `json:"id"`
status int `json:"status"`
}
var (
param Parameter
... ... @@ -203,10 +203,10 @@ func (c *PartnerInfoController) PartnerInfoSetState() {
cmd := partnerInfoCmd.StatusPartnerInfoCommand{
Id: param.Id,
}
if param.status == "1" {
if param.status == 1 {
//禁用操作
cmd.Status = domain.PARTNER_STATUS_NO
} else if param.status == "2" {
} else if param.status == 2 {
//启用操作
cmd.Status = domain.PARTNER_STATUS_YES
} else {
... ... @@ -270,8 +270,8 @@ func (c *PartnerInfoController) ListPartnerInfo() {
"account": partners[i].Account,
"partnerName": partners[i].PartnerName,
"area": partners[i].RegionInfo.RegionName,
"createTime": partners[i].CreateAt.Format("2006-01-02 15:04:05"),
"cooperationTime": partners[i].CooperateTime.Format("2006-01-02"),
"createTime": partners[i].CreateAt.Local().Format("2006-01-02 15:04:05"),
"cooperationTime": partners[i].CooperateTime.Local().Format("2006-01-02"),
"state": partners[i].Status,
"partnerType": partners[i].PartnerCategory,
"salesmanName": "",
... ...