api检测标题是否已经存在
接口特点: 增加任意字段(无论主表或副表),做好字段为维护,无需改动接口,可检测所有表任意字段; 增加模型也无需另增加接口,接口通用; 真正做到接口免维护,更适合小白站长,一劳永逸。
// 修改时
$.ajax({ url: '/api/v1/?act=is_field_exists&classid=64&id=68&field=title&value=驻日大使崔天凯:胡锦涛主席访日有三点值得关注', // 示例 API type: 'GET', dataType: 'json', success: function (response) { if (response && 0 === response.code) {
// 返回 false if (response.data.duplicate) {
alert('已存在'); } } }, error: function (xhr, status, error) { } });
// 新增时
$.ajax({ url: '/api/v1/?act=is_field_exists&classid=64&field=title&value=驻日大使崔天凯:胡锦涛主席访日有三点值得关注', // 示例 API type: 'GET', dataType: 'json', success: function (response) { if (response && 0 === response.code) {
// 返回 true if (response.data.duplicate) {
alert('已存在'); } } }, error: function (xhr, status, error) { } });
|