Fleaclassindex.php 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. namespace app\admin\controller;
  3. use think\facade\View;
  4. use think\facade\Lang;
  5. /**
  6. *
  7. *
  8. * ----------------------------------------------------------------------------
  9. *
  10. * 控制器
  11. */
  12. class Fleaclassindex extends AdminControl
  13. {
  14. public function initialize()
  15. {
  16. parent::initialize(); // TODO: Change the autogenerated stub
  17. Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/flea.lang.php');
  18. }
  19. /**
  20. * 设置
  21. */
  22. public function flea_class_index()
  23. {
  24. /**
  25. * 实例化商品分类模型
  26. */
  27. $fleaclass_model = model('fleaclass');
  28. $goods_class = $fleaclass_model->getTreeClassList(1);
  29. View::assign('goods_class', $goods_class);
  30. /**
  31. * 获取设置信息
  32. */
  33. $fc_index = $fleaclass_model->getFleaclassindex(array());
  34. if (is_array($fc_index) && !empty($fc_index)) {
  35. foreach ($fc_index as $value) {
  36. View::assign($value['fcindex_code'], $value);
  37. }
  38. }
  39. if (request()->isPost()) {
  40. $a = $fleaclass_model->setFleaclassindex(array('fcindex_code' => 'shuma', 'fcindex_id1' => input('post.shuma_cid1'), 'fcindex_id2' => input('post.shuma_cid2'), 'fcindex_id3' => input('post.shuma_cid3'), 'fcindex_id4' => input('post.shuma_cid4')));
  41. $b = $fleaclass_model->setFleaclassindex(array('fcindex_code' => 'zhuangban', 'fcindex_id1' => input('post.zhuangban_cid1'), 'fcindex_id2' => input('post.zhuangban_cid2'), '' => input('post.fcindex_id3'), 'fcindex_id4' => input('post.zhuangban_cid4')));
  42. $c = $fleaclass_model->setFleaclassindex(array('fcindex_code' => 'jujia', 'fcindex_id1' => input('post.jujia_cid1'), 'fcindex_id2' => input('post.jujia_cid2'), 'fcindex_id3' => input('post.jujia_cid3'), 'fcindex_id4' => input('post.jujia_cid4')));
  43. $d = $fleaclass_model->setFleaclassindex(array('fcindex_code' => 'xingqu', 'fcindex_id1' => input('post.xingqu_cid1'), 'fcindex_id2' => input('post.xingqu_cid2'), 'fcindex_id3' => input('post.xingqu_cid3'), 'fcindex_id4' => input('post.xingqu_cid4')));
  44. $e = $fleaclass_model->setFleaclassindex(array('fcindex_code' => 'muying', 'fcindex_id1' => input('post.muying_cid1'), 'fcindex_id2' => input('post.muying_cid2'), 'fcindex_id3' => input('post.muying_cid3'), 'fcindex_id4' => input('post.muying_cid4')));
  45. if ($a && $b && $c && $d && $e) {
  46. $a = $fleaclass_model->setFleaclassindex(array('fcindex_code' => 'shuma', 'fcindex_name1' => input('post.shuma_cname1'), 'fcindex_name2' => input('post.shuma_cname2'), 'fcindex_name3' => input('post.shuma_cname3'), 'fcindex_name4' => input('post.shuma_cname4')));
  47. $b = $fleaclass_model->setFleaclassindex(array('fcindex_code' => 'zhuangban', 'fcindex_name1' => input('post.zhuangban_cname1'), 'fcindex_name2' => input('post.zhuangban_cname2'), 'fcindex_name3' => input('post.zhuangban_cname3'), 'fcindex_name4' => input('post.zhuangban_cname4')));
  48. $c = $fleaclass_model->setFleaclassindex(array('fcindex_code' => 'jujia', 'fcindex_name1' => input('post.jujia_cname1'), 'fcindex_name2' => input('post.jujia_cname2'), 'fcindex_name3' => input('post.jujia_cname3'), 'fcindex_name4' => input('post.jujia_cname4')));
  49. $d = $fleaclass_model->setFleaclassindex(array('fcindex_code' => 'xingqu', 'fcindex_name1' => input('post.xingqu_cname1'), 'fcindex_name2' => input('post.xingqu_cname2'), 'fcindex_name3' => input('post.xingqu_cname3'), 'fcindex_name4' => input('post.xingqu_cname4')));
  50. $e = $fleaclass_model->setFleaclassindex(array('fcindex_code' => 'muying', 'fcindex_name1' => input('post.muying_cname1'), 'fcindex_name2' => input('post.muying_cname2'), 'fcindex_name3' => input('post.muying_cname3'), 'fcindex_name4' => input('post.muying_cname4')));
  51. if ($a && $b && $c && $d && $e) {
  52. $this->success(lang('flea_class_setting_ok'));
  53. }
  54. } else {
  55. $this->error(lang('flea_class_setting_error'));
  56. }
  57. } else {
  58. $this->setAdminCurItem('flea_class_index');
  59. return View::fetch('flea_class_index');
  60. }
  61. }
  62. protected function getAdminItemList()
  63. {
  64. $menu_array = array(
  65. array(
  66. 'name' => 'flea_class_index', 'text' => lang('flea_index_class_setting_info'), 'url' => (string)url('Fleaclassindex/flea_class_index')
  67. ),
  68. );
  69. return $menu_array;
  70. }
  71. }