$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_city_lists=$regionModel->where("pid > 1 and level = 3 and `status`=0")->select();
$play_lists=$model->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->sp_lists=$sp_lists;
$this->sp_lists=$sp_lists;
$this->region_lists=$region_lists;
$this->media_lists=json_encode($media_lists);
$this->region_city_lists=$region_city_lists;
$this->play_lists=$play_lists;
$this->display();
$this->display();
}
}
//添加处理
//添加处理
publicfunctionaddHandle(){
publicfunctionaddHandle(){
$model=D("Hotel");
$model=D("SpPlaylist");
$mapModel=D("SpPlaylistMediaMap");
$id=I('id','',int);
$id=I('id','',int);
$data['sp_id']=I("sp_id");
$data['sp_id']=I("sp_id");
$data['region_id']=I("region_id");
$data['name']=I("name");
$data['name']=I("name");
$data['code']=I("code");
$data['remark']=I("remark");
$data['remark']=I("remark");
$data['status']=I("status");
$data['status']=I("status");
$media_lists=I("post.media_lists");
if($id){
if($id){
$data['id']=$id;
$data['id']=$id;
$data["updatetime"]=date('Y-m-d H:i:s');
$data["updatetime"]=date('Y-m-d H:i:s');
$r=$model->save($data);
$r=$model->save($data);
if($r){
if($r){
echo'true';
echo'true';
}else{
}else{
...
@@ -67,6 +70,13 @@ class PlaylistAction extends CommonAction{
...
@@ -67,6 +70,13 @@ class PlaylistAction extends CommonAction{
$where=" and (A.`name` like '%".$searchValue."%') ";
}
if($searchSp){
$where=" and A.sp_id = $searchSp ";
}
$model=newModel();
//======================
$fields="count(A.id) count";
//返回列表(limit分页)
if($queryType=="list"){
$where.=$sort." ".$limit;
$fields=" *,B.`name` sp_name,case A.`status` when 0 then '<font color=green>正常</font>' when 1 then '<font color=red>禁用</font>' when 2 then '<font color=red>删除</font>' end as `status` ";
}
$sql="select ".$fields." from sh_sp_playlist A join sh_sp B on A.sp_id = B.id where 1=1 ".$where.";";
$where=" and (A.`name` like '%".$searchValue."%') ";
}
if($searchSp){
$where=" and A.sp_id = $searchSp ";
}
$model=newModel();
//======================
$fields="count(A.id) count";
//返回列表(limit分页)
if($queryType=="list"){
$where.=$sort." ".$limit;
$fields=" A.`name`,A.addtime,A.updatetime,B.`name` sp_name,case A.`status` when 0 then '<font color=green>正常</font>' when 1 then '<font color=red>禁用</font>' when 2 then '<font color=red>删除</font>' end as `status` ";
}
$sql="select ".$fields." from sh_sp_playlist A join sh_sp B on A.sp_id = B.id where 1=1 ".$where.";";