更新转换

This commit is contained in:
mkm 2024-01-28 14:53:27 +08:00
parent 79702ec7ad
commit a135427f53
1 changed files with 10 additions and 10 deletions

View File

@ -827,11 +827,11 @@ class IndexController extends BaseApiController
public function addVillagerInfo() public function addVillagerInfo()
{ {
$params = $this->request->post(); $params = $this->request->post();
$params['house_rent_info'] = $params['house_rent_info']; $params['house_rent_info'] = $params['house_rent_info']?json_encode($params['house_rent_info']):'';
$params['land_rent_info'] = $params['land_rent_info']; $params['land_rent_info'] = $params['land_rent_info']?json_encode($params['land_rent_info']):'';
$params['product_info'] = $params['product_info']; $params['product_info'] = $params['product_info']?json_encode($params['product_info']):'';
$params['idle_asset_rent_info'] = $params['idle_asset_rent_info']; $params['idle_asset_rent_info'] = $params['idle_asset_rent_info']?json_encode($params['idle_asset_rent_info']):'';
$params['house_decoration_construction'] = $params['house_decoration_construction']; $params['house_decoration_construction'] = $params['house_decoration_construction']?json_encode($params['house_decoration_construction']):'';
$params['create_time'] = time(); $params['create_time'] = time();
$params['update_time'] = time(); $params['update_time'] = time();
$model = Db::name('villager_information')->insertGetId($params); $model = Db::name('villager_information')->insertGetId($params);
@ -848,11 +848,11 @@ class IndexController extends BaseApiController
public function editVillagerInfo() public function editVillagerInfo()
{ {
$params = $this->request->post(); $params = $this->request->post();
$params['house_rent_info'] = $params['house_rent_info']; $params['house_rent_info'] = $params['house_rent_info']?json_encode($params['house_rent_info']):'';
$params['land_rent_info'] = $params['land_rent_info']; $params['land_rent_info'] = $params['land_rent_info']?json_encode($params['land_rent_info']):'';
$params['product_info'] = $params['product_info']; $params['product_info'] = $params['product_info']?json_encode($params['product_info']):'';
$params['idle_asset_rent_info'] = $params['idle_asset_rent_info']; $params['idle_asset_rent_info'] = $params['idle_asset_rent_info']?json_encode($params['idle_asset_rent_info']):'';
$params['house_decoration_construction'] = $params['house_decoration_construction']; $params['house_decoration_construction'] = $params['house_decoration_construction']?json_encode($params['house_decoration_construction']):'';
Db::name('villager_information')->where('shop_user_id', $params['shop_user_id'])->update($params); Db::name('villager_information')->where('shop_user_id', $params['shop_user_id'])->update($params);
return $this->success('更新成功'); return $this->success('更新成功');
} }