lichunlei před 3 roky
rodič
revize
35ffcebc71

+ 0 - 483
AppStart/Redis/BothdisDbconn.cs

@@ -1,483 +0,0 @@
-using System;
-using System.Collections.Generic;
-using Library;
-
-namespace MySystem
-{
-    public class BothdisDbconn
-    {
-        public readonly static BothdisDbconn Instance = new BothdisDbconn();
-
-        public void SendMq(string key, object obj)
-        {
-            SetRedisDataList data = new SetRedisDataList()
-            {
-                key = key,
-                val = Newtonsoft.Json.JsonConvert.SerializeObject(obj),
-            };
-            // RabbitMQClient.Instance.SendMsg(Newtonsoft.Json.JsonConvert.SerializeObject(data), "SetRedisDataList");
-            RedisDbconn.Instance.AddList("SetRedisDataList", Newtonsoft.Json.JsonConvert.SerializeObject(data));
-        }
-
-        #region 设置单个字段
-        public void Set(string key, object value)
-        {
-            try
-            {
-                if (RedisDbconn.Instance.Set(key, value))
-                {
-                    RedisDbconn.Instance.Clear(key);
-                }
-            }
-            catch (Exception ex)
-            {
-                TendisErr err = new TendisErr()
-                {
-                    key = key,
-                    value = value,
-                    errMsg = ex.ToString(),
-                };
-                function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(err), "Tendis:Set:Error");
-            }
-        }
-        #endregion
-
-        #region 整数累加
-        public void AddInt(string key, long value = 1)
-        {
-            try
-            {
-                if (RedisDbconn.Instance.AddInt(key, value) > 0)
-                {
-                    RedisDbconn.Instance.Clear(key);
-                }
-            }
-            catch (Exception ex)
-            {
-                TendisErr err = new TendisErr()
-                {
-                    key = key,
-                    value = value,
-                    errMsg = ex.ToString(),
-                };
-                function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(err), "Tendis:AddInt:Error");
-            }
-        }
-        #endregion
-
-        #region 数字累加
-        public void AddNumber(string key, decimal value = 1)
-        {
-            try
-            {
-                if (RedisDbconn.Instance.AddNumber(key, value) > 0)
-                {
-                    RedisDbconn.Instance.Clear(key);
-                }
-            }
-            catch (Exception ex)
-            {
-                TendisErr err = new TendisErr()
-                {
-                    key = key,
-                    value = value,
-                    errMsg = ex.ToString(),
-                };
-                function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(err), "Tendis:AddNumber:Error");
-            }
-        }
-        #endregion
-
-        #region 获取单个字段
-        public T Get<T>(string key)
-        {
-            if (RedisDbconn.Instance.Exists(key))
-            {
-                T obj = RedisDbconn.Instance.Get<T>(key);
-                if (obj != null)
-                {
-                    return obj;
-                }
-            }
-            T newobj = TendisDbconn.Instance.Get<T>(key);
-            if (newobj != null)
-            {
-                RedisDbconn.Instance.Set(key, newobj);
-                RedisDbconn.Instance.SetExpire(key, function.get_Random(1800, 5400));
-            }
-            return newobj;
-        }
-        public decimal GetNumber(string key)
-        {
-            if (RedisDbconn.Instance.Exists(key))
-            {
-                decimal obj = RedisDbconn.Instance.Get<decimal>(key);
-                if (obj > 0)
-                {
-                    return obj;
-                }
-            }
-            decimal newobj = TendisDbconn.Instance.Get<decimal>(key);
-            if (newobj > 0)
-            {
-                RedisDbconn.Instance.Clear(key);
-                RedisDbconn.Instance.AddNumber(key, newobj);
-                RedisDbconn.Instance.SetExpire(key, function.get_Random(1800, 5400));
-            }
-            return 0;
-        }
-        public int GetInt(string key)
-        {
-            if (RedisDbconn.Instance.Exists(key))
-            {
-                int obj = RedisDbconn.Instance.Get<int>(key);
-                if (obj > 0)
-                {
-                    return obj;
-                }
-            }
-            int newobj = TendisDbconn.Instance.Get<int>(key);
-            if (newobj > 0)
-            {
-                RedisDbconn.Instance.Clear(key);
-                RedisDbconn.Instance.AddInt(key, newobj);
-                RedisDbconn.Instance.SetExpire(key, function.get_Random(1800, 5400));
-            }
-            return 0;
-        }
-        #endregion
-
-        #region 设置散列字段
-        public void HSet(string key, string field, object value)
-        {
-            try
-            {
-                RedisDbconn.Instance.HSet(key, field, value);
-            }
-            catch (Exception ex)
-            {
-                TendisErr err = new TendisErr()
-                {
-                    key = key,
-                    value = value,
-                    errMsg = ex.ToString(),
-                };
-                function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(err), "Tendis:HSet:Error");
-            }
-            RedisDbconn.Instance.HSet(key, field, value);
-        }
-        #endregion
-
-        #region 散列整数累加
-        public void HAddInt(string key, string field, long value = 1)
-        {
-            try
-            {
-                RedisDbconn.Instance.HAddInt(key, field, value);
-            }
-            catch (Exception ex)
-            {
-                TendisErr err = new TendisErr()
-                {
-                    key = key,
-                    value = value,
-                    errMsg = ex.ToString(),
-                };
-                function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(err), "Tendis:HAddInt:Error");
-            }
-            RedisDbconn.Instance.HAddInt(key, field, value);
-        }
-        #endregion
-
-        #region 散列数字累加
-        public void HAddNumber(string key, string field, decimal value = 1)
-        {
-            try
-            {
-                RedisDbconn.Instance.HAddNumber(key, field, value);
-            }
-            catch (Exception ex)
-            {
-                TendisErr err = new TendisErr()
-                {
-                    key = key,
-                    value = value,
-                    errMsg = ex.ToString(),
-                };
-                function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(err), "Tendis:HAddNumber:Error");
-            }
-            RedisDbconn.Instance.HAddNumber(key, field, value);
-        }
-        #endregion
-
-        #region 获取散列元素
-        public T HGet<T>(string key, string field)
-        {
-            if (RedisDbconn.Instance.HExists(key, field))
-            {
-                T obj = RedisDbconn.Instance.HGet<T>(key, field);
-                if (obj != null)
-                {
-                    return obj;
-                }
-            }
-            T newobj = RedisDbconn.Instance.HGet<T>(key, field);
-            // if (newobj != null)
-            // {
-            //     RedisDbconn.Instance.HSet(key, field, newobj);
-            // }
-            return newobj;
-        }
-        #endregion
-
-        #region 获取散列所有元素
-        public Dictionary<string, T> HGetAll<T>(string key)
-        {
-            if (RedisDbconn.Instance.Exists(key))
-            {
-                Dictionary<string, T> obj = RedisDbconn.Instance.HGetAll<T>(key);
-                if (obj != null)
-                {
-                    return obj;
-                }
-            }
-            Dictionary<string, T> newobj = RedisDbconn.Instance.HGetAll<T>(key);
-            // if (newobj != null)
-            // {
-            //     foreach (string sub in newobj.Keys)
-            //     {
-            //         RedisDbconn.Instance.HSet(key, sub, newobj[sub]);
-            //     }
-            // }
-            return newobj;
-        }
-        #endregion
-
-        #region 添加集合对象
-        public void SAdd(string key, object value)
-        {
-            try
-            {
-                RedisDbconn.Instance.SAdd(key, value);
-            }
-            catch (Exception ex)
-            {
-                TendisErr err = new TendisErr()
-                {
-                    key = key,
-                    value = value,
-                    errMsg = ex.ToString(),
-                };
-                function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(err), "Tendis:SAdd:Error");
-            }
-            RedisDbconn.Instance.SAdd(key, value);
-        }
-        public void SAdd(string key, object[] value)
-        {
-            try
-            {
-                RedisDbconn.Instance.SAdd(key, value);
-            }
-            catch (Exception ex)
-            {
-                TendisErr err = new TendisErr()
-                {
-                    key = key,
-                    value = value,
-                    errMsg = ex.ToString(),
-                };
-                function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(err), "Tendis:SAdd:Error");
-            }
-            RedisDbconn.Instance.SAdd(key, value);
-        }
-        #endregion
-
-        #region 获取集合对象
-        public T[] SGetList<T>(string key)
-        {
-            if (RedisDbconn.Instance.Exists(key))
-            {
-                T[] obj = RedisDbconn.Instance.SGetList<T>(key);
-                if (obj != null)
-                {
-                    if (obj.Length > 0)
-                    {
-                        return obj;
-                    }
-                }
-            }
-            T[] newobj = RedisDbconn.Instance.SGetList<T>(key);
-            // if (newobj != null)
-            // {
-            //     foreach (T sub in newobj)
-            //     {
-            //         RedisDbconn.Instance.SAdd(key, sub);
-            //     }
-            // }
-            return newobj;
-        }
-        #endregion
-
-        #region 添加列表对象
-        public void AddList(string key, object value)
-        {
-            try
-            {
-                if (RedisDbconn.Instance.AddList(key, value) > 0)
-                { 
-                    RedisDbconn.Instance.Clear(key);
-                }
-            }
-            catch (Exception ex)
-            {
-                TendisErr err = new TendisErr()
-                {
-                    key = key,
-                    value = value,
-                    errMsg = ex.ToString(),
-                };
-                function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(err), "Tendis:AddList:Error");
-            }
-        }
-        public void AddList(string key, object[] value)
-        {
-            try
-            {
-                if (RedisDbconn.Instance.AddList(key, value) > 0)
-                {
-                    RedisDbconn.Instance.Clear(key);
-                }
-            }
-            catch (Exception ex)
-            {
-                TendisErr err = new TendisErr()
-                {
-                    key = key,
-                    value = value,
-                    errMsg = ex.ToString(),
-                };
-                function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(err), "Tendis:AddList:Error");
-            }
-        }
-        #endregion
-
-        #region 获取列表
-        public List<T> GetList<T>(string key, int pageNum = 1, int pageSize = 10)
-        {
-            if (RedisDbconn.Instance.Exists(key))
-            {
-                List<T> list = RedisDbconn.Instance.GetList<T>(key, pageNum, pageSize);
-                if (list.Count > 0)
-                {
-                    return list;
-                }
-            }
-            List<T> tlist = RedisDbconn.Instance.GetList<T>(key, pageNum, pageSize);
-            if (tlist.Count > 0)
-            {
-                RedisDbconn.Instance.Clear(key);
-                object[] tmplist = new object[tlist.Count];
-                for (int i = 0; i < tlist.Count; i++)
-                {
-                    tmplist[i] = tlist[i];
-                }
-                RedisDbconn.Instance.AddList(key, tmplist);
-            }
-            return tlist;
-        }
-        #endregion
-
-        #region 添加排序列表对象
-        public void AddSort(string key, object value, decimal score)
-        {
-            try
-            {
-                RedisDbconn.Instance.AddSort(key, value, score);
-            }
-            catch (Exception ex)
-            {
-                TendisErr err = new TendisErr()
-                {
-                    key = key,
-                    value = value,
-                    errMsg = ex.ToString(),
-                };
-                function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(err), "Tendis:AddSort:Error");
-            }
-            RedisDbconn.Instance.AddSort(key, value, score);
-            int Expired = 60 * 60 * 24 * 180;
-            RedisDbconn.Instance.SetExpire(key, Expired);
-        }
-        #endregion
-
-        #region 获取排序列表
-        public List<T> GetSort<T>(string key, int pageNum = 1, int pageSize = 10)
-        {
-            if (RedisDbconn.Instance.Exists(key))
-            {
-                List<T> list = RedisDbconn.Instance.GetSort<T>(key, pageNum, pageSize);
-                if (list.Count > 0)
-                {
-                    return list;
-                }
-            }
-            return RedisDbconn.Instance.GetSort<T>(key, pageNum, pageSize);
-        }
-        public List<T> GetSortDesc<T>(string key, int pageNum = 1, int pageSize = 10)
-        {
-            if (RedisDbconn.Instance.Exists(key))
-            {
-                List<T> list = RedisDbconn.Instance.GetSortDesc<T>(key, pageNum, pageSize);
-                if (list.Count > 0)
-                {
-                    return list;
-                }
-            }
-            return RedisDbconn.Instance.GetSortDesc<T>(key, pageNum, pageSize);
-        }
-        #endregion
-
-        public void Remove(string key, long start, long end)
-        {
-            try
-            {
-                RedisDbconn.Instance.AddSort(key, start, end);
-            }
-            catch (Exception ex)
-            {
-                TendisErr err = new TendisErr()
-                {
-                    key = key,
-                    start = start,
-                    end = end,
-                    errMsg = ex.ToString(),
-                };
-                function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(err), "Tendis:Remove:Error");
-            }
-            RedisDbconn.Instance.Remove(key, start, end);
-        }
-
-        public void RemoveTop(string key, long count)
-        {
-            Remove(key, count, RedisDbconn.Instance.Count(key) - 1); ;
-        }
-
-        public void Clear(string pattern)
-        {
-            try
-            {
-                RedisDbconn.Instance.Clear(pattern);
-                RedisDbconn.Instance.Clear(pattern);
-            }
-            catch (Exception ex)
-            {
-                TendisErr err = new TendisErr()
-                {
-                    key = pattern,
-                    errMsg = ex.ToString(),
-                };
-                function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(err), "Tendis:Clear:Error");
-            }
-        }
-    }
-}

