Exemplo n.º 1
0
 public object DeleteFoods(Dictionary <string, object> dicParas)
 {
     try
     {
         string MobileToken = dicParas.ContainsKey("mobileToken") ? dicParas["mobileToken"].ToString() : string.Empty;//获取手机令牌
         string mobile      = string.Empty;
         if (!MobileTokenBusiness.ExistToken(MobileToken, out mobile))
         {
             return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机令牌无效"));
         }
         string        FoodID       = dicParas.ContainsKey("foodid") ? dicParas["foodid"].ToString() : string.Empty;//获取套餐ID
         int           ID           = int.Parse(FoodID);
         IFoodsService foodsService = BLLContainer.Resolve <IFoodsService>("XCCloudRS232");
         var           foods        = foodsService.GetModels(x => x.FoodID == ID).FirstOrDefault <t_foods>();
         if (foods == null)
         {
             return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "未查询到套餐信息"));
         }
         foods.FoodState = 0;
         foodsService.Update(foods);
         return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemplo n.º 2
0
        public object getFoodDetail(Dictionary <string, object> dicParas)
        {
            XCCloudUserTokenModel userTokenModel     = (XCCloudUserTokenModel)(dicParas[Constant.XCCloudUserTokenModel]);
            StoreIDDataModel      userTokenDataModel = (StoreIDDataModel)(userTokenModel.DataModel);

            string foodId = dicParas.ContainsKey("foodId") ? dicParas["foodId"].ToString() : string.Empty;

            if (string.IsNullOrEmpty(foodId))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "套餐名不能为空"));
            }

            string sql = "exec GetFoodDetail @StoreId,@FoodId ";

            SqlParameter[] parameters = new SqlParameter[2];
            parameters[0] = new SqlParameter("@StoreId", userTokenDataModel.StoreId);
            parameters[1] = new SqlParameter("@FoodId", foodId);
            System.Data.DataSet ds = XCCloudBLL.ExecuteQuerySentence(sql, parameters);
            DataTable           dt = ds.Tables[0];

            if (dt.Rows.Count > 0)
            {
                List <FoodDetailModel> list1 = Utils.GetModelList <FoodDetailModel>(ds.Tables[0]).ToList();
                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, list1));
            }
            else
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "无数据"));
            }
        }
Exemplo n.º 3
0
        public object merchLogin(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg = string.Empty;
                string mobile = dicParas.ContainsKey("mobile") ? dicParas["mobile"].ToString() : string.Empty;
                string code   = dicParas.ContainsKey("smsCode") ? dicParas["smsCode"].ToString() : string.Empty;

                if (string.IsNullOrWhiteSpace(mobile) || !IsMobile(mobile))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "请输入正确的手机号码"));
                }

                string smsCode = dicParas.ContainsKey("smsCode") ? dicParas["smsCode"].ToString() : string.Empty;
                if (string.IsNullOrEmpty(smsCode))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "请输入短信验证码"));
                }

                //验证短信验证码
                bool isSMSTest = bool.Parse(System.Configuration.ConfigurationManager.AppSettings["isSMSTest"].ToString());
                //判断缓存验证码是否正确
                string key = mobile + "_" + smsCode;
                if (!isSMSTest)
                {
                    if (!SMSCodeCache.IsExist(key))
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "短信验证码无效"));
                    }
                }

                IMerchService merchService = BLLContainer.Resolve <IMerchService>();
                var           merch        = merchService.GetModels(p => p.Mobile.Equals(mobile, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <Base_MerchInfo>();
                if (merch == null)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "商户不存在"));
                }

                //如果商户token为空,就写入新的token
                if (string.IsNullOrWhiteSpace(merch.Token))
                {
                    string token = System.Guid.NewGuid().ToString("N");
                    merch.Token = token; //更新token
                    merch.State = 1;     //状态激活
                    merchService.Update(merch);

                    if (!MobileTokenCache.ExistTokenByKey(mobile))
                    {
                        MobileTokenCache.AddToken(CommonConfig.PrefixKey + mobile, token);
                    }
                }

                MerchModel merchModel = new MerchModel(merch.MerchName, merch.OPName, merch.Token, merch.State);
                return(ResponseModelFactory <MerchModel> .CreateModel(isSignKeyReturn, merchModel));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 4
0
 public object deleteGroup(Dictionary <string, object> dicParas)
 {
     try
     {
         string MobileToken = dicParas.ContainsKey("mobileToken") ? dicParas["mobileToken"].ToString() : string.Empty; //获取手机令牌
         string GroupID     = dicParas.ContainsKey("groupID") ? dicParas["groupID"].ToString() : string.Empty;         //获取分组ID
         if (GroupID == "")
         {
             return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "分组ID不能为空"));
         }
         if (MobileToken == "")
         {
             return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机令牌不能为空"));
         }
         string mobile = string.Empty;
         if (!MobileTokenBusiness.ExistToken(MobileToken, out mobile))
         {
             return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机token无效"));
         }
         string         sql        = "exec deleteDataGameInfo @GroupID,@Return output";
         SqlParameter[] parameters = new SqlParameter[2];
         parameters[0]           = new SqlParameter("@GroupID", GroupID);
         parameters[1]           = new SqlParameter("@Return", 0);
         parameters[1].Direction = System.Data.ParameterDirection.Output;
         XCCloudRS232BLL.ExecuteQuerySentence(sql, parameters);
         return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemplo n.º 5
0
        public object getMemberCard(Dictionary <string, object> dicParas)
        {
            try
            {
                string           mobile           = string.Empty;
                MobileTokenModel mobileTokenModel = (MobileTokenModel)(dicParas[Constant.MobileTokenModel]);
                string           sql        = "exec SelectMenber @Mobile,@Return output";
                SqlParameter[]   parameters = new SqlParameter[2];
                parameters[0]           = new SqlParameter("@Mobile", mobileTokenModel.Mobile);
                parameters[1]           = new SqlParameter("@Return", 0);
                parameters[1].Direction = System.Data.ParameterDirection.Output;
                System.Data.DataSet ds = XCGameManabll.ExecuteQuerySentence(sql, parameters);
                DataTable           dt = ds.Tables[0];
                if (dt.Rows.Count == 0)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, ""));
                }
                var list = Utils.GetModelList <TmpmemberModel>(ds.Tables[0]).ToList();

                return(ResponseModelFactory <List <TmpmemberModel> > .CreateModel(isSignKeyReturn, list));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 6
