李帅

1.打印paypal token

This diff is collapsed. Click to expand it.
......@@ -3,6 +3,7 @@
namespace App\Http\Controllers\V1;
use App\Http\Controllers\Controller;
use App\Jobs\UserMakeImmerse;
use App\Models\Collect;
use App\Models\Immerse;
use App\Jobs\UserMakeVideo as MakeVideo;
......@@ -52,34 +53,56 @@ class ImmerseController extends Controller
$user_id = $request->user()->id;
$immerse = Immerse::query()->find($request->item_id);
if ($validated['type'] == 1){
$create = Immerse::query()->create([
'user_id' => $user_id,
'title' => '',
'content' => $validated['content'],
'url' => '',
'type' => $validated['type'],
'duration' => 0,
'size' => 0,
'poem_id' => $immerse->poem_id,
'temp_id' => $immerse->temp_id,
'thumbnail' => $immerse->thumbnail,
'bgm' => $validated['item_url'],
'state' => 0
]);
// if ($validated['type'] == 1){
// $create = Immerse::query()->create([
// 'user_id' => $user_id,
// 'title' => '',
// 'content' => $validated['content'],
// 'url' => '',
// 'type' => $validated['type'],
// 'duration' => 0,
// 'size' => 0,
// 'poem_id' => $immerse->poem_id,
// 'temp_id' => $immerse->temp_id,
// 'thumbnail' => $immerse->thumbnail,
// 'bgm' => $validated['item_url'],
// 'state' => 0
// ]);
//
// // 添加至队列
// MakeImages::dispatch($create);
// }else{
// // 视频
// $create = Immerse::query()->create([
// 'user_id' => $user_id,
// 'title' => '',
// 'content' => $validated['content'],
// 'url' => '',
// 'type' => $validated['type'],
// 'duration' => 0,
// 'size' => 0,
// 'poem_id' => $immerse->poem_id,
// 'temp_id' => $immerse->temp_id,
// 'thumbnail' => '',
// 'bgm' => $immerse->bgm,
// 'state' => 0
// ]);
//
// // 添加至队列
// MakeVideo::dispatch($create, $validated['item_url']);
// }
// 添加至队列
MakeImages::dispatch($create);
}else{
// 视频
$create = Immerse::query()->create([
'user_id' => $user_id,
'title' => '',
'content' => $validated['content'],
'url' => '',
'type' => $validated['type'],
'upload_file' => $validated['item_url'],
'duration' => 0,
'size' => 0,
'origin_video_url' => $immerse->origin_video_url,
'origin_image_url' => $immerse->origin_image_url,
'poem_id' => $immerse->poem_id,
'temp_id' => $immerse->temp_id,
'thumbnail' => '',
......@@ -88,8 +111,7 @@ class ImmerseController extends Controller
]);
// 添加至队列
MakeVideo::dispatch($create, $validated['item_url']);
}
UserMakeImmerse::dispatch($create);
return Response::success($create);
}
......
......@@ -82,8 +82,11 @@ class MakeImages implements ShouldQueue
'content' => $this->adminMakeVideo->feel,
'url' => str_replace(Storage::disk('public')->path(''),'',$output),
'type' => $this->adminMakeVideo->type == 1 ? 2 : 1,
'upload_file' => '',
'duration' => 0,
'size' => filesize($image),
'origin_video_url' => '',
'origin_image_url' => $this->adminMakeVideo->image_url,
'poem_id' => $this->adminMakeVideo->poem_id,
'temp_id' => $this->adminMakeVideo->temp_id,
'thumbnail' => str_replace(Storage::disk('public')->path(''),'',$image),
......@@ -154,8 +157,11 @@ class MakeImages implements ShouldQueue
'content' => $this->adminMakeVideo->feel,
'url' => str_replace(Storage::disk('public')->path(''),'',$output),
'type' => $this->adminMakeVideo->type == 1 ? 2 : 1,
'upload_file' => '',
'duration' => $video_info['format']['duration'],
'size' => $video_info['format']['size'],
'origin_video_url' => '',
'origin_image_url' => $this->adminMakeVideo->image_url,
'poem_id' => $this->adminMakeVideo->poem_id,
'temp_id' => $this->adminMakeVideo->temp_id,
'thumbnail' => str_replace(Storage::disk('public')->path(''),'',$this->adminMakeVideo->images_url),
......
......@@ -116,13 +116,28 @@ class MakeVideo implements ShouldQueue
return;
}
if ($this->adminMakeVideo->thumbnail == 2){
// 截取中间帧作为视频封面
$frame = ceil($media_info['streams'][0]['nb_frames'] / 2);
$thumbnail = $this->getTempPath('.jpg',false);
$cmd = $this->ffmpeg . ' -y ' .
' -i ' . escapeshellarg($file) .
' -filter_complex "[0:v]select=\'eq(n,' . $frame . ')\'[img]" ' .
' -map [img]'.
' -frames:v 1 -s 720x1280 -preset superfast '.
escapeshellarg($thumbnail);
if (!$this->execmd($cmd)) return ;
}else{
$thumbnail = $adminMakeVideo->thumbnail_url;
}
$end_wallpaper = Storage::disk('public')->path('ffmpeg') . "/end_wallpaper.png";
$thumbnail = Storage::disk('public')->path('ffmpeg') . "/thumbnail.png";
$avatar = Storage::disk('public')->path('ffmpeg') . "/thumbnail.png";
$font = Storage::disk('public')->path('ffmpeg') . "/arialuni.ttf";
$signature = "一言 · 官方出品";
// 生成贴纸和签名
$end_wallpaper = $this->wallpaperWithSignature($end_wallpaper, $thumbnail, $signature, $font);
$end_wallpaper = $this->wallpaperWithSignature($end_wallpaper, $avatar, $signature, $font);
// 截取最后一帧
$last_frame_video = $this->getTempPath();
......@@ -176,11 +191,14 @@ class MakeVideo implements ShouldQueue
'content' => $this->adminMakeVideo->feel,
'url' => str_replace(Storage::disk('public')->path(''),'',$video),
'type' => $this->adminMakeVideo->type == 1 ? 2 : 1,
'upload_file' => '',
'duration' => $video_info['format']['duration'],
'size' => $video_info['format']['size'],
'origin_video_url' => $this->adminMakeVideo->video_url,
'origin_image_url' => '',
'poem_id' => $this->adminMakeVideo->poem_id,
'temp_id' => $this->adminMakeVideo->temp_id,
'thumbnail' => '',
'thumbnail' => $thumbnail,
'state' => 1,
'bgm' => $this->adminMakeVideo->bgm_url ?? '',
]);
......
This diff is collapsed. Click to expand it.
<?php
/**
* Created by PhpStorm.
* User: lishuai
* Date: 2022/2/15
* Time: 4:23 PM
*/
namespace App\Payment;
use App\Models\MembershipGood;
use App\Models\Order;
use App\Models\User;
use App\Models\UserProfile;
use Carbon\Carbon;
use GuzzleHttp\Client;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Redis;
class ApplePayment implements PaymentInterface
{
const IS_SANDBOX = true;
public function __construct()
{
}
public function prepare(Order $order)
{
// 查询订单对应的产品id
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: lishuai
* Date: 2022/2/15
* Time: 4:23 PM
*/
namespace App\Payment;
use App\Models\MembershipGood;
use App\Models\Order;
use App\Models\User;
use App\Models\UserProfile;
use Carbon\Carbon;
use GuzzleHttp\Client;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Redis;
class GooglePayment implements PaymentInterface
{
const IS_SANDBOX = true;
public function __construct()
{
}
public function prepare(Order $order)
{
// 查询订单对应的产品id
}
}
\ No newline at end of file
......@@ -19,8 +19,12 @@ class PaymentFactory
return new WechatPayment();
case 'paypal':
return new PaypalPayment();
case 'google':
return new GooglePayment();
case 'apple':
return new ApplePayment();
default:
throw new \Exception('未知的支付方式');
return new \Exception('未知的支付方式');
}
}
}
\ No newline at end of file
......
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterImmerse2Table extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('immerse', function (Blueprint $table) {
$table->string('upload_file')->after('type')->comment('上传资源路径');
$table->string('origin_video_url')->after('size')->comment('原始视频路径');
$table->string('origin_image_url')->after('origin_video_url')->comment('原始图片路径');
$table->string('tags')->after('comment')->default('')->comment('标签');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropColumns('immerse', ['upload_file', 'origin_video_url', 'origin_image_url', 'tags']);
}
}
......@@ -23,7 +23,7 @@ Route::prefix('v1')->namespace('App\Http\Controllers\V1')->group(function (Route
/** 社会化用户登录*/
$api->any('auth/{service}/callback', 'AuthController@apiHandleProviderCallback');
/** */
/** 增加观看次数 */
$api->get('/addview/{id}', 'ImmerseController@addview');
});
......