Пример #1
0
 /**
  * @abstract    取得物料信息
  * @return      物料代码+物料代码
  */
 public function getmaterielAction()
 {
     $result = $this->getRequest()->getParams();
     $materiel = new Product_Model_Materiel();
     if (isset($result['q']) && $result['q']) {
         $query = $result['q'];
         $where = "code like '%{$query}%' or name like '%{$query}%' or description like '%{$query}%'";
     } else {
         $where = "1=1";
     }
     $data = $materiel->getListBySel($where, 0, 50);
     $result = array();
     for ($i = 0; $i < count($data); $i++) {
         $result[$i] = array();
         $result[$i]['code'] = $data[$i]['code'];
         $result[$i]['name'] = $data[$i]['name'];
         $result[$i]['description'] = $data[$i]['description'];
         $result[$i]['state'] = $data[$i]['state'];
         /*if(($typeId = $data[$i]['type']) != '') {
               $typeName = $this->getTypeByConnect($typeId, '');
               $result[$i]['type_name'] = $typeName;
           }*/
     }
     // 转为json格式并输出
     echo Zend_Json::encode($result);
     exit;
 }