예제 #1
0
 public function removeMonitorAction()
 {
     $da = $this->get("we_data_access");
     $da_im = $this->get('we_data_access_im');
     $request = $this->getRequest();
     //访问权限校验
     $api = new ApiController();
     $api->setContainer($this->container);
     $isWeFaFaDomain = $api->checkWWWDomain();
     if (!$isWeFaFaDomain) {
         $token = $api->checkAccessToken($request, $da);
         if (!$token) {
             $re = array("returncode" => "9999");
             $re["code"] = "err0105";
             $re["msg"] = "参数Appid或Openid或Access_token未指定或无效.";
             return $this->responseJson($request, $re);
         }
     }
     $openid = $request->get("openid");
     $staffinfo = new Staff($da, $da_im, $openid, $this->get("logger"), $this->container);
     $staffdata = $staffinfo->getInfo();
     if (empty($staffdata)) {
         $result = Utils::WrapResultError("无效操作帐号");
         return $this->responseJson($request, $result);
     }
     $to = $request->get("to");
     if (empty($to)) {
         $result = Utils::WrapResultError("无效的帐号");
         return $this->responseJson($request, $result);
     }
     $to = $staffinfo->getStaffInfo($to);
     if (empty($to)) {
         $result = Utils::WrapResultError("无效的帐号");
         return $this->responseJson($request, $result);
     }
     try {
         $sql = 'delete from  t_module_location_monitor where staff=?';
         $da->ExecSQL($sql, array((string) $to['jid']));
         $sql = 'delete from  t_module_location where staff=?';
         $da->ExecSQL($sql, array((string) $to['login_account']));
     } catch (\Exception $e) {
     }
     $senddata = array('opt' => 'stop');
     $msg = Utils::WrapMessage('sendlocation', $senddata, array());
     //$msgxml = Utils::WrapMessageXml($this->module["jid"],$msg,'sendlocation-id');
     $api->sendMsg("", $to['jid'], 'sendlocation', json_encode($msg));
     return $this->responseJson($request, Utils::WrapResultOk(""));
 }
예제 #2
0
 public function getManager($paraObj)
 {
     $eno = $paraObj['user']->eno;
     $data = $this->getInfo($eno);
     if (empty($data)) {
         return Utils::WrapResultError("无效的企业信息");
     }
     $result = array();
     $managers = $data['sys_manager'];
     $managers = explode(';', $managers);
     $staffMgr = new Staff($this->da, $this->db_im, $paraObj['user'], $this->logger, $this->container);
     foreach ($managers as $key => $value) {
         $result[] = $staffMgr->getStaffInfo($value);
     }
     return Utils::WrapResultOK($result);
 }
예제 #3
0
 public function getGroupMembers($parameter)
 {
     try {
         $da = $this->conn;
         $da_im = $this->conn_im;
         $groupid = $parameter["groupid"];
         $pageindex = $parameter["page_index"];
         $limit = $parameter["limit"];
         $user = $parameter["user"];
         $sql = "  select groupid, employeeid,grouprole from im_groupemployee where groupid=? limit " . ($pageindex - 1) * $limit . " , " . $limit;
         $table = $da_im->GetData("group", $sql, array((string) $groupid));
         $staffinfo = new Staff($da, $da_im, $user, $this->get("logger"), $this->container);
         foreach ($table["group"]["rows"] as $key => $value) {
             $staff = $staffinfo->getStaffInfo($table["group"]["rows"][$key]['employeeid']);
             $table['group']['rows'][$key]['dept_name'] = $staff["dept_name"];
             $table['group']['rows'][$key]['nick_name'] = $staff['nick_name'];
             $table['group']['rows'][$key]['login_account'] = $staff['login_account'];
             $table['group']['rows'][$key]['mobile'] = $staff['mobile_bind'];
             $table['group']['rows'][$key]['photo_path'] = $staff['photo_path'];
         }
         // $result = Utils::WrapResultOK($table["group"]["rows"]);
         // return $this->container->responseJson($request,$result);
         return $table["group"]["rows"];
     } catch (\Exception $e) {
         return null;
     }
 }
예제 #4
0
    public function getNoAtten($paramObj)
    {
        $user = $paramObj['user'];
        $eno = $user->eno;
        $ymd = $paramObj['ymd'];
        $deptid = $this->getDeptSql($paramObj['deptid']);
        $limit = $paramObj['limit'];
        $pageIndex = $paramObj['pageIndex'];
        $da = $this->conn;
        $da_im = $this->conn_im;
        if (empty($ymd)) {
            $ymd = date('Y-m-d');
        }
        $getatten_setup = $this->getatten_setup($paramObj);
        if ($getatten_setup['returncode'] != '0000' || count($getatten_setup['data']) == 0) {
            return Utils::WrapResultError('未正确的设置考勤参数');
        }
        $late_time = $getatten_setup['data'][0]['late_time'];
        $offwork_time = $getatten_setup['data'][0]['offwork_time'];
        $sql = 'select temp.staff_id ,"未考勤" state ,"未考勤" atten_date
				from (
					 select s.login_account staff_id
					 from we_staff s
					 where #deptid
					 and s.eno=?
					 and s.login_account not in (
						 select c.staff_id
						 from ma_checkatten c
						 where c.check_date=?
						 and c.eno = ?
						 group by c.staff_id
						 union all
						 select login_account from we_service
					 )
					 ) temp
					 limit ' . ($pageIndex - 1) * $limit . ' , ' . $limit;
        $sql = str_replace("#deptid", $deptid, $sql);
        $ds = $da->GetData('t', $sql, array((string) $eno, (string) $ymd, (string) $eno));
        $staff = new Staff($da, $da_im, $user, $this->container->get("logger"), $this->container);
        foreach ($ds['t']['rows'] as $key => $value) {
            $staffinfo = $staff->getStaffInfo($ds['t']['rows'][$key]['staff_id']);
            $ds['t']['rows'][$key]['nick_name'] = $staffinfo['nick_name'];
            $ds['t']['rows'][$key]['dept_name'] = $staffinfo['dept_name'];
            $ds['t']['rows'][$key]['mobile_bind'] = $staffinfo['mobile_bind'];
            $ds['t']['rows'][$key]['photo_path'] = $staffinfo['photo_path'];
        }
        return Utils::WrapResultOK(count($ds['t']['rows']) > 0 ? $ds['t']['rows'] : array());
    }