整合营销服务商

电脑端+手机端+微信端=数据同步管理

免费咨询热线:

干货|SpringBoot集成极光推送完整实现代码(建议收藏)

作中经常会遇到服务器向App推送消息的需求,一般企业中选择用极光推送的比较多,在集成极光时发现极光的文档并不完整,网上的文章也很多不能直接使用,这里列出我在工作中集成极光的全部代码,只需要按照如下代码保证一次性实现。



1.pom.xml

<!-- 极光推送 begin -->
<dependency>
    <groupId>cn.jpush.api</groupId>
    <artifactId>jpush-client</artifactId>
    <version>3.3.10</version>
</dependency>
<dependency>
    <groupId>cn.jpush.api</groupId>
    <artifactId>jiguang-common</artifactId>
    <version>1.1.4</version>
</dependency>
<!-- 极光推送 end -->

2.application.yml

jpush:
  appKey: xxx
  masterSecret: xxxx
  apnsProduction: false   # 是否生成环境,true表示生成环境

3.MyJPushClient

import cn.jiguang.common.resp.APIConnectionException;
import cn.jiguang.common.resp.APIRequestException;
import cn.jpush.api.JPushClient;
import cn.jpush.api.push.PushResult;
import cn.jpush.api.push.model.Message;
import cn.jpush.api.push.model.Options;
import cn.jpush.api.push.model.Platform;
import cn.jpush.api.push.model.PushPayload;
import cn.jpush.api.push.model.audience.Audience;
import cn.jpush.api.push.model.notification.AndroidNotification;
import cn.jpush.api.push.model.notification.IosNotification;
import cn.jpush.api.push.model.notification.Notification;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 极光推送客户端
 *
 * @author Mengday Zhang
 * @version 1.0
 * @since 2019-04-01
 */
@Component
public class MyJPushClient {
    @Value("${jpush.appKey}")
    private String appKey;

    @Value("${jpush.masterSecret}")
    private String masterSecret;

    @Value("${jpush.apnsProduction}")
    private boolean apnsProduction;

    private static JPushClient jPushClient = null;
    private static final int RESPONSE_OK = 200;
    private static final Logger logger = LoggerFactory.getLogger(MyJPushClient.class);


    public JPushClient getJPushClient() {
        if (jPushClient == null) {
            jPushClient = new JPushClient(masterSecret, appKey);
        }

        return jPushClient;
    }


    /**
     * 推送到alias列表
     *
     * @param alias             别名或别名组
     * @param notificationTitle 通知内容标题
     * @param msgTitle          消息内容标题
     * @param msgContent        消息内容
     * @param extras            扩展字段
     */
    public void sendToAliasList(List<String> alias, String notificationTitle, String msgTitle, String msgContent, String extras) {
        PushPayload pushPayload = buildPushObject_all_aliasList_alertWithTitle(alias, notificationTitle, msgTitle, msgContent, extras);
        this.sendPush(pushPayload);
    }

    /**
     * 推送到tag列表
     *
     * @param tagsList          Tag或Tag组
     * @param notificationTitle 通知内容标题
     * @param msgTitle          消息内容标题
     * @param msgContent        消息内容
     * @param extras            扩展字段
     */
    public void sendToTagsList(List<String> tagsList, String notificationTitle, String msgTitle, String msgContent, String extras) {
        PushPayload pushPayload = buildPushObject_all_tagList_alertWithTitle(tagsList, notificationTitle, msgTitle, msgContent, extras);
        this.sendPush(pushPayload);
    }

    /**
     * 发送给所有安卓用户
     *
     * @param notificationTitle 通知内容标题
     * @param msgTitle          消息内容标题
     * @param msgContent        消息内容
     * @param extras        扩展字段
     */
    public void sendToAllAndroid(String notificationTitle, String msgTitle, String msgContent, String extras) {
        PushPayload pushPayload = buildPushObject_android_all_alertWithTitle(notificationTitle, msgTitle, msgContent, extras);
        this.sendPush(pushPayload);
    }

