MobileHome.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. namespace app\api\controller;
  3. use app\BaseController;
  4. /*
  5. * 基类
  6. */
  7. /**
  8. *
  9. *
  10. * ----------------------------------------------------------------------------
  11. *
  12. * 控制器
  13. */
  14. class MobileHome extends BaseController
  15. {
  16. //客户端类型
  17. protected $client_type_array = array('android', 'wap', 'wechat', 'ios', 'windows', 'jswechat', 'minipro');
  18. //列表默认分页数
  19. protected $pagesize = 5;
  20. public function initialize()
  21. {
  22. parent::initialize();
  23. //分页数处理
  24. $pagesize = intval(input('param.per_page'));
  25. if ($pagesize > 0) {
  26. $this->pagesize = $pagesize;
  27. } else {
  28. $this->pagesize = 10;
  29. }
  30. /* 加入配置信息 */
  31. $config_list = rkcache('config', true);
  32. config($config_list, 'ds_config');
  33. header('Access-Control-Allow-Origin:' . config('ds_config.h5_site_url'));
  34. if (isset($_SERVER["HTTP_REFERER"])) {
  35. if (strpos($_SERVER["HTTP_REFERER"], config('ds_config.h5_store_site_url')) !== false) {
  36. header('Access-Control-Allow-Origin:' . config('ds_config.h5_store_site_url'));
  37. } else if (strpos($_SERVER["HTTP_REFERER"], config('ds_config.h5_chain_site_url')) !== false) {
  38. header('Access-Control-Allow-Origin:' . config('ds_config.h5_chain_site_url'));
  39. }
  40. }
  41. header('Access-Control-Allow-Methods:GET, POST, OPTIONS');
  42. header('Access-Control-Allow-Headers:X-DS-KEY,Content-Type');
  43. header('Access-Control-Allow-Credentials:true');
  44. if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
  45. exit;
  46. }
  47. }
  48. /**
  49. * 返回过滤对应的用户信息
  50. * @param type $member_info
  51. * @return type
  52. */
  53. protected function getMemberUser($member_info)
  54. {
  55. return array(
  56. 'member_id' => $member_info['member_id'],
  57. 'member_name' => $member_info['member_name'],
  58. 'member_truename' => $member_info['member_truename'],
  59. 'member_nickname' => $member_info['member_nickname'],
  60. 'member_avatar' => get_member_avatar($member_info['member_avatar']),
  61. 'member_points' => $member_info['member_points'],
  62. 'member_email' => $member_info['member_email'],
  63. 'member_emailbind' => $member_info['member_emailbind'],
  64. 'member_mobile' => $member_info['member_mobile'],
  65. 'member_mobilebind' => $member_info['member_mobilebind'],
  66. 'member_sex' => $member_info['member_sex'],
  67. 'member_qq' => $member_info['member_qq'],
  68. 'member_ww' => $member_info['member_ww'],
  69. 'member_birthday' => date('Y-m-d', $member_info['member_birthday']),
  70. 'member_auth_state' => $member_info['member_auth_state'],
  71. 'member_idcard_image1_url' => get_member_idcard_image($member_info['member_idcard_image1']),
  72. 'member_idcard_image2_url' => get_member_idcard_image($member_info['member_idcard_image2']),
  73. 'member_idcard_image3_url' => get_member_idcard_image($member_info['member_idcard_image3']),
  74. );
  75. }
  76. /**
  77. * 返回过滤对应的用户信息
  78. * @param type $seller_info
  79. * @return type
  80. */
  81. protected function getSellerUser($seller_info, $store_info)
  82. {
  83. return array(
  84. 'store_id' => $store_info['store_id'],
  85. 'store_name' => $store_info['store_name'],
  86. 'member_id' => $seller_info['member_id'],
  87. 'seller_id' => $seller_info['seller_id'],
  88. 'seller_name' => $seller_info['seller_name'],
  89. 'store_avatar' => get_store_logo($store_info['store_avatar']),
  90. 'is_platform_store' => $store_info['is_platform_store'],
  91. 'storeclass_id' => $store_info['storeclass_id'],
  92. );
  93. }
  94. /**
  95. * 返回过滤对应的用户信息
  96. * @param type $chain_info
  97. * @return type
  98. */
  99. protected function getChainUser($chain_info)
  100. {
  101. return array(
  102. 'chain_id' => $chain_info['chain_id'],
  103. 'chain_name' => $chain_info['chain_name'],
  104. 'chain_addressname' => $chain_info['chain_addressname'],
  105. 'chain_area_info' => $chain_info['chain_area_info'],
  106. 'chain_area_2' => $chain_info['chain_area_2'],
  107. 'chain_area_3' => $chain_info['chain_area_3'],
  108. 'chain_address' => $chain_info['chain_address'],
  109. 'chain_state' => $chain_info['chain_state'],
  110. );
  111. }
  112. }