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.
54 lines
1.5 KiB
54 lines
1.5 KiB
<?php
|
|
|
|
namespace app\admin\controller\qingdong\attendance;
|
|
|
|
|
|
use addons\qingdong\model\Attendance as AttendanceModel;
|
|
use addons\qingdong\model\Staff;
|
|
use app\common\controller\Backend;
|
|
|
|
/**
|
|
* 打卡记录
|
|
*/
|
|
class Attendance extends Backend {
|
|
public function _initialize() {
|
|
parent::_initialize();
|
|
$this->model = new AttendanceModel();
|
|
}
|
|
|
|
|
|
/**
|
|
* 打卡记录列表
|
|
*/
|
|
public function index() {
|
|
$this->request->filter(['strip_tags']);
|
|
if ($this->request->isAjax()) {
|
|
//0:全部 1:我的 2:下属的
|
|
$type = input('type',0);
|
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
|
switch($type){
|
|
case 1:
|
|
$staff = Staff::info();
|
|
$wheres['staff_id'] = $staff->id;
|
|
break;
|
|
case 2:
|
|
$wheres['staff_id'] = array('in',Staff::getLowerStaffId());
|
|
break;
|
|
default:
|
|
$wheres['staff_id'] = array('in',Staff::getMyStaffIds());
|
|
break;
|
|
|
|
}
|
|
$wheres['type'] = 0;//上下班打卡
|
|
$list = $this->model->where($where)->where($wheres)->with(['staff'])->order($sort, $order)->paginate($limit);
|
|
$row = $list->items();
|
|
$result = array("total" => $list->total(), "rows" => $row);
|
|
|
|
return json($result);
|
|
}
|
|
return $this->view->fetch();
|
|
}
|
|
|
|
|
|
|
|
}
|