c5_labsci/web/admin/datasse/imgs.php

46 lines
1.7 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace web\admin\datasse;
class imgs {
static function sse_upimg($senddata, $sendevent) {
global $db;
$rsuser = verifyfast();
if (nopower($db, $rsuser['id'], 'p610r'))
return errjson('您未被授权操作');
//多参数建议用strparam
//SSE支持data、type、id。其中type为空或fix。id可选可作为另一种数据。
$param = get('param');
$bdel = $param == 'del';
$senddata($bdel?'del: True':'需填写参数:del');
$csql = new \ciy\sql('INFORMATION_SCHEMA.SCHEMATA');
$csql->where('SCHEMA_NAME = DATABASE()');
$sehrow = $db->getone($csql);
$csql = new \ciy\sql('INFORMATION_SCHEMA.TABLES');
$csql->where('TABLE_SCHEMA', $sehrow['SCHEMA_NAME']);
$tablerows = $db->get($csql);
//$senddata('log: ' . json_encode($row));
foreach($tablerows as $tablerow){
$csql = new \ciy\sql();
$colrows = $db->getraw('show full fields from '.$tablerow['TABLE_NAME']);
//分析col是否有saasxid
foreach($colrows as $colrow){
if(strpos($colrow['Comment'],',IMG') === false)
continue;
//读取一条分析库类型是saas还是非saas的path
//如果是saas则分析saasid/orgid/还是saasxid
$senddata('log: ' . $colrow['Field'].','. $colrow['Comment']);
}
//Comment
}
// for ($i = 0; $i < 100; $i++) {
// if ($i % 10 == 1)
// $senddata('ssr: ' . $i . "\n\n" . 'ddd', $i);
// $sendevent($i);
// usleep(50000);
// }
$sendevent('ok');
}
}