public function node($request, $response, $args) { $msg = DbConfig::get('user-node'); $user = Auth::getUser(); $nodes = Node::where('type', 1)->orderBy('sort')->get(); return $this->view()->assign('nodes', $nodes)->assign('user', $user)->assign('msg', $msg)->display('user/node.tpl'); }
public static function getAppName() { $appName = DbConfig::get('app-name'); if ($appName == null || $appName == "") { return self::get("appName"); } return $appName; }
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)); }
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)); }
/** * @param $template * @param $ary * @return mixed */ public static function genHtml($template, $ary) { $smarty = new smarty(); $smarty->settemplatedir(BASE_PATH . '/resources/email/'); $smarty->setcompiledir(BASE_PATH . '/storage/framework/smarty/compile/'); $smarty->setcachedir(BASE_PATH . '/storage/framework/smarty/cache/'); // add config $smarty->assign('config', Config::getPublicConfig()); $smarty->assign('analyticsCode', DbConfig::get('analytics-code')); foreach ($ary as $key => $value) { $smarty->assign($key, $value); } return $smarty->fetch($template); }
public static function getSmarty() { $smarty = new smarty(); //实例化smarty $smarty->settemplatedir(BASE_PATH . '/resources/views/' . Config::get('theme') . '/'); //设置模板文件存放目录 $smarty->setcompiledir(BASE_PATH . '/storage/framework/smarty/compile/'); //设置生成文件存放目录 $smarty->setcachedir(BASE_PATH . '/storage/framework/smarty/cache/'); //设置缓存文件存放目录 // add config $smarty->assign('config', Config::getPublicConfig()); $smarty->assign('user', Auth::getUser()); $smarty->assign('analyticsCode', DbConfig::get('analytics-code')); return $smarty; }
public function code() { $msg = DbConfig::get('home-code'); $codes = InviteCode::where('user_id', '=', '0')->take(10)->get(); return $this->view()->assign('codes', $codes)->assign('msg', $msg)->display('code.tpl'); }