修正在线目录SQL数字序列化,覆盖真实原生网格加载

这个提交包含在:
mac 于 2026-11-11 19:55:13 +08:00 提交
1 父节点 8ef576b73d
当前提交 188553a613
6 个文件已更改
+24 -7

没有与搜索条件相匹配的文件

+2 -1
查看文件
@@ -27,7 +27,7 @@ class DB {
public $prefix='test_';
function prepare($sql,...$args){if(count($args)===1&&is_array($args[0]))$args=$args[0];return array($sql,$args);}
function get_var($q){global $bound;$sql=is_array($q)?$q[0]:$q;if(strpos($sql,'app_login_records')!==false)return $bound;if(strpos($sql,'COUNT(')!==false)return 1;return null;}
function get_results($q,$mode=null){global $rows;return array_map(function($r){return (array)$r;},array_values(array_filter($rows,function($r){return $r->status==='published';})));}
function get_results($q,$mode=null){global $rows;return array_map(function($r){$row=(array)$r;$row['id']=(string)$row['id'];$row['file_size']=(string)$row['file_size'];return $row;},array_values(array_filter($rows,function($r){return $r->status==='published';})));}
function get_col($q){return array('测试分类');} function esc_like($s){return addcslashes($s,'_%\\');}
function get_row($q){global $rows;$id=$q[1][0];$row=$rows[$id]??null;return $row&&$row->status==='published'&&$row->material_type==='lut'?$row:null;}
}
@@ -76,6 +76,7 @@ $path=$root.'/materials/test.cube';file_put_contents($path,$cube);
$rows[1]=(object)array('id'=>1,'title'=>'测试 LUT','category'=>'测试分类','file_size'=>strlen($cube),'checksum'=>hash('sha256',$cube),'material_type'=>'lut','status'=>'published','relative_path'=>'test.cube');
$rows[2]=clone $rows[1];$rows[2]->id=2;$rows[2]->status='draft';
check(count(body(Dayu_Color_Online_LUTs::catalog(new Request(array(),$token)))['items'])===1,'catalogue excludes private drafts');
$serialized=body(Dayu_Color_Online_LUTs::catalog(new Request(array(),$token)))['items'][0];check(is_int($serialized['id'])&&is_int($serialized['file_size']),'SQL string identifiers and sizes serialize as JSON numbers for the native client');
check(body(Dayu_Color_Online_LUTs::download(new Request(array('id'=>1),$token))) instanceof Dayu_Color_LUT_Binary,'authorized published LUT streams original bytes');
check(denied(Dayu_Color_Online_LUTs::download(new Request(array('id'=>2),$token)),404),'private LUT cannot be downloaded by guessed ID');
$rows[1]->relative_path='../outside.cube';file_put_contents($root.'/outside.cube',$cube);