public function run() { $city_code = $this->getDataItem('city_code', 0); //上传手机唯一标识 $phone_id = $this->getDataItem('phone_id', ""); $cityId = $this->getCityId($city_code); if ($cityId <= 0) { //return $this->errorLog(ResultStatus::CITY_NOT_OPEN, '城市未开通'); $cityId = 2; } $this->bcanon = CosPointCanon::query()->columns(['bc.id', 'bc.title', 'bc.img_url', 'bc.settime', 'bc.fit', 'summary', 'bc.assist'])->leftJoin('Apps\\Common\\Models\\CosBeautyCanon', 'Apps\\Common\\Models\\CosPointCanon.canon_id=bc.id', 'bc')->where('Apps\\Common\\Models\\CosPointCanon.open_city_id = ' . $cityId . ' and bc.state = 2')->orderBy('Apps\\Common\\Models\\CosPointCanon.sort desc')->execute()->toArray(); $this->bcanon = $this->bcanon ? $this->bcanon : []; for ($i = 0; $i < count($this->bcanon); $i++) { //判断是否已经点过赞 $bc_assist = CosBeautyCanonAssist::count(["conditions" => "mobile_sign = :sign: AND beauty_canon_id = :bc_id: ", "bind" => ['sign' => $phone_id, 'bc_id' => $this->bcanon[$i]['id']]]); if ($bc_assist > 0) { $this->bcanon[$i]['is_assist'] = true; } if ($this->bcanon[$i]['summary'] == null) { $this->bcanon[$i]['summary'] = ''; } // $this->bcanon[$i]['img_url'] = PicUrl::BeautyCanonCover($this->bcanon[$i]['img_url'], $this->getDi()); $this->bcanon[$i]['img_url'] = "http://img.meelier.com/" . $this->bcanon[$i]['img_url']; if ($this->bcanon[$i]['fit'] == null) { $this->bcanon[$i]['fit'] = 0; } if ($this->bcanon[$i]['assist'] == null) { $this->bcanon[$i]['assist'] = 0; } } $this->setResult($this->bcanon); }
public function homelistAction() { $this->setLeftNav('homelist'); $req = $this->request; $page = intval($req->getQuery('page', null, 1)); $page = $page > 0 ? $page : 1; $limit = $this->pageNavLimit; $offset = $limit * ($page - 1); if ($req->getQuery("cityid")) { $wherearr[] = "Apps\\Common\\Models\\CosPointCanon.open_city_id = " . $req->getQuery("cityid"); $this->view->setVar("cityid", $req->getQuery("cityid")); } $wherearr[] = "c.state <> 3"; $where = implode(" and ", $wherearr); $list = CosPointCanon::query()->columns(['c.img_url', 'c.title', 'c.id', 'c.assist', 'Apps\\Common\\Models\\CosPointCanon.sort as sort', 'Apps\\Common\\Models\\CosPointCanon.open_city_id as cityid'])->leftJoin("Apps\\Common\\Models\\CosBeautyCanon", 'Apps\\Common\\Models\\CosPointCanon.canon_id = c.id', 'c')->where($where)->orderBy("Apps\\Common\\Models\\CosPointCanon.open_city_id desc")->limit($limit, $offset)->execute()->toArray(); foreach ($list as $k => $v) { $list[$k]['img_url'] = "http://img.meelier.com/" . $list[$k]['img_url']; $list[$k]['city_name'] = SysOpenCity::findFirst("city_id = " . $list[$k]['cityid'])->toArray(); } $this->view->setVar("total", count($list)); $this->view->setVar("limit", $limit); $this->view->setVar("page", $page); $this->view->setVar("list", $list); $this->view->setVar('openCity', $this->openCityList()); }
public function run() { $city_code = $this->getDataItem('city_code', 0); $cityId = $this->getCityId($city_code); if ($cityId <= 0) { //return $this->errorLog(ResultStatus::CITY_NOT_OPEN, '城市未开通'); $cityId = 2; } $this->bcanon = CosPointCanon::query()->columns(['bc.id', 'bc.title', 'bc.img_url', 'bc.settime', 'bc.fit', 'bc.assist'])->leftJoin('Apps\\Common\\Models\\CosBeautyCanon', 'Apps\\Common\\Models\\CosPointCanon.canon_id=bc.id', 'bc')->where('Apps\\Common\\Models\\CosPointCanon.open_city_id = ' . $cityId . ' and bc.state = 2')->orderBy('Apps\\Common\\Models\\CosPointCanon.sort desc')->execute()->toArray(); $this->bcanon = $this->bcanon ? $this->bcanon : []; for ($i = 0; $i < count($this->bcanon); $i++) { //$this->bcanon[$i]['img_url'] = PicUrl::BeautyCanonCover($this->bcanon[$i]['img_url'], $this->getDi()); $this->bcanon[$i]['img_url'] = "http://img.meelier.com/" . $this->bcanon[$i]['img_url']; if ($this->bcanon[$i]['fit'] == null) { $this->bcanon[$i]['fit'] = 0; } if ($this->bcanon[$i]['assist'] == null) { $this->bcanon[$i]['assist'] = 0; } } $this->setResult($this->bcanon); }