jiaojiao7 4 vuotta sitten
vanhempi
commit
66ac26be0e

+ 4 - 1
router/pageRouter.go

@@ -14,6 +14,7 @@ func pageRouterRegister(router *gin.Engine) {
 		pageRouterGroup.GET("/userRecharge", userRechargePage)
 		pageRouterGroup.GET("/projectDetailsPage", projectDetailsPage)
 		pageRouterGroup.GET("/projectListPage", projectListPage)
+		pageRouterGroup.GET("/projectListDetail", projectListDetailPage)
 		pageRouterGroup.GET("/interfaceListPage", interfaceListPage)
 	}
 }
@@ -40,7 +41,9 @@ func projectDetailsPage(context *gin.Context) {
 func projectListPage(context *gin.Context) {
 	context.HTML(200, "projectList.html", nil)
 }
-
+func projectListDetailPage(context *gin.Context) {
+	context.HTML(200, "projectListDetail.html", nil)
+}
 func interfaceListPage(context *gin.Context) {
 	context.HTML(200, "interfaceList.html", nil)
 }

+ 2 - 0
service/projectDetail.go

@@ -82,6 +82,8 @@ func ProjectDetailData(id string) (data []map[string]interface{}, httpStatus int
 				"province":    i["area"],
 				"city":        i["city"],
 				"package":     i["package1"],
+				"url":         i["url"],
+				"jyUrl":       i["jyUrl"],
 			}
 			data = append(data, dataMap)
 		}

+ 5 - 3
service/user.go

