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