Fleaclassindex.php 4.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. namespace app\admin\controller;
  3. use think\facade\View;
  4. use think\facade\Lang;
  5. /**
  6. * ============================================================================
  7. *
  8. * ============================================================================
  9. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  10. * 网站地址: https://www.valimart.net/
  11. * ----------------------------------------------------------------------------
  12. *
  13. * ============================================================================
  14. * 控制器
  15. */
  16. class Fleaclassindex extends AdminControl
  17. {
  18. public function initialize()
  19. {
  20. parent::initialize(); // TODO: Change the autogenerated stub
  21. Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/flea.lang.php');
  22. }
  23. /**
  24. * 设置
  25. */
  26. public function flea_class_index() {
  27. /**
  28. * 实例化商品分类模型
  29. */
  30. $fleaclass_model = model('fleaclass');
  31. $goods_class = $fleaclass_model->getTreeClassList(1);
  32. View::assign('goods_class', $goods_class);
  33. /**
  34. * 获取设置信息
  35. */
  36. $fc_index = $fleaclass_model->getFleaclassindex(array());
  37. if (is_array($fc_index) && !empty($fc_index)) {
  38. foreach ($fc_index as $value) {
  39. View::assign($value['fcindex_code'], $value);
  40. }
  41. }
  42. if (request()->isPost()) {
  43. $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')));
  44. $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')));
  45. $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')));
  46. $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')));
  47. $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')));
  48. if ($a && $b && $c && $d && $e) {
  49. $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')));
  50. $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')));
  51. $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')));
  52. $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')));
  53. $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')));
  54. if ($a && $b && $c && $d && $e) {
  55. $this->success(lang('flea_class_setting_ok'));
  56. }
  57. } else {
  58. $this->error(lang('flea_class_setting_error'));
  59. }
  60. } else {
  61. $this->setAdminCurItem('flea_class_index');
  62. return View::fetch('flea_class_index');
  63. }
  64. }
  65. protected function getAdminItemList()
  66. {
  67. $menu_array = array(
  68. array(
  69. 'name' => 'flea_class_index', 'text' => lang('flea_index_class_setting_info'), 'url' => (string)url('Fleaclassindex/flea_class_index')
  70. ),
  71. );
  72. return $menu_array;
  73. }
  74. }