Ejemplo n.º 1
0
        public override DResult <VerifyDto> Verify()
        {
            var paramDict = OnlinePayHelper.GetParams();

            Logger.Info(JsonHelper.ToJson(paramDict, indented: true));
            var sign      = paramDict.GetValue <string>("sign");
            var checkSign = paramDict.Md5Sign(Config.PrivateKey);

            if (sign != checkSign)
            {
                return(DResult.Error <VerifyDto>("验证签名失败"));
            }
            if (Config.AppId != paramDict.GetValue <string>("appid"))
            {
                return(DResult.Error <VerifyDto>("AppId异常"));
            }
            var dto = new VerifyDto
            {
                Id          = paramDict.GetValue <string>("out_trade_no"),
                TradeNo     = paramDict.GetValue <string>("transaction_id"),
                TradeStatus = paramDict.GetValue <string>("result_code"),
                Amount      = paramDict.GetValue <decimal>("total_fee"),
                BuyerId     = paramDict.GetValue <string>("openid")
            };

            return(DResult.Succ(dto));
        }
Ejemplo n.º 2
0
        //public override DApiResult<string> Pay(long orderNo, decimal price, string subject)
        //{
        //    var dict = Config.BaseParams("alipay.trade.pay");
        //    //业务参数
        //    var item = new Dictionary<string, object>
        //    {
        //        {"out_trade_no", orderNo},
        //        {"product_code", "QUICK_MSECURITY_PAY"},
        //        {"auth_code", "28763443825664394"},
        //        {"subject", subject},
        //        {"total_amount", price}
        //    };
        //    dict.Add("biz_content", JsonHelper.ToJson(item));
        //    dict.Add("sign", dict.RsaSign(Config.PrivateKey, Config.Charset));

        //    var url = $"{Config.Gateway}?{dict.ParamsUrl()}";
        //    Logger.Info(JsonHelper.ToJson(dict, indented: true));
        //    using (var http = new HttpHelper(url, Encoding.GetEncoding(Config.Charset)))
        //    {
        //        var html = http.GetHtml();
        //        Logger.Info(html);
        //        var dto = JsonHelper.Json<ReturnAlipayDto>(html);
        //        if (dto?.alipay_trade_pay_response == null)
        //            return DApiResult.Error<string>("支付接口异常");
        //        var result = dto.alipay_trade_pay_response;
        //        if (result.code != "10000")
        //            return DApiResult.Error<string>($"{result.msg}:{result.sub_msg}");
        //        return DApiResult.Succ(string.Empty);
        //    }
        //}

        public override DResult <VerifyDto> Verify()
        {
            var paramDict = OnlinePayHelper.GetParams();

            Logger.Info(JsonHelper.ToJson(paramDict, indented: true));
            var signVerified = AlipaySignature.RsaCheck(paramDict, Config.PublicKey, Config.Charset);

            if (!signVerified)
            {
                return(DResult.Error <VerifyDto>("验证签名失败"));
            }
            if (paramDict.GetValue <string>("app_id") != Config.AppId)
            {
                return(DResult.Error <VerifyDto>("AppId异常"));
            }
            var dto = new VerifyDto
            {
                Id           = paramDict.GetValue <string>("out_trade_no"),
                TradeNo      = paramDict.GetValue <string>("trade_no"),
                TradeStatus  = paramDict.GetValue <string>("trade_status"),
                Amount       = paramDict.GetValue <decimal>("total_amount"),
                BuyerId      = paramDict.GetValue <string>("buyer_id"),
                BuyerAccount = paramDict.GetValue <string>("buyer_logon_id")
            };

            return(DResult.Succ(dto));
        }
