From 82064c43d55265d6e167c715cc24a66a62dd2c77 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Tue, 29 Oct 2019 21:34:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A9=E8=B4=AD=E5=90=A7=E5=BA=97=E9=93=BA?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=86=85=E5=95=86=E5=93=81=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hyhproject/common/model/Shopping.php | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/hyhproject/common/model/Shopping.php b/hyhproject/common/model/Shopping.php index 62fffbe..1d90e83 100755 --- a/hyhproject/common/model/Shopping.php +++ b/hyhproject/common/model/Shopping.php @@ -45,6 +45,42 @@ class Shopping extends Base{ } return WSTReturn('',1,$rs); } + public function getHelpSaleShops(){ + $page = (int)input('page',1); + $rs = cache('QLG_HELP_SALE_SHOPS_'.$page); + if(!$rs){ + $pageSize = input("post.pageSize/d",10); + $goodsSize = input("post.goodsSize/d",3); + $lat = input("post.lat",0); + $lng = input("post.lng",0); + $where['s.dataFlag'] = 1; + $where['s.shopStatus'] = 1; + $where['s.status'] = 1; + $field = 's.shopId,s.shopImg,s.shopName,s.shopLevel,ROUND(12756.276*ASIN(SQRT(POW(SIN(('.$lat.'*0.0174532925-lat*0.0174532925)/2),2)+ + COS('.$lat.'*0.0174532925)*COS(lat*0.0174532925)*POW(SIN(('.$lng.'*0.0174532925-lng*0.0174532925)/2),2)))*1000) AS distance'; + $order = 's.shopLevel ASC'; + $rs = Db::name('shops s') + ->where($where) + ->field($field) + ->order($order) + //->cache(true,86400) + ->paginate($pageSize) + ->toArray(); + //dump($this->getLastSql()); + if(count($rs['Rows']) == 0){ + return WSTReturn('',1,$rs); + } + $goods_field = 'g.goodsImg,g.shopPrice,g.goodsId,g.saleTime,g.discountRate'; + foreach ($rs['Rows'] as &$v) { + $v['goods'] = $this->getShopGoods($v['shopId'],$goodsSize,$goods_field,3); + foreach ($v['goods'] as &$val) { + $val['goodsImg'] = WSTImg($val['goodsImg'],3); + } + } + cache('QLG_HELP_SALE_SHOPS_'.$page,$rs,60); + } + return WSTReturn('',1,$rs); + } /** * 获取列表 */