Worker.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace app\api\controller\h5;
  3. use app\hander\HelpHander;
  4. use think\Controller;
  5. use think\Db;
  6. use think\Exception;
  7. class Worker extends Base
  8. {
  9. //推荐护工
  10. public function hot(){
  11. $model = new \app\common\model\Worker();
  12. $data = $model->hotList($this->orgId);
  13. HelpHander::success($data);
  14. }
  15. // 护工列表
  16. public function lists(){
  17. $page = input('page',1);
  18. $size = input('size',10);
  19. $model = new \app\common\model\Worker();
  20. $res = $model->apiLists($this->orgId,[],$page,$size);
  21. HelpHander::success($res['rows'],'操作成功');
  22. }
  23. // 用户下单
  24. public function order(){
  25. $model = new \app\common\model\PhOrders();
  26. $res = $model->bookOrder();
  27. if(!$res){
  28. HelpHander::error($model->getError());
  29. }
  30. HelpHander::success(['payId'=>$res],'操作成功');
  31. }
  32. public function userInfo(){
  33. $info = Db::name('wxuser')
  34. ->where('id',$this->userId)
  35. ->find();
  36. HelpHander::success($info);
  37. }
  38. // 护工列表
  39. public function cates(){
  40. $lists = Db::name('cate')->where('org_id',$this->orgId)->where('enable',1)->where('del',0)->select();
  41. $lists = $lists?$lists:[];
  42. foreach ($lists as $k=>$v){
  43. $lists[$k]['title'] = $v['title']."[单价:".$v['price']."]";
  44. }
  45. HelpHander::success($lists,'操作成功');
  46. }
  47. }