native.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. define('IN_MOBILE', true);
  7. require '../../framework/bootstrap.inc.php';
  8. load()->classs('pay/pay');
  9. $pay = Pay::create();
  10. $input= file_get_contents('php://input');
  11. $input = $pay->parseResult($input);
  12. if(is_error($input)) {
  13. $pay->replyErrorNotify($input['message']);
  14. exit();
  15. }
  16. $result = $pay->buildNativePrepayid($input['product_id']);
  17. if(is_error($result)) {
  18. $pay->replyErrorNotify($result['message']);
  19. exit();
  20. }
  21. echo array2xml($result);
  22. echo 90;
  23. $log = pdo_get('core_paylog', array('plid' => $input['product_id']));
  24. $site = WeUtility::createModuleSite($log['module']);
  25. if(!is_error($site)) {
  26. $method = 'scanResult';
  27. if (method_exists($site, $method)) {
  28. $ret = array();
  29. $ret['weid'] = $log['weid'];
  30. $ret['uniacid'] = $log['uniacid'];
  31. $ret['acid'] = $log['acid'];
  32. $ret['result'] = 'success';
  33. $ret['type'] = $log['type'];
  34. $ret['from'] = 'notify';
  35. $ret['tid'] = $log['tid'];
  36. $ret['uniontid'] = $log['uniontid'];
  37. $ret['openid'] = empty($input['openid']) ? $log['openid'] : $input['openid'];
  38. $ret['is_follow'] = $input['is_subscribe'] == 'Y' ? 1 : 0;
  39. $ret['fee'] = $log['fee'];
  40. $ret['tag'] = $log['tag'];
  41. $ret['is_usecard'] = $log['is_usecard'];
  42. $ret['card_type'] = $log['card_type'];
  43. $ret['card_fee'] = $log['card_fee'];
  44. $ret['card_id'] = $log['card_id'];
  45. $site->$method($ret);
  46. }
  47. }