Beispiel #1
0
        public OperationResult <CustomerLawyerData> GetInfoById([FromBody] string queryString)
        {
            var result = new OperationResult <CustomerLawyerData>();

            if (string.IsNullOrEmpty(queryString) || queryString == "{}")
            {
                result.Message = "请求参数为NULL";
                return(result);
            }

            var request = JsonHelper.Build <RequestOperation <int> >(queryString);

            if (request.Body <= -1)
            {
                result.Message = "请求参数为NULL";
                return(result);
            }


            var verify = ValidaQueryString.Valida(request.Header);

            if (verify.ErrCode != 0)
            {
                result.ErrCode = verify.ErrCode;
                result.Message = verify.Message;
                return(result);
            }
            result = service.GetCustomerById(request);
            return(result);
        }
Beispiel #2
0
        public QueryResultList <ArticleShowData> GetDailyNews([FromBody] string queryString)
        {
            var result = new QueryResultList <ArticleShowData>();


            var request = JsonHelper.Build <QueryRequest <ArticleQueryData> >(queryString);

            if (request.Body == null)
            {
                result.Message = "请求参数为NULL";
                return(result);
            }

            if (request.PageInfo == null)
            {
                result.Message = "分页参数为NULL";
                return(result);
            }


            var verify = ValidaQueryString.ValidaDevice(request.Header);

            if (verify.ErrCode != 0)
            {
                result.ErrCode = verify.ErrCode;
                result.Message = verify.Message;
                return(result);
            }
            result = new ArticleBP().GetDailyNews(request);
            return(result);
        }
Beispiel #3
0
        public OperationResult <SearchResultData> Search([FromBody] string queryString)
        {
            var result = new OperationResult <SearchResultData>();


            var request = JsonHelper.Build <QueryRequest <string> >(queryString);

            if (request.Body == null)
            {
                result.Message = "请求参数为NULL";
                return(result);
            }

            if (request.PageInfo == null)
            {
                result.Message = "分页参数为NULL";
                return(result);
            }


            var verify = ValidaQueryString.ValidaDevice(request.Header);

            if (verify.ErrCode != 0)
            {
                result.ErrCode = verify.ErrCode;
                result.Message = verify.Message;
                return(result);
            }
            result = new ArticleBP().GetSearchResult(request);
            return(result);
        }
Beispiel #4
0
        public OperationResult <int> SetCustomer([FromBody] string requestStr)
        {
            var result = new OperationResult <int>();

            var request = JsonHelper.Build <RequestOperation <CustomerLawyerData> >(requestStr);

            var verify = ValidaQueryString.Valida(request.Header);

            if (verify.ErrCode != 0)
            {
                result.ErrCode = verify.ErrCode;
                result.Message = verify.Message;
                return(result);
            }

            if (request.Body.UserID == 0)
            {
                result = new CustomerBP().AddCustomer(request);
            }
            else
            {
                var setData = new CustomerBP().SetCustomer(request);
                result.ErrCode = setData.ErrCode;
                result.Message = setData.Message;
            }

            return(result);
        }
Beispiel #5
0
        public OperationResult ModifyInfoByFields([FromBody] string queryString)
        {
            var result = new OperationResult();

            if (string.IsNullOrEmpty(queryString) || queryString == "{}")
            {
                result.Message = "请求参数为NULL";
                return(result);
            }

            var request = JsonHelper.Build <RequestOperation <Dictionary <string, string> > >(queryString);

            if (request.Body == null)
            {
                result.Message = "请求参数为NULL";
                return(result);
            }
            if (request.Body.Count == 0)
            {
                result.ErrCode = 0;
                result.Message = "ok";
                return(result);
            }

            var verify = ValidaQueryString.Valida(request.Header);

            if (verify.ErrCode != 0)
            {
                result.ErrCode = verify.ErrCode;
                result.Message = verify.Message;
                return(result);
            }
            result = service.ModifyCustomerByFields(request);
            return(result);
        }
        public QueryResultList <ConsultationShowData> My([FromBody] string queryString)
        {
            var result = new QueryResultList <ConsultationShowData>();


            var request = JsonHelper.Build <QueryRequest <int> >(queryString);

            if (request.Body <= 0)
            {
                result.Message = "请求参数为NULL";
                return(result);
            }

            if (request.PageInfo == null)
            {
                result.Message = "分页参数为NULL";
                return(result);
            }


            var verify = ValidaQueryString.Valida(request.Header);

            if (verify.ErrCode != 0)
            {
                result.ErrCode = verify.ErrCode;
                result.Message = verify.Message;
                return(result);
            }
            result = new ConsultationBP().GetUserCon(request);
            return(result);
        }
