Commit 96cd1b8e authored by hujun's avatar hujun

公告

parent cf1e5ece
......@@ -25,24 +25,33 @@ class Feed extends Basic
public function feedList() {
$push = new PushFeed();
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$field = 'id,house_id,title,content,link,house_title,create_time';
$where = [];
$where['status'] = 0;
// if (!empty($this->agentId)) {
// $where[0] = ['EXP','find_in_set('.$this->agentId.',agent_id) or agent_id = -1'];
// }
$data = $push->getList($pageNo, $pageSize, 'id DESC', $field, $where);
foreach ($data as $k => $v) {
$data[$k]['icon'] = CURRENT_URL . "resource/image/notice_xibaotl.png";
$data[$k]['content'] = "恭喜{$v['content']}成交{$v['house_title']}商铺一套";
$field = 'id,house_id,title,content,link,house_title,create_time,type';
if (isset($this->params['home']) && $this->params['home'] == 1) {
//首页
$where_0['status'] = 0;
$where_0['type'] = 1;
$where_1['status'] = 0;
$where_1['type'] = 0;
$data[0] = $push->getList(1, 1, 'id DESC', $field, $where_0);
$data[1] = $push->getList(1, 1, 'id DESC', $field, $where_1);
} else {
//列表页
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$where = [];
$where['status'] = 0;
$data = $push->getList($pageNo, $pageSize, 'id DESC', $field, $where);
foreach ($data as $k => $v) {
if ($v['type'] == 0) {
$data[$k]['icon'] = CURRENT_URL . "resource/image/notice_xibaotl.png";
$data[$k]['content'] = "恭喜{$v['content']}成交{$v['house_title']}商铺一套";
}
}
}
return $this->response(200, "", $data);
}
......@@ -106,13 +115,23 @@ class Feed extends Basic
return $this->response(101, "Id is null!");
}
if (empty($this->params['type'])) {
$where['type'] = 0;
} else {
$where['type'] = 1;
}
$where['id'] = $this->params['id'];
$where['status'] = 0;
$data = $push->getFeedInfo($field, $where);
if ($data['type'] == 0) {
if ($this->params['type'] == 0) {
$data['type_string'] = '成功下定';
}
if ($data['type'] == 1) {
$data['type_string'] = '公告';
}
return $this->response(200, "", $data);
}
}
\ No newline at end of file
......@@ -81,7 +81,7 @@ class Finance extends Basic
}
if (!empty($this->params['end_time']) && empty($this->params['create_time'])) {
$where['a.create_time'] = [ '< time', $this->params['create_time'] . ' 23:59:59' ];
$where['a.create_time'] = [ '< time', $this->params['end_time'] . ' 23:59:59' ];
}
if (!empty($this->params['end_time']) && !empty($this->params['create_time'])) {
......
......@@ -10,11 +10,122 @@ namespace app\index\controller;
use app\index\extend\Basic;
use app\model\PushFeed;
use think\Request;
class Notice extends Basic
{
protected $m_push;
public function __construct(Request $request = null)
{
parent::__construct($request);
$this->m_push = new PushFeed();
}
/**
* 公告
*
* @return \think\Response|\think\response\View
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function index() {
return view('index');
if (!$this->request->isAjax()) {
return view('index');
}
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
if (!empty($this->params['start_time']) && empty($this->params['end_time'])) {
$where['create_time'] = [ '> time', $this->params['start_time'] . ' 00:00:00' ];
}
if (!empty($this->params['end_time']) && empty($this->params['start_time'])) {
$where['create_time'] = [ '< time', $this->params['end_time'] . ' 23:59:59' ];
}
if (!empty($this->params['end_time']) && !empty($this->params['start_time'])) {
$where['create_time'] = [ 'between time', [ $this->params['start_time'] . ' 00:00:00', $this->params['end_time'] . ' 23:59:59' ] ];
}
if (!empty($this->params['title'])) {
$where['title'] = ['LIKE', '%' . $this->params['title'] . '%'];
}
$field = 'id,title,content,create_time';
$where['status'] = 0;
$where['type'] = 1;
$data['list'] = $this->m_push->getList($pageNo, $pageSize, 'id DESC', $field, $where);
$data['total'] = $this->m_push->getTotal($where);
return $this->response(200, "", $data);
}
/**
* 新增公告
*
* @return \think\Response
*/
public function addNotice() {
if (!empty($this->params['title'])) {
return $this->response(101, '标题为空!');
}
if (!empty($this->params['content'])) {
return $this->response(101, '内容为空!');
}
$data['title'] = trim($this->params['title']);
$data['content'] = trim($this->params['content']);
$data['publisher_id'] = $this->userId;
$data['agent_id'] = -1;
$data['steel_phone'] = 0;
$num = $this->m_push->editData($data);
if ($num > 0) {
return $this->response(101, '内容为空!');
}
return $this->response(200, '新增成功!');
}
/**
* 公告详情
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getNoticeInfo() {
if (empty($this->params['id'])) {
return $this->response(101, "Id is null.");
}
$data = $this->m_push->getFeedInfo('id,content,title');
return $this->response(200, "", $data);
}
/**
* 删除状态
*
* @return \think\Response
*/
public function delNotice() {
if (empty($this->params['id'])) {
return $this->response(101, "Id is null.");
}
$num = $this->m_push->editData(['status'=> 1], $this->params['id']);
if ($num > 0) {
return $this->response(200);
} else {
return $this->response(101, "删除失败!");
}
}
}
\ No newline at end of file
......@@ -237,20 +237,15 @@ Route::group('index', [
'getTaxesById' => [ 'index/Finance/getTaxesById', [ 'method' => 'POST|GET' ] ], //财务结单
'financeUpdateLog' => [ 'index/Finance/financeUpdateLog', [ 'method' => 'POST|GET' ] ], //财务结单
'noticeIndex' => [ 'index/notice/index', [ 'method' => 'GET' ] ], //财务结单
'noticeIndex' => [ 'index/notice/index', [ 'method' => 'GET' ] ], //公告列表
'getNoticeInfo' => [ 'index/notice/getNoticeInfo', [ 'method' => 'GET' ] ], //公告详情
'delNotice' => [ 'index/notice/delNotice', [ 'method' => 'POST' ] ], //删除公告
'addNotice' => [ 'index/notice/addNotice', [ 'method' => 'POST' ] ], //新增公告
'test' => ['index/WxTest/test', [ 'method' => 'POST|GET' ] ], //wx
'evaluationList' => [ 'index/Evaluation/evaluationList', [ 'method' => 'POST|GET' ] ], //评价列表 朱伟 2018-06-13
'marchInList' => [ 'index/MarchIn/marchInList', [ 'method' => 'POST|GET' ] ], //进场记录列表 朱伟 2018-06-13
]);
......
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