updateEvent('wxopen'); } /** * 微信开放平台网站应用设置 */ public function wxweb() { return $this->updateEvent('wxweb'); } /** * 支付宝第三方平台设置 */ public function alipayopen() { return $this->updateEvent('alipayopen'); } /** * 更新设置事件 */ private function updateEvent(string $key) { if (!$this->request->isAjax()) { $model = SettingModel::getItem($key); if($key == 'wxopen'){ $status = ['失败','正常']; if(Cache::get('component_access_token')){ $value = 1; }else{ $value = 0; } $model['status'] = ['text' => $status[$value], 'value' => $value]; } return View::fetch($key, compact('model')); } $model = new SettingModel; if ($model->edit($key,$this->postData('data'))) { return $this->renderSuccess('更新成功'); } return $this->renderError('更新失败'); } }