0
        public object getMobileToken(Dictionary <string, object> dicParas)
        {
            try
            {
                string mobile  = dicParas.ContainsKey("mobile") ? dicParas["mobile"].ToString().Trim() : "";
                string smsCode = dicParas.ContainsKey("smsCode") ? dicParas["smsCode"].ToString().Trim() : "";

                string key = mobile + "_" + smsCode;
                if (!FilterMobileBusiness.IsTestSMS)
                {
                    if (!SMSCodeCache.IsExist(key))
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "短信验证码无效"));
                    }
                }


                if (SMSCodeCache.IsExist(key))
                {
                    SMSCodeCache.Remove(key);
                }

                string token = MobileTokenBusiness.SetMobileToken(mobile);
                MobileTokenResponseModel tokenModel = new MobileTokenResponseModel(mobile, token);
                return(ResponseModelFactory <MobileTokenResponseModel> .CreateModel(isSignKeyReturn, tokenModel));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 7
0
        public object getMember(Dictionary <string, object> dicParas)
        {
            XCCloudUserTokenModel userTokenModel     = (XCCloudUserTokenModel)(dicParas[Constant.XCCloudUserTokenModel]);
            StoreIDDataModel      userTokenDataModel = (StoreIDDataModel)(userTokenModel.DataModel);

            string icCardId = dicParas.ContainsKey("icCardId") ? dicParas["icCardId"].ToString() : string.Empty;
            string storeId  = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;

            if (string.IsNullOrEmpty(icCardId))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "会员卡号无效"));
            }
            if (string.IsNullOrEmpty(storeId))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店号无效"));
            }

            string storedProcedure = "GetMember";

            SqlParameter[] parameters = new SqlParameter[4];
            parameters[0]           = new SqlParameter("@ICCardID", icCardId);
            parameters[1]           = new SqlParameter("@StoreID", storeId);
            parameters[2]           = new SqlParameter("@Result", SqlDbType.Int);
            parameters[2].Direction = System.Data.ParameterDirection.Output;
            parameters[3]           = new SqlParameter("@ErrMsg", SqlDbType.VarChar, 200);
            parameters[3].Direction = System.Data.ParameterDirection.Output;
            System.Data.DataSet ds = XCCloudBLL.GetStoredProcedureSentence(storedProcedure, parameters);
            if (parameters[2].Value.ToString() == "1")
            {
                var baseMemberModel = Utils.GetModelList <BaseMemberModel>(ds.Tables[0]).ToList()[0];
                return(ResponseModelFactory <BaseMemberModel> .CreateModel(isSignKeyReturn, baseMemberModel));
            }
            return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "会员信息不存在"));
        }
Exemplo n.º 8
0
        public object getLoginUser(Dictionary <string, object> dicParas)
        {
            string UserName = dicParas.ContainsKey("UserName") ? dicParas["UserName"].ToString() : string.Empty;
            string PassWord = dicParas.ContainsKey("PassWord") ? dicParas["PassWord"].ToString() : string.Empty;

            if (string.IsNullOrEmpty(UserName))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "请输入用户名"));
            }
            if (string.IsNullOrEmpty(PassWord))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "请输入密码"));
            }
            string Pass = Utils.MD5(PassWord);
            IUserRegisterService userervice = BLLContainer.Resolve <IUserRegisterService>();
            var menulist = userervice.GetModels(p => p.UserName == UserName && p.PassWord == Pass).ToList();

            if (menulist.Count > 0)
            {
                if (menulist[0].State != 1)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "该用户正在审核中"));
                }
                string key   = UserName;
                string token = System.Guid.NewGuid().ToString("N");
                if (!MobileTokenCache.ExistTokenByKey(key))
                {
                    MobileTokenCache.AddToken(key, token);
                }
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, token, Result_Code.T, ""));
            }
            return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "用户名或密码有误"));
        }
Exemplo n.º 9
0
        public object login(Dictionary <string, object> dicParas)
        {
            string userMobile = dicParas.ContainsKey("userMobile") ? dicParas["userMobile"].ToString() : string.Empty;
            string password   = dicParas.ContainsKey("password") ? dicParas["password"].ToString() : string.Empty;
            string imgCode    = dicParas.ContainsKey("imgCode") ? dicParas["imgCode"].ToString() : string.Empty;

            //验证码
            if (!ValidateImgCache.Exist(imgCode.ToUpper()))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "验证码无效"));
            }
            ValidateImgCache.Remove(imgCode.ToUpper());

            IAdminUserService adminUserService = BLLContainer.Resolve <IAdminUserService>();
            var model = adminUserService.GetModels(p => p.Mobile.Equals(userMobile)).FirstOrDefault <t_AdminUser>();

            if (model == null)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "用户不存在"));
            }
            else
            {
                if (model.Password.Equals(password))
                {
                    string token = XCGameManaAdminUserTokenBusiness.SetToken(model.Mobile, model.Id);
                    var    obj   = new { token = token };
                    return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj));
                }
                else
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "密码不正确"));
                }
            }
        }
