Commit c1227d01 authored by gxx's avatar gxx

添加了一些database

parent d336a6af
......@@ -79,7 +79,7 @@ class AdminService implements AdminServiceContract
$admin->update();
if ($admin) {
$roles = RoleAdmin::where('admin_id', $id)->get();
if (count($role) > 0) {
if ($role != null) {
if (!$roles->isEmpty()) {
foreach ($roles as $rol) {
$ro = RoleAdmin::where(['role_id' => $rol->role_id,])->first();
......
......@@ -23,7 +23,7 @@ class RoleService implements RoleServiceContract
$role->description = $description;
$result = $role->save();
if ($result){
if (count($permission) > 0){
if ($permission != null){
$role->attachPermissions($permission);
}
return $result;
......
......@@ -81,9 +81,12 @@ class SMSService implements SMSServiceContract
$feigesms =new FeigeSMS();
$surplus= $feigesms->system();
$sid = SMS::max('id');
$sms = SMS::find($sid);
if($sms == null){
return $sms;
}
if($sms->created_at->isToday()){
$date = Carbon::now();
......@@ -92,7 +95,6 @@ class SMSService implements SMSServiceContract
$addRecord = new SMS();
$addRecord->sms_surplus = $surplus->Balance;
$addRecord->save();
return $surplus;
}
......
......@@ -79,7 +79,7 @@ class ScheduleService implements ScheduleServiceContract
public function getAll()
{
$schedules = Schedule::all();
if(count($schedules) < 0){
if($schedules->isEmpty()){
return null;
}else{
return $schedules;
......
......@@ -25,8 +25,8 @@ class StatisticsService implements StatisticsServiceContract
public function UserTotal()
{
$users = User::all();
$date = ['全部用户'=>count($users)];
$users = User::count();
$date = ['全部用户'=>$users];
return $date;
}
......@@ -153,7 +153,6 @@ class StatisticsService implements StatisticsServiceContract
});
})->get();
if(!$weekTask->isEmpty()){
//dd(count($weekTask));
if(count($weekTask) >= 1){
$LastWeekActiveUser+=1;
}
......@@ -347,7 +346,7 @@ class StatisticsService implements StatisticsServiceContract
}
// 获取全部用户
$userCount = UserInfo::all()->count();
$userCount = UserInfo::count();
$invitation = ceil($a / $userCount);
$timeline = ceil($b / $userCount);
......
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('phone')->nullable()->unique();
$table->string('user_name')->unique();
$table->string('real_name')->nullable();
$table->string('token')->nullable();
$table->string('head_icon')->nullable();
$table->string('password');
$table->boolean('gender')->nullable();
$table->string('email')->nullable()->unique();
$table->unsignedInteger('status')->default(0);
$table->softDeletes();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateGroupsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('groups', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('owner_id');
$table->unsignedInteger('creator_id');
$table->string('name');
$table->string('brief')->nullable();
$table->string('logo')->nullable();
$table->unsignedInteger('status')->default(0);
$table->softDeletes();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('groups');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUserGroupsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_groups', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('user_id');
$table->unsignedInteger('group_id');
$table->boolean("is_owner")->default(0);
$table->unsignedInteger('status')->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_groups');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateProjectsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('projects', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->unsignedInteger('creator_id');
$table->longText('partners')->nullable();
$table->string('group_id')->nullable();
$table->string('brief')->nullable();
$table->string('cover_img')->nullable();
$table->integer("permission")->default(0);
// $table->json("members")->nullable();
$table->softDeletes();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('projects');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTasksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('tasks', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('owner_id');
$table->unsignedInteger('project_id');
$table->unsignedInteger('creator_id');
$table->string('brief')->nullable();
$table->dateTime('starts_at')->nullable();
$table->dateTime('ends_at')->nullable();
$table->unsignedInteger('status')->default(0);
$table->softDeletes();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('tasks');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateNotificationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('notifications', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('creator_id');
$table->string('title');
$table->text('content');
$table->unsignedInteger('target_id')->nullable();
$table->unsignedInteger('status')->default('0');
$table->tinyInteger('is_group')->default('0');
$table->longText('target_ids')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('notifications');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUserProjectsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_projects', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('project_id');
$table->unsignedInteger('creator_id');
$table->string('priority')->nullable();
$table->unsignedInteger('inviter_id')->nullable();
$table->unsignedInteger('status');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_projects');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSchedulesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('schedules', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('creator_id');
$table->unsignedInteger('owner_id');
$table->text('brief');
$table->dateTime('starts_at');
$table->dateTime("ends_at")->nullable();
$table->softDeletes();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('schedules');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateFilesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('files', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('file_type');
$table->string('size');
$table->unsignedInteger('folder_id')->nullable();
$table->unsignedInteger('group_id')->nullable();
$table->unsignedInteger('owner_id');
$table->unsignedInteger('creator_id');
$table->softDeletes();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('files');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateWechatsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('wechats', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('user_id')->unique();
$table->unsignedInteger('open_id')->unique();
$table->string('nickname')->nullable();
$table->string('head_icon')->nullable();
$table->unsignedInteger('sex')->nullable();
$table->unsignedInteger('subscribe');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('wechats');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateGetPasswordsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('get_passwords', function (Blueprint $table) {
$table->increments('id');
$table->string('phone')->nullable();
$table->string('token');
$table->string('email')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('get_passwords');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUserSettingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_settings', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('current_group_id')->nullable();
$table->unsignedInteger('user_id');
$table->unsignedInteger('stick_page_id')->nullable();
$table->boolean("is_new")->default(true);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_settings');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateFoldersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('folders', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->unsignedInteger('parent_id');
$table->unsignedInteger('creator_id');
$table->unsignedInteger('owner_id');
$table->softDeletes();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('folders');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateBoardsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('boards', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->longText('tasks')->nullable();
$table->char('color',8)->nullable();
$table->unsignedInteger('project_id');
$table->unsignedInteger('rank');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('boards');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSmsVerifiesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('sms_verifies', function (Blueprint $table) {
$table->increments('id');
$table->string('phone');
$table->string('verify_code');
$table->boolean('is_checked')->default(false);
$table->unsignedInteger("action_id")->default(0);
$table->ipAddress("ip_address")->nullable();
$table->string("finger_print")->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('sms_verifies');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateEmailChecksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('email_checks', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('user_id')->nullable();
$table->string('email')->nullable();
$table->string('token');
$table->unsignedInteger('status')->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('email_checks');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateInvitationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('invitations', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('inviter_id');
$table->unsignedInteger('target_id');
$table->unsignedInteger('type')->default('0');
$table->unsignedInteger('status')->default('0');
$table->unsignedInteger('group_id');
$table->string('token')->nullable();
$table->text('content');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('invitations');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateStatusesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('statuses', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->unsignedInteger('code');
$table->string('brief');
$table->unsignedInteger('father_id')->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('statuses');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateDefaultPagesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('default_pages', function (Blueprint $table) {
$table->increments('id');
$table->string('chinese');
$table->string('page_name');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('default_pages');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateNotificationActionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('notification_actions', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger("noti_id");
$table->string("target_table");
$table->string("target_column");
$table->unsignedInteger("target_id");
$table->string("explain");
$table->string("target_value_type");
$table->string("target_value");
$table->integer("status");
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('notification_actions');
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUserInfosTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_infos', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('user_id');
$table->string('terminal');
$table->string('manner');
$table->dateTime('last_login_time');
$table->boolean('return_visit')->default(0);
$table->longText('page_retention_time')->nullabel();
$table->longText('user_engagement')->nullabel();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_infos');
}
}
......@@ -18,5 +18,6 @@ class DatabaseSeeder extends Seeder
$this->call(RolesTableSeeder::class);
$this->call(RoleAdminsTableSeeder::class);
$this->call(PermissionRoleTableSeeder::class);
$this->call(SmsTableSeeder::class);
}
}
<?php
use Illuminate\Database\Seeder;
class SmsTableSeeder extends Seeder
{
/**
* Auto generated seed file
*
* @return void
*/
public function run()
{
\DB::table('sms')->delete();
\DB::table('sms')->insert(array (
0 =>
array (
'id' => 1,
'sms_surplus' => 2,
'created_at' => '2017-09-28 03:33:31',
'updated_at' => '2017-09-28 03:33:31',
),
1 =>
array (
'id' => 2,
'sms_surplus' => 3,
'created_at' => '2017-09-28 18:06:13',
'updated_at' => '2017-09-29 16:06:19',
),
2 =>
array (
'id' => 3,
'sms_surplus' => 3,
'created_at' => '2017-10-09 13:20:33',
'updated_at' => '2017-10-09 13:20:33',
),
3 =>
array (
'id' => 4,
'sms_surplus' => 3,
'created_at' => '2017-10-09 14:09:06',
'updated_at' => '2017-10-09 14:09:06',
),
4 =>
array (
'id' => 5,
'sms_surplus' => 3,
'created_at' => '2017-10-09 14:38:05',
'updated_at' => '2017-10-09 14:38:05',
),
5 =>
array (
'id' => 6,
'sms_surplus' => 3,
'created_at' => '2017-10-09 14:50:04',
'updated_at' => '2017-10-09 14:50:04',
),
6 =>
array (
'id' => 7,
'sms_surplus' => 3,
'created_at' => '2017-10-09 14:54:22',
'updated_at' => '2017-10-09 14:54:22',
),
7 =>
array (
'id' => 8,
'sms_surplus' => 3,
'created_at' => '2017-10-09 16:05:43',
'updated_at' => '2017-10-09 16:05:43',
),
8 =>
array (
'id' => 9,
'sms_surplus' => 3,
'created_at' => '2017-10-09 16:08:07',
'updated_at' => '2017-10-09 16:08:07',
),
9 =>
array (
'id' => 10,
'sms_surplus' => 3,
'created_at' => '2017-10-09 16:38:37',
'updated_at' => '2017-10-09 16:38:37',
),
));
}
}
\ No newline at end of file
......@@ -12,7 +12,7 @@
<div class="info-box-content">
<span class="info-box-text">短信剩余</span>
<span class="info-box-number">{{$surplus->Balance}} 条</span>
<span class="info-box-number">{{$surplus == null? 0: $surplus->Balance}} 条</span>
</div>
<!-- /.info-box-content -->
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment