|
@@ -1,89 +0,0 @@
|
|
|
-package logic
|
|
|
-
|
|
|
-import (
|
|
|
- "app.yhyue.com/moapp/jybase/date"
|
|
|
- "app.yhyue.com/moapp/jypkg/ent/util"
|
|
|
- T "bp.jydev.jianyu360.cn/CRM/application/api/common"
|
|
|
- "context"
|
|
|
- "fmt"
|
|
|
- "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) {
|
|
|
- logx.Info(fmt.Sprintf("%+v", req))
|
|
|
- resp = &types.Reply{}
|
|
|
- rid := ""
|
|
|
- if req.Source == "2" {
|
|
|
- rid = util.DecodeId(req.RelateId)
|
|
|
- } else {
|
|
|
- rid = req.RelateId
|
|
|
- }
|
|
|
- query := map[string]interface{}{
|
|
|
- "position_id": req.PositionId,
|
|
|
- "itype": req.Source,
|
|
|
- "relate_id": rid,
|
|
|
- }
|
|
|
- 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"] = 0
|
|
|
- }
|
|
|
- b := T.CrmMysql.Update("connection_status", query, update)
|
|
|
- if !b {
|
|
|
- resp.Error_code = -1
|
|
|
- resp.Error_msg = "状态更新失败"
|
|
|
- } else {
|
|
|
- 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": rid,
|
|
|
- "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.Data = i
|
|
|
- resp.Error_msg = "更新成功"
|
|
|
- }
|
|
|
- } else {
|
|
|
- resp.Error_code = -1
|
|
|
- resp.Error_msg = "未查询到收录信息"
|
|
|
- }
|
|
|
- }
|
|
|
- return
|
|
|
-}
|