Exemplo n.º 10
0
        public object getUpdatePassWord(Dictionary <string, object> dicParas)
        {
            string UserToken    = dicParas.ContainsKey("UserToken") ? dicParas["UserToken"].ToString() : string.Empty;
            string PassWord     = dicParas.ContainsKey("PassWord") ? dicParas["PassWord"].ToString() : string.Empty;
            string NewsPassWord = dicParas.ContainsKey("NewsPassWord") ? dicParas["NewsPassWord"].ToString() : string.Empty;

            if (string.IsNullOrEmpty(PassWord))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "请输入密码"));
            }
            if (string.IsNullOrEmpty(NewsPassWord))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "请输入新密码"));
            }
            string UserName = string.Empty;

            //验证token
            if (!MobileTokenBusiness.ExistToken(UserToken, out UserName))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "用户token无效"));
            }
            PassWord = Utils.MD5(PassWord);
            IUserRegisterService userervice = BLLContainer.Resolve <IUserRegisterService>();
            var menlist = userervice.GetModels(p => p.UserName == UserName && p.PassWord == PassWord).ToList();

            if (menlist.Count > 0)
            {
                NewsPassWord        = Utils.MD5(NewsPassWord);
                menlist[0].PassWord = NewsPassWord;
                userervice.Update(menlist[0]);
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
            }
            return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "原密码输入有误"));
        }
Exemplo n.º 11
0
        public object unBindStore(Dictionary <string, object> dicParas)
        {
            try
            {
                string storeId = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;

                if (string.IsNullOrEmpty(storeId))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "storeId参数不能为空"));
                }

                int           iStoreId     = Convert.ToInt32(storeId);
                IStoreService storeService = BLLContainer.Resolve <IStoreService>();
                if (!storeService.Any(a => a.id == iStoreId))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "该门店不存在"));
                }

                var storeInfo = storeService.GetModels(p => p.id == iStoreId).FirstOrDefault();
                storeInfo.openId = string.Empty;
                if (!storeService.Update(storeInfo))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "解绑门店失败"));
                }

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Exemplo n.º 12
0
        public object deviceControl(Dictionary <string, object> dicParas)
        {
            string errMsg   = string.Empty;
            string token    = dicParas.ContainsKey("token") ? dicParas["token"].ToString() : string.Empty;
            string mcuid    = dicParas.ContainsKey("mcuid") ? dicParas["mcuid"].ToString() : string.Empty;
            string icCardId = dicParas.ContainsKey("icCardId") ? dicParas["icCardId"].ToString() : string.Empty;
            string action   = dicParas.ContainsKey("controlAction") ? dicParas["controlAction"].ToString() : string.Empty;
            string coins    = dicParas.ContainsKey("coins") ? dicParas["coins"].ToString() : string.Empty;

            UDPClientItemBusiness.ClientItem item = XCCloudService.SocketService.UDP.ClientList.ClientListObj.Where <UDPClientItemBusiness.ClientItem>(p => p.gID.Equals(token)).FirstOrDefault <UDPClientItemBusiness.ClientItem>();
            if (item == null)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "雷达token不存在"));
            }

            StoreBusiness   storeBusiness   = new StoreBusiness();
            StoreCacheModel storeCacheModel = null;

            if (!storeBusiness.IsEffectiveStore(item.StoreID, ref storeCacheModel, out errMsg))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店不存在"));
            }

            IMemberService memberService = BLLContainer.Resolve <IMemberService>(storeCacheModel.StoreDBName);
            var            memberlist    = memberService.GetModels(x => x.ICCardID.ToString() == icCardId).FirstOrDefault <t_member>();

            if (memberlist == null)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机号码无效"));
            }

            //判断设备状态是否为启用状态
            XCCloudService.BLL.IBLL.XCGame.IDeviceService ids = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IDeviceService>(storeCacheModel.StoreDBName);
            var menlist = ids.GetModels(p => p.MCUID.Equals(mcuid, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <XCCloudService.Model.XCGame.t_device>();

            if (menlist == null)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "设备不存在"));
            }

            if (menlist.state != "启用")
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "设备未启用"));
            }

            string sn      = UDPSocketAnswerBusiness.GetSN();
            string orderId = System.Guid.NewGuid().ToString("N");
            DeviceControlRequestDataModel deviceControlModel = new DeviceControlRequestDataModel(item.StoreID, memberlist.Mobile, icCardId, item.Segment, mcuid, action, int.Parse(coins), sn, orderId, storeCacheModel.StorePassword, 0, "");

            MPOrderBusiness.AddTCPAnswerOrder(orderId, memberlist.Mobile, int.Parse(coins), action, icCardId, item.StoreID);

            if (!DataFactory.SendDataToRadar(deviceControlModel, out errMsg))
            {
                ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.F, "", Result_Code.T, errMsg);
            }

            var obj = new { orderId = orderId, sn = sn };

            return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj));
        }
Exemplo n.º 13
0
        public object radarHeat(Dictionary <string, object> dicParas)
        {
            string errMsg = string.Empty;
            string token  = dicParas.ContainsKey("token") ? dicParas["token"].ToString() : string.Empty;

            UDPClientItemBusiness.ClientItem item = XCCloudService.SocketService.UDP.ClientList.ClientListObj.Where <UDPClientItemBusiness.ClientItem>(p => p.gID.Equals(token)).FirstOrDefault <UDPClientItemBusiness.ClientItem>();
            if (item == null)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "雷达token不存在"));
            }

            StoreBusiness   storeBusiness   = new StoreBusiness();
            StoreCacheModel storeCacheModel = null;

            if (!storeBusiness.IsEffectiveStore(item.StoreID, ref storeCacheModel, out errMsg))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店不存在"));
            }

            ClientService service = new ClientService();

            service.Connection();
            RadarHeartbeatRequestDataModel dataModel = new RadarHeartbeatRequestDataModel(token, "");

            byte[] data = DataFactory.CreateRequesProtocolData(TransmiteEnum.雷达心跳, dataModel);
            service.Send(data);

            var obj = new { token = token };

            return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj));
        }
