浏览代码

计量支付附件

调整附件一对一关联为多对一
NoNZero 9 年之前
父节点
当前提交
4b2ed2715b

+ 1 - 1
index.php

@@ -1,5 +1,5 @@
 <?php
 <?php
-
+ini_set('display_errors', 1);
 include './protected/config/common.conf.php';
 include './protected/config/common.conf.php';
 include './protected/config/routes.conf.php';
 include './protected/config/routes.conf.php';
 include './protected/config/db.conf.php';
 include './protected/config/db.conf.php';

+ 22 - 22
protected/class/itemfile.php

@@ -2,37 +2,37 @@
 
 
 Doo::loadModel('itematt');
 Doo::loadModel('itematt');
 
 
-class ItemFile {
+class ItemFile
+{
 
 
     private $__itemfile;
     private $__itemfile;
 
 
-    function __construct() {
-	$this->__itemfile = new ItemAtt();
+    function __construct()
+    {
+        $this->__itemfile = new ItemAtt();
     }
     }
 
 
-    public function insertItemFileRecord($postArray) {
-	$this->__itemfile->mpid = $postArray['mpid'];
-	$this->__itemfile->ownerid = $postArray['ownerid'];
-	$this->__itemfile->itemid = $postArray['itemid'];
-	$this->__itemfile->filename = $postArray['filename'];
-	$this->__itemfile->fileext = $postArray['fileext'];
-	$this->__itemfile->filesize = $postArray['filesize'];
-	$this->__itemfile->filepath = $postArray['filepath'];
-	$this->__itemfile->categoryid = $postArray['categoryid'];
-	if (isset($postArray['tips']))
-	    $this->__itemfile->tips = $postArray['tips'];
-	$this->__itemfile->intime = time();
-	return $this->__itemfile->insert();
+    public function insertItemFileRecord($postArray)
+    {
+        $this->__itemfile->ownerid = $postArray['ownerid'];
+        $this->__itemfile->filename = $postArray['filename'];
+        $this->__itemfile->fileext = $postArray['fileext'];
+        $this->__itemfile->filesize = $postArray['filesize'];
+        $this->__itemfile->filepath = $postArray['filepath'];
+        $this->__itemfile->intime = time();
+        return $this->__itemfile->insert();
     }
     }
 
 
-    public function getItemFileList($tenderid) {
-	return $tenderid ? $this->__itemfile->find(array('where' => 'mpid=?', 'desc' => 'intime', 'param' => array($tenderid), 'asArray' => TRUE)) : FALSE;
+    public function getItemFileList($tenderid)
+    {
+        return $tenderid ? $this->__itemfile->find(array('where' => 'mpid=?', 'desc' => 'intime', 'param' => array($tenderid), 'asArray' => TRUE)) : FALSE;
     }
     }
 
 
-    public function updateItemFields($id, $fname, $tips) {
-	$this->__itemfile->filename = iconv('GBK', 'UTF-8', $fname);
-	$this->__itemfile->tips = iconv('GBK', 'UTF-8', $tips);
-	return $this->__itemfile->update(array('where' => 'iaid=?', 'param' => array($id)));
+    public function updateItemFields($id, $fname, $tips)
+    {
+        $this->__itemfile->filename = iconv('GBK', 'UTF-8', $fname);
+        $this->__itemfile->tips = iconv('GBK', 'UTF-8', $tips);
+        return $this->__itemfile->update(array('where' => 'iaid=?', 'param' => array($id)));
     }
     }
 
 
 }
 }

+ 29 - 0
protected/class/itemmeasurenum.php

@@ -0,0 +1,29 @@
+<?php
+
+Doo::loadModel('itemmnum');
+
+class ItemMeasureNumpofper
+{
+
+    private $__itemMeasureNum;
+
+    function __construct()
+    {
+        $this->__itemMeasureNum = new ItemMeasureNumofper();
+    }
+
+    public function insert($postArray)
+    {
+        $this->__itemMeasureNum->iaid = $postArray['iaid'];
+        $this->__itemMeasureNum->ownerid = $postArray['ownerid'];
+        $this->__itemMeasureNum->softwareitemid = $postArray['itemid'];
+        $this->__itemMeasureNum->pid = $postArray['pid'];
+        $this->__itemMeasureNum->mpid = $postArray['mpid'];
+        $this->__itemMeasureNum->isdel = 0;
+        $this->__itemMeasureNum->deltime = 0;
+        $this->__itemMeasureNum->categoryid = 0;
+        $this->__itemMeasureNum->tips = $postArray['tips'];
+        $this->__itemMeasureNum->intime = time();
+        return $this->__itemMeasureNum->insert();
+    }
+}

