From 2f2d2cbd5d16dc76d1e6475d8e149f31b6cd63b6 Mon Sep 17 00:00:00 2001
From: "ZLW-PC\\Administrator" <374861669@qq.com>
Date: Fri, 10 Nov 2017 17:36:05 +0800
Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E8=87=AA=E5=AE=9A=E4=B9=89?=
=?UTF-8?q?=E8=8F=9C=E5=8D=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/Common/WechatCallbackApi.php | 169 +++++++++++++++
app/Common/WechatMenu.php | 76 +++++++
.../Admin/WeixinMenuController.php | 203 ++++++++++++++++++
.../Controllers/Weixin/UserController.php | 8 +
app/Http/Model/Arctype.php | 2 +-
app/Http/Model/WeixinMenu.php | 181 ++++++++++++++++
public/css/weixin/style.css | 79 ++-----
.../views/admin/WeixinMenu/add.blade.php | 86 ++++++++
.../views/admin/WeixinMenu/edit.blade.php | 82 +++++++
.../views/admin/WeixinMenu/index.blade.php | 32 +++
.../views/weixin/goods/goodsDetail.blade.php | 31 ++-
resources/views/weixin/user/index.blade.php | 6 +-
routes/web.php | 8 +
13 files changed, 890 insertions(+), 73 deletions(-)
create mode 100644 app/Common/WechatCallbackApi.php
create mode 100644 app/Common/WechatMenu.php
create mode 100644 app/Http/Controllers/Admin/WeixinMenuController.php
create mode 100644 app/Http/Model/WeixinMenu.php
create mode 100644 resources/views/admin/WeixinMenu/add.blade.php
create mode 100644 resources/views/admin/WeixinMenu/edit.blade.php
create mode 100644 resources/views/admin/WeixinMenu/index.blade.php
diff --git a/app/Common/WechatCallbackApi.php b/app/Common/WechatCallbackApi.php
new file mode 100644
index 0000000..0fef54d
--- /dev/null
+++ b/app/Common/WechatCallbackApi.php
@@ -0,0 +1,169 @@
+checkSignature())
+ {
+ echo $echoStr;
+ exit;
+ }
+ }
+
+ private function checkSignature()
+ {
+ $signature = $_GET["signature"];
+ $timestamp = $_GET["timestamp"];
+ $nonce = $_GET["nonce"];
+
+ $token = TOKEN;
+ $tmpArr = array($token, $timestamp, $nonce);
+ sort($tmpArr);
+ $tmpStr = implode( $tmpArr );
+ $tmpStr = sha1( $tmpStr );
+
+ if( $tmpStr == $signature )
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public function responseMsg()
+ {
+ $postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
+ if (!empty($postStr))
+ {
+ $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
+ $RX_TYPE = trim($postObj->MsgType);
+
+ switch ($RX_TYPE)
+ {
+ case "text":
+ $resultStr = $this->receiveText($postObj);
+ break;
+ case "event":
+ $resultStr = $this->receiveEvent($postObj);
+ break;
+ default:
+ $resultStr = "";
+ break;
+ }
+
+ echo $resultStr;
+ }
+ else
+ {
+ echo "";
+ exit;
+ }
+ }
+
+ private function receiveText($object)
+ {
+ $funcFlag = 0;
+ $contentStr = "你发送的内容为:".$object->Content;
+ $resultStr = $this->transmitText($object, $contentStr, $funcFlag);
+ return $resultStr;
+ }
+
+ private function receiveEvent($object)
+ {
+ $contentStr = "";
+ switch ($object->Event)
+ {
+ case "subscribe":
+ $contentStr = "欢迎洋洋博客";
+ case "unsubscribe":
+ break;
+ case "CLICK":
+ switch ($object->EventKey)
+ {
+ case "company":
+ $contentStr[] = array("Title" =>"公司简介",
+ "Description" =>"洋洋的博客",
+ "PicUrl" =>"http://discuz.comli.com/weixin/weather/icon/cartoon.jpg",
+ "Url" =>"weixin://addfriend/pondbaystudio");
+ break;
+ default:
+ $contentStr[] = array("Title" =>"默认菜单回复",
+ "Description" =>"您正在使用的是洋洋的博客",
+ "PicUrl" =>"http://discuz.comli.com/weixin/weather/icon/cartoon.jpg",
+ "Url" =>"weixin://addfriend/pondbaystudio");
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (is_array($contentStr))
+ {
+ $resultStr = $this->transmitNews($object, $contentStr);
+ }
+ else
+ {
+ $resultStr = $this->transmitText($object, $contentStr);
+ }
+
+ return $resultStr;
+ }
+
+ private function transmitText($object, $content, $funcFlag = 0)
+ {
+ $textTpl = "
+
+
+ %s
+
+
+ %d
+ ";
+
+ $resultStr = sprintf($textTpl, $object->FromUserName, $object->ToUserName, time(), $content, $funcFlag);
+
+ return $resultStr;
+ }
+
+ private function transmitNews($object, $arr_item, $funcFlag = 0)
+ {
+ //首条标题28字,其他标题39字
+ if(!is_array($arr_item))
+ return;
+
+ $itemTpl = "-
+
+
+
+
+
+ ";
+ $item_str = "";
+ foreach ($arr_item as $item)
+ $item_str .= sprintf($itemTpl, $item['Title'], $item['Description'], $item['PicUrl'], $item['Url']);
+
+ $newsTpl = "
+
+
+ %s
+
+
+ %s
+
+ $item_str
+ %s
+ ";
+
+ $resultStr = sprintf($newsTpl, $object->FromUserName, $object->ToUserName, time(), count($arr_item), $funcFlag);
+ return $resultStr;
+ }
+}
\ No newline at end of file
diff --git a/app/Common/WechatMenu.php b/app/Common/WechatMenu.php
new file mode 100644
index 0000000..2fb4c70
--- /dev/null
+++ b/app/Common/WechatMenu.php
@@ -0,0 +1,76 @@
+开发者模式->获取
+ private $app_id;
+ private $app_secret;
+ private $access_token;
+ private $expires_in;
+
+ public function __construct($app_id, $app_secret)
+ {
+ $this->app_id = $app_id;
+ $this->app_secret = $app_secret;
+
+ $token = $this->get_access_token();
+ $this->access_token = $token['access_token'];
+ $this->expires_in = $token['expires_in'];
+ }
+
+ /**
+ * 获取授权access_token
+ *
+ */
+ public function get_access_token()
+ {
+ $token_url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$this->app_id}&secret={$this->app_secret}";
+ $token_data = $this->http($token_url);
+
+ return json_decode($token_data, true);
+ }
+
+ //获取关注者列表
+ public function get_user_list($next_openid = NULL)
+ {
+ $url = "https://api.weixin.qq.com/cgi-bin/user/get?access_token=".$this->access_token."&next_openid=".$next_openid;
+ $res = $this->http($url);
+ return json_decode($res, true);
+ }
+
+ /**
+ * 自定义菜单创建
+ *
+ * @param string $jsonmenu
+ */
+ public function create_menu($jsonmenu)
+ {
+ $url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=".$this->access_token;
+ return $this->http($url, $jsonmenu);
+ }
+
+ // cURL函数简单封装
+ public function http($url, $data = null)
+ {
+ $curl = curl_init();
+ curl_setopt($curl, CURLOPT_URL, $url);
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
+ curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
+
+ if (!empty($data))
+ {
+ curl_setopt($curl, CURLOPT_POST, 1);
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
+ }
+
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+ $output = curl_exec($curl);
+ curl_close($curl);
+
+ return $output;
+ }
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/Admin/WeixinMenuController.php b/app/Http/Controllers/Admin/WeixinMenuController.php
new file mode 100644
index 0000000..c110d0d
--- /dev/null
+++ b/app/Http/Controllers/Admin/WeixinMenuController.php
@@ -0,0 +1,203 @@
+-1));
+
+ $data['catlist'] = $catlist;
+ return view('admin.WeixinMenu.index', $data);
+ }
+
+ public function add()
+ {
+ if(!empty($_GET["reid"]))
+ {
+ $id = $_GET["reid"];
+ if(preg_match('/[0-9]*/',$id)){}else{exit;}
+ if($id!=0)
+ {
+ $data['postone'] = object_to_array(DB::table("weixin_menu")->where('id', $id)->first(), 1);
+ }
+
+ $data['id'] = $id;
+ }
+ else
+ {
+ $data['id'] = 0;
+ }
+
+ return view('admin.WeixinMenu.add', $data);
+ }
+
+ public function doadd()
+ {
+ if(!empty($_POST["prid"])){if($_POST["prid"]=="top"){$_POST['pid']=0;}else{$_POST['pid'] = $_POST["prid"];}}//父级栏目id
+ $_POST['addtime'] = time();//添加时间
+ unset($_POST["prid"]);
+ unset($_POST["_token"]);
+
+ if(DB::table('weixin_menu')->insert(array_filter($_POST)))
+ {
+ success_jump('添加成功!');
+ }
+ else
+ {
+ error_jump('添加失败!请修改后重新添加');
+ }
+ }
+
+ public function edit()
+ {
+ $id = $_GET["id"];if(preg_match('/[0-9]*/',$id)){}else{exit;}
+
+ $data['id'] = $id;
+ $post = object_to_array(DB::table('weixin_menu')->where('id', $id)->first(), 1);
+ $reid = $post['pid'];
+ if($reid!=0){$data['postone'] = object_to_array(DB::table('weixin_menu')->where('id', $reid)->first());}
+
+ $data['post'] = $post;
+
+ return view('admin.WeixinMenu.edit', $data);
+ }
+
+ public function doedit()
+ {
+ if(!empty($_POST["id"])){$id = $_POST["id"];unset($_POST["id"]);}else {$id="";exit;}
+ $_POST['addtime'] = time(); //添加时间
+ unset($_POST["_token"]);
+
+ if(DB::table('weixin_menu')->where('id', $id)->update(array_filter($_POST)))
+ {
+ success_jump('修改成功!', route('admin_weixinmenu'));
+ }
+ else
+ {
+ error_jump('修改失败!请修改后重新添加');
+ }
+ }
+
+ public function del()
+ {
+ if(!empty($_REQUEST["id"])){$id = $_REQUEST["id"];}else{error_jump('删除失败!请重新提交');} //if(preg_match('/[0-9]*/',$id)){}else{exit;}
+
+ if(DB::table('weixin_menu')->where('pid', $id)->first())
+ {
+ error_jump('删除失败!请先删除子栏目');
+ }
+ else
+ {
+ if(DB::table('weixin_menu')->where('id', $id)->delete())
+ {
+ success_jump('删除成功');
+ }
+ else
+ {
+ error_jump('删除失败!请重新提交');
+ }
+ }
+ }
+
+ public function createmenu()
+ {
+ $catlist = WeixinMenu::getList(array('is_show'=>-1));
+
+ $wechat_menu = new WechatMenu(sysconfig('CMS_WX_APPID'),sysconfig('CMS_WX_APPSECRET'));
+
+ /* $menu = array(
+ 'button'=>array();
+ ); */
+
+ $jsonmenu = '
+ {
+ "button":[
+ {
+ "name":"篮球",
+ "sub_button":[
+ {
+ "type":"click",
+ "name":"nba",
+ "key":"V1001_NBA"
+ },
+ {
+ "type":"click",
+ "name":"cba",
+ "key":"V1001_CBA"
+ }
+ ]
+ },
+ {
+ "name":"体育",
+ "sub_button":[
+ {
+ "type":"view",
+ "name":"url",
+ "url":"http://m.hao123.com/a/tianqi"
+ },
+ {
+ "type":"click",
+ "name":"排球",
+ "key":"V1001_PAIQIU"
+ },
+ {
+ "type":"click",
+ "name":"网球",
+ "key":"V1001_WANGQIU"
+ },
+ {
+ "type":"click",
+ "name":"乒乓球",
+ "key":"V1001_PPQ"
+ },
+ {
+ "type":"click",
+ "name":"台球",
+ "key":"V1001_TAIQIU"
+ }
+ ]
+ },
+ {
+ "name":"新闻",
+ "sub_button":[
+ {
+ "type":"click",
+ "name":"国内新闻",
+ "key":"V1001_GNNEWS"
+ },
+ {
+ "type":"click",
+ "name":"国际新闻",
+ "key":"V1001_GJNEWS"
+ },
+ {
+ "type":"click",
+ "name":"地方新闻",
+ "key":"V1001_AREANEWS"
+ },
+ {
+ "type":"click",
+ "name":"家庭新闻",
+ "key":"V1001_HOMENEWS"
+ }
+ ]
+ }
+ ]
+ }';
+
+ $wechat_menu->create_menu($jsonmenu);
+
+ success_jump('修改菜单,生成后,不会立即显示,有24小时的缓存,除非你取消关注,然后重新关注!', route('admin_weixinmenu'),5);
+ }
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/Weixin/UserController.php b/app/Http/Controllers/Weixin/UserController.php
index 2c423a9..f8fb25d 100644
--- a/app/Http/Controllers/Weixin/UserController.php
+++ b/app/Http/Controllers/Weixin/UserController.php
@@ -435,6 +435,9 @@ class UserController extends CommonController
header('Location: '.route('weixin_user'));exit;
}
+ $return_url = '';
+ if(isset($_REQUEST['return_url']) && !empty($_REQUEST['return_url'])){$return_url = $_SESSION['weixin_history_back_url'] = $_REQUEST['return_url'];}
+
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
if($_POST['user_name'] == '')
@@ -458,6 +461,7 @@ class UserController extends CommonController
$_SESSION['weixin_user_info'] = $res['data'];
+ if($return_url != ''){header('Location: '.$return_url);exit;}
header('Location: '.route('weixin_user'));exit;
}
@@ -473,6 +477,10 @@ class UserController extends CommonController
header('Location: '.route('weixin_user'));exit;
}
+ $return_url = '';
+ if(isset($_REQUEST['return_url']) && !empty($_REQUEST['return_url'])){$_SESSION['weixin_history_back_url'] = $_REQUEST['return_url'];}
+ if(isset($_REQUEST['parent_id']) && !empty($_REQUEST['parent_id'])){$_SESSION['weixin_user_parent_id'] = $_REQUEST['parent_id'];} //推荐人id存在session,首页入口也存了一次
+
return view('weixin.user.register');
}
diff --git a/app/Http/Model/Arctype.php b/app/Http/Model/Arctype.php
index ca3b549..bc8d0c3 100644
--- a/app/Http/Model/Arctype.php
+++ b/app/Http/Model/Arctype.php
@@ -131,4 +131,4 @@ class Arctype extends Model
return true;
}
-}
+}
\ No newline at end of file
diff --git a/app/Http/Model/WeixinMenu.php b/app/Http/Model/WeixinMenu.php
new file mode 100644
index 0000000..507a0bc
--- /dev/null
+++ b/app/Http/Model/WeixinMenu.php
@@ -0,0 +1,181 @@
+orderBy('listorder', 'asc')->get();
+
+ if($list)
+ {
+ foreach($list as $k=>$v)
+ {
+ $res[] = $v;
+ $child = self::where(array('pid'=>$list[$k]->id,'is_show'=>self::IS_SHOW))->orderBy('listorder', 'asc')->get();
+
+ if($child)
+ {
+ foreach($child as $key=>$value)
+ {
+ $res[] = $value;
+ }
+ }
+ }
+ }
+ else
+ {
+ return false;
+ }
+
+ return $res;
+ }
+
+ public static function getOne($where)
+ {
+ return self::where($where)->first();
+ }
+
+ public static function add(array $data)
+ {
+ if ($id = self::insertGetId($data))
+ {
+ return $id;
+ }
+
+ return false;
+ }
+
+ public static function modify($where, array $data)
+ {
+ if (self::where($where)->update($data) === false)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ //删除一条记录
+ public static function remove($id)
+ {
+ if (!self::whereIn('id', explode(',', $id))->delete())
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ //删除一条记录
+ public static function getWeixinMenuJson()
+ {
+ $where['pid'] = 0;
+ $where['is_show'] = self::IS_SHOW;
+ $list = self::where($where)->orderBy('listorder', 'asc')->get();
+
+ $res='';
+ if($list)
+ {
+ foreach($list as $k=>$v)
+ {
+ $child = self::where(array('pid'=>$list[$k]->id,'is_show'=>self::IS_SHOW))->orderBy('listorder', 'asc')->get();
+
+ if($child)
+ {
+ $temp_child='';
+ foreach($child as $key=>$value)
+ {
+ if($value->type == 'click')
+ {
+ $temp_child[] = array(
+ 'type'=>$value->type,
+ 'name'=>$value->name,
+ 'key'=>$value->key
+ );
+ }
+ elseif($value->type == 'view')
+ {
+ $temp_child[] = array(
+ 'type'=>$value->type,
+ 'name'=>$value->name,
+ 'url'=>$value->key
+ );
+ }
+ elseif($value->type == 'miniprogram')
+ {
+ $temp_child[] = array(
+ 'type'=>$value->type,
+ 'name'=>$value->name,
+ 'url'=>$value->key,
+ 'appid'=>$value->appid,
+ 'pagepath'=>$value->pagepath
+ );
+ }
+ }
+
+ $res[] = array(
+ 'name'=>$value->name,
+ 'sub_button'=>$temp_child
+ );
+ }
+ else
+ {
+ if($v->type == 'click')
+ {
+ $res[] = array(
+ 'type'=>$v->type,
+ 'name'=>$v->name,
+ 'key'=>$v->key
+ );
+ }
+ elseif($v->type == 'view')
+ {
+ $res[] = array(
+ 'type'=>$v->type,
+ 'name'=>$v->name,
+ 'url'=>$v->key
+ );
+ }
+ elseif($v->type == 'miniprogram')
+ {
+ $res[] = array(
+ 'type'=>$v->type,
+ 'name'=>$v->name,
+ 'url'=>$v->key,
+ 'appid'=>$v->appid,
+ 'pagepath'=>$v->pagepath
+ );
+ }
+ }
+ }
+ }
+
+ return json_encode($res);
+ }
+}
\ No newline at end of file
diff --git a/public/css/weixin/style.css b/public/css/weixin/style.css
index a906a3b..92cbea5 100644
--- a/public/css/weixin/style.css
+++ b/public/css/weixin/style.css
@@ -81,73 +81,18 @@ background:none;
.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;
-border-bottom:1px solid #dedede;
-position:relative;
-text-align:center;
-line-height:50px;
-padding:0 10px;
-}
-
-.classreturn .return{
-position:absolute;
-left:15px
-}
-
-.classreturn .return a{
-overflow:hidden;
-display:block
-}
-
-.classreturn .return a img{
-width:12px;
-height:22px
-}
-
-.classreturn .tit{
-font-size:1.125rem;
-}
-
-.classreturn .tit .sear-input{
-width:12.544rem;
-height:1.23733rem
-}
-
-.classreturn .tit .sear-input a{
-display:block
-}
-
-.classreturn .tit .sear-input input{
-border:0;
-width:100%;
-height:1.23733rem;
-color:#666666;
-outline:none;
-padding:0 .21333rem;
-font-size:.59733rem;
-display:inherit
-}
-
-.classreturn .nav_menu{
-position:absolute;
-right:15px
-}
-
-.classreturn .nav_menu a{
-display:block
-}
-
-.classreturn .nav_menu img{
-width:20px
-}
-.ds-in-bl{
-display:inline-block;
-vertical-align:middle;
-*vertical-align:auto;
-*zoom:1;
-*display:inline
-}
+.classreturn{background-color:#f8f8f8;border-bottom:1px solid #dedede;position:relative;text-align:center;line-height:50px;padding:0 10px;}
+.classreturn .return{position:absolute;left:15px}
+.classreturn .return a{overflow:hidden;display:block}
+.classreturn .return a img{width:12px;height:22px}
+.classreturn .tit{font-size:1.125rem;}
+.classreturn .tit .sear-input{width:12.544rem;height:1.23733rem}
+.classreturn .tit .sear-input a{display:block}
+.classreturn .tit .sear-input input{border:0;width:100%;height:1.23733rem;color:#666666;outline:none;padding:0 .21333rem;font-size:.59733rem;display:inherit}
+.classreturn .nav_menu{position:absolute;right:15px}
+.classreturn .nav_menu a{display:block;color:#999;}
+.classreturn .nav_menu img{width:20px}
+.ds-in-bl{display:inline-block;vertical-align:middle;*vertical-align:auto;*zoom:1;*display:inline}
.tpnavf{display:none;}
.tpnavf .nav_list{-moz-box-shadow:0 0 0 0 rgba(255,255,255,0);-webkit-box-shadow:0 0 0 0 rgba(255,255,255,0);box-shadow:0 0 0 0 rgba(255,255,255,0);border-bottom:1px solid #f0f2f5;background-color:#404042;}
diff --git a/resources/views/admin/WeixinMenu/add.blade.php b/resources/views/admin/WeixinMenu/add.blade.php
new file mode 100644
index 0000000..e03e1e2
--- /dev/null
+++ b/resources/views/admin/WeixinMenu/add.blade.php
@@ -0,0 +1,86 @@
+@extends('admin.layouts.app')
+@section('title', '栏目添加')
+
+@section('content')
+
+
+
+
+@endsection
\ No newline at end of file
diff --git a/resources/views/admin/WeixinMenu/edit.blade.php b/resources/views/admin/WeixinMenu/edit.blade.php
new file mode 100644
index 0000000..1728760
--- /dev/null
+++ b/resources/views/admin/WeixinMenu/edit.blade.php
@@ -0,0 +1,82 @@
+@extends('admin.layouts.app')
+@section('title', '菜单修改')
+
+@section('content')
+
+
+
+
+@endsection
\ No newline at end of file
diff --git a/resources/views/admin/WeixinMenu/index.blade.php b/resources/views/admin/WeixinMenu/index.blade.php
new file mode 100644
index 0000000..f7c635f
--- /dev/null
+++ b/resources/views/admin/WeixinMenu/index.blade.php
@@ -0,0 +1,32 @@
+@extends('admin.layouts.app')
+@section('title', '微信公众号自定义菜单列表')
+
+@section('content')
+[ 增加顶级菜单 ] [ 生成菜单 ]
+
+
+
+
+@endsection
\ No newline at end of file
diff --git a/resources/views/weixin/goods/goodsDetail.blade.php b/resources/views/weixin/goods/goodsDetail.blade.php
index 14374c6..dc4e89c 100644
--- a/resources/views/weixin/goods/goodsDetail.blade.php
+++ b/resources/views/weixin/goods/goodsDetail.blade.php
@@ -179,7 +179,20 @@ function cart_num_add()
function dosubmit()
{
var url = '';
- var access_token = '';
+ var access_token = '';
+ if(access_token=='')
+ {
+ //提示
+ layer.open({
+ content: '请先登录'
+ ,skin: 'msg'
+ ,time: 2 //2秒后自动关闭
+ });
+
+ setTimeout("location.href = 'route('weixin_goods_detail',array('id'=>$post['id'])))); ?>'",1000);
+
+ return false;
+ }
var cart_type = $("#cart_type").val();
var goods_number = $("#num").val();
@@ -219,9 +232,23 @@ function dosubmit()
function collect_goods()
{
var url = '=1){echo env('APP_API_URL').'/collect_goods_delete';}else{echo env('APP_API_URL').'/collect_goods_add';} ?>';
- var access_token = '';
+ var access_token = '';
var goods_id = $("#id").val();
+ if(access_token=='')
+ {
+ //提示
+ layer.open({
+ content: '请先登录'
+ ,skin: 'msg'
+ ,time: 2 //2秒后自动关闭
+ });
+
+ setTimeout("location.href = 'route('weixin_goods_detail',array('id'=>$post['id'])))); ?>'",1000);
+
+ return false;
+ }
+
$.post(url,{access_token:access_token,goods_id:goods_id},function(res)
{
if(res.code==0)
diff --git a/resources/views/weixin/user/index.blade.php b/resources/views/weixin/user/index.blade.php
index 7604a98..8d955ea 100644
--- a/resources/views/weixin/user/index.blade.php
+++ b/resources/views/weixin/user/index.blade.php
@@ -44,7 +44,7 @@
-
+
@@ -95,7 +95,7 @@
-
+
@@ -136,7 +136,7 @@
-
+
diff --git a/routes/web.php b/routes/web.php
index b7fc2a2..3ee534b 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -327,6 +327,14 @@ Route::group(['prefix' => 'fladmin', 'namespace' => 'Admin', 'middleware' => ['w
Route::get('/menu/edit', 'MenuController@edit')->name('admin_menu_edit');
Route::post('/menu/doedit', 'MenuController@doedit')->name('admin_menu_doedit');
Route::get('/menu/del', 'MenuController@del')->name('admin_menu_del');
+ //微信自定义菜单管理
+ Route::get('/weixinmenu', 'WeixinMenuController@index')->name('admin_weixinmenu');
+ Route::get('/weixinmenu/add', 'WeixinMenuController@add')->name('admin_weixinmenu_add');
+ Route::post('/weixinmenu/doadd', 'WeixinMenuController@doadd')->name('admin_weixinmenu_doadd');
+ Route::get('/weixinmenu/edit', 'WeixinMenuController@edit')->name('admin_weixinmenu_edit');
+ Route::post('/weixinmenu/doedit', 'WeixinMenuController@doedit')->name('admin_weixinmenu_doedit');
+ Route::get('/weixinmenu/del', 'WeixinMenuController@del')->name('admin_weixinmenu_del');
+ Route::get('/weixinmenu/createmenu', 'WeixinMenuController@createmenu')->name('admin_weixinmenu_createmenu'); //生成自定义菜单
//后台登录注销
Route::get('/login', 'LoginController@login')->name('admin_login');
Route::post('/dologin', 'LoginController@dologin')->name('admin_dologin');