public UsersPayPwdController()
 {
     if (!InitState)
     {
         DataObj.OutError("8080");
         return;
     }
     if (DataObj == null)
     {
         DataObj.OutError("1000");
         return;
     }
     if (!DataObj.IsReg)
     {
         DataObj.OutError("3002");
         return;
     }
 }
Пример #2
0
 public BasicCarBrandController()
 {
     if (!InitState)
     {
         DataObj.OutError("8080");
         return;
     }
     if (DataObj == null)
     {
         DataObj.OutError("1000");
         return;
     }
     if (!DataObj.IsReg)
     {
         DataObj.OutError("3002");
         return;
     }
 }
Пример #3
0
 public MsgNoticeInfoController()
 {
     if (!InitState)
     {
         DataObj.OutError("8080");
         return;
     }
     if (DataObj == null)
     {
         DataObj.OutError("1000");
         return;
     }
     if (!DataObj.IsReg)
     {
         DataObj.OutError("3002");
         return;
     }
 }
 public FastOrderIndexController()
 {
     if (!InitState)
     {
         DataObj.OutError("8080");
         return;
     }
     if (DataObj == null)
     {
         DataObj.OutError("1000");
         return;
     }
     if (!DataObj.IsReg)
     {
         DataObj.OutError("3002");
         return;
     }
 }
 public GetPayPassByBankController()
 {
     if (!InitState)
     {
         DataObj.OutError("8080");
         return;
     }
     if (DataObj == null)
     {
         DataObj.OutError("1000");
         return;
     }
     if (!DataObj.IsReg)
     {
         DataObj.OutError("3002");
         return;
     }
 }
Пример #6
0
 public QRCodeCancelController()
 {
     if (!InitState)
     {
         DataObj.OutError("8080");
         return;
     }
     if (DataObj == null)
     {
         DataObj.OutError("1000");
         return;
     }
     if (!DataObj.IsReg)
     {
         DataObj.OutError("3002");
         return;
     }
 }
 public PayConfigChangeController()
 {
     if (!InitState)
     {
         DataObj.OutError("8080");
         return;
     }
     if (DataObj == null)
     {
         DataObj.OutError("1000");
         return;
     }
     if (!DataObj.IsReg)
     {
         DataObj.OutError("3002");
         return;
     }
 }
 public RegEquipmentController()
 {
     if (!InitState)
     {
         DataObj.OutError("8080");
         return;
     }
     if (DataObj == null)
     {
         DataObj.OutError("1000");
         return;
     }
     if (DataObj.IsReg)
     {
         DataObj.OutError("3003");
         return;
     }
 }
 public ZhouBianDailyController()
 {
     if (!InitState)
     {
         DataObj.OutError("8080");
         return;
     }
     if (DataObj == null)
     {
         DataObj.OutError("1000");
         return;
     }
     if (!DataObj.IsReg)
     {
         DataObj.OutError("3002");
         return;
     }
 }
Пример #10
0
 public OrderProfitLogController()
 {
     if (!InitState)
     {
         DataObj.OutError("8080");
         return;
     }
     if (DataObj == null)
     {
         DataObj.OutError("1000");
         return;
     }
     if (!DataObj.IsReg)
     {
         DataObj.OutError("3002");
         return;
     }
 }
        public void Post()
        {
            string Data = DataObj.GetData();

            if (Data.IsNullOrEmpty())
            {
                DataObj.OutError("1000");
                return;
            }
            JObject json = new JObject();

            try
            {
                json = (JObject)JsonConvert.DeserializeObject(Data);
            }
            catch (Exception Ex)
            {
                Log.Write("[BasicCity]:", "【Data】" + Data, Ex);
            }
            if (json == null)
            {
                DataObj.OutError("1000");
                return;
            }
            BasicBank BasicBank = new BasicBank();

            BasicBank = JsonToObject.ConvertJsonToModel(BasicBank, json);

            var query = Entity.BasicBank.AsQueryable();

            if (BasicBank.CanCredit == 1)//支持信用卡
            {
                query = query.Where(o => o.State == 1 && o.CanCredit == 1);
            }
            else
            {
                query = query.Where(n => n.State == 1 && n.IsPayCard == 1);
            }
            IList <BasicBank> BasicBankList = query.ToList();

            DataObj.Data = BasicBankList.EntityToJson();
            DataObj.Code = "0000";
            DataObj.OutString();
        }
        public void Post()
        {
            string Data = DataObj.GetData();

            if (!Data.IsNullOrEmpty())
            {
                JObject json = new JObject();
                try
                {
                    json = (JObject)JsonConvert.DeserializeObject(Data);
                }
                catch (Exception Ex)
                {
                    Log.Write("[AppUpdate]:", "【Data】" + Data, Ex);
                }
                if (json == null)
                {
                    DataObj.OutError("1000");
                    return;
                }

                //处理贴牌相关
                AppUpdate AppUpdate = new AppUpdate();
                AppUpdate = JsonToObject.ConvertJsonToModel(AppUpdate, json);

                AppUpdate = Entity.AppUpdate.FirstOrNew(n => n.Tag == AppUpdate.Tag);
                if (AppUpdate.Id.IsNullOrEmpty())
                {
                    DataObj.OutError("1000");
                    return;
                }
                if (Equipment.RqType == "Apple")
                {
                    AppUpdate.Cols = "Name,Tag,IosVer,IosInt,IosUrl,IosYYB,IosInfo,IOSState,IosColor";
                }
                if (Equipment.RqType == "Android")
                {
                    AppUpdate.Cols = "Name,Tag,ApkVer,ApkInt,ApkUrl,ApkYYB,ApkInfo,ApkColor,APKState";
                }
                DataObj.Data = AppUpdate.ToJson();
                DataObj.Code = "0000";
                DataObj.OutString();
            }
        }
Пример #13
0
        public void Post()
        {
            string Data = DataObj.GetData();

            if (Data.IsNullOrEmpty())
            {
                DataObj.OutError("1000");
                return;
            }
            JObject json = new JObject();

            try
            {
                json = (JObject)JsonConvert.DeserializeObject(Data);
            }
            catch (Exception Ex)
            {
                Log.Write("[CreditCardAdd]:", "【Data】" + Data, Ex);
            }
            if (json == null)
            {
                DataObj.OutError("1000");
                return;
            }
            UserCard UserCard = new UserCard();

            UserCard      = JsonToObject.ConvertJsonToModel(UserCard, json);
            DataObj.Data  = "";
            UserCard.Card = UserCard.Card.Replace(" ", "");
            if (!UserCard.Card.IsNullOrEmpty() && UserCard.Card.Length >= 6)
            {
                string       wei6         = UserCard.Card.Substring(0, 6);
                BasicCardBin BasicCardBin = Entity.BasicCardBin.FirstOrDefault(o => o.BIN == wei6);
                if (BasicCardBin != null)
                {
                    BasicCardBin.Card = UserCard.Card;
                    BasicCardBin.Cols = "BankName,CardType,Card";
                    DataObj.Data      = BasicCardBin.OutJson();
                }
            }
            DataObj.Code = "0000";
            DataObj.OutString();
        }
Пример #14
0
        public void Post()
        {
            string Data = DataObj.GetData();

            if (Data.IsNullOrEmpty())
            {
                DataObj.OutError("1000");
                return;
            }
            JObject json = new JObject();

            try
            {
                json = (JObject)JsonConvert.DeserializeObject(Data);
            }
            catch (Exception Ex)
            {
                Log.Write("[MsgAboutInfo]:", "【Data】" + Data, Ex);
            }
            if (json == null)
            {
                DataObj.OutError("1000");
                return;
            }
            MsgAbout MsgAbout = new MsgAbout();

            MsgAbout = JsonToObject.ConvertJsonToModel(MsgAbout, json);
            //获取信息
            MsgAbout = Entity.MsgAbout.FirstOrDefault(n => n.State == 1 && n.Id == MsgAbout.Id);
            if (MsgAbout == null)//不存在
            {
                DataObj.OutError("1001");
                return;
            }
            DataObj.Data = MsgAbout.OutJson();
            DataObj.Code = "0000";
            DataObj.OutString();
        }
Пример #15
0
        public void Post()
        {
            string Data = DataObj.GetData();

            if (Data.IsNullOrEmpty())
            {
                DataObj.OutError("1000");
                return;
            }
            JObject json = new JObject();

            try
            {
                json = (JObject)JsonConvert.DeserializeObject(Data);
            }
            catch (Exception Ex)
            {
                Log.Write("[BasicCity]:", "【Data】" + Data, Ex);
            }
            if (json == null)
            {
                DataObj.OutError("1000");
                return;
            }
            BasicBankCard BasicBankCard = new BasicBankCard();

            BasicBankCard = JsonToObject.ConvertJsonToModel(BasicBankCard, json);
            if (BasicBankCard.BIN.IsNullOrEmpty())
            {
                DataObj.OutError("1000");
                return;
            }
            IList <BasicBankCard> BasicBankCardList = Entity.BasicBankCard.Where(n => n.State == 1 && n.BIN == BasicBankCard.BIN).ToList();

            DataObj.Data = BasicBankCardList.EntityToJson();
            DataObj.Code = "0000";
            DataObj.OutString();
        }
        public void Post()
        {
            string Data = DataObj.GetData();

            if (Data.IsNullOrEmpty())
            {
                DataObj.OutError("1000");
                return;
            }
            JObject json = new JObject();

            try
            {
                json = (JObject)JsonConvert.DeserializeObject(Data);
            }
            catch (Exception Ex)
            {
                Log.Write("[UserCard]:", "【Data】" + Data, Ex);
            }
            if (json == null)
            {
                DataObj.OutError("1000");
                return;
            }
            UserCard UserCard = new UserCard();

            UserCard = JsonToObject.ConvertJsonToModel(UserCard, json);

            if (UserCard.Type.IsNullOrEmpty())
            {
                UserCard.Type = 1;
            }

            //string CashName = "UserCard_" + UserCard.Type + "_" + UserCard.Token;
            //if (HasCache)
            //{
            //    string StringJson = CacheBuilder.EntityCache.Get(CashName, null) as string;
            //    if (!StringJson.IsNullOrEmpty())
            //    {
            //        DataObj.Data = StringJson;
            //        DataObj.Code = "0000";
            //        DataObj.OutString();
            //        return;
            //    }
            //}
            //获取用户信息
            Users baseUsers = Entity.Users.FirstOrDefault(n => n.Token == UserCard.Token);

            if (baseUsers == null)//用户令牌不存在
            {
                DataObj.OutError("2004");
                return;
            }
            if (baseUsers.State != 1)//用户被锁定
            {
                DataObj.OutError("2003");
                return;
            }
            if (baseUsers.CardStae != 2)//未实名认证
            {
                DataObj.OutError("2006");
                return;
            }
            if (baseUsers.MiBao != 1)//未设置支付密码
            {
                DataObj.OutError("2008");
                return;
            }
            IList <UserCard> UserCardList = Entity.UserCard.Where(n => n.UId == baseUsers.Id && n.Type == UserCard.Type && n.State == 1).OrderBy(o => o.Id).ToList();
            var RunCardList = Entity.JobOrders.Where(o => (o.State == 2 || o.State == 3) && o.UId == baseUsers.Id).Select(o => new { o.UserCardId, o.TNum }).ToList();

            foreach (var item in UserCardList)
            {
                item.Cols += ",IsRun,TNum";
                var run = RunCardList.Where(o => o.UserCardId == item.Id).FirstOrDefault();
                if (run != null)
                {
                    item.IsRun = true;
                    item.TNum  = run.TNum;
                }
                else
                {
                    item.IsRun = false;
                    item.TNum  = "";
                }
            }

            string data = UserCardList.EntityToJson();

            //if (HasCache)
            //{
            //    CacheBuilder.EntityCache.Remove(CashName, null);
            //    CacheBuilder.EntityCache.Add(CashName, data, DateTime.Now.AddMinutes(15), null);
            //}
            DataObj.Data = data;
            DataObj.Code = "0000";
            DataObj.OutString();
        }
        public void Post()
        {
            DataObj.Data = @"{""userpay"":[{""cost"":""0.007"",""config"":{""shouyintai"":""0"",""zhitongche"":""1"",""yaoyiyao"":""1"",""shanhuzixuan"":""0""},""tag"":""WeiXin"",""cname"":""大额微信收款"",""state"":""0"",""snum"":2,""enum"":50000,""payway"":9}]}";
            DataObj.Code = "0000";
            DataObj.OutString();
            return;

            string Data = DataObj.GetData();

            if (!Data.IsNullOrEmpty())
            {
                JObject json = new JObject();
                try
                {
                    json = (JObject)JsonConvert.DeserializeObject(Data);
                }
                catch (Exception Ex)
                {
                    Log.Write("[Receipt]:", "【Data】" + Data, Ex);
                }
                if (json == null)
                {
                    DataObj.OutError("1000");
                    return;
                }
                var Users = new Users();
                Users = JsonToObject.ConvertJsonToModel(Users, json);
                Users BaseUsers = Entity.Users.FirstOrDefault(o => o.Token == Users.Token);
                if (BaseUsers == null)//用户令牌不存在
                {
                    DataObj.OutError("2004");
                    return;
                }
                if (BaseUsers.State != 1)//用户被锁定
                {
                    DataObj.OutError("2003");
                    return;
                }
                if (BaseUsers.CardStae != 2)//未实名认证
                {
                    DataObj.OutError("2006");
                    return;
                }
                //if (BaseUsers.MiBao != 1)//未设置支付密码
                //{
                //    DataObj.OutError("2008");
                //    return;
                //}

                var                result             = new ReceiptModel();
                SysSet             SysSet             = Entity.SysSet.FirstOrDefault();
                ReceiptConfigModel ReceiptConfigModel = new ReceiptConfigModel()
                {
                    ShanHuZiXuan = SysSet.ShanHuZiXuan,
                    ShouYinTai   = SysSet.ShouYinTai,
                    ZhiTongChe   = SysSet.ZhiTongChe,
                };
                if (Equipment.RqType == "Apple")
                {
                    ReceiptConfigModel.YaoYiYao = SysSet.IosSet7;
                }
                if (Equipment.RqType == "Android")
                {
                    ReceiptConfigModel.YaoYiYao = SysSet.ApkSet7;
                }

                IList <SysControl> SysControlList = Entity.SysControl.Where(o => AllowTag.Contains(o.Tag) && (o.State == 1 || o.State == 2) && o.LagEntryDay == 0).OrderBy(n => n.Sort).ToList();//SysControl
                IList <UserPay>    UserPayList    = Entity.UserPay.Where(n => n.UId == BaseUsers.Id).ToList();
                foreach (var p in SysControlList)
                {
                    p.Cols = "Tag,CName,State,SNum,ENum,PayWay,Cost,Config";
                    p.ChkState();
                    p.Cost = UserPayList.Where(o => o.PId == p.PayWay).Select(o => o.Cost).FirstOrNew();
                    if (ReceiptConfigModel.ShanHuZiXuan == 1 && p.IsPay == 1)
                    {
                        ReceiptConfigModel.ShanHuZiXuan = 1;
                    }
                    else
                    {
                        ReceiptConfigModel.ShanHuZiXuan = 0;
                    }
                    string  JsStr = ReceiptConfigModel.OutJson();
                    JObject JS    = (JObject)JsonConvert.DeserializeObject(JsStr);
                    p.Config = JS;
                }
                result.UserPay = SysControlList.EntityToJson();

                string data = result.OutJson();
                data         = data.Replace("\"[{", "[{").Replace("}]\"", "}]");
                DataObj.Data = data;
                DataObj.Code = "0000";
                DataObj.OutString();
                //Tools.OutString(ErrInfo.Return("0000"));
            }
        }