Exemplo n.º 14
0
        public object getDeviceInfo(Dictionary <string, object> dicParas)
        {
            try
            {
//                string MobileToken = dicParas.ContainsKey("mobileToken") ? dicParas["mobileToken"].ToString() : string.Empty;//获取手机令牌
//                if (MobileToken == "")
//                {
//                    return ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机令牌不能为空");
//                }
//                string mobile = string.Empty;
//                if (!MobileTokenBusiness.ExistToken(MobileToken, out mobile))
//                {
//                    return ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机token无效");
//                }
//                mobile = mobile.Replace("RS232", "");
//                string sql = "";
//                sql = @"select b.SN,b.Token,b.DeviceName,b.Status from Base_DeviceInfo as b
// left join Base_MerchInfo as a on a.ID=b.MerchID  where a.State='1'  and DeviceType='0' and a.Mobile='" + mobile + "'";
//                DataSet ds = XCCloudRS232BLL.ExecuteQuerySentence(sql, null);
//                DataTable dt = ds.Tables[0];
//                if (dt.Rows.Count > 0)
//                {
//                    var basedeviceinfolist = Utils.GetModelList<BaseDeviceInfoModel>(dt).ToList();
//                    BaseDeviceInfoModelList baseDeviceInfoModelList = new BaseDeviceInfoModelList();
//                    baseDeviceInfoModelList.Lists = basedeviceinfolist;
//                    return ResponseModelFactory<BaseDeviceInfoModelList>.CreateModel(isSignKeyReturn, baseDeviceInfoModelList);
//                }
                string         mobileToken = dicParas.ContainsKey("mobileToken") ? dicParas["mobileToken"].ToString() : string.Empty;
                Base_MerchInfo merch       = MerchBusiness.GetMerchModel(mobileToken);
                if (merch.IsNull())
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "用户令牌无效"));
                }

                var list = DeviceBusiness.GetDeviceList().Where(t => t.MerchID == merch.ID && (DeviceTypeEnum)(int)t.DeviceType == DeviceTypeEnum.Router && t.Status == 1).ToList();
                if (list.IsNull() || list.Count == 0)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "无数据"));
                }

                BaseDeviceInfoModelList baseDeviceInfoModelList = new BaseDeviceInfoModelList();
                baseDeviceInfoModelList.Lists = new List <BaseDeviceInfoModel>();
                foreach (var item in list)
                {
                    BaseDeviceInfoModel model = new BaseDeviceInfoModel();
                    model.DeviceName = item.DeviceName ?? item.SN;
                    model.SN         = item.SN;
                    model.Token      = item.Token;
                    model.Status     = DeviceStatusBusiness.GetDeviceState(item.Token);

                    baseDeviceInfoModelList.Lists.Add(model);
                }

                return(ResponseModelFactory <BaseDeviceInfoModelList> .CreateModel(isSignKeyReturn, baseDeviceInfoModelList));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 15
0
        public object getStore(Dictionary <string, object> dicParas)
        {
            string        storeId      = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
            IStoreService storeService = BLLContainer.Resolve <IStoreService>();
            var           store        = storeService.GetModels(p => p.id.ToString().Equals(storeId)).FirstOrDefault <t_store>();

            if (store == null)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店不存在"));
            }
            else
            {
                var obj = new {
                    id             = store.id,
                    companyname    = store.companyname,
                    province       = store.province,
                    address        = store.address,
                    boss           = store.boss,
                    phone          = store.phone,
                    telphone       = store.telphone,
                    client_level   = store.client_level,
                    createtime     = Convert.ToDateTime(store.createtime).ToString("yyyy-MM-dd HH:mm:ss"),
                    updatetime     = Convert.ToDateTime(store.updatetime).ToString("yyyy-MM-dd HH:mm:ss"),
                    power_due_date = Convert.ToDateTime(store.power_due_date).ToString("yyyy-MM-dd"),
                    note           = store.note,
                    parentid       = store.parentid,
                    developer      = store.developer,
                    store_password = store.store_password,
                    store_dbname   = store.store_dbname,
                    wxfee          = store.wxfee * 1000
                };
                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj));
            }
        }
Exemplo n.º 16
0
        public object getstorepassword(Dictionary <string, object> dicParas)
        {
            string        storeId      = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
            string        Dogid        = dicParas.ContainsKey("dogid") ? dicParas["dogid"].ToString() : string.Empty;
            StoreBusiness store        = new StoreBusiness();
            string        xcGameDBName = string.Empty;
            string        password     = string.Empty;
            string        errMsg       = string.Empty;

            if (!store.IsExistDog(storeId, Dogid))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "加密不合法"));
            }
            if (storeId == "")
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "店号不能为空"));
            }

            if (!store.IsEffectiveStore(storeId, out xcGameDBName, out password, out errMsg))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
            }
            storeId = storeId.PadRight(8, '0');
            string pass = Utils.EncryptDES(password, storeId);

            return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, pass));
        }
Exemplo n.º 17
0
        public object removeStore(Dictionary <string, object> dicParas)
        {
            try
            {
                string        storeId      = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
                IStoreService storeService = BLLContainer.Resolve <IStoreService>();
                var           storeModel   = storeService.GetModels(p => p.id.ToString().Equals(storeId)).FirstOrDefault <t_store>();
                if (storeModel == null)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店不存在"));
                }

                if (storeService.Delete(storeModel))
                {
                    List <StoreCacheModel> list            = StoreCache.GetStore();
                    StoreCacheModel        storeCacheModel = list.Where <StoreCacheModel>(p => p.StoreID == int.Parse(storeId)).FirstOrDefault <StoreCacheModel>();
                    if (storeCacheModel != null)
                    {
                        list.Remove(storeCacheModel);
                    }
                }

                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 18
0
        public object getStores(Dictionary <string, object> dicParas)
        {
            try
            {
                string openId = dicParas.ContainsKey("openId") ? dicParas["openId"].ToString() : string.Empty;

                if (string.IsNullOrEmpty(openId))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "openId参数不能为空"));
                }

                IStoreService storeService = BLLContainer.Resolve <IStoreService>();
                var           linq         = from a in storeService.GetModels(p => p.openId.Equals(openId, StringComparison.OrdinalIgnoreCase))
                                             select new
                {
                    storeId     = a.id,
                    companyname = a.companyname,
                    address     = a.address
                };

                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, linq.ToList()));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 19
