wxapp.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. class CoreModuleWxapp extends WeModuleWxapp {
  3. public function doPagePay() {
  4. global $_W, $_GPC;
  5. $order_info = table('core_paylog')
  6. ->searchWithUniacid($_W['uniacid'])
  7. ->searchWithModule(safe_gpc_string($_GPC['module_name']))
  8. ->searchWithTid(safe_gpc_string($_GPC['orderid']))
  9. ->get();
  10. $order = array(
  11. 'tid' => $order_info['tid'],
  12. 'user' => $_SESSION['openid'],
  13. 'fee' => $order_info['fee'],
  14. 'title' => safe_gpc_string($_GPC['title']),
  15. );
  16. $this->module = array('name' => $order_info['module']);
  17. $paydata = $this->pay($order);
  18. $this->result(0, '', $paydata);
  19. }
  20. public function doPagePayResult() {
  21. global $_GPC, $_W;
  22. $log = table('core_paylog')
  23. ->searchWithUniacid($_W['uniacid'])
  24. ->searchWithModule(safe_gpc_string($_GPC['module_name']))
  25. ->searchWithTid(safe_gpc_string($_GPC['orderid']))
  26. ->get();
  27. if (!empty($log) && !empty($log['status'])) {
  28. if (!empty($log['tag'])) {
  29. $tag = iunserializer($log['tag']);
  30. $log['uid'] = $tag['uid'];
  31. }
  32. $site = WeUtility::createModuleSite($log['module']);
  33. if (!is_error($site)) {
  34. $method = 'payResult';
  35. if (method_exists($site, $method)) {
  36. $ret = array();
  37. $ret['weid'] = $log['uniacid'];
  38. $ret['uniacid'] = $log['uniacid'];
  39. $ret['result'] = 'success';
  40. $ret['type'] = $log['type'];
  41. $ret['from'] = 'return';
  42. $ret['tid'] = $log['tid'];
  43. $ret['uniontid'] = $log['uniontid'];
  44. $ret['user'] = $log['openid'];
  45. $ret['fee'] = $log['fee'];
  46. $ret['tag'] = $tag;
  47. $ret['is_usecard'] = $log['is_usecard'];
  48. $ret['card_type'] = $log['card_type'];
  49. $ret['card_fee'] = $log['card_fee'];
  50. $ret['card_id'] = $log['card_id'];
  51. exit($site->$method($ret));
  52. }
  53. }
  54. }
  55. }
  56. }