Test.php 783 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace app\admin\controller;
  3. use app\common\util\ExcelUtil;
  4. use think\Db;
  5. class Test extends Auth
  6. {
  7. public function index(){
  8. $data = Db::name('device_record')
  9. ->alias('dr')
  10. ->join('device d', 'd.id=dr.device_id')
  11. ->field('dr.*,d.title as device_name,d.content as device_details')
  12. ->where('dr.org_id',$this->orgId)
  13. ->where('cate_id','in',[22,23])
  14. ->order('dr.id desc')
  15. ->limit(30)
  16. ->select();
  17. foreach ($data as $k=>$v){
  18. $img = explode(',',$v['images']);
  19. if($img){
  20. $data[$k]['images'] = $img[0];
  21. }
  22. }
  23. halt($data);
  24. HelpHander::success($data);
  25. }
  26. }