Exemplo n.º 1
0
 /**
  * 每日一问
  */
 public function actionAskedDaily()
 {
     try {
         $askInfo = AskedDaily::findLasted();
         if (!$askInfo) {
             $this->code(450, '未找到每日一问内容');
         }
         $this->code(200, 'ok', ['question_id' => $askInfo['id'], 'title' => $askInfo['title'], 'content' => str_replace("\n", "\n\n", $askInfo['content']), 'url' => $askInfo['url']]);
     } catch (Exception $e) {
         $this->code(500, $e->getMessage());
     }
 }