예제 #1
0
 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 checkChannel()
 {
     $channel = \Input::get('channel', 0);
     if (false === ChannelUtil::checkChannel($channel)) {
         $this->ret['err_code'] = ErrCode::ERR_PARAM;
         return $this->render();
     }
 }
예제 #3
0
 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);
 }