0
 public object getGroup(Dictionary <string, object> dicParas)
 {
     try
     {
         string MobileToken = dicParas.ContainsKey("mobileToken") ? dicParas["mobileToken"].ToString() : string.Empty; //获取手机令牌
         string GroupID     = dicParas.ContainsKey("groupID") ? dicParas["groupID"].ToString() : string.Empty;         //获取分组ID
         if (GroupID == "")
         {
             return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "分组ID不能为空"));
         }
         if (MobileToken == "")
         {
             return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机令牌不能为空"));
         }
         string mobile = string.Empty;
         if (!MobileTokenBusiness.ExistToken(MobileToken, out mobile))
         {
             return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机token无效"));
         }
         int GroupIDs = int.Parse(GroupID);
         IDataGameInfoService dataGameInfoService = BLLContainer.Resolve <IDataGameInfoService>("XCCloudRS232");
         var menlist = dataGameInfoService.GetModels(x => x.GroupID == GroupIDs).ToList <Data_GameInfo>();
         if (menlist.Count > 0)
         {
             List <DataGameInfoModel> gameinfolist = Utils.GetCopyList <DataGameInfoModel, Data_GameInfo>(menlist);
             return(ResponseModelFactory <List <DataGameInfoModel> > .CreateModel(isSignKeyReturn, gameinfolist));
         }
         return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "无数据"));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemplo n.º 20
0
        public object getUserRegister(Dictionary <string, object> dicParas)
        {
            string        errMsg       = string.Empty;
            string        xcGameDBName = string.Empty;
            string        Mobile       = dicParas.ContainsKey("mobile") ? dicParas["mobile"].ToString() : string.Empty;
            string        StoreId      = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
            string        UserName     = dicParas.ContainsKey("UserName") ? dicParas["UserName"].ToString() : string.Empty;
            string        PassWord     = dicParas.ContainsKey("PassWord") ? dicParas["PassWord"].ToString() : string.Empty;
            string        smsCode      = dicParas.ContainsKey("smsCode") ? dicParas["smsCode"].ToString() : string.Empty;
            string        Pass         = Utils.MD5(PassWord);
            StoreBusiness store        = new StoreBusiness();

            if (!store.IsEffectiveStore(StoreId, out xcGameDBName, out errMsg))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
            }
            string key = Mobile + "_" + smsCode;

            //判断缓存验证码是否正确
            if (!FilterMobileBusiness.IsTestSMS && !FilterMobileBusiness.ExistMobile(Mobile))
            {
                if (!SMSCodeCache.IsExist(key))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "短信验证码无效"));
                }
            }
            IUserRegisterService userregisterService = BLLContainer.Resolve <IUserRegisterService>();
            //判断用户名是否存在
            var userlist = userregisterService.GetModels(p => p.UserName == UserName).ToList();

            if (userlist.Count > 0)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "该用户名已经存在"));
            }
            //判断用户是否注册
            var menulist = userregisterService.GetModels(p => p.Mobile == Mobile && p.StoreId == StoreId).ToList();

            if (menulist.Count > 0)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "该用户已注册"));
            }
            xcGameDBName = "XCGameManagerDB";
            string sql = "exec InsertUserRegister @UserName,@PassWord,@Mobile,@StoreId,@Return output ";

            SqlParameter[] parameters = new SqlParameter[5];
            parameters[0]           = new SqlParameter("@UserName", UserName);
            parameters[1]           = new SqlParameter("@PassWord", Pass);
            parameters[2]           = new SqlParameter("@Mobile", Mobile);
            parameters[3]           = new SqlParameter("@StoreId", StoreId);
            parameters[4]           = new SqlParameter("@Return", 0);
            parameters[4].Direction = System.Data.ParameterDirection.Output;
            t_UserRegister userregister = userregisterService.SqlQuery(sql, xcGameDBName, parameters).FirstOrDefault <t_UserRegister>();

            if (userregister == null)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "用户添加异常"));
            }
            return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
        }
Exemplo n.º 21
0
        public object getFoodList(Dictionary <string, object> dicParas)
        {
            XCCloudUserTokenModel userTokenModel     = (XCCloudUserTokenModel)(dicParas[Constant.XCCloudUserTokenModel]);
            StoreIDDataModel      userTokenDataModel = (StoreIDDataModel)(userTokenModel.DataModel);

            string customerType  = dicParas.ContainsKey("customerType") ? dicParas["customerType"].ToString() : string.Empty;
            string memberLevelId = dicParas.ContainsKey("memberLevelId") ? dicParas["memberLevelId"].ToString() : string.Empty;
            string foodTypeStr   = dicParas.ContainsKey("foodTypeStr") ? dicParas["foodTypeStr"].ToString() : string.Empty;

            if (string.IsNullOrEmpty(memberLevelId))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "会员等级无效"));
            }

            string sql = "exec GetFoodListInfo @StoreId,@CustomerType,@MemberLevelId,@FoodTypeStr ";

            SqlParameter[] parameters = new SqlParameter[4];
            parameters[0] = new SqlParameter("@StoreId", userTokenDataModel.StoreId);
            parameters[1] = new SqlParameter("@CustomerType", customerType);
            parameters[2] = new SqlParameter("@MemberLevelId", memberLevelId);
            parameters[3] = new SqlParameter("@FoodTypeStr", foodTypeStr);
            System.Data.DataSet ds = XCCloudBLL.ExecuteQuerySentence(sql, parameters);
            DataTable           dt = ds.Tables[0];

            if (dt.Rows.Count > 0)
            {
                List <FoodInfoModel> list1 = Utils.GetModelList <FoodInfoModel>(ds.Tables[0]).ToList();
                for (int i = 0; i < list1.Count; i++)
                {
                    List <FoodInfoPriceModel> listFoodInfoPriceModel = new List <FoodInfoPriceModel>();
                    FoodInfoPriceModel        foodInfoModel          = new FoodInfoPriceModel(0, list1[i].FoodPrice);
                    listFoodInfoPriceModel.Add(foodInfoModel);

                    if (list1[i].AllowCoin == 1)
                    {
                        foodInfoModel = new FoodInfoPriceModel(1, list1[i].Coins);
                        listFoodInfoPriceModel.Add(foodInfoModel);
                    }

                    if (list1[i].AllowPoint == 1)
                    {
                        foodInfoModel = new FoodInfoPriceModel(2, list1[i].Points);
                        listFoodInfoPriceModel.Add(foodInfoModel);
                    }

                    if (list1[i].AllowLottery == 1)
                    {
                        foodInfoModel = new FoodInfoPriceModel(3, list1[i].Lottery);
                        listFoodInfoPriceModel.Add(foodInfoModel);
                    }

                    list1[i].priceListModel = listFoodInfoPriceModel;
                }
                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, list1));
            }

            return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "无数据"));
        }
