예제 #1
0
 public function SaveRoleAction()
 {
     $request = $this->getRequest();
     $appid = $request->get("appid");
     $roles = $request->get("roles");
     $clear = $request->get("clear");
     $result = array();
     $da = $this->get("we_data_access");
     if ($clear == 1) {
         $ex = $this->DeleteRole($da, $appid);
         if ($ex) {
             $result = array("success" => true, "message" => "清除用户权限成功!", "count" => 0);
             //记录日志
             $syslog = new \Justsy\AdminAppBundle\Controller\SysLogController();
             $syslog->setContainer($this->container);
             $user = $this->get('security.context')->getToken()->getUser()->getUserName();
             $sql = "select appname from we_appcenter_apps where appid=?;";
             $ds = $da->GetData("table", $sql, array((string) $appid));
             if ($ds && $ds["table"]["recordcount"] > 0) {
                 $desc = "清除了应用【" . $ds["table"]["rows"][0]["appname"] . "】的所有人员查看权限。";
                 $syslog->AddSysLog($desc, "应用权限");
             }
         } else {
             $result = array("success" => false, "message" => "清除用户权限失败!");
         }
     } else {
         $result = $this->EditAppRole($appid, $roles);
     }
     if ($result["success"]) {
         $this->sendPresence();
     }
     $response = new Response(json_encode($result));
     $response->headers->set('Content-Type', 'text/json');
     return $response;
 }
예제 #2
0
 public function ResetPassWordAction()
 {
     $da = $this->get("we_data_access");
     $da_im = $this->get("we_data_access_im");
     $request = $this->getRequest();
     $account = strtolower($request->get("account"));
     $password = $request->get("password");
     $result = array("success" => true, "message" => "");
     $user = $this->get('security.context')->getToken()->getUser();
     try {
         $u_staff = new Staff($da, $da_im, $account, $this->get('logger'), $this->container);
         $targetStaffInfo = $u_staff->getInfo();
         $re = $u_staff->changepassword($targetStaffInfo["login_account"], $password, $this->get('security.encoder_factory'));
         if ($re) {
             //$this->get("logger")->err("sendImPresence:".$targetStaffInfo["fafa_jid"]);
             //给自己发送一个staff-changepasswod的出席,通知在线客户端密码发生修改,需要新密码重新登录
             Utils::sendImPresence($user->fafa_jid, $targetStaffInfo["fafa_jid"], "staff-changepasswod", "staff-changepasswod", $this->container, "", "", false, Utils::$systemmessage_code);
             //记录用户操作日志
             $syslog = new \Justsy\AdminAppBundle\Controller\SysLogController();
             $syslog->setContainer($this->container);
             $desc = "重置了用户账号:" . $account . "登录密码!";
             $syslog->AddSysLog($desc, "重置密码");
         } else {
             $result = array("success" => false, "message" => "修改密码错误!");
         }
     } catch (\Exception $e) {
         $this->get("logger")->err($e->getMessage());
         $result = array("success" => false, "message" => "修改密码错误!");
     }
     $response = new Response(json_encode($result));
     $response->headers->set('Content-Type', 'text/json');
     return $response;
 }
예제 #3
0
 public function CleareRoleAction()
 {
     $da = $this->get('we_data_access');
     $request = $this->getRequest();
     $login_account = $request->get("login_account");
     $success = true;
     $msg = "";
     try {
         $sql = "delete from mb_staff_menu where staff_id=?";
         $da->ExecSQL($sql, array((string) $login_account));
         //用户权限增减日志
         $syslog = new \Justsy\AdminAppBundle\Controller\SysLogController();
         $syslog->setContainer($this->container);
         $desc = "取消了用户" . $login_account . "的所有菜单权限!";
         $syslog->AddSysLog($desc, "菜单权限");
     } catch (\Exception $e) {
         $msg = "清除用户菜单权限失败!";
         $success = false;
         $this->get('logger')->err($e);
     }
     $result = array("success" => $success, "msg" => $msg);
     $response = new Response(json_encode($result));
     $response->headers->set('Content-Type', 'text/json');
     return $response;
 }