    /**
     * 发送给所有IOS用户
     *
     * @param notificationTitle 通知内容标题
     * @param msgTitle          消息内容标题
     * @param msgContent        消息内容
     * @param extras        扩展字段
     */
    public void sendToAllIOS(String notificationTitle, String msgTitle, String msgContent, String extras) {
        PushPayload pushPayload = buildPushObject_ios_all_alertWithTitle(notificationTitle, msgTitle, msgContent, extras);
        this.sendPush(pushPayload);
    }

    /**
     * 发送给所有用户
     *
     * @param notificationTitle 通知内容标题
     * @param msgTitle          消息内容标题
     * @param msgContent        消息内容
     * @param extras        扩展字段
     */
    public void sendToAll(String notificationTitle, String msgTitle, String msgContent, String extras) {
        PushPayload pushPayload = buildPushObject_android_and_ios(notificationTitle, msgTitle, msgContent, extras);
        this.sendPush(pushPayload);
    }

    private PushResult sendPush(PushPayload pushPayload) {
        logger.info("pushPayload={}", pushPayload);
        PushResult pushResult = null;
        try {
            pushResult = this.getJPushClient().sendPush(pushPayload);
            logger.info("" + pushResult);
            if (pushResult.getResponseCode() == RESPONSE_OK) {
                logger.info("push successful, pushPayload={}", pushPayload);
            }
        } catch (APIConnectionException e) {
            logger.error("push failed: pushPayload={}, exception={}", pushPayload, e);
        } catch (APIRequestException e) {
            logger.error("push failed: pushPayload={}, exception={}", pushPayload, e);
        }

        return pushResult;
    }


    /**
     * 向所有平台所有用户推送消息
     *
     * @param notificationTitle
     * @param msgTitle
     * @param msgContent
     * @param extras
     * @return
     */
    public PushPayload buildPushObject_android_and_ios(String notificationTitle, String msgTitle, String msgContent, String extras) {
        return PushPayload.newBuilder()
                .setPlatform(Platform.android_ios())
                .setAudience(Audience.all())
                .setNotification(Notification.newBuilder()
                        .setAlert(notificationTitle)
                        .addPlatformNotification(AndroidNotification.newBuilder()
                                .setAlert(notificationTitle)
                                .setTitle(notificationTitle)
                                // 此字段为透传字段,不会显示在通知栏。用户可以通过此字段来做一些定制需求,如特定的key传要指定跳转的页面(value)
                                .addExtra("androidNotification extras key", extras)
                                .build()
                        )
                        .addPlatformNotification(IosNotification.newBuilder()
                                // 传一个IosAlert对象,指定apns title、title、subtitle等
                                .setAlert(notificationTitle)
                                // 直接传alert
                                // 此项是指定此推送的badge自动加1
                                .incrBadge(1)
                                // 此字段的值default表示系统默认声音;传sound.caf表示此推送以项目里面打包的sound.caf声音来提醒,
                                // 如果系统没有此音频则以系统默认声音提醒;此字段如果传空字符串,iOS9及以上的系统是无声音提醒,以下的系统是默认声音
                                .setSound("default")
                                // 此字段为透传字段,不会显示在通知栏。用户可以通过此字段来做一些定制需求,如特定的key传要指定跳转的页面(value)
                                .addExtra("iosNotification extras key", extras)
                                // 此项说明此推送是一个background推送,想了解background看:http://docs.jpush.io/client/ios_tutorials/#ios-7-background-remote-notification
                                // .setContentAvailable(true)
                                .build()
                        )
                        .build()
                )
                // Platform指定了哪些平台就会像指定平台中符合推送条件的设备进行推送。 jpush的自定义消息,
                // sdk默认不做任何处理,不会有通知提示。建议看文档http://docs.jpush.io/guideline/faq/的
                // [通知与自定义消息有什么区别?]了解通知和自定义消息的区别
                .setMessage(Message.newBuilder()
                        .setMsgContent(msgContent)
                        .setTitle(msgTitle)
                        .addExtra("message extras key", extras)
                        .build())
                .setOptions(Options.newBuilder()
                        // 此字段的值是用来指定本推送要推送的apns环境,false表示开发,true表示生产;对android和自定义消息无意义
                        .setApnsProduction(apnsProduction)
                        // 此字段是给开发者自己给推送编号,方便推送者分辨推送记录
                        .setSendno(1)
                        // 此字段的值是用来指定本推送的离线保存时长,如果不传此字段则默认保存一天,最多指定保留十天,单位为秒
                        .setTimeToLive(86400)
                        .build())
                .build();
    }


