<?php
namespace app\api\controller\sharp;
use app\api\controller\Controller;
use app\api\service\sharp\Active as ActiveService;
use app\common\service\qrcode\sharp\Goods as GoodsPoster;
class Goods extends Controller
{
public function lists($active_time_id)
{
$service = new ActiveService;
$list = $service->getGoodsListByActiveTimeId($active_time_id);
return $this->renderSuccess(compact('list'));
}
public function detail($active_time_id, $sharp_goods_id)
{
$service = new ActiveService;
$data = $service->getyActiveGoodsDetail($active_time_id, $sharp_goods_id);
if ($data === false) {
return $this->renderError($service->getError());
}
return $this->renderSuccess($data);
}
public function poster($active_time_id, $sharp_goods_id)
{
$service = new ActiveService;
$data = $service->getyActiveGoodsDetail($active_time_id, $sharp_goods_id);
if ($data === false) {
return $this->renderError($service->getError());
}
$Qrcode = new GoodsPoster($data['active'], $data['goods'], $this->getUser(false));
return $this->renderSuccess([
'qrcode' => $Qrcode->getImage(),
]);
}
}