Exemplo n.º 1
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");
     }
 }
Exemplo n.º 2
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");
     }
 }
Exemplo n.º 3
0
 /**
  * function description
  *
  * @param
  * @return void
  */
 public function execute($request)
 {
     $id = $request->id;
     if (is_numeric($id)) {
         $cry = new Util_Crypt3Des();
         $id = $cry->encrypt($id);
         $id = base64_encode($id);
         include LIB_ROOT . "third/phpqrcode/phpqrcode.php";
         $data = SP_URL_HOME . "letter/show/" . $id . ".html";
         // 纠错级别:L、M、Q、H
         $level = 'L';
         // 点的大小:1到10,用于手机端4就可以了
         $size = 4;
         // 下面注释了把二维码图片保存到本地的代码,如果要保存图片,用$fileName替换第二个参数fal
         QRcode::png($data, false, $level, $size);
     } else {
         $this->show404();
     }
 }
Exemplo n.º 4
0
 /**
  * 合并存储的值为一个关联数组
  *
  * @param string $str
  * @param array $keys
  * @param string $glue
  * @return array
  */
 public static function parseStored($str)
 {
     //解密3des
     $cry = new Util_Crypt3Des();
     $str = $cry->decrypt($str);
     $data = explode(',', $str);
     $user['id'] = $data[0];
     $user['login'] = $data[1];
     if (isset($data[2])) {
         $user['mobile'] = $data[2];
     }
     if (isset($data[3])) {
         $user['email'] = $data[3];
     }
     return $user;
 }