Commit 6da0fee7 authored by wangjiangze's avatar wangjiangze

上下线处理

parent 0e278b86
...@@ -99,7 +99,11 @@ class FrontAction extends CommonAction{ ...@@ -99,7 +99,11 @@ class FrontAction extends CommonAction{
//删除处理 //删除处理
public function deleteHandle(){ public function deleteHandle(){
if(D("Front")->where("id=".I("id","",int))->delete()){ $model = D("Front");
$data['id'] = I("id","",int);
$data['status'] = 2;
$data['updatetime'] = date('Y-m-d H:i:s');
if($model->save($data)){
echo 'true'; echo 'true';
}else{ }else{
echo 'false'; echo 'false';
......
...@@ -79,19 +79,25 @@ class HotelAction extends CommonAction{ ...@@ -79,19 +79,25 @@ class HotelAction extends CommonAction{
//删除处理 //删除处理
public function deleteHandle(){ public function deleteHandle(){
if(D("HotelMediaMap")->where("id=".I("id","",int))->delete()){ $model = D("HotelMediaMap");
echo 'true'; $data['id'] = I("id","",int);
}else{ $data['status'] = 0;
echo 'false'; $data['updatetime'] = date('Y-m-d H:i:s');
} if($model->save($data)){
echo 'true';
}else{
echo 'false';
}
} }
//ajax修改状态 //ajax修改状态
public function updateStatusAjaxHandle(){ public function updateStatusAjaxHandle(){
$model = D("HotelMediaMap"); $model = D("HotelMediaMap");
$data = $_POST; $data = $_POST;
$searchSp = $data['searchSp'];
unset($data['searchSp']);
$data['updatetime'] = date('Y-m-d H:i:s'); $data['updatetime'] = date('Y-m-d H:i:s');
if($model->save($data)){ if($model->table("sh_hotel_media_map_$searchSp")->save($data)){
echo 'true'; echo 'true';
}else{ }else{
echo 'false'; echo 'false';
......
...@@ -29,7 +29,7 @@ class FrontModel extends RelationModel{ ...@@ -29,7 +29,7 @@ class FrontModel extends RelationModel{
//返回列表(limit分页) //返回列表(limit分页)
if($queryType=="list"){ if($queryType=="list"){
$where .= $sort." ".$limit; $where .= $sort." ".$limit;
$fields = " A.*,B.`name` hotel_name,case A.`status` when 1 then '<font color=red>禁用</font>' when 0 then '<font color=green>启用</font>' end as `status` "; $fields = " A.*,B.`name` hotel_name,case A.`status` when 2 then '<font color=red>删除</font>' when 1 then '<font color=red>禁用</font>' when 0 then '<font color=green>启用</font>' end as `status` ";
} }
$sql = "select ".$fields." from sh_hotel_device A join sh_hotel B on A.hotel_id = B.id where 1=1 ".$where.";"; $sql = "select ".$fields." from sh_hotel_device A join sh_hotel B on A.hotel_id = B.id where 1=1 ".$where.";";
return $model->query($sql); return $model->query($sql);
......
...@@ -32,7 +32,7 @@ class HotelMediaMapModel extends RelationModel{ ...@@ -32,7 +32,7 @@ class HotelMediaMapModel extends RelationModel{
//返回列表(limit分页) //返回列表(limit分页)
if($queryType=="list"){ if($queryType=="list"){
$where .= $sort." ".$limit; $where .= $sort." ".$limit;
$fields = " A.*,B.title media_name,C.`name` hotel_name,case A.`status` when 1 then '<font color=green>上线</font>' when 2 then '<font color=red>下线</font>' when 0 then '<font>删除</font>' end as `status` "; $fields = " A.*,B.title media_name,C.`name` hotel_name,case A.`status` when 1 then '<font color=green>上线</font>' when 2 then '<font color=red>下线</font>' when 0 then '<font color=red>删除</font>' end as `status` ";
} }
$sql = "select ".$fields." from ".$this->tableName." A join sh_media_wasu B on A.media_id = B.id join sh_hotel C on A.hotel_id = C.id and C.sp_id = $searchSp where 1=1 ".$where.";"; $sql = "select ".$fields." from ".$this->tableName." A join sh_media_wasu B on A.media_id = B.id join sh_hotel C on A.hotel_id = C.id and C.sp_id = $searchSp where 1=1 ".$where.";";
// echo $sql; // echo $sql;
......
...@@ -84,17 +84,17 @@ onRowContextMenu : onRowContextMenu ...@@ -84,17 +84,17 @@ onRowContextMenu : onRowContextMenu
<div id="mm1" class="easyui-menu" style="width:120px;display: none"> <div id="mm1" class="easyui-menu" style="width:120px;display: none">
<!-- <div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('Media','Hotel','add')}>编辑</div>--> <!-- <div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('Media','Hotel','add')}>编辑</div>-->
<div iconCls="icon-cancel" id="menuDel" onclick="del()" {:buttonAuth('Media','Hotel','deletehandle')}>删除</div> <div iconCls="icon-cancel" id="menuDel" onclick="enable(0)" {:buttonAuth('Media','Hotel','deletehandle')}>删除</div>
<!-- <div class="menu-sep"></div> <div class="menu-sep"></div>
<div iconCls="icon-stop" id="menuStop" onclick="enable(1)" {:buttonAuth('Media','Hotel','updateStatusAjaxHandle')}>禁用</div> <div iconCls="icon-start" id="menuStop" onclick="enable(1)" {:buttonAuth('Media','Hotel','updateStatusAjaxHandle')}>上线</div>
<div iconCls="icon-start" id="menuStart" onclick="enable(0)" {:buttonAuth('Media','Hotel','updateStatusAjaxHandle')}>启用</div>--> <div iconCls="icon-stop" id="menuStart" onclick="enable(2)" {:buttonAuth('Media','Hotel','updateStatusAjaxHandle')}>下线</div>
</div> </div>
<div id="mm2" class="easyui-menu" style="width:120px;display: none"> <div id="mm2" class="easyui-menu" style="width:120px;display: none">
<!-- <div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('Media','Hotel','add')}>编辑</div>--> <!-- <div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('Media','Hotel','add')}>编辑</div>-->
<div iconCls="icon-cancel" id="menuDel" onclick="del()" {:buttonAuth('Media','Hotel','deletehandle')}>删除</div> <div iconCls="icon-cancel" id="menuDel" onclick="enable(0)" {:buttonAuth('Media','Hotel','deletehandle')}>删除</div>
<!-- <div class="menu-sep"></div> <div class="menu-sep"></div>
<div iconCls="icon-stop" id="menuStop" onclick="enable(1)" {:buttonAuth('Media','Hotel','updateStatusAjaxHandle')}>禁用</div> <div iconCls="icon-start" id="menuStop" onclick="enable(1)" {:buttonAuth('Media','Hotel','updateStatusAjaxHandle')}>上线</div>
<div iconCls="icon-start" id="menuStart" onclick="enable(0)" {:buttonAuth('Media','Hotel','updateStatusAjaxHandle')}>启用</div>--> <div iconCls="icon-stop" id="menuStart" onclick="enable(2)" {:buttonAuth('Media','Hotel','updateStatusAjaxHandle')}>下线</div>
</div> </div>
<script> <script>
$().ready(function(){ $().ready(function(){
...@@ -157,13 +157,16 @@ $(function(){ ...@@ -157,13 +157,16 @@ $(function(){
//禁用启用 //禁用启用
function enable(status){ function enable(status){
var row = $('#dg').datagrid('getSelected'); var row = $('#dg').datagrid('getSelected');
var searchSp = $("select[name='searchSp']").val();
if (row){ if (row){
var msg='启用'; var msg='上线';
if(status==1) if(status==1)
msg='禁用' msg='下线'
else if(status==0)
msg='删除'
$.messager.confirm('操作确认', '确认['+msg+']该记录?', function(r){ $.messager.confirm('操作确认', '确认['+msg+']该记录?', function(r){
if (r){ if (r){
$.post("/Media/Hotel/updateStatusAjaxHandle/", {id:row.id,status:status}, $.post("/Media/Hotel/updateStatusAjaxHandle/", {id:row.id,status:status,searchSp:searchSp},
function(data){ function(data){
$('#dg').datagrid('reload'); $('#dg').datagrid('reload');
}); });
......
...@@ -81,8 +81,8 @@ onRowContextMenu : onRowContextMenu ...@@ -81,8 +81,8 @@ onRowContextMenu : onRowContextMenu
<div class="menu-sep"></div> <div class="menu-sep"></div>
<div iconCls="icon-stop" id="menuStop" onclick="enable(1)" {:buttonAuth('Media','Playlist','updateStatusAjaxHandle')}>禁用</div> <div iconCls="icon-stop" id="menuStop" onclick="enable(1)" {:buttonAuth('Media','Playlist','updateStatusAjaxHandle')}>禁用</div>
<div iconCls="icon-start" id="menuStart" onclick="enable(0)" {:buttonAuth('Media','Playlist','updateStatusAjaxHandle')}>启用</div> <div iconCls="icon-start" id="menuStart" onclick="enable(0)" {:buttonAuth('Media','Playlist','updateStatusAjaxHandle')}>启用</div>
<div class="menu-sep"></div> <!-- <div class="menu-sep"></div>
<div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('Media','Playlist','add')}>列表</div> <div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('Media','Playlist','add')}>列表</div>-->
</div> </div>
<div id="mm2" class="easyui-menu" style="width:120px;display: none"> <div id="mm2" class="easyui-menu" style="width:120px;display: none">
<div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('Media','Playlist','add')}>编辑</div> <div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('Media','Playlist','add')}>编辑</div>
...@@ -90,8 +90,8 @@ onRowContextMenu : onRowContextMenu ...@@ -90,8 +90,8 @@ onRowContextMenu : onRowContextMenu
<div class="menu-sep"></div> <div class="menu-sep"></div>
<div iconCls="icon-stop" id="menuStop" onclick="enable(1)" {:buttonAuth('Media','Playlist','updateStatusAjaxHandle')}>禁用</div> <div iconCls="icon-stop" id="menuStop" onclick="enable(1)" {:buttonAuth('Media','Playlist','updateStatusAjaxHandle')}>禁用</div>
<div iconCls="icon-start" id="menuStart" onclick="enable(0)" {:buttonAuth('Media','Playlist','updateStatusAjaxHandle')}>启用</div> <div iconCls="icon-start" id="menuStart" onclick="enable(0)" {:buttonAuth('Media','Playlist','updateStatusAjaxHandle')}>启用</div>
<div class="menu-sep"></div> <!-- <div class="menu-sep"></div>
<div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('Media','Playlist','add')}>列表</div> <div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('Media','Playlist','add')}>列表</div>-->
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
......
...@@ -71,20 +71,20 @@ onRowContextMenu : onRowContextMenu ...@@ -71,20 +71,20 @@ onRowContextMenu : onRowContextMenu
<div id="mm1" class="easyui-menu" style="width:120px;display: none"> <div id="mm1" class="easyui-menu" style="width:120px;display: none">
<div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('PlayCtrl','PlayCtrl','add')}>编辑</div> <div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('PlayCtrl','PlayCtrl','add')}>编辑</div>
<div iconCls="icon-cancel" id="menuDel" onclick="del()" {:buttonAuth('PlayCtrl','PlayCtrl','deletehandle')}>删除</div> <div iconCls="icon-cancel" id="menuDel" onclick="del()" {:buttonAuth('PlayCtrl','PlayCtrl','deletehandle')}>删除</div>
<div class="menu-sep"></div>
<div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('PlayCtrl','PlayCtrl','add')}>列表</div>
<!-- <div class="menu-sep"></div> <!-- <div class="menu-sep"></div>
<div iconCls="icon-stop" id="menuStop" onclick="enable(1)" {:buttonAuth('PlayCtrl','PlayCtrl','updateStatusAjaxHandle')}>禁用</div> <div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('PlayCtrl','PlayCtrl','add')}>列表</div>-->
<div iconCls="icon-start" id="menuStart" onclick="enable(0)" {:buttonAuth('PlayCtrl','PlayCtrl','updateStatusAjaxHandle')}>启用</div>--> <div class="menu-sep"></div>
<div iconCls="icon-start" id="menuStop" onclick="enable(1)" {:buttonAuth('PlayCtrl','PlayCtrl','updateStatusAjaxHandle')}>上线</div>
<div iconCls="icon-stop" id="menuStart" onclick="enable(2)" {:buttonAuth('PlayCtrl','PlayCtrl','updateStatusAjaxHandle')}>下线</div>
</div> </div>
<div id="mm2" class="easyui-menu" style="width:120px;display: none"> <div id="mm2" class="easyui-menu" style="width:120px;display: none">
<div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('PlayCtrl','PlayCtrl','add')}>编辑</div> <div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('PlayCtrl','PlayCtrl','add')}>编辑</div>
<div iconCls="icon-cancel" id="menuDel" onclick="del()" {:buttonAuth('PlayCtrl','PlayCtrl','deletehandle')}>删除</div> <div iconCls="icon-cancel" id="menuDel" onclick="del()" {:buttonAuth('PlayCtrl','PlayCtrl','deletehandle')}>删除</div>
<div class="menu-sep"></div>
<div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('PlayCtrl','PlayCtrl','add')}>列表</div>
<!-- <div class="menu-sep"></div> <!-- <div class="menu-sep"></div>
<div iconCls="icon-stop" id="menuStop" onclick="enable(1)" {:buttonAuth('PlayCtrl','PlayCtrl','updateStatusAjaxHandle')}>禁用</div> <div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('PlayCtrl','PlayCtrl','add')}>列表</div>-->
<div iconCls="icon-start" id="menuStart" onclick="enable(0)" {:buttonAuth('PlayCtrl','PlayCtrl','updateStatusAjaxHandle')}>启用</div>--> <div class="menu-sep"></div>
<div iconCls="icon-start" id="menuStop" onclick="enable(1)" {:buttonAuth('PlayCtrl','PlayCtrl','updateStatusAjaxHandle')}>上线</div>
<div iconCls="icon-stop" id="menuStart" onclick="enable(2)" {:buttonAuth('PlayCtrl','PlayCtrl','updateStatusAjaxHandle')}>下线</div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
...@@ -125,9 +125,9 @@ $(function(){ ...@@ -125,9 +125,9 @@ $(function(){
function enable(status){ function enable(status){
var row = $('#dg').datagrid('getSelected'); var row = $('#dg').datagrid('getSelected');
if (row){ if (row){
var msg='启用'; var msg='上线';
if(status==1) if(status==2)
msg='禁用' msg='下线'
$.messager.confirm('操作确认', '确认['+msg+']该记录?', function(r){ $.messager.confirm('操作确认', '确认['+msg+']该记录?', function(r){
if (r){ if (r){
$.post("/PlayCtrl/PlayCtrl/updateStatusAjaxHandle/", {id:row.id,status:status}, $.post("/PlayCtrl/PlayCtrl/updateStatusAjaxHandle/", {id:row.id,status:status},
......
...@@ -71,20 +71,20 @@ onRowContextMenu : onRowContextMenu ...@@ -71,20 +71,20 @@ onRowContextMenu : onRowContextMenu
<div id="mm1" class="easyui-menu" style="width:120px;display: none"> <div id="mm1" class="easyui-menu" style="width:120px;display: none">
<div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('PlayCtrl','PlayCtrl','add')}>编辑</div> <div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('PlayCtrl','PlayCtrl','add')}>编辑</div>
<div iconCls="icon-cancel" id="menuDel" onclick="del()" {:buttonAuth('PlayCtrl','PlayCtrl','deletehandle')}>删除</div> <div iconCls="icon-cancel" id="menuDel" onclick="del()" {:buttonAuth('PlayCtrl','PlayCtrl','deletehandle')}>删除</div>
<div class="menu-sep"></div>
<div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('PlayCtrl','PlayCtrl','add')}>列表</div>
<!-- <div class="menu-sep"></div> <!-- <div class="menu-sep"></div>
<div iconCls="icon-stop" id="menuStop" onclick="enable(1)" {:buttonAuth('PlayCtrl','PlayCtrl','updateStatusAjaxHandle')}>禁用</div> <div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('PlayCtrl','PlayCtrl','add')}>列表</div>-->
<div iconCls="icon-start" id="menuStart" onclick="enable(0)" {:buttonAuth('PlayCtrl','PlayCtrl','updateStatusAjaxHandle')}>启用</div>--> <div class="menu-sep"></div>
<div iconCls="icon-start" id="menuStop" onclick="enable(1)" {:buttonAuth('PlayCtrl','PlayCtrl','updateStatusAjaxHandle')}>上线</div>
<div iconCls="icon-stop" id="menuStart" onclick="enable(2)" {:buttonAuth('PlayCtrl','PlayCtrl','updateStatusAjaxHandle')}>下线</div>
</div> </div>
<div id="mm2" class="easyui-menu" style="width:120px;display: none"> <div id="mm2" class="easyui-menu" style="width:120px;display: none">
<div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('PlayCtrl','PlayCtrl','add')}>编辑</div> <div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('PlayCtrl','PlayCtrl','add')}>编辑</div>
<div iconCls="icon-cancel" id="menuDel" onclick="del()" {:buttonAuth('PlayCtrl','PlayCtrl','deletehandle')}>删除</div> <div iconCls="icon-cancel" id="menuDel" onclick="del()" {:buttonAuth('PlayCtrl','PlayCtrl','deletehandle')}>删除</div>
<div class="menu-sep"></div>
<div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('PlayCtrl','PlayCtrl','add')}>列表</div>
<!-- <div class="menu-sep"></div> <!-- <div class="menu-sep"></div>
<div iconCls="icon-stop" id="menuStop" onclick="enable(1)" {:buttonAuth('PlayCtrl','PlayCtrl','updateStatusAjaxHandle')}>禁用</div> <div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('PlayCtrl','PlayCtrl','add')}>列表</div>-->
<div iconCls="icon-start" id="menuStart" onclick="enable(0)" {:buttonAuth('PlayCtrl','PlayCtrl','updateStatusAjaxHandle')}>启用</div>--> <div class="menu-sep"></div>
<div iconCls="icon-start" id="menuStop" onclick="enable(1)" {:buttonAuth('PlayCtrl','PlayCtrl','updateStatusAjaxHandle')}>上线</div>
<div iconCls="icon-stop" id="menuStart" onclick="enable(2)" {:buttonAuth('PlayCtrl','PlayCtrl','updateStatusAjaxHandle')}>下线</div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
...@@ -125,9 +125,9 @@ $(function(){ ...@@ -125,9 +125,9 @@ $(function(){
function enable(status){ function enable(status){
var row = $('#dg').datagrid('getSelected'); var row = $('#dg').datagrid('getSelected');
if (row){ if (row){
var msg='启用'; var msg='上线';
if(status==1) if(status==2)
msg='禁用' msg='下线'
$.messager.confirm('操作确认', '确认['+msg+']该记录?', function(r){ $.messager.confirm('操作确认', '确认['+msg+']该记录?', function(r){
if (r){ if (r){
$.post("/PlayCtrl/PlayCtrl/updateStatusAjaxHandle/", {id:row.id,status:status}, $.post("/PlayCtrl/PlayCtrl/updateStatusAjaxHandle/", {id:row.id,status:status},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment