Commit e174cb90 authored by wangjiangze's avatar wangjiangze

分前端增加SP搜索和列表数据

parent 3139c294
......@@ -16,11 +16,16 @@ class FrontAction extends CommonAction{
echo "{\"total\":\"".$total."\",\"rows\":".json_encode($list)."}";
}else{
$hotelModel = D("Hotel");
$spModel = D("Sp");
if($userInfo['sp_ids']&&$userInfo['grade']>=3){
$hotel_lists = $hotelModel->where("`status`=0 and sp_id in(".$userInfo['sp_ids'].")")->select();
$sp_lists = $spModel->where("`status`=0 and id in(".$userInfo['sp_ids'].")")->select();
}else{
$hotel_lists = $hotelModel->where("`status`=0")->select();
$sp_lists = $spModel->where("`status`=0")->select();
}
$this->sp_lists = $sp_lists;
$this->hotel_lists = $hotel_lists;
$this->display();
}
......
......@@ -13,11 +13,14 @@ class FrontModel extends RelationModel{
$searchField = $inputs["searchField"]?$inputs["searchField"]:'A.name';
$searchValue = $inputs["searchValue"]?$inputs["searchValue"]:'';
$searchHotel = $inputs["searchHotel"]?$inputs["searchHotel"]:0;
$searchSp = $inputs["searchSp"]?$inputs["searchSp"]:0;
if($searchValue){
$where = " and (A.`name` like '%".$searchValue."%' or A.`code` like '%".$searchValue."%') ";
}
if($searchSp){
$where .= " and B.sp_id = $searchSp ";
}
if($searchHotel){
$where .= " and A.hotel_id = $searchHotel ";
}
......@@ -33,9 +36,9 @@ class FrontModel extends RelationModel{
//返回列表(limit分页)
if($queryType=="list"){
$where .= $sort." ".$limit;
$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` ";
$fields = " A.*,B.`name` hotel_name,C.`name` sp_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 join sh_sp C on B.sp_id = C.id where 1=1 ".$where.";";
return $model->query($sql);
}
}
\ No newline at end of file
......@@ -24,6 +24,12 @@
<form name="searchform" method="post" action="" id ="searchform">
<input type="hidden" name="op" value="getjson">
<div class="inputBox">
<select class="select" name="searchSp">
<option value="0">合作方</option>
<volist name="sp_lists" id="item">
<option value="{$item.id}">{$item.name}</option>
</volist>
</select>
<select class="select" name="searchHotel">
<option value="0">酒店</option>
<volist name="hotel_lists" id="item">
......@@ -66,6 +72,7 @@ onRowContextMenu : onRowContextMenu
<thead>
<tr>
<th data-options="field:'hotel_name',width:40" sortable="true">酒店</th>
<th data-options="field:'sp_name',width:40" sortable="true">合作方</th>
<th data-options="field:'type',width:20" formatter="TypeAction">类型</th>
<th data-options="field:'name',width:40">分前端名称</th>
<th data-options="field:'code',width:20">分前端标识</th>
......
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