75 lines
2.6 KiB
PHP
75 lines
2.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{
|
|
|
|
function __construct($inputs, $app_key){
|
|
parent::__construct($inputs, $app_key);
|
|
$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');
|
|
$type = $this->input_param('type');
|
|
|
|
!$page && $page = 1;
|
|
!$size && $size = 10;
|
|
$where = [
|
|
'status' => 1
|
|
];
|
|
$srv_id = 4; //金融服务
|
|
$count = $this->package_model->count($where);
|
|
$list = [];
|
|
if($count){
|
|
$rows = $this->package_model->select($where,'id desc',$page,$size,'id,srv_ids');
|
|
foreach($rows as $key=>$val){
|
|
$title = '';
|
|
$srv_id_arr = explode(',',$val['srv_ids']);
|
|
if(!is_array($srv_id_arr)){
|
|
continue;
|
|
}
|
|
if($type==2){ //分期 必须包含金融包
|
|
if(in_array($srv_id,$srv_id_arr)){
|
|
$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
|
|
];
|
|
}
|
|
}else{ //全款 过滤包含金融包
|
|
if(!in_array($srv_id,$srv_id_arr)){
|
|
$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;
|
|
}
|
|
}
|