private function _checkParams($fields) { $errCode = 0; $errMsg = ''; do { $gateway = substr($fields['gateway'], 1); $channel = substr($fields['channel'], 1); $merRechargeNo = substr($fields['mer_recharge_no'], 1); $gatewayCode = Util\GatewayUtil::checkGateway($gateway); if (!$gatewayCode) { $errCode = 1; $errMsg = sprintf('gateway not exists gateway=%s', $gateway); break; } if (false === Util\ChannelUtil::checkChannel($channel)) { $errCode = 2; $errMsg = sprintf('channel not exists channel=%s', $channel); break; } $gatewayObj = Util\GatewayUtil::getGatewayObj($gateway); if (false == $gatewayObj->checkSign($fields)) { $errCode = 3; $errMsg = '参数验证失败'; break; } if (!$merRechargeNo) { $errCode = 4; $errMsg = '参数传递错误'; break; } } while (0); return array('err_code' => $errCode, 'err_msg' => $errMsg, 'channel' => $channel, 'gateway' => $gateway, 'mer_recharge_no' => $merRechargeNo); }
public function checkGateway() { $gateway = \Input::get('gateway', 0); if (false === GatewayUtil::checkGateway($gateway)) { $this->ret['err_code'] = ErrCode::ERR_PARAM; return $this->render(); } }
private function _checkParams($channel, $gateway) { $errCode = 0; $errMsg = ''; do { $gatewayCode = Util\GatewayUtil::checkGateway($gateway); if (!$gatewayCode) { $errCode = 1; $errMsg = sprintf('gateway not exists gateway=%s', $gateway); break; } if (false === Util\ChannelUtil::checkChannel($channel)) { $errCode = 1; $errMsg = sprintf('channel not exists channel=%s', $channel); break; } } while (0); return array('err_code' => $errCode, 'err_msg' => $errMsg, 'channel' => $channel, 'gateway' => $gateway); }