Browse Source

微信分享

master
ZLW-PC\Administrator 7 years ago
parent
commit
cadd8bb4be
  1. 1
      app/Common/WechatAuth.php
  2. 2
      app/Http/Controllers/Api/UserRechargeController.php
  3. 8
      app/Http/Controllers/Weixin/CommonController.php
  4. 6
      app/Http/Controllers/Weixin/IndexController.php
  5. 7
      public/css/weixin/style.css
  6. 6
      resources/org/wxJsSdk/jssdk.php
  7. 2
      resources/views/weixin/article/detail.blade.php
  8. 7
      resources/views/weixin/cart/cartCheckout.blade.php
  9. 5
      resources/views/weixin/cart/index.blade.php
  10. 2
      resources/views/weixin/collect_goods/index.blade.php
  11. 4
      resources/views/weixin/common/footer.blade.php
  12. 7
      resources/views/weixin/common/wxshare.blade.php
  13. 22
      resources/views/weixin/index/index.blade.php
  14. 4
      resources/views/weixin/user/userBonusList.blade.php
  15. 10
      resources/views/weixin/user/userGoodsHistory.blade.php
  16. 8
      resources/views/weixin/user/userMoneyList.blade.php
  17. 8
      resources/views/weixin/user/userPointList.blade.php
  18. 4
      routes/web.php

1
app/Common/WechatAuth.php