Ejemplo n.º 3
0
        public DResult <Models.Wiki> AddWiki(string name, string groupId, string creatorId, string desc)
        {
            if (Wikis.Exists(w => w.Name == name))
            {
                return(DResult.Error <Models.Wiki>("词条已存在!"));
            }
            var group = Groups.SingleOrDefault(g => g.Id == groupId);

            if (group == null)
            {
                return(DResult.Error <Models.Wiki>("分组不存在!"));
            }
            var wiki = new Models.Wiki
            {
                Id          = CombHelper.Guid16,
                Name        = name,
                CreatorId   = creatorId,
                GroupId     = groupId,
                Hots        = 0,
                Sort        = 0,
                Description = desc,
                CreateTime  = Clock.Now
            };

            wiki.Sort = Wikis.Max(w => w.Sort, w => w.GroupId == groupId) + 1;
            var result = UnitOfWork.Transaction(() =>
            {
                Wikis.Insert(wiki);
                group.WikiCount++;
                group.LastUpdateTime = Clock.Now;
                Groups.Update(group);
            });

            return(result > 0 ? DResult.Succ(wiki) : DResult.Error <Models.Wiki>("添加词条失败!"));
        }
Ejemplo n.º 4
0
        [HttpGet("hello")]//, AppTicket]
        public DResult <DemoDto> Hello(VDemoInput input)
        {
            var inputDto = Mapper.Map <DemoInputDto>(input);
            var dto      = _demoService.Hello(IdentityHelper.Guid32, inputDto);

            return(DResult.Succ(dto));
        }
Ejemplo n.º 5
0
        public async Task <DResults <JobDto> > JobHots()
        {
            //:todo
            var list = await Task.FromResult(new List <JobDto>());

            return(DResult.Succ(list, -1));
        }
 public async Task <DResult <IList <OrganizationTypeDto> > > GetRelationMasterOrganizationTypes(string TypeId)
 {
     try {
         return(DResult.Succ(businessOrganization.GetRelationMasterOrganizationTypes(TypeId)));
     }
     catch (Exception ex) {
         Logger.Error(ex.ToString());
         return(DResult.Error <IList <OrganizationTypeDto> >(ex.Message, 500));
     }
 }
Ejemplo n.º 7
0
 public async Task <DResult <int> > AddPrivilegeRoleForUser([FromBody] UserAddRoleAndPrivilege userAddRoleAndPrivilege)
 {
     try
     {
         return(DResult.Succ(businessUser.AddPrivilegeRoleForUser(userAddRoleAndPrivilege)));
     }
     catch (Exception ex) {
         Logger.Error(ex.ToString());
         return(DResult.Error <int>(ex.Message, 500));
     }
 }
Ejemplo n.º 8
0
 public async Task <DResult <PagedList <UserInfoDto> > > GetAppUsers(string Key, int Page = 0, int Size = 0, string SystemCode = "00")
 {
     try
     {
         return(DResult.Succ(businessUser.GetAppUsers(Page, Size, Key, SystemCode)));
     }
     catch (Exception ex) {
         Logger.Error(ex.ToString());
         return(DResult.Error <PagedList <UserInfoDto> >(ex.Message, 500));
     }
 }
Ejemplo n.º 9
0
 public async Task <DResult <UserRolePrivilege> > GetUserRolePrivilege(string UserId)
 {
     try
     {
         return(DResult.Succ(businessUser.GetUserRolePrivilege(UserId)));
     }
     catch (Exception ex) {
         Logger.Error(ex.ToString());
         return(DResult.Error <UserRolePrivilege>(ex.Message, 500));
     }
 }
 public async Task <DResult <IList <OrganizationAbstractDto> > > GetAreas(string OrganizationCode)
 {
     try
     {
         return(DResult.Succ(businessOrganization.GetAreas(OrganizationCode)));
     }
     catch (Exception ex) {
         Logger.Error(ex.ToString());
         return(DResult.Error <IList <OrganizationAbstractDto> >(ex.Message, 500));
     }
 }
Ejemplo n.º 11
0
 public async Task <DResult <int> > AddJsonItem([FromBody] JsonItemEditDto jsonItemEdit)
 {
     try
     {
         return(DResult.Succ(businessItem.AddJsonItem(jsonItemEdit)));
     }
     catch (Exception ex) {
         Logger.Error(ex.ToString());
         return(DResult.Error <int>(ex.Message, 500));
     }
 }
