From ea68e8f8c00c0178037a9f1cc6dc1663bde913b8 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 03 七月 2021 17:49:35 +0800
Subject: [PATCH] 推送服务完善

---
 service-push/src/main/resources/static/pushplatform-appinfo-list.html |  116 +++++++++++++++++++++++++++++++--------------------------
 1 files changed, 63 insertions(+), 53 deletions(-)

diff --git a/service-push/src/main/resources/static/source-get-list.html b/service-push/src/main/resources/static/pushplatform-appinfo-list.html
similarity index 78%
rename from service-push/src/main/resources/static/source-get-list.html
rename to service-push/src/main/resources/static/pushplatform-appinfo-list.html
index 7afb606..0d25d35 100644
--- a/service-push/src/main/resources/static/source-get-list.html
+++ b/service-push/src/main/resources/static/pushplatform-appinfo-list.html
@@ -20,6 +20,18 @@
     <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
     <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
     <![endif]-->
+    <script src="./js/utils.js"></script>
+    <script>
+        var form = {
+            "app.id": 123,
+            "app.name": "娴嬭瘯",
+            id: 12312312,
+            name: "娴嬭瘯123"
+        };
+
+        var obj = formUtil.formFieldsToJSON(form);
+        console.log(JSON.stringify(obj));
+    </script>
 </head>
 
 <body>
@@ -27,7 +39,7 @@
             <span class="layui-breadcrumb">
                 <a href="">鏉ユ簮绠$悊</a>
                 <a>
-                    <cite>鑾峰彇鏉ユ簮鍒楄〃</cite></a>
+                    <cite>涓夋柟鎺ㄩ�佸钩鍙板簲鐢ㄤ俊鎭�</cite></a>
             </span>
     <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
        onclick="location.reload()" title="鍒锋柊">
@@ -51,7 +63,7 @@
                         <div class="layui-inline layui-show-xs-block">
                             <select name="appCode" lay-verify="required" lay-search="">
                                 <option value="">鐩存帴閫夋嫨鎴栨悳绱㈠簲鐢�</option>
-                                <option v-for="item in appList" :value="item.appCode">{{item.appName}}</option>
+                                <option v-for="item in appList" :value="item.appCode">{{item.name}}</option>
                             </select>
                         </div>
 
@@ -75,7 +87,7 @@
 </body>
 <script type="text/html" id="toolbar">
     <div class="layui-btn-container">
-        <button class="layui-btn" onclick="xadmin.open('娣诲姞鏉ユ簮','./source-get-add.html',500,580)"><i
+        <button class="layui-btn" onclick="xadmin.open('娣诲姞鎺ㄩ�佸钩鍙板簲鐢ㄤ俊鎭�','./pushplatform-appinfo-add.html',500,580)"><i
                 class="layui-icon">顦�</i>娣诲姞
         </button>
 
@@ -92,7 +104,7 @@
         <!--<i class="layui-icon">&#xe669;</i>-->
         <!--</a>-->
 
-        <a title="鍒犻櫎" onclick="member_del(this,{{d.LAY_INDEX }},{{d.id}})" href="javascript:;">
+        <a title="鍒犻櫎" onclick="member_del(this,{{d.LAY_INDEX }},'{{d.id}}')" href="javascript:;">
             <i class="layui-icon">&#xe640;</i>
         </a>
     </div>
@@ -143,13 +155,6 @@
         });
     }
 
-    function member_resume(obj, index, id) {
-        layer.confirm('纭瑕佹仮澶嶅悧锛�', function (index) {
-            //鍙戝紓姝ュ垹闄ゆ暟鎹�
-            // $(obj).parents("tr").remove();
-            layer.msg('宸叉仮澶�!', {icon: 1, time: 1000});
-        });
-    }
 </script>
 
 <script>
