Exemple #1
0
 function orderInfoAction()
 {
     $request = $this->getRequest();
     if ('POST' == $request->getMethod()) {
         $ssotoken = $this->post()->get("ssotoken");
         $type = $this->post()->get("type");
         $pos = $this->post()->get("pos");
         $resource = $this->post()->get("resource");
         $action = $this->post()->get("action");
     } else {
         $ssotoken = $this->get("ssotoken");
         $type = $this->get("type");
         $pos = $this->get("pos");
         $resource = $this->get("resource");
         $action = $this->get("action");
     }
     //参数完整性校验
     if (!$ssotoken || !$type || !$pos) {
         $this->displayJsonUdo(Common_Error::ERROR_PARAM);
     }
     if ($type == Common_Config::LOG_ENTER_ORDER) {
         if (!is_array(json_decode($resource))) {
             $this->displayJsonUdo(Common_Error::ERROR_PARAM, "", "缺少resource参数信息");
         }
     } else {
         if ($type == Common_Config::LOG_SELECT_ALL || $type == Common_Config::LOG_SELECT_PAY) {
             if (!$action) {
                 $this->displayJsonUdo(Common_Error::ERROR_PARAM, "", "缺少action参数信息");
             }
         }
     }
     //获取用户id
     $userModel = new UserModel();
     $uid = $userModel->getUserId($ssotoken);
     if (is_array($uid)) {
         $this->displayJsonUdo(Common_Error::INVALID_TOKEN, "", $uid['msg']);
     }
     $accountModel = new AccountModel();
     $insert = $accountModel->orderLog($uid, $type, $pos, $resource, $action);
     if (!$insert) {
         $this->displayJsonUdo(Common_Error::ERROR_FAIL);
     }
     $this->displayJsonUdo(Common_Error::ERROR_SUCCESS);
 }