    /**
     * 向所有平台单个或多个指定别名用户推送消息
     *
     * @param aliasList
     * @param notificationTitle
     * @param msgTitle
     * @param msgContent
     * @param extras
     * @return
     */
    private PushPayload buildPushObject_all_aliasList_alertWithTitle(List<String> aliasList, String notificationTitle, String msgTitle, String msgContent, String extras) {
        // 创建一个IosAlert对象,可指定APNs的alert、title等字段
        // IosAlert iosAlert =  IosAlert.newBuilder().setTitleAndBody("title", "alert body").build();

        return PushPayload.newBuilder()
                // 指定要推送的平台,all代表当前应用配置了的所有平台,也可以传android等具体平台
                .setPlatform(Platform.all())
                // 指定推送的接收对象,all代表所有人,也可以指定已经设置成功的tag或alias或该应应用客户端调用接口获取到的registration id
                .setAudience(Audience.alias(aliasList))
                // jpush的通知,android的由jpush直接下发,iOS的由apns服务器下发,Winphone的由mpns下发
                .setNotification(Notification.newBuilder()
                        // 指定当前推送的android通知
                        .addPlatformNotification(AndroidNotification.newBuilder()
                                .setAlert(notificationTitle)
                                .setTitle(notificationTitle)
                                // 此字段为透传字段,不会显示在通知栏。用户可以通过此字段来做一些定制需求,如特定的key传要指定跳转的页面(value)
                                .addExtra("androidNotification extras key", extras)
                                .build())
                        // 指定当前推送的iOS通知
                        .addPlatformNotification(IosNotification.newBuilder()
                                // 传一个IosAlert对象,指定apns title、title、subtitle等
                                .setAlert(notificationTitle)
                                // 直接传alert
                                // 此项是指定此推送的badge自动加1
                                .incrBadge(1)
                                // 此字段的值default表示系统默认声音;传sound.caf表示此推送以项目里面打包的sound.caf声音来提醒,
                                // 如果系统没有此音频则以系统默认声音提醒;此字段如果传空字符串,iOS9及以上的系统是无声音提醒,以下的系统是默认声音
                                .setSound("default")
                                // 此字段为透传字段,不会显示在通知栏。用户可以通过此字段来做一些定制需求,如特定的key传要指定跳转的页面(value)
                                .addExtra("iosNotification extras key", extras)
                                // 此项说明此推送是一个background推送,想了解background看:http://docs.jpush.io/client/ios_tutorials/#ios-7-background-remote-notification
                                // 取消此注释,消息推送时ios将无法在锁屏情况接收
                                // .setContentAvailable(true)
                                .build())
                        .build())
                // Platform指定了哪些平台就会像指定平台中符合推送条件的设备进行推送。 jpush的自定义消息,
                // sdk默认不做任何处理,不会有通知提示。建议看文档http://docs.jpush.io/guideline/faq/的
                // [通知与自定义消息有什么区别?]了解通知和自定义消息的区别
                .setMessage(Message.newBuilder()
                        .setMsgContent(msgContent)
                        .setTitle(msgTitle)
                        .addExtra("message extras key", extras)
                        .build())
                .setOptions(Options.newBuilder()
                        // 此字段的值是用来指定本推送要推送的apns环境,false表示开发,true表示生产;对android和自定义消息无意义
                        .setApnsProduction(apnsProduction)
                        // 此字段是给开发者自己给推送编号,方便推送者分辨推送记录
                        .setSendno(1)
                        // 此字段的值是用来指定本推送的离线保存时长,如果不传此字段则默认保存一天,最多指定保留十天;
                        .setTimeToLive(86400)
                        .build())
                .build();

    }