Ejemplo n.º 12
0
 public async Task <DResult <IList <string> > > GetPrivileges(string UserId)
 {
     try
     {
         return(DResult.Succ(businessUser.GetPrivileges(UserId)));
     }
     catch (Exception ex) {
         Logger.Error(ex.ToString());
         return(DResult.Error <IList <string> >(ex.Message, 500));
     }
 }
Ejemplo n.º 13
0
 public async Task <DResult <IList <V2UserInfoDto> > > GetV2UserInfos([FromBody] IList <string> UserIds)
 {
     try
     {
         return(DResult.Succ(businessUser.GetV2UserInfos(UserIds)));
     }
     catch (Exception ex) {
         Logger.Error(ex.ToString());
         return(DResult.Error <IList <V2UserInfoDto> >(ex.Message, 500));
     }
 }
 public async Task <DResult <int> > UpdateDepartment([FromBody] DepartmentUpdateDto departmentUpdateDto)
 {
     try
     {
         return(DResult.Succ(businessOrganization.UpdateDepartment(departmentUpdateDto)));
     }
     catch (Exception ex) {
         Logger.Error(ex.ToString());
         return(DResult.Error <int>(ExceptionParse.ParseString(ex.Message), 500));
     }
 }
 public async Task <DResult <PagedList <DepartmentInfoDto> > > QueryDepartments([FromBody] DepartmentPageQueryDto pageQueryDto)
 {
     try
     {
         return(DResult.Succ(businessOrganization.QueryDepartments(pageQueryDto)));
     }
     catch (Exception ex) {
         Logger.Error(ex.ToString());
         return(DResult.Error <PagedList <DepartmentInfoDto> >(ex.Message, 500));
     }
 }
 public async Task <DResult <int> > DeleteRelationOrganizationUser(string RelationId)
 {
     try
     {
         return(DResult.Succ(businessOrganization.DeleteRelationUsers(RelationId)));
     }
     catch (Exception ex) {
         Logger.Error(ex.ToString());
         return(DResult.Error <int>(ex.Message, 500));
     }
 }
 public async Task <DResult <IList <OrganizationForeignDto> > > GetForeignOrganizations(IList <string> OrganizationIds = null)
 {
     try
     {
         return(DResult.Succ(businessOrganization.GetForeignDtos()));
     }
     catch (Exception ex) {
         Logger.Error(ex.ToString());
         return(DResult.Error <IList <OrganizationForeignDto> >(ex.Message, 500));
     }
 }
 public async Task <DResult <PagedList <RelationUserInfoDto> > > GetRelationOrganizationUsers(string OrganizationCode, int UserType, int Page, int Size)
 {
     try
     {
         return(DResult.Succ(businessOrganization.GetRelationOrganizationUsers(OrganizationCode, UserType, Page, Size)));
     }
     catch (Exception ex) {
         Logger.Error(ex.ToString());
         return(DResult.Error <PagedList <RelationUserInfoDto> >(ex.Message, 500));
     }
 }
 public async Task <DResult <int> > DeleteRelationOrganizations([FromBody] IList <string> RelationIds)
 {
     try
     {
         return(DResult.Succ(businessOrganization.DeleteRelationOrganizations(RelationIds)));
     }
     catch (Exception ex) {
         Logger.Error(ex.ToString());
         return(DResult.Error <int>(ex.Message, 500));
     }
 }
 public async Task <DResult <int> > AddRelationUser([FromBody] RelationOrganizationUserAddDto relationOrganization)
 {
     try
     {
         return(DResult.Succ(businessOrganization.AddRelationUser(relationOrganization)));
     }
     catch (Exception ex) {
         Logger.Error(ex.ToString());
         return(DResult.Error <int>(ExceptionParse.ParseString(ex.Message), 500));
     }
 }
Ejemplo n.º 21
0
 public async Task <DResult <IList <AbstractDto> > > GetRelationUsersOfOrganizationCode(string OrganizationCode, string UserName)
 {
     try
     {
         return(DResult.Succ(businessUser.GetRelationUsersOfOrganizationCode(OrganizationCode, UserName)));
     }
     catch (Exception ex) {
         Logger.Error(ex.ToString());
         return(DResult.Error <IList <AbstractDto> >(ex.Message, 500));
     }
 }
