diff --git a/app/adminapi/logic/farm/FarmLogic.php b/app/adminapi/logic/farm/FarmLogic.php index 7bc4197..ed787e0 100644 --- a/app/adminapi/logic/farm/FarmLogic.php +++ b/app/adminapi/logic/farm/FarmLogic.php @@ -41,6 +41,7 @@ class FarmLogic extends BaseLogic Db::startTrans(); try { Farm::create([ + 'user_id' => $params['user_id'], 'farm_name' => $params['farm_name'], 'farm_type' => $params['farm_type'], 'breed_type' => $params['breed_type'], diff --git a/app/api/controller/FarmController.php b/app/api/controller/FarmController.php index 8522739..3b8236b 100644 --- a/app/api/controller/FarmController.php +++ b/app/api/controller/FarmController.php @@ -20,6 +20,7 @@ class FarmController extends BaseApiController public function add() { $params = (new FarmValidate())->post()->goCheck('add'); + $params['user_id'] = $this->userId; $result = FarmLogic::add($params); if (true === $result) { return $this->success('添加成功', [], 1, 1);