Basedata.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\controller\Api;
  4. use think\Db;
  5. /**
  6. * 基础文章接口
  7. */
  8. class Basedata extends Api
  9. {
  10. protected $noNeedLogin = ['*'];
  11. protected $noNeedRight = ['*'];
  12. public function find(){
  13. $key = input('key');
  14. if(!$key){
  15. $this->error();
  16. }
  17. $fields = 'name,content,updatetime';
  18. $find = Db::name('basedata')->field($fields)->where('key',$key)->find();
  19. $this->success('success',$find);
  20. }
  21. public function carrule(){
  22. $base = Db::name('basedata')->where('key','carbaseservice')->value('content');
  23. $read = Db::name('basedata')->where('key','carmustread')->value('content');
  24. $rs = [
  25. 'base' => $base,
  26. 'read' => $read,
  27. ];
  28. $this->success('success',$rs);
  29. }
  30. //邀请页面
  31. public function yaoqing(){
  32. $rs = [
  33. 'yaoqingrule' => Db::name('basedata')->where('key','yaoqingrule')->value('content'),
  34. 'beiyaoqinginfo' => Db::name('basedata')->where('key','beiyaoqinginfo')->value('content'),
  35. 'yaoqing_page_image' => localpath_to_netpath(config('site.yaoqing_page_image')),
  36. 'beiyaoqing_page_image' => localpath_to_netpath(config('site.beiyaoqing_page_image')),
  37. ];
  38. $this->success('success',$rs);
  39. }
  40. }