Commit d0311ec4 authored by hujun's avatar hujun

PC后台隐私号码

parent c0f85e75
<?php
/**
* Created by PhpStorm.
* User: hu jun
* Date: 2018/2/23
* Time: 14:34
*/
namespace app\index\controller;
use app\index\extend\Basic;
use app\model\AliYunPhone;
class Phone extends Basic
{
/**
* 号码池列表
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function index() {
$data['status'] = 200;
$data['msg'] = "";
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
$phone_x = $this->params['phone_x'];
if ($phone_x) {
$where['phone_x'] = $phone_x;
}
$where['status'] = 0;
$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);
$data['data']['total'] = $aliYun_phone->getTotal($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 bindPhoneList() {
$data['status'] = 200;
$data['msg'] = "";
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
$phone_a = $this->params['phone_a'];
$phone_b = $this->params['phone_b'];
if ($phone_a) {
$where['phone_a'] = $phone_a;
}
if ($phone_b) {
$where['phone_a'] = $phone_b;
}
$where['b.status'] = 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);
foreach ($result as $k=>$v) {
$result[$k]['expire_time'] = date('Y-m-d H:i:s',strtotime($v['create_time'])+518400); //7天有限期
}
$data['data']['list'] = $result;
$data['data']['total'] = $aliYun_phone->getPhoneListTotal($where);
return $this->response($data['status'], $data['msg'], $data['data']);
}
}
\ 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