瀏覽代碼

改了获取历史更新版本记录的接口,和对应的HTML

pzb 6 年之前
父節點
當前提交
d55c03a5d2
共有 2 個文件被更改,包括 23 次插入32 次删除
  1. 11 2
      Controller/AppInfo.py
  2. 12 30
      templates/appVerList.html

+ 11 - 2
Controller/AppInfo.py

@@ -9,6 +9,7 @@ from Object.TokenObject import TokenObject
 from Object.ResponseObject import ResponseObject
 from django.shortcuts import render_to_response,render
 import simplejson as json
+import re,time
 '''
 http://192.168.136.45:8077/appInfo?operation=add&token=test&appBundleId=123456&appName=%E8%AF%BA%E5%9F%BA%E4%BA%9A1%E5%8F%B7&systemLanguage=US&content=dladfjklsjfdsajkdfasjkljlk&app_type=2&newAppversion=1234&bundleVersion=1234
 http://192.168.136.45:8077/appInfo?operation=update&token=test&appBundleId=1234&appName=%E8%AF%BA%E5%9F%BA%E4%BA%9A3%E5%8F%B7&systemLanguage=US&content=dladfjklsjfdsajkdfasjkljlk&app_type=2&newAppversion=555&id=6
@@ -217,17 +218,25 @@ class AppVersionView(View):
         return self.validation(request_dict=request.POST)
 
     def validation(self, request_dict, *args, **kwargs):
-        data = []
         appBundleId = request_dict.get('appBundleId', None)
         app_type = request_dict.get('app_type', None)
         lang = request_dict.get('lang', None)
-        print (appBundleId)
+        # print (appBundleId)
         # if lang == 'cn':
         #     return render_to_response('appVersionLists_cn.html')
         # else:
         #     return render_to_response('appVersionLists_en.html')
         queryset = App_Colophon.objects.filter(lang=lang,app_id__appBundleId=appBundleId,app_id__app_type=app_type).order_by('-id')
         queryset_dict = CommonService.qs_to_dict(queryset).get('datas')
+        # 修改数据逻辑改装数据返回值
+        for k, v in enumerate(queryset_dict):
+            content = v['fields']['content']
+            content = content.split('\n') #分割字符串
+            v['fields']['content'] = content
+            # 时间戳转日期
+            version_time = v['fields']['version_time']
+            version_time = time.strftime("%Y-%m-%d", time.localtime(version_time))
+            v['fields']['version_time'] = version_time
         return render_to_response('appVerList.html', locals())
 
 

+ 12 - 30
templates/appVerList.html

@@ -14,8 +14,6 @@
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <meta name="author" content="LayoutIt!">
       <link href="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
-
-      <script  type="text/javascript"  src=" https://test.dvema.com/web/js/jquery-2.1.1.min.js"></script>
   </head>
   <style>
       body{
@@ -47,7 +45,12 @@
                         <div class="date">更新日期:<a class="data_time">{{ item.fields.version_time }}</a></div>
                     </div>
                     <br>
-                    <div class="content">{{ item.fields.content }}</div>
+                    <div class="content">
+                       {% for con  in item.fields.content  %}
+                            {{ con }}
+                            <br/>
+                       {% endfor %}
+                    </div>
                     <hr />
                 {% else %}
                      <h3 style="text-align: left">{{ item.fields.newApp_version }}</h3>
@@ -56,7 +59,12 @@
                         <div class="date">update date:<a class="data_time">{{ item.fields.version_time }}</a></div>
                     </div>
                     <br>
-                    <div class="content">{{ item.fields.content }}</div>
+                    <div class="content">
+                        {% for con  in item.fields.content  %}
+                            {{ con }}
+                            <br/>
+                       {% endfor %}
+                    </div>
                     <hr />
                 {% endif %}
             {% endfor %}
@@ -64,32 +72,6 @@
 		<div class="col-md-4">
 		</div>
 	</div>
-        <script>
-            /**
-     * 时间戳转日期
-     * @param timestamp
-     * @returns {*}
-     */
-    function timestampToTime(timestamp) {
-        var date = new Date(timestamp * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
-        Y = date.getFullYear() + '-';
-        M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
-        D = date.getDate() + ' ';
-        // h = date.getHours() + ':';
-        // m = (date.getMinutes() < 10 ? '0'+(date.getMinutes()) : date.getMinutes()) + ':';
-        // s = (date.getSeconds() < 10 ? '0'+(date.getSeconds()) : date.getSeconds());
-        return Y+M+D;
-    }
-            $(".data_time").each(function(){
-                $(this).html(timestampToTime($(this).html()));
-            });
-            $(".content").each(function(){
-                var str = $(this).html();
-                var _re5=new RegExp("\\n","g");
-                var _strs5=str.replace(_re5,"<br>");
-                $(this).html(_strs5);
-            });
-        </script>
 </div>
   </body>
 </html>