Authored by 邱骏

update

@@ -151,9 +151,27 @@ const article = { @@ -151,9 +151,27 @@ const article = {
151 151
152 req.ctx(ArticleModel).getSingleArticle(actId, articleId) 152 req.ctx(ArticleModel).getSingleArticle(actId, articleId)
153 .then(ret => { 153 .then(ret => {
  154 + let img_arr = _.map(ret, 'img_url');
  155 +
  156 + console.log(img_arr);
  157 + let result = {};
  158 + let final_result = {};
  159 +
  160 + if (ret.length > 0) {
  161 + result.id = ret[0].id;
  162 + result.content = ret[0].content;
  163 + result.good_count = ret[0].good_count;
  164 + result.user_id = ret[0].user_id;
  165 + result.user_name = ret[0].user_name;
  166 + result.create_time = ret[0].create_time;
  167 + result.img_url = img_arr;
  168 + }
  169 + _.each(result, (value, key) => {
  170 + final_result[camelcase(key)] = value;
  171 + });
154 res.json({ 172 res.json({
155 code: 200, 173 code: 200,
156 - data: ret, 174 + data: final_result,
157 message: GET_ARTICLE_SUCCESS 175 message: GET_ARTICLE_SUCCESS
158 }); 176 });
159 }); 177 });