Commit ac20abc1 authored by zfc's avatar zfc Committed by hujun

客户标签列表

parent 53a8dafe
......@@ -47,7 +47,7 @@ class Client extends Basic
if ($this->params['id']) {
//编辑
$data['start'] = $this->user->edit($this->params, $this->params['id']);
$this->operating_records($this->params['agents_id'], $type=3, $remark='用户编辑',0,$this->params['id']);
$this->operating_records($this->params['ccr_id'], $type=3, $remark='用户编辑',0,$this->params['id']);
} else {
//添加
$data['start'] = $this->user->edit($this->params);
......@@ -58,8 +58,7 @@ class Client extends Basic
if($data['start']==1){
$data['id']= $this->user->id;
$this->operating_records($this->params['agents_id'], $type=3, $remark='用户添加',0,$data['id']);
$this->operating_records($this->params['ccr_id'], $type=3, $remark='用户添加',0,$data['id']);
}else{
$this->code = 101;
$this->msg = '提交重复!';
......
......@@ -37,13 +37,17 @@ class Basic extends Controller
protected $agentPhone;
protected $timeStamp_;
protected $filterVerify = array(
'broker/login'
);
/**
* 基础接口SDK
* @param Request|null $request
*/
/**
* Basic constructor.
* @param Request|null $request
*/
public function __construct(Request $request = null)
{
// CORS 跨域 Options 检测响应
......@@ -56,21 +60,21 @@ class Basic extends Controller
} elseif (strtoupper($this->request->method()) === "POST") {
$this->params = $this->request->param() != null ? $this->request->param() : null;
}
/* if (isset($this->params['AuthToken']) && $this->params['AuthToken'] != 'null' && !empty($this->params['AuthToken'])) {
$jwt = new \Firebase\JWT\JWT();
$this->authToken = $this->params['AuthToken'];
$result = $jwt->decode($this->authToken, config('jwt_key'), array( 'HS256' )); //解码token
$this->userId = $result->data->id;
$this->phone = $result->data->phone;
$this->userNick = $result->data->userNick;
$this->timeStamp_ = $result->timeStamp_;
}
$requestPath = $this->request->routeInfo()["rule"][0] . "/" . $this->request->routeInfo()["rule"][1];
//过滤掉不需要验证token的接口
if (!in_array(trim($requestPath), $this->filterVerify)) {
$this->tokenVerify();
}*/
// if (isset($this->params['AuthToken']) && $this->params['AuthToken'] != 'null' && !empty($this->params['AuthToken'])) {
// $jwt = new \Firebase\JWT\JWT();
// $this->authToken = $this->params['AuthToken'];
// $result = $jwt->decode($this->authToken, config('jwt_key'), array( 'HS256' )); //解码token
// $this->agentId = $result->data->id;
// $this->agentPhone = $result->data->phone;
// $this->agentName = $result->data->userNick;
// $this->timeStamp_ = $result->timeStamp_;
// }
//
// $requestPath = $this->request->routeInfo()["rule"][0] . "/" . $this->request->routeInfo()["rule"][1];
// //过滤掉不需要验证token的接口
// if (!in_array(trim($requestPath), $this->filterVerify)) {
// $this->tokenVerify();
// }
}
......
......@@ -45,6 +45,9 @@ class Auth extends Basic
/**
* 角色列表接口
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAuth() {
$data['status'] = 200;
......
......@@ -11,6 +11,7 @@ namespace app\index\controller;
use app\index\extend\Basic;
use app\model\GLabels;
use app\model\ULabels;
use think\Session;
class Label extends Basic
......@@ -18,8 +19,10 @@ class Label 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;
......@@ -53,6 +56,13 @@ class Label extends Basic
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'] = '';
......@@ -66,4 +76,79 @@ class Label extends Basic
return $this->response($result['code'], $result['msg'], $result['data']);
}
//*****************************************************************************************用户标签
//用户标签页面
public function uLabelIndex(){
return view('u_label_index');
}
/**用户添加编辑
* @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.');
if($table->repetition('name',$data['name'])&& empty($data['id'])){
return $this->response(100, 'url存在重复值');
}
//新增或者编辑数据
if(empty($data['id'])){
$data['create_time']= date( 'Y-m-d H:i:s',time());
$data['update_time']= date( 'Y-m-d H:i:s',time());
$id='';
}else{
$data['update_time']= date( 'Y-m-d H:i:s',time());
$id=$data['id'];
}
//新增或者编辑数据
//prt($data)
if ($table->editData($data,$id)) {
return $this->response(200, '成功');
} else {
return $this->response(100, '无修改');
}
} else {
$where="id={$group_id}";
$info= $table->uleList($where);
//echo $table->getLastSql();
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() {
$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']);
}
}
\ No newline at end of file
......@@ -30,9 +30,11 @@ class GOperatingRecords extends BaseModel
if ($agents_id>0) {
$request = Request::instance();
$name = Session::get('userName');
if ($name) {
$name = db('a_agents')->where('id',$agents_id)->value('name');
if (empty($name)) {
$name = db('agents')->where('id', $agents_id)->value('realname');
}
$data = [
'agents_id' => $agents_id,
'name' => $name,
......
<?php
namespace app\model;
class ULabels extends BaseModel
{
/**
* @param $where
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function uleList($where)
{
return $this->where($where)->select();
}
/**检查重复
* @param $name
* @param $key
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function repetition($name,$key){
$r=$this->field($name)
->where($name,'=',$key)
->select();
//$this->getLastSql();
if($r){
return true;
}else{
return false;
}
}
}
......@@ -157,7 +157,10 @@ class Users extends Model
*/
public function edit($data, $id = 0) {
$insert_data['user_nick'] = $data['user_nick'];
$insert_data['user_phone'] = $data['user_phone'];
if($data['user_phone']){
$insert_data['user_phone'] = $data['user_phone'];
}
$insert_data['sex'] = $data['sex'];
if ($id) {
......
......@@ -107,6 +107,10 @@ Route::group('index', [
'updateStatus'=>['index/agent/updateStatus', ['method' => 'post']], //状态修改【接口】
'updateRole'=>['index/agent/updateRole', ['method' => 'post']], //经纪人角色修改【接口】
//客户标签
'uLabelIndex'=>['index/label/uLabelIndex',['method' => 'get']], //客户标签界面
'getULabelsList'=>['index/label/getULabelsList',['method' => 'get']], //客户标签列表接口
'updateULabel'=>['index/label/updateULabel',['method' => 'post|get']], //编辑添加客户标签
//商圈
'BusinessDistrict' => ['index/BusinessDistrict/index', ['method' => 'get']], //商圈列表
......
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