Exemplo n.º 1
0
 /**
  * 修改页面 post
  * @author Hanxiang
  * @param $id
  * @param ShakeAroundClient $shakeAroundClient
  * @param PageService $pageService
  * @return mixed
  */
 public function delete($id, ShakeAroundClient $shakeAroundClient, PageService $pageService)
 {
     $wx_page = WeixinPage::find($id);
     if (!$wx_page) {
         return redirect('/admin/wxpages')->with('result', false)->with('msg', "操作失败,页面不存在");
     }
     try {
         $pageService->deletePageOnline($shakeAroundClient, [$id]);
     } catch (\Exception $e) {
         return redirect('/admin/wxpages')->with('result', false)->with('msg', "操作失败" . $e->getMessage());
     }
     $pageService->delete([$id]);
     return redirect('/admin/wxpages')->with('result', true)->with('msg', "操作成功");
 }
Exemplo n.º 2
0
 /**
  * @param ShakeAroundClient $shakeAroundClient
  * @param PageService $pageService
  * @return string
  */
 public function delete(ShakeAroundClient $shakeAroundClient, PageService $pageService)
 {
     $resquetData = json_decode($this->inputData, true);
     if (!isset($resquetData['page_ids'])) {
         return RestHelp::parametersIllegal("page_ids is required");
     }
     if (!is_array($resquetData['page_ids'])) {
         return RestHelp::parametersIllegal("page_ids is not array");
     }
     foreach ($resquetData['page_ids'] as $id) {
         if (!WeixinPage::find($id)) {
             return RestHelp::encodeResult(23002, sprintf("page id %s not found", $id));
         }
     }
     try {
         $pageService->deletePageOnline($shakeAroundClient, $resquetData['page_ids']);
     } catch (\Exception $e) {
         return RestHelp::encodeResult($e->getCode(), $e->getMessage());
     }
     $pageService->delete($resquetData['page_ids']);
     return RestHelp::success();
 }