MobileHome.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <?php
  2. namespace app\api\controller;
  3. use app\BaseController;
  4. /*
  5. * 基类
  6. */
  7. /**
  8. * ============================================================================
  9. * DSMall多用户商城
  10. * ============================================================================
  11. * 版权所有 2014-2028 长沙德尚网络科技有限公司,并保留所有权利。
  12. * 网站地址: http://www.csdeshang.com
  13. * ----------------------------------------------------------------------------
  14. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
  15. * 不允许对程序代码以任何形式任何目的的再发布。
  16. * ============================================================================
  17. * 控制器
  18. */
  19. class MobileHome extends BaseController {
  20. //客户端类型
  21. protected $client_type_array = array('android', 'wap', 'wechat', 'ios', 'windows', 'jswechat', 'minipro');
  22. //列表默认分页数
  23. protected $pagesize = 5;
  24. public function initialize() {
  25. parent::initialize();
  26. //分页数处理
  27. $pagesize = intval(input('param.per_page'));
  28. if ($pagesize > 0) {
  29. $this->pagesize = $pagesize;
  30. } else {
  31. $this->pagesize = 10;
  32. }
  33. /* 加入配置信息 */
  34. $config_list = rkcache('config', true);
  35. config($config_list,'ds_config');
  36. header('Access-Control-Allow-Origin:'.config('ds_config.h5_site_url'));
  37. if(isset($_SERVER["HTTP_REFERER"])){
  38. if(strpos($_SERVER["HTTP_REFERER"],config('ds_config.h5_store_site_url'))!==false){
  39. header('Access-Control-Allow-Origin:'.config('ds_config.h5_store_site_url'));
  40. }else if(strpos($_SERVER["HTTP_REFERER"],config('ds_config.h5_chain_site_url'))!==false){
  41. header('Access-Control-Allow-Origin:'.config('ds_config.h5_chain_site_url'));
  42. }
  43. }
  44. header('Access-Control-Allow-Methods:GET, POST, OPTIONS');
  45. header('Access-Control-Allow-Headers:X-DS-KEY,Content-Type');
  46. header('Access-Control-Allow-Credentials:true');
  47. if($_SERVER['REQUEST_METHOD'] == 'OPTIONS'){
  48. exit;
  49. }
  50. }
  51. /**
  52. * 返回过滤对应的用户信息
  53. * @param type $member_info
  54. * @return type
  55. */
  56. protected function getMemberUser($member_info) {
  57. return array(
  58. 'member_id' => $member_info['member_id'],
  59. 'member_name' => $member_info['member_name'],
  60. 'member_truename' => $member_info['member_truename'],
  61. 'member_nickname' => $member_info['member_nickname'],
  62. 'member_avatar' => get_member_avatar($member_info['member_avatar']),
  63. 'member_points' => $member_info['member_points'],
  64. 'member_email' => $member_info['member_email'],
  65. 'member_emailbind' => $member_info['member_emailbind'],
  66. 'member_mobile' => $member_info['member_mobile'],
  67. 'member_mobilebind' => $member_info['member_mobilebind'],
  68. 'member_sex' => $member_info['member_sex'],
  69. 'member_qq' => $member_info['member_qq'],
  70. 'member_ww' => $member_info['member_ww'],
  71. 'member_birthday' => date('Y-m-d',$member_info['member_birthday']),
  72. 'member_auth_state' => $member_info['member_auth_state'],
  73. 'member_idcard_image1_url' => get_member_idcard_image($member_info['member_idcard_image1']),
  74. 'member_idcard_image2_url' => get_member_idcard_image($member_info['member_idcard_image2']),
  75. 'member_idcard_image3_url' => get_member_idcard_image($member_info['member_idcard_image3']),
  76. );
  77. }
  78. /**
  79. * 返回过滤对应的用户信息
  80. * @param type $seller_info
  81. * @return type
  82. */
  83. protected function getSellerUser($seller_info,$store_info) {
  84. return array(
  85. 'store_id'=>$store_info['store_id'],
  86. 'store_name'=>$store_info['store_name'],
  87. 'member_id' => $seller_info['member_id'],
  88. 'seller_id' => $seller_info['seller_id'],
  89. 'seller_name' => $seller_info['seller_name'],
  90. 'store_avatar'=>get_store_logo($store_info['store_avatar']),
  91. 'is_platform_store' => $store_info['is_platform_store'],
  92. 'storeclass_id'=>$store_info['storeclass_id'],
  93. );
  94. }
  95. /**
  96. * 返回过滤对应的用户信息
  97. * @param type $chain_info
  98. * @return type
  99. */
  100. protected function getChainUser($chain_info) {
  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. }
  113. ?>