Files
liche/api/controllers/wxapp/licheb/Services.php
T
2021-08-13 10:56:24 +08:00

55 lines
1.6 KiB
PHP

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Created by Vim
* User: lcc
* Date: 2021/08/09
* Time: 11:08
*/
require_once APPPATH.'controllers/wxapp/Wxapp.php';
class Services extends Wxapp{
public function __construct(){
parent::__construct();
$this->login_white = array('get_package');//登录白名单
$this->load->model('receiver/receiver_services_model','services_model');
$this->load->model('receiver/receiver_service_package_model','package_model');
}
//服务包
protected function get_package(){
$page = $this->input_param('page');
$size = $this->input_param('size');
!$page && $page = 1;
!$size && $size = 10;
$where = [
'status' => 1
];
$count = $this->package_model->count($where);
$list = [];
if($count){
$rows = $this->package_model->select($where,'id asc',$page,$size);
foreach($rows as $key=>$val){
$title = '';
if($val['srv_ids']){
$s_where = [
"id in ({$val['srv_ids']})" => null
];
$s_rows = $this->services_model->select($s_where,'','','','id,title');
$s_rows && $title = implode('+',array_column($s_rows,'title'));
}
$list[] = [
'id' => $val['id'],
'title' => $title
];
}
}
$data = [
'list' => $list,
'total' => $count
];
return $data;
}
}