Пример #18
0
        public void Post()
        {
            string Data = DataObj.GetData();

            if (Data.IsNullOrEmpty())
            {
                DataObj.OutError("1000");
                return;
            }
            JObject json = new JObject();

            try
            {
                json = (JObject)JsonConvert.DeserializeObject(Data);
            }
            catch (Exception Ex)
            {
                Log.Write("[OrderDaiLi_3_0]:", "【Data】" + Data, Ex);
            }
            if (json == null)
            {
                DataObj.OutError("1000");
                return;
            }
            DaiLiOrder DaiLiOrder = new DaiLiOrder();

            DaiLiOrder = JsonToObject.ConvertJsonToModel(DaiLiOrder, json);

            UserTrack UserTrack = new UserTrack();

            UserTrack = JsonToObject.ConvertJsonToModel(UserTrack, json);

            //设置开通等级
            if (DaiLiOrder.Tier.IsNullOrEmpty())
            {
                DataObj.OutError("1000");
                return;
            }
            if (DaiLiOrder.X.IsNullOrEmpty() || DaiLiOrder.Y.IsNullOrEmpty())
            {
                DataObj.OutError("1000");
                return;
            }

            //获取用户信息
            Users baseUsers = Entity.Users.FirstOrDefault(n => n.Token == DaiLiOrder.Token);

            if (baseUsers == null)//用户令牌不存在
            {
                DataObj.OutError("2004");
                return;
            }
            if (baseUsers.State != 1)//用户被锁定
            {
                DataObj.OutError("2003");
                return;
            }
            if (baseUsers.CardStae != 2)//未实名认证
            {
                DataObj.OutError("2006");
                return;
            }
            if (baseUsers.MiBao != 1)//未设置支付密码
            {
                DataObj.OutError("2008");
                return;
            }

            //获取分支机构信息
            //AgentType AgentType = Entity.AgentType.FirstOrNew(n => n.Id == DaiLiOrder.Levels);
            //if (AgentType.Id.IsNullOrEmpty()) {
            //    DataObj.OutError("1000");
            //    return;
            //}
            //if (AgentType.AgentID != baseUsers.Agent) {
            //    //用户代理与开通等级代理不同
            //    DataObj.OutError("1000");
            //    return;
            //}
            SysAgent SysAgent = Entity.SysAgent.FirstOrNew(o => o.LinkMobile == baseUsers.UserName);

            if (!SysAgent.LinkMobile.IsNullOrEmpty())
            {
                if (SysAgent.Tier < 5 || DaiLiOrder.Tier >= SysAgent.Tier)
                {
                    DataObj.OutError("9000");
                    return;
                }
            }

            DaiLiOrder.UId      = baseUsers.Id;
            DaiLiOrder.UserName = baseUsers.UserName;
            DaiLiOrder.TureName = baseUsers.TrueName;

            DaiLiOrder.Agent = baseUsers.Agent;
            DaiLiOrder.AId   = baseUsers.AId;
            // DaiLiOrder.Amoney = AgentType.RegisterFee;

            DaiLiOrder.OrderState = 1;
            DaiLiOrder.PayState   = 0;
            DaiLiOrder.AddTime    = DateTime.Now;
            DaiLiOrder.SameGet    = 0;
            //这里是利润计算==========
            DaiLiOrder.AIdGet     = Convert.ToDouble(DaiLiOrder.Amoney); //总利润
            DaiLiOrder.AgentGet   = 0;                                   //分支机构佣金设置为0,待分润计算后再写入
            DaiLiOrder.AgentState = 0;

            //写入订单总表
            Orders Orders = new Orders();

            Orders.UId      = DaiLiOrder.UId;
            Orders.TName    = "自助开通代理";
            Orders.RUId     = 0;
            Orders.RName    = string.Empty;
            Orders.TType    = 10;
            Orders.TState   = 1;
            Orders.Amoney   = DaiLiOrder.Amoney;
            Orders.Poundage = 0;
            Orders.AddTime  = DateTime.Now;
            Orders.PayState = 0;
            Orders.PayWay   = 15;

            Orders.Agent      = DaiLiOrder.Agent;
            Orders.AgentState = 0;
            Orders.AId        = DaiLiOrder.AId;
            Orders.FId        = 0;

            string OrderAddress = DaiLiOrder.OrderAddress;

            if (OrderAddress.IsNullOrEmpty())
            {
                OrderAddress = Utils.GetAddressByGPS(DaiLiOrder.X, DaiLiOrder.Y);
            }
            Orders.OrderAddress = OrderAddress;
            Orders.X            = DaiLiOrder.X;
            Orders.Y            = DaiLiOrder.Y;

            Entity.Orders.AddObject(Orders);
            Entity.SaveChanges();
            Entity.Refresh(RefreshMode.StoreWins, Orders);

            DaiLiOrder.OId = Orders.TNum;
            Entity.DaiLiOrder.AddObject(DaiLiOrder);
            Entity.SaveChanges();

            //=======================================
            UserTrack.ENo        = DataObj.ENo;
            UserTrack.OPType     = Orders.PayName;
            UserTrack.UserName   = Orders.TNum;
            UserTrack.GPSAddress = Orders.OrderAddress;
            UserTrack.GPSX       = Orders.X;
            UserTrack.GPSY       = Orders.Y;
            Orders.SeavGPSLog(UserTrack, Entity);
            //=======================================
            Orders.SendMsg(Entity);//发送消息类
            //=======================================
            Orders.Cols = "TNum,PayId,Amoney,PayState";
            string TNum = Orders.TNum;
            string Sign = (TNum + "NewPay").GetMD5().Substring(8, 8);

            // Orders.PayId = PayPath + "/pay/" + TNum + ".html?sign=" + Sign;
            Orders.PayId = PayPath + "/mobile/orders/GoPay.html?sign=" + Sign + "&tnum=" + TNum;
            //=======================================

            //获取最佳支付通道
            #region 结算中心
            //IList<PayConfig> PayConfigList = Entity.PayConfig.Where(n => n.State == 1).OrderBy(n => n.Cost).ToList();
            //IList<SysControl> SysControlList = Entity.SysControl.OrderBy(n => n.Sort).ToList();//SysControl
            //IList<SysControl> SCList = new List<SysControl>();
            //IList<PayConfig> PCList = new List<PayConfig>();
            //foreach (var p in SysControlList)
            //{
            //    SysControl T = p.ChkState();
            //    if (T.State == 1)
            //    {
            //        SCList.Add(p);
            //    }
            //}
            //foreach (var p in PayConfigList)
            //{
            //    SysControl T = SCList.FirstOrDefault(n => n.PayWay == p.Id);
            //    if (T != null)
            //    {
            //        if (Orders.Amoney >= (decimal)T.SNum && Orders.Amoney <= (decimal)T.ENum)
            //        {
            //            PCList.Add(p);
            //        }
            //    }
            //}
            //IList<PayConfig> CashList = PCList.Where(n => n.GroupType == "Cash").OrderBy(n => n.Cost).ToList();
            //IList<PayConfig> BankList = PCList.Where(n => n.GroupType == "Bank").OrderBy(n => n.Cost).ToList();
            //IList<PayConfig> WxList = PCList.Where(n => n.GroupType == "WeiXin").OrderBy(n => n.Cost).ToList();
            //IList<PayConfig> AliList = PCList.Where(n => n.GroupType == "AliPay").OrderBy(n => n.Cost).ToList();

            //IList<PayConfig> List = new List<PayConfig>();
            //if (CashList.Count > 0)
            //{
            //    PayConfig Cash = new PayConfig();
            //    Cash.GroupType = "Cash";
            //    Cash.Name = "余额支付";
            //    Cash.State = 1;
            //    Cash.Cols = "Name,GroupType,State";
            //    List.Add(Cash);
            //}
            //if (BankList.Count > 0)
            //{
            //    PayConfig Bank = new PayConfig();
            //    Bank.GroupType = "Bank";
            //    Bank.Name = "银联支付";
            //    Bank.State = 1;
            //    Bank.Cols = "Name,GroupType,State";
            //    List.Add(Bank);
            //}
            //if (WxList.Count > 0)
            //{
            //    PayConfig Wx = new PayConfig();
            //    Wx.GroupType = "WeiXin";
            //    Wx.Name = "微信支付";
            //    Wx.State = 0;
            //    Wx.Cols = "Name,GroupType,State";
            //    List.Add(Wx);
            //}
            //if (AliList.Count > 0)
            //{
            //    PayConfig Ali = new PayConfig();
            //    Ali.GroupType = "AliPay";
            //    Ali.Name = "支付宝支付";
            //    Ali.State = 1;
            //    Ali.Cols = "Name,GroupType,State";
            //    List.Add(Ali);
            //}
            //string PCString = List.EntityToJson();
            //JArray PCJson = (JArray)JsonConvert.DeserializeObject(PCString);
            //Orders.PayConfig = PCJson;

            //Orders.Cols += ",PayConfig";
            #endregion
            //Orders.paycon
            DataObj.Data = Orders.OutJson();
            DataObj.Code = "0000";
            DataObj.OutString();
        }
        public void Post()
        {
            string Data = DataObj.GetData();

            if (Data.IsNullOrEmpty())
            {
                DataObj.OutError("1000");
                return;
            }
            JObject json = new JObject();

            try
            {
                json = (JObject)JsonConvert.DeserializeObject(Data);
            }
            catch (Exception Ex)
            {
                Log.Write("[MyQRCode]:", "【Data】" + Data, Ex);
            }
            if (json == null)
            {
                DataObj.OutError("1000");
                return;
            }
            QRCode QRCode = new QRCode();

            QRCode = JsonToObject.ConvertJsonToModel(QRCode, json);
            if (QRCode.Token.IsNullOrEmpty())
            {
                DataObj.OutError("1000");
                return;
            }
            //获取用户信息
            Users baseUsers = Entity.Users.FirstOrDefault(n => n.Token == QRCode.Token);

            if (baseUsers == null)//用户令牌不存在
            {
                DataObj.OutError("2004");
                return;
            }
            if (baseUsers.State != 1)//用户被锁定
            {
                DataObj.OutError("2003");
                return;
            }
            if (baseUsers.CardStae != 2)//未实名认证
            {
                DataObj.OutError("2006");
                return;
            }
            ///qc.html?n=1000000002#gp_3zt5do
            List <QRCode> QRCodeList = Entity.QRCode.Where(n => n.UId == baseUsers.Id && n.State == 2).OrderByDescending(n => n.State).ThenByDescending(n => n.EditTime).ToList();

            QRCodeList.ForEach(o =>
            {
                o.UrlPam = string.Format("http://i.kkapay.com/qc.html?n={0}#gp_{1}", o.Num, o.Code);
            });
            DataObj.Data = QRCodeList.EntityToJson();
            DataObj.Code = "0000";
            DataObj.OutString();
        }
