/**
  * 保存图片
  * @throws DeepInHtmlException
  */
 public function save()
 {
     $topicId = intval(\Input::get("topicid"));
     $lang = \Input::get("lang");
     $bgColor = \Input::get("bgcolor", null);
     $appNameColor = \Input::get("appnamecolor", null);
     $categoryNameColor = \Input::get("categorynamecolor", null);
     if (empty($bgColor)) {
         throw new DeepInHtmlException("请填入背景颜色~!");
     }
     if (empty($appNameColor)) {
         throw new DeepInHtmlException("应用名称颜色不能为空");
     }
     if (empty($categoryNameColor)) {
         throw new DeepInHtmlException("分类名称颜色不能为空~!");
     }
     if (empty($lang)) {
         throw new DeepInHtmlException("请选择语言~!");
     }
     try {
         $this->find($topicId);
     } catch (DeepInException $e) {
         throw new DeepInHtmlException($e->getMessage());
     }
     $bannerId = intval(\Input::get("bannerid"));
     $banner = null;
     if ($bannerId > 0) {
         try {
             $banner = $this->findBanner($bannerId);
         } catch (DeepInException $e) {
             $banner = null;
         }
     }
     $isAdd = false;
     if ($banner == null) {
         $banner = new ShopTopicBanner();
         $isAdd = true;
     }
     $banner->lang($lang);
     //语言
     $banner->topicId($topicId);
     $banner->bgColor($bgColor);
     $banner->appNameColor($appNameColor);
     $banner->categoryNameColor($categoryNameColor);
     $upload = DeepInUtil::upload(array("banner"));
     if (isset($upload["banner"])) {
         $banner->banner($upload["banner"]);
     } else {
         if ($isAdd) {
             throw new DeepInHtmlException("请上传背景图片~!");
         }
     }
     if ($banner->save() == false) {
         throw new DeepInHtmlException("操作失败~!");
     }
     return $this->success("操作成功~!");
 }
 /**
  * 保存数据
  * @throws DeepInException
  * @throws DeepInHtmlException
  */
 public function save()
 {
     $topicName = \Input::get("topicname");
     $enTopicName = \Input::get("entopicname");
     $local = \Input::get("local");
     $description = \Input::get("description");
     $enDescription = \Input::get("endescription");
     $categoryId = \Input::get("categoryid");
     $categoryId = intval($categoryId);
     $bgColor = \Input::get("bgcolor", null);
     //默认背景颜色
     $pos = intval(\Input::get("pos"));
     //位置(顺序)升序
     if (empty($bgColor)) {
         throw new DeepInHtmlException("默认背景颜色不能为空~!");
     }
     $appNameColor = \Input::get("appnamecolor", null);
     $categoryNameColor = \Input::get("categorynamecolor", null);
     if (empty($appNameColor)) {
         throw new DeepInHtmlException("应用名称颜色不能为空");
     }
     if (empty($categoryNameColor)) {
         throw new DeepInHtmlException("分类名称颜色不能为空~!");
     }
     if (empty($enTopicName) || empty($topicName) || empty($local) || empty($description) || $categoryId < 1) {
         throw new DeepInHtmlException("参数不完整~!");
     }
     $uploadInfo = DeepInUtil::upload(array("imgview"));
     if (!isset($uploadInfo["imgview"])) {
         throw new DeepInHtmlException("请选择封面图片~!");
     }
     $topic = new ShopTopic();
     $topic->topicName($topicName);
     $topic->enTopicName($enTopicName);
     $topic->local($local);
     $topic->description($description);
     $topic->enDescription($enDescription);
     //        $topic->bgImage($uploadInfo["bgimage"]);
     $topic->imgView($uploadInfo["imgview"]);
     $topic->categoryId($categoryId);
     $topic->pos($pos);
     //        $topic->bgColor($bgColor);
     if ($topic->save() == false) {
         throw new DeepInHtmlException("数据保存失败~!");
     }
     $uploadInfo = DeepInUtil::upload(array("banner"));
     if (!isset($uploadInfo["banner"])) {
         throw new DeepInHtmlException("请选择默认背景图片~!");
     }
     $banner = new ShopTopicBanner();
     $banner->topicId($topic->topicId());
     $banner->banner($uploadInfo['banner']);
     $banner->bgColor($bgColor);
     $banner->lang($local);
     //默认使用地区的代码
     $banner->appNameColor($appNameColor);
     $banner->categoryNameColor($categoryNameColor);
     $to = "/admin/topic/edit/" . $topic->topicId();
     if ($banner->save() == false) {
         throw new DeepInHtmlException("专题新增成功,但是默认背景图片信息保存失败~!", $to);
     }
     return $this->success("保存成功~!", $to);
 }