diff --git a/app/api/controller/Square.php b/app/api/controller/Square.php index d77b6661..3de50a25 100644 --- a/app/api/controller/Square.php +++ b/app/api/controller/Square.php @@ -20,6 +20,7 @@ use app\api\model\Square as squareModel; use app\api\model\Squarelike as squarelikeModel; use app\common\model\UploadFile; use app\common\model\Channel; +use app\api\model\Goods as GoodsModel; /** * 广场动态 @@ -77,6 +78,7 @@ class Square extends Controller $like = $modelLike->where(['user_name' => $useInfo['user_id'],'square_id' => $r['square_id']])->find(); $res[$kr]['imgs'] = []; + $res[$kr]['goodsInfo'] = []; $list['data'][$kr]['isLike'] = !empty($like) ? true : false; $res[$kr]['avatar_url'] = []; if ($r['imgs']) { @@ -88,6 +90,11 @@ class Square extends Controller $files = UploadFile::getFileList([$user['avatar_id']]); $list['data'][$kr]['avatar_url'] = $files ?: null; } + if ($r['goods_id']) { + $modelgoods = new GoodsModel; + $goods = $modelgoods->getDetails2($r['goods_id'])->toArray(); + $res[$kr]['goodsInfo'] = $goods; + } } return $this->renderSuccess($list); } diff --git a/public/install/data/install_struct.sql b/public/install/data/install_struct.sql index b403bf28..cb0cf1c3 100644 --- a/public/install/data/install_struct.sql +++ b/public/install/data/install_struct.sql @@ -1745,6 +1745,7 @@ CREATE TABLE `yoshop_style` ( DROP TABLE IF EXISTS `yoshop_square`; CREATE TABLE `yoshop_square` ( `square_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '动态ID', + `goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品ID', `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID', `merchant_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商户ID、商店ID 隔离商城里面的商户', `imgs` varchar(200) NOT NULL DEFAULT '' COMMENT '图片ID',