Пример #20
0
        public void Post()
        {
            string Data = DataObj.GetData();

            if (Data.IsNullOrEmpty())
            {
                DataObj.OutError("1000");
                return;
            }
            JObject json = new JObject();

            try
            {
                json = (JObject)JsonConvert.DeserializeObject(Data);
            }
            catch (Exception Ex)
            {
                Log.Write("[Orders]:", "【Data】" + Data, Ex);
            }
            if (json == null)
            {
                DataObj.OutError("1000");
                return;
            }
            Orders Orders = new Orders();

            Orders = JsonToObject.ConvertJsonToModel(Orders, json);

            Users baseUsers = Entity.Users.FirstOrDefault(n => n.Token == Orders.Token);

            if (baseUsers == null)//用户令牌不存在
            {
                DataObj.OutError("2004");
                return;
            }
            if (baseUsers.State != 1)//用户被锁定
            {
                DataObj.OutError("2003");
                return;
            }
            if (baseUsers.CardStae != 2)//未实名认证
            {
                DataObj.OutError("2006");
                return;
            }
            if (baseUsers.MiBao != 1)//未设置支付密码
            {
                DataObj.OutError("2008");
                return;
            }

            Orders = Entity.Orders.FirstOrDefault(n => n.TNum == Orders.TNum && n.UId == baseUsers.Id);
            if (Orders == null)//不存在
            {
                DataObj.OutError("1001");
                return;
            }
            if (Orders.TState != 1)
            {
                DataObj.OutError("6010");
                return;
            }
            if (Orders.PayState != 0)
            {
                DataObj.OutError("6010");
                return;
            }
            Orders.TState = 3;
            if (Orders.TType == 1)
            { //银联卡支付
                OrderRecharge OrderRecharge = Entity.OrderRecharge.FirstOrNew(n => n.OId == Orders.TNum);
                OrderRecharge.OrderState = 3;
            }
            if (Orders.TType == 2)//提现不能取消
            {
                DataObj.OutError("6010");
                return;
            }
            if (Orders.TType == 3)//付款
            {
                OrderTransfer OrderTransfer = Entity.OrderTransfer.FirstOrNew(n => n.OId == Orders.TNum);
                OrderTransfer.OrderState = 3;
            }
            if (Orders.TType == 5)//防租
            {
                OrderHouse OrderHouse = Entity.OrderHouse.FirstOrNew(n => n.OId == Orders.TNum);
                OrderHouse.OrderState = 3;
            }
            if (Orders.TType == 7)//不能取消
            {
                DataObj.OutError("6010");
                return;
            }
            if (Orders.TType == 8)//不能取消
            {
                DataObj.OutError("6010");
                return;
            }
            if (Orders.TType == 9)//不能取消
            {
                DataObj.OutError("6010");
                return;
            }
            Entity.SaveChanges();

            Orders.SendMsg(Entity);//发送消息类

            DataObj.Data = "";
            DataObj.Code = "0000";
            DataObj.OutString();
        }
        public void Post()
        {
            //1.0接口停止使用 20150921,返回参数错误
            DataObj.OutError("1000");
            return;

            /*
             * string Data = DataObj.GetData();
             * if (Data.IsNullOrEmpty())
             * {
             *  DataObj.OutError("1000");
             *  return;
             * }
             * JObject json = new JObject();
             * try
             * {
             *  json = (JObject)JsonConvert.DeserializeObject(Data);
             * }
             * catch (Exception Ex)
             * {
             *  Log.Write("[UsersTrueName]:", "【Data】" + Data, Ex);
             * }
             * if (json == null)
             * {
             *  DataObj.OutError("1000");
             *  return;
             * }
             * //JObject pp = (JObject)p;
             * Users Users = new Users();
             * Users = JsonToObject.ConvertJsonToModel(Users, json);
             * //Users.CardPic = System.Web.HttpContext.Current.Request.Form["cardpic"];
             *
             * if (Users.CardPic.IsNullOrEmpty() || Users.CardPic == "Err")
             * {
             *  DataObj.OutError("4001");
             *  return;
             * }
             * if (Users.TrueName.IsNullOrEmpty() || Users.CardId.IsNullOrEmpty())
             * {
             *  DataObj.OutError("1000");
             *  return;
             * }
             * Users baseUsers = Entity.Users.FirstOrDefault(n => n.Token == Users.Token);
             * if (baseUsers == null)//用户令牌不存在
             * {
             *  DataObj.OutError("2004");
             *  return;
             * }
             * if (baseUsers.State != 1)
             * {
             *  DataObj.OutError("2003");
             *  return;
             * }
             * if (baseUsers.CardStae == 2) { //已实名认证
             *  DataObj.OutError("2007");
             *  return;
             * }
             * int CardIdCount = Entity.Users.Count(n => n.CardId == Users.CardId && n.CardStae == 2);
             * if (CardIdCount > 0) //身份证已用过
             * {
             *  DataObj.OutError("2020");
             *  return;
             * }
             *
             * Users.CardPic = Utils.Base64StringToImage(Users.CardPic, "Users");
             * Users.CardFace = Utils.Base64StringToImage(Users.CardFace, "Users");
             * Users.CardBack = Utils.Base64StringToImage(Users.CardBack, "Users");
             *
             * baseUsers.CardStae = 1;
             * baseUsers.TrueName = Users.TrueName;
             * baseUsers.NeekName = Users.NeekName;
             * baseUsers.CardId = Users.CardId;
             * baseUsers.CardPic = Users.CardPic;
             * baseUsers.CardFace = Users.CardFace;
             * baseUsers.CardBack = Users.CardBack;
             * Entity.SaveChanges();
             *
             * baseUsers.CardPic = Utils.ImageUrl("Users", baseUsers.CardPic, ApiPath);
             * baseUsers.CardFace = Utils.ImageUrl("Users", baseUsers.CardFace, ApiPath);
             * baseUsers.CardBack = Utils.ImageUrl("Users", baseUsers.CardBack, ApiPath);
             *
             * baseUsers.Cols = "TrueName,CardStae,CardPic,CardFace,CardBack,CardId";
             *
             * DataObj.Data = baseUsers.OutJson();
             * DataObj.Code = "0000";
             * DataObj.OutString();
             */
        }
        public void Post()
        {
            string Data = DataObj.GetData();

            if (Data.IsNullOrEmpty())
            {
                DataObj.OutError("1000");
                return;
            }
            JObject json = new JObject();

            try
            {
                json = (JObject)JsonConvert.DeserializeObject(Data);
            }
            catch (Exception Ex)
            {
                Log.Write("[ApplyLoan]:", "【Data】" + Data, Ex);
            }
            if (json == null)
            {
                DataObj.OutError("1000");
                return;
            }
            ApplyLoan ApplyLoan = new ApplyLoan();

            ApplyLoan = JsonToObject.ConvertJsonToModel(ApplyLoan, json);

            Users baseUsers = Entity.Users.FirstOrDefault(n => n.Token == ApplyLoan.Token);

            if (baseUsers == null)//用户令牌不存在
            {
                DataObj.OutError("2004");
                return;
            }
            if (baseUsers.State != 1)//用户被锁定
            {
                DataObj.OutError("2003");
                return;
            }
            if (baseUsers.CardStae != 2)//未实名认证
            {
                DataObj.OutError("2006");
                return;
            }
            if (baseUsers.MiBao != 1)//未设置支付密码
            {
                DataObj.OutError("2008");
                return;
            }

            EFPagingInfo <ApplyLoan> p = new EFPagingInfo <ApplyLoan>();

            if (!ApplyLoan.Pg.IsNullOrEmpty())
            {
                p.PageIndex = ApplyLoan.Pg;
            }
            if (!ApplyLoan.Pgs.IsNullOrEmpty())
            {
                p.PageSize = ApplyLoan.Pgs;
            }

            p.SqlWhere.Add(f => f.UId == baseUsers.Id);
            p.SqlWhere.Add(f => f.State > 0);

            p.OrderByList.Add("Id", "DESC");
            IPageOfItems <ApplyLoan> List = Entity.Selects <ApplyLoan>(p);


            IList <ApplyLoan> iList = List.ToList();
            StringBuilder     sb    = new StringBuilder("");

            sb.Append("{");
            sb.Append(List.PageToString());
            sb.Append(",");
            sb.Append(iList.EntityToString());
            sb.Append("}");
            DataObj.Data = sb.ToString();
            DataObj.Code = "0000";
            DataObj.OutString();
        }
        public void Post()
        {
            string Data = DataObj.GetData();

            if (Data.IsNullOrEmpty())
            {
                DataObj.OutError("1000");
                return;
            }
            JObject json = new JObject();

            try
            {
                json = (JObject)JsonConvert.DeserializeObject(Data);
            }
            catch (Exception Ex)
            {
                Log.Write("[UsersReg]:", "【Data】" + Data, Ex);
            }
            if (json == null)
            {
                DataObj.OutError("1000");
                return;
            }

            //JObject pp = (JObject)p;
            Users Users = new Users();

            Users = JsonToObject.ConvertJsonToModel(Users, json);
            if (Users.UserName.IsNullOrEmpty())
            {
                //
                DataObj.OutError("1000");
                return;
            }
            //手机号码黑名单验证
            if (Entity.UserBlackList.FirstOrDefault(UBL => UBL.CardNumber == Users.UserName && UBL.State == 1) != null)
            {
                //提示暂不支持您手机号入网
                DataObj.OutError("2026");
                return;
            }
            //验证是否重复
            Users Old = Entity.Users.FirstOrDefault(n => n.UserName == Users.UserName);

            if (Old != null)
            {
                DataObj.OutError("2005");
                return;
            }

            DateTime Today  = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
            SysSet   SysSet = Entity.SysSet.FirstOrNew();
            //统计今天已经发送注册验证码次数
            int Times = Entity.SMSCode.Count(n => n.UId == 0 && n.Mobile == Users.UserName && n.CType == 1 && n.AddTime >= Today);

            if (Times >= SysSet.SMSTimes)
            {
                DataObj.OutError("2031");
                return;
            }
            if (Times > 0)   //第一次发送不获取,以节少系统资源
            {
                SMSCode SMSCode = Entity.SMSCode.Where(n => n.UId == 0 && n.Mobile == Users.UserName && n.CType == 1 && n.AddTime >= Today).OrderByDescending(n => n.Id).FirstOrDefault();
                if (SMSCode.AddTime.AddMinutes(1) >= DateTime.Now)   //最后一次发送到现在不足1分钟
                {
                    DataObj.OutError("2032");
                    return;
                }
            }
            //失效之前获取验证码
            IList <SMSCode> List = Entity.SMSCode.Where(n => n.UId == 0 && n.Mobile == Users.UserName && n.CType == 1 && n.State == 1).ToList();

            foreach (var p in List)
            {
                p.State = 0;
            }
            Entity.SaveChanges();

            //生成验证码
            string Code = Utils.RandomSMSCode(4);

            SMSCode SSC = new SMSCode();

            SSC.CType   = 1;
            SSC.UId     = 0;
            SSC.Mobile  = Users.UserName;
            SSC.Code    = Code;
            SSC.AddTime = DateTime.Now;
            SSC.State   = 1;
            Entity.SMSCode.AddObject(SSC);
            Entity.SaveChanges();

            SysAgent SA = Entity.SysAgent.FirstOrNew(n => n.Id == Users.Agent);

            SA = SA.GetTopAgent(Entity);
            //发送验证码
            SSC.SendSMS(SysSet, SA, Entity);

            DataObj.Data = "";
            DataObj.Code = "0000";
            DataObj.OutString();
            //Tools.OutString(ErrInfo.Return("0000"));
        }
        public void Post()
        {
            string Data = DataObj.GetData();

            if (Data.IsNullOrEmpty())
            {
                DataObj.OutError("1000");
                return;
            }
            JObject json = new JObject();

            try
            {
                json = (JObject)JsonConvert.DeserializeObject(Data);
            }
            catch (Exception Ex)
            {
                Log.Write("[OrderBanKa]:", "【Data】" + Data, Ex);
            }
            if (json == null)
            {
                DataObj.OutError("1000");
                return;
            }
            BanKaOrder BanKaOrder = new BanKaOrder();

            BanKaOrder = JsonToObject.ConvertJsonToModel(BanKaOrder, json);
            if (BanKaOrder.BKTId.IsNullOrEmpty() || BanKaOrder.PayPWD.IsNullOrEmpty())
            {
                DataObj.OutError("1000");
                return;
            }
            if (BanKaOrder.PayPWD.Length < 6)//6位及以上
            {
                DataObj.OutError("1000");
                return;
            }
            //获取用户信息
            Users baseUsers = Entity.Users.FirstOrDefault(n => n.Token == BanKaOrder.Token);

            if (baseUsers == null)//用户令牌不存在
            {
                DataObj.OutError("2004");
                return;
            }
            if (baseUsers.State != 1)//用户被锁定
            {
                DataObj.OutError("2003");
                return;
            }
            if (baseUsers.CardStae != 2)//未实名认证
            {
                DataObj.OutError("2006");
                return;
            }
            if (baseUsers.MiBao != 1)//未设置支付密码
            {
                DataObj.OutError("2008");
                return;
            }
            if (baseUsers.PayLock == 1)//密码错误太多次锁定
            {
                DataObj.OutError("2050");
                return;
            }

            //这里是执行指纹解锁
            bool IfCheckOk = true;

            if (BanKaOrder.PayPWD.Substring(0, 3) == "HF_")
            {
                string PassWord = BanKaOrder.PayPWD;
                PassWord = PassWord.Replace("HF_", "");
                string Token = baseUsers.Token;
                Token = Token + "GoodPay";
                string Md5Token = Token.GetMD5().ToUpper();
                string Pass     = Md5Token.Substring(0, 4) + Md5Token.Substring(Md5Token.Length - 4, 4);
                if (Pass != PassWord)
                {
                    IfCheckOk = false;
                }
            }
            else if (baseUsers.PayPwd != BanKaOrder.PayPWD.GetPayMD5())
            {
                //原支付密码错误
                IfCheckOk = false;
            }
            if (!IfCheckOk)
            {
                //付密码错误
                SysSet SysSet = Entity.SysSet.FirstOrNew();
                //系统统一修改标识SAME002
                baseUsers.PayErr++;
                if (baseUsers.PayErr >= SysSet.PayLock)
                {
                    baseUsers.PayLock = 1;
                }
                Entity.SaveChanges();
                Users Out = new Users();
                Out.PayErr   = SysSet.PayLock - baseUsers.PayErr;
                Out.Cols     = "PayErr";
                DataObj.Data = Out.OutJson();
                DataObj.Code = "2010";
                DataObj.OutString();
                return;
            }

            baseUsers.PayErr = 0;


            //检测是否已经购买过
            BanKaOrder BKO = Entity.BanKaOrder.FirstOrDefault(n => n.UId == baseUsers.Id && n.BKTId == BanKaOrder.BKTId && n.OrderState == 2 && n.PayState == 1);

            if (BKO != null)
            {
                DataObj.OutError("6051");
                return;
            }

            //获取产品
            BanKaType BanKaType = Entity.BanKaType.FirstOrDefault(n => n.Id == BanKaOrder.BKTId && n.State == 1);

            if (BanKaType == null)
            {
                DataObj.OutError("1000");
                return;
            }
            if (BanKaType.Amoney > baseUsers.Amount)
            {//余额不足
                DataObj.OutError("6026");
                return;
            }

            BanKaOrder.UId    = baseUsers.Id;
            BanKaOrder.Amoney = BanKaType.Amoney;

            BanKaOrder.OrderState = 1;
            BanKaOrder.PayState   = 0;
            BanKaOrder.AddTime    = DateTime.Now;

            BanKaOrder.Agent      = baseUsers.Agent;
            BanKaOrder.AId        = baseUsers.AId;
            BanKaOrder.AgentState = 0;
            //这里是利润计算==========
            BanKaOrder.AgentGet = 0;
            BanKaOrder.AIdGet   = 0;

            Entity.BanKaOrder.AddObject(BanKaOrder);

            Entity.SaveChanges();

            Entity.Refresh(RefreshMode.StoreWins, BanKaOrder);

            //开始支付流程
            //==================================================================
            //帐户变动记录
            int     USERSID  = baseUsers.Id;
            string  TNUM     = BanKaOrder.OId;
            decimal PAYMONEY = BanKaOrder.Amoney;
            string  SP_Ret   = Entity.SP_UsersMoney(USERSID, TNUM, PAYMONEY, 2, BanKaType.Title);

            if (SP_Ret != "3")
            {
                Utils.WriteLog(string.Format("U{0},O{1},T{2}:{3}【{4}】", USERSID, TNUM, 2, PAYMONEY, SP_Ret), "SP_UsersMoney");
                BanKaOrder.OrderState = 0;
                Entity.SaveChanges();
                DataObj.OutError("8888");
                return;
            }
            //==================================================================
            //交易标识
            BanKaOrder.OrderState = 2;
            BanKaOrder.PayState   = 1;
            Entity.SaveChanges();

            DataObj.Data = BanKaOrder.OutJson();
            DataObj.Code = "0000";
            DataObj.OutString();
        }
        public void Post()
        {
            string Data = DataObj.GetData();

            if (Data.IsNullOrEmpty())
            {
                DataObj.OutError("1000");
                return;
            }
            JObject json = new JObject();

            try
            {
                json = (JObject)JsonConvert.DeserializeObject(Data);
            }
            catch (Exception Ex)
            {
                Log.Write("[QRCodeLogin]:", "【Data】" + Data, Ex);
            }
            if (json == null)
            {
                DataObj.OutError("1000");
                return;
            }
            UserLoginSceneid UserLoginSceneid = new UserLoginSceneid();

            UserLoginSceneid = JsonToObject.ConvertJsonToModel(UserLoginSceneid, json);
            if (UserLoginSceneid.Sceneid.IsNullOrEmpty() || UserLoginSceneid.Token.IsNullOrEmpty())
            {
                DataObj.OutError("1000");
                return;
            }

            //获取用户信息
            Users baseUsers = Entity.Users.FirstOrDefault(n => n.Token == UserLoginSceneid.Token);

            if (baseUsers == null)//用户令牌不存在
            {
                DataObj.OutError("2004");
                return;
            }
            if (baseUsers.State != 1)//用户被锁定
            {
                DataObj.OutError("2003");
                return;
            }

            UserLoginSceneid SLS = Entity.UserLoginSceneid.FirstOrDefault(n => n.Sceneid == UserLoginSceneid.Sceneid);

            if (SLS == null)
            {//不存在
                DataObj.OutError("2040");
                return;
            }
            if (!SLS.UId.IsNullOrEmpty())
            {//已使用
                DataObj.OutError("2040");
                return;
            }
            if (SLS.AddTime.AddMinutes(5) < DateTime.Now)
            {//超时
                DataObj.OutError("2040");
                return;
            }
            if (!SLS.UId.IsNullOrEmpty())//已使用
            {
                DataObj.OutError("2040");
                return;
            }
            if (SLS.Token != UserLoginSceneid.Token)
            {//被别人扫过
                DataObj.OutError("2040");
                return;
            }
            SLS.UId       = baseUsers.Id;
            SLS.LoginTime = DateTime.Now;

            Entity.SaveChanges();
            DataObj.Data = "";
            DataObj.Code = "0000";
            DataObj.OutString();
        }
        public void Post()
        {
            string Data = DataObj.GetData();

            if (Data.IsNullOrEmpty())
            {
                DataObj.OutError("1000");
                return;
            }
            JObject json = new JObject();

            try
            {
                json = (JObject)JsonConvert.DeserializeObject(Data);
            }
            catch (Exception Ex)
            {
                Log.Write("[ZhouBianInfo]:", "【Data】" + Data, Ex);
            }
            if (json == null)
            {
                DataObj.OutError("1000");
                return;
            }
            //JObject pp = (JObject)p;
            Users Users = new Users();

            Users = JsonToObject.ConvertJsonToModel(Users, json);
            Users baseUsers = Entity.Users.FirstOrDefault(n => n.Token == Users.Token);

            if (baseUsers == null)//用户令牌不存在
            {
                DataObj.OutError("2004");
                return;
            }
            if (baseUsers.State != 1)//用户被锁定
            {
                DataObj.OutError("2003");
                return;
            }
            if (baseUsers.CardStae != 2)//未实名认证
            {
                DataObj.OutError("2006");
                return;
            }
            if (baseUsers.Pic.IsNullOrEmpty())//未上传头象
            {
                DataObj.OutError("2041");
                return;
            }
            if (baseUsers.NeekName.IsNullOrEmpty())
            {
                baseUsers.NeekName = baseUsers.TrueName;
                Entity.SaveChanges();
            }

            string wxtoken = GetToken();

            YYDevice YYDevice = Entity.YYDevice.FirstOrDefault(n => n.UId == baseUsers.Id && n.State == 2);//已绑定页面

            if (YYDevice == null)
            {
                //获取设备
                YYDevice = Entity.YYDevice.FirstOrDefault(n => n.UId == 0 && n.State == 1);//未绑定
                if (YYDevice == null)
                {
                    //没有可用的设备
                    YYDevice = GetYYDevice(wxtoken);
                }
                if (YYDevice != null)
                {
                    YYDevice.UId   = baseUsers.Id;
                    YYDevice.State = 2;
                    Entity.SaveChanges();
                }
            }
            if (YYDevice.PageId.IsNullOrEmpty())
            {
                //未绑定页面
                YYPage YYPage = Entity.YYPage.FirstOrDefault(n => n.UId == baseUsers.Id && n.State == 1);
                if (YYPage == null)
                {
                    //生成页面
                    string title       = GetNeekName(baseUsers.NeekName);//从商户名称中获取6位
                    string description = "点击去付款";
                    string URL         = string.Format(SysPath + "/mobile/shop/index-{0}.html", baseUsers.Id, baseUsers.UserName);
                    //string Icon = Utils.ImageUrl("UsersPic", baseUsers.Pic);
                    string Icon                = Utils.ImageUrl("UsersPic", baseUsers.Pic, 120, 120, "Cut");
                    string IconPath            = HttpContext.Current.Server.MapPath(Icon);
                    UploadImageResultJson Img  = WXAPI.UploadImage(wxtoken, IconPath);
                    string            wxpicurl = Img.data.pic_url;
                    AddPageResultJson Page     = WXAPI.AddPage(wxtoken, title, description, URL, wxpicurl);
                    if (Page.errcode == ReturnCode.请求成功)
                    {
                        YYPage          = new YYPage();
                        YYPage.Title    = title;
                        YYPage.UId      = baseUsers.Id;
                        YYPage.SubTitle = description;
                        YYPage.Url      = URL;
                        YYPage.Icon     = Icon;
                        YYPage.WXIcon   = wxpicurl;
                        YYPage.AddTime  = DateTime.Now;
                        YYPage.State    = 1;
                        YYPage.PageId   = Page.data.page_id.ToString();
                        Entity.YYPage.AddObject(YYPage);
                        Entity.SaveChanges();
                    }
                }
                //绑定页面
                long         DevId  = long.Parse(YYDevice.DevId);
                long         PageId = long.Parse(YYPage.PageId);
                WxJsonResult WJR    = WXAPI.BindPage(wxtoken, DevId, PageId);
                if (WJR.errcode == ReturnCode.请求成功)
                {
                    YYDevice.PageId       = YYPage.PageId;
                    baseUsers.YYOpenState = 1;//标识用户已经开通
                    Entity.SaveChanges();
                }
            }

            YYDaily YYDaily = Entity.YYDaily.Where(n => n.UId == baseUsers.Id && n.DevId == YYDevice.DevId && n.OutDate < DateTime.Now).OrderByDescending(n => n.OutDate).FirstOrDefault();

            if (YYDaily == null)
            {
                YYDevice.ClickPV = 0;
                YYDevice.ClickUV = 0;
                YYDevice.ShakePV = 0;
                YYDevice.ShakeUV = 0;
            }
            else
            {
                YYDevice.ClickPV = YYDaily.ClickPV;
                YYDevice.ClickUV = YYDaily.ClickUV;
                YYDevice.ShakePV = YYDaily.ShakePV;
                YYDevice.ShakeUV = YYDaily.ShakeUV;
            }
            DataObj.Data = YYDevice.OutJson();
            DataObj.Code = "0000";
            DataObj.OutString();
        }
        public void Post()
        {
            string Data = DataObj.GetData();

            if (Data.IsNullOrEmpty())
            {
                DataObj.OutError("1000");
                return;
            }
            JObject json = new JObject();

            try
            {
                json = (JObject)JsonConvert.DeserializeObject(Data);
            }
            catch (Exception Ex)
            {
                Log.Write("[UsersTrueNameByAPI]:", "【Data】" + Data, Ex);
            }
            if (json == null)
            {
                DataObj.OutError("1000");
                return;
            }
            UserAuth UserAuth = new UserAuth();

            UserAuth = JsonToObject.ConvertJsonToModel(UserAuth, json);

            SysSet SysSet = this.Entity.SysSet.FirstOrNew();

            if (!UserAuth.IdentityCode.IsNullOrEmpty())
            {
                var y        = UserAuth.IdentityCode.Substring(6, 4);
                var m        = UserAuth.IdentityCode.Substring(10, 2);
                var d        = UserAuth.IdentityCode.Substring(12, 2);
                var birthday = new DateTime(int.Parse(y), int.Parse(m), int.Parse(d));
                var now      = DateTime.Now;
                int age      = now.Year - birthday.Year;
                if (now.Month < birthday.Month || (now.Month == birthday.Month && now.Day < birthday.Day))
                {
                    age--;
                }
                if (age > SysSet.AuthMaxAge || age < SysSet.AuthMinAge)
                {
                    DataObj.OutError("1104");
                    return;
                }
            }

            Users Users = new Users();

            Users = JsonToObject.ConvertJsonToModel(Users, json);

            UserTrack UserTrack = new UserTrack();

            UserTrack = JsonToObject.ConvertJsonToModel(UserTrack, json);

            if (UserAuth.Token.IsNullOrEmpty())
            {
                DataObj.OutError("1000");
                return;
            }
            if (UserAuth.NeekName.IsNullOrEmpty())
            {
                DataObj.OutError("1000");
                return;
            }
            if (Users.X.IsNullOrEmpty() || Users.Y.IsNullOrEmpty())
            {
                DataObj.OutError("1000");
                return;
            }

            string HaoFu_Auth_Open = ConfigurationManager.AppSettings["HaoFu_Auth_Open"].ToString();
            //SysSet SysSet = Entity.SysSet.FirstOrNew();

            byte CardItemNum  = 0;
            byte CardType     = 0;
            byte UsedCardType = 0;

            if (Equipment.RqType == "Apple")
            {
                CardItemNum = SysSet.IosSet10;
                if (SysSet.IosSet11 == 0)
                {
                    CardType = 0;
                }
                if (SysSet.IosSet11 == 1)
                {
                    CardType = 2;
                }
                if (SysSet.IosSet11 == 2)
                {
                    CardType = 1;
                }
            }
            else
            {
                CardItemNum = SysSet.ApkSet10;
                if (SysSet.ApkSet11 == 0)
                {
                    CardType = 0;
                }
                if (SysSet.ApkSet11 == 1)
                {
                    CardType = 2;
                }
                if (SysSet.ApkSet11 == 2)
                {
                    CardType = 1;
                }
            }
            if (HaoFu_Auth_Open != "true")
            {
                CardItemNum = 6;//兼容直连六要素接口
            }
            if (CardItemNum == 6)
            {
                if (UserAuth.BankAccount.IsNullOrEmpty() || UserAuth.AccountName.IsNullOrEmpty() || UserAuth.IdentityCode.IsNullOrEmpty() || UserAuth.Mobile.IsNullOrEmpty() || UserAuth.CVV.IsNullOrEmpty() || UserAuth.EndDate.IsNullOrEmpty())
                {
                    DataObj.OutError("1000");
                    return;
                }
                CardType = 2;//六要素一定是信用卡
            }
            else if (CardItemNum == 4)
            {
                if (UserAuth.BankAccount.IsNullOrEmpty() || UserAuth.AccountName.IsNullOrEmpty() || UserAuth.IdentityCode.IsNullOrEmpty() || UserAuth.Mobile.IsNullOrEmpty())
                {
                    DataObj.OutError("1000");
                    return;
                }
            }
            else if (CardItemNum == 3)
            {
                if (UserAuth.BankAccount.IsNullOrEmpty() || UserAuth.AccountName.IsNullOrEmpty() || UserAuth.IdentityCode.IsNullOrEmpty())
                {
                    DataObj.OutError("1000");
                    return;
                }
            }
            else
            {
                DataObj.OutError("1000");
                return;
            }
            Users baseUsers = Entity.Users.FirstOrDefault(n => n.Token == UserAuth.Token);

            if (baseUsers == null)//用户令牌不存在
            {
                DataObj.OutError("2004");
                return;
            }
            if (baseUsers.State != 1)
            {
                DataObj.OutError("2003");
                return;
            }
            if (baseUsers.CardStae == 2)   //已实名认证
            {
                DataObj.OutError("2007");
                return;
            }
            int CardIdCount = Entity.Users.Count(n => n.CardId == UserAuth.IdentityCode && n.CardStae == 2);

            if (CardIdCount > 0) //身份证已用过
            {
                DataObj.OutError("2020");
                return;
            }
            //验证账号是否被限制
            if (Entity.UserBlackList.FirstOrDefault(UBL => UBL.CardNumber == baseUsers.UserName && UBL.State == 1) != null)
            {
                //提示暂不支持您入网
                DataObj.OutError("2027");
                return;
            }
            //验证身份证是否被限制
            if (Entity.UserBlackList.FirstOrDefault(UBL => UBL.CardNumber == UserAuth.IdentityCode && UBL.State == 2) != null)
            {
                //提示暂不支持您入网
                DataObj.OutError("2027");
                return;
            }
            //验证银行卡是否被限制
            if (Entity.UserBlackList.FirstOrDefault(UBL => UBL.CardNumber == UserAuth.BankAccount && UBL.State == 3) != null)
            {
                //提示暂不支持您入网
                DataObj.OutError("2027");
                return;
            }
            //2016-10-07 非法关键词限制
            if (!SysSet.NoWord.IsNullOrEmpty())
            {
                string NeekName = Users.NeekName;
                NeekName = NeekName.Replace(" ", "").Replace(" ", "");
                string[] NoWord    = SysSet.NoWord.Split('|');
                bool     hasNoWord = false;
                string   noword    = "";
                foreach (var p in NoWord)
                {
                    if (NeekName.Contains(p))
                    {
                        hasNoWord = true;
                        noword    = p;
                        break;
                    }
                }
                if (hasNoWord)
                {
                    DataObj.Msg = "禁止使用关键词“" + noword + "”";
                    DataObj.OutError("2025");
                    return;
                }
            }

            //2016-09-30 限制重名提交
            Users tempUsers = Entity.Users.FirstOrDefault(n => n.NeekName == Users.NeekName && n.State == 1 && (n.CardStae == 2 || n.CardStae == 1));

            if (tempUsers != null)
            {
                DataObj.OutError("2024");
                return;
            }

            int Count = Entity.UserAuth.Count(n => n.UId == baseUsers.Id && n.IsCharge == 1);

            if (Count >= SysSet.AuthTimes)
            {
                DataObj.OutError("2022");
                return;
            }

            if (!UserAuth.EndDate.IsNullOrEmpty())
            {
                //处理年月问题传上来是MMYY
                //20151112调整成YYMM
                if (UserAuth.EndDate.Length == 4)
                {
                    string MM = UserAuth.EndDate.Substring(0, 2);
                    string YY = UserAuth.EndDate.Substring(2, 2);
                    UserAuth.EndDate = YY + MM;
                }
            }

            UserAuth.AddTime  = DateTime.Now;
            UserAuth.UId      = baseUsers.Id;
            UserAuth.IsCharge = 0;
            Entity.UserAuth.AddObject(UserAuth);
            Entity.SaveChanges();
            Entity.Refresh(RefreshMode.StoreWins, UserAuth);

            #region 贴牌配置
            int ApkSet3   = SysSet.ApkSet3;
            int IosSet3   = SysSet.IosSet3;
            var vSysAgent = Entity.SysAgent.FirstOrDefault(o => o.Id == baseUsers.Agent);
            if (vSysAgent == null)
            {
                DataObj.OutError("1000");
                return;
            }
            var topSysAgent = vSysAgent.GetTopAgent(Entity);
            if (topSysAgent != null && topSysAgent.IsTeiPai == 1)
            {
                ApkSet3 = topSysAgent.Set3;
                IosSet3 = topSysAgent.Set3;
            }
            #endregion

            #region 激活码逻辑
            Card Card        = null;
            bool IsCheckCard = false;
            //必填
            if ((ApkSet3 == 1 && this.Equipment.RqType == "Android") || (IosSet3 == 1 && this.Equipment.RqType == "Apple"))
            {
                IsCheckCard = true;
                if (UserAuth.CardNum.IsNullOrEmpty() || UserAuth.CardPWD.IsNullOrEmpty())
                {
                    DataObj.OutError("1000");
                    return;
                }
            }

            //选填
            if ((ApkSet3 == 3 && this.Equipment.RqType == "Android") || (IosSet3 == 3 && this.Equipment.RqType == "Apple"))
            {
                if (!UserAuth.CardNum.IsNullOrEmpty() && !UserAuth.CardPWD.IsNullOrEmpty())
                {
                    IsCheckCard = true;
                }
            }

            if (IsCheckCard)
            {
                Card = Entity.Card.FirstOrDefault(n => n.Code == UserAuth.CardNum && n.PasWd == UserAuth.CardPWD && n.Auto == 1);
                if (Card == null)
                {
                    DataObj.OutError("5001");
                    return;
                }
                if (Card.State != 1)
                {
                    string StateStr = string.Empty;
                    switch (Card.State)
                    {
                    case 2:
                        StateStr = "已授权";
                        break;

                    case 3:
                        StateStr = "已使用";
                        break;

                    case 0:
                        StateStr = "已失效";
                        break;
                    }

                    DataObj.Msg = "激活码" + StateStr;
                    DataObj.OutError("5001");
                    return;
                }
                if (Card.AId.IsNullOrEmpty())
                {
                    DataObj.OutError("5002");
                    return;
                }
                if (Card.AdminId.IsNullOrEmpty())
                {
                    DataObj.OutError("5002");
                    return;
                }
                Card.State        = 3;//使用中
                baseUsers.CardNum = Card.Code;
            }
            #endregion

            string ret_code = "";
            string ret_msg  = "";
            string isCharge = "";

            string CONTENT = "";

            #region 第三方接口查询
            if (HaoFu_Auth_Open == "true")
            {
                if (CardItemNum != 6)
                {
                    UsedCardType = GetCardType(UserAuth.BankAccount);
                    if (CardType == 1)//要求借记卡
                    {
                        if (UsedCardType != 1)
                        {
                            DataObj.OutError("2023");
                            Utils.WriteLog(CardType + "===" + UsedCardType + "无法查询的卡:" + UserAuth.BankAccount, "bankcard");
                            return;
                        }
                    }
                    if (CardType == 2)//要求信用卡
                    {
                        if (UsedCardType != 2)
                        {
                            DataObj.OutError("2023");
                            Utils.WriteLog(CardType + "===" + UsedCardType + "无法查询的卡:" + UserAuth.BankAccount, "bankcard");
                            return;
                        }
                    }
                }
                else
                {
                    UsedCardType = 2;
                }

                string HaoFu_Auth_MerId  = ConfigurationManager.AppSettings["HaoFu_Auth_MerId"].ToString();
                string HaoFu_Auth_MerKey = ConfigurationManager.AppSettings["HaoFu_Auth_MerKey"].ToString();
                string HaoFu_Auth_Url    = ConfigurationManager.AppSettings["HaoFu_Auth_Url"].ToString();

                string data       = "{\"action\":\"authuser\",\"merid\":\"" + HaoFu_Auth_MerId + "\",\"orderid\":\"" + UserAuth.OId + "\",\"bankaccount\":\"" + UserAuth.BankAccount + "\",\"accountname\":\"" + UserAuth.AccountName + "\",\"identitycode\":\"" + UserAuth.IdentityCode + "\",\"mobile\":\"" + UserAuth.Mobile + "\",\"cvv\":\"" + UserAuth.CVV + "\",\"enddate\":\"" + UserAuth.EndDate + "\"}";
                string DataBase64 = LokFuEncode.Base64Encode(data, "utf-8");
                string Sign       = (DataBase64 + HaoFu_Auth_MerKey).GetMD5();

                DataBase64 = HttpUtility.UrlEncode(DataBase64, Encoding.UTF8);
                string postdata = "req=" + DataBase64 + "&sign=" + Sign;

                CONTENT = Utils.PostRequest(HaoFu_Auth_Url, postdata, "utf-8");

                JObject JS = new JObject();
                try
                {
                    JS = (JObject)JsonConvert.DeserializeObject(CONTENT);
                }
                catch (Exception Ex)
                {
                    Log.Write("[UsersTrueNameByAPI]:", "【CONTENT】" + CONTENT, Ex);
                }
                if (JS == null)
                {
                    DataObj.OutError("2021");
                    return;
                }
                string resp = JS["resp"].ToString();
                CONTENT = LokFuEncode.Base64Decode(resp, "utf-8");
                try
                {
                    JS = (JObject)JsonConvert.DeserializeObject(CONTENT);
                }
                catch (Exception Ex)
                {
                    Log.Write("[UsersTrueNameByAPI]:", "【CONTENT2】" + CONTENT, Ex);
                }
                if (JS == null)
                {
                    DataObj.OutError("2021");
                    return;
                }
                ret_code = JS["respcode"].ToString();
                ret_msg  = JS["respmsg"].ToString();
                if (JS["ischarge"] != null)
                {
                    isCharge = JS["ischarge"].ToString();
                }
                if (isCharge == "1")
                {
                    UserAuth.IsCharge = 1;
                }
                else
                {
                    UserAuth.IsCharge = 0;
                }
            }
            #endregion

            #region 审核处理
            UserAuth.RetCode = ret_code;
            UserAuth.RetMsg  = ret_msg;
            UserAuth.RetLog  = CONTENT;

            baseUsers.TrueName = UserAuth.AccountName;
            baseUsers.NeekName = UserAuth.NeekName;
            baseUsers.CardId   = UserAuth.IdentityCode;

            baseUsers.CardFace = "";

            baseUsers.CardType = 1;
            if (UsedCardType == 2)
            {
                baseUsers.HasT0 = 1;
            }
            else
            {
                baseUsers.HasT0 = 0;
            }

            string Code = "0000";
            if (ret_code == "0000")
            {
                baseUsers.CardStae = 2;//直接审核通过
                //=======================================
                string GPSAddress = Users.RegAddress;
                if (GPSAddress.IsNullOrEmpty())
                {
                    GPSAddress = Utils.GetAddressByGPS(Users.X, Users.Y);
                }
                if (!GPSAddress.IsNullOrEmpty())
                {
                    baseUsers.RegAddress = GPSAddress;
                    baseUsers.X          = Users.X;
                    baseUsers.Y          = Users.Y;
                }
                //=======================================
                UserTrack.ENo        = DataObj.ENo;
                UserTrack.OPType     = "自动认证";
                UserTrack.GPSAddress = GPSAddress;
                UserTrack.GPSX       = Users.X;
                UserTrack.GPSY       = Users.Y;
                baseUsers.SeavGPSLog(UserTrack, Entity);
                //=======================================

                //20151125需要对有绑卡的用户验证是否是来源与推广,增加抽奖次数
                #region  人推广
                if (!baseUsers.MyPId.IsNullOrEmpty())
                {
                    if (baseUsers.ShareType == 2)
                    {
                        //支付通道升级推广
                        PayConfigChange PCC = Entity.PayConfigChange.FirstOrDefault(n => n.Id == baseUsers.PayConfigId && n.State == 1 && n.ShareNumber > 0);
                        if (PCC != null)
                        {
                            int count = Entity.Users.Count(n => n.CardStae == 2 && n.State == 1 && n.MyPId == baseUsers.MyPId && n.PayConfigId == baseUsers.PayConfigId && n.Id != baseUsers.Id);

                            count++;                      //这里统计会漏掉当前用户的,需要增加1个。

                            if (count == PCC.ShareNumber) //相等的那一次调整,避免超出了还一直调整
                            {
                                Users UP = Entity.Users.FirstOrDefault(n => n.Id == baseUsers.MyPId);
                                if (PCC.CState == 1)
                                {
                                    if (UP.Cash0 > PCC.Cash0)
                                    {
                                        UP.Cash0 = PCC.Cash0;
                                    }
                                    if (UP.ECash0 > PCC.ECash0)
                                    {
                                        UP.ECash0 = PCC.ECash0;
                                    }
                                }
                                if (PCC.EState == 1)
                                {
                                    if (UP.Cash1 > PCC.Cash1)
                                    {
                                        UP.Cash1 = PCC.Cash1;
                                    }
                                    if (UP.ECash1 > PCC.ECash1)
                                    {
                                        UP.ECash1 = PCC.ECash1;
                                    }
                                }
                                IList <UserPay> List = Entity.UserPay.Where(n => n.UId == baseUsers.MyPId).ToList();//获取用户配置
                                foreach (var p in List)
                                {
                                    PayConfigTemp PCT = Entity.PayConfigTemp.FirstOrDefault(n => n.PId == p.PId && n.PCCId == PCC.Id);
                                    //获取套餐配置
                                    if (PCT != null)
                                    {
                                        if (PCT.State == 1)
                                        {
                                            if (p.Cost > PCT.Cost)
                                            {
                                                p.Cost = PCT.Cost;
                                            }
                                        }
                                    }
                                }
                                string UserPayCashName = "UserPay_" + UP.Id.ToString() + "_" + Equipment.RqType;
                                CacheBuilder.EntityCache.Remove(UserPayCashName, null);
                                string PayConfigChangeCashName = "PayConfigChange_" + UP.Agent + "_" + UP.Id;
                                CacheBuilder.EntityCache.Remove(PayConfigChangeCashName, null);
                                //Utils.WriteLog("UserPayCashName:" + UserPayCashName + " PayConfigChangeCashName:" + PayConfigChangeCashName, "ClearCache");
                            }
                        }
                    }
                    if (baseUsers.ShareType == 1)
                    {
                        //增加推广抽奖次数
                        TurnUsers TurnUsers = Entity.TurnUsers.FirstOrNew(n => n.UId == baseUsers.MyPId);
                        if (!TurnUsers.Id.IsNullOrEmpty())
                        {
                            TurnUsers.Times++;
                        }
                    }
                    #region 分享统计数
                    //===================================增加分享统计数===================================
                    //获取用户所属各级分润配置
                    // IList<UserPromoteGet> UserPromoteGetList = Entity.UserPromoteGet.Where(n => n.AgentID == baseUsers.Agent).OrderBy(n => n.PromoteLevel).ToList();
                    int MaxLevel = SysSet.GlobaPromoteMaxLevel;
                    //获取用户各级关系,最大级不超过用户配置级数。返回数据包含当前用户,当前用户级数标识Tier为0
                    IList <Users> UsersList = baseUsers.GetUsersById(Entity, MaxLevel);
                    foreach (var U in UsersList.Where(n => n.Tier > 0))
                    {
                        ShareTotal ShareTotal = Entity.ShareTotal.FirstOrDefault(n => n.UId == U.Id && n.Tier == U.Tier);
                        if (ShareTotal == null)
                        {
                            ShareTotal          = new ShareTotal();
                            ShareTotal.UId      = U.Id;
                            ShareTotal.AddTime  = DateTime.Now;
                            ShareTotal.ShareNum = 1;
                            ShareTotal.Amount   = 0;
                            ShareTotal.Profit   = 0;
                            ShareTotal.Tier     = U.Tier;
                            Entity.ShareTotal.AddObject(ShareTotal);
                        }
                        else
                        {
                            ShareTotal.ShareNum += 1;
                        }
                        Entity.SaveChanges();
                    }
                    //===================================增加分享统计数 End===================================
                    #endregion
                }
                #endregion

                if (Card != null)
                {
                    //代理商信息
                    baseUsers.Agent = Card.AId;
                    baseUsers.AId   = Card.AdminId;
                    //推广信息
                    if (!Card.PUId.IsNullOrEmpty())
                    {
                        if (baseUsers.MyPId.IsNullOrEmpty())
                        {
                            //不是费率升级推广才有效
                            baseUsers.MyPId       = Card.PUId;
                            baseUsers.PayConfigId = 0;
                            baseUsers.ShareType   = 1;
                        }
                    }
                    Card.State = 2;
                }
            }
            else
            {
                Code = "2021";
                baseUsers.CardStae = 3;//审核失败
                baseUsers.CardNum  = "";
                if (Card != null)
                {
                    Card.State = 1;
                }
            }
            Entity.SaveChanges();
            #endregion
            DataObj.Data = UserAuth.OutJson();
            DataObj.Code = Code;
            DataObj.OutString();
        }
