Ejemplo n.º 1
0
 public static function deleteIpBlackWhiteRow($ip)
 {
     try {
         $oList = Model_Security_BlackWhiteIpList::data_access()->force_master();
         $oList->filter('ip', $ip);
         $oList->set_field('status', Model_Security_BlackWhiteIpList::LIST_STATUS_DELETE);
         $oList->update();
     } catch (Exception $e) {
         return false;
     }
     return true;
 }
Ejemplo n.º 2
0
 /**
  * 检测是否需要显示验证码
  * 根据经纪人Id 和 当前IP 来判断经纪人在当前场景里是否需要显示验证码
  * 需要显示验证码的逻辑为:
  *    如果经纪人在黑白名单里,则以经纪人的黑白名单为准。否则以IP黑白名单为准。
  *    在 经纪人黑白名单 和 IP黑白名单 里都没有的话则返回true.
  * 返回值:true 表示当前场景无需显示验证码
  *
  * @param int $brokerId
  * @param string $ip
  * @param int $scene
  * @return bool
  */
 public static function checkScene($brokerId, $ip, $scene = Model_Security_BlackWhiteList::SCENE_ALL)
 {
     $blackWhiteBrokerRow = Model_Security_BlackWhiteBrokerList::getRowByBrokerId($brokerId);
     if (!empty($blackWhiteBrokerRow)) {
         return static::doSceneCheck($blackWhiteBrokerRow['type'], $blackWhiteBrokerRow['scene'], $scene);
     }
     $blackWhiteIpRow = Model_Security_BlackWhiteIpList::getRowByIp($ip);
     if (!empty($blackWhiteIpRow)) {
         return static::doSceneCheck($blackWhiteIpRow['type'], $blackWhiteIpRow['scene'], $scene);
     }
     return $scene == Model_Security_BlackWhiteList::SCENE_ALL ? false : true;
 }