弹幕不分页
This commit is contained in:
@@ -17,6 +17,28 @@ class BarrageController extends BaseController
|
|||||||
$this->service = new BarrageService();
|
$this->service = new BarrageService();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取列表
|
||||||
|
*
|
||||||
|
* @param Request $request 请求对象
|
||||||
|
* @return mixed 返回分页数据及总数
|
||||||
|
*/
|
||||||
|
public function preset(Request $request)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$raw = $this->service->serviceListAll($request);
|
||||||
|
$data = [];
|
||||||
|
foreach ($raw as $item) {
|
||||||
|
unset($item['created_at']);
|
||||||
|
unset($item['updated_at']);
|
||||||
|
$data[] = $this->indexFormat($item);
|
||||||
|
}
|
||||||
|
return $this->success($data);
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
return $this->error($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取列表
|
* 获取列表
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ class BarrageService
|
|||||||
$config['model'] = $this->modelClass;
|
$config['model'] = $this->modelClass;
|
||||||
switch ($scene) {
|
switch ($scene) {
|
||||||
case 'default':
|
case 'default':
|
||||||
|
$config['order']['is_blocked'] = '0';
|
||||||
$config['order']['sort'] = 'desc';
|
$config['order']['sort'] = 'desc';
|
||||||
$config['order']['id'] = 'desc';
|
$config['order']['id'] = 'desc';
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -86,8 +86,10 @@ class SkuAttributeService
|
|||||||
public function beforeServiceUpdate($data, Request $request)
|
public function beforeServiceUpdate($data, Request $request)
|
||||||
{
|
{
|
||||||
$options = [];
|
$options = [];
|
||||||
foreach ($data['options_json'] as $v){
|
if (!empty($data['options_json'])) {
|
||||||
$options[] = $v['value'];
|
foreach ($data['options_json'] as $v){
|
||||||
|
$options[] = $v['value'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$data['options_json'] = json_encode($options, JSON_UNESCAPED_UNICODE);
|
$data['options_json'] = json_encode($options, JSON_UNESCAPED_UNICODE);
|
||||||
return $data;
|
return $data;
|
||||||
|
|||||||
+2
-1
@@ -104,12 +104,13 @@ Route::group('/common', function () {
|
|||||||
// sku
|
// sku
|
||||||
Route::group('/sku', function () {
|
Route::group('/sku', function () {
|
||||||
Route::any('/list', [app\common\controller\SkuController::class, 'index']);
|
Route::any('/list', [app\common\controller\SkuController::class, 'index']);
|
||||||
Route::any('/preset', [app\common\controller\SkuController::class, 'preset']);
|
Route::any('/all', [app\common\controller\SkuController::class, 'preset']);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 弹幕
|
// 弹幕
|
||||||
Route::group('/barrage', function () {
|
Route::group('/barrage', function () {
|
||||||
Route::any('/list', [app\common\controller\BarrageController::class, 'index']);
|
Route::any('/list', [app\common\controller\BarrageController::class, 'index']);
|
||||||
|
Route::any('/all', [app\common\controller\BarrageController::class, 'preset']);
|
||||||
Route::any('/store', [app\common\controller\BarrageController::class, 'store']);
|
Route::any('/store', [app\common\controller\BarrageController::class, 'store']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user