chenzx
2024-12-02 c0a9a10f8da3ebaaffb01de6115392476f4f4197
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
using CommonHelper;
using GasolineBlend.BLL;
using GasolineBlend.Entity;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using System.Web.Razor.Tokenizer.Symbols;
 
namespace GasolineBlend.Controllers
{
    public class DefaultCompanyController : BaseController
    {
 
 
        private DefaultCompanyBLL _acc = new DefaultCompanyBLL();
        /// <summary>
        ///获取推送
        /// </summary>
        /// <param name="Keyword"></param>
        /// <returns></returns>
        [HttpPost]
        public ActionResult GetDefaultCompanyIsId(int UserId)
        {
            try
            {
                var list = _acc.GetDefaultCompanyIsId(UserId);
                if (list.Count == 0)
                {
                    bool isAdd = _acc.AddDefaultCompany(UserId);
                    if (!isAdd) {
                        return Error();
                    }
                    var list2 = _acc.GetDefaultCompanyIsId(UserId);
                    return SuccessNoShow(data: list2);
                }
                return SuccessNoShow(data: list);
            }
            catch (Exception e)
            {
                LogHelper.Write(Level.Error, "获取推送 GetDefaultCompanyIsId", e, OperatorProvider.Instance.Current == null ? "GuestEx" : OperatorProvider.Instance.Current.LoginName);
                return Error();
            }
        }
 
        /// <summary>
        ///修改推送
        /// </summary>
        /// <param name="Keyword"></param>
        /// <returns></returns>
        [HttpPost]
        public ActionResult UpdateDefaultCompany(DefaultCompany defaultCompany)
        {
            try
            {
                bool isUpdate = _acc.UpdateDefaultCompany(defaultCompany);
                return isUpdate ? SuccessNoShow() : Error();
            }
            catch (Exception e)
            {
                LogHelper.Write(Level.Error, "修改推送 UpdateDefaultCompany " +
                    "" +
                    "", e, OperatorProvider.Instance.Current == null ? "GuestEx" : OperatorProvider.Instance.Current.LoginName);
                return Error();
            }
        }
 
 
 
 
        /// <summary>
        ///添加推送
        /// </summary>
        /// <param name="Keyword"></param>
        /// <returns></returns>
        [HttpPost]
        public ActionResult AddDefaultCompany(int UserId)
        {
            try
            {
                bool isAdd = _acc.AddDefaultCompany(UserId);
                return isAdd ? SuccessNoShow() : Error();
            }
            catch (Exception e)
            {
                LogHelper.Write(Level.Error, "添加智能体 AddPushData" +
                    "" +
                    "", e, OperatorProvider.Instance.Current == null ? "GuestEx" : OperatorProvider.Instance.Current.LoginName);
                return Error();
            }
        }
 
 
 
 
    }
}