Operation.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. /**
  3. * 营销设置
  4. */
  5. namespace app\admin\controller;
  6. use think\facade\View;
  7. use think\facade\Lang;
  8. /**
  9. * ============================================================================
  10. *
  11. * ============================================================================
  12. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  13. * 网站地址: https://www.valimart.net/
  14. * ----------------------------------------------------------------------------
  15. *
  16. * ============================================================================
  17. * 控制器
  18. */
  19. class Operation extends AdminControl
  20. {
  21. public function initialize()
  22. {
  23. parent::initialize(); // TODO: Change the autogenerated stub
  24. Lang::load(base_path().'admin/lang/'.config('lang.default_lang').'/config.lang.php');
  25. }
  26. public function index(){
  27. $this->setAdminCurItem('index');
  28. return View::fetch('index');
  29. }
  30. /**
  31. * 基本设置
  32. */
  33. public function setting(){
  34. $config_model = model('config');
  35. if (request()->isPost()) {
  36. $update_array = array();
  37. $update_array['flea_isuse'] = intval(input('post.flea_isuse'));
  38. $update_array['promotion_allow'] = intval(input('post.promotion_allow'));
  39. $update_array['groupbuy_allow'] = intval(input('post.groupbuy_allow'));
  40. $update_array['points_isuse'] = intval(input('post.points_isuse'));
  41. $update_array['pointshop_isuse'] = input('post.pointshop_isuse');
  42. $update_array['voucher_allow'] = input('post.voucher_allow');
  43. $update_array['mgdiscount_allow'] = input('post.mgdiscount_allow');
  44. $update_array['pointprod_isuse'] = input('post.pointprod_isuse');
  45. $result = $config_model->editConfig($update_array);
  46. if ($result === true) {
  47. $this->log(lang('ds_edit') . lang('ds_operation') . lang('ds_operation_set'), 1);
  48. $this->success(lang('ds_common_save_succ'));
  49. } else {
  50. $this->error(lang('ds_common_save_fail'));
  51. }
  52. } else {
  53. $list_setting = rkcache('config', true);
  54. View::assign('list_setting', $list_setting);
  55. $this->setAdminCurItem('setting');
  56. return View::fetch('setting');
  57. }
  58. }
  59. public function point_signin(){
  60. $config_model = model('config');
  61. if(!request()->isPost()){
  62. $list_setting = rkcache('config', true);
  63. View::assign('list_setting', $list_setting);
  64. return View::fetch('point_signin');
  65. }else{
  66. $update_array = array();
  67. $update_array['points_signin_isuse'] = input('post.points_signin_isuse');
  68. $update_array['points_signin'] = intval(input('post.points_signin'));
  69. $update_array['points_signin_cycle'] = intval(input('post.points_signin_cycle'));
  70. $update_array['points_signin_reward'] = intval(input('post.points_signin_reward'));
  71. $result = $config_model->editConfig($update_array);
  72. if ($result === true) {
  73. $this->success(lang('ds_common_save_succ'));
  74. } else {
  75. $this->error(lang('ds_common_save_fail'));
  76. }
  77. }
  78. }
  79. /**
  80. * 获取卖家栏目列表,针对控制器下的栏目
  81. */
  82. protected function getAdminItemList() {
  83. $menu_array = array(
  84. array(
  85. 'name' => 'index',
  86. 'text' => lang('ds_operation_set'),
  87. 'url' => (string)url('Operation/index')
  88. ),
  89. array(
  90. 'name' => 'setting',
  91. 'text' => lang('base_setting'),
  92. 'url' => (string)url('Operation/setting')
  93. ),
  94. );
  95. return $menu_array;
  96. }
  97. }