Card.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace app\admin\controller\qingdongams\attendance;
  3. use addons\qingdongams\model\AttendanceCard;
  4. use addons\qingdongams\model\Staff;
  5. use app\common\controller\Backend;
  6. /**
  7. * 补卡记录
  8. */
  9. class Card extends Backend {
  10. public function _initialize() {
  11. parent::_initialize();
  12. $this->model = new AttendanceCard();
  13. }
  14. /**
  15. * 补卡记录
  16. */
  17. public function index() {
  18. $this->request->filter(['strip_tags']);
  19. if ($this->request->isAjax()) {
  20. //0:全部 1:我的 2:下属的
  21. $type = input('type',0);
  22. list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  23. switch($type){
  24. case 1:
  25. $staff = Staff::info();
  26. $wheres['create_staff_id'] = $staff->id;
  27. break;
  28. case 2:
  29. $wheres['create_staff_id'] = array('in',Staff::getLowerStaffId());
  30. break;
  31. default:
  32. $wheres['create_staff_id'] = array('in',Staff::getMyStaffIds());
  33. break;
  34. }
  35. $wheres['type'] = 0;//上下班打卡
  36. $list = $this->model->where($where)->where($wheres)->with(['createStaff'])->order($sort, $order)->paginate($limit);
  37. $row = $list->items();
  38. $result = array("total" => $list->total(), "rows" => $row);
  39. return json($result);
  40. }
  41. return $this->view->fetch();
  42. }
  43. }