Operation.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. /**
  3. * 营销设置
  4. */
  5. namespace app\admin\controller;
  6. use think\facade\View;
  7. use think\facade\Lang;
  8. /**
  9. * ============================================================================
  10. * DSMall多用户商城
  11. * ============================================================================
  12. * 版权所有 2014-2028 长沙德尚网络科技有限公司,并保留所有权利。
  13. * 网站地址: http://www.csdeshang.com
  14. * ----------------------------------------------------------------------------
  15. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
  16. * 不允许对程序代码以任何形式任何目的的再发布。
  17. * ============================================================================
  18. * 控制器
  19. */
  20. class Operation extends AdminControl
  21. {
  22. public function initialize()
  23. {
  24. parent::initialize(); // TODO: Change the autogenerated stub
  25. Lang::load(base_path().'admin/lang/'.config('lang.default_lang').'/config.lang.php');
  26. }
  27. public function index(){
  28. $this->setAdminCurItem('index');
  29. return View::fetch('index');
  30. }
  31. /**
  32. * 基本设置
  33. */
  34. public function setting(){
  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. $config_model = model('config');
  62. if(!request()->isPost()){
  63. $list_setting = rkcache('config', true);
  64. View::assign('list_setting', $list_setting);
  65. return View::fetch('point_signin');
  66. }else{
  67. $update_array = array();
  68. $update_array['points_signin_isuse'] = input('post.points_signin_isuse');
  69. $update_array['points_signin'] = intval(input('post.points_signin'));
  70. $update_array['points_signin_cycle'] = intval(input('post.points_signin_cycle'));
  71. $update_array['points_signin_reward'] = intval(input('post.points_signin_reward'));
  72. $result = $config_model->editConfig($update_array);
  73. if ($result === true) {
  74. $this->success(lang('ds_common_save_succ'));
  75. } else {
  76. $this->error(lang('ds_common_save_fail'));
  77. }
  78. }
  79. }
  80. /**
  81. * 获取卖家栏目列表,针对控制器下的栏目
  82. */
  83. protected function getAdminItemList() {
  84. $menu_array = array(
  85. array(
  86. 'name' => 'index',
  87. 'text' => lang('ds_operation_set'),
  88. 'url' => (string)url('Operation/index')
  89. ),
  90. array(
  91. 'name' => 'setting',
  92. 'text' => lang('base_setting'),
  93. 'url' => (string)url('Operation/setting')
  94. ),
  95. );
  96. return $menu_array;
  97. }
  98. }