Code Monkey home page Code Monkey logo

cocoyo's Introduction

哈哈!我也不知道在业余时间怼了多少次自己的博客了:smile:

安装

克隆项目

git clone [email protected]:ningge123/cocoyo.git

进入目录

composer install

下载前端资源

npm install

复制.env.example.env

cp .env.example .env

配置.env

介绍一些所需要的配置项

Redis因为需要记录文章统计访问数和用户最后访问时间,所以你需要配置redis

REDIS_HOST=
REDIS_PASSWORD=
REDIS_PORT=

用户注册验证邮箱需要用到邮件发送,所以需要配置邮件服务,我这里使用的是sendcloud

MAIL_DRIVER=
SEND_CLOUD_USER=
SEND_CLOUD_KEY=
MAIL_FROM_ADDRESS=
MAIL_FROM_NAME=

站内消息提醒使用的是laravel的广播系统,所以需要配置pusher:

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=

//还需要配置`/resources/assets/js/commponents/Navbar.vue`里的:
key: '65f5c4e6ce56d46ab2c6',

文件系统用的是public目录:

FILESYSTEM_DRIVER=public

所以需要执行:

php artisan storage:link

api认证用的是passport:

OAUTH_GRANT_TYPE=
OAUTH_CLIENT_ID=
OAUTH_CLIENT_SECRET=
OAUTH_SCOPE=*

所以需要执行:

php artisan make:passport:install

文章标题转为英文,用的是有道翻译接口:

YOUDAO_APP_KEY=
YOUDAO_APP_SECRET=

第三方登陆QQweibo,当然你也可以屏蔽:

WEIBO_KEY=
WEIBO_SECRET=
WEIBO_REDIRECT_URI=

QQ_KEY=
QQ_SECRET=
QQ_REDIRECT_URI=

配置就是这些!下面介绍两个自定义artisan:

php artisan  cocoyo:sync-database-visit // 将访问数从 Redis 同步到数据库中
php artisan cocoyo:sync-user-actived-at // 将用户最后登录时间从 Redis 同步到数据库中

还有定义了两个任务调度:

// 每日零时执行一次 同步redis最后用户访问时间到数据库
$schedule->command('cocoyo:sync-user-actived-at')->dailyAt('00:00');
// 每周六零时执行一次 同步redis 访问数至数据库
$schedule->command('cocoyo:sync-database-visit')->weekly()->saturdays()->dailyAt('00:00');

所以需要加上定时任务

* * * * * php /data/www/cocoyo/artisan schedule:run >> /dev/null 2>&1

最后是一些截图:

8W%5D(M3_L(Z3W39NZ{GZP.png

XL5AF{ZD@3YC{$PU})AU%V.png

附上地址cocoyo。:laughing:

cocoyo's People

Contributors

ningge123 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.