批量删除标签

对应API：{@link http://open.weibo.com/wiki/2/tags/destroy_batch tags/destroy_batch}

@access public
@param mixed $ids 必选参数，要删除的tag id，多个id用半角逗号分割，最多10个。或由多个tag id构成的数组。如：“553,554,555"或array(553, 554, 555)
@return array
168913
function delete_tags( $ids )
	{
		$params = array();
		if (is_array($ids) && !empty($ids)) {
			$params['ids'] = join(',', $ids);
		} else {
			$params['ids'] = $ids;
		}
		return $this->oauth->post( 'tags/destroy_batch', $params );
	}
947222
public static function idcardVerifyNumber($idcardBase)
    {
        if (strlen($idcardBase) != 17) {
            return false;
        }

        //加权因子
        $factor = array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
        //校验码对应值
        $verifyNumberList = array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
        $checksum = 0;
        for ($i = 0; $i < strlen($idcardBase); $i++) {
            $checksum += intval(substr($idcardBase, $i, 1)) * $factor[$i];
        }
        $mod = $checksum % 11;
        return $verifyNumberList[$mod];
    }
364898
public function removeMany(array $ids) {
		$backend = $this->getBackend();
		$ids     = array_map([$this, 'prepareId'], $ids);
		
		$result = true;
		
		try {
			foreach ($ids as $id) {
				if (! $backend->delete($id)) {
					$result = false;
				}
			}
		} catch (PhalconCacheException $exception) {
			if ($this->operationsExceptions) {
				throw new OperationFailed('Removing of the data from the cache failed due to the backend exception occurred: "' . $exception->getMessage() . '"', 0, $exception);
			} else {
				return false;
			}
		}
		
		return $result;
	}
648922
public function fetchBatchTags($batchId)
    {
        $result = $this->_get($this->_batchUrl($batchId, '/tags'));
        return Deserialize::tags($result);
    }
314055
public function pushUserTagSet($userId,$tags) {
        try{
            if(empty($userId))
                throw new Exception('用户 Id 不能为空');
            if(empty($tags))
                throw new Exception('用户标签不能为空');
            $params['userId'] = $userId;
            $params['tags'] = $tags;
            $ret = $this->curl('/user/tag/set',$params,'json');
            if(empty($ret))
                throw new Exception('请求失败');
            return $ret;
        }catch (Exception $e) {
            print_r($e->getMessage());
        }
    }
799139
public function getIdsNotMatchingTags($tags = array())
    {
        $res = $this->_query("SELECT id FROM cache");
        $rows = @sqlite_fetch_all($res, SQLITE_ASSOC);
        $result = array();
        foreach ($rows as $row) {
            $id = $row['id'];
            $matching = false;
            foreach ($tags as $tag) {
                $res = $this->_query("SELECT COUNT(*) AS nbr FROM tag WHERE name='$tag' AND id='$id'");
                if (!$res) {
                    return array();
                }
                $nbr = (int) @sqlite_fetch_single($res);
                if ($nbr > 0) {
                    $matching = true;
                }
            }
            if (!$matching) {
                $result[] = $id;
            }
        }
        return $result;
    }
1152679
public function findByIds($ids)
    {
        if (!is_array($ids)) {
            $ids = explode(',', $ids);
        }

        if (!$ids) {
            return [];
        }

        return $this->createValuedQueryBuilder('c')
            ->andWhere('c.id IN (:ids)')->setParameter('ids', $ids)
            ->andWhere('c.deletedAt IS NULL')
            ->andWhere('c.active = :active')
            ->andWhere('c.layout = :layout')
            ->andWhere('c.publishAt < :now OR c.publishAt IS NULL')->setParameter('now', new \DateTime())
            ->setParameter('active', true)
            ->setParameter('layout', false)
            ->getQuery()
            ->useResultCache(true, self::CACHE_TTL)
            ->getResult();
    }
1208691
private function recur_reverse($id, $if_recur=false)
    {
        if (!$id) return array();
        if (!$if_recur) $this->resultIds = array();
        foreach ($this->data as $v) {
            if ($v[$this->fields[0]] == $id && $v[$this->fields[1]] != $this->root) {
                $this->recur_reverse($v[$this->fields[1]], true); // 先递归获取父父级，再将父级加到列表
                $this->resultIds[] = $v[$this->fields[1]];
            }
        }
        return $this->resultIds;
    }
1261020
public function selectByIds(array $ids = array())
    {
        if (empty($ids)) {
            return array();
        }

        $ids = array_map('intval', $ids);

        $sql = $this->getSelectQueryByIds($ids);

        $resultSet = $this->db->fetchAll($sql);

        return $this->implementVOs($resultSet);
    }
130815
public function destroy($id)
    {
        $id      = (int) $id;
        $deleted = false;
        $message = '';
        $code    = 0;

        try{
            $user    = Sentry::findUserById($id);
            $deleted = $user->delete();
            $code    = 200;
        }catch(UserNotFoundException $e){
            $message = $e->getMessage();
            $code    = 404;
        }catch(Exception $e){
            $message = $e->getMessage();
            $code    = 500;
        }

        if(Request::isAjax()){
            Response::headers()->set('Content-Type', 'application/json');
            Response::setBody(json_encode(
                array(
                    'success'   => $deleted,
                    'data'      => array( 'id' => $id ),
                    'message'   => $message,
                    'code'      => $code
                )
            ));
        }else{
            Response::redirect($this->siteUrl('admin/user'));
        }
    }
670250
public function hasFollow($id=0)
    {
        //检查临时存放
        $server_val = $this->searchServeVal('follow_state');
        count($server_val) ? $not_follow_list = explode('|', $server_val) : $not_follow_list = $this->getWechatUsersNotFollow();

        if ($id === 0) $id = Session::get('id');

        $work_id = Member::find($id)->work_id;

        return array_search($work_id, $not_follow_list) === false ? true : false;

    }
52293
public function get_from_ids(array $ids) {
        $alias = $this->get_table_alias();
        list($insql, $params) = $this->get_db()->get_in_or_equal($ids);
        $wheresql = $alias . '.id ' . $insql;
        $sql = $this->generate_get_records_sql($wheresql);
        $records = $this->get_db()->get_records_sql($sql, $params);

        return $this->transform_db_records_to_entities($records);
    }
1146441
public function removeMany(array $ids) {
		$event  = $this->getProfiler()->startDelete('Remove (' . count($ids) . '): ' . implode(', ', $ids));
		$result = $this->getBackend()->removeMany($ids);
		
		if ($result === false) {
			$event->stopError();
		} else {
			$event->stopSuccess();
		}
		
		return $result;
	}
339670
public function several(array $ids)
    {
        $result = [];
        foreach ($ids as $id) {
            if ($this->has($id)) {
                $result[$id] = $this->get($id);
            }
        }
        return $result;

    }
216675
public function findByIds($ids)
    {
        $query = $this->createQueryBuilder('m')
            ->where('m.id IN (:ids)')
            ->andWhere('m.status = :status')
            ->setParameters(array(
                'ids' => $ids,
                'status' => 1,
            ))
            ->getQuery()
        ;

        return $query->getResult();
    }
1025957
public function destroy($id)
    {
        $post = $this->tagRepo->findOrFail($id);
        $post->delete();

        $message = 'El registro se eliminó satisfactoriamente.';

        return [
            'message' => $message
        ];
    }
516624
protected function _clearCache( array $ids )
	{
		$domain = str_replace( '_', '/', strtolower( $this->_name ) );
		$tags = array( $domain );

		foreach( $ids as $id ) {
			$tags[] = $domain . '-' . $id;
		}

		$this->_context->getCache()->deleteByTags( $tags );
	}