log(222222); $log['type'] = 'notify'; $input = input(); /* $input = '{"s_type":1,"s_order":"Q202012136344128716383742","voucherNo":"","sign":"345AF8D8CAF418BD7973C5750597C4C4","mid":"1367893433324477","orderNum":"Q202012133351677645780669","cardNo":"1000113700013929562","status":"1"}'; $input = json_decode($input, true); */ $order_id = $input['s_order']; $log['order_id'] = $order_id; if ($input['s_type'] == 2) { $input = file_get_contents("php://input"); $input = json_decode($input, true); } else { unset($input['s_type']); } $log['request'] = $input; $this->log($log); if ($order_id) { return $this->notify($order_id, $log['request']); // return; } return 'error'; } # maihan回调 public function ze() { return $this->notify_call('order_no'); } public function feedov() { return $this->notify_call('third_id'); } public function dyr() { $input = input(); if (isset($input[0]) && $input[0]) { if (is_string($input[0])) { $input = json_decode($input[0], true); } else { $input = $input[0]; } } $log['type'] = 'notify'; $log['request'] = $input; $this->log($log); if(isset($input['out_trade_num']) && $input['out_trade_num']) { $order_id = $input['out_trade_num']; if ($order_id) { if (strstr($order_id, '-')) { $temp = explode('-', $order_id); $order_id = $temp[0]; } $orderService = OrderService::instance(); $order = $orderService->get($order_id); if(isset($order['channel_order_id']) && $input['order_number'] != $order['channel_order_id']) { return response('error'); } return $this->notify($order_id, $log['request']); } } return response('error'); } # maihan回调 public function maihan() { return $this->notify_call('ret_para'); } #金嘉奇 public function jinjiaqi() { return $this->notify_call('UserOrderId'); } #金嘉奇 public function shenghui() { return $this->notify_call('thirdOrderNo'); } # 趣传回调 public function shouka() { return $this->notify_call('MerchantOrderID'); } # 小马系统回调 public function ma() { return $this->notify_call('merchant_order_id'); } # 小马系统回调 public function rainend() { return $this->notify_call('outOrderId'); } # 系统回调 public function feinimoshu() { return $this->notify_call('morder'); } # 博鼎城回调 public function bodingcheng() { return $this->notify_call('downstreamSerialno'); } # 达尚回调 public function dashang() { return $this->notify_call('downstreamSerialno'); } # 明盛回调 public function mingsheng() { return $this->notify_call('downstreamSerialno'); } # 首浩回调 public function shouhao_call() { return $this->notify_call('orderNum'); } public function flow_call() { return $this->notify_call('consumerNo'); } public function feizhidu() { return $this->notify_call('third_id'); } # 首浩回调,主动发起 public function shouhao() { return; $channelService = \app\channel\service\ChannelService::instance(); $class = \app\merchant\service\OrderService::instance(); $where['cid'] = 10018; $where['status'] = 4; $data = $class->db()->where($where)->order('id asc')->limit(100)->select()->toArray(); if ($data) { foreach ($data as $k => $v) { $class->db()->where(array('id' => $v['id']))->update(array('status' => 6)); $result = $channelService->call('query', $v['cid'], $v['order_id']); $class->db()->where(array('id' => $v['id']))->update(array('status' => 4)); if ($result['status'] < 3) { return $this->notify($v['order_id'], $result, false, false); } } } } # 主动发起 public function dy() { $channelService = \app\channel\service\ChannelService::instance(); $class = \app\merchant\service\OrderService::instance(); $where['cid'] = 48; $where['status'] = 4; $data = $class->db()->where($where)->order('id asc')->limit(100)->select()->toArray(); if ($data) { foreach ($data as $k => $v) { $class->db()->where(array('id' => $v['id']))->update(array('status' => 6)); $result = $channelService->call('query', $v['cid'], $v); $class->db()->where(array('id' => $v['id']))->update(array('status' => 4)); if ($result['status'] < 3) { return $this->notify($v['order_id'], $result, false, false); } } } } # 平安回调 public function pingan() { return $this->notify_call('ret_para'); } # 联创回调 public function lianchuang() { return $this->notify_call('partnerOrderNo'); } # 辽宁鑫宏 public function hongxin() { return $this->notify_call('orderNum'); } # 聚合 public function juhe() { return $this->notify_call('orderid'); } # public function zhierbei() { return $this->notify_call('consumerNo'); } public function guorui() { return $this->notify_call('user_order'); } public function jiashi() { return $this->notify_call('orderId'); } public function niuniu() { return $this->notify_call('tmporder'); } public function yuanju() { return $this->notify_call('orderApiNo'); } public function lupay() { return $this->notify_call('OutID'); } public function gufeng() { return $this->notify_call('order_num'); } public function huachuang() { return $this->notify_call('serialNo'); } public function qianfan() { return $this->notify_call('user_order'); } public function niubite() { return $this->notify_call('third_id'); } public function weizhixing() { return $this->notify_call('trans_no'); } public function yinhuochong() { return $this->notify_call('customerOrderId'); } public function kutu() { return $this->notify_call('orderId'); } public function manxiangyou() { $args = input('args'); $log['type'] = 'notify'; $log['request'] = $args; $this->log($log); # 解密 $channelService = \app\channel\service\ChannelService::instance(); $input = $channelService->call('decode', 10080, $args); $key = 'sn'; $log['type'] = 'notify'; $log['request'] = $input; $this->log($log); if(isset($input[$key]) && $input[$key]) { $order_id = $input[$key]; if ($order_id) { if (strstr($order_id, '-')) { $temp = explode('-', $order_id); $order_id = $temp[0]; } return $this->notify($order_id, $log['request']); } } return response('error'); } public function jingheng() { return $this->notify_call('ext'); } public function xinjunhui() { return $this->notify_call('orderNo'); } public function huifen() { return $this->notify_call('orderNo'); } public function huashang() { return $this->notify_call('rechargeNo'); } public function huadan() { return $this->notify_call('order_id'); } # 公共回调方法 private function notify_call($key) { $input = input(); if (isset($input[0]) && $input[0]) { if (is_string($input[0])) { $input = json_decode($input[0], true); } else { $input = $input[0]; } } $log['type'] = 'notify'; $log['request'] = $input; $this->log($log); if(isset($input[$key]) && $input[$key]) { $order_id = $input[$key]; if ($order_id) { if (strstr($order_id, '-')) { $temp = explode('-', $order_id); $order_id = $temp[0]; } return $this->notify($order_id, $log['request']); } } return response('error'); } # 卡有回调,主动查询 public function kayou() { $channelService = \app\channel\service\ChannelService::instance(); $class = \app\merchant\service\OrderService::instance(); $where['cid'] = 8; $where['status'] = 4; $data = $class->db()->where($where)->order('id asc')->limit(100)->select()->toArray(); if ($data) { foreach ($data as $k => $v) { $class->db()->where(array('id' => $v['id']))->update(array('status' => 6)); $result = $channelService->call('query', $v['cid'], $v); $class->db()->where(array('id' => $v['id']))->update(array('status' => 4)); if ($result['status'] < 3) { return $this->notify($v['order_id'], $result, false, false); } } } } # 卡有回调,主动查询 public function yixunlian() { $channelService = \app\channel\service\ChannelService::instance(); $class = \app\merchant\service\OrderService::instance(); $where['cid'] = 18; $where['status'] = 4; $data = $class->db()->where($where)->order('id asc')->limit(100)->select()->toArray(); if ($data) { foreach ($data as $k => $v) { $class->db()->where(array('id' => $v['id']))->update(array('status' => 6)); $result = $channelService->call('query', $v['cid'], $v['order_id']); $class->db()->where(array('id' => $v['id']))->update(array('status' => 4)); if ($result['nFlag']) { return $this->notify($v['order_id'], $result, false, false); } } } } # 渠道僧下卡密,主动查询 public function shengxiakami() { $channelService = \app\channel\service\ChannelService::instance(); $class = \app\merchant\service\OrderService::instance(); $where['cid'] = 5; $where['status'] = 4; $data = $class->db()->where($where)->order('id asc')->limit(100)->select()->toArray(); if ($data) { foreach ($data as $k => $v) { $class->db()->where(array('id' => $v['id']))->update(array('status' => 6)); // var_dump($v);die; $result = $channelService->call('query', $v['cid'], $v); // var_dump($v);die; $class->db()->where(array('id' => $v['id']))->update(array('status' => 4)); if ($result['status'] == 7) { return $this->notify($v['order_id'], $result, false, false); } } } } # 渠道僧下卡密,主动查询 public function piaopiapjinbi() { $channelService = \app\channel\service\ChannelService::instance(); $class = \app\merchant\service\OrderService::instance(); $where['cid'] = 15; $where['status'] = 4; $data = $class->db()->where($where)->order('id asc')->limit(100)->select()->toArray(); if ($data) { foreach ($data as $k => $v) { // $class->db()->where(array('id' => $v['id']))->update(array('status' => 6)); // var_dump($v);die; $result = $channelService->call('query', $v['cid'], $v); // $class->db()->where(array('id' => $v['id']))->update(array('status' => 4)); if ($result['status'] !=4) { return $this->notify($v['order_id'], $result, false, false); } } } } # 渠道僧下卡密,主动查询 public function xunmai() { $channelService = \app\channel\service\ChannelService::instance(); $class = \app\merchant\service\OrderService::instance(); $where['cid'] = 2; $where['status'] = 1; $data = $class->db()->where($where)->order('id asc')->limit(100)->select()->toArray(); if ($data) { foreach ($data as $k => $v) { // $class->db()->where(array('id' => $v['id']))->update(array('status' => 6)); // var_dump($v);die; $result = $channelService->call('query', $v['cid'], $v); // if($result['status'] == 7) // var_dump($result);die; // $class->db()->where(array('id' => $v['id']))->update(array('status' => 4)); if ($result['status'] == 7) { return $this->notify($v['order_id'], $result, false, false); } } } } public function niannian() { $channelService = \app\channel\service\ChannelService::instance(); $class = \app\merchant\service\OrderService::instance(); $where['cid'] = 2; $where['status'] = 4; $data = $class->db()->where($where)->order('id asc')->limit(100)->select()->toArray(); if ($data) { foreach ($data as $k => $v) { // $class->db()->where(array('id' => $v['id']))->update(array('status' => 6)); // var_dump($v);die; $result = $channelService->call('query', $v['cid'], $v); // var_dump($v);die; // $class->db()->where(array('id' => $v['id']))->update(array('status' => 4)); if ($result['status'] != 4) { // var_dump($v['order_id'],$result['status']); return $this->notify($v['order_id'], $result, false, false); } } } } public function queue_query($order_id,$result){ return $this->notify($order_id, $result, false, false); } }