Commit 9285e8af authored by hujun's avatar hujun

拨打电话返回默认跟进

parent e692831a
......@@ -296,13 +296,12 @@ class Broker extends Basic
$params['disc'] = $result[0]['disc']? $result[0]['disc'] : '黄浦区';
}
//主表查询商铺详细信息
$UPhoneFollowPp = new UPhoneFollowPp();
$UPhoneFollowPp = new UPhoneFollowPp();
$result = $UPhoneFollowPp->savePhoneFollow($params);
//跟进,对客户状态进行更新 0:求租;1:已租;-1:无效
$Users->update_user_status([ 'id' => $user_id, 'user_status' => $user_status ]);
if ($result == 1) {
if ($result > 0) {
//跟进,对客户状态进行更新 0:求租;1:已租;-1:无效
$Users->update_user_status([ 'id' => $user_id, 'user_status' => $user_status ]);
return $this->response("200", "success!", $result);
} else {
return $this->response("101", "失败!");
......
......@@ -33,7 +33,7 @@ class CellPhone extends Basic
$call = new CallPhoneService();
$record = true; //是否录音
$user_id = empty($this->params['user_id']) ? 0:(int)$this->params['user_id'];
$result = $call->bindAXB($this->params['phone_a'], $this->params['phone_b'], $record, $user_id);
$result = $call->bindAXB($this->params['phone_a'], $this->params['phone_b'], $record, $user_id, $this->agentId);
if ($result['status'] == 'success') {
$this->msg = $result['msg'];
......
......@@ -15,6 +15,7 @@ use app\extra\RedisExt;
use app\model\AliYunPhone;
use app\model\BindingPhone;
use app\model\SecretReport;
use app\model\UPhoneFollowPp;
use app\model\Users;
use think\Log;
......@@ -22,21 +23,24 @@ class CallPhoneService
{
private $phone_a = '';
private $phone_b = '';
private $phone_x = '';
private $user_id = '';
private $phone_x = ''; //中间号
private $user_id;
private $agent_id;
private $expiry_date = '';
private $record = true;
private $release = 1;
private $subs_id = '';
private $release = 1; //是否释放
private $subs_id = ''; //阿里云释放参数
private $request_id = '';
private $mapping_id = '';
private $mapping_id = ''; //容联云释放参数
private $is_privacy = 0; //0直接拨打号码1阿里云隐私号码2容联云隐私号码
private $day_num = 0; //号码绑定有效期
private $landlord_phone_day = 0; //房东号码绑定有效期
private $city;
public function __construct()
public function __construct(string $city = '上海市')
{
$this->readRedis();
$this->city = $city;
}
/**
......@@ -48,9 +52,10 @@ class CallPhoneService
* @param $phone_b
* @param bool $record
* @param int $user_id
* @param int $agent_id
* @return mixed
*/
public function bindAXB($phone_a, $phone_b, $record = true, int $user_id)
public function bindAXB($phone_a, $phone_b, $record = true, int $user_id, int $agent_id)
{
$result['status'] = 'failed';
......@@ -88,13 +93,14 @@ class CallPhoneService
$this->phone_a = $phone_a;//经纪人手机号
$this->phone_b = $phone_b;//客户手机号
$this->record = $record; //是否录音
$this->agent_id = $agent_id;
try {
//0不使用隐私号码 1阿里云 2容联云
if ($this->is_privacy == 0) {
$this->originalPhone();
$result['status'] = 'success';
$result['phone'] = $phone_b;
$result['status'] = 'success';
$result['phone'] = $phone_b;
$result['follow_id'] = $this->addPhoneFollow(); //打默认跟进
return $result;
}
......@@ -137,7 +143,7 @@ class CallPhoneService
$result['status'] = 'success';
$result['phone'] = $call_phone['phone'];
$result['msg'] = $call_phone['msg'];
$result['follow_id'] = $this->addPhoneFollow(); //打默认跟进
$type = 'AliYunBindAxb';
} else {
$result['msg'] = $call_phone['msg'];
......@@ -149,7 +155,7 @@ class CallPhoneService
$result['status'] = 'success';
$result['phone'] = $call_phone['phone'];
$result['msg'] = $call_phone['msg'];
$result['follow_id'] = $this->addPhoneFollow(); //打默认跟进
$type = 'YunTongXunBindAxb';
} else {
$result['msg'] = $call_phone['msg'];
......@@ -391,4 +397,15 @@ class CallPhoneService
$this->landlord_phone_day = empty($this->landlord_phone_day) ? 1 : $this->landlord_phone_day;
}
/**
* 打默认跟进
*
* @return int|string
*/
private function addPhoneFollow() {
$follow = new UPhoneFollowPp();
$content = '拨打电话,未打跟进。';
$id = $follow->insertDefaultFollow($this->agent_id, $this->user_id, $content, 3, $this->city);
return $id;
}
}
\ No newline at end of file
......@@ -156,7 +156,7 @@ class CellPhone extends Basic
}
$record = true; //录音
$call_phone = new CallPhoneService();
$data = $call_phone->bindAXB($this->params['phone_a'], $phone_b, $record, $user_id);
$data = $call_phone->bindAXB($this->params['phone_a'], $phone_b, $record, $user_id, $this->userId);
$result['msg'] = '';
if ($data['status'] == 'success') {
$push = new PushMessageService();
......
......@@ -342,4 +342,34 @@ class UPhoneFollowPp extends BaseModel
//echo $this->getLastSql();
return $return;
}
/**
* 插入默认跟进
*
* @param $agent_id
* @param $user_id
* @param $content
* @param $type
* @param $city
* @return int|string
*/
public function insertDefaultFollow($agent_id, $user_id, $content, $type, $city) {
$data['agent_id'] = $agent_id;
$data['user_id'] = $user_id;
$data['content'] = $content;
$data['city'] = $city;
if ($city == '上海市') {
$data['province'] = '上海市';
$data['disc'] = '黄浦区';
}
if ($city == '杭州市') {
$data['province'] = '浙江省';
$data['disc'] = '西湖区';
}
$data['type'] = $type;
return $this->insertGetId($data);
}
}
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