yuelujie 20 hours ago
parent
commit
19351b469a
86 changed files with 3341 additions and 1710 deletions
  1. 4 0
      src/jfw/modules/app/src/web/staticres/jyapp/big-member/css/ent_portrait.css
  2. 8 1
      src/jfw/modules/app/src/web/staticres/jyapp/big-member/css/unit_portrayal.css
  3. 7 2
      src/jfw/modules/app/src/web/staticres/jyapp/big-member/js/ent_portrait.js
  4. 8 2
      src/jfw/modules/app/src/web/staticres/jyapp/big-member/js/unit_portrayal.js
  5. 7 1
      src/jfw/modules/app/src/web/templates/big-member/page_client_portrayal.html
  6. 8 0
      src/jfw/modules/app/src/web/templates/big-member/page_ent_portrait.html
  7. 40 6
      src/jfw/modules/app/src/web/templates/big-member/page_pro_follow_detail.html
  8. 7 1
      src/jfw/modules/app/src/web/templates/big-member/page_unit_portrayal.html
  9. 5 1
      src/jfw/modules/app/src/web/templates/commonPay/analysisReport/orderDetail.html
  10. 19 5
      src/jfw/modules/app/src/web/templates/commonPay/checkout.html
  11. 2 2
      src/jfw/modules/app/src/web/templates/commonPay/myOrder.html
  12. 9 5
      src/jfw/modules/app/src/web/templates/commonPay/paySuccess.html
  13. 2 1
      src/jfw/modules/subscribepay/src/config.json
  14. 7 1
      src/jfw/modules/subscribepay/src/config.yaml
  15. 1 0
      src/jfw/modules/subscribepay/src/config/config.go
  16. 33 30
      src/jfw/modules/subscribepay/src/consts/consts.go
  17. 1 0
      src/jfw/modules/subscribepay/src/entity/aiForecastPack.go
  18. 1 0
      src/jfw/modules/subscribepay/src/entity/areaPack.go
  19. 360 295
      src/jfw/modules/subscribepay/src/entity/basePack.go
  20. 66 15
      src/jfw/modules/subscribepay/src/entity/bidCreditReport/bidCreditReport.go
  21. 1 0
      src/jfw/modules/subscribepay/src/entity/bidReportPayBack.go
  22. 1 0
      src/jfw/modules/subscribepay/src/entity/bidfile.go
  23. 43 6
      src/jfw/modules/subscribepay/src/entity/commodity.go
  24. 1 0
      src/jfw/modules/subscribepay/src/entity/dataExportPackStruct.go
  25. 1 0
      src/jfw/modules/subscribepay/src/entity/dataReportStruct.go
  26. 1 0
      src/jfw/modules/subscribepay/src/entity/dataexport.go
  27. 1 0
      src/jfw/modules/subscribepay/src/entity/debrisProduct.go
  28. 1 0
      src/jfw/modules/subscribepay/src/entity/docMember.go
  29. 1 0
      src/jfw/modules/subscribepay/src/entity/integral.go
  30. 1 0
      src/jfw/modules/subscribepay/src/entity/jyCourseOnlineStruct.go
  31. 1 0
      src/jfw/modules/subscribepay/src/entity/jyCourseStruct.go
  32. 1 0
      src/jfw/modules/subscribepay/src/entity/member.go
  33. 180 0
      src/jfw/modules/subscribepay/src/entity/order.go
  34. 44 2
      src/jfw/modules/subscribepay/src/entity/pdfExportPack.go
  35. 1 0
      src/jfw/modules/subscribepay/src/entity/reWardStruct.go
  36. 1 0
      src/jfw/modules/subscribepay/src/entity/resourcePackStruct.go
  37. 1 0
      src/jfw/modules/subscribepay/src/entity/subscribeVip.go
  38. 161 10
      src/jfw/modules/subscribepay/src/entity/zmAnalysisReport.go
  39. 9 0
      src/jfw/modules/subscribepay/src/pay/aliCpa.go
  40. 2 2
      src/jfw/modules/subscribepay/src/pay_config.json
  41. 280 2
      src/jfw/modules/subscribepay/src/service/bidCreditReport.go
  42. 2 2
      src/jfw/modules/subscribepay/src/service/pdfExportPack.go
  43. 2 1
      src/jfw/modules/subscribepay/src/timetask.json
  44. 1205 1120
      src/jfw/modules/subscribepay/src/timetask/timetask.go
  45. 30 0
      src/jfw/modules/subscribepay/src/zm_analysis_report.yaml
  46. 8 1
      src/web/staticres/big-member/css/unit_portrayal.css
  47. 9 3
      src/web/staticres/big-member/js/unit_portrayal.js
  48. 4 0
      src/web/staticres/big-member/weixin/css/ent_portrait.css
  49. 5 1
      src/web/staticres/common-module/big-member/css/client_portrayal.css
  50. 8 0
      src/web/staticres/common-module/big-member/js/client_portrayal.js
  51. 9 1
      src/web/staticres/common-module/collection/js/ent_portrait.js
  52. 71 5
      src/web/staticres/common-module/mobile-portrayal-footer/css/mobile-portrayal-footer.css
  53. 35 0
      src/web/staticres/common-module/mobile-portrayal-footer/css/mobile-report-banner.css
  54. BIN
      src/web/staticres/common-module/mobile-portrayal-footer/images/crown-month.png
  55. BIN
      src/web/staticres/common-module/mobile-portrayal-footer/images/crown-season.png
  56. BIN
      src/web/staticres/common-module/mobile-portrayal-footer/images/crown-year.png
  57. BIN
      src/web/staticres/common-module/mobile-portrayal-footer/images/reportDownload.png
  58. 236 106
      src/web/staticres/common-module/mobile-portrayal-footer/js/mobile-portrayal-footer.js
  59. 164 0
      src/web/staticres/common-module/mobile-portrayal-footer/js/mobile-report-banner.js
  60. BIN
      src/web/staticres/common-module/order-list/image/analysisReport.png
  61. 33 14
      src/web/staticres/common-module/order-list/js/order-detail.js
  62. 4 4
      src/web/staticres/common-module/order-list/js/order-list-config.js
  63. 33 15
      src/web/staticres/common-module/order-list/js/order-list.js
  64. BIN
      src/web/staticres/common-module/partner/image/C_06.png
  65. 1 1
      src/web/staticres/common-module/public/head.js
  66. 0 0
      src/web/staticres/common-module/track/j-track.amd.min.js
  67. 0 0
      src/web/staticres/common-module/track/j-track.es.min.js
  68. 0 0
      src/web/staticres/common-module/track/j-track.min.js
  69. 5 0
      src/web/staticres/order/css/pay_success.css
  70. 1 1
      src/web/templates/big-member/pc/page_index.html
  71. 38 4
      src/web/templates/big-member/wx/page_pro_follow_detail.html
  72. 6 1
      src/web/templates/big-member/wx/page_unit_portrayal.html
  73. 9 0
      src/web/templates/frontRouter/wx/collection/sess/ent_portrait.html
  74. 1 1
      src/web/templates/frontRouter/wx/mini-app/free/page_unit_portrayal.html
  75. 18 3
      src/web/templates/order/pc/analysisReport/detail.html
  76. 5 2
      src/web/templates/order/pc/orderPay.html
  77. 9 2
      src/web/templates/order/pc/paySuccess.html
  78. 3 3
      src/web/templates/pc/dataExport_sieve.html
  79. 20 11
      src/web/templates/pc/myOrder.html
  80. 5 5
      src/web/templates/pc/newIndex.html
  81. 1 1
      src/web/templates/pc/subscribe_new.html
  82. 1 1
      src/web/templates/pc/template/index/activity-dialog.html
  83. 5 1
      src/web/templates/weixin/commonPay/analysisReport/orderDetail.html
  84. 17 4
      src/web/templates/weixin/commonPay/checkout.html
  85. 2 2
      src/web/templates/weixin/commonPay/myOrder.html
  86. 8 4
      src/web/templates/weixin/commonPay/paySuccess.html

+ 4 - 0
src/jfw/modules/app/src/web/staticres/jyapp/big-member/css/ent_portrait.css

@@ -721,4 +721,8 @@
 }
 .sesame-container .sesame-main.expanded {
   height: auto!important;
+}
+.banner-container{
+  padding: .04rem .32rem .24rem;
+  background: #fff;
 }

+ 8 - 1
src/jfw/modules/app/src/web/staticres/jyapp/big-member/css/unit_portrayal.css

@@ -45,9 +45,16 @@
 .van-tabs__nav {
     align-items: center;
 }
-.van-tab__pane {
+.van-tab__pane:not(:first-child) {
     margin-top: .24rem;
 }
+.banner-container{
+  padding: .24rem .32rem;
+  background: #fff;
+}
+.history-list{
+  margin-top: .32rem;
+}
 .buyer-tabs-container {
     flex: 1;
 }

+ 7 - 2
src/jfw/modules/app/src/web/staticres/jyapp/big-member/js/ent_portrait.js

@@ -11,7 +11,7 @@ var vNode = {
     mobilePortrayalFooter:mobilePortrayalFooter,
     mobilePortrayalGroupingScript: mobilePortrayalGroupingScript,
     downloadpopup: downloadpopup,
-
+    mobileReportBanner: mobileReportBanner
   },
   data () {
     // 修改柱状条颜色为渐变色
@@ -212,7 +212,8 @@ var vNode = {
         wx: 'wx_ent_limit',
         h5: 'h5_ent_limit'
       },
-      setGroupState: '' // 如果为put说明是企业画像-已监控-更改
+      setGroupState: '', // 如果为put说明是企业画像-已监控-更改
+      reportBtnInfo: {}
     }
   },
   created: function () {
@@ -2006,6 +2007,10 @@ var vNode = {
           _this.onDtTextClick(type)
         }
       }
+    },
+    getReportBtnInfo: function(data) {
+      console.log(data,'report-info')
+      this.reportBtnInfo = data
     }
   }
 }

+ 8 - 2
src/jfw/modules/app/src/web/staticres/jyapp/big-member/js/unit_portrayal.js

@@ -12,6 +12,7 @@ var vNode = {
     forwardshare: vmForward,
     mobilePortrayalFooter:mobilePortrayalFooter,
     downloadpopup: downloadpopup,
+    mobileReportBanner: mobileReportBanner
   },
   data () {
     // 修改柱状条颜色为渐变色
@@ -182,8 +183,9 @@ var vNode = {
       // 页面滚动距离
       pageScrollTop: 0,
       // 下载弹窗需要用的参数
-        portraitName:'',
-        balance:0, //定制下载余额
+      portraitName:'',
+      balance:0, //定制下载余额,
+      reportBtnInfo: {}
     }
   },
   computed: {
@@ -2132,6 +2134,10 @@ var vNode = {
           _this.onDtTextClick(type)
         }
       }
+    },
+    getReportBtnInfo: function(data) {
+      console.log(data,'report-info')
+      this.reportBtnInfo = data
     }
   }
 }

+ 7 - 1
src/jfw/modules/app/src/web/templates/big-member/page_client_portrayal.html

@@ -25,6 +25,7 @@
   <link rel="stylesheet" type="text/css" href='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/forward-share/css/forward.css?v={{Msg "seo" "version"}}'/>
   <link rel="stylesheet" type="text/css" href='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/mobile-portrayal-footer/css/mobile-portrayal-footer.css?v={{Msg "seo" "version"}}'/>
   <link rel="stylesheet" href='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/portrait/css/downloadpopup.css?v={{Msg "seo" "version"}}' />
+  <link rel="stylesheet" type="text/css" href='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/mobile-portrayal-footer/css/mobile-report-banner.css?v={{Msg "seo" "version"}}'/>
   <style>
     .skeleton{
       height: 100%;
@@ -152,6 +153,10 @@
         :offset-top="stickyTop">
         <!-- 采购单位通讯录 -->
         <van-tab :name="moduleList[0].name" :title="moduleList[0].title">
+          <!-- 芝麻分析报告-采购单位分析报告banner -->
+          <div class="banner-container" v-if="reportBtnInfo.buyerBtn">
+            <mobile-report-banner type="unit" :buyer-name="buyer.name" :info="reportBtnInfo"></mobile-report-banner>
+          </div>
           <!-- 免费用户采购单位全景分析提示 -->
           <!-- <div v-if="getfreeBuyerPort" style="margin-top: .24rem; " class="free-give">
               <div class="go-text"> 免费赠送1次【采购单位全景分析】权益体验机会!</div>
@@ -578,7 +583,7 @@
        <!-- 下载弹窗 -->
     <downloadpopup ref="downloadpopup" :type="'unit'" :data="{'power':!noAuth,'portraitName':buyer.name,'searchcount':dt.total,'allmoney':statistics.buyerScale,'allcount':statistics.buyerCount,'otherone':statistics.winnerCount,'othertwo':statistics.otherWinner,balance}"></downloadpopup>
     <!-- 底部按钮组件 -->
-    <mobile-portrayal-footer ref="portrayalFooter" @monitorclick="changeFollowState('g')" @claimclick="changeClaimState" :downshow="true" :islogin="true" :monitorshow="true" :monitor="follow" :params="clientParams" :downshow="true" :shareshow="true" :claimshow="claimShow" :claim="claim" :allpower="powerInfo"></mobile-portrayal-footer>
+    <mobile-portrayal-footer ref="portrayalFooter" type="unit" @report-info="getReportBtnInfo" @monitorclick="changeFollowState('g')" @claimclick="changeClaimState" :downshow="true" :islogin="true" :monitorshow="true" :monitor="follow" :params="clientParams" :downshow="true" :shareshow="true" :claimshow="claimShow" :claim="claim" :allpower="powerInfo"></mobile-portrayal-footer>
       <!--客服组件-->
       <customer-corner-component :scroll-status="pageScrollTop < 60" bottom-position="12%"></customer-corner-component>
   </div>
@@ -620,6 +625,7 @@
 <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/forward-share/js/forward.js?v={{Msg "seo" "version"}}'></script>
 <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/portrait/js/downloadpopup.js?v={{Msg "seo" "version"}}'></script>
 <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module//mobile-portrayal-footer/js/mobile-portrayal-footer.js?v={{Msg "seo" "version"}}'></script>
+<script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module//mobile-portrayal-footer/js/mobile-report-banner.js?v={{Msg "seo" "version"}}'></script>
 <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/big-member/js/client_portrayal.js?v={{Msg "seo" "version"}}11'></script>
 <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/customer-corner/mobile-template.js?v={{Msg "seo" "version"}}'></script>
 <script>

+ 8 - 0
src/jfw/modules/app/src/web/templates/big-member/page_ent_portrait.html

@@ -23,6 +23,7 @@
   <link rel="stylesheet" type="text/css" href='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/mobile-portrayal-footer/css/mobile-portrayal-footer.css?v={{Msg "seo" "version"}}'/>
   <link rel="stylesheet" type="text/css" href='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/mobile-portrayal-footer/css/mobile-portrayal-grouping.css?v={{Msg "seo" "version"}}'/>
   <link rel="stylesheet" href='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/portrait/css/downloadpopup.css?v={{Msg "seo" "version"}}' />
+  <link rel="stylesheet" type="text/css" href='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/mobile-portrayal-footer/css/mobile-report-banner.css?v={{Msg "seo" "version"}}'/>
   <!--E-当前页面的css资源-->
 </head>
 <style>
@@ -154,6 +155,10 @@
         v-if="conf.powerLoaded && conf.showPortraitAll" :offset-top="stickyTop">
         <!-- 企业信息/工商信息 -->
         <van-tab :name="moduleList[0].name" :title="moduleList[0].title">
+          <!-- 芝麻分析报告banner-供应商分析报告 -->
+          <div class="banner-container" v-if="reportBtnInfo.entBtn">
+            <mobile-report-banner type="ent" :ent-name="entInfo.name" :info="reportBtnInfo"></mobile-report-banner>
+          </div>
           <!-- 芝麻信用标 -->
           <div class="sesame-container" v-if="entBaseInfo.zhimaLabels">
             <div class="sesame-header">
@@ -710,9 +715,11 @@
                   @change="changeGroupState"
                   @lookdynamic="lookDynamic"
                   @monitorclick="changeFollowState"
+                  @report-info="getReportBtnInfo"
                   :downshow="true"
                   :islogin="isLogin"
                   :params="entParams"
+                  type="ent"
                   :shareshow="true">
                 </mobile-portrayal-footer>
                 <!-- 分组组件 -->
@@ -755,6 +762,7 @@
 <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/portrait/js/downloadpopup.js?v={{Msg "seo" "version"}}'></script>
 <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module//mobile-portrayal-footer/js/mobile-portrayal-footer.js?v={{Msg "seo" "version"}}'></script>
 <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module//mobile-portrayal-footer/js/mobile-portrayal-grouping.js?v={{Msg "seo" "version"}}'></script>
+<script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module//mobile-portrayal-footer/js/mobile-report-banner.js?v={{Msg "seo" "version"}}'></script>
 <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/forward-share/js/forward.js?v={{Msg "seo" "version"}}'></script>
 <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/jyapp/big-member/js/ent_portrait.js?v={{Msg "seo" "version"}}'>
 </script>

+ 40 - 6
src/jfw/modules/app/src/web/templates/big-member/page_pro_follow_detail.html

@@ -839,7 +839,7 @@
               contentType: 'application/json',
               data: JSON.stringify(params),
               success: function(res) {
-                if(res.error_code === 0) {
+                if(res.error_code === 0 && res.data) {
                   let list = res.data.list ? res.data.list : []
                   // if(!list) {list = []}
                   if (list.length > 0) {
@@ -848,7 +848,7 @@
                     _this.cbInfo.isShowRefer = false
                   }
                 } else {
-                  _this.$toast(res.error_msg)
+                  // _this.$toast(res.error_msg)
                 }
               }
             })
@@ -1637,14 +1637,48 @@
               })
             },
             goProjectAnalysisReport: function() {
+              var _this = this
               if (this.projectReportId) {
                 location.href = '/jy_mobile/report/analysis/detail?id=' + this.projectReportId
               } else {
-                var id = this.sid
-                var buyer = this.prolist.buyer
-                var name = this.prolist.projectname
-                location.href = '/jy_mobile/order/create/analysis-report/project?id=' + id + '&name=' + name + '&buyer=' + buyer
+                this.deductPackage(function(code, data){
+                  if (code === 0 && data) {
+                    location.href = '/jy_mobile/report/analysis/detail?id=' + data
+                    return
+                  }
+                  var id = _this.sid
+                  var buyer = _this.prolist.buyer
+                  var name = _this.prolist.projectname
+                  location.href = '/jy_mobile/order/create/analysis-report/project?id=' + id + '&name=' + name + '&buyer=' + buyer
+                })
+              }
+            },
+            deductPackage: function(callback) {
+              var params = {
+                buyer: this.prolist.buyer,
+                report_mold: 1,
+                project_name: this.prolist.projectname,
+                bidding_id: this.sid
               }
+              console.log(params, 'params')
+              var loading = this.$toast.loading({
+                  duration: 0,
+                  forbidClick: true,
+                  message: 'loading...',
+              })
+              $.ajax({
+                type: 'POST',
+                url: '/subscribepay/zmComboConsumption',
+                data: params,
+                success: function(res) {
+                  loading.clear()
+                  callback && callback(res.error_code, res.data)
+                },
+                error: function() {
+                  loading.clear()
+                  callback && callback()
+                }
+              })
             }
         }
     }

+ 7 - 1
src/jfw/modules/app/src/web/templates/big-member/page_unit_portrayal.html

@@ -31,6 +31,7 @@
   <link rel="stylesheet"
   href='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/portrait/css/downloadpopup.css?v={{Msg "seo" "version"}}' />
   <link rel="stylesheet" href='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/big-member/css/pop_group.css?v={{Msg "seo" "version"}}' />
+  <link rel="stylesheet" type="text/css" href='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/mobile-portrayal-footer/css/mobile-report-banner.css?v={{Msg "seo" "version"}}'/>
   <style>
     .skeleton {
       height: 100%;
@@ -195,6 +196,10 @@
           :offset-top="stickyTop">
           <!-- 采购单位通讯录 -->
           <van-tab :name="moduleList[0].name" :title="moduleList[0].title">
+            <!-- 芝麻分析报告-采购单位分析报告banner -->
+            <div class="banner-container" v-if="reportBtnInfo.buyerBtn">
+              <mobile-report-banner type="unit" :buyer-name="buyer.name" :info="reportBtnInfo"></mobile-report-banner>
+            </div>
             <!-- 免费用户采购单位全景分析提示 -->
             <div v-if="getfreeBuyerPort && isLogin" class="free-give">
               <div class="go-text"> 免费赠送1次【采购单位全景分析】权益体验机会!</div>
@@ -709,7 +714,7 @@
     <!-- 下载弹窗 -->
     <downloadpopup ref="downloadpopup" :type="'unit'" :data="{'power':!getStatus,'portraitName':buyer.name,'searchcount':dt.total,'allmoney':statistics.buyerScale,'allcount':statistics.buyerCount,'otherone':statistics.winnerCount,'othertwo':statistics.otherWinner,balance}"></downloadpopup>
        <!-- 底部按钮组件 -->
-    <mobile-portrayal-footer ref="portrayalFooter" @monitorclick="changeFollowState('g')" :islogin="userInfo.isLogin"  :monitorshow="true" :downshow="true" :monitor="follow" :params="unitParams" :allpower="allpower" :shareshow="isLogin"></mobile-portrayal-footer>
+    <mobile-portrayal-footer ref="portrayalFooter" type="unit" @report-info="getReportBtnInfo" @monitorclick="changeFollowState('g')" :islogin="userInfo.isLogin"  :monitorshow="true" :downshow="true" :monitor="follow" :params="unitParams" :allpower="allpower" :shareshow="isLogin"></mobile-portrayal-footer>
       <!--客服组件-->
       <customer-corner-component :scroll-status="pageScrollTop < 60" bottom-position="12%"></customer-corner-component>
   </div>
@@ -758,6 +763,7 @@
   </script>
   <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/portrait/js/downloadpopup.js?v={{Msg "seo" "version"}}'></script>
   <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module//mobile-portrayal-footer/js/mobile-portrayal-footer.js?v={{Msg "seo" "version"}}'></script>
+  <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module//mobile-portrayal-footer/js/mobile-report-banner.js?v={{Msg "seo" "version"}}'></script>
   <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/jyapp/big-member/js/unit_portrayal.js?v={{Msg "seo" "version"}}'>
   </script>
   <script

+ 5 - 1
src/jfw/modules/app/src/web/templates/commonPay/analysisReport/orderDetail.html

@@ -40,10 +40,14 @@
                                 </span>
                                 <span class="rp-right">
                                     <span class="product-type" style="margin-bottom: 0;color: #171826;">${ orderInfo.productType }</span>
-                                    <div class="j-card-item" style="padding-top: 0;" v-if="orderInfo.productInfoList[1]">
+                                    <div class="j-card-item" style="padding-top: 0;" v-if="orderInfo.productInfoList[1] && orderInfo.productInfoList[1].type">
                                         <span class="card-item-l">报告类型:</span>
                                         <span class="card-item-l">${ orderInfo.productInfoList[1].type }</span>
                                     </div>
+                                    <div class="j-card-item" style="padding-top: 0;" v-if="orderInfo.productInfoList[0] && orderInfo.productInfoList[0].label === '权益规格'">
+                                        <span class="card-item-l" style="min-width: auto">权益卡:</span>
+                                        <span class="card-item-l">${ orderInfo.productInfoList[0].text }</span>
+                                    </div>
                                     <span class="pay-money">&yen; ${ orderInfo.payMoney }</span>
                                     <span v-if="orderInfo.refund_status && orderInfo.refund_status > 0" class="refund-success-tip">退款成功</span>
                                 </span>

+ 19 - 5
src/jfw/modules/app/src/web/templates/commonPay/checkout.html

@@ -9,7 +9,7 @@
     <meta name="apple-mobile-web-app-status-bar-style" content="black">
     <meta http-equiv="X-UA-Compatible" content="ie=edge">
     {{if eq .T.doType "analysisReport"}}
-    <title>芝麻信用共建分析报告</title>
+    <title>招投标综合分析</title>
     {{else}}
     <title>{{.T.title}}</title>
     {{end}}
@@ -78,6 +78,7 @@
         }
         .analysis-report-container.tip-text.target-type {
           margin-top: 0.32rem;
+          text-align: center;
         }
         .analysis-report-container.tip-text.target-name {
           color: #171826;
@@ -94,7 +95,7 @@
     <div class="j-header">
         <span class="header-left iconfont icon-fanhui"></span>
         {{if eq .T.doType "analysisReport"}}
-        <span class="header-title">芝麻信用共建分析报告</span>
+        <span class="header-title">招投标综合分析</span>
         {{else}}
         <span class="header-title">{{.T.title}}</span>
         {{end}}
@@ -103,8 +104,14 @@
     <div class="j-body">
         <div class="need-pay">
             {{if eq .T.doType "analysisReport"}}
-            <div class="analysis-report-container tip-text target-type"><span name="target-type"></span></div>
-            <div class="analysis-report-container tip-text target-name"><span name="target-name"></span></div>
+            <div class="target-no-level-module" style="display: none">
+              <div class="analysis-report-container tip-text target-type"><span name="target-type"></span></div>
+              <div class="analysis-report-container tip-text target-name"><span name="target-name"></span></div>
+            </div>
+            <div class="target-level-module" style="display: none">
+              <div class="analysis-report-container tip-text target-type">权益卡</div>
+              <div class="analysis-report-container tip-text target-name"><span name="target-level"></span></div>
+            </div>
             {{end}}
             <div class="tip-text">需支付金额</div>
             <div class="price-container">
@@ -446,7 +453,7 @@
       function echoAnalysisReportInfo () {
         var cacheKey = 'analysis-report-' + {{.T.orderCode}}
         var echoInfo = JSON.parse(sessionStorage.getItem(cacheKey) || '{}')
-        var echoMaps = ['target-type', 'target-name']
+        var echoMaps = ['target-type', 'target-name', 'target-level']
 
         for (let i = 0; i < echoMaps.length; i++) {
           var echoInfoKey = echoMaps[i]
@@ -455,6 +462,13 @@
             $('.analysis-report-container span[name="'+ echoInfoKey +'"]').text(echoVal)
           }
         }
+
+        if (echoInfo['target-level'] && echoInfo['target-level'] !== '单份') {
+          $('.target-level-module').show()
+        } else {
+          $('.target-no-level-module').show()
+        }
+
       }
 
       try  {

+ 2 - 2
src/jfw/modules/app/src/web/templates/commonPay/myOrder.html

@@ -58,8 +58,8 @@
                                         <div class="img-container" :class="item|formatItemBadge">
                                             <img :src="item.contentImgUrl + '?v=' + version" />
                                         </div>
-                                        <div class="content-list" v-if="item.contentList" :class="{'compare-theme': item.product_type === '芝麻信用共建分析报告' }">
-                                            <div class="content-list-item ellipsis product-type-label" v-if="item.product_type === '芝麻信用共建分析报告'">芝麻信用共建分析报告</div>
+                                        <div class="content-list" v-if="item.contentList" :class="{'compare-theme': item.product_type === '招投标综合分析' }">
+                                            <div class="content-list-item ellipsis product-type-label" v-if="item.product_type === '招投标综合分析'">招投标综合分析</div>
                                             <div
                                                     class="content-list-item ellipsis"
                                                     v-for="(k, i) in item.contentList"

+ 9 - 5
src/jfw/modules/app/src/web/templates/commonPay/paySuccess.html

@@ -5,7 +5,7 @@
     <meta name="viewport"
           content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
     {{if eq .T.doType "analysisReport"}}
-    <title>芝麻信用共建分析报告</title>
+    <title>招投标综合分析</title>
     {{else}}
     <title>{{.T.title}}</title>
     {{end}}
@@ -64,7 +64,7 @@
 <div class="app-layout-header jy-app-header">
     <span class="app-back jyapp-icon jyapp-icon-zuojiantou"></span>
     {{if eq .T.doType "analysisReport"}}
-    <span class="header-title">芝麻信用共建分析报告</span>
+    <span class="header-title">招投标综合分析</span>
     {{else}}
     <span class="header-title">{{.T.title}}</span>
     {{end}}
@@ -104,8 +104,9 @@
             {{else if eq .T.doType "areaPack"}}
               <div class="info-item"></div>
             {{else if eq .T.doType "analysisReport"}}
-            <div class="analysis-report-container info-item" name="芝麻信用共建分析报告">
-              <p class="analysis-report-container info-label">下载的报告将发送至邮箱</p>
+            <div class="analysis-report-container info-item" name="招投标综合分析">
+              <p class="analysis-report-container target-level-module info-label" style="display: none">您已开通招投标综合分析权益【<span name="target-level"></span>】,</p>
+              <p class="analysis-report-container info-label">PDF版报告将发送至您的邮箱,请留意查收。</p>
               <p class="analysis-report-container info-label is-hight"><span name="target-email">{{.T.email}}</span></p>
             </div>
             {{end}}
@@ -259,7 +260,7 @@
   function echoAnalysisReportInfo () {
     var cacheKey = 'analysis-report-' + {{.T.orderCode}}
     var echoInfo = JSON.parse(sessionStorage.getItem(cacheKey) || '{}')
-    var echoMaps = ['target-email']
+    var echoMaps = ['target-email', 'target-level']
 
     for (let i = 0; i < echoMaps.length; i++) {
       var echoInfoKey = echoMaps[i]
@@ -268,6 +269,9 @@
         $('.analysis-report-container span[name="'+ echoInfoKey +'"]').text(echoVal)
       }
     }
+    if (echoInfo['target-level'] && echoInfo['target-level'] !== '单份') {
+      $('.target-level-module').show()
+    }
   }
 
   // 芝麻报告5S倒计时自动跳转

+ 2 - 1
src/jfw/modules/subscribepay/src/config.json

@@ -138,7 +138,8 @@
     "业主采购分析报告下载包":true,
     "企业中标分析报告下载包":true,
     "投标企业信用报告": true,
-    "芝麻信用共建分析报告": true
+    "招投标综合分析": true
+
   },
   "smsServiceRpc": "127.0.0.1:932",
   "nsq": "192.168.3.240:4260",

+ 7 - 1
src/jfw/modules/subscribepay/src/config.yaml

@@ -51,9 +51,15 @@ pdfPackPrice:
   投标企业信用报告下载包:
     - num: 1
       price: 9900
-  芝麻信用共建分析报告下载包:
+  招投标综合分析下载包:
     - num: 1
       price: 99900
+    - num: 20
+      price: 199900
+    - num: 30
+      price: 339900
+    - num: 40
+      price: 788800
 miniprogram:
   jyzbw:
     name: "剑鱼招标网"

+ 1 - 0
src/jfw/modules/subscribepay/src/config/config.go

@@ -234,6 +234,7 @@ type timeTaskConfig struct {
 	UpdateTimeLimitActivityOrderStatus string          //限时活动取消订单定时任务
 	CheckDocMemberIsExpire             string          `json:"checkDocMemberIsExpire"` //  剑鱼文库会员是否过期
 	SubVipTipDuring                    SubVipTipDuring //超级订阅提醒
+	ZmUserEquityRecovery               string          `json:"zmUserEquityRecovery"`
 }
 type messageConfig struct {
 	WxTpl_SoonExpire           *WxTplMsg //微信-超级订阅-即将到期

+ 33 - 30
src/jfw/modules/subscribepay/src/consts/consts.go

@@ -3,39 +3,42 @@ package consts
 import "time"
 
 var (
-    TaskActivityCacheKey                = "activity_day_task_%v_%v_%v"
-    TaskActivityCacheTimeout            = 60 * 60 * 3
-    TaskActiveId                        = 16 // p718 天天抢豪礼活动固定id
-    TaskIdVip                           = 4
-    TaskIdMember                        = 5
-    OrderStatusCancel                   = -2 // 订单状态-已取消
-    ZmAnalysisReportProductName         = "芝麻信用共建分析报告"
-    ZmAnalysisReportProductCode         = "zmxygjbg001"
-    ZmAnalysisReportFirstBuyDiscountMsg = "首购立减%v元"
+	TaskActivityCacheKey                    = "activity_day_task_%v_%v_%v"
+	TaskActivityCacheTimeout                = 60 * 60 * 3
+	TaskActiveId                            = 16 // p718 天天抢豪礼活动固定id
+	TaskIdVip                               = 4
+	TaskIdMember                            = 5
+	OrderStatusCancel                       = -2 // 订单状态-已取消
+	ZmAnalysisReportProductName             = "招投标综合分析"
+	ZmAnalysisReportProductCode             = "zmxygjbg001"
+	ZmAnalysisReportFirstBuyDiscountMsg     = "首购立减%v元"
+	ZmAnalysisReportExpiredBuyDiscountMsg   = "您的权益已过期%v天,开通权益享特惠!"
+	ZmAnalysisReportRemainingBuyDiscountMsg = "本月剩余报告下载额度:<span class=\"highlight-text\">%v份</span>"
+	ZmAnalysisReportNoLimitBuyDiscountMsg   = "本月报告下载额度已用完,可享权益特价:<span class=\"highlight-text\">%v/份</span>"
 
-    ZMReportOrderType = map[int]string{
-        0: "EP_ZTB_REPORT",              //芝麻企业信用招投标报告
-        1: "EP_TB_ANALYSE_REPORT",       //企业投标项目分析报告
-        2: "EP_SUPPLIER_ANALYSE_REPORT", //供应商分析报告
-        3: "EP_PURCHASE_ANALYSE_REPORT", //采购单位分析报告
-    }
-    CrnRedisCacheKey             = "company_crn_%s"
-    RedisCode                    = "newother"
-    ESPtIndex                    = "projectset"
-    ESPtType                     = "projectset"
-    ESBiddingIndex               = "bidding"
-    ESBiddingType                = "bidding"
-    CreateOrderLockKey           = "order_create_lock_%v_%v" // 订单创建锁key  用户id_产品id
-    CreateOrderLockTimeout       = 15 * time.Second          // 自动释放超时时间 防止死锁
-    MaxCount                     = 60
-    ExpiresTime            int64 = 60 * 60
-    ContactsPattern              = `(\?|-|、|女士|主任|先生|老师|工|镇长|不详|)|(|科长|经理|公司|经办人|部长|采购)`
+	ZMReportOrderType = map[int]string{
+		0: "EP_ZTB_REPORT",              //芝麻企业信用招投标报告
+		1: "EP_TB_ANALYSE_REPORT",       //企业投标项目分析报告
+		2: "EP_SUPPLIER_ANALYSE_REPORT", //供应商分析报告
+		3: "EP_PURCHASE_ANALYSE_REPORT", //采购单位分析报告
+	}
+	CrnRedisCacheKey             = "company_crn_%s"
+	RedisCode                    = "newother"
+	ESPtIndex                    = "projectset"
+	ESPtType                     = "projectset"
+	ESBiddingIndex               = "bidding"
+	ESBiddingType                = "bidding"
+	CreateOrderLockKey           = "order_create_lock_%v_%v" // 订单创建锁key  用户id_产品id
+	CreateOrderLockTimeout       = 15 * time.Second          // 自动释放超时时间 防止死锁
+	MaxCount                     = 60
+	ExpiresTime            int64 = 60 * 60
+	ContactsPattern              = `(\?|-|、|女士|主任|先生|老师|工|镇长|不详|)|(|科长|经理|公司|经办人|部长|采购)`
 )
 
 const (
-    ZmReportMoldProject = 1 // mold 1-项目分析报告
-    ZmReportMoldEnt     = 2 // mold 2-竞争对手分析报告
-    ZmReportMoldBuyer   = 3 // mold 3-采购单位分析报告
+	ZmReportMoldProject = 1 // mold 1-项目分析报告
+	ZmReportMoldEnt     = 2 // mold 2-竞争对手分析报告
+	ZmReportMoldBuyer   = 3 // mold 3-采购单位分析报告
 
-    ZmAnalysisReportSinglePackageID = 1511
+	ZmAnalysisReportSinglePackageID = 1511
 )

+ 1 - 0
src/jfw/modules/subscribepay/src/entity/aiForecastPack.go

@@ -60,6 +60,7 @@ func (a *aiForecastPackStruct) PayCallBack(param *CallBackParam) bool {
 					"order_code": orderCode,
 				}, map[string]interface{}{
 					"is_service_open":   1,
+					"pay_status":        1,
 					"open_service_time": now.Format(time.DateTime),
 					"service_starttime": service_starttime,
 					"service_endtime":   service_endtime,

+ 1 - 0
src/jfw/modules/subscribepay/src/entity/areaPack.go

@@ -172,6 +172,7 @@ func (this *areaPackPrice) PayCallBack(param *CallBackParam) bool {
 					"order_code": orderCode,
 				}, map[string]interface{}{
 					"is_service_open":   1,
+					"pay_status":        1,
 					"open_service_time": now.Format(time.DateTime),
 					"service_endtime":   et,
 					"service_starttime": st,

+ 360 - 295
src/jfw/modules/subscribepay/src/entity/basePack.go

@@ -1,351 +1,416 @@
 package entity
 
 import (
-    "app.yhyue.com/moapp/jybase/go-xweb/httpsession"
-    "app.yhyue.com/moapp/jybase/redis"
-    "encoding/json"
-    "fmt"
-    "github.com/gogf/gf/v2/util/gconv"
-    "jy/src/jfw/modules/subscribepay/src/config"
-    "jy/src/jfw/modules/subscribepay/src/util"
-    "log"
-    "strconv"
-    "time"
+	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
+	"app.yhyue.com/moapp/jybase/redis"
+	"encoding/json"
+	"fmt"
+	"github.com/gogf/gf/v2/util/gconv"
+	"jy/src/jfw/modules/subscribepay/src/config"
+	"jy/src/jfw/modules/subscribepay/src/consts"
+	"jy/src/jfw/modules/subscribepay/src/util"
+	"log"
+	"math"
+	"strconv"
+	"time"
 
-    qutil "app.yhyue.com/moapp/jybase/common"
-    . "app.yhyue.com/moapp/jybase/date"
-    "app.yhyue.com/moapp/jybase/encrypt"
-    . "app.yhyue.com/moapp/jybase/mongodb"
-    "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
+	qutil "app.yhyue.com/moapp/jybase/common"
+	. "app.yhyue.com/moapp/jybase/date"
+	"app.yhyue.com/moapp/jybase/encrypt"
+	. "app.yhyue.com/moapp/jybase/mongodb"
+	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
 )
 
 // 默认消费
 func (this *UseBalanceStruct) defaultConsume() (r map[string]interface{}, m string, c int) {
-    r, rerr := this.UseBalance()
-    if rerr != nil {
-        m = fmt.Sprintf("消费异常:%s", rerr.Error())
-    }
-    return
+	r, rerr := this.UseBalance()
+	if rerr != nil {
+		m = fmt.Sprintf("消费异常:%s", rerr.Error())
+	}
+	return
 }
 
 // KeyAccountConsume 大客户平台  || 资源中台  无权限限制
 func (this *UseBalanceStruct) KeyAccountConsume() (r map[string]interface{}, m string, c int) {
-    log.Println(this.Name, "-------附件下载记录------", this.Remarks)
-    _fileName := this.Remarks["fileName"].(string)
-    _id := this.Remarks["id"].(string)
-    if this.Remarks["infoType"] != nil && this.Remarks["infoType"].(string) == "S" {
-        r = SupplyInfoFile(_fileName, _id)
-    } else {
-        r = fileAttachRpc(_fileName, _id)
-    }
-    return
+	log.Println(this.Name, "-------附件下载记录------", this.Remarks)
+	_fileName := this.Remarks["fileName"].(string)
+	_id := this.Remarks["id"].(string)
+	if this.Remarks["infoType"] != nil && this.Remarks["infoType"].(string) == "S" {
+		r = SupplyInfoFile(_fileName, _id)
+	} else {
+		r = fileAttachRpc(_fileName, _id)
+	}
+	return
 }
 
 // 附件下载消费 fui:免费赠送已使用次数;pui:付费权限已使用次数
 func (this *UseBalanceStruct) fileConsume() (r map[string]interface{}, m string, c int) {
-    _fileName := this.Remarks["fileName"].(string)
-    _id := this.Remarks["id"].(string)
-    log.Println("附件下载包。。。。。")
-    BaseMsg := jy.GetBigVipUserBaseMsg(this.Session, *config.Middleground)
-    log.Println("---:", this.Remarks)
-    //P450 v4.8.85
-    var freeFileCacheUpdate = func() {
-        //免费用户 更新留资附件缓存
-        if BaseMsg.Status <= 0 && BaseMsg.VipStatus <= 0 && BaseMsg.EntnicheStatus <= 0 {
-            sess := this.Session.GetMultiple()
-            userId := this.UserId
-            if qutil.IntAll(sess["positionId"]) == 1 {
-                userId = strconv.Itoa(qutil.IntAll(sess["positionId"]))
-            }
-            //已留资
-            if c := qutil.Int64All(redis.GetInt("other", fmt.Sprintf("free_article_attach_%s", userId))); c > 0 {
-                if ok := redis.PutKV(fmt.Sprintf("free_article_attach_%s", userId), -1); !ok {
-                    log.Println("free user update file  download power  false:", userId)
-                }
-            }
-        }
-    }
-    //获取余额数量
-    dbs := &FindBalanceStruct{
-        AccountId:    this.UserId,
-        ResourceType: "附件下载包",
-        VipState:     BaseMsg.VipStatus,
-    }
-    this.VipState = BaseMsg.VipStatus
-    data, err := dbs.FindBalance()
-    if data == nil || err != nil {
-        c = -1
-        m = "余额不足"
-        go freeFileCacheUpdate()
-        return
-    }
-    number := 0
-    if data != nil {
-        dataArr := gconv.SliceAny(data["data"])
-        if len(dataArr) > 0 {
-            dataMap := gconv.MapStrStr(dataArr[0])
-            number = gconv.Int(dataMap["number"])
-        }
-    }
-    isExists := false
-    id := this.FindJyConsumePackRecord()
-    if id != "" && this.Remarks["downUrl"] != nil {
-        if util.MQFW.UpdateById(jyCC, id, map[string]interface{}{
-            "$set": map[string]interface{}{
-                "l_updateDate": time.Now().Unix(),
-            },
-        }) {
-            delete(this.Remarks, "id")
-            delete(this.Remarks, "title")
-            r = this.Remarks
-            r["isExists"] = true
-            isExists = true
-        }
-    }
-    go freeFileCacheUpdate()
-    if BaseMsg.Status > 0 && BaseMsg.PowerMap[3] {
-        if this.Remarks["infoType"] != nil && this.Remarks["infoType"].(string) == "S" {
-            r = SupplyInfoFile(_fileName, _id)
-        } else {
-            r = fileAttachRpc(_fileName, _id)
-        }
-        /*go func(this *UseBalanceStruct, r map[string]interface{}) {
-        	data := make(map[string]interface{})
-        	data["p_type"] = "大会员用户附件下载"
-        	data["p_userid"] = this.UserId
-        	data["p_infoId"] = this.Remarks["id"].(string)
-        	data["s_platform"] = this.Platform
-        	data["p_create_time"] = time.Now().Unix()
-        	data["p_rep"] = r
-        	//存库记录
-        	if util.MQFW.Save("filehistroy", data) == "" {
-        		log.Println("大会员附件下载-历史记录异常:" + this.UserId)
-        	}
-        }(this, r)*/
-        if r["downUrl"] != nil {
-            this.Remarks["downUrl"] = r["downUrl"]
-            this.Remarks["size"] = r["size"]
-        }
-        if !isExists {
-            this.saveJyConsumePackList()
-        }
-    } else {
-        //查询当月附件下载历史记录-如是已下载过的附件不再扣除次数
-        // log.Println(this.Remarks, "++++++", this.AccountId, id, "-------------", isExists)
-        //当月未有消费记录
-        if !isExists {
-            //免费赠送已使用次数
-            if number > 0 {
-                if this.Remarks["infoType"] != nil && this.Remarks["infoType"].(string) == "S" {
-                    r = SupplyInfoFile(_fileName, _id)
-                } else {
-                    r = fileAttachRpc(_fileName, _id)
-                }
-                if r["downUrl"] != nil {
-                    this.Remarks["downUrl"] = r["downUrl"]
-                    this.Remarks["size"] = r["size"]
-                    if this.saveJyConsumePackList() {
-                        //中台消费记录
-                        rb, err := this.UseBalance()
-                        if err != nil || (rb != nil && qutil.IntAll(rb["code"]) == 0) {
-                            m = fmt.Sprintf("消费记录保存异常:%s", qutil.ObjToString(rb["message"]))
-                        }
-                    }
-                } else {
-                    m = "获取附件异常"
-                }
-            } else {
-                c = -1
-                m = "该用户下载权限已用完"
-            }
-        }
-    }
-    return
+	_fileName := this.Remarks["fileName"].(string)
+	_id := this.Remarks["id"].(string)
+	log.Println("附件下载包。。。。。")
+	BaseMsg := jy.GetBigVipUserBaseMsg(this.Session, *config.Middleground)
+	log.Println("---:", this.Remarks)
+	//P450 v4.8.85
+	var freeFileCacheUpdate = func() {
+		//免费用户 更新留资附件缓存
+		if BaseMsg.Status <= 0 && BaseMsg.VipStatus <= 0 && BaseMsg.EntnicheStatus <= 0 {
+			sess := this.Session.GetMultiple()
+			userId := this.UserId
+			if qutil.IntAll(sess["positionId"]) == 1 {
+				userId = strconv.Itoa(qutil.IntAll(sess["positionId"]))
+			}
+			//已留资
+			if c := qutil.Int64All(redis.GetInt("other", fmt.Sprintf("free_article_attach_%s", userId))); c > 0 {
+				if ok := redis.PutKV(fmt.Sprintf("free_article_attach_%s", userId), -1); !ok {
+					log.Println("free user update file  download power  false:", userId)
+				}
+			}
+		}
+	}
+	//获取余额数量
+	dbs := &FindBalanceStruct{
+		AccountId:    this.UserId,
+		ResourceType: "附件下载包",
+		VipState:     BaseMsg.VipStatus,
+	}
+	this.VipState = BaseMsg.VipStatus
+	data, err := dbs.FindBalance()
+	if data == nil || err != nil {
+		c = -1
+		m = "余额不足"
+		go freeFileCacheUpdate()
+		return
+	}
+	number := 0
+	if data != nil {
+		dataArr := gconv.SliceAny(data["data"])
+		if len(dataArr) > 0 {
+			dataMap := gconv.MapStrStr(dataArr[0])
+			number = gconv.Int(dataMap["number"])
+		}
+	}
+	isExists := false
+	id := this.FindJyConsumePackRecord()
+	if id != "" && this.Remarks["downUrl"] != nil {
+		if util.MQFW.UpdateById(jyCC, id, map[string]interface{}{
+			"$set": map[string]interface{}{
+				"l_updateDate": time.Now().Unix(),
+			},
+		}) {
+			delete(this.Remarks, "id")
+			delete(this.Remarks, "title")
+			r = this.Remarks
+			r["isExists"] = true
+			isExists = true
+		}
+	}
+	go freeFileCacheUpdate()
+	if BaseMsg.Status > 0 && BaseMsg.PowerMap[3] {
+		if this.Remarks["infoType"] != nil && this.Remarks["infoType"].(string) == "S" {
+			r = SupplyInfoFile(_fileName, _id)
+		} else {
+			r = fileAttachRpc(_fileName, _id)
+		}
+		/*go func(this *UseBalanceStruct, r map[string]interface{}) {
+			data := make(map[string]interface{})
+			data["p_type"] = "大会员用户附件下载"
+			data["p_userid"] = this.UserId
+			data["p_infoId"] = this.Remarks["id"].(string)
+			data["s_platform"] = this.Platform
+			data["p_create_time"] = time.Now().Unix()
+			data["p_rep"] = r
+			//存库记录
+			if util.MQFW.Save("filehistroy", data) == "" {
+				log.Println("大会员附件下载-历史记录异常:" + this.UserId)
+			}
+		}(this, r)*/
+		if r["downUrl"] != nil {
+			this.Remarks["downUrl"] = r["downUrl"]
+			this.Remarks["size"] = r["size"]
+		}
+		if !isExists {
+			this.saveJyConsumePackList()
+		}
+	} else {
+		//查询当月附件下载历史记录-如是已下载过的附件不再扣除次数
+		// log.Println(this.Remarks, "++++++", this.AccountId, id, "-------------", isExists)
+		//当月未有消费记录
+		if !isExists {
+			//免费赠送已使用次数
+			if number > 0 {
+				if this.Remarks["infoType"] != nil && this.Remarks["infoType"].(string) == "S" {
+					r = SupplyInfoFile(_fileName, _id)
+				} else {
+					r = fileAttachRpc(_fileName, _id)
+				}
+				if r["downUrl"] != nil {
+					this.Remarks["downUrl"] = r["downUrl"]
+					this.Remarks["size"] = r["size"]
+					if this.saveJyConsumePackList() {
+						//中台消费记录
+						rb, err := this.UseBalance()
+						if err != nil || (rb != nil && qutil.IntAll(rb["code"]) == 0) {
+							m = fmt.Sprintf("消费记录保存异常:%s", qutil.ObjToString(rb["message"]))
+						}
+					}
+				} else {
+					m = "获取附件异常"
+				}
+			} else {
+				c = -1
+				m = "该用户下载权限已用完"
+			}
+		}
+	}
+	return
 }
 
 var jyCC = "jy_consumepack"
 
 // 查询jy 消费日志记录
 func (this *UseBalanceStruct) FindJyConsumePackRecord() string {
-    query := map[string]interface{}{
-        "s_id":       this.Remarks["id"].(string),
-        "s_userId":   this.UserId,
-        "s_product":  this.Name,
-        "s_month":    time.Now().Format("2006-01"),
-        "s_fileName": this.Remarks["fileName"].(string),
-    }
-    res, ok := util.MQFW.FindOne(jyCC, query)
-    if ok && res != nil {
-        if (*res)["s_downUrl"] != nil {
-            this.Remarks["downUrl"] = (*res)["s_downUrl"]
-            this.Remarks["size"] = (*res)["s_fileSize"]
-        }
-    } else {
-        log.Println("查询附件下载日志异常:", this.UserId)
-    }
-    return BsonIdToSId((*res)["_id"])
+	query := map[string]interface{}{
+		"s_id":       this.Remarks["id"].(string),
+		"s_userId":   this.UserId,
+		"s_product":  this.Name,
+		"s_month":    time.Now().Format("2006-01"),
+		"s_fileName": this.Remarks["fileName"].(string),
+	}
+	res, ok := util.MQFW.FindOne(jyCC, query)
+	if ok && res != nil {
+		if (*res)["s_downUrl"] != nil {
+			this.Remarks["downUrl"] = (*res)["s_downUrl"]
+			this.Remarks["size"] = (*res)["s_fileSize"]
+		}
+	} else {
+		log.Println("查询附件下载日志异常:", this.UserId)
+	}
+	return BsonIdToSId((*res)["_id"])
 }
 
 // 保存日志
 func (this *UseBalanceStruct) saveJyConsumePackList() (b bool) {
-    saveMap := map[string]interface{}{
-        "s_id":         this.Remarks["id"],
-        "s_userId":     this.UserId,
-        "s_product":    this.Name,
-        "l_date":       time.Now().Unix(),
-        "l_updateDate": time.Now().Unix(), //更新时间
-        "s_month":      time.Now().Format("2006-01"),
-        "s_fileName":   this.Remarks["fileName"],
-        "s_downUrl":    this.Remarks["downUrl"],
-        "s_fileSize":   this.Remarks["size"],
-        "s_title":      this.Remarks["title"],
-        "b_isPay":      b,
-        "s_platform":   this.Platform,
-    }
-    b = util.MQFW.Save(jyCC, saveMap) != ""
-    if !b {
-        log.Println("保存附件下载日志异常:", this.UserId)
-    }
-    return
+	saveMap := map[string]interface{}{
+		"s_id":         this.Remarks["id"],
+		"s_userId":     this.UserId,
+		"s_product":    this.Name,
+		"l_date":       time.Now().Unix(),
+		"l_updateDate": time.Now().Unix(), //更新时间
+		"s_month":      time.Now().Format("2006-01"),
+		"s_fileName":   this.Remarks["fileName"],
+		"s_downUrl":    this.Remarks["downUrl"],
+		"s_fileSize":   this.Remarks["size"],
+		"s_title":      this.Remarks["title"],
+		"b_isPay":      b,
+		"s_platform":   this.Platform,
+	}
+	b = util.MQFW.Save(jyCC, saveMap) != ""
+	if !b {
+		log.Println("保存附件下载日志异常:", this.UserId)
+	}
+	return
 }
 
 // 调rpc 获取附件信息
 func fileAttachRpc(fileName, id string) (r map[string]interface{}) {
-    r = make(map[string]interface{})
-    // 调用rpc 获取附件信息
-    req := util.JyFileRequest{id}
-    rep, err := util.Attachment(&req)
-    if err != nil {
-        log.Println("attachment  rpc调用失败")
-    } else {
-        if rep.Rep != nil && len(rep.Rep) > 0 {
-            //获取当前附件下载地址
-            for _, v := range rep.Rep {
-                if qutil.ObjToString(v["filename"]) == fileName {
-                    r = map[string]interface{}{
-                        "downUrl":  qutil.ObjToString(v["downurl"]),
-                        "fileName": qutil.ObjToString(v["filename"]),
-                        "size":     qutil.ObjToString(v["size"]),
-                    }
-                    break
-                }
-            }
-        }
-    }
-    return
+	r = make(map[string]interface{})
+	// 调用rpc 获取附件信息
+	req := util.JyFileRequest{id}
+	rep, err := util.Attachment(&req)
+	if err != nil {
+		log.Println("attachment  rpc调用失败")
+	} else {
+		if rep.Rep != nil && len(rep.Rep) > 0 {
+			//获取当前附件下载地址
+			for _, v := range rep.Rep {
+				if qutil.ObjToString(v["filename"]) == fileName {
+					r = map[string]interface{}{
+						"downUrl":  qutil.ObjToString(v["downurl"]),
+						"fileName": qutil.ObjToString(v["filename"]),
+						"size":     qutil.ObjToString(v["size"]),
+					}
+					break
+				}
+			}
+		}
+	}
+	return
 }
 
 // 供应信息附件
 func SupplyInfoFile(fileName, msgId string) (r map[string]interface{}) {
-    //查数据
-    data := util.InfoMysql.FindOne("supply_info", map[string]interface{}{"id": msgId}, "", "")
-    if *data != nil && (*data)["attach"] != nil {
-        attach_str := qutil.ObjToString((*data)["attach"])
-        var attachMap map[string]interface{}
-        err := json.Unmarshal([]byte(attach_str), &attachMap)
-        if err != nil {
-            log.Println("err:", err)
-        }
-        for _, v := range attachMap {
-            fileMap := qutil.ObjToMap(v)
-            if fileName == qutil.ObjToString((*fileMap)["filename"]) {
-                r = map[string]interface{}{
-                    "downUrl":  fmt.Sprintf("%s/%s", qutil.ObjToString((*fileMap)["ossurl"]), qutil.ObjToString((*fileMap)["fid"])),
-                    "fileName": qutil.ObjToString((*fileMap)["filename"]),
-                    "size":     qutil.ObjToString((*fileMap)["size"]),
-                }
-                break
-            }
-        }
-    }
-    return
+	//查数据
+	data := util.InfoMysql.FindOne("supply_info", map[string]interface{}{"id": msgId}, "", "")
+	if *data != nil && (*data)["attach"] != nil {
+		attach_str := qutil.ObjToString((*data)["attach"])
+		var attachMap map[string]interface{}
+		err := json.Unmarshal([]byte(attach_str), &attachMap)
+		if err != nil {
+			log.Println("err:", err)
+		}
+		for _, v := range attachMap {
+			fileMap := qutil.ObjToMap(v)
+			if fileName == qutil.ObjToString((*fileMap)["filename"]) {
+				r = map[string]interface{}{
+					"downUrl":  fmt.Sprintf("%s/%s", qutil.ObjToString((*fileMap)["ossurl"]), qutil.ObjToString((*fileMap)["fid"])),
+					"fileName": qutil.ObjToString((*fileMap)["filename"]),
+					"size":     qutil.ObjToString((*fileMap)["size"]),
+				}
+				break
+			}
+		}
+	}
+	return
 }
 
 // 兑换作废
 func JyexchangeCance(userId, product, platform, queryTime string, pageSize, pageNum int) (list []map[string]interface{}, total int, err error) {
-    RStruct := InitFindRecord(userId, userId, product, queryTime, platform, pageSize, pageNum, 2)
-    list, total = RStruct.DefaultData()
-    return list, total, nil
+	RStruct := InitFindRecord(userId, userId, product, queryTime, platform, pageSize, pageNum, 2)
+	list, total = RStruct.DefaultData()
+	return list, total, nil
 }
 
 // 消费
 func JyConsumePack(userId, product, platform string, remarks map[string]interface{}, session *httpsession.Session) (r map[string]interface{}, m string, c int) {
-    CStruct := InitUseBalance(userId, product, product, "", "", nil, remarks, 1, platform, session)
-    switch product {
-    case "附件下载包":
-        r, m, c = CStruct.fileConsume()
-    case "大客户平台":
-        r, m, c = CStruct.KeyAccountConsume()
-    case "资源平台":
-        r, m, c = CStruct.KeyAccountConsume()
-    default:
-        r, m, c = CStruct.defaultConsume()
-    }
-    return
+	CStruct := InitUseBalance(userId, product, product, "", "", nil, remarks, 1, platform, session)
+	switch product {
+	case "附件下载包":
+		r, m, c = CStruct.fileConsume()
+	case "大客户平台":
+		r, m, c = CStruct.KeyAccountConsume()
+	case "资源平台":
+		r, m, c = CStruct.KeyAccountConsume()
+	default:
+		r, m, c = CStruct.defaultConsume()
+	}
+	return
 }
 
 // 流水
 func JyFindRecordPack(userId, productName, queryTime, platform string, pageSize, pageNum int) (list []map[string]interface{}, total int, err error) {
-    RStruct := InitFindRecord(userId, userId, productName, queryTime, platform, pageSize, pageNum, 0)
-    switch productName {
-    case "附件下载包":
-        list, total = RStruct.FindJyConsumePackAllRecord()
-    default:
-        list, total = RStruct.DefaultData()
-    }
-    return list, total, nil
+	RStruct := InitFindRecord(userId, userId, productName, queryTime, platform, pageSize, pageNum, 0)
+	switch productName {
+	case "附件下载包":
+		list, total = RStruct.FindJyConsumePackAllRecord()
+	default:
+		list, total = RStruct.DefaultData()
+	}
+	return list, total, nil
 }
 
 // 数据处理-附件下载包
 func (this *FindRecordStruct) FindJyConsumePackAllRecord() ([]map[string]interface{}, int) {
-    var articleAddMap = map[string]string{
-        "PC":  "/article/content/%s.html",
-        "WX":  "/article/content/%s.html",
-        "APP": "/jyapp/article/content/%s.html",
-    }
-    query := map[string]interface{}{
-        "s_userId":  this.UserId,
-        "s_product": this.Name,
-        "s_month":   this.QueryTime,
-    }
-    // log.Println("query:", query, "---", this.Page, this.PageSize)
-    //当月
-    total := util.MQFW.Count(jyCC, query)
-    // query["s_month"] = this.QueryTime
-    list, ok := util.MQFW.Find(jyCC, query, `{"l_updateDate":-1,"l_date":-1}`, `{"s_id":1,"s_fileName":1,"s_downUrl":1,"l_date":1,"s_title":1,"l_updateDate":1}`, false, (this.Page-1)*this.PageSize, this.PageSize)
-    if ok && list != nil {
-        if len(*list) >= 1 {
-            for _, item := range *list {
-                itemData := qutil.ObjToMap(item)
-                if itemData == nil || len(*itemData) == 0 {
-                    continue
-                }
-                l_date := qutil.If((*itemData)["l_updateDate"] != nil, (*itemData)["l_updateDate"], (*itemData)["l_date"])
-                (*itemData)["l_date"] = FormatDateWithObj(&l_date, "2006/01/02")
-                (*itemData)["articleUrl"] = fmt.Sprintf(articleAddMap[this.Platform], encrypt.EncodeArticleId2ByCheck((*itemData)["s_id"].(string)))
-                (*itemData)["s_id"] = encrypt.EncodeArticleId2ByCheck((*itemData)["s_id"].(string))
-                delete((*itemData), "s_downUrl")
-                delete((*itemData), "_id")
-            }
-        } else {
-            log.Println("暂无附件下载记录:", this.UserId)
-        }
-    } else {
-        log.Println("查询附件下载记录异常:", this.UserId)
-    }
+	var articleAddMap = map[string]string{
+		"PC":  "/article/content/%s.html",
+		"WX":  "/article/content/%s.html",
+		"APP": "/jyapp/article/content/%s.html",
+	}
+	query := map[string]interface{}{
+		"s_userId":  this.UserId,
+		"s_product": this.Name,
+		"s_month":   this.QueryTime,
+	}
+	// log.Println("query:", query, "---", this.Page, this.PageSize)
+	//当月
+	total := util.MQFW.Count(jyCC, query)
+	// query["s_month"] = this.QueryTime
+	list, ok := util.MQFW.Find(jyCC, query, `{"l_updateDate":-1,"l_date":-1}`, `{"s_id":1,"s_fileName":1,"s_downUrl":1,"l_date":1,"s_title":1,"l_updateDate":1}`, false, (this.Page-1)*this.PageSize, this.PageSize)
+	if ok && list != nil {
+		if len(*list) >= 1 {
+			for _, item := range *list {
+				itemData := qutil.ObjToMap(item)
+				if itemData == nil || len(*itemData) == 0 {
+					continue
+				}
+				l_date := qutil.If((*itemData)["l_updateDate"] != nil, (*itemData)["l_updateDate"], (*itemData)["l_date"])
+				(*itemData)["l_date"] = FormatDateWithObj(&l_date, "2006/01/02")
+				(*itemData)["articleUrl"] = fmt.Sprintf(articleAddMap[this.Platform], encrypt.EncodeArticleId2ByCheck((*itemData)["s_id"].(string)))
+				(*itemData)["s_id"] = encrypt.EncodeArticleId2ByCheck((*itemData)["s_id"].(string))
+				delete((*itemData), "s_downUrl")
+				delete((*itemData), "_id")
+			}
+		} else {
+			log.Println("暂无附件下载记录:", this.UserId)
+		}
+	} else {
+		log.Println("查询附件下载记录异常:", this.UserId)
+	}
 
-    return *list, total
+	return *list, total
 }
 
 // 数据处理-default
 func (this *FindRecordStruct) DefaultData() ([]map[string]interface{}, int) {
-    returnList, total, err := this.FindRecord()
-    if err != nil {
-        log.Println("默认资源包流水异常:", err)
-        return nil, 0
-    }
-    if total == 0 {
-        log.Println(fmt.Sprintf("暂无%s资源包流水", this.Name))
-    }
-    return qutil.ObjArrToMapArr(returnList), total
+	var (
+		returnList []interface{}
+		total      int
+		err        error
+	)
+	if this.ResourceType == "招投标综合分析下载包" { //芝麻信用流水
+		total = gconv.Int(util.Mysql.Count("bid_credit_balance_details", map[string]interface{}{"user_id": this.UserId}))
+		balanceDetails := util.Mysql.SelectBySql("SELECT *  FROM bid_credit_balance_details where user_id =? order by create_time desc, id desc limit ?,?", this.UserId, (this.Page-1)*this.PageSize, this.PageSize)
+		if balanceDetails != nil && len(*balanceDetails) > 0 {
+			for _, m := range *balanceDetails {
+				var (
+					userType    int
+					combo, mold string
+				)
+				remarks := make(map[string]interface{})
+				switch gconv.Int(m["pack_type"]) {
+				case 1:
+					combo = "月"
+				case 2:
+					combo = "季"
+				case 3:
+					combo = "年"
+				}
+				switch gconv.Int(m["operation"]) {
+				case 1: //新增
+					userType = 1
+					if gconv.Int(m["pack_type"]) > 0 {
+						remarks["source"] = fmt.Sprintf("开通%s卡,%s卡每月余额权益", combo, combo)
+					} else {
+						remarks["source"] = "购买“招投标综合分析”-单份"
+					}
+				case 2: //消费
+					remarks["source"] = "下载报告"
+				case 3: //回收
+					remarks["describe"] = "未使用权益失效"
+					userType = 5
+				case 4: //重新分配
+					userType = 1
+					remarks["source"] = fmt.Sprintf("%s卡每月余额权益", combo)
+				}
+				switch gconv.Int(m["mold"]) {
+				case consts.ZmReportMoldProject:
+					mold = "项目分析报告"
+				case consts.ZmReportMoldEnt:
+					mold = "竞争对手分析报告"
+				case consts.ZmReportMoldBuyer:
+					mold = "采购单位分析报告"
+				}
+				now, _ := time.ParseInLocation("2006-01-02 15:04:05", gconv.String(m["create_time"]), time.Local)
+				returnList = append(returnList, map[string]interface{}{
+					"createTime":    now.Unix(),
+					"number":        math.Abs(gconv.Float64(m["number"])),
+					"deductionNumb": m["residue_number"],
+					"pack_type":     m["pack_type"],
+					"userType":      userType,
+					"remarks":       gconv.String(remarks),
+					"resourceType":  mold,
+				})
+			}
+		}
+	} else {
+		returnList, total, err = this.FindRecord()
+	}
+
+	if err != nil {
+		log.Println("默认资源包流水异常:", err)
+		return nil, 0
+	}
+	if total == 0 {
+		log.Println(fmt.Sprintf("暂无%s资源包流水", this.Name))
+	}
+	return qutil.ObjArrToMapArr(returnList), total
 }

+ 66 - 15
src/jfw/modules/subscribepay/src/entity/bidCreditReport/bidCreditReport.go

@@ -211,7 +211,7 @@ func (b *bidCreditReport) CallBack(from url.Values) bool {
 
 // 芝麻企业信用报告查询接口
 func (b *bidCreditReport) ReportQuery(orderNo string) bool {
-	datas := util.Mysql.SelectBySql(`select mold,bidding_id,project_name,id,user_id,order_code,mail,ent_name,buyer,download_url from jianyu.bid_credit_report where order_no=?`, orderNo)
+	datas := util.Mysql.SelectBySql(`select mold,bidding_id,pack_type,project_name,id,user_id,order_code,mail,ent_name,buyer,download_url from jianyu.bid_credit_report where order_no=?`, orderNo)
 	if datas == nil || len(*datas) == 0 {
 		log.Println("没有找到企业信用报告记录", orderNo)
 		return true
@@ -235,7 +235,8 @@ func (b *bidCreditReport) ReportQuery(orderNo string) bool {
 	if entName != "" {
 		entId = b.GetWinnerIdByName(entName)
 	}
-	mold := gconv.Int((*datas)[0]["mold"]) //报告类型
+	mold := gconv.Int((*datas)[0]["mold"])          //报告类型
+	packType := gconv.Int((*datas)[0]["pack_type"]) //报告类型
 	subject := fmt.Sprintf("投标企业信用报告(%s)", entName)
 	fileName := "/" + b.folderName(bcrId, orderCode, entName) + "/" + subject + ".pdf"
 	reportType := "4"
@@ -269,18 +270,19 @@ func (b *bidCreditReport) ReportQuery(orderNo string) bool {
 		"bcr_id": bcrId,
 	}, map[string]interface{}{
 		"$set": map[string]interface{}{
-			"type":         reportType,
-			"user_id":      userId,
-			"s_email":      userMail,
-			"l_createTime": time.Now().Unix(),
-			"s_pdfUrl":     downloadUrl,
-			"bcr_id":       bcrId,
-			"ent":          entName,
-			"buyer":        buyer,
-			"projectname":  projectName,
-			"biddingTitle": biddingTitle,
-			"biddingId":    biddingId,
-			"entId":        entId,
+			"type":               reportType,
+			"user_id":            userId,
+			"s_email":            userMail,
+			"l_createTime":       time.Now().Unix(),
+			"s_pdfUrl":           downloadUrl,
+			"bcr_id":             bcrId,
+			"ent":                entName,
+			"buyer":              buyer,
+			"projectname":        projectName,
+			"biddingTitle":       biddingTitle,
+			"biddingId":          biddingId,
+			"entId":              entId,
+			"acquisition_method": packType,
 		},
 	}, true, false)
 	downloadUrl = config.Config.WebDomain + downloadUrl
@@ -358,7 +360,7 @@ func (b *bidCreditReport) sendMail(userId, userMail, entName, buyer, downloadUrl
 
 // 芝麻企业信用招投标报告创建请求
 func (b *bidCreditReport) Create(id int64) error {
-	datas := util.Mysql.SelectBySql(`select price,mold,bidding_id,project_name,user_id,order_code,ent_name,cert_no,buyer,prove_purchase,prove_purchase_status,prove_executed,prove_executed_status,prove_dishonesty,prove_dishonesty_status,prove_produce,prove_produce_status,creditchina,performance,out_biz_no,order_no from jianyu.bid_credit_report where id=?`, id)
+	datas := util.Mysql.SelectBySql(`select price,pack_type,mold,bidding_id,project_name,user_id,order_code,ent_name,cert_no,buyer,prove_purchase,prove_purchase_status,prove_executed,prove_executed_status,prove_dishonesty,prove_dishonesty_status,prove_produce,prove_produce_status,creditchina,performance,out_biz_no,order_no from jianyu.bid_credit_report where id=?`, id)
 	if datas == nil || len(*datas) == 0 {
 		return errors.New("没有找到相关记录")
 	}
@@ -373,6 +375,7 @@ func (b *bidCreditReport) Create(id int64) error {
 	projectName := gconv.String((*datas)[0]["project_name"])
 	performance := gconv.String((*datas)[0]["performance"])
 	price := gconv.Int((*datas)[0]["price"])
+	packType := gconv.Int((*datas)[0]["pack_type"])
 	var err error
 	outBizNo := guid.S()
 	mgoUserId := userId
@@ -418,6 +421,14 @@ func (b *bidCreditReport) Create(id int64) error {
 			biz["bidder_ep_name"] = entName
 			biz["bidder_ep_cert_no"] = certNo
 		}
+		switch packType {
+		case 1:
+			biz["pack_type"] = "MONTH"
+		case 2:
+			biz["pack_type"] = "QUARTER"
+		case 3:
+			biz["pack_type"] = "YEAR"
+		}
 		//项目名称
 		if projectName != "" {
 			biz["project_name"] = projectName
@@ -445,6 +456,7 @@ func (b *bidCreditReport) Create(id int64) error {
 	if err != nil {
 		return err
 	}
+	log.Println("分析报告", di)
 	biz := map[string]interface{}{
 		"order_no":   orderNo,
 		"order_type": consts.ZMReportOrderType[mold], //"EP_ZTB_REPORT",
@@ -469,6 +481,45 @@ func (b *bidCreditReport) Create(id int64) error {
 	return nil
 }
 
+// 芝麻企业信用招投标套餐创建请求
+func (b *bidCreditReport) CreateCombo(userId, start, end string, price, pack_type int) error {
+	var (
+		packType string
+		number   int
+	)
+	exampleType := g.Cfg("./zm_analysis_report.yaml").MustGet(gctx.New(), "exampleType").Maps()
+	for _, m := range exampleType {
+		if gconv.Int(m["pack_type"]) == pack_type {
+			number = gconv.Int(m["number"])
+		}
+	}
+	var quota int
+	switch pack_type {
+	case 1:
+		packType = "MONTH"
+		quota = number
+	case 2:
+		packType = "QUARTER"
+		quota = number * 3
+	case 3:
+		packType = "YEAR"
+		quota = number * 12
+	}
+	biz := map[string]interface{}{
+		"customer_id":   userId,
+		"pack_type":     packType,
+		"quota":         quota, //
+		"report_amount": price,
+		"start_date":    start,
+		"end_date":      end,
+	}
+	result := b.request(userId, "zhima.credit.ep.pack.subscribe", biz)
+	if result.GetVar("code").String() != "10000" {
+		return errors.New(result.String())
+	}
+	return nil
+}
+
 func (b *bidCreditReport) GetWinnerIdByName(entName string) (entId string) {
 	if entName == "" {
 		return

+ 1 - 0
src/jfw/modules/subscribepay/src/entity/bidReportPayBack.go

@@ -46,6 +46,7 @@ func (b *bidCreditReportPay) PayCallBack(param *CallBackParam) bool {
 					"order_code": order_code,
 				}, map[string]interface{}{
 					"is_service_open":   1,
+					"pay_status":        1,
 					"open_service_time": now.Format(time.DateTime),
 				}) {
 					return false

+ 1 - 0
src/jfw/modules/subscribepay/src/entity/bidfile.go

@@ -59,6 +59,7 @@ func (b *bidfile) PayCallBack(param *CallBackParam) bool {
 					"order_code": orderCode,
 				}, map[string]interface{}{
 					"is_service_open":   1,
+					"pay_status":        1,
 					"open_service_time": now.Format(time.DateTime),
 					"service_starttime": now.Format(time.DateTime),
 					"service_endtime":   GetTime("2006年01月02日15:04:05", fmt.Sprintf("%s23:59:59", endtime)).Format(Date_Full_Layout),

+ 43 - 6
src/jfw/modules/subscribepay/src/entity/commodity.go

@@ -3,6 +3,8 @@ package entity
 import (
 	"encoding/json"
 	"fmt"
+	"github.com/gogf/gf/v2/frame/g"
+	"github.com/gogf/gf/v2/os/gctx"
 	"github.com/gogf/gf/v2/util/gconv"
 	"jy/src/jfw/modules/subscribepay/src/config"
 	"jy/src/jfw/modules/subscribepay/src/consts"
@@ -955,6 +957,21 @@ func GetExtend(productCode int64, types string, id string) map[int64]map[string]
 			//"priceUnit":    "元", //价格单位  元/分...
 			"specsUnit": "个", //产品单位  天/条..,
 		}
+	case PDFPACK_ZMANALYSISREPORT:
+		data = map[string]interface{}{
+			"1511": map[string]interface{}{
+				"pack_type":    0,
+				"validityYear": 3, //有效期限
+				//"priceUnit":    "元", //价格单位  元/分...
+				"specsUnit": "份", //产品单位  天/条..,
+			},
+		}
+		exampleType := g.Cfg("./zm_analysis_report.yaml").MustGet(gctx.New(), "exampleType").Maps()
+		for _, m := range exampleType {
+			m["specsUnit"] = "份"
+			data[gconv.String(m["id"])] = m
+		}
+
 	}
 	retData := map[int64]map[string]interface{}{}
 	if types != "" {
@@ -1184,7 +1201,11 @@ func zmAnalysisReportProduct(productId, orderType int64, userid string, spec *ma
 	productInfo.ProductId = productId
 	sku := []*Sku{}
 	userId := qu.InterfaceToStr(sess["userId"])
-
+	var isCombo bool
+	user := util.Compatible.Select(userId, `{"i_zhima_endtime":1,"i_zhima_starttime":1,"i_zhima_status":1,"i_zhima_number":1}`)
+	if user != nil && len(*user) > 0 {
+		isCombo = gconv.Int((*user)["i_zhima_status"]) > 0
+	}
 	//子产品
 	allLottery := util.UserAllLottery(0, 1, 0, strconv.Itoa(int(productId)), userid, config.CouponConfig.AppId)
 	for _, v_ := range proList {
@@ -1193,6 +1214,11 @@ func zmAnalysisReportProduct(productId, orderType int64, userid string, spec *ma
 		desc := fmt.Sprintf("%v %s", num, unit)
 		if num == 1 {
 			desc = "单份"
+		} else {
+			if isCombo {
+				continue
+			}
+			desc = fmt.Sprintf("%s卡", unit)
 		}
 		choosed := false
 		productIdStr := strconv.Itoa(int(productId))
@@ -1227,7 +1253,21 @@ func zmAnalysisReportProduct(productId, orderType int64, userid string, spec *ma
 		}
 
 		// 判断有没有首次购买优惠  有首购优惠则不展示其他活动信息 不叠加
-		if ok, firstDiscount := GetZmAnalysisReportFirstDiscount(v, userId); ok && firstDiscount > 0 {
+		var (
+			ok, isCombos  bool
+			firstDiscount int
+		)
+		if v == consts.ZmAnalysisReportSinglePackageID {
+			ok, firstDiscount, isCombos = GetZmAnalysisReportFirstDiscount(v, userId)
+			if ok && firstDiscount > 0 && !isCombos {
+				extend1[v] = map[string]interface{}{
+					"is_first": true,
+				}
+			}
+		} else { //套餐
+			ok, firstDiscount = GetZmAnalysisReportComboDiscount(v)
+		}
+		if ok && firstDiscount > 0 {
 			productSku.Activity = nil
 			productSku.ActivityId = 0
 			productSku.LotterId = 0
@@ -1236,14 +1276,11 @@ func zmAnalysisReportProduct(productId, orderType int64, userid string, spec *ma
 			if productSku.DiscountPrice < 0 {
 				productSku.DiscountPrice = 0
 			}
-			extend1[v] = map[string]interface{}{
-				"is_first": true,
-			}
 		}
 		sku = append(sku, productSku)
 	}
 	productInfo.Sku = sku
-	productInfo.Extend = GetExtend(productId, PDFPACK_SOURCENAME, productType)
+	productInfo.Extend = GetExtend(productId, PDFPACK_ZMANALYSISREPORT, productType)
 	productInfo.Extend1 = extend1
 	*productInfolist = append(*productInfolist, *productInfo)
 	return

+ 1 - 0
src/jfw/modules/subscribepay/src/entity/dataExportPackStruct.go

@@ -95,6 +95,7 @@ func (this *dataExportPackStruct) PayCallBack(param *CallBackParam) bool {
 					"order_code": orderCode,
 				}, map[string]interface{}{
 					"is_service_open":   1,
+					"pay_status":        1,
 					"open_service_time": now.Format(time.DateTime),
 					"service_starttime": now.Format(time.DateTime),
 					"service_endtime":   entTime.Format(time.DateTime),

+ 1 - 0
src/jfw/modules/subscribepay/src/entity/dataReportStruct.go

@@ -54,6 +54,7 @@ func (this *dataReportStruct) PayCallBack(param *CallBackParam) (update bool) {
 					"order_code": orderCode,
 				}, map[string]interface{}{
 					"is_service_open":   1,
+					"pay_status":        1,
 					"open_service_time": now.Format(time.DateTime),
 					"service_starttime": service_starttime,
 					"service_endtime":   service_endtime,

+ 1 - 0
src/jfw/modules/subscribepay/src/entity/dataexport.go

@@ -107,6 +107,7 @@ func (d *dataExportStruct) PayCallBack(param *CallBackParam) bool {
 				if !util.Mysql.UpdateByTx(tx, "jy_order_detail", g.Map{
 					"order_code": orderCode,
 				}, map[string]interface{}{
+					"pay_status":        1,
 					"service_starttime": service_starttime,
 					"service_endtime":   service_endtime,
 				}) {

+ 1 - 0
src/jfw/modules/subscribepay/src/entity/debrisProduct.go

@@ -89,6 +89,7 @@ func (this *debrisProductStruct) PayCallBack(param *CallBackParam) (update bool)
 			"order_code": orderCode,
 		}, map[string]interface{}{
 			"is_service_open":   1,
+			"pay_status":        1,
 			"service_starttime": FormatDate(&startTime, Date_Full_Layout),
 			"service_endtime":   FormatDate(&endTime, Date_Full_Layout),
 			"open_service_time": now.Format(time.DateTime),

+ 1 - 0
src/jfw/modules/subscribepay/src/entity/docMember.go

@@ -136,6 +136,7 @@ func (d *docMemberStruct) PayCallBack(param *CallBackParam) bool {
 			"order_code": orderCode,
 		}, map[string]interface{}{
 			"is_service_open":   1,
+			"pay_status":        1,
 			"open_service_time": now.Format(time.DateTime),
 			"service_endtime":   updateMap["vip_endtime"],
 			"service_starttime": updateMap["vip_starttime"],

+ 1 - 0
src/jfw/modules/subscribepay/src/entity/integral.go

@@ -86,6 +86,7 @@ func (b *integral) PayCallBack(param *CallBackParam) bool {
 					"order_code": order_code,
 				}, map[string]interface{}{
 					"is_service_open":   1,
+					"pay_status":        1,
 					"open_service_time": now.Format(time.DateTime),
 					"service_starttime": service_starttime,
 					"service_endtime":   service_endtime,

+ 1 - 0
src/jfw/modules/subscribepay/src/entity/jyCourseOnlineStruct.go

@@ -57,6 +57,7 @@ func (this *jyCourseOnline) PayCallBack(param *CallBackParam) bool {
 					"order_code": orderCode,
 				}, map[string]interface{}{
 					"is_service_open":   1,
+					"pay_status":        1,
 					"open_service_time": now.Format(time.DateTime),
 					"service_starttime": service_starttime,
 					"service_endtime":   service_endtime,

+ 1 - 0
src/jfw/modules/subscribepay/src/entity/jyCourseStruct.go

@@ -125,6 +125,7 @@ func (this *jyCourse) PayCallBack(param *CallBackParam) bool {
 					"order_code": orderCode,
 				}, map[string]interface{}{
 					"is_service_open":   1,
+					"pay_status":        1,
 					"open_service_time": now.Format(time.DateTime),
 					"service_starttime": service_starttime,
 					"service_endtime":   service_endtime,

+ 1 - 0
src/jfw/modules/subscribepay/src/entity/member.go

@@ -99,6 +99,7 @@ func (m *memberStruct) PayCallBack(param *CallBackParam) bool {
 				}
 				upData := map[string]interface{}{
 					"is_service_open":   1,
+					"pay_status":        1,
 					"service_starttime": nowFormat,
 					"service_endtime":   FormatDate(&enddate, Date_Full_Layout),
 					"open_service_time": now.Format(time.DateTime),

+ 180 - 0
src/jfw/modules/subscribepay/src/entity/order.go

@@ -2,11 +2,18 @@ package entity
 
 import (
 	"app.yhyue.com/moapp/jybase/es"
+<<<<<<< HEAD
 	"app.yhyue.com/moapp/jybase/mongodb"
+=======
+>>>>>>> master
 	"bytes"
 	"encoding/json"
 	"fmt"
 	"github.com/gogf/gf/v2/frame/g"
+<<<<<<< HEAD
+=======
+	"github.com/gogf/gf/v2/os/gctx"
+>>>>>>> master
 	"github.com/gogf/gf/v2/util/gconv"
 	"io/ioutil"
 	"jy/src/jfw/modules/subscribepay/src/config"
@@ -66,7 +73,10 @@ type OrderInfo struct {
 	DataSpec          string `json:"data_spec,omitempty"`
 	UserMail          string `json:"user_mail,omitempty"`
 	UserPhone         string `json:"user_phone,omitempty"`
+<<<<<<< HEAD
 	PersonPhone       string `json:"person_phone,omitempty"`
+=======
+>>>>>>> master
 	DataCount         int    `json:"data_count,omitempty"`
 	FilterPublishtime string `json:"filter_publishtime,omitempty"`
 	FilterKeys        string `json:"filter_keys,omitempty"`
@@ -149,6 +159,7 @@ func (this *commonOrderStruct) InserMap(product, productId, userid, lotteryId, d
 	if orderinfo == nil && msg != "" {
 		return
 	}
+<<<<<<< HEAD
 	if userid != "" {
 		if mongodb.IsObjectIdHex(userid) {
 			userData, ok := util.MQFW.FindById("user", userid, "")
@@ -162,19 +173,29 @@ func (this *commonOrderStruct) InserMap(product, productId, userid, lotteryId, d
 			}
 		}
 	}
+=======
+>>>>>>> master
 	filterM := map[string]interface{}{}
 	if err := json.Unmarshal([]byte(orderinfo.Filter), &filterM); err != nil {
 		return
 	}
 	// p738 芝麻分析报告首购优惠 不与活动叠加
 	if product == consts.ZmAnalysisReportProductName {
+<<<<<<< HEAD
 		if isFirst, b := m["is_first"].(bool); b && isFirst {
 			// 再次判断是否符合首购优惠
 			if ok, firstDiscount := GetZmAnalysisReportFirstDiscount(qu.Int64All(productId), userid); ok && firstDiscount > 0 {
+=======
+		if gconv.Int(filterM["pack_type"]) == 0 {
+			//if isFirst, b := m["is_first"].(bool); b && isFirst {
+			// 再次判断是否符合首购优惠
+			if ok, firstDiscount, isCombo := GetZmAnalysisReportFirstDiscount(qu.Int64All(productId), userid); ok && firstDiscount > 0 {
+>>>>>>> master
 				// 如果符合首次优惠则取首次优惠价格
 				orderinfo.OrderMoney = orderinfo.OriginalPrice - firstDiscount
 				orderinfo.DiscountPrice = firstDiscount
 				orderinfo.OrderDetail["final_price"] = orderinfo.OrderMoney
+<<<<<<< HEAD
 				filterM["first_price"] = 1 // 首购优惠标识
 				filterByte, _ := json.Marshal(filterM)
 				orderinfo.Filter = string(filterByte)
@@ -184,6 +205,26 @@ func (this *commonOrderStruct) InserMap(product, productId, userid, lotteryId, d
 
 		}
 
+=======
+				if isCombo {
+					filterM["combo_price"] = 1 // 套餐优惠标识
+				} else {
+					filterM["first_price"] = 1 // 首购优惠标识
+				}
+				filterByte, _ := json.Marshal(filterM)
+				orderinfo.Filter = string(filterByte)
+			}
+			//}
+		} else {
+			if ok, ComboDiscount := GetZmAnalysisReportComboDiscount(qu.Int64All(productId)); ok && ComboDiscount > 0 {
+				orderinfo.OrderMoney = orderinfo.OriginalPrice - ComboDiscount
+				orderinfo.DiscountPrice = ComboDiscount
+				orderinfo.OrderDetail["final_price"] = orderinfo.OrderMoney
+				filterByte, _ := json.Marshal(filterM)
+				orderinfo.Filter = string(filterByte)
+			}
+		}
+>>>>>>> master
 	}
 	//卡券
 	log.Println("卡卷信息", lotteryId)
@@ -408,7 +449,11 @@ func dataExportOrder(m map[string]interface{}, userId string) (*OrderInfo, strin
 	return &OrderInfo{
 		UserId:            userId,
 		OrderCode:         ordercode,
+<<<<<<< HEAD
 		PersonPhone:       qu.ObjToString(m["order_phone"]),
+=======
+		UserPhone:         qu.ObjToString(m["order_phone"]),
+>>>>>>> master
 		UserMail:          qu.ObjToString(m["order_email"]),
 		ProductType:       "历史数据",
 		OrderMoney:        order_money,
@@ -750,10 +795,17 @@ func vipFirstBuy(m map[string]interface{}, userId string, session *httpsession.S
 				"finalAreaCount":    areaCount,
 			}),
 		},
+<<<<<<< HEAD
 		UserId:      userId,
 		Filter:      string(filterStr),
 		DisWord:     disWord,
 		PersonPhone: qu.ObjToString(m["order_phone"]),
+=======
+		UserId:    userId,
+		Filter:    string(filterStr),
+		DisWord:   disWord,
+		UserPhone: qu.ObjToString(m["order_phone"]),
+>>>>>>> master
 	}, ""
 }
 
@@ -864,7 +916,11 @@ func vipRenew(m map[string]interface{}, userId string, session *httpsession.Sess
 		VipType:       1,
 		VipStartTime:  FormatDate(&startTime, Date_Full_Layout),
 		VipEndTime:    FormatDate(&endTime, Date_Full_Layout),
+<<<<<<< HEAD
 		PersonPhone:   qu.ObjToString(m["order_phone"]),
+=======
+		UserPhone:     qu.ObjToString(m["order_phone"]),
+>>>>>>> master
 		OrderDetail: g.Map{
 			"order_code":   ordercode,
 			"product_type": "VIP订阅",
@@ -1027,7 +1083,11 @@ func vipUpgrade(m map[string]interface{}, userId string, session *httpsession.Se
 		Filter:        string(filterStr),
 		DisWord:       disWord,
 		VipType:       2,
+<<<<<<< HEAD
 		PersonPhone:   order_phone,
+=======
+		UserPhone:     order_phone,
+>>>>>>> master
 		VipStartTime:  FormatDate(&startTime, Date_Full_Layout),
 		VipEndTime:    FormatDate(&endTime, Date_Full_Layout),
 		OrderDetail: g.Map{
@@ -1116,7 +1176,11 @@ func memberOrder(m map[string]interface{}, userId string, session *httpsession.S
 		PrepayTime:    NowFormat(Date_Full_Layout),
 		UserId:        userId,
 		OriginalPrice: order_money,
+<<<<<<< HEAD
 		PersonPhone:   order_phone,
+=======
+		UserPhone:     order_phone,
+>>>>>>> master
 		OrderDetail: g.Map{
 			"order_code":     code,
 			"product_type":   "大会员",
@@ -1171,7 +1235,11 @@ func integralOrder(m map[string]interface{}, userId string) (*OrderInfo, string)
 		PrepayTime:    NowFormat(Date_Full_Layout),
 		UserId:        userId,
 		OriginalPrice: original_price,
+<<<<<<< HEAD
 		PersonPhone:   order_phone,
+=======
+		UserPhone:     order_phone,
+>>>>>>> master
 		OrderDetail: g.Map{
 			"order_code":   code,
 			"product_type": "剑鱼币",
@@ -1227,7 +1295,11 @@ func dataexportPackOrder(m map[string]interface{}, userId string) (*OrderInfo, s
 		OrderMoney:    orderMoney,
 		OrderStatus:   0,
 		ServiceStatus: 0,
+<<<<<<< HEAD
 		PersonPhone:   qu.ObjToString(m["order_phone"]),
+=======
+		UserPhone:     qu.ObjToString(m["order_phone"]),
+>>>>>>> master
 		OrderCode:     orderCode,
 		ProductType:   "数据流量包",
 		CreateTime:    NowFormat(Date_Full_Layout),
@@ -1297,7 +1369,11 @@ func pdfExportPackOrder(m map[string]interface{}, userId, product, productId str
 		OrderMoney:    packDetail.Price, //订单金额
 		OrderStatus:   0,
 		ServiceStatus: 0,
+<<<<<<< HEAD
 		PersonPhone:   qu.ObjToString(m["order_phone"]),
+=======
+		UserPhone:     qu.ObjToString(m["order_phone"]),
+>>>>>>> master
 		OrderCode:     orderCode,
 		ProductType:   product,
 		CreateTime:    NowFormat(Date_Full_Layout),
@@ -1359,7 +1435,11 @@ func areaPackOrder(m map[string]interface{}, userId string, session *httpsession
 		OrderMoney:    totalfee,
 		OrderStatus:   0,
 		ServiceStatus: 0,
+<<<<<<< HEAD
 		PersonPhone:   qu.ObjToString(m["order_phone"]),
+=======
+		UserPhone:     qu.ObjToString(m["order_phone"]),
+>>>>>>> master
 		OrderCode:     orderCode,
 		ProductType:   "省份订阅包",
 		CreateTime:    NowFormat(Date_Full_Layout),
@@ -1484,7 +1564,11 @@ func filePackOrder(m map[string]interface{}, userId string, session *httpsession
 		OrderMoney:    price,
 		OrderStatus:   0,
 		ServiceStatus: 0,
+<<<<<<< HEAD
 		PersonPhone:   order_phone,
+=======
+		UserPhone:     order_phone,
+>>>>>>> master
 		OrderCode:     orderCode,
 		ProductType:   "附件下载包",
 		CreateTime:    FormatDate(&now, Date_Full_Layout),
@@ -1572,7 +1656,11 @@ func buyerPortraitPackOrder(m map[string]interface{}, userId string, session *ht
 		OrderMoney:    price,
 		OrderStatus:   0,
 		ServiceStatus: 0,
+<<<<<<< HEAD
 		PersonPhone:   order_phone,
+=======
+		UserPhone:     order_phone,
+>>>>>>> master
 		OrderCode:     orderCode,
 		ProductType:   "采购单位画像包",
 		CreateTime:    FormatDate(&now, Date_Full_Layout),
@@ -1644,7 +1732,11 @@ func newDataReportOrder(m map[string]interface{}, userId string) (*OrderInfo, st
 		OrderMoney:    qu.IntAll((*r)["i_price"]),
 		OrderStatus:   0,
 		ServiceStatus: 0,
+<<<<<<< HEAD
 		PersonPhone:   phone,
+=======
+		UserPhone:     phone,
+>>>>>>> master
 		OrderCode:     orderCode,
 		ProductType:   "数据报告",
 		CreateTime:    FormatDate(&now, Date_Full_Layout),
@@ -1702,7 +1794,11 @@ func bidReportOrder(m map[string]interface{}, userId, productId string, session
 		OrderMoney:    packDetail.Price,
 		OrderStatus:   0,
 		ServiceStatus: 0,
+<<<<<<< HEAD
 		PersonPhone:   phone,
+=======
+		UserPhone:     phone,
+>>>>>>> master
 		OrderCode:     orderCode,
 		ProductType:   "投标企业信用报告",
 		CreateTime:    FormatDate(&now, Date_Full_Layout),
@@ -1733,6 +1829,10 @@ type zmAnalysisReportOrderData struct {
 	CertNo       string `json:"certNo,omitempty"`
 	ProjectName  string `json:"projectName,omitempty"`
 	BiddingTitle string `json:"biddingTitle,omitempty"`
+<<<<<<< HEAD
+=======
+	PackType     int    `json:"packType,omitempty"`
+>>>>>>> master
 }
 
 func zmAnalysisReportOrder(m map[string]interface{}, userId, productId string) (*OrderInfo, string) {
@@ -1746,6 +1846,22 @@ func zmAnalysisReportOrder(m map[string]interface{}, userId, productId string) (
 	//生成订单号
 	orderCode := pay.GetOrderCode(userId)
 	order_phone := qu.ObjToString(m["order_phone"])
+<<<<<<< HEAD
+=======
+	var (
+		equity string
+	)
+	if params.PackType == 0 {
+		equity = "1份"
+	} else {
+		exampleType := g.Cfg("./zm_analysis_report.yaml").MustGet(gctx.New(), "exampleType").Maps()
+		for _, m := range exampleType {
+			if gconv.Int(m["pack_type"]) == params.PackType {
+				equity = fmt.Sprintf("%d份/月", gconv.Int(m["number"]))
+			}
+		}
+	}
+>>>>>>> master
 	now := time.Now()
 	report := map[string]interface{}{
 		"ent_name":      params.EntName,
@@ -1757,6 +1873,11 @@ func zmAnalysisReportOrder(m map[string]interface{}, userId, productId string) (
 		"bidding_id":    params.BiddingId,
 		"bidding_title": params.BiddingTitle,
 		"project_name":  params.ProjectName,
+<<<<<<< HEAD
+=======
+		"pack_type":     params.PackType,
+		"equity":        equity,
+>>>>>>> master
 	}
 	filterStr, _ := json.Marshal(report)
 	packDetail, err := JyPdfExportPack.GetPdfPackDetail(productId)
@@ -1767,7 +1888,11 @@ func zmAnalysisReportOrder(m map[string]interface{}, userId, productId string) (
 		OrderMoney:    packDetail.Price,
 		OrderStatus:   0,
 		ServiceStatus: 0,
+<<<<<<< HEAD
 		PersonPhone:   params.Phone,
+=======
+		UserPhone:     params.Phone,
+>>>>>>> master
 		OrderCode:     orderCode,
 		ProductType:   consts.ZmAnalysisReportProductName,
 		CreateTime:    FormatDate(&now, Date_Full_Layout),
@@ -1798,6 +1923,16 @@ func zmReportCheckParams(m map[string]interface{}, userId string) (*zmAnalysisRe
 	if !EmailReg.MatchString(email) {
 		return nil, "数据校验不通过"
 	}
+<<<<<<< HEAD
+=======
+	number, endTime, _ := ZmAnalysis(userId)
+	if number > 0 {
+		return nil, "套餐存在可用权益"
+	}
+	if gconv.Int64(m["pack_type"]) > 0 && endTime >= time.Now().Unix() {
+		return nil, "已购买套餐,请选择单份购买"
+	}
+>>>>>>> master
 	// todo 待确认是否需要校验其他信息有效性
 	var certNo, projectName string
 	entNameSingel := entName
@@ -1867,10 +2002,43 @@ func zmReportCheckParams(m map[string]interface{}, userId string) (*zmAnalysisRe
 		BiddingId:    biddingId,
 		ProjectName:  projectName,
 		BiddingTitle: biddingTitle,
+<<<<<<< HEAD
+	}
+	return returnData, ""
+=======
+		PackType:     gconv.Int(m["pack_type"]),
 	}
 	return returnData, ""
 }
 
+func ZmAnalysis(userId string) (int64, int64, int64) {
+	data := util.Compatible.Select(userId, `{"i_zhima_endtime":1,"i_zhima_starttime":1,"i_zhima_status":1,"i_zhima_number":1}`)
+	var i_zhima_status, i_zhima_endtime int64
+	if data != nil && len(*data) > 0 {
+		i_zhima_endtime = qu.Int64All((*data)["i_zhima_endtime"])
+		i_zhima_starttime := qu.Int64All((*data)["i_zhima_starttime"])
+		i_zhima_status = qu.Int64All((*data)["i_zhima_status"])
+		i_zhima_number := qu.Int64All((*data)["i_zhima_number"])
+		if i_zhima_status > 0 {
+			zhimaEndtime := time.Unix(i_zhima_endtime, 0)
+			zhimaStarttime := time.Unix(i_zhima_starttime, 0)
+			for zhimaEndtime.After(zhimaStarttime) {
+				newZmTime := zhimaStarttime.AddDate(0, 1, 0)
+				if newZmTime.Unix() >= time.Now().Unix() {
+					var number int64
+					//计算周期内数量
+					balanceDetails := util.Mysql.CountBySql("SELECT count(1)  FROM bid_credit_report where create_time>=? and mold>0 and user_id =? and pack_type>0", FormatDate(&zhimaStarttime, Date_Full_Layout), userId)
+					number = i_zhima_number - balanceDetails
+					return qu.Int64All(qu.If(number < 0, 0, number)), i_zhima_endtime, i_zhima_status
+				}
+				zhimaStarttime = newZmTime
+			}
+		}
+	}
+	return 0, i_zhima_endtime, i_zhima_status
+>>>>>>> master
+}
+
 // 中标必听课
 func courseOnlineOrder(m map[string]interface{}, userId string) (*OrderInfo, string) {
 	pay_way := "wx_app"
@@ -1920,7 +2088,11 @@ func courseOnlineOrder(m map[string]interface{}, userId string) (*OrderInfo, str
 		OrderMoney:    price,
 		OrderStatus:   0,
 		ServiceStatus: 0,
+<<<<<<< HEAD
 		PersonPhone:   order_phone,
+=======
+		UserPhone:     order_phone,
+>>>>>>> master
 		OrderCode:     orderCode,
 		ProductType:   "中标必听课",
 		CreateTime:    FormatDate(&now, Date_Full_Layout),
@@ -2023,7 +2195,11 @@ func docMemberFirstBuy(m map[string]interface{}, userId string, session *httpses
 		OriginalPrice: original_price,
 		UserId:        userId,
 		Filter:        string(filterStr),
+<<<<<<< HEAD
 		PersonPhone:   qu.ObjToString(m["order_phone"]),
+=======
+		UserPhone:     qu.ObjToString(m["order_phone"]),
+>>>>>>> master
 		OrderDetail: g.Map{
 			"order_code":   ordercode,
 			"product_type": DocMemberProductName,
@@ -2100,7 +2276,11 @@ func docMemberRenew(m map[string]interface{}, userId string, session *httpsessio
 		VipType:       1, // 续费
 		VipStartTime:  FormatDate(&startTime, Date_Full_Layout),
 		VipEndTime:    FormatDate(&endTime, Date_Full_Layout),
+<<<<<<< HEAD
 		PersonPhone:   order_phone,
+=======
+		UserPhone:     order_phone,
+>>>>>>> master
 		OrderDetail: g.Map{
 			"order_code":   ordercode,
 			"product_type": DocMemberProductName,

+ 44 - 2
src/jfw/modules/subscribepay/src/entity/pdfExportPack.go

@@ -11,11 +11,14 @@ import (
 	"encoding/json"
 	"fmt"
 	"github.com/gogf/gf/v2/frame/g"
+	"github.com/gogf/gf/v2/os/gctx"
 	"github.com/gogf/gf/v2/util/gconv"
 	"github.com/google/uuid"
 	"io"
+	"jy/src/jfw/modules/subscribepay/src/consts"
 	"jy/src/jfw/modules/subscribepay/src/util"
 	"log"
+	"math"
 	"net"
 	"net/http"
 	"net/url"
@@ -35,7 +38,7 @@ const (
 	PDFPACK_BUYER            = "业主采购分析报告下载包"
 	PDFPACK_MARKET           = "市场分析定制报告下载包"
 	PDFPACK_BIDREPORT        = "投标企业信用报告下载包"
-	PDFPACK_ZMANALYSISREPORT = "芝麻信用共建分析报告下载包"
+	PDFPACK_ZMANALYSISREPORT = "招投标综合分析下载包"
 
 	ParentResourceIdPrefix = "p_share_"
 )
@@ -104,13 +107,22 @@ type (
 		WINNER AccountPdfPack `json:"winner"` //企业中标分析报告下载包
 		BUYER  AccountPdfPack `json:"buyer"`  //业主采购分析报告下载包
 		MARKET AccountPdfPack `json:"market"` //市场分析定制报告下载包
+		ZHIMA  ZhimaPack      `json:"zhima"`  //芝麻分析报告下载包
 	}
 	AccountPdfPack struct {
 		Total      int    `json:"total"`
 		MinEndTime string `json:"minEndTime"`
 		FirstUse   string `json:"-"` //优先使用账号
 	}
-
+	ZhimaPack struct {
+		Total        int    `json:"total"`
+		Balance      int    `json:"balance"`
+		PackType     int64  `json:"pack_type"`
+		MinEndTime   string `json:"minEndTime"`
+		FirstMsg     string `json:"firstMsg"`
+		ExpiredMsg   string `json:"expiredMsg"`
+		EffectiveMsg string `json:"effectiveMsg"`
+	}
 	PdfPackUseRemark struct {
 		QueryId         string `json:"queryId"`         //查询条件
 		PdfUrl          string `json:"pdfUrl"`          //下载地址
@@ -180,6 +192,7 @@ func (this *pdfExportPackStruct) PayCallBack(param *CallBackParam) bool {
 				"order_code": orderCode,
 			}, map[string]interface{}{
 				"is_service_open":   1,
+				"pay_status":        1,
 				"open_service_time": now.Format(time.DateTime),
 				"service_starttime": now.Format(time.DateTime),
 				"service_endtime":   endTime.Format(Date_Full_Layout),
@@ -339,6 +352,7 @@ func (this *pdfExportPackStruct) accountQuery(accountId string) (*AccountPdfPack
 		if packMap == nil || len(*packMap) == 0 {
 			continue
 		}
+
 		if packType := qutil.ObjToString((*packMap)["name"]); packType != PDFPACK_SOURCENAME {
 			continue
 		}
@@ -358,6 +372,33 @@ func (this *pdfExportPackStruct) accountQuery(accountId string) (*AccountPdfPack
 			account.MARKET = packDetail
 		}
 	}
+
+	//判断用户权益
+	number, endTime, packType := ZmAnalysis(accountId)
+	account.ZHIMA = ZhimaPack{
+		PackType:   packType,
+		Balance:    gconv.Int(number),
+		MinEndTime: time.Unix(endTime, 0).Format(time.DateTime),
+	}
+	exampleType := g.Cfg("./zm_analysis_report.yaml").MustGet(gctx.New(), "exampleType").Maps()
+	switch {
+	case packType == 0: //没有开过套餐
+		if b, firstDiscount, isCombo := GetZmAnalysisReportFirstDiscount(consts.ZmAnalysisReportSinglePackageID, accountId); b && firstDiscount > 0 && !isCombo {
+			account.ZHIMA.FirstMsg = fmt.Sprintf("首份报告仅%v元!", exampleType[0]["first"])
+		}
+	case packType < 0: //过期
+		account.ZHIMA.ExpiredMsg = fmt.Sprintf("权益卡已过期:%v天", math.Ceil(gconv.Float64(time.Now().Unix()-endTime)/(3600*24)))
+	case packType > 0: //有效期内&存在分数
+		var allNumber int
+		for _, m := range exampleType {
+			if gconv.Int64(m["pack_type"]) == packType {
+				allNumber = gconv.Int(m["number"])
+			}
+		}
+		account.ZHIMA.EffectiveMsg = fmt.Sprintf("本月余额%v份/%v份", number, allNumber)
+		account.ZHIMA.Total = allNumber
+	}
+	//芝麻分析报告权益
 	return account, nil
 }
 
@@ -384,6 +425,7 @@ func (appi *AccountPdfPackItem) merge(pAccount *AccountPdfPackItem) *AccountPdfP
 			MinEndTime: marketMinEndTime,
 			FirstUse:   qutil.If(marketMinEndTime == appi.MARKET.MinEndTime, appi.MARKET.FirstUse, pAccount.MARKET.FirstUse).(string),
 		},
+		ZHIMA: appi.ZHIMA,
 	}
 }
 

+ 1 - 0
src/jfw/modules/subscribepay/src/entity/reWardStruct.go

@@ -68,6 +68,7 @@ func (r *reWardStruct) PayCallBack(param *CallBackParam) bool {
 			"final_price":       param.TotalFee,
 			"product_code":      "ds001",
 			"is_service_open":   1,
+			"pay_status":        1,
 			"tactics":           1, //1购买 2赠送
 			"service_type":      1, //1:购买 2:续费 3:升级 4:试用
 			"is_master":         1,

+ 1 - 0
src/jfw/modules/subscribepay/src/entity/resourcePackStruct.go

@@ -66,6 +66,7 @@ func (this *resoucePackStruct) PayCallBack(param *CallBackParam) bool {
 			}
 			upDetail := map[string]interface{}{
 				"is_service_open":   1,
+				"pay_status":        1,
 				"open_service_time": now.Format(time.DateTime),
 				"service_starttime": now.Format(time.DateTime),
 			}

+ 1 - 0
src/jfw/modules/subscribepay/src/entity/subscribeVip.go

@@ -226,6 +226,7 @@ func (this *vipSubscribeStruct) PayCallBack(param *CallBackParam) bool {
 			"order_code": orderCode,
 		}, map[string]interface{}{
 			"is_service_open":   1,
+			"pay_status":        1,
 			"service_starttime": vipStarttime,
 			"service_endtime":   vipEndtime,
 			"open_service_time": now.Format(time.DateTime),

+ 161 - 10
src/jfw/modules/subscribepay/src/entity/zmAnalysisReport.go

@@ -4,10 +4,15 @@ import (
 	qutil "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/date"
 	"app.yhyue.com/moapp/jybase/encrypt"
+	"app.yhyue.com/moapp/jybase/mongodb"
 	"database/sql"
 	"encoding/json"
+	"errors"
+	"fmt"
 	"github.com/gogf/gf/v2/frame/g"
 	"github.com/gogf/gf/v2/os/gctx"
+	"github.com/gogf/gf/v2/util/gconv"
+	"jy/src/jfw/modules/subscribepay/src/config"
 	"jy/src/jfw/modules/subscribepay/src/consts"
 	"jy/src/jfw/modules/subscribepay/src/entity/bidCreditReport"
 	"jy/src/jfw/modules/subscribepay/src/util"
@@ -16,26 +21,49 @@ import (
 )
 
 var ZmAnalysisReportFirstDiscountConfigMap = map[int64]int{}
+var ZmAnalysisReportComboDiscountConfigMap = map[int64]int{}
 var ZmAnalysisReportWarnUrl = []string{}
 
 func init() {
 	g.Cfg("./zm_analysis_report.yaml").MustGet(gctx.New(), "FirstDiscount").Scan(&ZmAnalysisReportFirstDiscountConfigMap)
+	g.Cfg("./zm_analysis_report.yaml").MustGet(gctx.New(), "comboDiscount").Scan(&ZmAnalysisReportComboDiscountConfigMap)
 	g.Cfg("./zm_analysis_report.yaml").MustGet(gctx.New(), "WebhookURL").Scan(&ZmAnalysisReportWarnUrl)
 }
 
 // 获取首次优惠额度
-func GetZmAnalysisReportFirstDiscount(productCode int64, userId string) (bool, int) {
+func GetZmAnalysisReportFirstDiscount(productCode int64, userId string) (bool, int, bool) {
 	// 查配置
 	if discount, ok := ZmAnalysisReportFirstDiscountConfigMap[productCode]; !ok {
-		return false, 0
+		return false, 0, false
 	} else {
-		query := "SELECT count(*) FROM jianyu.dataexport_order WHERE user_id=? and product_type=? and order_status!=?"
-		if util.Mysql.CountBySql(query, userId, consts.ZmAnalysisReportProductName, consts.OrderStatusCancel) > 0 {
-			return false, 0
-		} else {
-			return true, discount
+		//是否在套餐有效期内
+		data := util.Compatible.Select(userId, `{"i_zhima_endtime":1,"i_zhima_starttime":1,"i_zhima_status":1,"i_zhima_number":1}`)
+		var i_zhima_status int64
+		if data != nil && len(*data) > 0 {
+			i_zhima_status = qutil.Int64All((*data)["i_zhima_status"])
+		}
+		if i_zhima_status == 0 { //没有开过套餐
+			query := "SELECT count(*) FROM jianyu.dataexport_order WHERE user_id=? and product_type=? and order_status!=?"
+			if util.Mysql.CountBySql(query, userId, consts.ZmAnalysisReportProductName, consts.OrderStatusCancel) > 0 {
+				return false, 0, false
+			} else {
+				return true, discount, false
+			}
+		}
+		if i_zhima_status > 0 { //购买过套餐 切在有效期内 每份按照优惠价
+			return true, discount, true
 		}
 	}
+	return false, 0, true
+}
+
+// 获取首次优惠额度
+func GetZmAnalysisReportComboDiscount(productCode int64) (bool, int) {
+	// 查配置
+	if discount, ok := ZmAnalysisReportComboDiscountConfigMap[productCode]; ok {
+		return true, discount
+	}
+	return false, 0
 }
 
 type zmAnalysisReportPay struct{}
@@ -57,6 +85,7 @@ func (b *zmAnalysisReportPay) PayCallBack(param *CallBackParam) bool {
 			log.Println("芝麻分析报告json.Unmarshal出错", err)
 			return false
 		}
+		packType := gconv.Int(filter["pack_type"])
 		order_code := qutil.ObjToString((*orderdata)["order_code"])
 		mail := qutil.ObjToString((*orderdata)["user_mail"])
 		flag := util.Mysql.ExecTx("芝麻信用工具分析报告-", func(tx *sql.Tx) bool {
@@ -76,6 +105,7 @@ func (b *zmAnalysisReportPay) PayCallBack(param *CallBackParam) bool {
 			}, map[string]interface{}{
 				"is_service_open":   1,
 				"open_service_time": now.Format(time.DateTime),
+				"pay_status":        1,
 			}) {
 				return false
 			}
@@ -86,7 +116,20 @@ func (b *zmAnalysisReportPay) PayCallBack(param *CallBackParam) bool {
 					biddingId = decodeBiddingId[0]
 				}
 			}
+			//判断用户是否已购买套餐
+			pack_type := packType
+			user := util.Compatible.Select(userId, `{"i_zhima_status":1}`)
+			if user != nil && len(*user) > 0 {
+				if gconv.Int((*user)["i_zhima_status"]) > 0 {
+					pack_type = -gconv.Int((*user)["i_zhima_status"])
+				}
+			}
 
+			err := BalanceDetails(userId, packType, 1, qutil.IntAll(filter["report_mold"]))
+			if err != nil {
+				log.Println("新增投标企业信用报告流水明细错误", order_code, err)
+				return false
+			}
 			rid = util.Mysql.InsertByTx(tx, "bid_credit_report", map[string]interface{}{
 				"user_id":      userId,
 				"order_code":   order_code,
@@ -100,20 +143,38 @@ func (b *zmAnalysisReportPay) PayCallBack(param *CallBackParam) bool {
 				"create_time":  nowFormat,
 				"status":       1,             //  1:已提交
 				"price":        param.CashFee, //支付价格
+				"pack_type":    pack_type,
 			})
 			if rid <= 0 {
 				return false
 			}
+			err = BalanceDetails(userId, gconv.Int(qutil.If(pack_type < 0, pack_type, packType)), 2, qutil.IntAll(filter["report_mold"]))
+			if err != nil {
+				log.Println("新增投标企业信用报告流水明细错误", order_code, err)
+				return false
+			}
 			return true
 		})
 		if flag {
-			err := bidCreditReport.BidCreditReport.Create(rid)
+			var (
+				err    error
+				zmType string
+			)
+			if packType > 0 { //套餐 购买套餐服务
+				zmType = "BidCreditReport.CreateCombo"
+				start, end := ZmUserStartEndTime(packType)
+				err = bidCreditReport.BidCreditReport.CreateCombo(userId, start.Format(time.DateOnly), end.Format(time.DateOnly), param.CashFee, packType)
+			}
+			if err == nil {
+				zmType = "BidCreditReport.Create"
+				err = bidCreditReport.BidCreditReport.Create(rid)
+			}
 			if err != nil {
-				log.Println("芝麻信用共建分析报告:bidCreditReport.BidCreditReport.Create err", err)
+				log.Printf("芝麻信用共建分析报告:bidCreditReport.%s err:%s\n", zmType, err.Error())
 				tmp := map[string]interface{}{
 					"order_code": order_code,
 					"err":        err.Error(),
-					"type":       "芝麻信用共建分析报告-BidCreditReport.Create",
+					"type":       fmt.Sprintf("芝麻信用共建分析报告-%s", zmType),
 				}
 				marshal, _ := json.Marshal(tmp)
 				SendMsgByWXURL(string(marshal), ZmAnalysisReportWarnUrl)
@@ -124,3 +185,93 @@ func (b *zmAnalysisReportPay) PayCallBack(param *CallBackParam) bool {
 	}
 	return true
 }
+
+func BalanceDetails(userId string, packType, operation, mold int) error {
+	tm := time.Now()
+	nowFormat := date.FormatDate(&tm, date.Date_Full_Layout)
+	if operation == 2 { //单份扣除
+		var residue_number int64
+		number, _, i_zhima_status := ZmAnalysis(userId)
+		if i_zhima_status > 0 && number > 0 {
+			residue_number = number - 1
+		}
+		//判断用户是否已购买套餐
+		util.Mysql.Insert("bid_credit_balance_details", map[string]interface{}{
+			"user_id":        userId,
+			"operation":      2,
+			"pack_type":      packType,
+			"number":         -1,
+			"residue_number": residue_number,
+			"create_time":    nowFormat,
+			"mold":           mold,
+		})
+		return nil
+	}
+
+	var (
+		num     int
+	)
+	switch packType {
+	case 0: //单份购买
+		num = 1
+	default:
+		exampleType := g.Cfg("./zm_analysis_report.yaml").MustGet(gctx.New(), "exampleType").Maps()
+		for _, m := range exampleType {
+			if gconv.Int(m["pack_type"]) == packType {
+				num = gconv.Int(m["number"])
+			}
+		}
+		if num == 0 {
+			return errors.New("套餐配置错误")
+		}
+		start, end := ZmUserStartEndTime(packType)
+		set := map[string]interface{}{
+			"$set": map[string]interface{}{
+				"i_zhima_status":    packType,
+				"i_zhima_starttime": start.Unix(),
+				"i_zhima_endtime":   end.Unix(),
+				"i_zhima_number":    num,
+			},
+		}
+		//新增用户权益
+		user_id := userId
+		if !mongodb.IsObjectIdHex(userId) {
+			identity := config.Middleground.UserCenter.IdentityByPositionId(gconv.Int64(userId))
+			if identity.EntUserId <= 0 {
+				return fmt.Errorf("企业大会员开通服务出错:entUserId参数异常")
+			}
+			user_id = gconv.String(identity.EntUserId)
+		}
+		if !util.Compatible.UpdateByEntUserId(user_id, set) {
+			return errors.New("开通权益--芝麻订单user表芝麻状态更新失败")
+		}
+	}
+	data := map[string]interface{}{
+		"user_id":        userId,
+		"operation":      operation,
+		"pack_type":      packType,
+		"number":         num,
+		"residue_number": num,
+		"create_time":    nowFormat,
+	}
+	util.Mysql.Insert("bid_credit_balance_details", data)
+	return nil
+}
+
+func ZmUserStartEndTime(packType int) (start, end time.Time) {
+	now := time.Now()
+	// 获取本月1号 00:00:00
+	start = now
+	switch packType {
+	case 1:
+		year, mon, day := now.AddDate(0, 1, 0).Date()
+		end = time.Date(year, mon, day, 23, 59, 59, 0, time.Local)
+	case 2:
+		year, mon, day := now.AddDate(0, 3, 0).Date()
+		end = time.Date(year, mon, day, 23, 59, 59, 0, time.Local)
+	case 3:
+		year, mon, day := now.AddDate(0, 12, 0).Date()
+		end = time.Date(year, mon, day, 23, 59, 59, 0, time.Local)
+	}
+	return
+}

+ 9 - 0
src/jfw/modules/subscribepay/src/pay/aliCpa.go

@@ -2,6 +2,7 @@ package pay
 
 import (
 	qutil "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jypkg/ent/util"
 	"context"
 	"encoding/json"
 	"fmt"
@@ -151,5 +152,13 @@ func (a *aliPayStruct) CpaCallback(ctx context.Context, bizNo, epCertNo, failRea
 	if resStruct.ZhimaCreditEpSyncResponse.SubMsg != "" {
 		return fmt.Errorf("aliPayStruct CpaCallback %v", resStruct.ZhimaCreditEpSyncResponse.SubMsg)
 	}
+	go func() { //记录芝麻回调参数
+		util.Mgo_Log.SaveBulk("jy_zhima_logs", map[string]interface{}{
+			"bizNo":       bizNo,
+			"epCertNo":    epCertNo,
+			"failReason":  failReason,
+			"returnParam": resStruct,
+		})
+	}()
 	return nil
 }

+ 2 - 2
src/jfw/modules/subscribepay/src/pay_config.json

@@ -24,7 +24,7 @@
       "filePack_msg": "剑鱼标讯-附件下载包",
       "buyerPortraitPack_msg": "剑鱼标讯-采购单位画像包",
       "docMember_msg": "剑鱼标讯-剑鱼文库会员",
-      "zmAnalysisReport_msg": "剑鱼标讯-芝麻信用共建分析报告"
+      "zmAnalysisReport_msg": "剑鱼标讯-招投标综合分析"
     },
     "openidSwitch": {
       "oIMvJvrVXG89597EFmYiSiznbyyY": "oHwE_wEQlEBvjZJOyZeNnQcgKQMo",
@@ -60,7 +60,7 @@
     "Subject_buyerPortraitPack": "剑鱼标讯-采购单位画像包",
     "Subject_docMember": "剑鱼标讯-剑鱼文库会员",
     "Subject_bidReport": "剑鱼标讯-投标企业信用报告",
-    "Subject_zmAnalysisReport": "剑鱼标讯-芝麻信用共建分析报告"
+    "Subject_zmAnalysisReport": "剑鱼标讯-招投标综合分析"
   },
   "payDebug": "1"
 }

+ 280 - 2
src/jfw/modules/subscribepay/src/service/bidCreditReport.go

@@ -3,9 +3,11 @@ package service
 import (
 	"app.yhyue.com/moapp/jybase/api"
 	"app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/date"
 	"app.yhyue.com/moapp/jybase/encrypt"
 	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
 	"context"
+	"database/sql"
 	"encoding/json"
 	"fmt"
 	"github.com/gogf/gf/v2/frame/g"
@@ -15,6 +17,7 @@ import (
 	"jy/src/jfw/modules/subscribepay/src/entity"
 	"jy/src/jfw/modules/subscribepay/src/entity/bidCreditReport"
 	"jy/src/jfw/modules/subscribepay/src/util"
+	"log"
 	"strings"
 	"time"
 )
@@ -28,6 +31,8 @@ type BidCreditReport struct {
 	getButton    xweb.Mapper `xweb:"/bidCreditReport/getButton"`      // 报告按钮是否展示
 	reportTest   xweb.Mapper `xweb:"/bidCreditReport/report/test"`    //调试
 	example      xweb.Mapper `xweb:"/bidCreditReport/report/example"` //信用报告示例
+
+	zmComboConsumption xweb.Mapper `xweb:"/zmComboConsumption"` //芝麻消费
 }
 
 func (this *BidCreditReport) Example() {
@@ -214,7 +219,7 @@ func (this *BidCreditReport) GetButton() {
 			"project_report_button": false,
 			"ent_crn":               map[string]interface{}{},
 			"discount_msg":          "",
-			"buyer_report_id`":      "",
+			"buyer_report_id":       "",
 			"ent_report_ids":        map[string]interface{}{},
 			"project_report_id":     "",
 		}
@@ -227,9 +232,28 @@ func (this *BidCreditReport) GetButton() {
 		if userId == "" {
 			return rs, nil
 		}
-		if b, firstDiscount := entity.GetZmAnalysisReportFirstDiscount(consts.ZmAnalysisReportSinglePackageID, userId); b && firstDiscount > 0 {
+
+		if b, firstDiscount, isCombo := entity.GetZmAnalysisReportFirstDiscount(consts.ZmAnalysisReportSinglePackageID, userId); b && firstDiscount > 0 && !isCombo {
 			rs["discount_msg"] = fmt.Sprintf(consts.ZmAnalysisReportFirstBuyDiscountMsg, firstDiscount/100)
 		}
+
+		//number, endTime, status := entity.ZmAnalysis(userId)
+		/*switch {
+		  case status == 0: //没有开过套餐
+
+		  case status < 0: //过期
+		      rs["discount_msg"] = fmt.Sprintf(consts.ZmAnalysisReportExpiredBuyDiscountMsg, (time.Now().Unix()-endTime)/3600*24)
+		  case status > 0 && number > 0: //有效期内&存在分数
+		      rs["discount_msg"] = fmt.Sprintf(consts.ZmAnalysisReportRemainingBuyDiscountMsg, number)
+		  case status > 0 && number <= 0: //有效期内&无分数
+		      exampleType := g.Cfg("./zm_analysis_report.yaml").MustGet(gctx.New(), "exampleType").Maps()
+		      for _, m := range exampleType {
+		          if gconv.Int64(m["pack_type"]) == status {
+		              rs["discount_msg"] = fmt.Sprintf(consts.ZmAnalysisReportNoLimitBuyDiscountMsg, m["first"])
+		          }
+		      }
+		  }*/
+
 		if buyer != "" {
 			entInfo := bidCreditReport.BidCreditReport.GetCRNByName(userId, buyer)
 			if entInfo.Crn != "" {
@@ -297,7 +321,261 @@ func (this *BidCreditReport) GetButton() {
 				"createtime": time.Now().Unix(),
 			})
 		}
+
+		//芝麻权益
+		rs["zmAnalysis"] = ZmAnalysis(userId)
+		rs["isNew"] = g.Cfg("zm_analysis_report.yaml").MustGet(gctx.New(), "isNew", true).Bool()
+		rs["guidingCopy"] = g.Cfg("zm_analysis_report.yaml").MustGet(gctx.New(), "guidingCopy", true).Map()
 		return rs, nil
 	}()
 	this.ServeJson(api.NewResult(data, err))
 }
+
+type ZmAnalysisReport struct {
+	ZmStatus    int64 `json:"zmStatus,omitempty"`
+	ZmNumber    int64 `json:"zmNumber,omitempty"`
+	ZmAllNumber int64 `json:"zmAllNumber,omitempty"`
+	ComboOne    int64 `json:"comboOne,omitempty"`
+	StartTime   int64 `json:"startTime,omitempty"`  //开始时间戳
+	EndTime     int64 `json:"endTime,omitempty"`    //结束时间戳
+	ExpiredDay  int   `json:"expiredDay,omitempty"` //过期多少天
+}
+
+func ZmAnalysis(userId string) *ZmAnalysisReport {
+	var (
+		zmAnalysis = &ZmAnalysisReport{}
+	)
+	data := util.Compatible.Select(userId, `{"i_zhima_endtime":1,"i_zhima_starttime":1,"i_zhima_status":1,"i_zhima_number":1}`)
+	if data != nil && len(*data) > 0 {
+		i_zhima_endtime := common.Int64All((*data)["i_zhima_endtime"])
+		i_zhima_starttime := common.Int64All((*data)["i_zhima_starttime"])
+		i_zhima_status := common.Int64All((*data)["i_zhima_status"])
+		i_zhima_number := common.Int64All((*data)["i_zhima_number"])
+		zhimaEndtime := time.Unix(i_zhima_endtime, 0)
+		zhimaStarttime := time.Unix(i_zhima_starttime, 0)
+		if i_zhima_status > 0 {
+			for zhimaEndtime.After(zhimaStarttime) {
+				newZmTime := zhimaStarttime.AddDate(0, 1, 0)
+				if newZmTime.Unix() >= time.Now().Unix() {
+					var number int64
+					//计算周期内数量
+					balanceDetails := util.Mysql.CountBySql("SELECT count(1)  FROM bid_credit_report where create_time>=? and user_id =? and pack_type>0 and mold>0", date.FormatDate(&zhimaStarttime, date.Date_Full_Layout), userId)
+					number = i_zhima_number - balanceDetails
+					zmAnalysis.ZmNumber = common.Int64All(common.If(number < 0, 0, number))
+					zmAnalysis.ZmAllNumber = i_zhima_number
+					zmAnalysis.ZmStatus = i_zhima_status
+					zmAnalysis.StartTime = i_zhima_starttime
+					zmAnalysis.EndTime = i_zhima_endtime
+					exampleType := g.Cfg("./zm_analysis_report.yaml").MustGet(gctx.New(), "exampleType").Maps()
+					for _, m := range exampleType {
+						if gconv.Int64(m["pack_type"]) == i_zhima_status {
+							zmAnalysis.ComboOne = gconv.Int64(m["first"])
+						}
+					}
+					break
+				}
+				zhimaStarttime = newZmTime
+			}
+		} else {
+			zmAnalysis.ExpiredDay = gconv.Int(time.Now().Sub(zhimaEndtime).Hours() / 24)
+		}
+	}
+	return zmAnalysis
+}
+
+func (t *BidCreditReport) ZmComboConsumption() error {
+	userId := common.InterfaceToStr(t.GetSession("userId"))
+	queryMap := map[string]interface{}{
+		"user_id": userId,
+	}
+	//mail := common.InterfaceToStr(t.GetSession("EmailBindingVerifyEmail"))
+	entName := t.GetString("ent_name")
+	if entName != "" {
+		queryMap["ent_name"] = entName
+	}
+	certNo := t.GetString("cert_no")
+	if certNo != "" {
+		queryMap["cert_no"] = certNo
+	}
+	buyer := t.GetString("buyer")
+	if buyer != "" {
+		queryMap["buyer"] = buyer
+	}
+	reportMold := gconv.Int64(t.GetString("report_mold"))
+	queryMap["mold"] = reportMold
+	projectName := t.GetString("project_name")
+	if projectName != "" {
+		queryMap["project_name"] = projectName
+	}
+	var biddingId string
+	if tmp := t.GetString("bidding_id"); tmp != "" {
+		decodeBiddingId := encrypt.DecodeArticleId2ByCheck(tmp)
+		if len(decodeBiddingId) > 0 {
+			biddingId = decodeBiddingId[0]
+			queryMap["bidding_id"] = biddingId
+			//_, biddingTitle = bidCreditReport.BidCreditReport.GetBiddingInfo(biddingId)
+		}
+	}
+
+	switch reportMold {
+	case consts.ZmReportMoldProject:
+		if biddingId == "" || buyer == "" {
+			t.ServeJson(map[string]interface{}{
+				"error_code": -1,
+				"error_msg":  "数据校验不通过",
+			})
+			return nil
+		}
+		projectName = entity.GetProjectNameByInfoId(biddingId)
+		if projectName == "" {
+			log.Println("未获取到项目信息", biddingId)
+			t.ServeJson(map[string]interface{}{
+				"error_code": -1,
+				"error_msg":  "未查询到项目信息",
+			})
+			return nil
+		}
+		//查采购单位
+		entInfo := bidCreditReport.BidCreditReport.GetCRNByName(userId, buyer)
+		if entInfo.Crn == "" {
+			log.Println("未获取到crn", buyer)
+			t.ServeJson(map[string]interface{}{
+				"error_code": -1,
+				"error_msg":  "未获取到crn",
+			})
+			return nil
+		}
+		certNo = entInfo.Crn
+
+	case consts.ZmReportMoldEnt:
+		if entName == "" {
+			t.ServeJson(map[string]interface{}{
+				"error_code": -1,
+				"error_msg":  "数据校验不通过",
+			})
+			return nil
+		}
+		buyer = ""
+		//  根据企业名称查 cert_no
+		entInfo := bidCreditReport.BidCreditReport.GetCRNByName(userId, entName)
+		if entInfo.Crn == "" {
+			log.Println("未获取到crn", entName)
+			t.ServeJson(map[string]interface{}{
+				"error_code": -1,
+				"error_msg":  "未获取到crn",
+			})
+			return nil
+		}
+		certNo = entInfo.Crn
+	case consts.ZmReportMoldBuyer:
+		if buyer == "" {
+			t.ServeJson(map[string]interface{}{
+				"error_code": -1,
+				"error_msg":  "数据校验不通过",
+			})
+			return nil
+		}
+		entName = ""
+		entInfo := bidCreditReport.BidCreditReport.GetCRNByName(userId, buyer)
+		if entInfo.Crn == "" {
+			log.Println("未获取到crn", buyer)
+			t.ServeJson(map[string]interface{}{
+				"error_code": -1,
+				"error_msg":  "企业信息有误,未获取到crn",
+			})
+			return nil
+		}
+		certNo = entInfo.Crn
+	default:
+		t.ServeJson(map[string]interface{}{
+			"error_code": -1,
+			"error_msg":  "参数有误",
+		})
+		return nil
+
+	}
+
+	creditReport := util.Mysql.FindOne("bid_credit_report", queryMap, "", "")
+	if creditReport != nil && len(*creditReport) > 0 {
+		t.ServeJson(api.NewResult(encrypt.EncodeArticleId(gconv.String((*creditReport)["id"])), nil))
+		return nil
+	}
+	//判断用户权益
+	number, endTime, packType := entity.ZmAnalysis(userId)
+	if number <= 0 || endTime <= time.Now().Unix() || packType == 0 {
+		t.ServeJson(map[string]interface{}{
+			"error_code": -1,
+			"error_msg":  "套餐权益扣除失败",
+		})
+		return nil
+	}
+
+	var (
+		rid  int64
+		mail string
+	)
+	order := util.Mysql.FindOne("dataexport_order", map[string]interface{}{"user_id": userId, "product_type": consts.ZmAnalysisReportProductName}, "user_mail", "  create_time desc")
+	if order != nil && len(*order) > 0 {
+		mail = gconv.String((*order)["user_mail"])
+	}
+	if !util.Mysql.ExecTx("扣除芝麻服务", func(tx *sql.Tx) bool {
+		rid = util.Mysql.InsertByTx(tx, "bid_credit_report", map[string]interface{}{
+			"user_id":      userId,
+			"ent_name":     entName,
+			"cert_no":      certNo,
+			"buyer":        buyer,
+			"mold":         reportMold,
+			"bidding_id":   biddingId,
+			"mail":         mail,
+			"project_name": projectName,
+			"create_time":  time.Now().Format(timeLayout),
+			"pack_type":    packType,
+			"status":       1, //  1:已提交
+		})
+		if rid <= 0 {
+			log.Println("bid_credit_report Insert err")
+			return false
+		}
+		//扣次数套餐
+		id := util.Mysql.InsertByTx(tx, "bid_credit_balance_details", map[string]interface{}{
+			"user_id":        userId,
+			"operation":      2,
+			"pack_type":      packType,
+			"number":         -1,
+			"residue_number": number - 1,
+			"create_time":    time.Now().Format(timeLayout),
+			"mold":           reportMold,
+		})
+		if id <= 0 {
+			log.Println("bid_credit_balance_details Insert err")
+			return false
+		}
+		return true
+	}) {
+		t.ServeJson(map[string]interface{}{
+			"error_code": -1,
+			"error_msg":  "权益生效失败",
+		})
+		return nil
+	}
+
+	//TODO 请求芝麻 扣除套餐次数
+	err := bidCreditReport.BidCreditReport.Create(rid)
+	if err != nil {
+		log.Printf("芝麻信用共建分析报告套餐分数:BidCreditReport.Create err:%s \n", err.Error())
+		tmp := map[string]interface{}{
+			"userId": userId,
+			"err":    err.Error(),
+			"type":   fmt.Sprintf("芝麻信用共建分析套餐报告-%s", "bidCreditReport.Create"),
+		}
+		marshal, _ := json.Marshal(tmp)
+		entity.SendMsgByWXURL(string(marshal), entity.ZmAnalysisReportWarnUrl)
+		t.ServeJson(map[string]interface{}{
+			"error_code": -1,
+			"error_msg":  "套餐权益扣除失败",
+		})
+		return nil
+	}
+	t.ServeJson(api.NewResult(encrypt.EncodeArticleId(gconv.String(rid)), nil))
+	return nil
+}

+ 2 - 2
src/jfw/modules/subscribepay/src/service/pdfExportPack.go

@@ -49,7 +49,7 @@ func (this *PdfExportPackService) RecordList() {
 			return nil, err
 		}
 		var (
-			accountId, queryUserId string
+			accountId string
 		)
 		vip := jy.GetBigVipUserBaseMsg(this.Session(), *config.Middleground)
 		if vip.Pid != "" {
@@ -58,7 +58,7 @@ func (this *PdfExportPackService) RecordList() {
 		} else {
 			accountId = fmt.Sprintf("%s,%s", fmt.Sprintf("%s%s", entity.ParentResourceIdPrefix, userId), userId)
 		}
-		returnList, total := entity.InitFindRecord(queryUserId, accountId, productName, "", "", pageSize, pageNum, -1).DefaultData()
+		returnList, total := entity.InitFindRecord(userId, accountId, productName, "", "", pageSize, pageNum, -1).DefaultData()
 
 		for i := 0; i < len(returnList); i++ {
 			createTime, createtimeParseErr := time.Parse(time.RFC3339, qutil.ObjToString(returnList[i]["createTime"]))

+ 2 - 1
src/jfw/modules/subscribepay/src/timetask.json

@@ -24,5 +24,6 @@
     {"day": 7,"cycle": 90},
     {"day": 30,"cycle": 360},
     {"day": 0,"cycle": 7}
-  ]
+  ],
+  "ZmUserEquityRecovery": "00:00"
 }

+ 1205 - 1120
src/jfw/modules/subscribepay/src/timetask/timetask.go

@@ -1,1204 +1,1289 @@
 package timetask
 
 import (
-    "encoding/hex"
-    "fmt"
-    "github.com/gogf/gf/v2/util/gconv"
-    "jy/src/jfw/modules/subscribepay/src/config"
-    . "jy/src/jfw/modules/subscribepay/src/config"
-    "jy/src/jfw/modules/subscribepay/src/entity/bidCreditReport"
-    "jy/src/jfw/modules/subscribepay/src/pay"
-    "jy/src/jfw/modules/subscribepay/src/util"
-    "log"
-    "strconv"
-    "strings"
-    "time"
+	"encoding/hex"
+	"fmt"
+	"github.com/gogf/gf/v2/util/gconv"
+	"jy/src/jfw/modules/subscribepay/src/config"
+	. "jy/src/jfw/modules/subscribepay/src/config"
+	"jy/src/jfw/modules/subscribepay/src/entity/bidCreditReport"
+	"jy/src/jfw/modules/subscribepay/src/pay"
+	"jy/src/jfw/modules/subscribepay/src/util"
+	"log"
+	"strconv"
+	"strings"
+	"time"
 
-    "bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
 
-    qutil "app.yhyue.com/moapp/jybase/common"
-    . "app.yhyue.com/moapp/jybase/date"
-    . "app.yhyue.com/moapp/jybase/mongodb"
-    "app.yhyue.com/moapp/jybase/redis"
-    qrpc "app.yhyue.com/moapp/jybase/rpc"
-    "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
+	qutil "app.yhyue.com/moapp/jybase/common"
+	. "app.yhyue.com/moapp/jybase/date"
+	. "app.yhyue.com/moapp/jybase/mongodb"
+	"app.yhyue.com/moapp/jybase/redis"
+	qrpc "app.yhyue.com/moapp/jybase/rpc"
+	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
 )
 
 const (
-    oneDayLong = 86400
-    threeday   = 3 * oneDayLong
-    thirtDays  = 30 * oneDayLong
+	oneDayLong = 86400
+	threeday   = 3 * oneDayLong
+	thirtDays  = 30 * oneDayLong
 
-    CollEntUser = "ent_user" // 企业版用户表
+	CollEntUser = "ent_user" // 企业版用户表
 )
 
 func Run() {
-    if TimeTaskConfig.IsRun {
-        for _, v := range []Identity{&Personal{}, &Ent{}} {
-            go checkIsExpire(v)
-            go checkMemberIsExpire(v)
-            go updateProvincePackageStatus(v) //省份流量包
-            go checkDocMemberIsExpire(v)      // 剑鱼文库会员检查过期状态
-        }
-        go bigMemberExpireRemind()
-        go syncVipUpgrade()
-        go updateDataExportStatus()
-        go SendDataExportMailForPayed()
-        go courseTask()
-        go expireRemind()
-        go checkMemberIsStart()
-        go checkEntIsStart() // 企业版大会员或超级订阅定时开通
-        go checkMemberServiceIsExpire()
-        go updateTimeLimitActitityOrderStatus() //修改限时活动的订单状态
-        go bidCreditReport.BidCreditReport.NewOrderWarn()
-    }
+	if TimeTaskConfig.IsRun {
+		for _, v := range []Identity{&Personal{}, &Ent{}} {
+			go checkIsExpire(v)
+			go checkMemberIsExpire(v)
+			go updateProvincePackageStatus(v) //省份流量包
+			go checkDocMemberIsExpire(v)      // 剑鱼文库会员检查过期状态
+		}
+		for _, s := range []string{"user", "ent_user"} {
+			go ZmUserEquityRecovery(s)
+		}
+		go bigMemberExpireRemind()
+		go syncVipUpgrade()
+		go updateDataExportStatus()
+		go SendDataExportMailForPayed()
+		go courseTask()
+		go expireRemind()
+		go checkMemberIsStart()
+		go checkEntIsStart() // 企业版大会员或超级订阅定时开通
+		go checkMemberServiceIsExpire()
+		go updateTimeLimitActitityOrderStatus() //修改限时活动的订单状态
+		go bidCreditReport.BidCreditReport.NewOrderWarn()
+	}
 }
 
 // 省份流量包到期时间 定时任务
 func updateProvincePackageStatus(i Identity) {
-    crontab(true, TimeTaskConfig.ProvinceExpire, func() {
-        defer qutil.Catch()
-        log.Println("定时任务,开始更新省份订阅包状态开始")
-        now_unix := time.Now().Unix()
-        sess := util.MQFW.GetMgoConn()
-        for {
-            if sess != nil {
-                defer util.MQFW.DestoryMongoConn(sess)
-                break
-            }
-            time.Sleep(time.Minute)
-            sess = util.MQFW.GetMgoConn()
-        }
-        query := i.SubsetQuery(2)
-        query["o_jy.i_ppstatus"] = map[string]interface{}{
-            "$gt": -1,
-        }
-        query["o_jy.l_areaEnd_p"] = map[string]interface{}{
-            "$lte": now_unix,
-        }
-        it := sess.DB("qfw").C(i.SubsetColl()).Find(query).Select(map[string]interface{}{"o_jy.i_ppstatus": 1, "o_jy.l_areaEnd_p": 1}).Iter()
-        for m := make(map[string]interface{}); it.Next(&m); {
-            _id := BsonIdToSId(m["_id"])
-            if util.MQFW.UpdateById(i.SubsetColl(), _id, map[string]interface{}{
-                "$set": map[string]interface{}{
-                    "o_jy.i_ppstatus":    -1,
-                    "o_jy.i_areapackTip": 1,
-                },
-            }) {
-                positionId := util.MongoIdToPositionId(_id)
-                ok := jy.ClearBigVipUserPower(positionId)
-                config.Middleground.UserCenter.WorkDesktopClearUserInfo(pb.WorkDesktopClearUserInfoReq{
-                    PositionId: positionId,
-                    AppId:      "10000",
-                })
-                config.Middleground.PowerCheckCenter.DelCheckRedis("10000", qutil.Int64All(positionId))
-                if !ok {
-                    log.Println("清除 redis省份订阅包服务详情 缓存失败:", _id)
-                }
-            } else {
-                log.Println("更新user表 省份订阅包状态失败:", _id)
-            }
-            m = make(map[string]interface{})
-        }
-        log.Println("定时任务,更新省份订阅包状态结束")
-    })
+	crontab(true, TimeTaskConfig.ProvinceExpire, func() {
+		defer qutil.Catch()
+		log.Println("定时任务,开始更新省份订阅包状态开始")
+		now_unix := time.Now().Unix()
+		sess := util.MQFW.GetMgoConn()
+		for {
+			if sess != nil {
+				defer util.MQFW.DestoryMongoConn(sess)
+				break
+			}
+			time.Sleep(time.Minute)
+			sess = util.MQFW.GetMgoConn()
+		}
+		query := i.SubsetQuery(2)
+		query["o_jy.i_ppstatus"] = map[string]interface{}{
+			"$gt": -1,
+		}
+		query["o_jy.l_areaEnd_p"] = map[string]interface{}{
+			"$lte": now_unix,
+		}
+		it := sess.DB("qfw").C(i.SubsetColl()).Find(query).Select(map[string]interface{}{"o_jy.i_ppstatus": 1, "o_jy.l_areaEnd_p": 1}).Iter()
+		for m := make(map[string]interface{}); it.Next(&m); {
+			_id := BsonIdToSId(m["_id"])
+			if util.MQFW.UpdateById(i.SubsetColl(), _id, map[string]interface{}{
+				"$set": map[string]interface{}{
+					"o_jy.i_ppstatus":    -1,
+					"o_jy.i_areapackTip": 1,
+				},
+			}) {
+				positionId := util.MongoIdToPositionId(_id)
+				ok := jy.ClearBigVipUserPower(positionId)
+				config.Middleground.UserCenter.WorkDesktopClearUserInfo(pb.WorkDesktopClearUserInfoReq{
+					PositionId: positionId,
+					AppId:      "10000",
+				})
+				config.Middleground.PowerCheckCenter.DelCheckRedis("10000", qutil.Int64All(positionId))
+				if !ok {
+					log.Println("清除 redis省份订阅包服务详情 缓存失败:", _id)
+				}
+			} else {
+				log.Println("更新user表 省份订阅包状态失败:", _id)
+			}
+			m = make(map[string]interface{})
+		}
+		log.Println("定时任务,更新省份订阅包状态结束")
+	})
 }
 
 // 定时更新超过72小时订单
 func updateDataExportStatus() {
-    crontabByTicker(true, TimeTaskConfig.UpdateDEStatus, func() {
-        log.Println("定时任务,开始更新超时订单状态")
-        create_time := time.Now()
-        create_time_stamp := create_time.Unix()
-        start_time_stamp := create_time.Unix()
-        order_countdown := Config.OrderCountdown //配置文件读取
-        if strings.Contains(qutil.ObjToString(order_countdown), "h") {
-            onehour, _ := time.ParseDuration(qutil.ObjToString(order_countdown))
-            create_time_stamp = create_time.Add(-onehour).Unix()
-            start_time_stamp = create_time.Add(-onehour).AddDate(0, 0, -1).Unix()
-        } else {
-            i_countdown := qutil.IntAll(order_countdown)
-            create_time_stamp = create_time.AddDate(0, 0, -i_countdown).Unix()
-            start_time_stamp = create_time.AddDate(0, 0, -i_countdown).AddDate(0, 0, -1).Unix()
-        }
-        over_time := FormatDateByInt64(&create_time_stamp, Date_Full_Layout)
-        start_time := FormatDateByInt64(&start_time_stamp, Date_Full_Layout)
-        log.Println("over_time:", over_time, "start_time:", start_time)
-        //查询未支付超时订单(仅用户自主下单、销售代用户下单的订单)
-        wooList := util.Mysql.SelectBySql(`SELECT * FROM dataexport_order  WHERE order_status = 0 AND  create_time < ? AND create_time > ? AND (is_backstage_order = 0 or (is_backstage_order=1 AND order_channel ='xdqd04'))`, over_time, start_time)
-        if wooList != nil && len(*wooList) != 0 {
-            for _, v := range *wooList {
-                if v["order_code"] != nil {
-                    //订单编号
-                    order_code, _ := v["order_code"].(string)
-                    productType := 0 //取消卡券的时候 需要这个参数  商品类型0普通的1线上课程
-                    if product_type, _ := v["product_type"].(string); product_type != "中标必听课" {
-                        productType = 1
-                    }
-                    flag := false
-                    //仅用户自主下单、销售代用户下单的订单 可以取消
-                    cancelOrder := qutil.IntAll(v["is_backstage_order"]) == 0 || (qutil.IntAll(v["is_backstage_order"]) == 1 && qutil.ObjToString(v["order_channel"]) == "xdqd04")
-                    if qutil.IntAll(v["order_status"]) == 0 && cancelOrder && qutil.ObjToString(v["pay_way"]) != "transferAccounts" { //未支付状态下 删除订单需要先关闭订单
-                        flag = pay.CloseDataExportOrder(qutil.ObjToString(v["pay_way"]), qutil.ObjToString(v["out_trade_no"]), qutil.ObjToString(v["prepay_time"]))
-                    }
-                    if flag || (!(qutil.IntAll(v["course_status"]) == 2 || qutil.IntAll(v["course_status"]) == 4)) && qutil.ObjToString(v["pay_way"]) == "transferAccounts" && cancelOrder { //对公转账非审核中 和 转账成功 状态下超时取消订单
-                        queryMap := map[string]interface{}{
-                            "order_code": order_code,
-                        }
-                        flag = util.Mysql.Update("dataexport_order", queryMap, map[string]interface{}{"order_status": -2})
-                    }
-                    // discountId := ""
-                    // var filter map[string]interface{}
-                    // //关闭未支付订单
-                    // if err := json.Unmarshal([]byte(qutil.ObjToString(v["filter"])), &filter); err != nil {
-                    // 	log.Println("filter.json.Unmarshal出错", err)
-                    // } else {
-                    // 	if filter["discountId"] != nil {
-                    // 		discountId = strconv.Itoa(qutil.IntAll(filter["discountId"]))
-                    // 	}
-                    // }
-                    if !flag {
-                        log.Println("mysql 订单更新失败", order_code)
-                    } else {
-                        //解除卡卷绑定
-                        //用户领取卡卷的记录id
-                        userLotteryId, _ := v["d_relation_id"].(string)
-                        if userLotteryId != "" {
-                            //用户id
-                            userId, _ := v["user_id"].(string)
-                            go func(userId, userLotteryId, order_code string) {
-                                if !util.UpdateCouponState(userId, userLotteryId, "", "", order_code, qutil.ObjToString(v["product_type"]), "0", 0, productType) {
-                                    log.Println(fmt.Sprintf("单号%s-解绑失败-卡卷%s", order_code, userLotteryId))
-                                }
-                            }(userId, userLotteryId, order_code)
-                        }
-                    }
-                }
-            }
-        }
-        log.Println("定时任务,更新超时订单状态结束")
-    })
+	crontabByTicker(true, TimeTaskConfig.UpdateDEStatus, func() {
+		log.Println("定时任务,开始更新超时订单状态")
+		create_time := time.Now()
+		create_time_stamp := create_time.Unix()
+		start_time_stamp := create_time.Unix()
+		order_countdown := Config.OrderCountdown //配置文件读取
+		if strings.Contains(qutil.ObjToString(order_countdown), "h") {
+			onehour, _ := time.ParseDuration(qutil.ObjToString(order_countdown))
+			create_time_stamp = create_time.Add(-onehour).Unix()
+			start_time_stamp = create_time.Add(-onehour).AddDate(0, 0, -1).Unix()
+		} else {
+			i_countdown := qutil.IntAll(order_countdown)
+			create_time_stamp = create_time.AddDate(0, 0, -i_countdown).Unix()
+			start_time_stamp = create_time.AddDate(0, 0, -i_countdown).AddDate(0, 0, -1).Unix()
+		}
+		over_time := FormatDateByInt64(&create_time_stamp, Date_Full_Layout)
+		start_time := FormatDateByInt64(&start_time_stamp, Date_Full_Layout)
+		log.Println("over_time:", over_time, "start_time:", start_time)
+		//查询未支付超时订单(仅用户自主下单、销售代用户下单的订单)
+		wooList := util.Mysql.SelectBySql(`SELECT * FROM dataexport_order  WHERE order_status = 0 AND  create_time < ? AND create_time > ? AND (is_backstage_order = 0 or (is_backstage_order=1 AND order_channel ='xdqd04'))`, over_time, start_time)
+		if wooList != nil && len(*wooList) != 0 {
+			for _, v := range *wooList {
+				if v["order_code"] != nil {
+					//订单编号
+					order_code, _ := v["order_code"].(string)
+					productType := 0 //取消卡券的时候 需要这个参数  商品类型0普通的1线上课程
+					if product_type, _ := v["product_type"].(string); product_type != "中标必听课" {
+						productType = 1
+					}
+					flag := false
+					//仅用户自主下单、销售代用户下单的订单 可以取消
+					cancelOrder := qutil.IntAll(v["is_backstage_order"]) == 0 || (qutil.IntAll(v["is_backstage_order"]) == 1 && qutil.ObjToString(v["order_channel"]) == "xdqd04")
+					if qutil.IntAll(v["order_status"]) == 0 && cancelOrder && qutil.ObjToString(v["pay_way"]) != "transferAccounts" { //未支付状态下 删除订单需要先关闭订单
+						flag = pay.CloseDataExportOrder(qutil.ObjToString(v["pay_way"]), qutil.ObjToString(v["out_trade_no"]), qutil.ObjToString(v["prepay_time"]))
+					}
+					if flag || (!(qutil.IntAll(v["course_status"]) == 2 || qutil.IntAll(v["course_status"]) == 4)) && qutil.ObjToString(v["pay_way"]) == "transferAccounts" && cancelOrder { //对公转账非审核中 和 转账成功 状态下超时取消订单
+						queryMap := map[string]interface{}{
+							"order_code": order_code,
+						}
+						flag = util.Mysql.Update("dataexport_order", queryMap, map[string]interface{}{"order_status": -2})
+					}
+					// discountId := ""
+					// var filter map[string]interface{}
+					// //关闭未支付订单
+					// if err := json.Unmarshal([]byte(qutil.ObjToString(v["filter"])), &filter); err != nil {
+					// 	log.Println("filter.json.Unmarshal出错", err)
+					// } else {
+					// 	if filter["discountId"] != nil {
+					// 		discountId = strconv.Itoa(qutil.IntAll(filter["discountId"]))
+					// 	}
+					// }
+					if !flag {
+						log.Println("mysql 订单更新失败", order_code)
+					} else {
+						//解除卡卷绑定
+						//用户领取卡卷的记录id
+						userLotteryId, _ := v["d_relation_id"].(string)
+						if userLotteryId != "" {
+							//用户id
+							userId, _ := v["user_id"].(string)
+							go func(userId, userLotteryId, order_code string) {
+								if !util.UpdateCouponState(userId, userLotteryId, "", "", order_code, qutil.ObjToString(v["product_type"]), "0", 0, productType) {
+									log.Println(fmt.Sprintf("单号%s-解绑失败-卡卷%s", order_code, userLotteryId))
+								}
+							}(userId, userLotteryId, order_code)
+						}
+					}
+				}
+			}
+		}
+		log.Println("定时任务,更新超时订单状态结束")
+	})
 }
 
 // 每天夜里12点 根据课程结束时间 更新课程状态 并 更新mysql预定此课程订单的状态为已取消
 func courseTask() {
-    crontab(true, TimeTaskConfig.CourseTask, func() {
-        log.Println("定时任务,开始更新课程状态")
-        now_unix := time.Now().Unix()
-        sess := util.MQFW.GetMgoConn()
-        defer util.MQFW.DestoryMongoConn(sess)
-        //i_status :  0是保存未发布 1是已发布 -1是已下线
-        it := sess.DB("qfw").C("jy_course").Find(map[string]interface{}{
-            "i_status": 1,
-            "l_starttime": map[string]interface{}{
-                "$lte": now_unix,
-            },
-        }).Select(map[string]interface{}{"i_status": 1, "l_endtime": 1}).Iter()
-        for m := make(map[string]interface{}); it.Next(&m); {
-            _id := BsonIdToSId(m["_id"])
-            util.MQFW.UpdateById("jy_course", _id, map[string]interface{}{
-                "$set": map[string]interface{}{
-                    "i_status": -1,
-                },
-            })
-            go func(id string) { //更新已预订此课程订单的状态为已取消
-                var updateSql = `UPDATE dataexport_order  SET order_status = -2 WHERE order_status = 0 AND product_type = '招投标课程' AND filter_id = '` + id + `'`
-                i := util.Mysql.UpdateOrDeleteBySql(updateSql)
-                if i < 0 {
-                    log.Println("mysql 订单更新失败", id)
-                }
-            }(_id)
-            m = make(map[string]interface{})
-        }
-        log.Println("定时任务,更新课程状态结束")
-    })
+	crontab(true, TimeTaskConfig.CourseTask, func() {
+		log.Println("定时任务,开始更新课程状态")
+		now_unix := time.Now().Unix()
+		sess := util.MQFW.GetMgoConn()
+		defer util.MQFW.DestoryMongoConn(sess)
+		//i_status :  0是保存未发布 1是已发布 -1是已下线
+		it := sess.DB("qfw").C("jy_course").Find(map[string]interface{}{
+			"i_status": 1,
+			"l_starttime": map[string]interface{}{
+				"$lte": now_unix,
+			},
+		}).Select(map[string]interface{}{"i_status": 1, "l_endtime": 1}).Iter()
+		for m := make(map[string]interface{}); it.Next(&m); {
+			_id := BsonIdToSId(m["_id"])
+			util.MQFW.UpdateById("jy_course", _id, map[string]interface{}{
+				"$set": map[string]interface{}{
+					"i_status": -1,
+				},
+			})
+			go func(id string) { //更新已预订此课程订单的状态为已取消
+				var updateSql = `UPDATE dataexport_order  SET order_status = -2 WHERE order_status = 0 AND product_type = '招投标课程' AND filter_id = '` + id + `'`
+				i := util.Mysql.UpdateOrDeleteBySql(updateSql)
+				if i < 0 {
+					log.Println("mysql 订单更新失败", id)
+				}
+			}(_id)
+			m = make(map[string]interface{})
+		}
+		log.Println("定时任务,更新课程状态结束")
+	})
 }
 
 // vip升级 下个月生效 同步
 func syncVipUpgrade() {
-    crontab(true, TimeTaskConfig.SyncVipUpgrade, func() {
-        defer qutil.Catch()
-        log.Println("定时任务,开始同步vip升级数据")
-        sess := util.MQFW.GetMgoConn()
-        for {
-            if sess != nil {
-                defer util.MQFW.DestoryMongoConn(sess)
-                break
-            }
-            time.Sleep(time.Minute)
-            sess = util.MQFW.GetMgoConn()
-        }
-        it := sess.DB("qfw").C("vip_upgrade").Find(map[string]interface{}{
-            "l_validtime": map[string]interface{}{
-                "$lte": time.Now().Unix(),
-            },
-            "i_isvalid": map[string]interface{}{
-                "$ne": 1,
-            },
-        }).Select(map[string]interface{}{"s_userid": 1, "o_area": 1, "a_buyerclass": 1, "o_buyset": 1}).Iter()
-        for m := make(map[string]interface{}); it.Next(&m); {
-            _id := BsonIdToSId(m["_id"])
-            s_userid := qutil.ObjToString(m["s_userid"])
-            if s_userid == "" {
-                log.Println("定时任务,同步vip升级数据有问题,userid是空", _id)
-                continue
-            }
-            o_area, _ := m["o_area"].(map[string]interface{})
-            o_buyset, _ := m["o_buyset"].(map[string]interface{})
-            a_buyerclass, _ := m["a_buyerclass"].([]interface{})
-            updateOk := false
-            if IsObjectIdHex(s_userid) {
-                updateOk = util.Compatible.Update(s_userid, map[string]interface{}{
-                    "$set": map[string]interface{}{
-                        "o_vipjy.o_area":       o_area,
-                        "o_vipjy.a_buyerclass": a_buyerclass,
-                        "o_vipjy.o_buyset":     o_buyset,
-                    },
-                })
-            } else {
-                updateOk = util.MQFW.Update("entniche_user", map[string]interface{}{
-                    "i_type":   2,
-                    "i_userid": qutil.IntAll(s_userid),
-                }, map[string]interface{}{
-                    "$set": map[string]interface{}{
-                        "o_vipjy.o_area":       o_area,
-                        "o_vipjy.a_buyerclass": a_buyerclass,
-                        "o_vipjy.o_buyset":     o_buyset,
-                    },
-                }, false, false)
-            }
-            if updateOk {
-                util.MQFW.UpdateById("vip_upgrade", _id, map[string]interface{}{
-                    "$set": map[string]interface{}{
-                        "l_synctime": time.Now().Unix(),
-                        "i_isvalid":  1,
-                    },
-                })
-                log.Println("定时任务,同步vip升级数据成功", _id)
-                positionId := util.MongoIdToPositionId(_id)
-                go jy.ClearBigVipUserPower(positionId)
-                go config.Middleground.UserCenter.WorkDesktopClearUserInfo(pb.WorkDesktopClearUserInfoReq{
-                    PositionId: positionId,
-                    AppId:      "10000",
-                })
-                go config.Middleground.PowerCheckCenter.DelCheckRedis("10000", qutil.Int64All(positionId))
-            } else {
-                log.Println("定时任务,同步vip升级数据更新用户表失败", _id)
-            }
-            m = make(map[string]interface{})
-        }
-        log.Println("定时任务,同步vip升级数据结束")
-    })
+	crontab(true, TimeTaskConfig.SyncVipUpgrade, func() {
+		defer qutil.Catch()
+		log.Println("定时任务,开始同步vip升级数据")
+		sess := util.MQFW.GetMgoConn()
+		for {
+			if sess != nil {
+				defer util.MQFW.DestoryMongoConn(sess)
+				break
+			}
+			time.Sleep(time.Minute)
+			sess = util.MQFW.GetMgoConn()
+		}
+		it := sess.DB("qfw").C("vip_upgrade").Find(map[string]interface{}{
+			"l_validtime": map[string]interface{}{
+				"$lte": time.Now().Unix(),
+			},
+			"i_isvalid": map[string]interface{}{
+				"$ne": 1,
+			},
+		}).Select(map[string]interface{}{"s_userid": 1, "o_area": 1, "a_buyerclass": 1, "o_buyset": 1}).Iter()
+		for m := make(map[string]interface{}); it.Next(&m); {
+			_id := BsonIdToSId(m["_id"])
+			s_userid := qutil.ObjToString(m["s_userid"])
+			if s_userid == "" {
+				log.Println("定时任务,同步vip升级数据有问题,userid是空", _id)
+				continue
+			}
+			o_area, _ := m["o_area"].(map[string]interface{})
+			o_buyset, _ := m["o_buyset"].(map[string]interface{})
+			a_buyerclass, _ := m["a_buyerclass"].([]interface{})
+			updateOk := false
+			if IsObjectIdHex(s_userid) {
+				updateOk = util.Compatible.Update(s_userid, map[string]interface{}{
+					"$set": map[string]interface{}{
+						"o_vipjy.o_area":       o_area,
+						"o_vipjy.a_buyerclass": a_buyerclass,
+						"o_vipjy.o_buyset":     o_buyset,
+					},
+				})
+			} else {
+				updateOk = util.MQFW.Update("entniche_user", map[string]interface{}{
+					"i_type":   2,
+					"i_userid": qutil.IntAll(s_userid),
+				}, map[string]interface{}{
+					"$set": map[string]interface{}{
+						"o_vipjy.o_area":       o_area,
+						"o_vipjy.a_buyerclass": a_buyerclass,
+						"o_vipjy.o_buyset":     o_buyset,
+					},
+				}, false, false)
+			}
+			if updateOk {
+				util.MQFW.UpdateById("vip_upgrade", _id, map[string]interface{}{
+					"$set": map[string]interface{}{
+						"l_synctime": time.Now().Unix(),
+						"i_isvalid":  1,
+					},
+				})
+				log.Println("定时任务,同步vip升级数据成功", _id)
+				positionId := util.MongoIdToPositionId(_id)
+				go jy.ClearBigVipUserPower(positionId)
+				go config.Middleground.UserCenter.WorkDesktopClearUserInfo(pb.WorkDesktopClearUserInfoReq{
+					PositionId: positionId,
+					AppId:      "10000",
+				})
+				go config.Middleground.PowerCheckCenter.DelCheckRedis("10000", qutil.Int64All(positionId))
+			} else {
+				log.Println("定时任务,同步vip升级数据更新用户表失败", _id)
+			}
+			m = make(map[string]interface{})
+		}
+		log.Println("定时任务,同步vip升级数据结束")
+	})
 }
 
 // 每天0点 检查试用、vip服务是否到期
 func checkIsExpire(iy Identity) {
-    crontab(true, TimeTaskConfig.CheckIsExpire, func() {
-        defer qutil.Catch()
-        log.Println("定时任务,开始更新vip状态")
-        now_unix := time.Now().Unix()
-        sess := util.MQFW.GetMgoConn()
-        for {
-            if sess != nil {
-                defer util.MQFW.DestoryMongoConn(sess)
-                break
-            }
-            time.Sleep(time.Minute)
-            sess = util.MQFW.GetMgoConn()
-        }
-        query := iy.UserQuery()
-        query["i_vip_status"] = map[string]interface{}{
-            "$gt": 0,
-        }
-        queryEndTime := now_unix + threeday
-        if len(TimeTaskConfig.SubVipTipDuring) > 0 {
-            queryEndTime = now_unix + oneDayLong*TimeTaskConfig.SubVipTipDuring[0].Cycle
-        }
-        query["l_vip_endtime"] = map[string]interface{}{
-            "$lte": queryEndTime,
-        }
-        count, err := sess.DB("qfw").C(iy.UserColl()).Find(query).Count()
-        log.Println("当前时间:", FormatDateByInt64(&now_unix, Date_Full_Layout), "数据总量:", count, "--err:", err)
-        var i int64 = 0
-        it := sess.DB("qfw").C(iy.UserColl()).Find(query).Select(iy.UserField(map[string]interface{}{"i_vip_status": 1, "l_vip_starttime": 1, "l_vip_endtime": 1, "i_userid": 1, "i_entid": 1, "base_user_id": 1, "o_vipjy": 1})).Iter()
-        for m := make(map[string]interface{}); it.Next(&m); {
-            i++
-            _id := BsonIdToSId(m["_id"])
-            l_vip_endtime := qutil.Int64All(m["l_vip_endtime"])
-            l_vip_starttime := qutil.Int64All(m["l_vip_starttime"])
-            i_vip_status := qutil.IntAll(m["i_vip_status"])
-            if l_vip_endtime <= now_unix {
-                // TODO: 到期提醒(所有超级订阅都发送)
-                ok := util.MQFW.UpdateById(iy.UserColl(), _id, map[string]interface{}{
-                    "$set": map[string]interface{}{
-                        "i_vip_status":     -i_vip_status,
-                        "i_vip_expire_tip": 2,
-                        "i_vip_subtips":    0,
-                        "i_vip_fastimport": 0,
-                    },
-                    "$unset": map[string]interface{}{
-                        "i_vip_expire_tip_retry": "",
-                    },
-                })
-                if !ok {
-                    log.Println("用户:", _id, " 更新vip状态异常")
-                }
-                go iy.DelVipSubPush(m)
-                positionId := util.MongoIdToPositionId(_id)
-                go jy.ClearBigVipUserPower(positionId)
-                go config.Middleground.UserCenter.WorkDesktopClearUserInfo(pb.WorkDesktopClearUserInfoReq{
-                    PositionId: positionId,
-                    AppId:      "10000",
-                })
-                go config.Middleground.PowerCheckCenter.DelCheckRedis("10000", qutil.Int64All(positionId))
-                log.Println("用户", _id, i_vip_status, l_vip_endtime, "修改已到期状态")
-                redis.Del("other", "p1_indexMessage_"+_id) //清除redis中vip状态
-                filePackKey := fmt.Sprintf(jy.FilePackNumKey, _id, fmt.Sprint(time.Now().Month()))
-                redis.Del(jy.PowerCacheDb, filePackKey) //清除redis中附件下载包次数
-                vipFileUploadNumKey := fmt.Sprintf(jy.VipFileUploadNumKey, _id, fmt.Sprint(time.Now().Month()))
-                redis.Del(jy.PowerCacheDb, vipFileUploadNumKey) //清除redis中vip使用次数
-            } else {
-                // TODO:即将到期提醒
-                //(1)当超级订阅服务周期≥360天,到期前30天开始提醒;当超级订阅服务周期≥90天,到期前7天开始提醒;当超级订阅服务周期≥7天,到期当天提醒;
-                //(2) 仅购买个人超级订阅(包含企业身份下个人购买的订单)
-                //(3)老版本超级订阅不提醒(仅个人身份下有)
-                showTip := func(s, e int64) bool {
-                    for _, cfg := range TimeTaskConfig.SubVipTipDuring {
-                        if e-s >= cfg.Cycle*oneDayLong && (now_unix+oneDayLong*(cfg.Day+1) > e && now_unix+oneDayLong*cfg.Day < e) {
-                            log.Println("用户 sVipTip", _id, i_vip_status, l_vip_endtime, "新增到期提醒", cfg.Day)
-                            return true
-                        }
-                    }
-                    return false
-                }(l_vip_starttime, l_vip_endtime)
-                if !showTip {
-                    continue
-                }
-                var (
-                    identity   *pb.Identity
-                    entId      = qutil.Int64All(m["i_entid"])
-                    entUserId  = qutil.Int64All(m["i_userid"])
-                    baseUserId = qutil.Int64All(m["base_user_id"])
-                )
-                if iy.UserColl() == CollEntUser {
-                    if util.Mysql.Count("entniche_power",
-                        map[string]interface{}{
-                            "ent_id":      entId,
-                            "ent_user_id": entUserId,
-                        }) >= 1 {
-                        continue
-                    }
-                    identity = util.Compatible.Middleground.UserCenter.IdentityByEntUserId(entUserId)
-                } else {
-                    //老版本超级订阅不提醒
-                    if o_vipjy := qutil.ObjToMap(m["o_vipjy"]); o_vipjy != nil && len(*o_vipjy) > 0 {
-                        if o_buyset := qutil.ObjToMap((*o_vipjy)["o_buyset"]); o_buyset != nil && len(*o_buyset) > 0 {
-                            if qutil.IntAll((*o_buyset)["upgrade"]) != 1 {
-                                continue
-                            }
-                        }
-                    }
-                    identity = util.Compatible.Middleground.UserCenter.IdentityByUserId(baseUserId)
-                }
+	crontab(true, TimeTaskConfig.CheckIsExpire, func() {
+		defer qutil.Catch()
+		log.Println("定时任务,开始更新vip状态")
+		now_unix := time.Now().Unix()
+		sess := util.MQFW.GetMgoConn()
+		for {
+			if sess != nil {
+				defer util.MQFW.DestoryMongoConn(sess)
+				break
+			}
+			time.Sleep(time.Minute)
+			sess = util.MQFW.GetMgoConn()
+		}
+		query := iy.UserQuery()
+		query["i_vip_status"] = map[string]interface{}{
+			"$gt": 0,
+		}
+		queryEndTime := now_unix + threeday
+		if len(TimeTaskConfig.SubVipTipDuring) > 0 {
+			queryEndTime = now_unix + oneDayLong*TimeTaskConfig.SubVipTipDuring[0].Cycle
+		}
+		query["l_vip_endtime"] = map[string]interface{}{
+			"$lte": queryEndTime,
+		}
+		count, err := sess.DB("qfw").C(iy.UserColl()).Find(query).Count()
+		log.Println("当前时间:", FormatDateByInt64(&now_unix, Date_Full_Layout), "数据总量:", count, "--err:", err)
+		var i int64 = 0
+		it := sess.DB("qfw").C(iy.UserColl()).Find(query).Select(iy.UserField(map[string]interface{}{"i_vip_status": 1, "l_vip_starttime": 1, "l_vip_endtime": 1, "i_userid": 1, "i_entid": 1, "base_user_id": 1, "o_vipjy": 1})).Iter()
+		for m := make(map[string]interface{}); it.Next(&m); {
+			i++
+			_id := BsonIdToSId(m["_id"])
+			l_vip_endtime := qutil.Int64All(m["l_vip_endtime"])
+			l_vip_starttime := qutil.Int64All(m["l_vip_starttime"])
+			i_vip_status := qutil.IntAll(m["i_vip_status"])
+			if l_vip_endtime <= now_unix {
+				// TODO: 到期提醒(所有超级订阅都发送)
+				ok := util.MQFW.UpdateById(iy.UserColl(), _id, map[string]interface{}{
+					"$set": map[string]interface{}{
+						"i_vip_status":     -i_vip_status,
+						"i_vip_expire_tip": 2,
+						"i_vip_subtips":    0,
+						"i_vip_fastimport": 0,
+					},
+					"$unset": map[string]interface{}{
+						"i_vip_expire_tip_retry": "",
+					},
+				})
+				if !ok {
+					log.Println("用户:", _id, " 更新vip状态异常")
+				}
+				go iy.DelVipSubPush(m)
+				positionId := util.MongoIdToPositionId(_id)
+				go jy.ClearBigVipUserPower(positionId)
+				go config.Middleground.UserCenter.WorkDesktopClearUserInfo(pb.WorkDesktopClearUserInfoReq{
+					PositionId: positionId,
+					AppId:      "10000",
+				})
+				go config.Middleground.PowerCheckCenter.DelCheckRedis("10000", qutil.Int64All(positionId))
+				log.Println("用户", _id, i_vip_status, l_vip_endtime, "修改已到期状态")
+				redis.Del("other", "p1_indexMessage_"+_id) //清除redis中vip状态
+				filePackKey := fmt.Sprintf(jy.FilePackNumKey, _id, fmt.Sprint(time.Now().Month()))
+				redis.Del(jy.PowerCacheDb, filePackKey) //清除redis中附件下载包次数
+				vipFileUploadNumKey := fmt.Sprintf(jy.VipFileUploadNumKey, _id, fmt.Sprint(time.Now().Month()))
+				redis.Del(jy.PowerCacheDb, vipFileUploadNumKey) //清除redis中vip使用次数
+			} else {
+				// TODO:即将到期提醒
+				//(1)当超级订阅服务周期≥360天,到期前30天开始提醒;当超级订阅服务周期≥90天,到期前7天开始提醒;当超级订阅服务周期≥7天,到期当天提醒;
+				//(2) 仅购买个人超级订阅(包含企业身份下个人购买的订单)
+				//(3)老版本超级订阅不提醒(仅个人身份下有)
+				showTip := func(s, e int64) bool {
+					for _, cfg := range TimeTaskConfig.SubVipTipDuring {
+						if e-s >= cfg.Cycle*oneDayLong && (now_unix+oneDayLong*(cfg.Day+1) > e && now_unix+oneDayLong*cfg.Day < e) {
+							log.Println("用户 sVipTip", _id, i_vip_status, l_vip_endtime, "新增到期提醒", cfg.Day)
+							return true
+						}
+					}
+					return false
+				}(l_vip_starttime, l_vip_endtime)
+				if !showTip {
+					continue
+				}
+				var (
+					identity   *pb.Identity
+					entId      = qutil.Int64All(m["i_entid"])
+					entUserId  = qutil.Int64All(m["i_userid"])
+					baseUserId = qutil.Int64All(m["base_user_id"])
+				)
+				if iy.UserColl() == CollEntUser {
+					if util.Mysql.Count("entniche_power",
+						map[string]interface{}{
+							"ent_id":      entId,
+							"ent_user_id": entUserId,
+						}) >= 1 {
+						continue
+					}
+					identity = util.Compatible.Middleground.UserCenter.IdentityByEntUserId(entUserId)
+				} else {
+					//老版本超级订阅不提醒
+					if o_vipjy := qutil.ObjToMap(m["o_vipjy"]); o_vipjy != nil && len(*o_vipjy) > 0 {
+						if o_buyset := qutil.ObjToMap((*o_vipjy)["o_buyset"]); o_buyset != nil && len(*o_buyset) > 0 {
+							if qutil.IntAll((*o_buyset)["upgrade"]) != 1 {
+								continue
+							}
+						}
+					}
+					identity = util.Compatible.Middleground.UserCenter.IdentityByUserId(baseUserId)
+				}
 
-                updateOk := util.MQFW.UpdateById(iy.UserColl(), _id, map[string]interface{}{
-                    "$set": map[string]interface{}{
-                        "i_vip_expire_tip": 1,
-                    },
-                })
-                // 存入redis值,供前台弹框使用
-                redis.Put("newother", fmt.Sprintf("Expire_SubvipTip_%d", identity.PositionId), l_vip_endtime, qutil.IntAll(l_vip_endtime-now_unix))
+				updateOk := util.MQFW.UpdateById(iy.UserColl(), _id, map[string]interface{}{
+					"$set": map[string]interface{}{
+						"i_vip_expire_tip": 1,
+					},
+				})
+				// 存入redis值,供前台弹框使用
+				redis.Put("newother", fmt.Sprintf("Expire_SubvipTip_%d", identity.PositionId), l_vip_endtime, qutil.IntAll(l_vip_endtime-now_unix))
 
-                log.Println("用户 sVipTip", _id, identity.PositionId, i_vip_status, l_vip_endtime, "修改即将到期状态", updateOk)
-            }
-            m = make(map[string]interface{})
-        }
-        if i != count {
-            log.Println("更新vip状态有异常,已处理:", i, "总量:", count)
-        }
-        log.Println("已处理:", i, "总量:", count)
-        log.Println("定时任务,更新vip状态结束")
-    })
+				log.Println("用户 sVipTip", _id, identity.PositionId, i_vip_status, l_vip_endtime, "修改即将到期状态", updateOk)
+			}
+			m = make(map[string]interface{})
+		}
+		if i != count {
+			log.Println("更新vip状态有异常,已处理:", i, "总量:", count)
+		}
+		log.Println("已处理:", i, "总量:", count)
+		log.Println("定时任务,更新vip状态结束")
+	})
 }
 
 // 即将到期或者已到期发推送消息
 func expireRemind() {
-    crontab(false, TimeTaskConfig.ExpireRemind, func() {
-        defer qutil.Catch()
-        log.Println("定时任务,到期提醒,开始推送消息")
-        doFunc := func(m map[string]interface{}) {
-            i_vip_expire_tip := qutil.IntAll(m["i_vip_expire_tip"])
-            if i_vip_expire_tip != 1 && i_vip_expire_tip != 2 {
-                return
-            }
-            _id := qutil.ObjToString(m["_id"])
-            l_vip_endtime := qutil.Int64All(m["l_vip_endtime"])
-            i_vip_status := qutil.IntAll(m["i_vip_status"])
-            wxPushOk, appPushOk := false, false
-            l_vip_starttime := qutil.Int64All(m["l_vip_starttime"])
-            s_m_openid := qutil.ObjToString(m["s_m_openid"])
-            isPushWx := qutil.IntAllDef(m["i_ispush"], 1)
-            s_jpushid := qutil.ObjToString(m["s_jpushid"])
-            s_opushid := qutil.ObjToString(m["s_opushid"])
-            s_appponetype := qutil.ObjToString(m["s_appponetype"])
-            log.Println("到期提醒,推送消息", _id, "i_vip_status", i_vip_status, "l_vip_starttime", l_vip_starttime, "l_vip_endtime", l_vip_endtime, "i_vip_expire_tip", i_vip_expire_tip, "s_m_openid", s_m_openid, "isPushWx", isPushWx, "s_appponetype", s_appponetype, "s_jpushid", s_jpushid, "s_opushid", s_opushid)
-            if isPushWx == 1 && s_m_openid != "" { //微信推送
-                tp := ""
-                tplId, keyword1_value, keyword2_value, keyword3_value, keyword4_value := "", "", "", "", ""
-                switch i_vip_status {
-                case 2, -2:
-                    keyword4_value = FormatDateByInt64(&l_vip_endtime, Date_Short_Layout)
-                    if i_vip_expire_tip == 1 {
-                        tp = "soonexprie"
-                        tplId = MessageConfig.WxTpl_SoonExpire.Id
-                        keyword2_value = MessageConfig.WxTpl_SoonExpire.Keyword2.Value
-                        keyword3_value = MessageConfig.WxTpl_SoonExpire.Keyword3.Value
-                        keyword4_value = fmt.Sprintf(MessageConfig.WxTpl_SoonExpire.Keyword4.Value, keyword4_value)
-                    } else if i_vip_expire_tip == 2 {
-                        tp = "expried"
-                        tplId = MessageConfig.WxTpl_Expired.Id
-                        keyword2_value = MessageConfig.WxTpl_Expired.Keyword2.Value
-                        keyword3_value = MessageConfig.WxTpl_Expired.Keyword3.Value
-                        keyword4_value = fmt.Sprintf(MessageConfig.WxTpl_Expired.Keyword4.Value, keyword4_value)
-                    }
-                    keyword1_value = qutil.ObjToString(m["s_nickname"])
-                default:
-                    return
-                }
-                tmplData := map[string]*qrpc.TmplItem{
-                    "keyword1": &qrpc.TmplItem{
-                        Value: keyword1_value,
-                    },
-                    "keyword2": &qrpc.TmplItem{
-                        Value: keyword2_value,
-                    },
-                    "keyword3": &qrpc.TmplItem{
-                        Value: keyword3_value,
-                    },
-                    "keyword4": &qrpc.TmplItem{
-                        Value: keyword4_value,
-                    },
-                }
-                wxPushOk, _ = qrpc.WxSendTmplMsg(Config.Weixinrpc, &qrpc.WxTmplMsg{
-                    OpenId:   s_m_openid,
-                    TplId:    tplId,
-                    TmplData: tmplData,
-                    Url:      Config.WebDomain + "/front/sess/" + util.Se_Topnet.EncodeString(_id+qutil.If(IsObjectIdHex(_id), ",_id,", ",entUserId,").(string)+strconv.Itoa(int(time.Now().Unix()))+",msgremind") + "__" + hex.EncodeToString([]byte(fmt.Sprintf("type=%s", tp))),
-                })
-                log.Println("到期提醒,微信推送", _id, wxPushOk)
-            }
-            if !wxPushOk && (m["s_opushid"] != nil || m["s_jpushid"] != nil) { //app推送
-                tp, app_descript := "", ""
-                switch i_vip_status {
-                case 1, -1:
-                    if i_vip_expire_tip == 1 {
-                        tp = "ontrial_soonexprie"
-                        app_descript = MessageConfig.App_OnTrial_SoonExpire
-                    } else if i_vip_expire_tip == 2 {
-                        tp = "ontrial_expried"
-                        app_descript = MessageConfig.App_OnTrial_Expired
-                    }
-                case 2, -2:
-                    if i_vip_expire_tip == 1 {
-                        tp = "soonexprie"
-                        app_descript = MessageConfig.App_SoonExpire
-                    } else if i_vip_expire_tip == 2 {
-                        tp = "expried"
-                        app_descript = MessageConfig.App_Expired
-                    }
-                default:
-                    return
-                }
-                appPushOk = qrpc.AppPush(Config.AppPushServiceRpc, map[string]interface{}{
-                    "phoneType":   m["s_appponetype"],
-                    "otherPushId": m["s_opushid"],
-                    "jgPushId":    m["s_jpushid"],
-                    "url":         "/jyapp/free/sess/" + util.Se_Topnet.EncodeString(_id+qutil.If(IsObjectIdHex(_id), ",_id,", ",entUserId,").(string)+strconv.Itoa(int(time.Now().Unix()))+",msgremind") + "__" + hex.EncodeToString([]byte(fmt.Sprintf("type=%s", tp))),
-                    "userId":      _id,
-                    "type":        "vipNotice",
-                    "descript":    app_descript,
-                    "title":       "剑鱼提醒",
-                    "category":    "服务通知_账号动态",
-                })
-                log.Println("到期提醒,app推送", _id, appPushOk)
-            }
-            if wxPushOk || appPushOk {
-                util.Compatible.UpdateByEntUserId(_id, map[string]interface{}{
-                    "$set": map[string]interface{}{
-                        "i_vip_expire_tip": 0,
-                    },
-                })
-            }
-        }
-        field := map[string]interface{}{
-            "s_m_openid":             1,
-            "s_jpushid":              1,
-            "s_opushid":              1,
-            "s_appponetype":          1,
-            "s_nickname":             1,
-            "i_ispush":               1,
-            "i_vip_status":           1,
-            "l_vip_starttime":        1,
-            "l_vip_endtime":          1,
-            "i_vip_expire_tip":       1,
-            "i_vip_expire_tip_retry": 1,
-        }
-        (&Personal{}).LoadVipUsers(field, doFunc)
-        (&Ent{}).LoadVipUsers(field, doFunc)
-        log.Println("定时任务,到期提醒,推送消息结束")
-    })
+	crontab(false, TimeTaskConfig.ExpireRemind, func() {
+		defer qutil.Catch()
+		log.Println("定时任务,到期提醒,开始推送消息")
+		doFunc := func(m map[string]interface{}) {
+			i_vip_expire_tip := qutil.IntAll(m["i_vip_expire_tip"])
+			if i_vip_expire_tip != 1 && i_vip_expire_tip != 2 {
+				return
+			}
+			_id := qutil.ObjToString(m["_id"])
+			l_vip_endtime := qutil.Int64All(m["l_vip_endtime"])
+			i_vip_status := qutil.IntAll(m["i_vip_status"])
+			wxPushOk, appPushOk := false, false
+			l_vip_starttime := qutil.Int64All(m["l_vip_starttime"])
+			s_m_openid := qutil.ObjToString(m["s_m_openid"])
+			isPushWx := qutil.IntAllDef(m["i_ispush"], 1)
+			s_jpushid := qutil.ObjToString(m["s_jpushid"])
+			s_opushid := qutil.ObjToString(m["s_opushid"])
+			s_appponetype := qutil.ObjToString(m["s_appponetype"])
+			log.Println("到期提醒,推送消息", _id, "i_vip_status", i_vip_status, "l_vip_starttime", l_vip_starttime, "l_vip_endtime", l_vip_endtime, "i_vip_expire_tip", i_vip_expire_tip, "s_m_openid", s_m_openid, "isPushWx", isPushWx, "s_appponetype", s_appponetype, "s_jpushid", s_jpushid, "s_opushid", s_opushid)
+			if isPushWx == 1 && s_m_openid != "" { //微信推送
+				tp := ""
+				tplId, keyword1_value, keyword2_value, keyword3_value, keyword4_value := "", "", "", "", ""
+				switch i_vip_status {
+				case 2, -2:
+					keyword4_value = FormatDateByInt64(&l_vip_endtime, Date_Short_Layout)
+					if i_vip_expire_tip == 1 {
+						tp = "soonexprie"
+						tplId = MessageConfig.WxTpl_SoonExpire.Id
+						keyword2_value = MessageConfig.WxTpl_SoonExpire.Keyword2.Value
+						keyword3_value = MessageConfig.WxTpl_SoonExpire.Keyword3.Value
+						keyword4_value = fmt.Sprintf(MessageConfig.WxTpl_SoonExpire.Keyword4.Value, keyword4_value)
+					} else if i_vip_expire_tip == 2 {
+						tp = "expried"
+						tplId = MessageConfig.WxTpl_Expired.Id
+						keyword2_value = MessageConfig.WxTpl_Expired.Keyword2.Value
+						keyword3_value = MessageConfig.WxTpl_Expired.Keyword3.Value
+						keyword4_value = fmt.Sprintf(MessageConfig.WxTpl_Expired.Keyword4.Value, keyword4_value)
+					}
+					keyword1_value = qutil.ObjToString(m["s_nickname"])
+				default:
+					return
+				}
+				tmplData := map[string]*qrpc.TmplItem{
+					"keyword1": &qrpc.TmplItem{
+						Value: keyword1_value,
+					},
+					"keyword2": &qrpc.TmplItem{
+						Value: keyword2_value,
+					},
+					"keyword3": &qrpc.TmplItem{
+						Value: keyword3_value,
+					},
+					"keyword4": &qrpc.TmplItem{
+						Value: keyword4_value,
+					},
+				}
+				wxPushOk, _ = qrpc.WxSendTmplMsg(Config.Weixinrpc, &qrpc.WxTmplMsg{
+					OpenId:   s_m_openid,
+					TplId:    tplId,
+					TmplData: tmplData,
+					Url:      Config.WebDomain + "/front/sess/" + util.Se_Topnet.EncodeString(_id+qutil.If(IsObjectIdHex(_id), ",_id,", ",entUserId,").(string)+strconv.Itoa(int(time.Now().Unix()))+",msgremind") + "__" + hex.EncodeToString([]byte(fmt.Sprintf("type=%s", tp))),
+				})
+				log.Println("到期提醒,微信推送", _id, wxPushOk)
+			}
+			if !wxPushOk && (m["s_opushid"] != nil || m["s_jpushid"] != nil) { //app推送
+				tp, app_descript := "", ""
+				switch i_vip_status {
+				case 1, -1:
+					if i_vip_expire_tip == 1 {
+						tp = "ontrial_soonexprie"
+						app_descript = MessageConfig.App_OnTrial_SoonExpire
+					} else if i_vip_expire_tip == 2 {
+						tp = "ontrial_expried"
+						app_descript = MessageConfig.App_OnTrial_Expired
+					}
+				case 2, -2:
+					if i_vip_expire_tip == 1 {
+						tp = "soonexprie"
+						app_descript = MessageConfig.App_SoonExpire
+					} else if i_vip_expire_tip == 2 {
+						tp = "expried"
+						app_descript = MessageConfig.App_Expired
+					}
+				default:
+					return
+				}
+				appPushOk = qrpc.AppPush(Config.AppPushServiceRpc, map[string]interface{}{
+					"phoneType":   m["s_appponetype"],
+					"otherPushId": m["s_opushid"],
+					"jgPushId":    m["s_jpushid"],
+					"url":         "/jyapp/free/sess/" + util.Se_Topnet.EncodeString(_id+qutil.If(IsObjectIdHex(_id), ",_id,", ",entUserId,").(string)+strconv.Itoa(int(time.Now().Unix()))+",msgremind") + "__" + hex.EncodeToString([]byte(fmt.Sprintf("type=%s", tp))),
+					"userId":      _id,
+					"type":        "vipNotice",
+					"descript":    app_descript,
+					"title":       "剑鱼提醒",
+					"category":    "服务通知_账号动态",
+				})
+				log.Println("到期提醒,app推送", _id, appPushOk)
+			}
+			if wxPushOk || appPushOk {
+				util.Compatible.UpdateByEntUserId(_id, map[string]interface{}{
+					"$set": map[string]interface{}{
+						"i_vip_expire_tip": 0,
+					},
+				})
+			}
+		}
+		field := map[string]interface{}{
+			"s_m_openid":             1,
+			"s_jpushid":              1,
+			"s_opushid":              1,
+			"s_appponetype":          1,
+			"s_nickname":             1,
+			"i_ispush":               1,
+			"i_vip_status":           1,
+			"l_vip_starttime":        1,
+			"l_vip_endtime":          1,
+			"i_vip_expire_tip":       1,
+			"i_vip_expire_tip_retry": 1,
+		}
+		(&Personal{}).LoadVipUsers(field, doFunc)
+		(&Ent{}).LoadVipUsers(field, doFunc)
+		log.Println("定时任务,到期提醒,推送消息结束")
+	})
 }
 
 // 检测大会员到期时间 定时任务
 func checkMemberIsExpire(i Identity) {
-    crontab(true, TimeTaskConfig.MemberExpire, func() {
-        defer qutil.Catch()
-        log.Println("定时任务,开始更新大会员状态")
-        now_unix := time.Now().Unix()
-        now_time := FormatDateByInt64(&now_unix, Date_Full_Layout)
-        sess := util.MQFW.GetMgoConn()
-        for {
-            if sess != nil {
-                defer util.MQFW.DestoryMongoConn(sess)
-                break
-            }
-            time.Sleep(time.Minute)
-            sess = util.MQFW.GetMgoConn()
-        }
-        query := i.UserQuery()
-        query["i_member_status"] = map[string]interface{}{
-            "$gt": 0,
-        }
-        query["i_member_endtime"] = map[string]interface{}{
-            "$lte": now_unix + threeday,
-        }
-        it := sess.DB("qfw").C(i.UserColl()).Find(query).Select(i.UserField(map[string]interface{}{"i_member_status": 1, "i_member_endtime": 1, "i_member_expire_tip": 1})).Iter()
-        for m := make(map[string]interface{}); it.Next(&m); {
-            _id := BsonIdToSId(m["_id"])
-            i_member_endtime := qutil.Int64All(m["i_member_endtime"])
-            i_member_status := qutil.IntAll(m["i_member_status"])
-            i_member_expire_tip := qutil.IntAll(m["i_member_expire_tip"])
-            if i_member_endtime <= now_unix {
-                util.MQFW.UpdateById(i.UserColl(), _id, map[string]interface{}{
-                    "$set": map[string]interface{}{
-                        "i_member_status":     -i_member_status,
-                        "i_member_expire_tip": 2,
-                    },
-                    "$unset": map[string]interface{}{
-                        "i_member_expire_tip_retry": "",
-                        "i_mainaccount":             "",
-                        "i_pay_sub_num":             "",
-                        "i_free_sub_num":            "",
-                        "i_member_sub_status":       "",
-                        "s_member_mainid":           "",
-                    },
-                })
-                go i.DelBigMemberSubPush(m)
-                //大会员用户服务表
-                if util.Mysql.UpdateOrDeleteBySql(`UPDATE `+jy.BigmemberUserPowerTable+` a SET a.i_frequency = 0 , a.i_status = -1, a.l_updatetime=?  WHERE a.s_userid = ?`, now_time, _id) < 0 {
-                    log.Println(_id, "更新到期用户服务表出错")
-                } else {
-                    positionId := util.MongoIdToPositionId(_id)
-                    ok := jy.ClearBigVipUserPower(positionId)
-                    config.Middleground.UserCenter.WorkDesktopClearUserInfo(pb.WorkDesktopClearUserInfoReq{
-                        PositionId: positionId,
-                        AppId:      "10000",
-                    })
-                    go config.Middleground.PowerCheckCenter.DelCheckRedis("10000", qutil.Int64All(positionId))
-                    if !ok {
-                        log.Println("清除 redis 大会员服务详情 缓存失败:", _id)
-                    }
-                }
-            } else if i_member_endtime-now_unix <= threeday && i_member_expire_tip != 1 {
-                updateOk := util.MQFW.UpdateById(i.UserColl(), _id, map[string]interface{}{
-                    "$set": map[string]interface{}{
-                        "i_member_expire_tip": 1,
-                    },
-                    "$unset": map[string]interface{}{
-                        "i_member_expire_tip_retry": "",
-                    },
-                })
-                log.Println("用户", _id, i_member_status, i_member_endtime, "修改大会员即将到期状态", updateOk)
-            }
-            m = make(map[string]interface{})
-        }
-        log.Println("定时任务,更新大会员状态结束")
-    })
+	crontab(true, TimeTaskConfig.MemberExpire, func() {
+		defer qutil.Catch()
+		log.Println("定时任务,开始更新大会员状态")
+		now_unix := time.Now().Unix()
+		now_time := FormatDateByInt64(&now_unix, Date_Full_Layout)
+		sess := util.MQFW.GetMgoConn()
+		for {
+			if sess != nil {
+				defer util.MQFW.DestoryMongoConn(sess)
+				break
+			}
+			time.Sleep(time.Minute)
+			sess = util.MQFW.GetMgoConn()
+		}
+		query := i.UserQuery()
+		query["i_member_status"] = map[string]interface{}{
+			"$gt": 0,
+		}
+		query["i_member_endtime"] = map[string]interface{}{
+			"$lte": now_unix + threeday,
+		}
+		it := sess.DB("qfw").C(i.UserColl()).Find(query).Select(i.UserField(map[string]interface{}{"i_member_status": 1, "i_member_endtime": 1, "i_member_expire_tip": 1})).Iter()
+		for m := make(map[string]interface{}); it.Next(&m); {
+			_id := BsonIdToSId(m["_id"])
+			i_member_endtime := qutil.Int64All(m["i_member_endtime"])
+			i_member_status := qutil.IntAll(m["i_member_status"])
+			i_member_expire_tip := qutil.IntAll(m["i_member_expire_tip"])
+			if i_member_endtime <= now_unix {
+				util.MQFW.UpdateById(i.UserColl(), _id, map[string]interface{}{
+					"$set": map[string]interface{}{
+						"i_member_status":     -i_member_status,
+						"i_member_expire_tip": 2,
+					},
+					"$unset": map[string]interface{}{
+						"i_member_expire_tip_retry": "",
+						"i_mainaccount":             "",
+						"i_pay_sub_num":             "",
+						"i_free_sub_num":            "",
+						"i_member_sub_status":       "",
+						"s_member_mainid":           "",
+					},
+				})
+				go i.DelBigMemberSubPush(m)
+				//大会员用户服务表
+				if util.Mysql.UpdateOrDeleteBySql(`UPDATE `+jy.BigmemberUserPowerTable+` a SET a.i_frequency = 0 , a.i_status = -1, a.l_updatetime=?  WHERE a.s_userid = ?`, now_time, _id) < 0 {
+					log.Println(_id, "更新到期用户服务表出错")
+				} else {
+					positionId := util.MongoIdToPositionId(_id)
+					ok := jy.ClearBigVipUserPower(positionId)
+					config.Middleground.UserCenter.WorkDesktopClearUserInfo(pb.WorkDesktopClearUserInfoReq{
+						PositionId: positionId,
+						AppId:      "10000",
+					})
+					go config.Middleground.PowerCheckCenter.DelCheckRedis("10000", qutil.Int64All(positionId))
+					if !ok {
+						log.Println("清除 redis 大会员服务详情 缓存失败:", _id)
+					}
+				}
+			} else if i_member_endtime-now_unix <= threeday && i_member_expire_tip != 1 {
+				updateOk := util.MQFW.UpdateById(i.UserColl(), _id, map[string]interface{}{
+					"$set": map[string]interface{}{
+						"i_member_expire_tip": 1,
+					},
+					"$unset": map[string]interface{}{
+						"i_member_expire_tip_retry": "",
+					},
+				})
+				log.Println("用户", _id, i_member_status, i_member_endtime, "修改大会员即将到期状态", updateOk)
+			}
+			m = make(map[string]interface{})
+		}
+		log.Println("定时任务,更新大会员状态结束")
+	})
 }
 
 // 大会员即将到期或者已到期发推送消息
 func bigMemberExpireRemind() {
-    crontab(false, TimeTaskConfig.ExpireRemind, func() {
-        defer qutil.Catch()
-        log.Println("定时任务,大会员到期提醒,开始推送消息")
-        now_unix := time.Now().Unix()
-        doFunc := func(m map[string]interface{}) {
-            i_member_expire_tip := qutil.IntAll(m["i_member_expire_tip"])
-            if i_member_expire_tip != 1 && i_member_expire_tip != 2 {
-                return
-            }
-            _id := qutil.ObjToString(m["_id"])
-            i_member_endtime := qutil.Int64All(m["i_member_endtime"])
-            if i_member_endtime-now_unix > threeday { //&& i_member_expire_tip == 1
-                log.Println("大会员即将到期提醒,结束时间大于三天,过滤掉", _id, i_member_endtime)
-                return
-            }
-            i_member_status := qutil.IntAll(m["i_member_status"])
-            wxPushOk, appPushOk := false, false
-            i_member_starttime := qutil.Int64All(m["i_member_starttime"])
-            s_m_openid := qutil.ObjToString(m["s_m_openid"])
-            isPushWx := qutil.IntAllDef(m["i_ispush"], 1)
-            s_jpushid := qutil.ObjToString(m["s_jpushid"])
-            s_opushid := qutil.ObjToString(m["s_opushid"])
-            s_appponetype := qutil.ObjToString(m["s_appponetype"])
-            log.Println("大会员到期提醒,推送消息", _id, "i_member_status", i_member_status, "i_member_starttime", i_member_starttime, "i_member_endtime", i_member_endtime, "i_member_expire_tip", i_member_expire_tip, "s_m_openid", s_m_openid, "isPushWx", isPushWx, "s_appponetype", s_appponetype, "s_jpushid", s_jpushid, "s_opushid", s_opushid)
-            if isPushWx == 1 && s_m_openid != "" { //微信推送
-                //tp := ""
-                tplId, keyword1_value, keyword2_value, keyword3_value, keyword4_value := "", "", "", "", ""
-                keyword4_value = FormatDateByInt64(&i_member_endtime, Date_Short_Layout)
-                if i_member_status > 0 {
-                    //tp = "bigmember_soonexprie"
-                    tplId = MessageConfig.WxTpl_BigMember_SoonExpire.Id
-                    keyword2_value = MessageConfig.WxTpl_BigMember_SoonExpire.Keyword2.Value
-                    keyword3_value = MessageConfig.WxTpl_BigMember_SoonExpire.Keyword3.Value
-                    keyword4_value = fmt.Sprintf(MessageConfig.WxTpl_BigMember_SoonExpire.Keyword4.Value, keyword4_value)
-                } else if i_member_status < 0 {
-                    //tp = "bigmember_expried"
-                    tplId = MessageConfig.WxTpl_BigMember_Expired.Id
-                    keyword2_value = MessageConfig.WxTpl_BigMember_Expired.Keyword2.Value
-                    keyword3_value = MessageConfig.WxTpl_BigMember_Expired.Keyword3.Value
-                    keyword4_value = fmt.Sprintf(MessageConfig.WxTpl_BigMember_Expired.Keyword4.Value, keyword4_value)
-                } else {
-                    return
-                }
-                keyword1_value = qutil.ObjToString(m["s_nickname"])
-                tmplData := map[string]*qrpc.TmplItem{
-                    "keyword1": &qrpc.TmplItem{
-                        Value: keyword1_value,
-                    },
-                    "keyword2": &qrpc.TmplItem{
-                        Value: keyword2_value,
-                    },
-                    "keyword3": &qrpc.TmplItem{
-                        Value: keyword3_value,
-                    },
-                    "keyword4": &qrpc.TmplItem{
-                        Value: keyword4_value,
-                    },
-                }
-                wxPushOk, _ = qrpc.WxSendTmplMsg(Config.Weixinrpc, &qrpc.WxTmplMsg{
-                    OpenId:   s_m_openid,
-                    TplId:    tplId,
-                    TmplData: tmplData,
-                    //Url:      Config.WebDomain + "/front/sess/" + util.Se_Topnet.EncodeString(s_m_openid+",uid,"+strconv.Itoa(int(time.Now().Unix()))+",msgremind") + "__" + hex.EncodeToString([]byte(fmt.Sprintf("type=%s&advertcode=%s", tp, wtmc.AdvertCode))),
-                })
-                log.Println("大会员到期提醒,微信推送", _id, wxPushOk)
-            }
-            if !wxPushOk && (m["s_opushid"] != nil || m["s_jpushid"] != nil) { //app推送
-                tp, app_descript := "", ""
-                if i_member_status > 0 {
-                    tp = "bigmember_soonexprie"
-                    app_descript = MessageConfig.App_BigMember_SoonExpire
-                } else if i_member_status < 0 {
-                    tp = "bigmember_expried"
-                    app_descript = MessageConfig.App_BigMember_Expired
-                } else {
-                    return
-                }
-                appPushOk = qrpc.AppPush(Config.AppPushServiceRpc, map[string]interface{}{
-                    "phoneType":   m["s_appponetype"],
-                    "otherPushId": m["s_opushid"],
-                    "jgPushId":    m["s_jpushid"],
-                    "url":         "/jyapp/free/sess/" + util.Se_Topnet.EncodeString(_id+qutil.If(IsObjectIdHex(_id), ",_id,", ",entUserId,").(string)+strconv.Itoa(int(time.Now().Unix()))+",msgremind") + "__" + hex.EncodeToString([]byte(fmt.Sprintf("type=%s", tp))),
-                    "userId":      _id,
-                    "type":        "vipNotice",
-                    "descript":    app_descript,
-                    "title":       "剑鱼提醒",
-                    "category":    "服务通知_账号动态",
-                    "menuName":    "box",
-                })
-                log.Println("大会员到期提醒,app推送", _id, appPushOk)
-            }
-            if wxPushOk || appPushOk || qutil.IntAll(m["i_member_expire_tip_retry"]) >= 2 {
-                util.Compatible.UpdateByEntUserId(_id, map[string]interface{}{
-                    "$set": map[string]interface{}{
-                        "i_member_expire_tip": 0,
-                    },
-                })
-            } else {
-                util.Compatible.Update(_id, map[string]interface{}{
-                    "$inc": map[string]interface{}{
-                        "i_member_expire_tip_retry": 1,
-                    },
-                })
-            }
-        }
-        field := map[string]interface{}{
-            "s_m_openid":                1,
-            "s_jpushid":                 1,
-            "s_opushid":                 1,
-            "s_appponetype":             1,
-            "s_nickname":                1,
-            "i_ispush":                  1,
-            "i_member_status":           1,
-            "i_member_starttime":        1,
-            "i_member_endtime":          1,
-            "i_member_expire_tip":       1,
-            "i_member_expire_tip_retry": 1,
-        }
-        (&Personal{}).LoadBigMemberUsers(field, doFunc)
-        (&Ent{}).LoadBigMemberUsers(field, doFunc)
-        log.Println("定时任务,大会员到期提醒,推送消息结束")
-    })
+	crontab(false, TimeTaskConfig.ExpireRemind, func() {
+		defer qutil.Catch()
+		log.Println("定时任务,大会员到期提醒,开始推送消息")
+		now_unix := time.Now().Unix()
+		doFunc := func(m map[string]interface{}) {
+			i_member_expire_tip := qutil.IntAll(m["i_member_expire_tip"])
+			if i_member_expire_tip != 1 && i_member_expire_tip != 2 {
+				return
+			}
+			_id := qutil.ObjToString(m["_id"])
+			i_member_endtime := qutil.Int64All(m["i_member_endtime"])
+			if i_member_endtime-now_unix > threeday { //&& i_member_expire_tip == 1
+				log.Println("大会员即将到期提醒,结束时间大于三天,过滤掉", _id, i_member_endtime)
+				return
+			}
+			i_member_status := qutil.IntAll(m["i_member_status"])
+			wxPushOk, appPushOk := false, false
+			i_member_starttime := qutil.Int64All(m["i_member_starttime"])
+			s_m_openid := qutil.ObjToString(m["s_m_openid"])
+			isPushWx := qutil.IntAllDef(m["i_ispush"], 1)
+			s_jpushid := qutil.ObjToString(m["s_jpushid"])
+			s_opushid := qutil.ObjToString(m["s_opushid"])
+			s_appponetype := qutil.ObjToString(m["s_appponetype"])
+			log.Println("大会员到期提醒,推送消息", _id, "i_member_status", i_member_status, "i_member_starttime", i_member_starttime, "i_member_endtime", i_member_endtime, "i_member_expire_tip", i_member_expire_tip, "s_m_openid", s_m_openid, "isPushWx", isPushWx, "s_appponetype", s_appponetype, "s_jpushid", s_jpushid, "s_opushid", s_opushid)
+			if isPushWx == 1 && s_m_openid != "" { //微信推送
+				//tp := ""
+				tplId, keyword1_value, keyword2_value, keyword3_value, keyword4_value := "", "", "", "", ""
+				keyword4_value = FormatDateByInt64(&i_member_endtime, Date_Short_Layout)
+				if i_member_status > 0 {
+					//tp = "bigmember_soonexprie"
+					tplId = MessageConfig.WxTpl_BigMember_SoonExpire.Id
+					keyword2_value = MessageConfig.WxTpl_BigMember_SoonExpire.Keyword2.Value
+					keyword3_value = MessageConfig.WxTpl_BigMember_SoonExpire.Keyword3.Value
+					keyword4_value = fmt.Sprintf(MessageConfig.WxTpl_BigMember_SoonExpire.Keyword4.Value, keyword4_value)
+				} else if i_member_status < 0 {
+					//tp = "bigmember_expried"
+					tplId = MessageConfig.WxTpl_BigMember_Expired.Id
+					keyword2_value = MessageConfig.WxTpl_BigMember_Expired.Keyword2.Value
+					keyword3_value = MessageConfig.WxTpl_BigMember_Expired.Keyword3.Value
+					keyword4_value = fmt.Sprintf(MessageConfig.WxTpl_BigMember_Expired.Keyword4.Value, keyword4_value)
+				} else {
+					return
+				}
+				keyword1_value = qutil.ObjToString(m["s_nickname"])
+				tmplData := map[string]*qrpc.TmplItem{
+					"keyword1": &qrpc.TmplItem{
+						Value: keyword1_value,
+					},
+					"keyword2": &qrpc.TmplItem{
+						Value: keyword2_value,
+					},
+					"keyword3": &qrpc.TmplItem{
+						Value: keyword3_value,
+					},
+					"keyword4": &qrpc.TmplItem{
+						Value: keyword4_value,
+					},
+				}
+				wxPushOk, _ = qrpc.WxSendTmplMsg(Config.Weixinrpc, &qrpc.WxTmplMsg{
+					OpenId:   s_m_openid,
+					TplId:    tplId,
+					TmplData: tmplData,
+					//Url:      Config.WebDomain + "/front/sess/" + util.Se_Topnet.EncodeString(s_m_openid+",uid,"+strconv.Itoa(int(time.Now().Unix()))+",msgremind") + "__" + hex.EncodeToString([]byte(fmt.Sprintf("type=%s&advertcode=%s", tp, wtmc.AdvertCode))),
+				})
+				log.Println("大会员到期提醒,微信推送", _id, wxPushOk)
+			}
+			if !wxPushOk && (m["s_opushid"] != nil || m["s_jpushid"] != nil) { //app推送
+				tp, app_descript := "", ""
+				if i_member_status > 0 {
+					tp = "bigmember_soonexprie"
+					app_descript = MessageConfig.App_BigMember_SoonExpire
+				} else if i_member_status < 0 {
+					tp = "bigmember_expried"
+					app_descript = MessageConfig.App_BigMember_Expired
+				} else {
+					return
+				}
+				appPushOk = qrpc.AppPush(Config.AppPushServiceRpc, map[string]interface{}{
+					"phoneType":   m["s_appponetype"],
+					"otherPushId": m["s_opushid"],
+					"jgPushId":    m["s_jpushid"],
+					"url":         "/jyapp/free/sess/" + util.Se_Topnet.EncodeString(_id+qutil.If(IsObjectIdHex(_id), ",_id,", ",entUserId,").(string)+strconv.Itoa(int(time.Now().Unix()))+",msgremind") + "__" + hex.EncodeToString([]byte(fmt.Sprintf("type=%s", tp))),
+					"userId":      _id,
+					"type":        "vipNotice",
+					"descript":    app_descript,
+					"title":       "剑鱼提醒",
+					"category":    "服务通知_账号动态",
+					"menuName":    "box",
+				})
+				log.Println("大会员到期提醒,app推送", _id, appPushOk)
+			}
+			if wxPushOk || appPushOk || qutil.IntAll(m["i_member_expire_tip_retry"]) >= 2 {
+				util.Compatible.UpdateByEntUserId(_id, map[string]interface{}{
+					"$set": map[string]interface{}{
+						"i_member_expire_tip": 0,
+					},
+				})
+			} else {
+				util.Compatible.Update(_id, map[string]interface{}{
+					"$inc": map[string]interface{}{
+						"i_member_expire_tip_retry": 1,
+					},
+				})
+			}
+		}
+		field := map[string]interface{}{
+			"s_m_openid":                1,
+			"s_jpushid":                 1,
+			"s_opushid":                 1,
+			"s_appponetype":             1,
+			"s_nickname":                1,
+			"i_ispush":                  1,
+			"i_member_status":           1,
+			"i_member_starttime":        1,
+			"i_member_endtime":          1,
+			"i_member_expire_tip":       1,
+			"i_member_expire_tip_retry": 1,
+		}
+		(&Personal{}).LoadBigMemberUsers(field, doFunc)
+		(&Ent{}).LoadBigMemberUsers(field, doFunc)
+		log.Println("定时任务,大会员到期提醒,推送消息结束")
+	})
 }
 
 // 查看是否有大会员用户定时开启会员
 func checkMemberIsStart() {
-    crontab(true, TimeTaskConfig.MemberIsStart, func() {
-        defer qutil.Catch()
-        log.Println("定时任务,开始更新大会员状态-定时开启会员状态")
-        now_unix := time.Now().Unix()
-        sess := util.MQFW.GetMgoConn()
-        for {
-            if sess != nil {
-                defer util.MQFW.DestoryMongoConn(sess)
-                break
-            }
-            time.Sleep(time.Minute)
-            sess = util.MQFW.GetMgoConn()
-        }
-        //定时开启大会员  i_member_status<0 && i_member_endtime 结束时间大于当前时间 && i_member_starttime 开始时间小于当前时间
-        it := sess.DB("qfw").C("user").Find(map[string]interface{}{
-            "i_appid": 2,
-            "i_member_status": map[string]interface{}{
-                "$lt": 0,
-            },
-            "$and": []map[string]interface{}{
-                map[string]interface{}{
-                    "i_member_endtime": map[string]interface{}{
-                        "$gte": now_unix,
-                    },
-                },
-                map[string]interface{}{
-                    "i_member_starttime": map[string]interface{}{
-                        "$lte": now_unix,
-                    },
-                },
-            },
-        }).Select(map[string]interface{}{"i_member_status": 1, "i_member_endtime": 1, "i_member_starttime": 1}).Iter()
-        for m := make(map[string]interface{}); it.Next(&m); {
-            log.Println("企业用户权益开通生效", BsonIdToSId(m["_id"]), m["user_phone"])
-            _id := BsonIdToSId(m["_id"])
-            i_member_endtime := qutil.Int64All(m["i_member_endtime"])
-            i_member_starttime := qutil.Int64All(m["i_member_starttime"])
-            i_member_status := qutil.IntAll(m["i_member_status"])
-            if i_member_endtime > now_unix && i_member_starttime <= now_unix {
-                util.Compatible.Update(_id, map[string]interface{}{
-                    "$set": map[string]interface{}{
-                        "i_member_status": -i_member_status,
-                    },
-                })
-                //大会员用户服务表更新
-                updateBigMemberService(_id, now_unix)
-                positionId := util.MongoIdToPositionId(_id)
-                ok := jy.ClearBigVipUserPower(positionId)
-                config.Middleground.UserCenter.WorkDesktopClearUserInfo(pb.WorkDesktopClearUserInfoReq{
-                    PositionId: positionId,
-                    AppId:      "10000",
-                })
-                config.Middleground.PowerCheckCenter.DelCheckRedis("10000", qutil.Int64All(positionId))
-                if !ok {
-                    log.Println("清除 redis 大会员服务详情 缓存失败:", _id)
-                }
-            }
-            m = make(map[string]interface{})
-        }
-        log.Println("定时任务,更新大会员状态结束-定时开启会员状态")
-    })
+	crontab(true, TimeTaskConfig.MemberIsStart, func() {
+		defer qutil.Catch()
+		log.Println("定时任务,开始更新大会员状态-定时开启会员状态")
+		now_unix := time.Now().Unix()
+		sess := util.MQFW.GetMgoConn()
+		for {
+			if sess != nil {
+				defer util.MQFW.DestoryMongoConn(sess)
+				break
+			}
+			time.Sleep(time.Minute)
+			sess = util.MQFW.GetMgoConn()
+		}
+		//定时开启大会员  i_member_status<0 && i_member_endtime 结束时间大于当前时间 && i_member_starttime 开始时间小于当前时间
+		it := sess.DB("qfw").C("user").Find(map[string]interface{}{
+			"i_appid": 2,
+			"i_member_status": map[string]interface{}{
+				"$lt": 0,
+			},
+			"$and": []map[string]interface{}{
+				map[string]interface{}{
+					"i_member_endtime": map[string]interface{}{
+						"$gte": now_unix,
+					},
+				},
+				map[string]interface{}{
+					"i_member_starttime": map[string]interface{}{
+						"$lte": now_unix,
+					},
+				},
+			},
+		}).Select(map[string]interface{}{"i_member_status": 1, "i_member_endtime": 1, "i_member_starttime": 1}).Iter()
+		for m := make(map[string]interface{}); it.Next(&m); {
+			log.Println("企业用户权益开通生效", BsonIdToSId(m["_id"]), m["user_phone"])
+			_id := BsonIdToSId(m["_id"])
+			i_member_endtime := qutil.Int64All(m["i_member_endtime"])
+			i_member_starttime := qutil.Int64All(m["i_member_starttime"])
+			i_member_status := qutil.IntAll(m["i_member_status"])
+			if i_member_endtime > now_unix && i_member_starttime <= now_unix {
+				util.Compatible.Update(_id, map[string]interface{}{
+					"$set": map[string]interface{}{
+						"i_member_status": -i_member_status,
+					},
+				})
+				//大会员用户服务表更新
+				updateBigMemberService(_id, now_unix)
+				positionId := util.MongoIdToPositionId(_id)
+				ok := jy.ClearBigVipUserPower(positionId)
+				config.Middleground.UserCenter.WorkDesktopClearUserInfo(pb.WorkDesktopClearUserInfoReq{
+					PositionId: positionId,
+					AppId:      "10000",
+				})
+				config.Middleground.PowerCheckCenter.DelCheckRedis("10000", qutil.Int64All(positionId))
+				if !ok {
+					log.Println("清除 redis 大会员服务详情 缓存失败:", _id)
+				}
+			}
+			m = make(map[string]interface{})
+		}
+		log.Println("定时任务,更新大会员状态结束-定时开启会员状态")
+	})
 }
 
 // 查看企业版大会员、超级订阅是否开通
 func checkEntIsStart() {
-    crontab(true, TimeTaskConfig.MemberIsStart, func() {
-        defer qutil.Catch()
-        log.Println("定时任务,开始更新大会员状态-定时开启会员状态")
-        now_unix := time.Now().Unix()
-        sess := util.MQFW.GetMgoConn()
-        for {
-            if sess != nil {
-                defer util.MQFW.DestoryMongoConn(sess)
-                break
-            }
-            time.Sleep(time.Minute)
-            sess = util.MQFW.GetMgoConn()
-        }
-        count, _ := sess.DB("qfw").C(CollEntUser).Find(map[string]interface{}{
-            "$or": []map[string]interface{}{
-                {"i_member_status": map[string]interface{}{
-                    "$lt": 0},
-                    "$and": []map[string]interface{}{
-                        map[string]interface{}{
-                            "i_member_endtime": map[string]interface{}{
-                                "$gte": now_unix,
-                            },
-                        },
-                        map[string]interface{}{
-                            "i_member_starttime": map[string]interface{}{
-                                "$lte": now_unix,
-                            },
-                        },
-                    }},
-                {"i_vip_status": map[string]interface{}{
-                    "$lt": 0},
-                    "$and": []map[string]interface{}{
-                        map[string]interface{}{
-                            "l_vip_endtime": map[string]interface{}{
-                                "$gte": now_unix,
-                            },
-                        },
-                        map[string]interface{}{
-                            "l_vip_starttime": map[string]interface{}{
-                                "$lte": now_unix,
-                            },
-                        },
-                    }},
-            },
-        }).Select(map[string]interface{}{"i_member_status": 1, "i_member_endtime": 1, "i_member_starttime": 1, "i_vip_status": 1, "l_vip_starttime": 1, "l_vip_endtime": 1, "i_entid": 1, "i_userid": 1}).Count()
+	crontab(true, TimeTaskConfig.MemberIsStart, func() {
+		defer qutil.Catch()
+		log.Println("定时任务,开始更新大会员状态-定时开启会员状态")
+		now_unix := time.Now().Unix()
+		sess := util.MQFW.GetMgoConn()
+		for {
+			if sess != nil {
+				defer util.MQFW.DestoryMongoConn(sess)
+				break
+			}
+			time.Sleep(time.Minute)
+			sess = util.MQFW.GetMgoConn()
+		}
+		count, _ := sess.DB("qfw").C(CollEntUser).Find(map[string]interface{}{
+			"$or": []map[string]interface{}{
+				{"i_member_status": map[string]interface{}{
+					"$lt": 0},
+					"$and": []map[string]interface{}{
+						map[string]interface{}{
+							"i_member_endtime": map[string]interface{}{
+								"$gte": now_unix,
+							},
+						},
+						map[string]interface{}{
+							"i_member_starttime": map[string]interface{}{
+								"$lte": now_unix,
+							},
+						},
+					}},
+				{"i_vip_status": map[string]interface{}{
+					"$lt": 0},
+					"$and": []map[string]interface{}{
+						map[string]interface{}{
+							"l_vip_endtime": map[string]interface{}{
+								"$gte": now_unix,
+							},
+						},
+						map[string]interface{}{
+							"l_vip_starttime": map[string]interface{}{
+								"$lte": now_unix,
+							},
+						},
+					}},
+			},
+		}).Select(map[string]interface{}{"i_member_status": 1, "i_member_endtime": 1, "i_member_starttime": 1, "i_vip_status": 1, "l_vip_starttime": 1, "l_vip_endtime": 1, "i_entid": 1, "i_userid": 1}).Count()
 
-        log.Println("企业定时任务时间:", now_unix, count)
-        //定时开启大会员  i_member_status<0 && i_member_endtime 结束时间大于当前时间 && i_member_starttime 开始时间小于当前时间
-        it := sess.DB("qfw").C(CollEntUser).Find(map[string]interface{}{
-            "$or": []map[string]interface{}{
-                {"i_member_status": map[string]interface{}{
-                    "$lt": 0},
-                    "$and": []map[string]interface{}{
-                        map[string]interface{}{
-                            "i_member_endtime": map[string]interface{}{
-                                "$gte": now_unix,
-                            },
-                        },
-                        map[string]interface{}{
-                            "i_member_starttime": map[string]interface{}{
-                                "$lte": now_unix,
-                            },
-                        },
-                    }},
-                {"i_vip_status": map[string]interface{}{
-                    "$lt": 0},
-                    "$and": []map[string]interface{}{
-                        map[string]interface{}{
-                            "l_vip_endtime": map[string]interface{}{
-                                "$gte": now_unix,
-                            },
-                        },
-                        map[string]interface{}{
-                            "l_vip_starttime": map[string]interface{}{
-                                "$lte": now_unix,
-                            },
-                        },
-                    }},
-            },
-        }).Select(map[string]interface{}{"i_member_status": 1, "i_member_endtime": 1, "i_member_starttime": 1, "i_vip_status": 1, "l_vip_starttime": 1, "l_vip_endtime": 1, "i_entid": 1, "i_userid": 1}).Iter()
-        for m := make(map[string]interface{}); it.Next(&m); {
-            _id := BsonIdToSId(m["_id"])
-            i_member_endtime := qutil.Int64All(m["i_member_endtime"])
-            i_member_starttime := qutil.Int64All(m["i_member_starttime"])
-            i_member_status := qutil.IntAll(m["i_member_status"])
-            l_vip_endtime := qutil.Int64All(m["l_vip_endtime"])
-            l_vip_starttime := qutil.Int64All(m["l_vip_starttime"])
-            i_vip_status := qutil.IntAll(m["i_vip_status"])
-            i_userid := qutil.IntAll(m["i_userid"])
-            if i_member_endtime > now_unix && i_member_starttime <= now_unix {
-                util.MQFW.UpdateById(CollEntUser, _id, map[string]interface{}{
-                    "$set": map[string]interface{}{
-                        "i_member_status": -i_member_status,
-                    },
-                })
-            }
-            if l_vip_endtime > now_unix && l_vip_starttime <= now_unix {
-                util.MQFW.UpdateById(CollEntUser, _id, map[string]interface{}{
-                    "$set": map[string]interface{}{
-                        "i_vip_status": -i_vip_status,
-                    },
-                })
-            }
-            // 清缓存
-            go clearEntCache(i_userid)
-            m = make(map[string]interface{})
-        }
-        log.Println("定时任务,更新企业版大会员、超级订阅状态结束-定时开启会员状态")
-    })
+		log.Println("企业定时任务时间:", now_unix, count)
+		//定时开启大会员  i_member_status<0 && i_member_endtime 结束时间大于当前时间 && i_member_starttime 开始时间小于当前时间
+		it := sess.DB("qfw").C(CollEntUser).Find(map[string]interface{}{
+			"$or": []map[string]interface{}{
+				{"i_member_status": map[string]interface{}{
+					"$lt": 0},
+					"$and": []map[string]interface{}{
+						map[string]interface{}{
+							"i_member_endtime": map[string]interface{}{
+								"$gte": now_unix,
+							},
+						},
+						map[string]interface{}{
+							"i_member_starttime": map[string]interface{}{
+								"$lte": now_unix,
+							},
+						},
+					}},
+				{"i_vip_status": map[string]interface{}{
+					"$lt": 0},
+					"$and": []map[string]interface{}{
+						map[string]interface{}{
+							"l_vip_endtime": map[string]interface{}{
+								"$gte": now_unix,
+							},
+						},
+						map[string]interface{}{
+							"l_vip_starttime": map[string]interface{}{
+								"$lte": now_unix,
+							},
+						},
+					}},
+			},
+		}).Select(map[string]interface{}{"i_member_status": 1, "i_member_endtime": 1, "i_member_starttime": 1, "i_vip_status": 1, "l_vip_starttime": 1, "l_vip_endtime": 1, "i_entid": 1, "i_userid": 1}).Iter()
+		for m := make(map[string]interface{}); it.Next(&m); {
+			_id := BsonIdToSId(m["_id"])
+			i_member_endtime := qutil.Int64All(m["i_member_endtime"])
+			i_member_starttime := qutil.Int64All(m["i_member_starttime"])
+			i_member_status := qutil.IntAll(m["i_member_status"])
+			l_vip_endtime := qutil.Int64All(m["l_vip_endtime"])
+			l_vip_starttime := qutil.Int64All(m["l_vip_starttime"])
+			i_vip_status := qutil.IntAll(m["i_vip_status"])
+			i_userid := qutil.IntAll(m["i_userid"])
+			if i_member_endtime > now_unix && i_member_starttime <= now_unix {
+				util.MQFW.UpdateById(CollEntUser, _id, map[string]interface{}{
+					"$set": map[string]interface{}{
+						"i_member_status": -i_member_status,
+					},
+				})
+			}
+			if l_vip_endtime > now_unix && l_vip_starttime <= now_unix {
+				util.MQFW.UpdateById(CollEntUser, _id, map[string]interface{}{
+					"$set": map[string]interface{}{
+						"i_vip_status": -i_vip_status,
+					},
+				})
+			}
+			// 清缓存
+			go clearEntCache(i_userid)
+			m = make(map[string]interface{})
+		}
+		log.Println("定时任务,更新企业版大会员、超级订阅状态结束-定时开启会员状态")
+	})
 }
 
 // 企业版账号清权益缓存
 func clearEntCache(userId int) {
 
-    identity := config.Middleground.UserCenter.IdentityByEntUserId(int64(userId))
-    if identity == nil {
-        return
-    }
-    positionId := fmt.Sprint(identity.PositionId)
-    ok := jy.ClearBigVipUserPower(positionId)
-    config.Middleground.UserCenter.WorkDesktopClearUserInfo(pb.WorkDesktopClearUserInfoReq{
-        PositionId: positionId,
-        AppId:      "10000",
-    })
-    config.Middleground.PowerCheckCenter.DelCheckRedis("10000", qutil.Int64All(positionId))
-    if !ok {
-        log.Println("清除 redis 大会员超级订阅服务详情 缓存失败:", positionId)
-    }
+	identity := config.Middleground.UserCenter.IdentityByEntUserId(int64(userId))
+	if identity == nil {
+		return
+	}
+	positionId := fmt.Sprint(identity.PositionId)
+	ok := jy.ClearBigVipUserPower(positionId)
+	config.Middleground.UserCenter.WorkDesktopClearUserInfo(pb.WorkDesktopClearUserInfoReq{
+		PositionId: positionId,
+		AppId:      "10000",
+	})
+	config.Middleground.PowerCheckCenter.DelCheckRedis("10000", qutil.Int64All(positionId))
+	if !ok {
+		log.Println("清除 redis 大会员超级订阅服务详情 缓存失败:", positionId)
+	}
 
 }
 
 // 大会员更新用户服务表
 func updateBigMemberService(userId string, now_unix int64) {
-    now_time := FormatDateByInt64(&now_unix, Date_Full_Layout)
-    userServiceList := util.Mysql.SelectBySql(`select * from  `+jy.BigmemberUserPowerTable+` where s_userid=? AND i_status = 1 AND l_starttime <= ? AND l_endtime > ?`, userId, now_time, now_time)
-    if len(*userServiceList) > 0 {
-        for _, v := range *userServiceList {
-            var serviceid = v["s_serviceid"]
-            if util.Mysql.UpdateOrDeleteBySql(`UPDATE `+jy.BigmemberUserPowerTable+` a SET  a.i_status = 0 , a.l_updatetime=? WHERE a.s_userid = ? AND a.s_serviceid = ? `, now_time, userId, serviceid) < 0 {
-                log.Println(userId, "开启大会员用户服务表出错")
-            }
-        }
-    }
+	now_time := FormatDateByInt64(&now_unix, Date_Full_Layout)
+	userServiceList := util.Mysql.SelectBySql(`select * from  `+jy.BigmemberUserPowerTable+` where s_userid=? AND i_status = 1 AND l_starttime <= ? AND l_endtime > ?`, userId, now_time, now_time)
+	if len(*userServiceList) > 0 {
+		for _, v := range *userServiceList {
+			var serviceid = v["s_serviceid"]
+			if util.Mysql.UpdateOrDeleteBySql(`UPDATE `+jy.BigmemberUserPowerTable+` a SET  a.i_status = 0 , a.l_updatetime=? WHERE a.s_userid = ? AND a.s_serviceid = ? `, now_time, userId, serviceid) < 0 {
+				log.Println(userId, "开启大会员用户服务表出错")
+			}
+		}
+	}
 }
 
 // 大会员用户服务表  用户服务是否需要开启或关闭
 func checkMemberServiceIsExpire() {
-    crontab(true, TimeTaskConfig.MemberServiceIsExpire, func() {
-        defer qutil.Catch()
-        log.Println("定时任务,更新大会员服务表状态开始")
-        now_unix := time.Now().Unix()
-        now_time := FormatDateByInt64(&now_unix, Date_Full_Layout)
-        //待使用服务更新状态 wait & 服务到期更新状态 overdue
-        wooList := util.Mysql.SelectBySql(`SELECT * FROM `+jy.BigmemberUserPowerTable+` a WHERE (a.i_status = 1 AND a.l_starttime <= ? AND a.l_endtime > ?) OR (a.i_status = 0 AND  a.l_endtime < ?)`, now_time, now_time, now_time)
-        if len(*wooList) > 0 {
-            // log.Println(len(*wooList), "-----:", wooList)
-            var useridMap = map[string]bool{}
-            for _, v := range *wooList {
-                var starttime int64 = -1
-                var endtime int64 = -1
-                var serviceid = v["s_serviceid"]
-                var userid = v["s_userid"]
-                if !useridMap[userid.(string)] {
-                    useridMap[userid.(string)] = true
-                }
-                if thisTime, err := time.ParseInLocation(Date_Full_Layout, v["l_starttime"].(string), time.Local); err == nil {
-                    starttime = thisTime.Unix()
-                }
-                if thisTime, err := time.ParseInLocation(Date_Full_Layout, v["l_endtime"].(string), time.Local); err == nil {
-                    endtime = thisTime.Unix()
-                }
-                if starttime <= now_unix && endtime > now_unix {
-                    if util.Mysql.UpdateOrDeleteBySql(`UPDATE `+jy.BigmemberUserPowerTable+` a SET  a.i_status = 0, a.l_updatetime=? WHERE a.s_userid = ? AND a.s_serviceid = ? `, now_time, userid, serviceid) < 0 {
-                        log.Println(userid, "开启大会员用户服务表出错")
-                    }
-                } else if endtime < now_unix {
-                    if util.Mysql.UpdateOrDeleteBySql(`UPDATE `+jy.BigmemberUserPowerTable+` a SET a.i_frequency = 0 , a.i_status = -1, a.l_updatetime=? WHERE a.s_userid = ? AND a.s_serviceid = ?`, now_time, userid, serviceid) < 0 {
-                        log.Println(userid, "关闭大会员用户服务表出错")
-                    }
-                }
-            }
-            // log.Println("useridMap:", useridMap)
-            if useridMap != nil && len(useridMap) > 0 {
-                for k, _ := range useridMap {
-                    positionId := util.MongoIdToPositionId(k)
-                    ok := jy.ClearBigVipUserPower(positionId)
-                    config.Middleground.UserCenter.WorkDesktopClearUserInfo(pb.WorkDesktopClearUserInfoReq{
-                        PositionId: positionId,
-                        AppId:      "10000",
-                    })
-                    config.Middleground.PowerCheckCenter.DelCheckRedis("10000", qutil.Int64All(positionId))
-                    if !ok {
-                        log.Println("清除 redis 大会员服务详情 缓存失败:", k)
-                    }
+	crontab(true, TimeTaskConfig.MemberServiceIsExpire, func() {
+		defer qutil.Catch()
+		log.Println("定时任务,更新大会员服务表状态开始")
+		now_unix := time.Now().Unix()
+		now_time := FormatDateByInt64(&now_unix, Date_Full_Layout)
+		//待使用服务更新状态 wait & 服务到期更新状态 overdue
+		wooList := util.Mysql.SelectBySql(`SELECT * FROM `+jy.BigmemberUserPowerTable+` a WHERE (a.i_status = 1 AND a.l_starttime <= ? AND a.l_endtime > ?) OR (a.i_status = 0 AND  a.l_endtime < ?)`, now_time, now_time, now_time)
+		if len(*wooList) > 0 {
+			// log.Println(len(*wooList), "-----:", wooList)
+			var useridMap = map[string]bool{}
+			for _, v := range *wooList {
+				var starttime int64 = -1
+				var endtime int64 = -1
+				var serviceid = v["s_serviceid"]
+				var userid = v["s_userid"]
+				if !useridMap[userid.(string)] {
+					useridMap[userid.(string)] = true
+				}
+				if thisTime, err := time.ParseInLocation(Date_Full_Layout, v["l_starttime"].(string), time.Local); err == nil {
+					starttime = thisTime.Unix()
+				}
+				if thisTime, err := time.ParseInLocation(Date_Full_Layout, v["l_endtime"].(string), time.Local); err == nil {
+					endtime = thisTime.Unix()
+				}
+				if starttime <= now_unix && endtime > now_unix {
+					if util.Mysql.UpdateOrDeleteBySql(`UPDATE `+jy.BigmemberUserPowerTable+` a SET  a.i_status = 0, a.l_updatetime=? WHERE a.s_userid = ? AND a.s_serviceid = ? `, now_time, userid, serviceid) < 0 {
+						log.Println(userid, "开启大会员用户服务表出错")
+					}
+				} else if endtime < now_unix {
+					if util.Mysql.UpdateOrDeleteBySql(`UPDATE `+jy.BigmemberUserPowerTable+` a SET a.i_frequency = 0 , a.i_status = -1, a.l_updatetime=? WHERE a.s_userid = ? AND a.s_serviceid = ?`, now_time, userid, serviceid) < 0 {
+						log.Println(userid, "关闭大会员用户服务表出错")
+					}
+				}
+			}
+			// log.Println("useridMap:", useridMap)
+			if useridMap != nil && len(useridMap) > 0 {
+				for k, _ := range useridMap {
+					positionId := util.MongoIdToPositionId(k)
+					ok := jy.ClearBigVipUserPower(positionId)
+					config.Middleground.UserCenter.WorkDesktopClearUserInfo(pb.WorkDesktopClearUserInfoReq{
+						PositionId: positionId,
+						AppId:      "10000",
+					})
+					config.Middleground.PowerCheckCenter.DelCheckRedis("10000", qutil.Int64All(positionId))
+					if !ok {
+						log.Println("清除 redis 大会员服务详情 缓存失败:", k)
+					}
 
-                }
-            }
-        }
-        log.Println("定时任务,更新大会员服务表状态结束")
-    })
+				}
+			}
+		}
+		log.Println("定时任务,更新大会员服务表状态结束")
+	})
 }
 
 func updateTimeLimitActitityOrderStatus() { //修改限时活动的订单状态
-    crontabByTicker(true, TimeTaskConfig.UpdateTimeLimitActivityOrderStatus, func() {
-        defer qutil.Catch()
-        log.Println("定时任务,更新限时活动订单状态开始")
-        now := time.Now().Add(-time.Duration(config.Config.ActivityOrderCountdown) * time.Minute)
-        //获取倒计时时间
-        starttime := now.Format(Date_Full_Layout)
-        limitTime := 20 //默认二十秒
-        if strings.Contains(TimeTaskConfig.UpdateTimeLimitActivityOrderStatus, "s") {
-            cStr := strings.Split(TimeTaskConfig.UpdateTimeLimitActivityOrderStatus, "s")[0]
-            limitTime, _ = strconv.Atoi(cStr)
-        }
-        endtime := now.Add(-time.Duration(limitTime) * time.Second).Format(Date_Full_Layout)
-        data := util.Mysql.SelectBySql(`select * from dataexport_order where order_status =0 and  expiration_time>=? and expiration_time<? and is_backstage_order = 0`, starttime, endtime)
-        log.Println(fmt.Sprintf(`select * from dataexport_order where order_status =0 and  expiration_time<%s and expiration_time>=%s`, starttime, endtime))
-        if data != nil && len(*data) > 0 {
-            for _, v := range *data {
-                //对公转账审核中不取消卡券
-                if gconv.String(v["pay_way"]) == "transferAccounts" && gconv.Int64(v["course_status"]) == 2 {
-                    continue
-                }
-                //订单编号
-                order_code, _ := v["order_code"].(string)
-                productType := 0 //取消卡券的时候 需要这个参数  商品类型0普通的1线上课程
-                if product_type, _ := v["product_type"].(string); product_type != "中标必听课" {
-                    productType = 1
-                }
-                flag := false
-                if qutil.IntAll(v["order_status"]) == 0 && qutil.IntAll(v["is_backstage_order"]) == 0 && qutil.ObjToString(v["pay_way"]) != "transferAccounts" { //未支付状态下 删除订单需要先关闭订单
-                    flag = pay.CloseDataExportOrder(qutil.ObjToString(v["pay_way"]), qutil.ObjToString(v["out_trade_no"]), qutil.ObjToString(v["prepay_time"]))
-                }
-                if flag || (!(qutil.IntAll(v["course_status"]) == 2 || qutil.IntAll(v["course_status"]) == 4)) && qutil.ObjToString(v["pay_way"]) == "transferAccounts" && qutil.IntAll(v["is_backstage_order"]) == 0 { //对公转账非审核中 和 转账成功 状态下超时取消订单
-                    queryMap := map[string]interface{}{
-                        "order_code": order_code,
-                    }
-                    flag = util.Mysql.Update("dataexport_order", queryMap, map[string]interface{}{"order_status": -2})
-                }
+	crontabByTicker(true, TimeTaskConfig.UpdateTimeLimitActivityOrderStatus, func() {
+		defer qutil.Catch()
+		log.Println("定时任务,更新限时活动订单状态开始")
+		now := time.Now().Add(-time.Duration(config.Config.ActivityOrderCountdown) * time.Minute)
+		//获取倒计时时间
+		starttime := now.Format(Date_Full_Layout)
+		limitTime := 20 //默认二十秒
+		if strings.Contains(TimeTaskConfig.UpdateTimeLimitActivityOrderStatus, "s") {
+			cStr := strings.Split(TimeTaskConfig.UpdateTimeLimitActivityOrderStatus, "s")[0]
+			limitTime, _ = strconv.Atoi(cStr)
+		}
+		endtime := now.Add(-time.Duration(limitTime) * time.Second).Format(Date_Full_Layout)
+		data := util.Mysql.SelectBySql(`select * from dataexport_order where order_status =0 and  expiration_time>=? and expiration_time<? and is_backstage_order = 0`, starttime, endtime)
+		log.Println(fmt.Sprintf(`select * from dataexport_order where order_status =0 and  expiration_time<%s and expiration_time>=%s`, starttime, endtime))
+		if data != nil && len(*data) > 0 {
+			for _, v := range *data {
+				//对公转账审核中不取消卡券
+				if gconv.String(v["pay_way"]) == "transferAccounts" && gconv.Int64(v["course_status"]) == 2 {
+					continue
+				}
+				//订单编号
+				order_code, _ := v["order_code"].(string)
+				productType := 0 //取消卡券的时候 需要这个参数  商品类型0普通的1线上课程
+				if product_type, _ := v["product_type"].(string); product_type != "中标必听课" {
+					productType = 1
+				}
+				flag := false
+				if qutil.IntAll(v["order_status"]) == 0 && qutil.IntAll(v["is_backstage_order"]) == 0 && qutil.ObjToString(v["pay_way"]) != "transferAccounts" { //未支付状态下 删除订单需要先关闭订单
+					flag = pay.CloseDataExportOrder(qutil.ObjToString(v["pay_way"]), qutil.ObjToString(v["out_trade_no"]), qutil.ObjToString(v["prepay_time"]))
+				}
+				if flag || (!(qutil.IntAll(v["course_status"]) == 2 || qutil.IntAll(v["course_status"]) == 4)) && qutil.ObjToString(v["pay_way"]) == "transferAccounts" && qutil.IntAll(v["is_backstage_order"]) == 0 { //对公转账非审核中 和 转账成功 状态下超时取消订单
+					queryMap := map[string]interface{}{
+						"order_code": order_code,
+					}
+					flag = util.Mysql.Update("dataexport_order", queryMap, map[string]interface{}{"order_status": -2})
+				}
 
-                if !flag {
-                    log.Println("mysql 订单更新失败", order_code)
-                } else {
-                    //解除卡卷绑定
-                    //用户领取卡卷的记录id
-                    userLotteryId, _ := v["d_relation_id"].(string)
-                    if userLotteryId != "" {
-                        //用户id
-                        userId, _ := v["user_id"].(string)
-                        go func(userId, userLotteryId, order_code string) {
-                            if !util.UpdateCouponState(userId, userLotteryId, "", "", order_code, qutil.ObjToString(v["product_type"]), "0", 0, productType) {
-                                log.Println(fmt.Sprintf("单号%s-解绑失败-卡卷%s", order_code, userLotteryId))
-                            }
-                        }(userId, userLotteryId, order_code)
-                    }
-                }
-            }
-        }
-        log.Println("定时任务,更新限时活动订单结束")
-    })
+				if !flag {
+					log.Println("mysql 订单更新失败", order_code)
+				} else {
+					//解除卡卷绑定
+					//用户领取卡卷的记录id
+					userLotteryId, _ := v["d_relation_id"].(string)
+					if userLotteryId != "" {
+						//用户id
+						userId, _ := v["user_id"].(string)
+						go func(userId, userLotteryId, order_code string) {
+							if !util.UpdateCouponState(userId, userLotteryId, "", "", order_code, qutil.ObjToString(v["product_type"]), "0", 0, productType) {
+								log.Println(fmt.Sprintf("单号%s-解绑失败-卡卷%s", order_code, userLotteryId))
+							}
+						}(userId, userLotteryId, order_code)
+					}
+				}
+			}
+		}
+		log.Println("定时任务,更新限时活动订单结束")
+	})
 }
 
 func crontab(flag bool, c string, f func()) {
-    array := strings.Split(c, ":")
-    if len(array) != 2 {
-        log.Fatalln("定时任务参数错误!", c)
-    }
-    if flag {
-        go f()
-    }
-    now := time.Now()
-    t := time.Date(now.Year(), now.Month(), now.Day(), qutil.IntAll(array[0]), qutil.IntAll(array[1]), 0, 0, time.Local)
-    if t.Before(now) {
-        t = t.AddDate(0, 0, 1)
-    }
-    timer := time.NewTimer(t.Sub(now))
-    for {
-        select {
-        case <-timer.C:
-            go f()
-            timer.Reset(24 * time.Hour)
-        }
-    }
+	array := strings.Split(c, ":")
+	if len(array) != 2 {
+		log.Fatalln("定时任务参数错误!", c)
+	}
+	if flag {
+		go f()
+	}
+	now := time.Now()
+	t := time.Date(now.Year(), now.Month(), now.Day(), qutil.IntAll(array[0]), qutil.IntAll(array[1]), 0, 0, time.Local)
+	if t.Before(now) {
+		t = t.AddDate(0, 0, 1)
+	}
+	timer := time.NewTimer(t.Sub(now))
+	for {
+		select {
+		case <-timer.C:
+			go f()
+			timer.Reset(24 * time.Hour)
+		}
+	}
 }
 
 func crontabByTicker(flag bool, c string, f func()) {
-    if c == "0" {
-        log.Println("定时任务参数有误:", c)
-        return
-    }
-    countdown := 5 * 60
-    if strings.Contains(c, "h") {
-        cStr := strings.Split(c, "h")[0]
-        countdown, _ = strconv.Atoi(cStr)
-        countdown = countdown * 60 * 60
-    } else if strings.Contains(c, "s") {
-        cStr := strings.Split(c, "s")[0]
-        countdown, _ = strconv.Atoi(cStr)
-        countdown = countdown
-    } else {
-        countdown, _ = strconv.Atoi(c)
-        countdown = countdown * 60
-    }
-    if flag {
-        go f()
-    }
-    ticker := time.NewTicker(time.Duration(countdown) * time.Second)
-    go func(t *time.Ticker) {
-        for {
-            select {
-            case <-t.C:
-                go f()
-                fmt.Println("get ticker", time.Now().Format("2006-01-02 15:04:05"))
-            }
-        }
-    }(ticker)
+	if c == "0" {
+		log.Println("定时任务参数有误:", c)
+		return
+	}
+	countdown := 5 * 60
+	if strings.Contains(c, "h") {
+		cStr := strings.Split(c, "h")[0]
+		countdown, _ = strconv.Atoi(cStr)
+		countdown = countdown * 60 * 60
+	} else if strings.Contains(c, "s") {
+		cStr := strings.Split(c, "s")[0]
+		countdown, _ = strconv.Atoi(cStr)
+		countdown = countdown
+	} else {
+		countdown, _ = strconv.Atoi(c)
+		countdown = countdown * 60
+	}
+	if flag {
+		go f()
+	}
+	ticker := time.NewTicker(time.Duration(countdown) * time.Second)
+	go func(t *time.Ticker) {
+		for {
+			select {
+			case <-t.C:
+				go f()
+				fmt.Println("get ticker", time.Now().Format("2006-01-02 15:04:05"))
+			}
+		}
+	}(ticker)
 }
 
 func checkDocMemberIsExpire(iy Identity) {
-    crontab(true, TimeTaskConfig.CheckDocMemberIsExpire, func() {
-        defer qutil.Catch()
-        log.Println("定时任务,开始更新文库会员状态")
-        now_unix := time.Now().Unix()
-        sess := util.MQFW.GetMgoConn()
-        for {
-            if sess != nil {
-                defer util.MQFW.DestoryMongoConn(sess)
-                break
-            }
-            time.Sleep(time.Minute)
-            sess = util.MQFW.GetMgoConn()
-        }
-        query := iy.UserQuery()
-        query["i_doc_status"] = map[string]interface{}{
-            "$gt": 0,
-        }
-        query["l_doc_endtime"] = map[string]interface{}{
-            "$lte": now_unix,
-        }
-        count, err := sess.DB("qfw").C(iy.UserColl()).Find(query).Count()
-        log.Println("当前时间:", FormatDateByInt64(&now_unix, Date_Full_Layout), "数据总量:", count, "--err:", err)
-        var i int64 = 0
-        it := sess.DB("qfw").C(iy.UserColl()).Find(query).Select(iy.UserField(map[string]interface{}{"i_doc_status": 1, "l_doc_endtime": 1, "i_userid": 1, "i_entid": 1, "base_user_id": 1, "o_vipjy": 1})).Iter()
-        for m := make(map[string]interface{}); it.Next(&m); {
-            i++
-            _id := BsonIdToSId(m["_id"])
-            l_doc_endtime := qutil.Int64All(m["l_doc_endtime"])
-            i_doc_status := qutil.IntAll(m["i_doc_status"])
-            if l_doc_endtime <= now_unix {
-                ok := util.MQFW.UpdateById(iy.UserColl(), _id, map[string]interface{}{
-                    "$set": map[string]interface{}{
-                        "i_doc_status": -i_doc_status,
-                    },
-                })
-                if !ok {
-                    log.Println("用户:", _id, " 更新doc状态异常")
-                } else {
-                    var (
-                        identity   *pb.Identity
-                        entUserId  = qutil.Int64All(m["i_userid"])
-                        baseUserId = qutil.Int64All(m["base_user_id"])
-                    )
-                    if iy.UserColl() == CollEntUser {
-                        identity = util.Compatible.Middleground.UserCenter.IdentityByEntUserId(entUserId)
-                    } else {
-                        identity = util.Compatible.Middleground.UserCenter.IdentityByUserId(baseUserId)
-                    }
-                    go config.Middleground.UserCenter.WorkDesktopClearUserInfo(pb.WorkDesktopClearUserInfoReq{
-                        PositionId: strconv.Itoa(int(identity.PositionId)),
-                        AppId:      "10000",
-                    })
-                    go config.Middleground.PowerCheckCenter.DelCheckRedis("10000", identity.PositionId)
-                }
-                m = make(map[string]interface{})
-            }
-        }
-        if i != count {
-            log.Println("更新doc状态有异常,已处理:", i, "总量:", count)
-        }
-        log.Println("doc 已处理:", i, "总量:", count)
-        log.Println("定时任务,更新doc状态结束")
-    })
+	crontab(true, TimeTaskConfig.CheckDocMemberIsExpire, func() {
+		defer qutil.Catch()
+		log.Println("定时任务,开始更新文库会员状态")
+		now_unix := time.Now().Unix()
+		sess := util.MQFW.GetMgoConn()
+		for {
+			if sess != nil {
+				defer util.MQFW.DestoryMongoConn(sess)
+				break
+			}
+			time.Sleep(time.Minute)
+			sess = util.MQFW.GetMgoConn()
+		}
+		query := iy.UserQuery()
+		query["i_doc_status"] = map[string]interface{}{
+			"$gt": 0,
+		}
+		query["l_doc_endtime"] = map[string]interface{}{
+			"$lte": now_unix,
+		}
+		count, err := sess.DB("qfw").C(iy.UserColl()).Find(query).Count()
+		log.Println("当前时间:", FormatDateByInt64(&now_unix, Date_Full_Layout), "数据总量:", count, "--err:", err)
+		var i int64 = 0
+		it := sess.DB("qfw").C(iy.UserColl()).Find(query).Select(iy.UserField(map[string]interface{}{"i_doc_status": 1, "l_doc_endtime": 1, "i_userid": 1, "i_entid": 1, "base_user_id": 1, "o_vipjy": 1})).Iter()
+		for m := make(map[string]interface{}); it.Next(&m); {
+			i++
+			_id := BsonIdToSId(m["_id"])
+			l_doc_endtime := qutil.Int64All(m["l_doc_endtime"])
+			i_doc_status := qutil.IntAll(m["i_doc_status"])
+			if l_doc_endtime <= now_unix {
+				ok := util.MQFW.UpdateById(iy.UserColl(), _id, map[string]interface{}{
+					"$set": map[string]interface{}{
+						"i_doc_status": -i_doc_status,
+					},
+				})
+				if !ok {
+					log.Println("用户:", _id, " 更新doc状态异常")
+				} else {
+					var (
+						identity   *pb.Identity
+						entUserId  = qutil.Int64All(m["i_userid"])
+						baseUserId = qutil.Int64All(m["base_user_id"])
+					)
+					if iy.UserColl() == CollEntUser {
+						identity = util.Compatible.Middleground.UserCenter.IdentityByEntUserId(entUserId)
+					} else {
+						identity = util.Compatible.Middleground.UserCenter.IdentityByUserId(baseUserId)
+					}
+					go config.Middleground.UserCenter.WorkDesktopClearUserInfo(pb.WorkDesktopClearUserInfoReq{
+						PositionId: strconv.Itoa(int(identity.PositionId)),
+						AppId:      "10000",
+					})
+					go config.Middleground.PowerCheckCenter.DelCheckRedis("10000", identity.PositionId)
+				}
+				m = make(map[string]interface{})
+			}
+		}
+		if i != count {
+			log.Println("更新doc状态有异常,已处理:", i, "总量:", count)
+		}
+		log.Println("doc 已处理:", i, "总量:", count)
+		log.Println("定时任务,更新doc状态结束")
+	})
+}
+
+func ZmUserEquityRecovery(userTable string) {
+	yesterday := time.Now().Add(-time.Hour * 10)
+	now := time.Date(yesterday.Year(),
+		yesterday.Month(),
+		yesterday.Day(),
+		23, 59, 59, 0,
+		time.Local)
+	crontab(false, TimeTaskConfig.ZmUserEquityRecovery, func() {
+		queryMap := map[string]interface{}{"i_zhima_number": 1, "i_zhima_status": 1, "_id": 1, "i_zhima_endtime": 1, "i_zhima_starttime": 1}
+		if userTable == CollEntUser {
+			queryMap["i_userid"] = 1
+		}
+		sess := util.MQFW.GetMgoConn()
+		it := sess.DB("qfw").C(userTable).Find(map[string]interface{}{
+			"i_zhima_status": map[string]interface{}{
+				"$gt": 0},
+		}).Select(queryMap).Iter()
+		for m := make(map[string]interface{}); it.Next(&m); {
+			userId := BsonIdToSId(m["_id"])
+			if userTable == CollEntUser {
+				identity := config.Middleground.UserCenter.IdentityByEntUserId(gconv.Int64(m["i_userid"]))
+				if identity == nil {
+					continue
+				}
+				userId = fmt.Sprint(identity.PositionId)
+			}
+
+			i_zhima_endtime := qutil.Int64All(m["i_zhima_endtime"])
+			i_zhima_starttime := qutil.Int64All(m["i_zhima_starttime"])
+			i_zhima_status := qutil.IntAll(m["i_zhima_status"])
+			i_zhima_number := qutil.IntAll(m["i_zhima_number"])
+
+			zhimaEndtime := time.Unix(i_zhima_endtime, 0)
+			zhimaStarttime := time.Unix(i_zhima_starttime, 0)
+			for zhimaEndtime.After(zhimaStarttime) {
+				newZmTime := zhimaStarttime.AddDate(0, 1, 0)
+				if newZmTime.Format("2006-01-02") == now.Format("2006-01-02") {
+					log.Println("每月芝麻权益重新分配", userId, newZmTime.Format("2006-01-02"), now.Format("2006-01-02"))
+					var (
+						number int
+					)
+					//计算周期内数量
+					balanceDetails := util.Mysql.CountBySql("SELECT count(1)  FROM bid_credit_report where create_time>=? and mold>0 and user_id =? and pack_type>0", FormatDate(&zhimaStarttime, Date_Full_Layout), userId)
+					number = i_zhima_number - gconv.Int(balanceDetails)
+					if number > 0 {
+						util.Mysql.Insert("bid_credit_balance_details", map[string]interface{}{
+							"user_id":        userId,
+							"pack_type":      i_zhima_status,
+							"operation":      3,
+							"number":         -number,
+							"residue_number": 0,
+							"create_time":    time.Now().Format(Date_Full_Layout),
+						})
+					}
+					if newZmTime.Format("2006-01-02") != time.Unix(i_zhima_endtime, 0).Format("2006-01-02") {
+						util.Mysql.Insert("bid_credit_balance_details", map[string]interface{}{
+							"user_id":        userId,
+							"pack_type":      i_zhima_status,
+							"operation":      4,
+							"number":         i_zhima_number,
+							"residue_number": i_zhima_number,
+							"create_time":    time.Now().Format(Date_Full_Layout),
+						})
+					}
+					break
+				}
+				zhimaStarttime = newZmTime
+			}
+			if i_zhima_endtime <= now.Unix() {
+				util.MQFW.UpdateById(userTable, BsonIdToSId(m["_id"]), map[string]interface{}{
+					"$set": map[string]interface{}{
+						"i_zhima_status": -i_zhima_status,
+					},
+				})
+			}
+			// 清缓存
+			m = make(map[string]interface{})
+		}
+	})
+
 }

+ 30 - 0
src/jfw/modules/subscribepay/src/zm_analysis_report.yaml

@@ -2,6 +2,11 @@
 # 首购优惠额度   例如原价 99900  首次购买价格为 29900  则优惠额度为 70000
 FirstDiscount:
   1511: 70000
+comboDiscount:
+  1512: 100000
+  1513: 173300
+  1514: 400000
+
 
 # 支付回调告警配置
 WebhookURL:
@@ -15,3 +20,28 @@ ExampleUrl:
     url: /common-module/pdf/【剑鱼标讯】采购单位分析报告.pdf
 EnvSwitch: false
 EnvPhone: 15737190152
+
+exampleType:
+  - pack_type: 1
+    id: 1512
+    price: 999
+    number: 20
+    day: 30
+    first: 299
+  - pack_type: 2
+    id: 1513
+    price: 1666
+    number: 30
+    day: 90
+    first: 299
+  - pack_type: 3
+    id: 1514
+    price: 3888
+    number: 40
+    day: 365
+    first: 299
+
+guidingCopy:
+  buyer: "采购单位文案"
+  ent: "企业单位文案"
+  zhima: "芝麻文案"

+ 8 - 1
src/web/staticres/big-member/css/unit_portrayal.css

@@ -45,9 +45,16 @@
 .van-tabs__nav {
     align-items: center;
 }
-.van-tab__pane {
+.van-tab__pane:not(:first-child) {
     margin-top: .24rem;
 }
+.banner-container{
+  padding: .24rem .32rem;
+  background: #fff;
+}
+.history-list{
+  margin-top: .32rem;
+}
 .buyer-tabs-container {
     flex: 1;
 }

+ 9 - 3
src/web/staticres/big-member/js/unit_portrayal.js

@@ -10,6 +10,7 @@ var vNode = {
       forwardshare: vmForward,
       mobilePortrayalFooter:mobilePortrayalFooter,
       downloadpopup: downloadpopup,
+      mobileReportBanner: mobileReportBanner
     },
     data() {
         // 修改柱状条颜色为渐变色
@@ -179,9 +180,10 @@ var vNode = {
             unitParams: {},
             follow:false, // 是否监控,
             allpower:{},
-          pageScrollTop: 0,
-                // 下载弹窗需要用的参数
-        balance:0, //定制下载余额
+            pageScrollTop: 0,
+            // 下载弹窗需要用的参数
+            balance:0, //定制下载余额
+            reportBtnInfo: {}
         }
     },
     computed: {
@@ -1988,6 +1990,10 @@ var vNode = {
               _this.onDtTextClick(type)
             }
           }
+        },
+        getReportBtnInfo: function(data) {
+          console.log(data,'report-info')
+          this.reportBtnInfo = data
         }
     }
 }

+ 4 - 0
src/web/staticres/big-member/weixin/css/ent_portrait.css

@@ -680,4 +680,8 @@
 }
 .sesame-container .sesame-main.expanded {
   height: auto!important;
+}
+.banner-container{
+  padding: .24rem .32rem .24rem;
+  background: #fff;
 }

+ 5 - 1
src/web/staticres/common-module/big-member/css/client_portrayal.css

@@ -45,9 +45,13 @@
 .van-tabs__nav {
     align-items: center;
 }
-.van-tab__pane {
+.van-tab__pane:not(:first-child) {
     margin-top: .24rem;
 }
+.banner-container{
+  padding: .24rem .32rem;
+  background: #fff;
+}
 .buyer-tabs-container {
     flex: 1;
 }

+ 8 - 0
src/web/staticres/common-module/big-member/js/client_portrayal.js

@@ -9,6 +9,7 @@ var vNode = {
     forwardshare: vmForward,
     mobilePortrayalFooter:mobilePortrayalFooter,
     downloadpopup: downloadpopup,
+    mobileReportBanner: mobileReportBanner
   },
   data() {
       // 修改柱状条颜色为渐变色
@@ -183,6 +184,9 @@ var vNode = {
           clientParams: {},
           pageScrollTop: 0,
           balance:0, //定制下载余额
+          reportBtnInfo: {
+            buyerBtn: false
+          }
       }
   },
   computed: {
@@ -1867,6 +1871,10 @@ var vNode = {
         if (type === 'customer') {
           utils.goToCustomerPage()
         }
+      },
+      getReportBtnInfo: function(data) {
+        console.log(data,'report-info')
+        this.reportBtnInfo = data
       }
   }
 }

+ 9 - 1
src/web/staticres/common-module/collection/js/ent_portrait.js

@@ -11,6 +11,7 @@ var vNode = {
     mobilePortrayalFooter:mobilePortrayalFooter,
     mobilePortrayalGroupingScript: mobilePortrayalGroupingScript,
     downloadpopup: downloadpopup,
+    mobileReportBanner: mobileReportBanner
   },
   data () {
     // 修改柱状条颜色为渐变色
@@ -211,7 +212,10 @@ var vNode = {
         wx: 'wx_ent_limit',
         h5: 'h5_ent_limit'
       },
-      setGroupState: '' // 如果为put说明是企业画像-已监控-更改
+      setGroupState: '', // 如果为put说明是企业画像-已监控-更改
+      reportBtnInfo: {
+        entBtn: false
+      }
     }
   },
   created: function () {
@@ -1916,6 +1920,10 @@ var vNode = {
           _this.onDtTextClick(type)
         }
       }
+    },
+    getReportBtnInfo: function(data) {
+      console.log(data,'report-info')
+      this.reportBtnInfo = data
     }
   }
 }

+ 71 - 5
src/web/staticres/common-module/mobile-portrayal-footer/css/mobile-portrayal-footer.css

@@ -192,14 +192,16 @@ color: #9B9CA3;
   right: .2rem;
   left: unset;
 }
-.activity-tips-box {
+.tips-container{
   display: flex;
   justify-content: center;
-  margin: .24rem auto 0;
 }
-.activity-tips{
-  display: inline-flex;
+.highlight-tip-box {
+  display: flex;
+  justify-content: center;
+  margin: .24rem auto 0;
   align-items: center;
+  min-width: 2rem;
   padding: .02rem .24rem;
   background: rgba(42, 190, 209, 0.12);
   color: #2ABED1;
@@ -207,6 +209,17 @@ color: #9B9CA3;
   line-height: .36rem;
   border-radius: 4px;
 }
+.gray-tip-box{
+  margin-top: .24rem;
+  color: #9B9CA3;
+  font-size: .22rem;
+  line-height: .32rem;
+  text-align: center;
+}
+.gray-tip-box .highlight-text{
+  font-size: .22rem;
+  line-height: .32rem;
+}
 .report-info-item{
   margin-top: .24rem;
 }
@@ -220,4 +233,57 @@ color: #9B9CA3;
   background-size: contain;
   transform: translateX(-50%);
   z-index: 10;
-}
+}
+.package-container{
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  width: 2.4rem;
+  height: .44rem;
+  margin: .24rem auto 0;
+  border-radius: 8px 2px 8px 2px;
+  font-weight: 600;
+}
+.package-icon{
+  width: 12px;
+  height: 10px;
+  background-repeat: no-repeat;
+  background-position: center center;
+  background-size: 100% 100%;
+  margin-right: 4px;
+}
+.package-icon.package-icon-month{
+  background-image: url(../images/crown-month.png);
+}
+.package-icon.package-icon-season{
+  background-image: url(../images/crown-season.png);
+}
+.package-icon.package-icon-year{
+  background-image: url(../images/crown-year.png);
+}
+.package-type{
+  margin-right: 2px;
+  font-size: 13px;
+}
+.package-vip{
+  font-size: 12px;
+  font-style: italic;
+}
+.package-container.month{
+  background: #2ABED1;
+  color: #fff;
+}
+.package-container.season{
+  background:#F1D090;
+  color: #33323A;
+}
+.package-container.season .package-vip{
+  color: #1B1A2A;
+}
+.package-container.year{
+  background: #1B1A2A;
+  color: #F1D090;
+}
+.package-container.year .package-vip{
+  color: #FAE7CA;
+}

+ 35 - 0
src/web/staticres/common-module/mobile-portrayal-footer/css/mobile-report-banner.css

@@ -0,0 +1,35 @@
+.mobile-report-banner{
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  padding: .12rem 0;
+  border: 0.5px solid#87DFEA;
+  border-radius: 8px;
+  background:#2ABED11F;
+}
+.mobile-report-banner .market-text{
+  display: inline-flex;
+  align-items: center;
+  padding: 0 8px;
+  margin-right: 4px;
+  border-radius: 8px 2px 8px 2px;
+  font-size: .22rem;
+  height: .36rem;
+  color: #fff;
+  background: linear-gradient(101.8deg, #2ABED1 0%, #0A6CFF 100%);
+}
+.mobile-report-banner .report-action{
+  display: flex;
+  align-items: center;
+  font-size: .28rem;
+  line-height: .4rem;
+  color: #2ABED1;
+}
+.mobile-report-banner .report-action-img{
+  display: inline-block;
+  width: .4rem;
+  height: .4rem;
+  margin-right: 4px;
+  background: url('../images/reportDownload.png') no-repeat center center;
+  background-size: contain;
+}

BIN
src/web/staticres/common-module/mobile-portrayal-footer/images/crown-month.png


BIN
src/web/staticres/common-module/mobile-portrayal-footer/images/crown-season.png


BIN
src/web/staticres/common-module/mobile-portrayal-footer/images/crown-year.png


BIN
src/web/staticres/common-module/mobile-portrayal-footer/images/reportDownload.png


+ 236 - 106
src/web/staticres/common-module/mobile-portrayal-footer/js/mobile-portrayal-footer.js

@@ -24,7 +24,7 @@ var mobileportrayalfootertemp = `
       <div class="footer-item" @click="onClickReport" v-bound-phone="bindPhoneDownLoad()" v-if="downshow">
         <div class="footer-xz">
         </div>
-        <span class="new-img" v-if="reportBtnInfo.entBtn || reportBtnInfo.buyerBtn"></span>
+        <span class="new-img" v-if="reportBtnInfo.isNew"></span>
         <p class="footer-text">下载报告</p>
       </div>
       <div class="monitor-box report-popover-box" :style="{'top': reportPopoverTop }" v-show="showReportPopover">
@@ -33,14 +33,15 @@ var mobileportrayalfootertemp = `
           </p>
         </div>
         <div class="monitor-box-item" v-if="reportBtnInfo.entBtn || reportBtnInfo.buyerBtn">
-          <p class="look-desc">芝麻信用共建分析报告</p>
+          <p class="look-desc">招投标综合分析</p>
+          <p v-if="isPackage" class="package-container" :class="packageClass">
+            <span class="package-icon" :class="'package-icon-' + packageClass" />
+            <span class="package-type">{{ packageText }}</span>
+            <span class="package-vip">VIP</span>
+          </p>
           <p class="look-text report-info-item" v-if="reportBtnInfo.entBtn" @click="onAnalysis('competitor')">供应商分析报告</p>
           <p class="look-text report-info-item" v-if="reportBtnInfo.buyerBtn" @click="onAnalysis('buyer')">采购单位分析报告</p>
-          <div class="activity-tips-box" v-if="reportBtnInfo.discountText"> 
-            <p class="activity-tips">
-              <span>{{reportBtnInfo.discountText}}</span>
-            </p>
-          </div>
+          <div v-if="discountText" v-html="discountText" class="tips-container"></div>
         </div>
       </div>
       <div class="monitor-box" :class="{'action': monitorGroupShow }" v-show="monitorboxShow">
@@ -64,6 +65,7 @@ var mobileportrayalfootertemp = `
   </div>
   </div>
 `
+
 var mobilePortrayalFooter = {
   name: 'mobilePortrayalFooter',
   template: mobileportrayalfootertemp,
@@ -138,6 +140,13 @@ var mobilePortrayalFooter = {
           h5: 'h5_buyer_monitor_limit'
         }
       }
+    },
+    // ent 企业画像
+    // unit 采购单位画像
+    // project 项目详情
+    type: {
+      type: String,
+      default: ''
     }
   },
   data: function () {
@@ -158,8 +167,7 @@ var mobilePortrayalFooter = {
         crnMap: {},
         projectReportId: '',
         entReportIds: {},
-        buyerReportId: '',
-        discountText: ''
+        buyerReportId: ''
       }
     }
   },
@@ -172,7 +180,60 @@ var mobilePortrayalFooter = {
   computed: {
     setMonitorObj () {
       return this.portraitOrigin === 'ent' ? '企业' : '业主'
-    }
+    },
+    packageInfo() {
+      return this.reportBtnInfo.zmAnalysis
+    },
+    isPackage() {
+      return this.packageInfo.zmStatus && this.packageInfo.zmStatus > 0
+    },
+    packageText() {
+      var status = this.packageInfo.zmStatus
+      if (status === 1) {
+        return '月卡'
+      } else if (status === 2) {
+        return '季卡'
+      } else if (status === 3) {
+        return '年卡'
+      } else {
+        return ''
+      }
+    },
+    packageClass() {
+      var status = this.packageInfo.zmStatus
+      if (status === 1) {
+        return 'month'
+      } else if (status === 2) {
+        return 'season'
+      } else if (status === 3) {
+        return 'year'
+      } else {
+        return ''
+      }
+    },
+    discountText() {
+      var packageType = this.packageInfo.zmStatus
+      var balance = this.packageInfo.zmNumber
+      var total = this.packageInfo.zmAllNumber
+      var price = this.packageInfo.comboOne
+      var expiredDay = this.packageInfo.expiredDay
+      var discountMsg = this.reportBtnInfo.discount_msg
+      if (packageType > 0) {
+        if (balance > 0) {
+          return `<div class="gray-tip-box">本月报告下载额度:<span class="highlight-text">${balance}</span>/${total}</div>`
+        } else {
+          return `<p class="gray-tip-box">本月免费额度已用完<br>享受会员特价:<span class="highlight-text">${price}/份</span></p>`
+        }
+      } else {
+        // packageType < 0:套餐过期天数
+        // 其他:首购优惠等
+        if (packageType < 0 && expiredDay) {
+          return `<div class="gray-tip-box">您的权益已过期${expiredDay}天,<br>开通权益享特惠</div>`
+        } else {
+          return  discountMsg ? `<div class="highlight-tip-box">${discountMsg}</div>` : `<p class="gray-tip-box"><span class="highlight-text">开通招投标综合分析权益,<br>看报告更优惠!</span></p>`
+        }
+      }
+    },
   },
  watch: {
   islogin (val){
@@ -295,7 +356,7 @@ var mobilePortrayalFooter = {
           window.location.href = '/jyapp/big/page/client_list'
         }
       }
-      
+
     },
     lookMore (){
       if(this.portraitOrigin === 'ent'){
@@ -438,113 +499,182 @@ var mobilePortrayalFooter = {
     },
        //  采购单位监控点击相关结束
    // 转给同事相关
-  onCallback (data) {
-    if (data.type === 'close') {
-      this.showIframe = false
-    }
-  },
-  setShareEvent () {
-    console.info('xxx')
-    let params = this.params
-    sessionStorage.setItem('share-query--login-clear', JSON.stringify(params))
-    this.showIframe = false
-    this.$nextTick(() => {
-      this.showIframe = true
-    })
-  },
-  bindPhoneSetShare: function () {
-    var _this = this
-    return {
-      props: {
-        name: _this.portraitOrigin === 'ent' ? '企业画像-转给同事' : '采购单位画像-转给同事'
-      },
-      next: function () {
-        _this.setShareEvent()
+    onCallback (data) {
+      if (data.type === 'close') {
+        this.showIframe = false
       }
-    }
-  },
-  bindPhoneDownLoad: function () {
-    var _this = this
-    return {
-      props: {
-        name: _this.portraitOrigin === 'ent' ? '企业画像-下载报告' : '采购单位画像-下载报告'
-      },
-      next: function () {
-        if (_this.reportBtnInfo.entBtn || _this.reportBtnInfo.buyerBtn) {
-          _this.onClickReport()
-        } else {
-          _this.downLoad()
+    },
+    setShareEvent () {
+      console.info('xxx')
+      let params = this.params
+      sessionStorage.setItem('share-query--login-clear', JSON.stringify(params))
+      this.showIframe = false
+      this.$nextTick(() => {
+        this.showIframe = true
+      })
+    },
+    bindPhoneSetShare: function () {
+      var _this = this
+      return {
+        props: {
+          name: _this.portraitOrigin === 'ent' ? '企业画像-转给同事' : '采购单位画像-转给同事'
+        },
+        next: function () {
+          _this.setShareEvent()
         }
       }
-    }
-  },
-  bindPhoneMonitor: function(){
-    var _this = this
-    return {
-      props: {
-        name: _this.portraitOrigin === 'ent' ? '企业画像-监控' : '采购单位画像-监控'
-      },
-      next: function () {
-        _this.monitorClick()
+    },
+    bindPhoneDownLoad: function () {
+      var _this = this
+      return {
+        props: {
+          name: _this.portraitOrigin === 'ent' ? '企业画像-下载报告' : '采购单位画像-下载报告'
+        },
+        next: function () {
+          if (_this.reportBtnInfo.entBtn || _this.reportBtnInfo.buyerBtn) {
+            _this.onClickReport()
+          } else {
+            _this.downLoad()
+          }
+        }
       }
-    }
-  },
-  getReportBtnInfo: function() {
-    var _this = this
-    var params = {}
-    if (this.portraitOrigin === 'ent') {
-      params.ent_name = this.entInfo.name
-    } else {
-      params.buyer = decodeURIComponent(utils.getParam('entName'))
-    }
-    if(this.portraitOrigin === 'ent') {
-      if (!params.ent_name) return
-    } else {
-      if (!params.buyer) return
-    }
-    $.ajax({
-      type: 'POST',
-      url: '/subscribepay/bidCreditReport/getButton',
-      data: params,
-      success: function(res) {
-        if (res.error_code === 0 && res.data) {
-          _this.reportBtnInfo.entBtn = res.data.ent_report_button
-          _this.reportBtnInfo.buyerBtn = res.data.buyer_report_button
-          _this.reportBtnInfo.crnMap = res.data.ent_crn
-          _this.reportBtnInfo.entReportIds = res.data.ent_report_ids
-          _this.reportBtnInfo.projectReportId = res.data.project_report_id
-          _this.reportBtnInfo.buyerReportId = res.data.buyer_report_id
-          _this.reportBtnInfo.discountText = res.data.discount_msg
-        } else {
-          console.log(res)
+    },
+    bindPhoneMonitor: function(){
+      var _this = this
+      return {
+        props: {
+          name: _this.portraitOrigin === 'ent' ? '企业画像-监控' : '采购单位画像-监控'
+        },
+        next: function () {
+          _this.monitorClick()
         }
       }
-    })
-  },
-  onClickReport: function() {
-    if (this.reportBtnInfo.entBtn || this.reportBtnInfo.buyerBtn) {
-      this.showReportPopover = !this.showReportPopover
-    }
-  },
-  onAnalysis: function() {
-    this.showReportPopover = false
-    if (this.portraitOrigin === 'ent') {
-      var entName = this.entInfo.name
-      var reportId = this.reportBtnInfo.entReportIds[entName] || ''
-      if (reportId) {
-        location.href = '/jy_mobile/report/analysis/detail?id=' + reportId
+    },
+    getReportBtnInfo: function() {
+      var _this = this
+      var params = {}
+      if (this.type === 'ent') {
+        params.ent_name = this.entInfo.name
       } else {
-        location.href = '/jy_mobile/order/create/analysis-report/competitor?name=' + entName
+        params.buyer = decodeURIComponent(utils.getParam('entName'))
+      }
+      // 企业画像页面 没有企业名称return
+      if(this.type === 'ent' && !params.ent_name) return
+      // 采购单位画像页面 没有采购单位 return
+      if (this.type === 'unit' && !params.buyer) return
+      // 项目详情页面 没有标讯id return
+      // if (this.type === 'project' && !params.bidding_id) return
+      $.ajax({
+        type: 'POST',
+        url: '/subscribepay/bidCreditReport/getButton',
+        data: params,
+        success: function(res) {
+          if (res.error_code === 0 && res.data) {
+            _this.reportBtnInfo.entBtn = res.data.ent_report_button
+            _this.reportBtnInfo.buyerBtn = res.data.buyer_report_button
+            _this.reportBtnInfo.crnMap = res.data.ent_crn
+            _this.reportBtnInfo.entReportIds = res.data.ent_report_ids
+            _this.reportBtnInfo.projectReportId = res.data.project_report_id
+            _this.reportBtnInfo.buyerReportId = res.data.buyer_report_id
+            Object.assign(_this.reportBtnInfo, res.data)
+            _this.$emit('report-info', _this.reportBtnInfo)
+          } else {
+            console.log(res)
+          }
+        }
+      })
+    },
+    onClickReport: function() {
+      if (this.reportBtnInfo.entBtn || this.reportBtnInfo.buyerBtn) {
+        this.showReportPopover = !this.showReportPopover
       }
-    } else {
-      var buyerName = decodeURIComponent(utils.getParam('entName'))
-      var reportId = this.reportBtnInfo.buyerReportId
+    },
+    onAnalysis: function() {
+      this.showReportPopover = false
+      var reportId = this.getReportId()
+      var _this = this
+      // console.log(reportId);
       if (reportId) {
         location.href = '/jy_mobile/report/analysis/detail?id=' + reportId
       } else {
-        location.href = '/jy_mobile/order/create/analysis-report/unit?name=' + buyerName
+        this.deductPackage(function(code, id){
+          console.log(code, id);
+          if (code === 0 && id) {
+            location.href = '/jy_mobile/report/analysis/detail?id=' + id
+            return
+          }
+          location.href = _this.getReportOrderUrl()
+        })
+      }
+    },
+    getReportOrderUrl: function() {
+      var url = ''
+      if (this.type === 'ent') {
+        var entName = this.entInfo.name
+        url = '/jy_mobile/order/create/analysis-report/competitor?name=' + entName
+      } else if (this.type === 'unit') {
+        var buyerName = decodeURIComponent(utils.getParam('entName'))
+        url = '/jy_mobile/order/create/analysis-report/unit?name=' + buyerName
+      } else if (this.type === 'project') {
+        // 暂无使用
+        // url = '/jy_mobile/order/create/analysis-report/project?name=' + this.projectName + '&id=' + this.bId + '&buyer=' + this.buyerName
+      }
+      return url
+    },
+    getReportId: function() {
+      var reportId = ''
+      var entName = this.entInfo.name
+      if (this.type === 'ent') {
+        reportId = this.reportBtnInfo.entReportIds[entName] || ''
+      } else if (this.type === 'unit') {
+        reportId = this.reportBtnInfo.buyerReportId
+      } else if (this.type === 'project') {
+        reportId = this.reportBtnInfo.projectReportId
+      }
+      return reportId
+    },
+    getReportMold: function() {
+      var type = this.type
+      var mold = 0
+      switch (type) {
+        case 'project':
+          mold = 1
+          break
+        case 'ent':
+          mold = 2
+          break
+        case 'unit':
+          mold = 3
+          break
+      }
+      return mold
+    },
+    deductPackage: function(callback) {
+      var params = {
+        ent_name: this.entInfo.name,
+        buyer: decodeURIComponent(utils.getParam('entName')),
+        report_mold: this.getReportMold(),
+        project_name: '', // 暂无使用场景
+        bidding_id: '' // 暂无使用场景
       }
+      var loading = this.$toast.loading({
+        duration: 0,
+        forbidClick: true,
+        message: 'loading...',
+      })
+      $.ajax({
+        type: 'POST',
+        url: '/subscribepay/zmComboConsumption',
+        data: params,
+        success: function(res) {
+          loading.clear()
+          callback && callback(res.error_code, res.data)
+        },
+        error: function() {
+          loading.clear()
+          callback && callback()
+        }
+      })
     }
   }
-  }
 }

+ 164 - 0
src/web/staticres/common-module/mobile-portrayal-footer/js/mobile-report-banner.js

@@ -0,0 +1,164 @@
+var mobileReportBannerTemp = `
+  <div class="mobile-report-banner">
+    <span class="market-text">{{ marketText }}</span>
+    <div class="report-action" @click="handleClickReport">
+      <span class="report-action-img"></span>
+      <span>{{ type | formatType(type) }}</span>
+      <i class="icon-arrow-right"></i>
+    </div>
+  </div>
+`
+var mobileReportBanner = {
+  name: 'mobileReportBanner',
+  template: mobileReportBannerTemp,
+  props: {
+    // 页面来源
+    origin: {
+      type: String,
+      default: ''
+    },
+    type: {
+      type: String,
+      default: ''
+    },
+    entName: {
+      type: String,
+      default: ''
+    },
+    buyerName: {
+      type: String,
+      default: ''
+    },
+    projectName: {
+      type: String,
+      default: ''
+    },
+    bId: {
+      type: String,
+      default: ''
+    },
+    info: {
+      type: Object,
+      default: () => {}
+    }
+  },
+  data: function () {
+    return {}
+  },
+  filters: {
+    formatType(type) {
+      if (type === 'ent') {
+        return '供应商分析报告'
+      }
+      if (type === 'unit') {
+        return '采购单位分析报告'
+      }
+      if (type === 'project') {
+        return '项目分析报告'
+      }
+    }
+  },
+  computed: {
+    // 营销文案
+    marketText: function() {
+      if (this.info && this.info.guidingCopy) {
+        var guidingCopy = this.info.guidingCopy
+        if (this.type === 'ent') {
+          return guidingCopy.ent || ''
+        } else if (this.type === 'unit') {
+          return guidingCopy.buyer || ''
+        } else if (this.type === 'project') {
+          return guidingCopy.project || ''
+        } else {
+          return ''
+        }
+      } else {
+        return ''
+      }
+    }
+  },
+  watch: {},
+  methods: {
+    getReportMold: function() {
+      var type = this.type
+      var mold = 0
+      switch (type) {
+        case 'project':
+          mold = 1
+          break
+        case 'ent':
+          mold = 2
+          break
+        case 'unit':
+          mold = 3
+          break
+      }
+      return mold
+    },
+    deductPackage: function(callback) {
+      var params = {
+        ent_name: this.entName,
+        buyer: this.buyerName,
+        report_mold: this.getReportMold(),
+        project_name: this.projectName,
+        bidding_id: this.bId
+      }
+      console.log(params, 'params')
+      var loading = this.$toast.loading({
+          duration: 0,
+          forbidClick: true,
+          message: 'loading...',
+      })
+      $.ajax({
+        type: 'POST',
+        url: '/subscribepay/zmComboConsumption',
+        data: params,
+        success: function(res) {
+          loading.clear()
+          callback && callback(res.error_code, res.data)
+        },
+        error: function() {
+          loading.clear()
+          callback && callback()
+        }
+      })
+    },
+    getReportId: function() {
+      var reportId = ''
+      if (this.type === 'ent') {
+        reportId = this.info.entReportIds[this.entName] || ''
+      } else if (this.type === 'unit') {
+        reportId = this.info.buyerReportId
+      } else if (this.type === 'project') {
+        reportId = this.info.projectReportId
+      }
+      return reportId
+    },
+    getReportOrderUrl: function() {
+      var url = ''
+      if (this.type === 'ent') {
+        url = '/jy_mobile/order/create/analysis-report/competitor?name=' + this.entName
+      } else if (this.type === 'unit') {
+        url = '/jy_mobile/order/create/analysis-report/unit?name=' + this.buyerName
+      } else if (this.type === 'project') {
+        url = '/jy_mobile/order/create/analysis-report/project?name=' + this.projectName + '&id=' + this.bId + '&buyer=' + this.buyerName
+      }
+      return url
+    },
+    handleClickReport: function(){
+      var reportId = this.getReportId()
+      var _this = this
+      if (reportId) {
+        location.href = '/jy_mobile/report/analysis/detail?id=' + reportId
+      } else {
+        this.deductPackage(function(code, id) {
+          if (code === 0 && id) {
+            location.href = '/jy_mobile/report/analysis/detail?id=' + id
+            return
+          }
+          location.href = _this.getReportOrderUrl()
+        })
+      }
+    }
+  }
+}

BIN
src/web/staticres/common-module/order-list/image/analysisReport.png


+ 33 - 14
src/web/staticres/common-module/order-list/js/order-detail.js

@@ -549,7 +549,7 @@ var vm = new Vue({
         //   infoList = this.getBidCreditReportInfo(order)
         //   break
         // }
-        case '芝麻信用共建分析报告':
+        case '招投标综合分析':
         {
           infoList = this.getZhimaOrderItemInfo(order)
           break
@@ -974,9 +974,16 @@ var vm = new Vue({
         duration: effectiveduration_vip
       }
     },
-    // 芝麻信用共建分析报告
+    // 招投标综合分析
     formatZhimaInfo(item) {
-      var result = {}
+      var levelMap = {
+        1: '月卡',
+        2: '季卡',
+        3: '年卡',
+      }
+      var result = {
+        level: levelMap[item.pack_type] || ''
+      }
       switch (item.report_mold) {
         case 1: {
           result.type = '项目分析报告'
@@ -1005,6 +1012,7 @@ var vm = new Vue({
         'target-before': info.before,
         'target-name': info.name,
         'target-email': data.email,
+        'target-level': info.level,
         report_mold: data.report_mold
       }))
     },
@@ -1014,17 +1022,6 @@ var vm = new Vue({
       var formatInfo = this.formatZhimaInfo(filterInfo)
       this.saveEchoInfo(order.order_code, formatInfo, filterInfo)
       var result = [
-        {
-          label: formatInfo.before,
-          split: ':',
-          text: formatInfo.name
-        },
-        {
-          label: '报告类型',
-          split: ':',
-          text: '芝麻信用共建分析报告<br>- ' + formatInfo.type,
-          type: formatInfo.type
-        },
         {
           label: '报告接收邮箱',
           className: 'max-4',
@@ -1033,6 +1030,28 @@ var vm = new Vue({
         }
       ]
 
+      if (formatInfo.level) {
+        result.unshift({
+          label: '权益规格',
+          split: ':',
+          text: formatInfo.level
+        })
+      } else {
+        result = [
+          {
+            label: formatInfo.before,
+            split: ':',
+            text: formatInfo.name
+          },
+          {
+            label: '报告类型',
+            split: ':',
+            text: '招投标综合分析<br>- ' + formatInfo.type,
+            type: formatInfo.type
+          },
+        ].concat(result)
+      }
+
       return result
     },
     goToLink: function (href) {

+ 4 - 4
src/web/staticres/common-module/order-list/js/order-list-config.js

@@ -16,7 +16,7 @@ var assetsConf = {
     '企业中标分析报告下载包':'enterpriseAnalysisLink',
     '业主采购分析报告下载包':'ownerAnalysisLink',
     '投标企业信用报告':'bidCreditReportLink',
-    '芝麻信用共建分析报告':'analysisReportLink'
+    '招投标综合分析':'analysisReportLink'
   },
   // 产品集合
   productionTypeList: [
@@ -43,7 +43,7 @@ var assetsConf = {
     '企业中标分析报告下载包',
     '业主采购分析报告下载包',
     '投标企业信息报告',
-    '芝麻信用共建分析报告'
+    '招投标综合分析'
   ],
   // 支持再次购买的产品集合
   canBuyAgainProductions: [
@@ -75,7 +75,7 @@ var assetsConf = {
     '企业中标分析报告下载包',
     '业主采购分析报告下载包',
     '投标企业信用报告',
-    '芝麻信用共建分析报告'
+    '招投标综合分析'
   ],
   init: function () {
     // this.getPlatform()
@@ -603,7 +603,7 @@ var assetsConf = {
       }
     }
   },
-    //  芝麻信用共建分析报告
+    //  招投标综合分析
   analysisReportLink: {
     pay: {
       wx: '/weixin/pay/checkout_analysisReport',

+ 33 - 15
src/web/staticres/common-module/order-list/js/order-list.js

@@ -884,7 +884,7 @@ var vm = new Vue({
           }
           break
         }
-        case '芝麻信用共建分析报告': {
+        case '招投标综合分析': {
           try {
             info.contentImgUrl = assetsConf.analysisReportLink.imgMap.headerImg[platform]
             info.contentList = this.getZhimaOrderItemInfo(order)
@@ -1407,7 +1407,7 @@ var vm = new Vue({
             this.goToLink(`${href}?orderCode=${orderCode}`)
           }
         }
-        case '芝麻信用共建分析报告': {
+        case '招投标综合分析': {
           var href = assetsConf.analysisReportLink.pay[platform]
           if (href) {
             this.goToLink(`${href}?orderCode=${orderCode}`)
@@ -1743,7 +1743,7 @@ var vm = new Vue({
           }
           break
         }
-        case '芝麻信用共建分析报告': {
+        case '招投标综合分析': {
           var href = assetsConf.analysisReportLink.orderDetail[platform]
           if (href) {
             goToFn(`${href}?order_code=${orderCode}`)
@@ -3220,9 +3220,16 @@ var vm = new Vue({
       var result = [prodType]
       return result
     },
-    // 芝麻信用共建分析报告
+    // 招投标综合分析
     formatZhimaInfo(item) {
-      var result = {}
+      var levelMap = {
+        1: '月卡',
+        2: '季卡',
+        3: '年卡',
+      }
+      var result = {
+        level: levelMap[item.pack_type] || ''
+      }
       switch (item.report_mold) {
         case 1: {
           result.type = '项目分析报告'
@@ -3251,6 +3258,7 @@ var vm = new Vue({
         'target-before': info.before,
         'target-name': info.name,
         'target-email': data.email,
+        'target-level': info.level,
         report_mold: data.report_mold
       }))
     },
@@ -3259,22 +3267,32 @@ var vm = new Vue({
       var formatInfo = this.formatZhimaInfo(filterInfo)
       this.saveEchoInfo(order.order_code, formatInfo, filterInfo)
       var result = [
-        {
-          label: '报告类型',
-          split: ':',
-          text: formatInfo.type
-        },
-        {
-          label: formatInfo.before,
-          split: ':',
-          text: formatInfo.name
-        },
         {
           label: '报告接收邮箱',
           split: ':',
           text: filterInfo.email
         }
       ]
+      if (formatInfo.level) {
+        result.unshift({
+          label: '权益规格',
+          split: ':',
+          text: formatInfo.level
+        })
+      } else {
+        result = [
+          {
+            label: '报告类型',
+            split: ':',
+            text: formatInfo.type
+          },
+          {
+            label: formatInfo.before,
+            split: ':',
+            text: formatInfo.name
+          },
+        ].concat(result)
+      }
       return result
     },
     // 剑鱼文库会员订单卡片信息整理

BIN
src/web/staticres/common-module/partner/image/C_06.png


+ 1 - 1
src/web/staticres/common-module/public/head.js

@@ -86,7 +86,7 @@
 
   try {
     // 初始化JTrack
-    var sdkVersion = 170
+    var sdkVersion = 180
     if (window.goTemplateData && window.goTemplateData.version) {
       sdkVersion = window.goTemplateData.version
     }

File diff suppressed because it is too large
+ 0 - 0
src/web/staticres/common-module/track/j-track.amd.min.js


File diff suppressed because it is too large
+ 0 - 0
src/web/staticres/common-module/track/j-track.es.min.js


File diff suppressed because it is too large
+ 0 - 0
src/web/staticres/common-module/track/j-track.min.js


+ 5 - 0
src/web/staticres/order/css/pay_success.css

@@ -279,6 +279,11 @@
   font-size: 16px;
 }
 
+.analysis-report-container.file-info.is-bold {
+  color: #1D1D1D;
+  font-size: 16px;
+  margin-top: 8px;
+}
 .analysis-report-container.file-info.is-hight {
   color: #2ABED1;
 }

+ 1 - 1
src/web/templates/big-member/pc/page_index.html

@@ -776,7 +776,7 @@
                 $('.ent-info-data').text(dataJSONObj.subscribe_ent_info_count + dataJSONObj.subscribe_ent_info_unit)
                 $('.buyer-info-data').text(dataJSONObj.subscribe_buyer_info_count + dataJSONObj.subscribe_buyer_info_unit)
                 $('.daily-update-data').text(dataJSONObj.subscribe_daily_update_count + dataJSONObj.subscribe_daily_update_unit)
-                
+
                 $('.total-push-unit').text(dataJSONObj.subscribe_total_push_unit)
                 $('.zb-info-unit').text(dataJSONObj.subscribe_zb_info_unit)
                 $('.project-unit').text(dataJSONObj.subscribe_project_unit)

+ 38 - 4
src/web/templates/big-member/wx/page_pro_follow_detail.html

@@ -1649,14 +1649,48 @@
               })
             },
             goProjectAnalysisReport: function() {
+              var _this = this
               if (this.projectReportId) {
                 location.href = '/jy_mobile/report/analysis/detail?id=' + this.projectReportId
               } else {
-                var id = this.sid
-                var buyer = this.prolist.buyer
-                var name = this.prolist.projectname
-                location.href = '/jy_mobile/order/create/analysis-report/project?id=' + id + '&name=' + name + '&buyer=' + buyer
+                this.deductPackage(function(code, data){
+                  if (code === 0 && data) {
+                    location.href = '/jy_mobile/report/analysis/detail?id=' + data
+                    return
+                  }
+                  var id = _this.sid
+                  var buyer = _this.prolist.buyer
+                  var name = _this.prolist.projectname
+                  location.href = '/jy_mobile/order/create/analysis-report/project?id=' + id + '&name=' + name + '&buyer=' + buyer
+                })
               }
+            },
+            deductPackage: function(callback) {
+              var params = {
+                buyer: this.prolist.buyer,
+                report_mold: 1,
+                project_name: this.prolist.projectname,
+                bidding_id: this.sid
+              }
+              console.log(params, 'params')
+              var loading = this.$toast.loading({
+                duration: 0,
+                forbidClick: true,
+                message: 'loading...'
+              })
+              $.ajax({
+                type: 'POST',
+                url: '/subscribepay/zmComboConsumption',
+                data: params,
+                success: function(res) {
+                  loading.clear()
+                  callback && callback(res.error_code, res.data)
+                },
+                error: function() {
+                  loading.clear()
+                  callback && callback()
+                }
+              })
             }
         }
     }

+ 6 - 1
src/web/templates/big-member/wx/page_unit_portrayal.html

@@ -41,6 +41,7 @@
   <link rel="stylesheet" type="text/css" href='{{Msg "seo" "cdn"}}/common-module/mobile-portrayal-footer/css/mobile-portrayal-footer.css?v={{Msg "seo" "version"}}'/>
   <link rel="stylesheet"
   href='{{Msg "seo" "cdn"}}/common-module/portrait/css/downloadpopup.css?v={{Msg "seo" "version"}}' />
+  <link rel="stylesheet" type="text/css" href='{{Msg "seo" "cdn"}}/common-module/mobile-portrayal-footer/css/mobile-report-banner.css?v={{Msg "seo" "version"}}'/>
   <style>
         .skeleton{
             height: 100%;
@@ -354,6 +355,9 @@
             :offset-top="stickyTop">
             <!-- 采购单位通讯录 -->
             <van-tab :name="moduleList[0].name" :title="moduleList[0].title">
+                <div class="banner-container" v-if="reportBtnInfo.buyerBtn">
+                  <mobile-report-banner type="unit" :buyer-name="buyer.name" :info="reportBtnInfo"></mobile-report-banner>
+                </div>
                 <!-- 免费用户采购单位全景分析提示 -->
                 <div v-if="getfreeBuyerPort" class="free-give">
                     <div class="go-text"> 免费赠送1次【采购单位全景分析】权益体验机会!</div>
@@ -794,7 +798,7 @@
       <downloadpopup ref="downloadpopup" :type="'unit'" :data="{'power':!getStatus,'portraitName':buyer.name,'searchcount':dt.total,'allmoney':statistics.buyerScale,'allcount':statistics.buyerCount,'otherone':statistics.winnerCount,'othertwo':statistics.otherWinner,balance}"></downloadpopup>
       <popup-data-export ref="popup_dataExport" @next="next_export"></popup-data-export>
         <!-- 底部按钮组件 -->
-    <mobile-portrayal-footer ref="portrayalFooter" @monitorclick="changeFollowState('g')" :islogin="userInfo.isLogin" :downshow="true" :monitorshow="true"  :monitor="follow" :params="unitParams" :shareshow="true" :allpower="allpower"></mobile-portrayal-footer>
+    <mobile-portrayal-footer ref="portrayalFooter" type="unit" @report-info="getReportBtnInfo" @monitorclick="changeFollowState('g')" :islogin="userInfo.isLogin" :downshow="true" :monitorshow="true"  :monitor="follow" :params="unitParams" :shareshow="true" :allpower="allpower"></mobile-portrayal-footer>
     <!--客服组件-->
     <customer-corner-component :scroll-status="pageScrollTop < 60" bottom-position="12%"></customer-corner-component>
     </div>
@@ -831,6 +835,7 @@
 <script src='{{Msg "seo" "cdn"}}/common-module/forward-share/js/forward.js?v={{Msg "seo" "version"}}'></script>
 <script src='{{Msg "seo" "cdn"}}/common-module/portrait/js/downloadpopup.js?v={{Msg "seo" "version"}}'></script>
 <script src='{{Msg "seo" "cdn"}}/common-module//mobile-portrayal-footer/js/mobile-portrayal-footer.js?v={{Msg "seo" "version"}}'></script>
+<script src='{{Msg "seo" "cdn"}}/common-module//mobile-portrayal-footer/js/mobile-report-banner.js?v={{Msg "seo" "version"}}'></script>
 <script src='{{Msg "seo" "cdn"}}/big-member/js/unit_portrayal.js?v={{Msg "seo" "version"}}'></script>
 <script src='{{Msg "seo" "cdn"}}/common-module/keep-tags/keep-tags-template.js?v={{Msg "seo" "version"}}'></script>
 <script src='{{Msg "seo" "cdn"}}/common-module/keep-tags/keep-ent-tags-template.js?v={{Msg "seo" "version"}}'></script>

+ 9 - 0
src/web/templates/frontRouter/wx/collection/sess/ent_portrait.html

@@ -30,6 +30,7 @@
         <link rel="stylesheet" type="text/css" href='{{Msg "seo" "cdn"}}/common-module/dataExport/css/popup-data-export.css?v={{Msg "seo" "version"}}'/>
         <link rel="stylesheet" type="text/css" href='{{Msg "seo" "cdn"}}/common-module/mobile-portrayal-footer/css/mobile-portrayal-footer.css?v={{Msg "seo" "version"}}'/>
         <link rel="stylesheet" type="text/css" href='{{Msg "seo" "cdn"}}/common-module/mobile-portrayal-footer/css/mobile-portrayal-grouping.css?v={{Msg "seo" "version"}}'/>
+        <link rel="stylesheet" type="text/css" href='{{Msg "seo" "cdn"}}/common-module/mobile-portrayal-footer/css/mobile-report-banner.css?v={{Msg "seo" "version"}}'/>
         <link rel="stylesheet" href='{{Msg "seo" "cdn"}}/common-module/portrait/css/downloadpopup.css?v={{Msg "seo" "version"}}' />
 </head>
 <style>
@@ -159,6 +160,10 @@
                 :offset-top="stickyTop">
                 <!-- 企业信息/工商信息 -->
                 <van-tab :name="moduleList[0].name" :title="moduleList[0].title">
+                    <!-- 芝麻分析报告banner-供应商分析报告 -->
+                    <div class="banner-container" v-if="reportBtnInfo.entBtn">
+                      <mobile-report-banner type="ent" :ent-name="entInfo.name" :info="reportBtnInfo"></mobile-report-banner>
+                    </div>
                     <!-- 芝麻信用标 -->
                     <div class="sesame-container" v-if="entBaseInfo.zhimaLabels">
                       <div class="sesame-header">
@@ -709,10 +714,12 @@
       @change="changeGroupState"
       @lookdynamic="lookDynamic"
       @monitorclick="changeFollowState"
+      @report-info="getReportBtnInfo"
       :downshow="true"
       :islogin="isLogin"
       :params="entParams"
       :shareshow="true"
+      type="ent"
       ></mobile-portrayal-footer>
     <!-- 分组组件 -->
     <mobile-portrayal-grouping-script
@@ -751,11 +758,13 @@
 <script src='{{Msg "seo" "cdn"}}/common-module/portrait/js/downloadpopup.js?v={{Msg "seo" "version"}}'></script>
 <script src='{{Msg "seo" "cdn"}}/common-module/mobile-portrayal-footer/js/mobile-portrayal-footer.js?v={{Msg "seo" "version"}}'></script>
 <script src='{{Msg "seo" "cdn"}}/common-module/mobile-portrayal-footer/js/mobile-portrayal-grouping.js?v={{Msg "seo" "version"}}'></script>
+<script src='{{Msg "seo" "cdn"}}/common-module//mobile-portrayal-footer/js/mobile-report-banner.js?v={{Msg "seo" "version"}}'></script>
 <script src='{{Msg "seo" "cdn"}}/common-module/collection/js/ent_portrait.js?v={{Msg "seo" "version"}}'></script>
 <script src='{{Msg "seo" "cdn"}}/common-module/keep-tags/keep-tags-template.js?v={{Msg "seo" "version"}}'></script>
 <script src='{{Msg "seo" "cdn"}}/common-module/keep-tags/keep-ent-tags-template.js?v={{Msg "seo" "version"}}'></script>
 <script src='{{Msg "seo" "cdn"}}/common-module/dataExport/components/popup-data-export.js?v={{Msg "seo" "version"}}'></script>
 <script src='{{Msg "seo" "cdn"}}/common-module/customer-corner/mobile-template.js?v={{Msg "seo" "version"}}'></script>
+
 <script>
   // 收藏组件
   var vKeepComponent = new Vue({

+ 1 - 1
src/web/templates/frontRouter/wx/mini-app/free/page_unit_portrayal.html

@@ -826,7 +826,7 @@
 <wx-share-guide tip="点击右上角,将页面分享给好友吧" v-model="guideMask" theme="red" :logo-mini="false"></wx-share-guide>
 <!-- end share -->
         <!-- 底部按钮组件 -->
-<mobile-portrayal-footer v-show="!chartLoading" ref="portrayalFooter" @minishareclick="doMiniAppShare" @monitorclick="changeFollowState" :islogin="userInfo.isLogin"  :monitorshow="true" :custom-monitor="true" :monitor="follow" :params="unitParams" :show-mini-app-share="true" :allpower="allpower"></mobile-portrayal-footer>
+<mobile-portrayal-footer v-show="!chartLoading" ref="portrayalFooter" type="unit" @minishareclick="doMiniAppShare" @monitorclick="changeFollowState" :islogin="userInfo.isLogin"  :monitorshow="true" :custom-monitor="true" :monitor="follow" :params="unitParams" :show-mini-app-share="true" :allpower="allpower"></mobile-portrayal-footer>
     </div>
   <div id="jyKeepComponent">
     <keep-component ref="vKeepComponent" @on-change-keep="changeKeepStatus" :bid="nowOpenBid" :first="false"></keep-component>

+ 18 - 3
src/web/templates/order/pc/analysisReport/detail.html

@@ -84,8 +84,9 @@
                 <div class="clearfix list_tbody">
                     <div class="filter_data">
                         <p><span class="pt_text">产品类型</span>:<span class="product_type"></span></p>
-                        <p><span>报告类型:</span><span class="product_type"></span> - <span class="target-type"></span></p>
-                        <p><span><span class="target-name-type"></span>:</span><span class="target-name"></span></p>
+                        <p class="target-level-module" style="display: none"><span>权益规格:</span><span class="target-level"></span></p>
+                        <p class="target-no-level-module" style="display: none"><span>报告类型:</span><span class="product_type"></span> - <span class="target-type"></span></p>
+                        <p class="target-no-level-module" style="display: none"><span><span class="target-name-type"></span>:</span><span class="target-name"></span></p>
                         <p class="show-status-success"><span>报告接收邮箱:</span><span class="email"></span></p>
                     </div>
                 </div>
@@ -230,7 +231,14 @@
             }
 
             function formatZhimaInfo(item) {
-              var result = {}
+              var levelMap = {
+                1: '月卡',
+                2: '季卡',
+                3: '年卡',
+              }
+              var result = {
+                level: levelMap[item.pack_type] || ''
+              }
               switch (item.report_mold) {
                 case 1: {
                   result.type = '项目分析报告'
@@ -262,6 +270,7 @@
                 'target-before': info.before,
                 'target-name': info.name,
                 'target-email': data.email,
+                'target-level': info.level,
                 report_mold: data.report_mold
               }))
             }
@@ -272,6 +281,12 @@
             $('.filter_data .target-type').text(formatInfo.type)
             $('.filter_data .target-name').text(formatInfo.name)
             $('.filter_data .target-name-type').text(formatInfo.before)
+            $('.filter_data .target-level').text(formatInfo.level)
+            if (formatInfo.level) {
+              $('.filter_data .target-level-module').show()
+            } else {
+              $('.filter_data .target-no-level-module').show()
+            }
             $('.filter_data .email').text(filterObj.email)
             $(".payOrder").on("click", function () {
               location.href = "/front/analysisReport/orderPay/" + orderCode;

+ 5 - 2
src/web/templates/order/pc/orderPay.html

@@ -45,11 +45,14 @@
                 {{else if eq .T.orderType "analysisReport"}}
                     <div class="t_left" style="padding-top: 18px;padding-bottom: 18px;">
                       <p class="analysis-report-container">
-                        芝麻信用共建分析报告
+                        招投标综合分析
                         <span name="target-type"></span>
                         <span class="target-split-line"></span>
                         <span name="target-before"></span>:
                         <span name="target-name"></span>
+                        <span class="target-split-line"></span>
+                        <span>权益规格:</span>
+                        <span name="target-level">单份</span>
                       </p>
                       <p>订单已提交成功,请尽快支付</p>
                     </div>
@@ -185,7 +188,7 @@
         function echoAnalysisReportInfo () {
           var cacheKey = 'analysis-report-' + orderCode
           var echoInfo = JSON.parse(sessionStorage.getItem(cacheKey) || '{}')
-          var echoMaps = ['target-type', 'target-name', 'target-before']
+          var echoMaps = ['target-type', 'target-name', 'target-before', 'target-level']
 
           for (let i = 0; i < echoMaps.length; i++) {
             var echoInfoKey = echoMaps[i]

+ 9 - 2
src/web/templates/order/pc/paySuccess.html

@@ -112,7 +112,10 @@
             {{else if eq .T.orderType "analysisReport"}}
               <p style="margin-top: 6px;"> 购买成功!</p>
               <p class="file-info datapackage-money-tip-group">¥<span name="file-price"></span></p>
-              <p class="analysis-report-container file-info" style="margin-top: 20px">下载的报告将发送至邮箱</p>
+              <p class="target-level-module analysis-report-container file-info" style="margin-top: 20px;display: none;">招投标综合分析</p>
+              <p class="target-level-module analysis-report-container file-info is-bold"  style="display: none;">权益卡:<span name="target-level"></span></p>
+
+              <p class="analysis-report-container file-info" style="margin-top: 16px">PDF版报告将发送至您的邮箱,请留意查收。</p>
               <p class="analysis-report-container file-info is-hight"><span name="target-email">{{.T.email}}</span></p>
             {{else}}
                 <p>支付成功!</p>
@@ -244,6 +247,7 @@
 
     var myPageNavIsNormal = true;
     var orderType = {{.T.orderType}}
+    var orderCode = {{.T.orderCode}}
 
     // 芝麻报告5S倒计时自动跳转
     if (orderType === 'analysisReport') {
@@ -363,7 +367,7 @@
     function echoAnalysisReportInfo () {
       var cacheKey = 'analysis-report-' + orderCode
       var echoInfo = JSON.parse(sessionStorage.getItem(cacheKey) || '{}')
-      var echoMaps = ['target-email']
+      var echoMaps = ['target-email', 'target-level']
 
       for (let i = 0; i < echoMaps.length; i++) {
         var echoInfoKey = echoMaps[i]
@@ -372,6 +376,9 @@
           $('.analysis-report-container span[name="'+ echoInfoKey +'"]').text(echoVal)
         }
       }
+      if (echoInfo['target-level'] && echoInfo['target-level'] !== '单份') {
+        $('.target-level-module').show()
+      }
     }
 
     try  {

+ 3 - 3
src/web/templates/pc/dataExport_sieve.html

@@ -1412,8 +1412,8 @@
             //     }
             //     adhtml += '<img src="' + ADTopList[i]["s_pic"] + '" alt="" ></a></div>'
             // }
-            adhtml += '<div onclick="adv_statistics(this)"><a dataHref="' + ADTopList[0]["s_link"] + '" target="_blank"><img src="' + ADTopList[0]["s_pic"] + '" alt="" style="height:auto;width:100%;"></a></div>'
-            // if (ADTopList.length == 1) {
+          adhtml += '<div onclick="adv_statistics(this)" data-exposure="dataExport_Sieve_Banner__'+ADTopList[0]["s_picalt"]+'" data-exposure-loop  ><a dataHref="' + ADTopList[0]["s_link"] + '" target="_blank"><img src="' + ADTopList[0]["s_pic"] + '" alt="" style="height:auto;width:100%;"></a></div>'
+          // if (ADTopList.length == 1) {
             //     $(".swiper-pagination").hide();
             // }
             // if (adhtml != "") {
@@ -3842,7 +3842,7 @@
                           var exclude = keyAllArr[i].exclude ? keyAllArr[i].exclude: ''
                           nnTemplate += createKeyBox(key, append, exclude, i)
                         }
-                        
+
                         $('#inputDel_0 .column:eq(0)').html(nnTemplate)
                         $('#inputDel_0 .column:eq(1)').html(nnTemplate)
                         $('#inputDel_0 .column:eq(2)').html(nnTemplate)

+ 20 - 11
src/web/templates/pc/myOrder.html

@@ -466,10 +466,11 @@
                     <!-- 后端说只有一份,可以写死,没必要存 -->
                     <p>报告下载份数:1份</p>
                   </div>
-                  <div class="fl shop_main" v-if="item.product_type === '芝麻信用共建分析报告'">
-                    <p style="font-size: 16px;font-weight: 700;">芝麻信用共建分析报告</p>
-                    <p>报告类型: @#item.filterInfo.type#@</p>
-                    <p>@#item.filterInfo.before#@: @#item.filterInfo.name#@</p>
+                  <div class="fl shop_main" v-if="item.product_type === '招投标综合分析'">
+                    <p style="font-size: 16px;font-weight: 700;">招投标综合分析</p>
+                    <p v-if="item.filterInfo.level">权益规格: @#item.filterInfo.level#@</p>
+                    <p v-if="!item.filterInfo.level">报告类型: @#item.filterInfo.type#@</p>
+                    <p v-if="!item.filterInfo.level">@#item.filterInfo.before#@: @#item.filterInfo.name#@</p>
                     <p>报告接收邮箱:@# item.filter.email #@</p>
                   </div>
                 </div>
@@ -795,7 +796,7 @@
       delimiters: ['@#', '#@'],
       data: function () {
         return {
-          typeEnum: ["医械通", "VIP订阅", "中标必听课", "企业商机管理", "剑鱼币", "历史数据", "大会员", "大会员-AI中标预测包", "大会员-子账号", "大会员-招标文件解读", "大会员-补充包", "招标文件解读", "数据报告", '数据流量包', '省份订阅包', '附件下载包', '采购单位画像包', '数据文件', '剑鱼文库会员', '市场分析定制报告下载包', '企业中标分析报告下载包', '业主采购分析报告下载包', '投标企业信用报告', '芝麻信用共建分析报告'],
+          typeEnum: ["医械通", "VIP订阅", "中标必听课", "企业商机管理", "剑鱼币", "历史数据", "大会员", "大会员-AI中标预测包", "大会员-子账号", "大会员-招标文件解读", "大会员-补充包", "招标文件解读", "数据报告", '数据流量包', '省份订阅包', '附件下载包', '采购单位画像包', '数据文件', '剑鱼文库会员', '市场分析定制报告下载包', '企业中标分析报告下载包', '业主采购分析报告下载包', '投标企业信用报告', '招投标综合分析'],
           imgMap: {
             '医械通': {
               icon: '/electronic_invoice/image/med_aratus.png?v=1001'
@@ -907,7 +908,7 @@
             '投标企业信用报告': {
               icon: '/common-module/order-list/image/creditReport.png'
             },
-            '芝麻信用共建分析报告': {
+            '招投标综合分析': {
               icon: '/common-module/order-list/image/analysisReport.png'
             },
           },
@@ -1433,8 +1434,8 @@
               v.docMemberInfo = docMemberInfo
             }
 
-            //  芝麻信用共建分析报告
-            if (v.product_type === '芝麻信用共建分析报告') {
+            //  招投标综合分析
+            if (v.product_type === '招投标综合分析') {
               v.filterInfo = _this.formatZhimaInfo(v.filter || {})
               _this.saveEchoInfo(v.order_code, v.filterInfo , v.filter)
             }
@@ -1460,11 +1461,19 @@
             'target-before': info.before,
             'target-name': info.name,
             'target-email': data.email,
+            'target-level': info.level,
             report_mold: data.report_mold
           }))
         },
         formatZhimaInfo(item) {
-          var result = {}
+          var levelMap = {
+            1: '月卡',
+            2: '季卡',
+            3: '年卡',
+          }
+          var result = {
+            level: levelMap[item.pack_type] || ''
+          }
           switch (item.report_mold) {
             case 1: {
               result.type = '项目分析报告'
@@ -1598,7 +1607,7 @@
               href = '/front/creditReport/orderPay/' + item.order_code
               break
             }
-            case '芝麻信用共建分析报告': {
+            case '招投标综合分析': {
               href = '/front/analysisReport/orderPay/' + item.order_code
               break
             }
@@ -1837,7 +1846,7 @@
               href = '/front/creditReport/jyOrderDetail/' + item.order_code
               break
             }
-            case '芝麻信用共建分析报告': {
+            case '招投标综合分析': {
               href = '/front/analysisReport/jyOrderDetail/' + item.order_code
               break
             }

+ 5 - 5
src/web/templates/pc/newIndex.html

@@ -57,7 +57,7 @@
                 <div class="banner-swiper swiper-container" id="new-pc-index-carousel">
                   <div class="swiper-wrapper">
                     {{range $ad := $ad_2}}
-                    <a class="swiper-slide" data-exposure="PC首页上部分中心轮播图-{{$ad.S_picalt}}" data-exposure-loop target="_blank" {{if $ad.S_link}}href="{{$ad.S_link}}"{{end}}>
+                    <a class="swiper-slide" data-exposure="new-pc-index-carousel__{{$ad.S_picalt}}" data-exposure-loop target="_blank" {{if $ad.S_link}}href="{{$ad.S_link}}"{{end}}>
                       <img class="img-banner" src='{{$ad.S_pic}}' alt="{{$ad.S_picalt}}">
                     </a>
                     {{end}}
@@ -82,7 +82,7 @@
           <div class="banner-swiper swiper-container" id="new-pc-index-top-carousel">
             <div class="swiper-wrapper">
               {{range $ad := $ad_1}}
-              <a class="swiper-slide" data-exposure="PC首页 banner 轮播图-{{$ad.S_picalt}}" data-exposure-loop target="_blank" {{if $ad.S_link}}href="{{$ad.S_link}}"{{end}}>
+              <a class="swiper-slide" data-exposure="new-pc-index-top-ad__{{$ad.S_picalt}}" data-exposure-loop target="_blank" {{if $ad.S_link}}href="{{$ad.S_link}}"{{end}}>
                 <img class="img-banner" src='{{$ad.S_pic}}' alt="{{$ad.S_picalt}}">
               </a>
               {{end}}
@@ -106,7 +106,7 @@
               <div class="banner-swiper swiper-container" id="new-pc-index-middle-carousel">
                 <div class="swiper-wrapper">
                   {{range $ad := $ad_3}}
-                  <a class="swiper-slide banner-remark" data-exposure="PC推荐标讯专区下广告位-{{$ad.S_picalt}}" data-exposure-loop target="_blank" {{if $ad.S_link}}href="{{$ad.S_link}}"{{end}}>
+                  <a class="swiper-slide banner-remark" data-exposure="new-pc-index-middle-carousel__{{$ad.S_picalt}}" data-exposure-loop target="_blank" {{if $ad.S_link}}href="{{$ad.S_link}}"{{end}}>
                     <img class="img-banner" src='{{$ad.S_pic}}' alt="{{$ad.S_picalt}}">
                   </a>
                   {{end}}
@@ -144,7 +144,7 @@
                 <div class="banner-swiper swiper-container" id="new-pc-index-twenty-three-left">
                   <div class="swiper-wrapper">
                     {{range $ad := $ad_4}}
-                    <a class="swiper-slide banner-remark" data-exposure="PC首页项目专区下广告位-{{$ad.S_picalt}}" data-exposure-loop target="_blank" {{if $ad.S_link}}href="{{$ad.S_link}}"{{end}}>
+                    <a class="swiper-slide banner-remark" data-exposure="new-pc-index-twenty-three-left__{{$ad.S_picalt}}" data-exposure-loop target="_blank" {{if $ad.S_link}}href="{{$ad.S_link}}"{{end}}>
                       <img class="img-banner" src='{{$ad.S_pic}}' alt="{{$ad.S_picalt}}">
                     </a>
                     {{end}}
@@ -159,7 +159,7 @@
                 <div class="banner-swiper swiper-container" id="new-pc-index-twenty-three-right">
                   <div class="swiper-wrapper">
                     {{range $ad := $ad_5}}
-                    <a class="swiper-slide banner-remark" data-exposure="PC首页机构专区下广告位2-{{$ad.S_picalt}}" data-exposure-loop target="_blank" {{if $ad.S_link}}href="{{$ad.S_link}}"{{end}}>
+                    <a class="swiper-slide banner-remark" data-exposure="new-pc-index-twenty-three-right__{{$ad.S_picalt}}" data-exposure-loop target="_blank" {{if $ad.S_link}}href="{{$ad.S_link}}"{{end}}>
                       <img class="img-banner" src='{{$ad.S_pic}}' alt="{{$ad.S_picalt}}">
                     </a>
                     {{end}}

+ 1 - 1
src/web/templates/pc/subscribe_new.html

@@ -171,7 +171,7 @@
           </div>
         </div>
     </div>
-    
+
 </div>
 <div class="statistic-info CfadeInUp">
   <div class="w-1200 statistic-info-box">

+ 1 - 1
src/web/templates/pc/template/index/activity-dialog.html

@@ -1,5 +1,5 @@
 <div class="pc_tc" id="pc-index-alert">
-  <div id="index_tc" data-exposure="首页弹窗"  class="tc" dataUrl="">
+  <div id="index_tc" data-exposure="jy-pc-index-tap__"  class="tc" dataUrl="">
     <div id="index_tc_svga"></div>
     <div class="tc_button"></div>
   </div>

+ 5 - 1
src/web/templates/weixin/commonPay/analysisReport/orderDetail.html

@@ -43,10 +43,14 @@
                                 </span>
                                 <span class="rp-right">
                                     <span class="product-type" style="margin-bottom: 0;color: #171826;">${ orderInfo.productType }</span>
-                                    <div class="j-card-item" style="padding-top: 0;" v-if="orderInfo.productInfoList[1]">
+                                    <div class="j-card-item" style="padding-top: 0;" v-if="orderInfo.productInfoList[1] && orderInfo.productInfoList[1].type">
                                         <span class="card-item-l">报告类型:</span>
                                         <span class="card-item-l">${ orderInfo.productInfoList[1].type }</span>
                                     </div>
+                                    <div class="j-card-item" style="padding-top: 0;" v-if="orderInfo.productInfoList[0] && orderInfo.productInfoList[0].label === '权益规格'">
+                                        <span class="card-item-l" style="min-width: auto">权益卡:</span>
+                                        <span class="card-item-l">${ orderInfo.productInfoList[0].text }</span>
+                                    </div>
                                     <span class="pay-money">&yen; ${ orderInfo.payMoney }</span>
                                     <span v-if="orderInfo.refund_status && orderInfo.refund_status > 0" class="refund-success-tip">退款成功</span>
                                 </span>

+ 17 - 4
src/web/templates/weixin/commonPay/checkout.html

@@ -9,7 +9,7 @@
     <meta name="apple-mobile-web-app-status-bar-style" content="black">
     <meta http-equiv="X-UA-Compatible" content="ie=edge">
     {{if eq .T.doType "analysisReport"}}
-    <title>芝麻信用共建分析报告</title>
+    <title>招投标综合分析</title>
     {{else}}
     <title>{{.T.title}}</title>
     {{end}}
@@ -71,6 +71,7 @@
         }
         .analysis-report-container.tip-text.target-type {
           margin-top: 0.32rem;
+          text-align: center;
         }
         .analysis-report-container.tip-text.target-name {
           color: #171826;
@@ -113,8 +114,14 @@
     <div class="j-body">
         <div class="need-pay">
           {{if eq .T.doType "analysisReport"}}
-          <div class="analysis-report-container tip-text target-type"><span name="target-type"></span></div>
-          <div class="analysis-report-container tip-text target-name"><span name="target-name"></span></div>
+            <div class="target-no-level-module" style="display: none">
+              <div class="analysis-report-container tip-text target-type"><span name="target-type"></span></div>
+              <div class="analysis-report-container tip-text target-name"><span name="target-name"></span></div>
+            </div>
+            <div class="target-level-module" style="display: none">
+              <div class="analysis-report-container tip-text target-type">权益卡</div>
+              <div class="analysis-report-container tip-text target-name"><span name="target-level"></span></div>
+            </div>
           {{end}}
             <div class="tip-text">需支付金额</div>
             <div class="price-container">
@@ -546,7 +553,7 @@
       function echoAnalysisReportInfo () {
         var cacheKey = 'analysis-report-' + {{.T.orderCode}}
         var echoInfo = JSON.parse(sessionStorage.getItem(cacheKey) || '{}')
-        var echoMaps = ['target-type', 'target-name']
+        var echoMaps = ['target-type', 'target-name', 'target-level']
 
         for (let i = 0; i < echoMaps.length; i++) {
           var echoInfoKey = echoMaps[i]
@@ -555,6 +562,12 @@
             $('.analysis-report-container span[name="'+ echoInfoKey +'"]').text(echoVal)
           }
         }
+
+        if (echoInfo['target-level'] && echoInfo['target-level'] !== '单份') {
+          $('.target-level-module').show()
+        } else {
+          $('.target-no-level-module').show()
+        }
       }
 
       if ('{{.T.doType}}' === 'analysisReport') {

+ 2 - 2
src/web/templates/weixin/commonPay/myOrder.html

@@ -70,8 +70,8 @@
                                 <div class="img-container" :class="item|formatItemBadge">
                                     <img :src="item.contentImgUrl + '?v=' + version" />
                                 </div>
-                              <div class="content-list" v-if="item.contentList" :class="{'compare-theme': item.product_type === '芝麻信用共建分析报告' }">
-                                <div class="content-list-item ellipsis product-type-label" v-if="item.product_type === '芝麻信用共建分析报告'">芝麻信用共建分析报告</div>
+                              <div class="content-list" v-if="item.contentList" :class="{'compare-theme': item.product_type === '招投标综合分析' }">
+                                <div class="content-list-item ellipsis product-type-label" v-if="item.product_type === '招投标综合分析'">招投标综合分析</div>
                                     <div
                                             class="content-list-item ellipsis"
                                             v-for="(k, i) in item.contentList"

+ 8 - 4
src/web/templates/weixin/commonPay/paySuccess.html

@@ -6,7 +6,7 @@
           content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
     <title>
         {{if eq .T.doType "analysisReport"}}
-        芝麻信用共建分析报告
+        招投标综合分析
       {{ else if eq .T.doType "backend" }}
         剑鱼标讯
       {{else}}
@@ -89,8 +89,9 @@
           {{else if eq .T.doType "areaPack"}}
             <div class="info-item"></div>
             {{else if eq .T.doType "analysisReport"}}
-            <div class="analysis-report-container info-item" name="芝麻信用共建分析报告">
-              <p class="analysis-report-container info-label">下载的报告将发送至邮箱</p>
+            <div class="analysis-report-container info-item" name="招投标综合分析">
+              <p class="analysis-report-container target-level-module info-label" style="display: none">您已开通招投标综合分析权益【<span name="target-level"></span>】,</p>
+              <p class="analysis-report-container info-label">PDF版报告将发送至您的邮箱,请留意查收。</p>
               <p class="analysis-report-container info-label is-hight"><span name="target-email">{{.T.email}}</span></p>
             </div>
           {{end}}
@@ -237,7 +238,7 @@
   function echoAnalysisReportInfo () {
     var cacheKey = 'analysis-report-' + {{.T.orderCode}}
     var echoInfo = JSON.parse(sessionStorage.getItem(cacheKey) || '{}')
-    var echoMaps = ['target-email']
+    var echoMaps = ['target-email', 'target-level']
 
     for (let i = 0; i < echoMaps.length; i++) {
       var echoInfoKey = echoMaps[i]
@@ -246,6 +247,9 @@
         $('.analysis-report-container span[name="'+ echoInfoKey +'"]').text(echoVal)
       }
     }
+    if (echoInfo['target-level'] && echoInfo['target-level'] !== '单份') {
+      $('.target-level-module').show()
+    }
   }
 
   // 芝麻报告5S倒计时自动跳转

Some files were not shown because too many files changed in this diff