123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <?php
- namespace app\api\controller\v1;
- use app\api\controller\Base;
- use app\hander\HelpHander;
- use think\Db;
- class AttendanceRecord extends Base
- {
- // 列表
- public function list(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $name = input('name','','trim');
- $startTime = input('startTime','','trim');
- $endTime = input('endTime','','trim');
- $ret = model('AttendanceRecord')->lists($page,$size,$name,$startTime,$endTime,$this->orgId);
- HelpHander::success($ret);
- }
- // 手机打卡
- public function save(){
- model('AttendanceRecord')->sjsign();
- HelpHander::success([],'操作成功');
- }
- // 绑定设备
- public function bundleDevice(){
- $deviceSn = input('deviceSn','','trim');
- model('AttendanceRecord')->bundleDevice($this->userId,$deviceSn);
- HelpHander::success([],'操作成功');
- }
- // 解绑设备
- public function unBundleDevice(){
- $uId = input('uId/d',0);
- model('AttendanceRecord')->unBundleDevice($uId);
- HelpHander::success([],'操作成功');
- }
- public function listByStaffId(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $startTime = input('startTime','','trim');
- $endTime = input('endTime','','trim');
- $uid = input('staffId/d',0);
- $ret = model('AttendanceRecord')->listByStaffId($page,$size,$this->orgId,$uid,$startTime,$endTime);
- HelpHander::success($ret);
- }
- public function attendanceStatistics(){
- $month = input('month','','trim');
- $page = input('page/d',1);
- $size = input('size/d',10);
- $userName = input('userName','','trim');
- $ret = model('AttendanceRecordResult')->attendanceStatistics($month,$page,$size,$this->orgId,$userName);
- HelpHander::success($ret);
- }
- public function changeAttendance(){
- $data = [
- "type" => input('type/d',1),
- "time" => input('time','',''),
- "min" => input('min/d',0),
- "id" => input('id/d',0),
- "cate" => input('cate/d',0),
- "status" => input('status/d',0)
- ];
- if($data['type'] == 2&&$data['min'] <= 0){
- HelpHander::error('分钟数不能为0');
- }
- if(!$data['time']){
- HelpHander::error('参数错误');
- }
- model('AttendanceUserClass')->changeAttendance($data,$this->orgId);
- HelpHander::success([],'操作成功');
- }
- //考勤报表导出
- public function attendanceExport(){
- $month = input('month','','trim');
- $userName = input('userName','','trim');
- $ret = model('AttendanceRecordResult')->attendanceExport($month,$this->orgId,$userName);
- HelpHander::success($ret);
- }
- }
|