Service.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace app\api\controller\h5;
  3. use app\hander\HelpHander;
  4. use think\Db;
  5. class Service extends Base
  6. {
  7. // 根据组织获取服务
  8. public function list(){
  9. $lists = Db::name('service')
  10. ->field('id,title')
  11. ->where('org_id',$this->orgId)
  12. ->where('del',0)
  13. ->where('enable',1)
  14. ->select();
  15. HelpHander::success($lists);
  16. }
  17. // 根据日期获取服务时间
  18. public function times(){
  19. $serviceId = input('serviceId/d');
  20. $day = input('day/s','','trim');
  21. $lists = Db::name('service_time')
  22. ->field('id,day,start,end,limit')
  23. ->where('org_id',$this->orgId)
  24. ->where('del',0)
  25. ->where('enable',1)
  26. ->where('service_id',$serviceId)
  27. ->where('day',$day)
  28. ->order('start asc')
  29. ->select();
  30. foreach ($lists as $k=>$v){
  31. $lists[$k]['start'] = date('H:i',strtotime($v['day'].' '.$v['start']));
  32. $lists[$k]['end'] = date('H:i',strtotime($v['day'].' '.$v['end']));
  33. }
  34. HelpHander::success($lists);
  35. }
  36. }