Index.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\controller\Api;
  4. use think\Db;
  5. /**
  6. * 首页接口
  7. */
  8. class Index extends Api
  9. {
  10. protected $noNeedLogin = ['*'];
  11. protected $noNeedRight = ['*'];
  12. /**
  13. * 首页
  14. *
  15. */
  16. public function index()
  17. {
  18. $this->success('请求成功');
  19. }
  20. public function getConfiguration()
  21. {
  22. $name = $this->request->post('name');
  23. $website = $this->request->post('website');
  24. $where['name']=$name;
  25. $where['website']=$website;
  26. $where['status']='normal';
  27. $list = Db::name('functional')->where($where)->find();
  28. unset($where);
  29. $where['fid']=$list['id'];
  30. $where['status']='normal';
  31. $domain2 = $this->request->domain();
  32. if($list['image']){
  33. $list['image']=$domain2.$list['image'];
  34. }
  35. if($list['image_m']){
  36. $list['image_m']=$domain2.$list['image_m'];
  37. }
  38. $list['details']=Db::name('functional_del')->where($where)->select();
  39. foreach ($list['details'] as $k=>$v){
  40. if($v['image']){
  41. $list['details'][$k]['image']=$domain2.$v['image'];
  42. }
  43. if($v['image_m']){
  44. $list['details'][$k]['image_m']=$domain2.$v['image_m'];
  45. }
  46. }
  47. $this->success('请求成功',$list);
  48. }
  49. }