ZLW-PC\Administrator
7 years ago
18 changed files with 313 additions and 91 deletions
-
16app/Http/Controllers/Admin/GoodsController.php
-
86app/Http/Controllers/Api/UserGoodsHistoryController.php
-
53app/Http/Controllers/Weixin/ArticleController.php
-
54app/Http/Controllers/Weixin/CommonController.php
-
3app/Http/Controllers/Weixin/GoodsController.php
-
44app/Http/Controllers/Weixin/IndexController.php
-
20app/Http/Controllers/Weixin/UserController.php
-
17app/Http/Model/Goods.php
-
14app/Http/Model/UserGoodsHistory.php
-
1resources/views/admin/goods/edit.blade.php
-
0resources/views/weixin/article/category.blade.php
-
2resources/views/weixin/article/detail.blade.php
-
0resources/views/weixin/goods/goods.blade.php
-
0resources/views/weixin/goods/goodslist.blade.php
-
4resources/views/weixin/index/index.blade.php
-
47resources/views/weixin/index/jump.blade.php
-
29resources/views/weixin/user/userGoodsHistory.blade.php
-
14routes/web.php
@ -0,0 +1,86 @@ |
|||
<?php |
|||
namespace App\Http\Controllers\Api; |
|||
|
|||
use App\Http\Controllers\Api\CommonController; |
|||
use Illuminate\Http\Request; |
|||
use App\Common\ReturnData; |
|||
use App\Common\Token; |
|||
|
|||
use App\Http\Model\UserGoodsHistory; |
|||
|
|||
class UserGoodsHistoryController extends CommonController |
|||
{ |
|||
public function __construct() |
|||
{ |
|||
parent::__construct(); |
|||
} |
|||
|
|||
//我的足迹列表
|
|||
public function userGoodsHistoryList(Request $request) |
|||
{ |
|||
//参数
|
|||
$data['limit'] = $request->input('limit', 10); |
|||
$data['offset'] = $request->input('offset', 0); |
|||
|
|||
$data['user_id'] = Token::$uid; |
|||
|
|||
$res = UserGoodsHistory::getList($data); |
|||
if($res === false) |
|||
{ |
|||
return ReturnData::create(ReturnData::SYSTEM_FAIL); |
|||
} |
|||
|
|||
return ReturnData::create(ReturnData::SUCCESS,$res); |
|||
} |
|||
|
|||
//我的足迹添加
|
|||
public function userGoodsHistoryAdd(Request $request) |
|||
{ |
|||
//参数
|
|||
$data['goods_id'] = $request->input('goods_id',null); |
|||
$data['user_id'] = Token::$uid; |
|||
|
|||
if($data['goods_id']===null || $data['user_id']===null) |
|||
{ |
|||
return ReturnData::create(ReturnData::PARAMS_ERROR); |
|||
} |
|||
|
|||
$res = UserGoodsHistory::add($data); |
|||
if($res === false) |
|||
{ |
|||
return ReturnData::create(ReturnData::SYSTEM_FAIL); |
|||
} |
|||
|
|||
return ReturnData::create(ReturnData::SUCCESS,$res); |
|||
} |
|||
|
|||
//删除一条我的足迹
|
|||
public function userGoodsHistoryDelete(Request $request) |
|||
{ |
|||
//参数
|
|||
$id = $request->input('id',null); |
|||
|
|||
$res = UserGoodsHistory::remove($id,Token::$uid); |
|||
if($res === false) |
|||
{ |
|||
return ReturnData::create(ReturnData::SYSTEM_FAIL); |
|||
} |
|||
|
|||
return ReturnData::create(ReturnData::SUCCESS,$res); |
|||
} |
|||
|
|||
//清空我的足迹
|
|||
public function userGoodsHistoryClear(Request $request) |
|||
{ |
|||
//参数
|
|||
$user_id = Token::$uid; |
|||
|
|||
$res = UserGoodsHistory::remove($user_id); |
|||
if($res === false) |
|||
{ |
|||
return ReturnData::create(ReturnData::SYSTEM_FAIL); |
|||
} |
|||
|
|||
return ReturnData::create(ReturnData::SUCCESS,$res); |
|||
} |
|||
} |
@ -0,0 +1,53 @@ |
|||
<?php |
|||
namespace App\Http\Controllers\Weixin; |
|||
|
|||
use App\Http\Controllers\Weixin\CommonController; |
|||
use Illuminate\Http\Request; |
|||
|
|||
class ArticleController extends CommonController |
|||
{ |
|||
public function __construct() |
|||
{ |
|||
parent::__construct(); |
|||
} |
|||
|
|||
//列表页
|
|||
public function category($cat) |
|||
{ |
|||
//文章分类
|
|||
$postdata = array( |
|||
'id' => $cat |
|||
); |
|||
$url = env('APP_API_URL')."/arctype_detail"; |
|||
$arctype_detail = curl_request($url,$postdata,'GET'); |
|||
$data['post'] = $arctype_detail['data']; |
|||
|
|||
//文章列表
|
|||
$postdata = array( |
|||
'limit' => 10, |
|||
'offset' => 0 |
|||
); |
|||
$url = env('APP_API_URL')."/article_list"; |
|||
$article_list = curl_request($url,$postdata,'GET'); |
|||
$data['article_list'] = $article_list['data']['list']; |
|||
|
|||
return view('weixin.article.category', $data); |
|||
} |
|||
|
|||
//文章详情页
|
|||
public function detail($id) |
|||
{ |
|||
//最新资讯
|
|||
$postdata = array( |
|||
'id' => $id |
|||
); |
|||
$url = env('APP_API_URL')."/article_detail"; |
|||
$article_detail = curl_request($url,$postdata,'GET'); |
|||
if(empty($article_detail['data'])){return redirect()->route('weixin_page404');} |
|||
$article_detail['data']['body'] = preg_replace('/src=\"\/uploads\/allimg/',"src=\"".env('APP_URL')."/uploads/allimg",$article_detail['data']['body']); |
|||
$data['post'] = $article_detail['data']; |
|||
|
|||
return view('weixin.article.detail', $data); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,47 @@ |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|||
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
|||
<title>跳转提示</title> |
|||
<style type="text/css"> |
|||
*{ padding: 0; margin: 0; } |
|||
body{ background: #fff; font-family: '微软雅黑'; color: #333; font-size: 16px; }
|
|||
.system-message{padding: 24px 48px;margin:5% auto 0 auto;width:600px;} |
|||
.system-message h1{ font-size: 100px; font-weight: normal; line-height: 120px; margin-bottom: 12px; } |
|||
.system-message .jump{ padding-top: 10px} |
|||
.system-message .jump a{ color: #333;}
|
|||
.system-message .success,.system-message .error{ line-height: 1.8em; font-size: 36px } |
|||
.system-message .detail{ font-size: 12px; line-height: 20px; margin-top: 12px; display:none} |
|||
</style> |
|||
</head><body> |
|||
<?php |
|||
/** 参数说明 |
|||
* $_REQUEST['message']; //成功提示
|
|||
* $_REQUEST['error']; //失败提示
|
|||
* $_REQUEST['url']; //要跳转到哪里
|
|||
* $_REQUEST['time']; //几秒后跳转
|
|||
*/ |
|||
?>
|
|||
<div class="system-message"> |
|||
<?php if(isset($_REQUEST['message'])) { ?>
|
|||
<h1>:)</h1> |
|||
<p class="success"><?php echo $_REQUEST['message']; ?></p>
|
|||
<?php }elseif(isset($_REQUEST['error'])){ ?>
|
|||
<h1>:(</h1> |
|||
<p class="error"><?php echo $_REQUEST['error']; ?></p>
|
|||
<?php } ?>
|
|||
<p class="detail"></p> |
|||
<p class="jump">页面自动 <a id="href" href="<?php if(isset($_REQUEST['url'])){ echo $_REQUEST['url']; } ?>">跳转</a> 等待时间: <b id="wait"><?php if(isset($_REQUEST['time'])){ echo $_REQUEST['time']; } ?></b></p>
|
|||
</div> |
|||
<script type="text/javascript"> |
|||
(function(){ |
|||
var wait = document.getElementById('wait'),href = document.getElementById('href').href; |
|||
var interval = setInterval(function(){ |
|||
var time = --wait.innerHTML; |
|||
if(time <= 0) |
|||
{ |
|||
location.href = href; |
|||
clearInterval(interval); |
|||
}; |
|||
}, 1000); |
|||
})(); |
|||
</script> |
|||
</body></html> |
@ -1,33 +1,22 @@ |
|||
<!DOCTYPE html><html><head><meta http-equiv="content-type" content="text/html;charset=utf-8"/> |
|||
<title>商城</title><meta name="keywords" content="关键词"><meta name="description" content="描述"><meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport"> |
|||
<title>我的足迹</title><meta name="keywords" content="关键词"><meta name="description" content="描述"><meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport"> |
|||
<link href="<?php echo env('APP_URL'); ?>/css/weixin/style.css" type="text/css" rel="stylesheet"> |
|||
<script type="text/javascript" src="<?php echo env('APP_URL'); ?>/js/jquery.min.js"></script></head><body> |
|||
<div class="classreturn loginsignup"> |
|||
<div class="ds-in-bl return"><a href="javascript:history.back(-1);"><img src="<?php echo env('APP_URL'); ?>/images/weixin/return.png" alt="返回"></a></div> |
|||
<div class="ds-in-bl tit center"><span>我的足迹</span></div> |
|||
<div class="ds-in-bl nav_menu"><a href="javascript:void(0);" style="color:#999;">清空</a></div> |
|||
<div class="ds-in-bl nav_menu"><a href="javascript:void(0);" style="color:#999;" id="clear_history">清空</a></div> |
|||
</div> |
|||
|
|||
<div class="floor"> |
|||
<ul class="goods_list_s cl"> |
|||
<li><a href="http://www.baidu.com"><span class="goods_thumb"><img alt="决定基金业绩的主要因素" src="<?php echo env('APP_URL'); ?>/images/weixin/goods_thumb_400_400.jpeg"></span></a> |
|||
<div class="goods_info"><p class="goods_tit">买基金要因素决定基金业绩的主要因素决定基金业绩的主要因素决定基金业绩的主要因素</p> |
|||
<p class="goods_price">¥<b>100.00</b></p> |
|||
<p class="goods_des fr">删除</p> |
|||
</div> |
|||
</li> |
|||
<li><a href="http://www.baidu.com"><span class="goods_thumb"><img alt="决定基金业绩的主要因素" src="<?php echo env('APP_URL'); ?>/images/weixin/goods_thumb_400_400.jpeg"></span></a> |
|||
<div class="goods_info"><p class="goods_tit">买基金要因素决定基金业绩的主要因素决定基金业绩的主要因素决定基金业绩的主要因素</p> |
|||
<p class="goods_price">¥<b>100.00</b></p> |
|||
<p class="goods_des fr">删除</p> |
|||
</div> |
|||
</li> |
|||
<li><a href="http://www.baidu.com"><span class="goods_thumb"><img alt="决定基金业绩的主要因素" src="<?php echo env('APP_URL'); ?>/images/weixin/goods_thumb_400_400.jpeg"></span></a> |
|||
<div class="goods_info"><p class="goods_tit">买基金要因素决定基金业绩的主要因素决定基金业绩的主要因素决定基金业绩的主要因素</p> |
|||
<p class="goods_price">¥<b>100.00</b></p> |
|||
<p class="goods_des fr">删除</p> |
|||
</div> |
|||
</li> |
|||
<?php if($user_goods_history){foreach($user_goods_history as $k=>$v){ ?>
|
|||
<li><a href="<?php echo $v['goods']['goods_detail_url']; ?>"><span class="goods_thumb"><img alt="<?php echo $v['goods']['title']; ?>" src="<?php echo env('APP_URL'); ?><?php echo $v['goods']['litpic']; ?>"></span></a> |
|||
<div class="goods_info"><p class="goods_tit"><?php echo $v['goods']['title']; ?></p>
|
|||
<p class="goods_price">¥<b><?php echo $v['goods']['price']; ?></b></p>
|
|||
<p class="goods_des fr"><span id="del_history">删除</span></p> |
|||
</div></li> |
|||
<?php }} ?>
|
|||
</ul> |
|||
</div> |
|||
|
|||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue