public function run() { $city_code = $this->getDataItem('citycode', 0); $cityId = $this->getCityId($city_code); if ($cityId <= 0) { return $this->errorLog(ResultStatus::CITY_NOT_OPEN, '城市未开通'); //$cityId=2; } $list = CosPointBp::query()->columns(['b.bp_name', 'Apps\\Common\\Models\\CosPointBp.img_url as bp_cover', 'b.bp_address', 'b.bp_medal', 'b.bp_id'])->leftJoin('Apps\\Common\\Models\\BeautyParlor', 'Apps\\Common\\Models\\CosPointBp.bp_id=b.bp_id', 'b')->where('Apps\\Common\\Models\\CosPointBp.addr = "' . $cityId . '"')->orderBy('Apps\\Common\\Models\\CosPointBp.sort desc')->execute()->toArray(); foreach ($list as $k => $v) { $list[$k]['medal_refund'] = substr($list[$k]['bp_medal'], 0, 1); $list[$k]['medal_verify'] = substr($list[$k]['bp_medal'], 1, 1); $list[$k]['bp_cover'] = "http://img.meelier.com/" . $list[$k]['bp_cover']; $list[$k]['tag'] = BeautyParlorTag::query()->columns('i.tag_title')->leftJoin('Apps\\Common\\Models\\BeautyParlorTagInfo', 'Apps\\Common\\Models\\BeautyParlorTag.tag_id = i.tag_id', 'i')->where("Apps\\Common\\Models\\BeautyParlorTag.bp_id = " . $list[$k]['bp_id'])->orderby("Apps\\Common\\Models\\BeautyParlorTag.sort asc")->limit(3, 0)->execute()->toArray(); } foreach ($list as $k => $v) { unset($list[$k]['bp_medal']); } if (count($list) == 0) { unset($list); } $this->setResult($list); }
private function getParlorRand($city_id, $limit) { $where = "ISNULL(show_start_time) AND ISNULL(show_end_time) and b.bp_state = 1 AND ISNULL(sort) AND addr = :id:"; $parlor = CosPointBp::query()->columns(['b.bp_id id', 'b.bp_name name', 'sort', 'img_url cover', 'b.bp_address address', 'b.bp_medal'])->leftJoin('Apps\\Common\\Models\\BeautyParlor', 'b.bp_id = Apps\\Common\\Models\\CosPointBp.bp_id', 'b')->where($where)->bind(['id' => $city_id])->orderBy('rand()')->limit($limit, 0)->execute()->toArray(); return $parlor; }
/** * 取消推荐美容院 * @date: 2016-1-8 * @author: futao */ public function calloffAction() { $req = $this->request; $id = $req->getQuery("id"); $cityid = $req->getQuery("city_id"); $flg = CosPointBp::find("id = {$id}")->delete(); if ($flg == true) { echo "<script>window.parent.location.href='/manage/bp/bannerBp?City={$cityid}'</script>"; } }