李帅

init

<?php
namespace App\Admin\Repositories;
use App\Models\Immerse as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class Immersive extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}
<?php
namespace App\Http\Controllers\V1;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Jiannei\Response\Laravel\Support\Facades\Response;
class HomeController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\JsonResponse
*/
public function index()
{
//
return Response::success();
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}
<?php
namespace App\Http\Controllers\V1;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class ImmerseController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//todo 发布流程
// if type == 1
// 写入audio-show表,写入immerse表,发送异步转码任务,
// if type == 2
// 写入video-show表,写入immerse表,发送异步转码合成视频水印任务
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class Immerse extends Model
{
use HasDateTimeFormatter;
protected $table = 'immerse';
public function send($user_id, $type, $audio = '', $video = '')
{
}
}
......@@ -15,6 +15,7 @@ class CreateAudioShowTable extends Migration
{
Schema::create('audio_show', function (Blueprint $table) {
$table->increments('id');
$table->unsignedBigInteger('user_id')->index()->comment('用户id');
$table->string('image_url')->default('')->comment('图片地址');
$table->string('image_size')->default('')->comment('图片大小');
$table->string('audio_url')->default('')->comment('音频地址');
......
......@@ -15,6 +15,7 @@ class CreateVideoShowTable extends Migration
{
Schema::create('video_show', function (Blueprint $table) {
$table->increments('id');
$table->unsignedBigInteger('user_id')->index()->comment('用户id');
$table->string('video_url')->default('')->comment('视频地址');
$table->string('video_size')->default('')->comment('视频大小');
$table->string('video_time')->default('')->comment('视频时长');
......
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateImmerseTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('immerse', function (Blueprint $table) {
$table->increments('id');
$table->unsignedBigInteger('user_id')->index()->comment('用户id');
$table->string('title')->default('')->comment('标题');
$table->text('content')->default('-')->comment('内容');
$table->unsignedTinyInteger('type')->comment('图文=1,视频=2');
$table->unsignedBigInteger('display_id')->comment('图文或视频id');
$table->integer('praise')->comment('点赞量');
$table->integer('view')->comment('播放量');
$table->integer('collect')->comment('收藏量');
$table->integer('share')->comment('分享量');
$table->integer('comment')->comment('评论数');
$table->unsignedTinyInteger('is_self')->index()->default('1')->comment('自制=1,搬运=2');
$table->unsignedTinyInteger('is_publish')->index()->default('1')->comment('草稿=0,发布=1');
$table->unsignedTinyInteger('is_check')->index()->default('0')->comment('审核通过=1,未通过=0');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('immerse');
}
}
<?php
return [
'labels' => [
'Immersive' => 'Immersive',
'immersive' => 'Immersive',
],
'fields' => [
'user_id' => '用户id',
'title' => '标题',
'content' => '内容',
'type' => '类型',
'display_id' => '图文或视频id',
'praise' => '点赞量',
'view' => '播放量',
'collect' => '收藏量',
'share' => '分享量',
'comment' => '评论数',
'is_self' => '是否自制',
'is_publish' => '是否草稿',
'is_check' => '审核状态',
],
'options' => [
],
];
<?php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Illuminate\Routing\Router;
/*
|--------------------------------------------------------------------------
......@@ -16,6 +16,13 @@ use Illuminate\Support\Facades\Route;
//Route::prefix('v1')->middleware('auth:sanctum')->group(function ($api){
Route::prefix('v1')->group(function ($api){
Route::prefix('v1')->namespace('App\Http\Controllers\V1')->group(function (Router $api) {
/**首页*/
$api->apiResource('/home', 'HomeController');
/** 临境 */
$api->apiResource('/immersive', 'ImmerseController');
});
\ No newline at end of file
......