    /**
     * 向所有平台单个或多个指定Tag用户推送消息
     *
     * @param tagsList
     * @param notificationTitle
     * @param msgTitle
     * @param msgContent
     * @param extras
     * @return
     */
    private PushPayload buildPushObject_all_tagList_alertWithTitle(List<String> tagsList, String notificationTitle, String msgTitle, String msgContent, String extras) {
        //创建一个IosAlert对象,可指定APNs的alert、title等字段
        //IosAlert iosAlert =  IosAlert.newBuilder().setTitleAndBody("title", "alert body").build();

        return PushPayload.newBuilder()
                // 指定要推送的平台,all代表当前应用配置了的所有平台,也可以传android等具体平台
                .setPlatform(Platform.all())
                // 指定推送的接收对象,all代表所有人,也可以指定已经设置成功的tag或alias或该应应用客户端调用接口获取到的registration id
                .setAudience(Audience.tag(tagsList))
                // jpush的通知,android的由jpush直接下发,iOS的由apns服务器下发,Winphone的由mpns下发
                .setNotification(Notification.newBuilder()
                        // 指定当前推送的android通知
                        .addPlatformNotification(AndroidNotification.newBuilder()
                                .setAlert(notificationTitle)
                                .setTitle(notificationTitle)
                                //此字段为透传字段,不会显示在通知栏。用户可以通过此字段来做一些定制需求,如特定的key传要指定跳转的页面(value)
                                .addExtra("androidNotification extras key", extras)
                                .build())
                        // 指定当前推送的iOS通知
                        .addPlatformNotification(IosNotification.newBuilder()
                                // 传一个IosAlert对象,指定apns title、title、subtitle等
                                .setAlert(notificationTitle)
                                // 直接传alert
                                // 此项是指定此推送的badge自动加1
                                .incrBadge(1)
                                // 此字段的值default表示系统默认声音;传sound.caf表示此推送以项目里面打包的sound.caf声音来提醒,
                                // 如果系统没有此音频则以系统默认声音提醒;此字段如果传空字符串,iOS9及以上的系统是无声音提醒,以下的系统是默认声音
                                .setSound("default")
                                // 此字段为透传字段,不会显示在通知栏。用户可以通过此字段来做一些定制需求,如特定的key传要指定跳转的页面(value)
                                .addExtra("iosNotification extras key", extras)
                                // 此项说明此推送是一个background推送,想了解background看:http://docs.jpush.io/client/ios_tutorials/#ios-7-background-remote-notification
                                // 取消此注释,消息推送时ios将无法在锁屏情况接收
                                // .setContentAvailable(true)
                                .build())
                        .build())
                // Platform指定了哪些平台就会像指定平台中符合推送条件的设备进行推送。 jpush的自定义消息,
                // sdk默认不做任何处理,不会有通知提示。建议看文档http://docs.jpush.io/guideline/faq/的
                // [通知与自定义消息有什么区别?]了解通知和自定义消息的区别
                .setMessage(Message.newBuilder()
                        .setMsgContent(msgContent)
                        .setTitle(msgTitle)
                        .addExtra("message extras key", extras)
                        .build())
                .setOptions(Options.newBuilder()
                        // 此字段的值是用来指定本推送要推送的apns环境,false表示开发,true表示生产;对android和自定义消息无意义
                        .setApnsProduction(apnsProduction)
                        // 此字段是给开发者自己给推送编号,方便推送者分辨推送记录
                        .setSendno(1)
                        // 此字段的值是用来指定本推送的离线保存时长,如果不传此字段则默认保存一天,最多指定保留十天;
                        .setTimeToLive(86400)
                        .build())
                .build();

    }


