SellerController.class.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. /**
  3. * lionfish 商城系统
  4. *
  5. * ==========================================================================
  6. * @link http://www.liofis.com/
  7. * @copyright Copyright (c) 2015 liofis.com.
  8. * @license http://www.liofis.com/license.html License
  9. * ==========================================================================
  10. *
  11. * @author fish
  12. *
  13. */
  14. namespace Seller\Controller;
  15. use Admin\Model\SellerModel;
  16. class SellerController extends CommonController{
  17. protected function _initialize(){
  18. parent::_initialize();
  19. $this->breadcrumb1='店铺设置';
  20. $this->breadcrumb2='店铺信息';
  21. }
  22. public function info(){
  23. $data = M('seller')->where( array('s_id' => SELLERUID) )->find();
  24. if(!empty($data['s_logo']))
  25. $data['thumb_logo'] = resize($data['s_logo'], 100, 100);
  26. $this->type = -1;
  27. $this->action=U('Seller/edit');
  28. $this->data=$data;
  29. $this->display();
  30. }
  31. public function addad()
  32. {
  33. if(IS_POST){
  34. $model=new SellerModel();
  35. $data=I('post.');
  36. $data['seller_id'] = SELLERUID;
  37. $return=$model->add_ad($data);
  38. $this->osc_alert($return);
  39. }
  40. $this->crumbs='新增';
  41. $this->action=U('Seller/addad');
  42. $this->display('editad');
  43. }
  44. function editad(){
  45. if(IS_POST){
  46. $model=new SellerModel();
  47. $data=I('post.');
  48. $return=$model->edit_ad($data);
  49. $this->osc_alert($return);
  50. }
  51. $this->crumbs='编辑';
  52. $this->action=U('Seller/editad');
  53. $this->slider=M('seller_ad')->find(I('id'));
  54. $this->thumb_image=resize($this->slider['image'], 100, 100);
  55. $this->display('editad');
  56. }
  57. public function delad(){
  58. $r=M('seller_ad')->delete(I('id'));
  59. if($r){
  60. $this->redirect('Seller/adlist');
  61. }
  62. }
  63. public function adlist()
  64. {
  65. $model= new SellerModel();
  66. $data=$model->show_slider_page(SELLERUID);
  67. $this->assign('empty',$data['empty']);// 赋值数据集
  68. $this->assign('list',$data['list']);// 赋值数据集
  69. $this->assign('page',$data['page']);// 赋值分页输出
  70. $this->type = 1;
  71. $this->display();
  72. }
  73. function edit(){
  74. $info = M('seller')->where( array('s_id' => SELLERUID) )->find();
  75. if(IS_POST){
  76. $model=new SellerModel();
  77. $data=I('post.');
  78. $data['s_status'] = $info['s_status'];
  79. if($data['s_id'] != SELLERUID)
  80. {
  81. die('非法操作');
  82. }
  83. $return=$model->edit_seller_user($data);
  84. $return['jump'] = U('Seller/info');
  85. $this->osc_alert($return);
  86. }
  87. }
  88. }
  89. ?>