李帅

init

1 +<?php
2 +
3 +namespace App\Admin\Repositories;
4 +
5 +use App\Models\Immerse as Model;
6 +use Dcat\Admin\Repositories\EloquentRepository;
7 +
8 +class Immersive extends EloquentRepository
9 +{
10 + /**
11 + * Model.
12 + *
13 + * @var string
14 + */
15 + protected $eloquentClass = Model::class;
16 +}
1 +<?php
2 +
3 +namespace App\Http\Controllers\V1;
4 +
5 +use App\Http\Controllers\Controller;
6 +use Illuminate\Http\Request;
7 +use Jiannei\Response\Laravel\Support\Facades\Response;
8 +
9 +class HomeController extends Controller
10 +{
11 + /**
12 + * Display a listing of the resource.
13 + *
14 + * @return \Illuminate\Http\JsonResponse
15 + */
16 + public function index()
17 + {
18 + //
19 + return Response::success();
20 + }
21 +
22 + /**
23 + * Show the form for creating a new resource.
24 + *
25 + * @return \Illuminate\Http\Response
26 + */
27 + public function create()
28 + {
29 + //
30 + }
31 +
32 + /**
33 + * Store a newly created resource in storage.
34 + *
35 + * @param \Illuminate\Http\Request $request
36 + * @return \Illuminate\Http\Response
37 + */
38 + public function store(Request $request)
39 + {
40 + //
41 + }
42 +
43 + /**
44 + * Display the specified resource.
45 + *
46 + * @param int $id
47 + * @return \Illuminate\Http\Response
48 + */
49 + public function show($id)
50 + {
51 + //
52 + }
53 +
54 + /**
55 + * Show the form for editing the specified resource.
56 + *
57 + * @param int $id
58 + * @return \Illuminate\Http\Response
59 + */
60 + public function edit($id)
61 + {
62 + //
63 + }
64 +
65 + /**
66 + * Update the specified resource in storage.
67 + *
68 + * @param \Illuminate\Http\Request $request
69 + * @param int $id
70 + * @return \Illuminate\Http\Response
71 + */
72 + public function update(Request $request, $id)
73 + {
74 + //
75 + }
76 +
77 + /**
78 + * Remove the specified resource from storage.
79 + *
80 + * @param int $id
81 + * @return \Illuminate\Http\Response
82 + */
83 + public function destroy($id)
84 + {
85 + //
86 + }
87 +}
1 +<?php
2 +
3 +namespace App\Http\Controllers\V1;
4 +
5 +use App\Http\Controllers\Controller;
6 +use Illuminate\Http\Request;
7 +
8 +class ImmerseController extends Controller
9 +{
10 + /**
11 + * Display a listing of the resource.
12 + *
13 + * @return \Illuminate\Http\Response
14 + */
15 + public function index()
16 + {
17 + //
18 + }
19 +
20 + /**
21 + * Store a newly created resource in storage.
22 + *
23 + * @param \Illuminate\Http\Request $request
24 + * @return \Illuminate\Http\Response
25 + */
26 + public function store(Request $request)
27 + {
28 + //todo 发布流程
29 + // if type == 1
30 + // 写入audio-show表,写入immerse表,发送异步转码任务,
31 + // if type == 2
32 + // 写入video-show表,写入immerse表,发送异步转码合成视频水印任务
33 +
34 + }
35 +
36 + /**
37 + * Display the specified resource.
38 + *
39 + * @param int $id
40 + * @return \Illuminate\Http\Response
41 + */
42 + public function show($id)
43 + {
44 + //
45 + }
46 +
47 + /**
48 + * Update the specified resource in storage.
49 + *
50 + * @param \Illuminate\Http\Request $request
51 + * @param int $id
52 + * @return \Illuminate\Http\Response
53 + */
54 + public function update(Request $request, $id)
55 + {
56 + //
57 + }
58 +
59 + /**
60 + * Remove the specified resource from storage.
61 + *
62 + * @param int $id
63 + * @return \Illuminate\Http\Response
64 + */
65 + public function destroy($id)
66 + {
67 + //
68 + }
69 +}
1 +<?php
2 +
3 +namespace App\Models;
4 +
5 +use Dcat\Admin\Traits\HasDateTimeFormatter;
6 +
7 +use Illuminate\Database\Eloquent\Model;
8 +
9 +class Immerse extends Model
10 +{
11 + use HasDateTimeFormatter;
12 + protected $table = 'immerse';
13 +
14 +
15 + public function send($user_id, $type, $audio = '', $video = '')
16 + {
17 +
18 + }
19 +}
...@@ -15,6 +15,7 @@ class CreateAudioShowTable extends Migration ...@@ -15,6 +15,7 @@ class CreateAudioShowTable extends Migration
15 { 15 {
16 Schema::create('audio_show', function (Blueprint $table) { 16 Schema::create('audio_show', function (Blueprint $table) {
17 $table->increments('id'); 17 $table->increments('id');
18 + $table->unsignedBigInteger('user_id')->index()->comment('用户id');
18 $table->string('image_url')->default('')->comment('图片地址'); 19 $table->string('image_url')->default('')->comment('图片地址');
19 $table->string('image_size')->default('')->comment('图片大小'); 20 $table->string('image_size')->default('')->comment('图片大小');
20 $table->string('audio_url')->default('')->comment('音频地址'); 21 $table->string('audio_url')->default('')->comment('音频地址');
......
...@@ -15,6 +15,7 @@ class CreateVideoShowTable extends Migration ...@@ -15,6 +15,7 @@ class CreateVideoShowTable extends Migration
15 { 15 {
16 Schema::create('video_show', function (Blueprint $table) { 16 Schema::create('video_show', function (Blueprint $table) {
17 $table->increments('id'); 17 $table->increments('id');
18 + $table->unsignedBigInteger('user_id')->index()->comment('用户id');
18 $table->string('video_url')->default('')->comment('视频地址'); 19 $table->string('video_url')->default('')->comment('视频地址');
19 $table->string('video_size')->default('')->comment('视频大小'); 20 $table->string('video_size')->default('')->comment('视频大小');
20 $table->string('video_time')->default('')->comment('视频时长'); 21 $table->string('video_time')->default('')->comment('视频时长');
......
1 +<?php
2 +
3 +use Illuminate\Support\Facades\Schema;
4 +use Illuminate\Database\Schema\Blueprint;
5 +use Illuminate\Database\Migrations\Migration;
6 +
7 +class CreateImmerseTable extends Migration
8 +{
9 + /**
10 + * Run the migrations.
11 + *
12 + * @return void
13 + */
14 + public function up()
15 + {
16 + Schema::create('immerse', function (Blueprint $table) {
17 + $table->increments('id');
18 + $table->unsignedBigInteger('user_id')->index()->comment('用户id');
19 + $table->string('title')->default('')->comment('标题');
20 + $table->text('content')->default('-')->comment('内容');
21 + $table->unsignedTinyInteger('type')->comment('图文=1,视频=2');
22 + $table->unsignedBigInteger('display_id')->comment('图文或视频id');
23 + $table->integer('praise')->comment('点赞量');
24 + $table->integer('view')->comment('播放量');
25 + $table->integer('collect')->comment('收藏量');
26 + $table->integer('share')->comment('分享量');
27 + $table->integer('comment')->comment('评论数');
28 + $table->unsignedTinyInteger('is_self')->index()->default('1')->comment('自制=1,搬运=2');
29 + $table->unsignedTinyInteger('is_publish')->index()->default('1')->comment('草稿=0,发布=1');
30 + $table->unsignedTinyInteger('is_check')->index()->default('0')->comment('审核通过=1,未通过=0');
31 + $table->timestamps();
32 + });
33 + }
34 +
35 + /**
36 + * Reverse the migrations.
37 + *
38 + * @return void
39 + */
40 + public function down()
41 + {
42 + Schema::dropIfExists('immerse');
43 + }
44 +}
1 +<?php
2 +return [
3 + 'labels' => [
4 + 'Immersive' => 'Immersive',
5 + 'immersive' => 'Immersive',
6 + ],
7 + 'fields' => [
8 + 'user_id' => '用户id',
9 + 'title' => '标题',
10 + 'content' => '内容',
11 + 'type' => '类型',
12 + 'display_id' => '图文或视频id',
13 + 'praise' => '点赞量',
14 + 'view' => '播放量',
15 + 'collect' => '收藏量',
16 + 'share' => '分享量',
17 + 'comment' => '评论数',
18 + 'is_self' => '是否自制',
19 + 'is_publish' => '是否草稿',
20 + 'is_check' => '审核状态',
21 + ],
22 + 'options' => [
23 + ],
24 +];
1 <?php 1 <?php
2 2
3 -use Illuminate\Http\Request;
4 use Illuminate\Support\Facades\Route; 3 use Illuminate\Support\Facades\Route;
4 +use Illuminate\Routing\Router;
5 5
6 /* 6 /*
7 |-------------------------------------------------------------------------- 7 |--------------------------------------------------------------------------
...@@ -16,6 +16,13 @@ use Illuminate\Support\Facades\Route; ...@@ -16,6 +16,13 @@ use Illuminate\Support\Facades\Route;
16 16
17 //Route::prefix('v1')->middleware('auth:sanctum')->group(function ($api){ 17 //Route::prefix('v1')->middleware('auth:sanctum')->group(function ($api){
18 18
19 -Route::prefix('v1')->group(function ($api){ 19 +Route::prefix('v1')->namespace('App\Http\Controllers\V1')->group(function (Router $api) {
20 +
21 + /**首页*/
22 + $api->apiResource('/home', 'HomeController');
23 +
24 + /** 临境 */
25 + $api->apiResource('/immersive', 'ImmerseController');
26 +
20 27
21 }); 28 });
...\ No newline at end of file ...\ No newline at end of file
......