Ejemplo n.º 1
0
 public function show()
 {
     $shop = trim(IFilter::act(IReq::get("id")));
     $where = 0 < intval($shop) ? " where a.shopid = " . $shop : "where shortname='" . $shop . "'";
     $shopinfo = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "shopfast as a left join " . Mysite::$app->config['tablepre'] . "shop as b  on a.shopid = b.id " . $where . "   ");
     if (empty($shopinfo)) {
         $link = IUrl::creaturl("site/index");
         $this->message("获取店铺信息失败", $link);
     }
     if ($shopinfo['endtime'] < time()) {
         $link = IUrl::creaturl("site/index");
         $this->message("店铺已关门", $link);
     }
     $nowhour = date("H:i:s", time());
     $nowhour = strtotime($nowhour);
     $data['shopinfo'] = $shopinfo;
     $data['shopopeninfo'] = $this->shopIsopen($shopinfo['is_open'], $shopinfo['starttime'], $shopinfo['is_orderbefore'], $nowhour);
     $data['com_goods'] = $this->mysql->getarr("select *  from " . Mysite::$app->config['tablepre'] . "goods where shopid = " . $shopinfo['id'] . " and is_com = 1 and is_goshop=1 ");
     $goodstype = $this->mysql->getarr("select * from " . Mysite::$app->config['tablepre'] . "goodstype where shopid = " . $shopinfo['id'] . " and cattype = " . $shopinfo['shoptype'] . " and is_goshop=1 order by orderid asc");
     $data['goodstype'] = array();
     $tempids = array();
     foreach ($goodstype as $key => $value) {
         $value['det'] = $this->mysql->getarr("select *  from " . Mysite::$app->config['tablepre'] . "goods where typeid = " . $value['id'] . " and shopid=" . $shopinfo['id'] . " and  is_goshop=1");
         $tempids[] = $value['id'];
         $data['goodstype'][] = $value;
     }
     $data['mainattr'] = array();
     $templist = $this->mysql->getarr("select * from " . Mysite::$app->config['tablepre'] . "shoptype where  cattype = " . $shopinfo['shoptype'] . " and parent_id = 0 and is_main =1  order by orderid asc limit 0,1000");
     foreach ($templist as $key => $value) {
         $value['det'] = $this->mysql->getarr("select * from " . Mysite::$app->config['tablepre'] . "shoptype where parent_id = " . $value['id'] . " order by orderid asc  limit 0,20");
         $data['mainattr'][] = $value;
     }
     $data['shopattr'] = $this->mysql->getarr("select * from " . Mysite::$app->config['tablepre'] . "shopattr  where  cattype = " . $shopinfo['shoptype'] . " and shopid = '" . $shopinfo['id'] . "'  order by firstattr asc limit 0,1000");
     $data['goodsattr'] = array();
     $goodsattr = $this->mysql->getarr("select * from " . Mysite::$app->config['tablepre'] . "goodssign  where  type = 'goods'  order by id asc limit 0,1000");
     foreach ($goodsattr as $key => $value) {
         $data['goodsattr'][$value['id']] = $value['imgurl'];
     }
     $data['psinfo'] = $this->pscost($shopinfo, 1);
     $sellrule = new sellrule();
     $sellrule->setdata($shopinfo['shopid'], 1000, $shopinfo['shoptype']);
     $ruleinfo = $sellrule->getdata();
     $data['ruledata'] = array();
     if (isset($ruleinfo['cxids']) && $ruleinfo['cxids']) {
         $data['ruledata'] = $this->mysql->getarr("select * from " . Mysite::$app->config['tablepre'] . "rule  where  id in(" . $ruleinfo['cxids'] . ")  order by id asc limit 0,1000");
     }
     $cximglist = $this->mysql->getarr("select * from " . Mysite::$app->config['tablepre'] . "goodssign  where  type = 'cx'  order by id asc limit 0,1000");
     $data['ruleimg'] = array();
     foreach ($cximglist as $key => $value) {
         $data['ruleimg'][$value['id']] = $value['imgurl'];
     }
     $data['cxlist'] = $ruleinfo;
     $data['scoretocost'] = Mysite::$app->config['scoretocost'];
     $data['collect'] = array();
     if (!empty($this->memberinfo)) {
         $data['collect'] = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "collect where collectid=" . $shopinfo['id'] . " and collecttype = 0 and uid=" . $this->member['uid'] . " ");
     }
     $bzinfo = Mysite::$app->config['orderbz'];
     $data['bzlist'] = array();
     if (!empty($bzinfo)) {
         $data['bzlist'] = unserialize($bzinfo);
     }
     $addresslist = array();
     if (0 < $this->member['uid']) {
         $addresslist = $this->mysql->getarr("select * from " . Mysite::$app->config['tablepre'] . "address where userid=" . $this->member['uid'] . "  ");
     }
     $data['addresslist'] = $addresslist;
     $data['paylist'] = $this->mysql->getarr("select * from " . Mysite::$app->config['tablepre'] . "paylist   order by id desc  ");
     $data['juanlist'] = array();
     if (!empty($this->member['uid'])) {
         $data['juanlist'] = $this->mysql->getarr("select * from " . Mysite::$app->config['tablepre'] . "juan  where uid ='" . $this->member['uid'] . "'  and status = 1 and endtime > " . time() . "  order by id desc limit 0,20");
     }
     Mysite::$app->setdata($data);
 }