Merge branch 'newbackend' of https://github.com/nakazawakan/kikikanri into fe_fix_new
このコミットが含まれているのは:
コミット
40e6a46865
|
@ -1,4 +1,4 @@
|
|||
APP_NAME=KIKI
|
||||
APP_NAME=KIKIシステム
|
||||
APP_ENV=local
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
APP_NAME=KIKI
|
||||
APP_NAME=KIKIシステム
|
||||
APP_ENV=production
|
||||
APP_KEY=
|
||||
APP_DEBUG=false
|
||||
|
|
|
@ -5,6 +5,9 @@ namespace App\Console;
|
|||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
use App\Models\TelActivation;
|
||||
use App\Models\EmailActivation;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
|
@ -24,6 +27,18 @@ class Kernel extends ConsoleKernel
|
|||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
$schedule->call(function () {
|
||||
foreach (TelActivation::get() as $t) {
|
||||
if (time() > strtotime($t->ttl)) {
|
||||
TelActivation::where('id', $t->id)->delete();
|
||||
}
|
||||
}
|
||||
foreach (EmailActivation::get() as $e) {
|
||||
if (time() > strtotime($e->ttl)) {
|
||||
EmailActivation::where('id', $e->id)->delete();
|
||||
}
|
||||
}
|
||||
})->everyMinute();
|
||||
// $schedule->command('inspire')->hourly();
|
||||
}
|
||||
|
||||
|
|
|
@ -111,12 +111,15 @@ trait AuthenticationTrait {
|
|||
//unset($_COOKIE['remember_token']);
|
||||
//setcookie('remember_token', '', time() - 3600, '/', $_SERVER['HTTP_HOST'], 0, 1);
|
||||
|
||||
$expire = (int)time() + ((int)env('SESSION_LIFETIME') * 60);
|
||||
|
||||
if ($r->remember_token == 'true') {
|
||||
$token = bin2hex(random_bytes(24));
|
||||
|
||||
try {
|
||||
$this->getModel()->where('id', $get->id)->update(['remember_token' => $token]);
|
||||
setcookie('remember_token', $token, time()+157788000, '/', $_SERVER['HTTP_HOST'], false, true);
|
||||
$expire = (int)time()+157788000;
|
||||
setcookie('remember_token', $token, $expire, '/', $_SERVER['HTTP_HOST'], false, true);
|
||||
}
|
||||
catch (\Throwable $e) {
|
||||
Log::critical($e->getMessage());
|
||||
|
@ -127,7 +130,7 @@ trait AuthenticationTrait {
|
|||
// セッションを想像する
|
||||
$login_user_datum = $this->makeSession($this->getGuard(), $get->toArray());
|
||||
|
||||
return ['status_code' => 200, 'params' => ['id' => $login_user_datum['id'], 'expire' => (int)time() + ((int)env('SESSION_LIFETIME') * 60)]];
|
||||
return ['status_code' => 200, 'params' => ['id' => $login_user_datum['id'], 'expire' => $expire]];
|
||||
}
|
||||
|
||||
public function logout () {
|
||||
|
|
|
@ -585,7 +585,12 @@ class ChildrenController extends Controller {
|
|||
if (isset($r->child_id)) {
|
||||
$child_id = $r->child_id;
|
||||
}
|
||||
$child_id = request()->route()->action['as'] == 'cpa' ? (int)$child_id : (int)session()->get('children')['id'];
|
||||
else if (isset($r->token)) {
|
||||
$child_id = TelActivation::select('id')->where('token', $r->token)->first()->id;
|
||||
}
|
||||
else if (null !== session()->get('children')['id']) {
|
||||
$child_id = (int)session()->get('children')['id'];
|
||||
}
|
||||
|
||||
if (is_null($child_id) && !isset($r->token)) {
|
||||
return ['status_code' => 400, 'error_messages' => ['パスワードの更新に失敗しました。']];
|
||||
|
|
|
@ -21,67 +21,80 @@ class FilesController extends Controller {
|
|||
abort_if(!Storage::disk('private')->exists($path), 404, $err);
|
||||
abort_if(!session()->has('children') && !session()->has('fathers') && !session()->has('admins'), 404, $err);
|
||||
|
||||
if (substr($path, -4) == '.pdf') {
|
||||
if (session()->has('children')) {
|
||||
if (null !== ($rel = FatherRelation::where('child_id', (int)session()->get('children')['id'])->first())) {
|
||||
$got = true;
|
||||
}
|
||||
if (null !== (Meeting::where('father_id', $rel->father_id)->where('pdf', '/files/'.$path)->first())) {
|
||||
$got = true;
|
||||
}
|
||||
abort_if(!$got, 404, $err);
|
||||
}
|
||||
else if (session()->has('fathers')) {
|
||||
if (null !== (Meeting::where('father_id', (int)session()->get('fathers')['id'])->where('pdf', '/files/'.$path)->first())) {
|
||||
$got = true;
|
||||
}
|
||||
abort_if(!$got, 404, $err);
|
||||
}
|
||||
// 管理者は全部見えます。
|
||||
if (session()->has('admins')) {
|
||||
$got = true;
|
||||
}
|
||||
else {
|
||||
if (null !== ($meetimg = MeetingImage::where('image', '/files/'.$path)->first())) {
|
||||
|
||||
// 既にgotはtrueの場合、スキップ。このチェックが無いと、trueになったらも全部確認する様になります。
|
||||
if (!$got) {
|
||||
// PDFの場合
|
||||
if (substr($path, -4) == '.pdf') {
|
||||
// 子供
|
||||
if (session()->has('children')) {
|
||||
// ミーティング
|
||||
if (null !== ($rel = FatherRelation::where('child_id', (int)session()->get('children')['id'])->first())) {
|
||||
$got = true;
|
||||
if (null !== (Meeting::where('father_id', $rel->father_id)->where('pdf', '/files/'.$path)->first())) {
|
||||
$got = true;
|
||||
}
|
||||
}
|
||||
if (null !== (Meeting::where('id', $meetimg->meeting_id)->where('father_id', $rel->father_id)->first())) {
|
||||
$got = true;
|
||||
}
|
||||
abort_if(!$got, 404, $err);
|
||||
}
|
||||
if (session()->has('fathers')) {
|
||||
if (null !== (Meeting::where('id', $meetimg->meeting_id)->where('father_id', (int)session()->get('fathers')['id'])->first())) {
|
||||
// 親
|
||||
if (!$got && session()->has('fathers')) {
|
||||
// ミーティング
|
||||
if (null !== (Meeting::where('father_id', (int)session()->get('fathers')['id'])->where('pdf', '/files/'.$path)->first())) {
|
||||
$got = true;
|
||||
}
|
||||
abort_if(!$got, 404, $err);
|
||||
}
|
||||
|
||||
abort_if(!$got, 404, $err);
|
||||
}
|
||||
// 画像の場合
|
||||
else {
|
||||
if (session()->has('children')) {
|
||||
if (null !== (Child::where('id', (int)session()->get('children')['id'])->where('image', '/files/'.$path)->first())) {
|
||||
$got = true;
|
||||
// ミーティング
|
||||
if (null !== ($meetimg = MeetingImage::where('image', '/files/'.$path)->first())) {
|
||||
// 子供
|
||||
if (session()->has('children')) {
|
||||
if (null !== ($rel = FatherRelation::where('child_id', (int)session()->get('children')['id'])->first())) {
|
||||
if (null !== (Meeting::where('id', $meetimg->meeting_id)->where('father_id', $rel->father_id)->first())) {
|
||||
$got = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (FatherRelation::select('father_id')->where('child_id', (int)session()->get('children')['id'])->get() as $rel) {
|
||||
if (null !== (Father::where('id', (int)$rel->father_id)->where('image', '/files/'.$path)->first())) {
|
||||
// 親
|
||||
if (!$got && session()->has('fathers')) {
|
||||
if (null !== (Meeting::where('id', $meetimg->meeting_id)->where('father_id', (int)session()->get('fathers')['id'])->first())) {
|
||||
$got = true;
|
||||
}
|
||||
}
|
||||
abort_if(!$got, 404, $err);
|
||||
}
|
||||
if (session()->has('fathers')) {
|
||||
if (null !== (Father::where('id', (int)session()->get('fathers')['id'])->where('image', '/files/'.$path)->first())) {
|
||||
$got = true;
|
||||
}
|
||||
foreach (FatherRelation::select('child_id')->where('father_id', (int)session()->get('fathers')['id'])->get() as $rel) {
|
||||
if (null !== (Child::where('id', (int)$rel->child_id)->where('image', '/files/'.$path)->first())) {
|
||||
else {
|
||||
if (session()->has('children')) {
|
||||
if (null !== (Child::where('id', (int)session()->get('children')['id'])->where('image', '/files/'.$path)->first())) {
|
||||
$got = true;
|
||||
}
|
||||
foreach (FatherRelation::select('father_id')->where('child_id', (int)session()->get('children')['id'])->get() as $rel) {
|
||||
if (null !== (Father::where('id', (int)$rel->father_id)->where('image', '/files/'.$path)->first())) {
|
||||
$got = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (session()->has('fathers')) {
|
||||
if (null !== (Father::where('id', (int)session()->get('fathers')['id'])->where('image', '/files/'.$path)->first())) {
|
||||
$got = true;
|
||||
}
|
||||
foreach (FatherRelation::select('child_id')->where('father_id', (int)session()->get('fathers')['id'])->get() as $rel) {
|
||||
if (null !== (Child::where('id', (int)$rel->child_id)->where('image', '/files/'.$path)->first())) {
|
||||
$got = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
abort_if(!$got, 404, $err);
|
||||
}
|
||||
|
||||
abort_if(!$got, 404, $err);
|
||||
}
|
||||
}
|
||||
|
||||
return Storage::disk('private')->response($path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,11 +93,11 @@ class MeetingsController extends Controller {
|
|||
|
||||
if (substr($r->pdf, -4) != '.pdf') {
|
||||
$pdf = base64_decode(substr($r->pdf, strpos($r->pdf, ',') + 1));
|
||||
|
||||
Storage::disk('private')->put($filename, $pdf);
|
||||
}
|
||||
else {
|
||||
$insert['pdf'] = $r->pdf;
|
||||
$pdf = Storage::disk('private')->get(substr($r->pdf, 7));
|
||||
Storage::disk('private')->put($filename, $pdf);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,22 +106,22 @@ class MeetingsController extends Controller {
|
|||
|
||||
if (isset($r->image)) {
|
||||
foreach ($r->image as $img) {
|
||||
if (substr($img, -5) != '.jpeg' && substr($img, -4) != '.jpg' && substr($img, -4) != '.png' && substr($img, -4) != '.gif') {
|
||||
$fname = $this->uuidv4() . '.jpg';
|
||||
$fnames[] = $fname;
|
||||
$image = base64_decode(substr($img, strpos($img, ',') + 1));
|
||||
Storage::disk('private')->put($fname, $image);
|
||||
$this->fiximg($fname);
|
||||
$fname = $this->uuidv4() . '.jpg';
|
||||
$fnames[] = $fname;
|
||||
|
||||
$imgname = '/files/'.$fname;
|
||||
if (substr($img, -5) != '.jpeg' && substr($img, -4) != '.jpg' && substr($img, -4) != '.png' && substr($img, -4) != '.gif') {
|
||||
$image = base64_decode(substr($img, strpos($img, ',') + 1));
|
||||
}
|
||||
else {
|
||||
$imgname = $img;
|
||||
$image = Storage::disk('private')->get(substr($img, 7));
|
||||
}
|
||||
|
||||
Storage::disk('private')->put($fname, $image);
|
||||
$this->fiximg($fname);
|
||||
|
||||
$insert_image = [
|
||||
'meeting_id' => (int)$meeting,
|
||||
'image' => $imgname,
|
||||
'image' => '/files/'.$fname,
|
||||
];
|
||||
|
||||
MeetingImage::create($insert_image);
|
||||
|
|
|
@ -11,7 +11,7 @@ class ChildrenMainRegistrationMail extends Mailable {
|
|||
use Queueable, SerializesModels;
|
||||
|
||||
public function build () {
|
||||
return $this->subject('【KIKIシステム】本登録が完了しました。')->text('emails.children.registration.main', [
|
||||
return $this->subject('【KIKI】本登録が完了しました。')->text('emails.children.registration.main', [
|
||||
'url' => '/c-account/login',
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class ContactsMail extends Mailable {
|
|||
}
|
||||
|
||||
public function build () {
|
||||
return $this->subject('【KIKIシステム】お問い合わせありがとうございます。')->text('emails.contacts', [
|
||||
return $this->subject('【KIKI】お問い合わせありがとうございます。')->text('emails.contacts', [
|
||||
'messages' => $this->message
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ class FathersApprovalAgainMail extends Mailable {
|
|||
}
|
||||
|
||||
public function build () {
|
||||
return $this->subject('【KIKIシステム】KIKI運営事務局からのお知らせ')->text('emails.fathers.approvalagain', [
|
||||
return $this->subject('【KIKI】KIKI運営事務局からのお知らせ')->text('emails.fathers.approvalagain', [
|
||||
'father' => $this->father,
|
||||
'url' => '/c-account/meeting/detail/'.$this->meeting_id,
|
||||
]);
|
||||
|
|
|
@ -18,7 +18,7 @@ class FathersApprovalMail extends Mailable {
|
|||
}
|
||||
|
||||
public function build () {
|
||||
return $this->subject('【KIKIシステム】KIKI運営事務局からのお知らせ')->text('emails.fathers.approval', [
|
||||
return $this->subject('【KIKI】KIKI運営事務局からのお知らせ')->text('emails.fathers.approval', [
|
||||
'father' => $this->father,
|
||||
'url' => '/c-account/meeting/detail/'.$this->meeting_id,
|
||||
]);
|
||||
|
|
|
@ -16,7 +16,7 @@ class FathersForgetPasswordMail extends Mailable {
|
|||
}
|
||||
|
||||
public function build () {
|
||||
return $this->subject('【KIKIシステム】パスワードリセットを依頼しました。')->text('emails.fathers.forgotpassword', [
|
||||
return $this->subject('【KIKI】パスワードリセットを依頼しました。')->text('emails.fathers.forgotpassword', [
|
||||
'url' => '/p-account/forgot-password/reset/'.$this->token,
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ class FathersRegistrationMainMail extends Mailable {
|
|||
use Queueable, SerializesModels;
|
||||
|
||||
public function build () {
|
||||
return $this->subject('【KIKIシステム】本登録が完了しました。')->text('emails.fathers.registration.main', [
|
||||
return $this->subject('【KIKI】本登録が完了しました。')->text('emails.fathers.registration.main', [
|
||||
'url' => '/p-account/login',
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class FathersRegistrationTemporaryMail extends Mailable {
|
|||
}
|
||||
|
||||
public function build () {
|
||||
return $this->subject('【KIKIシステム】会員登録のご案内')->text('emails.fathers.registration.temporary', [
|
||||
return $this->subject('【KIKI】会員登録のご案内')->text('emails.fathers.registration.temporary', [
|
||||
'url' => '/p-account/register/'.$this->token,
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ class MeetingEditAwareness extends Mailable {
|
|||
}
|
||||
|
||||
public function build () {
|
||||
return $this->subject('【KIKIシステム】KIKI運営事務局からのお知らせ')->text('emails.fathers.meetingawareness', [
|
||||
return $this->subject('【KIKI】KIKI運営事務局からのお知らせ')->text('emails.fathers.meetingawareness', [
|
||||
'child' => $this->child,
|
||||
'url' => '/p-account/meeting/detail/'.$this->meeting_id,
|
||||
]);
|
||||
|
|
|
@ -18,7 +18,7 @@ class MeetingEditNotification extends Mailable {
|
|||
}
|
||||
|
||||
public function build () {
|
||||
return $this->subject('【KIKIシステム】KIKI運営事務局からのお知らせ')->text('emails.fathers.meetingedit', [
|
||||
return $this->subject('【KIKI】KIKI運営事務局からのお知らせ')->text('emails.fathers.meetingedit', [
|
||||
'father' => $this->father,
|
||||
'url' => '/c-account/meeting/detail/'.$this->meeting_id,
|
||||
]);
|
||||
|
|
|
@ -12897,7 +12897,7 @@ categories: [project]
|
|||
@font-face {
|
||||
font-family: "iconfont";
|
||||
src: url(/fonts/iconfont.eot?9bd2f8e21fb68f3cb69f306c7a5a07d2);
|
||||
src: url(/fonts/iconfont.eot?9bd2f8e21fb68f3cb69f306c7a5a07d2) format("eot"), url(/fonts/iconfont.woff?72290a51f520574be856b3621acc29a1) format("woff"), url(/fonts/iconfont.ttf?e240ce427caf7549e576c77b39a1d3f1) format("truetype"), url(/fonts/iconfont.svg?9e48c54f8bbb472c1c286234fdd6636f) format("svg");
|
||||
src: url(/fonts/iconfont.eot?9bd2f8e21fb68f3cb69f306c7a5a07d2) format("eot"), url(/fonts/iconfont.woff?72290a51f520574be856b3621acc29a1) format("woff"), url(/fonts/iconfont.ttf?e240ce427caf7549e576c77b39a1d3f1) format("truetype"), url(/fonts/iconfont.svg?d812f238f7ec32f5cb5ebd322f320a02) format("svg");
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
|
ファイル差分が大きすぎるため省略します
差分を読み込み
|
@ -168,7 +168,6 @@ Route::group(['prefix' => 'children'], function () {
|
|||
Route::group(['prefix' => 'father'], function () {
|
||||
Route::group(['prefix' => 'relations'], function () {
|
||||
Route::get('/checkNull', '\App\Http\Controllers\Api\FatherRelationsController@checkNull')->name('chknull_child');
|
||||
Route::get('/check', '\App\Http\Controllers\Api\FatherRelationsController@check')->name('chk_child');
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ RUN apt-get install -y nodejs
|
|||
|
||||
# yarnをインストール
|
||||
RUN apt-get update
|
||||
RUN apt-get -y install git unzip libzip-dev libicu-dev libonig-dev zlib1g-dev
|
||||
RUN apt-get -y install git unzip libzip-dev libicu-dev libonig-dev zlib1g-dev cron
|
||||
RUN apt-get clean
|
||||
RUN curl --output libpng16-16_1.6.36-6_amd64.deb http://ftp.jp.debian.org/debian/pool/main/libp/libpng1.6/libpng16-16_1.6.36-6_amd64.deb
|
||||
RUN curl --output libpng-dev_1.6.36-6_amd64.deb http://ftp.jp.debian.org/debian/pool/main/libp/libpng1.6/libpng-dev_1.6.36-6_amd64.deb
|
||||
|
@ -31,5 +31,9 @@ RUN docker-php-ext-configure gd --with-jpeg
|
|||
RUN docker-php-ext-install -j$(nproc) intl pdo_mysql zip bcmath gd exif
|
||||
|
||||
COPY ./php.ini /usr/local/etc/php/php.ini
|
||||
COPY ./crontab /etc/crontab
|
||||
CMD ["cron","-f", "-l", "2"]
|
||||
|
||||
#RUN cd /work && composer update && npm run prod && php artisan migrate:fresh --seed
|
||||
|
||||
WORKDIR /work
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
# /etc/crontab: system-wide crontab
|
||||
# Unlike any other crontab you don't have to run the `crontab'
|
||||
# command to install the new version when you edit this file
|
||||
# and files in /etc/cron.d. These files also have username fields,
|
||||
# that none of the other crontabs do.
|
||||
|
||||
SHELL=/bin/sh
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
|
||||
# Example of job definition:
|
||||
# .---------------- minute (0 - 59)
|
||||
# | .------------- hour (0 - 23)
|
||||
# | | .---------- day of month (1 - 31)
|
||||
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
|
||||
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
|
||||
# | | | | |
|
||||
# * * * * * user-name command to be executed
|
||||
17 * * * * root cd / && run-parts --report /etc/cron.hourly
|
||||
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
|
||||
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
|
||||
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
|
||||
* * * * * root cd /work && php artisan schedule:run >> /dev/null 2>&1
|
||||
#
|
新しいイシューから参照