/** * * @param string $hello * @return CommonUtilReturnVar */ function helloworld($hello) { $retCode = 0; $retCode_Str = 'SUCC'; $data = array(); // class err_service_name_helloworld{} // code succ: return CommonUtilReturnVar::Ret(true, $retCode, $data, $retCode_Str); failed: return CommonUtilReturnVar::Ret(false, $retCode, $data, $retCode_Str); }
/** * 获取所有票据 * * @return CommonUtilReturnVar */ function getall() { $retCode = 0; $retCode_Str = 'SUCC'; $data = array(); // class err_dbs_applereceiptcenter_getall{} $db = DBPools::default_Db_pools()->dbconnect(); $ret = $db->query(Data::DBKey_tablename); // code succ: return CommonUtilReturnVar::Ret(true, $retCode, $data, $retCode_Str); failed: return CommonUtilReturnVar::Ret(false, $retCode, $data, $retCode_Str); }
/** * @param ProcessData $ProcessData * @return array */ private function process(ProcessData $ProcessData) { $cmd = $ProcessData->get_command(); $cmdID = $ProcessData->get_commandid(); $params = $ProcessData->get_params(); // $verify = $ProcessData->get_verify(); $cmdClassName = $ProcessData->get_command_classname(); $cmdMethodName = $ProcessData->get_command_methodname(); $functionReturn = CommonUtilReturnVar::RetFail(0, 'no callable'); $classFullName = route()->getService($cmdClassName); //查找注册类 if (empty($classFullName)) { goto end; } $classIns = new $classFullName(); //是否是接口类 if (!$classIns instanceof Base) { $functionReturn = CommonUtilReturnVar::RetFail(1, 'service type error!'); goto end; } foreach ($this->processFilters as $filter) { if ($filter instanceof ProcessFilter) { if (!$filter->filter($classIns, $ProcessData)) { $functionReturn = CommonUtilReturnVar::RetFail(2, 'not pass filter!'); goto end; } } } if (!$classIns->is_services_enable($cmdMethodName)) { $functionReturn = CommonUtilReturnVar::RetFail(3, 'service cannot call!'); goto end; } try { $functionReturn = $classIns->call_service($cmdMethodName, $params); } catch (MissingArgumentException $e) { // $functionReturn = CommonUtilReturnVar::RetFail(err_service_gateway_call::ARGUMENT_ERROR, "MissingArgumentException\n" . $e->getMessage()); } end: $returnArr = $functionReturn->to_Array(); $returnArr[CommonUtilMessage::DBKey_cmd] = $cmd; $returnArr[CommonUtilMessage::DBKey_cmdid] = $cmdID; return $returnArr; }
/** * 创建消息体 * * @param string $command * 命令关键字 * @param int $commandid * 命令序号 * @param CommonUtilReturnVar $retdata * @return multitype: */ static function createmessagebody_withreturndata($command, $commandid, CommonUtilReturnVar $retdata) { return self::createmessagebody_withreturnparam($command, $commandid, $retdata->get_retsucc(), $retdata->get_retdata(), $retdata->get_retcode(), $retdata->get_retcode_str()); }
/** * 校验订单 * * @param string $orderId * @return CommonUtilReturnVar */ function check($orderId) { $retCode = 0; $retCode_Str = 'SUCC'; $data = array(); // class err_dbs_notice_center_check{} $orderId = strval($orderId); $rechargeData = $this->get_rechargedata($orderId); if (is_null($rechargeData)) { $retCode = err_dbs_notice_center_check::RECHARGE_DATA_NOT_EXIST; $retCode_Str = 'RECHARGE_DATA_NOT_EXIST:' . $orderId; goto failed; } if ($rechargeData->get_iscompleteverify()) { $retCode = err_dbs_notice_center_check::ALREADY_VERIFYED; $retCode_Str = 'ALREADY_VERIFYED'; goto failed; } $rechargeData->complete_verify(); $data = $rechargeData->toArray(); $this->save_rechargedata($rechargeData); // code succ: return CommonUtilReturnVar::Ret(true, $retCode, $data, $retCode_Str); failed: return CommonUtilReturnVar::Ret(false, $retCode, $data, $retCode_Str); }
/** * @param bool|true $isdump * @return CommonUtilReturnVar */ public function help($isdump = true) { $retCode = 0; $retCode_Str = 'SUCC'; $data = array(); $Services = $this->buildServices(); sort($Services); $this->_gen_html_docments($Services); // dump($Services); succ: return CommonUtilReturnVar::Ret(true, $retCode, $data, $retCode_Str); failed: return CommonUtilReturnVar::Ret(false, $retCode, $data, $retCode_Str); }