Exemplo n.º 22
0
        public object getPposWxPay(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg = string.Empty;
                //string orderId = dicParas.ContainsKey("orderId") ? dicParas["orderId"].ToString() : string.Empty;
                string orderId = System.DateTime.Now.ToString("yyyyMMddHHmmss");
                string amount  = dicParas.ContainsKey("amount") ? dicParas["amount"].ToString() : string.Empty;
                string subject = dicParas.ContainsKey("subject") ? dicParas["subject"].ToString() : string.Empty;
                string openid  = dicParas.ContainsKey("openid") ? dicParas["openid"].ToString() : string.Empty;

                if (string.IsNullOrWhiteSpace(orderId))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "订单号无效"));
                }

                //Flw_Order order = Flw_OrderBusiness.GetOrderModel(orderId);
                //if (order == null)
                //{
                //    return ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "订单号无效");
                //}


                #region 新大陆微信公众号支付
                string error = "";
                PPosPayData.WeiXinPubPay pay = new PPosPayData.WeiXinPubPay();

                pay.openid = openid;       //在授权回调页面中获取到的授权code或者openid

                pay.amount       = amount; //实际付款
                pay.total_amount = amount; //订单总金额
                pay.subject      = subject;
                pay.selOrderNo   = orderId;
                pay.goods_tag    = "";

                PPosPayApi ppos = new PPosPayApi();
                PPosPayData.WeiXinPubPayACK ack    = new PPosPayData.WeiXinPubPayACK();
                PPosPayData.WeiXinPubPayACK result = ppos.PubPay(pay, ref ack, out error);
                if (result == null)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "支付失败," + error));
                }
                #endregion

                PposPubSigPay model = new PposPubSigPay();
                model.appId     = result.apiAppid;
                model.timeStamp = result.apiTimestamp;
                model.nonceStr  = result.apiNoncestr;
                model.package   = result.apiPackage;
                model.paySign   = result.apiPaysign;

                return(ResponseModelFactory <PposPubSigPay> .CreateModel(isSignKeyReturn, model));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 23
0
        public object getSegmentList(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg      = string.Empty;
                string mobileToken = dicParas.ContainsKey("mobileToken") ? dicParas["mobileToken"].ToString() : string.Empty;
                string routerToken = dicParas.ContainsKey("routerToken") ? dicParas["routerToken"].ToString() : string.Empty;
                string groupId     = dicParas.ContainsKey("groupId") ? dicParas["groupId"].ToString() : string.Empty;

                Base_MerchInfo merch = MerchBusiness.GetMerchModel(mobileToken);
                if (merch.IsNull())
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "用户令牌无效"));
                }

                Base_DeviceInfo router = DeviceBusiness.GetDeviceModel(routerToken);
                if (router.IsNull())
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "控制器令牌无效"));
                }

                Data_GameInfo group = GameBusiness.GetGameInfoModel(Convert.ToInt32(groupId));
                if (group.IsNull())
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "分组参数无效"));
                }

                //分组集合
                var groupList = MerchSegmentBusiness.GetMerchSegmentList().Where(t => t.ParentID == router.ID && t.GroupID == group.GroupID).ToList();

                GroupInfoModel model = new GroupInfoModel();
                model.groupId   = group.GroupID;
                model.groupName = group.GroupName;

                List <Terminal> Terminals = new List <Terminal>();
                foreach (var item in groupList)
                {
                    Terminal        t       = new Terminal();
                    Base_DeviceInfo cDevice = DeviceBusiness.GetDeviceModelById((int)item.DeviceID);
                    t.terminalName  = cDevice.DeviceName ?? cDevice.SN;
                    t.terminalToken = cDevice.Token;
                    t.headAddress   = item.HeadAddress;
                    t.sn            = cDevice.SN;
                    t.deviceType    = ((DeviceTypeEnum)cDevice.DeviceType).ToDescription();
                    t.status        = DeviceStatusBusiness.GetDeviceState(cDevice.Token);

                    Terminals.Add(t);
                }
                model.Terminals = Terminals;

                return(ResponseModelFactory <GroupInfoModel> .CreateModel(isSignKeyReturn, model));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 24
