Commit 40890ffb authored by hujun's avatar hujun

记录客户拨打经纪人次数

parent f275a0ab
<?php <?php
namespace app\api\controller; namespace app\api\controller;
use app\api\extend\Basic; use app\api\extend\Basic;
use app\api_broker\service\PushMessageService;
use app\model\AAgents; use app\model\AAgents;
use app\model\Agents;
use app\model\Evaluate; use app\model\Evaluate;
use app\model\EvaluateSign; use app\model\EvaluateSign;
use app\model\OBargainModel; use app\model\OBargainModel;
use app\model\Remarks;
/** /**
* Description of Agents * Description of Agents
...@@ -18,7 +16,8 @@ use app\model\Remarks; ...@@ -18,7 +16,8 @@ use app\model\Remarks;
* @time :11:15:05 * @time :11:15:05
* Intro : * Intro :
*/ */
class Broker extends Basic{ class Broker extends Basic
{
/** /**
* 咨询经纪人 * 咨询经纪人
...@@ -28,7 +27,8 @@ class Broker extends Basic{ ...@@ -28,7 +27,8 @@ class Broker extends Basic{
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function index() { public function index()
{
$params = $this->params; $params = $this->params;
$data['status'] = 101; $data['status'] = 101;
$data['data'] = []; $data['data'] = [];
...@@ -45,7 +45,7 @@ class Broker extends Basic{ ...@@ -45,7 +45,7 @@ class Broker extends Basic{
$agent_client = 0; $agent_client = 0;
if (!empty($this->userId) && ($this->params['source'] != 'B-APP')) { if (!empty($this->userId) && ($this->params['source'] != 'B-APP')) {
$agent_client = $agents->getAgentClient($fields, ['c.id'=>$this->userId]); $agent_client = $agents->getAgentClient($fields, [ 'c.id' => $this->userId ]);
} }
$where['c.houses_id'] = $params['house_id']; $where['c.houses_id'] = $params['house_id'];
...@@ -57,10 +57,10 @@ class Broker extends Basic{ ...@@ -57,10 +57,10 @@ class Broker extends Basic{
} }
if (!empty($list)) { if (!empty($list)) {
foreach ($list as $k=>$v) { foreach ($list as $k => $v) {
$v['head_portrait'] = AGENTHEADERIMGURL.$v['img']; $v['head_portrait'] = AGENTHEADERIMGURL . $v['img'];
if ($list[$k]['evaluate_grade']) { if ($list[$k]['evaluate_grade']) {
$evaluate_grade = floor(($list[$k]['evaluate_grade']/2)/$list[$k]['evaluate']); $evaluate_grade = floor(($list[$k]['evaluate_grade'] / 2) / $list[$k]['evaluate']);
} else { } else {
$evaluate_grade = 0; $evaluate_grade = 0;
} }
...@@ -77,7 +77,7 @@ class Broker extends Basic{ ...@@ -77,7 +77,7 @@ class Broker extends Basic{
$data['msg'] = 'house_id 为空'; $data['msg'] = 'house_id 为空';
} }
return $this->response($data['status'], $data['msg'], $data['data'] ); return $this->response($data['status'], $data['msg'], $data['data']);
} }
/** /**
...@@ -86,10 +86,11 @@ class Broker extends Basic{ ...@@ -86,10 +86,11 @@ class Broker extends Basic{
* @return \think\Response * @return \think\Response
* @throws \Exception * @throws \Exception
*/ */
public function appraiser() { public function appraiser()
{
$params = $this->params; $params = $this->params;
$data['status'] = 101; $data['status'] = 101;
$data['data'] = array(); $data['data'] = [];
$data['msg'] = ''; $data['msg'] = '';
if (empty($params['agents_id'])) { if (empty($params['agents_id'])) {
...@@ -108,7 +109,7 @@ class Broker extends Basic{ ...@@ -108,7 +109,7 @@ class Broker extends Basic{
} }
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
$id_arr = array(); $id_arr = [];
if (isset($params['sign_name'])) { if (isset($params['sign_name'])) {
$evaluate_sign = new EvaluateSign(); $evaluate_sign = new EvaluateSign();
foreach ($params['sign_name'] as $v) { foreach ($params['sign_name'] as $v) {
...@@ -142,7 +143,7 @@ class Broker extends Basic{ ...@@ -142,7 +143,7 @@ class Broker extends Basic{
]); ]);
if ($evaluate->id) { if ($evaluate->id) {
$data['data'] = ['id'=> $evaluate->id]; $data['data'] = [ 'id' => $evaluate->id ];
$data['status'] = 200; $data['status'] = 200;
$data['msg'] = '评价成功'; $data['msg'] = '评价成功';
} else { } else {
...@@ -160,10 +161,11 @@ class Broker extends Basic{ ...@@ -160,10 +161,11 @@ class Broker extends Basic{
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function commentAndDeal() { public function commentAndDeal()
{
$params = $this->params; $params = $this->params;
$data['status'] = 200; $data['status'] = 200;
$data['data'] = array(); $data['data'] = [];
$data['msg'] = ''; $data['msg'] = '';
if ($params['agent_id']) { if ($params['agent_id']) {
...@@ -183,7 +185,7 @@ class Broker extends Basic{ ...@@ -183,7 +185,7 @@ class Broker extends Basic{
//评价列表信息 //评价列表信息
$result['evaluate'] = $evaluate->getEvaluate($pageNo, $pageSize, 'a.id desc', $fields_evaluate, '', $params['agent_id']); $result['evaluate'] = $evaluate->getEvaluate($pageNo, $pageSize, 'a.id desc', $fields_evaluate, '', $params['agent_id']);
//成交记录 //成交记录
$result['journalAccounts'] = $bargain->getBargainOrderList($pageNo, $pageSize, '', $bargain_fields, ['a.agent_id'=>$this->params['agent_id']]); $result['journalAccounts'] = $bargain->getBargainOrderList($pageNo, $pageSize, '', $bargain_fields, [ 'a.agent_id' => $this->params['agent_id'] ]);
$data['data'] = $result; $data['data'] = $result;
break; break;
case 1: case 1:
...@@ -193,7 +195,7 @@ class Broker extends Basic{ ...@@ -193,7 +195,7 @@ class Broker extends Basic{
break; break;
case 2: case 2:
//成交记录 //成交记录
$result['journalAccounts'] = $bargain->getBargainOrderList($pageNo, $pageSize, '', $bargain_fields, ['a.agent_id'=>$this->params['agent_id']]); $result['journalAccounts'] = $bargain->getBargainOrderList($pageNo, $pageSize, '', $bargain_fields, [ 'a.agent_id' => $this->params['agent_id'] ]);
$data['data'] = $result; $data['data'] = $result;
break; break;
default: default:
...@@ -216,10 +218,11 @@ class Broker extends Basic{ ...@@ -216,10 +218,11 @@ class Broker extends Basic{
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function brokerDetail() { public function brokerDetail()
{
$data['status'] = 200; $data['status'] = 200;
$data['data'] = array(); $data['data'] = [];
$data['msg'] = ''; $data['msg'] = '';
if ($this->params['agent_id']) { if ($this->params['agent_id']) {
...@@ -233,10 +236,33 @@ class Broker extends Basic{ ...@@ -233,10 +236,33 @@ class Broker extends Basic{
return $this->response($data['status'], $data['msg'], $data['data']); return $this->response($data['status'], $data['msg'], $data['data']);
} }
public function testtest() { /**
$push = new PushMessageService(); * 记录客户拨打经纪人次数
// $push->pushReportMessage(2362,3670,1); *
// $push->pushMarchInMessage(26964); * @return \think\Response
$push->pushBargainMessage(26989); * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function recordCallNum()
{
$data['status'] = 200;
$data['data'] = [];
$data['msg'] = '';
if ($this->params['agent_id'] > 0) {
$m_agents = new AAgents();
$agents_data = $m_agents->getAgentInfo('id,update_time,call_number', $this->params['agent_id']);
$insert_data['update_time'] = $agents_data['update_time'];
$insert_data['call_number'] = $agents_data['call_number'] + 1;
$data['data'] = $m_agents->editData($insert_data, $agents_data['id']);
} else {
$data['status'] = 101;
$data['msg'] = 'agent_id is null';
}
return $this->response($data['status'], $data['msg'], $data['data']);
} }
} }
...@@ -312,11 +312,6 @@ class AAgents extends BaseModel ...@@ -312,11 +312,6 @@ class AAgents extends BaseModel
return $this->save([ 'password' => md5($pwd) ], [ 'id' => $id ]); return $this->save([ 'password' => md5($pwd) ], [ 'id' => $id ]);
} }
public function saveList()
{
}
/** /**
* 分页列表 * 分页列表
* @param int $p * @param int $p
...@@ -343,13 +338,16 @@ class AAgents extends BaseModel ...@@ -343,13 +338,16 @@ class AAgents extends BaseModel
return $data; return $data;
} }
/** /**
* 统计任务获取经纪人列表 * 统计任务获取经纪人列表
*
* @param int $pageNo * @param int $pageNo
* @param int $pageSize * @param int $pageSize
* @param string $field * @param string $field
* @return false|\PDOStatement|string|\think\Collection * @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/ */
public function getAgentsListByTask($pageNo = 1, $pageSize = 15, $field = "id") public function getAgentsListByTask($pageNo = 1, $pageSize = 15, $field = "id")
{ {
...@@ -358,7 +356,6 @@ class AAgents extends BaseModel ...@@ -358,7 +356,6 @@ class AAgents extends BaseModel
->limit($pageSize) ->limit($pageSize)
->page($pageNo) ->page($pageNo)
->select(); ->select();
} }
/** /**
...@@ -373,8 +370,12 @@ class AAgents extends BaseModel ...@@ -373,8 +370,12 @@ class AAgents extends BaseModel
/** /**
* 批量获取经纪人 * 批量获取经纪人
*
* @param $params * @param $params
* @return false|\PDOStatement|string|\think\Collection * @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/ */
public function getAgentsByStoreId($params) public function getAgentsByStoreId($params)
{ {
...@@ -386,7 +387,13 @@ class AAgents extends BaseModel ...@@ -386,7 +387,13 @@ class AAgents extends BaseModel
return $result; return $result;
} }
/**
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function countAgentNum($params) public function countAgentNum($params)
{ {
$where_ = $whereOr_ = []; $where_ = $whereOr_ = [];
...@@ -413,7 +420,14 @@ class AAgents extends BaseModel ...@@ -413,7 +420,14 @@ class AAgents extends BaseModel
} }
/**
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAgentsInfoByAgentId($field, $params) public function getAgentsInfoByAgentId($field, $params)
{ {
$where_ = []; $where_ = [];
...@@ -444,6 +458,13 @@ class AAgents extends BaseModel ...@@ -444,6 +458,13 @@ class AAgents extends BaseModel
} }
/**
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getStoreOrDistrict($params){ public function getStoreOrDistrict($params){
$result = Db::table($this->table) $result = Db::table($this->table)
->field("id,name,img") ->field("id,name,img")
...@@ -453,6 +474,14 @@ class AAgents extends BaseModel ...@@ -453,6 +474,14 @@ class AAgents extends BaseModel
return $result; return $result;
} }
/**
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function searchAgentsByKeyword($field, $params) public function searchAgentsByKeyword($field, $params)
{ {
...@@ -508,13 +537,15 @@ class AAgents extends BaseModel ...@@ -508,13 +537,15 @@ class AAgents extends BaseModel
->value('id'); ->value('id');
} }
/** /**
* 根据id检查是否有权限 * 根据id检查是否有权限
* *
* @param $agents_id * @param $agents_id
* @param $rule * @param $rule
* @return mixed * @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/ */
public function agentsAuthIds($agents_id, $rule) public function agentsAuthIds($agents_id, $rule)
{ {
......
...@@ -264,6 +264,7 @@ Route::group('api', [ ...@@ -264,6 +264,7 @@ Route::group('api', [
'brokerDetail' => [ 'api/broker/brokerDetail', [ 'method' => 'get' ] ], //经纪人详情 'brokerDetail' => [ 'api/broker/brokerDetail', [ 'method' => 'get' ] ], //经纪人详情
//post broker //post broker
'appraiser' => [ 'api/broker/appraiser', [ 'method' => 'post' ] ], //评价经纪人 'appraiser' => [ 'api/broker/appraiser', [ 'method' => 'post' ] ], //评价经纪人
'recordCallNum' => [ 'api/broker/recordCallNum', [ 'method' => 'post' ] ], //记录拨打经纪人号码
//get member //get member
'logout' => [ 'api/member/logout', [ 'method' => 'get' ] ], 'logout' => [ 'api/member/logout', [ '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