Ejemplo n.º 1
0
Archivo: Order.cs Proyecto: tynr426/ict
        /// <summary>
        /// 订单支付
        /// </summary>
        /// <param name="para"></param>
        /// <returns></returns>
        public static IResultResponse OrderPay(SysParameter para)
        {
            int sellerId = para.ToInt("FKId");
            int dbId     = para.ToInt("DBId");
            int orderId  = para.ToInt("OrderId");

            try
            {
                ConnectorRelation connectorEntity = new ConnectorBusiness(para.dapperFactory).GetUpConnector(sellerId, dbId);
                if (connectorEntity.Id == null)
                {
                    return(ResultResponse.ExceptionResult("没有找到对应的上游"));
                }
                RelationMappingEntity orderMappingEntity = new OrderRelationBusiness(para.dapperFactory).GetUpOrder(sellerId, dbId, orderId);
                if (!orderMappingEntity.OrderMapping.ContainsKey(orderId))
                {
                    return(ResultResponse.ExceptionResult("没有找到对应的订单"));
                }
                Dictionary <string, string> p = new Dictionary <string, string>()
                {
                    { "domain", connectorEntity.Domain },
                    { "userId", connectorEntity.UpBuyerId.ToString() },
                    { "orderId", orderMappingEntity.OrderMapping[orderId].ToString() },
                };

                return(ResultResponse.GetSuccessResult(p));
            }
            catch (Exception ex)
            {
                return(ResultResponse.ExceptionResult(ex));
            }
        }