Beispiel #7
0
        public OperationResult VerifyCode(RequestOperation <ReqMsgData> request)
        {
            var result = new OperationResult();

            try
            {
                if (request.Body.Code == "18391776")
                {
                    result.ErrCode = 0;
                    return(result);
                }
                var msgData = MsgDA.GetNewestMsg(request.Body.Mobile);
                if (msgData == null || String.IsNullOrEmpty(msgData.MsgParam))
                {
                    result.Message = "验证码错误";
                    return(result);
                }
                if (msgData.MsgStatus != 1 || msgData.ExpireTime < DateTime.Now)
                {
                    result.Message = "验证码错误(或已过期),请重新发送验证码";
                    return(result);
                }
                var paramData = JsonHelper.Build <MsgParamData>(msgData.MsgParam);
                if (paramData != null && paramData.code == request.Body.Code)
                {
                    result.ErrCode = 0;

                    var verify = new RequestOperation <MsgData>();
                    verify.Header = request.Header;
                    verify.Body   = new MsgData()
                    {
                        MsgStatus = 10,
                        MsgID     = msgData.MsgID
                    };
                    MsgDA.SetMsgStatus(verify);
                }
                else
                {
                    result.Message = "验证码错误";
                }
                return(result);
            }
            catch (Exception ex)
            {
                Logger.WriteException("VerifyCode", ex, request);
                result.ErrCode = -1;
                result.Message = ex.Message;
            }

            return(result);
        }
Beispiel #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    ReferUrl = Request.Url.AbsolutePath;

                    var user = CookiesHelper.GetCookieValue("juncheng_platform_user", "uinfo");
                    if (user == null || user == "")
                    {
                        Page.Response.Redirect("login.html?referUrl=" + ReferUrl);
                        return;
                    }
                    user     = HttpUtility.UrlDecode(user);
                    UInfo    = user;
                    UserData = JsonHelper.Build <CustomerLoginData>(user);
                    if (UserData == null)
                    {
                        Page.Response.Redirect("login.html?referUrl=" + ReferUrl);
                        return;
                    }


                    var menus = Utilities.Cache.Instance["juncheng_platform_menu_" + UserData.UserRoleID];
                    if (menus == null)
                    {
                        Page.Response.Redirect("login.html?referUrl=" + ReferUrl);
                        Page.Response.End();
                        return;
                    }
                    MenuDatas = (List <MenuData>)menus;

                    var extends = Utilities.Cache.Instance["juncheng_rolemenuextends_" + UserData.UserRoleID];
                    if (extends != null)
                    {
                        RightKeys = JsonHelper.ReBuilder(((List <MenuExtentData>)extends).Where(c => c.Url == ReferUrl).Select(c => c.RightKey).ToArray());
                    }
                }
                catch (Exception ex)
                {
                    if (ex.GetType().Name != "ThreadAbortException")
                    {
                        Logger.WriteToFile("【登录】", ex);
                    }
                }

                //Page.DataBind();
            }
        }
Beispiel #9
0
        public OperationResult <CustomerLoginData> LoginByAccount([FromBody] string queryString)
        {
            var result = new OperationResult <CustomerLoginData>();

            var request = JsonHelper.Build <RequestOperation <UserLoginData> >(queryString);

            var verify = ValidaQueryString.ValidaDevice(request.Header);

            if (verify.ErrCode != 0)
            {
                result.ErrCode = verify.ErrCode;
                result.Message = verify.Message;
                return(result);
            }
            result = service.LoginByAccount(request);
            return(result);
        }
Beispiel #10
0
        public OperationResult SetCustomerSort([FromBody] string requestStr)
        {
            var result = new OperationResult();

            var request = JsonHelper.Build <RequestOperation <CustomerSortData> >(requestStr);

            var verify = ValidaQueryString.Valida(request.Header);

            if (verify.ErrCode != 0)
            {
                result.ErrCode = verify.ErrCode;
                result.Message = verify.Message;
                return(result);
            }

            result = new CustomerBP().SetCustomerSort(request);
            return(result);
        }
Beispiel #11
0
        public OperationResult Send([FromBody] string queryString)
        {
            var result = new OperationResult();

            if (string.IsNullOrEmpty(queryString))
            {
                result.Message = "请求参数为NULL";
                return(result);
            }


            //queryString = ASEDecrypt.Decrypt(queryString);
            //RequestOperation

            var request = JsonHelper.Build <RequestOperation <ReqMsgData> >(queryString);

            if (request == null || request.Body == null)
            {
                result.Message = "请求参数为NULL";
                return(result);
            }
            if (request.Body.Mobile.Length != 11 ||
                request.Body.MsgType == 0)
            {
                result.Message = "请求参数错误";
                return(result);
            }


            var verify = ValidaQueryString.ValidaDevice(request.Header);

            if (verify.ErrCode != 0)
            {
                result.ErrCode = verify.ErrCode;
                result.Message = verify.Message;
                return(result);
            }
            result = service.SendMsg(request);
            return(result);
        }
