1、手机银行
2、电脑银行
3、微信
4、支付宝
1、管理员管理
2、生成卡密
3、查询卡密
4、批量封卡
涉及技术:Html+Flex弹性布局+ES6语法+Vue.js+Jquery+.Net MVC框架
环境:Windows2016+IIS管理工具
数据库:实体模型+SqlServer
适应使用:Windows、Linux、MAC
开发耗时:47day
//监听浏览器窗口大小改变
this.$nextTick(() => {
window.addEventListener('resize', (res) => {
//浏览器变化执行动作
let browserProportion = window.devicePixelRatio;
let result = Math.round(browserProportion * 100);
this.browserProportion = result;
alert('为了正常工作使用,请保持浏览器缩放比例为:100%');
});
})
// 拖拽点 - 设置电量
getdianliang() {
let value = document.getElementById('dianliang').value;
this.dianliangbaifenbi = value;
let nums = (15 / 100) * this.dianliangbaifenbi;
this.dianliang = nums;
},
// 获取聊天模式
getliaotianmoshi() {
let value = document.getElementById('liaotianmoshi').value;
if (value == 0) {
this.liaotianmoshi = 0;
this.liaotianbiaoti = '微信对话制作';
}
if (value == 1) {
this.liaotianmoshi = 1;
this.liaotianbiaoti = '群聊标题(12)';
}
},
// 删除html节点 - 聊天内容
deleteNode(index) {
var deleteN = document.getElementById('liaotianneirong');
console.log(deleteN.hasChildNodes());
// 存在节点
if (deleteN.hasChildNodes()) {
deleteN.removeChild(deleteN.childNodes[index]);
this.$delete(this.historyList, index);
}
},
// 打开上传聊天背景图片
upImg() {
document.getElementById('uppic').click();
},
// 上传聊天背景图片
changeImage(e) {
let that = this;
let file = e.target.files[0];
var reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = function (e) {
that.liaotianbeijing = this.result;
}
},
// 删除聊天背景图
deleteliaotianbeijing() {
this.liaotianbeijing = '';
},
// 添加用户
addUser() {
let template = {
touxiang: '../wxduihuakefatu/image/上传头像.png',
yonghuming: '',
liaotianneirong: '欢迎使用微信对话',
hongbaozhufuyu: '恭喜发财,大吉大利',
jine: 0.01,
yuyinshichang: 3,
tupianduihua: ''
};
this.userList.push(template);
},
// 发送文字对话
getText(index, num) {
// 自定义数据结构
let template = {
'userindex': null,// 用户id
'usertouxiang': '',// 用户头像
'useryonghuming': '',// 用户昵称
'value': '',// 值
'gongneng': num,// 功能
'describe': '' // 描述
}
template.userindex = index;
template.usertouxiang = this.userList[index].touxiang;
template.useryonghuming = this.userList[index].yonghuming;
template.value = this.userList[index].liaotianneirong;
template.describe = '您刚刚添加了发送文字对话值为:' + this.userList[index].liaotianneirong;
this.historyList.push(template);
// 字体
let typeface = 'Segoe UI';
// 对话宽度
let widthPixel;
if (template.value.length > 15) {
widthPixel = '180px';
}
// 昵称
let nickName;
if (this.isyonghunicheng == 0) {
nickName = '';
} else {
nickName = template.useryonghuming;
}
if (index == 0) {
$('#liaotianneirong').append(''
+ ''
+ '+ template.usertouxiang + '">'
+ ''
+ ''
+ ''
+ '+ typeface + ';padding: 7px;border-radius: 5px;">'
+ '+
widthPixel + '">' + template.value + ''
+ ''
+ '');
} else {
$('#liaotianneirong').append(''
+ ''
+ '+ template.usertouxiang + '">'
+ ''
+ '+ typeface + ';transform: scale(0.8);margin-top: -3px;margin-left: -110px;">' + nickName + ''
+ ''
+ ''
+ '+ typeface + ';padding: 7px;border-radius: 5px;">'
+ '+
widthPixel + '">' + template.value + ''
+ ''
+ '');
}
console.log(this.historyList);
},
// 发送语音对话
getyuyinshijian(index, num) {
// 自定义数据结构
let template = {
'userindex': index,// 用户id
'usertouxiang': this.userList[index].touxiang,// 用户头像
'useryonghuming': this.userList[index].yonghuming,// 用户昵称
'value': this.userList[index].yuyinshichang,// 值
'gongneng': num,// 功能
'describe': '您刚刚添加了发送语音对话值为:' + this.userList[index].yuyinshichang // 描述
}
this.historyList.push(template);
// 字体
let typeface = 'Segoe UI';
// 昵称
let nickName;
if (this.isyonghunicheng == 0) {
nickName = '';
} else {
nickName = template.useryonghuming;
}
// 对话宽度
let widthPixel;
if (this.userList[index].yuyinshichang > 60) {
alert('语音时长不可超过60s');
} else {
let num = (130 / 60) * this.userList[index].yuyinshichang;
if (this.userList[index].yuyinshichang > 10 && this.userList[index].yuyinshichang > 20) {
widthPixel = parseInt(num) + 'px';
}
if (index == 0) {
$('#liaotianneirong').append(''
+ ''
+ '+ template.usertouxiang + '">'
+ ''
+ ''
+ ''
+ '+ typeface + ';padding: 5px;border-radius: 5px;width: ' + widthPixel + ';">'
+ ''
+ ''
+ ''
+ ''
+ template.value + `''` + ''
+ ''
+ '');
} else {
$('#liaotianneirong').append(''
+ ''
+ '+ template.usertouxiang + '">'
+ ''
+ '+ typeface + ';transform: scale(0.8);margin-top: -5px;margin-left: -110px;">' + nickName + ''
+ ''
+ ''
+ '+ typeface + ';padding: 5px;border-radius: 5px;width: ' + widthPixel + ';">'
+ ''
+ ''
+ ''
+ ''
+ template.value + `''` + ''
+ ''
+ '');
}
}
console.log(this.historyList);
},
// 发送红包
getFaHongBao(index, num) {
// 自定义数据结构
let template = {
'userindex': index,// 用户id
'usertouxiang': this.userList[index].touxiang,// 用户头像
'useryonghuming': this.userList[index].yonghuming,// 用户昵称
'value': this.userList[index].hongbaozhufuyu,// 值
'gongneng': num,// 功能
'describe': '您刚刚添加了发送红包对话值为:' + this.userList[index].hongbaozhufuyu // 描述
}
this.historyList.push(template);
// 昵称
let nickName;
if (this.isyonghunicheng == 0) {
nickName = '';
} else {
nickName = template.useryonghuming;
}
if (index == 0) {
$('#liaotianneirong').append(''
+ ''
+ '+ template.usertouxiang + '">'
+ ''
+ ''
+ ''
+ '+ template.value + ''
+ ''
+ '');
} else {
$('#liaotianneirong').append(''
+ ''
+ '+ template.usertouxiang + '">'
+ ''
+ '' + nickName + ''
+ ''
+ ''
+ '+ template.value + ''
+ ''
+ '');
}
console.log(this.historyList);
},
openFinished() {
this.finishProductModel = true;
document.getElementById('finishProduct').innerHTML = '';
html2canvas(document.querySelector("#capture"), {
scale: 5,
useCORS: true,
}).then(canvas => {
canvas.style.width = `300px`;
canvas.style.height = `610px`;
document.getElementById('finishProduct').appendChild(canvas);
})
}
///
/// 随机生成卡密
///
/// 密码类型
/// 数量
/// 备注
///
public ActionResult suijishengchengkami(int kamileixing,int shuliang,string beizhu)
{
ReturnJson returnJson = new ReturnJson();
try
{
// 是否成功添加入数据库
bool state = false;
// 存储卡密
ArrayList arrayList = new ArrayList();
// 临时存储卡密
StringBuilder stringBuilder = new StringBuilder(62);
// 随机
Random random = new Random();
// 生成数量
for (int i = 1; i <= shuliang; i++)
{
// 制作卡密中
for (int j = 0; j < 32; j++)
{
stringBuilder.Append(constant[random.Next(62)]);
}
// 卡密号已生成
string kamihao = stringBuilder.ToString();
// 是否产生碰撞
var selerepeat = (from tbKaMi in myModels.KaMi
where tbKaMi.kamihao.Trim().Equals(kamihao.Trim())
select tbKaMi).Count();
if (selerepeat > 0)
{
// 清空临时存储卡密
stringBuilder.Length = 0;
// 控制死循环
bool bools = true;
// 进入死循环
while (bools)
{
// 独立制作卡密
for (int j = 0; j < 32; j++)
{
stringBuilder.Append(constant[random.Next(62)]);
}
// 制作完毕
string saixuankamihao = stringBuilder.ToString();
// 是否产生碰撞
var selerepeats = (from tbKaMi in myModels.KaMi
where tbKaMi.kamihao.Trim().Equals(kamihao.Trim())
select tbKaMi).Count();
if (selerepeats > 0)
{
// 继续进入死循环继续制作卡密 - 不发生卡密碰撞
bools = true;
// 清空临时存储卡密
stringBuilder.Length = 0;
}
else
{
// 跳出死循环
bools = false;
// 将卡密追加入数组中
arrayList.Add(stringBuilder.ToString());
//将制作完成的卡密添加入数据库 - 递归
state = tianjiakamijinrushujuku(stringBuilder.ToString(),kamileixing, beizhu);
// 清空临时存储卡密
stringBuilder.Length = 0;
}
}
}
else
{
// 没有产生碰撞 - 正常运行
arrayList.Add(stringBuilder.ToString());
//将制作完成的卡密添加入数据库 - 递归
state = tianjiakamijinrushujuku(stringBuilder.ToString(),kamileixing, beizhu);
// 清空临时存储卡密
stringBuilder.Length = 0;
}
}
if (state)
{
returnJson.State = true;
returnJson.Msg = "生成卡密成功";
returnJson.Object = arrayList;
}
else
{
returnJson.State = false;
returnJson.Msg = "服务器繁忙";
}
}
catch (Exception)
{
returnJson.State = false;
returnJson.Msg = "随机生成卡密抛出异常,请尽快修复";
}
return Json(returnJson,JsonRequestBehavior.AllowGet);
}
///
/// 登录卡密
///
/// 卡密
/// 机器码
/// ip地址
///
public ActionResult denglu(string kami, string jiqima, string IP)
{
returnjson returnJson = new returnjson();
try
{
var count = (from tbKaMi in myModels.KaMi
where tbKaMi.kamihao == kami
select tbKaMi).Count();
if (count > 0)
{
var data = (from tbKaMi in myModels.KaMi
where tbKaMi.kamihao == kami
select tbKaMi).Single();
if (data.caozuozhuangtai != 2)// 判断卡密是否被删除
{
if (data.shifoudaoqi != 1 && data.shifoudaoqi != null)// 判断卡密状态是否过期
{
DateTime NowTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));// 当前时间
DateTime sqldaoqishijian = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));// 初始化,避免出现空数据异常报错
if (data.daoqishijian == null)
{
sqldaoqishijian = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));// 初始化,避免出现空数据异常报错
}
else
{
sqldaoqishijian = Convert.ToDateTime(data.daoqishijian);// 到期时间
}
if (sqldaoqishijian >= NowTime)// 判断卡密时间是否过期
{
if (data.caozuozhuangtai != 1)// 判断卡密是否被停封
{
if (data.shiyongzhuangtai != 1)// 判断是否激活过
{
// 未激活 - 第一次登录
string uuid = "";// 生成guid唯一标识符 / 机器码
bool state = true;// 死循环控制状态
while (state)
{
uuid = Guid.NewGuid().ToString();// 机器码生成了
var repeat = (from tbKaMi in myModels.KaMi
where tbKaMi.jiqima.Trim() == uuid
select tbKaMi).Count();
if (repeat > 0)// 判断是否重复机器码
{
state = true;// 继续循环
}
else
{
state = false;// 停止循环
}
}
data.shiyongzhuangtai = 1;// 激活当前卡密
data.caozuozhuangtai = 0;// 默认解封状态 - 管理员操作
data.yonghucaozuozhuangtai = 0;// 锁定设备 - 用户操作
data.dengluIP = IP;// IP地址
data.jiqima = uuid;// 机器码
data.jihuoshijian = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");// 激活时间
string daoqishijian = "";// 临时到期时间
string str = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");// 基础时间
if (data.leixing == 0)
{
daoqishijian = (Convert.ToDateTime(str).AddMinutes(15)).ToString("yyyy-MM-dd HH:mm:ss").Trim();
}
if (data.leixing == 1)
{
daoqishijian = (Convert.ToDateTime(str).AddHours(1)).ToString("yyyy-MM-dd HH:mm:ss").Trim();
}
if (data.leixing == 2)
{
daoqishijian = (Convert.ToDateTime(str).AddDays(1)).ToString("yyyy-MM-dd HH:mm:ss").Trim();
}
if (data.leixing == 3)
{
daoqishijian = (Convert.ToDateTime(str).AddDays(3)).ToString("yyyy-MM-dd HH:mm:ss").Trim();
}
if (data.leixing == 4)
{
daoqishijian = (Convert.ToDateTime(str).AddDays(7)).ToString("yyyy-MM-dd HH:mm:ss").Trim();
}
if (data.leixing == 5)
{
daoqishijian = (Convert.ToDateTime(str).AddDays(15)).ToString("yyyy-MM-dd HH:mm:ss").Trim();
}
if (data.leixing == 6)
{
daoqishijian = (Convert.ToDateTime(str).AddMonths(1)).ToString("yyyy-MM-dd HH:mm:ss").Trim();
}
if (data.leixing == 7)
{
daoqishijian = (Convert.ToDateTime(str).AddMonths(3)).ToString("yyyy-MM-dd HH:mm:ss").Trim();
}
if (data.leixing == 8)
{
daoqishijian = (Convert.ToDateTime(str).AddYears(1)).ToString("yyyy-MM-dd HH:mm:ss").Trim();
}
if (data.leixing == 9)
{
daoqishijian = (Convert.ToDateTime(str).AddYears(10)).ToString("yyyy-MM-dd HH:mm:ss").Trim();
}
data.daoqishijian = daoqishijian;// 到期时间
data.shifoudaoqi = 0;// 未过期
data.zuihoudenglushijian = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");// 最后登录时间
myModels.Entry(data).State = System.Data.Entity.EntityState.Modified;
if (myModels.SaveChanges() > 0)
{
returnJson.State = true;
returnJson.Msg = "登录成功";
returnJson.key = kami.Trim();
returnJson.value = uuid.Trim();
}
else
{
returnJson.State = false;
returnJson.Msg = "登录失败";
}
}
else
{
if (data.yonghucaozuozhuangtai == 1)// 解卡 - 另一台电脑也可以登录
{
if (data.jiqima == "重置")// 重生脚本
{
string uuid = "";// 生成guid唯一标识符 / 机器码
bool state = true;
while (state)
{
uuid = Guid.NewGuid().ToString();// 生成机器了
var repeat = (from tbKaMi in myModels.KaMi
where tbKaMi.jiqima.Trim() == uuid
select tbKaMi).Count();
if (repeat > 0)
{
state = true;
}
else
{
state = false;
}
}
data.shiyongzhuangtai = 1;// 激活当前卡密
data.caozuozhuangtai = 0;// 默认解封状态 - 管理员操作
data.yonghucaozuozhuangtai = 0;// 锁定设备 - 用户操作
data.dengluIP = IP;// IP地址
data.jiqima = uuid;// 机器码
string str = (Convert.ToDateTime(data.daoqishijian).AddDays(-1)).ToString("yyyy-MM-dd HH:mm:ss").Trim();//减24小时
data.daoqishijian = str;// 到期时间
data.zuihoudenglushijian = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");// 最后登录时间
myModels.Entry(data).State = System.Data.Entity.EntityState.Modified;
if (myModels.SaveChanges() > 0)
{
returnJson.State = true;
returnJson.Msg = "登录成功";
returnJson.key = kami.Trim();
returnJson.value = uuid.Trim();
}
else
{
returnJson.State = false;
returnJson.Msg = "登录失败";
}
}
}
else// 锁卡 - 未解过卡 - 正常登录
{
if (data.jiqima == "重置")// 重生脚本
{
string uuid = "";// 生成guid唯一标识符 / 机器码
bool state = true;
while (state)
{
uuid = Guid.NewGuid().ToString();// 生成机器了
var repeat = (from tbKaMi in myModels.KaMi
where tbKaMi.jiqima.Trim() == uuid
select tbKaMi).Count();
if (repeat > 0)
{
state = true;
}
else
{
state = false;
}
}
data.shiyongzhuangtai = 1;// 激活当前卡密
data.caozuozhuangtai = 0;// 默认解封状态 - 管理员操作
data.yonghucaozuozhuangtai = 0;// 锁定设备 - 用户操作
data.dengluIP = IP;// IP地址
data.jiqima = uuid;// 机器码
string str = (Convert.ToDateTime(data.daoqishijian).AddDays(-1)).ToString("yyyy-MM-dd HH:mm:ss").Trim();//减24小时
data.daoqishijian = str;// 到期时间
data.zuihoudenglushijian = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");// 最后登录时间
myModels.Entry(data).State = System.Data.Entity.EntityState.Modified;
if (myModels.SaveChanges() > 0)
{
returnJson.State = true;
returnJson.Msg = "登录成功";
returnJson.key = kami.Trim();
returnJson.value = uuid.Trim();
}
else
{
returnJson.State = false;
returnJson.Msg = "登录失败";
}
}
else
{
if (jiqima.Trim() != "false")
{
if (data.jiqima.Trim().Equals(jiqima))
{
data.shiyongzhuangtai = 1;// 激活卡密
data.jiqima = jiqima.Trim();// 机器码
data.yonghucaozuozhuangtai = 0;// 锁定设备 - 用户操作
data.caozuozhuangtai = 0;// 默认解封状态 - 管理员操作
data.dengluIP = IP;// IP地址
data.zuihoudenglushijian = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");// 最后登录时间
myModels.Entry(data).State = System.Data.Entity.EntityState.Modified;
if (myModels.SaveChanges() > 0)
{
returnJson.State = true;
returnJson.Msg = "登录成功";
returnJson.key = kami.Trim();
returnJson.value = data.jiqima.Trim();
}
else
{
returnJson.State = false;
returnJson.Msg = "登录失败";
}
}
else
{
returnJson.State = false;
returnJson.Msg = "当前卡密已绑定其他设备,请解锁后再登录";
}
}
else
{
returnJson.State = false;
returnJson.Msg = "你不是卡密使用者本人";
}
}
}
}
}
else
{
returnJson.State = false;
returnJson.Msg = "卡密已被停封";
}
}
else
{
// 将卡密修改为过期状态
data.shifoudaoqi = 1;
myModels.Entry(data).State = System.Data.Entity.EntityState.Modified;
myModels.SaveChanges();
returnJson.State = false;
returnJson.Msg = "卡密已过期";
}
}
else
{
returnJson.State = false;
returnJson.Msg = "卡密已过期";
}
}
else
{
returnJson.State = false;
returnJson.Msg = "卡密已回收";
}
}
else
{
returnJson.State = false;
returnJson.Msg = "卡密不存在";
}
}
catch (Exception)
{
returnJson.State = false;
returnJson.Msg = "登录卡密方法抛出异常,请尽快修复";
}
return Json(returnJson,JsonRequestBehavior.AllowGet);
}
///
/// 解锁电脑设备
///
/// 卡密
/// 机器码
/// ip地址
///
public ActionResult jiesuoVoid(string kami, string jiqima, string IP)
{
returnjson returnJson = new returnjson();
try
{
var count = (from tbKaMi in myModels.KaMi
where tbKaMi.kamihao == kami
select tbKaMi).Count();
if (count > 0)
{
var data = (from tbKaMi in myModels.KaMi
where tbKaMi.kamihao == kami
select tbKaMi).Single();
if (data.caozuozhuangtai != 2)// 判断卡密是否被删除
{
if (data.shifoudaoqi != 1 && data.shifoudaoqi != null)// 判断卡密状态是否过期
{
DateTime NowTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));// 当前时间
DateTime sqldaoqishijian = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));// 初始化,避免出现空数据异常报错
if (data.daoqishijian == null)
{
sqldaoqishijian = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));// 初始化,避免出现空数据异常报错
}
else
{
sqldaoqishijian = Convert.ToDateTime(data.daoqishijian);// 到期时间
}
if (sqldaoqishijian >= NowTime)// 判断卡密时间是否过期
{
if (data.caozuozhuangtai != 1)// 判断卡密是否被停封
{
if (data.shiyongzhuangtai != 1)// 判断是否激活过
{
// 未激活 - 解锁
returnJson.State = false;
returnJson.Msg = "当前卡密未绑定过任何设备,请先登录";
}
else
{
if (data.yonghucaozuozhuangtai == 0)// 目前是锁卡状态
{
if (data.jiqima == "重置")// 重生脚本
{
data.shiyongzhuangtai = 1;// 激活卡密
data.caozuozhuangtai = 0;// 默认解封状态 - 管理员操作
data.yonghucaozuozhuangtai = 1;// 解锁设备 - 用户操作
data.jiqima = "重置";// 机器码
data.dengluIP = IP;// IP地址
myModels.Entry(data).State = System.Data.Entity.EntityState.Modified;
if (myModels.SaveChanges() > 0)
{
returnJson.State = true;
returnJson.Msg = "解锁设备成功";
returnJson.key = kami.Trim();
returnJson.value = null;
}
else
{
returnJson.State = false;
returnJson.Msg = "解锁设备失败";
}
}
else
{
if (jiqima.Trim() != "false")
{
if (data.jiqima.Trim().Equals(jiqima))// 判断是不是本人
{
data.shiyongzhuangtai = 1;// 激活卡密
data.caozuozhuangtai = 0;// 默认解封状态 - 管理员操作
data.yonghucaozuozhuangtai = 1;// 解锁设备 - 用户操作
data.jiqima = "重置";// 机器码
data.dengluIP = IP;// IP地址
myModels.Entry(data).State = System.Data.Entity.EntityState.Modified;
if (myModels.SaveChanges() > 0)
{
returnJson.State = true;
returnJson.Msg = "解锁设备成功";
returnJson.key = kami.Trim();
returnJson.value = null;
}
else
{
returnJson.State = false;
returnJson.Msg = "解锁设备失败";
}
}
else
{
returnJson.State = false;
returnJson.Msg = "当前卡密已绑定其他设备,请解锁后重试";
}
}
else
{
returnJson.State = false;
returnJson.Msg = "你不是卡密使用者本人";
}
}
}
else
{
returnJson.State = false;
returnJson.Msg = "当前卡密已是解锁状态,不用再解锁";
}
}
}
else
{
returnJson.State = false;
returnJson.Msg = "卡密已被停封";
}
}
else
{
// 将卡密修改为过期状态
data.shifoudaoqi = 1;
myModels.Entry(data).State = System.Data.Entity.EntityState.Modified;
myModels.SaveChanges();
returnJson.State = false;
returnJson.Msg = "卡密已过期";
}
}
else
{
returnJson.State = false;
returnJson.Msg = "卡密已过期";
}
}
else
{
returnJson.State = false;
returnJson.Msg = "卡密已回收";
}
}
else
{
returnJson.State = false;
returnJson.Msg = "卡密不存在";
}
}
catch (Exception)
{
returnJson.State = false;
returnJson.Msg = "解锁电脑设备方法抛出异常,请尽快修复";
}
return Json(returnJson, JsonRequestBehavior.AllowGet);
}
///
/// 高危地区
///
/// 国家
/// 身份
/// 市
/// 区
///
public ActionResult gaoweidiqu(string guojia,string shengfen,string shi,string qu)
{
ReturnJson returnJson = new ReturnJson();
try
{
if (guojia != "")
{
string str = guojia.Trim();
bool res = jiancegaoweidiqu(str);
if (res)// 检测到高危地区
{
returnJson.State = true;
return Json(returnJson, JsonRequestBehavior.AllowGet);// 直接返回方法
}
else// 未检测到高危地区
{
returnJson.State = false;
}
}
if (shengfen != "")
{
string str = shengfen.Trim();
bool res = jiancegaoweidiqu(str);
if (res)// 检测到高危地区
{
returnJson.State = true;
return Json(returnJson, JsonRequestBehavior.AllowGet);// 直接返回方法
}
else// 未检测到高危地区
{
returnJson.State = false;
}
}
if (shi != "")
{
string str = shi.Trim();
bool res = jiancegaoweidiqu(str);
if (res)// 检测到高危地区
{
returnJson.State = true;
return Json(returnJson, JsonRequestBehavior.AllowGet);// 直接返回方法
}
else// 未检测到高危地区
{
returnJson.State = false;
}
}
if (qu != "")
{
string str = qu.Trim();
bool res = jiancegaoweidiqu(str);
if (res)// 检测到高危地区
{
returnJson.State = true;
return Json(returnJson, JsonRequestBehavior.AllowGet);// 直接返回方法
}
else// 未检测到高危地区
{
returnJson.State = false;
}
}
}
catch (Exception)
{
// 防止异常发生
}
return Json(returnJson, JsonRequestBehavior.AllowGet);
}
///
/// 检测高危地区
///
/// 参数
/// 0地区开放/1高危地区
public bool jiancegaoweidiqu(string name)
{
bool res = false;
try
{
var count = (from tbRegion in myModels.Region
where tbRegion.Name.Trim().Contains(name.Trim())
select tbRegion).Count();
if (count > 0)
{
var data = (from tbRegion in myModels.Region
where tbRegion.Name.Trim().Contains(name.Trim())
select tbRegion).Single();
if (data.State != 1)
{
res = false;// 目前该地区开放访问
}
else
{
res = true;// 检测到高危地区
}
}
else
{
res = false;// 没有检测到高危地区
}
}
catch (Exception)
{
// 防止异常发生
}
return res;
}