function sendFormAction()
 {
     $to = $this->_request->getParam('to');
     $title = $this->_request->getParam('title');
     $content = $this->_request->getParam('content');
     /*
     			$data = array(
     						'to' => $to,
     						'title' => $title,
     						'content'    => $content
     				);print_r($data);exit;*/
     if (empty($to) || empty($title) || empty($content)) {
         Zshop_Message::show($this, '不能为空!', 'admin/email/send', 2);
     } else {
         $tf = $this->email->sendEmail($to, $title, $content);
         if ($tf) {
             $data = array('address' => $to, 'send_name' => $this->email->_send, 'title' => $title, 'content' => $content, 'send_time' => time());
             $line = $this->email->insertEmail($data);
             if ($line) {
                 Zshop_Message::show($this, '发送成功!', 'admin/email/index', 2);
             } else {
                 Zshop_Message::show($this, '发送成功 , 插入失败!', 'admin/email/index', 2);
             }
         } else {
             Zshop_Message::show($this, '发送失败!', 'admin/email/index', 4);
         }
     }
 }
 public function replyAction()
 {
     $id = $this->_request->getParam('id');
     $reply = $this->_request->getParam('reply');
     $data = array('reply' => $reply, 'reply_status' => '1');
     $ok = $this->consult->updateConsult($id, $data);
     !empty($ok) && Zshop_Message::show($this, '回复成功!', 'admin/consult/index', 2);
 }
 function updateFormAction()
 {
     $id = $this->_request->getParam('id');
     $name = $this->_request->getParam('name');
     $min = $this->_request->getParam('min');
     $max = $this->_request->getParam('max');
     $discount = $this->_request->getParam('discount');
     if (empty($name) || empty($min) || empty($max)) {
         Zshop_Message::show($this, '不能为空', 'admin/grade/add', 1);
     } else {
         $data = array('grade_name' => $name, 'min_point' => intval($min), 'max_point' => intval($max), 'discount' => $discount);
         $this->grade->updateGrade($id, $data);
         $this->_redirect('admin/grade/index');
     }
 }
 function addFormAction()
 {
     $name = $this->_request->getParam('user_name');
     $pass = $this->_request->getParam('password');
     $sex = $this->_request->getParam('sex');
     $date = $this->_request->getParam('date');
     $phone = $this->_request->getParam('phone');
     $email = $this->_request->getParam('email');
     if (empty($name) || empty($pass) || empty($sex) || empty($email) || empty($phone) || empty($date)) {
         Zshop_Message::show($this, '输入不能为空', 'admin/member/add', 1);
     } else {
         $isValid = $this->member->checkMember($name);
         if ($isValid) {
             $data = array('user_name' => $name, 'password' => $pass, 'email' => $email, 'sex' => $sex, 'phone' => $phone, 'birthday' => strtotime($date), 'ip' => $_SERVER['REMOTE_ADDR'], 'grade' => 1, 'point' => 0, 'money' => 0, 'create_time' => time());
             $id = $this->member->insertMember($data);
             $id ? $this->_redirect('admin/member/index') : Zshop_Message::show($this, '插入失败', 'admin/member/add', 1);
         } else {
             Zshop_Message::show($this, '用户名已存在', 'admin/member/add', 1);
         }
     }
 }
 public function updateAction()
 {
     //获取传入参数
     $id = $this->_getParam('id');
     $name = $this->_getParam('name');
     $description = $this->_getParam('description');
     $orders = $this->_getParam('orders');
     //判断传入参数,并提交
     if (empty($name) || empty($description)) {
         Zshop_Message::show($this, '带*号内容必须输入', 'back', 2);
     } else {
         $brand = array('brand_name' => iconv_substr($name, 0, 100, 'utf-8'), 'description' => iconv_substr(nl2br($description), 0, 500, 'utf-8'), 'orders' => intval($orders));
         $isUpdated = $this->goodsBrand->update($brand, $id);
         if ($isUpdated) {
             $message = '修改成功';
             $url = 'admin/goodsbrand/index';
         } else {
             $message = '修改失败';
             $url = 'back';
         }
         Zshop_Message::show($this, $message, $url, 2);
     }
 }
 public function insertAction()
 {
     $typeId = intval($this->_getParam('typeId'));
     $propertyName = iconv_substr($this->_getParam('propertyName'), 0, 100, 'utf-8');
     $nameExists = $this->goodsPropertyModel->checkDuplicat('property_name', $propertyName);
     if ($nameExists) {
         Zshop_Message::show($this, $propertyName . '已经存在', 'back', 2);
     } elseif (empty($typeId) || empty($propertyName)) {
         Zshop_Message::show($this, '输入不能为空', 'back', 2);
     } else {
         //增加商品类型属性
         $set = array('type_id' => $typeId, 'property_name' => $propertyName);
         $isInserted = $this->goodsPropertyModel->insert($set);
         if ($isInserted) {
             $message = '添加成功';
             $backUrl = 'admin/goodstypeproperty/index/typeId/' . $typeId;
         } else {
             $message = '添加失败';
             $backUrl = 'back';
         }
         Zshop_Message::show($this, $message, $backUrl, 2);
     }
 }
 public function delAction()
 {
     $id = $this->getRequest()->getParam('id');
     if (empty($id)) {
         $ids = $this->getRequest()->getPost('check');
     } else {
         $ids = $id;
     }
     $isDeleted = $this->contentModel->delete($ids);
     $message = $isDeleted ? '删除成功' : '删除失败';
     Zshop_Message::show($this, $message, "admin/information/index", 3);
 }
 /**
  * 商品分类删除
  * @todo 分类下存在商品不删除
  */
 public function deleteAction()
 {
     $id = intval($this->_getParam('id'));
     $this->goodsCatalogModel->where = array('pid' => $id);
     $childCatNum = $this->goodsCatalogModel->getTotalNums();
     if ($childCatNum > 0) {
         Zshop_Message::show($this, '该分类下存在子分类,不能删除', 'back', 2);
     } else {
         $isDeleted = $this->goodsCatalogModel->delete($id);
         $message = $isDeleted ? '删除成功' : '删除失败';
         Zshop_Message::show($this, $message, 'admin/goodscatalog/index', 2);
     }
 }
 public function deleteAction()
 {
     $typeId = intval($this->_getParam('id'));
     if (empty($typeId)) {
         Zshop_Message::show($this, '类型ID为空', 'back', 2);
     } else {
         //删除商品类型
         $typeDeleted = $this->goodsTypeModel->delete($typeId);
         //删除商品类型属性
         $goodsTypeProperty = new GoodsTypePropertyModel();
         $propertyDeleted = $goodsTypeProperty->delete($typeId, 'type_id');
         //跳转提示
         $message = $typeDeleted && $propertyDeleted ? '删除成功' : '删除失败';
         Zshop_Message::show($this, $message, 'admin/goodstype/index', 2);
     }
 }
 public function logoutAction()
 {
     unset($this->session->adminName);
     Zend_Session::destroy(true);
     Zshop_Message::show($this, '退出成功', 'admin/login/index', 1);
 }
 public function outsaleAction()
 {
     $goodsId = $this->_getParam('check');
     $goodsId = array_filter($goodsId);
     //过滤空值
     if (is_array($goodsId) && count($goodsId) > 0) {
         $goods = new GoodsModel();
         $isUpdated = $goods->update(array('is_on_sale' => 0), $goodsId);
         $message = $isUpdated ? '下架成功' : '下架失败';
         Zshop_Message::show($this, $message, 'admin/goods/index', 2);
     } else {
         Zshop_Message::show($this, '未选择商品', 'admin/goods/index', 2);
     }
 }