Пример #28
0
        public void Post()
        {
            string Data = DataObj.GetData();

            if (Data.IsNullOrEmpty())
            {
                DataObj.OutError("1000");
                return;
            }
            JObject json = new JObject();

            try
            {
                json = (JObject)JsonConvert.DeserializeObject(Data);
            }
            catch (Exception Ex)
            {
                Log.Write("[Orders]:", "【Data】" + Data, Ex);
            }
            if (json == null)
            {
                DataObj.OutError("1000");
                return;
            }
            Orders Orders = new Orders();

            Orders = JsonToObject.ConvertJsonToModel(Orders, json);

            Users baseUsers = Entity.Users.FirstOrDefault(n => n.Token == Orders.Token);

            if (baseUsers == null)//用户令牌不存在
            {
                DataObj.OutError("2004");
                return;
            }
            if (baseUsers.State != 1)//用户被锁定
            {
                DataObj.OutError("2003");
                return;
            }
            if (baseUsers.CardStae != 2)//未实名认证
            {
                //DataObj.OutError("2006");
                //return;
            }
            if (baseUsers.MiBao != 1)//未设置支付密码
            {
                //DataObj.OutError("2008");
                //return;
            }

            EFPagingInfo <Orders> p = new EFPagingInfo <Orders>();

            if (!Orders.Pg.IsNullOrEmpty())
            {
                p.PageIndex = Orders.Pg;
            }
            if (!Orders.Pgs.IsNullOrEmpty())
            {
                p.PageSize = Orders.Pgs;
            }
            if (!Orders.STime.IsNullOrEmpty())
            {
                p.SqlWhere.Add(f => f.AddTime >= Orders.STime);
            }
            if (!Orders.ETime.IsNullOrEmpty())
            {
                Orders.ETime = Orders.ETime.AddHours(24);
                p.SqlWhere.Add(f => f.AddTime <= Orders.ETime);
            }
            if (!Orders.IdCardState.IsNullOrEmpty())
            {//凭证状态
                if (Orders.IdCardState == 99)
                {
                    p.SqlWhere.Add(f => f.IdCardState == 0);
                }
                else if (Orders.IdCardState == 98)
                {
                    p.SqlWhere.Add(f => f.IdCardState == 1 || f.IdCardState == 2 || f.IdCardState == 4);
                }
                else
                {
                    p.SqlWhere.Add(f => f.IdCardState == Orders.IdCardState);
                }
            }

            bool IsOld = true;

            #region 版本比较 升级之后比较长时间后可以考滤删除版本判断代码
            //处理贴牌相关
            var SysAgent = this.Entity.SysAgent.FirstOrDefault(o => o.Id == baseUsers.Agent);
            if (SysAgent == null)
            {
                DataObj.OutError("1000");
                return;
            }
            var topSysAgent = SysAgent.GetTopAgent(this.Entity);

            if (!Equipment.SoftVer.IsNullOrEmpty())
            {
                Version v1 = new Version(Equipment.SoftVer);//当前版本
                Version v2 = new Version("1.0");

                if (Equipment.RqType.ToLower() == "apple")
                {
                    //苹果
                    if (topSysAgent.IsTeiPai == 0)//好付
                    {
                        v2 = new Version("8.0");
                    }
                    else//贴牌
                    {
                        v2 = new Version("6.0");
                    }
                }
                else if (Equipment.RqType.ToLower() == "android")
                {
                    //安卓
                    if (topSysAgent.IsTeiPai == 0)//好付
                    {
                        v2 = new Version("8.0.0");
                    }
                    else //贴牌
                    {
                        v2 = new Version("6.0");
                    }
                }
                if (v1 >= v2)
                {
                    IsOld = false;
                }
            }
            #endregion
            if (!IsOld)//新版
            {
                #region 4.0条件判断
                if (!(Orders.TType == 3 && Orders.TState == 3))
                {
                    p.SqlWhere.Add(o => o.UId == baseUsers.Id);
                }
                if (!Orders.TType.IsNullOrEmpty())
                {
                    p.SqlWhere.Add(f => f.TType == Orders.TType);//读取对应的类型
                    if (Orders.TType == 1)
                    {
                        if (!Orders.TState.IsNullOrEmpty())
                        {
                            switch (Orders.TState)
                            {
                            case 1:    //未付
                                p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 0);
                                break;

                            case 2:    //已付
                                p.SqlWhere.Add(f => f.TState == 2 && f.PayState == 1);
                                break;

                            case 3:    //待传证照
                                p.SqlWhere.Add(f => f.PayState == 1 && f.IdCardState == 1);
                                break;

                            case 4:    //待审核/已传证照
                                p.SqlWhere.Add(f => f.PayState == 1 && f.IdCardState == 2);
                                break;

                            case 5:    //审核失败
                                p.SqlWhere.Add(f => f.PayState == 1 && f.IdCardState == 4);
                                break;

                            case 6:    //退单
                                p.SqlWhere.Add(f => f.TState == 4);
                                break;

                            case 7:    //待入帐
                                p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 1 && f.InState == 0);
                                break;
                            }
                        }
                    }
                    if (Orders.TType == 2)
                    {
                        switch (Orders.TState)
                        {
                        case 1:    //处理中
                            p.SqlWhere.Add(f => f.TState == 1);
                            break;

                        case 2:    //已汇出
                            p.SqlWhere.Add(f => f.TState == 2 && f.PayState == 2);
                            break;

                        case 3:    //提现失败
                            p.SqlWhere.Add(f => f.TState == 3);
                            break;

                        case 4:    //出款中
                            p.SqlWhere.Add(f => f.TState == 2 && f.PayState == 1);
                            break;

                        case 5:    //退款
                            p.SqlWhere.Add(f => f.TState == 2 && f.PayState == 4);
                            break;

                        case 6:    //退款中
                            p.SqlWhere.Add(f => f.TState == 2 && f.PayState == 3);
                            break;
                        }
                    }
                    if (Orders.TType == 3)
                    {
                        switch (Orders.TState)
                        {
                        case 1:    //未付
                            p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 0);
                            break;

                        case 2:    //已付
                            p.SqlWhere.Add(f => f.TState == 2 && f.PayState == 1);
                            break;

                        case 3:    //已收
                            p.SqlWhere.Add(f => f.TState == 2 && f.PayState == 1 && f.RUId == baseUsers.Id);
                            break;
                        }
                    }
                    if (Orders.TType == 6)
                    {
                        if (!Orders.TState.IsNullOrEmpty())
                        {
                            p.SqlWhere.Add(f => f.TState == Orders.TState);
                        }
                    }
                    if (Orders.TType == 7 || Orders.TType == 8)
                    {
                        if (!Orders.TState.IsNullOrEmpty())
                        {
                            if (Orders.TState == 99)
                            {
                                p.SqlWhere.Add(f => f.TState == 0);
                            }
                            if (Orders.TState == 1)
                            {
                                p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 0);
                            }
                            if (Orders.TState == 2)
                            {
                                p.SqlWhere.Add(f => f.TState == 2 && f.PayState == 1);
                            }
                            if (Orders.TState == 3)//退单
                            {
                                p.SqlWhere.Add(f => f.TState == 4);
                            }
                            if (Orders.TState == 4)//待入帐
                            {
                                p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 1 && f.InState == 0);
                            }
                            if (Orders.TState == 5)//待审核/已传证照
                            {
                                p.SqlWhere.Add(f => f.PayState == 1 && f.InState == 1 && f.IdCardState == 2);
                            }
                            if (Orders.TState == 6)//待传证照
                            {
                                p.SqlWhere.Add(f => f.PayState == 1 && f.InState == 1 && f.IdCardState == 1);
                            }
                            if (Orders.TState == 7)//审核失败
                            {
                                p.SqlWhere.Add(f => f.PayState == 1 && f.InState == 1 && f.IdCardState == 4);
                            }
                        }
                    }
                }
                else
                {
                    if (!Orders.TState.IsNullOrEmpty())
                    {
                        if (Orders.TState == 99)
                        {
                            p.SqlWhere.Add(f => f.TState == 0);
                        }
                        if (Orders.TState == 1)
                        {
                            p.SqlWhere.Add(f => f.PayState == 1);
                        }
                        if (Orders.TState == 2)
                        {
                            p.SqlWhere.Add(f => f.PayState == 0 && f.TState != 0);
                        }
                    }
                }
                #endregion
            }
            else
            {
                #region 4.0之前条件判断
                //搜索
                if (Orders.TType.IsNullOrEmpty())
                {//不限类型,读取收支交易,收款订单只显示已支付订单
                    p.SqlWhere.Add(f => f.UId == baseUsers.Id || (f.RUId == baseUsers.Id && f.PayState == 1) && f.TType != 2);
                }
                else
                {
                    if (Orders.TType == 4)
                    {
                        //已支付收款订单
                        p.SqlWhere.Add(f => f.TType == 3);
                        p.SqlWhere.Add(f => f.RUId == baseUsers.Id && f.PayState == 1);
                    }
                    else if (Orders.TType == 95)
                    { //转帐单
                        p.SqlWhere.Add(f => f.TType == 3);
                        p.SqlWhere.Add(f => (f.RUId == baseUsers.Id && f.PayState == 1) || f.UId == baseUsers.Id);
                    }
                    else if (Orders.TType == 96)   //收款订单
                    {
                        p.SqlWhere.Add(f => (f.TType == 3 && f.RUId == baseUsers.Id && f.PayState == 1) || (f.TType == 1 && f.UId == baseUsers.Id));
                    }
                    else
                    {
                        p.SqlWhere.Add(f => f.TType == Orders.TType);
                        p.SqlWhere.Add(f => f.UId == baseUsers.Id);
                    }
                }
                if (!Orders.TState.IsNullOrEmpty())  //交易状态
                {
                    p.SqlWhere.Add(f => f.TState == Orders.TState);
                }
                if (!Orders.PayState.IsNullOrEmpty()) //支付状态
                {
                    if (Orders.PayState == 99)
                    {
                        Orders.PayState = 0;
                    }
                    p.SqlWhere.Add(f => f.PayState == Orders.PayState);
                }
                #endregion
            }

            p.OrderByList.Add("Id", "DESC");
            IPageOfItems <Orders> List = Entity.Selects <Orders>(p);
            //处理转帐订单
            foreach (var pp in List)
            {
                pp.Cols = pp.Cols + ",Json,PicList,UserCardName,CardUpdateTime";
                if (baseUsers.Id == pp.RUId)
                {
                    pp.TType = 4;
                }
                JObject JS = new JObject();
                if (pp.TType == 1)
                { //银联卡支付
                    OrderRecharge OrderRecharge = Entity.OrderRecharge.FirstOrNew(n => n.OId == pp.TNum);
                    OrderRecharge.Cols = "Amoney,PayMoney,Poundage,PayType";
                    string JsStr = OrderRecharge.OutJson();
                    try
                    {
                        JS = (JObject)JsonConvert.DeserializeObject(JsStr);
                    }
                    catch (Exception Ex)
                    {
                        Log.Write("[Order]:", "【JsStr】" + JsStr, Ex);
                    }
                    pp.Json = JS;
                }
                if (pp.TType == 2)//提现不能取消
                {
                    OrderCash OrderCash = Entity.OrderCash.FirstOrNew(n => n.OId == pp.TNum);
                    OrderCash.Cols     = "Owner,Bank,CardNum,Deposit,Mobile,Province,City,District,Amoney,UserRate,TrunType,PayMoney";
                    OrderCash.PayMoney = OrderCash.Amoney - (decimal)OrderCash.UserRate;
                    string JsStr = OrderCash.OutJson();
                    try
                    {
                        JS = (JObject)JsonConvert.DeserializeObject(JsStr);
                    }
                    catch (Exception Ex)
                    {
                        Log.Write("[Order]:", "【JsStr】" + JsStr, Ex);
                    }
                    pp.Json = JS;
                }
                if (pp.TType == 3 || pp.TType == 4)//付款
                {
                    OrderTransfer OrderTransfer = Entity.OrderTransfer.FirstOrNew(n => n.OId == pp.TNum);
                    Users         Users         = new Users();
                    if (pp.TType == 4)
                    {
                        Users = Entity.Users.FirstOrNew(n => n.Id == OrderTransfer.UId);
                    }
                    if (pp.TType == 3)
                    {
                        Users = Entity.Users.FirstOrNew(n => n.Id == OrderTransfer.RUId);
                    }
                    OrderTransfer.Mobile     = Users.UserName;
                    OrderTransfer.ToUserName = Users.TrueName;
                    OrderTransfer.Cols       = "UId,RUId,PayMoney,Poundage,Amoney,Mobile,ToUserName";
                    string JsStr = OrderTransfer.OutJson();
                    try
                    {
                        JS = (JObject)JsonConvert.DeserializeObject(JsStr);
                    }
                    catch (Exception Ex)
                    {
                        Log.Write("[Order]:", "【JsStr】" + JsStr, Ex);
                    }
                    pp.Json = JS;
                }
                if (pp.TType == 5)//防租
                {
                    OrderHouse OrderHouse = Entity.OrderHouse.FirstOrNew(n => n.OId == pp.TNum);
                    OrderHouse.Cols = "HouseOwner,Bank,CardNum,Deposit,Mobile,MonthRent,SecurityMoney,PayMonth,Poundage,Amoney";
                    string JsStr = OrderHouse.OutJson();
                    try
                    {
                        JS = (JObject)JsonConvert.DeserializeObject(JsStr);
                    }
                    catch (Exception Ex)
                    {
                        Log.Write("[Order]:", "【JsStr】" + JsStr, Ex);
                    }
                    pp.Json = JS;
                }
                if (pp.TType == 6)
                { //升级
                    //PayConfigOrder PayConfigOrder = Entity.PayConfigOrder.FirstOrNew(n => n.OId == pp.TNum);
                    //Out = Out + "," + PayConfigOrder.ToStr();
                    pp.Poundage = 0;
                }
                if (pp.TType == 7 || pp.TType == 8 || pp.TType == 9)
                { //扫码
                    OrderF2F OrderF2F = Entity.OrderF2F.FirstOrNew(n => n.OId == pp.TNum);
                    OrderF2F.Cols = "Amoney,PayMoney,Poundage";
                    string JsStr = OrderF2F.OutJson();
                    try
                    {
                        JS = (JObject)JsonConvert.DeserializeObject(JsStr);
                    }
                    catch (Exception Ex)
                    {
                        Log.Write("[Order]:", "【JsStr】" + JsStr, Ex);
                    }
                    pp.Json = JS;
                }
                if (pp.TType == 10)
                {//代理
                }
                pp.DoRemark(Entity);
                pp.StateTxt = pp.GetState();
                if (pp.RUId == baseUsers.Id && pp.PayState == 1)
                {
                    pp.StateTxt = "已收";
                }
                if (pp.IdCardState > 1)
                {
                    pp.Remark = pp.DDAuditRemark;
                }
                if (!pp.Remark.IsNullOrEmpty())
                {
                    pp.Remark = pp.Remark.Replace("\t", "");
                }
                if (!pp.UserCardPic.IsNullOrEmpty())
                {
                    var UserCardPicList = pp.UserCardPic.Split(',').ToList();
                    for (int i = 0; i < UserCardPicList.Count; i++)
                    {
                        var a = Utils.ImageUrl("Orders", UserCardPicList[i], AppImgPath);
                        UserCardPicList[i] = a;
                    }
                    JavaScriptSerializer JSS = new JavaScriptSerializer();
                    string data = JSS.Serialize(UserCardPicList);
                    JArray JO   = (JArray)JsonConvert.DeserializeObject(data);
                    pp.PicList = JO;
                }
            }

            IList <OrdersModel> OML = Utils.GetOrdersModel();
            OML = OML.Where(n => n.Id != 10).ToList();
            foreach (var P in OML)
            {
                if (P.Id == 3)
                {
                    P.Id = 95;
                }
            }

            IList <Orders> iList = List.ToList();
            StringBuilder  sb    = new StringBuilder("");
            sb.Append("{");
            sb.Append(List.PageToString());
            sb.Append(",");
            sb.Append(iList.EntityToString());
            sb.Append(",");
            sb.Append(OML.EntityToString());

            sb.Append(",\"state\":{");
            sb.Append("\"0\":[{\"key\":\"交易关闭\",\"value\":\"99\"},{\"key\":\"已付\",\"value\":\"1\"},{\"key\":\"未付\",\"value\":\"2\"}],");
            sb.Append("\"1\":[{\"key\":\"未付\",\"value\":\"1\"},{\"key\":\"已付\",\"value\":\"2\"},{\"key\":\"待传证照\",\"value\":\"3\"},{\"key\":\"已传证照\",\"value\":\"4\"},{\"key\":\"审核失败\",\"value\":\"5\"},{\"key\":\"退单\",\"value\":\"6\"},{\"key\":\"待入账\",\"value\":\"7\"}],");
            sb.Append("\"2\":[{\"key\":\"处理中\",\"value\":\"1\"},{\"key\":\"已汇出\",\"value\":\"2\"},{\"key\":\"提现失败\",\"value\":\"3\"},{\"key\":\"出款中\",\"value\":\"4\"},{\"key\":\"已退款\",\"value\":\"5\"},{\"key\":\"退款中\",\"value\":\"6\"}],");
            sb.Append("\"3\":[{\"key\":\"未付\",\"value\":\"1\"},{\"key\":\"已付\",\"value\":\"2\"},{\"key\":\"已收\",\"value\":\"3\"}],");
            sb.Append("\"6\":[{\"key\":\"交易关闭\",\"value\":\"99\"},{\"key\":\"未付\",\"value\":\"1\"},{\"key\":\"已付\",\"value\":\"2\"}],");
            sb.Append("\"7\":[{\"key\":\"交易关闭\",\"value\":\"99\"},{\"key\":\"进行中\",\"value\":\"1\"},{\"key\":\"已付\",\"value\":\"2\"},{\"key\":\"退单\",\"value\":\"3\"},{\"key\":\"待入账\",\"value\":\"4\"},{\"key\":\"已传证照\",\"value\":\"5\"},{\"key\":\"待传证照\",\"value\":\"6\"},{\"key\":\"审核失败\",\"value\":\"7\"}],");
            sb.Append("\"8\":[{\"key\":\"交易关闭\",\"value\":\"99\"},{\"key\":\"进行中\",\"value\":\"1\"},{\"key\":\"已付\",\"value\":\"2\"},{\"key\":\"退单\",\"value\":\"3\"},{\"key\":\"待入账\",\"value\":\"4\"},{\"key\":\"已传证照\",\"value\":\"5\"},{\"key\":\"待传证照\",\"value\":\"6\"},{\"key\":\"审核失败\",\"value\":\"7\"}]");
            sb.Append("},");

            sb.Append("\"type\":[{\"key\":\"0\",\"value\":\"全部\"},{\"key\":\"1\",\"value\":\"银联卡支付\"},{\"key\":\"2\",\"value\":\"提现\"},{\"key\":\"3\",\"value\":\"转账\"},{\"key\":\"6\",\"value\":\"升级\"},{\"key\":\"7\",\"value\":\"支付宝\"},{\"key\":\"8\",\"value\":\"微信\"}]");

            sb.Append("}");
            DataObj.Data = sb.ToString();
            DataObj.Code = "0000";
            DataObj.OutString();
        }
