コード例 #1
0
 public function accessCheck()
 {
     $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 $re;
         }
     }
     $openid = $request->get("openid");
     $staffinfo = new Staff($da, $da_im, $openid, $this->get("logger"), $this->container);
     $staffdata = $staffinfo->getInfo();
     if (empty($staffdata)) {
         return Utils::WrapResultError("无效操作帐号");
     }
     return Utils::WrapResultOk($staffinfo);
 }
コード例 #2
0
 public function sendSMSAction($mobiles, $msg)
 {
     $SmsFunction = null;
     try {
         $syspara = new \Justsy\BaseBundle\DataAccess\SysParam($this->container);
         $SmsFunction = $syspara->GetSysParam('SMS_FUNCTION_NAME', '');
     } catch (\Exception $e) {
         return Utils::WrapResultError($e->getMessage());
     }
     if (!empty($SmsFunction)) {
         $re = call_user_func(array($this, $SmsFunction), $mobiles, $msg);
         return $re;
     }
     $SMS_ACT = $this->container->getParameter('SMS_ACT');
     $SMS_PWD = $this->container->getParameter('SMS_PWD');
     $SMS_URL = $this->container->getParameter('SMS_URL');
     $mobiles = str_replace(";", ",", $mobiles);
     $content = urlEncode(urlEncode(mb_convert_encoding($msg, 'gb2312', 'utf-8')));
     $pwd = md5($SMS_PWD);
     $apidata = "func=sendsms&username={$SMS_ACT}&password={$pwd}&mobiles={$mobiles}&message={$content}&smstype=0&timerflag=0&timervalue=&timertype=0&timerid=0";
     $this->get("logger")->err($SMS_URL . "?" . $apidata);
     $result = mb_convert_encoding($this->do_post_request($SMS_URL . "?" . $apidata, null), 'utf-8', 'gb2312');
     $this->get("logger")->err($result);
     return Utils::WrapResultOK('');
 }
コード例 #3
0
ファイル: QrcodeMgr.php プロジェクト: 3116246/haolinju
 public function e($parameters)
 {
     if (count($parameters) == 0) {
         return Utils::WrapResultError("无效的eno参数");
     }
     $eno = $parameters[0];
     if (empty($eno)) {
         return Utils::WrapResultError("无效的eno参数");
     }
     $staffMgr = new Enterprise($this->conn, $this->logger, $this->container);
     $staffdata = $staffMgr->getInfo($eno);
     if (empty($staffdata)) {
         return Utils::WrapResultError("未查找到企业信息");
     }
     return Utils::WrapResultOK($staffdata);
 }
コード例 #4
0
 public function push_receiverlistAction()
 {
     $da = $this->get("we_data_access");
     $da_im = $this->get('we_data_access_im');
     $request = $this->getRequest();
     //访问权限校验
     $api = new \Justsy\OpenAPIBundle\Controller\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 \Justsy\BaseBundle\Management\Staff($da, $da_im, $openid, $this->get("logger"), $this->container);
     $staffdata = $staffinfo->getInfo();
     if (empty($staffdata)) {
         $result = Utils::WrapResultError("无效操作帐号");
         return $this->responseJson($request, $result);
     }
     $appid = $request->get('appid');
     $appmgr = new \Justsy\BaseBundle\Management\App($this->container);
     $appdata = $appmgr->getappinfo(array('appid' => $appid));
     if (empty($appdata)) {
         $result = Utils::WrapResultError("无效应用标识");
         return $this->responseJson($request, $result);
     }
     $data = $request->get("data");
     //部门名称
     if (empty($data)) {
         $result = Utils::WrapResultError("无效的数据");
         return $this->responseJson($request, $result);
     }
     $data = json_decode($data, true);
     $noticeMgr = new \Justsy\BaseBundle\Management\PromptlyNotice($this->container, $staffdata, $appdata);
     $result = $noticeMgr->getReceiverList($data);
     return $this->responseJson($request, $result);
 }
