예제 #1
0
        public async Task <ApiResult> GetByZch(string zch)
        {
            ApiResult     apiresult = new ApiResult();
            LoginResponse loginRes  = new LoginResponse();

            try
            {
                loginRes = await DataAccess.DataBase.GzApiReader.Login(_login);

                if (loginRes.ack_code.Equals("SUCCESS"))
                {
                    var legalRes = await DataAccess.DataBase.GzApiReader.GetLegal(new GetLegalRequest(loginRes, zch, null));

                    if (legalRes.ack_code.Equals("SUCCESS"))
                    {
                        apiresult.AddMsgSingle(true, null, legalRes.data);
                    }
                    else
                    {
                        apiresult.AddMsgSingle(false, new ErrorMsg("GetLegalPerson错误", "获取数据错误"), null);
                        apiresult.AddMsg(false, legalRes.errors, null);
                    }
                }
                else
                {
                    apiresult.AddMsgSingle(false, new ErrorMsg("GetLegalPerson错误", "登陆错误"), null);
                    apiresult.AddMsg(false, loginRes.errors, null);
                }
            }
            catch (Exception ex)
            {
                apiresult.AddMsgSingle(false, new ErrorMsg("GetLegalPerson未知错误", ex.ToString()), null);
            }
            return(apiresult);
        }