Commit 16442262 authored by hujun's avatar hujun

楼盘标签列表

parent cd2ad586
<?php
/**
* Created by PhpStorm.
* User: fuju
* Date: 2018/2/6
* Time: 15:03
*/
namespace app\index\controller;
use app\index\extend\Basic;
use app\model\FollowUp;
use app\model\GLabels;
use app\model\ULabels;
use app\model\UPhoneFollowUp;
use app\model\UPhoneFollowUpTemporary;
use think\Session;
class OfficeGLabel extends Basic
{
/**
* 添加标签
* @return \think\Response|\think\response\View
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function index(){
$result['code'] = 200;
$result['msg'] = '';
$labels = new GLabels();
if ($this->request->isPost()) {
if ($this->params['name']) {
$data['name'] = $this->params['name'];
$data['operation_id'] = Session::get('userId');
$data['type'] = $this->params['type'];
if ($this->params['id']) {
$result['data'] = $labels->save($data, ['id'=>$this->params['id']]);
} else {
$result['data'] = $labels->save($data);
}
} else {
$result['code'] = 101;
$result['msg'] = 'name is null';
}
$return = $this->response($result['code'], $result['msg'], $result['data']);
} else {
if ($this->params['id']) {
$result['data'] = $labels->where('id',$this->params['id'])->find();
$return = $this->response($result['code'], $result['msg'], $result['data']);
} else {
//标签页面
$return = view('index');
}
}
return $return;
}
/**
* 楼盘标签
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getLabelsList() {
$result['code'] = 200;
$result['msg'] = '';
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$labels = new GLabels();
$field = 'id,name,create_time';
$where['type'] = 0;
$result['data']['list'] = $labels->getList($pageNo, $pageSize, 'id DESC', $field, $where);
$result['data']['total'] = $labels->getTotal($where);
return $this->response($result['code'], $result['msg'], $result['data']);
}
//*****************************************************************************************用户标签
/**用户添加编辑
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function updateULabel(){
$group_id = $this->request->param('id');
$table= new ULabels();
if ($this->request->isPost()) {
$data = input('post.');
$data['operation_id'] = Session::get("user_info.id");//操作人id
if($table->repetition('name',$data['name'])&& empty($data['id'])){
return $this->response(100, 'url存在重复值');
}
//新增或者编辑数据
if(empty($data['id'])){
$id = '';
}else{
$id = $data['id'];
}
$data['free'] = $this->params['free'];
//新增或者编辑数据
if ($table->editData($data,$id)) {
return $this->response(200, '成功');
} else {
return $this->response(100, '无修改');
}
} else {
$where = "id = {$group_id}";
$info = $table->uleList($where);
return $this->response(200, '成功', $info[0]);
}
}
/**
* 用户标签
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getULabelsList() {
if ($this->request->isAjax()) {
$result['code'] = 200;
$result['msg'] = '';
//获取当前模块可操作按钮start********************************
$userRule = Session::get('userRule');
// $result['data']['cz']=$userRule['cz'];
$result['data']['cz']=1;
//获取当前模块可操作按钮end**********************************
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
$labels = New ULabels;
$field = 'id,name,create_time,free';
$where['type'] = 1;
$result['data']['list'] = $labels->getList($pageNo, $pageSize, 'id DESC', $field, $where);
$result['data']['total'] = $labels->getTotal($where);
return $this->response($result['code'], $result['msg'], $result['data']);
} else {
return view('u_label_index');
}
}
/**
* 获取用户上一次跟进状态
*
* @return \think\Response
*/
public function getUserLabel() {
if (empty($this->params['user_id'])) {
return $this->response(101, '没有用户信息');
}
$follow_temp = new UPhoneFollowUpTemporary($this->siteId);
$user_status = $follow_temp->getUserFollowKey('user_status', ['user_id'=>$this->params['user_id']], 'id DESC');
if (empty($user_status)) {
$follow = new UPhoneFollowUp($this->siteId);
$user_status = $follow->getUserFollowKey('user_status', ['user_id'=>$this->params['user_id']], 'id DESC');
}
return $this->response(200, '', $user_status);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: fuju
* Date: 2018/2/6
* Time: 15:03
*/
namespace app\index\controller;
use app\index\extend\Basic;
use app\model\FollowUp;
use app\model\GLabels;
use app\model\ULabels;
use app\model\UPhoneFollowUp;
use app\model\UPhoneFollowUpTemporary;
use think\Session;
class OfficeLabel extends Basic
{
/**
* 添加标签
* @return \think\Response|\think\response\View
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function index(){
$result['code'] = 200;
$result['msg'] = '';
$labels = new GLabels();
if ($this->request->isPost()) {
if ($this->params['name']) {
$data['name'] = $this->params['name'];
$data['operation_id'] = Session::get('userId');
$data['type'] = $this->params['type'];
if ($this->params['id']) {
$result['data'] = $labels->save($data, ['id'=>$this->params['id']]);
} else {
$result['data'] = $labels->save($data);
}
} else {
$result['code'] = 101;
$result['msg'] = 'name is null';
}
$return = $this->response($result['code'], $result['msg'], $result['data']);
} else {
if ($this->params['id']) {
$result['data'] = $labels->where('id',$this->params['id'])->find();
$return = $this->response($result['code'], $result['msg'], $result['data']);
} else {
//标签页面
$return = view('index');
}
}
return $return;
}
/**
* 楼盘标签
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getLabelsList() {
$result['code'] = 200;
$result['msg'] = '';
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$labels = new GLabels();
$field = 'id,name,create_time';
$where['type'] = 0;
$result['data']['list'] = $labels->getList($pageNo, $pageSize, 'id DESC', $field, $where);
$result['data']['total'] = $labels->getTotal($where);
return $this->response($result['code'], $result['msg'], $result['data']);
}
//*****************************************************************************************用户标签
/**用户添加编辑
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function updateULabel(){
$group_id = $this->request->param('id');
$table= new ULabels();
if ($this->request->isPost()) {
$data = input('post.');
$data['operation_id'] = Session::get("user_info.id");//操作人id
if($table->repetition('name',$data['name'])&& empty($data['id'])){
return $this->response(100, 'url存在重复值');
}
//新增或者编辑数据
if(empty($data['id'])){
$id = '';
}else{
$id = $data['id'];
}
$data['free'] = $this->params['free'];
//新增或者编辑数据
if ($table->editData($data,$id)) {
return $this->response(200, '成功');
} else {
return $this->response(100, '无修改');
}
} else {
$where = "id = {$group_id}";
$info = $table->uleList($where);
return $this->response(200, '成功', $info[0]);
}
}
/**
* 用户标签
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getULabelsList() {
if ($this->request->isAjax()) {
$result['code'] = 200;
$result['msg'] = '';
//获取当前模块可操作按钮start********************************
$userRule = Session::get('userRule');
// $result['data']['cz']=$userRule['cz'];
$result['data']['cz']=1;
//获取当前模块可操作按钮end**********************************
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
$labels = New ULabels;
$field = 'id,name,create_time,free';
$where['type'] = 1;
$result['data']['list'] = $labels->getList($pageNo, $pageSize, 'id DESC', $field, $where);
$result['data']['total'] = $labels->getTotal($where);
return $this->response($result['code'], $result['msg'], $result['data']);
} else {
return view('u_label_index');
}
}
/**
* 获取用户上一次跟进状态
*
* @return \think\Response
*/
public function getUserLabel() {
if (empty($this->params['user_id'])) {
return $this->response(101, '没有用户信息');
}
$follow_temp = new UPhoneFollowUpTemporary($this->siteId);
$user_status = $follow_temp->getUserFollowKey('user_status', ['user_id'=>$this->params['user_id']], 'id DESC');
if (empty($user_status)) {
$follow = new UPhoneFollowUp($this->siteId);
$user_status = $follow->getUserFollowKey('user_status', ['user_id'=>$this->params['user_id']], 'id DESC');
}
return $this->response(200, '', $user_status);
}
}
\ No newline at end of file
......@@ -93,6 +93,7 @@ class Basic extends Controller
'index/baiduText',
'index/getBroker_new',
'index/dailyBackImg',
'office_index/getLabelsList',
);
/**
......
......@@ -988,6 +988,7 @@ Route::group('office_index', [
'delBuilding' => ['index/OfficeManage/delBuilding', ['method' => 'GET']],//删除楼盘
'getRoomList' => ['index/OfficeRoom/getRoomList', ['method' => 'GET']],//删除楼盘
'getList' => ['index/Station/getList', ['method' => 'GET']],//城市地铁
'getLabelsList' => ['index/OfficeLabel/getLabelsList', ['method' => 'get']], //楼盘标签列表
]);
//Route::miss('api/index/miss');//处理错误的url
\ No newline at end of file
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