From 2fe556a03bce3df5ad8fdcfdc92583d8ea945ac9 Mon Sep 17 00:00:00 2001 From: colly_wyx <wangyixiong_007@163.com> Date: Thu, 29 Mar 2018 12:01:28 +0800 Subject: [PATCH] 新增广告调用接口 --- Yfs/Domain/Ad.php | 20 ++++++++++ Yfs/Api/Ad.php | 48 ++++++++++++++++++++++++ Yfs/Model/Ad.php | 8 ++++ 3 files changed, 76 insertions(+), 0 deletions(-) diff --git a/Yfs/Api/Ad.php b/Yfs/Api/Ad.php new file mode 100644 index 0000000..792a8fe --- /dev/null +++ b/Yfs/Api/Ad.php @@ -0,0 +1,48 @@ +<?php +/** + * ��������������� + */ + +class Api_Ad extends PhalApi_Api { + + public function getRules() { + return array( + 'getAd' => array( + + ), + ); + } + + /** + * ������������������������ + * @desc ������������������������ + * @return bool code ������������0��������������� 1������������ + * @return string msg ������������ + * @return object info ������������������ + * @return string info._id ������id + * @return string info.name ������������ + * @return string info.content ������������ + * @return string info.logo ������logo + * @return string info.create_time ������������ + * @return string info.is_open ������������������0������������������1������������ + */ + public function getAd(){ + $rs = array('code' => 0, 'msg' => '', 'info' => array()); + $ad_service = new Domain_Ad(); + $ad = $ad_service->getAd(); + + if ($ad) { + $rs['code'] = 0; + $rs['msg'] = '������������������������'; + $rs['info'] = $ad; + } + else{ + $rs['code'] = 1; + $rs['msg'] = '���������������������'; + } + + return $rs; + } + + +} diff --git a/Yfs/Domain/Ad.php b/Yfs/Domain/Ad.php new file mode 100644 index 0000000..80e6ada --- /dev/null +++ b/Yfs/Domain/Ad.php @@ -0,0 +1,20 @@ +<?php +/** + * ��������������� + */ +class Domain_Ad { + + public function __construct(){ + $this->model = new Model_Ad(); + } + + /** + * ������������������ + * @param [type] is_open [description] + * @return [type] [description] + */ + public function getAd(){ + return $this->model->get(array('is_open' => 1),array(), array('time_level' => -1), 1); + } + +} diff --git a/Yfs/Model/Ad.php b/Yfs/Model/Ad.php new file mode 100644 index 0000000..ae627cb --- /dev/null +++ b/Yfs/Model/Ad.php @@ -0,0 +1,8 @@ +<?php + +class Model_Ad extends Model_Base{ + + public $table = 'ad'; + + +} -- Gitblit v1.8.0