|
|
@@ -8,9 +8,9 @@ use common\components\util;
|
|
|
|
|
|
class AdController extends BaseController
|
|
|
{
|
|
|
- //list,detail,create,update,delete
|
|
|
+
|
|
|
protected $service = '\biz\ad\services\AdService';
|
|
|
-
|
|
|
+
|
|
|
//广告列表
|
|
|
public function actionList()
|
|
|
{
|
|
|
@@ -19,26 +19,14 @@ class AdController extends BaseController
|
|
|
$where = [];
|
|
|
$where['merchantId'] = $this->merchantId;
|
|
|
$where['type'] = $type;
|
|
|
- //parent::actionList('*', $where);
|
|
|
+ $where['delStatus'] = 0;
|
|
|
$list = AdService::getAdList($where);
|
|
|
util::success($list);
|
|
|
}
|
|
|
|
|
|
- /*public function actionDetail()
|
|
|
- {
|
|
|
- $data = Yii::$app->request->get();
|
|
|
- if (isset($data['is_view']) && $data['is_view'] == 1) {
|
|
|
- $id = $data['id'];
|
|
|
- AdService::counters(['viewTimes' => 1], ['id' => $id]);
|
|
|
- }
|
|
|
- parent::actionDetail();
|
|
|
- }*/
|
|
|
-
|
|
|
//添加广告
|
|
|
public function actionAdd()
|
|
|
{
|
|
|
- //$_POST['merchantId'] = $this->merchantId;
|
|
|
- //parent::actionAdd();
|
|
|
$post = Yii::$app->request->post();
|
|
|
$post['merchantId'] = $this->merchantId;
|
|
|
$ad = AdService::addAd($post);
|
|
|
@@ -92,10 +80,10 @@ class AdController extends BaseController
|
|
|
$id = Yii::$app->request->get('id', 0);
|
|
|
$info = AdService::getById($id);
|
|
|
AdService::valid($info, $this->merchantId);
|
|
|
- AdService::deleteById($id);
|
|
|
+ AdService::deleteAd($id);
|
|
|
util::complete('删除成功');
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//上下架广告
|
|
|
public function actionUpdateStatus()
|
|
|
{
|
|
|
@@ -103,7 +91,7 @@ class AdController extends BaseController
|
|
|
$status = Yii::$app->request->get('status', 1);
|
|
|
$info = AdService::getById($id);
|
|
|
AdService::valid($info, $this->merchantId);
|
|
|
- AdService::updateById($id,['status'=>$status]);
|
|
|
+ AdService::updateById($id, ['status' => $status]);
|
|
|
util::complete('操作成功');
|
|
|
}
|
|
|
|
|
|
@@ -125,5 +113,5 @@ class AdController extends BaseController
|
|
|
AdService::updateById($id, ['inTurn' => $inTurn]);
|
|
|
util::complete('操作成功');
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|