Ejemplo n.º 22
0
        public DResults <TEntity> PageList(IOrderedQueryable <TEntity> ordered, DPage page)
        {
            if (ordered == null)
            {
                return(DResult.Errors <TEntity>("数据查询异常!"));
            }
            var result = ordered.Skip(page.Page * page.Size).Take(page.Size).ToList();
            var total  = ordered.Count();

            return(DResult.Succ(result, total));
        }
Ejemplo n.º 23
0
 public async Task <DResult <int> > UpdatePassword([FromBody] UserUpdatePasswordDto passwordDto)
 {
     try
     {
         return(DResult.Succ(businessUser.UpdatePassword(passwordDto)));
     }
     catch (Exception ex) {
         Logger.Error(ex.ToString());
         return(DResult.Error <int>(ExceptionParse.ParseString(ex.Message), 500));
     }
 }
 public async Task <DResult <PagedList <OrganizationAbstractDto> > > GetAllOrganizationOfCode(string Code, int Page = 0, int Size = 0, string OrganizationId = null)
 {
     try
     {
         return(DResult.Succ(businessOrganization.GetOrganizationAll(Code, Page, Size, OrganizationId)));
     }
     catch (Exception ex) {
         Logger.Error(ex.ToString());
         return(DResult.Error <PagedList <OrganizationAbstractDto> >(ex.Message, 500));
     }
 }
Ejemplo n.º 25
0
 public async Task <DResult <PagedList <UserInfoDto> > > QueryUserRelationUserByName(string UserId, string Name, int Page = 0, int Size = 0)
 {
     try
     {
         return(DResult.Succ(businessUser.QueryUserRelationUserByName(UserId, Name, Page, Size)));
     }
     catch (Exception ex) {
         Logger.Error(ex.ToString());
         return(DResult.Error <PagedList <UserInfoDto> >(ex.Message, 500));
     }
 }
Ejemplo n.º 26
0
 public async Task <DResult <int> > DeleteItem(string itemId)
 {
     try
     {
         return(DResult.Succ(businessItem.DeleteItem(itemId)));
     }
     catch (Exception ex) {
         Logger.Error(ex.ToString());
         return(DResult.Error <int>(ex.Message, 500));
     }
 }
 public async Task <DResult <OrganizationDto> > GetOrganizationByDName(string name)
 {
     try
     {
         return(DResult.Succ(businessOrganization.GetOrganizationByDName(name)));
     }
     catch (Exception ex) {
         Logger.Error(ex.ToString());
         return(DResult.Error <OrganizationDto>(ex.Message, 500));
     }
 }
 public async Task <DResult <IList <OrganizationAbstractDto> > > GetPositions(string ParentOrganizationCode, string ParentDepartmentCode)
 {
     try
     {
         return(DResult.Succ(businessOrganization.GetPositions(ParentOrganizationCode, ParentDepartmentCode)));
     }
     catch (Exception ex) {
         Logger.Error(ex.ToString());
         return(DResult.Error <IList <OrganizationAbstractDto> >(ex.Message, 500));
     }
 }
Ejemplo n.º 29
0
 public async Task <DResult <int> > AddItem([FromBody] ItemAddDto addItem)
 {
     try
     {
         return(DResult.Succ(businessItem.AddItem(addItem)));
     }
     catch (Exception ex) {
         Logger.Error(ex.ToString());
         return(DResult.Error <int>(ex.Message, 500));
     }
 }
 public async Task <DResult <OrganizationAbstractDto> > AddDepartment([FromBody] DepartmentAddDto departmentAddDto)
 {
     try
     {
         return(DResult.Succ(businessOrganization.AddDepartment(departmentAddDto)));
     }
     catch (Exception ex) {
         Logger.Error(ex.ToString());
         return(DResult.Error <OrganizationAbstractDto>(ExceptionParse.ParseString(ex.Message), 500));
     }
 }