Пример #29
0
        public void Post()
        {
            string Data = DataObj.GetData();

            if (Data.IsNullOrEmpty())
            {
                DataObj.OutError("1000");
                return;
            }
            JObject json = new JObject();

            try
            {
                json = (JObject)JsonConvert.DeserializeObject(Data);
            }
            catch (Exception Ex)
            {
                Log.Write("[UserCardInfo]:", "【Data】" + Data, Ex);
            }
            if (json == null)
            {
                DataObj.OutError("1000");
                return;
            }
            UserCard UserCard = new UserCard();

            UserCard = JsonToObject.ConvertJsonToModel(UserCard, json);
            //获取用户信息
            Users baseUsers = Entity.Users.FirstOrDefault(n => n.Token == UserCard.Token);

            if (baseUsers == null)//用户令牌不存在
            {
                DataObj.OutError("2004");
                return;
            }
            if (baseUsers.State != 1)//用户被锁定
            {
                DataObj.OutError("2003");
                return;
            }
            if (baseUsers.CardStae != 2)//未实名认证
            {
                DataObj.OutError("2006");
                return;
            }
            if (baseUsers.MiBao != 1)//未设置支付密码
            {
                DataObj.OutError("2008");
                return;
            }
            UserCard = Entity.UserCard.FirstOrDefault(n => n.Id == UserCard.Id && n.UId == baseUsers.Id && n.State == 1);
            if (UserCard == null)//不存在
            {
                DataObj.OutError("1001");
                return;
            }

            if (!UserCard.Province.IsNullOrEmpty())
            {
                BasicProvince BasicProvince = Entity.BasicProvince.FirstOrDefault(n => n.Id == UserCard.Province);
                if (BasicProvince != null)
                {
                    UserCard.ProvinceName = BasicProvince.Name;
                }
            }
            if (!UserCard.City.IsNullOrEmpty())
            {
                BasicCity BasicCity = Entity.BasicCity.FirstOrDefault(n => n.Id == UserCard.City);
                if (BasicCity != null)
                {
                    UserCard.CityName = BasicCity.Name;
                }
            }

            UserCard.Cols = "Id,Bank,Card,Name,Type,Deposit,Province,City,District,Bin,BId,ProvinceName,CityName,Mobile";
            DataObj.Data  = UserCard.OutJson();
            DataObj.Code  = "0000";
            DataObj.OutString();
        }
