Operation.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. *
  13. * 控制器
  14. */
  15. class Operation extends AdminControl
  16. {
  17. public function initialize()
  18. {
  19. parent::initialize(); // TODO: Change the autogenerated stub
  20. Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/config.lang.php');
  21. }
  22. public function index()
  23. {
  24. $this->setAdminCurItem('index');
  25. return View::fetch('index');
  26. }
  27. /**
  28. * 基本设置
  29. */
  30. public function setting()
  31. {
  32. $config_model = model('config');
  33. if (request()->isPost()) {
  34. $update_array = array();
  35. $update_array['flea_isuse'] = intval(input('post.flea_isuse'));
  36. $update_array['promotion_allow'] = intval(input('post.promotion_allow'));
  37. $update_array['groupbuy_allow'] = intval(input('post.groupbuy_allow'));
  38. $update_array['points_isuse'] = intval(input('post.points_isuse'));
  39. $update_array['pointshop_isuse'] = input('post.pointshop_isuse');
  40. $update_array['voucher_allow'] = input('post.voucher_allow');
  41. $update_array['mgdiscount_allow'] = input('post.mgdiscount_allow');
  42. $update_array['pointprod_isuse'] = input('post.pointprod_isuse');
  43. $result = $config_model->editConfig($update_array);
  44. if ($result === true) {
  45. $this->log(lang('ds_edit') . lang('ds_operation') . lang('ds_operation_set'), 1);
  46. $this->success(lang('ds_common_save_succ'));
  47. } else {
  48. $this->error(lang('ds_common_save_fail'));
  49. }
  50. } else {
  51. $list_setting = rkcache('config', true);
  52. View::assign('list_setting', $list_setting);
  53. $this->setAdminCurItem('setting');
  54. return View::fetch('setting');
  55. }
  56. }
  57. public function point_signin()
  58. {
  59. $config_model = model('config');
  60. if (!request()->isPost()) {
  61. $list_setting = rkcache('config', true);
  62. View::assign('list_setting', $list_setting);
  63. return View::fetch('point_signin');
  64. } else {
  65. $update_array = array();
  66. $update_array['points_signin_isuse'] = input('post.points_signin_isuse');
  67. $update_array['points_signin'] = intval(input('post.points_signin'));
  68. $update_array['points_signin_cycle'] = intval(input('post.points_signin_cycle'));
  69. $update_array['points_signin_reward'] = intval(input('post.points_signin_reward'));
  70. $result = $config_model->editConfig($update_array);
  71. if ($result === true) {
  72. $this->success(lang('ds_common_save_succ'));
  73. } else {
  74. $this->error(lang('ds_common_save_fail'));
  75. }
  76. }
  77. }
  78. /**
  79. * 获取卖家栏目列表,针对控制器下的栏目
  80. */
  81. protected function getAdminItemList()
  82. {
  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. }