commit
9b1f51a656
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: kaguya
|
||||
* Date: 2017/11/24
|
||||
* Time: 13:06
|
||||
*/
|
||||
|
||||
namespace App\Controllers\Client;
|
||||
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Models\Ann;
|
||||
use App\Models\User;
|
||||
use App\Services\Auth;
|
||||
use App\Services\Factory;
|
||||
use App\Utils\Helper;
|
||||
|
||||
class ClientApiController extends BaseController
|
||||
{
|
||||
public function GetAnnouncement($request, $response, $args)
|
||||
{
|
||||
$accessToken = Helper::getTokenFromReq($request);
|
||||
$storage = Factory::createTokenStorage();
|
||||
$token = $storage->get($accessToken);
|
||||
$user = User::find($token->userId);
|
||||
$Anns = Ann::orderBy('date', 'desc')->first();
|
||||
$res['ret'] = 1;
|
||||
$res['msg'] = "ok";
|
||||
$res['data'] = $Anns;
|
||||
return $this->echoJson($response, $res);
|
||||
|
||||
|
||||
//return $this->view()->assign("anns", $Anns)->display('user/announcement.tpl');
|
||||
}
|
||||
|
||||
public function Redirect($request, $response, $args){
|
||||
$user = Auth::getUser();
|
||||
$url = $request->getQueryParams()["target"];
|
||||
if(!$user->isLogin){
|
||||
$accessToken = Helper::getTokenFromReq($request);
|
||||
$storage = Factory::createTokenStorage();
|
||||
$token = $storage->get($accessToken);
|
||||
if ($token==null) {
|
||||
$res['ret'] = 0;
|
||||
$res['msg'] = "token is null";
|
||||
return $this->echoJson($response, $res);
|
||||
}
|
||||
$user = User::find($token->userId);
|
||||
$time = 3600*24;
|
||||
Auth::login($user->id, $time);
|
||||
}
|
||||
return $response->withRedirect($url);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: kaguya
|
||||
* Date: 2017/11/30
|
||||
* Time: 16:59
|
||||
*/
|
||||
|
||||
namespace App\Controllers\Client;
|
||||
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Models\Code;
|
||||
use App\Models\Shop;
|
||||
use App\Services\Auth;
|
||||
use App\Utils\Pay;
|
||||
|
||||
class ClientShopController extends BaseController
|
||||
{
|
||||
public function GetShop($request, $response, $args){
|
||||
$user = Auth::getUser();
|
||||
//var_dump($user->isLogin);
|
||||
if(!$user->isLogin){
|
||||
return $response->withRedirect('/api/redirect?target=/client/shop');
|
||||
}
|
||||
$pageNum = 1;
|
||||
if (isset($request->getQueryParams()["page"])) {
|
||||
$pageNum = $request->getQueryParams()["page"];
|
||||
}
|
||||
$shops = Shop::where("status", 1)->paginate(15, ['*'], 'page', $pageNum);
|
||||
$shops->setPath('/user/shop');
|
||||
|
||||
return $this->view()->assign('shops', $shops)->display('client/shop.tpl');
|
||||
}
|
||||
|
||||
public function GetCode($request, $response, $args)
|
||||
{
|
||||
$user = Auth::getUser();
|
||||
//var_dump($user->isLogin);
|
||||
if(!$user->isLogin){
|
||||
return $response->withRedirect('/api/redirect?target=/client/code');
|
||||
}
|
||||
$pageNum = 1;
|
||||
if (isset($request->getQueryParams()["page"])) {
|
||||
$pageNum = $request->getQueryParams()["page"];
|
||||
}
|
||||
$codes = Code::where('type', '<>', '-2')->where('userid', '=', $user->id)->orderBy('id', 'desc')->paginate(15, ['*'], 'page', $pageNum);
|
||||
$codes->setPath('/user/code');
|
||||
return $this->view()->assign('codes', $codes)->assign('pmw', Pay::getHTML($user))->display('client/code.tpl');
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
<!-- js -->
|
||||
<script src="//cdn.staticfile.org/jquery/2.2.1/jquery.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/jquery-validate/1.15.0/jquery.validate.min.js"></script>
|
||||
<script src="//static.geetest.com/static/tools/gt.js"></script>
|
||||
|
||||
<script src="/theme/material/js/base.min.js"></script>
|
||||
<script src="/theme/material/js/project.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.5.16/clipboard.min.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,195 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="IE=edge" http-equiv="X-UA-Compatible">
|
||||
<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width" name="viewport">
|
||||
<meta name="theme-color" content="#ff9800">
|
||||
<title>{$config["appName"]}</title>
|
||||
|
||||
|
||||
|
||||
<!-- css -->
|
||||
<link href="/theme/material/css/base.min.css" rel="stylesheet">
|
||||
<link href="/theme/material/css/project.min.css" rel="stylesheet">
|
||||
<link href="//fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||
|
||||
|
||||
|
||||
<!-- favicon -->
|
||||
<!-- ... -->
|
||||
<style>
|
||||
.pagination {
|
||||
display:inline-block;
|
||||
padding-left:0;
|
||||
margin:20px 0;
|
||||
border-radius:4px
|
||||
}
|
||||
.pagination>li {
|
||||
display:inline
|
||||
}
|
||||
.pagination>li>a,.pagination>li>span {
|
||||
position:relative;
|
||||
float:left;
|
||||
padding:6px 12px;
|
||||
margin-left:-1px;
|
||||
line-height:1.42857143;
|
||||
color:#337ab7;
|
||||
text-decoration:none;
|
||||
background-color:#fff;
|
||||
border:1px solid #ddd
|
||||
}
|
||||
.pagination>li:first-child>a,.pagination>li:first-child>span {
|
||||
margin-left:0;
|
||||
border-top-left-radius:4px;
|
||||
border-bottom-left-radius:4px
|
||||
}
|
||||
.pagination>li:last-child>a,.pagination>li:last-child>span {
|
||||
border-top-right-radius:4px;
|
||||
border-bottom-right-radius:4px
|
||||
}
|
||||
.pagination>li>a:focus,.pagination>li>a:hover,.pagination>li>span:focus,.pagination>li>span:hover {
|
||||
color:#23527c;
|
||||
background-color:#eee;
|
||||
border-color:#ddd
|
||||
}
|
||||
.pagination>.active>a,.pagination>.active>a:focus,.pagination>.active>a:hover,.pagination>.active>span,.pagination>.active>span:focus,.pagination>.active>span:hover {
|
||||
z-index:2;
|
||||
color:#fff;
|
||||
cursor:default;
|
||||
background-color:#337ab7;
|
||||
border-color:#337ab7
|
||||
}
|
||||
.pagination>.disabled>a,.pagination>.disabled>a:focus,.pagination>.disabled>a:hover,.pagination>.disabled>span,.pagination>.disabled>span:focus,.pagination>.disabled>span:hover {
|
||||
color:#777;
|
||||
cursor:not-allowed;
|
||||
background-color:#fff;
|
||||
border-color:#ddd
|
||||
}
|
||||
.pagination-lg>li>a,.pagination-lg>li>span {
|
||||
padding:10px 16px;
|
||||
font-size:18px
|
||||
}
|
||||
.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span {
|
||||
border-top-left-radius:6px;
|
||||
border-bottom-left-radius:6px
|
||||
}
|
||||
.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span {
|
||||
border-top-right-radius:6px;
|
||||
border-bottom-right-radius:6px
|
||||
}
|
||||
.pagination-sm>li>a,.pagination-sm>li>span {
|
||||
padding:5px 10px;
|
||||
font-size:12px
|
||||
}
|
||||
.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span {
|
||||
border-top-left-radius:3px;
|
||||
border-bottom-left-radius:3px
|
||||
}
|
||||
.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span {
|
||||
border-top-right-radius:3px;
|
||||
border-bottom-right-radius:3px
|
||||
}
|
||||
.pager {
|
||||
padding-left:0;
|
||||
margin:20px 0;
|
||||
text-align:center;
|
||||
list-style:none
|
||||
}
|
||||
.pager li {
|
||||
display:inline
|
||||
}
|
||||
.pager li>a,.pager li>span {
|
||||
display:inline-block;
|
||||
padding:5px 14px;
|
||||
background-color:#fff;
|
||||
border:1px solid #ddd;
|
||||
border-radius:15px
|
||||
}
|
||||
.pager li>a:focus,.pager li>a:hover {
|
||||
text-decoration:none;
|
||||
background-color:#eee
|
||||
}
|
||||
.pager .next>a,.pager .next>span {
|
||||
float:right
|
||||
}
|
||||
.pager .previous>a,.pager .previous>span {
|
||||
float:left
|
||||
}
|
||||
.pager .disabled>a,.pager .disabled>a:focus,.pager .disabled>a:hover,.pager .disabled>span {
|
||||
color:#777;
|
||||
cursor:not-allowed;
|
||||
background-color:#fff
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.pagination>li>a,
|
||||
.pagination>li>span {
|
||||
border: 1px solid white;
|
||||
}
|
||||
.pagination>li.active>a {
|
||||
background: #f50057;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.pagination>li>a {
|
||||
background: white;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
|
||||
.pagination > .active > a, .pagination > .active > a:focus, .pagination > .active > a:hover, .pagination > .active > span, .pagination > .active > span:focus, .pagination > .active > span:hover {
|
||||
color: #fff;
|
||||
background-color: #000;
|
||||
border-color: #000;
|
||||
}
|
||||
|
||||
.pagination>.active>span {
|
||||
background-color: #f50057;
|
||||
color: #fff;
|
||||
border-color: #fff;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.pagination > .disabled > span {
|
||||
border-color: #fff;
|
||||
}
|
||||
|
||||
|
||||
pre {
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.progress-green .progress-bar {
|
||||
background-color: #f0231b;
|
||||
}
|
||||
|
||||
.progress-green {
|
||||
background-color: #000;
|
||||
}
|
||||
|
||||
.progress-green .progress-bar {
|
||||
background-color: #ff0a00;
|
||||
}
|
||||
|
||||
.page-orange .ui-content-header {
|
||||
background-image: url(/theme/material/css/images/bg/amber.jpg);
|
||||
}
|
||||
|
||||
.content-heading {
|
||||
font-weight: 300;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
<body class="page-orange">
|
||||
|
||||
Loading…
Reference in New Issue