Usercenter.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace app\company\controller;
  3. use app\common\controller\Apic;
  4. use think\Db;
  5. /**
  6. * 轮播图
  7. */
  8. class Usercenter extends Apic
  9. {
  10. protected $noNeedLogin = [''];
  11. protected $noNeedRight = [''];
  12. //信息维护
  13. public function company_info(){
  14. $banner = Db::name('banner')->where('company_id',$this->auth->company_id)->column('image');
  15. $company = Db::name('company')->field('aboutus_image,aboutus')->where('id',$this->auth->company_id)->find();
  16. $rs = [
  17. 'banner' => one_domain_image(implode(',',$banner)),
  18. 'aboutus' => $company['aboutus'],
  19. 'aboutus_image' => localpath_to_netpath($company['aboutus_image']),
  20. ];
  21. $this->success(1,$rs);
  22. }
  23. //设置轮播图,关于我们图
  24. public function set_banner()
  25. {
  26. //轮播图
  27. $banner_images = input('banner_images','');
  28. Db::name('banner')->where('company_id',$this->auth->company_id)->delete();
  29. $banner_images = explode(',',$banner_images);
  30. if(!empty($banner_images)){
  31. foreach($banner_images as $key => $val){
  32. $insert_all[] = [
  33. 'image' => $val,
  34. 'company_id' => $this->auth->company_id,
  35. ];
  36. }
  37. Db::name('banner')->insertAll($insert_all);
  38. }
  39. //关于我们图
  40. $aboutus_image = input('aboutus_image','');
  41. $update = ['aboutus_image'=>$aboutus_image];
  42. Db::name('company')->where('id',$this->auth->company_id)->update($update);
  43. $this->success();
  44. }
  45. //设置关于我们
  46. public function set_aboutus()
  47. {
  48. $aboutus = input('aboutus','','htmlspecialchars_decode');
  49. $update = ['aboutus'=>$aboutus];
  50. Db::name('company')->where('id',$this->auth->company_id)->update($update);
  51. $this->success();
  52. }
  53. }