0
        public object addDevice(Dictionary <string, object> dicParas)
        {
            string storeId     = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
            string mcuId       = dicParas.ContainsKey("mcuId") ? dicParas["mcuId"].ToString() : string.Empty;
            string deviceToken = string.Empty;

            if (string.IsNullOrEmpty(storeId))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店号无效"));
            }

            if (string.IsNullOrEmpty(mcuId))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "设备ID无效"));
            }

            int           storeids     = int.Parse(storeId);
            IStoreService storeService = BLLContainer.Resolve <IStoreService>();
            var           menlist      = storeService.GetModels(x => x.id == storeids).FirstOrDefault <t_store>();

            if (menlist == null)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, "门店号无效"));
            }
            deviceToken = DeviceManaBusiness.GetDeviceToken();
            int    StoreType = 1;
            string dbname    = menlist.store_dbname;

            if (dbname == "XCCloudRS232")
            {
                StoreType = 0;
            }
            IDeviceService device     = BLLContainer.Resolve <IDeviceService>();
            var            devicelist = device.GetModels(x => x.DeviceId == mcuId && x.StoreId == storeId).FirstOrDefault <t_device>();

            if (devicelist != null)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "该店号已经存在该设备信息!"));
            }
            string sql = @"select a.MCUID,b.GameName,b.GameType from t_head a inner join t_game b on a.GameID = b.GameID where MCUID = '" + mcuId + "'";

            System.Data.DataSet ds = XCGameBLL.ExecuteQuerySentence(sql, dbname, null);
            if (ds.Tables[0].Rows.Count > 0)
            {
                DeviceModel deviceModel = Utils.GetModelList <DeviceModel>(ds.Tables[0])[0];
                t_device    device1     = new t_device();
                device1.TerminalNo = deviceToken;
                device1.StoreId    = storeId;
                device1.StoreType  = StoreType;
                device1.DeviceName = deviceModel.GameName;
                device1.DeviceType = deviceModel.GameType;
                device1.DeviceId   = deviceModel.MCUID;
                device.Add(device1);
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
            }
            return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "未查询到相关数据"));
        }
Exemplo n.º 25
0
        public object getAliMiniAppPaySign(Dictionary <string, object> dicParas)
        {
            try
            {
                int    coins       = 0;
                string orderNo     = string.Empty;
                string errMsg      = string.Empty;
                string mobileToken = dicParas.ContainsKey("mobileToken") ? dicParas["mobileToken"].ToString() : string.Empty;
                string storeId     = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
                string productName = dicParas.ContainsKey("productName") ? dicParas["productName"].ToString() : string.Empty;
                string payPriceStr = dicParas.ContainsKey("payPrice") ? dicParas["payPrice"].ToString() : string.Empty;
                string buyType     = dicParas.ContainsKey("buyType") ? dicParas["buyType"].ToString() : string.Empty;
                string coinsStr    = dicParas.ContainsKey("coins") ? dicParas["coins"].ToString() : string.Empty;

                decimal payPrice = 0;
                if (!decimal.TryParse(payPriceStr, out payPrice))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "支付金额不正确"));
                }

                if (!int.TryParse(coinsStr, out coins))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "购买币数不正确"));
                }
                MobileTokenModel mobileTokenModel = (MobileTokenModel)(dicParas[Constant.MobileTokenModel]);

                //生成服务器订单号
                orderNo = PayOrderHelper.CreateXCGameOrderNo(storeId, payPrice, 0, (int)(OrderType.Ali), productName, mobileTokenModel.Mobile, buyType, coins);

                IAopClient             client  = new DefaultAopClient(AliPayConfig.serverUrl, AliPayConfig.miniAppId, AliPayConfig.merchant_miniapp_private_key, "json", "1.0", "RSA2", AliPayConfig.alipay_miniapp_public_key, AliPayConfig.charset, false);
                AlipayTradeAppPayModel builder = new AlipayTradeAppPayModel();
                builder.Body           = "莘拍档-" + buyType;
                builder.Subject        = productName;
                builder.OutTradeNo     = orderNo;
                builder.TotalAmount    = payPrice.ToString("0.00");
                builder.ProductCode    = "QUICK_MSECURITY_PAY";
                builder.TimeoutExpress = "10m";

                AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();

                request.SetBizModel(builder);
                request.SetNotifyUrl(AliPayConfig.AliMiniAppNotify_url);

                AlipayTradeAppPayResponse response = client.SdkExecute(request);
                //string strSign = HttpUtility.HtmlEncode(response.Body);

                AlipayMiniAppSignModel model = new AlipayMiniAppSignModel();
                model.OrderId = orderNo;
                model.PaySign = response.Body;

                return(ResponseModelFactory <AlipayMiniAppSignModel> .CreateModel(isSignKeyReturn, model));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 26
0
        public object getMemberExpenseDetail(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg       = string.Empty;
                string mobileToken  = dicParas.ContainsKey("mobileToken") ? dicParas["mobileToken"].ToString() : string.Empty;
                string icCardId     = dicParas.ContainsKey("icCardId") ? dicParas["icCardId"].ToString() : string.Empty;
                string flowType     = dicParas.ContainsKey("flowType") ? dicParas["flowType"].ToString() : string.Empty;
                string sDate        = dicParas.ContainsKey("sDate") ? dicParas["sDate"].ToString() : string.Empty;
                string eDate        = dicParas.ContainsKey("eDate") ? dicParas["eDate"].ToString() : string.Empty;
                string strPageIndex = dicParas.ContainsKey("pageIndex") ? dicParas["pageIndex"].ToString() : string.Empty;
                string strpageSize  = dicParas.ContainsKey("pageSize") ? dicParas["pageSize"].ToString() : string.Empty;

                int pageIndex = 1, pageSize = 10;

                if (!string.IsNullOrWhiteSpace(strPageIndex) && strPageIndex.IsInt())
                {
                    pageIndex = Convert.ToInt32(strPageIndex);
                }

                if (!string.IsNullOrWhiteSpace(strpageSize) && strpageSize.IsInt())
                {
                    pageSize = Convert.ToInt32(strpageSize);
                }

                if (mobileToken == "")
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机令牌不能为空"));
                }
                Base_MerchInfo merch = MerchBusiness.GetMerchModel(mobileToken);
                if (merch.IsNull())
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "用户token无效"));
                }

                t_member member = MemberBusiness.GetMerchModel(icCardId);
                if (member.IsNull())
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "会员卡号错误"));
                }

                DataTable table = AccountBusiness.GetMemberExpenseDetail(merch.ID, icCardId, flowType, sDate, eDate, pageIndex, pageSize);

                if (table.Rows.Count == 0)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "无数据"));
                }

                var list = Utils.GetModelList <MemberExpenseDetailModel>(table).ToList();
                return(ResponseModelFactory <List <MemberExpenseDetailModel> > .CreateModel(isSignKeyReturn, list));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 27
