Worker.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace app\api\controller\h5;
  3. use app\common\util\AppMsg;
  4. use app\hander\HelpHander;
  5. use think\Controller;
  6. use think\Db;
  7. use think\Exception;
  8. class Worker extends Base
  9. {
  10. //推荐护工
  11. public function hot(){
  12. $model = new \app\common\model\Worker();
  13. $data = $model->hotList($this->orgId);
  14. HelpHander::success($data);
  15. }
  16. // 护工列表
  17. public function lists(){
  18. $page = input('page',1);
  19. $size = input('size',10);
  20. $model = new \app\common\model\Worker();
  21. $res = $model->apiLists($this->orgId,[],$page,$size);
  22. HelpHander::success($res['rows'],'操作成功');
  23. }
  24. // 用户下单
  25. public function order(){
  26. $depId = input('depId/d',0);
  27. $model = new \app\common\model\PhOrders();
  28. $res = $model->bookOrder();
  29. if(!$res){
  30. HelpHander::error($model->getError());
  31. }
  32. $ids = Db::table('ph_user')
  33. ->where('org_id',$this->orgId)
  34. ->where('','exp',Db::raw("FIND_IN_SET($depId,dep)"))
  35. ->column('user');
  36. if (!empty($ids)) {
  37. send_jpush($ids,AppMsg::PUSH_WORKER_ORDER_SEND,'有一个新的陪护订单,请注意查看',['id'=>$res]);
  38. }
  39. HelpHander::success(['payId'=>$res],'操作成功');
  40. }
  41. public function userInfo(){
  42. $info = Db::name('wxuser')
  43. ->where('id',$this->userId)
  44. ->find();
  45. HelpHander::success($info);
  46. }
  47. // 护工列表
  48. public function cates(){
  49. $lists = Db::name('cate')->where('org_id',$this->orgId)->where('enable',1)->where('del',0)->select();
  50. $lists = $lists?$lists:[];
  51. foreach ($lists as $k=>$v){
  52. $lists[$k]['title'] = $v['title']."[单价:".$v['price']."]";
  53. }
  54. HelpHander::success($lists,'操作成功');
  55. }
  56. }