'card', 'cash' => 'cash', 'api_product' => 'api_product', ); $param['api_product'] = 'dhcz'; return $this->submit($param, $check); } # 中石油油卡充值 拼音来吧 public function zsycz($param) { $check = array ( 'card' => 'card', 'cash' => 'cash', //'idCard' => 'idCard', //'realName' => 'realName', 'api_product' => 'api_product', ); $param['api_product'] = 'zsycz'; return $this->submit($param, $check); } # 中石化油卡充值 public function zshcz($param) { $check = array ( 'card' => 'card', 'cash' => 'cash', 'api_product' => 'api_product', ); $param['api_product'] = 'zshcz_tc'; return $this->submit($param, $check); } # 中石化油卡充值透传 public function zshcz_tc($param) { $check = array ( 'card' => 'card', 'cash' => 'cash', 'api_product' => 'api_product', ); $param['api_product'] = 'zshcz_tc'; return $this->submit($param, $check); } # 通知处理 主要返回状态 2是成功 3是失败 public function notify($data) { $request = $data; unset($request['signature']); $request = $this->getParam($request, $this->token, 2); if ($request['signature'] != $data['signature']) { return false; } $result = array(); $result['cash'] = 1; if ($data['status'] == 2) { $result['status'] = 2; } elseif ($data['status'] == 3) { $result['status'] = 3; } else { $result['status'] = 4; } /* if (isset($this->data['product_key']) && strstr($this->data['product_key'], '_tc') && isset($data['vnum']) && $data['vnum']) { # 流水号 $data['s_nubmer'] = $result['s_nubmer'] = $data['vnum']; } */ if (isset($this->data['mid']) && $this->data['mid'] != 33 && isset($data['vnum']) && $data['vnum']) { # 流水号 $data['s_nubmer'] = $result['s_nubmer'] = $data['vnum']; } if (isset($data['msg']) && $data['msg']) { # 错误信息 $data['msg'] = $result['msg'] = $data['msg']; } $result['data'] = $data; return $result; } # 数据响应格式处理 public function response($data) { $log['type'] = 'response'; $log['data'] = $data; $log['config'] = $this->data; $this->log($log); $array = $this->json_decode($data); if (!$array) { $msg = 'error'; } elseif (isset($array['code']) && $array['code'] == 1) { # 正确 $msg = 'ok'; } else { # 错误 $msg = isset($array['info']) ? $array['info'] : 'error'; } return array ( 'msg' => $msg, 'data' => $data, 'array' => $array, ); } # 查询接口 public function query($param) { } # 查询余额接口 public function account($day) { $request['day'] = $day; $request['appid'] = $this->mid; $request['api_product'] = 'query'; $request = $this->getParam($request, $this->token, 2); $url = $this->host . 'gateway/api.run/accountByDay'; $response = $this->curl('post', $url, $request); $response = $this->response($response); return $response['array']['data']; } # 提交数据 private function submit($param, $check) { $param = $this->param($param, $check); if (is_string($param) || (is_array($param) && $param['status'] == 1)) { return $param; } return $this->send($param); } private function send($param, $parent_order = '') { $request = $param['detail']; $request['appid'] = $this->mid; $request['order'] = $param['order']; $request = $this->getParam($request, $this->token, 2); $url = $this->host . 'gateway/api.run/submit'; $response = $this->curl('post', $url, $request); $response = $this->response($response); //$response['data'] = '{}'; //$response['msg'] = 'ok'; $channel_order_id = ''; $this->create($param['order'], $channel_order_id, $param['merchant_order'], $param['cash'], $url, $request, $response, 1, $param['account'], $parent_order); return $response['msg']; } }