/**
  * function description
  *
  * @param
  * @return void
  */
 public function execute($request)
 {
     if ($request->format == 'json') {
         $arrary = array();
         $id = $request->id;
         if (!is_numeric($id) || $id < 1) {
             return array('status' => '-5', 'msg' => '参数错误');
         }
         $pageConfig = $_POST['pageConfig'];
         $pageItem = $_POST['pageItem'];
         $letter = array();
         $letter['pageConfig'] = $pageConfig;
         $letter['pageItem'] = $pageItem;
         Sp_Letter_Letter::save($id, $letter);
         return array('status' => 0, 'msg' => '保存成功');
     } else {
         $id = $request->id;
         if (!is_numeric($id) || $id < 1) {
             $this->show404();
         }
         $letter = Sp_Letter_Letter::getLetterById($id);
         if (empty($letter)) {
             $this->show404();
         }
         $active = Sp_Active_Active::getActiveById($letter['active_id'], $user->id);
         if (empty($active)) {
             $this->show404();
         }
         $view = new Sp_View();
         $view->assign("id", $id);
         $view->assign("active", $active);
         $view->display("active/lettereditor.html");
     }
 }
Ejemplo n.º 2
0
 /**
  * function description
  *
  * @param
  * @return void
  */
 public function execute($request)
 {
     if ($request->format == 'json') {
         $user = Sp_Account_User::current();
         $aid = $request->id;
         if (!is_numeric($aid)) {
             $data = array();
             $data['status'] = '-1';
             $data['msg'] = '提交数据有误';
             return $data;
         }
         // 当前页数
         $nowPage = $request->page;
         empty($nowPage) && ($nowPage = 1);
         $limitRow = ($nowPage - 1) * self::PAGE_SIZE;
         // 分页数据
         $array = Sp_Letter_Letter::getListByUser($user->id, $aid, $limitRow, self::PAGE_SIZE);
         $total = Sp_Letter_Letter::getTotalByUser($user->id, $aid);
         if (is_array($array) && count($array)) {
             $cry = new Util_Crypt3Des();
             foreach ($array as $key => $value) {
                 $id = $cry->encrypt($value['id']);
                 $id = base64_encode($id);
                 $array[$key]['sid'] = $id;
             }
         }
         // 分页
         $pager = new Util_Pager($total, $nowPage, self::PAGE_SIZE);
         $pageString = $pager->renderNav(true);
         $data = array();
         if (is_array($array)) {
             $data['status'] = '0';
             $data['data'] = $array;
             $data['msg'] = '';
             $data['pageString'] = $pageString;
             $data['nowtime'] = time();
         } else {
             $data['status'] = '-1';
             $data['data'] = array();
             $data['msg'] = '';
         }
         return $data;
     } else {
         $aid = $request->id;
         if (!is_numeric($aid)) {
             $this->show404();
         }
         $user = Sp_Account_User::current();
         $active = Sp_Active_Active::getActiveById($aid, $user->id);
         if (empty($active)) {
             $this->show404();
         }
         $view = new Sp_View();
         $view->assign('active', $active);
         $view->assign('select', 'letter');
         $view->display("letter/index.html");
     }
 }
Ejemplo n.º 3
0
 /**
  * function description
  *
  * @param
  * @return void
  */
 public function execute($request)
 {
     if ($request->format == 'json') {
         $id = $request->id;
         if (!is_numeric($id)) {
             return array('status' => '-1', 'msg' => '参数错误');
         }
         $user = Sp_Account_User::current();
         $rs = Sp_Letter_Letter::delByPrimarykey($id, $user->id);
         return array('status' => '0', 'msg' => '删除成功');
     }
 }
 /**
  * function description
  *
  * @param
  * @return void
  */
 public function execute($request)
 {
     if ($request->format == 'json') {
         return array();
     } else {
         $id = $request->id;
         if (!is_numeric($id) || $id < 1) {
             $this->show404();
         }
         $letter = Sp_Letter_Letter::getLetterById($id);
         if (empty($letter)) {
             $this->show404();
         }
         $view = new Sp_View();
         $view->assign("letter", $letter);
         $view->display("letter/createsuccess.html");
     }
 }
Ejemplo n.º 5
0
 /**
  * function description
  *
  * @param
  * @return void
  */
 public function execute($request)
 {
     if ($request->format == 'json') {
         $id = $request->id;
         if (!is_numeric($id)) {
             return array('status' => '-1', 'msg' => '参数错误');
         }
         $letter = Sp_Letter_Letter::getLetterById($id);
         if (is_array($letter) && count($letter) > 0) {
             $letter['pageConfig'] = json_decode($letter['pageConfig'], TRUE);
             $letter['pageItem'] = json_decode($letter['pageItem'], TRUE);
         }
         if (!empty($letter)) {
             $active = Sp_Active_Active::getActiveById($letter['active_id']);
             if (empty($active)) {
                 return array('status' => '-1', 'msg' => '数据有误');
             }
         }
         return array('status' => '0', 'msg' => '获取成功', 'data' => $letter);
     } else {
         $jssdk = new Util_Jssdk("wx91f7f41fce0885bc", "YjlcfXNkdBYjlcfXNkdBYjlcfXNkdBYj");
         $signPackage = $jssdk->GetSignPackage();
         $id = $request->id;
         $id = base64_decode($id);
         $cry = new Util_Crypt3Des();
         $id = $cry->decrypt($id);
         if (!is_numeric($id)) {
             $this->show404();
         }
         $letter = Sp_Letter_Letter::getLetterById($id);
         if (empty($letter)) {
             $this->show404();
         }
         $active = Sp_Active_Active::getActiveById($letter['active_id']);
         if (empty($active)) {
             $this->show404();
         }
         $view = new Sp_View();
         $view->assign("letter", $letter);
         $view->assign('active', $active);
         $view->assign('signPackage', $signPackage);
         $view->display("letter/show.html");
     }
 }
Ejemplo n.º 6
0
 /**
  * function description
  *
  * @param
  * @return void
  */
 public function execute($request)
 {
     if ($request->format == 'json') {
         $active_id = $request->active_id;
         $title = $request->title;
         $discrib = $request->discrib;
         if (!is_numeric($active_id) || empty($title)) {
             return array('status' => '-1', 'msg' => '参数错误');
         }
         $user = Sp_Account_User::current();
         $letter = array();
         $letter['user_id'] = $user->id;
         $letter['title'] = $title;
         $letter['discrib'] = $discrib;
         $letter['active_id'] = $active_id;
         $lastid = Sp_Letter_Letter::add($letter);
         if (is_numeric($lastid) && $lastid > 0) {
             return array('status' => '0', 'msg' => '添加成功', 'data' => $lastid);
         } else {
             return array('status' => '-1', 'msg' => '添加失败');
         }
     }
 }
Ejemplo n.º 7
0
 public function getCurrentNum($activeId = '')
 {
     $Id = intval($activeId);
     return Sp_Letter_Letter::getCurrentNum($Id);
 }