MobileHome.php 4.9 KB

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