Browse Source

article detail

master
林一峰 7 years ago
parent
commit
30805d498d
  1. 6
      app/Http/Controllers/Api/ArticleController.php
  2. 43
      app/Http/Controllers/Weixin/ArticleController.php
  3. 4
      app/Http/Controllers/Weixin/UserController.php
  4. 6
      app/Http/Model/Article.php
  5. 2
      app/Http/Model/Order.php
  6. 223
      lqycms.sql
  7. 6
      public/css/weixin/style.css
  8. 68
      resources/views/weixin/article/category.blade.php
  9. 19
      resources/views/weixin/article/detail.blade.php
  10. 8
      resources/views/weixin/index/index.blade.php
  11. 2
      resources/views/weixin/user/login.blade.php

6
app/Http/Controllers/Api/ArticleController.php

@ -20,7 +20,7 @@ class ArticleController extends CommonController
//参数
$data['limit'] = $request->input('limit', 10);
$data['offset'] = $request->input('offset', 0);
if($request->input('typeid', null) !== null){$data['typeid'] = $request->input('typeid');}
if($request->input('typeid', '') != ''){$data['typeid'] = $request->input('typeid');}
$data['ischeck'] = Article::IS_CHECK;
$res = Article::getList($data);
@ -51,8 +51,8 @@ class ArticleController extends CommonController
return ReturnData::create(ReturnData::SYSTEM_FAIL);
}
$res->pubdate = date('Y-m-d H:i',$res->pubdate);
$res->addtime = date('Y-m-d H:i',$res->addtime);
//$res->pubdate = date('Y-m-d H:i',$res->pubdate);
//$res->addtime = date('Y-m-d H:i',$res->addtime);
\DB::table('article')->where(array('id'=>$data['id']))->increment('click', 1);

43
app/Http/Controllers/Weixin/ArticleController.php

@ -14,6 +14,9 @@ class ArticleController extends CommonController
//列表页
public function category($cat)
{
$pagesize = 10;
$offset = 0;
//文章分类
$postdata = array(
'id' => $cat
@ -22,14 +25,34 @@ class ArticleController extends CommonController
$arctype_detail = curl_request($url,$postdata,'GET');
$data['post'] = $arctype_detail['data'];
if(isset($_REQUEST['page'])){$offset = ($_REQUEST['page']-1)*$pagesize;}
//文章列表
$postdata = array(
'limit' => 10,
'offset' => 0
$postdata2 = array(
'limit' => $pagesize,
'offset' => $offset,
'typeid' => $cat
);
$url = env('APP_API_URL')."/article_list";
$article_list = curl_request($url,$postdata,'GET');
$data['article_list'] = $article_list['data']['list'];
$res = curl_request($url,$postdata2,'GET');
$data['list'] = $res['data']['list'];
$data['totalpage'] = ceil($res['data']['count']/$pagesize);
if(isset($_REQUEST['page_ajax']) && $_REQUEST['page_ajax']==1)
{
$html = '';
if($res['data']['list'])
{
foreach($res['data']['list'] as $k => $v)
{
$html .= '<li><a href="'.$v['article_detail_url'].'">'.$v['title'].'</a><p>'.$v['pubdate'].'</p></li>';
}
}
exit(json_encode($html));
}
return view('weixin.article.category', $data);
}
@ -42,12 +65,12 @@ class ArticleController extends CommonController
'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'];
$res = curl_request($url,$postdata,'GET');
if(empty($res['data'])){return redirect()->route('weixin_page404');}
$res['data']['body'] = preg_replace('/src=\"\/uploads\/allimg/',"src=\"".env('APP_URL')."/uploads/allimg",$res['data']['body']);
$res['data']['pubdate'] = date('Y-m-d',$res['data']['pubdate']);
$data['post'] = $res['data'];
return view('weixin.article.detail', $data);
}
}

4
app/Http/Controllers/Weixin/UserController.php

@ -5,6 +5,7 @@ use App\Http\Controllers\Weixin\CommonController;
use Illuminate\Http\Request;
use App\Common\ReturnCode;
use App\Common\WechatAuth;
use App\Common\Helper;
class UserController extends CommonController
{
@ -465,7 +466,8 @@ class UserController extends CommonController
header('Location: '.route('weixin_user'));exit;
}
return view('weixin.user.login');
$data['isWechatBrowser'] = Helper::isWechatBrowser();
return view('weixin.user.login',$data);
}
//注册

6
app/Http/Model/Article.php

