Ejemplo n.º 1
0
 /**
  * @param int $supplierId 供应商id
  * @return array 渠道包管理列表
  */
 public function getChannelListBySupplierId($supplierId, $page = 1, $page_size = 10)
 {
     if (!empty($supplierId) && is_numeric($supplierId)) {
         $where = array("supplier_id" => $supplierId);
     }
     $offest = ($page - 1) * $page_size;
     $channeList = $this->supplier_channel_channels->find($where, array(), $page_size, $offest);
     if (!empty($channeList)) {
         $supplierIds = array();
         foreach ($channeList as $channeRow) {
             $supplierIds[] = $channeRow['supplier_id'];
         }
         $supplierListRs = $this->supplier_channel_account->findById($supplierIds);
         $supplierList = array();
         foreach ($supplierListRs as $supplierRow) {
             $supplierList[$supplierRow['id']] = $supplierRow;
         }
         foreach ($channeList as &$channeRow) {
             $supplier_id = $channeRow['supplier_id'];
             $channeRow['supplier'] = $supplierList[$supplier_id]['supplier'];
             $channeRow['price'] /= 100;
             // 数据库存储单位为分
         }
     }
     return $channeList;
 }