Пример #30
0
        public void Post()
        {
            DataObj.OutError("1020");
            return;

            /*
             * string Data = DataObj.GetData();
             * if (Data.IsNullOrEmpty())
             * {
             *  DataObj.OutError("1000");
             *  return;
             * }
             * JObject json = new JObject();
             * try
             * {
             *  json = (JObject)JsonConvert.DeserializeObject(Data);
             * }
             * catch (Exception Ex)
             * {
             *  Log.Write("[AutoBao]:", "【Data】" + Data, Ex);
             * }
             * if (json == null)
             * {
             *  DataObj.OutError("1000");
             *  return;
             * }
             * Users Users = new Users();
             * Users = JsonToObject.ConvertJsonToModel(Users, json);
             *
             * UserTrack UserTrack = new UserTrack();
             * UserTrack = JsonToObject.ConvertJsonToModel(UserTrack, json);
             *
             * if (Users.PassWord.IsNullOrEmpty() || Users.Token.IsNullOrEmpty())//使用PassWord字段
             * {
             *  DataObj.OutError("1000");
             *  return;
             * }
             * if (Users.PassWord.Length < 6)//6位及以上
             * {
             *  DataObj.OutError("1000");
             *  return;
             * }
             * if (Users.AutoBao != 1 && Users.AutoBao != 0) {
             *  DataObj.OutError("1000");
             *  return;
             * }
             * if (Users.X.IsNullOrEmpty() || Users.Y.IsNullOrEmpty())
             * {
             *  //DataObj.OutError("1000");
             *  //return;
             * }
             *
             *
             #region 校验
             * //获取用户信息
             * Users baseUsers = Entity.Users.FirstOrDefault(n => n.Token == Users.Token);
             * if (baseUsers == null)//用户令牌不存在
             * {
             *  DataObj.OutError("2004");
             *  return;
             * }
             * if (baseUsers.State != 1)//用户被锁定
             * {
             *  DataObj.OutError("2003");
             *  return;
             * }
             * if (baseUsers.MiBao != 1)//未设置支付密码
             * {
             *  DataObj.OutError("2008");
             *  return;
             * }
             * if (baseUsers.AutoCash == 1)
             * {
             *  DataObj.OutError("6072");
             *  return;
             * }
             * if (baseUsers.PayLock == 1)//密码错误太多次锁定
             * {
             *  DataObj.OutError("2050");
             *  return;
             * }
             * if (baseUsers.StopPayState == 2)//禁止支付
             * {
             *  DataObj.OutError("6060");
             *  return;
             * }
             *
             * //这里是执行指纹解锁
             * bool IfCheckOk = true;
             * if (Users.PassWord.Substring(0, 3) == "HF_")
             * {
             *  string PassWord = Users.PassWord;
             *  PassWord = PassWord.Replace("HF_", "");
             *  string Token = baseUsers.Token;
             *  Token = Token + "GoodPay";
             *  string Md5Token = Token.GetMD5().ToUpper();
             *  string Pass = Md5Token.Substring(0, 4) + Md5Token.Substring(Md5Token.Length - 4, 4);
             *  if (Pass != PassWord)
             *  {
             *      IfCheckOk = false;
             *  }
             * }
             * else if (baseUsers.PayPwd != Users.PassWord.GetPayMD5())
             * {
             *  //原支付密码错误
             *  IfCheckOk = false;
             * }
             * if (!IfCheckOk)
             * {
             *  SysSet SysSet = Entity.SysSet.FirstOrNew();
             *  //付密码错误
             *  baseUsers.PayErr++;
             *  if (baseUsers.PayErr >= SysSet.PayLock)
             *  {
             *      baseUsers.PayLock = 1;
             *  }
             *  Entity.SaveChanges();
             *  Users Out = new Users();
             *  Out.PayErr = SysSet.PayLock - baseUsers.PayErr;
             *  Out.Cols = "PayErr";
             *  DataObj.Data = Out.OutJson();
             *  DataObj.Code = "2010";
             *  DataObj.OutString();
             *  return;
             * }
             * baseUsers.PayErr = 0;
             #endregion
             * //修改用户信息
             * baseUsers.AutoBao = Users.AutoBao;
             *
             * Entity.SaveChanges();
             *
             * string optype = "关闭";
             * if (Users.AutoBao == 1)
             * {
             *  optype = "开启";
             * }
             *
             * //添加跟踪信息
             * //=======================================
             * UserTrack.ENo = DataObj.ENo;
             * UserTrack.OPType = optype + "余额自动输入余额生息";
             * UserTrack.GPSAddress = Users.RegAddress;
             * UserTrack.GPSX = Users.X;
             * UserTrack.GPSY = Users.Y;
             * baseUsers.SeavGPSLog(UserTrack, Entity);
             * //=======================================
             *
             * DataObj.Data = "";
             * DataObj.Code = "0000";
             * DataObj.OutString();
             */
        }