修复内容
This commit is contained in:
@@ -17,20 +17,23 @@ class Calendar extends ApiBase
|
||||
if (!preg_match('/^\d{4}-\d{2}$/', $month)) {
|
||||
return $this->_error("月份格式错误,请使用格式:2026-01");
|
||||
}
|
||||
|
||||
// 计算该月的开始和结束日期
|
||||
$startDate = $month . '-01';
|
||||
$endDate = date('Y-m-t', strtotime($startDate)); // 获取该月最后一天
|
||||
|
||||
$uid = $this->user_id;
|
||||
|
||||
// 查询该月份的所有服务数据,关联商品表和员工表
|
||||
// 查询该月份的所有服务数据,关联总订单表、商品表和员工表
|
||||
$service = Db::name('order_exe')
|
||||
->alias('oe')
|
||||
->join('order o', 'oe.order_sn = o.order_sn', 'INNER')
|
||||
->join('goods g', 'oe.goods_id = g.id', 'LEFT')
|
||||
->join('staff s', 'oe.staff_id = s.id', 'LEFT')
|
||||
->where('o.user_id', $uid)
|
||||
->where('oe.date', '>=', $startDate)
|
||||
->where('oe.date', '<=', $endDate)
|
||||
->where('oe.abnormal', 0)
|
||||
->field('oe.staff_status,oe.date,oe.addtime,oe.start_time,oe.timeout,oe.xq,oe.staff_id,s.name as staff_name,s.onwork,s.leave,g.name as goods_name')
|
||||
->field('oe.staff_status,oe.date,oe.addtime,oe.start_time,oe.timeout,oe.xq,oe.staff_id,oe.order_sn,s.name as staff_name,s.onwork,s.leave,g.name as goods_name')
|
||||
->order('oe.date asc, oe.addtime asc')
|
||||
->select();
|
||||
|
||||
@@ -38,9 +41,10 @@ class Calendar extends ApiBase
|
||||
if ($service) {
|
||||
foreach ($service as $v) {
|
||||
// 如果有绑定员工,但员工状态不符合要求,则跳过
|
||||
if (!empty($v['staff_id']) && ($v['onwork'] != 1 || $v['leave'] != 1)) {
|
||||
continue;
|
||||
}
|
||||
// 注释掉员工状态过滤,先看看是否能查询出来
|
||||
// if (!empty($v['staff_id']) && ($v['onwork'] != 1 || $v['leave'] != 1)) {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// 处理服务时间
|
||||
$timeRange = '';
|
||||
|
||||
Reference in New Issue
Block a user