Commit e446a210 authored by shajiaiming's avatar shajiaiming

探索应用banner

parent ba10f198
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace api\controllers; namespace api\controllers;
use common\models\psources\CoinBannerItem;
use common\models\psources\ExploreApp; use common\models\psources\ExploreApp;
use common\models\psources\ExploreAppCategory; use common\models\psources\ExploreAppCategory;
use Yii; use Yii;
...@@ -79,4 +80,24 @@ class ExploreController extends BaseController ...@@ -79,4 +80,24 @@ class ExploreController extends BaseController
return ['code' => $code, 'msg' => $msg, 'data' => $data]; return ['code' => $code, 'msg' => $msg, 'data' => $data];
} }
public function actionBanner()
{
$msg = 'ok';
$code = 0;
$header = Yii::$app->request->headers;
$platform_id = $header['FZM-PLATFORM-ID'] ?? null;
if (false == $platform_id) {
$msg = '参数错误';
$code = -1;
$data = null;
goto doEnd;
}
$coin_banner = CoinBannerItem::find()->select('banner_url, image_url')->where(['platform_id' => $platform_id])->asArray()->all();
$data = $coin_banner;
doEnd :
return ['code' => $code, 'msg' => $msg, 'data' => $data];
}
} }
\ No newline at end of file
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace wallet\controllers; namespace wallet\controllers;
use common\models\psources\CoinBannerItem;
use common\models\psources\CoinPlatformWithHold; use common\models\psources\CoinPlatformWithHold;
use common\models\psources\ExploreApp; use common\models\psources\ExploreApp;
use common\models\psources\ExploreAppCategory; use common\models\psources\ExploreAppCategory;
...@@ -81,4 +82,36 @@ class ExploreController extends BaseController ...@@ -81,4 +82,36 @@ class ExploreController extends BaseController
doEnd : doEnd :
return ['code' => $code, 'msg' => $msg, 'data' => $data]; return ['code' => $code, 'msg' => $msg, 'data' => $data];
} }
public function actionBanner()
{
$msg = 'ok';
$code = 0;
$platform_id = Yii::$app->request->getPlatformId();
$page = Yii::$app->request->get('page', 1);
if (false == $platform_id) {
$msg = '参数错误';
$code = -1;
$data = null;
goto doEnd;
}
$query = CoinBannerItem::find()
->select('id, banner_url, image_url')
->where(['platform_id' => $platform_id])
->asArray();
$banner_model = $query->offset(($page - 1) * 10)->limit(10)->asArray()->all();
$countQuery = clone $query;
$pages = new Pagination(['totalCount' => $countQuery->count(), 'pageSize' => '10']);
$data = [
'list' => $banner_model,
'page' => [
'pageCount' => $pages->pageCount,
'pageSize' => 10,
'currentPage' => $page,
]
];
doEnd :
return ['code' => $code, 'msg' => $msg, 'data' => $data];
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment