This commit is contained in:
2025-12-13 10:48:51 +08:00
parent 9a215866fa
commit 22a4c9fb8f
4 changed files with 41 additions and 2 deletions
+6 -1
View File
@@ -3,6 +3,7 @@ namespace app\admin\controller;
use app\common\controller\BaseController;
use app\common\model\PostCategory;
use app\common\model\SkuAttribute;
use app\common\service\OssService;
use app\common\traits\crud\CrudControllerTrait;
use app\common\service\SkuService;
@@ -48,8 +49,12 @@ class SkuController extends BaseController
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
if (isset($data['updated_at']))
$data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
if (isset($data['spec_json']))
if (isset($data['spec_json'])){
$data['spec'] = json_decode($data['spec_json'], true);
foreach ($data['spec'] as $k=>$v){
$data['spec'][$k]['attr_type'] = SkuAttribute::where('id', $v['attr_id'])->value('attr_type');
}
}
if (isset($data['category_id']))
$data['category_name'] = PostCategory::where('id', $data['category_id'])->value('name');
$ossservice = new OssService();