コード例 #5
0
ファイル: GroupMgr.php プロジェクト: 3116246/haolinju
 public function setCovert($parameter)
 {
     $groupid = isset($parameter["groupid"]) ? $parameter["groupid"] : null;
     $jid = isset($parameter["jid"]) ? $parameter["jid"] : null;
     $state = isset($parameter["state"]) ? $parameter["state"] : "1";
     //默认为添加
     $success = true;
     $msg = "";
     if (empty($groupid)) {
         return Utils::WrapResultError('群编号不能为空');
     } else {
         if (empty($jid)) {
             return Utils::WrapResultError('设置的成员帐号不能为空');
         }
     }
     $sql = "";
     $para = array();
     if ($state == "1") {
         $sql = "insert into im_groupemployee_covert(groupid,jid)values(?,?);";
     } else {
         $sql = "delete from im_groupemployee_covert where groupid=? and jid=?;";
     }
     try {
         $this->conn_im->ExecSQL($sql, array((string) $groupid, (string) $jid));
         //向成员发送出席
         $user = $parameter["user"];
         $title = $state == "1" ? "set_covert" : "cancel_covert";
         $message = $state == "1" ? "设置了您的屏蔽群消息" : "取消了您的屏蔽群消息";
         Utils::sendImPresence($user->fafa_jid, $jid, $title, $message, $this->container, "", "", true, '', '0');
     } catch (\Exception $e) {
         $success = false;
         $msg = $state == "1" ? "设置屏蔽成员失败!" : "取消屏蔽成员失败!";
         return Utils::WrapResultError($e->getMessage());
     }
     return Utils::WrapResultOK('1');
 }
コード例 #6
0
 public function getfriendcardAction()
 {
     $re = array("returncode" => ReturnCode::$SUCCESS);
     $request = $this->getRequest();
     $uEno = "";
     $userJid = "";
     $currUser = $this->get('security.context')->getToken();
     if (!empty($currUser)) {
         $user = $currUser->getUser();
         $uEno = $user->eno;
         //当前登录人企业 号
         $userJid = $user->fafa_jid;
     } else {
         $ds = $this->getstaffinfo($request->get("Openid") . $request->get("openid"));
         if (empty($ds)) {
             $re = Utils::WrapResultError("当前操作人帐号无效");
             $response = new Response($request->get('jsoncallback') ? $request->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re));
             $response->headers->set('Content-Type', 'text/json');
             return $response;
         }
         $uEno = $ds["eno"];
         $userJid = $ds["jid"];
     }
     $staff = $request->get("staff");
     $ds = $this->getstaffinfo($staff);
     if (empty($ds)) {
         $re = Utils::WrapResultError("未查询到用户数据!");
     } else {
         $_source = $request->get("_source");
         //wefafa_bizproxy:业务代理
         if ($ds["eno"] != $uEno) {
             $da_im = $this->get('we_data_access_im');
             //判断该人员是否自己好友
             $dfriend = $da_im->GetData("f", "select count(1) from rosterusers where username=? and jid=? and subscription='B'", array((string) $userJid, (string) $ds["we_staff"]["rows"][0]["jid"]));
             if ($dfriend == null || count($dfriend["f"]["rows"]) == 0) {
                 $re = Utils::WrapResultError("没有权限查询该帐号的信息", ReturnCode::$NOTACCESS);
             } else {
                 if ("wefafa_bizproxy" != $_source) {
                     $re["staff_full"] = $ds;
                     $re["staff_full"]["pinyin"] = Utils::Pinyin($re["staff_full"]["nick_name"]);
                 } else {
                     $re = $ds;
                     $re["pinyin"] = Utils::Pinyin($re["nick_name"]);
                     $re["returncode"] = ReturnCode::$SUCCESS;
                 }
             }
         } else {
             if ("wefafa_bizproxy" != $_source) {
                 $re["staff_full"] = $ds;
                 $re["staff_full"]["pinyin"] = Utils::Pinyin($re["staff_full"]["nick_name"]);
             } else {
                 $re = $ds;
                 $re["pinyin"] = Utils::Pinyin($re["nick_name"]);
                 $re["returncode"] = ReturnCode::$SUCCESS;
             }
         }
     }
     $response = new Response($request->get('jsoncallback') ? $request->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re));
     $response->headers->set('Content-Type', 'text/json');
     return $response;
 }
