コード例 #1
0
        public static BaishiRewardInfo GetItemByGateAndTel(string Gate, string Tel)
        {
            if (Gate == null || Tel == null)
            {
                return(null);
            }
            if (itemCacheTimeout <= 0)
            {
                return(dal.GetItemByGateAndTel(Gate, Tel));
            }
            string key   = string.Concat("DC2016_BLL_BaishiRewardByGateAndTel_", Gate, "_,_", Tel);
            string value = RedisHelper.Get(key);

            if (!string.IsNullOrEmpty(value))
            {
                try { return(new BaishiRewardInfo(value)); } catch { }
            }
            BaishiRewardInfo item = dal.GetItemByGateAndTel(Gate, Tel);

            if (item == null)
            {
                return(null);
            }
            RedisHelper.Set(key, item.Stringify(), itemCacheTimeout);
            return(item);
        }
コード例 #2
0
        public static BaishiRewardInfo GetItem(uint?Id)
        {
            if (Id == null)
            {
                return(null);
            }
            if (itemCacheTimeout <= 0)
            {
                return(dal.GetItem(Id));
            }
            string key   = string.Concat("DC2016_BLL_BaishiReward_", Id);
            string value = RedisHelper.Get(key);

            if (!string.IsNullOrEmpty(value))
            {
                try { return(new BaishiRewardInfo(value)); } catch { }
            }
            BaishiRewardInfo item = dal.GetItem(Id);

            if (item == null)
            {
                return(null);
            }
            RedisHelper.Set(key, item.Stringify(), itemCacheTimeout);
            return(item);
        }
コード例 #3
0
 public static DC2016.DAL.BaishiReward.SqlUpdateBuild UpdateDiy(BaishiRewardInfo item, uint?Id)
 {
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item != null ? item : GetItem(Id));
     }
     return(new DC2016.DAL.BaishiReward.SqlUpdateBuild(item, Id));
 }
コード例 #4
0
 public static int Update(BaishiRewardInfo item)
 {
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item);
     }
     return(dal.Update(item));
 }
コード例 #5
0
 private static void RemoveCache(BaishiRewardInfo item)
 {
     if (item == null)
     {
         return;
     }
     RedisHelper.Remove(string.Concat("DC2016_BLL_BaishiReward_", item.Id));
     RedisHelper.Remove(string.Concat("DC2016_BLL_BaishiRewardByGateAndTel_", item.Gate, "_,_", item.Tel));
 }
コード例 #6
0
 public static BaishiRewardInfo Insert(BaishiRewardInfo item)
 {
     item = dal.Insert(item);
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item);
     }
     return(item);
 }
コード例 #7
0
 public int Update(BaishiRewardInfo item)
 {
     return(new SqlUpdateBuild(null, item.Id)
            .SetActiveid(item.Activeid)
            .SetGate(item.Gate)
            .SetRewarditem(item.Rewarditem)
            .SetState(item.State)
            .SetTel(item.Tel)
            .SetTime(item.Time).ExecuteNonQuery());
 }
コード例 #8
0
        public BaishiRewardInfo Insert(BaishiRewardInfo item)
        {
            uint loc1;

            if (uint.TryParse(string.Concat(SqlHelper.ExecuteScalar(TSQL.Insert, GetParameters(item))), out loc1))
            {
                item.Id = loc1;
            }
            return(item);
        }
コード例 #9
0
 protected static MySqlParameter[] GetParameters(BaishiRewardInfo item)
 {
     return(new MySqlParameter[] {
         GetParameter("?id", MySqlDbType.UInt32, 10, item.Id),
         GetParameter("?activeid", MySqlDbType.VarChar, 32, item.Activeid),
         GetParameter("?gate", MySqlDbType.VarChar, 8, item.Gate),
         GetParameter("?rewarditem", MySqlDbType.Int32, 11, item.Rewarditem),
         GetParameter("?state", MySqlDbType.Int32, 11, item.State),
         GetParameter("?tel", MySqlDbType.VarChar, 18, item.Tel),
         GetParameter("?time", MySqlDbType.DateTime, -1, item.Time)
     });
 }
