Beispiel #1
0
    public ResultAli Result_Ali(string JSon, string version)
    {
        string disID  = string.Empty;
        string UserID = string.Empty;

        Hi.BLL.BD_Distributor bll_dis  = new Hi.BLL.BD_Distributor();
        Hi.BLL.BD_Company     bll_comp = new Hi.BLL.BD_Company();
        ResultAli             result   = new ResultAli();
        string partner     = string.Empty;
        string seller      = string.Empty;
        string private_key = string.Empty;

        try
        {
            #region//JSon取值
            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["UserID"].ToString().Trim() != "" && JInfo["ResellerID"].ToString().Trim() != "")
            {
                disID = JInfo["ResellerID"].ToString();

                UserID = JInfo["UserID"].ToString();
            }
            else
            {
                return(new ResultAli()
                {
                    Result = "F", Description = "参数异常"
                });
            }

            #endregion
            //判断登录信息是否正确
            Hi.Model.SYS_Users user = new Hi.Model.SYS_Users();
            if (!new Common().IsLegitUser(int.Parse(UserID), out user, 0, int.Parse(disID == "" ? "0" : disID)))
            {
                return new ResultAli()
                       {
                           Result = "F", Description = "用户异常"
                       }
            }
            ;
            //判断经销商信息是否异常
            Hi.Model.BD_Distributor dis = bll_dis.GetModel(Convert.ToInt32(disID));
            if (dis == null || dis.dr == 1 || dis.AuditState == 0 || dis.IsEnabled == 0)
            {
                return new ResultAli()
                       {
                           Result = "F", Description = "经销商异常"
                       }
            }
            ;
            //判断经销商对应的核心企业是否异常
            Hi.Model.BD_Company comp = bll_comp.GetModel(dis.CompID);
            if (comp == null || comp.dr == 1 || comp.AuditState == 0 || comp.IsEnabled == 0)
            {
                return new ResultAli()
                       {
                           Result = "F", Description = "核心企业异常"
                       }
            }
            ;
            //获取Pay_PayWxandAli表的实体
            Hi.Model.Pay_PayWxandAli payali = Common.GetPayWxandAli(comp.ID);
            if (payali == null || ClsSystem.gnvl(payali.ali_isno, "0") == "0")
            {
                return new ResultAli()
                       {
                           Result = "F", Description = "核心企业无可用的支付宝收款账户"
                       }
            }
            ;
            #region //返回参数

            result.Result      = "T";
            result.Description = "返回成功";
            //对数据库中数据进行解密
            partner     = Common.DesDecrypt(payali.ali_partner, Common.EncryptKey);
            seller      = Common.DesDecrypt(payali.ali_seller_email, Common.EncryptKey);
            private_key = Common.DesDecrypt(payali.ali_key, Common.EncryptKey);
            //对解密过的数据,再用我们的加密方法进行加密
            partner     = AESHelper.Encrpt_string(partner);
            seller      = AESHelper.Encrpt_string(seller);
            private_key = AESHelper.Encrpt_string(private_key);
            //将我们这边加密完的数据,赋值给返回实体
            result.PARTNER     = partner;
            result.SELLER      = seller;
            result.RSA_PRIVATE = private_key;
            #endregion
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "Result_Ali:" + JSon);
            return(new ResultAli()
            {
                Result = "F", Description = "参数异常"
            });
        }
        return(result);
    }
Beispiel #2
0
    public ResultWX Result_WX(string JSon, string version)
    {
        string disID  = string.Empty;
        string UserID = string.Empty;

        Hi.BLL.BD_Distributor bll_dis  = new Hi.BLL.BD_Distributor();
        Hi.BLL.BD_Company     bll_comp = new Hi.BLL.BD_Company();
        ResultWX result = new ResultWX();
        string   appid  = string.Empty;
        string   mchid  = string.Empty;
        string   key    = string.Empty;

        try
        {
            #region//JSon取值
            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["UserID"].ToString().Trim() != "" && JInfo["ResellerID"].ToString().Trim() != "")
            {
                disID  = JInfo["ResellerID"].ToString();
                UserID = JInfo["UserID"].ToString();
            }
            else
            {
                return(new ResultWX()
                {
                    Result = "F", Description = "参数异常"
                });
            }

            #endregion
            //判断登录信息是否正确
            Hi.Model.SYS_Users user = new Hi.Model.SYS_Users();
            if (!new Common().IsLegitUser(int.Parse(UserID), out user, 0, int.Parse(disID == "" ? "0" : disID)))
            {
                return new ResultWX()
                       {
                           Result = "F", Description = "用户异常"
                       }
            }
            ;
            //判断经销商信息是否异常
            Hi.Model.BD_Distributor dis = bll_dis.GetModel(Convert.ToInt32(disID));
            if (dis == null || dis.dr == 1 || dis.AuditState == 0 || dis.IsEnabled == 0)
            {
                return new ResultWX()
                       {
                           Result = "F", Description = "经销商异常"
                       }
            }
            ;
            //判断经销商对应的核心企业是否异常
            Hi.Model.BD_Company comp = bll_comp.GetModel(dis.CompID);
            if (comp == null || comp.dr == 1 || comp.AuditState == 0 || comp.IsEnabled == 0)
            {
                return new ResultWX()
                       {
                           Result = "F", Description = "核心企业异常"
                       }
            }
            ;
            //获取Pay_PayWxandAli表的实体
            Hi.Model.Pay_PayWxandAli paywx = Common.GetPayWxandAli(comp.ID);
            if (paywx == null || ClsSystem.gnvl(paywx.wx_Isno, "0") == "0")
            {
                return new ResultWX()
                       {
                           Result = "F", Description = "核心企业无可用的微信收款账户"
                       }
            }
            ;
            #region //返回参数
            result.Result      = "T";
            result.Description = "返回成功";
            //对数据库中取出的值进行解密
            appid = Common.DesDecrypt(paywx.wx_appid, Common.EncryptKey);
            mchid = Common.DesDecrypt(paywx.wx_mchid, Common.EncryptKey);
            key   = Common.DesDecrypt(paywx.wx_key, Common.EncryptKey);
            //对解密过的字段,用我们这边的方法重新加密
            appid = AESHelper.Encrpt_string(appid);
            mchid = AESHelper.Encrpt_string(mchid);
            key   = AESHelper.Encrpt_string(key);
            //将加密完的值赋给返回实体
            result.AppID = appid;
            result.Mchid = mchid;
            //result.AppSecret = paywx.wx_appsechet;
            result.APPkey = key;

            #endregion
            //return result;
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "Result_WX:" + JSon);
            return(new ResultWX()
            {
                Result = "F", Description = "参数异常"
            });
        }
        return(result);
    }
Beispiel #3
0
 public string Maker_string(string key)
 {
     return(AESHelper.Encrpt_string(key));
 }