0
        public object getOrder(Dictionary <string, object> dicParas)
        {
            try
            {
                string StoreID   = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
                string UserToken = dicParas.ContainsKey("userToken") ? dicParas["userToken"].ToString() : string.Empty;
                if (string.IsNullOrEmpty(UserToken))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "用户token无效"));
                }

                var list = XCCloudUserTokenBusiness.GetUserTokenModel(UserToken);
                if (list == null)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "用户token无效"));
                }
                if (string.IsNullOrEmpty(StoreID))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店号无效"));
                }
                string OrderNum = string.Empty;
                IFlw_Order_SerialNumberService flw_Order_SerialNumberService = BLLContainer.Resolve <IFlw_Order_SerialNumberService>();
                var orderlist = flw_Order_SerialNumberService.GetModels(x => x.StoreiD == StoreID).ToList().FirstOrDefault(x => Convert.ToDateTime(x.CreateDate).ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd"));


                IBase_StoreInfoService base_StoreInfoService = BLLContainer.Resolve <IBase_StoreInfoService>();
                var menlist = base_StoreInfoService.GetModels(x => x.StoreID == StoreID).FirstOrDefault <Base_StoreInfo>();
                if (menlist == null)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "未查询到商户号"));
                }
                int num = 0;
                if (orderlist == null)
                {
                    num = +1;
                    Flw_Order_SerialNumber flw_Order_SerialNumber = new Flw_Order_SerialNumber();
                    flw_Order_SerialNumber.StoreiD    = StoreID;
                    flw_Order_SerialNumber.CreateDate = DateTime.Now;
                    flw_Order_SerialNumber.CurNumber  = num;
                    flw_Order_SerialNumberService.Add(flw_Order_SerialNumber);
                }
                else
                {
                    num = Convert.ToInt32(orderlist.CurNumber + 1);
                    orderlist.CurNumber = num;
                    flw_Order_SerialNumberService.Update(orderlist);
                }
                OrderNum = DateTime.Now.ToString("yyyyMMddHHmm") + menlist.MerchID + num.ToString();
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, OrderNum, Result_Code.T, ""));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 28
0
        public object getMemberSaveMoney(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg       = string.Empty;
                string xcGameDBName = string.Empty;
                string state        = "0";//设备状态
                string stateName    = string.Empty;
                string password     = string.Empty;
                XCGameMemberTokenModel memberTokenKeyModel = (XCGameMemberTokenModel)(dicParas[Constant.XCGameMemberTokenModel]);
                if (memberTokenKeyModel == null)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "会员令牌不存在"));
                }
                string MobileToken = dicParas.ContainsKey("mobileToken") ? dicParas["mobileToken"].ToString() : string.Empty;
                if (MobileToken == "")
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机令牌不能为空"));
                }

                string         terminalNo    = dicParas.ContainsKey("deviceToken") ? dicParas["deviceToken"].ToString() : string.Empty;
                IDeviceService deviceService = BLLContainer.Resolve <IDeviceService>();
                var            deviceModel   = deviceService.GetModels(p => p.TerminalNo.Equals(terminalNo, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <t_device>();
                if (deviceModel == null)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "终端号不存在"));
                }
                string        DeviceStoreID = deviceModel.StoreId;
                string        StoreID       = memberTokenKeyModel.StoreId;
                StoreBusiness store         = new StoreBusiness();
                if (!store.IsEffectiveStore(memberTokenKeyModel.StoreId, out xcGameDBName, out password, out errMsg))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                }
                if (DeviceStoreID != StoreID)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "当前设备无效"));
                }
                if (DeviceStateBusiness.ExistDeviceState(deviceModel.StoreId, deviceModel.DeviceId))
                {
                    state = DeviceStateBusiness.GetDeviceState(deviceModel.StoreId, deviceModel.DeviceId);
                }
                if (state != "1")
                {
                    stateName = DeviceStateBusiness.GetStateName(state);
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, stateName));
                }

                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 29
0
        public object GetStoreSales(Dictionary <string, object> dicParas)
        {
            string errMsg     = string.Empty;
            string storeId    = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
            string date       = dicParas.ContainsKey("date") ? dicParas["date"].ToString() : string.Empty;
            string icCardId   = dicParas.ContainsKey("icCardId") ? dicParas["icCardId"].ToString() : string.Empty;
            string searchType = dicParas.ContainsKey("searchType") ? dicParas["searchType"].ToString() : string.Empty;

            //验证门店信息
            StoreCacheModel storeModel = null;
            StoreBusiness   store      = new StoreBusiness();

            if (!store.IsEffectiveStore(storeId, ref storeModel, out errMsg))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
            }

            string sn         = UDPSocketStoreQueryAnswerBusiness.GetSN();
            string radarToken = string.Empty;

            if (!DataFactory.SendDataStoreQuery(storeId, date, sn, searchType, icCardId, storeModel.StorePassword, out radarToken, out errMsg))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
            }

            int whileCount = 0;
            UDPSocketStoreQueryAnswerModel answerModel = null;

            while (answerModel == null && whileCount <= 25)
            {
                whileCount++;
                System.Threading.Thread.Sleep(1000);
                answerModel = UDPSocketStoreQueryAnswerBusiness.GetAnswerModel(sn, 2);
            }

            if (answerModel == null)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "系统没有响应"));
            }

            List <StoreQueryResultNotifyTableData> list = (List <StoreQueryResultNotifyTableData>)(answerModel.Result);

            if (list == null || list.Count == 0)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "营业数据不存在"));
            }
            else if (list[0].Key.Equals("查询结果") && list[0].Value.Equals("无此营业日期"))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "营业数据不存在"));
            }
            else
            {
                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, list));
            }
        }
Exemplo n.º 30
0
        public object addUserToken(Dictionary <string, object> dicParas)
        {
            string userToken = dicParas.ContainsKey("userToken") ? dicParas["userToken"].ToString() : string.Empty;
            var    list      = UserInfoBusiness.GetUserTokenModel(userToken);

            if (list == null)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "用户token无效"));
            }

            return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
        }