public bool PayIn(string source, string dest, decimal amount, string message) { long timestamp = ((DateTimeOffset)DateTime.UtcNow).ToUnixTimeSeconds(); string hash = Encrypting.HMD5Hash($"{_partnerCode}|{timestamp.ToString()}|{source}|{dest}|{(int)amount}|{message}", _secretKey); _encrypt.SetKey(_setting.BankCode); var obj = new { from_account_number = source, to_account_number = dest, amount = amount, message = message }; var headers = new Dictionary <string, string>() { { "partner_code", _partnerCode }, { "timestamp", timestamp.ToString() }, { "hash", hash }, { "signature", _encrypt.EncryptData(hash, _secretKey) } }; var info = CallAPIHelper.CallAPI <ExternalBankRes <ExternalTransferMoneyResponse> >(string.Concat(_url, "api/transactions/receive_external"), "POST", obj, headers, addQueryParams: true); if (info != null) { return(info.data.is_success); } else { return(false); } }
/// <summary> /// 查询企业单位数据集合 /// </summary> /// <param name="searchEntity">企业单位查询条件对象</param> /// <returns></returns> public CompanyList GetCompanyList(ParamsCompanySearch searchEntity) { Dictionary <string, string> paramsList = new Dictionary <string, string>() { { "page", searchEntity.PageIndex.ToString() }, { "rows", searchEntity.PageSize.ToString() }, { "unitId", searchEntity.UnitId }, { "unitName", searchEntity.UnitName }, { "linkman", searchEntity.linkman } }; CompanyList result = CallAPIHelper.CallAPIInPOST <CompanyList>(APIAddressSetting.API_POST_GETUnitList, paramsList); if (result != null && result.rows != null) { result.rows.ToList().ForEach(d => { d.setDate = DateTimeHelper.ConvertIntToDateTimeString(d.setDate); if (!string.IsNullOrEmpty(d.notused)) { d.State = d.notused == "0" ? "已停用" : "已启用"; } }); } return(result); }
public ExternalInfoUserResponse GetInfoUser(string accountNumber) { long timestamp = ((DateTimeOffset)DateTime.UtcNow).ToUnixTimeSeconds(); string hash = Encrypting.HMD5Hash($"{_partnerCode}|{timestamp.ToString()}|{accountNumber}", _secretKey); var headers = new Dictionary <string, string>() { { "partner_code", _partnerCode }, { "timestamp", timestamp.ToString() }, { "hash", hash } }; var obj = new { account_number = accountNumber, }; var info = CallAPIHelper.CallAPI <ExternalBankRes <ExternalInfoUserResponse> >(string.Concat(_url, "api/transactions/query_info"), "POST", obj, headers, addQueryParams: true); if (info != null) { return(info.data); } else { return(null); } }
/// <summary> /// 删除企业单位记录 /// </summary> /// <param name="id">企业单位主键ID</param> /// <returns></returns> public ResultEntity DeleteCompany(string id) { Dictionary <string, string> paramsList = new Dictionary <string, string>() { { "id", id } }; ResultEntity entity = CallAPIHelper.CallAPIInPOST <ResultEntity>(APIAddressSetting.API_POST_DELETEUnit, paramsList); return(entity); }
/// <summary> /// 删除单位站点同步记录 /// </summary> /// <param name="id">单位站点同步记录的主键ID</param> /// <returns></returns> public DeleteResultEntity DeleteStationSync(string id) { Dictionary <string, string> paramsList = new Dictionary <string, string>() { { "id", id } }; DeleteResultEntity result = CallAPIHelper.CallAPIInPOST <DeleteResultEntity>(APIAddressSetting.API_POST_DELETEUnitSync, paramsList); return(result); }
/// <summary> /// 查询站点数据集合 /// </summary> /// <param name="searchEntity"></param> /// <returns></returns> public StationList GetStationList(ParamsStationSearch searchEntity) { Dictionary <string, string> paramsList = new Dictionary <string, string> { { "body", searchEntity.body }, { "siteName", searchEntity.siteName } }; StationList result = CallAPIHelper.CallAPIInPOST <StationList>(APIAddressSetting.API_POST_GETSiteList, paramsList); return(result); }
/// <summary> /// 修改已配置的单位站点同步的状态; 0:暂停,1:启用 /// </summary> /// <param name="id"></param> /// <param name="state"></param> /// <returns></returns> public ResultEntity SetStationSyncState(string id, string state) { Dictionary <string, string> paramsList = new Dictionary <string, string>() { { "id", id }, { "enable", state } }; ResultEntity result = CallAPIHelper.CallAPIInPOST <ResultEntity>(APIAddressSetting.API_POST_SETUnitSyncState, paramsList); return(result); }
/// <summary> /// 获取企业单位详情 /// </summary> /// <param name="id"></param> /// <returns></returns> public CompanyDetails GetCompanyDetails(string id) { Dictionary <string, string> paramsList = new Dictionary <string, string>() { { "id", id } }; CompanyDetails result = CallAPIHelper.CallAPIInPOST <CompanyDetails>(APIAddressSetting.API_POST_GETUnit, paramsList); if (result != null) { result.setDate = DateTimeHelper.ConvertIntToDateTimeString(result.setDate); } return(result); }
/// <summary> /// 获取登陆用户的已授权系统板块集合 /// </summary> /// <param name="userName"></param> /// <returns></returns> public Menu[] GetUserSystemMenu(string userName) { Menu[] result = SessionHelper.GetSession <Menu[]>(SessionKeys.LoginUserMenu); if (result == null) { Dictionary <string, string> dicList = new Dictionary <string, string>() { { "loginName", userName } }; result = CallAPIHelper.CallAPIInPOST <Menu[]>(APIAddressSetting.API_POST_GETSysPowerByLoginName, dicList); if (result != null) { SessionHelper.SetSession(SessionKeys.LoginUserMenu, result); } } return(result); }
/// <summary> /// 登录 /// </summary> /// <param name="userName">用户名</param> /// <param name="password">密码</param> /// <returns></returns> public LoginUserInfo Login(string userName, string password) { Dictionary <string, string> dictList = new Dictionary <string, string> { { "userName", userName }, { "password", password } }; //TODO: //这里需要等待接口方修改接口返回数据,然后本地修改LoginUserInfo以映射接口返回值 LoginUserInfo loginUser = CallAPIHelper.CallAPIInPOST <LoginUserInfo>(APIAddressSetting.API_POST_Login, dictList); if (loginUser != null && loginUser.result == 1 && loginUser.user != null) { //登录成功,高速缓存用户信息到服务器中 SessionHelper.SetSession(SessionKeys.LoginUserSessionKey, loginUser); } return(loginUser); }
/// <summary> /// 获取已分配到单位的站点数据集合 /// </summary> /// <param name="searchEntity"></param> /// <returns></returns> public SyncStationList GetSyncStationList(ParamsSyncStationSearch searchEntity) { Dictionary <string, string> paramsList = new Dictionary <string, string>() { { "page", searchEntity.page.ToString() }, { "rows", searchEntity.rows.ToString() }, { "unitId", searchEntity.unitId.ToString() } }; SyncStationList result = CallAPIHelper.CallAPIInPOST <SyncStationList>(APIAddressSetting.API_POST_GETUnitSyncList, paramsList); if (result != null && result.rows != null) { result.rows.ToList().ForEach(d => { d.operationDate = DateTimeHelper.ConvertIntToDateTimeString(d.operationDate); }); } return(result); }
/// <summary> /// 创建新企业单位 /// </summary> /// <param name="entity">接口参数实体对象</param> /// <returns></returns> public ResultAddCompany AddCompany(CompanyAdd entity) { ResultAddCompany result = CallAPIHelper.CallAPIInPOST <ResultAddCompany>(APIAddressSetting.API_POST_ADDUnit, entity); return(result); }
/// <summary> /// 添加一条单位同步站点的数据 /// </summary> /// <param name="entity"></param> /// <returns></returns> public AddResultEntity AddStationSync(SyncStationAdd entity) { AddResultEntity result = CallAPIHelper.CallAPIInPOST <AddResultEntity>(APIAddressSetting.API_POST_ADDUnitSync, entity); return(result); }
/// <summary> /// 修改企业单位记录数据 /// </summary> /// <param name="entity">接口参数实体对象</param> /// <returns></returns> public ResultEntity UpdateCompany(CompanyEdit entity) { ResultEntity result = CallAPIHelper.CallAPIInPOST <ResultEntity>(APIAddressSetting.API_POST_UPDATEUnit, entity); return(result); }
/// <summary> /// 获取企业等级类型集合 /// </summary> /// <returns></returns> public CompanyGradeItem[] GetCompanyGradeList() { var result = CallAPIHelper.CallAPIInGET <CompanyGradeItem[]>(APIAddressSetting.API_GET_CompanyGrade); return(result); }