Config.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. <?php
  2. namespace app\admin\controller;
  3. use think\facade\View;
  4. use think\facade\Lang;
  5. /**
  6. * ============================================================================
  7. * DSMall多用户商城
  8. * ============================================================================
  9. * 版权所有 2014-2028 长沙德尚网络科技有限公司,并保留所有权利。
  10. * 网站地址: http://www.csdeshang.com
  11. * ----------------------------------------------------------------------------
  12. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
  13. * 不允许对程序代码以任何形式任何目的的再发布。
  14. * ============================================================================
  15. * 控制器
  16. */
  17. class Config extends AdminControl {
  18. public function initialize() {
  19. parent::initialize();
  20. Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/config.lang.php');
  21. }
  22. public function base() {
  23. $config_model = model('config');
  24. if (!request()->isPost()) {
  25. $list_config = rkcache('config', true);
  26. View::assign('list_config', $list_config);
  27. /* 设置卖家当前栏目 */
  28. $this->setAdminCurItem('base');
  29. return View::fetch();
  30. } else {
  31. $update_array = array();
  32. //首页首次访问悬浮图片
  33. if (!empty($_FILES['fixed_suspension_img']['name'])) {
  34. $res=ds_upload_pic(ATTACH_COMMON,'fixed_suspension_img', 'fixed_suspension_img.png');
  35. if($res['code']){
  36. $file_name=$res['data']['file_name'];
  37. $upload['fixed_suspension_img'] = $file_name;
  38. }else{
  39. $this->error($res['msg']);
  40. }
  41. }
  42. if (!empty($upload['fixed_suspension_img'])) {
  43. $update_array['fixed_suspension_img'] = $upload['fixed_suspension_img'];
  44. }
  45. $update_array['goods_verify'] = intval(input('post.goods_verify')) ;//店铺商品审核
  46. $update_array['goods_all_verify'] = intval(input('post.goods_all_verify')) ;//店铺所有商品是否通过审核
  47. $update_array['baidu_ak'] = input('post.baidu_ak');
  48. $update_array['baiduservice_ak'] = input('post.baiduservice_ak');
  49. $update_array['mapak_type'] = input('post.mapak_type');
  50. $update_array['gaode_ak'] = input('post.gaode_ak');
  51. $update_array['gaode_jscode'] = input('post.gaode_jscode');
  52. $update_array['site_name'] = input('post.site_name');
  53. $update_array['icp_number'] = input('post.icp_number');
  54. $update_array['wab_number'] = input('post.wab_number');
  55. $update_array['site_phone'] = input('post.site_phone');
  56. $update_array['site_tel400'] = input('post.site_tel400');
  57. $update_array['site_email'] = input('post.site_email');
  58. $update_array['flow_static_code'] = input('post.flow_static_code');
  59. $update_array['site_state'] = intval(input('post.site_state'));
  60. $update_array['cache_open'] = intval(input('post.cache_open'));
  61. $update_array['closed_reason'] = input('post.closed_reason');
  62. $update_array['hot_search'] = input('post.hot_search');
  63. $update_array['h5_site_url'] = input('post.h5_site_url');
  64. $update_array['h5_chain_site_url'] = input('post.h5_chain_site_url');
  65. $update_array['h5_store_site_url'] = input('post.h5_store_site_url');
  66. $update_array['h5_force_redirect'] = input('post.h5_force_redirect');
  67. $update_array['fixed_suspension_state'] = input('post.fixed_suspension_state'); //首页首次访问悬浮状态
  68. $update_array['fixed_suspension_url'] = input('post.fixed_suspension_url');
  69. $update_array['member_auth'] = input('post.member_auth');//会员实名认证
  70. $result = $config_model->editConfig($update_array);
  71. if ($result) {
  72. if($update_array['goods_verify']==0 && $update_array['goods_all_verify']==1){
  73. $goods_model = model('goods');
  74. $update = array();
  75. $update['goods_verify'] = 1;
  76. $where = array();
  77. $where[]=array('goods_commonid','>', 0);
  78. $goods_model->editProduces($where, $update);
  79. }
  80. $this->log(lang('ds_edit') . lang('web_set'), 1);
  81. $this->success(lang('ds_common_save_succ'), 'Config/base');
  82. } else {
  83. $this->log(lang('ds_edit') . lang('web_set'), 0);
  84. }
  85. }
  86. }
  87. public function logo() {
  88. $config_model = model('config');
  89. if (!request()->isPost()) {
  90. $list_config = rkcache('config', true);
  91. View::assign('list_config', $list_config);
  92. /* 设置卖家当前栏目 */
  93. $this->setAdminCurItem('logo');
  94. return View::fetch();
  95. } else {
  96. //上传文件保存路径
  97. if (!empty($_FILES['site_logo']['name'])) {
  98. $res=ds_upload_pic(ATTACH_COMMON,'site_logo', 'site_logo.png');
  99. if($res['code']){
  100. $file_name=$res['data']['file_name'];
  101. $upload['site_logo'] = $file_name;
  102. }else{
  103. $this->error($res['msg']);
  104. }
  105. }
  106. if (!empty($upload['site_logo'])) {
  107. $update_array['site_logo'] = $upload['site_logo'];
  108. }
  109. if (!empty($_FILES['member_logo']['name'])) {
  110. $res=ds_upload_pic(ATTACH_COMMON,'member_logo', 'member_logo.png');
  111. if($res['code']){
  112. $file_name=$res['data']['file_name'];
  113. $upload['member_logo'] = $file_name;
  114. }else{
  115. $this->error($res['msg']);
  116. }
  117. }
  118. if (!empty($upload['member_logo'])) {
  119. $update_array['member_logo'] = $upload['member_logo'];
  120. }
  121. if (!empty($_FILES['seller_center_logo']['name'])) {
  122. $res=ds_upload_pic(ATTACH_COMMON,'seller_center_logo', 'seller_center_logo.png');
  123. if($res['code']){
  124. $file_name=$res['data']['file_name'];
  125. $upload['seller_center_logo'] = $file_name;
  126. }else{
  127. $this->error($res['msg']);
  128. }
  129. }
  130. if (!empty($upload['seller_center_logo'])) {
  131. $update_array['seller_center_logo'] = $upload['seller_center_logo'];
  132. }
  133. if (!empty($_FILES['admin_backlogo']['name'])) {
  134. $res=ds_upload_pic('admin/common','admin_backlogo', 'backlogo.png');
  135. if($res['code']){
  136. $file_name=$res['data']['file_name'];
  137. $upload['admin_backlogo'] = $file_name;
  138. }else{
  139. $this->error($res['msg']);
  140. }
  141. }
  142. if (!empty($upload['admin_backlogo'])) {
  143. $update_array['admin_backlogo'] = $upload['admin_backlogo'];
  144. }
  145. if (!empty($_FILES['admin_logo']['name'])) {
  146. $res=ds_upload_pic('admin/common','admin_logo', 'logo.png');
  147. if($res['code']){
  148. $file_name=$res['data']['file_name'];
  149. $upload['admin_logo'] = $file_name;
  150. }else{
  151. $this->error($res['msg']);
  152. }
  153. }
  154. if (!empty($upload['admin_logo'])) {
  155. $update_array['admin_logo'] = $upload['admin_logo'];
  156. }
  157. if (!empty($_FILES['site_mobile_logo']['name'])) {
  158. $res=ds_upload_pic(ATTACH_COMMON,'site_mobile_logo', 'site_mobile_logo.png');
  159. if($res['code']){
  160. $file_name=$res['data']['file_name'];
  161. $upload['site_mobile_logo'] = $file_name;
  162. }else{
  163. $this->error($res['msg']);
  164. }
  165. }
  166. if (!empty($upload['site_mobile_logo'])) {
  167. $update_array['site_mobile_logo'] = $upload['site_mobile_logo'];
  168. }
  169. if (!empty($_FILES['site_logowx']['name'])) {
  170. $res=ds_upload_pic(ATTACH_COMMON,'site_logowx', 'site_logowx.png');
  171. if($res['code']){
  172. $file_name=$res['data']['file_name'];
  173. $upload['site_logowx'] = $file_name;
  174. }else{
  175. $this->error($res['msg']);
  176. }
  177. }
  178. if (!empty($upload['site_logowx'])) {
  179. $update_array['site_logowx'] = $upload['site_logowx'];
  180. }
  181. if (!empty($_FILES['business_licence']['name'])) {
  182. $res=ds_upload_pic(ATTACH_COMMON,'business_licence', 'business_licence.png');
  183. if($res['code']){
  184. $file_name=$res['data']['file_name'];
  185. $upload['business_licence'] = $file_name;
  186. }else{
  187. $this->error($res['msg']);
  188. }
  189. }
  190. if (!empty($upload['business_licence'])) {
  191. $update_array['business_licence'] = $upload['business_licence'];
  192. }
  193. $result = $config_model->editConfig($update_array);
  194. if ($result) {
  195. $this->log(lang('ds_edit') . lang('web_set'), 1);
  196. $this->success(lang('ds_common_save_succ'), 'Config/logo');
  197. } else {
  198. $this->log(lang('ds_edit') . lang('web_set'), 0);
  199. }
  200. }
  201. }
  202. /**
  203. * 敏感词过滤设置
  204. */
  205. public function word_filter() {
  206. $config_model = model('config');
  207. if (!request()->isPost()) {
  208. $list_config = rkcache('config', true);
  209. View::assign('list_config', $list_config);
  210. /* 设置卖家当前栏目 */
  211. $this->setAdminCurItem('word_filter');
  212. return View::fetch();
  213. } else {
  214. $update_array = array();
  215. $update_array['word_filter_open'] = intval(input('post.word_filter_open'));
  216. $update_array['word_filter_appid'] = trim(input('post.word_filter_appid'));
  217. $update_array['word_filter_secret'] = trim(input('post.word_filter_secret'));
  218. $result = $config_model->editConfig($update_array);
  219. if ($result === true) {
  220. $this->log(lang('ds_edit') . lang('word_filter_set'), 1);
  221. $this->success(lang('ds_common_save_succ'));
  222. } else {
  223. $this->log(lang('ds_edit') . lang('word_filter_set'), 0);
  224. $this->error(lang('ds_common_save_fail'));
  225. }
  226. }
  227. }
  228. /**
  229. * 防灌水设置
  230. */
  231. public function dump() {
  232. $config_model = model('config');
  233. if (!request()->isPost()) {
  234. $list_config = rkcache('config', true);
  235. View::assign('list_config', $list_config);
  236. /* 设置卖家当前栏目 */
  237. $this->setAdminCurItem('dump');
  238. return View::fetch();
  239. } else {
  240. $update_array = array();
  241. $update_array['guest_comment'] = intval(input('post.guest_comment'));
  242. $update_array['captcha_status_login'] = intval(input('post.captcha_status_login'));
  243. $update_array['captcha_status_register'] = intval(input('post.captcha_status_register'));
  244. $update_array['captcha_status_goodsqa'] = intval(input('post.captcha_status_goodsqa'));
  245. $update_array['captcha_status_storelogin'] = intval(input('post.captcha_status_storelogin'));
  246. $update_array['member_normal_register'] = intval(input('post.member_normal_register'));
  247. $result = $config_model->editConfig($update_array);
  248. if ($result === true) {
  249. $this->log(lang('ds_edit') . lang('dis_dump'), 1);
  250. $this->success(lang('ds_common_save_succ'));
  251. } else {
  252. $this->log(lang('ds_edit') . lang('dis_dump'), 0);
  253. $this->error(lang('ds_common_save_fail'));
  254. }
  255. }
  256. }
  257. /*
  258. * 设置自动收货时间
  259. */
  260. public function auto() {
  261. $config_model = model('config');
  262. if (!request()->isPost()) {
  263. $list_config = rkcache('config', true);
  264. View::assign('list_config', $list_config);
  265. /* 设置卖家当前栏目 */
  266. $this->setAdminCurItem('auto');
  267. return View::fetch();
  268. } else {
  269. $order_auto_receive_day = intval(input('post.order_auto_receive_day'));
  270. $order_auto_cancel_day = intval(input('post.order_auto_cancel_day'));
  271. $code_invalid_refund = intval(input('post.code_invalid_refund'));
  272. $store_bill_cycle = intval(input('post.store_bill_cycle'));
  273. if ($order_auto_receive_day < 1 || $order_auto_receive_day > 100) {
  274. $this->error(lang('automatic_confirmation_receipt') . '1-100' . lang('numerical'));
  275. }
  276. if ($order_auto_cancel_day < 1 || $order_auto_cancel_day > 50) {
  277. $this->error(lang('automatic_confirmation_receipt') . '1-50' . lang('numerical'));
  278. }
  279. if ($code_invalid_refund < 1 || $code_invalid_refund > 100) {
  280. $this->error(lang('exchange_code_refunded_automatically') . '1-100' . lang('numerical'));
  281. }
  282. if ($store_bill_cycle < 7) {
  283. $this->error(lang('store_bill_cycle_error'));
  284. }
  285. $update_array['order_auto_receive_day'] = $order_auto_receive_day;
  286. $update_array['order_auto_cancel_day'] = $order_auto_cancel_day;
  287. $update_array['code_invalid_refund'] = $code_invalid_refund;
  288. $update_array['store_bill_cycle'] = $store_bill_cycle;
  289. $result = $config_model->editConfig($update_array);
  290. if ($result) {
  291. $this->log(lang('ds_edit') . lang('auto_set'), 1);
  292. $this->success(lang('ds_common_save_succ'), 'Config/auto');
  293. } else {
  294. $this->log(lang('ds_edit') . lang('auto_set'), 0);
  295. $this->error(lang('ds_common_save_fail'));
  296. }
  297. }
  298. }
  299. /**
  300. * 获取卖家栏目列表,针对控制器下的栏目
  301. */
  302. protected function getAdminItemList() {
  303. $menu_array = array(
  304. array(
  305. 'name' => 'base',
  306. 'text' => lang('ds_base'),
  307. 'url' => (string) url('Config/base')
  308. ),
  309. array(
  310. 'name' => 'logo',
  311. 'text' => lang('ds_logo'),
  312. 'url' => (string) url('Config/logo')
  313. ),
  314. array(
  315. 'name' => 'dump',
  316. 'text' => lang('dis_dump'),
  317. 'url' => (string) url('Config/dump')
  318. ),
  319. array(
  320. 'name' => 'word_filter',
  321. 'text' => lang('word_filter_set'),
  322. 'url' => (string) url('Config/word_filter')
  323. ),
  324. array(
  325. 'name' => 'auto',
  326. 'text' => lang('automatic_execution_time_setting'),
  327. 'url' => (string) url('Config/auto')
  328. ),
  329. );
  330. return $menu_array;
  331. }
  332. }