Пример #1
0
 public function getExprienceAround($exprience)
 {
     $re = array();
     $level = \Justsy\BaseBundle\Common\ExperienceLevel::getLevel($exprience);
     $ExperienceLevels = \Justsy\BaseBundle\Common\ExperienceLevel::getExperienceLevels();
     $re["PreLevelExperience"] = $ExperienceLevels[$level];
     $re["NextLevelExperience"] = !array_key_exists($level + 1, $ExperienceLevels) ? $ExperienceLevels[$level] : $ExperienceLevels[$level + 1];
     return $re;
 }
Пример #2
0
 public function loadUserByUsername($username)
 {
     $dataset = $this->getUserInfo($username);
     $DataAccess = $this->get('we_data_access');
     if ($dataset && $dataset["we_staff"]["recordcount"] > 0) {
         $we_staff_row = $dataset["we_staff"]["rows"][0];
         $password = $we_staff_row['password'];
         $salt = $we_staff_row['login_account'];
         $roles = array('ROLE_USER');
         $sqls = array();
         $params = array();
         //获取用户角色和对应功能点数据
         $sqls[] = "select DISTINCT d.`code`,d.`name`\n\t    from we_staff_role a ,we_role b, we_role_function c,we_function d \n\t\t\twhere a.roleid=b.id and b.id=c.roleid and c.functionid=d.id and a.staff=? ;";
         //获取用户角色
         $sqls[] = "select DISTINCT b.name,b.code from we_staff_role a,we_role b where a.roleid=b.id and a.staff=?";
         $params[] = array((string) $salt);
         $params[] = array((string) $salt);
         $ds = $DataAccess->GetDatas(array("we_function", "we_role"), $sqls, $params);
         $us = new UserSession($we_staff_row['login_account'], $password, $salt, $roles);
         $us->nick_name = $we_staff_row['nick_name'];
         //$us->identify = $we_staff_row['identify'];
         $us->photo_path = $we_staff_row['photo_path'];
         $us->photo_path_small = $we_staff_row['photo_path_small'];
         $us->photo_path_big = $we_staff_row['photo_path_big'];
         $us->dept_id = $we_staff_row['dept_id'];
         $us->dept_name = $we_staff_row['dept_name'];
         $us->dept_name = $us->dept_name == null ? "[未设置部门]" : $us->dept_name;
         $us->eno = $we_staff_row['eno'];
         $us->fafa_jid = $we_staff_row['fafa_jid'];
         $us->duty = $we_staff_row['duty'];
         $us->work_phone = $we_staff_row['work_phone'];
         $us->mobile = $we_staff_row['mobile'];
         $us->birthday = $we_staff_row['birthday'];
         $us->sex_id = $we_staff_row['sex_id'];
         $us->openid = $we_staff_row['openid'];
         $us->t_code = trim(DES::decrypt($we_staff_row['t_code']));
         $us->edomain = $we_staff_row['edomain'];
         $us->ename = $we_staff_row['ename'];
         $us->eshortname = $we_staff_row['eshortname'];
         $us->total_point = $we_staff_row['total_point'];
         $us->level = \Justsy\BaseBundle\Common\ExperienceLevel::getLevel($us->total_point);
         $us->vip_level = empty($we_staff_row['vip_level']) ? '1' : $we_staff_row['vip_level'];
         $us->auth_level = empty($we_staff_row['auth_level']) ? 'J' : $we_staff_row['auth_level'];
         if ($us->auth_level != 'S') {
             $us->vip_level = $us->level;
         }
         $us->eno_level = $we_staff_row['eno_level'];
         $us->we_level = $we_staff_row['we_level'];
         foreach ($dataset["we_circle"]["rows"] as &$row) {
             $us->circle_ids[] = $row['circle_id'];
             $us->circle_names[] = $row['circle_name'];
             $us->network_domains[] = $row['network_domain'];
             $us->circle_logo_path_small[] = $row['logo_path_small'];
         }
         $us->manager_circles = $this->get_manager_circles($we_staff_row['login_account']);
         foreach ($ds["we_function"]["rows"] as &$row) {
             $us->function_names[] = $row['name'];
             $us->function_codes[] = $row['code'];
             $us->function_array[] = array("name" => $row['name'], "code" => $row['code']);
         }
         foreach ($ds["we_role"]["rows"] as &$row) {
             $us->role_names[] = $row['name'];
             $us->role_codes[] = $row['code'];
             $us->role_array[] = array("name" => $row['name'], "code" => $row['code']);
         }
         return $us;
     } else {
         return null;
     }
 }
Пример #3
0
 public function calcLevel($exprience)
 {
     return \Justsy\BaseBundle\Common\ExperienceLevel::getLevel($exprience);
 }
