智慧教务系统 PHP-NiuCloud框架开发
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

71 lines
2.2 KiB

<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址:https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace addon\zhjw\app\service\admin\common;
use addon\zhjw\app\model\orders\Orders;
use addon\zhjw\app\model\students\Students;
use addon\zhjw\app\model\contracts\Contracts;
use core\base\BaseAdminService;
/**
* 公共接口服务层
* Class OrdersService
* @package addon\zhjw\app\service\admin\orders
*/
class CommonService extends BaseAdminService
{
public function __construct()
{
parent::__construct();
}
/**
* 获取订单管理列表
* @param array $where
* @return array
*/
public function getPage(array $where = [])
{
$field = 'id,student_id,contract_id,amount,order_type,pay_type,payment_status,payment_time,create_time,update_time,is_deleted,created_by,created_role,updated_by,updated_role';
$order = 'id desc';
$search_model = $this->model->withSearch(["student_id","contract_id","amount","order_type","pay_type","payment_status","payment_time","create_time"], $where)->with(['students','contracts'])->field($field)->order($order);
$list = $this->pageQuery($search_model);
return $list;
}
/**
* 构建树形结构
* @param array $areas 所有地址数据
* @param int $pid 父级ID
* @return array
*/
public function areaBuildTree(array $areas, int $pid = 0)
{
$tree = [];
foreach ($areas as $area) {
if ($area['pid'] == $pid) {
$children = $this->areaBuildTree($areas, $area['id']);
if ($children) {
$area['children'] = $children;
}
$tree[] = $area;
}
}
return $tree;
}
}