Commit 9a69d1e8 authored by hujun's avatar hujun

删除弃用接口

parent 302d549c
......@@ -13,7 +13,6 @@ namespace app\chat\service;
use app\chat\utils\RegisterUtil;
use app\chat\utils\RPush;
use app\model\AAgents;
use app\model\Agents;
use app\model\ChatMsg;
use app\model\ChatMsgExt;
use app\model\ChatMsgStatus;
......
......@@ -10,17 +10,14 @@ namespace app\index\controller;
use app\api_broker\service\CallPhoneService;
use app\api_broker\service\ClientService;
use app\api_broker\service\UserExpiredTimeService;
use app\index\extend\Basic;
use app\index\service\UserService;
use app\model\AAgents;
use app\model\Agents;
use app\model\GOperatingRecords;
use app\model\Remarks;
use app\model\ULabels;
use app\model\UPhoneFollowPp;
use app\model\Users;
use think\Session;
class Remark extends Basic
{
......@@ -304,19 +301,6 @@ class Remark extends Basic
);
}
/**
* 客方搜索
*
* @return \think\Response
*/
public function select_by_phone()
{
$phone = trim($this->params['phone']);
$table = new Agents();
$Agents_res = $table->select_by_phone($phone);
return $this->response("200", "success!", $Agents_res);
}
/**
* 电话跟进列表
*/
......
<?php
namespace app\model;
use think\Model;
use think\Db;
class Agents extends Model
{
protected $table = 'agents';
/**
* 查询经纪人
*
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param $field
* @param $params
* @param string $house_id
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getUser($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params, $house_id = '')
{
if ($house_id == '') {
$data = $this->field($field)->alias('a')
->join('u_evaluate b', 'a.id = b.agents_id', 'left')
->where($params)
->where('level=2 or level=5')
->group('a.id')
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
} else {
$data = $this->field($field)->alias('a')
->join('u_evaluate b', 'a.id = b.agents_id', 'left')
->where('find_in_set(' . $house_id . ', house_ids) or find_in_set(' . $house_id . ', house_ids2)')
->where($params)
->where('level=2 or level=5')
->group('a.id')
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
}
return $data;
}
/**
* 记录总数
*
* @param $params
* @return int|string
*/
public function getTotal2($join,$params)
{
return $this->alias('a')
->join($join)
->where($params)->count();
}
/**分页列表
* @param int $p
* @param int $pageSize
* @param string $order_
* @param string $field
* @param string $join
* @param string $where
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getListJoin($p = 1, $pageSize = 15, $order_ = 'id desc', $field = '',$join='', $where = '')
{
$data = $this->field($field)
->alias('a')
->join($join)
->where($where)
->order($order_)
->limit($pageSize)
->page($p)
->select();
//echo $this->getLastSql();
return $data;
}
/**
* 经纪人详情
* @param $id
* @return array|bool|false|\PDOStatement|string|Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function agentsDetail($id)
{
if ($id) {
$result = $this->field('id,realname,created,sub_shopname,head_portrait')
->where('level=2 or level=5')
->where('id', $id)->find();
$result['head_portrait'] = 'user_header/' . $result['head_portrait']; //头像
$evaluate_grade = Db::table('u_evaluate')
->field('sum(evaluate_grade) as evaluate_grade, count(*) as evaluate_num')
->where('agents_id', $id)->where('is_show', 0)->find();
if ($evaluate_grade['evaluate_grade']) {
$grade = floor(($evaluate_grade['evaluate_grade'] / 2) / $evaluate_grade['evaluate_num']);
} else {
$grade = 0;
}
$result['evaluate_grade'] = $grade; //评分等级
$result['evaluate_num'] = $evaluate_grade['evaluate_num']; //评论数量
$result['watch_shop'] = Db::table('u_appoint_watch_shop')
->where('agents_id', $id)->count(); //看铺
$result['head_portrait'] = ADMIN_URL_TL.$result['head_portrait'];
$remarks = new Remarks();
$fields = 'id';
$where['shopuser_id'] = $id;
$where['transaction_status'] = 3;
$Journal_num = $remarks->getJournalHouseInfoId($fields, $where);
$result['JournalAccounts'] = count($Journal_num); //成交记录
$current_time = time();
$user_time = strtotime($result['created']);
$year = date('Y', $current_time) - date('Y', $user_time);
//入职年限
if ($year == 0) {
$result['created'] = $year . '个月以上';
} else {
$result['created'] = $year . '年以上';
}
$result['label'] = array( 0 => '待定标签数据', 1 => '待定标签数据' );
$data = $result;
} else {
$data = false;
}
return $data;
}
/**
* 获取经纪人 by zw
* @param $field
* @param $where_
* @return array|false|\PDOStatement|string|Model
*/
public function getAgentsById($field, $where_)
{
$data = $this
->field($field)
->where($where_)
->select();
return $data;
}
/**
* 查询经纪人列表
*
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param $field
* @param $params
* @param string $house_id
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAgents($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params, $house_id = '')
{
if ($house_id == '') {
$data = $this->field($field)
->where($params)
->where('level=2 or level=5')
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
} else {
$data = $this->field($field)
->where('find_in_set(' . $house_id . ', house_ids) or find_in_set(' . $house_id . ', house_ids2)')
->where($params)
->where('level=2 or level=5')
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
}
return $data;
}
/**
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param $field
* @param string $where
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function searchList($pageNo=1, $pageSize=15,$order_='id desc',$field, $where=''){
$r =$this->field($field)
->where($where)
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
return $r;
}
/**
* @param $params
* @return int|string
*/
public function searchTotal($params)
{
return $this->where($params)->count();
}
public function Agents_res($agent_id)
{
return db('agents')
->where('id', $agent_id)
->field('realname,phone,head_portrait,agentshopname')
->find();
}
/**
* 返回经纪人和部门信息
*
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getInfo($phone) {
$agents_data = $this->where([
'phone' => $phone,
'inuse' => 1,
'level' => ['in','2,5']
])->find();
if (!empty($agents_data->store_id)) {
$store_name = Db::table('a_store')->where('id',$agents_data['store_id'])->value('store_name');
$agents_data['department'] = $store_name;
}
if (!empty($agents_data->auth_group_id)) {
$district_name = Db::table('a_district')->where('id',$agents_data['district_id'])->value('district_name');
$agents_data['department'] = $agents_data['department'] ? $district_name.'-'.$store_name : $district_name;
}
$agents_data['commission'] = 500;
switch ($agents_data['level']) {
case 10 :
$agents_data['level_name'] = '业务员';break;
case 20 :
$agents_data['level_name'] = '店长';break;
case 30 :
$agents_data['level_name'] = '总监';break;
case 40 :
$agents_data['level_name'] = '总监';break;
}
return $agents_data;
}
public function select_by_phone($phone) {
$agents = db('agents')
->where('phone','like','%'.$phone.'%')
->where('level', 'in',[2,5])
->field('id,realname,agentshopname,phone')
->limit(10)
->page(1)
->select();
return $agents;
}
}
......@@ -94,8 +94,8 @@ define(['doT', 'text!temp/carry_out_template_tpl.html', 'css!style/home.css', 'c
},
search_phone2:function(){//手机号
$.ajax ({
url: '/index/select_by_phone',
type: 'POST',
url: '/index/getBroker_new',
type: 'GET',
async: true,
data: {
"phone":$("#cus_fang").val()
......@@ -105,7 +105,7 @@ define(['doT', 'text!temp/carry_out_template_tpl.html', 'css!style/home.css', 'c
if (data.code == 200) {
var user_ul2 = "";
$.each(data.data, function(i,item) {
user_ul2+='<li class="addphone2" data-id="'+item.id+'">'+item.id+'-'+item.realname+'-'+item.phone+'</li>';
user_ul2+='<li class="addphone2" data-id="'+item.id+'">'+item.id+'-'+item.name+'-'+item.phone+'</li>';
});
$(".user-ul2").html(user_ul2);
......
......@@ -91,8 +91,8 @@ define(['doT', 'text!temp/evaluation_list_template_tpl.html', 'css!style/home.cs
},
search_phone2:function(){//手机号
$.ajax ({
url: '/index/select_by_phone',
type: 'POST',
url: '/index/getBroker_new',
type: 'GET',
async: true,
data: {
"phone":$("#cus_fang").val()
......@@ -102,7 +102,7 @@ define(['doT', 'text!temp/evaluation_list_template_tpl.html', 'css!style/home.cs
if (data.code == 200) {
var user_ul2 = "";
$.each(data.data, function(i,item) {
user_ul2+='<li class="addphone2" data-id="'+item.id+'">'+item.id+'-'+item.realname+'-'+item.phone+'</li>';
user_ul2+='<li class="addphone2" data-id="'+item.id+'">'+item.id+'-'+item.name+'-'+item.phone+'</li>';
});
$(".user-ul2").html(user_ul2);
......
......@@ -92,8 +92,8 @@
},
search_phone2:function(){//手机号
$.ajax ({
url: '/index/select_by_phone',
type: 'POST',
url: '/index/getBroker_new',
type: 'GET',
async: true,
data: {
"phone":$("#cus_fang").val()
......@@ -103,7 +103,7 @@
if (data.code == 200) {
var user_ul2 = "";
$.each(data.data, function(i,item) {
user_ul2+='<li class="addphone2" data-id="'+item.id+'">'+item.id+'-'+item.realname+'-'+item.phone+'</li>';
user_ul2+='<li class="addphone2" data-id="'+item.id+'">'+item.id+'-'+item.name+'-'+item.phone+'</li>';
});
$(".user-ul2").html(user_ul2);
......
......@@ -110,8 +110,8 @@ define(['doT', 'text!temp/refund_template_tpl.html', 'css!style/home.css', 'ckfi
},
search_phone2:function(){//手机号
$.ajax ({
url: '/index/select_by_phone',
type: 'POST',
url: '/index/getBroker_new',
type: 'GET',
async: true,
data: {
"phone":$("#cus_fang").val()
......@@ -121,7 +121,7 @@ define(['doT', 'text!temp/refund_template_tpl.html', 'css!style/home.css', 'ckfi
if (data.code == 200) {
var user_ul2 = "";
$.each(data.data, function(i,item) {
user_ul2+='<li class="addphone2" data-id="'+item.id+'">'+item.id+'-'+item.realname+'-'+item.phone+'</li>';
user_ul2+='<li class="addphone2" data-id="'+item.id+'">'+item.id+'-'+item.name+'-'+item.phone+'</li>';
});
$(".user-ul2").html(user_ul2);
......
......@@ -117,8 +117,8 @@ define(['doT', 'text!temp/refundorder_template_tpl.html', 'css!style/home.css',
},
search_phone2:function(){//手机号
$.ajax ({
url: '/index/select_by_phone',
type: 'POST',
url: '/index/getBroker_new',
type: 'GET',
async: true,
data: {
"phone":$("#cus_fang").val()
......@@ -128,7 +128,7 @@ define(['doT', 'text!temp/refundorder_template_tpl.html', 'css!style/home.css',
if (data.code == 200) {
var user_ul2 = "";
$.each(data.data, function(i,item) {
user_ul2+='<li class="addphone2" data-id="'+item.id+'">'+item.id+'-'+item.realname+'-'+item.phone+'</li>';
user_ul2+='<li class="addphone2" data-id="'+item.id+'">'+item.id+'-'+item.name+'-'+item.phone+'</li>';
});
$(".user-ul2").html(user_ul2);
......
......@@ -66,8 +66,8 @@ define(['doT', 'text!temp/visit_shop_template_tpl.html', 'css!style/home.css', '
},
search_phone2:function(){//手机号
$.ajax ({
url: '/index/select_by_phone',
type: 'POST',
url: '/index/getBroker_new',
type: 'GET',
async: true,
data: {
"phone":$("#cus_fang").val()
......@@ -77,7 +77,7 @@ define(['doT', 'text!temp/visit_shop_template_tpl.html', 'css!style/home.css', '
if (data.code == 200) {
var user_ul2 = "";
$.each(data.data, function(i,item) {
user_ul2+='<li class="addphone2" data-id="'+item.id+'">'+item.id+'-'+item.realname+'-'+item.phone+'</li>';
user_ul2+='<li class="addphone2" data-id="'+item.id+'">'+item.id+'-'+item.name+'-'+item.phone+'</li>';
});
$(".user-ul2").html(user_ul2);
......
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