Merge branch 'master' of https://gitea.f2b211.com/jsasg/orico-official-website
This commit is contained in:
@@ -61,7 +61,7 @@ class Upload
|
||||
$name_rule = fn() => $filename_keep ? $this->filenameGenerator($file) : null;
|
||||
|
||||
// 处理图片
|
||||
$image_manager = ImageManager::imagick();
|
||||
$image_manager = ImageManager::gd();
|
||||
if ($filetype_to == 'original') {
|
||||
$filename = Filesystem::disk('image')->putFile($param['module'], $file, $name_rule());
|
||||
$image = $image_manager->read('.' . $storage . '/' . $filename);
|
||||
@@ -171,7 +171,6 @@ class Upload
|
||||
'filesha1' => $image_model->file_sha1
|
||||
]);
|
||||
} catch (\Throwable $th) {
|
||||
dump($th);exit;
|
||||
return error($th->getMessage());
|
||||
}
|
||||
|
||||
@@ -185,7 +184,7 @@ class Upload
|
||||
*/
|
||||
private function checkPath($path): string
|
||||
{
|
||||
$ok = false;
|
||||
$ok = true;
|
||||
$filename = basename($path);
|
||||
$dirname = dirname($path);
|
||||
if (!is_dir($dirname)) {
|
||||
|
||||
@@ -23,9 +23,9 @@ class ArticleValidate extends Validate
|
||||
'sort' => 'integer',
|
||||
'recommend' => 'require|in:0,1',
|
||||
'release_time' => 'dateFormat:Y-m-d H:i:s',
|
||||
'seo_title' => 'max:255',
|
||||
'seo_keywords' => 'max:255',
|
||||
'seo_desc' => 'max:255'
|
||||
'seo_title' => 'max:512',
|
||||
'seo_keywords' => 'max:512',
|
||||
'seo_desc' => 'max:1024'
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -48,8 +48,8 @@ class ArticleValidate extends Validate
|
||||
'recommend.require' => '推荐状态不能为空',
|
||||
'recommend.in' => '推荐状态的值必须是0或1',
|
||||
'release_time.dateFormat' => '发布时间格式不正确',
|
||||
'seo_title.max' => 'SEO标题长度不能超过255个字符',
|
||||
'seo_keywords.max' => 'SEO关键字长度不能超过255个字符',
|
||||
'seo_desc.max' => 'SEO描述长度不能超过255个字符'
|
||||
'seo_title.max' => 'SEO标题长度不能超过512个字符',
|
||||
'seo_keywords.max' => 'SEO关键字长度不能超过512个字符',
|
||||
'seo_desc.max' => 'SEO描述长度不能超过1024个字符'
|
||||
];
|
||||
}
|
||||
|
||||
@@ -60,7 +60,10 @@ class DataMigration extends Command
|
||||
// $this->migrateProductPurchaseLinks();
|
||||
|
||||
// 迁移文章
|
||||
// $this->migrateArticle([
|
||||
$this->migrateArticle([
|
||||
16 => 7,
|
||||
31 => 9,
|
||||
32 => 8,
|
||||
// 68 => 10,
|
||||
// 69 => 11,
|
||||
// 70 => 12,
|
||||
@@ -77,7 +80,7 @@ class DataMigration extends Command
|
||||
// 83 => 24,
|
||||
// 84 => 25,
|
||||
// 85 => 26
|
||||
// ]);
|
||||
]);
|
||||
|
||||
// 迁移faq
|
||||
// $this->migrateFaq();
|
||||
@@ -290,14 +293,15 @@ class DataMigration extends Command
|
||||
$old_db = Db::connect('old');
|
||||
|
||||
$success_map = [];
|
||||
$success_arr = include_once(runtime_path() . 'product_success.php');
|
||||
$success_arr = []; // include_once(runtime_path() . 'product_success.php');
|
||||
foreach ($success_arr as $so) {
|
||||
$success_map['p_' . $so['cod_product_id']] = $so;
|
||||
}
|
||||
|
||||
$arr = include_once(runtime_path() . 'product_ids.php');
|
||||
$products = $old_db->name('product')
|
||||
->where('country_code', 'in', ['ZH', 'US'])
|
||||
->where('id', '>', 15789)
|
||||
->where('id', 'in', array_unique(array_column($arr, 'cod_product_id')))
|
||||
->order(['id' => 'asc'])
|
||||
->cursor();
|
||||
|
||||
@@ -374,7 +378,16 @@ class DataMigration extends Command
|
||||
'deleted_at' => $v['stat'] == -1 ? date('Y-m-d H:i:s') : null,
|
||||
];
|
||||
// 保存产品数据
|
||||
$prod = Db::name('product')
|
||||
->where('language_id', '=', $item['language_id'])
|
||||
->where('spu', '=', $item['spu'])
|
||||
->find();
|
||||
if (!empty($prod)) {
|
||||
$id = $prod['id'];
|
||||
Db::name('product')->where('id', '=', $prod['id'])->update($item);
|
||||
} else {
|
||||
$id = Db::name('product')->insertGetId($item);
|
||||
}
|
||||
|
||||
// 保存产品参数数据
|
||||
if (!empty($v['product_view'])) {
|
||||
@@ -387,7 +400,21 @@ class DataMigration extends Command
|
||||
'value' => $p['desc_desc']
|
||||
];
|
||||
}
|
||||
$old_params = Db::name('product_params')
|
||||
->where('product_id', '=', $id)
|
||||
->select();
|
||||
if ($old_params->isEmpty()) {
|
||||
Db::name('product_params')->insertAll($prarms);
|
||||
} else {
|
||||
foreach ($old_params as $op) {
|
||||
Db::name('product_params')
|
||||
->where('product_id', '=', $id)
|
||||
->where('name', '=', $op['name'])
|
||||
->update([
|
||||
'value' => $op['value']
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 保存sku数据
|
||||
@@ -444,7 +471,7 @@ class DataMigration extends Command
|
||||
if ($k != 'sort') {
|
||||
$attr_value = $at;
|
||||
if (in_array($k, ['颜色', 'Color'])) {
|
||||
if ($k == 'Color') $k = '颜色';
|
||||
// if ($k == 'Color') $k = '颜色';
|
||||
$attr_value = '/static/common/images/colors/' . $at . '.png';
|
||||
}
|
||||
$images[$pkey]['color'] = $at;
|
||||
@@ -468,7 +495,7 @@ class DataMigration extends Command
|
||||
}
|
||||
}
|
||||
$attr_arr = [
|
||||
'attr_id' => $attrs_map[$v['country_code']]['颜色'],
|
||||
'attr_id' => $attrs_map[$v['country_code']][$v['country_code'] == 'ZH' ? '颜色' : 'Color'],
|
||||
'attr_value' => $attr_value,
|
||||
];
|
||||
if (
|
||||
@@ -514,7 +541,7 @@ class DataMigration extends Command
|
||||
$skus[] = [
|
||||
'main_image' => $ti['image_url'],
|
||||
'attrs' => [[
|
||||
'attr_id' => $attrs_map[$v['country_code']]['颜色'],
|
||||
'attr_id' => $attrs_map[$v['country_code']][$v['country_code'] == 'ZH' ? '颜色' : 'Color'],
|
||||
'attr_value' => $ti['image_color'],
|
||||
]],
|
||||
'pkey' => $tpkey
|
||||
@@ -575,6 +602,7 @@ class DataMigration extends Command
|
||||
}
|
||||
|
||||
foreach ($skus as $sku) {
|
||||
Db::name('product_sku')->where('product_id', '=', $sku['product_id'])->delete();
|
||||
$sku_id = Db::name('product_sku')->insertGetId([
|
||||
'product_id' => $sku['product_id'],
|
||||
'sku' => $sku['sku']??'',
|
||||
@@ -584,6 +612,7 @@ class DataMigration extends Command
|
||||
if (!empty($sku['attrs'])) {
|
||||
foreach ($sku['attrs'] as $attr) {
|
||||
if (!empty($sku_id)) {
|
||||
Db::name('product_sku_attr')->where('sku_id', '=', $sku_id)->delete();
|
||||
Db::name('product_sku_attr')->insert([
|
||||
'sku_id' => $sku_id,
|
||||
'attr_id' => $attr['attr_id'],
|
||||
@@ -601,7 +630,7 @@ class DataMigration extends Command
|
||||
sprintf('["ow_product_id" => %d, "cod_product_id" => %d]'.PHP_EOL, $id, $v['id']),
|
||||
FILE_APPEND
|
||||
);
|
||||
$this->println(sprintf('迁移产品ID:%s => %s 【耗时:%s】', $v['id'], 0, round(microtime(true) - $start, 2) . 's'));
|
||||
$this->println(sprintf('迁移产品ID:%s => %s 【耗时:%s】', $v['id'], $id, round(microtime(true) - $start, 2) . 's'));
|
||||
} catch (\Throwable $th) {
|
||||
Db::rollback();
|
||||
file_put_contents(
|
||||
@@ -694,9 +723,12 @@ class DataMigration extends Command
|
||||
throw new \Exception('请确认分类ID');
|
||||
}
|
||||
|
||||
// 1634
|
||||
$article = Db::connect('old')
|
||||
->name('article')
|
||||
->where('country_code', 'in', ['ZH', 'US'])
|
||||
->where('cid', 'in', array_keys($category_map))
|
||||
->where('id', '=', 351)
|
||||
->order(['id' => 'asc'])
|
||||
->cursor();
|
||||
|
||||
@@ -745,7 +777,16 @@ class DataMigration extends Command
|
||||
'release_time' => date('Y-m-d H:i:s', $v['createtime']),
|
||||
'deleted_at' => $v['stat'] == -1 ? date('Y-m-d H:i:s') : null
|
||||
];
|
||||
$ret = Db::name('article')
|
||||
->where('language_id', '=', $item['language_id'])
|
||||
->where('title', '=', $item['title'])
|
||||
->find();
|
||||
if (empty($ret)) {
|
||||
$id = Db::name('article')->insertGetId($item);
|
||||
} else {
|
||||
$id = $ret['id'];
|
||||
Db::name('article')->where('id', '=', $ret['id'])->update($item);
|
||||
}
|
||||
|
||||
$this->println(sprintf('迁移文章ID:%s => %s', $v['id'], $id));
|
||||
}
|
||||
@@ -779,7 +820,15 @@ class DataMigration extends Command
|
||||
'recommend' => $val['is_home'],
|
||||
'sort' => $val['sort'] == 9999 ? 0 : $val['sort']
|
||||
];
|
||||
$ret = Db::name('faq')
|
||||
->where('language_id', '=', $item['language_id'])
|
||||
->where('question', '=', $item['question'])
|
||||
->find();
|
||||
if (empty($ret)) {
|
||||
Db::name('faq')->insert($item);
|
||||
} else {
|
||||
Db::name('faq')->where('id', '=', $ret['id'])->update($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -929,7 +978,7 @@ class DataMigration extends Command
|
||||
|
||||
class UploadMannager
|
||||
{
|
||||
const UPLOAD_BASE_API = 'http://dev.ow.f2b211.com';
|
||||
const UPLOAD_BASE_API = 'http://ow.f2b211.com';
|
||||
const DOWNLOAD_BASE_API = 'http://www.orico.com.cn';
|
||||
const DOWNLOAD_TEMP_PATH = '/var/www/html/orico-official-website/public/migrate_temp_images';
|
||||
private $username = 'admin';
|
||||
@@ -942,7 +991,7 @@ class UploadMannager
|
||||
{
|
||||
// 登录获取token
|
||||
$this->token = $this->getAuthorization();
|
||||
$this->maps = include_once(runtime_path() . 'fiber_product_image_mapping.php');
|
||||
$this->maps = []; // include_once(runtime_path() . 'fiber_product_image_mapping.php');
|
||||
}
|
||||
|
||||
// 下载图片
|
||||
@@ -1062,6 +1111,7 @@ class UploadMannager
|
||||
print($http_code . PHP_EOL);
|
||||
}
|
||||
|
||||
file_put_contents(runtime_path() . 'upload.txt', $response . PHP_EOL, FILE_APPEND);
|
||||
$ret = json_decode($response, true);
|
||||
if (empty($ret)) {
|
||||
throw new \Exception($response);
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
{if condition="!empty($vo.children)"}
|
||||
<ul>
|
||||
{volist name="vo.children" id="vc"}
|
||||
<li><a href="{$vc.link}" class="fline">{$vc.name}</a></li>
|
||||
<li><a href="{$vc.link}" class="fline" target="{$vc.blank==1?'_blank':'_self'}">{$vc.name}</a></li>
|
||||
{/volist}
|
||||
</ul>
|
||||
{/if}
|
||||
@@ -82,7 +82,7 @@
|
||||
<div class="ftcopyright">
|
||||
<span>{$basic_config.website_powerby.value}</span>
|
||||
{if condition="!empty($basic_config.website_icp)"}
|
||||
<a href="https://beian.miit.gov.cn/">({$basic_config.website_icp.value})</a>
|
||||
<a href="https://beian.miit.gov.cn/">{$basic_config.website_icp.value|raw}</a>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user