/**
  * 选择应用
  * @return \Illuminate\View\View
  * @throws DeepInException
  */
 public function select()
 {
     $id = \Input::get("packageid");
     if (!$id) {
         throw new DeepInException("参数不完整");
     }
     //判断用户是否在应用里面
     $app = ShopApps::whereRaw("packageid=:packageid", array(":packageid" => $id))->first();
     if (!$app instanceof ShopApps) {
         //不存在在应用商店里面,属于新增一行数据到应用商店里面
         //拉取仓库里面的数据,部分数据是需要冗余的
         $responseValue = OpenApi::metadataInfo($id);
         if ($responseValue->getStatusCode() != 0) {
             throw new DeepInException("拉取仓库数据失败~!", $responseValue->getStatusMessage());
         }
         $data = $responseValue->getData();
         $app = new ShopApps();
         $app->packageId($id);
         $app->appName($id);
         //$data["name"]
         if ($app->save() == false) {
             throw new DeepInException("数据移进商店失败~!");
         }
         $appId = $app->appId();
         //创建两行宣传语的数据[默认新增两行]
         $inserted = ShopAppsTranslation::insert(array(array("appid" => $appId, "lang" => "zh_CN"), array("appid" => $appId, "lang" => "en_US")));
         if ($inserted == false) {
             throw new DeepInException("翻译数据新增失败~!");
         }
         return $this->successJSON();
     }
 }
 /**
  * 移除/移入 仓库数据到商店
  * @return \Illuminate\Http\JsonResponse
  * @throws DeepInException
  * @throws \Exception
  */
 public function select()
 {
     $id = \Input::get("packageid");
     if (!$id) {
         throw new DeepInException("参数不完整");
     }
     //判断用户是否在应用里面
     $app = ShopApps::whereRaw("packageid=:packageid", array(":packageid" => $id))->first();
     if (!$app instanceof ShopApps) {
         //不存在在应用商店里面,属于新增一行数据到应用商店里面
         //拉取仓库里面的数据,部分数据是需要冗余的
         $responseValue = OpenApi::metadataInfo($id);
         if ($responseValue->getStatusCode() != 0) {
             throw new DeepInException("拉取仓库数据失败~!", $responseValue->getStatusMessage());
         }
         $data = $responseValue->getData();
         $app = new ShopApps();
         $app->packageId($id);
         $app->appName($id);
         //$data["name"]
         if ($app->save() == false) {
             throw new DeepInException("数据移进商店失败~!");
         }
         $appId = $app->appId();
         //创建两行宣传语的数据[默认新增两行]
         $inserted = ShopAppsTranslation::insert(array(array("appid" => $appId, "lang" => "zh_CN"), array("appid" => $appId, "lang" => "en_US")));
         if ($inserted == false) {
             throw new DeepInException("翻译数据新增失败~!");
         }
     }
     return $this->successJSON();
     //        else {
     //            //应用在商店里面,需要判断该应用是否被栏目或者专题选用,如果被选用,则无法从商店里面remove掉该应用
     //
     //
     ////            $this->checkAppReferred($app->appId());
     ////            if ($app->inuse() == 1) {
     ////                throw new DeepInException("数据属于上架状态,无法移除商店~!");
     ////            }
     //            $applocalList = ShopAppsLocal::whereRaw("appid=:appid", array(":appid" => $appId))->get();
     //            if (count($applocalList) > 0) {
     //                throw new DeepInException("数据属于上架状态,无法移除商店~!");
     //            }
     //
     //            //删掉shop-app里面的数据
     //            if ($app->delete() == false) {
     //                throw new DeepInException("移除数据错误~!");
     //            }
     //
     //            //宣传语的翻译也要删掉
     //
     //            //对应的区域数据也要删掉
     //
     //
     //            return $this->successJSON();
     //        }
 }