Ejemplo n.º 2
0
Archivo: Order.cs Proyecto: tynr426/ict
        /// <summary>
        /// 订单支付
        /// </summary>
        /// <param name="para"></param>
        /// <returns></returns>
        public static IResultResponse OrderUpdate(SysParameter para)
        {
            int sellerId  = para.ToInt("FKId");
            int dbId      = para.ToInt("DBId");
            int orderId   = para.ToInt("OrderId");
            int upBuyerId = para.ToInt("BuyerId");

            try
            {
                ConnectorRelation connectorEntity = new ConnectorBusiness(para.dapperFactory).GetDownConnector(sellerId, upBuyerId, dbId);
                if (connectorEntity.Id == null)
                {
                    return(ResultResponse.ExceptionResult("没有找到对应的下游"));
                }
                RelationMappingEntity orderMappingEntity = new OrderRelationBusiness(para.dapperFactory).GetDownOrder(sellerId, dbId, orderId, upBuyerId);
                if (!orderMappingEntity.OrderMapping.ContainsKey(orderId))
                {
                    return(ResultResponse.ExceptionResult("没有找到对应的订单"));
                }

                new OrderRelationBusiness(para.dapperFactory).UpdateUpOrder(connectorEntity, para.ToDictionary());

                return(ResultResponse.GetSuccessResult(200));
            }
            catch (Exception ex)
            {
                return(ResultResponse.ExceptionResult(ex));
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取上游供应商的首页
        /// </summary>
        /// <param name="para"></param>
        /// <returns></returns>
        public static IResultResponse GetUpDefalutUrl(SysParameter para)
        {
            IResultResponse resultResponse = OpsUtil.VerifyAccessToken(para);

            if (!resultResponse.Success)
            {
                return(resultResponse);
            }

            Sdk.AccessToken accessToken = resultResponse.Content as Sdk.AccessToken;
            try
            {
                ConnectorRelation connectorRelation = new ConnectorBusiness(para.dapperFactory).GetUpConnector(Utils.ToInt(accessToken.Id));
                if (connectorRelation.VirtualDir != null)
                {
                    Dictionary <string, string> dic = new Dictionary <string, string>()
                    {
                        { "method", "linker.login" },
                        { "userId", "0" },
                        { "storeId", connectorRelation.UpBuyerId.ToString() },
                        { "virtualdir", connectorRelation.VirtualDir },
                    };
                    var param = ApiRequest.GetPaySign(dic);
                    return(ResultResponse.GetSuccessResult($"{connectorRelation.Domain}/linker.axd?{param}"));
                }
                return(ResultResponse.ExceptionResult("你没有上游供应商"));
            }
            catch (Exception ex)
            {
                return(ResultResponse.ExceptionResult(ex, 500));
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 授权登录
        /// </summary>
        /// <param name="para"></param>
        /// <returns></returns>
        public static IResultResponse AuthLogin(SysParameter para)
        {
            try
            {
                string token = para.ToValue("exchange_token");
                if (token.IndexOf("%") > -1)
                {
                    token = HttpUtility.UrlDecode(token);
                }
                string sign     = para.ToValue("exhange_sign");
                string sign_new = Encrypt.MD532("rwxkj:" + token);
                if (sign_new != sign)
                {
                    return(ResultResponse.ExceptionResult("参数被篡改"));
                }
                string tokenStr = AES.Decode(token);

                var dic = Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <string, object> >(tokenStr);

                if (dic == null || dic.Count() == 0)
                {
                    return(ResultResponse.ExceptionResult("交换token失败"));
                }
                int             fk_id          = dic.ToInt("fk_id", 0);
                int             db_id          = dic.ToInt("db_id", 0);
                IResultResponse resultResponse = new ConnectorBusiness(para.dapperFactory).ExchangeToken(fk_id, db_id);
                if (resultResponse.Success)
                {
                    return(resultResponse);
                }
                else
                {
                    string domain = dic.ToValue("domain");
                    string msg    = string.Empty;
                    resultResponse = ApiRequest.GetResponse(domain, "account.base.info", new Dictionary <string, string>()
                    {
                        { "exchange_token", HttpUtility.UrlEncode(token) },
                        { "exhange_sign", sign },
                    });
                    if (resultResponse.Success)
                    {
                        Dictionary <string, object> dic_content = resultResponse.Content as Dictionary <string, object>;
                        resultResponse = new ConnectorBusiness(para.dapperFactory).Join(dic_content);
                        if (!resultResponse.Success)
                        {
                            return(resultResponse);
                        }

                        resultResponse = new ConnectorBusiness(para.dapperFactory).ExchangeToken(fk_id, db_id);
                    }
                }
                return(resultResponse);
            }
            catch (Exception ex)
            {
                return(ResultResponse.ExceptionResult(ex, 500));
            }
        }
Ejemplo n.º 5
0
 public static IResultResponse Update(SysParameter para)
 {
     try
     {
         int result = new ConnectorBusiness(para.dapperFactory).Update(para.Properties);
         return(ResultResponse.GetSuccessResult(result));
     }
     catch (Exception ex)
     {
         return(ResultResponse.ExceptionResult(ex, 500));
     }
 }
Ejemplo n.º 6
0
 public static IResultResponse Delete(SysParameter para)
 {
     try
     {
         int id     = para.ToInt("Id");
         int result = new ConnectorBusiness(para.dapperFactory).Delete(id);
         return(ResultResponse.GetSuccessResult(result));
     }
     catch (Exception ex)
     {
         return(ResultResponse.ExceptionResult(ex, 500));
     }
 }
Ejemplo n.º 7
0
 public static IResultResponse DownConnectorStock(SysParameter para)
 {
     try
     {
         PagingQuery  query       = para.ToPagingQuery();
         int          connectorId = para.ToInt("ConnectorId", 0);
         PagingResult result      = new ConnectorBusiness(para.dapperFactory).DownConnectorStock(connectorId, query);
         return(ResultResponse.GetSuccessResult(result));
     }
     catch (Exception ex)
     {
         return(ResultResponse.ExceptionResult(ex, 500));
     }
 }
Ejemplo n.º 8
0
 public static IResultResponse GetList(SysParameter para)
 {
     try
     {
         string          mobile      = para.ToValue("Mobile");
         int             connectorId = para.ToInt("ConnectorId", 0);
         IResultResponse result      = new ConnectorBusiness(para.dapperFactory).search(connectorId, mobile);
         return(result);
     }
     catch (Exception ex)
     {
         return(ResultResponse.ExceptionResult(ex, 500));
     }
 }
Ejemplo n.º 9
0
 public static IResultResponse GetMyList(SysParameter para)
 {
     try
     {
         PagingQuery  query       = para.ToPagingQuery();
         int          connectorId = para.ToInt("ConnectorId");
         int          status      = para.ToInt("Status", 0);
         PagingResult result      = new ConnectorBusiness(para.dapperFactory).GetMyConnectorList(query, connectorId, status);
         return(ResultResponse.GetSuccessResult(result));
     }
     catch (Exception ex)
     {
         return(ResultResponse.ExceptionResult(ex, 500));
     }
 }
Ejemplo n.º 10
0
        /// <summary>
        /// 获得二维码内容
        /// </summary>
        /// <param name="para"></param>
        /// <returns></returns>
        public static IResultResponse GetConnectorByQr(SysParameter para)
        {
            string qr = para.ToValue("qr");
            string s  = ECF.Security.AES.Decode(qr);

            if (string.IsNullOrEmpty(s))
            {
                return(ResultResponse.ExceptionResult("该二维码无效"));
            }
            int connectorId = Utils.ToInt(s);

            Dictionary <string, object> dicInfo = new ConnectorBusiness(para.dapperFactory).GetConnectorById(connectorId);

            if (dicInfo == null || dicInfo.Count == 0)
            {
                return(ResultResponse.ExceptionResult("不存在该连接器对象"));
            }
            return(ResultResponse.GetSuccessResult(dicInfo));
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 获得下游列表
        /// </summary>
        /// <param name="para"></param>
        /// <returns></returns>
        public static IResultResponse GetDownList(SysParameter para)
        {
            IResultResponse resultResponse = OpsUtil.VerifyAccessToken(para);

            if (!resultResponse.Success)
            {
                return(resultResponse);
            }

            Sdk.AccessToken accessToken = resultResponse.Content as Sdk.AccessToken;
            try
            {
                DataTable dt = new ConnectorBusiness(para.dapperFactory).GetDownList(accessToken.Id);
                return(ResultResponse.GetSuccessResult(dt));
            }
            catch (Exception ex)
            {
                return(ResultResponse.ExceptionResult(ex, 500));
            }
        }