    /**
     * 向android平台所有用户推送消息
     *
     * @param notificationTitle
     * @param msgTitle
     * @param msgContent
     * @param extras
     * @return
     */
    private PushPayload buildPushObject_android_all_alertWithTitle(String notificationTitle, String msgTitle, String msgContent, String extras) {
        return PushPayload.newBuilder()
                // 指定要推送的平台,all代表当前应用配置了的所有平台,也可以传android等具体平台
                .setPlatform(Platform.android())
                // 指定推送的接收对象,all代表所有人,也可以指定已经设置成功的tag或alias或该应应用客户端调用接口获取到的registration id
                .setAudience(Audience.all())
                // jpush的通知,android的由jpush直接下发,iOS的由apns服务器下发,Winphone的由mpns下发
                .setNotification(Notification.newBuilder()
                        // 指定当前推送的android通知
                        .addPlatformNotification(AndroidNotification.newBuilder()
                                .setAlert(notificationTitle)
                                .setTitle(notificationTitle)
                                // 此字段为透传字段,不会显示在通知栏。用户可以通过此字段来做一些定制需求,如特定的key传要指定跳转的页面(value)
                                .addExtra("androidNotification extras key", extras)
                                .build())
                        .build()
                )
                // Platform指定了哪些平台就会像指定平台中符合推送条件的设备进行推送。 jpush的自定义消息,
                // sdk默认不做任何处理,不会有通知提示。建议看文档http://docs.jpush.io/guideline/faq/的
                // [通知与自定义消息有什么区别?]了解通知和自定义消息的区别
                .setMessage(Message.newBuilder()
                        .setMsgContent(msgContent)
                        .setTitle(msgTitle)
                        .addExtra("message extras key", extras)
                        .build())

                .setOptions(Options.newBuilder()
                        // 此字段的值是用来指定本推送要推送的apns环境,false表示开发,true表示生产;对android和自定义消息无意义
                        .setApnsProduction(apnsProduction)
                        // 此字段是给开发者自己给推送编号,方便推送者分辨推送记录
                        .setSendno(1)
                        // 此字段的值是用来指定本推送的离线保存时长,如果不传此字段则默认保存一天,最多指定保留十天,单位为秒
                        .setTimeToLive(86400)
                        .build())
                .build();
    }


    /**
     * 向ios平台所有用户推送消息
     *
     * @param notificationTitle
     * @param msgTitle
     * @param msgContent
     * @param extras
     * @return
     */
    private PushPayload buildPushObject_ios_all_alertWithTitle(String notificationTitle, String msgTitle, String msgContent, String extras) {
        return PushPayload.newBuilder()
                // 指定要推送的平台,all代表当前应用配置了的所有平台,也可以传android等具体平台
                .setPlatform(Platform.ios())
                // 指定推送的接收对象,all代表所有人,也可以指定已经设置成功的tag或alias或该应应用客户端调用接口获取到的registration id
                .setAudience(Audience.all())
                // jpush的通知,android的由jpush直接下发,iOS的由apns服务器下发,Winphone的由mpns下发
                .setNotification(Notification.newBuilder()
                        // 指定当前推送的android通知
                        .addPlatformNotification(IosNotification.newBuilder()
                                // 传一个IosAlert对象,指定apns title、title、subtitle等
                                .setAlert(notificationTitle)
                                // 直接传alert
                                // 此项是指定此推送的badge自动加1
                                .incrBadge(1)
                                // 此字段的值default表示系统默认声音;传sound.caf表示此推送以项目里面打包的sound.caf声音来提醒,
                                // 如果系统没有此音频则以系统默认声音提醒;此字段如果传空字符串,iOS9及以上的系统是无声音提醒,以下的系统是默认声音
                                .setSound("default")
                                // 此字段为透传字段,不会显示在通知栏。用户可以通过此字段来做一些定制需求,如特定的key传要指定跳转的页面(value)
                                .addExtra("iosNotification extras key", extras)
                                // 此项说明此推送是一个background推送,想了解background看:http://docs.jpush.io/client/ios_tutorials/#ios-7-background-remote-notification
                                // .setContentAvailable(true)
                                .build())
                        .build()
                )
                // Platform指定了哪些平台就会像指定平台中符合推送条件的设备进行推送。 jpush的自定义消息,
                // sdk默认不做任何处理,不会有通知提示。建议看文档http://docs.jpush.io/guideline/faq/的
                // [通知与自定义消息有什么区别?]了解通知和自定义消息的区别
                .setMessage(Message.newBuilder()
                        .setMsgContent(msgContent)
                        .setTitle(msgTitle)
                        .addExtra("message extras key", extras)
                        .build())
                .setOptions(Options.newBuilder()
                        // 此字段的值是用来指定本推送要推送的apns环境,false表示开发,true表示生产;对android和自定义消息无意义
                        .setApnsProduction(apnsProduction)
                        // 此字段是给开发者自己给推送编号,方便推送者分辨推送记录
                        .setSendno(1)
                        // 此字段的值是用来指定本推送的离线保存时长,如果不传此字段则默认保存一天,最多指定保留十天,单位为秒
                        .setTimeToLive(86400)
                        .build())
                .build();
    }

