|
@@ -10,15 +10,16 @@ import (
|
|
|
"time"
|
|
|
)
|
|
|
|
|
|
-// CompanyServiceRecordController 客户-服务记录
|
|
|
+// CompanyServiceRecordController 客户-沟通记录
|
|
|
type CompanyServiceRecordController struct {
|
|
|
BaseAuthController
|
|
|
}
|
|
|
|
|
|
// ServiceRecordList
|
|
|
-// @Title 服务记录列表
|
|
|
-// @Description 服务记录列表
|
|
|
+// @Title 沟通记录列表
|
|
|
+// @Description 沟通记录列表
|
|
|
// @Param CompanyId query int true "客户ID"
|
|
|
+// @Param CompanyType query int true "客户类型,0:中文客户,1:英文客户"
|
|
|
// @Success Ret=200 获取成功
|
|
|
// @router /service_record/list [get]
|
|
|
func (this *CompanyServiceRecordController) ServiceRecordList() {
|
|
@@ -42,15 +43,16 @@ func (this *CompanyServiceRecordController) ServiceRecordList() {
|
|
|
br.Msg = "参数有误"
|
|
|
return
|
|
|
}
|
|
|
+ companyType, _ := this.GetInt("CompanyType", 2)
|
|
|
|
|
|
recordOB := new(company.CompanyServiceRecord)
|
|
|
- recordCond := fmt.Sprintf(` AND %s = ?`, company.CompanyServiceRecordColumns.CompanyId)
|
|
|
+ recordCond := fmt.Sprintf(` AND %s = ? AND company_type = ? `, company.CompanyServiceRecordColumns.CompanyId)
|
|
|
recordPars := make([]interface{}, 0)
|
|
|
- recordPars = append(recordPars, companyId)
|
|
|
+ recordPars = append(recordPars, companyId, companyType)
|
|
|
records, e := recordOB.GetItemsByCondition(recordCond, recordPars, []string{}, "")
|
|
|
if e != nil {
|
|
|
br.Msg = "获取失败"
|
|
|
- br.ErrMsg = "获取客户服务记录失败, Err: " + e.Error()
|
|
|
+ br.ErrMsg = "获取客户沟通记录失败, Err: " + e.Error()
|
|
|
return
|
|
|
}
|
|
|
respList := make([]*company.CompanyServiceRecordItem, 0)
|
|
@@ -72,8 +74,8 @@ func (this *CompanyServiceRecordController) ServiceRecordList() {
|
|
|
}
|
|
|
|
|
|
// ServiceRecordAdd
|
|
|
-// @Title 新增服务记录
|
|
|
-// @Description 新增服务记录
|
|
|
+// @Title 新增沟通记录
|
|
|
+// @Description 新增沟通记录
|
|
|
// @Param request body company.CompanyServiceRecordAddReq true "type json string"
|
|
|
// @Success Ret=200 操作成功
|
|
|
// @router /service_record/add [post]
|
|
@@ -105,15 +107,21 @@ func (this *CompanyServiceRecordController) ServiceRecordAdd() {
|
|
|
}
|
|
|
req.Content = strings.TrimSpace(req.Content)
|
|
|
if req.Content == "" {
|
|
|
- br.Msg = "请输入服务描述"
|
|
|
+ br.Msg = "请输入沟通描述"
|
|
|
return
|
|
|
}
|
|
|
if len([]rune(req.Content)) > 100 {
|
|
|
- br.Msg = "服务描述不可超过100个字符"
|
|
|
+ br.Msg = "沟通描述不可超过100个字符"
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ // 默认中文客户
|
|
|
+ if req.CompanyType == 0 {
|
|
|
+ req.CompanyType = 2
|
|
|
+ }
|
|
|
+
|
|
|
item := new(company.CompanyServiceRecord)
|
|
|
+ item.CompanyType = req.CompanyType
|
|
|
item.CompanyId = req.CompanyId
|
|
|
item.Content = req.Content
|
|
|
item.SysAdminId = sysUser.AdminId
|
|
@@ -122,7 +130,7 @@ func (this *CompanyServiceRecordController) ServiceRecordAdd() {
|
|
|
item.ModifyTime = time.Now().Local()
|
|
|
if e := item.Create(); e != nil {
|
|
|
br.Msg = "操作失败"
|
|
|
- br.ErrMsg = "新增服务记录失败, Err: " + e.Error()
|
|
|
+ br.ErrMsg = "新增沟通记录失败, Err: " + e.Error()
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -132,8 +140,8 @@ func (this *CompanyServiceRecordController) ServiceRecordAdd() {
|
|
|
}
|
|
|
|
|
|
// ServiceRecordDel
|
|
|
-// @Title 删除服务记录
|
|
|
-// @Description 删除服务记录
|
|
|
+// @Title 删除沟通记录
|
|
|
+// @Description 删除沟通记录
|
|
|
// @Param request body company.CompanyServiceRecordDelReq true "type json string"
|
|
|
// @Success Ret=200 操作成功
|
|
|
// @router /service_record/del [post]
|
|
@@ -167,16 +175,16 @@ func (this *CompanyServiceRecordController) ServiceRecordDel() {
|
|
|
item := new(company.CompanyServiceRecord)
|
|
|
if e := item.GetItemById(req.CompanyServiceRecordId); e != nil {
|
|
|
if e.Error() == utils.ErrNoRow() {
|
|
|
- br.Msg = "服务记录已被删除, 请刷新页面"
|
|
|
+ br.Msg = "沟通记录已被删除, 请刷新页面"
|
|
|
return
|
|
|
}
|
|
|
br.Msg = "操作失败"
|
|
|
- br.ErrMsg = "获取服务记录失败, Err: " + e.Error()
|
|
|
+ br.ErrMsg = "获取沟通记录失败, Err: " + e.Error()
|
|
|
return
|
|
|
}
|
|
|
if e := item.Del(); e != nil {
|
|
|
br.Msg = "操作失败"
|
|
|
- br.ErrMsg = "删除服务记录失败, Err: " + e.Error()
|
|
|
+ br.ErrMsg = "删除沟通记录失败, Err: " + e.Error()
|
|
|
return
|
|
|
}
|
|
|
|