using System; using System.Collections.Generic; using System.Linq; using System.Web; using HZQR.Common; namespace OpenApi.Method { public class Common { /// /// 判断是否是偶数 /// /// /// public static bool IsOdd(int n) { return Convert.ToBoolean(n % 2 == 0); } /// /// 返回json数据结果对象 /// /// /// /// /// public static object ReturnJson(int code, string msg, object data = null) { Models.Result result = new Models.Result(); result.Result_Data = data; result.Result_Code = code; result.Result_Desc = msg; return result; } /// /// 验证授权码数据 /// /// 授权码 /// public static bool VerifyCode(string code) { bool flag = false; try { if (!string.IsNullOrWhiteSpace(code)) { switch (code.ToDecrypt()) { case "14602": return true; } } } catch (Exception ex) { LogUtil.WriteLog(ex); } return flag; } /// /// 验证授权码数据 /// /// /// 接口请求入参 /// public static bool VerifyCode(Models.ParamsModel paramsModel) { bool flag = false; try { if (paramsModel != null && !string.IsNullOrWhiteSpace(paramsModel.code)) { return VerifyCode(paramsModel.code); } } catch (Exception ex) { LogUtil.WriteLog(ex); } return flag; } } }