Content.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace app\api\controller;
  3. use app\admin\model\Contents;
  4. use app\common\controller\Api;
  5. use app\common\model\Page;
  6. /**
  7. * 图文管理
  8. */
  9. class Content extends Api
  10. {
  11. protected $noNeedLogin = '*';
  12. protected $noNeedRight = '*';
  13. /**
  14. * 图文详情
  15. * @ApiParams (name=id,description="8售后保障7发票保障6配送签收常见问题5支付方式4如何下单3账号管理2注册登录1关于酷屏")
  16. * @ApiReturnParams (name=content,description="内容")
  17. */
  18. public function show(){
  19. $data=$this->_validate([
  20. 'id'=>['require'],
  21. ]);
  22. $content=Contents::where('id',$data['id'])->find();
  23. if($content && !$content['create_time']){
  24. $content['create_time']=time();
  25. $content->save();
  26. }
  27. $this->success('',$content);
  28. }
  29. /**
  30. * 获取页面配置
  31. * @ApiParams (name=page,description="页面名称zhihuiyiliao,zhihuicanyin,zhihuijinrong,zhihuilingshou,yunpingtai,chanpindingzhi,shouye")
  32. * @ApiReturnParams (name=content,description="页面配置,abcdefg代表从上到下页面顺序配置,title标题,title_en英文标题,title_btn按钮标题,title_in页面内标题,bg背景图,desc描述或者介绍,logo就是logo,image图片,icon图标,href跳转链接,img_rt右侧图片,list功能列表,")
  33. * @ApiReturnParams (name=hezuodanwei,description="合作单位列表")
  34. */
  35. public function page(){
  36. $pages=Page::column('key');
  37. $data=$this->_validate([
  38. 'page|页面'=>['require','in:'.implode(',',$pages)],
  39. ]);
  40. $page=Page::where('key',$data['page'])->find();
  41. $global=Page::where('key','hezuodanwei')->find();
  42. $this->success('',[
  43. 'content'=>$page['content'],
  44. 'hezuodanwei'=>$global['content'],
  45. ]);
  46. }
  47. }