コード例 #7
0
 public function listAction()
 {
     $da = $this->get("we_data_access");
     $da_im = $this->get('we_data_access_im');
     $request = $this->getRequest();
     //访问权限校验
     $api = new \Justsy\OpenAPIBundle\Controller\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 \Justsy\BaseBundle\Management\Staff($da, $da_im, $openid, $this->get("logger"), $this->container);
     $staffdata = $staffinfo->getInfo();
     if (empty($staffdata)) {
         $result = Utils::WrapResultError("无效操作帐号");
         return $this->responseJson($request, $result);
     }
     $verCrl = new \Justsy\AdminAppBundle\Controller\VersionController();
     $verCrl->setContainer($this->container);
     return $this->responseJson($request, $verCrl->SearchVersionAction());
 }
コード例 #8
0
ファイル: ApplyLeaveMgr.php プロジェクト: 3116246/haolinju
 public function reject($paraObj)
 {
     $currUser = $paraObj["user"];
     if (empty($currUser)) {
         return Utils::WrapResultError("请登录后重试", ReturnCode::$NOTLOGIN);
     }
     $wfl = new \Justsy\BaseBundle\Business\WeWorkflow($this->container);
     //根据申请帐号处理
     $account = isset($paraObj["staff"]) ? $paraObj["staff"] : "";
     if (!empty($account)) {
         $paraObj["submit_staff"] = $account;
     }
     $nodeinfo = $wfl->getNode($paraObj);
     if (empty($nodeinfo)) {
         return Utils::WrapResultError("申请已被取消或删除");
     }
     //判断申请状态
     if ($nodeinfo["status"] != "9") {
         return Utils::WrapResultError("该申请已处理");
     }
     //向申请人发送处理消息
     $message = "你的请假申请已由【" . $currUser->nick_name . "】驳回";
     Utils::sendImMessage("", $applystaff, "bus_apply_reject", $message, $this->container, "", "", true, '', '0');
     $paraObj["node_id"] = $nodeinfo["node_id"];
     //申请状态处理
     $re = $wfl->reject($paraObj);
     //消息通知
     if (!empty($re)) {
         //通知所有的节点处理人
         $dealstaffJids = isset($re["dealstaffs"]) ? $re["dealstaffs"] : "";
         if (!empty($dealstaffJids)) {
             $to = explode(",", $dealstaffJids);
             Utils::sendImMessage("", $to, "bus_apply_reject", json_encode($re), $this->container, "", "", false, '', '0');
         }
     }
     return Utils::WrapResultOK($re);
 }
コード例 #9
0
ファイル: EnoParamManager.php プロジェクト: 3116246/haolinju
 private function parseEjabberdCfg($cfgPath)
 {
     $data = array();
     $handle = @fopen($cfgPath, "r");
     if ($handle) {
         while (($buffer = fgets($handle)) !== false) {
             $buffer = trim($buffer);
             if (empty($buffer) || $buffer[0] == '%') {
                 //$data[] = $buffer;
             } else {
                 $data[] = $buffer[strlen($buffer) - 1] == '.' ? rtrim($buffer, '.') . '\\n' : $buffer;
             }
         }
         if (!feof($handle)) {
             return Utils::WrapResultError($cfgPath . '文件上调用fgets函数失败!');
         }
         fclose($handle);
         $formatContent = implode('', $data);
         $data = explode('\\n', $formatContent);
         return Utils::WrapResultOK($data);
     } else {
         return Utils::WrapResultError($cfgPath . '文件打开失败,请检查参数ejabberd_server_path设置及文件是否存在!');
     }
 }
コード例 #10
0
ファイル: HrAttendance.php プロジェクト: 3116246/haolinju
    public function getCountNoAtten($paramObj)
    {
        $ymd = $paramObj['ymd'];
        $deptid = $this->getDeptSql($paramObj['deptid']);
        $user = $paramObj['user'];
        $eno = $user->eno;
        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 count(1) count
				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 ';
        $sql = str_replace("#deptid", $deptid, $sql);
        $da = $this->conn;
        $ds = $da->GetData('t', $sql, array((string) $eno, (string) $ymd, (string) $eno));
        return Utils::WrapResultOK(count($ds['t']['rows']) > 0 ? $ds['t']['rows'][0]['count'] : array());
    }
