|
@@ -21,13 +21,15 @@ Doo::loadModel('users');
|
|
|
*
|
|
|
* @author NoNZero
|
|
|
*/
|
|
|
-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 $statusArray = array('uncheck' => '1', 'checking' => '2', 'checked' => '3', 'checkno' => '4');
|
|
|
private $fileTypeArray = array('台帐附件');
|
|
|
|
|
|
- public function __construct() {
|
|
|
+ public function __construct()
|
|
|
+ {
|
|
|
$this->data['rootUrl'] = Doo::conf()->APP_URL;
|
|
|
$this->client = new client();
|
|
|
$this->auth = new Auth();
|
|
@@ -44,7 +46,8 @@ class ClientController extends DooController {
|
|
|
$this->itemfile = new ItemFile();
|
|
|
}
|
|
|
|
|
|
- public function ClientSignin() {
|
|
|
+ public function ClientSignin()
|
|
|
+ {
|
|
|
if (isset($_POST['zhname']) && isset($_POST['zhpass'])) {
|
|
|
echo json_encode(array('status' => FALSE, 'msg' => '登录失败,请更新软件。'), JSON_UNESCAPED_UNICODE);
|
|
|
die;
|
|
@@ -75,13 +78,14 @@ class ClientController extends DooController {
|
|
|
die;
|
|
|
}
|
|
|
} catch (Exception $exc) {
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 创建标段
|
|
|
// 参数:用户ID,创建名称,KEY
|
|
|
- function ClientCreatmeasure() {
|
|
|
+ function ClientCreatmeasure()
|
|
|
+ {
|
|
|
if (isset($this->params['uid']) && $this->params['uid'] && isset($this->params['bname']) && $this->params['bname'] && $this->params['ckey'] && isset($this->params['ckey'])) {
|
|
|
$retval = $this->contractact->getPidWithKey($this->params['ckey']);
|
|
|
if (isset($retval['pid'])) {
|
|
@@ -112,7 +116,8 @@ class ClientController extends DooController {
|
|
|
}
|
|
|
|
|
|
// 编制人审核第一期时 开始审核第一期时候调用
|
|
|
- public function ClientPeriod() {
|
|
|
+ public function ClientPeriod()
|
|
|
+ {
|
|
|
// TODO:上报数据
|
|
|
// TODO:每期更新数据时候和上传时候要查询当前进行期数的第几次一并写入数据库
|
|
|
if (isset($this->params['userid']) && isset($this->params['tenderid']) && isset($this->params['phaseno']) && isset($_POST['MD5_JL'])) {
|
|
@@ -203,7 +208,8 @@ class ClientController extends DooController {
|
|
|
* 查询标段的审核状态可以根据业主的审核依据来查询
|
|
|
* 如果除业主意外的人审核状态为未通过怎么处理
|
|
|
*/
|
|
|
- public function getMAStatus() {
|
|
|
+ public function getMAStatus()
|
|
|
+ {
|
|
|
// curr:当前期数,status:当前状态,total:总期数
|
|
|
// 参数catid
|
|
|
if (isset($this->params['tenderid'])) {
|
|
@@ -258,7 +264,8 @@ class ClientController extends DooController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function getUserSearch() {
|
|
|
+ public function getUserSearch()
|
|
|
+ {
|
|
|
if (isset($_POST['uemail']) && filter_var($_POST['uemail'], FILTER_VALIDATE_EMAIL)) {
|
|
|
$retval = $this->users->getOne(array('where' => 'uemail=?', 'param' => array($_POST['uemail']), 'asArray' => TRUE));
|
|
|
if (isset($retval['uid'])) {
|
|
@@ -287,7 +294,8 @@ class ClientController extends DooController {
|
|
|
* sectionid:标段ID periodid:期数
|
|
|
* TODO:如果审核人的期数或者次数与标段期数或者次数存在不对应情况的处理
|
|
|
*/
|
|
|
- public function getAlluserMeasure() {
|
|
|
+ public function getAlluserMeasure()
|
|
|
+ {
|
|
|
if (isset($this->params['tenderid']) && isset($this->params['phaseno'])) {
|
|
|
// error_log(var_export($this->params, TRUE), 3, '/opt/html/jlzftest/data/' . time());
|
|
|
// 先判断是否存在期数问题
|
|
@@ -335,7 +343,8 @@ class ClientController extends DooController {
|
|
|
//
|
|
|
//
|
|
|
// 配置审核人时候还没有创建标段所以没有MPID存在
|
|
|
- function addAuditMeasure() {
|
|
|
+ function addAuditMeasure()
|
|
|
+ {
|
|
|
// 必须检查期数是否存在
|
|
|
// 标段ID 当前登录 审核人ID
|
|
|
// 检测是否重复写入 && ($_POST['creatoruid'] > 0)
|
|
@@ -367,7 +376,8 @@ class ClientController extends DooController {
|
|
|
/**
|
|
|
* 删除审核用户
|
|
|
*/
|
|
|
- function delAuditMeasure() {
|
|
|
+ function delAuditMeasure()
|
|
|
+ {
|
|
|
if (isset($this->params['userid']) && isset($this->params['tenderid']) && isset($this->params['phaseno'])) {
|
|
|
// 判断当前标段期数审核状态,决定是否继续执行
|
|
|
$IntMaxTimes = $this->measureauditact->getMaxTimesInt($this->params['tenderid'], $this->params['phaseno']); // 根据标段PMID,期数numpname,获取目前重做次数
|
|
@@ -395,7 +405,8 @@ class ClientController extends DooController {
|
|
|
}
|
|
|
|
|
|
// 查询状态变更为审核中,已审核中为查询依据
|
|
|
- function checkMeasureStatus() {
|
|
|
+ function checkMeasureStatus()
|
|
|
+ {
|
|
|
if (isset($_POST['sectionid']) && isset($_POST['periodid'])) {
|
|
|
$mpArray = $this->numofperact->getRow($_POST['sectionid'], $_POST['periodid']);
|
|
|
$maArray = $this->measureauditact->getAlluserMeasureAudit($_POST['sectionid'], $_POST['periodid']);
|
|
@@ -420,7 +431,8 @@ class ClientController extends DooController {
|
|
|
// 根据用户查询参与的标段信息
|
|
|
// 参数为1时,当提交的附件中有重做记录时,提取记录未经过排重处理,出现重复结果。
|
|
|
// api/client/user/get/15/allproject 此接口也有同样问题
|
|
|
- function getAuditProject() {
|
|
|
+ function getAuditProject()
|
|
|
+ {
|
|
|
// TODO:可以通过SQL直接查询出来
|
|
|
if (isset($_POST['audituid']) && isset($_POST['RequestType'])) {
|
|
|
$downfileurl = NULL;
|
|
@@ -486,19 +498,19 @@ class ClientController extends DooController {
|
|
|
}
|
|
|
if ($_POST['RequestType'] == 2) {
|
|
|
/**
|
|
|
- {
|
|
|
- "downurl": "http://d.jl.smartcost.com.cn/data/2015/0608/20150608043245691/ProjectFile.rmf", 最新一期最新一次的文件
|
|
|
- "proName": "巫溪县前进桥", 项目名称
|
|
|
- "stName": "巫溪县 前进桥(终)", 合同段名称
|
|
|
- "MD5_Jl": "7cf05dccc6ad45b2d78f476a3388c3b2", 最新一期最新一次的文件hash code
|
|
|
- "tenderstatus": "2", 标段状态
|
|
|
- "tenderid": "234", 标段ID
|
|
|
- "pnameid": "79", 项目ID
|
|
|
- "ptypeid": "96", 合同段ID
|
|
|
- "audituidstatus": "2", 当前用户审核状态
|
|
|
- "bianzhirenuid": "59", 编制人UID
|
|
|
- "tenderName": "巫溪县 前进桥 终" 标段名称
|
|
|
- }
|
|
|
+ * {
|
|
|
+ * "downurl": "http://d.jl.smartcost.com.cn/data/2015/0608/20150608043245691/ProjectFile.rmf", 最新一期最新一次的文件
|
|
|
+ * "proName": "巫溪县前进桥", 项目名称
|
|
|
+ * "stName": "巫溪县 前进桥(终)", 合同段名称
|
|
|
+ * "MD5_Jl": "7cf05dccc6ad45b2d78f476a3388c3b2", 最新一期最新一次的文件hash code
|
|
|
+ * "tenderstatus": "2", 标段状态
|
|
|
+ * "tenderid": "234", 标段ID
|
|
|
+ * "pnameid": "79", 项目ID
|
|
|
+ * "ptypeid": "96", 合同段ID
|
|
|
+ * "audituidstatus": "2", 当前用户审核状态
|
|
|
+ * "bianzhirenuid": "59", 编制人UID
|
|
|
+ * "tenderName": "巫溪县 前进桥 终" 标段名称
|
|
|
+ * }
|
|
|
*/
|
|
|
// TODO::不同角色提取条件不同是否使用audituid 作为当前用户提取条件,容易产生冲突
|
|
|
if (!isset($_POST['audituid']) || !($_POST['audituid'] > 0)) {
|
|
@@ -574,7 +586,7 @@ class ClientController extends DooController {
|
|
|
*/
|
|
|
$intNum = $this->numofperact->getCountNumpname($spvalue['pmid'], $spvalue['numpname']);
|
|
|
// 如果期数是第一期期数必须大于一,否则减一为无效数据 ,为0表示这期为做上报没有产生记录
|
|
|
- if (( $spvalue['numpname'] > 1) && ($intNum == 0)) {// 提取上一期的数据
|
|
|
+ if (($spvalue['numpname'] > 1) && ($intNum == 0)) {// 提取上一期的数据
|
|
|
// 提取期数减一
|
|
|
$intLastTimes = $this->numofperact->getMaxTimes($spvalue['pmid'], $spvalue['numpname'] - 1)['times'];
|
|
|
$numstatusArray = $this->numofperact->getRow($spvalue['pmid'], $spvalue['numpname'] - 1, $intLastTimes); //获取上一期最新一次的状态
|
|
@@ -606,7 +618,8 @@ class ClientController extends DooController {
|
|
|
}
|
|
|
|
|
|
//二维数组去掉重复值 并保留键值
|
|
|
- function array_unique_fb($array2D) {
|
|
|
+ function array_unique_fb($array2D)
|
|
|
+ {
|
|
|
$key = array();
|
|
|
foreach ($array2D as $k => $v) {
|
|
|
if (empty($key))
|
|
@@ -624,7 +637,8 @@ class ClientController extends DooController {
|
|
|
return $temp2;
|
|
|
}
|
|
|
|
|
|
- function unique_arr($array2D, $stkeep = false, $ndformat = true) {
|
|
|
+ function unique_arr($array2D, $stkeep = false, $ndformat = true)
|
|
|
+ {
|
|
|
// 判断是否保留一级数组键 (一级数组键可以为非数字)
|
|
|
if ($stkeep)
|
|
|
$stArr = array_keys($array2D);
|
|
@@ -655,7 +669,8 @@ class ClientController extends DooController {
|
|
|
}
|
|
|
|
|
|
// 标段期审核接口
|
|
|
- function auditMeasure() {
|
|
|
+ function auditMeasure()
|
|
|
+ {
|
|
|
if (isset($_POST['userid']) && isset($_POST['tenderid']) && isset($_POST['phaseno']) && isset($_POST['MD5_JL'])) {
|
|
|
$auditcontent = iconv('GB2312', 'UTF-8', $_POST['CheckerMemo']);
|
|
|
$auditArray = $this->measureauditact->getLastNewRowInfo($_POST['tenderid'], $_POST['phaseno'], $_POST['userid']);
|
|
@@ -749,7 +764,8 @@ class ClientController extends DooController {
|
|
|
/**
|
|
|
* 根据标段ID查询是否需要更新
|
|
|
*/
|
|
|
- function checkTenderUpdate() {
|
|
|
+ function checkTenderUpdate()
|
|
|
+ {
|
|
|
if (isset($this->params ['tenderid']) && $this->params['tenderid']) {
|
|
|
$updateArray = $this->attfile->getFileUpdate($this->params['tenderid']);
|
|
|
$projectArray = $this->project->getRowByPid($updateArray['pid']);
|
|
@@ -773,7 +789,8 @@ class ClientController extends DooController {
|
|
|
/**
|
|
|
* 手动创建第二期的审核人
|
|
|
*/
|
|
|
- function creatTenderNumPnameUser() {
|
|
|
+ function creatTenderNumPnameUser()
|
|
|
+ {
|
|
|
if (isset($_POST['tenderid']) && isset($_POST['phaseno']) && ($_POST['phaseno'] > 1)) {
|
|
|
$allMeasureUser = $this->measureauditact->getUserAudit($_POST['tenderid'], $_POST['phaseno'] - 1);
|
|
|
if (isset($allMeasureUser)) {
|
|
@@ -786,7 +803,7 @@ class ClientController extends DooController {
|
|
|
try {
|
|
|
$this->measureauditact->insertMeasureAudit($value['pid'], $value['creatoruid'], $value['auditoruid'], $value['mpid'], $value['pmid'], $value['stid'], $_POST['phaseno'], $status, $value['last']);
|
|
|
} catch (Exception $exc) {
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
echo json_encode(array('status' => TRUE, 'msg' => ''), JSON_UNESCAPED_UNICODE);
|
|
@@ -804,7 +821,8 @@ class ClientController extends DooController {
|
|
|
/**
|
|
|
* 返回指定用户参与的所有项目
|
|
|
*/
|
|
|
- function getUserALLProject() {
|
|
|
+ function getUserALLProject()
|
|
|
+ {
|
|
|
if (!isset($this->params['userid']) || !($this->params['userid'] > 0)) {
|
|
|
echo json_encode(array('status' => FALSE, 'msg' => '返回指定用户参与的所有项目参数错误'), JSON_UNESCAPED_UNICODE);
|
|
|
die();
|
|
@@ -848,7 +866,8 @@ class ClientController extends DooController {
|
|
|
* TODO: 不通过两次未通过时候操作期数状态为错误位同步状态位 ok
|
|
|
* TODO: MPID未通过操作不争取 ok
|
|
|
*/
|
|
|
- function setCheckno() {
|
|
|
+ function setCheckno()
|
|
|
+ {
|
|
|
if (isset($this->params['userid']) && isset($this->params['tenderid']) && isset($this->params['phaseno']) && isset($_POST['MD5_JL'])) {
|
|
|
$auditcontent = iconv('GB2312', 'UTF-8', $_POST['CheckerMemo']);
|
|
|
$auditArray = $this->measureauditact->getRowInfo($this->params['tenderid'], $this->params['phaseno'], $this->params['userid']);
|
|
@@ -898,7 +917,8 @@ class ClientController extends DooController {
|
|
|
* 创建未通过的新一期
|
|
|
*
|
|
|
*/
|
|
|
- function createNewAudit() {
|
|
|
+ function createNewAudit()
|
|
|
+ {
|
|
|
// 插入上次期数相关审核人员
|
|
|
// TODO:
|
|
|
// error_log(var_export($this->params, TRUE), 3, '/opt/html/jiliang_customedProduct/data/' . time());
|
|
@@ -933,7 +953,8 @@ class ClientController extends DooController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function getUserInfo() {
|
|
|
+ public function getUserInfo()
|
|
|
+ {
|
|
|
if (isset($this->params['userid']) && ($this->params['userid'] > 0)) {
|
|
|
$proArray = $this->profile->getProWithUid($this->params['userid']);
|
|
|
if (isset($proArray['userid'])) {
|
|
@@ -950,7 +971,8 @@ class ClientController extends DooController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function updateTenderName() {
|
|
|
+ public function updateTenderName()
|
|
|
+ {
|
|
|
if (isset($this->params['BidID']) && isset($this->params['BidNewName'])) {
|
|
|
if ($this->actmeasure->updateName($this->params['BidID'], iconv('GB2312', 'UTF-8', $this->params['BidNewName']))) {
|
|
|
echo json_encode(array('status' => 'TRUE', 'msg' => ''), JSON_UNESCAPED_UNICODE);
|
|
@@ -967,11 +989,12 @@ class ClientController extends DooController {
|
|
|
|
|
|
/**
|
|
|
* 清单附件上传,单文件上传
|
|
|
- * @param int $tenderid 标段ID
|
|
|
- * @param int $uid 上传人ID
|
|
|
- * @param int $itemid 本地清单ID
|
|
|
+ * @param int $tenderid 标段ID
|
|
|
+ * @param int $uid 上传人ID
|
|
|
+ * @param int $itemid 本地清单ID
|
|
|
*/
|
|
|
- public function uploadItemFile() {
|
|
|
+ public function uploadItemFile()
|
|
|
+ {
|
|
|
if (isset($this->params['tenderid']) && isset($this->params['uid'])) {
|
|
|
if (!isset($_FILES['upitem']) && !isset($_POST['itemid']) && !isset($_POST['Category'])) {
|
|
|
$this->msg(0, '上传参数错误');
|
|
@@ -1000,7 +1023,8 @@ class ClientController extends DooController {
|
|
|
/**
|
|
|
* 获得清单附件列表
|
|
|
*/
|
|
|
- public function getItemFileList() {
|
|
|
+ public function getItemFileList()
|
|
|
+ {
|
|
|
if (isset($this->params['tenderid'])) {
|
|
|
$itemfileArray = $this->itemfile->getItemFileList($this->params['tenderid']);
|
|
|
$key = array_search(max($itemfileArray), $itemfileArray);
|
|
@@ -1020,7 +1044,8 @@ class ClientController extends DooController {
|
|
|
/**
|
|
|
* 编辑清单附件描述 文件名?
|
|
|
*/
|
|
|
- public function updateItemFileDesc() {
|
|
|
+ public function updateItemFileDesc()
|
|
|
+ {
|
|
|
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);
|
|
@@ -1038,7 +1063,8 @@ class ClientController extends DooController {
|
|
|
* 查询指定项目的指定期的全部审核意见。
|
|
|
* 标段ID,期号
|
|
|
*/
|
|
|
- public function getAuditOpinion() {
|
|
|
+ public function getAuditOpinion()
|
|
|
+ {
|
|
|
if (isset($this->params['tenderid']) && isset($this->params['phaseno'])) {
|
|
|
$retval = $this->measureauditact->getAuditOpinion($this->params['tenderid'], $this->params['phaseno']);
|
|
|
$iterator = new ArrayIterator($retval);
|
|
@@ -1058,34 +1084,41 @@ class ClientController extends DooController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- function upfile($fildname, $param = 'doc, docx, xls, xlsx, png, zip') {
|
|
|
+ function upfile($fildname, $param = 'doc, docx, xls, xlsx, png, zip')
|
|
|
+ {
|
|
|
return $this->att->uploadMut($fildname, $param);
|
|
|
}
|
|
|
|
|
|
- function upItemFile($fildname, $param = 'doc, docx, xls, xlsx, png, zip') {
|
|
|
+ function upItemFile($fildname, $param = 'doc, docx, xls, xlsx, png, zip')
|
|
|
+ {
|
|
|
$this->att->setUploadDir();
|
|
|
return $this->att->uploadMut($fildname, $param);
|
|
|
}
|
|
|
|
|
|
- function getFileupErrorNo() {
|
|
|
+ function getFileupErrorNo()
|
|
|
+ {
|
|
|
return $this->att->error();
|
|
|
}
|
|
|
|
|
|
- function Signout() {
|
|
|
+ function Signout()
|
|
|
+ {
|
|
|
session_destroy();
|
|
|
}
|
|
|
|
|
|
- function isLoggedIn() {
|
|
|
+ function isLoggedIn()
|
|
|
+ {
|
|
|
return isset($_SESSION['user_id']);
|
|
|
}
|
|
|
|
|
|
- function generateFormHash($salt) {
|
|
|
+ function generateFormHash($salt)
|
|
|
+ {
|
|
|
$hash = md5(mt_rand(1, 1000000) . $salt);
|
|
|
$_SESSION['csrf_hash'] = $hash;
|
|
|
return $hash;
|
|
|
}
|
|
|
|
|
|
- function isValidFormHash($hash) {
|
|
|
+ function isValidFormHash($hash)
|
|
|
+ {
|
|
|
return $_SESSION['csrf_hash'] === $hash;
|
|
|
}
|
|
|
|
|
@@ -1094,7 +1127,8 @@ class ClientController extends DooController {
|
|
|
* @param $password 密码
|
|
|
* @param $random 随机数
|
|
|
*/
|
|
|
- function random($length, $chars = '0123456789') {
|
|
|
+ function random($length, $chars = '0123456789')
|
|
|
+ {
|
|
|
$hash = '';
|
|
|
$max = strlen($chars) - 1;
|
|
|
for ($i = 0; $i < $length; $i++) {
|
|
@@ -1108,11 +1142,13 @@ class ClientController extends DooController {
|
|
|
* @param string $lenth 长度
|
|
|
* @return string 字符串
|
|
|
*/
|
|
|
- function create_randomstr($lenth = 6) {
|
|
|
+ function create_randomstr($lenth = 6)
|
|
|
+ {
|
|
|
return $this->random($lenth, '123456789abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ');
|
|
|
}
|
|
|
|
|
|
- function dir_create($path, $mode = 0777) {
|
|
|
+ function dir_create($path, $mode = 0777)
|
|
|
+ {
|
|
|
if (is_dir($path))
|
|
|
return TRUE;
|
|
|
$path = $this->dir_path($path);
|
|
@@ -1123,14 +1159,16 @@ class ClientController extends DooController {
|
|
|
return is_dir($path);
|
|
|
}
|
|
|
|
|
|
- function dir_path($path) {
|
|
|
+ function dir_path($path)
|
|
|
+ {
|
|
|
$path = str_replace('\\', '/', $path);
|
|
|
if (substr($path, -1) != '/')
|
|
|
$path = $path . '/';
|
|
|
return $path;
|
|
|
}
|
|
|
|
|
|
- function msg($isTrue = 0, $msg = null, $retmsg = null) {
|
|
|
+ function msg($isTrue = 0, $msg = null, $retmsg = null)
|
|
|
+ {
|
|
|
if ($isTrue > 0) {
|
|
|
echo json_encode(array('status' => 'TRUE', 'msg' => ''), JSON_UNESCAPED_UNICODE);
|
|
|
die();
|