    public static void main(String[] args) {
//        MyJPushClient jPushUtil = new MyJPushClient();
//        List<String> aliasList = Arrays.asList("239");
//        String notificationTitle = "notificationTitle";
//        String msgTitle = "msgTitle";
//        String msgContent = "msgContent";
//        jPushUtil.sendToAliasList(aliasList, notificationTitle, msgTitle, msgContent, "exts");
    }

}

4.test

@RunWith(SpringRunner.class)
@SpringBootTest
public class JPushApplicationTests {

    @Autowired
    private MyJPushClient jPushClient;

    @Test
    public void testJPush() {
        List<String> aliasList = Arrays.asList("239");
        String notificationTitle = "notification_title";
        String msgTitle = "msg_title";
        String msgContent = "msg_content";
        jPushClient.sendToAliasList(aliasList, notificationTitle, msgTitle, msgContent, "exts");
    }
}

获取示例源码请转发该文章并关注Java实用技术,私信获取极光推送源码。

光推送(Jiguang Push)是一个跨平台的消息推送服务,可帮助您向您的移动应用用户发送推送通知。它提供广泛的功能,包括:

定时推送:在指定的时间向用户发送推送通知。

标签推送:根据用户标签向特定用户群组发送推送通知。

别名推送:向单个用户或一组用户发送推送通知。

丰富推送:发送包含文本、图像和链接的推送通知。

地理围栏推送:向位于特定地理区域内的用户发送推送通知。

离线推送:即使用户离线,也能向他们发送推送通知。

要开始使用极光推送,您需要创建一个极光开发者账号并创建一个应用。然后,您需要将极光推送 SDK 集成到您的移动应用中。SDK 提供用于发送推送通知、接收推送通知和管理用户订阅的 API。

以下是一般步骤:

1. 创建极光开发者账号

访问极光推送官网:https://www.jiguang.cn/

注册账号并完成验证

2. 创建应用

登录极光控制台

进入【应用管理】页面

点击“创建应用”按钮

填写应用名称并选择应用类型

选择服务“消息推送”

完成应用创建

3. 配置推送服务

按照不同平台的配置说明进行设置

Android 配置

填写应用包名

上传厂商密钥文件

HarmonyOS 配置

填写应用包名

填写默认标题

上传厂商密钥文件

iOS 配置

上传 APNs 证书

填写 Bundle ID

4. 集成极光推送 SDK

将极光推送 SDK 下载到您的项目中

按照 SDK 文档进行集成

5. 发送推送通知

使用极光推送 SDK 的 API 发送推送通知

您可以指定目标用户、推送内容和推送选项

6. 接收推送通知

在您的应用中实现极光推送 SDK 的回调函数

处理推送通知并相应地更新您的应用界面

有关更详细的开发步骤,请参阅极光推送官方文档:https://docs.jiguang.cn/

以下是一些额外的提示,可帮助您开始使用极光推送:

使用极光推送控制台测试您的推送通知。

使用极光推送的分析功能来跟踪您的推送通知效果。

遵循极光推送的最佳实践来确保您的推送通知有效且不打扰用户。

欲善其事,必先利其器。在我们开发的过程中,一些“轮子”、工具能够帮助我们应对项目中切实的需求,提升开发的效率。所以,日常收集一些库或工具就显得尤为重要了。毕竟,遇见需求/问题的时候,能做到“家有余粮,心中不慌。”