コード例 #11
0
ファイル: Dept.php プロジェクト: 3116246/haolinju
 public function setFriend($parameter)
 {
     $userinfo = $parameter["user"];
     $user = array();
     $user["login_account"] = $userinfo->getUserName();
     $user["fafa_jid"] = $userinfo->fafa_jid;
     $deptids = $parameter["deptid"];
     $success = true;
     $message = array();
     for ($i = 0; $i < count($deptids); $i++) {
         $deptid = $deptids[$i];
         $sql = 'update im_base_dept set friend=1 where deptid=?';
         $this->conn_im->ExecSQL($sql, array((string) $deptid));
         $this->getinfo($deptid, true);
         $re = $this->setFriendByDept($deptid);
         if (!$re["success"]) {
             return Utils::WrapResultError($re["message"]);
         }
     }
     return Utils::WrapResultOK('');
 }
コード例 #12
0
ファイル: Service.php プロジェクト: 3116246/haolinju
 public function getMessageDetail($parameter)
 {
     $msgid = $parameter["msgid"];
     $sql = "select msg_title,msg_type,case when msg_type='TEXT' then msg_text else msg_content end as msg_content,ifnull(msg_summary,'') msg_summary,msg_img_url \n              from we_micro_message where send_id=?;";
     $success = true;
     $returndata = array();
     $msg_type = "";
     try {
         $ds = $this->conn->GetData("table", $sql, array((string) $msgid));
         if ($ds && $ds["table"]["recordcount"] > 0) {
             $returndata = $ds["table"]["rows"];
             $msg_type = strtolower($ds["table"]["rows"][0]["msg_type"]);
         }
     } catch (\Exception $e) {
         $success = false;
         $this->logger->err($e->getMessage());
         return Utils::WrapResultError($e->getMessage());
     }
     return Utils::WrapResultOK($returndata);
 }
コード例 #13
0
ファイル: Staff.php プロジェクト: 3116246/haolinju
 public function checkmobile($parameter)
 {
     $list = $parameter["list"];
     //手机号列表。多个手机号用,分隔
     if (empty($list)) {
         return Utils::WrapResultError("手机号不能为空");
     }
     $sqlqlist = array();
     $para = array();
     $list = explode(",", $list);
     $reglist = array();
     for ($i = 0; $i < count($list); $i++) {
         $m = $list[$i];
         if (empty($m)) {
             continue;
         }
         $sqlqlist[] = "?";
         $para[] = (string) $m;
     }
     if (count($sqlqlist) == 0) {
         return Utils::WrapResultError("手机号不能为空");
     }
     $sql = "select mobile_bind mobile,login_account,fafa_jid,nick_name from we_staff where mobile_bind in(" . implode(",", $sqlqlist) . ")";
     try {
         $ds = $this->conn->GetData("t", $sql, $para);
         if ($ds && count($ds["t"]["rows"]) > 0) {
             for ($i = 0; $i < count($ds["t"]["rows"]); $i++) {
                 $reglist[] = $ds["t"]["rows"][$i];
             }
         }
         return $reglist;
     } catch (\Exception $e) {
         $this->logger->err($e->getMessage());
         return Utils::WrapResultError($e->getMessage());
     }
 }
