Ad.php 560 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2019/10/29
  6. * Time: 16:38
  7. */
  8. namespace app\common\model;
  9. use think\Model;
  10. use think\Db;
  11. use think\Config;
  12. class Ad extends Model
  13. {
  14. protected $table = 'cy_ad';
  15. protected $dateFormat = false;
  16. /**
  17. * 获取页内广告
  18. */
  19. public function getPageAd(){
  20. $adInfo = Db::connect(config('database_slave'))->table('cy_ad')->cache(Config::get('QUERY_RESULT_CACHE_TIME'))->where('type',99)->order('sort asc,create_time asc')->find();
  21. return $adInfo;
  22. }
  23. }