在本期中,我依然精选了一些近期收罗的开源库、工具以及我的微博上 #每日一Pen# 话题中大家转发较多的编程灵感,希望你们有所收获。


前端

1. TypeLighter.js

TypeLighter.js 是一款轻量级(Gzip 压缩后仅 1.04KB)的 JS 库,能够帮助你实现打字机效果。它提供了 8 个属性(写入速度、写入/删除延迟等)供你微调,更改 data 属性即可更改其值。 ​​​​

项目地址:

https://github.com/EdernClemente/TypeLighterJS

2.Clendar

Clendar 是一款轻量级、无依赖的 JS 日历组件。它具备简洁的 API,适用于 React、Vue、Angular 等框架。 ​​​​

项目地址:

https://github.com/simbawus/calendar

3.Lax.js

Lax.js 是一款轻量的 Vanilla JS 插件,当页面滚动时,创建流畅、炫酷的动画效果,让你的网站“动”起来。

项目地址:

https://github.com/alexfoxy/laxxx

4.HIUI

HIUI 是由小米开源的面向中后台系统的前端组件库。它以用户体验一致性为出发点,提供类型全面的组件库和页面模板,帮助开发人员快速实现交互一致、界面美观的界面开发。 ​

项目地址:

https://github.com/XiaoMi/hiui

5.awesome-coding-js

这个仓库整合了大量算法和数据结构的 JavaScript 实现,涉及经典排序算法、二叉树、链表、字符串等内容,巩固基础的朋友,可以关注下。

项目地址:

https://github.com/ConardLi/awesome-coding-js

6.JS-Dev-Reads

专为 JS 开发者汇总的阅读清单,涉及图书推荐、文章精选等内容。

项目地址:

https://github.com/twhite96/js-dev-reads


后端

1.JetCache

JetCache 是由阿里巴巴开源的通用缓存访问框架,它提供了统一的 API 和注解来简化缓存的使用。如果你了解 SpringCache 的话,那么更容易接受它,因为它比 SpringCache 更强大。它支持 TTL、两级缓存、分布式缓存自动刷新、异步 Cache API,还可以手动去操作缓存实例。

项目地址:

https://github.com/alibaba/jetcache

2.architect-awesome

一套非常全面的后端架构师技术图谱,从数据结构与算法着手,带你学习后端技术的方方面面。目前 GitHub 上已有 3.7W Star,值得推荐。

项目地址:

https://github.com/xingshaocheng/architect-awesome

3.Bistoury

Bistoury 是去哪儿网开源的一个对应用透明,无侵入的 Java 应用诊断工具。它提供了在线 Debug、线程级 CPU 监控等诸多功能,帮助开发人员直接通过日志、内存、线程、类信息、调试、机器和系统属性等各个方面对应用进行诊断,提升开发人员的诊断效率和诊断能力。

项目地址:

https://github.com/qunarcorp/bistoury

4.Python-Crawler-Tutorial-Starts-From-Zero

这是 Python 从零到一爬虫系列教程。教程涉及爬虫预备知识、请求分析流程、Requests 模块的使用等基础知识部分,以及 3 个项目实例内容,帮助你零到一学会 Python 爬虫。

项目地址:

https://github.com/Kr1s77/Python-crawler-tutorial-starts-from-zero

5.VHR

VHR(微人事)是一个由 SpringBoot+Vue 开发的人力资源管理系统。项目采用前后端分离,并提供了详细的开发文档,供参考与学习。

项目地址:

https://github.com/lenve/vhr


移动端

1.Morec

Morec 是一个精美的 Flutter 版电影客户端。它利用了豆瓣现有的 API,实现了具备电影搜索、电影榜单、详情介绍等完整功能的电影展示,或许这个项目能给你一些参考。 ​

项目地址:

https://github.com/Mayandev/morec

2.PickerView

这是一个非常好用的 Android PickerView 库,内部提供 2 种常用类型的 Picker.它支持扩展自定义 Picker、自定义弹窗,也可作为 View 的非弹窗场景。

项目地址:

https://github.com/jaaksi/pickerview

3.Xpush