+ 4 - 0
protected/config/routes.conf.php

@@ -128,6 +128,10 @@ $route['*']['/api/client/tender/attachment/:tenderid/list'] = array('ClientContr
  */
  */
 $route['*']['/api/client/tender/attachment/info/:fileid/update'] = array('ClientController', 'updateItemFileDesc');
 $route['*']['/api/client/tender/attachment/info/:fileid/update'] = array('ClientController', 'updateItemFileDesc');
 /**
 /**
+ * 根据标段ID获取全部附件列表
+ */
+$route['*']['/api/client/tender/attachment/:itemid/del'] = array('ClientController', 'delItemFile');
+/**
  * 根据标段ID和期数获取审核意见
  * 根据标段ID和期数获取审核意见
  */
  */
 $route['*']['/api/client/tender/get/:tenderid/:phaseno/auditopinion'] = array('ClientController', 'getAuditOpinion');
 $route['*']['/api/client/tender/get/:tenderid/:phaseno/auditopinion'] = array('ClientController', 'getAuditOpinion');

+ 28 - 3
protected/controller/ClientController.php

@@ -14,6 +14,7 @@ Doo::loadClass('numofperact');
 Doo::loadClass('measureauditact');
 Doo::loadClass('measureauditact');
 Doo::loadClass('itemfile');
 Doo::loadClass('itemfile');
 Doo::loadModel('users');
 Doo::loadModel('users');
+Doo::loadClass('itemmeasurenum');
 
 
 /**
 /**
  * MainController
  * MainController
@@ -24,7 +25,7 @@ Doo::loadModel('users');
 class ClientController extends DooController
 class ClientController extends DooController
 {
 {
 
 
-    private $data, $client, $auth, $att, $file, $zip, $actmeasure, $contractact, $project, $profile, $numofperact, $measureauditact, $attfile, $users, $itemfile;
+    private $data, $client, $auth, $att, $file, $zip, $actmeasure, $contractact, $project, $profile, $numofperact, $measureauditact, $attfile, $users, $itemfile, $itemMeasureNum;
     private $statusArray = array('uncheck' => '1', 'checking' => '2', 'checked' => '3', 'checkno' => '4');
     private $statusArray = array('uncheck' => '1', 'checking' => '2', 'checked' => '3', 'checkno' => '4');
     private $fileTypeArray = array('台帐附件');
     private $fileTypeArray = array('台帐附件');
 
 
@@ -44,6 +45,7 @@ class ClientController extends DooController
         $this->measureauditact = new MeasureauditAct();
         $this->measureauditact = new MeasureauditAct();
         $this->users = new Users();
         $this->users = new Users();
         $this->itemfile = new ItemFile();
         $this->itemfile = new ItemFile();
+        $this->itemMeasureNum = new ItemMeasureNumpofper();
     }
     }
 
 
     public function ClientSignin()
     public function ClientSignin()
@@ -1084,8 +1086,13 @@ class ClientController extends DooController
                 $memoStr = iconv('GBK', 'UTF-8', $_POST['Memo']);
                 $memoStr = iconv('GBK', 'UTF-8', $_POST['Memo']);
                 $fnArray = explode('.', $fileArray['filename']);
                 $fnArray = explode('.', $fileArray['filename']);
                 $filenameStr = iconv('GBK', 'UTF-8', $fnArray[0]);
                 $filenameStr = iconv('GBK', 'UTF-8', $fnArray[0]);
-                $postArray = array('mpid' => $this->params['tenderid'], 'ownerid' => $this->params['uid'], 'itemid' => $_POST['itemid'], 'filename' => $filenameStr, 'filesize' => $fileArray['filesize'], 'fileext' => $fileArray['fileext'], 'filepath' => $fileArray['filepath'], 'categoryid' => array_search($_POST['Category'], $this->fileTypeArray), 'tips' => $memoStr);
-                if ($this->itemfile->insertItemFileRecord($postArray) > 1) {
+//                $postArray = array('mpid' => $this->params['tenderid'], 'ownerid' => $this->params['uid'], 'itemid' => $_POST['itemid'], 'filename' => $filenameStr, 'filesize' => $fileArray['filesize'], 'fileext' => $fileArray['fileext'], 'filepath' => $fileArray['filepath'], 'categoryid' => array_search($_POST['Category'], $this->fileTypeArray), 'tips' => $memoStr);
+                $postArray = array('ownerid' => $this->params['uid'], 'filename' => $filenameStr, 'filesize' => $fileArray['filesize'], 'fileext' => $fileArray['fileext'], 'filepath' => $fileArray['filepath']);
+                $iaid = $this->itemfile->insertItemFileRecord($postArray);
+                if ($iaid > 1) {
+                    $pidArray = $this->numofperact->getRowByMpid($this->params['tenderid']);
+                    $itemMeasureNumArray = array('iaid' => $iaid, 'pid' => $pidArray['pid'], 'mpid' => $this->params['tenderid'], 'ownerid' => $this->params['uid'], 'itemid' => $_POST['itemid'], 'tips' => $memoStr);
+                    $this->itemMeasureNum->insert($itemMeasureNumArray);
                     $extPath = pathinfo($fileArray['filepath']);
                     $extPath = pathinfo($fileArray['filepath']);
                     $itemArray = array('onlineFileName' => $extPath['filename'] . '.' . $extPath['extension']);
                     $itemArray = array('onlineFileName' => $extPath['filename'] . '.' . $extPath['extension']);
                     $status = array('status' => TRUE, 'msg' => '', 'iteminfo' => $itemArray);
                     $status = array('status' => TRUE, 'msg' => '', 'iteminfo' => $itemArray);
@@ -1140,6 +1147,24 @@ class ClientController extends DooController
     }
     }
 
 
     /**
     /**
+     * 删除清单附件
+     */
+    public function delItemFile()
+    {
+        if (isset($this->params['fileid']) && isset($_POST['FileName']) && isset($_POST['Memo'])) {
+            if ($this->itemfile->updateItemFields($this->params['fileid'], $_POST['FileName'], $_POST['Memo']) > 0) {
+                echo json_encode(array('status' => 'TRUE', 'msg' => ''), JSON_UNESCAPED_UNICODE);
+                die();
+            } else {
+                echo json_encode(array('status' => 'FALSE', 'msg' => '附件更新接口参数错误'), JSON_UNESCAPED_UNICODE);
+                die();
+            }
+        } else {
+            $this->msg(0, '附件更新接口参数错误');
+        }
+    }
+
+    /**
      *   查询指定项目的指定期的全部审批意见。
      *   查询指定项目的指定期的全部审批意见。
      *   标段ID,期号
      *   标段ID,期号
      */
      */

+ 32 - 0
protected/model/itemmnum.php

@@ -0,0 +1,32 @@
+<?php
+
+Doo::loadCore('db/DooModel');
+
+/**
+ * 用户表
+ */
+class ItemMeasureNumofper extends DooModel
+{
+    public $imnid;
+    public $iaid;
+    public $pid;
+    public $mpid;
+    public $softwareitemid;
+    public $isdel;
+    public $intime;
+    public $deltime;
+    public $ownerid;
+    public $categoryid;
+    public $tips;
+    public $_table = 'jl_item_measure_numofper';
+    public $_primarykey = 'imnid';
+    public $_fields = array('imnid', 'iaid', 'pid', 'mpid', 'softwareitemid', 'isdel', 'intime', 'deltime', 'ownerid', 'categoryid', 'tips');
+
+    public function __construct()
+    {
+        parent::setupModel(__CLASS__);
+    }
+
+}
+
+?>

+ 5 - 0
附件.sql

@@ -0,0 +1,5 @@
+ALTER TABLE `jl_item_attachment`
+  DROP `mpid`,
+  DROP `itemid`,
+  DROP `categoryid`,
+  DROP `tips`;