コード例 #14
0
ファイル: PromptlyNotice.php プロジェクト: 3116246/haolinju
 public function reply($data)
 {
     $noticeid = $data["noticeid"];
     if (empty($noticeid)) {
         return Utils::WrapResultError("noticeid不能为空");
     }
     $files = isset($data["files"]) ? $data["files"] : '';
     if (!empty($files) && is_array($files)) {
         $files = implode(',', $files);
     }
     $sql = 'update im_pushnotice_memebr set receive_time=now() where noticeid=? and employeeid=? and receive_time is not null';
     $sql1 = 'insert into im_pushnotice_msg(id,replyid,msg,created,us,msgid)values(?,?,?,now(),?,?)';
     $replyid = SysSeq::GetSeqNextValue($this->conn_im, "im_pushnotice_msg", "id");
     $sql = 'select count(1)+1 cnt from im_pushnotice_msg where replyid=?';
     $ds = $this->conn_im->Getdata('t', $sql, array((int) $noticeid));
     $cnt = $ds['t']['rows'][0]['cnt'];
     $senddata = array();
     $senddata = array('noticeid' => $noticeid, 'reply_count' => $cnt, 'reply' => array('id' => $replyid, 'nickname' => $this->user["nick_name"], 'photo' => $this->user["photo_path"], 'jid' => $this->user["jid"], 'text' => $data["reply-text"], 'files' => $files, 'sendtime' => date("Y-m-d H:i:s", time())));
     $notice = array();
     // Utils::WrapMessageNoticeinfo($data["reply-text"],$this->module["appname"],null,$this->module["logo"]);
     $msg = Utils::WrapMessage('push-notice-reply', $senddata, $notice);
     $msgxml = Utils::WrapMessageXml($this->module["jid"], $msg, 'push-notice-reply-' . $replyid);
     $this->conn_im->ExecSQLs(array($sql, $sql1), array(array((int) $noticeid, (string) $this->user["jid"]), array((int) $replyid, (int) $noticeid, (string) json_encode($senddata['reply']), $this->user['jid'], 'push-notice-reply-' . $replyid)));
     $noticeinfo = $this->getinfo($noticeid);
     $receiver = $this->getmember($noticeid);
     $receiver[] = $noticeinfo["us"];
     Utils::findonlinejid($this->conn_im, $receiver);
     if (!empty($receiver)) {
         //发送消息
         $presence = new \Justsy\OpenAPIBundle\Controller\ApiController();
         $presence->setContainer($this->container);
         $presence->sendMsg($this->module["jid"], $receiver, '通知回复', json_encode($msg));
     }
     return Utils::WrapResultOK(array('noticeid' => $noticeid));
 }
コード例 #15
0
ファイル: Enterprise.php プロジェクト: 3116246/haolinju
 public function dealapplylist($paraObj)
 {
     $currUser = $paraObj["user"];
     if (empty($currUser)) {
         return Utils::WrapResultError("请登录后重试", ReturnCode::$NOTLOGIN);
     }
     $wfl = new \Justsy\BaseBundle\Business\WeWorkflow($this->container);
     if (isset($paraObj["status"])) {
         if ($paraObj["status"] == "todo") {
             return Utils::WrapResultOK($wfl->listtodo($paraObj));
         }
         if ($paraObj["status"] == "did") {
             return Utils::WrapResultOK($wfl->listtdid($paraObj));
         }
     }
     return Utils::WrapResultOK($wfl->listall($paraObj));
 }
コード例 #16
0
ファイル: ApiController.php プロジェクト: 3116246/haolinju
 public function revokeMsgAction()
 {
     //判断请求域。是wefafa或子域则不验证授权令牌
     $isWeFaFaDomain = $this->checkWWWDomain();
     $request = $this->get("request");
     $da = $this->get("we_data_access");
     if (!$isWeFaFaDomain) {
         $token = $this->checkAccessToken($request, $da);
         if (!$token) {
             return $this->responseJson($request, Utils::WrapResultError('参数Appid或Openid或Access_token未指定或无效.'));
         }
     }
     $openid = $request->get("openid");
     $staffinfo = new \Justsy\BaseBundle\Management\Staff($da, $this->get("we_data_access_im"), $openid, $this->get("logger"), $this->container);
     $staffdata = $staffinfo->getInfo();
     if (empty($staffdata)) {
         $result = Utils::WrapResultError("无效操作帐号");
         return $this->responseJson($request, $result);
     }
     $to_jid = array();
     $chatjid = $request->get('jid');
     $to_jid[] = $chatjid;
     $groupid = $request->get('groupid');
     $msgid = $request->get('msgid');
     if (empty($chatjid) && empty($groupid)) {
         return $this->responseJson($request, Utils::WrapResultError('无效的撤回类型.'));
     }
     if (empty($msgid)) {
         return $this->responseJson($request, Utils::WrapResultError('无效的消息ID.'));
     }
     if (!empty($groupid)) {
         $groupMgr = new \Justsy\BaseBundle\Management\GroupMgr($da, $this->get("we_data_access_im"), $this->container);
         $to_jid = $groupMgr->getGroupMembersJidByIM($groupid);
         //群消息默认采用的发送时的iq ID。生成规则:Msgid =case QMsgid of []-> From#jid.luser++"-"++IQId; _-> QMsgid end,
         //生成消息ID
         $jid_user = explode('@', $staffdata['jid'])[0];
         $msgid = $jid_user . '-' . $msgid;
     }
     $msgtype = !empty($chatjid) ? 'chat' : 'group';
     $notice = array();
     $message = json_encode(Utils::WrapMessage('message_revoke', array('type' => $msgtype, 'msgid' => $msgid, 'sender' => array('nick_name' => $staffdata['nick_name'], 'photo' => $staffdata['photo_path'], 'jid' => $staffdata['jid'], 'sendtime' => date("Y-m-d H:i:s", time()))), $notice));
     $success = Utils::sendImMessage($staffdata['jid'], $to_jid, "message_revoke", $message, $this->container, "", "", false, Utils::$systemmessage_code);
     return $this->responseJson($request, Utils::WrapResultOK(''));
 }
