Skip to content

Commit

Permalink
fixed bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wanglelecc committed May 16, 2018
1 parent 20da6e8 commit f4d2164
Show file tree
Hide file tree
Showing 56 changed files with 3,005 additions and 1,384 deletions.
23 changes: 21 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,32 @@ BAIDU_TRANSLATE_KEY=
DEBUGBAR_ENABLED=true

API_STANDARDS_TREE=prs
API_SUBTYPE=laracms
API_SUBTYPE=
API_DOMAIN=
API_PREFIX=api
API_VERSION=v1
API_DEBUG=true

WEIXIN_KEY=
WEIXIN_SECRET=
WEIXIN_REDIRECT_URI=

JWT_SECRET=HSKxIUfwCdJj5gadbqfQo5im9zje95g9
WEIXINWEB_KEY=
WEIXINWEB_SECRET=
WEIXINWEB_REDIRECT_URI=

QQ_KEY=
QQ_SECRET=
QQ_REDIRECT_URI=

WEIBO_KEY=
WEIBO_SECRET=
WEIBO_REDIRECT_URI=

GITHUB_KEY=
GITHUB_SECRET=
GITHUB_REDIRECT_URI=

JWT_SECRET=HSKxIUfwCdJj5gadbqfQo5im9zje95g9

SCOUT_DRIVER=tntsearch
6 changes: 0 additions & 6 deletions app/Handlers/TokenizerHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ public function tokenize($text, $stopwords = [])
public function getTokens($text, $stopwords = [])
{
$split = Jieba::cutForSearch($text);
// var_dump($split);
//// echo '<hr />';
return $split;
// return array_diff($split, $stopwords);
}



}
2 changes: 2 additions & 0 deletions app/Http/Controllers/Administrator/ArticlesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public function index(Article $article, Request $request)
$article = $article->filterWith();
}

$article = $article->with(['categorys']);

// 关键字过滤
if($keyword = $request->keyword ?? ''){
$article->where('title', 'like', "%{$keyword}%");
Expand Down
20 changes: 18 additions & 2 deletions app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ public function handleProviderCallback($type)
'qq_id' => $oauthUser->getId(),
];
break;

case 'github':
$user = User::where('github_id', $oauthUser->getId())->first();
$userAttributes = [
'github_id' => $oauthUser->getId(),
];
break;
}

// 没有用户且未登录,默认创建一个用户
Expand All @@ -138,7 +145,10 @@ public function handleProviderCallback($type)
// $user->fill($userAttributes);
// $user->save();
return redirect()->route('user.settings','#bind')->with('success', '绑定成功.');
// return redirect()->route('user.settings','#bind');
}else if($user && Auth::check() && ($user->id != Auth::user()->id) ){
return redirect()->route('user.settings','#bind')->with('danger', '已绑定过其它用户,不能重复绑定.');
}else if( $user && Auth::check() && ($user->id == Auth::user()->id) ){
return redirect()->route('user.settings','#bind')->with('danger', '已绑定,无需重复绑定.');
}

# 登录用户
Expand All @@ -160,7 +170,7 @@ public function unbind($type){
$user = Auth::user();

if(!$user->email){
return redirect()->route('user.settings','#bind')->with('error', '绑定邮箱后才能解绑.');
return redirect()->route('user.settings','#bind')->with('danger', '绑定邮箱后才能解绑.');
}

switch (strtolower($type)) {
Expand All @@ -182,6 +192,12 @@ public function unbind($type){
'qq_id' => null,
];
break;

case 'github':
$userAttributes = [
'github_id' => null,
];
break;
}

# 用户保存
Expand Down
2 changes: 2 additions & 0 deletions app/Listeners/BehaviorLogListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public function __construct()
*/
public function handle(BehaviorLogEvent $event)
{
if (app()->runningInConsole()) { return; }

$model = $event->model;
$type = isset($model->id) ? '更新' : '添加';
$title = get_value($model, $model->titleName());
Expand Down
2 changes: 1 addition & 1 deletion app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class User extends Authenticatable implements JWTSubject
* @var array
*/
protected $fillable = [
'id','name', 'phone', 'email', 'password', 'avatar', 'introduction', 'status', 'weixin_openid', 'weixin_unionid', 'weibo_id', 'qq_id', 'last_ip', 'last_location', 'last_time',
'id','name', 'phone', 'email', 'password', 'avatar', 'introduction', 'status', 'weixin_openid', 'weixin_unionid', 'weibo_id', 'qq_id', 'github_id', 'last_ip', 'last_location', 'last_time',
];

// public $dispatchesEvents = [
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"name": "wanglelecc/laracms",
"description": "The Laracms By Laravel Framework.",
"keywords": ["framework", "laravel", "cms", "laracms", "wanglelecc"],
"license": "MIT",
"type": "project",
"require": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function up()
*/
Schema::create('blocks', function (Blueprint $table) {
$table->increments('id');
$table->uuid('object_id')->comment('objectId');
$table->string('object_id', 64)->comment('objectId');
$table->integer("group")->default(0)->comment('分组');
$table->enum("type",['latestArticle','hotArticle','latestProduct','hotProduct','slide','articleTree','productTree','blogTree','pageList','contact','about','links','header','followUs','html','htmlcode','phpcode',])->comment('类型');
$table->string("template")->default('default')->comment('模板');
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddGithubIdToUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('github_id')->unique()->nullable()->comment('Github openid')->after('qq_id');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('github_id');
});
}
}
2 changes: 1 addition & 1 deletion public/css/app.desktop.css

Large diffs are not rendered by default.

Loading

0 comments on commit f4d2164

Please sign in to comment.