예제 #4
0
 public function detailContentPublishAction()
 {
     $da = $this->get('we_data_access');
     $request = $this->getRequest();
     $id = $request->get("id");
     $code = ReturnCode::$SUCCESS;
     $data = array();
     $msg = "";
     $result = null;
     if ($id != null && !empty($id)) {
         $sql = "select title as news_title,content news_content,date_format(date,'%Y-%m-%d %H:%i') news_date,nick_name as news_author,'' news_subtitle,type \n             from mb_content_publish a inner join we_staff b on a.publish_staffid=b.login_account where id=?";
         try {
             $ds = $da->GetData("detail", $sql, array((string) $id));
             if ($ds && $ds["detail"]["recordcount"] > 0) {
                 $data = $ds["detail"]["rows"][0];
                 //写入日志信息
                 $syslog = new \Justsy\AdminAppBundle\Controller\SysLogController();
                 $syslog->setContainer($this->container);
                 $user = $this->get('security.context')->getToken()->getUser();
                 $type = "";
                 if ($ds["detail"]["rows"][0]["type"] == "1") {
                     $type = "制度";
                 } else {
                     $type = "福利";
                 }
                 $desc = $user->nick_name . "查看了标题为【" . $ds["detail"]["rows"][0]["news_title"] . "】的" . $type . "。";
                 $type = "查看" . $type;
                 $syslog->AddSysLog($desc, $type);
             }
         } catch (\Exception $e) {
             $this->get('logger')->err($e);
         }
     }
     $response = new Response(json_encode($data));
     $response->headers->set('Content-Type', 'text/json');
     return $response;
 }
