addArticle.md
6.35 KB
新增资讯接口
接口名:
/guang/article/addArticle
方法
POST JSONRAW
入参
属性名称 | 类型 | 例子 | 说明 | 是否必填 | 长度限制 |
---|---|---|---|---|---|
articleTitle | String | 尖货盘点 | 资讯标题 | 是 | 1-85 |
articleGender | String | 0 | 性别 | 是 | 1-1 |
authorId | int | 3098 | 作者ID | 是 | 1-11 |
maxSortId | int | 12 | 一级分类ID | 是 | 1-11 |
minSortId | int | 35 | 二级分类ID | 否 | 0-11 |
articleSummary | String | 御寒首选 | 摘要 | 是 | 1-85 |
coverImage | String | 封面图 | 是 | 1-200 | |
coverImageType | int | 1 | 图片类型 | 是 | 1-1 |
articleType | int | 1 | 文章类型 | 否 | 0-1 |
adsImgSize | String | 10881088 | 广告尺寸 | 否 | 0-20 |
url | String | {"action":"go.activity","url":"http://feature.yohobuy.com/0/0/373/index.html"} | 链接 | 否 | 0-166 |
contentData | String | [{"templateKey":"singleImage","contentData":{"template_name":"singleImage","template_intro":"一张图片","data":{"0":{"url":{},"alt":"","src":""}}}"}] | 文章内容 | 否 | - |
brands | String | [{"id":102,"brandCategory":1},{"id":103,"brandCategory":2}] | 关联品牌信息,brandCategory 1 yohobuy品牌 2 全球购品牌 | 否 | - |
tag | String | 欧美,复古,街头 | 文章标签 | 否 | 0-85 |
对应SQL的操作库表
<insert id="insertSelective" useGeneratedKeys="true" keyProperty="id" parameterType="com.yohobuy.platform.dal.guang.model.Article" >
insert into article
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="articleTitle != null" >
article_title,
</if>
<if test="maxSortId != null" >
max_sort_id,
</if>
<if test="minSortId != null" >
min_sort_id,
</if>
<if test="authorId != null" >
author_id,
</if>
<if test="coverImage != null" >
cover_image,
</if>
<if test="coverImageType != null" >
cover_image_type,
</if>
<if test="url != null" >
url,
</if>
<if test="adsImgSize != null" >
ads_img_size,
</if>
<if test="articleType != null" >
article_type,
</if>
<if test="articleSummary != null" >
article_summary,
</if>
<if test="articleGender != null" >
article_gender,
</if>
<if test="brand != null" >
brand,
</if>
<if test="tag != null" >
tag,
</if>
<if test="praise != null" >
praise,
</if>
<if test="browse != null" >
browse,
</if>
<if test="status != null" >
status,
</if>
<if test="isRecommend != null" >
is_recommend,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="publishTime != null" >
publish_time,
</if>
<if test="publishState != null" >
publish_state,
</if>
<if test="updateTime != null" >
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="articleTitle != null" >
#{articleTitle,jdbcType=VARCHAR},
</if>
<if test="maxSortId != null" >
#{maxSortId,jdbcType=INTEGER},
</if>
<if test="minSortId != null" >
#{minSortId,jdbcType=INTEGER},
</if>
<if test="authorId != null" >
#{authorId,jdbcType=INTEGER},
</if>
<if test="coverImage != null" >
#{coverImage,jdbcType=VARCHAR},
</if>
<if test="coverImageType != null" >
#{coverImageType,jdbcType=TINYINT},
</if>
<if test="url != null" >
#{url,jdbcType=VARCHAR},
</if>
<if test="adsImgSize != null" >
#{adsImgSize,jdbcType=VARCHAR},
</if>
<if test="articleType != null" >
#{articleType,jdbcType=TINYINT},
</if>
<if test="articleSummary != null" >
#{articleSummary,jdbcType=VARCHAR},
</if>
<if test="articleGender != null" >
#{articleGender,jdbcType=CHAR},
</if>
<if test="brand != null" >
#{brand,jdbcType=VARCHAR},
</if>
<if test="tag != null" >
#{tag,jdbcType=VARCHAR},
</if>
<if test="praise != null" >
#{praise,jdbcType=INTEGER},
</if>
<if test="browse != null" >
#{browse,jdbcType=INTEGER},
</if>
<if test="status != null" >
#{status,jdbcType=TINYINT},
</if>
<if test="isRecommend != null" >
#{isRecommend,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=INTEGER},
</if>
<if test="publishTime != null" >
#{publishTime,jdbcType=INTEGER},
</if>
<if test="publishState != null" >
#{publishState,jdbcType=TINYINT},
</if>
<if test="updateTime != null" >
#{updateTime,jdbcType=INTEGER},
</if>
</trim>
</insert>
<insert id="insertBatch" parameterType="java.util.List" >
insert into article_block (article_id, template_key,
order_by, create_time, content_data)
values
<foreach collection="list" item="item" separator=",">
(#{item.articleId,jdbcType=INTEGER}, #{item.templateKey,jdbcType=VARCHAR},
#{item.orderBy,jdbcType=INTEGER}, #{item.createTime,jdbcType=INTEGER}, #{item.contentData,jdbcType=LONGVARCHAR})
</foreach>
</insert>
<insert id="insertBatch" parameterType="java.util.List" >
insert into article_brand_relation (article_id, brand_id, brand_category, order_by,
create_time)
values
<foreach collection="list" item="item" separator=",">
(#{item.articleId,jdbcType=INTEGER}, #{item.brandId,jdbcType=INTEGER}, #{item.brandCategory,jdbcType=INTEGER}, #{item.orderBy,jdbcType=TINYINT},
#{item.createTime,jdbcType=INTEGER})
</foreach>
</insert>
错误编码
错误码code | 消息 | 说明 |
---|---|---|
400 | 文章信息为空! | |
400 | 请输入文章链接或文章内容 | |
400 | 请填写广告链接 | |
400 | 请选择广告图片尺寸 | |
200 | 添加成功! | |
400 | 添加失败! |
返回
{
"code":200,
"message":"添加成功!"
}