コード例 #17
0
 public function mobilenumactiveAction()
 {
     $deploy_mode = $this->container->getParameter('deploy_mode');
     $request = $this->getRequest();
     $mobile_num = $request->get('mobile_num');
     $mobile_pwd = $request->get('mobile_pwd');
     //$eno = $request->get('eno');
     $eno = $deploy_mode == "C" ? Utils::$PUBLIC_ENO : $this->container->getParameter("ENO");
     //企业独立部署时企业不设置,从配置文件中获取固定的企业号
     $ename = $request->get('ename');
     $nick_name = $request->get('nick_name');
     $active_code = $request->get('active_code');
     $login_account = $mobile_num;
     $ldap_uid = $request->get("ldap_uid");
     if (empty($active_code)) {
         return $this->getResponse(ReturnCode::$OTHERERROR, "请输入短信验证码!");
     }
     if (empty($mobile_pwd)) {
         return $this->getResponse(ReturnCode::$OTHERERROR, "请输入密码!");
     }
     if (empty($nick_name)) {
         return $this->getResponse(ReturnCode::$OTHERERROR, "请输入姓名!");
     }
     $da = $this->get('we_data_access');
     $da_im = $this->get('we_data_access_im');
     $cacheobj = new \Justsy\BaseBundle\Management\Enterprise($da, $this->get("logger"), $this->container);
     if (!strpos($login_account, "@")) {
         $domain = $this->container->getParameter('edomain');
         $login_account .= "@" . $domain;
     }
     $staffMgr = new \Justsy\BaseBundle\Management\Staff($da, $da_im, $login_account, $this->get("logger"), $this->container);
     $had = $staffMgr->getInfo();
     if (!empty($had)) {
         return $this->getResponse(ReturnCode::$OTHERERROR, "该手机号已注册,继续使用请先找回密码");
     }
     //判断手机号是否已经被使用
     if ($staffMgr->checkUser($mobile_num)) {
         return $this->getResponse(ReturnCode::$OTHERERROR, "该手机号已被绑定,请解绑后重试");
     }
     $sysparam = new \Justsy\BaseBundle\DataAccess\SysParam($this->container);
     $wn_code = $sysparam->GetSysParam("mobile_active_code");
     try {
         if ($wn_code != $active_code) {
             $sql = "select state_id,active_code,review_note from we_register where login_account=?";
             $ds = $da->GetData("we_register", $sql, array($login_account));
             if ($ds && $ds['we_register']['recordcount'] <= 0) {
                 return $this->getResponse(ReturnCode::$OTHERERROR, "未找到该手机号的注册信息!");
             }
             if ($ds['we_register']['rows'][0]['state_id'] == '3') {
                 return $this->getResponse(ReturnCode::$OTHERERROR, "该手机号已被注册!");
             }
             if ((empty($ds['we_register']['rows'][0]['review_note']) ? 0 : $ds['we_register']['rows'][0]['review_note']) >= 5) {
                 return $this->getResponse(ReturnCode::$OTHERERROR, "抱歉,验证码请求次数过多,如果获取不到验证码请根据下方提示与我们联系");
             }
             if ($ds['we_register']['rows'][0]['active_code'] != $active_code) {
                 $num = 5 - (empty($ds['we_register']['rows'][0]['review_note']) ? 0 : $ds['we_register']['rows'][0]['review_note']);
                 $sql = "update we_register set review_note=ifnull(review_note,0)+1 where login_account=?";
                 $da->ExecSQL($sql, array($login_account));
                 return $this->getResponse(ReturnCode::$OTHERERROR, "验证码错误,请重新输入。");
             }
         }
         $para = array();
         $para['account'] = $mobile_num;
         $para['password'] = $mobile_pwd;
         $para['deptid'] = '';
         $para['nick_name'] = $nick_name;
         $para['ldap_uid'] = '';
         $re = $staffMgr->createstaff($para);
     } catch (\Exception $e) {
         $re = Utils::WrapResultError($e->getMessage());
     }
     return $this->getResponse($re['returncode'], $re['msg']);
 }