@ -3,7 +3,6 @@ namespace App\Common;
/**
* OAuth2.0微信授权登录实现
*
*/
class WechatAuth
{

2
app/Http/Controllers/Api/UserRechargeController.php

@ -18,7 +18,7 @@ class UserRechargeController extends CommonController
public function userRechargeList(Request $request)
{
//参数
$data['limit'] = $request->input('limit', 10);
$data['limit'] = $request->input('limit', 10);
$data['offset'] = $request->input('offset', 0);
$data['status'] = $request->input('status', -1);

8
app/Http/Controllers/Weixin/CommonController.php

@ -2,12 +2,18 @@
namespace App\Http\Controllers\Weixin;
use App\Http\Controllers\Controller;
use App\Common\Helper;
class CommonController extends Controller
{
protected $isWechatBrowser;
public function __construct()
{
parent::__construct();
$this->isWechatBrowser = Helper::isWechatBrowser();
view()->share('isWechatBrowser', $this->isWechatBrowser);
}
/**
@ -63,4 +69,4 @@ class CommonController extends Controller
exit($str);
}
}
}
}

6
app/Http/Controllers/Weixin/IndexController.php

@ -21,6 +21,12 @@ class IndexController extends CommonController
//首页
public function index()
{
//分享到首页,把推荐id存下来
if(isset($_GET['parent_id']) && !empty($_GET['parent_id']))
{
$_SESSION['weixin_user_parent_id'] = intval($_GET['parent_id']);
}
//banner轮播图
$postdata = array(
'limit' => 5,

7
public/css/weixin/style.css

@ -74,11 +74,12 @@ background:none;
.goods_list_small li:nth-child(even) a{margin-right:0;margin-left:2px;}
.goods_list_s li{color:#333;border-bottom:1px solid #eee;overflow:hidden;margin-left:10px;margin-right:10px;padding:15px 5px 15px 5px;}
.goods_list_s li span{color:#333;display:block;font-size:1rem;}.goods_list_s a:last-child li{border-bottom:0}
.goods_list_s li .btn{color:#333;display:block;font-size:1rem;cursor:pointer;}.goods_list_s a:last-child li{border-bottom:0}
.goods_list_s .goods_thumb{width:100px;height:100px;float:left;margin-right:10px;display:block;}.goods_list_s .goods_thumb img{width:100px;height:100px;border:none;}
.goods_list_s .goods_tit{line-height:24px;overflow:hidden;}
.goods_list_s .goods_price{color:#f23030;}.goods_list_s .goods_price b{font-size:1rem;font-weight:normal;}
.goods_list_s .goods_des{color:#999999;font-size:0.875rem;}
.goods_list_s .buy{border:1px solid #f23030;border-radius:2px;padding:0 3px;color:#fff;background-color:#f23030;}
.classreturn{
background-color:#f8f8f8;
@ -292,9 +293,9 @@ margin:5px 0
.banner_headline .tit{border-top:1px dashed #dedede;text-align:center;margin:25px 0;}
.banner_headline .tit h4{color:#666666;background-color:#f1f1f1;font-size:18px;font-weight:normal;position:relative;top:-14px;display:inline;padding:0 20px;}
.radio .check_t i {background-position: -30px 0}
.radio .check_t i{background-position:-29px 0;}
.radio i {width:22px;height:22px;display: block;float: left;background-image: url("../../images/weixin/check.png");background-repeat: no-repeat;background-size: cover;background-position: 0}
.radio i{width:22px;height:22px;display: block;float: left;background-image: url("../../images/weixin/check.png");background-repeat: no-repeat;background-size: cover;background-position: 0}
.signup-find span,.radio span {font-size:24px;cursor: pointer}
.sc_list {

6
resources/org/wxJsSdk/jssdk.php

@ -122,12 +122,14 @@ class JSSDK
private function get_php_file($filename)
{
return trim(substr(file_get_contents($filename), 15));
//return trim(substr(file_get_contents($filename), 15)); //原版
return trim(substr(file_get_contents(resource_path('org/wxJsSdk/'.$filename)), 15)); //Laravel版
}
private function set_php_file($filename, $content)
{
$fp = fopen($filename, "w");
//$fp = fopen($filename, "w"); //原版
$fp = fopen(resource_path('org/wxJsSdk/'.$filename), "w"); //Laravel版
fwrite($fp, "<?php exit();?>" . $content);
fclose($fp);
}

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

@ -5,7 +5,7 @@
<meta name="keywords" content="<?php echo $post['keywords']; ?>"><meta name="description" content="<?php echo $post['description']; ?>"></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 tit center"><span>文章详情</span></div>
<div class="ds-in-bl nav_menu"><a href="javascript:void(0);"><img src="<?php echo env('APP_URL'); ?>/images/weixin/class1.png" alt="菜单"></a></div>
</div>

7
resources/views/weixin/cart/cartCheckout.blade.php

@ -15,14 +15,15 @@
<a href="/v2/index.php?m=default&amp;c=flow&amp;a=consignee_list&amp;u=53657">
<div class="checkout-addr">
<p class="title"><?php echo $user_default_address['name']; ?> <span><?php echo $user_default_address['mobile']; ?></span></p>
<!-- <p class="des">请添加收货地址</p> -->
<p class="title"><span class="name"><?php echo $user_default_address['name']; ?></span> <span class="tel"><?php echo $user_default_address['mobile']; ?></span></p>
<p class="des"><?php echo $user_default_address['province_name']; ?><?php echo $user_default_address['city_name']; ?><?php echo $user_default_address['district_name']; ?> <?php echo $user_default_address['address']; ?></p>
<i></i>
</div>
</a>
<style>
.checkout-addr{position: relative;/* border-top: 1px solid #e3e3e3;border-bottom: 1px solid #e3e3e3; */background: #fff;margin-top:10px;padding:10px;}
.checkout-addr p{margin-right:20px;}.checkout-addr .title{font-size:18px;margin-bottom:5px;}.checkout-addr .des{color:#666;}
.checkout-addr p{margin-right:20px;}.checkout-addr .title{font-size:18px;color:#353535;}.checkout-addr .des{color:#9b9b9b;}
.checkout-addr i{position: absolute;top: 50%;right:12px;margin-top:-6px;color:#bbb;display:inline-block;border-right:2px solid;border-bottom:2px solid;width:12px;height:12px;transform:rotate(-45deg);}
</style>
<ul class="goodslist">
@ -102,7 +103,7 @@ function update_pay_mode(sex)
<div class="floor" style="background-color:#fff;margin-top:10px;padding:10px;">
<div class="buy_note">
<div class="buy_note_tit"><span>备注</span></div>
<textarea name="message" rows="3"></textarea>
<textarea name="message" rows="3" placeholder="给卖家留言"></textarea>
</div>
<div class="order_check_info">
<p>共1件商品</p>

5
resources/views/weixin/cart/index.blade.php

@ -56,7 +56,7 @@
</div>
</div>
<!--商品列表-e-->
<?php } ?>
<!--提交栏-s-->
<div class="foohi foohiext">
<div class="payit ma-to-20 payallb">
@ -75,7 +75,6 @@
</div>
</div>
<!--提交栏-e-->
<?php } ?>
</div>
<?php }else{ ?>
<!--购物车没有商品-start-->
@ -251,7 +250,7 @@ function changeCartTotalPrice()
total_price = total_price + $('#goods_number'+goods_id).val() * $('#goods_price'+goods_id).text();
});
$('#total_fee').text(total_price);
$('#total_fee').text(total_price.toFixed(2));
}
</script>
</body></html>

2
resources/views/weixin/collect_goods/index.blade.php

@ -15,7 +15,7 @@
<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" onclick="del('<?php echo $v['goods_id']; ?>')">删除</span></p>
<p class="goods_des fr"><span class="btn" id="del_history" onclick="del('<?php echo $v['goods_id']; ?>')">删除</span></p>
</div></li>
<?php }} ?>
</ul>

