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

1.云端片库表按合作方分表,一个合作方一个表,创建合作方时自动创建相应表 ok

2.云端片库查询条件增加合作方列表用于过滤查询数据 ok
parent 47c3829b
...@@ -4,20 +4,28 @@ class CloudAction extends CommonAction{ ...@@ -4,20 +4,28 @@ class CloudAction 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("Media"); $model = D("Media");
$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);
$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"); $spModel = D("Sp");
$hotel_lists = $hotelModel->where("`status`=0")->select(); if($userInfo['sp_ids']&&$userInfo['grade']>=3){
$this->hotel_lists = $hotel_lists; $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();
}
$this->sp_lists = $sp_lists;
$this->display(); $this->display();
} }
$spModel = D("Sp");
$sp_lists = $spModel->where("`status`=0")->select();
$this->sp_lists = $sp_lists;
} }
//添加 //添加
......
...@@ -89,25 +89,33 @@ class SpAction extends CommonAction{ ...@@ -89,25 +89,33 @@ class SpAction extends CommonAction{
$confModel->addAll($confData); $confModel->addAll($confData);
} }
if($id){ if($id){
//创建合作方酒店片库表
$csql = "CREATE TABLE sh_hotel_media_map_$id LIKE sh_hotel_media_map;";
D("")->execute($csql);
//创建合作方云端片库表
$csql = "CREATE TABLE sh_media_wasu_$id LIKE sh_media_wasu;";
D("")->execute($csql);
echo 'true'; echo 'true';
}else{ }else{
echo 'false'; echo 'false';
} }
} }
//sh_hotel_media_map 生成表 格式 sh_hotel_media_map_合作方ID //sh_hotel_media_map 生成表 格式 sh_hotel_media_map_合作方ID
$create_table_sql = <<<EOF //$create_table_sql = <<<EOF
CREATE TABLE IF NOT EXISTS `sh_hotel_media_map_$id` ( // CREATE TABLE IF NOT EXISTS `sh_hotel_media_map_$id` (
`id` int(11) NOT NULL AUTO_INCREMENT, //`id` int(11) NOT NULL AUTO_INCREMENT,
`media_id` int(11) NOT NULL DEFAULT '0' COMMENT '媒资id', //`media_id` int(11) NOT NULL DEFAULT '0' COMMENT '媒资id',
`hotel_id` int(11) NOT NULL DEFAULT '0' COMMENT '酒店id', //`hotel_id` int(11) NOT NULL DEFAULT '0' COMMENT '酒店id',
`status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '播控状态:0删除,1上线,2下线', //`status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '播控状态:0删除,1上线,2下线',
`status_inject` tinyint(4) NOT NULL DEFAULT '0' COMMENT '注入状态:0未注入,1已注入,2注入失败', //`status_inject` tinyint(4) NOT NULL DEFAULT '0' COMMENT '注入状态:0未注入,1已注入,2注入失败',
`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, //`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updatetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, //`updatetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`) //PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='酒店片库映射表' //) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='酒店片库映射表'
EOF; //EOF;
$model->query($create_table_sql); // $model->query($create_table_sql);
} }
//删除处理 //删除处理
......
...@@ -27,7 +27,7 @@ class MediaModel extends RelationModel{ ...@@ -27,7 +27,7 @@ class MediaModel extends RelationModel{
$where .= $sort." ".$limit; $where .= $sort." ".$limit;
$fields = " *,case `status` when 1 then '<font color=green>上线</font>' when 2 then '<font color=red>下线</font>' when 0 then '<font>未知</font>' end as `status` "; $fields = " *,case `status` when 1 then '<font color=green>上线</font>' when 2 then '<font color=red>下线</font>' when 0 then '<font>未知</font>' end as `status` ";
} }
$sql = "select ".$fields." from sh_media_wasu where 1=1 ".$where.";"; $sql = "select ".$fields." from sh_media_wasu_$searchSp where 1=1 ".$where.";";
// echo $sql; // echo $sql;
return $model->query($sql); return $model->query($sql);
} }
......
...@@ -24,6 +24,11 @@ ...@@ -24,6 +24,11 @@
<form name="searchform" method="post" action="" id ="searchform"> <form name="searchform" method="post" action="" id ="searchform">
<input type="hidden" name="op" value="getjson"> <input type="hidden" name="op" value="getjson">
<div class="inputBox"> <div class="inputBox">
<select class="select" name="searchSp">
<volist name="sp_lists" id="item">
<option value="{$item.id}" <if condition="$key eq 0">selected="selected"</if> >{$item.name}</option>
</volist>
</select>
<input class="input" type="text" placeholder="媒资名称/媒资唯一标识" name="searchValue"> <input class="input" type="text" placeholder="媒资名称/媒资唯一标识" name="searchValue">
</div> </div>
<input id="submit_search" name="" type="button" value="查询" class="btn_go_s btn_orange" /> <input id="submit_search" name="" type="button" value="查询" class="btn_go_s btn_orange" />
......
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