コード例 #18
0
ファイル: ServerMonitor.php プロジェクト: 3116246/haolinju
 public function webServerCtl($paraObj)
 {
     $command = $paraObj['command'];
     if (empty($command)) {
         $result = Utils::WrapResultError("无效的命令");
         return $this->responseJson($result);
     }
     try {
         $dir = explode("src", __DIR__);
         if ($command == "start") {
             $str = "php {$dir[0]}app/console cache:clear --env=prod --no-debug\nchmod -R 777 {$dir[0]}app";
             $command = $dir[0] . 'clear_cache_prod.sh';
             $data = shell_exec($command);
             if (strpos($data, 'Clearing the cache for the prod environment with debug false') === false) {
                 throw new Exception($data);
             }
             return Utils::WrapResultOK($data);
         }
         return Utils::WrapResultError('无效的命令' . $command);
     } catch (\Exception $e) {
         $this->logger->err($e);
         return Utils::WrapResultError($e->getMessage());
     }
 }
コード例 #19
0
 public function SearchVersionAction()
 {
     $da = $this->get("we_data_access");
     $request = $this->getRequest();
     $pageindex = (int) $request->get("pageindex");
     $pagenumber = (int) $request->get("record");
     $success = true;
     $msg = "";
     $limit = " limit " . ($pageindex - 1) * $pagenumber . "," . $pagenumber;
     $para = array();
     $url = $this->container->getParameter('FILE_WEBSERVER_URL');
     $sql = "select a.id,version,case type when 0 then 'PC版' when 1 then 'Android版' when 2 then 'IOS版' end apptype,update_content,\n                   concat('{$url}',fileid) down_url,date_format(date,'%Y-%m-%d %H:%i') date,nick_name\n            from we_version a inner join we_staff b on staffid=login_account order by date desc,type desc " . $limit;
     try {
         $ds = $da->GetData("table", $sql, $para);
     } catch (\Exception $e) {
         $this->get("logger")->err($e->getMessage());
         return Utils::WrapResultError($e->getMessage());
     }
     $data = $ds["table"]["rows"];
     $recordcount = 0;
     if ($pageindex == 1) {
         //如果为第一页时返回记录总数
         $sql = " select count(*) recordcount from we_version;";
         if (count($para) > 0) {
             $ds = $da->GetData("table", $sql, $para);
         } else {
             $ds = $da->GetData("table", $sql);
         }
         if ($ds && $ds["table"]["recordcount"] > 0) {
             $recordcount = $ds["table"]["rows"][0]["recordcount"];
         }
     }
     return Utils::WrapResultOK($data);
 }
コード例 #20
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(""));
 }
