wangxinhui
2024-11-06 8f392cc88b0768b74efca3b68785cf5aa1c38e70
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
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using WIDESEA_Common.DBHelper;
using WIDESEA_Core.Utilities;
using WIDESEA_Entity.DomainModels;
 
namespace WIDESEA_Services.Services
{
    public class Parm
    {
        public List<string> data { get; set; }
        public int type { get; set; }
    }
    public partial class dt_stationinfoService
    {
        /// <summary>
        /// 设置缓存架禁用启用
        /// </summary>
        /// <param name="json"></param>
        /// <returns></returns>
        public WebResponseContent SetStationEnable(object json)
        {
            WebResponseContent webResponse = new WebResponseContent();
            try
            {
                var data = JsonConvert.DeserializeObject<Parm>(json.ToString());
                var res = FreeDB.DB.Update<dt_stationinfo>()
                     .Set(t => t.enable, data.type == 1)
                     .Where(t => data.data.Contains(t.id.ToString()))
                     .ExecuteAffrows();
                if (res <= 0)
                {
                    throw new Exception("操作失败!");
                }
                webResponse.OK();
            }
            catch (Exception ex)
            {
                webResponse.Error(ex.Message);
            }
            return webResponse;
        }
    }
}