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); $MotorRecord = new MotorRecord(); $result = false; $this->model->startTrans(); try { $row->user->partnership = $params['amount']; $result = $row->user->save(); $MotorRecord->setMoneyLog($row['user'], 'partnership', $params['amount'], 30, '发放合伙资产'); $MotorRecord->saveMoneyLog(); $this->model->commit(); } catch(Exception $e) { $this->model->rollback(); } if ($result) { IResponse::success([],'成功'); } IResponse::failure('失败'); } }