master
ljl 10 months ago
parent 5a9cb91328
commit 1efe3cc588

@ -8,6 +8,7 @@ use Dao\Goods\GoodsDao;
use Dao\Goods\OpGoodsShortDao;
use Dao\Goods\OpSkuShortDao;
use Dao\Mall\MallAppSDao;
use Dao\Mall\MallSDao;
use Dao\Order\OpOrderGoodsDao;
use DbTool;
use ExcelTool;
@ -24,6 +25,7 @@ use ZcNumberHelper;
class GoodsShortService extends AbstractService {
private $goodsDao;
private $mallSDao;
private $opGoodsShortDao;
private $opSkuShortDao;
private $opOrderGoodsDao;
@ -34,6 +36,7 @@ class GoodsShortService extends AbstractService {
protected function __construct() {
$this->mallAppSDao = MallAppSDao::instance();
$this->mallSDao = MallSDao::instance();
$this->goodsDao = GoodsDao::instance();
$this->opGoodsShortDao = OpGoodsShortDao::instance();
$this->opSkuShortDao = OpSkuShortDao::instance();
@ -53,7 +56,11 @@ class GoodsShortService extends AbstractService {
$goodsShorts = $this->opGoodsShortDao->getListByGoodsIds($goodsIds);
$goodsShorts = ZcArrayHelper::changeKey($rows, 'goodsId');
$mallIds = array_column($goodsList, 'mallId');
$mallIdAndMallNameMap = $this->mallSDao->getMallIdAndMallNameMap($mallIds);
foreach ($goodsList as $goodsId => &$goods) {
$goods['mallName'] = $mallIdAndMallNameMap[$goods['mallId']];
$goods['shortTitle'] = $goodsShorts[$goodsId]['shortTitle'];
$weight = $goodsShorts[$goodsId]['weight'];
$goods['shortWeight'] = $weight > 0 ? $weight : null;

Loading…
Cancel
Save