1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace app\api\logic;
- use app\common\model\AppointmentModel;
- use app\common\model\MealcenterModel;
- use app\common\model\MealOrdersModel;
- use app\common\model\serverappointmentmodel;
- use app\common\model\VisitModel;
- class StatisticsLogic
- {
- public function getmealcenterlist()
- {
- $page = isset($arr['page']) && is_numeric($arr['page']) && !empty($arr['page']) && $arr['page'] > 0 ? $arr['page'] : 1;
- $size = isset($arr['size']) && is_numeric($arr['size']) && !empty($arr['size']) && $arr['size'] > 0 ? $arr['size'] : 10;
- $m_mc = new MealcenterModel();
- $m_mo = new MealOrdersModel();
- $m_v = new VisitModel();
- $m_sa = new serverappointmentmodel();
- $m_a = new AppointmentModel();
- $where = [];
- $count = $m_mc->getList($where, 'count');
- if ($count <= 0) {
- return backarr(0, "无数据");
- }
- $list = $m_mc->getList($where, '*', $page, $size);
- foreach ($list as $key => $value) {
- $mocount = $m_mo->getList(['center_id' => $value['id']], 'count');
- $vcount = $m_v->getList(['center_id' => $value['id']], 'count');
- $sacount = $m_sa->getList(['center_id' => $value['id']], 'count');
- $acount = $m_a->getList(['center_id' => $value['id']], 'count');
- $value['mocount'] = empty($mocount) ? 0 : $mocount;
- $value['vcount'] = empty($vcount) ? 0 : $vcount;
- $value['sacount'] = empty($sacount) ? 0 : $sacount;
- $value['acount'] = empty($acount) ? 0 : $acount;
- $list[$key] = $value;
- }
- $restunData = [
- 'count' => $count,
- 'page' => $page,
- 'size' => $size,
- 'list' => $list,
- ];
- return backarr(1, "查询成功", $restunData);
- }
- }
|