Пример #1
0
        public string IsSignIn(UserParameterModel para)
        {
            string               result       = "";
            MessageModel         message      = new MessageModel();
            JavaScriptSerializer jss          = new JavaScriptSerializer();
            HashSet <object>     returnResult = new HashSet <object>();

            using (HiGame_V1Entities context = new HiGame_V1Entities())
            {
                db_AssetRecord asset = context.db_AssetRecord.
                                       Where(c => c.UserID == para.UserID)
                                       .Where(c => c.GainWay == ASSET.GAINWAY_SIGN)
                                       .Where(c => c.GainTime.Value.Year == DateTime.Now.Year &&
                                              c.GainTime.Value.Month == DateTime.Now.Month &&
                                              c.GainTime.Value.Day == DateTime.Now.Day).FirstOrDefault();
                if (asset == null)
                {
                    message.Message     = MESSAGE.NOTSIGN;
                    message.MessageCode = MESSAGE.NOTSIGN_CODE;
                }
                else
                {
                    //今日已签到
                    message.Message     = MESSAGE.SIGN;
                    message.MessageCode = MESSAGE.SIGN_CODE;
                }
            }
            returnResult.Add(message);
            result = jss.Serialize(returnResult);
            return(result);
        }
Пример #2
0
        public string MyAssetList(UserParameterModel user)
        {
            string               result       = "";
            MessageModel         message      = new MessageModel();
            JavaScriptSerializer jss          = new JavaScriptSerializer();
            HashSet <object>     returnResult = new HashSet <object>();

            //获取我的资产
            using (HiGame_V1Entities context = new HiGame_V1Entities())
            {
                //获取用户资产列表
                var sql = "SELECT t1.VirtualMoney,CONVERT(varchar(100), t1.GainTime, 23) as GainTime,t1.GainWay,t1.Remark" +
                          " FROM db_AssetRecord t1" +
                          " WHERE t1.UserID = " + user.UserID + "ORDER BY t1.GainTime DESC";

                var assetList = context.Database.SqlQuery <AssetList>(sql)
                                .Skip((user.StartPage - 1) * user.PageCount)
                                .Take(user.PageCount).ToList();

                message.Message     = MESSAGE.OK;
                message.MessageCode = MESSAGE.OK_CODE;
                returnResult.Add(message);
                returnResult.Add(assetList);
            }
            result = jss.Serialize(returnResult);
            return(result);
        }
Пример #3
0
        public string UserInfoByUserID(UserParameterModel user)
        {
            string               result       = "";
            MessageModel         message      = new MessageModel();
            JavaScriptSerializer jss          = new JavaScriptSerializer();
            HashSet <object>     returnResult = new HashSet <object>();

            using (HiGame_V1Entities context = new HiGame_V1Entities())
            {
                //获取用户
                UserModel userInfo = User.GetUserModelByUserID(user.UserID);
                if (userInfo != null)
                {
                    message.Message     = MESSAGE.OK;
                    message.MessageCode = MESSAGE.OK_CODE;
                }
                else
                {
                    message.Message     = MESSAGE.NOUSER;
                    message.MessageCode = MESSAGE.NOUSER_CODE;
                }
                returnResult.Add(message);
                returnResult.Add(userInfo);
            }
            result = jss.Serialize(returnResult);
            return(result);
        }
Пример #4
0
        public HttpResponseMessage IsSignIn([FromBody] UserParameterModel para)
        {
            UserLogic userLogic = new UserLogic();

            jsonResult = userLogic.IsSignIn(para);

            returnResult.Content = new StringContent(jsonResult, Encoding.UTF8, "application/json");
            return(returnResult);
        }
Пример #5
0
        public HttpResponseMessage MyAssetList([FromBody] UserParameterModel user)
        {
            UserLogic userLogic = new UserLogic();

            jsonResult = userLogic.MyAssetList(user);

            returnResult.Content = new StringContent(jsonResult, Encoding.UTF8, "application/json");
            return(returnResult);
        }