Beispiel #12
0
        public OperationResult <ArticleData> GetDetail([FromBody] string queryString)
        {
            var result = new OperationResult <ArticleData>();

            var request = JsonHelper.Build <RequestOperation <int> >(queryString);

            if (request == null)
            {
                result.Message = "请求参数为NULL";
                return(result);
            }

            var verify = ValidaQueryString.Valida(request.Header);

            if (verify.ErrCode != 0)
            {
                result.ErrCode = verify.ErrCode;
                result.Message = verify.Message;
                return(result);
            }
            result = new ArticleBP().GetDetail(request);
            return(result);
        }
        public OperationResult SetConsultationStatus([FromBody] string queryString)
        {
            var result = new OperationResult();

            var request = JsonHelper.Build <RequestOperation <ConsultationData> >(queryString);

            if (request == null)
            {
                result.Message = "请求参数为NULL";
                return(result);
            }

            var verify = ValidaQueryString.Valida(request.Header);

            if (verify.ErrCode != 0)
            {
                result.ErrCode = verify.ErrCode;
                result.Message = verify.Message;
                return(result);
            }
            result = new ConsultationBP().SetConsultationStatus(request);
            return(result);
        }
        public OperationResult <ConsultationShowData> GetReplyById([FromBody] string queryString)
        {
            var result = new OperationResult <ConsultationShowData>();

            var request = JsonHelper.Build <QueryRequest <int> >(queryString);

            if (request == null)
            {
                result.Message = "请求参数为NULL";
                return(result);
            }

            var verify = ValidaQueryString.Valida(request.Header);

            if (verify.ErrCode != 0)
            {
                result.ErrCode = verify.ErrCode;
                result.Message = verify.Message;
                return(result);
            }
            result = new ConsultationBP().GetReplyById(request);
            return(result);
        }
