service/erp/contact/template.go

74 lines
1.6 KiB
Go
Raw Normal View History

2024-08-19 17:49:26 +08:00
package contact
import (
"context"
client2 "git.kumo.work/shama/service/client"
"git.kumo.work/shama/service/lib/bean"
"time"
)
type template struct {
}
type ArgsTemplateList struct {
Page bean.Page
Search TemplateSearch
}
type TemplateSearch struct {
Type int64 // 类型
Title string // 标题
StaffIds []int64 // 创建人
TemplateIds []int64 // 模板id
}
type ReplyTemplateList struct {
List []TemplateItem `json:"list"`
Total int64 `json:"total"`
}
type TemplateItem struct {
Id int64 `json:"id"`
Type int64 `json:"type"`
Title string `json:"title"`
Content string `json:"content"`
CreatedStaffId int64 `json:"createdStaffId"`
CreatedAt *time.Time `json:"createdAt"`
}
// List @TITLE 列表
func (t *template) List(ctx context.Context, args ArgsTemplateList) (reply ReplyTemplateList, err error) {
xClient, err := client2.GetClient(t)
if err != nil {
return
}
err = xClient.Call(ctx, "List", args, &reply)
return
}
type ArgsTemplateAdd struct {
Type int64 // 类型
Title string // 标题
Content string // 内容
StaffId int64 // 员工id
}
// Add @TITLE 添加
func (t *template) Add(ctx context.Context, args ArgsTemplateAdd) (err error) {
xClient, err := client2.GetClient(t)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "Add", args, &reply)
return
}
// Delete @TITLE 删除
func (t *template) Delete(ctx context.Context, templateIds []int64) (err error) {
xClient, err := client2.GetClient(t)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "Delete", templateIds, &reply)
return
}