Commit 5763877c authored by wangjiangze's avatar wangjiangze

绑定SP权限调整

parent ceeca4be
...@@ -4,9 +4,9 @@ class FrontAction extends CommonAction{ ...@@ -4,9 +4,9 @@ class FrontAction extends CommonAction{
//管理 //管理
public function index(){ public function index(){
$op = I('op'); $op = I('op');
$userInfo = $_SESSION["_USER_INFO"];
if($op=="getjson"){ if($op=="getjson"){
$model = D("Front"); $model = D("Front");
$userInfo = $_SESSION["_USER_INFO"];
$inputs = I(); $inputs = I();
$list = $model->getList("list",$userInfo,$inputs); $list = $model->getList("list",$userInfo,$inputs);
$count = $model->getList("count",$userInfo,$inputs); $count = $model->getList("count",$userInfo,$inputs);
...@@ -14,7 +14,11 @@ class FrontAction extends CommonAction{ ...@@ -14,7 +14,11 @@ class FrontAction extends CommonAction{
echo "{\"total\":\"".$total."\",\"rows\":".json_encode($list)."}"; echo "{\"total\":\"".$total."\",\"rows\":".json_encode($list)."}";
}else{ }else{
$hotelModel = D("Hotel"); $hotelModel = D("Hotel");
if($userInfo['sp_ids']){
$hotel_lists = $hotelModel->where("`status`=0 and sp_id in(".$userInfo['sp_ids'].")")->select();
}else{
$hotel_lists = $hotelModel->where("`status`=0")->select(); $hotel_lists = $hotelModel->where("`status`=0")->select();
}
$this->hotel_lists = $hotel_lists; $this->hotel_lists = $hotel_lists;
$this->display(); $this->display();
} }
...@@ -35,7 +39,11 @@ class FrontAction extends CommonAction{ ...@@ -35,7 +39,11 @@ class FrontAction extends CommonAction{
$storage_list = $deviceStorageModel->field("id,`path`,`size`")->where("device_id = $id")->select(); $storage_list = $deviceStorageModel->field("id,`path`,`size`")->where("device_id = $id")->select();
$this->storage_list = $storage_list; $this->storage_list = $storage_list;
} }
if($userInfo['sp_ids']){
$hotel_lists = $hotelModel->where("`status`=0 and sp_id in(".$userInfo['sp_ids'].")")->select();
}else{
$hotel_lists = $hotelModel->where("`status`=0")->select(); $hotel_lists = $hotelModel->where("`status`=0")->select();
}
$this->code = GetfourStr(8); $this->code = GetfourStr(8);
$this->hotel_lists = $hotel_lists; $this->hotel_lists = $hotel_lists;
$this->display(); $this->display();
......
...@@ -4,9 +4,9 @@ class HotelAction extends CommonAction{ ...@@ -4,9 +4,9 @@ class HotelAction extends CommonAction{
//管理 //管理
public function index(){ public function index(){
$op = I('op'); $op = I('op');
$userInfo = $_SESSION["_USER_INFO"];
if($op=="getjson"){ if($op=="getjson"){
$model = D("Hotel"); $model = D("Hotel");
$userInfo = $_SESSION["_USER_INFO"];
$inputs = I(); $inputs = I();
$list = $model->getList("list",$userInfo,$inputs); $list = $model->getList("list",$userInfo,$inputs);
$count = $model->getList("count",$userInfo,$inputs); $count = $model->getList("count",$userInfo,$inputs);
...@@ -15,7 +15,12 @@ class HotelAction extends CommonAction{ ...@@ -15,7 +15,12 @@ class HotelAction extends CommonAction{
}else{ }else{
$spModel = D("Sp"); $spModel = D("Sp");
$regionModel = D("Region"); $regionModel = D("Region");
if($userInfo['sp_ids']){
$sp_lists = $spModel->where("`status`=0 and id in(".$userInfo['sp_ids'].")")->select();
}else{
$sp_lists = $spModel->where("`status`=0")->select(); $sp_lists = $spModel->where("`status`=0")->select();
}
$region_lists = $regionModel->where("`level` < 4 and pid < 999999")->select(); $region_lists = $regionModel->where("`level` < 4 and pid < 999999")->select();
$this->region_lists = $region_lists; $this->region_lists = $region_lists;
$this->sp_lists = $sp_lists; $this->sp_lists = $sp_lists;
...@@ -36,7 +41,11 @@ class HotelAction extends CommonAction{ ...@@ -36,7 +41,11 @@ class HotelAction extends CommonAction{
$info =$model->where("id = $id")->find(); $info =$model->where("id = $id")->find();
$this->info = $info; $this->info = $info;
} }
if($userInfo['sp_ids']){
$sp_lists = $spModel->where("`status`=0 and id in(".$userInfo['sp_ids'].")")->select();
}else{
$sp_lists = $spModel->where("`status`=0")->select(); $sp_lists = $spModel->where("`status`=0")->select();
}
$region_lists = $regionModel->where("pid = 1 and level = 2 and `status`=0")->select(); $region_lists = $regionModel->where("pid = 1 and level = 2 and `status`=0")->select();
$region_city_lists = $regionModel->where("pid > 1 and level = 3 and `status`=0")->select(); $region_city_lists = $regionModel->where("pid > 1 and level = 3 and `status`=0")->select();
$this->sp_lists = $sp_lists; $this->sp_lists = $sp_lists;
......
...@@ -13,9 +13,6 @@ class InjectAction extends CommonAction{ ...@@ -13,9 +13,6 @@ class InjectAction extends CommonAction{
$total = $count[0]["count"]; $total = $count[0]["count"];
echo "{\"total\":\"".$total."\",\"rows\":".json_encode($list)."}"; echo "{\"total\":\"".$total."\",\"rows\":".json_encode($list)."}";
}else{ }else{
$hotelModel = D("Hotel");
$hotel_lists = $hotelModel->where("`status`=0")->select();
$this->hotel_lists = $hotel_lists;
$this->display(); $this->display();
} }
} }
...@@ -35,9 +32,14 @@ class InjectAction extends CommonAction{ ...@@ -35,9 +32,14 @@ class InjectAction extends CommonAction{
$info =$model->where("id = $id")->find(); $info =$model->where("id = $id")->find();
$this->info = $info; $this->info = $info;
} }
$hotel_lists = $hotelModel->where("`status`=0")->select();
$sp_lists = $spModel->field("id,`name`")->select();
$media_lists = $mediaModel->field("id,title")->select(); $media_lists = $mediaModel->field("id,title")->select();
if($userInfo['sp_ids']){
$sp_lists = $spModel->field("id,`name`")->where("`status`=0 and id in(".$userInfo['sp_ids'].")")->select();
$hotel_lists = $hotelModel->field("id,`name`,sp_id")->where("`status`=0 and sp_id in(".$userInfo['sp_ids'].")")->select();
}else{
$sp_lists = $spModel->field("id,`name`")->where("`status`=0")->select();
$hotel_lists = $hotelModel->field("id,`name`,sp_id")->where("`status`=0")->select();
}
$play_lists = $spPlaylistModel->join(" A join sh_sp_playlist_media_map B on A.id = B.playlist_id ")->field("A.id,A.`name`,A.sp_id,group_concat(B.media_id) media_ids")->group("A.id")->select(); $play_lists = $spPlaylistModel->join(" A join sh_sp_playlist_media_map B on A.id = B.playlist_id ")->field("A.id,A.`name`,A.sp_id,group_concat(B.media_id) media_ids")->group("A.id")->select();
$this->hotel_lists = $hotel_lists; $this->hotel_lists = $hotel_lists;
$this->sp_lists = $sp_lists; $this->sp_lists = $sp_lists;
......
...@@ -4,9 +4,9 @@ class InjectLogAction extends CommonAction{ ...@@ -4,9 +4,9 @@ class InjectLogAction extends CommonAction{
//管理 //管理
public function index(){ public function index(){
$op = I('op'); $op = I('op');
$userInfo = $_SESSION["_USER_INFO"];
if($op=="getjson"){ if($op=="getjson"){
$model = D("InjectLog"); $model = D("InjectLog");
$userInfo = $_SESSION["_USER_INFO"];
$inputs = I(); $inputs = I();
$list = $model->getList("list",$userInfo,$inputs); $list = $model->getList("list",$userInfo,$inputs);
$count = $model->getList("count",$userInfo,$inputs); $count = $model->getList("count",$userInfo,$inputs);
...@@ -15,8 +15,13 @@ class InjectLogAction extends CommonAction{ ...@@ -15,8 +15,13 @@ class InjectLogAction extends CommonAction{
}else{ }else{
$hotelModel = D("Hotel"); $hotelModel = D("Hotel");
$spModel = D("Sp"); $spModel = D("Sp");
$hotel_lists = $hotelModel->where("`status`=0")->select(); if($userInfo['sp_ids']){
$sp_lists = $spModel->where("`status`=0 and id in(".$userInfo['sp_ids'].")")->select();
$hotel_lists = $hotelModel->where("`status`=0 and sp_id in(".$userInfo['sp_ids'].")")->select();
}else{
$sp_lists = $spModel->where("`status`=0")->select(); $sp_lists = $spModel->where("`status`=0")->select();
$hotel_lists = $hotelModel->where("`status`=0")->select();
}
$this->hotel_lists = $hotel_lists; $this->hotel_lists = $hotel_lists;
$this->sp_lists = $sp_lists; $this->sp_lists = $sp_lists;
$this->display(); $this->display();
......
...@@ -4,9 +4,9 @@ class PlayLogAction extends CommonAction{ ...@@ -4,9 +4,9 @@ class PlayLogAction extends CommonAction{
//管理 //管理
public function index(){ public function index(){
$op = I('op'); $op = I('op');
$userInfo = $_SESSION["_USER_INFO"];
if($op=="getjson"){ if($op=="getjson"){
$model = D("PlayLog"); $model = D("PlayLog");
$userInfo = $_SESSION["_USER_INFO"];
$inputs = I(); $inputs = I();
$list = $model->getList("list",$userInfo,$inputs); $list = $model->getList("list",$userInfo,$inputs);
$count = $model->getList("count",$userInfo,$inputs); $count = $model->getList("count",$userInfo,$inputs);
...@@ -15,8 +15,13 @@ class PlayLogAction extends CommonAction{ ...@@ -15,8 +15,13 @@ class PlayLogAction extends CommonAction{
}else{ }else{
$spModel = D("Sp"); $spModel = D("Sp");
$hotelModel = D("Hotel"); $hotelModel = D("Hotel");
$sp_lists = $spModel->where("`status`=0")->select(); if($userInfo['sp_ids']){
$hotel_lists = $hotelModel->where("`status`=0")->select(); $sp_lists = $spModel->field("id,`name`")->where("`status`=0 and id in(".$userInfo['sp_ids'].")")->select();
$hotel_lists = $hotelModel->field("id,`name`,sp_id")->where("`status`=0 and sp_id in(".$userInfo['sp_ids'].")")->select();
}else{
$sp_lists = $spModel->field("id,`name`")->where("`status`=0")->select();
$hotel_lists = $hotelModel->field("id,`name`,sp_id")->where("`status`=0")->select();
}
$this->sp_lists = $sp_lists; $this->sp_lists = $sp_lists;
$this->hotel_lists = $hotel_lists; $this->hotel_lists = $hotel_lists;
$this->display(); $this->display();
......
...@@ -4,9 +4,9 @@ class PushLogAction extends CommonAction{ ...@@ -4,9 +4,9 @@ class PushLogAction extends CommonAction{
//管理 //管理
public function index(){ public function index(){
$op = I('op'); $op = I('op');
$userInfo = $_SESSION["_USER_INFO"];
if($op=="getjson"){ if($op=="getjson"){
$model = D("PushLog"); $model = D("PushLog");
$userInfo = $_SESSION["_USER_INFO"];
$inputs = I(); $inputs = I();
$list = $model->getList("list",$userInfo,$inputs); $list = $model->getList("list",$userInfo,$inputs);
$count = $model->getList("count",$userInfo,$inputs); $count = $model->getList("count",$userInfo,$inputs);
...@@ -14,7 +14,14 @@ class PushLogAction extends CommonAction{ ...@@ -14,7 +14,14 @@ class PushLogAction extends CommonAction{
echo "{\"total\":\"".$total."\",\"rows\":".json_encode($list)."}"; echo "{\"total\":\"".$total."\",\"rows\":".json_encode($list)."}";
}else{ }else{
$spModel = D("Sp"); $spModel = D("Sp");
$sp_lists = $spModel->where("`status`=0")->select(); $hotelModel = D("Hotel");
if($userInfo['sp_ids']){
$sp_lists = $spModel->field("id,`name`")->where("`status`=0 and id in(".$userInfo['sp_ids'].")")->select();
$hotel_lists = $hotelModel->field("id,`name`,sp_id")->where("`status`=0 and sp_id in(".$userInfo['sp_ids'].")")->select();
}else{
$sp_lists = $spModel->field("id,`name`")->where("`status`=0")->select();
$hotel_lists = $hotelModel->field("id,`name`,sp_id")->where("`status`=0")->select();
}
$this->sp_lists = $sp_lists; $this->sp_lists = $sp_lists;
$this->display(); $this->display();
} }
......
...@@ -4,9 +4,9 @@ class HotelAction extends CommonAction{ ...@@ -4,9 +4,9 @@ class HotelAction extends CommonAction{
//管理 //管理
public function index(){ public function index(){
$op = I('op'); $op = I('op');
$userInfo = $_SESSION["_USER_INFO"];
if($op=="getjson"){ if($op=="getjson"){
$model = D("HotelMediaMap"); $model = D("HotelMediaMap");
$userInfo = $_SESSION["_USER_INFO"];
$inputs = I(); $inputs = I();
$list = $model->getList("list",$userInfo,$inputs); $list = $model->getList("list",$userInfo,$inputs);
$count = $model->getList("count",$userInfo,$inputs); $count = $model->getList("count",$userInfo,$inputs);
...@@ -15,8 +15,13 @@ class HotelAction extends CommonAction{ ...@@ -15,8 +15,13 @@ class HotelAction extends CommonAction{
}else{ }else{
$spModel = D("Sp"); $spModel = D("Sp");
$hotelModel = D("Hotel"); $hotelModel = D("Hotel");
if($userInfo['sp_ids']){
$sp_lists = $spModel->field("id,`name`")->where("`status`=0 and id in(".$userInfo['sp_ids'].")")->select();
$hotel_lists = $hotelModel->field("id,`name`,sp_id")->where("`status`=0 and sp_id in(".$userInfo['sp_ids'].")")->select();
}else{
$sp_lists = $spModel->field("id,`name`")->where("`status`=0")->select(); $sp_lists = $spModel->field("id,`name`")->where("`status`=0")->select();
$hotel_lists = $hotelModel->field("id,`name`,sp_id")->where("`status`=0")->select(); $hotel_lists = $hotelModel->field("id,`name`,sp_id")->where("`status`=0")->select();
}
$this->sp_lists = $sp_lists; $this->sp_lists = $sp_lists;
$this->hotel_lists = $hotel_lists; $this->hotel_lists = $hotel_lists;
$this->display(); $this->display();
......
...@@ -4,9 +4,9 @@ class PlaylistAction extends CommonAction{ ...@@ -4,9 +4,9 @@ class PlaylistAction extends CommonAction{
//管理 //管理
public function index(){ public function index(){
$op = I('op'); $op = I('op');
$userInfo = $_SESSION["_USER_INFO"];
if($op=="getjson"){ if($op=="getjson"){
$model = D("SpPlaylist"); $model = D("SpPlaylist");
$userInfo = $_SESSION["_USER_INFO"];
$inputs = I(); $inputs = I();
$list = $model->getList("list",$userInfo,$inputs); $list = $model->getList("list",$userInfo,$inputs);
$count = $model->getList("count",$userInfo,$inputs); $count = $model->getList("count",$userInfo,$inputs);
...@@ -14,7 +14,11 @@ class PlaylistAction extends CommonAction{ ...@@ -14,7 +14,11 @@ class PlaylistAction extends CommonAction{
echo "{\"total\":\"".$total."\",\"rows\":".json_encode($list)."}"; echo "{\"total\":\"".$total."\",\"rows\":".json_encode($list)."}";
}else{ }else{
$spModel = D("Sp"); $spModel = D("Sp");
if($userInfo['sp_ids']){
$sp_lists = $spModel->field("id,`name`")->where("`status`=0 and id in(".$userInfo['sp_ids'].")")->select();
}else{
$sp_lists = $spModel->field("id,`name`")->where("`status`=0")->select(); $sp_lists = $spModel->field("id,`name`")->where("`status`=0")->select();
}
$this->sp_lists = $sp_lists; $this->sp_lists = $sp_lists;
$this->display(); $this->display();
} }
......
...@@ -13,9 +13,6 @@ class PlayCtrlAction extends CommonAction{ ...@@ -13,9 +13,6 @@ class PlayCtrlAction extends CommonAction{
$total = $count[0]["count"]; $total = $count[0]["count"];
echo "{\"total\":\"".$total."\",\"rows\":".json_encode($list)."}"; echo "{\"total\":\"".$total."\",\"rows\":".json_encode($list)."}";
}else{ }else{
$hotelModel = D("Hotel");
$hotel_lists = $hotelModel->where("`status`=0")->select();
$this->hotel_lists = $hotel_lists;
$this->display(); $this->display();
} }
} }
...@@ -39,9 +36,14 @@ class PlayCtrlAction extends CommonAction{ ...@@ -39,9 +36,14 @@ class PlayCtrlAction extends CommonAction{
$this->log_info = $log_info; $this->log_info = $log_info;
$this->info = $info; $this->info = $info;
} }
$hotel_lists = $hotelModel->field("id,`name`,sp_id,region_id")->where("`status`=0")->select();
$sp_lists = $spModel->field("id,`name`")->select();
$media_lists = $mediaModel->field("id,title")->select(); $media_lists = $mediaModel->field("id,title")->select();
if($userInfo['sp_ids']){
$sp_lists = $spModel->field("id,`name`")->where("`status`=0 and id in(".$userInfo['sp_ids'].")")->select();
$hotel_lists = $hotelModel->field("id,`name`,sp_id,region_id")->where("`status`=0 and sp_id in(".$userInfo['sp_ids'].")")->select();
}else{
$sp_lists = $spModel->field("id,`name`")->where("`status`=0")->select();
$hotel_lists = $hotelModel->field("id,`name`,sp_id,region_id")->where("`status`=0")->select();
}
$play_lists = $spPlaylistModel->join(" A join sh_sp_playlist_media_map B on A.id = B.playlist_id ")->field("A.id,A.`name`,A.sp_id,group_concat(B.media_id) media_ids")->group("A.id")->select(); $play_lists = $spPlaylistModel->join(" A join sh_sp_playlist_media_map B on A.id = B.playlist_id ")->field("A.id,A.`name`,A.sp_id,group_concat(B.media_id) media_ids")->group("A.id")->select();
$region_lists = $regionModel->where("`level` < 4 and pid < 999999")->select(); $region_lists = $regionModel->where("`level` < 4 and pid < 999999")->select();
$this->region_lists = $region_lists; $this->region_lists = $region_lists;
......
...@@ -4,9 +4,9 @@ class PlayCtrlLogAction extends CommonAction{ ...@@ -4,9 +4,9 @@ class PlayCtrlLogAction extends CommonAction{
//管理 //管理
public function index(){ public function index(){
$op = I('op'); $op = I('op');
$userInfo = $_SESSION["_USER_INFO"];
if($op=="getjson"){ if($op=="getjson"){
$model = D("PlayCtrlLog"); $model = D("PlayCtrlLog");
$userInfo = $_SESSION["_USER_INFO"];
$inputs = I(); $inputs = I();
$list = $model->getList("list",$userInfo,$inputs); $list = $model->getList("list",$userInfo,$inputs);
$count = $model->getList("count",$userInfo,$inputs); $count = $model->getList("count",$userInfo,$inputs);
...@@ -15,8 +15,13 @@ class PlayCtrlLogAction extends CommonAction{ ...@@ -15,8 +15,13 @@ class PlayCtrlLogAction extends CommonAction{
}else{ }else{
$hotelModel = D("Hotel"); $hotelModel = D("Hotel");
$spModel = D("Sp"); $spModel = D("Sp");
$hotel_lists = $hotelModel->where("`status`=0")->select(); if($userInfo['sp_ids']){
$sp_lists = $spModel->where("`status`=0 and id in(".$userInfo['sp_ids'].")")->select();
$hotel_lists = $hotelModel->where("`status`=0 and sp_id in(".$userInfo['sp_ids'].")")->select();
}else{
$sp_lists = $spModel->where("`status`=0")->select(); $sp_lists = $spModel->where("`status`=0")->select();
$hotel_lists = $hotelModel->where("`status`=0")->select();
}
$this->hotel_lists = $hotel_lists; $this->hotel_lists = $hotel_lists;
$this->sp_lists = $sp_lists; $this->sp_lists = $sp_lists;
$this->display(); $this->display();
......
...@@ -13,9 +13,6 @@ class PlayCtrlAction extends CommonAction{ ...@@ -13,9 +13,6 @@ class PlayCtrlAction extends CommonAction{
$total = $count[0]["count"]; $total = $count[0]["count"];
echo "{\"total\":\"".$total."\",\"rows\":".json_encode($list)."}"; echo "{\"total\":\"".$total."\",\"rows\":".json_encode($list)."}";
}else{ }else{
$hotelModel = D("Hotel");
$hotel_lists = $hotelModel->where("`status`=0")->select();
$this->hotel_lists = $hotel_lists;
$this->display(); $this->display();
} }
} }
...@@ -39,9 +36,14 @@ class PlayCtrlAction extends CommonAction{ ...@@ -39,9 +36,14 @@ class PlayCtrlAction extends CommonAction{
$this->log_info = $log_info; $this->log_info = $log_info;
$this->info = $info; $this->info = $info;
} }
$hotel_lists = $hotelModel->field("id,`name`,sp_id,region_id")->where("`status`=0")->select();
$sp_lists = $spModel->field("id,`name`")->select();
$media_lists = $mediaModel->field("id,title")->select(); $media_lists = $mediaModel->field("id,title")->select();
if($userInfo['sp_ids']){
$sp_lists = $spModel->field("id,`name`")->where("`status`=0 and id in(".$userInfo['sp_ids'].")")->select();
$hotel_lists = $hotelModel->field("id,`name`,sp_id,region_id")->where("`status`=0 and sp_id in(".$userInfo['sp_ids'].")")->select();
}else{
$sp_lists = $spModel->field("id,`name`")->where("`status`=0")->select();
$hotel_lists = $hotelModel->field("id,`name`,sp_id,region_id")->where("`status`=0")->select();
}
$play_lists = $spPlaylistModel->join(" A join sh_sp_playlist_media_map B on A.id = B.playlist_id ")->field("A.id,A.`name`,A.sp_id,group_concat(B.media_id) media_ids")->group("A.id")->select(); $play_lists = $spPlaylistModel->join(" A join sh_sp_playlist_media_map B on A.id = B.playlist_id ")->field("A.id,A.`name`,A.sp_id,group_concat(B.media_id) media_ids")->group("A.id")->select();
$region_lists = $regionModel->where("`level` < 4 and pid < 999999")->select(); $region_lists = $regionModel->where("`level` < 4 and pid < 999999")->select();
$this->region_lists = $region_lists; $this->region_lists = $region_lists;
......
...@@ -4,9 +4,9 @@ class PlayCtrlLogAction extends CommonAction{ ...@@ -4,9 +4,9 @@ class PlayCtrlLogAction extends CommonAction{
//管理 //管理
public function index(){ public function index(){
$op = I('op'); $op = I('op');
$userInfo = $_SESSION["_USER_INFO"];
if($op=="getjson"){ if($op=="getjson"){
$model = D("PlayCtrlLog"); $model = D("PlayCtrlLog");
$userInfo = $_SESSION["_USER_INFO"];
$inputs = I(); $inputs = I();
$list = $model->getList("list",$userInfo,$inputs); $list = $model->getList("list",$userInfo,$inputs);
$count = $model->getList("count",$userInfo,$inputs); $count = $model->getList("count",$userInfo,$inputs);
...@@ -15,8 +15,13 @@ class PlayCtrlLogAction extends CommonAction{ ...@@ -15,8 +15,13 @@ class PlayCtrlLogAction extends CommonAction{
}else{ }else{
$hotelModel = D("Hotel"); $hotelModel = D("Hotel");
$spModel = D("Sp"); $spModel = D("Sp");
$hotel_lists = $hotelModel->where("`status`=0")->select(); if($userInfo['sp_ids']){
$sp_lists = $spModel->where("`status`=0 and id in(".$userInfo['sp_ids'].")")->select();
$hotel_lists = $hotelModel->where("`status`=0 and sp_id in(".$userInfo['sp_ids'].")")->select();
}else{
$sp_lists = $spModel->where("`status`=0")->select(); $sp_lists = $spModel->where("`status`=0")->select();
$hotel_lists = $hotelModel->where("`status`=0")->select();
}
$this->hotel_lists = $hotel_lists; $this->hotel_lists = $hotel_lists;
$this->sp_lists = $sp_lists; $this->sp_lists = $sp_lists;
$this->display(); $this->display();
......
...@@ -4,9 +4,9 @@ class ConfAction extends CommonAction{ ...@@ -4,9 +4,9 @@ class ConfAction extends CommonAction{
//管理 //管理
public function index(){ public function index(){
$op = I('op'); $op = I('op');
$userInfo = $_SESSION["_USER_INFO"];
if($op=="getjson"){ if($op=="getjson"){
$model = D("Conf"); $model = D("Conf");
$userInfo = $_SESSION["_USER_INFO"];
$inputs = I(); $inputs = I();
$list = $model->getList("list",$userInfo,$inputs); $list = $model->getList("list",$userInfo,$inputs);
$count = $model->getList("count",$userInfo,$inputs); $count = $model->getList("count",$userInfo,$inputs);
...@@ -14,7 +14,11 @@ class ConfAction extends CommonAction{ ...@@ -14,7 +14,11 @@ class ConfAction extends CommonAction{
echo "{\"total\":\"".$total."\",\"rows\":".json_encode($list)."}"; echo "{\"total\":\"".$total."\",\"rows\":".json_encode($list)."}";
}else{ }else{
$spModel = D("Sp"); $spModel = D("Sp");
if($userInfo['sp_ids']){
$sp_lists = $spModel->where("`status`=0 and id in(".$userInfo['sp_ids'].")")->select();
}else{
$sp_lists = $spModel->where("`status`=0")->select(); $sp_lists = $spModel->where("`status`=0")->select();
}
$this->sp_lists = $sp_lists; $this->sp_lists = $sp_lists;
$this->display(); $this->display();
} }
...@@ -32,7 +36,11 @@ class ConfAction extends CommonAction{ ...@@ -32,7 +36,11 @@ class ConfAction extends CommonAction{
$info =$model->where("id = $id")->find(); $info =$model->where("id = $id")->find();
$this->info = $info; $this->info = $info;
} }
if($userInfo['sp_ids']){
$sp_lists = $spModel->where("`status`=0 and id in(".$userInfo['sp_ids'].")")->select();
}else{
$sp_lists = $spModel->where("`status`=0")->select(); $sp_lists = $spModel->where("`status`=0")->select();
}
$this->sp_lists = $sp_lists; $this->sp_lists = $sp_lists;
$this->display(); $this->display();
} }
......
...@@ -16,8 +16,7 @@ class UserAction extends CommonAction{ ...@@ -16,8 +16,7 @@ class UserAction extends CommonAction{
} }
$spModel = D("Sp"); $spModel = D("Sp");
$sp_lists = $spModel->where("`status`=0")->select(); $sp_lists = $spModel->field("id,`name`")->where("`status`=0")->select();
$this->sp_lists = $sp_lists;
$id = I('id','',int); $id = I('id','',int);
if($id){ if($id){
...@@ -25,6 +24,7 @@ class UserAction extends CommonAction{ ...@@ -25,6 +24,7 @@ class UserAction extends CommonAction{
$user=$userModel->getUserInfo($id); $user=$userModel->getUserInfo($id);
$user=$user[0]; $user=$user[0];
$sp_lists = $spModel->field("A.id,A.`name`,if(B.`status`=0,'true',null) as selected")->join("A left join sh_sp_user_map B on A.id = B.sp_id and B.user_id = $id")->where("A.`status`=0")->select();
foreach ($role as $key=>$value){ foreach ($role as $key=>$value){
if($role[$key]['id']==$user['role_id']) if($role[$key]['id']==$user['role_id'])
$role[$key]['selected']='selected'; $role[$key]['selected']='selected';
...@@ -44,6 +44,7 @@ class UserAction extends CommonAction{ ...@@ -44,6 +44,7 @@ class UserAction extends CommonAction{
$bizUserList[$key]['selected']='selected'; $bizUserList[$key]['selected']='selected';
} }
} }
$this->sp_lists = $sp_lists;
$this->assign('user',$user); $this->assign('user',$user);
$this->assign('role',$role); $this->assign('role',$role);
$this->assign('myDeviceGroupOwnerList',$myDeviceGroupOwnerList); $this->assign('myDeviceGroupOwnerList',$myDeviceGroupOwnerList);
...@@ -54,6 +55,7 @@ class UserAction extends CommonAction{ ...@@ -54,6 +55,7 @@ class UserAction extends CommonAction{
public function addUserHandle(){ public function addUserHandle(){
$UserModel = D("User"); $UserModel = D("User");
$RoleUserModel = D("RoleUser"); $RoleUserModel = D("RoleUser");
$SpUserMapModel = D("SpUserMap");
$user["account"]=$_POST["account"]; $user["account"]=$_POST["account"];
$user["password"]=I("password","","md5");// $user["password"]=I("password","","md5");//
$user["nickname"]=$_POST["nickname"]; $user["nickname"]=$_POST["nickname"];
...@@ -67,10 +69,18 @@ class UserAction extends CommonAction{ ...@@ -67,10 +69,18 @@ class UserAction extends CommonAction{
$user["grade"]=$roleInfo["grade"];//用户等级与所选角色等级一致 $user["grade"]=$roleInfo["grade"];//用户等级与所选角色等级一致
//dump($user);exit; //dump($user);exit;
$uid = $_POST['id']; $uid = $_POST['id'];
$sp_id = $_POST['sp_id']; //表sh_sp_user_map绑定 $sp_ids = $_POST['sp_id']; //表sh_sp_user_map绑定
if($uid){ if($uid){
$user["id"]=$uid; $user["id"]=$uid;
$user["update_time"]=time(); $user["update_time"]=time();
$SpUserMapModel->where("user_id = $uid")->delete();
if($sp_ids){
$mapData = array();
foreach($sp_ids as $key=>$value){
$mapData[] = array("user_id"=>$uid,"sp_id"=>$value,"status"=>0,"addtime"=>date("Y-m-d H:i:s"));
}
$SpUserMapModel->addAll($mapData);
}
unset($user['account']); unset($user['account']);
unset($user['password']); unset($user['password']);
if($UserModel->save($user)){ if($UserModel->save($user)){
...@@ -95,6 +105,16 @@ class UserAction extends CommonAction{ ...@@ -95,6 +105,16 @@ class UserAction extends CommonAction{
$user["remark"]=''; $user["remark"]='';
$uid = $UserModel->add($user); $uid = $UserModel->add($user);
$SpUserMapModel->where("user_id = $uid")->delete();
if($sp_ids){
$mapData = array();
foreach($sp_ids as $key=>$value){
$mapData[] = array("user_id"=>$uid,"sp_id"=>$value,"status"=>0,"addtime"=>date("Y-m-d H:i:s"));
}
$SpUserMapModel->addAll($mapData);
}
if($uid){ if($uid){
$role["role_id"]=I("role_id","",int); $role["role_id"]=I("role_id","",int);
$role["user_id"]=$uid; $role["user_id"]=$uid;
......
...@@ -22,6 +22,10 @@ class ConfModel extends RelationModel{ ...@@ -22,6 +22,10 @@ class ConfModel extends RelationModel{
$where .= " and A.sp_id = $searchSp "; $where .= " and A.sp_id = $searchSp ";
} }
if($userInfo['sp_ids']){
$where .= " and A.sp_id in(".$userInfo['sp_ids'].") ";
}
$model = new Model(); $model = new Model();
//====================== //======================
......
...@@ -22,6 +22,10 @@ class FrontModel extends RelationModel{ ...@@ -22,6 +22,10 @@ class FrontModel extends RelationModel{
$where .= " and A.hotel_id = $searchHotel "; $where .= " and A.hotel_id = $searchHotel ";
} }
if($userInfo['sp_ids']){
$where .= " and B.sp_id in(".$userInfo['sp_ids'].") ";
}
$model = new Model(); $model = new Model();
//====================== //======================
......
...@@ -24,6 +24,9 @@ class HotelMediaMapModel extends RelationModel{ ...@@ -24,6 +24,9 @@ class HotelMediaMapModel extends RelationModel{
if($searchHotel){ if($searchHotel){
$where .= " and A.hotel_id = $searchHotel "; $where .= " and A.hotel_id = $searchHotel ";
} }
if($userInfo['sp_ids']){
$where .= " and C.sp_id in(".$userInfo['sp_ids'].") ";
}
$model = new Model(); $model = new Model();
......
...@@ -27,6 +27,10 @@ class HotelModel extends RelationModel{ ...@@ -27,6 +27,10 @@ class HotelModel extends RelationModel{
$where .= " and A.region_id = $searchRegion "; $where .= " and A.region_id = $searchRegion ";
} }
if($userInfo['sp_ids']){
$where .= " and A.sp_id in(".$userInfo['sp_ids'].") ";
}
$model = new Model(); $model = new Model();
//====================== //======================
......
...@@ -27,6 +27,10 @@ class InjectLogModel extends RelationModel{ ...@@ -27,6 +27,10 @@ class InjectLogModel extends RelationModel{
$where .= " and A.hotel_id = $searchHotel "; $where .= " and A.hotel_id = $searchHotel ";
} }
if($userInfo['sp_ids']){
$where .= " and A.sp_id in(".$userInfo['sp_ids'].") ";
}
$model = new Model(); $model = new Model();
//====================== //======================
......
...@@ -27,6 +27,10 @@ class PlayCtrlLogModel extends RelationModel{ ...@@ -27,6 +27,10 @@ class PlayCtrlLogModel extends RelationModel{
$where .= " and A.hotel_id = $searchHotel "; $where .= " and A.hotel_id = $searchHotel ";
} }
if($userInfo['sp_ids']){
$where .= " and A.sp_id in(".$userInfo['sp_ids'].") ";
}
$model = new Model(); $model = new Model();
//====================== //======================
......
...@@ -25,7 +25,9 @@ class PlayLogModel extends RelationModel{ ...@@ -25,7 +25,9 @@ class PlayLogModel extends RelationModel{
if($searchHotel){ if($searchHotel){
$where .= " and A.hotel_id = $searchHotel "; $where .= " and A.hotel_id = $searchHotel ";
} }
if($userInfo['sp_ids']){
$where .= " and A.sp_id in(".$userInfo['sp_ids'].") ";
}
$model = new Model(); $model = new Model();
//====================== //======================
......
...@@ -21,6 +21,10 @@ class PushLogModel extends RelationModel{ ...@@ -21,6 +21,10 @@ class PushLogModel extends RelationModel{
$where .= " and A.sp_id = $searchSp "; $where .= " and A.sp_id = $searchSp ";
} }
if($userInfo['sp_ids']){
$where .= " and A.sp_id in(".$userInfo['sp_ids'].") ";
}
$model = new Model(); $model = new Model();
......
...@@ -16,7 +16,9 @@ class SpModel extends RelationModel{ ...@@ -16,7 +16,9 @@ class SpModel extends RelationModel{
if($searchValue){ if($searchValue){
$where = " and (`name` like '%".$searchValue."%' or `code` like '%".$searchValue."%') "; $where = " and (`name` like '%".$searchValue."%' or `code` like '%".$searchValue."%') ";
} }
if($userInfo['sp_ids']){
$where .= " and id in(".$userInfo['sp_ids'].") ";
}
$model = new Model(); $model = new Model();
......
...@@ -19,7 +19,11 @@ class SpPlaylistModel extends RelationModel{ ...@@ -19,7 +19,11 @@ class SpPlaylistModel extends RelationModel{
} }
if($searchSp){ if($searchSp){
$where = " and A.sp_id = $searchSp "; $where .= " and A.sp_id = $searchSp ";
}
if($userInfo['sp_ids']){
$where .= " and A.sp_id in(".$userInfo['sp_ids'].") ";
} }
$model = new Model(); $model = new Model();
......
<?php
class SpUserMapModel extends RelationModel{
protected $tableName = 'sh_sp_user_map'; //重新定义表名
}
\ No newline at end of file
...@@ -12,7 +12,8 @@ class UserModel extends RelationModel{ ...@@ -12,7 +12,8 @@ class UserModel extends RelationModel{
) )
); );
public function getUserInfo($id){ public function getUserInfo($id){
$sql="select vru.*,vrru.role_id from rbac_user vru,rbac_role_user vrru where vru.id=".$id." and vrru.user_id=vru.id"; // $sql="select vru.*,vrru.role_id from rbac_user vru,rbac_role_user vrru where vru.id=".$id." and vrru.user_id=vru.id"; //WJZ 20190729 注释
$sql = "select A.*,GROUP_CONCAT(ssum.sp_id) sp_ids from (select vru.*,vrru.role_id from rbac_user vru,rbac_role_user vrru where vru.id=".$id." and vrru.user_id=vru.id)A left join sh_sp_user_map ssum on A.id = ssum.user_id";
$model = new Model(); $model = new Model();
return $model->query($sql); return $model->query($sql);
} }
......
...@@ -42,12 +42,12 @@ ...@@ -42,12 +42,12 @@
</form> </form>
</div><!--hyperchanne end--> </div><!--hyperchanne end-->
<div class=""> <div class="">
<ul class="operationBox"> <!-- <ul class="operationBox">
<li class="add"> <li class="add">
<a href="javascript:;" onclick="add()" class="on"><span></span>新增</a> <a href="javascript:;" onclick="add()" class="on"><span></span>新增</a>
</li> </li>
</ul> </ul>-->
</div><!--mainBox end--> </div><!--mainBox end-->
</div> </div>
</div> </div>
......
...@@ -42,12 +42,12 @@ ...@@ -42,12 +42,12 @@
</form> </form>
</div><!--hyperchanne end--> </div><!--hyperchanne end-->
<div class=""> <div class="">
<ul class="operationBox"> <!-- <ul class="operationBox">
<li class="add"> <li class="add">
<a href="javascript:;" onclick="add()" class="on"><span></span>新增</a> <a href="javascript:;" onclick="add()" class="on"><span></span>新增</a>
</li> </li>
</ul> </ul>-->
</div><!--mainBox end--> </div><!--mainBox end-->
</div> </div>
</div> </div>
......
...@@ -42,12 +42,12 @@ ...@@ -42,12 +42,12 @@
</form> </form>
</div><!--hyperchanne end--> </div><!--hyperchanne end-->
<div class=""> <div class="">
<ul class="operationBox"> <!-- <ul class="operationBox">
<li class="add"> <li class="add">
<a href="javascript:;" onclick="add()" class="on"><span></span>新增</a> <a href="javascript:;" onclick="add()" class="on"><span></span>新增</a>
</li> </li>
</ul> </ul>-->
</div><!--mainBox end--> </div><!--mainBox end-->
</div> </div>
</div> </div>
......
...@@ -86,6 +86,10 @@ $().ready(function(){ ...@@ -86,6 +86,10 @@ $().ready(function(){
</volist> </volist>
</select> </select>
</div> </div>
<div><label class="label_s">绑定合作方:</label>
<select name="sp_id[]" class="easyui-combobox" style="width:100%;" data-options='multiple:true,panelHeight:"auto",valueField:"id",textField:"name",data:{$sp_lists|json_encode}'>
</select>
</div>
<div><label class="label_s">是否启用:</label> <div><label class="label_s">是否启用:</label>
<span class="padding_t"><input type="radio" name="status" value="0">禁用</input>&nbsp;&nbsp; <span class="padding_t"><input type="radio" name="status" value="0">禁用</input>&nbsp;&nbsp;
<input type="radio" name="status" value="1" checked="checked">启用</input></span> <input type="radio" name="status" value="1" checked="checked">启用</input></span>
...@@ -94,23 +98,6 @@ $().ready(function(){ ...@@ -94,23 +98,6 @@ $().ready(function(){
</div> </div>
</div> </div>
</div> </div>
<!-- <div title="合作方绑定">
<div class="popPage">
<div class="box">
<div class="wrap">
<div class="clearfix">
<div><label class="label_s" style="min-width:120px!important">所属合作方:</label>
<select name="sp_id" class="easyui-combobox" style="width:100%;" data-options="multiple:true,panelHeight:'auto'">
<volist name="sp_lists" id="item">
<option value="{$item.id}">{$item.name}</option>
</volist>
</select>
</div>
</div>
</div>
</div>
</div>
</div>-->
</div> </div>
<div class="btnBox"> <div class="btnBox">
<!-- <a class="easyui-linkbutton" data-options="iconCls:'icon-save'" href="javascript:;" onclick="submitForm()">保存</a> --> <!-- <a class="easyui-linkbutton" data-options="iconCls:'icon-save'" href="javascript:;" onclick="submitForm()">保存</a> -->
......
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