Kaynağa Gözat

添加短信黑名单

bianjunhui 2 yıl önce
ebeveyn
işleme
1aec5beae7

+ 13 - 1
application/lib/data/adminAction.php

@@ -204,7 +204,12 @@ class AdvertAdminAction extends BaseAction{
 			$result = $this->getDbEntity()->query($sql);
 			return $result[0];
 		}
-
+        //根据手机号查询客户信息
+        public function selectOneCustomerBymobile($id){
+            $sql    = "select *  from ly_sms_customer  where tel='$id'  ";
+            $result = $this->getDbEntity()->query($sql);
+            return $result[0];
+        }
 		public function selectOneSmsCustomer($id){
 			$sql    = "select *  from ly_sms_customer  where id='$id'  ";
 			$result = $this->getDbEntity()->query($sql);
@@ -248,6 +253,13 @@ class AdvertAdminAction extends BaseAction{
 			$result = $this->getDbEntity()->execute_sql($sql);
 			return $result;
 		}
+        public function updateSmsCustomerBlcak($data){
+            $sql    = "update ly_sms_customer set is_block=1
+                            where id={$data['id']}";
+            $result = $this->getDbEntity()->execute_sql($sql);
+            return $result;
+        }
+
 
 		public function updateSmsCustomer($data,$id){
 			$sql    = "update ly_sms_customer set uname='{$data['uname']}',group_name='{$data['group_name']}',

+ 28 - 0
application/module/ctrl/Sms_customer_list_adminAction.class.php

@@ -199,7 +199,35 @@ class Sms_customer_list_adminAction extends Action{
 		$this->assign('group_list',$group_list);
 		$this->display('add.html');
 	}
+//添加黑名单
+    public function addBlack(){
+        $admin = new AdvertAdminAction();
+        if($_POST['tel']){
+            $info = '添加失败';
+            $uname = $_POST['username'];
+            $tel = $_POST['tel'];
+            $country = $_POST['country'];
+            $group_name ='黑名单';
+            $user = $admin->selectOneCustomerBymobile($tel);//查询手机号是否存在
+           
+            if($user){
+                $add =$admin->updateSmsCustomerBlcak($user);
+            }else{
+                $uid =99;
+                $values = "('{$uname}', '{$country}', '{$tel}', {$uid}, '{$group_name}', 1, 2)";
+                $add =$admin->import_sms_customer($values);
+            }
+            if($add){
+                $info = "添加成功";
+                header("Location:/?a=sms_customer_list_admin&m=blacklist&info=$info");
+                exit();
+            }else{
+                $this->assign('info',$info);
+            }
 
+        }
+        $this->display('addBlack.html');
+    }
 	//编辑客户
 	public function edit(){
 		$admin = new AdvertAdminAction();

+ 75 - 0
application/module/view/sms_customer_list_admin/addBlack.html

@@ -0,0 +1,75 @@
+<{include file='../public/admin_header.html'}>
+<{include file='../public/admin_navi.html'}>
+<!-- Right side column. Contains the navbar and content of the page -->
+<aside class="right-side">
+	<!-- Content Header (Page header) -->
+	<section class="content-header">
+		<h1>
+			添加短信黑名单
+			<small>addBlack</small>
+		</h1>
+		<ol class="breadcrumb">
+			<li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
+			<li class="active">Blank page</li>
+		</ol>
+	</section>
+
+	<!-- Main content -->
+	<div id='main' class="form-actions">
+		<form method="post" action=""  id="addBlack">
+			<table class="table table-bordered" style="margin-top:15px;">
+				<tr>
+
+					<td>客户名</td>
+					<td>
+						<input type="text" name="username" class="form-control" style="width:450px;" value="" />
+					</td>
+
+				</tr>
+				<tr>
+					<td>国家</td>
+					<td>
+						<input type="text" name="country" class="form-control" style="width:450px;" value="" />
+						<span style="color:red;">必填</span>
+					</td>
+				</tr>
+				<tr>
+					<td>手机号码</td>
+					<td>
+						<input type="text" name="tel" id="tel" class="form-control" style="width:450px;" value="" />
+						<span style="color:red;">必填</span>
+					</td>
+				</tr>
+
+				<tr>
+					<td>&nbsp;</td>
+					<td >
+						<input type="button"  onclick="to_submit();" value="提交" class="btn btn-info" style="width:120px;" />
+					</td>
+				</tr>
+
+			</table>
+		</form>
+
+
+	</div>
+</aside><!-- /.right-side -->
+</div><!-- ./wrapper -->
+
+<script>
+	$('#treeview9').addClass('active');
+	$(".user_group_left").addClass('active');
+
+	function to_submit(){
+		var tel = $('#tel').val();
+		var country = $('#country').val();
+		if(tel=='' || country==0){
+			alert("手机号码和国家为必填项");
+		}else{
+			$('#addBlack').submit();
+		}
+	}
+</script>
+
+</body>
+</html>

+ 1 - 1
application/module/view/sms_customer_list_admin/blacklist.html

@@ -45,7 +45,7 @@
 					<input type="file" name="inputExcel" style="width:175px;"><span style="color:red;">(excel是.xls格式的)</span>
 					<input type="submit" class="btn btn-success" value="导入黑名单"   style="cursor:pointer;height: 32px; width: 140px;margin-left:10px;margin-top:20px;" />
 				</form>
-
+				<a href="/?a=sms_customer_list_admin&m=addBlack" style="font-weight:bold;text-decoration:underline;">添加黑名单</a>
 				<form id="batch_delete" method="post" action="/?a=sms_customer_list_admin&m=batch_delete">
 
 					<input class="btn btn-warning" onclick="toSubmit();" value="批量删除" style="margin-bottom:20px;float:right;width:200px;"  />