예제 #1
0
 public function testDbConfig()
 {
     $key = 'key' . time();
     $value = "value";
     DbConfig::set($key, $value);
     $this->assertEquals($value, DbConfig::get($key));
     $this->assertEquals(null, DbConfig::get(time()));
     DbConfig::set($key, null);
     $this->assertEquals("", DbConfig::get($key));
 }
예제 #2
0
 public function updateConfig($request, $response, $args)
 {
     $config = ["analytics-code" => $request->getParam('analyticsCode'), "home-code" => $request->getParam('homeCode'), "app-name" => $request->getParam('appName'), "user-index" => $request->getParam('userIndex'), "user-node" => $request->getParam('userNode')];
     foreach ($config as $key => $value) {
         DbConfig::set($key, $value);
     }
     $res['ret'] = 1;
     $res['msg'] = "更新成功";
     return $response->getBody()->write(json_encode($res));
 }