예제 #5
0
 public function kqgsAction()
 {
     $re = array("returncode" => ReturnCode::$SUCCESS);
     $request = $this->getRequest();
     $user = $this->get('security.context')->getToken()->getUser();
     $da = $this->get('we_data_access');
     $kqlb = $request->get("kqlb");
     $user_code = explode('@', $user->getUserName());
     $user_code = strtoupper($user_code[0]);
     try {
         if (empty($kqlb)) {
             throw new \Exception("param is null");
         }
         $conn = $this->getConnection();
         // 返回数据
         $sql = "select user_code, user_name, qishu, ldk_dp, ldk_zc, cd_1,cd_2, cd_3, cd_4, zt_1, zt_2, dp_cd_1, dp_cd_2, dp_cd_3, dp_cd_4, dp_zt_1, \n                     dp_zt_2, kongqin, kg, qj01, qj02, qj03, qj04, qj05, qj06, qj07, qj08, qj09,qj10, qj11, qj12, qj13, qj14, qj15, qj16, qj17, qj18, qj19, hx_qq_1, hx_qq_2,hx_qq_3, qq_gs\n              from mb_hr_kqhz where user_code='" . $user_code . "' order by qishu desc limit 1";
         $table = mysql_query($sql);
         $kqgs = array();
         if (mysql_num_rows($table) > 0) {
             $r_kqhz = null;
             while ($rows = mysql_fetch_array($table)) {
                 $r_kqhz = $rows;
             }
             if ($kqlb == "01") {
                 $lbmcs = array("ldk_dp" => "店铺未打卡(次)", "ldk_zc" => "非店铺未打卡(次)", "cd_1" => "非店铺迟到(0-30分钟)", "cd_2" => "非店铺迟到(31-60分钟)", "cd_3" => "非店铺迟到(61-120分钟)", "cd_4" => "非店铺迟到(120分钟以上)", "zt_1" => "非店铺早退(30分钟以内)", "zt_2" => "非店铺早退(30分钟以上)", "dp_cd_1" => "店铺迟到(0-10分钟)", "dp_cd_2" => "店铺迟到(11-30分钟)", "dp_cd_3" => "店铺迟到(31-60分钟)", "dp_cd_4" => "店铺迟到(61-120分钟)", "dp_zt_1" => "店铺早退(1小时内)", "dp_zt_2" => "店铺早退(1小时以上)");
                 foreach ($lbmcs as $key => &$value) {
                     if ($r_kqhz[$key] <= 0) {
                         continue;
                     }
                     $item = array();
                     $item["lbmc"] = $value;
                     $item["kqnum"] = $r_kqhz[$key];
                     $item["kqdates"] = $this->getkqgsDetail($user_code, $r_kqhz["qishu"], $key);
                     //array();
                     $kqgs[] = $item;
                 }
             } else {
                 if ($kqlb == "02") {
                     $lbmcs = array("kongqin" => "空勤", "kg" => "旷工");
                     foreach ($lbmcs as $key => &$value) {
                         if ($r_kqhz[$key] <= 0) {
                             continue;
                         }
                         $item = array();
                         $item["lbmc"] = $value;
                         $item["kqnum"] = $r_kqhz[$key];
                         $item["kqdates"] = $this->getkqgsDetail($user_code, $r_kqhz["qishu"], $key);
                         //array();
                         $kqgs[] = $item;
                     }
                 } else {
                     if ($kqlb == "03") {
                         $lbmcs = array("qj01" => "年休假", "qj02" => "有薪事假", "qj03" => "无薪事假", "qj04" => "病假", "qj05" => "探亲假", "qj06" => "献血假", "qj07" => "长期服务奖假", "qj08" => "婚假", "qj09" => "产假", "qj10" => "丧假", "qj11" => "工伤假", "qj12" => "产检假", "qj13" => "陪产假", "qj14" => "调休", "qj15" => "哺乳假", "qj16" => "出差", "qj17" => "特殊假", "qj18" => "周末加班调休", "qj19" => "平时加班调休");
                         foreach ($lbmcs as $key => &$value) {
                             if ($r_kqhz[$key] <= 0) {
                                 continue;
                             }
                             $item = array();
                             $item["lbmc"] = $value;
                             $item["kqnum"] = $r_kqhz[$key];
                             $item["kqdates"] = $this->getkqgsDetail($user_code, $r_kqhz["qishu"], $key);
                             //array();
                             $kqgs[] = $item;
                         }
                     } else {
                         if ($kqlb == "04") {
                             $lbmcs = array("hx_qq_1" => "核心缺勤(1小时以内)次数", "hx_qq_2" => "核心缺勤(1到4小时)", "hx_qq_3" => "核心缺勤(4小时以上)", "qq_gs" => "非核心缺勤小时数");
                             foreach ($lbmcs as $key => &$value) {
                                 if ($r_kqhz[$key] <= 0) {
                                     continue;
                                 }
                                 $item = array();
                                 $item["lbmc"] = $value;
                                 $item["kqnum"] = $r_kqhz[$key];
                                 $item["kqdates"] = $this->getkqgsDetail($user_code, $r_kqhz["qishu"], $key);
                                 $kqgs[] = $item;
                             }
                         }
                     }
                 }
             }
         }
         $re["kqgs"] = $kqgs;
         //写入日志信息
         $syslog = new \Justsy\AdminAppBundle\Controller\SysLogController();
         $syslog->setContainer($this->container);
         $desc = $user->nick_name . "查看了【月度考勤】";
         $syslog->AddSysLog($desc, "月度考勤");
     } catch (\Exception $e) {
         $re["returncode"] = ReturnCode::$SYSERROR;
         $this->get('logger')->err($e);
     }
     if (!empty($conn)) {
         mysql_close($conn);
     }
     $response = new Response($request->get('jsoncallback') ? $request->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re));
     $response->headers->set('Content-Type', 'text/json');
     return $response;
 }
예제 #6
0
 public function RestartPasswordAction()
 {
     $da = $this->get("we_data_access");
     $request = $this->getRequest();
     $login_account = $request->get("login_account");
     $success = true;
     $msg = "";
     if (empty($login_account)) {
         $success = false;
         $msg = "请输入用户账号!";
     } else {
         if (!Utils::validateEmail($login_account)) {
             $success = false;
             $msg = "请输入正确的用户账号!";
         } else {
             $sql = "delete from mb_salary_staff where login_account=?;";
             try {
                 $da->ExecSQL($sql, array((string) $login_account));
                 //记录用户操作日志
                 $syslog = new \Justsy\AdminAppBundle\Controller\SysLogController();
                 $syslog->setContainer($this->container);
                 $desc = "清除用户账号:" . $login_account . "工资独立密码!";
                 $syslog->AddSysLog($desc, "工资密码");
             } catch (\Exception $e) {
                 $success = false;
                 $msg = "重置用户工资密码错误!";
                 $this->get("logger")->err($e->getMessage());
             }
         }
     }
     $result = array("success" => $success, "msg" => $msg);
     $response = new Response(json_encode($result));
     $response->headers->set('Content-Type', 'text/json');
     return $response;
 }