作者 tangxvhui

输出格式修改

... ... @@ -40,7 +40,7 @@ func (c *PartnerInfoController) CreatePartnerInfo() {
PartnerType int `json:"partnerType"`
Area string `json:"area"`
Account string `json:"account"`
State string `json:"state"`
State int `json:"state"`
CooperationTime string `json:"cooperationTime"`
SalesmanName string `json:"salesmanName"`
Phone string `json:"phone"`
... ... @@ -55,10 +55,9 @@ func (c *PartnerInfoController) CreatePartnerInfo() {
return
}
defaultPwd := fmt.Sprintf("%x", sha1.Sum([]byte("123456")))
state, _ := strconv.Atoi(param.State)
cooperateTime, err := time.ParseInLocation("2006-01-02", param.CooperationTime, time.Local)
if err != nil {
e := lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
e := lib.ThrowError(lib.ARG_ERROR, err.Error())
c.ResponseError(e)
return
}
... ... @@ -66,7 +65,7 @@ func (c *PartnerInfoController) CreatePartnerInfo() {
PartnerName: param.PartnerName,
Account: param.Account,
Password: defaultPwd,
Status: state,
Status: param.State,
PartnerCategory: param.PartnerType,
CooperateTime: cooperateTime,
RegionInfo: &domain.RegionInfo{
... ... @@ -96,7 +95,7 @@ func (c *PartnerInfoController) UpdatePartnerInfo() {
ID int64 `json:"id"`
PartnerType int `json:"partnerType"`
Area string `json:"area"`
State string `json:"state"`
State int `json:"state"`
CooperationTime string `json:"cooperationTime"`
SalesmanName string `json:"salesmanName"`
Phone string `json:"phone"`
... ... @@ -110,7 +109,6 @@ func (c *PartnerInfoController) UpdatePartnerInfo() {
c.ResponseError(errors.New("json数据解析失败"))
return
}
state, _ := strconv.Atoi(param.State)
cooperateTime, err := time.ParseInLocation("2006-01-02", param.CooperationTime, time.Local)
if err != nil {
e := lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
... ... @@ -118,7 +116,7 @@ func (c *PartnerInfoController) UpdatePartnerInfo() {
return
}
cmd := partnerInfoCmd.UpdatePartnerInfoCommand{
Status: state,
Status: param.State,
PartnerCategory: param.PartnerType,
CooperateTime: cooperateTime,
RegionInfo: &domain.RegionInfo{
... ... @@ -168,13 +166,13 @@ func (c *PartnerInfoController) GetPartnerInfo() {
rspResult := map[string]interface{}{
"account": partnerInfo.Account,
"partnerName": partnerInfo.PartnerName,
"partnertype": partnerInfo.PartnerCategory,
"partnerType": partnerInfo.PartnerCategory,
"area": partnerInfo.RegionInfo.RegionName,
"salesmanName": "",
"phone": "",
"createTime": partnerInfo.CreateAt.Format("2006-01-02 15:04:05"),
"cooperationTime": partnerInfo.CooperateTime.Format("2006-01-02"),
"state": fmt.Sprint(partnerInfo.Status),
"state": partnerInfo.Status,
"id": partnerInfo.Id,
}
if len(partnerInfo.Salesman) > 0 {
... ... @@ -185,7 +183,7 @@ func (c *PartnerInfoController) GetPartnerInfo() {
return
}
//GetPartnerInfo 移除合伙人
//PartnerInfoSetState 合伙人禁用启用
func (c *PartnerInfoController) PartnerInfoSetState() {
//用与适配前端定义的数据结构
type Parameter struct {
... ... @@ -274,7 +272,8 @@ func (c *PartnerInfoController) ListPartnerInfo() {
"area": partners[i].RegionInfo.RegionName,
"createTime": partners[i].CreateAt.Format("2006-01-02 15:04:05"),
"cooperationTime": partners[i].CooperateTime.Format("2006-01-02"),
"state": fmt.Sprint(partners[i].Status),
"state": partners[i].Status,
"partnerType": partners[i].PartnerCategory,
"salesmanName": "",
"phone": "",
}
... ...