[db:标签]

  • 好奇心对孩子的重要性,小孩好奇心的重要性

    接下来我再说一下第二个发现,我暂时给他起了一个小标题叫——

    生活 2021年11月18日
  • 全球供应短缺的主要原因终于找到了,美国人一直在“买买买”

    从被挑选的商店货架、停滞不前的集装箱船和空荡荡的汽车陈列室来看,几乎所有东西短缺的根本原因都是消费。

    生活 2021年11月18日
  • 自助餐厅里的螃蟹都是死的吗,胖哥俩肉蟹煲投诉电话

    中新经纬11月18日电 17日晚,微信公众号“胖哥俩帝都站”针对餐厅使用“隔夜死蟹”被罚50万元一事发布声明,称已经对涉事门店进行闭店处理,同时对相关责任人进行重罚。

    生活 2021年11月18日
  • 钉钉报警接入代码

    @Service@Slf4jpublic class DingTalkUtil { @Value("${dingTalk.robot.url}") private String robotUrl; @Value("${dingTalk.robot.me}") private String me; // 钉钉密钥 @Value("${dingTalk.robot.secret}") private String secret; @Value("${dingTalk.enabled}") private Boolean enabled; private OkHttpClient okHttpClient; private static final ObjectMapper objectMapper = new ObjectMapper(); private static final MediaType jsonMediaType = MediaType.parse("application/json"); @PostConstruct public void init() { ExecutorService executorService = new ThreadPoolExecutor( 1, 5, 1, TimeUnit.MINUTES, new ArrayBlockingQueue<>(100), ThreadFactoryBuilder.create().setNamePrefix("dingTalk-").build(), new ThreadPoolExecutor.CallerRunsPolicy() ); Dispatcher dispatcher = new Dispatcher(executorService); dispatcher.setMaxRequests(5); dispatcher.setMaxRequestsPerHost(5); okHttpClient = new OkHttpClient.Builder() .readTimeout(Duration.ofSeconds(1)) .connectTimeout(Duration.ofSeconds(1)) .callTimeout(Duration.ofSeconds(1)) .writeTimeout(Duration.ofSeconds(1)) .dispatcher(dispatcher) .build(); } /** * 异步发送钉钉机器人文本消息. */ public void sendTextMessage(String content) { doSendTextMessage(content, textMessage -> { }); } /** * 异步发送文本消息并@自己. */ public void sendTextMessageWithAtMe(String content) { doSendTextMessage(content, textMessage -> textMessage.getAt().getAtMobiles().add(me)); } /** * 异步发送文本消息并@所有人. */ public void sendTextMessageWithAtAll(String content) { doSendTextMessage(content, textMessage -> textMessage.getAt().setAtAll(true)); } private void doSendTextMessage(String content, Consumer<TextMessage> messageConfigurator) { if (!enabled) { return; } if (StringUtils.isBlank(content)) { throw new IllegalArgumentException("文本消息内容不能为空"); } TextMessage textMessage = new TextMessage(); textMessage.setText(new TextMessage.Content(content)); messageConfigurator.accept(textMessage); long timestamp = System.currentTimeMillis(); String sign = sign(timestamp); try { Request request = new Request.Builder() .url((robotUrl + "×tamp=" + timestamp + "&sign=" + sign)) .post(RequestBody.create(objectMapper.writeValueAsString(textMessage), jsonMediaType)) .build(); Call call = okHttpClient.newCall(request); call.enqueue(new Callback() { @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { log.error("发送钉钉消息失败, 请求: {}.", call, e); } @Override public void onResponse(@NotNull Call call, @NotNull Response response) { ResponseBody responseBody = response.body(); log.debug("钉钉发送成功, call: {}, resp: {}.", call.request().body(), responseBody); if (responseBody != null) responseBody.close(); } }); } catch (JsonProcessingException e) { throw ExceptionUtil.wrapRuntime(e); } } private String sign(long timestamp) { final String seed = (timestamp + "\n" + secret); try { Mac mac = Mac.getInstance("HmacSHA256"); mac.init(new SecretKeySpec(secret.getBytes(StandardCharsets.UTF_8), "HmacSHA256")); byte[] result = mac.doFinal(seed.getBytes(StandardCharsets.UTF_8)); return URLEncoder.encode(Base64.getEncoder().encodeToString(result), StandardCharsets.UTF_8.displayName()); } catch (NoSuchAlgorithmException | InvalidKeyException | UnsupportedEncodingException e) { throw ExceptionUtil.wrapRuntime(e); } } @Getter private static class TextMessage { private final String msgtype = "text"; @Setter private Content text; private final At at = new At(); @Data @AllArgsConstructor private static class Content { private String content; } private static class At { @Setter private boolean isAtAll = false; @Getter private final List<String> atMobiles = new LinkedList<>(); // 不能删除,否则会导致生成的json字段名是atAll, 导致@所有人不生效 public boolean getIsAtAll() { return isAtAll; } } }}

    科技 2021年11月18日
  • 苹果汽车会在2025年亮相?外观神似月球车

    近日,我们从相关渠道获悉,苹果增加旗下自动驾驶车队的研发测试人员数量,目前共有137人。量产版车型预计会在2025年亮相。

    科技 2021年11月18日
  • 蜜雪冰城拟上市,经营范围新增第二类增值电信业务

    近日,蜜雪冰城股份有限公司(下简称:蜜雪冰城)拟在A股市场上市,目前接受辅导备案。这意味着,蜜雪冰城有望成为继奈雪的茶之后,国内的茶饮“第二股”。

    科技 2021年11月18日
  • Excel函数大全——连接运算符

    今天说的是Excel中的连接运算符,连接运算符就只有一个为:&。要说明的是:

    科技 2021年11月18日
  • 做电商必备的55个网站请参考

    全网最全拿货网站!做电商必备!1.衣联网(www.eelly.com

    科技 2021年11月18日
  • 全球数治|企业数字化转型的四个层次及关键挑战

    澎湃新闻记者 吕娜 编译

    科技 2021年11月18日
  • 时尚设计带来不俗音质,哈氪零度真无线蓝牙耳机要做行业引领者

    蓝牙耳机已然成了很多人的必备物件,然而蓝牙耳机非黑即白的设计难免会让人产生视觉疲劳。最近笔者就体验了一款来自HAKII 旗下的一款HAKII ICE哈氪零度真无线蓝牙耳机,无论是颜值还是在音质续航等方面都带来了不错的体验。

    科技 2021年11月18日