Commit 7849d4ee authored by hujun's avatar hujun

新增或编辑中间号

parent aa781485
......@@ -31,6 +31,7 @@ class Phone extends Basic
$where['phone_x'] = $phone_x;
}
$where['status'] = 0;
$where['phone_pool_id'] = 1;
$fields = 'id,phone_x,monthly,cost,status,create_time';
$aliYun_phone = new AliYunPhone();
$data['data']['list'] = $aliYun_phone->getList($pageNo, $pageSize, 'id DESC', $fields, $where);
......@@ -63,6 +64,7 @@ class Phone extends Basic
}
$where['b.status'] = 1;
$where['a.phone_pool_id'] = 1;
$fields = 'a.id,b.id as bind_id,phone_x,phone_a,phone_b,record,b.create_time';
$aliYun_phone = new AliYunPhone();
$result = $aliYun_phone->getPhoneList($pageNo, $pageSize, 'b.id DESC', $fields, $where);
......@@ -73,4 +75,44 @@ class Phone extends Basic
$data['data']['total'] = $aliYun_phone->getPhoneListTotal($where);
return $this->response($data['status'], $data['msg'], $data['data']);
}
/**
* 新增或编辑号码池号码
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function edit_aliYunPhone() {
$phone_x = $this->params['phone_x'];
$id = $this->params['id'];
$data['status'] = 200;
$data['msg'] = '';
$phone = new AliYunPhone();
if ($this->request->isGet()) {
//获取信息
$result = $phone->field('id,phone_x')->where('id',$id)->find();
} else {
if ($id) {
//编辑
$result = $phone->save([
'phone_x' => $phone_x,
'phone_pool_id' => 1,
'monthly' => $this->params['monthly']*100,
'cost' => $this->params['cost']*100
],['id'=>$id]);
} else {
//新增
$result = $phone->save([
'phone_x' => $phone_x,
'phone_pool_id' => 1,
'monthly' => $this->params['monthly'],
'cost' => $this->params['cost']*100
]);
}
}
return $this->response($data['status'], $data['msg'], $result);
}
}
\ No newline at end of file
......@@ -142,6 +142,7 @@ Route::group('index', [
'RemarkFollowList'=>['index/Remark/RemarkFollowList',['method'=>'get']],//跟进列表【接口】
'phone_list'=>['index/Phone/index',['method'=>'get']],//隐私号码列表
'bindPhoneList'=>['index/Phone/bindPhoneList',['method'=>'get']],//绑定的隐私号码列表
'edit_aliYunPhone'=>['index/Phone/edit_aliYunPhone',['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