人人商城

api.php 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. error_reporting(0);
  3. require '../../../../framework/bootstrap.inc.php';
  4. require '../../../../addons/ewei_shopv2/defines.php';
  5. require '../../../../addons/ewei_shopv2/core/inc/functions.php';
  6. global $_W;
  7. global $_GPC;
  8. require_once EWEI_SHOPV2_CORE . 'inc/plugin_model.php';
  9. $polyapi_file = EWEI_SHOPV2_PLUGIN . strtolower('polyapi') . '/core/model.php';
  10. if (!is_file($polyapi_file)) {
  11. print_r('没有找到网店管家插件');
  12. exit();
  13. }
  14. require_once $polyapi_file;
  15. $class_name = 'PolyapiModel';
  16. $polyapi_plugin = new $class_name('polyapi');
  17. $array = array();
  18. $array['appkey'] = trim($_GPC['appkey']);
  19. $array['bizcontent'] = $_GPC['bizcontent'];
  20. $array['method'] = trim($_GPC['method']);
  21. $array['token'] = trim($_GPC['token']);
  22. $array['sign'] = trim($_GPC['sign']);
  23. $polyapi_plugin->check_request($array);
  24. $key_info = $polyapi_plugin->get_key_info($array);
  25. $array['bizcontent'] = html_entity_decode($array['bizcontent']);
  26. if (empty($key_info)) {
  27. $polyapi_plugin->errorData('商城未找到appkey和的信息token');
  28. }
  29. else if (empty($key_info['status'])) {
  30. $polyapi_plugin->errorData('接口已经关闭,请到商城中开启接口!');
  31. }
  32. else {
  33. $polyapi_plugin->check_sign($array, $key_info);
  34. }
  35. $_W['uniacid'] = $key_info['uniacid'];
  36. $array['uniacid'] = $key_info['uniacid'];
  37. $array['bizcontent'] = json_decode($array['bizcontent'], true);
  38. switch ($array['method']) {
  39. case 'Differ.JH.Business.GetOrder':
  40. $data = $polyapi_plugin->GetOrder($array);
  41. break;
  42. case 'Differ.JH.Business.CheckRefundStatus':
  43. $data = $polyapi_plugin->CheckRefundStatus($array);
  44. break;
  45. case 'Differ.JH.Business.Send':
  46. $data = $polyapi_plugin->Send($array);
  47. break;
  48. case 'Differ.JH.Business.DownloadProduct':
  49. $data = $polyapi_plugin->DownloadProduct($array);
  50. break;
  51. case 'Differ.JH.Business.SyncStock':
  52. $data = $polyapi_plugin->SyncStock($array);
  53. break;
  54. default:
  55. $polyapi_plugin->errorData('平台不支持此接口', 6);
  56. break;
  57. }
  58. $data = json_encode($data);
  59. echo $data;
  60. exit();
  61. ?>