4
resources/views/weixin/common/footer.blade.php

@ -9,4 +9,6 @@
<a href="<?php echo route('weixin_user'); ?>"><li<?php if(route('weixin_user') == $current_url){echo ' class="on"';} ?>><img src="<?php echo env('APP_URL'); ?>/images/weixin/center_icon<?php if(route('weixin_user') == $current_url){echo '2';} ?>.png"><p>个人中心</p></li></a></ul>
</div>
</div>
<!--底部导航-end-->
<!--底部导航-end-->
<?php if($isWechatBrowser){ ?>@include('weixin.common.wxshare')<?php } ?>

7
resources/views/weixin/common/wxshare.blade.php

@ -43,10 +43,9 @@ wx.ready(function () {
// config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
// 在这里调用 API
var title=document.title;
var desc=share_desc;
var url='{$shareurl}'; //分享链接
var img='{$shareimg}'; //分享图标
var subscribe='{$subscribe}'; //分享描述
var desc='<?php echo sysconfig('CMS_WXSHAER_DESC'); ?>'; //分享描述
var url='<?php echo sysconfig('CMS_WXSHAER_LINK'); ?>'; //分享链接
var img='<?php echo sysconfig('CMS_WXSHAER_IMGURL'); ?>'; //分享图标
// 分享给朋友
wx.onMenuShareAppMessage({

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

@ -152,24 +152,14 @@ var swiper = new Swiper('.swiper-nav', {
<div class="floor guesslike">
<div class="banner_tit"><img src="images/weixin/ind_52.jpg" alt="猜您喜欢"/></div>
<ul class="goods_list_s cl">
<a href="http://www.baidu.com"><li><span class="goods_thumb"><img alt="决定基金业绩的主要因素" src="images/weixin/goods_thumb_400_400.jpeg"></span>
<div class="goods_info"><p class="goods_tit">买基金要因素决定基金业绩的主要因素决定基金业绩的主要因素决定基金业绩的主要因素</p>
<p class="goods_price"><b>100.00</b></p>
<p class="goods_des">库存:10</p>
</div>
</li></a>
<a href="http://www.baidu.com"><li><span class="goods_thumb"><img alt="决定基金业绩的主要因素" src="images/weixin/goods_thumb_400_400.jpeg"></span>
<div class="goods_info"><p class="goods_tit">买基金的好处</p>
<p class="goods_price"><b>100.00</b></p>
<p class="goods_des">库存:10</p>
</div>
</li></a>
<a href="http://www.baidu.com"><li><span class="goods_thumb"><img alt="决定基金业绩的主要因素" src="images/weixin/goods_thumb_400_400.jpeg"></span>
<div class="goods_info"><p class="goods_tit">买基金的好处</p>
<p class="goods_price"><b>100.00</b></p>
<p class="goods_des">库存:10</p>
<?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>
<div class="goods_info"><p class="goods_tit"><?php echo $v['title']; ?></p>
<p class="goods_price"><b><?php echo $v['price']; ?></b></p>
<p class="goods_des">库存:<?php echo $v['goods_number']; ?><a href="<?php echo $v['goods_detail_url']; ?>"><span class="buy fr">立即抢购</span></a></p>
</div>
</li></a>
<?php }} ?>
</ul>
</div>
<!--猜您喜欢-end-->

4
resources/views/weixin/user/userBonusList.blade.php

@ -24,7 +24,9 @@
<p class="f-h-adr-con">有效期至<?php echo $v['bonus']['end_time']; ?> <span class="fr">满<?php echo $v['bonus']['min_amount']; ?>可用</span></p>
<!-- <div class="adr-edit-del">说明</div> -->
</div>
<?php }} ?>
<?php }}else{ ?>
<div style="text-align:center;line-height:40px;color:#999;">暂无记录</div>
<?php } ?>
</div>
<script>
$(function(){

10
resources/views/weixin/user/userGoodsHistory.blade.php

@ -11,15 +11,19 @@
<script type="text/javascript" src="<?php echo env('APP_URL'); ?>/js/layer/mobile/layer.js"></script>
<div class="floor">
<?php if($user_goods_history){ ?>
<ul class="goods_list_s cl">
<?php if($user_goods_history){foreach($user_goods_history as $k=>$v){ ?>
<?php 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" onclick="delconfirm('<?php echo route('weixin_user_goods_history_delete',array('id'=>$v['id'])); ?>')">删除</span></p>
<p class="goods_des fr"><span class="btn" id="del_history" onclick="delconfirm('<?php echo route('weixin_user_goods_history_delete',array('id'=>$v['id'])); ?>')">删除</span></p>
</div></li>
<?php }} ?>
<?php } ?>
</ul>
<?php }else{ ?>
<div style="text-align:center;line-height:40px;color:#999;">暂无记录</div>
<?php } ?>
</div>
<script>
$(function(){

8
resources/views/weixin/user/userMoneyList.blade.php

@ -17,15 +17,19 @@
.money_list span.green{color:#04ba06;}
</style>
<div class="floor">
<?php if($list){ ?>
<ul class="money_list cl">
<?php if($list){foreach($list as $k=>$v){ ?>
<?php foreach($list as $k=>$v){ ?>
<li>
<span <?php if($v['type']==0){echo 'class="green"';} ?>><?php if($v['type']==0){echo '+';}else{echo '-';} ?> <?php echo $v['money']; ?></span>
<div class="info"><p class="tit"><?php echo $v['des']; ?></p>
<p class="time"><?php echo date('Y-m-d H:i:s',$v['add_time']); ?></p></div>
</li>
<?php }} ?>
<?php } ?>
</ul>
<?php }else{ ?>
<div style="text-align:center;line-height:40px;color:#999;">暂无记录</div>
<?php } ?>
</div>
<script>
$(function(){

8
resources/views/weixin/user/userPointList.blade.php

@ -17,15 +17,19 @@
.money_list span.green{color:#f23030;}
</style>
<div class="floor">
<?php if($list){ ?>
<ul class="money_list cl">
<?php if($list){foreach($list as $k=>$v){ ?>
<?php foreach($list as $k=>$v){ ?>
<li>
<span <?php if($v['type']==0){echo 'class="green"';} ?>><?php if($v['type']==0){echo '+';}else{echo '-';} ?> <?php echo $v['point']; ?></span>
<div class="info"><p class="tit"><?php echo $v['des']; ?></p>
<p class="time"><?php echo date('Y-m-d H:i:s',$v['add_time']); ?></p></div>
</li>
<?php }} ?>
<?php } ?>
</ul>
<?php }else{ ?>
<div style="text-align:center;line-height:40px;color:#999;">暂无记录</div>
<?php } ?>
</div>
<script>
$(function(){

4
routes/web.php

@ -142,7 +142,9 @@ Route::group(['prefix' => 'dataapi', 'namespace' => 'Api', 'middleware' => ['web
Route::post('/user_info_update', 'UserController@userInfoUpdate'); //修改用户信息
Route::post('/user_password_update', 'UserController@userPasswordUpdate'); //修改用户密码、支付密码
Route::get('/user_list', 'UserController@userList'); //用户列表
//用户充值
Route::post('/user_recharge_add', 'UserMoneyController@userRechargeAdd'); //添加余额明细
//用户余额(钱包)
Route::get('/user_money_list', 'UserMoneyController@userMoneyList'); //用户余额明细
Route::post('/user_money_add', 'UserMoneyController@userMoneyAdd'); //添加余额明细
//浏览记录

Loading…
Cancel
Save