Xpush 是一款轻量级、可插拔的 Android 消息推送框架。它集成便捷,提供了一键集成推送(极光推送、友盟推送、华为、小米推送等),它具备丰富的功能(支持推送相关的注册、注销,标签的增加、删除、获取等操作),还支持统一的消息订阅、增加消息过滤器、支持 Android 9.0.

项目地址:

https://github.com/xuexiangjys/XPush


工具/资源

1.React Image Crop

React Image Crop 是一款响应式图像剪裁工具,它具备轻量、无依赖、响应式、支持触控等特性。

项目地址:

https://github.com/DominicTobias/react-image-crop

2.Chrome 插件英雄榜

这个仓库汇集了众多优秀、实用的 Chrome 插件,并提供了详尽的说明。或许,你会淘到自己喜欢的工具。

项目地址:

https://github.com/zhaoolee/ChromeAppHeroes

3.Microsoft Whiteboard

Microsoft Whiteboard 是由微软推出的一款电子白板软件,能帮助你便捷的记录想法、灵感与创意。它支持实时协作,云端保存等功能。目前可以免费下载,喜欢的朋友可以试试。 ​​​​

项目地址:

https://products.office.com/zh-cn/microsoft-whiteboard/digital-whiteboard-app

4.StarrySky

这是一个丰富的音乐播放封装库。它针对快速集成音频播放功能,减少大家搬砖的时间,提升开发效率。

项目地址:

https://github.com/EspoirX/StarrySky

5.Awesome Actions

这个仓库汇集了与 GitHub Actions 相关的优质内容。除了官方推荐以外,作者还汇总了 Actions 相关的工具、应用、测试、服务等众多内容。 ​

项目地址:

https://github.com/sdras/awesome-actions

6.A Programmer's Guide to English

这是一个专为程序员编写的英语学习指南。面对网上杂七杂八的英语学习技巧,如果想要学好英语,这个指南将会减少你不必要花费的时间。

项目地址:

https://github.com/yujiangshui/A-Programmers-Guide-to-English


编程灵感

1.Simple CSS Waves

纯 CSS 实现简单的波浪动画。

查看源码:

https://codepen.io/goodkatz/pen/LYPGxQz

2.CSS 3D Carousel Room

CSS+JS 实现 3D Carousel Room 效果。

查看源码:

https://codepen.io/Anemolo/pen/ERPvZV

3.Pure CSS Cute Cup

纯 CSS 绘制可爱杯子动画。

查看源码:

https://codepen.io/keirafoxy/pen/JgdBVW

4.Play Hard

HTML+CSS+JS 实现《Play Hard》文字伸缩炫彩动画。

查看源码:

https://codepen.io/chrisgannon/pen/KONLar

5.CSS Only-Social Icons

纯 CSS 实现带有 Hover 效果的社交图标。

查看源码:

https://codepen.io/Stockin/pen/aQoQGr


彩蛋

100 Days Of ML Code

人工智能一直是科技领域的热点,目前市场的需求也更为强烈,所以想学它人不在少数。但是,面对网络上良莠不齐的学习资源,鉴别和甄选其价值却耗费了我们不少时间与精力。今天分享的《100 Days Of ML Code》——百日机器学习计划,在 GitHub 上可谓相当火爆,于是有热心网友就将其翻译成了中文版本,供大家参考与学习。

这是一个系统的学习计划,作者图文并茂的讲述了机器学习的相关概念,并有源码辅助教学,内容从易到难、循序渐进的帮你掌握机器学习的概念与应用,推荐给大家。

项目地址:

https://github.com/MLEveryday/100-Days-Of-ML-Code


感谢你的阅读。若你有所收获,点赞与分享是给我最大的支持。

注:

如需转载,烦请按下方注明出处信息,谢谢!

作者:IT程序狮

原文地址:

https://zhuanlan.zhihu.com/p/81911980


同时也欢迎关注我的微信公众号【IT程序狮】,不定期分享 IT 学习文章与资源。

更多文章

1.开源精粹!18 个值得关注的开源项目与工具

2.开源精粹(二)!22 个实用、有趣的开源项目

3.开源精粹(三)!程序员必备的21款工具与编程灵感