diff --git a/module/job/control.php b/module/job/control.php index ee9791f323..0854d711a1 100644 --- a/module/job/control.php +++ b/module/job/control.php @@ -254,12 +254,30 @@ class job extends control * * @param int $repoID * @access public - * @return void + * @return string */ public function ajaxGetProductByRepo($repoID) { $repo = $this->loadModel('repo')->getRepoByID($repoID); - if($repo) return $repo->product; - die(js::error("Access Violation. 非法访问。")); + if(empty($repo)) die(json_encode(array(""=>""))); + + $product = $repo->product; + if(strpos($product, ',')) + { + $productList = explode(',', $product); + $matchedProducts = array(); + $productPair = $this->loadModel('product')->getPairs(); + foreach($productList as $productLeft) + { + foreach($productPair as $productRight => $productName) + { + if($productLeft == $productRight) $matchedProducts[$productName] = $productRight; + } + } + die(json_encode($matchedProduct)); + } + + $productName = $this->loadModel('product')->getByID($repo->product)->name; + die(json_encode(array($productName => $repo->product))); } }