69 lines
2.6 KiB
PHP
69 lines
2.6 KiB
PHP
<?php
|
|
defined('WXAPP_APP') or exit('No direct script access allowed');
|
|
|
|
require_once APPPATH . 'controllers/wxapp/Wxapp.php';
|
|
|
|
class Clues extends Wxapp
|
|
{
|
|
|
|
function __construct($inputs, $app_key)
|
|
{
|
|
parent::__construct($inputs, $app_key);
|
|
$this->login_white = array();//登录白名单
|
|
$this->check_status = array();//用户状态校验
|
|
$this->check_mobile = array();//需要手机号
|
|
$this->check_headimg = array();//授权微信信息
|
|
$this->load->model('receiver/receiver_clues_model', 'clues_model');
|
|
$this->load->model('receiver/receiver_clue_oplogs_model', 'clue_oplogs_model');
|
|
$this->load->model('area_model', 'mdArea');
|
|
}
|
|
|
|
public function get()
|
|
{
|
|
|
|
$id = $this->input_param('id');
|
|
if ($id) {
|
|
$where = [
|
|
'id' => $id,
|
|
];
|
|
$row = $this->clues_model->get($where);
|
|
if (!$row) {
|
|
throw new Exception('数据不存在', ERR_PARAMS_ERROR);
|
|
}
|
|
$other_data = [];
|
|
if ($row['county_id']) {
|
|
$re_area = $this->mdArea->get(['county_id' => $row['county_id']], 'province_name,city_name,county_name');
|
|
$re_area && $other_data['所在地区'] = "{$re_area['province_name']}-{$re_area['city_name']}-{$re_area['county_name']}";
|
|
}
|
|
$other_data['创建时间'] = date('Y-m-d', $row['c_time']);
|
|
$logs = $this->clue_oplogs_model->select(['clue_id' => $id], 'id desc', 1, 1);
|
|
if ($logs) {
|
|
$other_data['最近联系时间'] = date('Y-m-d', $logs[0]['c_time']);
|
|
}
|
|
$data = [
|
|
'id' => $row['id'],
|
|
'name' => $row['name'],
|
|
'mobile' => mobile_asterisk($row['mobile']),
|
|
'other_data' => $other_data,
|
|
];
|
|
return $data;
|
|
} else {
|
|
$page = $this->input_param('page');
|
|
$size = $this->input_param('size');
|
|
!$page && $page = 1;
|
|
!$size && $size = 10;
|
|
$where = ['biz_id' => $this->get_biz_id(), 'status' => 0];
|
|
$total = $this->clues_model->count($where);
|
|
$lists = [];
|
|
if ($total > 0) {
|
|
$rows = $this->clues_model->select($where, 'id desc', $page, $size, 'id,mobile,name');
|
|
foreach ($rows as $item) {
|
|
$item['mobile'] = mobile_asterisk($item['mobile']);
|
|
$lists[] = $item;
|
|
}
|
|
}
|
|
return ['list' => $lists, 'total' => $total];
|
|
}
|
|
|
|
}
|
|
} |