@@ -3,9 +3,6 @@ package service
 import (
 	"errors"
 	"fmt"
-	"github.com/gin-gonic/gin"
-	"go.uber.org/zap"
-	"gorm.io/gorm"
 	"log"
 	"sfbase/global"
 	"sfbase/utils"
@@ -16,6 +13,10 @@ import (
 	"strings"
 	"sync"
 	"time"
+
+	"github.com/gin-gonic/gin"
+	"go.uber.org/zap"
+	"gorm.io/gorm"
 )
 
 func CreateUserProduct(appId string, productArr []map[string]interface{}, buyType int) (status int, haveProductId string, err error) {
@@ -132,6 +133,7 @@ func CreateUserProduct(appId string, productArr []map[string]interface{}, buyTyp
 	return 1, haveProductId, nil
 }
 
+
 func UserProductList(appId string, c *gin.Context) (userProduct []model.UserProduct, err error) {
 	//userProduct := []model.UserProduct{}
 	err = db.GetSFISDB().Where("app_id = ? ", appId).Find(&userProduct).Error

+ 1 - 1
static/templates/interfaceList.html

@@ -14,7 +14,7 @@
     <body>
     <div class="list">
         <a href="/page/projectListPage">项目列表接口</a><br>
-        <a href="">项目列表详情接口</a>
+        <a href="/page/projectListDetail">项目列表详情接口</a>
     </div>
 
     </body>

+ 1 - 0
static/templates/login.html

@@ -112,6 +112,7 @@
                                 str += '<td style="width: 100px">' + item.phone + '</td>';
                                 str += '<td style="width: 100px">' + item.money + '</td>';
                                 str += '<td class="handle" style="width: 100px"><a href="/page/userRecharge">充值</a><a href="/page/chooseProductPage">购买产品</a></td>';
+
                                 str += '</tr>';
                             }
                             $('.box').html(str);

+ 14 - 12
static/templates/projectDetails.html

@@ -57,21 +57,23 @@
                         console.log(r.data[0]);
                         var html = `
                         <div>
-                            <p>项目标识: ${r.data[0]["project_id"]}</p>
-                            <p>项目名称: ${r.data[0]["projectname"]}</p>
-                            <p>项目代码: ${r.data[0]["projectcode"]}</p>
-                            <p>中标单位: ${r.data[0]["s_winner"]}</p>
+                            <p>项目标识: ${r.data[0]["projectId"]}</p>
+                            <p>项目名称: ${r.data[0]["projectName"]}</p>
+                            <p>项目代码: ${r.data[0]["projectCode"]}</p>
+                            <p>中标单位: ${r.data[0]["winner"]}</p>
                             <p>采购单位: ${r.data[0]["buyer"]}</p>
-                            <p>采购单位电话: ${r.data[0]["buyertel"]}</p>
-                            <p>采购单位联系人: ${r.data[0]["buyerperson"]}</p>
-                            <p>采购单位行业: ${r.data[0]["buyerclass"]}</p>
-                            <p>招标日期: ${r.data[0]["zbtime"]}</p>
-                            <p>中标日期: ${r.data[0]["jgtime"]}</p>
-                            <p>中标金额(元): ${r.data[0]["bidamount"]}</p>
+                            <p>采购单位电话: ${r.data[0]["buyerTel"]}</p>
+                            <p>采购单位联系人: ${r.data[0]["buyerPerson"]}</p>
+                            <p>采购单位行业: ${r.data[0]["buyerClass"]}</p>
+                            <p>招标日期: ${r.data[0]["tenderDate"]}</p>
+                            <p>中标日期: ${r.data[0]["bidDate"]}</p>
+                            <p>中标金额(元): ${r.data[0]["bidAmount"]}</p>
                             <p>预算金额(元): ${r.data[0]["budget"]}</p>
-                            <p>省份: ${r.data[0]["area"]}</p>
+                            <p>省份: ${r.data[0]["province"]}</p>
                             <p>城市: ${r.data[0]["city"]}</p>
-                            <p>原链接: ${r.data[0]["sourceinfourl"]}</p>
+                            <p>中标信息列表: ${JSON.stringify(r.data[0]["package"])}</p>
+                            <p>原链接: ${r.data[0]["url"]}</p>
+                            <p>剑鱼标讯链接: ${r.data[0]["jyUrl"]}</p>
                         </div>
                         `
                         $("#resultContent").append(html);

+ 7 - 7
static/templates/projectList.html

@@ -60,19 +60,19 @@
                             str += '<tr onclick="projectDetails(this)">';
                             // str += '<td style="width: 20px"></td>';
                             str += '<td class="td">' + (i + 1) + '</td>';
-                            str += '<td class="td">' + item.project_id + '</td>';
-                            str += '<td>' + item.projectname + '</td>';
+                            str += '<td class="td">' + item.projectId + '</td>';
+                            str += '<td>' + item.projectName + '</td>';
                             str += '<td>' + item.buyer + '</td>';
-                            str += '<td class="td">' + item.buyerclass + '</td>';
-                            if (item.zbtime == undefined || item.zbtime == "") {
+                            str += '<td class="td">' + item.buyerClass + '</td>';
+                            if (item.tenderDate == undefined || item.tenderDate == "") {
                                 str += '<td class="td"></td>';
                             } else {
-                                str += '<td class="td">' + item.zbtime + '</td>';
+                                str += '<td class="td">' + item.tenderDate + '</td>';
                             }
-                            if (item.jgtime == undefined || item.jgtime == "") {
+                            if (item.bidDate == undefined || item.bidDate == "") {
                                 str += '<td></td>';
                             } else {
-                                str += '<td class="td">' + item.jgtime + '</td>';
+                                str += '<td class="td">' + item.bidDate + '</td>';
                             }
                             str += '</tr>';
                         }

+ 127 - 0
static/templates/projectListDetail.html

@@ -0,0 +1,127 @@
+{{define "projectListDetail.html"}}
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
+    <script src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.js"></script>
+    <title>项目列表详情</title>
+</head>
+<body>
+<input type="text" id="winners" placeholder="请输入中标企业名">
+<button type="button" id="projectListDetailBtn">提交</button>
+<div id="resultContent"></div>
+<div id="tableDiv" hidden>
+    <table  id="tableId" border="1px solid" cellspacing="0" cellpadding="0" >
+        <tr>
+            <th style="width: 2%;">序号</th>
+            <th style="width: 5%">项目标识</th>
+            <th style="width: 4%">项目名称</th>
+            <th style="width: 5%">项目代码</th>
+            <th style="width: 15%">中标单位</th>
+            <th style="width: 5%">采购单位</th>
+            <th style="width: 5%">采购单位电话</th>
+            <th style="width: 5%">采购单位联系人</th>
+            <th style="width: 5%">采购单位行业</th>
+            <th style="width: 5%">招标日期</th>
+            <th style="width: 5%">中标日期</th>
+            <th style="width: 5%">中标金额(元)</th>
+            <th style="width: 5%">预算金额(元)</th>
+            <th style="width: 5%">省份</th>
+            <th style="width: 5%">城市</th>
+            <th style="width: 15%">中标信息列表</th>
+            <th style="width: 15%">原链接</th>
+            <th style="width: 15%">剑鱼标讯链接</th>
+        </tr>
+        <tbody class="box">
+
+        </tbody>
+    </table>
+</div>
+<script>
+
+    // 获取页面跳转传过来的参数
+    function GetQueryString(name) {
+        var rs = new RegExp("(^|)" + name + "=([^&]*)(&|$)", "gi").exec(LocString);
+        var tmp;
+        if (tmp = rs) {
+            return decodeURI(tmp[2])
+        }
+        return "";
+    }
+    var appid = GetQueryString("appId");
+    var key = GetQueryString("key");
+    function submit(param, rType, url, hearders, str) {
+        $.ajax({
+            url: url,
+            type: rType,
+            headers: hearders,
+            data: param,
+            success: function (r) {
+                if (r.data) {
+                    $("#tableDiv").show();
+                    $("#resultContent").text("");
+                    var str = "";
+                    for (var i = 0; i < r.data.length; i++) {
+                        var item = r.data[i]
+                        str += '<tr>';
+                        str += '<td >' + (i + 1) + '</td>';
+                        str += '<td style="word-break:break-all">' + item.projectId + '</td>';
+                        str += '<td >' + item.projectName + '</td>';
+                        str += '<td style="word-break:break-all">' + item.projectCode + '</td>';
+                        str += '<td >' + item.winner + '</td>';
+                        str += '<td style="word-break:break-all">' + item.buyer + '</td>';
+                        str += '<td style="word-break:break-all">' + item.buyerTel + '</td>';
+                        str += '<td style="word-break:break-all">' + item.buyerPerson + '</td>';
+                        str += '<td style="word-break:break-all">' + item.buyerClass + '</td>';
+                        if (item.tenderDate == undefined || item.tenderDate == "") {
+                            str += '<td ></td>';
+                        } else {
+                            str += '<td >' + item.tenderDate + '</td>';
+                        }
+                        if (item.bidDate == undefined || item.bidDate == "") {
+                            str += '<td></td>';
+                        } else {
+                            str += '<td class="td">' + item.bidDate + '</td>';
+                        }
+                        str += '<td style="word-break:break-all">' + item.bidAmount + '</td>';
+                        str += '<td style="word-break:break-all">' + item.budget + '</td>';
+                        str += '<td style="word-break:break-all">' + item.province + '</td>';
+                        str += '<td style="word-break:break-all">' + item.city + '</td>';
+                        str += '<td style="word-break:break-all">' + JSON.stringify(item.package) + '</td>';
+                        str += '<td style="word-break:break-all">' + item.url + '</td>';
+                        str += '<td style="word-break:break-all">' + item.jyUrl + '</td>';
+                        str += '</tr>';
+                    }
+                    str = str.replaceAll("undefined", "")
+                    str = str.replaceAll("null", "")
+                    $(".box").html(str);
+                } else {
+                    $("#resultContent").text(JSON.stringify(r));
+                }
+            }
+        })
+    }
+
+    $("#projectListDetailBtn").on("click", function () {
+
+        var param = {
+            "app_id": appid,
+            "winner": $("#winners").val()
+        };
+        var url = "/sfis/api/v1/projectListDetail";
+        var rType = "post";
+        var now = new Date().getTime();
+        var token = md5(appid + Math.round(now / 1000) + key);
+        var hearders = {
+            "timestamp": "" + Math.round(now / 1000),
+            "token": token
+        }
+        $(".box").html("");
+        $("#resultContent").text("");
+        submit(param, rType, url, hearders, "listDetail");
+    })
+</script>
+</body>
+</html>
+{{end}}

+ 49 - 17
static/templates/userRecharge.html

@@ -7,29 +7,48 @@
         <title>接口服务平台后台管理系统</title>
     </head>
     <style>
-      
+      .list a {
+          text-decoration: none;
+      }
     </style>
     <body>
-        <dev id="main">
-            <h1>充值接口</h1>
-            <dev>
-                <a onclick="$('#money').show();$('#main').hide();">1.余额充值</a>
-                <a onclick="$('#product').show();$('#main').hide();">2.剩余量充值</a>
-            </dev>
-        </dev>
-        <dev id="money" style="display: none;">
+        <div id="main">
+            <div class="list">
+                <h1>充值接口</h1>
+                <a href="#" onclick="$('#money').show();$('#main').hide();">1.余额充值</a><br>
+                <a href="#" onclick="$('#product').show();$('#main').hide();">2.剩余量充值</a>
+            </div>
+        </div>
+        <div id="money" style="display: none;">
             <input type="number" id="moneys" placeholder="请输入充值金额">
             <button type="button" id="moneyBtn">提交</button>
-        </dev>
-        <dev id="product" style="display: none;">
-            <input type="number" id="productId" placeholder="请输入产品id">
+        </div>
+        <div id="product" style="display: none;">
+            <!-- <input type="number" id="productId" placeholder="请输入产品id"> -->
+            产品 <select id="productId"></select>
             <input type="number" id="rechargeNum" placeholder="请输入充值次数">
             <input type="text" id="endTime" placeholder="请输入结束时间">
             <button type="button" id="productBtn">提交</button>
-        </dev>
-        <dev id="resultContent"></dev>
+        </div>
+        <div id="resultContent"></div>
         <script>
-            var appid = "sfGSVYRQMAAgkGBAUBJg4f";
+            var appid = getParam("id");
+            if (appid !== "") {
+                $.ajax({
+                    url: "/manage/user/userProductList",
+                    type: "post",
+                    data: {"appId":appid},
+                    success:function(r){
+                    	if(r.data){
+                            var html = ""
+                            for (var i in r.data){
+                                html += `<option value ="${r.data[i]["product_id"]}">${r.data[i]["product_id"]}</option>`
+                            }
+                            $("#productId").append(html);
+                    	}
+                    }
+                })
+            }
             function submit(param,rType,url,hearders){
                 $.ajax({
                     url: url,
@@ -37,6 +56,7 @@
                     headers: hearders,
                     data: param,
                     success:function(r){
+                        $("#resultContent").text("");
                     	if(r.code === 1000){
                             $("#resultContent").text(r.msg);
                     	}else{
@@ -48,7 +68,7 @@
             $("#moneyBtn").on("click", function(){
                 var param = {
                     "appid": appid,
-                    "money": $("#moneys").val(),
+                    "money": Math.round($("#moneys").val()*100),
                 };
                 var url = "/manage/user/moneyRecharge";
                 var rType = "post";
@@ -59,13 +79,25 @@
                 var param = {
                     "appid": appid,
                     "rechargeNum": $("#rechargeNum").val(),
-                    "productId": $("#productId").val(),
+                    "productId": $("#productId option:selected").val(),
                     "endTime": $("#endTime").val()
                 };
                 var url = "/manage/user/productRecharge";
                 var rType = "post";
                 submit(param,rType,url);
             })
+            
+            // 获取上个页面传来的参数
+            function getParam(name) {
+                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
+                var r = window.location.search.substr(1).match(reg); //获取url中"?"符后的字符串并正则匹配
+                var context = "";
+                if (r != null)
+                    context = r[2];
+                reg = null;
+                r = null;
+                return context == null || context == "" || context == "undefined" ? "" : context;
+            }
         </script>
     </body>
     </html>