123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- <?php
- namespace app\api\controller\v1;
- use app\api\controller\Base;
- use app\common\model\Worker;
- use app\hander\HelpHander;
- use think\App;
- use think\Db;
- use think\exception\Handle;
- class PhOrders extends Base
- {
- //护工工单列表
- public function todoList(){
- $page = input('page',1);
- $size = input('size',10);
- $status = input('status/d',-1);
- $model = new \app\common\model\PhOrders();
- $res = $model->workerOrderList($this->orgId,$status,$page,$size,$this->userId);
- HelpHander::success($res,'操作成功');
- }
- //护工工单详情
- public function todoDetail(){
- $id = input('id',0);
- $model = new \app\common\model\PhOrders();
- $res = $model->todoDetail($id);
- HelpHander::success($res,'操作成功');
- }
- //调度订单列表
- public function orderList(){
- $page = input('page',1);
- $size = input('size',10);
- $status = input('status/d',-1);
- $model = new \app\common\model\PhOrders();
- $res = $model->orderList1($this->orgId,$status,$page,$size);
- HelpHander::success($res,'操作成功');
- }
- //订单详情
- public function detail(){
- $id = input('id/d','');
- $model = new \app\common\model\PhOrders();
- $ret = $model->getInfo($id);
- HelpHander::success($ret,'操作成功');
- }
- //取消订单
- public function cancel(){
- $note = input('cancelReason','','trim');
- $id = input('id/d',0);
- $model = new \app\common\model\PhOrders();
- $ret = $model->cancelOrder($id,$note,$this->userId);
- if(!$ret){
- HelpHander::error($model->getError());
- }else{
- HelpHander::success([],'操作成功');
- }
- }
- //确认完成
- public function finish(){
- $model = new \app\common\model\PhOrders();
- $res = $model->finishSave($this->userId,$this->orgId);
- if($res){
- HelpHander::success([],'操作成功');
- }else{
- HelpHander::error($model->getError());
- }
- }
- //发单
- public function add(){
- $model = new \app\common\model\PhOrders();
- $res = $model->addSave($this->userId,$this->orgId,1);
- if($res){
- HelpHander::success([],'操作成功');
- }else{
- HelpHander::error($model->getError());
- }
- }
- public function send(){
- $model = new \app\common\model\PhOrders();
- $res = $model->sendSave($this->userId,$this->orgId);
- if($res){
- HelpHander::success([],'操作成功');
- }else{
- HelpHander::error($model->getError());
- }
- }
- public function getWorkerAll(){
- $model = new Worker();
- $ret = $model->getAllByOrg($this->orgId);
- HelpHander::success($ret,'成功');
- }
- public function payOrder(){
- $id = input('id/d',0);
- $remark = input('remark','','trim');
- $money = input('money/f',0);
- if($money <= 0){
- HelpHander::error('输入金额错误');
- }
- $res = model('PhOrderPay')->addSaveDispatch($this->orgId,$id,$money,$remark);
- if($res){
- HelpHander::success([],'操作成功');
- }else{
- HelpHander::error(model('PhOrderPay')->getError());
- }
- }
- /**
- * 退款
- */
- public function refund(){
- $res = model('PhOrderPay')->refundOrder($this->userId);
- if($res){
- HelpHander::success([],'操作成功');
- }else{
- HelpHander::error(model('PhOrderPay')->getError());
- }
- }
- public function payInfo(){
- $id = input('id/d',0);
- $pay = Db::name('ph_order_pay')->where('id',$id)->find();
- if(!$pay){
- HelpHander::error('记录不存在');
- }
- HelpHander::success($pay,'成功');
- }
- }
|