弹幕不分页

This commit is contained in:
2025-12-17 14:30:10 +08:00
parent eaf3249376
commit 4f1486056f
4 changed files with 29 additions and 3 deletions
@@ -17,6 +17,28 @@ class BarrageController extends BaseController
$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());
}
}
/**
* 获取列表
*
+1
View File
@@ -42,6 +42,7 @@ class BarrageService
$config['model'] = $this->modelClass;
switch ($scene) {
case 'default':
$config['order']['is_blocked'] = '0';
$config['order']['sort'] = 'desc';
$config['order']['id'] = 'desc';
break;
+4 -2
View File
@@ -86,8 +86,10 @@ class SkuAttributeService
public function beforeServiceUpdate($data, Request $request)
{
$options = [];
foreach ($data['options_json'] as $v){
$options[] = $v['value'];
if (!empty($data['options_json'])) {
foreach ($data['options_json'] as $v){
$options[] = $v['value'];
}
}
$data['options_json'] = json_encode($options, JSON_UNESCAPED_UNICODE);
return $data;