WeightClassController.class.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /**
  3. * 小梦科技资源nanodreamtech.com
  4. *
  5. * ==========================================================================
  6. * @link https://www.nanodreamtech.com/
  7. * @copyright Copyright (c) 2015 liofis.com.
  8. * @license https://www.nanodreamtech.com/license.html License
  9. * ==========================================================================
  10. *
  11. * @author fish
  12. *
  13. */
  14. namespace Admin\Controller;
  15. use Admin\Model\WeightClassModel;
  16. class WeightClassController extends CommonController{
  17. protected function _initialize(){
  18. parent::_initialize();
  19. $this->breadcrumb1='商品';
  20. $this->breadcrumb2='重量单位';
  21. }
  22. public function index(){
  23. $model=new WeightClassModel();
  24. $data=$model->show_weight_class_page();
  25. $this->assign('empty',$data['empty']);// 赋值数据集
  26. $this->assign('list',$data['list']);// 赋值数据集
  27. $this->assign('page',$data['page']);// 赋值分页输出
  28. $this->display();
  29. }
  30. function add(){
  31. if(IS_POST){
  32. $model=new WeightClassModel();
  33. $data=I('post.');
  34. $return=$model->add_weight_class($data);
  35. $this->osc_alert($return);
  36. }
  37. $this->crumbs='新增';
  38. $this->action=U('WeightClass/add');
  39. $this->display('edit');
  40. }
  41. function edit(){
  42. if(IS_POST){
  43. $model=new WeightClassModel();
  44. $data=I('post.');
  45. $return=$model->edit_weight_class($data);
  46. $this->osc_alert($return);
  47. }
  48. $this->crumbs='编辑';
  49. $this->action=U('WeightClass/edit');
  50. $this->d=M('WeightClass')->find(I('id'));
  51. $this->display('edit');
  52. }
  53. public function del(){
  54. $model=new WeightClassModel();
  55. $return=$model->del_weight_class();
  56. $this->osc_alert($return);
  57. }
  58. }
  59. ?>