notify.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. error_reporting(0);
  7. define('IN_MOBILE', true);
  8. require '../../framework/bootstrap.inc.php';
  9. $_W['uniacid'] = intval($_POST['reqReserved']);
  10. load()->web('common');
  11. load()->classs('coupon');
  12. $_W['uniaccount'] = $_W['account'] = uni_fetch($_W['uniacid']);
  13. $_W['acid'] = $_W['uniaccount']['acid'];
  14. $setting = uni_setting($_W['uniacid'], array('payment'));
  15. if(!is_array($setting['payment'])) {
  16. exit('没有设定支付参数.');
  17. }
  18. $payment = $setting['payment']['unionpay'];
  19. require '__init.php';
  20. if (!empty($_POST) && verify($_POST) && $_POST['respMsg'] == 'success') {
  21. $sql = 'SELECT * FROM ' . tablename('core_paylog') . ' WHERE `uniontid`=:uniontid';
  22. $params = array();
  23. $params[':uniontid'] = $_POST['orderId'];
  24. $log = pdo_fetch($sql, $params);
  25. if(!empty($log) && $log['status'] == '0') {
  26. $log['tag'] = iunserializer($log['tag']);
  27. $log['tag']['queryId'] = $_POST['queryId'];
  28. $record = array();
  29. $record['status'] = 1;
  30. $record['tag'] = iserializer($log['tag']);
  31. pdo_update('core_paylog', $record, array('plid' => $log['plid']));
  32. if ($log['is_usecard'] == 1 && !empty($log['encrypt_code'])) {
  33. $coupon_info = pdo_get('coupon', array('id' => $log['card_id']), array('id'));
  34. $coupon_record = pdo_get('coupon_record', array('code' => $log['encrypt_code'], 'status' => '1'));
  35. load()->model('activity');
  36. $status = activity_coupon_use($coupon_info['id'], $coupon_record['id'], $log['module']);
  37. }
  38. $site = WeUtility::createModuleSite($log['module']);
  39. if(!is_error($site)) {
  40. $method = 'payResult';
  41. if (method_exists($site, $method)) {
  42. $ret = array();
  43. $ret['weid'] = $log['uniacid'];
  44. $ret['uniacid'] = $log['uniacid'];
  45. $ret['result'] = 'success';
  46. $ret['type'] = $log['type'];
  47. $ret['from'] = 'nofity';
  48. $ret['tid'] = $log['tid'];
  49. $ret['user'] = $log['openid'];
  50. $ret['fee'] = $log['fee'];
  51. $ret['tag'] = $log['tag'];
  52. $ret['is_usecard'] = $log['is_usecard'];
  53. $ret['card_type'] = $log['card_type'];
  54. $ret['card_fee'] = $log['card_fee'];
  55. $ret['card_id'] = $log['card_id'];
  56. $site->$method($ret);
  57. exit('success');
  58. }
  59. }
  60. }
  61. }
  62. exit('fail');