|
@@ -0,0 +1,75 @@
|
|
|
+package logic
|
|
|
+
|
|
|
+import (
|
|
|
+ "app.yhyue.com/moapp/jybase/date"
|
|
|
+ T "bp.jydev.jianyu360.cn/CRM/application/api/common"
|
|
|
+ "context"
|
|
|
+ "time"
|
|
|
+
|
|
|
+ "bp.jydev.jianyu360.cn/CRM/application/api/internal/svc"
|
|
|
+ "bp.jydev.jianyu360.cn/CRM/application/api/internal/types"
|
|
|
+
|
|
|
+ "github.com/zeromicro/go-zero/core/logx"
|
|
|
+)
|
|
|
+
|
|
|
+type IgnoreActionLogic struct {
|
|
|
+ logx.Logger
|
|
|
+ ctx context.Context
|
|
|
+ svcCtx *svc.ServiceContext
|
|
|
+}
|
|
|
+
|
|
|
+func NewIgnoreActionLogic(ctx context.Context, svcCtx *svc.ServiceContext) *IgnoreActionLogic {
|
|
|
+ return &IgnoreActionLogic{
|
|
|
+ Logger: logx.WithContext(ctx),
|
|
|
+ ctx: ctx,
|
|
|
+ svcCtx: svcCtx,
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+func (l *IgnoreActionLogic) IgnoreAction(req *types.IgnoreReq) (resp *types.Reply, err error) {
|
|
|
+ resp = &types.Reply{}
|
|
|
+ query := map[string]interface{}{
|
|
|
+ "position_id": req.PositionId,
|
|
|
+ "itype": req.Source,
|
|
|
+ "relate_id": req.RelateId,
|
|
|
+ }
|
|
|
+ info := T.CrmMysql.FindOne("connection_status", query, "id", "")
|
|
|
+ if info != nil && len(*info) > 0 {
|
|
|
+ update := map[string]interface{}{
|
|
|
+ "is_ignore": req.Action,
|
|
|
+ }
|
|
|
+ if req.Action == 1 {
|
|
|
+ update["is_handle"] = 1
|
|
|
+ }
|
|
|
+ b := T.CrmMysql.Update("connection_status", query, update)
|
|
|
+ if !b {
|
|
|
+ resp.Error_code = -1
|
|
|
+ resp.Error_msg = "更新失败"
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ if req.Action == 1 {
|
|
|
+ save := map[string]interface{}{
|
|
|
+ "position_id": req.PositionId,
|
|
|
+ "ent_id": req.EntId,
|
|
|
+ "ent_dept_id": req.EntDeptId,
|
|
|
+ "ent_user id": req.EntUserId,
|
|
|
+ "relate_id": req.RelateId,
|
|
|
+ "itype": req.Source,
|
|
|
+ "is_handle": 1,
|
|
|
+ "is_ignore": req.Action,
|
|
|
+ "create_time": time.Now().Format(date.Date_Full_Layout),
|
|
|
+ "update_time": time.Now().Format(date.Date_Full_Layout),
|
|
|
+ }
|
|
|
+ i := T.CrmMysql.Insert("connection_status", save)
|
|
|
+ if i <= 0 {
|
|
|
+ resp.Error_code = -1
|
|
|
+ resp.Error_msg = "更新失败"
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ resp.Error_code = -1
|
|
|
+ resp.Error_msg = "更新失败"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|