public static function actionUpdate() { $p_id = W2HttpRequest::getRequestInt('id', null, false, false); $tmpModel = MissionHandler::loadModelById($p_id); switch ($auth = static::getAuthIfUserCanDoIt(Utility::getCurrentUserID(), 'update', $tmpModel)) { case 'admin': //有管理权限 // $tmpModel -> setUserID(W2HttpRequest::getRequestInt('userid')); // $tmpModel -> setStatus(W2HttpRequest::getRequestInt('status')); // $tmpModel -> setCreateTime(W2HttpRequest::getRequestDateTime('createtime')); // $tmpModel -> setModifyTime(W2HttpRequest::getRequestDateTime('modifytime')); //有管理权限 // $tmpModel -> setUserID(W2HttpRequest::getRequestInt('userid')); // $tmpModel -> setStatus(W2HttpRequest::getRequestInt('status')); // $tmpModel -> setCreateTime(W2HttpRequest::getRequestDateTime('createtime')); // $tmpModel -> setModifyTime(W2HttpRequest::getRequestDateTime('modifytime')); case 'self': //作者 // $tmpModel -> setJobID(W2HttpRequest::getRequestInt('jobid')); // $tmpModel -> setBossID(W2HttpRequest::getRequestInt('bossid')); // $tmpModel -> setAdvanceMoney(W2HttpRequest::getRequestFloat('advancemoney')); // $tmpModel -> setAdvanceType(W2HttpRequest::getRequestInt('advancetype')); // $tmpModel -> setAdvanceTime(W2HttpRequest::getRequestDateTime('advancetime')); // $tmpModel -> setPayMoney(W2HttpRequest::getRequestFloat('paymoney')); // $tmpModel -> setPayTime(W2HttpRequest::getRequestDateTime('paytime')); // $tmpModel -> setMissionStatus(W2HttpRequest::getRequestInt('missionstatus')); // $tmpModel -> setQualityRate(W2HttpRequest::getRequestInt('qualityrate')); // $tmpModel -> setManneryRate(W2HttpRequest::getRequestInt('manneryrate')); // $tmpModel -> setSpeedRate(W2HttpRequest::getRequestInt('speedrate')); // $tmpModel -> setCommentContent(W2HttpRequest::getRequestString('commentcontent')); // break; //作者 // $tmpModel -> setJobID(W2HttpRequest::getRequestInt('jobid')); // $tmpModel -> setBossID(W2HttpRequest::getRequestInt('bossid')); // $tmpModel -> setAdvanceMoney(W2HttpRequest::getRequestFloat('advancemoney')); // $tmpModel -> setAdvanceType(W2HttpRequest::getRequestInt('advancetype')); // $tmpModel -> setAdvanceTime(W2HttpRequest::getRequestDateTime('advancetime')); // $tmpModel -> setPayMoney(W2HttpRequest::getRequestFloat('paymoney')); // $tmpModel -> setPayTime(W2HttpRequest::getRequestDateTime('paytime')); // $tmpModel -> setMissionStatus(W2HttpRequest::getRequestInt('missionstatus')); // $tmpModel -> setQualityRate(W2HttpRequest::getRequestInt('qualityrate')); // $tmpModel -> setManneryRate(W2HttpRequest::getRequestInt('manneryrate')); // $tmpModel -> setSpeedRate(W2HttpRequest::getRequestInt('speedrate')); // $tmpModel -> setCommentContent(W2HttpRequest::getRequestString('commentcontent')); // break; case 'normal': //正常用户 $nextAction = W2HttpRequest::getRequestInt('nextaction'); if (!is_null($nextAction)) { if (MISSION_STATUS::isNextActionCanDo(Utility::getCurrentUserID(), $tmpModel, $nextAction)) { switch ($nextAction) { case MISSION_STATUS::COMMENTED: $qualityRate = W2HttpRequest::getRequestInt('qualityrate'); if ($qualityRate <= 0 || $qualityRate > 5) { return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NO_AUTH, '请给予服务质量评分哦.'); } $manneryRate = W2HttpRequest::getRequestInt('manneryrate'); if ($manneryRate <= 0 || $manneryRate > 5) { return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NO_AUTH, '请给予服务态度评分哦.'); } $speedRate = W2HttpRequest::getRequestInt('speedrate'); if ($speedRate <= 0 || $speedRate > 5) { return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NO_AUTH, '请给予服务速度评分哦.'); } $commentContent = W2HttpRequest::getRequestString('commentcontent'); if (empty($commentContent)) { return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NO_AUTH, '请给予评语留言哦.'); } $tmpModel->setQualityRate($qualityRate); $tmpModel->setManneryRate($manneryRate); $tmpModel->setSpeedRate($speedRate); $tmpModel->setCommentContent($commentContent); break; default: # code... break; } $tmpModel->setMissionStatus($nextAction); } else { return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NO_AUTH, '错误的操作事件,不可使用该功能,请刷新订单后重试。'); } } // return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NO_AUTH,'您没有权限执行该操作'); break; case 'draft': //未激活 return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NO_AUTH, '该账号未激活,不可使用该功能。'); break; case 'pending': //待审禁言 return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NO_AUTH, '该账号被禁言,不可使用该功能。'); break; case 'disabled': //封号 return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NO_AUTH, '该账号不可用,不可使用该功能。'); break; case 'visitor': return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NO_AUTH, '您需要登录后才可以执行该操作'); break; case 'empty': return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NOT_MODEL, '不存在对应数据'); break; default: return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NO_AUTH, '您没有权限执行该操作'); break; } return static::save($tmpModel); }
public function getLocalNextAction() { $nextActions = MISSION_STATUS::getNextAction(Utility::getCurrentUserID(), $this); $cancelActions = array(); foreach ($nextActions as $orderAction) { $strOfOrderStatus = MISSION_STATUS::getStrOfStatus($orderAction); $strOfOrderStatus['nextaction'] = $strOfOrderStatus['status']; unset($strOfOrderStatus['status']); unset($strOfOrderStatus['statusStr']); unset($strOfOrderStatus['statusDescription']); if ($orderAction == MISSION_STATUS::DISABLED || $orderAction == MISSION_STATUS::REJECT) { $cancelActions[] = $strOfOrderStatus; } else { $nextActions[] = $strOfOrderStatus; } } return array('cancelActions' => $cancelActions, 'nextActions' => $nextActions); }