Commit 04290ef1 authored by hujun's avatar hujun

优化-我的客户预约看铺

parent ab3bbc82
...@@ -10,15 +10,16 @@ namespace app\api_broker\controller; ...@@ -10,15 +10,16 @@ namespace app\api_broker\controller;
use app\api_broker\extend\Basic; use app\api_broker\extend\Basic;
use app\model\AAgents;
use app\model\AppointWatchShop; use app\model\AppointWatchShop;
use app\model\GHouses; use app\model\GHouses;
use app\model\HouseInfos; use app\model\FollowUp;
use app\model\Users;
use think\Request; use think\Request;
class AppointmentShop extends Basic class AppointmentShop extends Basic
{ {
private $m_watch; private $m_watch;
public function __construct(Request $request = null) public function __construct(Request $request = null)
{ {
parent::__construct($request); parent::__construct($request);
...@@ -30,21 +31,45 @@ class AppointmentShop extends Basic ...@@ -30,21 +31,45 @@ class AppointmentShop extends Basic
* *
* @return \think\Response * @return \think\Response
*/ */
public function getOurAppointment() { public function getOurAppointment()
{
$code = 200;
$msg = "";
$list = [];
$where['a.appoint_agent_id'] = 1; $where['a.appoint_agent_id'] = 1;
// $where['a.appoint_agent_id'] = $this->agentId; // $where['a.appoint_agent_id'] = $this->agentId;
$where['a.is_cancel'] = 0; $where['a.is_cancel'] = 0;
$page_no = empty($this->params['page_no']) ? 1 : $this->params['page_no']; $page_no = empty($this->params['page_no']) ? 1 : $this->params['page_no'];
$page_size = empty($this->params['page_size']) ? 15 : $this->params['page_size']; $page_size = empty($this->params['page_size']) ? 15 : $this->params['page_size'];
$field = 'a.house_id,a.appellation,a.phone,a.expect_time,a.other_require,b.create_time,'; $field = 'a.id,a.house_id,a.appellation,a.phone,a.expect_time,a.other_require,b.create_time,';
$field .= 'b.user_name,b.id as use_id'; $field .= 'b.user_name,b.id as use_id,a.applies_id';
$list = $this->m_watch->getAppointWatchOur($page_no, $page_size, 'a.id desc', $field,$where); try {
$m_house = new GHouses(); $list = $this->m_watch->getAppointWatchOur($page_no, $page_size, 'a.id desc', $field, $where);
foreach ($list as $k=>$v) { $m_house = new GHouses();
$list[$k]['house_title'] = $m_house->getHouseValue('internal_title', ['id'=>$v['house_id']]); $m_follow = new FollowUp();
$m_agent = new AAgents();
foreach ($list as $k => $v) {
if ($v['as is_report'] > 0) {
$list[$k]['is_report'] = 1;
} else {
$list[$k]['is_report'] = 0;
}
$list[$k]['house_title'] = $m_house->getHouseValue('internal_title', ['id' => $v['house_id']]);
$follow_up = $m_follow->getAllList('admin_id,content,create_time', ['sublet_id' => $v['id']]);
foreach ($follow_up as $k => $v) {
$follow_up[$k]['name'] = $m_agent->getAgentsById($v['admin_id'], 'name');
unset($follow_up[$k]['admin_id']);
}
$list[$k]['follow_up_list'] = $follow_up;
unset($list[$k]['applies_id']);
}
} catch (\Exception $e) {
$code = 101;
$msg = $e->getMessage();
} }
return $this->response(200, '',$list);
return $this->response($code, $msg, $list);
} }
} }
\ No newline at end of file
...@@ -3,6 +3,7 @@ namespace app\api_broker\controller; ...@@ -3,6 +3,7 @@ namespace app\api_broker\controller;
use app\api_broker\extend\Basic; use app\api_broker\extend\Basic;
use app\api_broker\service\FollowUpService; use app\api_broker\service\FollowUpService;
use app\model\OFollowUp;
/** /**
* Created by PhpStorm. * Created by PhpStorm.
......
...@@ -14,4 +14,10 @@ use think\Model; ...@@ -14,4 +14,10 @@ use think\Model;
class FollowUp extends Model class FollowUp extends Model
{ // 设置当前模型对应的完整数据表名称 { // 设置当前模型对应的完整数据表名称
protected $table = 'u_follow_up'; protected $table = 'u_follow_up';
public function getAllList($field, $where) {
return $this->field($field)
->where($where)
->select();
}
} }
\ 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