Пример #6
0
        public string MyMessage(UserParameterModel para)
        {
            string                result       = "";
            MessageModel          message      = new MessageModel();
            JavaScriptSerializer  jss          = new JavaScriptSerializer();
            HashSet <object>      returnResult = new HashSet <object>();
            List <MyMessageModel> messageInfo;

            using (HiGame_V1Entities context = new HiGame_V1Entities())
            {
                //单发消息
                var sql = "SELECT" +
                          " t1.MID as MessageID,t1.Title,t1.Content," +
                          " (CASE WHEN t1.State = 0 then '未读' else '已读' end) as State," +
                          " CONVERT(varchar(100), t1.SendTime, 20) as Time" +
                          " FROM" +
                          " db_Message t1" +
                          " WHERE t1.State in (0,99) AND t1.ReceiveID =" + para.UserID +
                          " ORDER BY t1.State ,t1.SendTime DESC";
                //" union" +
                ////群发消息
                //" SELECT" +
                //" t1.MID as MessageID,t1.Title,t1.Content," +
                //" (CASE WHEN t2.SysState IS NULL then '未读' else '已读' end) as State," +
                //" CONVERT(varchar(100), t1.SendTime, 20) as Time" +
                //" FROM" +
                //" db_Message t1" +
                //" left JOIN db_SysMessage t2 ON t1.MID = t2.MID" +
                //" WHERE t1.SendID = 0";

                messageInfo = context.Database.SqlQuery <MyMessageModel>(sql)
                              .Skip((para.StartPage - 1) * para.PageCount)
                              .Take(para.PageCount).ToList();
                var sqlCount = "SELECT" +
                               " t1.MID as MessageID,t1.Title,t1.Content," +
                               " (CASE WHEN t1.State = 0 then '未读' else '已读' end) as State," +
                               " CONVERT(varchar(100), t1.SendTime, 20) as Time" +
                               " FROM" +
                               " db_Message t1" +
                               " WHERE t1.State =0 AND t1.ReceiveID =" + para.UserID;

                var messageInfoCount = context.Database.SqlQuery <MyMessageModel>(sqlCount)
                                       .ToList().Count;

                message.Message     = messageInfoCount.ToString();
                message.MessageCode = MESSAGE.OK_CODE;
            }
            returnResult.Add(message);
            returnResult.Add(messageInfo);
            result = jss.Serialize(returnResult);
            return(result);
        }
Пример #7
0
        public string SignIn(UserParameterModel para)
        {
            string               result       = "";
            MessageModel         message      = new MessageModel();
            JavaScriptSerializer jss          = new JavaScriptSerializer();
            HashSet <object>     returnResult = new HashSet <object>();

            using (HiGame_V1Entities context = new HiGame_V1Entities())
            {
                db_AssetRecord asset = context.db_AssetRecord.
                                       Where(c => c.UserID == para.UserID)
                                       .Where(c => c.GainWay == ASSET.GAINWAY_SIGN)
                                       .Where(c => c.GainTime.Value.Year == DateTime.Now.Year &&
                                              c.GainTime.Value.Month == DateTime.Now.Month &&
                                              c.GainTime.Value.Day == DateTime.Now.Day).FirstOrDefault();
                if (asset == null)
                {
                    db_AssetRecord assetRecord = new db_AssetRecord();

                    assetRecord.UserID       = para.UserID;
                    assetRecord.VirtualMoney = ASSET.MONEY_SIGN;
                    assetRecord.TrueMoney    = 0;
                    assetRecord.GainWay      = ASSET.GAINWAY_SIGN;
                    assetRecord.GainTime     = DateTime.Now;
                    assetRecord.State        = ASSET.MONEYSTATE_YES;
                    //时间+操作+收入支出金额
                    assetRecord.Remark = assetRecord.GainTime + " " +
                                         assetRecord.GainWay + " "
                                         + ASSET.PAY_IN +
                                         assetRecord.VirtualMoney.ToString();

                    //将充值记录加入资产记录表
                    context.db_AssetRecord.Add(assetRecord);
                    context.SaveChanges();
                    message.Message     = MESSAGE.OK;
                    message.MessageCode = MESSAGE.OK_CODE;
                }
                else
                {
                    //今日已签到
                    message.Message     = MESSAGE.SIGN;
                    message.MessageCode = MESSAGE.SIGN_CODE;
                }
            }
            returnResult.Add(message);
            result = jss.Serialize(returnResult);
            return(result);
        }