model = new TaxiUser(); } /** * @desc 审核司机 * @param $ids * @throws \think\exception\PDOException * @author weichuanbao<654745815@qq.com> * @date 2021/12/7 0007 */ public function check($ids) { $row = $this->model::get($ids); if (!$row) { IResponse::failure('记录不存在'); } $result = false; $this->model->startTrans(); try { $row->status = 5; $result = $row->save(); $this->model->commit(); } catch(Exception $e) { $this->model->rollback(); } if ($result) { IResponse::success([],'成功'); } IResponse::failure('失败'); } /** * @desc 发放合伙资产 * @param $ids * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException * @throws \think\exception\PDOException * @author weichuanbao<654745815@qq.com> * @date 2022/1/7 0007 */ public function partnership($ids) { $row = $this->model->with('user')->find($ids); if (!$row) { IResponse::failure('记录不存在'); } $params = input(); $params['amount'] = input('amount', 0); if(floatval($params['amount'])<=0){ IResponse::failure('请输入合法资产金额'); } $MotorRecord = new MotorRecord(); $result = false; $this->model->startTrans(); var_dump($row->user); try { if(!$row->user){ IResponse::failure('该司机未绑定用户'); } $row->user->partnership = $params['amount']; $result = $row->user->save(); IResponse::failure('该司机未绑定用户'); $MotorRecord->setMoneyLog($row['user'], 'partnership', $params['amount'], 30, '发放合伙资产'); $MotorRecord->saveMoneyLog(); $this->model->commit(); } catch(Exception $e) { $this->model->rollback(); IResponse::failure($e->getMessage()); } if ($result) { IResponse::success([],'成功'); }else{ IResponse::failure('失败'); } } }