...
|
...
|
@@ -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,12 +65,9 @@ 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{
|
|
|
RegionName: param.Area,
|
|
|
},
|
|
|
Salesman: []domain.Salesman{
|
|
|
domain.Salesman{
|
|
|
Name: param.SalesmanName,
|
...
|
...
|
@@ -79,6 +75,11 @@ func (c *PartnerInfoController) CreatePartnerInfo() { |
|
|
},
|
|
|
},
|
|
|
}
|
|
|
if len(param.Area) > 0 {
|
|
|
cmd.RegionInfo = &domain.RegionInfo{
|
|
|
RegionName: param.Area,
|
|
|
}
|
|
|
}
|
|
|
serve := partnerInfoService.NewPartnerInfoService(nil)
|
|
|
_, err = serve.CreatePartnerInfo(&cmd)
|
|
|
if err != nil {
|
...
|
...
|
@@ -96,7 +97,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 +111,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 +118,8 @@ func (c *PartnerInfoController) UpdatePartnerInfo() { |
|
|
return
|
|
|
}
|
|
|
cmd := partnerInfoCmd.UpdatePartnerInfoCommand{
|
|
|
Status: state,
|
|
|
Id: param.ID,
|
|
|
Status: param.State,
|
|
|
PartnerCategory: param.PartnerType,
|
|
|
CooperateTime: cooperateTime,
|
|
|
RegionInfo: &domain.RegionInfo{
|
...
|
...
|
@@ -168,13 +169,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),
|
|
|
"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,
|
|
|
}
|
|
|
if len(partnerInfo.Salesman) > 0 {
|
...
|
...
|
@@ -185,12 +186,12 @@ func (c *PartnerInfoController) GetPartnerInfo() { |
|
|
return
|
|
|
}
|
|
|
|
|
|
//GetPartnerInfo 移除合伙人
|
|
|
//PartnerInfoSetState 合伙人禁用启用
|
|
|
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
|
...
|
...
|
@@ -205,10 +206,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 {
|
...
|
...
|
@@ -272,9 +273,10 @@ 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"),
|
|
|
"state": fmt.Sprint(partners[i].Status),
|
|
|
"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": "",
|
|
|
"phone": "",
|
|
|
}
|
...
|
...
|
|