作者 anyv
1 个管道 的构建 通过 耗费 3 秒

bug修改

... ... @@ -191,6 +191,7 @@ class IndexController extends WeChatBaseController
*/
public function search_salesman_goods(){
$book_name = $this -> request -> param();
$uid = cmf_get_current_user_id();
$data_status = Db::name('my_user') -> where("uid",$uid) -> find();
$where = ['type'=>1];
... ... @@ -207,11 +208,11 @@ class IndexController extends WeChatBaseController
$where = "type = 1 or uid =".$salesman_id['uid'];
}
if(empty($_POST['book_name'])){
if(empty($book_name['book_name'])){
$book_name = '';
$data_salesman_goods = Db::name('goods') -> alias('a') -> field("a.*,b.name") -> join('classification b','a.classify_id = b.id','LEFT') -> where($where) -> select() -> toArray();
}else{
$book_name = $_POST['book_name'];
$book_name = $book_name['book_name'];
$data_salesman_goods = Db::name('goods') -> alias('a') -> field("a.*,b.name") -> join('classification b','a.classify_id = b.id','LEFT') -> where($where) -> where('book_name','like',"%".$book_name."%") -> select() -> toArray();
}
if(!empty($data_salesman_goods)){
... ... @@ -428,6 +429,43 @@ class IndexController extends WeChatBaseController
}
/**
*搜索页点击搜索
*/
public function my_search(){
$uid = cmf_get_current_user_id();
$data_status = Db::name('my_user') -> where("uid",$uid) -> find();
$where = ['type'=>1];
if($data_status['status'] == 2){
$where = "type = 1 or uid = ".$uid;
}
if($data_status['status'] == 3){
$salesman_uid = Db::name('my_user') -> where('id',$data_status['pid']) -> find();
$where = "type = 1 or uid =".$salesman_uid['uid'];
}
if($data_status['status'] == 4){
$teacher_id = Db::name('my_user') -> where('id',$data_status['pid']) -> find();
$salesman_id = Db::name('my_user') -> where('id',$teacher_id['pid']) -> find();
$where = "type = 1 or uid =".$salesman_id['uid'];
}
if(empty($_POST['book_name'])){
$book_name = '';
$data_salesman_goods = Db::name('goods') -> alias('a') -> field("a.*,b.name") -> join('classification b','a.classify_id = b.id','LEFT') -> where($where) -> select() -> toArray();
}else{
$book_name = $_POST['book_name'];
$data_salesman_goods = Db::name('goods') -> alias('a') -> field("a.*,b.name") -> join('classification b','a.classify_id = b.id','LEFT') -> where($where) -> where('book_name','like',"%".$book_name."%") -> select() -> toArray();
}
if(!empty($data_salesman_goods)){
foreach ($data_salesman_goods as $key => $val){
$price = explode('.',$data_salesman_goods[$key]['price']);
$data_salesman_goods[$key]['price0'] = $price[0];
$data_salesman_goods[$key]['price1'] = $price[1];
}
}
return json_encode($data_salesman_goods);
}
... ...
... ... @@ -51,7 +51,7 @@ class PayController extends HomeBaseController
'body' => '百荣科技',
'detail' => '以客户为中心 以奋斗者文本',
'out_trade_no' => $data['order_number'],
'total_fee' => $data['money']*100, // 单位:分
'total_fee' => 1, /*$data['money']*100,*/ // 单位:分
'notify_url' => url('portal/pay/notify','','',true), // 支付结果通知网址,如果不设置则会使用配置里的默认地址
'openid' => $openid, // trade_type=JSAPI,此参数必传,用户在商户appid下的唯一标识,
];
... ... @@ -264,12 +264,12 @@ class PayController extends HomeBaseController
Db::rollback();
}
cache('a1',"789");
/*cache('a1',"789");
$bird = new BirdController;
$createOrder = $bird -> createOrder($order['id']);
cache('yuyue1',$createOrder);
$takeOrder = $bird -> takeOrder($order['id']);
cache('dingyue1',$takeOrder);
cache('dingyue1',$takeOrder);*/
}
return true; // 返回处理完成
});
... ...
... ... @@ -10,7 +10,7 @@
// [ 入口文件 ]
// 调试模式开关
define("APP_DEBUG",false);
define("APP_DEBUG",true);
// 定义CMF根目录,可更改此目录
define('CMF_ROOT', __DIR__ . '/../');
... ...
... ... @@ -33,15 +33,15 @@
<!-- index -->
<div class="in_box">
<!-- search -->
<form action="{:url('Index/search_salesman_goods')}" method="post">
<!-- <form action="{:url('Index/search_salesman_goods')}" method="post">-->
<div class="in_search">
<div class="in_search1">
<img src="__TMPL__/public/assets/images/1.png" alt="">
<input type="text" name="book_name" placeholder="输入书籍名称">
</div>
<div class="in_search_no"><input type="submit" placeholder="搜索" value="搜索"></div>
<div class="in_search_no" onclick="sousuo()"><!--<input type="submit" placeholder="搜索" value="搜索">-->搜索</div>
</div>
</form>
<!-- </form>-->
<!-- banner -->
<div class="in_banner swiper-container">
<ul class="swiper-wrapper">
... ... @@ -136,11 +136,6 @@
<img src="__TMPL__/public/assets/images/12.png" alt="">
</div>
<div class="in_campusTitle2">热门推荐</div>
<div class="in_campusTitle3">更多
<a href="{:url('Index/hot_goods')}">
<img src="__TMPL__/public/assets/images/8.png" alt="">
</a>
</div>
</div>
<!-- 小标题 -->
<div class="in_campust2">好货上新,火热开抢!</div>
... ... @@ -153,7 +148,7 @@
<img src="{:cmf_get_image_url($vo.show_img)}" alt="">
</div>
<div class="in_hotText">
<div class="in_hotName txt-cut"><span>{$vo.name}</span>{$vo.book_name}</div>
<div class="in_hotName txt-cut"><span>{$vo.grade}</span>{$vo.book_name}</div>
<div class="in_cam_shopPrice">
<div class="in_hotPrice1"><span>{$vo.price0}</span>.{$vo.price1}</div>
<div class="in_cam_shopY">¥{$vo.pricing}</div>
... ... @@ -196,6 +191,16 @@
</div>
<script src="__TMPL__/public/assets/js/base.js"></script>
<script src="__TMPL__/public/assets/js/swiper.min.js"></script>
<script src="__TMPL__/public/assets/js/jquery.js"></script>
<script>
/**
*点击搜索
*/
function sousuo(){
book_name = $("input[name='book_name']").val();
window.location.href = "{:url('Index/search_salesman_goods')}?book_name="+book_name;
}
</script>
<script>
var swiper = new Swiper('.swiper-container', {
pagination: '.swiper-pagination',
... ...
... ... @@ -22,16 +22,16 @@
<!-- search -->
<div class="search_box">
<!-- 顶部搜索 -->
<form action="{:url('Index/search_salesman_goods')}" method="post">
<!-- <form action="{:url('Index/search_salesman_goods')}" method="post">-->
<div class="se_search">
<a href="{:url('Index/index')}"><img class="search_left" src="__TMPL__/public/assets/images/25.png" alt=""></a>
<div class="se_input">
<img src="__TMPL__/public/assets/images/1.png" alt="">
<input type="text" name="book_name" placeholder="请输入搜索内容">
<input type="text" name="book_name" placeholder="{$search_content}" value="{$search_content}" >
</div>
<p class="se_searchNo"><input type="submit" placeholder="搜索" value="搜索"></p>
<p class="se_searchNo" onclick="my_submit()"><!--<input type="submit" placeholder="搜索" value="搜索">--> 搜索</p>
</div>
</form>
<!-- </form>-->
<input type="hidden" name="search_content" value="{$search_content}">
<!-- 搜索导航 -->
<div class="se_nav">
... ... @@ -54,7 +54,7 @@
<img src="{:cmf_get_image_url($vo.show_img)}" alt="">
</div>
<div class="in_hotText">
<div class="in_hotName txt-cut"><span>{$vo.name}</span>{$vo.book_name}</div>
<div class="in_hotName txt-cut"><span>{$vo.grade}</span>{$vo.book_name}</div>
<div class="in_cam_shopPrice">
<div class="in_hotPrice1"><span>{$vo.price0}</span>.{$vo.price1}</div>
<div class="in_cam_shopY">¥{$vo.pricing}</div>
... ... @@ -70,6 +70,23 @@
<script src="__TMPL__/public/assets/js/base.js"></script>
<script src="__TMPL__/public/assets/js/jquery.js"></script>
<script>
/**
*点击搜索
*/
function my_submit(){
book_name = $("input[name='book_name']").val();
$.post("{:url('Index/my_search')}",{book_name:book_name},function(data){
data_arr = JSON.parse(data);
$('.in_hotLi').remove();
for(var i=0;i<data_arr.length;i++){
show_img = data_arr[i].show_img;
url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id;
$('.se_con').append("<div class='in_hotLi'><a href='"+url+"'><div class='in_hotImg'><img src='"+show_img+"'></div><div class='in_hotText'><div class='in_hotName txt-cut'><span>"+data_arr[i].grade+"</span>"+data_arr[i].book_name+"</div><div class='in_cam_shopPrice'><div class='in_hotPrice1'>¥<span>"+data_arr[i].price0+"</span>."+data_arr[i].price1+"</div></div></div></a></div>");
}
});
}
</script>
<script>
$('.se_nav ul li').click(function() {
$(this).addClass('se_navactvie').siblings().removeClass('se_navactvie');
$(this).addClass('se_navactvie').siblings().children('img').attr('src', '__TMPL__/public/assets/images/s1.png')
... ... @@ -91,7 +108,7 @@
for(var i=0;i<data_arr.length;i++){
show_img = data_arr[i].show_img;
url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id;
$('.se_con').append("<div class='in_hotLi'><a href='"+url+"'><div class='in_hotImg'><img src='"+show_img+"'></div><div class='in_hotText'><div class='in_hotName txt-cut'><span></span>"+data_arr[i].book_name+"</div><div class='in_cam_shopPrice'><div class='in_hotPrice1'>¥<span>"+data_arr[i].price0+"</span>."+data_arr[i].price1+"</div></div></div></a></div>");
$('.se_con').append("<div class='in_hotLi'><a href='"+url+"'><div class='in_hotImg'><img src='"+show_img+"'></div><div class='in_hotText'><div class='in_hotName txt-cut'><span>"+data_arr[i].grade+"</span>"+data_arr[i].book_name+"</div><div class='in_cam_shopPrice'><div class='in_hotPrice1'>¥<span>"+data_arr[i].price0+"</span>."+data_arr[i].price1+"</div></div></div></a></div>");
}
});
}
... ... @@ -107,7 +124,7 @@
for(var i=0;i<data_arr.length;i++){
show_img = data_arr[i].show_img;
url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id;
$('.se_con').append("<div class='in_hotLi'><a href='"+url+"'><div class='in_hotImg'><img src='"+show_img+"'></div><div class='in_hotText'><div class='in_hotName txt-cut'><span></span>"+data_arr[i].book_name+"</div><div class='in_cam_shopPrice'><div class='in_hotPrice1'>¥<span>"+data_arr[i].price0+"</span>."+data_arr[i].price1+"</div></div></div></a></div>");
$('.se_con').append("<div class='in_hotLi'><a href='"+url+"'><div class='in_hotImg'><img src='"+show_img+"'></div><div class='in_hotText'><div class='in_hotName txt-cut'><span>"+data_arr[i].grade+"</span>"+data_arr[i].book_name+"</div><div class='in_cam_shopPrice'><div class='in_hotPrice1'>¥<span>"+data_arr[i].price0+"</span>."+data_arr[i].price1+"</div></div></div></a></div>");
}
});
}
... ... @@ -123,7 +140,7 @@
for(var i=0;i<data_arr.length;i++){
show_img = data_arr[i].show_img;
url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id;
$('.se_con').append("<div class='in_hotLi'><a href='"+url+"'><div class='in_hotImg'><img src='"+show_img+"'></div><div class='in_hotText'><div class='in_hotName txt-cut'><span></span>"+data_arr[i].book_name+"</div><div class='in_cam_shopPrice'><div class='in_hotPrice1'>¥<span>"+data_arr[i].price0+"</span>."+data_arr[i].price1+"</div></div></div></a></div>");
$('.se_con').append("<div class='in_hotLi'><a href='"+url+"'><div class='in_hotImg'><img src='"+show_img+"'></div><div class='in_hotText'><div class='in_hotName txt-cut'><span>"+data_arr[i].grade+"</span>"+data_arr[i].book_name+"</div><div class='in_cam_shopPrice'><div class='in_hotPrice1'>¥<span>"+data_arr[i].price0+"</span>."+data_arr[i].price1+"</div></div></div></a></div>");
}
});
}
... ...