CashondeliveryController.class.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php
  2. /**
  3. * lionfish 商城系统
  4. *
  5. * ==========================================================================
  6. * @link http://www.liofis.com/
  7. * @copyright Copyright (c) 2015 liofis.com.
  8. * @license http://www.liofis.com/license.html License
  9. * ==========================================================================
  10. *
  11. * @author cy 2021-04-26
  12. * @desc 货到付款设置
  13. *
  14. */
  15. namespace Seller\Controller;
  16. class CashondeliveryController extends CommonController{
  17. protected $menu;
  18. protected function _initialize(){
  19. parent::_initialize();
  20. $menu = array(
  21. 'title' => '货到付款',
  22. 'subtitle' => '货到付款',
  23. 'route' => 'cashondelivery/config',
  24. 'items' => array(
  25. array('title' => '设置', 'route' => 'cashondelivery/config'), )
  26. );
  27. $perm_url = strtolower(CONTROLLER_NAME) .'/'. strtolower(ACTION_NAME);
  28. $this->assign('perm_url', $perm_url );
  29. //组件权限方法===begin
  30. if(SELLERUID != 1)
  31. {
  32. $seller_info = M('seller')->field('s_role_id')->where( array('s_id' => SELLERUID ) )->find();
  33. $perm_role = M('lionfish_comshop_perm_role')->where( array('id' => $seller_info['s_role_id']) )->find();
  34. $perms_str = $perm_role['perms2'];
  35. $items = [];
  36. $can_use_routearr = [];
  37. foreach( $menu['items'] as $val )
  38. {
  39. $val_route = str_replace('/','.', $val['route']);
  40. if( strpos($perms_str, '.'.$val_route) !== false )
  41. {
  42. $items[] = $val;
  43. $can_use_routearr[] = strtolower($val['route']);
  44. }
  45. }
  46. $menu['items'] = $items;
  47. if( empty($can_use_routearr) )
  48. {
  49. $this->redirect( 'application/index', [], 1,'您没有当前应用权限' );
  50. }else if( !in_array($perm_url , $can_use_routearr ) )
  51. {
  52. $this->redirect( $can_use_routearr[0] );
  53. }
  54. }
  55. //组件方法end
  56. $this->menu = $menu;
  57. $this->assign('menu', $menu );
  58. }
  59. public function config()
  60. {
  61. $_GPC = I('request.');
  62. if (IS_POST) {
  63. $data = ((is_array($_GPC['parameter']) ? $_GPC['parameter'] : array()));
  64. $data['isopen_cashondelivery'] = isset($data['isopen_cashondelivery']) ? $data['isopen_cashondelivery'] : 0;
  65. $data['isopen_cashondelivery_communityhead'] = isset($data['isopen_cashondelivery_communityhead']) ? $data['isopen_cashondelivery_communityhead'] : 0;
  66. $data['isopen_cashondelivery_express'] = isset($data['isopen_cashondelivery_express']) ? $data['isopen_cashondelivery_express'] : 0;
  67. $data['isopen_cashondelivery_localtown'] = isset($data['isopen_cashondelivery_localtown']) ? $data['isopen_cashondelivery_localtown'] : 0;
  68. $data['isopen_cashondelivery_hexiao'] = isset($data['isopen_cashondelivery_hexiao']) ? $data['isopen_cashondelivery_hexiao'] : 0;
  69. $data['isopen_cashondelivery_code'] = isset($data['isopen_cashondelivery_code']) ? $data['isopen_cashondelivery_code'] : 0;
  70. $data['cashondelivery_code_img'] = isset($data['cashondelivery_code_img']) ? $data['cashondelivery_code_img'] : '';
  71. D('Seller/Config')->update($data);
  72. show_json(1, array('url' => $_SERVER['HTTP_REFERER']) );
  73. die();
  74. }
  75. $data = D('Seller/Config')->get_all_config();
  76. $this->data = $data;
  77. $this->display();
  78. }
  79. }
  80. ?>