Commit 5320a2ab authored by zw's avatar zw

banner管理

parent b0b96f66
...@@ -31,13 +31,27 @@ class Banner extends Basic ...@@ -31,13 +31,27 @@ class Banner extends Basic
*/ */
public function getBannerList() public function getBannerList()
{ {
$params = $this->params;
/*$params = array(
"site_area" => 1,//1表示c端 2表示b端
);*/
$where_ = [];
if(!isset($params["site_area"])){
return $this->response("101","请求参数错误");
}
if($params["site_area"] == 1){
$where_["type"] = array("in",[0,1]);
}else{
$where_["type"] = array("in",[2,3]);
}
$field = "id,title,CONCAT('".CK_IMG_URL."' , pic_path) as pic_path, url, type,sort,is_show,create_time,update_time"; $field = "id,title,CONCAT('".CK_IMG_URL."' , pic_path) as pic_path, url, type,sort,is_show,create_time,update_time";
$params['is_show'] = array( "eq", 0 ); $where_['is_show'] = array( "eq", 0 );
$result = $this->bannerModel $result = $this->bannerModel
->getBannerList(1, 15, "sort desc", $field, $params); ->getBannerList(1, 15, "sort desc", $field, $params);
// $jwt = new JwtUntils();
// $data['is_login'] = '0'; //0未登录
// $result['AuthToken'] = $jwt->createToken($data);
return $this->response("200", "request success", $result); return $this->response("200", "request success", $result);
} }
......
...@@ -48,15 +48,13 @@ class Banner extends Basic ...@@ -48,15 +48,13 @@ class Banner extends Basic
*/ */
public function getBannerList() public function getBannerList()
{ {
$field = "id,title,pic_path,url,sort,hits,is_show,up_user,create_time,update_time"; $field = "id,title,pic_path,url,sort,hits,is_show,type,up_user,create_time,update_time";
$params['is_show'] = array( "eq", 0 ); $params['is_show'] = array( "eq", 0 );
$params['type'] = array( "eq", 0 ); $params['type'] = array( "in", [ 0, 2 ] );
$pageNo = empty($_POST['pageNo']) ? 1 : $_POST['pageNo']; $pageNo = empty($_POST['pageNo']) ? 1 : $_POST['pageNo'];
$pageSize = empty($_POST['pageSize']) ? 15 : $_POST['pageSize']; $pageSize = empty($_POST['pageSize']) ? 15 : $_POST['pageSize'];
$result["list"] = $this->bannerModel $result["list"] = $this->bannerModel->getBannerList($pageNo, $pageSize, "sort desc", $field, $params);
->getBannerList($pageNo, $pageSize, "sort desc", $field, $params); $result["total"] = $this->bannerModel->getBannerTotal($params);
$result["total"] = $this->bannerModel
->getBannerTotal($params);
return $this->response("200", "request success", $result); return $this->response("200", "request success", $result);
} }
...@@ -66,9 +64,9 @@ class Banner extends Basic ...@@ -66,9 +64,9 @@ class Banner extends Basic
*/ */
public function getPopList() public function getPopList()
{ {
$field = "id,title,pic_path,url,sort,hits,is_show,up_user,create_time,update_time"; $field = "id,title,pic_path,url,sort,hits,is_show,type,up_user,create_time,update_time";
$params['is_show'] = array( "eq", 0 ); $params['is_show'] = array( "eq", 0 );
$params['type'] = array( "eq", 1 ); $params['type'] = array( "in", [ 1, 3 ] );
$pageNo = empty($_POST['pageNo']) ? 1 : $_POST['pageNo']; $pageNo = empty($_POST['pageNo']) ? 1 : $_POST['pageNo'];
$pageSize = empty($_POST['pageSize']) ? 15 : $_POST['pageSize']; $pageSize = empty($_POST['pageSize']) ? 15 : $_POST['pageSize'];
$result["list"] = $this->bannerModel $result["list"] = $this->bannerModel
...@@ -136,7 +134,7 @@ class Banner extends Basic ...@@ -136,7 +134,7 @@ class Banner extends Basic
public function upIsShow() public function upIsShow()
{ {
$params = array( $params = array(
"id" => $_POST["id"], "id" => $_POST["id"],
"is_show" => $_POST["is_show"] "is_show" => $_POST["is_show"]
); );
$result = $this->bannerModel->upIsShow($params); $result = $this->bannerModel->upIsShow($params);
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
<tr> <tr>
<th>标题</th> <th>标题</th>
<th>图片</th> <th>图片</th>
<th>显示</th>
<th>链接</th> <th>链接</th>
<th>排序</th> <th>排序</th>
<th>点击</th> <th>点击</th>
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
<tr> <tr>
<th>标题</th> <th>标题</th>
<th>图片</th> <th>图片</th>
<th>显示</th>
<th>链接</th> <th>链接</th>
<th>排序</th> <th>排序</th>
<th>点击</th> <th>点击</th>
......
...@@ -34,7 +34,18 @@ define (['doT', 'text!temp/banner_template_tpl.html', 'ckfinder', 'ckfinderStart ...@@ -34,7 +34,18 @@ define (['doT', 'text!temp/banner_template_tpl.html', 'ckfinder', 'ckfinderStart
params.url = $ ("#url").val (); params.url = $ ("#url").val ();
params.cover_image = $ ("#cover_image").val (); params.cover_image = $ ("#cover_image").val ();
params.sort = $ ("#sort").val (); params.sort = $ ("#sort").val ();
params.type = $("#type").val();
var banner_type = $("input[name=banner_type]:checked").val();
var page_type = $("#type").val();
if(page_type == 0 && banner_type == 0 ){
params.type = 0;
}else if(page_type == 0 && banner_type == 1 ){
params.type = 2;
}else if(page_type == 1 && banner_type == 0 ){
params.type = 1;
}else if(page_type == 1 && banner_type == 1 ){
params.type = 3;
}
if (!params.title || params.title == null) { if (!params.title || params.title == null) {
alert ("banner名称不能为空"); alert ("banner名称不能为空");
......
<script id="banner_list_tpl" type="text/template"> <script id="banner_list_tpl" type="text/template">
[% if( it ) { %] [% if( it ) { %]
[% for(var item in it){ %] [% for(var item in it){ %]
<tr > <tr>
<td>[%= it[item]["title"] %]</td> <td>[%= it[item]["title"] %]</td>
<td> <td>
<input type="hidden" value='[%= it[item]["pic_path"] %]'> <input type="hidden" value='[%= it[item]["pic_path"] %]'>
<img src='/resource/lib/Attachments/[%= it[item]["pic_path"] %]' class="diagram-image J_preview" <img src='/resource/lib/Attachments/[%= it[item]["pic_path"] %]' class="diagram-image J_preview"
data-bimg='/resource/lib/Attachments/[%= it[item]["pic_path"] %]' > data-bimg='/resource/lib/Attachments/[%= it[item]["pic_path"] %]'>
</td>
<td>
[% if( it[item]["type"]==0 || it[item]["type"]==1) { %]
用户app
[% }else{ %]
经纪人app
[% } %]
</td> </td>
<td>[%= it[item]["url"] %]</td> <td>[%= it[item]["url"] %]</td>
<td>[%= it[item]["sort"] %]</td> <td>[%= it[item]["sort"] %]</td>
<td>[%= it[item]["hits"] %]</td> <td>[%= it[item]["hits"] %]</td>
<td>[%= it[item]["up_user"] %]</td> <td>[%= it[item]["up_user"] %]</td>
<td> <td>
<a class="btn1 btn-success editor_banner " href="#modal-add-do" data-toggle="modal" data-id="[%= it[item]['id'] %]" > <a class="btn1 btn-success editor_banner " href="#modal-add-do" data-toggle="modal"
data-id="[%= it[item]['id'] %]">
编辑 编辑
</a> </a>
<a class="btn1 btn-danger delete_banner " href="#modal-delete" data-toggle="modal" data-id="[%= it[item]['id'] %]"> <a class="btn1 btn-danger delete_banner " href="#modal-delete" data-toggle="modal"
data-id="[%= it[item]['id'] %]">
删除 删除
</a> </a>
</td> </td>
...@@ -70,6 +80,19 @@ ...@@ -70,6 +80,19 @@
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form class="form-horizontal"> <form class="form-horizontal">
<div class="form-group">
<label class="col-sm-3 control-label">显示:</label>
<div class="col-sm-9">
<label>
<input type="radio" name="banner_type" value="0" checked>
用户端
</label>
<label>
<input type="radio" name="banner_type" value="1">
经纪人端
</label>
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">标题:</label> <label class="col-sm-3 control-label">标题:</label>
<div class="col-sm-9"> <div class="col-sm-9">
...@@ -81,13 +104,15 @@ ...@@ -81,13 +104,15 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">链接:</label> <label class="col-sm-3 control-label">链接:</label>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="text" class="form-control btn6" name="title" id="url" autocomplete="off" placeholder="请输入链接"> <input type="text" class="form-control btn6" name="title" id="url" autocomplete="off"
placeholder="请输入链接">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">图片:</label> <label class="col-sm-3 control-label">图片:</label>
<div class="col-sm-9"> <div class="col-sm-9">
<input readonly="readonly" type="text" name="cover_image" class="form-control" style="width: 150px !important;display: inline-block" <input readonly="readonly" type="text" name="cover_image" class="form-control"
style="width: 150px !important;display: inline-block"
id="cover_image" class="require" placeholder="请选择图片"/> id="cover_image" class="require" placeholder="请选择图片"/>
<button class="banner_img btn btn-default" type="button">选择图片</button> <button class="banner_img btn btn-default" type="button">选择图片</button>
<span class="tip">建议尺寸288x320</span> <span class="tip">建议尺寸288x320</span>
...@@ -96,7 +121,8 @@ ...@@ -96,7 +121,8 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">排序:</label> <label class="col-sm-3 control-label">排序:</label>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="text" class="form-control btn6" name="title" id="sort" autocomplete="off" placeholder="请输入排序"> <input type="text" class="form-control btn6" name="title" id="sort" autocomplete="off"
placeholder="请输入排序">
</div> </div>
</div> </div>
</form> </form>
......
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