Пример #4
0
 public function getShareTrendAction($conv_root_id)
 {
     $FILE_WEBSERVER_URL = $this->container->getParameter('FILE_WEBSERVER_URL');
     $user = $this->get('security.context')->getToken()->getUser();
     $da = $this->get('we_data_access');
     $conv = new \Justsy\BaseBundle\Business\Conv();
     $ds = $conv->getShareTrend($da, $user, $conv_root_id, $FILE_WEBSERVER_URL);
     if (count($ds["we_convers_list"]["rows"]) == 0) {
         return new Response("");
     }
     if ($ds["we_convers_list"]["rows"][0]["auth_level"] != 'S') {
         $ds["we_convers_list"]["rows"][0]["vip_level"] = \Justsy\BaseBundle\Common\ExperienceLevel::getLevel($ds["we_convers_list"]["rows"][0]["total_point"]);
     } else {
         $ds["we_convers_list"]["rows"][0]["vip_level"] = "1";
         //
     }
     $css_level = (int) ($ds["we_convers_list"]["rows"][0]["we_level"] / 10);
     return $this->render('JustsyBaseBundle:CDisplayArea:sharetrend.html.twig', array('this' => $this, 'ds' => $ds, 'css_level' => $css_level, 'trend' => $this->getRequest()->get("trend")));
 }
Пример #5
0
 function getUserInfo($username)
 {
     $DataAccess = $this->container->get('we_data_access');
     $curuser = $this->get('security.context')->getToken()->getUser();
     if (Utils::validateEmail($username)) {
         //帐号
         $sqls = "select f_checkAttentionWithAccount(?,a.login_account) attention,a.login_account, a.nick_name, a.photo_path_big, a.password, a.dept_id, a.eno,a.fafa_jid,a.duty,a.work_phone,a.mobile,date_format(a.birthday,'%Y-%c-%d') birthday, b.edomain, b.ename, b.eshortname, c.dept_name ,\n\t\t\t\t\tifnull(a.self_desc,'未设置个性签名') self_desc,ifnull(a.we_level, 0) we_level,b.vip_level,a.auth_level,a.total_point, a.attenstaff_num, a.fans_num, a.publish_num,ifnull(d.id,0) addcard from we_staff a\n\t\t\t\t\t  join we_enterprise b on a.eno=b.eno\n\t\t\t\t\t  left join we_department c on a.eno=c.eno and a.dept_id=c.dept_id \n\t\t\t\t\t  left join we_addrlist_main d on d.owner=? and d.typeid='M001' and d.addr_account=a.login_account\n\t\t\t\t\twhere a.login_account=? ";
         $params = array($curuser->getUsername(), $curuser->getUsername(), (string) $username);
     } else {
         $userNameAry = $this->parseUserName($username);
         $sqls = "select f_checkAttentionWithAccount(?,a.login_account) attention,a.login_account, a.nick_name, a.photo_path_big, a.password, a.dept_id, a.eno,a.fafa_jid,a.duty,a.work_phone,a.mobile,date_format(a.birthday,'%Y-%c-%d') birthday, b.edomain, b.ename, b.eshortname, c.dept_name ,\n\t\t\t\t\tifnull(a.self_desc,'未设置个性签名') self_desc,ifnull(a.we_level, 0) we_level,b.vip_level,a.auth_level,a.total_point, a.attenstaff_num, a.fans_num, a.publish_num,ifnull(d.id,0) addcard from we_staff a\n\t\t\t\t\t  join we_enterprise b on a.eno=b.eno\n\t\t\t\t\t  left join we_department c on a.eno=c.eno and a.dept_id=c.dept_id \n\t\t\t\t\t  left join we_addrlist_main d on d.owner=? and d.typeid='M001' and d.addr_account=a.login_account\n\t\t\t\t\twhere a.nick_name=? and b.eshortname=?";
         $params = array($curuser->getUsername(), $curuser->getUsername(), (string) $userNameAry[0], (string) $userNameAry[1]);
     }
     $dataset = $DataAccess->GetData("we_staff", $sqls, $params);
     if ($dataset && $dataset["we_staff"]["recordcount"] > 0) {
         $this->isSelf = $curuser->getUsername() == $dataset["we_staff"]["rows"][0]["login_account"];
         $dataset["we_staff"]["rows"][0]["vip_level"] = $dataset["we_staff"]["rows"][0]["auth_level"] != 'S' ? \Justsy\BaseBundle\Common\ExperienceLevel::getLevel($dataset["we_staff"]["rows"][0]["total_point"]) : "1";
         return $dataset["we_staff"]["rows"][0];
     } else {
         return "";
     }
 }