Shop.php 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com
  8. * =========================================================
  9. */
  10. namespace app\shop\controller;
  11. use app\model\shop\Shop as ShopModel;
  12. use app\model\system\Address as AddressModel;
  13. use app\model\system\Site;
  14. use app\model\web\Config as ConfigModel;
  15. /**
  16. * 店铺
  17. * Class Shop
  18. * @package app\shop\controller
  19. */
  20. class Shop extends BaseShop
  21. {
  22. /**
  23. * 店铺设置
  24. * @return mixed
  25. */
  26. public function config()
  27. {
  28. $shop_model = new ShopModel();
  29. $site_model = new Site();
  30. $condition = array (
  31. [ "site_id", "=", $this->site_id ]
  32. );
  33. if (request()->isAjax()) {
  34. $site_name = input('site_name', '');
  35. $logo = input("logo", '');//店铺logo
  36. $logo_square = input("logo_square", '');//店铺方形logo
  37. $avatar = input("avatar", '');//店铺头像(大图)
  38. $banner = input("banner", '');//店铺条幅
  39. $seo_keywords = input("seo_keywords", '');//店铺关键字
  40. $seo_description = input("seo_description", '');//店铺简介
  41. $qq = input("qq", '');//qq
  42. $ww = input("ww", '');//ww
  43. $telephone = input("telephone", '');//联系电话
  44. $shop_pc_status = input('shop_pc_status', 1);//商城pc端状态
  45. $shop_h5_status = input('shop_h5_status', 1);//商城h5端状态
  46. $shop_weapp_status = input('shop_weapp_status', 1);//商城小程序端状态
  47. $seo_title = input('seo_title', '');
  48. $site_tel = input("site_tel", '');//服务电话
  49. $data_site = array (
  50. "site_name" => $site_name,
  51. "logo" => $logo,
  52. "logo_square" => $logo_square,
  53. "seo_keywords" => $seo_keywords,
  54. "seo_description" => $seo_description,
  55. "site_tel" => $site_tel,
  56. "seo_title" => $seo_title
  57. );
  58. $work_week = input("work_week", '');//工作日 例如 : 1,2,3,4,5,6,7
  59. $start_time = input("start_time", 0);//开始时间
  60. $end_time = input("end_time", 0);//结束时间
  61. $data_shop = array (
  62. "avatar" => $avatar,
  63. "banner" => $banner,
  64. "qq" => $qq,
  65. "ww" => $ww,
  66. "telephone" => $telephone,
  67. "work_week" => $work_week,
  68. "start_time" => $start_time,
  69. "end_time" => $end_time,
  70. );
  71. $site_model->editSite($data_site, $condition);
  72. $res = $shop_model->editShop($data_shop, $condition, $this->site_id);
  73. if ($res[ 'code' ] >= 0) {
  74. $shop_model->setShopStatus([ 'shop_pc_status' => $shop_pc_status, 'shop_h5_status' => $shop_h5_status, 'shop_weapp_status' => $shop_weapp_status ], $this->site_id, $this->app_module);
  75. }
  76. return $res;
  77. } else {
  78. $this->forthMenu();
  79. $shop_info_result = $shop_model->getShopInfo($condition);
  80. $site_info = $site_model->getSiteInfo($condition);
  81. //商城状态
  82. $shop_status_result = $shop_model->getShopStatus($this->site_id, $this->app_module);
  83. $shop_status = $shop_status_result[ 'data' ][ 'value' ];
  84. $this->assign('shop_status', $shop_status);
  85. $config_model = new ConfigModel();
  86. $info = $config_model->getH5DomainName();
  87. $this->assign('domain_name_h5', $info[ 'data' ][ 'value' ][ 'domain_name_h5' ]);
  88. $shop_info = array_merge($shop_info_result[ "data" ], $site_info[ 'data' ]);
  89. $this->assign("shop_info", $shop_info);
  90. return $this->fetch("shop/config");
  91. }
  92. }
  93. /**
  94. * 联系方式
  95. * @return mixed
  96. */
  97. public function contact()
  98. {
  99. $shop_model = new ShopModel();
  100. $condition = array (
  101. [ "site_id", "=", $this->site_id ]
  102. );
  103. if (request()->isAjax()) {
  104. $province = input("province", 0);//省级地址
  105. $province_name = input("province_name", '');//省级地址
  106. $city = input("city");//市级地址
  107. $city_name = input("city_name", '');//市级地址
  108. $district = input("district", 0);//县级地址
  109. $district_name = input("district_name", '');//县级地址
  110. $community = input("community", 0);//乡镇地址
  111. $community_name = input("community_name", '');//乡镇地址
  112. $address = input("address", 0);//详细地址
  113. $full_address = input("full_address", 0);//完整地址
  114. $longitude = input("longitude", '');//经度
  115. $latitude = input("latitude", '');//纬度
  116. $qq = input("qq", '');//qq号
  117. $ww = input("ww", '');//阿里旺旺
  118. $email = input("email", '');//邮箱
  119. $telephone = input("telephone", '');//联系电话
  120. $name = input("name", '');//联系人姓名
  121. $mobile = input("mobile", '');//联系人手机号
  122. $data = array (
  123. "province" => $province,
  124. "province_name" => $province_name,
  125. "city" => $city,
  126. "city_name" => $city_name,
  127. "district" => $district,
  128. "district_name" => $district_name,
  129. "community" => $community,
  130. "community_name" => $community_name,
  131. "address" => $address,
  132. "full_address" => $full_address,
  133. "longitude" => $longitude,
  134. "latitude" => $latitude,
  135. "qq" => $qq,
  136. "ww" => $ww,
  137. "email" => $email,
  138. "telephone" => $telephone,
  139. "name" => $name,
  140. "mobile" => $mobile
  141. );
  142. $res = $shop_model->editShop($data, $condition, $this->site_id);
  143. return $res;
  144. } else {
  145. $this->forthMenu();
  146. $shop_info_result = $shop_model->getShopInfo($condition);
  147. $shop_info = $shop_info_result[ "data" ];
  148. $this->assign("info", $shop_info);
  149. //查询省级数据列表
  150. $address_model = new AddressModel();
  151. $list = $address_model->getAreaList([ [ "pid", "=", 0 ], [ "level", "=", 1 ] ]);
  152. $this->assign("province_list", $list[ "data" ]);
  153. $this->assign("http_type", get_http_type());
  154. $config_model = new ConfigModel();
  155. $mp_config = $config_model->getMapConfig($this->site_id);
  156. $this->assign('tencent_map_key', $mp_config[ 'data' ][ 'value' ][ 'tencent_map_key' ]);
  157. //效验腾讯地图KEY
  158. $check_map_key = $config_model->checkQqMapKey($mp_config[ 'data' ][ 'value' ][ 'tencent_map_key' ]);
  159. $this->assign('check_map_key', $check_map_key);
  160. return $this->fetch("shop/contact");
  161. }
  162. }
  163. /**
  164. * 店铺推广
  165. * return
  166. */
  167. public function shopUrl()
  168. {
  169. //获取商品sku_id
  170. $shop_model = new ShopModel();
  171. $res = $shop_model->qrcode($this->site_id);
  172. // dump($res);exit;
  173. return $res;
  174. }
  175. }