+ 0 - 218
AppStart/Redis/TendisDbconn.cs

@@ -1,218 +0,0 @@
-using System.Collections.Generic;
-using Library;
-using System.Linq;
-
-namespace MySystem
-{
-    public class TendisDbconn
-    {
-        public readonly static TendisDbconn Instance = new TendisDbconn();
-        public static CSRedis.CSRedisClient csredis;
-        private TendisDbconn()
-        {
-            if (csredis == null)
-            {
-                csredis = new CSRedis.CSRedisClient(ConfigurationManager.AppSettings["TendisConnStr"].ToString());
-            }
-        }
-
-        #region 设置单个字段
-        public bool Set(string key, object value)
-        {
-            return csredis.Set(key, value);
-            // return false;
-        }
-        #endregion
-
-        #region 整数累加
-        public long AddInt(string key, long value = 1)
-        {
-            return csredis.IncrBy(key, value);
-            // return 0;
-        }
-        #endregion
-
-        #region 数字累加
-        public decimal AddNumber(string key, decimal value = 1)
-        {
-            return csredis.IncrByFloat(key, value);
-            // return 0;
-        }
-        #endregion
-
-        #region 获取单个字段
-        public T Get<T>(string key)
-        {
-            return csredis.Get<T>(key);
-        }
-        #endregion
-
-        #region 设置散列字段
-        public bool HSet(string key, string field, object value)
-        {
-            return csredis.HSet(key, field, value);
-            // return false;
-        }
-        #endregion
-
-        #region 散列整数累加
-        public long HAddInt(string key, string field, long value = 1)
-        {
-            return csredis.HIncrBy(key, field, value);
-            // return 0;
-        }
-        #endregion
-
-        #region 散列数字累加
-        public decimal HAddNumber(string key, string field, decimal value = 1)
-        {
-            return csredis.HIncrByFloat(key, field, value);
-            // return 0;
-        }
-        #endregion
-
-        #region 获取散列元素
-        public T HGet<T>(string key, string field)
-        {
-            return csredis.HGet<T>(key, field);
-        }
-        #endregion
-
-        #region 获取散列所有元素
-        public Dictionary<string, T> HGetAll<T>(string key)
-        {
-            return csredis.HGetAll<T>(key);
-        }
-        #endregion
-
-        #region 添加列表对象
-        public long AddList(string key, object value)
-        {
-            return csredis.LPush(key, value);
-            // return 0;
-        }
-        public long AddList(string key, object[] value)
-        {
-            return csredis.LPush(key, value);
-            // return 0;
-        }
-        public T RPop<T>(string key)
-        {
-            return csredis.RPop<T>(key);
-        }
-        #endregion
-
-        #region 添加集合对象
-        public long SAdd(string key, object value)
-        {
-            return csredis.SAdd(key, value);
-            // return 0;
-        }
-        public long SAdd(string key, object[] value)
-        {
-            return csredis.SAdd(key, value);
-            // return 0;
-        }
-        #endregion
-
-        #region 判断元素是否存在
-        public bool SIsMember(string key, object value)
-        {
-            return csredis.SIsMember(key, value);
-        }
-        #endregion
-
-        #region 获取集合对象
-        public T[] SGetList<T>(string key)
-        {
-            return csredis.SMembers<T>(key);
-        }
-        #endregion
-
-        #region 修改列表对象
-        public bool SetList(string key, int index, object value)
-        {
-            long itemindex = csredis.LLen(key) - index - 1;
-            return csredis.LSet(key, itemindex, value);
-            // return false;
-        }
-        #endregion
-
-        #region 获取列表
-        public List<T> GetList<T>(string key, int pageNum = 1, int pageSize = 10)
-        {
-            int start = (pageNum - 1) * pageSize;
-            int end = start + pageSize - 1;
-            T[] list = csredis.LRange<T>(key, start, end);
-            return list.ToList();
-        }
-        #endregion
-
-        #region 添加排序列表对象
-        public long AddSort(string key, object value, decimal score)
-        {
-            return csredis.ZAdd(key, (score, value));
-            // return 0;
-        }
-        #endregion
-
-        #region 获取排序列表
-        public List<T> GetSort<T>(string key, int pageNum = 1, int pageSize = 10)
-        {
-            int start = (pageNum - 1) * pageSize;
-            int end = start + pageSize;
-            string[] list = csredis.ZRangeByScore(key, start, end);
-            List<T> lists = new List<T>();
-            foreach (string record in list)
-            { 
-                lists.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<T>(record));
-            }
-            return lists;
-        }
-        public List<T> GetSortDesc<T>(string key, int pageNum = 1, int pageSize = 10)
-        {
-            int start = (pageNum - 1) * pageSize;
-            int end = start + pageSize;
-            string[] list = csredis.ZRevRangeByScore(key, start, end);
-            List<T> lists = new List<T>();
-            foreach (string record in list)
-            { 
-                lists.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<T>(record));
-            }
-            return lists;
-        }
-        #endregion
-
-        public bool Remove(string key, long start, long end)
-        {
-            return csredis.LTrim(key, start, end);
-        }
-
-        public bool RemoveTop(string key, long count)
-        {
-            return RedisDbconn.Instance.Remove(key, count, RedisDbconn.Instance.Count(key) - 1);;
-        }
-
-        public long Count(string key)
-        {
-            return csredis.LLen(key);
-        }
-
-        public void Clear(string pattern)
-        {
-            string[] keys = csredis.Keys(pattern);
-            csredis.Del(keys);
-        }
-
-        public string[] GetKeys(string pattern)
-        { 
-            string[] keys = csredis.Keys(pattern);
-            return keys;
-        }
-
-        public void SetExpire(string key, int expire)
-        { 
-            csredis.Expire(key, expire); //秒为单位
-        }
-    }
-}