@@ -185,7 +190,7 @@
                     });
                 },
                 deleteList: function (ids, success) {
-                    ksapp.post("/admin/api/source/get/delete", {ids: JSON.stringify(ids)}, function (e) {
+                    ksapp.post("/admin/api/pushplatform-app/delete", {ids: JSON.stringify(ids)}, function (e) {
                         if (e.code == 0) {
                             success();
                         } else {
@@ -196,7 +201,7 @@
                 },
                 update: function (id, params) {
                     params.id = id;
-                    ksapp.post("/admin/api/source/get/update", params, function (e) {
+                    ksapp.postJSON("/admin/api/pushplatform-app/update", params, function (e) {
                         if (e.code == 0) {
                             layer.msg("淇敼鎴愬姛");
                         } else
@@ -208,7 +213,7 @@
                 getAppList: function () {//搴旂敤鍒楄〃
                     ksapp.post("/admin/api/app/list", {page: 1, limit: 100}, function (e) {
                         if (e.code == 0) {
-                            app.appList = e.data.data;
+                            app.appList = e.data.list;
                             layui.use("form", function (e) {
                                 var form = layui.form;
                                 form.render();
@@ -243,7 +248,7 @@
                         app.start = ksapp.getQueryParam("start");
                         app.end = ksapp.getQueryParam("end");
                         var table = layui.table;
-                        var url = "/admin/api/source/get/list";
+                        var url = "/admin/api/pushplatform-app/list";
                         tableIns = table.render({
                             elem: '#table_list',
                             url: url,
@@ -251,23 +256,31 @@
                             totalRow: true,
                             cols: [
                                 [{type: 'checkbox', title: "ID"},
-                                    {field: 'id', width: 80, sort: true, title: "ID"},
-                                    {field: 'icon', templet:'#iconTpl', edit: 'text', sort: true, width: 150, title: "鍥炬爣"},
-                                    {field: 'sourceName', edit: 'text', sort: true, width: 150, title: "鏉ユ簮鍚嶇О"},
-                                    {field: 'sourceCode', edit: 'text', sort: true, width: 120, title: "鏉ユ簮鏍囪瘑"},
-                                    {field: 'state', edit: 'text',templet:'#stateTpl', sort: true, width: 120, title: "鐘舵��"},
-                                    {field: 'weight', edit: 'text', sort: true, width: 80, title: "鏉冮噸"},
-                                    {field: 'goldCorn', edit: 'text', sort: true, width: 100, title: "閲戝竵鏁伴噺"},
-                                    {field: 'maxDayCount', edit: 'text', sort: true, width: 100, title: "姣忔棩鏈�澶ф鏁�"},
-                                    {field: 'minTimeSpan', edit: 'text', sort: true, width: 100, title: "姣忔闂撮殧鏃堕棿锛堢锛�"},
-                                    {field: 'sourceDesc', edit: 'text', width: 200, title: "鏉ユ簮绠�浠�"},
-                                    {field: 'remarks', edit: 'text', width: 200, title: "澶囨敞"},
-                                    {field: 'createTime', sort: true, width: 150, title: "鍒涘缓鏃堕棿"},
-                                    {field: 'updateTime', sort: true, width: 150, title: "淇敼鏃堕棿"},
+                                    {field: 'id', width: 120, sort: true, title: "ID"},
                                     {field: 'appCode', width: 120, title: "搴旂敤鏍囪瘑"},
-                                    {field: 'appName', width: 120, title: "搴旂敤鍚嶇О"},
-                                    // {field: 'status', width: 80, title: "鐘舵��", templet: "#statusContainer"},
-                                    {fixed: 'right', width: 150, title: "鎿嶄綔", toolbar: '#deleteContainer'},
+                                    {field: 'platform', width: 80, title: "鎺ㄩ�佸钩鍙�"},
+                                    {
+                                        field: "pushAppInfo.appId",
+                                        edit: 'text',
+                                        width: 200,
+                                        title: "appId"
+                                    },
+                                    {
+                                        field: 'pushAppInfo.appKey',
+                                        edit: 'text',
+                                        width: 120,
+                                        title: "appKey"
+                                    },
+                                    {
+                                        field: 'pushAppInfo.appSecret',
+                                        edit: 'text',
+                                        width: 200,
+                                        title: "appSecret"
+                                    },
+                                    {field: 'pushAppInfo.packageName', edit: 'text', width: 120, title: "鍖呭悕"},
+                                    {field: 'createTime', sort: true, width: 140, title: "鍒涘缓鏃堕棿"},
+                                    {field: 'updateTime', sort: true, width: 140, title: "淇敼鏃堕棿"},
+                                    {fixed: 'right', width: 80, title: "鎿嶄綔", toolbar: '#deleteContainer'},
                                 ]
 
                             ],
@@ -275,18 +288,25 @@
                             parseData: function (res) { //res 鍗充负鍘熷杩斿洖鐨勬暟鎹�
                                 if (res.code != 0)
                                     return;
-                                if( res.data.data==null)
+                                if (res.data.list == null)
                                     return;
-                                for (var i = 0; i < res.data.data.length; i++) {
-                                    res.data.data[i].appName = res.data.data[i].app.appName;
-                                    res.data.data[i].appCode = res.data.data[i].app.appCode;
+                                for (var i = 0; i < res.data.list.length; i++) {
+                                    //灏嗗璞¤浆鎹负灞炴��
+                                    var pushAppInfo = res.data.list[i].pushAppInfo;
+                                    delete   res.data.list[i].pushAppInfo;
+                                    for (key in pushAppInfo) {
+                                        res.data.list[i]["pushAppInfo." + key] = pushAppInfo[key];
+                                    }
                                 }
+
+                                console.log(res.data.list)
+
 
                                 return {
                                     "code": res.code, //瑙f瀽鎺ュ彛鐘舵��
                                     "msg": res.msg, //瑙f瀽鎻愮ず鏂囨湰
                                     "count": res.data.count, //瑙f瀽鏁版嵁闀垮害
-                                    "data": res.data.data //瑙f瀽鏁版嵁鍒楄〃
+                                    "data": res.data.list //瑙f瀽鏁版嵁鍒楄〃
                                 };
                             }
                             //,鈥︹�� //鍏朵粬鍙傛暟
@@ -299,7 +319,12 @@
                                     field = obj.field; //寰楀埌瀛楁
                                 //淇敼鎺ュ彛
                                 var params = {id: data.id};
-                                params[field] = value;
+                                if (field.indexOf(".") > -1) {
+                                    var keys = field.split(".");
+                                    params[keys[0]] = {};
+                                    params[keys[0]][keys[1]] = value;
+                                } else
+                                    params[field] = value;
                                 app.update(data.id, params);
                             });
 
@@ -337,22 +362,7 @@
 
 </script>
 
+<script>
 
-
-<script type="text/html" id="iconTpl">
-    {{#  if(d.icon ){ }}
-    <img src="{{d.icon}}" style="height:100%;" />
-    {{#  } else { }}
-    {{#  } }}
-</script>
-
-<script type="text/html" id="stateTpl">
-    {{#  if(d.state==1 ){ }}
-    <span>澶栨樉</span>
-    {{#  } else if(d.state==2) { }}
-    <span>涓嶅鏄�</span>
-    {{#  } else { }}
-    <span>绂佺敤</span>
-    {{#  } }}
 </script>
 </html>
\ No newline at end of file

--
Gitblit v1.8.0