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 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); }
/** * 首页推荐美粒宝典取消推荐1.0版本 * * @return $this|ResponseResult */ public function undoAction() { $req = $this->request; $id = $req->getQuery("id"); $status = CosPointCanon::find("canon_id = {$id}")->delete(); $cosbeautycanon = CosBeautyCanon::findFirst("id = {$id}"); $cosbeautycanon->state = 1; $flg = $cosbeautycanon->save(); if ($flg == true && $status == true) { $arr = array("status" => 10000); echo json_encode($arr); exit; } else { $arr = array("status" => 0, "errmsg" => "error"); echo json_encode($arr); exit; } }