sbd-npm 1.2.91 → 1.2.93

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/util.js +29 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.2.91",
3
+ "version": "1.2.93",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/util.js CHANGED
@@ -496,7 +496,7 @@ const Util = {
496
496
  html.push("<td>", Util.stock_url(item["code"], name), "</td>");
497
497
  html.push("<td>", (item["sector"] ? item["sector"] : "--"), "</td>");
498
498
  html.push("<td>", Util.industry_url(item["code"], item["industry"]), "</td>");
499
- html.push("<td>", Util.map_url(item["registered"]), "</td>");
499
+ html.push("<td>", Util.google_map_url(item["registered"]), "</td>");
500
500
  html.push("<td>", Util.to_float((item["pe_ttm"] ? item["pe_ttm"] : item["pe"]), 2), "</td>");
501
501
  html.push("<td>", Util.to_float(item["total_shares"], 2), "亿</td>");
502
502
  html.push("<td>", Util.to_float(item["market_capital"], 3), "亿</td>");
@@ -1155,7 +1155,12 @@ const Util = {
1155
1155
  }
1156
1156
  }
1157
1157
  });
1158
- let payload = {action: "public_fund_stock", fund_code: fund_code, date: date, pre_date: pre_date};
1158
+ let payload = {
1159
+ action: "public_fund_stock",
1160
+ fund_code: fund_code,
1161
+ date: date,
1162
+ pre_date: pre_date
1163
+ };
1159
1164
  Util.post(Util.get_url("fund_public"), payload, function (j) {
1160
1165
  $("." + component_tr).each(function () {
1161
1166
  $(this).remove();
@@ -1489,19 +1494,26 @@ const Util = {
1489
1494
  /**
1490
1495
  * 数量限制组件
1491
1496
  * @param component_id
1497
+ * @param select_val
1498
+ * @param max_val
1492
1499
  */
1493
- init_limit_num_component: function (component_id) {
1500
+ init_limit_num_component: function (component_id, select_val = 0, max_val = 0) {
1494
1501
  let element_id = component_id.replace("_div", "");
1495
1502
  let html = [];
1496
1503
  html.push('<label for="', element_id, '"></label>');
1497
1504
  html.push('<select id="', element_id, '" class="form-control">');
1498
1505
  html.push('<option value="50">50</option>');
1499
- html.push('<option value="100" selected>100</option>');
1506
+ html.push('<option value="100">100</option>');
1500
1507
  html.push('<option value="200">200</option>');
1501
1508
  html.push('<option value="500">500</option>');
1502
1509
  html.push('<option value="1000">1000</option>');
1510
+ if (max_val > 0) {
1511
+ html.push('<option value="', max_val, '">', max_val, '</option>');
1512
+ }
1503
1513
  html.push('</select>');
1504
- $("#" + component_id).html(html.join(""));
1514
+ let obj = $("#" + component_id);
1515
+ obj.html(html.join(""));
1516
+ obj.find("option[value='" + (select_val > 0 ? select_val : 100) + "']").attr("selected", true);
1505
1517
  },
1506
1518
 
1507
1519
  /**
@@ -2337,8 +2349,18 @@ const Util = {
2337
2349
  if (tips_obj.length) {
2338
2350
  tips_obj.html('共 <span class="label label-info">' + code_list.length + '</span> 家');
2339
2351
  }
2340
- //获取股票详情数据
2341
- Util.post("/action", {action: "code_detail", code_list: code_list.join("-")}, function (j) {
2352
+ let payload = {action: "code_detail", code_list: code_list.join("-")};
2353
+ $("#" + element_id).parent().find('thead td').each(function() {
2354
+ let title = $(this).text();
2355
+ if (title === "股东数") {
2356
+ payload["is_holder"] = 1;
2357
+ } else if (title === "基金数") {
2358
+ payload["is_fund"] = 1;
2359
+ } else if (title === "主力资金") {
2360
+ payload["is_money_inflow"] = 1;
2361
+ }
2362
+ });
2363
+ Util.post("/action", payload, function (j) {
2342
2364
  let valid_code_list = [];
2343
2365
  let total_change_percent = 0, total_year_change_percent = 0, total_d5_change_percent = 0;
2344
2366
  $.each(j, function (code, item) {