where('parent_id','<>',0) ->select(); foreach($result as $key => $val){ $rtn[$val['code']]=$val['value']; } return $this->success($rtn); } public function setShopConfig(){ $data = input('post.'); try{ foreach($data as $key => $val){ Db::name('shop_config') ->where('code',$key) ->update(['value'=>$val]); } }catch(\Exception $e){ return $this->error('更新失敗'); } return $this->success('更新成功'); } public function getAgents(){ $result = Db::name('agent') ->select(); return $this->success($result); } public function uploadLogo(){ $file = request()->file('file'); try{ $savename = \think\facade\Filesystem::disk('public')->putFile('images', $file); }catch(\Exception $e){ return $this->Error($e->getMessage()); } return $this->Success($savename); } }