diff --git a/APIJSON.NET/APIJSON.NET/APIJSON.NET.csproj b/APIJSON.NET/APIJSON.NET/APIJSON.NET.csproj index 634243e..96ad777 100644 --- a/APIJSON.NET/APIJSON.NET/APIJSON.NET.csproj +++ b/APIJSON.NET/APIJSON.NET/APIJSON.NET.csproj @@ -2,6 +2,8 @@ netcoreapp2.2 + false + 801d0f5b-e25d-416a-999f-0a82f7674301 diff --git a/APIJSON.NET/APIJSON.NET/Controllers/JsonController.cs b/APIJSON.NET/APIJSON.NET/Controllers/JsonController.cs index 1fd8d2e..e7f327c 100644 --- a/APIJSON.NET/APIJSON.NET/Controllers/JsonController.cs +++ b/APIJSON.NET/APIJSON.NET/Controllers/JsonController.cs @@ -99,7 +99,7 @@ public async Task QueryByTable([FromRoute]string table) /// /// [HttpPost("/add")] - public ActionResult Add([FromBody]JObject jobject) + public async Task Add([FromBody]JObject jobject) { JObject ht = new JObject(); @@ -107,9 +107,6 @@ public ActionResult Add([FromBody]JObject jobject) ht.Add("msg", "success"); try { - - - foreach (var item in jobject) { string key = item.Key.Trim(); diff --git a/APIJSON.NET/APIJSON.NET/Controllers/TokenController.cs b/APIJSON.NET/APIJSON.NET/Controllers/TokenController.cs index 2979019..ffc6860 100644 --- a/APIJSON.NET/APIJSON.NET/Controllers/TokenController.cs +++ b/APIJSON.NET/APIJSON.NET/Controllers/TokenController.cs @@ -30,7 +30,7 @@ public TokenController(DbContext _db, IOptions configura } [HttpPost("/token")] [AllowAnonymous] - public ActionResult Create([FromBody]TokenInput input) + public async Task< ActionResult> Create([FromBody]TokenInput input) { JObject ht = new JObject(); ht.Add("code", "200"); diff --git a/APIJSON.NET/APIJSON.NET/appsettings.json b/APIJSON.NET/APIJSON.NET/appsettings.json index da52e61..53f9f41 100644 --- a/APIJSON.NET/APIJSON.NET/appsettings.json +++ b/APIJSON.NET/APIJSON.NET/appsettings.json @@ -1,7 +1,7 @@ { "ConnectionStrings": { "DbType": 0, //0:MySql,1:SqlServer,2:Sqlite - "ConnectionString": "Server=192.168.2.25;Database=yunwei;Uid=root;Pwd=xmjk;Port=3306;Character Set=utf8;" + "ConnectionString": "Server=;Database=wordpress;Uid=roota;Pwd=@Abc;Port=3306;Character Set=utf8;" //"ConnectionString": "Server=119.29.9.25;Port=3306;Database=test;Uid=root;Pwd=1q,2w.3e?;CharSet=UTF8;" }, "Authentication": { @@ -16,20 +16,20 @@ { "name": "role1", //权限名称 唯一 "select": { //查询权限 - "table": [ "moment", "User", "Comment" ], //可操作的表 + "table": [ "guopindata" ], //可操作的表 "column": [ "*", "*", "*" ], //可操作的字段 "where": [] }, "update": { //修改权限 - "table": [ "moment", "User", "Comment" ], + "table": [ "guopindata" ], "column": [ "*", "*", "*" ] }, "insert": { //添加权限 - "table": [ "moment", "User", "Comment" ], + "table": [ "guopindata"], "column": [ "*", "*", "*" ] }, "delete": { //删除权限 - "table": [ "moment", "User", "Comment" ] + "table": [ "guopindata" ] } }, { diff --git a/APIJSON.NET/APIJSON.NET/wwwroot/js/main.js b/APIJSON.NET/APIJSON.NET/wwwroot/js/main.js index 7f32e28..7bf3db1 100644 --- a/APIJSON.NET/APIJSON.NET/wwwroot/js/main.js +++ b/APIJSON.NET/APIJSON.NET/wwwroot/js/main.js @@ -22,74 +22,74 @@ template: '#val-template' }) - Vue.use({ - install: function (Vue, options) { - - // 鍒ゆ柇鏁版嵁绫诲瀷 - Vue.prototype.getTyp = function (val) { - return toString.call(val).split(']')[0].split(' ')[1] - } + Vue.use({ + install: function (Vue, options) { - // 鍒ゆ柇鏄惁鏄璞℃垨鑰呮暟缁勶紝浠ュ涓嬬骇杩涜娓叉煋 - Vue.prototype.isObjectArr = function (val) { - return ['Object', 'Array'].indexOf(this.getTyp(val)) > -1 - } + // 鍒ゆ柇鏁版嵁绫诲瀷 + Vue.prototype.getTyp = function (val) { + return toString.call(val).split(']')[0].split(' ')[1] + } - // 鎶樺彔 - Vue.prototype.fold = function ($event) { - var target = Vue.prototype.expandTarget($event) - target.siblings('svg').show() - target.hide().parent().siblings('.expand-view').hide() - target.parent().siblings('.fold-view').show() - } - // 灞曞紑 - Vue.prototype.expand = function ($event) { - var target = Vue.prototype.expandTarget($event) - target.siblings('svg').show() - target.hide().parent().siblings('.expand-view').show() - target.parent().siblings('.fold-view').hide() - } + // 鍒ゆ柇鏄惁鏄璞℃垨鑰呮暟缁勶紝浠ュ涓嬬骇杩涜娓叉煋 + Vue.prototype.isObjectArr = function (val) { + return ['Object', 'Array'].indexOf(this.getTyp(val)) > -1 + } - //鑾峰彇灞曞紑鎶樺彔鐨則arget - Vue.prototype.expandTarget = function ($event) { - switch($event.target.tagName.toLowerCase()) { - case 'use': - return $($event.target).parent() - case 'label': - return $($event.target).closest('.fold-view').siblings('.expand-wraper').find('.icon-square-plus').first() - default: - return $($event.target) - } - } + // 鎶樺彔 + Vue.prototype.fold = function ($event) { + var target = Vue.prototype.expandTarget($event) + target.siblings('svg').show() + target.hide().parent().siblings('.expand-view').hide() + target.parent().siblings('.fold-view').show() + } + // 灞曞紑 + Vue.prototype.expand = function ($event) { + var target = Vue.prototype.expandTarget($event) + target.siblings('svg').show() + target.hide().parent().siblings('.expand-view').show() + target.parent().siblings('.fold-view').hide() + } - // 鏍煎紡鍖栧 - Vue.prototype.formatVal = function (val) { - switch(Vue.prototype.getTyp(val)) { - case 'String': - return '"' + val + '"' - break + //鑾峰彇灞曞紑鎶樺彔鐨則arget + Vue.prototype.expandTarget = function ($event) { + switch ($event.target.tagName.toLowerCase()) { + case 'use': + return $($event.target).parent() + case 'label': + return $($event.target).closest('.fold-view').siblings('.expand-wraper').find('.icon-square-plus').first() + default: + return $($event.target) + } + } - case 'Null': - return 'null' - break + // 鏍煎紡鍖栧 + Vue.prototype.formatVal = function (val) { + switch (Vue.prototype.getTyp(val)) { + case 'String': + return '"' + val + '"'; + break; - default: - return val + case 'Null': + return 'null'; + break; - } - } + default: + return val; - // 鍒ゆ柇鍊兼槸鍚︽槸閾炬帴 - Vue.prototype.isaLink = function (val) { - return /^((https|http|ftp|rtsp|mms)?:\/\/)[^\s]+/.test(val) - } + } + }; - // 璁$畻瀵硅薄鐨勯暱搴 - Vue.prototype.objLength = function (obj) { - return Object.keys(obj).length - } - } - }) + // 鍒ゆ柇鍊兼槸鍚︽槸閾炬帴 + Vue.prototype.isaLink = function (val) { + return /^((https|http|ftp|rtsp|mms)?:\/\/)[^\s]+/.test(val) + }; + + // 璁$畻瀵硅薄鐨勯暱搴 + Vue.prototype.objLength = function (obj) { + return Object.keys(obj).length + }; + } + }); var initJson = { "[]": { @@ -160,104 +160,104 @@ }, // 鍏ㄩ儴灞曞紑 expandAll: function () { - $('.icon-square-min').show() - $('.icon-square-plus').hide() - $('.expand-view').show() - $('.fold-view').hide() + $('.icon-square-min').show(); + $('.icon-square-plus').hide(); + $('.expand-view').show(); + $('.fold-view').hide(); }, // 鍏ㄩ儴鎶樺彔 collapseAll: function () { - $('.icon-square-min').hide() - $('.icon-square-plus').show() - $('.expand-view').hide() - $('.fold-view').show() + $('.icon-square-min').hide(); + $('.icon-square-plus').show(); + $('.expand-view').hide(); + $('.fold-view').show(); }, // 鍘嬬缉 compress: function () { - App.jsoncon = Parse.compress(App.jsoncon) + App.jsoncon = Parse.compress(App.jsoncon); }, // diff diffTwo: function () { - var oldJSON = {} - var newJSON = {} - App.view = 'code' + var oldJSON = {}; + var newJSON = {}; + App.view = 'code'; try { oldJSON = jsonlint.parse(App.jsoncon) } catch (ex) { - App.view = 'error' - App.error = { - msg: '鍘 JSON 瑙f瀽閿欒\r\n' + ex.message - } - return + App.view = 'error'; + App.error = { + msg: '鍘 JSON 瑙f瀽閿欒\r\n' + ex.message + }; + return; } try { - newJSON = jsonlint.parse(App.newjsoncon) + newJSON = jsonlint.parse(App.newjsoncon); } catch (ex) { - App.view = 'error' - App.error = { - msg: '鏂 JSON 瑙f瀽閿欒\r\n' + ex.message - } - return + App.view = 'error'; + App.error = { + msg: '鏂 JSON 瑙f瀽閿欒\r\n' + ex.message + }; + return; } var base = difflib.stringAsLines(JSON.stringify(oldJSON, '', 4)) var newtxt = difflib.stringAsLines(JSON.stringify(newJSON, '', 4)) var sm = new difflib.SequenceMatcher(base, newtxt) var opcodes = sm.get_opcodes() - $('#diffoutput').empty().append(diffview.buildView({ - baseTextLines: base, - newTextLines: newtxt, - opcodes: opcodes, - baseTextName: '鍘 JSON', - newTextName: '鏂 JSON', - contextSize: 2, - viewType: 0 - })) + $('#diffoutput').empty().append(diffview.buildView({ + baseTextLines: base, + newTextLines: newtxt, + opcodes: opcodes, + baseTextName: '鍘 JSON', + newTextName: '鏂 JSON', + contextSize: 2, + viewType: 0 + })); }, // 娓呯┖ clearAll: function () { - App.jsoncon = '' + App.jsoncon = ''; }, // 缇庡寲 beauty: function () { - App.jsoncon = JSON.stringify(JSON.parse(App.jsoncon), '', 4) + App.jsoncon = JSON.stringify(JSON.parse(App.jsoncon), '', 4); }, baseViewToDiff: function () { - App.baseview = 'diff' - App.diffTwo() + App.baseview = 'diff'; + App.diffTwo(); }, // 鍥炲埌鏍煎紡鍖栬鍥 baseViewToFormater: function () { - App.baseview = 'formater' - App.view = 'code' - App.showJsonView() + App.baseview = 'formater'; + App.view = 'code'; + App.showJsonView(); }, // 鏍规嵁json鍐呭鍙樺寲鏍煎紡鍖栬鍥 showJsonView: function () { if (App.baseview === 'diff') { - return + return; } try { if (this.jsoncon.trim() === '') { - App.view = 'empty' - } else { - App.view = 'code' - App.jsonhtml = jsonlint.parse(this.jsoncon) + App.view = 'empty'; + } else {; + App.view = 'code'; + App.jsonhtml = jsonlint.parse(this.jsoncon); } } catch (ex) { - App.view = 'error' - App.error = { - msg: ex.message - } + App.view = 'error'; + App.error = { + msg: ex.message + }; } }, @@ -265,19 +265,19 @@ save: function () { if (App.history.name.trim() === '') { Helper.alert('鍚嶇О涓嶈兘涓虹┖锛', 'danger') - return - } - var val = { - name: App.history.name, - data: App.jsoncon + return; } - var key = String(Date.now()) - localforage.setItem(key, val, function (err, value) { - Helper.alert('淇濆瓨鎴愬姛锛', 'success') - App.isSaveShow = false - val.key = key - App.historys.push(val) - }) + var val = { + name: App.history.name, + data: App.jsoncon + }; + var key = String(Date.now()); + localforage.setItem(key, val, function (err, value) { + Helper.alert('淇濆瓨鎴愬姛锛', 'success'); + App.isSaveShow = false; + val.key = key; + App.historys.push(val); + }); }, // 鍒犻櫎宸蹭繚瀛樼殑 @@ -321,31 +321,31 @@ }, // 鑾峰彇鍒嗕韩鐨勯摼鎺 - shareUrl: function (key) { - return `${window.location.origin}?key=${key}` + shareUrl: function (key) { + console.log(window.location.origin); + return `${window.location.origin}?key=${key}`; }, // 鍒嗕韩 share: function () { - let con = App.jsoncon + let con = App.jsoncon; if (con.trim() === '') { - return + return; } - App.isSharing = true - $.ajax({ - type: 'POST', - url: `${ApiUrl}/json`, - contentType: 'application/json; charset=utf-8', - data: JSON.stringify({con: con, key: App.shareKey}), - success: (data) => { - App.isSharing = false - App.shareKey = uuidv1() - if (data.status) { - Helper.alert('鍒嗕韩鎴愬姛锛屽凡灏嗛摼鎺ュ鍒跺埌鍓创鏉匡紝鍙兘淇濆瓨24灏忔椂', 'success') - } else { - } - } - }) + App.isSharing = true; + $.ajax({ + type: 'POST', + url: `${ApiUrl}/json`, + contentType: 'application/json; charset=utf-8', + data: JSON.stringify({ con: con, key: App.shareKey }), + success: (data) => { + App.isSharing = false; + App.shareKey = uuidv1(); + if (data.status) { + Helper.alert('鍒嗕韩鎴愬姛锛屽凡灏嗛摼鎺ュ鍒跺埌鍓创鏉匡紝鍙兘淇濆瓨24灏忔椂', 'success'); + } + } + }); } }, watch: { diff --git a/APIJSON.NET/APIJSONCommon/ApiJson.Common.csproj b/APIJSON.NET/APIJSONCommon/ApiJson.Common.csproj index 66d75af..e89cd9f 100644 --- a/APIJSON.NET/APIJSONCommon/ApiJson.Common.csproj +++ b/APIJSON.NET/APIJSONCommon/ApiJson.Common.csproj @@ -1,9 +1,10 @@ - +锘 netstandard2.0 0.0.1 閫氱敤鏌ヨ缁勪欢 + false diff --git a/APIJSON.NET/APIJSONCommon/Services/IIdentityService.cs b/APIJSON.NET/APIJSONCommon/Services/IIdentityService.cs index d911702..db6c8ce 100644 --- a/APIJSON.NET/APIJSONCommon/Services/IIdentityService.cs +++ b/APIJSON.NET/APIJSONCommon/Services/IIdentityService.cs @@ -25,7 +25,7 @@ public interface IIdentityService /// /// /// - Tuple GetSelectRole(string table); + (bool, string) GetSelectRole(string table); bool ColIsRole(string col, string[] selectrole);