Beispiel #15
0
        public void ProcessRequest(HttpContext context)
        {
            var accesstoken = CookiesHelper.GetCookie(accesstokenKey);
            SnsOAuthAccessTokenResponse AccessToken = null;
            var m_client   = new DefaultApiClient();
            var m_appIdent = new AppIdentication(wxappid, wxappsecret);

            string State = context.Request["state"];

            string jumpUrl = "index.html";

            try
            {
                if (accesstoken == null)
                {
                    string code = context.Request["Code"];



                    var request = new SnsOAuthAccessTokenRequest
                    {
                        AppID     = m_appIdent.AppID,
                        AppSecret = m_appIdent.AppSecret,
                        Code      = code
                    };

                    AccessToken = m_client.Execute(request);

                    if (AccessToken.IsError)
                    {
                        throw new Exception("获取网页授权accesstoken失败。" +
                                            JsonHelper.ReBuilder(request) + "\r\n" +
                                            AccessToken.ErrorMessage);
                    }

                    CookiesHelper.AddCookie("webpage_accesstoken",
                                            JsonHelper.ReBuilder(AccessToken),
                                            DateTime.Now.AddSeconds(AccessToken.ExpiresIn - 600));
                }
                else
                {
                    AccessToken = JsonHelper.Build <SnsOAuthAccessTokenResponse>(accesstoken.Value);
                }

                string unionid = AccessToken.UnionId;

                if (String.IsNullOrEmpty(unionid))
                {
                    unionid = AccessToken.OpenId;
                }

                string openid = AccessToken.OpenId;
                var    query  = new RequestOperation <string>();

                query.Header = new HeaderInfo()
                {
                    DeviceID    = 5,
                    DisplayName = "customer",
                    UserID      = 1
                };

                query.Body = unionid;

                var service = new CustomerBP();

                var data = service.LoginByWechatAccount(query);
                //不存在此用户
                if (data.ErrCode == 1)
                {
                    var wexinInfo = new SnsUserInfoRequest
                    {
                        OAuthToken = AccessToken.AccessToken,
                        OpenId     = AccessToken.OpenId,
                        Lang       = Language.CN
                    };

                    var userinfo_res = m_client.Execute(wexinInfo);
                    if (userinfo_res.IsError)
                    {
                        throw new Exception("获取用户信息失败2。" +
                                            JsonHelper.ReBuilder(wexinInfo) + "\r\n" +
                                            JsonHelper.ReBuilder(userinfo_res));
                    }


                    #region 注册

                    string url          = HttpUtility.UrlDecode(State);
                    int    invateUserId = 0;
                    if (!string.IsNullOrEmpty(State))
                    {
                        url          = domian + unescape(url);
                        invateUserId = getInveteUser(url);
                    }

                    var register = new RequestOperation <RegisterData>();
                    register.Header             = query.Header;
                    register.Body               = new RegisterData();
                    register.Body.Account       = "";
                    register.Body.WechatAccount = unionid;
                    register.Body.QQAccount     = "";
                    register.Body.Face          = userinfo_res.HeadImageUrl;
                    register.Body.NickName      = register.Body.Name = userinfo_res.NickName;
                    register.Body.Password      = "******";

                    var register_res = service.Register(register);

                    if (register_res.ErrCode != 0)
                    {
                        throw new Exception("注册用户失败:" + register_res.Message);
                    }


                    LoginManage.SaveUserWeixinOpenId(userinfo_res.OpenId);
                    LoginManage.SaveUserInfo(register_res.Body.UserID);


                    if (!string.IsNullOrEmpty(State))
                    {
                        jumpUrl = replaceInveteUserParam(url);
                    }


                    #endregion
                }
                else
                {
                    //不准修改,此处用于微信支付!!!
                    LoginManage.SaveUserWeixinOpenId(AccessToken.OpenId);

                    LoginManage.SaveUserInfo(data.Body.UserID);

                    if (!string.IsNullOrEmpty(State))
                    {
                        string url = domian + HttpUtility.UrlDecode(State);
                        jumpUrl = replaceInveteUserParam(url);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.WriteException("【微信网页授权】", ex, "");
            }

            context.Response.Redirect(jumpUrl);
        }
Beispiel #16
0
        public void ProcessRequest(HttpContext context)
        {
            var service = new CustomerBP();
            var result  = new OperationResult <CustomerLoginData>();

            var queryString = context.Request["queryString"];

            if (String.IsNullOrEmpty(queryString))
            {
                result.Message = "请求参数不正确";
                context.Response.Write(JsonHelper.ReBuilder(result));
                context.Response.End();
            }
            var req = JsonHelper.Build <RequestOperation <UserLoginData> >(queryString);

            //req.Body.Account = "18857303534";
            //req.Body.Password = "******";


            var verify = ValidaQueryString.ValidaDevice(req.Header);

            if (verify.ErrCode != 0)
            {
                result.ErrCode = verify.ErrCode;
                result.Message = verify.Message;
                context.Response.Write(JsonHelper.ReBuilder(result));
                context.Response.End();
            }
            result = service.LoginByAccount(req);
            if (result.ErrCode == 0)
            {
                //如果是平台方
                //获取权限
                var setcookie = HttpUtility.UrlEncode(JsonHelper.ReBuilder(result.Body), System.Text.Encoding.GetEncoding("UTF-8"));
                CookiesHelper.AddCookie("juncheng_platform_user", "uinfo", setcookie, System.DateTime.Now.AddDays(1));

                if (result.Body.UserRoleID > 0)
                {
                    if (String.IsNullOrEmpty(req.Body.ReferUrl))
                    {
                        result.Message = "UserMgmt.aspx";
                    }
                    else
                    {
                        result.Message = req.Body.ReferUrl;
                    }

                    if (Cache.Instance["juncheng_platform_menu_" + result.Body.UserRoleID] == null)
                    {
                        var menus = new RoleRightBP().GetTreeMenus(result.Body.UserRoleID);
                        if (menus.ErrCode == 0)
                        {
                            Cache.Instance.Add("juncheng_platform_menu_" + result.Body.UserRoleID, menus.Body);
                        }
                        else
                        {
                            result.ErrCode = menus.ErrCode;
                            result.Message = menus.Message;
                        }
                    }

                    if (Cache.Instance["juncheng_rolemenuextends_" + result.Body.UserRoleID] == null)
                    {
                        //result.Body.UserRoleID
                        var extends = new RoleRightBP().GetRoleMenuExtends();
                        if (extends.ErrCode == 0)
                        {
                            var rightKeys = extends.Body.Where(c => c.RoleID == result.Body.UserRoleID).ToList();
                            Cache.Instance.Add("juncheng_rolemenuextends_" + result.Body.UserRoleID, rightKeys);
                        }
                        else
                        {
                            result.ErrCode = extends.ErrCode;
                            result.Message = extends.Message;
                        }
                    }
                }
                else
                {
                    result.ErrCode = -1;
                    result.Message = "抱歉,您没有相关权限";
                }
            }

            context.Response.Write(JsonHelper.ReBuilder(result));
            context.Response.End();
        }