ewei_shopv2_api.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. define('IN_SYS', true);
  3. require __DIR__ . '/../framework/bootstrap.inc.php';
  4. load()->web('common');
  5. $uniacid = $_W['uniacid'] = intval($_GPC['i']);
  6. $_W['attachurl'] = $_W['attachurl_local'] = $_W['siteroot'] . $_W['config']['upload']['attachdir'] . '/';
  7. if (!empty($_W['setting']['remote'][$_W['uniacid']]['type'])) {
  8. $_W['setting']['remote'] = $_W['setting']['remote'][$_W['uniacid']];
  9. }
  10. $info = uni_setting_load('remote', $uniacid);
  11. if (!empty($info['remote'])) {
  12. if ($info['remote']['type'] != 0) {
  13. $_W['setting']['remote'] = $info['remote'];
  14. }
  15. }
  16. if (!empty($_W['setting']['remote']['type'])) {
  17. if ($_W['setting']['remote']['type'] == ATTACH_FTP) {
  18. $_W['attachurl'] = $_W['attachurl_remote'] = $_W['setting']['remote']['ftp']['url'] . '/';
  19. } else {
  20. if ($_W['setting']['remote']['type'] == ATTACH_OSS) {
  21. $_W['attachurl'] = $_W['attachurl_remote'] = $_W['setting']['remote']['alioss']['url'] . '/';
  22. } else {
  23. if ($_W['setting']['remote']['type'] == ATTACH_QINIU) {
  24. $_W['attachurl'] = $_W['attachurl_remote'] = $_W['setting']['remote']['qiniu']['url'] . '/';
  25. } else {
  26. if ($_W['setting']['remote']['type'] == ATTACH_COS) {
  27. $_W['attachurl'] = $_W['attachurl_remote'] = $_W['setting']['remote']['cos']['url'] . '/';
  28. }
  29. }
  30. }
  31. }
  32. }
  33. if (!empty($_GPC['formwe7'])) {
  34. $bind = pdo_fetch('SELECT * FROM ' . tablename('ewei_shop_wxapp_bind') . ' WHERE wxapp=:wxapp LIMIT 1', array(':wxapp' => $uniacid));
  35. if (!empty($bind) && !empty($bind['uniacid'])) {
  36. $uniacid = $_GPC['i'] = $bind['uniacid'];
  37. }
  38. }
  39. header('ACCESS-CONTROL-ALLOW-ORIGIN:*');
  40. if (empty($uniacid)) {
  41. exit('Access Denied.');
  42. }
  43. $site = WeUtility::createModuleSite('ewei_shopv2');
  44. $_GPC['c'] = 'site';
  45. $_GPC['a'] = 'entry';
  46. $_GPC['m'] = 'ewei_shopv2';
  47. $_GPC['do'] = 'mobile';
  48. $_W['uniacid'] = (int) $_GPC['i'];
  49. $_W['account'] = uni_fetch($_W['uniacid']);
  50. $_W['acid'] = (int) $_W['account']['acid'];
  51. if (!isset($_GPC['r'])) {
  52. $_GPC['r'] = 'app';
  53. } else {
  54. $_GPC['r'] = 'app.' . $_GPC['r'];
  55. }
  56. if (!is_error($site)) {
  57. $method = 'doMobileMobile';
  58. $site->uniacid = $uniacid;
  59. $site->inMobile = true;
  60. if (method_exists($site, $method)) {
  61. $r = $site->{$method}();
  62. if (!empty($r)) {
  63. echo $r;
  64. exit();
  65. }
  66. exit();
  67. }
  68. }