49 lines
1.2 KiB
PHP
49 lines
1.2 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace Hura8\Components\Deal\Controller;
|
||
|
|
|
||
|
|
use Hura8\Components\Deal\Model\DealModel;
|
||
|
|
use Hura8\Components\Product\AdminController\AProductController;
|
||
|
|
use Hura8\System\Controller\aEntityBaseController;
|
||
|
|
|
||
|
|
class bDealController extends aEntityBaseController
|
||
|
|
{
|
||
|
|
|
||
|
|
protected $objDealModel;
|
||
|
|
|
||
|
|
|
||
|
|
public function __construct() {
|
||
|
|
$this->objDealModel = new DealModel();
|
||
|
|
parent::__construct($this->objDealModel);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
public function getList(array $condition) : array
|
||
|
|
{
|
||
|
|
$deal_list = parent::getList($condition);
|
||
|
|
|
||
|
|
$product_list_info = [];
|
||
|
|
$product_list_ids = [];
|
||
|
|
$final_list = [];
|
||
|
|
foreach ($deal_list as $item) {
|
||
|
|
if(!isset($product_list_info[$item['pro_id']])) {
|
||
|
|
$product_list_info[$item['pro_id']]= null;
|
||
|
|
$product_list_ids[] = $item['pro_id'];
|
||
|
|
}
|
||
|
|
|
||
|
|
$copy = $item;
|
||
|
|
$copy['product_info'] = &$product_list_info[$item['pro_id']];
|
||
|
|
$final_list[] = $copy;
|
||
|
|
}
|
||
|
|
|
||
|
|
$objAProductController = new AProductController();
|
||
|
|
foreach ($objAProductController->getListByIds($product_list_ids) as $pro_id => $info) {
|
||
|
|
$product_list_info[$pro_id] = $info;
|
||
|
|
}
|
||
|
|
|
||
|
|
return $final_list;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|