+ 11 - 1
Controllers/HomeController.cs

@@ -51,9 +51,19 @@ namespace MySystem.Controllers
             Dictionary<string, object> result = new Dictionary<string, object>();
             Dictionary<string, object> webcredentials = new Dictionary<string, object>();
             List<string> apps = new List<string>();
-            apps.Add("7HQBL6X2N5.com.kexiaoshuang.ios");
+            apps.Add("7HQBL6X2N5.com.kexiaoshuang.creator");
             webcredentials.Add("apps", apps);
             result.Add("webcredentials", webcredentials);
+            Dictionary<string, object> applinks = new Dictionary<string, object>();
+            apps = new List<string>();
+            applinks.Add("apps", apps);
+            List<Dictionary<string, object>> details = new List<Dictionary<string, object>>();
+            Dictionary<string, object> detailsItem = new Dictionary<string, object>();
+            detailsItem.Add("appID", "7HQBL6X2N5.com.kexiaoshuang.creator");
+            detailsItem.Add("paths", "/creator/ios/*");
+            details.Add(detailsItem);
+            applinks.Add("details", details);
+            result.Add("applinks", applinks);
             return result;
         }
 

+ 0 - 1
appsettings.json

@@ -16,7 +16,6 @@
     "SqlConnStr": "server=47.109.31.237;port=3306;user=KxsMainServer;password=Rw2imhXQQt5ODWIF;database=KxsMainServer;charset=utf8;",
     "BsSqlConnStr": "server=47.109.31.237;port=3306;user=KxsBsServer;password=wyA1bEhi6aAkN8SB;database=KxsBsServer;charset=utf8;",
     "RedisConnStr": "47.109.31.237:6379,password=klm@redis,DefaultDatabase=1,poolsize=500,preheat=50,asyncPipeline=true",
-    "TendisConnStr": "47.109.31.237:6379,password=klm@redis,DefaultDatabase=1,poolsize=500,preheat=50,asyncPipeline=true",
     "IOSAppVersion": "1.0.0",
     "AndroidAppVersion": "1.0.0",
     "OSSKey": "",