Commit 696fd788 authored by zhuwei's avatar zhuwei

客户列表搜索

parent 54afdd76
......@@ -26,6 +26,7 @@ use app\model\AAgents;
use app\model\ABindingDevice;
use app\model\Agents;
use app\model\AStore;
use app\model\Evaluate;
use app\model\Regions;
use think\Exception;
use think\Session;
......@@ -300,4 +301,35 @@ class Agent extends Basic
return $this->response($code, $msg, $data);
}
/**
* 经纪人列表计算-评价次数和分数
* 朱伟 2018年07月03日
*/
public function agentEvaluateNumAndFraction()
{
$data = $this->request->param();
$agents_id = $data['agents_id'];
if (!isset($agents_id)) {
return $this->response("300", "参数不全");
}
$params['agents_id'] = $agents_id;
$field='sum(evaluate_grade) as agent_evaluate_fraction';
$model = new Evaluate();
$agent_evaluate_num = $model->getAgentEvaluateNum($params);
$agent_evaluate_fraction_res = $model->getAgentEvaluateFraction($field,$params);
$agent_evaluate_fraction = round($agent_evaluate_fraction_res[0]['agent_evaluate_fraction']/2 /$agent_evaluate_num,1);
if ($agent_evaluate_num && $agent_evaluate_fraction_res) {
$result['agent_evaluate_num'] = $agent_evaluate_num;
$result['agent_evaluate_fraction'] = $agent_evaluate_fraction;
return $this->response(200, '成功', $result);
} else {
return $this->response(100, '失败');
}
}
}
\ No newline at end of file
......@@ -60,7 +60,13 @@ class Member extends Basic{
//客户手机号
if (!empty($params['phone'])) {
$where[0] = ['EXP','a.user_phone LIKE "%'.$this->params['phone'].'%" or a.user_nick LIKE "%'.$this->params['phone'].'%"'];
//$where[0] = ['EXP','a.user_phone LIKE "%'.$this->params['phone'].'%" or a.user_nick LIKE "%'.$this->params['phone'].'%"'];
$where['a.user_phone'] = ['LIKE','%'.$params['phone'].'%'];
}
if (!empty($params['user_nick'])) {
//$where[0] = ['EXP','a.user_phone LIKE "%'.$this->params['phone'].'%" or a.user_nick LIKE "%'.$this->params['phone'].'%"'];
$where['a.user_nick'] = ['LIKE','%'.$params['user_nick'].'%'];
}
//是否公客
......
......@@ -164,4 +164,32 @@ class Evaluate extends Model
return $result;
}
/**
* 经纪人列表计算-评价次数
* 朱伟 2018年07月03日
*/
public function getAgentEvaluateNum($params = '')
{
$result = $this
->alias('a')
->where($params)
->count();
//dump($this->getLastSql());
return $result;
}
/**
* 经纪人列表计算-分数
* 朱伟 2018年07月03日
*/
public function getAgentEvaluateFraction($field,$params = '')
{
$result = Db::table('u_evaluate')
->field($field)
->alias('a')
->where($params)
->select();
//dump($this->getLastSql());
return $result;
}
}
......@@ -251,6 +251,8 @@ Route::group('index', [
'getNewsInfo' => [ 'index/news/getNewsInfo', [ 'method' => 'GET' ] ], //商学院资讯详情
'getNewsLabel' => [ 'index/news/getNewsLabel', [ 'method' => 'GET' ] ], //商学院资标签
'delNews' => [ 'index/news/delNews', [ 'method' => 'POST' ] ], //删除商学院文章
'agentEvaluateNumAndFraction' => [ 'index/agent/agentEvaluateNumAndFraction', [ 'method' => 'POST|GET' ] ],//经纪人列表计算-评价次数和分数 朱伟 2018-07-03
]);
......
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