コード例 #10
0
ファイル: ActivityController.cs プロジェクト: P79N6A/projects
        public IActionResult func_record_raffleinfo(string tel, string gate, int rewarditem, string activeid)
        {
            if (tel.IsNullOrEmpty())
            {
                return(this.FuncResult(new APIReturn(10000, $"参数不正确tel={tel}")));
            }
            if (gate.IsNullOrEmpty() || gate.Length > 8)
            {
                return(this.FuncResult(new APIReturn(10000, $"参数不正确gate={gate}")));
            }
            if (rewarditem < 10000)
            {
                return(this.FuncResult(new APIReturn(10000, $"参数不正确rewarditem={rewarditem}")));
            }
            if (activeid.IsNullOrEmpty())
            {
                return(this.FuncResult(new APIReturn(10000, $"参数不正确activeid={activeid}")));
            }
            BaishiRewardInfo raffleinfo = BaishiReward.hareInfo(gate, tel, activeid);

            if (raffleinfo == null)
            {
                raffleinfo            = new BaishiRewardInfo();
                raffleinfo.Activeid   = activeid;
                raffleinfo.Gate       = gate;
                raffleinfo.Tel        = tel;
                raffleinfo.Rewarditem = rewarditem;
                raffleinfo.Time       = DateTime.Now;
                raffleinfo            = BaishiReward.Insert(raffleinfo);
                if (raffleinfo == null)
                {
                    return(this.FuncResult(new APIReturn(19600, "记录数据失败")));
                }
                else
                {
                    return(this.FuncResult(new APIReturn(0, "记录信息成功")));
                }
            }
            else
            {
                Hashtable ht = new Hashtable();
                ht["tel"]        = raffleinfo.Tel;
                ht["time"]       = raffleinfo.Time;
                ht["rewarditem"] = raffleinfo.Rewarditem;
                return(this.FuncResult(new APIReturn(19601, "已有抽奖记录", ht)));
            }
        }
コード例 #11
0
ファイル: ActivityController.cs プロジェクト: P79N6A/projects
        public IActionResult func_get_raffleinfo(string tel, string gate, string activeid)
        {
            if (tel.IsNullOrEmpty())
            {
                return(this.FuncResult(new APIReturn(10205, $"手机号格式错误tel={tel}")));
            }
            if (gate.IsNullOrEmpty() || gate.Length > 8)
            {
                return(this.FuncResult(new APIReturn(10000, $"参数不正确gate={gate}")));
            }
            if (activeid.IsNullOrEmpty())
            {
                return(this.FuncResult(new APIReturn(10000, $"参数不正确activeid={activeid}")));
            }
            BaishiRewardInfo raffleinfo = BaishiReward.hareInfo(gate, tel, activeid);

            if (raffleinfo == null)
            {
                return(this.FuncResult(new APIReturn(19602, "没有记录")));
            }
            else if (raffleinfo.State == 1)
            {
                return(this.FuncResult(new APIReturn(19603, "奖励已领取")));
            }
            else
            {
                raffleinfo.State = 1;
                BaishiReward.Update(raffleinfo);

                Hashtable ht = new Hashtable();
                ht["tel"]        = raffleinfo.Tel;
                ht["time"]       = raffleinfo.Time;
                ht["rewarditem"] = raffleinfo.Rewarditem;
                return(this.FuncResult(new APIReturn(0, "已有抽奖记录", ht))); //分享记录失败
            }
        }
コード例 #12
0
 public SqlUpdateBuild(BaishiRewardInfo item, uint?Id)
 {
     _item  = item;
     _where = SqlHelper.Addslashes("`id` = {0}", Id);
 }