Commit b3700496 authored by 吴贤德's avatar 吴贤德

酒店片库冗余media_code字段,相应改动

1. 修改中心接口 2.修改媒资注入 3.修改播控管理
parent 140a3dc1
......@@ -285,6 +285,7 @@ class CenterAction extends Action
if ($push_mode==1) {
$sp_id = $sp["sp_id"];
$media_id = $data["id"];
$media_code = $data["code"];
$status = $data["status"];
$updateSQL = "UPDATE sh_hotel_media_map_$sp_id SET status=$status WHERE media_id=$media_id;";
......@@ -296,7 +297,7 @@ class CenterAction extends Action
$arr = M("")->query($sql);
foreach ($arr as $item) {
$dataList[] = array("media_id" => $media_id, "hotel_id" => $item["id"], "status" => $status, "status_inject" => 0);
$dataList[] = array("media_code"=>$media_code,"media_id" => $media_id, "hotel_id" => $item["id"], "status" => $status, "status_inject" => 0);
}
if (!empty($dataList)) {
......
......@@ -61,9 +61,9 @@ class InjectAction extends CommonAction{
$info =$model->where("id = $id")->find();
$this->info = $info;
}
$media_lists = $mediaModel->join(" A join sh_sp B on A.site_id = B.site_id ")->field("A.id,A.title,group_concat(B.id) sp_ids")->group(" A.id ")->select();
$media_lists = $mediaModel->join(" A join sh_sp B on A.site_id = B.site_id ")->field("concat(A.id,'_',A.code) id,A.title,group_concat(B.id) sp_ids")->group(" A.id ")->select();
if($userInfo['sp_ids']&&$userInfo['grade']>=3){
$sp_lists = $spModel->field("id,`name`")->where("`status`=0 and id in(".$userInfo['sp_ids'].")")->select();
$sp_lists = $spModel->field("A.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();
$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")->where("A.sp_id in(".$userInfo['sp_ids'].") and A.`status` = 0")->group("A.id")->select();
}else{
......@@ -114,30 +114,29 @@ class InjectAction extends CommonAction{
foreach($media_lists as $k => $v){
$logData = array();
$mapData = array();
// $isExists = M("Map_$sp_id","sh_hotel_media_")->field("id")->where("media_id = $v and hotel_id= $hotel_id")->find();
// if($isExists){
// continue;
// }
//支持重新注入(注入失败需要重新注入)
$sqlUpdate = "update sh_hotel_media_map_$sp_id set status_inject=0 where media_id=$v and hotel_id=$hotel_id";
$uok = M("")->execute($sqlUpdate);
if ($uok){
continue;
$tmp = explode("_",$v);
$media_id=$tmp[0];
$media_code=$tmp[1];
$isExists = M("Map_$sp_id","sh_hotel_media_")->field("id")->where("media_id = $media_id and hotel_id= $hotel_id")->find();
$mapData['media_id'] = $v;
$mapData['media_code'] = "$media_code";
$mapData['hotel_id'] = $hotel_id;
$mapData['addtime'] = date('Y-m-d H:i:s');
if($isExists){
$mapData['id'] = $isExists['id'];
M("Map_$sp_id","sh_hotel_media_")->save($mapData);
}else{
M("Map_$sp_id","sh_hotel_media_")->add($mapData);
}
$logData['task_id'] = $task_id;
$logData['media_id'] = $v;
$logData['media_id'] = $media_id;
$logData['hotel_id'] = $hotel_id;
$logData['sp_id'] = $sp_id;
$logData['status'] = 1;
$mapData['media_id'] = $v;
$mapData['hotel_id'] = $hotel_id;
$mapData['addtime'] = date('Y-m-d H:i:s');
M("Map_$sp_id","sh_hotel_media_")->add($mapData);
if($logData){
$logDataLists[] = $logData;
}
......
......@@ -65,7 +65,7 @@ class PlayCtrlAction extends CommonAction{
$this->log_info = $log_info;
$this->info = $info;
}
$media_lists = $mediaModel->join(" A join sh_sp B on A.site_id = B.site_id ")->field("A.id,A.title,group_concat(B.id) sp_ids")->group(" A.id ")->select();
$media_lists = $mediaModel->join(" A join sh_sp B on A.site_id = B.site_id ")->field("concat(A.id,'_',A.code) id,A.title,group_concat(B.id) sp_ids")->group(" A.id ")->select();
if($userInfo['sp_ids']&&$userInfo['grade']>=3){
$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();
......@@ -121,26 +121,24 @@ class PlayCtrlAction extends CommonAction{
foreach($media_lists as $k => $v){
$logData = array();
$mapData = array();
$isExists = M("Map_$sp_id","sh_hotel_media_")->field("id")->where("media_id = $v and hotel_id= $hotel_id")->find();
$tmp = explode("_",$v);
$media_id=$tmp[0];
$media_code=$tmp[1];
$mapData['media_id'] = $media_id;
$mapData['media_code'] = "$media_code";;
$mapData['hotel_id'] = $hotel_id;
$mapData['status'] = I("status",1,int);
$isExists = M("Map_$sp_id","sh_hotel_media_")->field("id")->where("media_id = $media_id and hotel_id= $hotel_id")->find();
if($isExists){
$mapData['id'] = $isExists['id'];
$mapData['media_id'] = $v;
$mapData['hotel_id'] = $hotel_id;
$mapData['status'] = I("status",1,int);
$mapData['updatetime'] = date('Y-m-d H:i:s');
M("Map_$sp_id","sh_hotel_media_")->save($mapData);
}else{
$mapData['media_id'] = $v;
$mapData['hotel_id'] = $hotel_id;
$mapData['status'] = I("status",1,int);
$mapData['addtime'] = date('Y-m-d H:i:s');
M("Map_$sp_id","sh_hotel_media_")->add($mapData);
}
$logData['task_id'] = $task_id;
$logData['media_id'] = $v;
$logData['media_id'] = $media_id;
$logData['hotel_id'] = $hotel_id;
$logData['sp_id'] = $sp_id;
$logData['status'] = I("status",1,int);
......
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