1 个管道
的构建
通过
耗费
1 秒
Merge branch 'master' of http://114.215.101.231:8099/guosheng/store into Branch_liuzhen
正在显示
11 个修改的文件
包含
125 行增加
和
47 行删除
@@ -12,6 +12,8 @@ namespace app\index\controller; | @@ -12,6 +12,8 @@ namespace app\index\controller; | ||
12 | use app\common\controller\Frontend; | 12 | use app\common\controller\Frontend; |
13 | use app\index\model\Firmstores; | 13 | use app\index\model\Firmstores; |
14 | use app\index\model\Minestore; | 14 | use app\index\model\Minestore; |
15 | +use app\index\model\Store; | ||
16 | +use app\index\model\Viporder; | ||
15 | use think\Db; | 17 | use think\Db; |
16 | 18 | ||
17 | class Enter extends Frontend | 19 | class Enter extends Frontend |
@@ -35,13 +37,13 @@ class Enter extends Frontend | @@ -35,13 +37,13 @@ class Enter extends Frontend | ||
35 | */ | 37 | */ |
36 | public function index(){ | 38 | public function index(){ |
37 | $user_id = $this->auth->id; | 39 | $user_id = $this->auth->id; |
38 | - $minestore = Db::name('minestore')->where('user_id',$this->auth->id)->find(); | ||
39 | - if($minestore) { | ||
40 | - $url = url('vip/index'); | ||
41 | - } else { | ||
42 | - $url = url('enter/index'); | 40 | + $viporderModel = new Viporder(); |
41 | + $vip_order = $viporderModel->where(['user_id'=>$user_id])->order("createtime desc")->find(); | ||
42 | + if(!empty($vip_order)){ | ||
43 | + if(in_array($vip_order['audit'],[1,2])){ | ||
44 | + $this->redirect('index/vip/index'); | ||
45 | + } | ||
43 | } | 46 | } |
44 | - $this->redirect($url); | ||
45 | $userModel = new \app\index\model\User(); | 47 | $userModel = new \app\index\model\User(); |
46 | $user = $userModel->findData(['id'=>$user_id]); | 48 | $user = $userModel->findData(['id'=>$user_id]); |
47 | if(empty($user)){ | 49 | if(empty($user)){ |
@@ -63,6 +65,13 @@ class Enter extends Frontend | @@ -63,6 +65,13 @@ class Enter extends Frontend | ||
63 | */ | 65 | */ |
64 | public function apply_personage(){ | 66 | public function apply_personage(){ |
65 | $user_id = $this->auth->id; | 67 | $user_id = $this->auth->id; |
68 | + $viporderModel = new Viporder(); | ||
69 | + $vip_order = $viporderModel->where(['user_id'=>$user_id])->order("createtime desc")->find(); | ||
70 | + if(!empty($vip_order)){ | ||
71 | + if(in_array($vip_order['audit'],[1,2])){ | ||
72 | + $this->redirect('index/vip/index'); | ||
73 | + } | ||
74 | + } | ||
66 | $userModel = new \app\index\model\User(); | 75 | $userModel = new \app\index\model\User(); |
67 | $user = $userModel->findData(['id'=>$user_id]); | 76 | $user = $userModel->findData(['id'=>$user_id]); |
68 | if(empty($user)){ | 77 | if(empty($user)){ |
@@ -84,6 +93,13 @@ class Enter extends Frontend | @@ -84,6 +93,13 @@ class Enter extends Frontend | ||
84 | */ | 93 | */ |
85 | public function apply_company(){ | 94 | public function apply_company(){ |
86 | $user_id = $this->auth->id; | 95 | $user_id = $this->auth->id; |
96 | + $viporderModel = new Viporder(); | ||
97 | + $vip_order = $viporderModel->where(['user_id'=>$user_id])->order("createtime desc")->find(); | ||
98 | + if(!empty($vip_order)){ | ||
99 | + if(in_array($vip_order['audit'],[1,2])){ | ||
100 | + $this->redirect('index/vip/index'); | ||
101 | + } | ||
102 | + } | ||
87 | $userModel = new \app\index\model\User(); | 103 | $userModel = new \app\index\model\User(); |
88 | $user = $userModel->findData(['id'=>$user_id]); | 104 | $user = $userModel->findData(['id'=>$user_id]); |
89 | if(empty($user)){ | 105 | if(empty($user)){ |
@@ -119,8 +119,15 @@ class Goods extends Frontend | @@ -119,8 +119,15 @@ class Goods extends Frontend | ||
119 | * @return mixed | 119 | * @return mixed |
120 | */ | 120 | */ |
121 | public function goods_list(){ | 121 | public function goods_list(){ |
122 | - //获取分类 | 122 | + $category_id = $this->request->param('category_id',0,'intval'); |
123 | + $category = []; | ||
124 | + $where = []; | ||
123 | $goodstypeModel = new Goodstype(); | 125 | $goodstypeModel = new Goodstype(); |
126 | + if(!empty($category_id)){ | ||
127 | + $category = $goodstypeModel->findData(['id'=>$category_id]); | ||
128 | + $where['goodstype_id'] = ['eq',$category_id]; | ||
129 | + } | ||
130 | + //获取分类 | ||
124 | $goodstype_one = $goodstypeModel->selectData(['pid'=>0]);//一级 | 131 | $goodstype_one = $goodstypeModel->selectData(['pid'=>0]);//一级 |
125 | foreach($goodstype_one as $key => $g_o){ | 132 | foreach($goodstype_one as $key => $g_o){ |
126 | $goodstype_two = $goodstypeModel->selectData(['pid'=>$g_o['id']]);//二级 | 133 | $goodstype_two = $goodstypeModel->selectData(['pid'=>$g_o['id']]);//二级 |
@@ -131,6 +138,7 @@ class Goods extends Frontend | @@ -131,6 +138,7 @@ class Goods extends Frontend | ||
131 | $slide = $picModel->selectData([]); | 138 | $slide = $picModel->selectData([]); |
132 | $this->assign('goodstype_one',$goodstype_one); | 139 | $this->assign('goodstype_one',$goodstype_one); |
133 | $this->assign('slide',$slide); | 140 | $this->assign('slide',$slide); |
141 | + $this->assign('category',$category); | ||
134 | $this->assign('title','产品热卖'); | 142 | $this->assign('title','产品热卖'); |
135 | return $this->fetch(); | 143 | return $this->fetch(); |
136 | } | 144 | } |
@@ -173,6 +181,9 @@ class Goods extends Frontend | @@ -173,6 +181,9 @@ class Goods extends Frontend | ||
173 | if(!empty($param['keyword'])){ | 181 | if(!empty($param['keyword'])){ |
174 | $where['t.name|s.name|g.goodsname|g.brand'] = ['like',"%$param[keyword]%"]; | 182 | $where['t.name|s.name|g.goodsname|g.brand'] = ['like',"%$param[keyword]%"]; |
175 | } | 183 | } |
184 | + if(!empty($param['category_id'])){ | ||
185 | + $where['g.goodstype_id'] = ['eq',$param['category_id']]; | ||
186 | + } | ||
176 | $order = 'g.weigh desc'; | 187 | $order = 'g.weigh desc'; |
177 | if(!empty($param['sort'])){ | 188 | if(!empty($param['sort'])){ |
178 | if($param['sort'] == 1){ | 189 | if($param['sort'] == 1){ |
@@ -15,6 +15,7 @@ use app\index\model\Firmstores; | @@ -15,6 +15,7 @@ use app\index\model\Firmstores; | ||
15 | use app\index\model\Minestore; | 15 | use app\index\model\Minestore; |
16 | use app\index\model\Price; | 16 | use app\index\model\Price; |
17 | use app\index\model\Province; | 17 | use app\index\model\Province; |
18 | +use app\index\model\Store; | ||
18 | use app\index\model\Viporder; | 19 | use app\index\model\Viporder; |
19 | 20 | ||
20 | class Vip extends Frontend | 21 | class Vip extends Frontend |
@@ -38,6 +39,11 @@ class Vip extends Frontend | @@ -38,6 +39,11 @@ class Vip extends Frontend | ||
38 | */ | 39 | */ |
39 | public function index(){ | 40 | public function index(){ |
40 | $user_id = $this->auth->id; | 41 | $user_id = $this->auth->id; |
42 | + $storeModel = new Store(); | ||
43 | + $store = $storeModel->findData(['user_id'=>$user_id]); | ||
44 | + if(!empty($store)){ | ||
45 | + $this->redirect('index/member/order'); | ||
46 | + } | ||
41 | //个人店铺 | 47 | //个人店铺 |
42 | $minestoreModel = new Minestore(); | 48 | $minestoreModel = new Minestore(); |
43 | $minestore = $minestoreModel->findData(['user_id'=>$user_id]); | 49 | $minestore = $minestoreModel->findData(['user_id'=>$user_id]); |
@@ -88,6 +94,11 @@ class Vip extends Frontend | @@ -88,6 +94,11 @@ class Vip extends Frontend | ||
88 | }else{ | 94 | }else{ |
89 | $money = $price['svipprice']; | 95 | $money = $price['svipprice']; |
90 | } | 96 | } |
97 | + $storeModel = new Store(); | ||
98 | + $store = $storeModel->findData(['user_id'=>$user_id]); | ||
99 | + if(!empty($store)){ | ||
100 | + $this->error('请前往续费~','index/member/order'); | ||
101 | + } | ||
91 | //个人店铺 | 102 | //个人店铺 |
92 | $minestoreModel = new Minestore(); | 103 | $minestoreModel = new Minestore(); |
93 | $minestore = $minestoreModel->findData(['user_id'=>$user_id]); | 104 | $minestore = $minestoreModel->findData(['user_id'=>$user_id]); |
@@ -88,6 +88,7 @@ class WechatPay extends HomeBase | @@ -88,6 +88,7 @@ class WechatPay extends HomeBase | ||
88 | $out_trade_no=$notify->out_trade_no; | 88 | $out_trade_no=$notify->out_trade_no; |
89 | $vipOrderModel = new Viporder(); | 89 | $vipOrderModel = new Viporder(); |
90 | $data = $vipOrderModel->findData(['num'=>$out_trade_no]); | 90 | $data = $vipOrderModel->findData(['num'=>$out_trade_no]); |
91 | + cache('a',$data['vip_type']."&"); | ||
91 | if (empty($data)) { // 如果订单不存在 | 92 | if (empty($data)) { // 如果订单不存在 |
92 | return 'Order not exist.'; // 告诉微信,我已经处理完了,订单没找到,别再通知我了 | 93 | return 'Order not exist.'; // 告诉微信,我已经处理完了,订单没找到,别再通知我了 |
93 | } | 94 | } |
@@ -98,6 +99,7 @@ class WechatPay extends HomeBase | @@ -98,6 +99,7 @@ class WechatPay extends HomeBase | ||
98 | } | 99 | } |
99 | $userModel = new \app\index\model\User(); | 100 | $userModel = new \app\index\model\User(); |
100 | $user = $userModel->findData(['id'=>$data['user_id']]); | 101 | $user = $userModel->findData(['id'=>$data['user_id']]); |
102 | + cache('b',$user['is_vip']."&".$user['id']."&".$user['vip_passttime']); | ||
101 | // 用户是否支付成功 | 103 | // 用户是否支付成功 |
102 | if($successful){ | 104 | if($successful){ |
103 | if($data['vip_type'] == '1'){ | 105 | if($data['vip_type'] == '1'){ |
@@ -107,7 +109,9 @@ class WechatPay extends HomeBase | @@ -107,7 +109,9 @@ class WechatPay extends HomeBase | ||
107 | }else{ | 109 | }else{ |
108 | $vip_passtime = time() + 365*24*60*60; | 110 | $vip_passtime = time() + 365*24*60*60; |
109 | } | 111 | } |
110 | - $userModel->updateData(['vip_passtime'=>$vip_passtime,'province_ids'=>$data['province_ids']]); | 112 | + cache('h',$vip_passtime); |
113 | + $userModel->updateData(['id'=>$user['id']],['vip_passtime'=>$vip_passtime,'province_ids'=>",".$data['province_ids'].","]); | ||
114 | + cache('c',"QQQQ"); | ||
111 | }else if($data['vip_type'] == '2'){ | 115 | }else if($data['vip_type'] == '2'){ |
112 | //超级会员 | 116 | //超级会员 |
113 | if($user['is_svip'] == '1'){ | 117 | if($user['is_svip'] == '1'){ |
@@ -115,20 +119,33 @@ class WechatPay extends HomeBase | @@ -115,20 +119,33 @@ class WechatPay extends HomeBase | ||
115 | }else{ | 119 | }else{ |
116 | $svip_passtime = time() + 365*24*60*60; | 120 | $svip_passtime = time() + 365*24*60*60; |
117 | } | 121 | } |
118 | - $userModel->updateData(['svip_passtime'=>$svip_passtime]); | 122 | + cache('g',$svip_passtime); |
123 | + cache('d',$userModel->updateData(['id'=>$user['id']],['svip_passtime'=>$svip_passtime])); | ||
119 | } | 124 | } |
120 | $arr['status'] = "2"; | 125 | $arr['status'] = "2"; |
121 | $arr['paytime'] = time(); | 126 | $arr['paytime'] = time(); |
122 | }else{ | 127 | }else{ |
123 | $arr['status'] = "1"; | 128 | $arr['status'] = "1"; |
124 | } | 129 | } |
125 | - $vipOrderModel->updateData(['id'=>$data['id']],$arr); | 130 | + cache('f',"FFFF"); |
131 | + cache('e',$vipOrderModel->updateData(['id'=>$data['id']],$arr)); | ||
126 | return true; // 返回处理完成 | 132 | return true; // 返回处理完成 |
127 | }); | 133 | }); |
128 | 134 | ||
129 | $response->send(); | 135 | $response->send(); |
130 | } | 136 | } |
131 | 137 | ||
138 | + public function demo(){ | ||
139 | + dump(cache('a')); | ||
140 | + dump(cache('b')); | ||
141 | + dump(cache('c')); | ||
142 | + dump(cache('d')); | ||
143 | + dump(cache('e')); | ||
144 | + dump(cache('f')); | ||
145 | + dump(cache('g')); | ||
146 | + dump(cache('h')); | ||
147 | + } | ||
148 | + | ||
132 | /** | 149 | /** |
133 | * 支付回调(购买商品) | 150 | * 支付回调(购买商品) |
134 | * @throws \EasyWeChat\Core\Exceptions\FaultException | 151 | * @throws \EasyWeChat\Core\Exceptions\FaultException |
@@ -18,4 +18,8 @@ class Goodstype extends Model | @@ -18,4 +18,8 @@ class Goodstype extends Model | ||
18 | $data = $this->where($where)->order('weigh desc')->select(); | 18 | $data = $this->where($where)->order('weigh desc')->select(); |
19 | return $data; | 19 | return $data; |
20 | } | 20 | } |
21 | + public function findData($where){ | ||
22 | + $data = $this->where($where)->find(); | ||
23 | + return $data; | ||
24 | + } | ||
21 | } | 25 | } |
@@ -54,29 +54,31 @@ class Store extends Model | @@ -54,29 +54,31 @@ class Store extends Model | ||
54 | } | 54 | } |
55 | public function findData($where){ | 55 | public function findData($where){ |
56 | $data = $this->where($where)->find(); | 56 | $data = $this->where($where)->find(); |
57 | - //判断会员是否过期 | ||
58 | - $is_vip = '2'; | ||
59 | - if(!empty($data['vip_passtime'])){ | ||
60 | - if($data['vip_passtime'] > time()){ | ||
61 | - $is_vip = "1"; | 57 | + if(!empty($data)){ |
58 | + //判断会员是否过期 | ||
59 | + $is_vip = '2'; | ||
60 | + if(!empty($data['vip_passtime'])){ | ||
61 | + if($data['vip_passtime'] > time()){ | ||
62 | + $is_vip = "1"; | ||
63 | + } | ||
62 | } | 64 | } |
63 | - } | ||
64 | - $is_svip = '2'; | ||
65 | - if(!empty($data['svip_passtime'])){ | ||
66 | - if($data['svip_passtime'] > time()){ | ||
67 | - $is_svip = "1"; | 65 | + $is_svip = '2'; |
66 | + if(!empty($data['svip_passtime'])){ | ||
67 | + if($data['svip_passtime'] > time()){ | ||
68 | + $is_svip = "1"; | ||
69 | + } | ||
68 | } | 70 | } |
71 | + $data['is_vip'] = $is_vip; | ||
72 | + $data['is_svip'] = $is_svip; | ||
73 | + //获取省市区 | ||
74 | + $areaModel = new Area(); | ||
75 | + $province_name = $areaModel->where(['id'=>$data['province_id']])->value('name'); | ||
76 | + $city_name = $areaModel->where(['id'=>$data['city_id']])->value('name'); | ||
77 | + $county_name = $areaModel->where(['id'=>$data['county_id']])->value('name'); | ||
78 | + $data['province_name'] = $province_name; | ||
79 | + $data['city_name'] = $city_name; | ||
80 | + $data['county_name'] = $county_name; | ||
69 | } | 81 | } |
70 | - $data['is_vip'] = $is_vip; | ||
71 | - $data['is_svip'] = $is_svip; | ||
72 | - //获取省市区 | ||
73 | - $areaModel = new Area(); | ||
74 | - $province_name = $areaModel->where(['id'=>$data['province_id']])->value('name'); | ||
75 | - $city_name = $areaModel->where(['id'=>$data['city_id']])->value('name'); | ||
76 | - $county_name = $areaModel->where(['id'=>$data['county_id']])->value('name'); | ||
77 | - $data['province_name'] = $province_name; | ||
78 | - $data['city_name'] = $city_name; | ||
79 | - $data['county_name'] = $county_name; | ||
80 | return $data; | 82 | return $data; |
81 | } | 83 | } |
82 | } | 84 | } |
@@ -13,21 +13,23 @@ class User extends Model | @@ -13,21 +13,23 @@ class User extends Model | ||
13 | { | 13 | { |
14 | public function findData($where){ | 14 | public function findData($where){ |
15 | $data = $this->where($where)->find(); | 15 | $data = $this->where($where)->find(); |
16 | - //判断是否为会员 | ||
17 | - $is_vip = '2'; | ||
18 | - if(!empty($data['vip_passtime'])){ | ||
19 | - if($data['vip_passtime'] > time()){ | ||
20 | - $is_vip = "1"; | 16 | + if(!empty($data)){ |
17 | + //判断是否为会员 | ||
18 | + $is_vip = '2'; | ||
19 | + if(!empty($data['vip_passtime'])){ | ||
20 | + if($data['vip_passtime'] > time()){ | ||
21 | + $is_vip = "1"; | ||
22 | + } | ||
21 | } | 23 | } |
22 | - } | ||
23 | - $is_svip = '2'; | ||
24 | - if(!empty($data['svip_passtime'])){ | ||
25 | - if($data['svip_passtime'] > time()){ | ||
26 | - $is_svip = "1"; | 24 | + $is_svip = '2'; |
25 | + if(!empty($data['svip_passtime'])){ | ||
26 | + if($data['svip_passtime'] > time()){ | ||
27 | + $is_svip = "1"; | ||
28 | + } | ||
27 | } | 29 | } |
30 | + $data['is_vip'] = $is_vip; | ||
31 | + $data['is_svip'] = $is_svip; | ||
28 | } | 32 | } |
29 | - $data['is_vip'] = $is_vip; | ||
30 | - $data['is_svip'] = $is_svip; | ||
31 | return $data; | 33 | return $data; |
32 | } | 34 | } |
33 | public function updateData($where,$data){ | 35 | public function updateData($where,$data){ |
@@ -348,7 +348,7 @@ | @@ -348,7 +348,7 @@ | ||
348 | </div> | 348 | </div> |
349 | <div class="typeDetailBox"> | 349 | <div class="typeDetailBox"> |
350 | {foreach name="$g_o.goodstype_two" item="g_t"} | 350 | {foreach name="$g_o.goodstype_two" item="g_t"} |
351 | - <p><a href="">{$g_t.name}</a></p> | 351 | + <p><a href="{:url('index/goods/goods_list',array('category_id'=>$g_t.id))}">{$g_t.name}</a></p> |
352 | {/foreach} | 352 | {/foreach} |
353 | </div> | 353 | </div> |
354 | </li> | 354 | </li> |
@@ -372,7 +372,7 @@ | @@ -372,7 +372,7 @@ | ||
372 | <div class="bestSellersMain"> | 372 | <div class="bestSellersMain"> |
373 | <div class="titleBox"> | 373 | <div class="titleBox"> |
374 | <span></span> | 374 | <span></span> |
375 | - <span>采购中心 > 产品热卖</span> | 375 | + <span>采购中心 {notempty name="$category"}> {$category.name}{/notempty}</span> |
376 | </div> | 376 | </div> |
377 | <div class="bestSellersList goods_dom"> | 377 | <div class="bestSellersList goods_dom"> |
378 | <!--<div class="commodityBox"> | 378 | <!--<div class="commodityBox"> |
@@ -402,6 +402,7 @@ | @@ -402,6 +402,7 @@ | ||
402 | {include file="public/footer"/} | 402 | {include file="public/footer"/} |
403 | {include file="public/js"/} | 403 | {include file="public/js"/} |
404 | <script> | 404 | <script> |
405 | + var category_id = {notempty name="$category"}{$category.id}{/notempty}; | ||
405 | $(function () { | 406 | $(function () { |
406 | initBanner();//初始化轮播图 | 407 | initBanner();//初始化轮播图 |
407 | initLocation();//获取定位信息 | 408 | initLocation();//获取定位信息 |
@@ -459,7 +460,7 @@ | @@ -459,7 +460,7 @@ | ||
459 | $.ajax({ | 460 | $.ajax({ |
460 | url:"{:url('index/goods/get_all')}", | 461 | url:"{:url('index/goods/get_all')}", |
461 | type:"POST", | 462 | type:"POST", |
462 | - data:{"province_id":province_id,"page":page,"pageNum":pageNum,'paginate':1}, | 463 | + data:{"province_id":province_id,"page":page,"pageNum":pageNum,'paginate':1,'category_id':category_id}, |
463 | success:function(res){ | 464 | success:function(res){ |
464 | console.log(res); | 465 | console.log(res); |
465 | var goods_html = ""; | 466 | var goods_html = ""; |
@@ -162,7 +162,12 @@ | @@ -162,7 +162,12 @@ | ||
162 | }else{ | 162 | }else{ |
163 | searchKey = val; | 163 | searchKey = val; |
164 | } | 164 | } |
165 | - window.location.href = 'search.html?searchKey='+searchKey; | 165 | + if(searchKey == ''){ |
166 | + toast('请输入关键字'); | ||
167 | + return false; | ||
168 | + } | ||
169 | + var str = "{:url('index/goods/search',array('keyword'=>'KEYWORD'))}"; | ||
170 | + window.location.href = str.replace('KEYWORD',searchKey); | ||
166 | } | 171 | } |
167 | </script> | 172 | </script> |
168 | </body> | 173 | </body> |
@@ -75,4 +75,13 @@ | @@ -75,4 +75,13 @@ | ||
75 | var pos=$.inArray(src,idCardImgFileArr); | 75 | var pos=$.inArray(src,idCardImgFileArr); |
76 | idCardImgFileArr.splice(pos,1);*/ | 76 | idCardImgFileArr.splice(pos,1);*/ |
77 | }); | 77 | }); |
78 | + function search2(){ | ||
79 | + var keyword = $('#searchVal').val(); | ||
80 | + if(keyword == ''){ | ||
81 | + toast('请输入关键字'); | ||
82 | + return false; | ||
83 | + } | ||
84 | + var str = "{:url('index/goods/search',array('keyword'=>'KEYWORD'))}"; | ||
85 | + window.location.href = str.replace('KEYWORD',keyword); | ||
86 | + } | ||
78 | </script> | 87 | </script> |
@@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
11 | <div class="searchBox"> | 11 | <div class="searchBox"> |
12 | <input id="searchVal" type="text" class="search" placeholder="请输入型号、参数查找元器件" /> | 12 | <input id="searchVal" type="text" class="search" placeholder="请输入型号、参数查找元器件" /> |
13 | <span class="input-group-btn"> | 13 | <span class="input-group-btn"> |
14 | - <button class="btn" onclick="search()"> | 14 | + <button class="btn" onclick="search2()"> |
15 | <img src="__CDN__/assets/store/images/search_icon_top.png" alt="user"> | 15 | <img src="__CDN__/assets/store/images/search_icon_top.png" alt="user"> |
16 | 搜索 | 16 | 搜索 |
17 | </button> | 17 | </button> |
-
请 注册 或 登录 后发表评论