Commit a94e3d3c authored by hujun's avatar hujun

拨打号码用户界面接口

parent 06f1a6e0
...@@ -364,6 +364,7 @@ class Broker extends Basic ...@@ -364,6 +364,7 @@ class Broker extends Basic
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function getAgentsByPhone() { public function getAgentsByPhone() {
header('Access-Control-Allow-Origin:*');
$agents = new Agents(); $agents = new Agents();
$data = $agents->getInfo($this->agentPhone); $data = $agents->getInfo($this->agentPhone);
$data['openid'] = ""; $data['openid'] = "";
......
...@@ -11,6 +11,7 @@ namespace app\api_broker\controller; ...@@ -11,6 +11,7 @@ namespace app\api_broker\controller;
use app\api_broker\extend\Basic; use app\api_broker\extend\Basic;
use app\api_broker\untils\PlsDemo; use app\api_broker\untils\PlsDemo;
use app\model\AAgentsPhone;
use app\model\AliYunPhone; use app\model\AliYunPhone;
use app\model\BindingPhone; use app\model\BindingPhone;
use think\Db; use think\Db;
...@@ -143,4 +144,29 @@ class CellPhone extends Basic ...@@ -143,4 +144,29 @@ class CellPhone extends Basic
$this->params['phone_x']; $this->params['phone_x'];
return $this->response($this->code, $this->msg); return $this->response($this->code, $this->msg);
} }
/**
* 获取经纪人拨打界面手机号
*
* @return \think\Response
* @throws \Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function agentsPhone() {
if ($this->params['agents_id']) {
$agents_phone = new AAgentsPhone();
if ($this->request->isGet()) {
$this->data = $agents_phone->getList(1,15,'id asc','id,phone','status = 0');
} else {
$this->data = $agents_phone->add($this->params['agents_id'],$this->params['phone']);
}
} else {
$this->code = 101;
$this->msg = 'agents_id is null';
}
return $this->response($this->code, $this->msg, $this->data);
}
} }
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: fuju
* Date: 2018/3/1
* Time: 17:56
*/
namespace app\model;
class AAgentsPhone extends BaseModel
{
/**
* 新增用户手机
*
* @param $id
* @param $phone
* @return array|false|int
* @throws \Exception
*/
public function add($id, $phone) {
if (is_array($phone)) {
$insert_data = [];
foreach ($phone as $k=>$v) {
$insert_data[$k]['agents_id'] = $id;
$insert_data[$k]['phone'] = $phone;
}
$result = $this->saveAll(array_unique($insert_data));
} else {
$is = $this->get(['phone'=>$phone,'agents_id'=>$id]);
if (!$is){
$result = $this->save(['phone'=>$phone,'agents_id'=>$id]);
} else {
$result = 0;
}
}
return $result;
}
/**
* 伪删除
*
* @param $id
* @param $phone
* @return mixed
*/
public function delPhone($id, $phone) {
$result = $this->where(['agents_id'=>$id,'phone'=>$phone])->setField('status',1);
return $result;
}
}
\ No newline at end of file
...@@ -276,6 +276,7 @@ Route::group('broker', [ ...@@ -276,6 +276,7 @@ Route::group('broker', [
'reportList' => ['api_broker/Report/reportList', [ 'method' => 'get' ] ], 'reportList' => ['api_broker/Report/reportList', [ 'method' => 'get' ] ],
'token' => ['api_broker/broker/token', [ 'method' => 'get' ] ], 'token' => ['api_broker/broker/token', [ 'method' => 'get' ] ],
'getAgentsByPhone' => ['api_broker/broker/getAgentsByPhone', [ 'method' => 'get' ] ], 'getAgentsByPhone' => ['api_broker/broker/getAgentsByPhone', [ 'method' => 'get' ] ],
'agentsPhone' => ['api_broker/CellPhone/agentsPhone', [ 'method' => 'get|post' ] ], //获取经纪人拨打界面手机号
]); ]);
......
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