コード例 #21
0
ファイル: SystemController.php プロジェクト: 3116246/haolinju
 public function resetpwdAction()
 {
     $request = $this->getRequest();
     $account = $request->get("account");
     $txtvaildcode = $request->get("txtvaildcode");
     $pwd = $request->get("txtnewpwd");
     $pwd_im = $pwd;
     $da = $this->get("we_data_access");
     $da_im = $this->get("we_data_access_im");
     $re = array("returncode" => ReturnCode::$SUCCESS);
     if (empty($account)) {
         return $this->responseJson(Utils::WrapResultError("帐号不能为空"), $request->get('jsoncallback'));
     }
     if (empty($txtvaildcode)) {
         return $this->responseJson(Utils::WrapResultError("验证码不能为空"), $request->get('jsoncallback'));
     }
     //验证帐号及验证码
     $isEmail = Utils::validateEmail($account);
     $isMobile = Utils::validateMobile($account);
     if (!$isEmail && !$isMobile) {
         return $this->responseJson(Utils::WrapResultError("帐号格式不正确,仅支持邮箱或手机帐号"), $request->get('jsoncallback'));
     }
     $u_staff = new \Justsy\BaseBundle\Management\Staff($da, $da_im, $account, $this->get('logger'), $this->container);
     $targetStaffInfo = $u_staff->getInfo();
     if (empty($targetStaffInfo)) {
         return $this->responseJson(Utils::WrapResultError("帐号无效"), $request->get('jsoncallback'));
     }
     $sysparam = new \Justsy\BaseBundle\DataAccess\SysParam($this->container);
     $wn_code = $sysparam->GetSysParam("mobile_active_code");
     if ($txtvaildcode != $wn_code) {
         $sql = "select * from we_mobilebind_validcode where login_account=? and actiontype='FP' and valid_date>now() order by valid_date desc limit 0,1";
         $ds = $da->GetData('t', $sql, array((string) $account));
         if ($txtvaildcode != $ds["t"]["rows"][0]["validcode"]) {
             return $this->responseJson(Utils::WrapResultError("验证码无效"), $request->get('jsoncallback'));
         }
     }
     try {
         $login_account = $targetStaffInfo['login_account'];
         $re = $u_staff->changepassword($login_account, $pwd, $this->get('security.encoder_factory'));
         return $this->responseJson($re, $request->get('jsoncallback'));
     } catch (Exception $e) {
         return $this->responseJson(Utils::WrapResultError("重置密码失败,请稍后重试"), $request->get('jsoncallback'));
     }
 }
コード例 #22
0
ファイル: App.php プロジェクト: 3116246/haolinju
 public function save($parameter)
 {
     $curuser = $parameter["user"];
     $sql = "";
     $para = array();
     $da = $this->conn;
     $result = array();
     try {
         if ($this->existsAppName($curuser->eno, $parameter["appid"], $parameter["appname"])) {
             return Utils::WrapResultError("PUSH应用名称已存在!");
         } else {
             if (empty($appid)) {
                 $appid = Utils::getAppid($curuser->eno, $curuser->login_account);
                 $appkey = Utils::getAppkey();
                 //$MicroAccountMgr=new MicroAccountMgr($da,$this->get('we_data_access_im'),$curuser,$this->get("logger"), $this->container);
                 //$MicroAccountMgr->register("",$number,$name,$type,$micro_use,$introduction,$concern_approval,$salutatory,$level,$password,$filename48,$filename120,$filename24,$factory,$dm,$appid);
                 $sql = "insert into we_appcenter_apps(appid,appkey,logo,appname,state,appdeveloper,appdesc,bindurl,apptype,sortid,createstaffid)values(?,?,?,?,1,?,?,?,?,?,?)";
                 $para = array($appid, $appkey, "", $parameter["appname"], $curuser->eno, "", "", "99", 0, $curuser->login_account);
             } else {
                 $sql = "update we_appcenter_apps set appname=?,logo=?,appdesc=?,bindurl=?,sortid=?,createstaffid=? where appid=?";
                 $para = array($parameter["appname"], "", "", "", 0, $curuser->login_account, $parameter["appid"]);
             }
             if ($sql != "") {
                 $da->ExecSQL($sql, $para);
             }
         }
     } catch (\Exception $e) {
         return Utils::WrapResultError($e->getMessage());
     }
     return Utils::WrapResultOK("");
 }
コード例 #23
0
ファイル: App_NoticeMgr.php プロジェクト: 3116246/haolinju
 public function receipt($parameters)
 {
     $currUser = $parameters["user"];
     if (empty($currUser)) {
         return Utils::WrapResultError("请登录后重试", ReturnCode::$NOTLOGIN);
     }
     $this->conn->ExecSQL("update we_app_bus_receipt set receiptdate=now() where appid=? and bus_id=? and staffid=?", array((string) $parameters["appid"], (string) $parameters["id"], (string) $currUser->getUserName()));
     return Utils::WrapResultOK("");
 }