@ -98,7 +98,11 @@ class Article extends BaseModel
$where['id'] = $id;
if(isset($ischeck)){$where['ischeck'] = $ischeck;}
return self::where($where)->first();
$res = self::where($where)->first();
if($res){$res->type_name = Arctype::where('id', $res->typeid)->value('name');}
return $res;
}
public static function add(array $data)

2
app/Http/Model/Order.php

@ -66,7 +66,7 @@ class Order extends BaseModel
if($res['count']>0)
{
$order_list = $model->skip($offset)->take($limit)->get();
$order_list = $model->orderBy('id', 'desc')->skip($offset)->take($limit)->get();
if($order_list)
{

223
lqycms.sql
File diff suppressed because it is too large
View File

6
public/css/weixin/style.css

@ -69,7 +69,7 @@ background:none;
.goods_list li img{width:100%;height:48vw;}.goods_list li .goods_price{color:#f23030;}.goods_list li .goods_price b{font-size:1rem;font-weight:normal;}
.goods_list li:nth-child(even) a{margin-right:0;margin-left:2px;}
.goods_list_small{overflow:hidden;background-color:#f1f1f1;margin-left:10px;}.goods_list_small .goods_info{padding:5px 10px 5px 10px;}
.goods_list_small{overflow:hidden;background-color:#f1f1f1;margin-left:4px;}.goods_list_small .goods_info{padding:5px 10px 5px 10px;}
.goods_list_small li{margin-bottom:4px;width:50%;float:left;overflow:hidden;}
.goods_list_small li a{display:block;font-size:0.875em;margin-right:2px;background-color:#fff;}.goods_list_small .goods_tit{overflow:hidden;white-space:nowrap;color:#000}
.goods_list_small li img{width:100%;height:auto;}.goods_list_small li .goods_price{color:#f23030;}.goods_list_small li .goods_price b{font-size:1rem;font-weight:normal;}
@ -696,8 +696,8 @@ margin:5px 0
.setting .close a{display: block;background: #ec5151;text-align: center;padding:10px;color: #fff;font-size:18px;border-radius:2px;}
h1.arc_tit, h2.arc_tit{font-weight: normal;font-size: 1.4em;padding: 10px;}
.arc_content .ainfo{font-size: 0.875em;color: #999;}
.arc_content{line-height: 26px;}
.arc_content .ainfo{color:#999;}
.arc_content{line-height:26px;}
.arclist li{color:#333;border-bottom:1px solid #eee;overflow:hidden;margin-left:10px;margin-right:10px;padding-top:10px;padding-bottom:10px;line-height:24px;}
.arclist li a{color:#333;display:block;}.arclist li p{color:#999;font-size:14px;}.arclist li:last-child{border-bottom:0}

68
resources/views/weixin/article/category.blade.php

@ -12,12 +12,76 @@
@include('weixin.common.headerNav')
<div class="arc_list">
<?php if($list){ ?>
<ul class="arclist cl">
<?php if($article_list){foreach($article_list as $k=>$v){ ?>
<?php foreach($list as $k=>$v){ ?>
<li><a href="<?php echo $v['article_detail_url']; ?>"><?php echo $v['title']; ?></a><p><?php echo $v['pubdate']; ?></p></li>
<?php }} ?>
<?php } ?>
</ul>
<?php }else{ ?>
<div style="text-align:center;line-height:40px;color:#999;">暂无记录</div>
<?php } ?>
</div>
<script>
$(function(){
var ajaxload = false;
var maxpage = false;
var startpage = 1;
var totalpage = <?php echo $totalpage; ?>;
var tmp_url = window.location.href;
msg = tmp_url.split("#");
tmp_url = msg[0];
$(window).scroll(function ()
{
var listheight = $(".arclist").outerHeight();
if ($(document).scrollTop() + $(window).height() >= listheight)
{
if(startpage >= totalpage)
{
//$("#submit_bt_one").html("已是最后一页,没有更多数据!");
return false;
}
if(!ajaxload && !maxpage)
{
ajaxload = true;
//$("#submit_bt_one").html("努力加载中...");
var url = tmp_url;
var nextpage = startpage+1;
$.get(url,{page_ajax:1,page:nextpage},function(res)
{
if(res)
{
$(".arclist").append(res);
startpage++;
if(startpage >= totalpage)
{
maxpage = true;
//$("#submit_bt_one").html("已是最后一页,没有更多数据!");
}
else
{
//$("#submit_bt_one").html("点击加载更多");
}
ajaxload = false;
}
else
{
//$("#submit_bt_one").html("请求失败,请稍候再试!");
ajaxload = false;
}
},'json');
}
}
});
});
</script>
@include('weixin.common.footer')
</body></html>

19
resources/views/weixin/article/detail.blade.php

@ -14,22 +14,9 @@
<h1 class="arc_tit"><?php echo $post['title']; ?></h1>
<div class="arc_content box">
<div class="ainfo"><?php echo $post['pubdate']; ?></div>
<div>
查询新股配号主要有以下三点:</div>
<div>
&nbsp;</div>
<div>
1.到证券营业部进行查询。</div>
<div>
&nbsp;</div>
<div>
2.在申购日后的第三天投资者可通过网上进行新股配号的查询。</div>
<div>
&nbsp;</div>
<div>
3.客户还可以通过交易所的咨询电话进行查询:0755-2288800(深市),021-16893006(沪市)投资者所查到的配号是投资者在一个帐户上申购新股所得配号的起始号,其余配号依次顺延.</div>
<!-- <div class="arcnext cl">: <a class="red" href="" rel="prev"></a></div> --></div>
<div class="ainfo"><?php echo $post['pubdate']; ?> <a style="color:#ee5b03;" href="<?php echo route('weixin_article_category',array('cat'=>$post['typeid'])); ?>"><?php echo $post['type_name']; ?></a></div>
<?php echo $post['body']; ?>
<div class="arcnext cl mb10" style="margin-top:10px;color:#999;">阅读 <?php echo $post['click']; ?><!-- <a class="red" href="" rel="prev"></a> --></div></div>
@include('weixin.common.footer')
</body></html>

8
resources/views/weixin/index/index.blade.php

@ -137,7 +137,7 @@ var swiper = new Swiper('.swiper-nav', {
<!--猜您喜欢-start-->
<div class="floor guesslike">
<div class="banner_tit"><img src="<?php echo env('APP_URL'); ?>/images/weixin/ind_52.jpg" alt="猜您喜欢"/></div>
<div class="banner_tit">- 精品推荐 -</div>
<div class="likeshop">
<ul class="goods_list" id="goods_list">
<?php if($goods_list){foreach($goods_list as $k=>$v){ ?>
@ -150,7 +150,7 @@ var swiper = new Swiper('.swiper-nav', {
<!--猜您喜欢-start-->
<div class="floor guesslike">
<div class="banner_tit"><img src="<?php echo env('APP_URL'); ?>/images/weixin/ind_52.jpg" alt="猜您喜欢"/></div>
<div class="banner_tit">- 猜你喜欢 -</div>
<ul class="goods_list_s cl">
<?php if($goods_list){foreach($goods_list as $k=>$v){ ?>
<a href="<?php echo $v['goods_detail_url']; ?>"><li><span class="goods_thumb"><img alt="<?php echo $v['title']; ?>" src="<?php echo $v['litpic']; ?>"></span>
@ -163,6 +163,8 @@ var swiper = new Swiper('.swiper-nav', {
</ul>
</div>
<!--猜您喜欢-end-->
<style>
.banner_tit{font-size:18px;font-weight:400;background-color:#fff;color:#f23030;height:46px;line-height:46px;padding-left:10px;padding-right:10px;border-bottom:1px solid #eee;text-align:center;}
</style>
@include('weixin.common.footer')
</body></html>

2
resources/views/weixin/user/login.blade.php

@ -39,7 +39,7 @@
<a style="margin:10px;background-color:#1aad19;text-align:center;color:white;border:1px solid #179e16;" class="bottoma" href="javascript:submit();">登录</a>
</div>
<div class="box reg">
<a style="float:left;" href="<?php echo route('weixin_wxoauth'); ?>">微信登录</a> <span style="float:right;"><a href="<?php echo route('weixin_register'); ?>">快速注册</a> | <a href="">忘记密码?</a></span>
<?php if($isWechatBrowser){ ?><a style="float:left;" href="<?php echo route('weixin_wxoauth'); ?>">微信登录</a> <?php } ?><span style="float:right;"><a href="<?php echo route('weixin_register'); ?>">快速注册</a> | <a href="">忘记密码?</a></span>
</div><br><br>
<script type="text/javascript" src="<?php echo env('APP_URL'); ?>/js/md5.min.js"></script>
<script type="text/javascript" src="<?php echo env('APP_URL'); ?>/js/layer/mobile/layer.js"></script>

Loading…
Cancel
Save