Browse Source

first commit

duanwangye 5 years ago
commit
6469e4f1e2
100 changed files with 10734 additions and 0 deletions
  1. 3 0
      .idea/dictionaries/Administrator.xml
  2. 8 0
      .idea/modules.xml
  3. 20 0
      .idea/p2p.iml
  4. 8 0
      .idea/php.xml
  5. 799 0
      .idea/workspace.xml
  6. 1 0
      application/.htaccess
  7. 157 0
      application/active/controller/Index.php
  8. 152 0
      application/active/controller/Wechat.php
  9. 27 0
      application/active/view/index_index.html
  10. 393 0
      application/active/view/index_register.html
  11. 471 0
      application/active/view/index_registerPC.html
  12. 21 0
      application/active/view/index_updateApp.html
  13. 29 0
      application/active/view/index_xinshou.html
  14. 6 0
      application/api.txt
  15. 127 0
      application/apidoc/logic/Active.php
  16. 17 0
      application/apidoc/logic/Base.php
  17. 164 0
      application/apidoc/logic/Cang.php
  18. 20 0
      application/apidoc/logic/Ext.php
  19. 495 0
      application/apidoc/logic/Index.php
  20. 534 0
      application/apidoc/logic/Subject.php
  21. 297 0
      application/apidoc/logic/System.php
  22. 655 0
      application/apidoc/logic/User.php
  23. 22 0
      application/apidoc/logic/apidoc.json
  24. 7 0
      application/apidoc/logic/footer.md
  25. 92 0
      application/apidoc/logic/header.md
  26. 17 0
      application/command.php
  27. 17 0
      application/common.php
  28. 244 0
      application/config.php
  29. 27 0
      application/core/exception/AppException.php
  30. 33 0
      application/core/exception/Http.php
  31. 24 0
      application/core/model/Active.php
  32. 19 0
      application/core/model/Bank.php
  33. 24 0
      application/core/model/BankPlatform.php
  34. 51 0
      application/core/model/Banner.php
  35. 139 0
      application/core/model/Cang.php
  36. 89 0
      application/core/model/CangRepay.php
  37. 44 0
      application/core/model/Cash.php
  38. 22 0
      application/core/model/Channel.php
  39. 41 0
      application/core/model/DMB.php
  40. 29 0
      application/core/model/Fang.php
  41. 116 0
      application/core/model/Hongbao.php
  42. 226 0
      application/core/model/HongbaoPlan.php
  43. 36 0
      application/core/model/InterestTimeType.php
  44. 19 0
      application/core/model/InterestType.php
  45. 24 0
      application/core/model/Introduce.php
  46. 64 0
      application/core/model/Loan.php
  47. 37 0
      application/core/model/Master.php
  48. 22 0
      application/core/model/Sms.php
  49. 274 0
      application/core/model/Subject.php
  50. 28 0
      application/core/model/SubjectStat.php
  51. 20 0
      application/core/model/SubjectType.php
  52. 77 0
      application/core/model/User.php
  53. 413 0
      application/core/model/UserAccount.php
  54. 33 0
      application/core/model/UserBank.php
  55. 32 0
      application/core/model/UserCancelLog.php
  56. 98 0
      application/core/model/UserDrawcash.php
  57. 95 0
      application/core/model/UserFinance.php
  58. 42 0
      application/core/model/UserHongbao.php
  59. 25 0
      application/core/model/UserHonor.php
  60. 75 0
      application/core/model/UserRecharge.php
  61. 55 0
      application/core/service/Check.php
  62. 250 0
      application/core/service/Finance.php
  63. 33 0
      application/core/service/Master.php
  64. 55 0
      application/core/service/Pay.php
  65. 96 0
      application/core/service/SMS.php
  66. 325 0
      application/core/service/Stat.php
  67. 432 0
      application/core/service/Tongbu.php
  68. 62 0
      application/core/service/User.php
  69. 12 0
      application/crontab.sh
  70. 88 0
      application/crontab/command/Cang.php
  71. 677 0
      application/crontab/command/Notify.php
  72. 60 0
      application/crontab/command/Send.php
  73. 225 0
      application/crontab/command/Subject.php
  74. 52 0
      application/database.php
  75. 18 0
      application/extra/interest.php
  76. 15 0
      application/extra/platform.php
  77. 85 0
      application/extra/skin_channel.php
  78. 84 0
      application/extra/skin_channel_20180306.php
  79. 72 0
      application/extra/skin_channel_20180308.php
  80. 85 0
      application/extra/skin_channel_20180313.php
  81. 16 0
      application/extra/system.php
  82. 13 0
      application/index/controller/Index.php
  83. 15 0
      application/laojiaqian/controller/Index.php
  84. 34 0
      application/laojiaqian/model/Project.php
  85. 33 0
      application/laojiaqian/model/User.php
  86. 41 0
      application/laojiaqian/model/UserDueDetail.php
  87. 30 0
      application/master/config.php
  88. 49 0
      application/master/controller/Base.php
  89. 29 0
      application/master/controller/Cang.php
  90. 46 0
      application/master/controller/H5manger.php
  91. 23 0
      application/master/controller/Index.php
  92. 57 0
      application/master/controller/Laojiaqian.php
  93. 33 0
      application/master/controller/Loan.php
  94. 118 0
      application/master/controller/Market.php
  95. 24 0
      application/master/controller/Master.php
  96. 45 0
      application/master/controller/Notify.php
  97. 54 0
      application/master/controller/Setting.php
  98. 126 0
      application/master/controller/Subject.php
  99. 66 0
      application/master/controller/Test.php
  100. 0 0
      application/master/controller/Upload.php

+ 3 - 0
.idea/dictionaries/Administrator.xml

@@ -0,0 +1,3 @@
+<component name="ProjectDictionaryState">
+  <dictionary name="Administrator" />
+</component>

+ 8 - 0
.idea/modules.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/p2p.iml" filepath="$PROJECT_DIR$/.idea/p2p.iml" />
+    </modules>
+  </component>
+</project>

+ 20 - 0
.idea/p2p.iml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="WEB_MODULE" version="4">
+  <component name="NewModuleRootManager">
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/thinkphp/library/think" isTestSource="false" packagePrefix="think\" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="module-library">
+      <library name="PHP Runtime" type="php">
+        <CLASSES>
+          <root url="jar://$APPLICATION_HOME_DIR$/plugins/php/lib/php.jar!/stubs/standard" />
+        </CLASSES>
+        <SOURCES>
+          <root url="jar://$APPLICATION_HOME_DIR$/plugins/php/lib/php.jar!/stubs/standard" />
+        </SOURCES>
+      </library>
+    </orderEntry>
+  </component>
+</module>

+ 8 - 0
.idea/php.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="PhpUnit">
+    <phpunit_settings>
+      <PhpUnitSettings load_method="CUSTOM_LOADER" custom_loader_path="$PROJECT_DIR$/thinkphp/vendor/autoload.php" />
+    </phpunit_settings>
+  </component>
+</project>

+ 799 - 0
.idea/workspace.xml

@@ -0,0 +1,799 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ChangeListManager">
+    <list default="true" id="f1025415-0ea7-4837-9300-0912df893406" name="Default" comment="" />
+    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
+    <option name="TRACKING_ENABLED" value="true" />
+    <option name="SHOW_DIALOG" value="false" />
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
+    <option name="LAST_RESOLUTION" value="IGNORE" />
+  </component>
+  <component name="ComposerSettings" doNotAsk="true">
+    <pharConfigPath>$PROJECT_DIR$/thinkphp/composer.json</pharConfigPath>
+  </component>
+  <component name="CreatePatchCommitExecutor">
+    <option name="PATCH_PATH" value="" />
+  </component>
+  <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
+  <component name="FileEditorManager">
+    <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
+      <file leaf-file-name="Cang.php" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/application/master/logic/Cang.php">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="10275">
+              <caret line="427" column="50" lean-forward="false" selection-start-line="427" selection-start-column="50" selection-end-line="427" selection-end-column="50" />
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="Subject.php" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/application/master/logic/Subject.php">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="6925">
+              <caret line="296" column="73" lean-forward="false" selection-start-line="296" selection-start-column="73" selection-end-line="296" selection-end-column="73" />
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="Master.php" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/application/master/logic/Master.php">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="325">
+              <caret line="28" column="27" lean-forward="false" selection-start-line="28" selection-start-column="27" selection-end-line="28" selection-end-column="27" />
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="Base.php" pinned="false" current-in-tab="true">
+        <entry file="file://$PROJECT_DIR$/application/master/controller/Base.php">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="0">
+              <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="config.php" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/application/config.php">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="3800">
+              <caret line="160" column="57" lean-forward="false" selection-start-line="160" selection-start-column="33" selection-end-line="160" selection-end-column="57" />
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="Http.php" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/application/core/exception/Http.php">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="0">
+              <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="AppException.php" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/application/core/exception/AppException.php">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="0">
+              <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="Index.php" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/application/index/controller/Index.php">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="225">
+              <caret line="10" column="8" lean-forward="false" selection-start-line="10" selection-start-column="8" selection-end-line="10" selection-end-column="125" />
+              <folding>
+                <element signature="e#40#61#0#PHP" expanded="true" />
+              </folding>
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="Base.php" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/application/mobile_v_2_1/controller/Base.php">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="2325">
+              <caret line="96" column="9" lean-forward="true" selection-start-line="96" selection-start-column="9" selection-end-line="96" selection-end-column="9" />
+              <folding>
+                <element signature="e#46#82#0#PHP" expanded="true" />
+              </folding>
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="Cang.php" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/application/mobile_v_2_1/controller/Cang.php">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="0">
+              <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+    </leaf>
+  </component>
+  <component name="FindInProjectRecents">
+    <findStrings>
+      <find>default_check_gateway</find>
+      <find>payment</find>
+      <find>Payment</find>
+      <find>pc_key</find>
+      <find>.pem</find>
+      <find>php_pbkey.pem</find>
+      <find>getPublicKeyPath</find>
+      <find>Finance</find>
+      <find>cangRepay</find>
+      <find>crontab</find>
+      <find>fuyou</find>
+      <find>view</find>
+      <find>render</find>
+      <find>order</find>
+      <find>getStatusCode</find>
+      <find>exception_handle</find>
+      <find>filed</find>
+      <find>statusText</find>
+      <find>isForgedText</find>
+      <find>upload</find>
+      <find>file</find>
+      <find>config</find>
+      <find>sendSMS</find>
+      <find>message_setCodeRepay</find>
+      <find>sendVerificationCode</find>
+      <find>tag_cang_create_success</find>
+      <find>like</find>
+      <find>redirect</find>
+    </findStrings>
+  </component>
+  <component name="IdeDocumentHistory">
+    <option name="CHANGED_PATHS">
+      <list>
+        <option value="$PROJECT_DIR$/application/master/controller/Base.php" />
+        <option value="$PROJECT_DIR$/application/config.php" />
+        <option value="$PROJECT_DIR$/application/master/logic/Market.php" />
+        <option value="$PROJECT_DIR$/application/core/service/Finance.php" />
+        <option value="$PROJECT_DIR$/application/core/model/Cang.php" />
+        <option value="$PROJECT_DIR$/application/master/logic/Subject.php" />
+        <option value="$PROJECT_DIR$/application/core/exception/Http.php" />
+        <option value="$PROJECT_DIR$/application/master/logic/Cang.php" />
+        <option value="$PROJECT_DIR$/application/mobile_v_2_1/logic/Cang.php" />
+        <option value="$PROJECT_DIR$/vendor/fuyou/Gold.php" />
+        <option value="$PROJECT_DIR$/application/mobile_v_2_1/controller/Base.php" />
+      </list>
+    </option>
+  </component>
+  <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
+  <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
+  <component name="JsGulpfileManager">
+    <detection-done>true</detection-done>
+    <sorting>DEFINITION_ORDER</sorting>
+  </component>
+  <component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
+  <component name="ProjectFrameBounds">
+    <option name="x" value="-8" />
+    <option name="y" value="-8" />
+    <option name="width" value="1456" />
+    <option name="height" value="876" />
+  </component>
+  <component name="ProjectView">
+    <navigator currentView="ProjectPane" proportions="" version="1">
+      <flattenPackages />
+      <showMembers />
+      <showModules />
+      <showLibraryContents />
+      <hideEmptyPackages />
+      <abbreviatePackageNames />
+      <autoscrollToSource />
+      <autoscrollFromSource ProjectPane="true" />
+      <sortByType />
+      <manualOrder />
+      <foldersAlwaysOnTop value="true" />
+    </navigator>
+    <panes>
+      <pane id="ProjectPane">
+        <subPane>
+          <PATH>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="p2p" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+            </PATH_ELEMENT>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="p2p" />
+              <option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
+            </PATH_ELEMENT>
+          </PATH>
+        </subPane>
+      </pane>
+      <pane id="Scratches" />
+      <pane id="Scope" />
+    </panes>
+  </component>
+  <component name="PropertiesComponent">
+    <property name="WebServerToolWindowFactoryState" value="false" />
+    <property name="last_opened_file_path" value="$PROJECT_DIR$/../../github/duolaibei_pay" />
+    <property name="settings.editor.selected.configurable" value="reference.webide.settings.project.settings.php" />
+    <property name="nodejs_interpreter_path" value="D:/myself/php/node/node" />
+    <property name="js.eslint.eslintPackage" value="" />
+    <property name="js-jscs-nodeInterpreter" value="D:\myself\php\node\node.exe" />
+  </component>
+  <component name="RunDashboard">
+    <option name="ruleStates">
+      <list>
+        <RuleState>
+          <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
+        </RuleState>
+        <RuleState>
+          <option name="name" value="StatusDashboardGroupingRule" />
+        </RuleState>
+      </list>
+    </option>
+  </component>
+  <component name="RunManager">
+    <configuration default="true" type="JavaScriptTestRunnerProtractor" factoryName="Protractor">
+      <config-file value="" />
+      <node-interpreter value="project" />
+      <envs />
+      <method />
+    </configuration>
+    <configuration default="true" type="JavascriptDebugType" factoryName="JavaScript Debug">
+      <method />
+    </configuration>
+    <configuration default="true" type="NodeJSConfigurationType" factoryName="Node.js" path-to-node="project" working-dir="">
+      <method />
+    </configuration>
+    <configuration default="true" type="PHPUnitRunConfigurationType" factoryName="PHPUnit">
+      <TestRunner />
+      <method />
+    </configuration>
+    <configuration default="true" type="PhpBehatConfigurationType" factoryName="Behat">
+      <BehatRunner />
+      <method />
+    </configuration>
+    <configuration default="true" type="PhpLocalRunConfigurationType" factoryName="PHP Console">
+      <method />
+    </configuration>
+    <configuration default="true" type="PhpSpecConfigurationType" factoryName="PHPSpec">
+      <PhpTestRunnerSettings />
+      <method />
+    </configuration>
+    <configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
+      <node-interpreter>project</node-interpreter>
+      <node-options />
+      <gulpfile />
+      <tasks />
+      <arguments />
+      <envs />
+      <method />
+    </configuration>
+    <configuration default="true" type="js.build_tools.npm" factoryName="npm">
+      <command value="run" />
+      <scripts />
+      <node-interpreter value="project" />
+      <envs />
+      <method />
+    </configuration>
+    <configuration default="true" type="mocha-javascript-test-runner" factoryName="Mocha">
+      <node-interpreter>project</node-interpreter>
+      <node-options />
+      <working-directory />
+      <pass-parent-env>true</pass-parent-env>
+      <envs />
+      <ui />
+      <extra-mocha-options />
+      <test-kind>DIRECTORY</test-kind>
+      <test-directory />
+      <recursive>false</recursive>
+      <method />
+    </configuration>
+  </component>
+  <component name="ShelveChangesManager" show_recycled="false">
+    <option name="remove_strategy" value="false" />
+  </component>
+  <component name="SvnConfiguration">
+    <configuration />
+  </component>
+  <component name="TaskManager">
+    <task active="true" id="Default" summary="Default task">
+      <changelist id="f1025415-0ea7-4837-9300-0912df893406" name="Default" comment="" />
+      <created>1524815671733</created>
+      <option name="number" value="Default" />
+      <option name="presentableId" value="Default" />
+      <updated>1524815671733</updated>
+      <workItem from="1524815672810" duration="1216000" />
+      <workItem from="1525254691977" duration="3057000" />
+      <workItem from="1525333040818" duration="599000" />
+      <workItem from="1525340685323" duration="599000" />
+      <workItem from="1526260926138" duration="2000" />
+      <workItem from="1537407808015" duration="7888000" />
+      <workItem from="1537837598319" duration="2517000" />
+      <workItem from="1537870606722" duration="566000" />
+      <workItem from="1538041295967" duration="5182000" />
+      <workItem from="1539052993311" duration="11680000" />
+      <workItem from="1539158772369" duration="10960000" />
+      <workItem from="1539565485360" duration="14427000" />
+      <workItem from="1540195802637" duration="232000" />
+      <workItem from="1540207206750" duration="12708000" />
+      <workItem from="1540774921570" duration="10965000" />
+      <workItem from="1541380070003" duration="14751000" />
+      <workItem from="1541985003084" duration="1486000" />
+      <workItem from="1542071399647" duration="598000" />
+      <workItem from="1542080519046" duration="346000" />
+      <workItem from="1542080912451" duration="6138000" />
+      <workItem from="1542341911548" duration="712000" />
+      <workItem from="1542589788661" duration="9385000" />
+      <workItem from="1543194536950" duration="2764000" />
+      <workItem from="1543453810239" duration="8150000" />
+      <workItem from="1543799964317" duration="4240000" />
+      <workItem from="1544404537285" duration="2782000" />
+      <workItem from="1544775583718" duration="1272000" />
+      <workItem from="1545009362079" duration="747000" />
+      <workItem from="1545614887128" duration="4030000" />
+      <workItem from="1546477886367" duration="1819000" />
+      <workItem from="1546822746082" duration="2546000" />
+      <workItem from="1547427941755" duration="2814000" />
+      <workItem from="1547772436066" duration="1251000" />
+      <workItem from="1548032642226" duration="1823000" />
+      <workItem from="1548397371322" duration="627000" />
+      <workItem from="1548637885469" duration="657000" />
+      <workItem from="1548723210229" duration="2409000" />
+      <workItem from="1550019140239" duration="1203000" />
+      <workItem from="1550215972927" duration="1632000" />
+      <workItem from="1550451704221" duration="608000" />
+    </task>
+    <servers />
+  </component>
+  <component name="TimeTrackingManager">
+    <option name="totallyTimeSpent" value="157388000" />
+  </component>
+  <component name="ToolWindowManager">
+    <frame x="-8" y="-8" width="1456" height="876" extended-state="1" />
+    <editor active="false" />
+    <layout>
+      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.21633238" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
+      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
+      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3293011" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
+      <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
+      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
+      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
+      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
+      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
+      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
+      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
+      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
+      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
+      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.7258065" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+    </layout>
+    <layout-to-restore>
+      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
+      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
+      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
+      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
+      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3293011" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
+      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
+      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
+      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
+      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
+      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.17335244" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
+      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
+      <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.7258065" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
+      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+    </layout-to-restore>
+  </component>
+  <component name="TypeScriptGeneratedFilesManager">
+    <option name="processedProjectFiles" value="true" />
+  </component>
+  <component name="VcsContentAnnotationSettings">
+    <option name="myLimit" value="2678400000" />
+  </component>
+  <component name="XDebuggerManager">
+    <breakpoint-manager />
+    <watches-manager />
+  </component>
+  <component name="editorHistoryManager">
+    <entry file="file://$PROJECT_DIR$/application/master/logic/Active.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="-5033">
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/master/logic/Loan.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="-3183">
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/core/service/Tongbu.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/core/service/User.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="-769">
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/core/service/Master.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/core/service/Check.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="-619">
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/apidoc/logic/Active.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/active/controller/Wechat.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/vendor/excel/PHPExcel/Shared/File.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="3375">
+          <caret line="135" column="25" lean-forward="false" selection-start-line="135" selection-start-column="25" selection-end-line="135" selection-end-column="25" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/master/config.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/master/logic/Market.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="10550">
+          <caret line="432" column="0" lean-forward="true" selection-start-line="432" selection-start-column="0" selection-end-line="432" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/master/logic/Setting.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/thinkphp/library/think/Validate.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="238">
+          <caret line="252" column="20" lean-forward="false" selection-start-line="252" selection-start-column="20" selection-end-line="252" selection-end-column="20" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/extend/Yunpian_SMS/SMS.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="150">
+          <caret line="6" column="1" lean-forward="false" selection-start-line="6" selection-start-column="1" selection-end-line="8" selection-end-column="42" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/core/service/Pay.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="25">
+          <caret line="24" column="38" lean-forward="false" selection-start-line="24" selection-start-column="32" selection-end-line="24" selection-end-column="38" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/active/controller/Index.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="3525">
+          <caret line="150" column="42" lean-forward="false" selection-start-line="150" selection-start-column="42" selection-end-line="150" selection-end-column="42" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/mobile_v_2_1/controller/User.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/master/logic/User.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/core/service/SMS.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="175">
+          <caret line="17" column="6" lean-forward="false" selection-start-line="17" selection-start-column="6" selection-end-line="17" selection-end-column="6" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/mobile_v_2_1/logic/User.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="1050">
+          <caret line="66" column="9" lean-forward="false" selection-start-line="66" selection-start-column="9" selection-end-line="66" selection-end-column="9" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/thinkphp/library/think/Hook.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="238">
+          <caret line="82" column="27" lean-forward="false" selection-start-line="82" selection-start-column="27" selection-end-line="82" selection-end-column="27" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/crontab/command/Cang.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/mobile/tags.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="150">
+          <caret line="14" column="5" lean-forward="false" selection-start-line="14" selection-start-column="5" selection-end-line="14" selection-end-column="5" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/mobile_v_2_1/behavior/UserHonor_Cang.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/mobile_v_2_1/behavior/CashSend.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="150">
+          <caret line="11" column="4" lean-forward="true" selection-start-line="11" selection-start-column="4" selection-end-line="11" selection-end-column="4" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/mobile_v_2_1/tags.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="300">
+          <caret line="20" column="0" lean-forward="true" selection-start-line="20" selection-start-column="0" selection-end-line="20" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/vendor/payModel/Drawcash.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="-1469">
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/vendor/payModel/User.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/thinkphp/library/think/Db.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="238">
+          <caret line="44" column="3" lean-forward="false" selection-start-line="44" selection-start-column="3" selection-end-line="44" selection-end-column="3" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/vendor/payModel/Recharge.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/core/service/Finance.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="2525">
+          <caret line="119" column="36" lean-forward="false" selection-start-line="119" selection-start-column="36" selection-end-line="119" selection-end-column="36" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/vendor/payModel/Trade.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="550">
+          <caret line="22" column="20" lean-forward="false" selection-start-line="22" selection-start-column="20" selection-end-line="22" selection-end-column="20" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/vendor/payModel/Model.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/vendor/fuyou/Config.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="200">
+          <caret line="8" column="6" lean-forward="false" selection-start-line="8" selection-start-column="6" selection-end-line="8" selection-end-column="6" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/vendor/fuyou/Base.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="1525">
+          <caret line="61" column="20" lean-forward="false" selection-start-line="61" selection-start-column="20" selection-end-line="61" selection-end-column="20" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/vendor/fuyou/Gold.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="1275">
+          <caret line="51" column="0" lean-forward="false" selection-start-line="51" selection-start-column="0" selection-end-line="51" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/mobile_v_2_1/controller/Index.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/mobile_v_2_1/logic/Index.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/mobile_v_2_1/logic/Cang.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="4775">
+          <caret line="212" column="47" lean-forward="false" selection-start-line="212" selection-start-column="47" selection-end-line="212" selection-end-column="47" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/mobile_v_2_1/logic/Subject.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/mobile_v_2_1/logic/System.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/index/controller/Index.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="225">
+          <caret line="10" column="8" lean-forward="false" selection-start-line="10" selection-start-column="8" selection-end-line="10" selection-end-column="125" />
+          <folding>
+            <element signature="e#40#61#0#PHP" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/mobile_v_2_1/controller/Base.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="2325">
+          <caret line="96" column="9" lean-forward="true" selection-start-line="96" selection-start-column="9" selection-end-line="96" selection-end-column="9" />
+          <folding>
+            <element signature="e#46#82#0#PHP" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/mobile_v_2_1/controller/Cang.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/config.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="3800">
+          <caret line="160" column="57" lean-forward="false" selection-start-line="160" selection-start-column="33" selection-end-line="160" selection-end-column="57" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/core/exception/Http.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/core/exception/AppException.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/master/logic/Cang.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="10275">
+          <caret line="427" column="50" lean-forward="false" selection-start-line="427" selection-start-column="50" selection-end-line="427" selection-end-column="50" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/master/logic/Subject.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="6925">
+          <caret line="296" column="73" lean-forward="false" selection-start-line="296" selection-start-column="73" selection-end-line="296" selection-end-column="73" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/master/logic/Master.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="325">
+          <caret line="28" column="27" lean-forward="false" selection-start-line="28" selection-start-column="27" selection-end-line="28" selection-end-column="27" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/application/master/controller/Base.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+  </component>
+  <component name="masterDetails">
+    <states>
+      <state key="ScopeChooserConfigurable.UI">
+        <settings>
+          <splitter-proportions>
+            <option name="proportions">
+              <list>
+                <option value="0.2" />
+              </list>
+            </option>
+          </splitter-proportions>
+        </settings>
+      </state>
+    </states>
+  </component>
+</project>

+ 1 - 0
application/.htaccess

@@ -0,0 +1 @@
+deny from all

+ 157 - 0
application/active/controller/Index.php

@@ -0,0 +1,157 @@
+<?php
+namespace app\active\controller;
+use app\core\model\Channel;
+use app\core\model\HongbaoPlan;
+use app\core\model\Introduce;
+use app\core\model\User;
+use app\core\model\UserAccount;
+use app\core\service\SMS;
+use app\core\service\Tongbu;
+use think\Controller;
+use think\Request;
+use tool\Common;
+
+
+class Index extends Controller
+{
+    public function updateApp() {
+        return view(__FUNCTION__, ['resourcePath'=>'/static/'.request()->path()]);
+    }
+
+    public function xinshou() {
+        return view(__FUNCTION__, ['resourcePath'=>'/static/'.request()->path()]);
+    }
+
+    public function register() {
+        if(request()->isPost()) {
+            $param = request()->param();
+
+            $package = (new SMS())->checkVerificationCode($param['mobile'], $param['mobileCode']);
+            if($package['code'] != 1) {
+                return $package;
+            }
+
+            $model = User::get([
+                'mobile'=>$param['mobile']
+            ]);
+            if($model) {
+                return Common::rm(-3, '该手机号码已经被注册');
+            }
+
+            if($param['password'] != $param['passwordRe']) {
+                return Common::rm(-4, '密码不一致');
+            }
+
+
+            //channel
+            $channel = Channel::get([
+                'code'=>$param['channel']
+            ]);
+
+            //introduce
+            $introduceUser = null;
+            if(isset($param['introduce']) && $param['introduce']) {
+                $introduceUser = User::get([
+                    'uuid'=>$param['introduce']
+                ]);
+                if($introduceUser) {
+                    $introduceUserAccount = $introduceUser->userAccount['introduceCount'];
+                    $introduceUserAccount['introduceCount'] = $introduceUserAccount['introduceCount'] + 1;
+                    $introduceUserAccount->allowField(['introduceCount'])->save();
+                }
+            }
+
+            //新用户
+            $model = new User();
+            $model['uuid'] = Common::token_create(32);
+            $model['password'] = $model->createPassword($param['password']);
+            $model['mobile'] = $param['mobile'];
+            $model['channelID'] = isset($channel['channelID']) ? $channel['channelID'] : 0;
+            $model['deviceID'] = '';
+            $model['osV'] = '';
+            $model['osType'] = $param['osType'];
+            $model['loginOsType'] = $param['osType'];
+            $model['apiV'] = '';
+            $model['appV'] = '';
+            $model['ip'] = request()->ip();
+            $model['isNewInvest'] = 1;//为首投用户
+            $model['loginTime'] = THINK_START_TIME;
+            $model['introduce'] = $introduceUser ? $introduceUser['userID'] : 0;
+            $model->save();
+
+            //账户
+            $userAccount = new UserAccount();
+            $userAccount['userID'] = $model['userID'];
+            $userAccount->save();
+
+            //新手红包
+            (new HongbaoPlan())->sendUserOnRegister($model);
+
+            //开始建立关系
+
+
+            /*//开始登录
+            $token = '';
+            //移动app登录
+            if($this->data['osType'] == 1 || $this->data['osType'] == 2) {
+                $model['token'] = $model->createToken();
+                $model['tokenOverTime'] = $model->createTokenOverTime();
+                $token =  $model['token'];
+            }
+            //pc登录
+            else if($this->data['osType'] == 3){
+                $model['tokenPc'] = $model->createToken();
+                $model['tokenOverTimePc'] = $model->createTokenOverTime();
+                $token =  $model['tokenPc'];
+            }
+            //app登录
+            else if($this->data['osType'] == 4){
+                $model['tokenWap'] = $model->createToken();
+                $model['tokenOverTimeWap'] = $model->createTokenOverTime();
+                $token =  $model['tokenWap'];
+            }
+            $model->save();
+
+            $this->user = $model;*/
+
+
+            //********************************** 同步,后期删掉就好了 *************************
+            (new Tongbu())->DY_user($param['mobile']);
+            //********************************** end *************************
+
+            return json(Common::rm(1, '操作成功'));
+        }
+
+        $os = request()->param('os');
+        $path = '/static/'.request()->path().'PC';
+        $view = __FUNCTION__.'PC';
+        if(!$os) {
+            $path = '/static/'.request()->path();
+            $view = __FUNCTION__;
+        }
+
+        return view($view, [
+            'resourcePath'=>$path,
+            'channel'=>request()->param('channel'),
+            'introduce'=>request()->param('introduce')
+        ]);
+    }
+
+    public function registerSendMobileCode() {
+        $param = Request::instance()->param();
+        if(strlen($param['mobile']) != 11) {
+            return json(Common::rm(-2, '手机号码不正确'));
+        }
+        $model = User::get([
+            'mobile'=>$param['mobile']
+        ]);
+        if($model) {
+            return json(Common::rm(-3, '该手机号码已经被注册'));
+        }
+        return json((new SMS())->sendVerificationCode($param['mobile']));
+    }
+
+    public function regAgreement() {
+        exit;
+    }
+}

+ 152 - 0
application/active/controller/Wechat.php

@@ -0,0 +1,152 @@
+<?php
+namespace app\active\controller;
+use app\core\model\Channel;
+use app\core\model\HongbaoPlan;
+use app\core\model\User;
+use app\core\model\UserAccount;
+use app\core\service\SMS;
+use app\core\service\Stat;
+use app\core\service\Tongbu;
+use think\Cache;
+use think\Controller;
+use think\Db;
+use think\Log;
+use think\Request;
+use tool\Common;
+use wechat\WechatAuth;
+use wechat\Wechat as WechatCommon;
+
+
+class Wechat extends Controller
+{
+   /* public function index() {
+        $appid = 'wx858c4fed463742d7';
+        $secret = '6390e4ae8cb2790e080666ae1a6cf5be';
+        $result = file_get_contents('https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid='.$appid.'&secret='.$secret);
+        $result = json_decode($result, true);
+
+        $result = file_get_contents('https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token='.$result['access_token'].'&type=jsapi');
+        $result = json_decode($result, true);
+        //dump($result);exit;
+        $data['jsapi_ticket'] = $result['ticket'];
+        $data['noncestr'] = THINK_START_TIME;
+        $data['timestamp'] = (int)THINK_START_TIME;
+        $data['url'] = 'http://www.baidu.com';
+        $data['signature'] = sha1(http_build_query($data));
+        $data['appid'] = 'wx858c4fed463742d7';
+        unset($data['jsapi_ticket']);
+
+        header('Content-type:text/json');
+        echo request()->param('callback').'('.json_encode(Common::rm(1, '操作成功', $data)).')';exit;
+    }
+
+    public function test() {
+        $signature = $_GET['signature']; //微信加密签名
+        $timestamp = $_GET['timestamp']; //时间戳
+        $nonce = $_GET['nonce']; //随机数
+        $echostr = $_GET['echostr']; //随机字符串
+        $token = '9GQfeptfROO3v1rjXAwoYjFCMpon8bvS';
+        $tempArr = array($token,$timestamp,$nonce);
+        sort($tempArr);
+        if($signature ==sha1(implode($tempArr))){
+            echo $echostr;
+        }else{
+            exit();
+        }
+    }*/
+
+
+    public function index() {
+        //https://jiaqiancaifu.dahengdian.com/active/wechat/index
+        //6a204bd89f3c8348afd5c77c717a097a
+        //O0pHtIhxWbAvcnCWiKPKJeX8tpAcrnTKznh9AvH28cE
+        $wechatAuth = new WechatAuth('wx5c2cb0242ae05436','0a668108cea8d819fbe48e41b9e0c396');
+        Log::info($wechatAuth->getAccessToken());
+        $wechat = new WechatCommon('6a204bd89f3c8348afd5c77c717a097a'/*, 'O0pHtIhxWbAvcnCWiKPKJeX8tpAcrnTKznh9AvH28cE', 'wx5c2cb0242ae05436'*/);
+        $token = $wechatAuth->getAccessToken();
+        $data = $wechat->request();
+        Log::info($data);
+        $stat = [];
+
+        $userCanS = [
+            'o1Bky0hQSqcmEeodarB8JP9rfKes',//徐总
+            'o1Bky0mQVkNebqyQOqDB5M_Vj3TM',//张奇
+            'o1Bky0m4xs9j_PqFyLvfAA3Uwux4',//张江
+            'o1Bky0pq59Ho1oP5VzE5YFxLCxgg',//吴总
+        ];
+        if(!in_array($data['FromUserName'], $userCanS)) {
+            exit;
+        }
+        if($data['Content'] == '存量') {
+            $stat = Stat::getStat();
+            $todayText = '今日总交易额'.$stat['moneySubjectTotal_today']."元\n";
+            $todayText .= '订单数'.$stat['cangCount_today']."笔\n\n";
+
+            $todayText .= '累计交易额'.$stat['moneySubjectTotal_all']."元\n";
+            $todayText .= '当前存量'.$stat['cunTotal_all']."元\n\n";
+            $todayText .= '以上信息仅限于新平台  :)';
+            $wechat->replyText($todayText, $token['access_token']);
+        }
+
+
+
+        if($data['Content'] == '交易') {
+            $list = Db::view('cang','cangID,subjectID,moneySubject,status,addTime,year,investDay,interest,money,userID,isForged,hongbao,yearExt')
+                ->view('user','userID,trueName,mobile,channelID,isNewInvest,osType','cang.userID=user.userID and user.isForged=0')
+                ->view('subject','subjectID,title','cang.subjectID=subject.subjectID')
+                ->view('channel','channelID,name as channelName','user.channelID=channel.channelID', 'left')
+                ->view('master','trueName as customer,masterID,mobile as customerMobile','master.masterID=cang.masterID', 'left')
+                //->view('user_hongbao','userHongbaoID,sum(money),sum(interest)','cang.hongbao in (user_hongbao.userHongbaoID)', 'left')
+                ->whereTime('addTime', 'today')
+                ->order('cangID desc')
+                ->select();
+
+            $todayText = '';
+            foreach ($list as $k=>$item) {
+                $list[$k]['addTime'] = Common::timetodate($list[$k]['addTime']);
+                $list[$k]['money'] = (int)($list[$k]['money'] / 100);
+                $list[$k]['moneySubject'] = (int)($list[$k]['moneySubject'] / 100);
+                $list[$k]['interest'] = Common::price2($list[$k]['interest'] / 100);
+                $list[$k]['mobile'] = Common::mobileAsterisk($list[$k]['mobile']);
+                if($list[$k]['osType'] == 1) {
+                    $list[$k]['osType'] = 'ios';
+                }
+                else if($list[$k]['osType'] == 2) {
+                    $list[$k]['osType'] = 'android';
+                }
+                else if($list[$k]['osType'] == 3) {
+                    $list[$k]['osType'] = 'pc';
+                }
+                else if($list[$k]['osType'] == 4) {
+                    $list[$k]['osType'] = 'wap';
+                }
+                $list[$k]['moneyHongbao'] = $list[$k]['moneySubject'] - $list[$k]['money'];
+
+
+                $todayText .= "\n\n".$list[$k]['moneySubject'].'元 '.$list[$k]['mobile'].' '.$list[$k]['trueName']."\n";
+                $todayText .= $list[$k]['title'].' '.$list[$k]['investDay'].'天 '."\n";
+                $todayText .= $list[$k]['addTime']."\n";
+                $todayText .= '渠道:'.$list[$k]['osType'].' '.$list[$k]['channelName']."\n\n";
+                $todayText .= '--------------------------------';
+                /*$todayText .= '订单数'.$stat['cangCount_today']."笔\n\n";
+
+                $todayText .= '累计交易额'.$stat['moneySubjectTotal_all']."元\n";
+                $todayText .= '当前存量'.$stat['cunTotal_all']."元\n\n";
+                $todayText .= '以上信息仅限于新平台  :)';*/
+            }
+            $todayText .= "\n\n".'以上交易发生于 '.Common::timetodate(THINK_START_TIME, 0)."\n";
+            $todayText .= '以上信息仅限于新平台  :)';
+            $wechat->replyText($todayText, $token['access_token']);
+        }
+
+
+        /*$wechat->replyText($data['Content'], $token['access_token']);
+        $wechat->replyText($data['Content'], $token['access_token']);
+        $wechat->replyText($data['Content'], $token['access_token']);
+        $wechat->replyText($data['Content'], $token['access_token']);
+        $wechat->replyText($data['Content'], $token['access_token']);
+        $wechat->replyText($data['Content'], $token['access_token']);
+        $wechat->replyText($data['Content'], $token['access_token']);*/
+        //$wechat->
+    }
+}

+ 27 - 0
application/active/view/index_index.html

@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <link rel="stylesheet" type="text/css">
+    <title>活动页面</title>
+    <meta name="format-detection" content="telephone=no">
+    <meta name="apple-mobile-web-app-capable" content="yes">
+    <meta name="apple-mobile-web-app-status-bar-style" content="black">
+    <script>
+        window.onload=function(){
+            var u=window.navigator.userAgent;
+            if(u.indexOf('iPhone')>-1||u.indexOf('iPad')>-1){
+                submit('这是腾讯的一个网站', 'http://www.qq.com', 'http://zhidao.dahengdian.com/static/images/user_litpic.png');
+            }
+            if(u.indexOf('Android')>-1){
+                window.bj.call('showShareButton', '{"show" : "true","imgUrl":"http://zhidao.dahengdian.com/static/images/user_litpic.png","shareUrl":"http://www.qq.com","title":"这是腾讯的一个网站","content":"腾讯是个好网站,你值得观看"}', 0);
+            }
+        }
+    </script>
+</head>
+<body>
+<div class="content">
+    这是一个活动呀,这是一个活动呀,这是一个活动呀,这是一个活动呀,这是一个活动呀
+</div>
+</body>
+</html>

File diff suppressed because it is too large
+ 393 - 0
application/active/view/index_register.html


+ 471 - 0
application/active/view/index_registerPC.html

@@ -0,0 +1,471 @@
+<!DOCTYPE html>
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+    <meta http-equiv="X-UA-Compatible" content="IE=edge chrome=1">
+    <title>我在佳乾财富,短期高息,还有888元现金红包!</title>
+    <meta content="telephone=no" name="format-detection">
+    <meta name="keywords" content="">
+    <meta name="description" content="">
+    <link rel="stylesheet" href="{$resourcePath}/mui.min.css">
+    <link rel="stylesheet" type="text/css" href="{$resourcePath}/1019.css">
+    <link rel="stylesheet" type="text/css" href="{$resourcePath}/mmm-account.css">
+</head>
+<body>
+<style type="text/css">
+    .a_bg {
+        width:100%;
+        background-image:url('http://slb.dahengdian.com/jiaqiancaifu/2018/03/01/XEuSQ9UcwV.jpg');
+        background-position:center center;
+        height:975px;
+        position:relative;
+    }
+    .a_bg_login {
+        width:287px;
+        height:370px;
+        background-color:#9A8453;
+        top:140px;
+        left:50%;
+        margin-left:220px;
+        position:absolute;
+        border-radius:5px
+    }
+    .notake {
+        width:250px;
+        margin-left:auto;
+        margin-right:auto;
+    }
+    .authCode-wrap {
+        border-radius: .375rem;
+        background: #fff;
+        padding: .475rem 2.66666667%;
+        margin-bottom: 15px;
+        overflow: hidden;
+    }
+    .authCode-wrap .code {
+        display: block;
+        border: none;
+        width: 62.66666667%;
+        padding: 0;
+        margin: 0;
+        float: left;
+        height: 20px;
+    }
+    .get-code {
+        color: #656565;
+        line-height: 20px;
+        height: 20px;
+    <!-- border-left: 1px solid #cacaca; -->
+        box-sizing: border-box;
+        cursor:pointer;
+    }
+    body .error-wrapper {
+        background-color: #ffffff;
+        color: #000000;
+        width: 260px;
+        min-width:inherit;
+        padding: 40px 40px;
+    }
+</style>
+
+<div class="logOut-Prompt">
+    <div class="logOut-content">
+        <div class="logOut-text">您是老用户,马上去官网登录吧!</div>
+        <div class="btn-group">
+            <div class="cancel" style="border-right:1px solid rgba(0,0,0,.2);">取消</div>
+            <div class="sure">确认</div>
+        </div>
+    </div>
+</div>
+<div class="safe-cover"></div>
+<div class="error-wrapper"></div>
+
+<div class="a_bg">
+    <div class="a_bg_login">
+        <div class="notake">
+            <div class="telphone-wrap">
+                <img src="http://slb.dahengdian.com/jiaqiancaifu/2018/03/01/3hMjjLODQU.png" style="height:80px;width:220px">
+            </div>
+            <div class="telphone-wrap">
+                <input type="tel" placeholder="请输入手机号" class="mobile" id="mobile" maxlength="11">
+            </div>
+            <div class="authCode-wrap">
+                <input type="tel" placeholder="请输入验证码" class="code" id="code" maxlength="6">
+                <div class="get-code">获取验证码</div>
+            </div>
+            <div class="telphone-wrap">
+                <input type="password" placeholder="请输入密码" class="mobile" id="password">
+            </div>
+            <div class="telphone-wrap">
+                <input type="password" placeholder="重复密码" class="mobile" id="passwordRe">
+            </div>
+            <div class="submitBtn">注册领福利</div>
+        </div>
+    </div>
+</div>
+
+
+<!-- <div class="logOut-Prompt">
+    <div class="logOut-content">
+        <div class="logOut-text">您是老用户,马上下载APP赚钱吧!</div>
+        <div class="btn-group">
+            <div class="cancel" style="border-right:1px solid rgba(0,0,0,.2);">取消</div>
+            <div class="sure">确认</div>
+        </div>
+    </div>
+</div>
+<div class="safe-cover"></div>
+<div class="error-wrapper"></div> -->
+
+<!-- <div class="safe-detail">
+    <div class="header-img2">
+        <img src="./我在佳乾财富,短期高息,还有888元现金红包!_files/redHeader2.png">
+    </div>
+    <div class="safe-text2">
+
+    </div>
+    <div class="safe-foot2">
+        <img src="./我在佳乾财富,短期高息,还有888元现金红包!_files/knowBtn.png">
+    </div>
+</div> -->
+<!-- <div class="page-group">
+
+    <div class="mui-content" style="background:#fcfcfc">
+
+
+        <div class="xw-page">
+            <div class="banner">
+                <img src="./我在佳乾财富,短期高息,还有888元现金红包!_files/banner1.png" alt="">
+            </div>
+            <div class="content">
+                <div class="notake">
+                    <div class="telphone-wrap">
+                        <input type="tel" placeholder="请输入手机号" class="mobile" id="mobile" maxlength="11">
+                    </div>
+                    <div class="authCode-wrap">
+                        <input type="tel" placeholder="请输入验证码" class="code" id="code" maxlength="6">
+                        <div class="get-code">获取验证码</div>
+                    </div>
+                    <div class="telphone-wrap">
+                        <input type="password" placeholder="请输入密码" class="mobile" id="password">
+                    </div>
+                    <div class="telphone-wrap">
+                        <input type="password" placeholder="重复密码" class="mobile" id="passwordRe">
+                    </div>
+                    <div class="submitBtn">注册领福利</div>
+                </div>
+            </div>
+            <div class="welfare">
+                <img src="./我在佳乾财富,短期高息,还有888元现金红包!_files/title_01.png">
+                <div class="welfare-item">
+                    <img src="./我在佳乾财富,短期高息,还有888元现金红包!_files/welfare_icon1.png" class="welfare_icon">
+                    <p class="title"><span>888元</span>理财红包</p>
+                    <p class="desc">注册即送,投资立返</p>
+                </div>
+            </div>
+            <div class="foot" style="color:#fff">
+                客服电话:<a class="cservice" style="color:#429fff" href="tel:400-005-8155" target="_self">400-005-8155</a><br>
+                活动最终解释权归佳乾财富所有
+            </div>
+        </div>
+
+    </div>
+</div> -->
+
+
+<script src="{$resourcePath}/mui.min.js"></script>
+<script src="{$resourcePath}/jquery-1.8.3.min.js"></script>
+<script src="{$resourcePath}/jweixin-1.2.0.js"></script>
+<script>
+    var osType = 3;
+    var u = navigator.userAgent, app = navigator.appVersion;
+    var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //g
+    var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
+    if (isAndroid) {
+        //这个是安卓操作系统
+        osType = 2;
+    }
+    if (isIOS) {
+        //这个是ios操作系统
+        osType = 1;
+    }
+
+    $(function () {
+        $(".safe-foot2").on('click', function () {
+            $('.safe-detail').removeClass('on');
+            $('.safe-cover').removeClass('on');
+        });
+        $(".safe-btn").on('click', function () {
+            $('.safe-detail').addClass('on');
+            $('.safe-cover').addClass('on');
+        });
+        $(".safe-foot").on('click', function () {
+            $('.safe-detail').removeClass('on');
+            $('.safe-cover').removeClass('on');
+        });
+
+        $("#mobile").on('focus', function () {
+            $("#hideInput").css({'display': 'block'})
+            $(this).removeClass("placeholderCenter") /*修改*/
+            /*  $(this).addClass("placeholderLeft") */
+        });
+
+        $(".cancel").on('click', function () {
+            $(".logOut-Prompt").hide();
+        });
+        $(".sure").on('click', function () {
+            window.location.href="http://www.bojiatouzi.com/web/user/login";
+        });
+
+        $("#switch").on('click', function () {
+            hideHook()
+        });
+        $("#mobile").on('focus', function () {
+            showHook()
+        });
+
+        function showHook() {
+            if ($('.hook').eq(0).hasClass('hideHook')) {
+                $(".hook").each(function () {
+                    $(this).removeClass('hideHook')
+                })
+            }
+        }
+
+        function hideHook() {
+            $(".hook").each(function () {
+                $(this).addClass('hideHook')
+            })
+        }
+
+        /*$('.icon-check-circle').on('click', function ()  else {
+         $(this).addClass('check');
+         $('#hiddenCheck').attr("checked", 'true');
+         }
+         });*/
+        /*错误提示*/
+        function showError(text) { //传错误内容
+            $(".error-wrapper").css({
+                'opacity': '1',
+                'visibility': 'visible'
+            });
+            $(".error-wrapper").html(text);
+            setTimeout(function () {
+                $(".error-wrapper").css({
+                    'opacity': '0',
+                    'visibility': 'hidden'
+                });
+            }, 2000)
+        }
+
+        /*错误提示*/
+        /*发送验证码*/
+        /*验证码倒计时*/
+        var InterValObj;
+        var curCount;
+        var canClick=true;
+        function sendMessage(sf) {
+            //设置button效果,开始计时
+            if(canClick){
+                curCount = 60;
+                canClick=false;
+                sf.text('(' + curCount + "s)" + "后重发");
+                InterValObj = window.setInterval(function () {
+                    SetRemainTime(sf)
+                }, 1000); //启动计时器,1秒执行一次
+                //向后台发送处理数据
+                var phone_number = $('#mobile').val();
+                //首先判断是否新用户
+                $.ajax({
+                    type:'POST',
+                    url: "/active/index/registersendmobilecode.html",
+                    data: {"mobile": phone_number},
+                    dataType: 'json',
+                    success: function (data) {
+                        if(data.code != 1){
+                            $(".logOut-Prompt").show();
+                        }else{
+                            /*$.ajax({
+                             type: "POST", //用POST方式传输
+                             dataType: "JSON", //数据格式:JSON
+                             url: '/m/sys/sendvercode', //目标地址
+                             data: {
+                             mobile:phone_number,
+                             scene:"101",
+                             code:$(".v_code_input").val()
+                             },
+                             error: function (data) {
+                             },
+                             success: function (data) {
+                             if(data.code == '0'){
+                             showError(data.message);
+                             }else if(data.code=="107"){
+                             }else{
+                             if(data.message != null){
+                             showError("验证码发送过于频繁,请稍后再试");
+                             }
+                             }
+                             }
+                             });*/
+                        }
+                    }
+                });
+
+            }
+        }
+
+        //timer处理函数
+        function SetRemainTime(sf) {
+            if (curCount == 0) {
+                window.clearInterval(InterValObj);//停止计时器
+                sf.removeAttr("disabled");//启用按钮
+                canClick=true;
+                sf.text(" 重新发送");
+            }
+            else {
+                curCount--;
+                sf.text('(' + curCount + "s)" + "");
+            }
+        }
+
+        $('.get-code').on('click', function () { //执行获取验证码
+
+            var phone = $('#mobile').val();
+            if (!(/^1[3|4|5|7|8]\d{9}$/.test(phone))) {
+                showError('手机号码格式错误')
+                return false
+            }
+            else {
+                var sf = $(this);
+
+                sendMessage(sf);
+            }
+        });
+
+        $(".submitBtn").on('click', function () {
+            var mobile = $("#mobile").val()
+            var code = $("#code").val()
+            var check = $('#hiddenCheck').attr('checked');
+            var passwordRe =  $("#passwordRe").val();
+            var password =  $("#password").val();
+            if (!(/^1[3|4|5|7|8]\d{9}$/.test(mobile))) {
+                showError('手机号码格式错误')
+                return false
+            } else if (!code) {
+                showError('验证码错误')
+                return false
+            } else {
+                if(password != passwordRe) {
+                    showError('两次输入密码不一致')
+                    return false
+                }
+                if(password.length < 6 || passwordRe.length < 6) {
+                    showError('密码长度必须6位或以上')
+                    return false
+                }
+                $.ajax({
+                    type: 'POST',
+                    url: "/active/index/register.html",
+                    data: {mobile: mobile, mobileCode: code, password:password, passwordRe:passwordRe, osType:osType, channel:'{$channel}'},
+                    dataType: 'json',
+                    success: function (data) {
+                        if(data.code == 1){
+                            alert("注册成功,点击确定领取888元红包吧")
+                            window.location.href="http://www.bojiatouzi.com/web/user/login";//注册成功跳下载页
+                        } else {
+                            showError(data.msg);
+                        }
+                    },
+                    error: function (data) {
+
+                    }
+                });
+            }
+        })
+
+
+
+        $("#code").on("focus",function(){
+            this.scrollIntoView(true)
+        })
+
+        $("#password").on("focus",function(){
+            this.scrollIntoView(true)
+        })
+
+        $("#passwordRe").on("focus",function(){
+            this.scrollIntoView(true)
+        })
+        /*window.addEventListener("resize", function () {
+         if (document.activeElement.tagName == "INPUT" || document.activeElement.tagName == "TEXTAREA") {
+         window.setTimeout(function () {
+         document.activeElement.scrollIntoViewIfNeeded();
+         console.log(123);
+         }, 0);
+         }
+         })*/
+    })
+
+    /*var share = {
+     picurl:'https://easyloan-static.fintechzh.com/static/wallet/images/licailogo.png',
+     sharetitle:'推荐你【纵横理财】,安全高息!一起来赚钱!',
+     sharecontent:'与主板上市公司股东联合发起,国有基金参与投资,注册送888元现金红包'
+     };
+
+     var wxconfig = {
+     appId :'wx56cac733eec25be9',
+     nonceStr :'c561f9fd-c469-4c79-b8a9-4c3ab286c4cf',
+     timestamp :'1516454316',
+     //url : 'http://m.lifo.com.cn/toutiao/sharedetailforxzapp?uuid=9b3109eb-93d7-11e7-8e02-6c92bf482157&from=singlemessage&isappinstalled=0',
+     signature :'d1ff2f4c9332f0f58bbd03400d605d37cb35e4df'
+
+     };
+
+     wx.config({
+     //debug: true,
+     debug: false,
+     appId: wxconfig.appId,
+     timestamp: wxconfig.timestamp,
+     nonceStr: wxconfig.nonceStr,
+     signature: wxconfig.signature,
+     jsApiList: ['checkJsApi','onMenuShareTimeline', 'onMenuShareAppMessage'] // 功能列表,我们要使用JS-SDK的什么功能
+     });
+
+     wx.ready(function(){
+     wx.onMenuShareTimeline({
+     title: share.sharetitle, // 分享标题
+     link: location.href, // 分享链接
+     imgUrl: share.picurl, // 分享图标
+     success: function () {
+     // 用户确认分享后执行的回调函数
+
+
+     },
+     cancel: function () {
+     // 用户取消分享后执行的回调函数
+
+     }
+     });
+
+     wx.onMenuShareAppMessage({
+     title: share.sharetitle, // 分享标题
+     desc: share.sharecontent, // 分享描述
+     link: location.href, // 分享链接
+     imgUrl: share.picurl, // 分享图标
+     success: function () {
+     // 用户确认分享后执行的回调函数
+     //alert("成功");
+
+     },
+     cancel: function () {
+     // 用户取消分享后执行的回调函数
+     //alert("失败");
+     }
+     });
+
+     });*/
+
+
+
+</script>
+
+</body></html>

+ 21 - 0
application/active/view/index_updateApp.html

@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
+<meta name="apple-mobile-web-app-capable" content="yes" />
+<meta name="format-detection" content="telephone=no" />
+<title>佳乾财富 - 全新版本升级公告</title>
+<meta name="description" content="">
+<meta name="keywords" content="">
+<link href="{$resourcePath}/css/reset.css" rel="stylesheet">
+<script type="text/javascript" src="{$resourcePath}/js/width-conversion.js"></script>
+</head>
+<body>
+    <img src="{$resourcePath}/img/active_d1.png" alt="" style="display: block;width: 100%;">
+    <img src="{$resourcePath}/img/active_d2.png" alt="" style="display: block;width: 100%;">
+    <img src="{$resourcePath}/img/active_d3.png" alt="" style="display: block;width: 100%;">
+    <img src="{$resourcePath}/img/active_d4.png" alt="" style="display: block;width: 100%;">
+</body>
+</html>

+ 29 - 0
application/active/view/index_xinshou.html

@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
+    <meta name="apple-mobile-web-app-capable" content="yes" />
+    <meta name="format-detection" content="telephone=no" />
+    <title>佳乾财富 - 新手红包888元</title>
+    <meta name="description" content="">
+    <meta name="keywords" content="">
+    <link href="{$resourcePath}/css/reset.css" rel="stylesheet">
+    <script type="text/javascript" src="{$resourcePath}/js/width-conversion.js"></script>
+    <script>
+        window.onload=function(){
+            var u=window.navigator.userAgent;
+            if(u.indexOf('iPhone')>-1||u.indexOf('iPad')>-1){
+                submit('佳乾财富 - 新手红包888', 'https://jiaqiancaifu.dahengdian.com/active/index/xinshou', 'https://wxapp.dahengdian.com/mTQD8RLMI5.png');
+            }
+            if(u.indexOf('Android')>-1){
+                window.bj.call('showShareButton', '{"show" : "true","imgUrl":"https://wxapp.dahengdian.com/mTQD8RLMI5.png","shareUrl":"https://jiaqiancaifu.dahengdian.com/active/index/xinshou","title":"佳乾财富 - 新手红包888","content":"佳乾财富 - 新手红包888"}', 0);
+            }
+        }
+    </script>
+</head>
+<body>
+<img src="{$resourcePath}/img/active_d6.jpg" alt="" style="display: block;width: 100%;">
+</body>
+</html>

+ 6 - 0
application/api.txt

@@ -0,0 +1,6 @@
+apidoc -i /home/wwwroot/wxapp.dahengdian.com/application/mobile/logic/ -o /home/wwwroot/wxapp.dahengdian.com/public/apidoc/app/v1/
+/usr/local/lib/node_modules/apidoc/template/
+
+
+
+apidoc -i /home/wwwroot/wxapp.dahengdian.com/application/master/logic/ -o /home/wwwroot/wxapp.dahengdian.com/public/apidoc/master/v1/

+ 127 - 0
application/apidoc/logic/Active.php

@@ -0,0 +1,127 @@
+<?php
+
+    /**
+     * @api {post} active/getActiveList 得到活动列表
+     * @apiVersion 1.0.0
+     * @apiName getActiveList
+     * @apiDescription 得到活动列表
+     * @apiGroup Active
+     *
+     * @apiParam {Number} [pageIndex] 页码
+     * @apiParam {Number} [pageItemCount] 每页条数
+     * @apiParamExample {json} 发送报文:
+    {
+    "pageIndex":1,
+    "pageItemCount":0
+    }
+     *
+     * @apiSuccess {Object[]} activeList 活动列表
+     * @apiSuccess {Number} subjectList.activeID 活动ID
+     * @apiSuccess {String} subjectList.title 活动标题
+     * @apiSuccess {String} subjectList.note 备注
+     * @apiSuccess {String} subjectList.thumbPc Pc标题图片地址
+     * @apiSuccess {String} subjectList.thumbApp App标题图片地址
+     * @apiSuccess {String} subjectList.linkPc Pc跳转地址
+     * @apiSuccess {String} subjectList.linkApp App跳转地址
+     * @apiSuccess {String} subjectList.addTime 添加时间
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功",
+    "content": {
+    "activeList": [
+    {
+    "activeID": 1,
+    "title": "阿斯顿发生掉发",
+    "note": "阿斯顿发生掉发阿斯顿发生掉发阿斯顿发生掉发",
+    "thumbPc": "",
+    "thumbApp": "",
+    "linkPc": "",
+    "linkApp": "",
+    "addTime": "2017-12-23 14:02:09"
+    },
+    {
+    "activeID": 2,
+    "title": "今日活动",
+    "note": "今日活动今日活动哈哈今日活动哈哈今日活动哈哈今日活动哈哈今日活动哈哈今日活动哈哈今日活动哈哈今日活动哈哈今日活动哈哈",
+    "thumbPc": "http://slb.dahengdian.com/51zhangxi/2017/12/23/o06Dih24iH.png",
+    "thumbApp": "http://slb.dahengdian.com/51zhangxi/2017/12/23/5bWVyqXAdq.jpg",
+    "linkPc": "122222222222222222",
+    "linkApp": "1111111111111111111",
+    "addTime": "2017-12-23 14:02:58"
+    }
+    ],
+    "count": 2,
+    "pageItemCount": 10
+    }
+    }
+     * @apiUse CreateUserError
+     */
+    /**
+     * @api {post} active/getActiveList 得到活动列表
+     * @apiVersion 1.0.1
+     * @apiName getActiveList
+     * @apiDescription 得到活动列表
+     * @apiGroup Active
+     *
+     * @apiParam {Number} [pageIndex] 页码
+     * @apiParam {Number} [pageItemCount] 每页条数
+     * @apiParamExample {json} 发送报文:
+    {
+    "pageIndex":1,
+    "pageItemCount":0
+    }
+     *
+     * @apiSuccess {Object[]} activeList 活动列表
+     * @apiSuccess {Number} subjectList.activeID 活动ID
+     * @apiSuccess {String} subjectList.title 活动标题
+     * @apiSuccess {String} subjectList.note 备注
+     * @apiSuccess {String} subjectList.thumbPc Pc标题图片地址
+     * @apiSuccess {String} subjectList.thumbApp App标题图片地址
+     * @apiSuccess {String} subjectList.linkPc Pc跳转地址
+     * @apiSuccess {String} subjectList.linkApp App跳转地址
+     * @apiSuccess {String} subjectList.addTime 添加时间
+     * @apiSuccess {Object} subjectList.share 分享参数,如果没有分享功能,则该参数不返回
+     * @apiSuccess {Object} subjectList.share.headImgUrl 分享图标
+     * @apiSuccess {String} subjectList.share.title 分享标题
+     * @apiSuccess {String} subjectList.share.desc 分享描述
+     * @apiSuccess {String} subjectList.share.link 分享链接
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功",
+    "content": {
+    "activeList": [
+    {
+    "activeID": 1,
+    "title": "阿斯顿发生掉发",
+    "note": "阿斯顿发生掉发阿斯顿发生掉发阿斯顿发生掉发",
+    "thumbPc": "",
+    "thumbApp": "",
+    "linkPc": "",
+    "linkApp": "",
+    "addTime": "2017-12-23 14:02:09",
+    "share": {
+    "headImgUrl":"https://static.qimai.cn/static/img/newaso100@2x.png",
+    "title":"11334466778899",
+    "desc":"11334466778899",
+    "link":"http://www.qq.com"
+    }
+    },
+    {
+    "activeID": 2,
+    "title": "今日活动",
+    "note": "今日活动今日活动哈哈今日活动哈哈今日活动哈哈今日活动哈哈今日活动哈哈今日活动哈哈今日活动哈哈今日活动哈哈今日活动哈哈",
+    "thumbPc": "http://slb.dahengdian.com/51zhangxi/2017/12/23/o06Dih24iH.png",
+    "thumbApp": "http://slb.dahengdian.com/51zhangxi/2017/12/23/5bWVyqXAdq.jpg",
+    "linkPc": "122222222222222222",
+    "linkApp": "1111111111111111111",
+    "addTime": "2017-12-23 14:02:58"
+    }
+    ],
+    "count": 2,
+    "pageItemCount": 10
+    }
+    }
+     * @apiUse CreateUserError
+     */

+ 17 - 0
application/apidoc/logic/Base.php

@@ -0,0 +1,17 @@
+<?php
+
+
+
+/**
+ * @apiDefine CreateUserError
+ * @apiVersion 0.2.0
+ *
+ * @apiError code 错误标示
+ * @apiError msg 错误信息
+ *
+ * @apiErrorExample  返回格式举例:
+ *     {
+ *       "code": 400,
+ *       "msg": "没找到接口",
+ *     }
+ */

+ 164 - 0
application/apidoc/logic/Cang.php

@@ -0,0 +1,164 @@
+<?php
+
+    /**
+     * @api {post} cang/create 投资一个标的
+     * @apiVersion 1.0.0
+     * @apiName create
+     * @apiDescription 投资一个标的
+     * @apiGroup Cang
+     *
+     * @apiParam {String} moneySubject 投资金额(相对标的金额,非本金,非支付金额)
+     * @apiParam {Array} [hongbaoIDS] 红包ID列表
+     * @apiParam {Number} subjectID 标的ID
+     * @apiParamExample {json} 发送报文:
+    {
+    "app": {
+    "moneySubject": "1000.00",
+    "hongbaoIDS": [12,13],
+    "subjectID": 19
+    },
+    "sign": "4297f44b13955235245b2497399d7a93"
+    }
+     *
+     * @apiSuccess {Number} cangID 新生成的持仓ID
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功",
+    "content": {
+    "cangID": "6"
+    },
+    "sign": "4297f44b13955235245b2497399d7a93"
+    }
+     * @apiUse CreateUserError
+     */
+
+    /**
+     * @api {post} cang/getCangList 得到我的投资列表
+     * @apiVersion 1.0.0
+     * @apiName getCangList
+     * @apiDescription 得到我的投资列表
+     * @apiGroup Cang
+     *
+     * @apiParam {Number=[1,2]} status 1为持有中,2为已回款
+     * @apiParamExample {json} 发送报文:
+    {
+    "status": 1
+    }
+     *
+     * @apiSuccess {Object[]} cangList 我的投资列表
+     * @apiSuccess {Number} cangList.cangID ID
+     * @apiSuccess {Number} cangList.moneySubject 投资份额(非本金,非实际支付金额)
+     * @apiSuccess {Number} cangList.status 状态,1-已持有,4-已计息,5-已回款
+     * @apiSuccess {String} cangList.statusText 状态描述,参考状态
+     * @apiSuccess {String} cangList.payTime 交易时间
+     * @apiSuccess {String} cangList.interestBeginTime 起息日期
+     * @apiSuccess {String} cangList.interestEndTime 停止计息日
+     * @apiSuccess {String} cangList.repayTimeText 回款时间描述
+     * @apiSuccess {String} cangList.year 年化
+     * @apiSuccess {String} cangList.yearExt 追加年化
+     * @apiSuccess {String} cangList.yearSystem 系统年化(废弃)
+     * @apiSuccess {String} cangList.ben 实际投入本金
+     * @apiSuccess {String} cangList.interest 利息
+     * @apiSuccess {Number} cangList.investDay 投资天数
+     * @apiSuccess {Object} cangList.subject 相关标的
+     * @apiSuccess {String} cangList.subject.title 标的标题
+     * @apiSuccess {Number} cangList.subject.subjectTypeID 标的类型
+     * @apiSuccess {Number} cangList.subject.interestTypeID 计息类型
+     * @apiSuccess {Number} cangList.subject.interestTimeTypeID 计息时间类型
+     * @apiSuccess {String} cangList.subject.reachTime 标的标题
+     * @apiSuccess {String} cangList.subject.title 标的标题
+     * @apiSuccess {Object[]} cangList.cangRepay 预回款清单
+     * @apiSuccess {String} cangList.cangRepay.money 回款金额
+     * @apiSuccess {String} cangList.cangRepay.repayTime 回款类型
+     * @apiSuccess {String} cangList.cangRepay.resultTime 实际到款时间
+     * @apiSuccess {String} cangList.cangRepay.reachTime 到款时间
+     * @apiSuccess {Number} cangList.cangRepay.status 清单状态,1-未回款,2-已回款,3-已到账(该状态可隐藏)
+     * @apiSuccess {Number} cangList.cangRepay.repayTypeID 清单类型,1-本金,2-利息
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功",
+    "content": {
+    "cangList": [
+    {
+    "cangID": 33,
+    "moneySubject": "2000.00",
+    "status": 4,
+    "payTime": "2017-12-12 20:53:50",
+    "interestBeginTime": "2017-12-12",
+    "interestEndTime": "2017-12-23",
+    "year": "12.80",
+    "yearExt": "2.00",
+    "yearSystem": "2.00",
+    "ben": "2000.00",
+    "interest": "7.01",
+    "investDay": 10,
+    "subject": {
+    "subjectTypeID": 2,
+    "interestTypeID": 1,
+    "interestTimeTypeID": 1,
+    "title": "普通标11111"
+    },
+    "cangRepay": [
+    {
+    "money": "2000.00",
+    "repayTime": "2017-12-22",
+    "reachTime": "2017-12-23",
+    "resultTime": "2017-12-12",
+    "status": 1,
+    "repayTypeID": 1
+    },
+    {
+    "money": "7.01",
+    "repayTime": "2017-12-22",
+    "reachTime": "2017-12-23",
+    "resultTime": "2017-12-12",
+    "status": 1,
+    "repayTypeID": 2
+    }
+    ],
+    "statusText": "计息中"
+    },
+    {
+    "cangID": 30,
+    "moneySubject": "98000.00",
+    "status": 4,
+    "payTime": "2017-12-12 18:28:27",
+    "interestBeginTime": "2017-12-12",
+    "year": "12.80",
+    "ben": "98000.00",
+    "interest": "343.67",
+    "investDay": 10,
+    "subject": {
+    "subjectTypeID": 2,
+    "interestTypeID": 1,
+    "interestTimeTypeID": 1,
+    "title": "普通标11111"
+    },
+    "cangRepay": [
+    {
+    "money": "98000.00",
+    "repayTime": "2017-12-22",
+    "reachTime": "2017-12-23",
+    "resultTime": "2017-12-12",
+    "status": 1,
+    "repayTypeID": 1
+    },
+    {
+    "money": "343.67",
+    "repayTime": "2017-12-22",
+    "reachTime": "2017-12-23",
+    "resultTime": "2017-12-12",
+    "status": 1,
+    "repayTypeID": 2
+    }
+    ],
+    "statusText": "计息中"
+    }
+    ]
+    },
+    "sign": "4297f44b13955235245b2497399d7a93"
+    }
+     * @apiUse CreateUserError
+     */

+ 20 - 0
application/apidoc/logic/Ext.php

@@ -0,0 +1,20 @@
+<?php
+
+    /**
+     * @api {post} ext/getLoginAd 得到填写手机号页面的广告
+     * @apiVersion 1.0.0
+     * @apiName getLoginAd
+     * @apiDescription 得到填写手机号页面的广告
+     * @apiGroup Ext
+     *
+     * @apiSuccess {String} content 图片url,比如http://www.baidu.com/image.jpg
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功",
+    "content": {
+    "content": "http://www.baidu.com/image.jpg"
+    }
+    }
+     * @apiUse CreateUserError
+     */

File diff suppressed because it is too large
+ 495 - 0
application/apidoc/logic/Index.php


+ 534 - 0
application/apidoc/logic/Subject.php

@@ -0,0 +1,534 @@
+<?php
+
+
+    /**
+     * @api {post} subject/getSubjectList 得到产品列表
+     * @apiVersion 1.0.0
+     * @apiName getSubjectList
+     * @apiDescription 得到产品列表
+     * @apiGroup Subject
+     *
+     * @apiParam {Number=[0,1,2]} [orderTerm] 期限次序,1由高到低,2由低到高,0无效
+     * @apiParam {Number=[0,1,2} [orderYear] 年化次序,1由高到低,2由低到高,0无效
+     * @apiParam {Number} [term] 期数,比如15,代表15天标
+     * @apiParam {Number} [status] 状态,0全部,1热卖中,2已售罄,3还款中
+     * @apiParam {Number=[1,2,3]} [subjectTypeID] 1-新手标,2-享车贷,3-优车贷
+     * @apiParam {Number} [pageIndex] 页码
+     * @apiParam {Number} [pageItemCount] 每页条数
+     * @apiParamExample {json} 发送报文:
+    {
+    "orderTerm": 0,
+    "orderYear": 0,
+    "term":15,
+    "status":15,
+    "subjectTypeID":1,
+    "pageIndex":1,
+    "pageItemCount":0
+    }
+     *
+     * @apiSuccess {Object[]} subjectList 产品列表
+     * @apiSuccess {Number} subjectList.subjectID 产品ID
+     * @apiSuccess {Number} subjectList.term 期限
+     * @apiSuccess {Number} subjectList.unit 期限单位,“天”,“月”,“年”
+     * @apiSuccess {String} subjectList.title 标题
+     * @apiSuccess {String} subjectList.price 总额
+     * @apiSuccess {String} subjectList.year 年化
+     * @apiSuccess {String} subjectList.yearSystem 追加年化
+     * @apiSuccess {String} subjectList.basePrice 起投金额
+     * @apiSuccess {String} subjectList.baseMaxPrice 最大投资金额
+     * @apiSuccess {String} subjectList.addTime 添加时间
+     * @apiSuccess {String} subjectList.repayTime 还款时间
+     * @apiSuccess {Number} subjectList.status 状态值,3-抢购中,4-已售罄
+     * @apiSuccess {String} subjectList.statusText 状态描述
+     * @apiSuccess {String} subjectList.alias 编号
+     * @apiSuccess {Number} subjectList.loanID 借款ID
+     * @apiSuccess {Number} subjectList.hongbao 可以使用红包个数
+     * @apiSuccess {String} subjectList.interestBeginTime 起息时间
+     * @apiSuccess {String} subjectList.overTime 到期时间
+     * @apiSuccess {String} subjectList.reachTime 到账时间
+     * @apiSuccess {Number} subjectList.investDay 剩余投资天数
+     * @apiSuccess {Object} subjectList.subjectType 产品类型
+     * @apiSuccess {String} subjectList.subjectType.name 描述
+     * @apiSuccess {String} subjectList.subjectType.icon 分类图标
+     * @apiSuccess {String} subjectList.subjectType.subjectTypeID 类型ID,1-新手标,2-精品标,3-长久标
+     * @apiSuccess {Object} subjectList.interestType 计息类型
+     * @apiSuccess {String} subjectList.interestType.name 描述
+     * @apiSuccess {Number} subjectList.interestType.interestTypeID 类型ID
+     * @apiSuccess {Object} subjectList.interestTimeType 计息时间类型
+     * @apiSuccess {String} subjectList.interestTimeType.name 描述
+     * @apiSuccess {String} subjectList.interestTimeType.text 年化描述
+     * @apiSuccess {Number} subjectList.interestTimeType.interestTimeTypeID 类型ID
+     * @apiSuccess {Object} subjectList.subjectStat 统计
+     * @apiSuccess {String} subjectList.subjectStat.moneyTotalInvest 已投资
+     * @apiSuccess {Number} subjectList.subjectStat.timesInvest 已投次数
+     * @apiSuccess {Number} subjectList.contentUrl1 产品说明
+     * @apiSuccess {Number} subjectList.contentUrl2 项目详情
+     * @apiSuccess {Number} subjectList.contentUrl3 投标记录
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功",
+    "content": {
+    "subjectList": [
+    {
+    "subjectID": 1,
+    "term": 1,
+    "unit":"天",
+    "title": "新手理财818",
+    "price": "100000.00",
+    "year": "12.80",
+    "yearSystem": "12.80",
+    "basePrice": "100.00",
+    "baseMaxPrice": "100000.00",
+    "addTime": "2017-12-04 11:12:47",
+    "interestBeginTime":"购买日",
+    "reachTime": "2017-12-04",
+    "status": 3,
+    "alias": "20171204111247GuSFSa",
+    "loanID": 0,
+    "hongbao": 0,
+    "overTime": "2017-12-05 00:00:00",
+    "subjectType": {
+    "icon": "http://www.baidu.com/bj.jpg",
+    "name": "新手理财",
+    "subjectTypeID": 2
+    },
+    "interestType": {
+    "name": "一次性还本付息",
+    "interestTypeID": 2
+    },
+    "interestTimeType": {
+    "text": "预期年化",
+    "name": "T成交日 + 0",
+    "interestTimeTypeID": 2
+    },
+    "subjectStat": {
+    "moneyTotalInvest": "0.00",
+    "timesInvest": 0
+    },
+    "statusText": "已发布",
+    "investDay": 1,
+    "repayTime": "2017-12-05 00:00:00",
+    "contentUrl1": "http://www.baidu.com",
+    "contentUrl2": "http://www.baidu.com",
+    "contentUrl3": "http://www.baidu.com"
+    }
+    ]
+    }
+    }
+     * @apiUse CreateUserError
+     */
+
+    /**
+     * @api {post} subject/getSubjectDetail 得到产品详细
+     * @apiVersion 1.0.0
+     * @apiName getSubjectDetail
+     * @apiDescription 得到产品详细
+     * @apiGroup Subject
+     *
+     * @apiParam {Number} subjectID 产品ID
+     * @apiParamExample {json} 发送报文:
+    {
+    "subjectID": 12
+    }
+     *
+     * @apiSuccess {Object} subjectDetail 产品详细
+     * @apiSuccess {Number} subjectDetail.subjectID 产品ID
+     * @apiSuccess {Number} subjectDetail.term 期限
+     * @apiSuccess {Number} subjectDetail.unit 期限单位,“天”,“月”,“年”
+     * @apiSuccess {String} subjectDetail.title 标题
+     * @apiSuccess {String} subjectDetail.price 总额
+     * @apiSuccess {String} subjectDetail.year 年化
+     * @apiSuccess {String} subjectDetail.yearSystem 追加年化
+     * @apiSuccess {String} subjectDetail.basePrice 起投金额
+     * @apiSuccess {String} subjectDetail.baseMaxPrice 最大投资金额
+     * @apiSuccess {String} subjectDetail.addTime 添加时间
+     * @apiSuccess {String} subjectDetail.repayTime 还款时间
+     * @apiSuccess {Number} subjectDetail.status 状态值,3-抢购中,4-已售罄
+     * @apiSuccess {String} subjectDetail.statusText 状态描述
+     * @apiSuccess {String} subjectDetail.alias 编号
+     * @apiSuccess {Number} subjectDetail.loanID 借款ID
+     * @apiSuccess {Number} subjectDetail.hongbao 可以使用红包个数
+     * @apiSuccess {String} subjectDetail.overTime 到期时间
+     * @apiSuccess {String} subjectDetail.interestBeginTime 起息日
+     * @apiSuccess {String} subjectDetail.reachTime 到账时间
+     * @apiSuccess {Number} subjectDetail.investDay 剩余投资天数
+     * @apiSuccess {Object} subjectDetail.subjectType 产品类型
+     * @apiSuccess {String} subjectDetail.subjectType.icon 分类图标
+     * @apiSuccess {String} subjectDetail.subjectType.name 描述
+     * @apiSuccess {String} subjectDetail.subjectType.subjectTypeID 类型ID,1-新手标,2-精品标,3-长久标
+     * @apiSuccess {Object} subjectDetail.interestType 计息类型
+     * @apiSuccess {String} subjectDetail.interestType.name 描述
+     * @apiSuccess {Number} subjectDetail.interestType.interestTypeID 类型ID
+     * @apiSuccess {Object} subjectDetail.interestTimeType 计息时间类型
+     * @apiSuccess {String} subjectDetail.interestTimeType.name 描述
+     * @apiSuccess {String} subjectDetail.interestTimeType.text 年化描述
+     * @apiSuccess {Number} subjectDetail.interestTimeType.interestTimeTypeID 类型ID
+     * @apiSuccess {Object} subjectDetail.subjectStat 统计
+     * @apiSuccess {String} subjectDetail.subjectStat.moneyTotalInvest 已投资
+     * @apiSuccess {Number} subjectDetail.subjectStat.timesInvest 已投次数
+     * @apiSuccess {String} subjectDetail.contentUrl1 产品说明
+     * @apiSuccess {String} subjectDetail.contentUrl2 项目详情
+     * @apiSuccess {String} subjectDetail.contentUrl3 投标记录
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功",
+    "content": {
+    "subjectDetail":{
+    "subjectID": 1,
+    "term": 1,
+    "unit":"天",
+    "title": "新手理财818",
+    "price": "100000.00",
+    "year": "12.80",
+    "yearSystem": "12.80",
+    "basePrice": "100.00",
+    "baseMaxPrice": "100000.00",
+    "addTime": "2017-12-04 11:12:47",
+    "interestBeginTime":"购买日",
+    "reachTime": "2017-12-04",
+    "status": 3,
+    "alias": "20171204111247GuSFSa",
+    "loanID": 0,
+    "hongbao": 0,
+    "overTime": "2017-12-05 00:00:00",
+    "subjectType": {
+    "icon": "http://www.baidu.com/bj.jpg",
+    "name": "新手理财",
+    "subjectTypeID": 2
+    },
+    "interestType": {
+    "name": "一次性还本付息",
+    "interestTypeID": 2
+    },
+    "interestTimeType": {
+    "text": "预期年化",
+    "name": "T成交日 + 0",
+    "interestTimeTypeID": 2
+    },
+    "subjectStat": {
+    "moneyTotalInvest": "0.00",
+    "timesInvest": 0
+    },
+    "statusText": "已发布",
+    "investDay": 1,
+    "repayTime": "2017-12-05 00:00:00"
+    },
+    "contentUrl1":"http://www.baidu.com",
+    "contentUrl2":"http://www.baidu.com",
+    "contentUrl3":"http://www.baidu.com"
+    }
+    }
+     * @apiUse CreateUserError
+     */
+
+
+    /**
+     * @api {post} subject/getSubjectContent 得到产品合同及投资记录
+     * @apiVersion 1.0.0
+     * @apiName getSubjectContent
+     * @apiDescription 得到产品合同及投资记录
+     * @apiGroup Subject
+     *
+     * @apiParam {Number} subjectID 产品ID
+     * @apiParamExample {json} 发送报文:
+    {
+    "subjectID": 12
+    }
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功",
+    "content": {
+    "cangList": [{
+    "cangID": 1887,
+    "subjectID": 766,
+    "userID": 17679,
+    "alias": "CP2018021014023800001887",
+    "moneySubject": "1000.00",
+    "status": 4,
+    "addTime": "2018-02-10 14:02:38",
+    "payTime": "2018-02-10 15:20:05",
+    "updateTime": "2018-02-10 14:02:43",
+    "interestBeginTime": "2018-02-10",
+    "interestEndTime": "1970-01-02",
+    "repayTime": 0,
+    "year": "0.00",
+    "ben": "1000.00",
+    "yearSystem": "0.00",
+    "interest": "0.00",
+    "investDay": 0,
+    "interestTimeTypeID": 0,
+    "isForged": 1,
+    "yearExt": "0.00",
+    "hongbao": "",
+    "outerNumber": "",
+    "osType": 0,
+    "ip": "",
+    "money": "0.00",
+    "BACKUPID": 0,
+    "masterID": "",
+    "isFutou": 0,
+    "user": {
+    "userID": 17679,
+    "uuid": "",
+    "trueName": "李平平",
+    "mobile": "17355246589",
+    "password": "asdfasdfasasdfasdfasdfasdfasdfsd",
+    "channelID": 0,
+    "passport": "",
+    "addTime": "1970-01-01 08:00:00",
+    "updateTime": "1970-01-01 08:00:00",
+    "status": 0,
+    "token": "",
+    "tokenOverTime": 0,
+    "isAuthTrueName": 0,
+    "isAuthBank": 0,
+    "isFuyougold": 0,
+    "avatar": "http:\/\/slb.dahengdian.com\/jiaqiancaifu\/2018\/01\/03\/V5KL8LKbLE.png",
+    "gender": 0,
+    "areaID": 0,
+    "deviceID": "",
+    "osV": "",
+    "osType": 0,
+    "ip": "",
+    "isForged": 1,
+    "isNewInvest": 0,
+    "tokenWap": "",
+    "tokenPc": "",
+    "tokenOverTimeWap": 0,
+    "tokenOverTimePc": 0,
+    "loginTime": "",
+    "loginOsType": 0,
+    "vip": 0,
+    "email": "",
+    "BACKUPID": 0,
+    "apiV": "",
+    "appV": ""
+    }
+    }, {
+    "cangID": 1880,
+    "subjectID": 766,
+    "userID": 19994,
+    "alias": "CP2018021011443200001880",
+    "moneySubject": "4600.00",
+    "status": 3,
+    "addTime": "2018-02-10 11:44:32",
+    "payTime": "2018-02-10 11:44:32",
+    "updateTime": "2018-02-10 11:44:32",
+    "interestBeginTime": "2018-02-10",
+    "interestEndTime": "2018-02-25",
+    "repayTime": 0,
+    "year": "18.00",
+    "ben": "4600.00",
+    "yearSystem": "0.00",
+    "interest": "36.30",
+    "investDay": 15,
+    "interestTimeTypeID": 3,
+    "isForged": 0,
+    "yearExt": "1.20",
+    "hongbao": "423820",
+    "outerNumber": "fuyou151823427212578",
+    "osType": 1,
+    "ip": "218.57.182.73",
+    "money": "4600.00",
+    "BACKUPID": 0,
+    "masterID": "",
+    "isFutou": 0,
+    "user": {
+    "userID": 19994,
+    "uuid": "5Ceh4akjW3EB0tMikG3LG8xCeeS0ONUS",
+    "trueName": "王敏",
+    "mobile": "13792629520",
+    "password": "d161a617d5e174e450600ad6bd91cdee",
+    "channelID": 68,
+    "passport": "370724198812061861",
+    "addTime": "2018-02-10 11:40:04",
+    "updateTime": "2018-02-10 12:12:17",
+    "status": 0,
+    "token": "",
+    "tokenOverTime": 0,
+    "isAuthTrueName": 1,
+    "isAuthBank": 1,
+    "isFuyougold": 0,
+    "avatar": "http:\/\/slb.dahengdian.com\/jiaqiancaifu\/2018\/01\/03\/V5KL8LKbLE.png",
+    "gender": 0,
+    "areaID": 0,
+    "deviceID": "A812975A-901A-45DB-AFEE-1902D04F4FF4",
+    "osV": "10.3.3",
+    "osType": 1,
+    "ip": "218.57.182.73",
+    "isForged": 0,
+    "isNewInvest": 0,
+    "tokenWap": "",
+    "tokenPc": "",
+    "tokenOverTimeWap": 0,
+    "tokenOverTimePc": 0,
+    "loginTime": 0,
+    "loginOsType": 1,
+    "vip": 0,
+    "email": "",
+    "BACKUPID": 0,
+    "apiV": "",
+    "appV": "1.0"
+    }
+    }, {
+    "cangID": 1876,
+    "subjectID": 766,
+    "userID": 19993,
+    "alias": "CP2018021011152700001876",
+    "moneySubject": "1000.00",
+    "status": 3,
+    "addTime": "2018-02-10 11:15:27",
+    "payTime": "2018-02-10 11:15:27",
+    "updateTime": "2018-02-10 11:15:32",
+    "interestBeginTime": "2018-02-10",
+    "interestEndTime": "2018-02-25",
+    "repayTime": 0,
+    "year": "18.00",
+    "ben": "1000.00",
+    "yearSystem": "0.00",
+    "interest": "7.89",
+    "investDay": 15,
+    "interestTimeTypeID": 3,
+    "isForged": 0,
+    "yearExt": "1.20",
+    "hongbao": "423789",
+    "outerNumber": "fuyou151823252788142",
+    "osType": 2,
+    "ip": "192.168.2.200",
+    "money": "1000.00",
+    "BACKUPID": 0,
+    "masterID": "",
+    "isFutou": 0,
+    "user": {
+    "userID": 19993,
+    "uuid": "MKQunLSM7X9WG5UaEn6rzhAeH5OTwbkk",
+    "trueName": "周海",
+    "mobile": "18124214379",
+    "password": "396af95650121f7dc1e997f77f0513fb",
+    "channelID": 55,
+    "passport": "441781199301106811",
+    "addTime": "2018-02-10 11:09:49",
+    "updateTime": "2018-02-10 11:15:27",
+    "status": 0,
+    "token": "5cf10e3d81a53d82ab6e9c5b30bc6006",
+    "tokenOverTime": 1518836989,
+    "isAuthTrueName": 1,
+    "isAuthBank": 1,
+    "isFuyougold": 0,
+    "avatar": "http:\/\/slb.dahengdian.com\/jiaqiancaifu\/2018\/01\/03\/V5KL8LKbLE.png",
+    "gender": 0,
+    "areaID": 0,
+    "deviceID": "8E4ECC0DD4AA90AACEB64703BA7EEE42",
+    "osV": "7.1.1",
+    "osType": 2,
+    "ip": "192.168.2.200",
+    "isForged": 0,
+    "isNewInvest": 0,
+    "tokenWap": "",
+    "tokenPc": "",
+    "tokenOverTimeWap": 0,
+    "tokenOverTimePc": 0,
+    "loginTime": 0,
+    "loginOsType": 2,
+    "vip": 0,
+    "email": "",
+    "BACKUPID": 0,
+    "apiV": "1.0.0",
+    "appV": "2.0.0"
+    }
+    }, {
+    "cangID": 1875,
+    "subjectID": 766,
+    "userID": 17653,
+    "alias": "CP2018021010150200001875",
+    "moneySubject": "1000.00",
+    "status": 4,
+    "addTime": "2018-02-10 10:15:02",
+    "payTime": "2018-02-10 15:20:05",
+    "updateTime": "2018-02-10 10:15:07",
+    "interestBeginTime": "2018-02-10",
+    "interestEndTime": "1970-01-02",
+    "repayTime": 0,
+    "year": "0.00",
+    "ben": "1000.00",
+    "yearSystem": "0.00",
+    "interest": "0.00",
+    "investDay": 0,
+    "interestTimeTypeID": 0,
+    "isForged": 1,
+    "yearExt": "0.00",
+    "hongbao": "",
+    "outerNumber": "",
+    "osType": 0,
+    "ip": "",
+    "money": "0.00",
+    "BACKUPID": 0,
+    "masterID": "",
+    "isFutou": 0,
+    "user": {
+    "userID": 17653,
+    "uuid": "",
+    "trueName": "冯伞",
+    "mobile": "13715988654",
+    "password": "12365478966555555512222222222222",
+    "channelID": 0,
+    "passport": "",
+    "addTime": "1970-01-01 08:00:00",
+    "updateTime": "1970-01-01 08:00:00",
+    "status": 0,
+    "token": "",
+    "tokenOverTime": 0,
+    "isAuthTrueName": 0,
+    "isAuthBank": 0,
+    "isFuyougold": 0,
+    "avatar": "http:\/\/slb.dahengdian.com\/jiaqiancaifu\/2018\/01\/03\/V5KL8LKbLE.png",
+    "gender": 0,
+    "areaID": 0,
+    "deviceID": "",
+    "osV": "",
+    "osType": 0,
+    "ip": "",
+    "isForged": 1,
+    "isNewInvest": 0,
+    "tokenWap": "",
+    "tokenPc": "",
+    "tokenOverTimeWap": 0,
+    "tokenOverTimePc": 0,
+    "loginTime": "",
+    "loginOsType": 0,
+    "vip": 0,
+    "email": "",
+    "BACKUPID": 0,
+    "apiV": "",
+    "appV": ""
+    }
+    }],
+    "loan": {
+    "loanID": 388,
+    "mobile": "18989706775",
+    "name": "金碎妹",
+    "money": "190000.00",
+    "year": "18.00",
+    "certType": 1,
+    "certContent": "330302195810051220",
+    "pledge": "",
+    "financingEntity": "",
+    "usage": "资金周转",
+    "addTime": "2018-02-08 11:46:22",
+    "updateTime": "2018-02-08 11:46:22",
+    "status": 1,
+    "alias": "",
+    "imageUrl": "http:\/\/slb.dahengdian.com\/jiaqiancaifu\/2018\/02\/08\/PEy3iz3KJv.jpg",
+    "info": "本项目为个人资金周转借款,借款人以名下车辆(梅赛德斯-奔驰汽车)为抵质押物,还款来源有保障。借款人户籍所在地位于江西省。交易过程中佳乾财富平台绝不触碰投资人资金,资金由富友支付第三方支付平台全程托管,并在富友支付及银行的全程托管下直接在投资人及借款人账户流动。",
+    "pledgeType": 1,
+    "contractImageUrl": "http:\/\/slb.dahengdian.com\/jiaqiancaifu\/2018\/02\/08\/fcFMRLKvSv.jpg",
+    "beginTime": 0,
+    "endTime": 0
+    }
+    }
+    }
+     * @apiUse CreateUserError
+     */

+ 297 - 0
application/apidoc/logic/System.php

@@ -0,0 +1,297 @@
+<?php
+
+
+    /**
+     * @api {post} system/getBankList 得到银行列表
+     * @apiVersion 1.0.0
+     * @apiName getUserBankList
+     * @apiDescription 得到银行列表
+     * @apiGroup System
+     *
+     *
+     *
+     * @apiSuccess {Object[]} bankList 第三方支付支持的银行卡列表
+     * @apiSuccess {Number} bankList.bankPlatformID 第三方支付银行卡ID
+     * @apiSuccess {String} bankList.alias 第三方支付银行卡代码
+     * @apiSuccess {Number} bankList.isCredit 是否为信用卡,0-非信用卡,1为信用卡
+     * @apiSuccess {Object} bankList.bank 银行
+     * @apiSuccess {Number} bankList.bank.bankID 银行名称
+     * @apiSuccess {String} bankList.bank.bankName 银行名称
+     * @apiSuccess {String} bankList.bank.appIcon 银行app图标
+     * @apiSuccess {String} bankList.bank.color 银行颜色(废弃)
+     * @apiSuccess {String} bankList.bank.backgroundColor 银行背景色
+     * @apiSuccess {String} bankList.bank.quotaTitle 限额名称描述
+     * @apiSuccess {String} bankList.bank.quotaSingleOrder 单笔限额,单位元
+     * @apiSuccess {String} bankList.bank.quotaSingleDay 单日限额
+     * @apiSuccess {String} bankList.bank.quotaSingleMouth 单月限额
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功",
+    "content": {
+    "bankList": [
+    {
+    "bankPlatformID": 5,
+    "alias": "张奇",
+    "isCredit": "",
+    "bank": {
+    "bankID": 1,
+    "bankName": "中国建设银行",
+    "color": "#5991F0",
+    "quotaTitle": "限额:",
+    "quotaText": "单笔5千 单日五万 单月150万",
+    "quotaSingleDay": 5000000,
+    "quotaSingleOrder": 500000,
+    "appIcon": "http://wxapp.dahengdian.com/static/mobile/image/zhongguo_icon2x.png",
+    "pcIcon": "",
+    "quotaSingleMonth": 500000000,
+    "backgroundColor": "#5991F0"
+    }
+    }
+    ]
+    }
+    }
+     * @apiUse CreateUserError
+     */
+
+
+    /**
+     * @api {post} system/getConfig 得到系统配置
+     * @apiVersion 1.0.0
+     * @apiName getConfig
+     * @apiDescription 得到系统配置
+     * @apiGroup System
+     *
+     * @apiSuccess {Object} config 系统配置
+     * @apiSuccess {Number} config.bankBandMax 至多绑定银行卡个数
+     * @apiSuccess {Number} config.loanAgreementUrl 借款协议url
+     * @apiSuccess {Number} config.riskBulletinUrl 风险揭示书url
+     * @apiSuccess {String} config.rechargeUrl 跳转充值url
+     * @apiSuccess {String} config.rechargeUrl.--money app应用参数,金额
+     * @apiSuccess {Number} config.rechargeUrl.--userBankID app应用参数,用户银行卡ID
+     * @apiSuccess {String} config.drawcashUrl 跳转提现url
+     * @apiSuccess {String} config.drawcashUrl.--money app应用参数,金额
+     * @apiSuccess {Number} config.drawcashUrl.--userBankID app应用参数,用户银行卡ID
+     * @apiSuccess {String} config.userInvitationUrl 邀请注册url
+     * @apiSuccess {String} config.activeUrl 活动url
+     * @apiSuccess {String} config.customerUrl 客服url
+     * @apiSuccess {String} config.aboutUsUrl 关于我们url
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功",
+    "content": {
+    "config": {
+      "bankBandMax":1,
+      "loanAgreementUrl":"http://www.baidu.com?######",
+      "riskBulletinUrl":"http://www.baidu.com?######",
+      "rechargeUrl":"http://wxapp.dahengdian.com/mobile/h5/userRecharge?######",
+      "drawcashUrl":"http://wxapp.dahengdian.com/mobile/h5/userDrawcash?######",
+      "userInvitationUrl":"http://www.baidu.com?######",
+      "activeUrl":"http://www.baidu.com?######",
+      "customerUrl":"http://www.baidu.com?######",
+      "aboutUsUrl":"http://www.baidu.com?######"
+     }
+    }
+    }
+    }
+     * @apiUse CreateUserError
+     */
+    /**
+     * @api {post} system/getConfig 得到系统配置
+     * @apiVersion 1.0.1
+     * @apiName getConfig
+     * @apiDescription 得到系统配置
+     * @apiGroup System
+     *
+     * @apiSuccess {Object} config 系统配置
+     * @apiSuccess {String} config.startPageImage 动态启动页图片url(建议拉伸),建议保持缓存12小时
+     * @apiSuccess {Number} config.bankBandMax 至多绑定银行卡个数
+     * @apiSuccess {String} config.loanAgreementUrl 借款协议url
+     * @apiSuccess {String} config.riskBulletinUrl 风险揭示书url
+     * @apiSuccess {String} config.rechargeUrl 跳转充值url
+     * @apiSuccess {String} config.rechargeUrl.--money app应用参数,金额
+     * @apiSuccess {Number} config.rechargeUrl.--userBankID app应用参数,用户银行卡ID
+     * @apiSuccess {String} config.rechargeWYUrl 跳转网银充值url
+     * @apiSuccess {String} config.rechargeWYUrl.--money app应用参数,金额
+     * @apiSuccess {Number} config.rechargeWYUrl.--userBankID app应用参数,用户银行卡ID
+     * @apiSuccess {String} config.drawcashUrl 跳转提现url
+     * @apiSuccess {String} config.drawcashUrl.--money app应用参数,
+     *
+     * 金额
+     * @apiSuccess {Number} config.drawcashUrl.--userBankID app应用参数,用户银行卡ID
+     * @apiSuccess {String} config.userInvitationUrl 邀请注册url
+     * @apiSuccess {String} config.activeUrl 活动url
+     * @apiSuccess {String} config.customerUrl 客服url
+     * @apiSuccess {String} config.aboutUsUrl 关于我们url
+     * @apiSuccess {String} config.regAgreementUrl 注册协议url
+     * @apiSuccess {String} config.stat 统计相关
+     * @apiSuccess {String} config.stat.userRegCount 注册用户数
+     * @apiSuccess {String} companyInfo 公司信息
+     * @apiSuccess {String} companyInfo.name 公司名称
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功",
+    "content": {
+    "config": {
+    "bankBandMax":1,
+    "loanAgreementUrl":"http://www.baidu.com?######",
+    "riskBulletinUrl":"http://www.baidu.com?######",
+    "rechargeUrl":"http://wxapp.dahengdian.com/mobile/h5/userRecharge?######",
+    "rechargeWYUrl":"http://wxapp.dahengdian.com/mobile/h5/userRechargeWY?######",
+    "drawcashUrl":"http://wxapp.dahengdian.com/mobile/h5/userDrawcash?######",
+    "userInvitationUrl":"http://www.baidu.com?######",
+    "activeUrl":"http://www.baidu.com?######",
+    "customerUrl":"http://www.baidu.com?######",
+    "aboutUsUrl":"http://www.baidu.com?######",
+    "regAgreementUrl":"http://www.baidu.com?######",
+    "stat":{
+    "userRegCount":200000
+    }
+    },
+    "companyInfo":{
+    "name":"浙江博佳投资管理有限公司"
+    }
+    }
+    }
+     * @apiUse CreateUserError
+     */
+    /**
+     * @api {post} system/getConfig 得到系统配置
+     * @apiVersion 1.0.2
+     * @apiName getConfig
+     * @apiDescription 得到系统配置
+     * @apiGroup System
+     *
+     * @apiSuccess {Object} config 系统配置
+     * @apiSuccess {String} config.startPageImage 动态启动页图片url(建议拉伸),建议保持缓存12小时
+     * @apiSuccess {Number} config.bankBandMax 至多绑定银行卡个数
+     * @apiSuccess {String} config.loanAgreementUrl 借款协议url
+     * @apiSuccess {String} config.riskBulletinUrl 风险揭示书url
+     * @apiSuccess {String} config.rechargeUrl 跳转充值url
+     * @apiSuccess {String} config.rechargeUrl.--money app应用参数,金额
+     * @apiSuccess {Number} config.rechargeUrl.--userBankID app应用参数,用户银行卡ID
+     * @apiSuccess {String} config.rechargeWYUrl 跳转网银充值url
+     * @apiSuccess {String} config.rechargeWYUrl.--money app应用参数,金额
+     * @apiSuccess {Number} config.rechargeWYUrl.--userBankID app应用参数,用户银行卡ID
+     * @apiSuccess {String} config.drawcashUrl 跳转提现url
+     * @apiSuccess {String} config.drawcashUrl.--money app应用参数,
+     * @apiSuccess {String} config.cancelUserUrl 销户(解绑银行卡)url
+     *
+     * 金额
+     * @apiSuccess {Number} config.drawcashUrl.--userBankID app应用参数,用户银行卡ID
+     * @apiSuccess {String} config.userInvitationUrl 邀请注册url
+     * @apiSuccess {String} config.activeUrl 活动url
+     * @apiSuccess {String} config.customerUrl 客服url
+     * @apiSuccess {String} config.aboutUsUrl 关于我们url
+     * @apiSuccess {String} config.regAgreementUrl 注册协议url
+     * @apiSuccess {String} config.stat 统计相关
+     * @apiSuccess {String} config.stat.userRegCount 注册用户数
+     * @apiSuccess {Object} companyInfo 公司信息
+     * @apiSuccess {String} companyInfo.name 公司名称
+     * @apiSuccess {String} companyInfo.brand 品牌名称
+     * @apiSuccess {String} companyInfo.phone 公司电话
+     * @apiSuccess {String} companyInfo.web 公司网址
+     * @apiSuccess {String} companyInfo.wechat 公司微信
+     *
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功",
+    "content": {
+    "config": {
+    "bankBandMax":1,
+    "loanAgreementUrl":"http://www.baidu.com?######",
+    "riskBulletinUrl":"http://www.baidu.com?######",
+    "rechargeUrl":"http://wxapp.dahengdian.com/mobile/h5/userRecharge?######",
+    "rechargeWYUrl":"http://wxapp.dahengdian.com/mobile/h5/userRechargeWY?######",
+    "drawcashUrl":"http://wxapp.dahengdian.com/mobile/h5/userDrawcash?######",
+    "userInvitationUrl":"http://www.baidu.com?######",
+    "activeUrl":"http://www.baidu.com?######",
+    "customerUrl":"http://www.baidu.com?######",
+    "aboutUsUrl":"http://www.baidu.com?######",
+    "regAgreementUrl":"http://www.baidu.com?######",
+    "stat":{
+    "userRegCount":200000
+    }
+    },
+    "companyInfo":{
+    "name":"浙江博佳投资管理有限公司",
+    "brand":"浙江博佳投资管理有限公司",
+    "phone":"浙江博佳投资管理有限公司",
+    "web":"浙江博佳投资管理有限公司",
+    "wechat":"浙江博佳投资管理有限公司"
+    }
+    }
+    }
+     * @apiUse CreateUserError
+     */
+
+
+    /**
+     * @api {post} system/getUpgradeInfoForIOS 得到IOS升级信息
+     * @apiVersion 1.0.0
+     * @apiName getUpgradeInfoForIOS
+     * @apiDescription 得到升级信息
+     * @apiGroup System
+     *
+     * @apiParam {String} versionName 版本号
+     * @apiParamExample {json} 发送报文:
+    {
+    "versionName":'1.1.1'
+    }
+     *
+     * @apiSuccess {String} versionName 版本号
+     * @apiSuccess {Array} versionContent 升级内容
+     * @apiSuccess {String} download 强制应用商店地址
+     * @apiSuccess {Array} channels 决定了那些渠道需要强制更新
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功",
+    "content": {
+    "versionName":"1.23",
+    "versionContent":[
+        "adsfasdf","131313213","asdfasdfasdfasdasdf"
+     ],
+    "download":"http://gyxz.exmmw.cn/hk/rj_yx1/aiba.apk",
+    "channels":[
+        "1123123","123123"
+    ]
+    }
+    }
+     * @apiUse CreateUserError
+     */
+
+    /**
+     * @api {post} system/getUpgradeInfoForIOS 得到升级信息
+     * @apiVersion 1.0.0
+     * @apiName getUpgradeInfo
+     * @apiDescription 得到升级信息
+     * @apiGroup System
+     *
+     * @apiParam {String} versionName 版本号
+     * @apiParamExample {json} 发送报文:
+    {
+    "versionName":'1.1.1'
+    }
+     *
+     * @apiSuccess {String} versionName 版本号
+     * @apiSuccess {Number} isForce 是否强制升级,0-不强制升级,1-强制升级
+     * @apiSuccess {String} downloadAndroid Android下载地址
+     * @apiSuccess {String} downloadIOS IOS下载地址
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功",
+    "content": {
+    "versionName":"1.23",
+    "isForce":1,
+    "downloadAndroid":"http://gyxz.exmmw.cn/hk/rj_yx1/aiba.apk",
+    "downloadIOS":"http://gyxz.exmmw.cn/hk/rj_yx1/aiba.apk",
+    "day":10
+    }
+    }
+     * @apiUse CreateUserError
+     */

+ 655 - 0
application/apidoc/logic/User.php

@@ -0,0 +1,655 @@
+<?php
+
+
+    /**
+     * @api {post} user/checkUserByMobile 检测是否为新用户
+     * @apiVersion 1.0.0
+     * @apiName checkUserByMobile
+     * @apiDescription 检测是否为新用户
+     * @apiGroup User
+     *
+     * @apiParam {String} mobile 手机号码
+     *
+     *
+     * @apiParamExample {json} 发送报文:
+    {
+    "mobile": "13136180523"
+    }
+     * @apiSuccess {Number} status 为0,新用户;为1已注册
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功",
+    "content":{
+    "status":0
+    }
+    }
+     * @apiUse CreateUserError
+     */
+
+
+    /**
+     * @api {post} user/registerSendMobileCode 注册新用户发送验证码
+     * @apiVersion 1.0.0
+     * @apiName registerSendMobileCode
+     * @apiDescription 注册新用户发送验证码,仅限国内手机号
+     * @apiGroup User
+     *
+     * @apiParam {String} mobile 手机号码
+     * @apiParamExample {json} 发送报文:
+    {
+    "mobile": "13136180523"
+    }
+     *
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功"
+    }
+     * @apiUse CreateUserError
+     */
+
+
+    /**
+     * @api {post} user/register 注册新用户
+     * @apiVersion 1.0.0
+     * @apiName register
+     * @apiDescription 注册新用户
+     * @apiGroup User
+     *
+     * @apiParam {String} mobile 手机号码
+     * @apiParam {String} mobileCode 手机号码,6位数字
+     * @apiParam {String} password 密码
+     * @apiParam {String} passwordRe 重复密码
+     * @apiParamExample {json} 发送报文:
+    {
+    "mobile": "13136180523",
+    "mobileCode": "2145",
+    "password": "12313132",
+    "passwordRe": "66332221144"
+    }
+     *
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功",
+    "content":{
+    "token":"a8ajdsjasdfuufayg8aasdfasdfasd"
+    }
+    }
+     * @apiUse CreateUserError
+     */
+
+
+    /**
+     * @api {post} user/loginByPassword 密码登录
+     * @apiVersion 1.0.0
+     * @apiName loginByPassword
+     * @apiDescription 注册新用户
+     * @apiGroup User
+     *
+     * @apiParam {String} mobile 手机号码
+     * @apiParam {String} password 密码
+     * @apiParamExample {json} 发送报文:
+    {
+    "mobile": "13136180523",
+    "password": "111111"
+    }
+     *
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功",
+    "content": {
+    "token": "a8ajdsjasdfuufayg8aasdfasdfasd",
+    "userInfo":{
+    "uuid":"123123123123123123"
+    }
+    }
+    }
+     * @apiUse CreateUserError
+     */
+
+
+    /**
+     * @api {post} user/loginSendMobileCode 登录/重置密码发送验证码
+     * @apiVersion 1.0.0
+     * @apiName loginSendMobileCode
+     * @apiDescription 登录/重置密码发送验证码
+     * @apiGroup User
+     *
+     * @apiParam {String} mobile 手机号码
+     * @apiParamExample {json} 发送报文:
+    {
+    "mobile": "13136180523"
+    }
+     *
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功"
+    }
+     * @apiUse CreateUserError
+     */
+
+
+    /**
+     * @api {post} user/loginByMobileCode 短信验证登录
+     * @apiVersion 1.0.0
+     * @apiName loginByMobileCode
+     * @apiDescription 短信验证登录
+     * @apiGroup User
+     *
+     * @apiParam {String} mobile 手机号码
+     * @apiParam {String} mobileCode 验证码
+     * @apiParamExample {json} 发送报文:
+    {
+    "mobile": "13136180523",
+    "mobileCode": "111111"
+    }
+     *
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功",
+    "content": {
+    "token": "a8ajdsjasdfuufayg8aasdfasdfasd",
+    "userInfo":{
+    "uuid":"123123123123123123"
+    }
+    }
+    }
+     * @apiUse CreateUserError
+     */
+
+
+    /**
+     * @api {post} user/logout 退出登录
+     * @apiVersion 1.0.0
+     * @apiName logout
+     * @apiDescription 退出登录,退出登录后返回首页
+     * @apiGroup User
+     *
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功"
+    }
+     * @apiUse CreateUserError
+     */
+
+
+    /**
+     * @api {post} user/resetPassword 重置密码
+     * @apiVersion 1.0.0
+     * @apiName resetPassword
+     * @apiDescription 重置密码,重置之后要重新登录
+     * @apiGroup User
+     *
+     * @apiParam {String} mobile 手机号码
+     * @apiParam {String} mobileCode 验证码
+     * @apiParam {String} password 密码
+     * @apiParam {String} passwordRe 重复密码
+     * @apiParamExample {json} 发送报文:
+    {
+    "mobile": "13136180523",
+    "mobileCode": "111111",
+    "password":"123123123123123123",
+    "passwordRe":"123123123123123123"
+    }
+     *
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功"
+    }
+     * @apiUse CreateUserError
+     */
+
+
+    /**
+     * @api {post} user/recharge 充值
+     * @apiVersion 1.0.0
+     * @apiName recharge
+     * @apiDescription 充值
+     * @apiGroup User
+     *
+     * @apiParam {Number} userBankID 银行卡ID
+     * @apiParam {Decimal} money 金额
+     * @apiParamExample {json} 发送报文:
+    {
+    "app": {
+    "userBankID": 12,
+    "money": 12.01
+    },
+    "sign": "4297f44b13955235245b2497399d7a93"
+    }
+     *
+     * @apiSuccess {Number} userRechargeID 充值ID
+     * @apiSuccess {String} alias 充值单号
+     * @apiSuccess {String} outerAlias 第三方支付订单号
+     * @apiSuccess {String} notify 支付完成第三方异步回调(通知服务器)
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功",
+    "content": {
+    "userRechargeID": 12,
+    "alias": "DC12981726638899",
+    "outerAlias": "12981726638899",
+    "notify": "http://wxapp.dahengdian.com/mobile/notify/index"
+    },
+    "sign":"4297f44b13955235245b2497399d7a93"
+    }
+     * @apiUse CreateUserError
+     */
+
+
+    /**
+     * @api {post} user/checkInfo 添加银行卡和实名统一接口
+     * @apiVersion 1.0.0
+     * @apiName checkInfo
+     * @apiDescription 添加银行卡和实名统一接口,验证通过后自动添加一个银行卡;该接口大概有2秒左右的延时,请界面做好优化
+     * @apiGroup User
+     *
+     * @apiParam {Number} bankID 银行ID
+     * @apiParam {String} trueName 真实姓名
+     * @apiParam {String} passport 身份证号码
+     * @apiParam {String} bankNumber 银行卡号码
+     * @apiParam {String} mobile 手机号码
+     * @apiParam {String} mobileCode 手机验证码
+     * @apiParam {String} [payword] 支付密码,密码为6位纯数字
+     * @apiParam {String} [paywordRe] 重复支付密码,密码为6位纯数字
+     * @apiParamExample {json} 发送报文:
+    {
+    "bankID": 12,
+    "trueName": "罗贯中",
+    "passport": "230354635879109",
+    "bankNumber": "63309871627382991010",
+    "mobileCode": "123456",
+    "mobile":"13136180523",
+    "payword":"123456",
+    "paywordRe":"123456"
+    }
+     *
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功"
+    }
+     * @apiUse CreateUserError
+     */
+    /**
+     * @api {post} user/checkInfo 添加银行卡和实名统一接口
+     * @apiVersion 1.0.1
+     * @apiName checkInfo
+     * @apiDescription 添加银行卡和实名统一接口,验证通过后自动添加一个银行卡;该接口大概有1秒左右的延时,请界面做好优化;app版本号2.1.2注意手机号隐藏和取消了手机短信验证
+     * @apiGroup User
+     *
+     * @apiParam {Number} bankID 银行ID
+     * @apiParam {String} trueName 真实姓名
+     * @apiParam {String} passport 身份证号码
+     * @apiParam {String} bankNumber 银行卡号码
+     * @apiParam {String} mobile 手机号码,手机号码从app版本号2.1.2后UI隐藏,传值固定为注册手机号
+     * @apiParam {String} mobileCode 手机验证码,手机验证码从app版本号2.1.2后UI隐藏,传值固定为687888
+     * @apiParam {String} payword 支付密码,密码至少为6位数字和英文字母
+     * @apiParam {String} paywordRe 重复支付密码,密码至少为6位数字和英文字母
+     * @apiParamExample {json} 发送报文:
+    {
+    "bankID": 12,
+    "trueName": "罗贯中",
+    "passport": "230354635879109",
+    "bankNumber": "63309871627382991010",
+    "mobileCode": "123456",
+    "mobile":"13136180523",
+    "payword":"123456",
+    "paywordRe":"123456"
+    }
+     *
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功"
+    }
+     * @apiUse CreateUserError
+     */
+
+
+    /**
+     * @api {post} user/checkInfoSendMobileCode 预留手机发送验证码
+     * @apiVersion 1.0.0
+     * @apiName checkInfoSendMobileCode
+     * @apiDescription 添加银行卡之前发送验证码,该手机号码为银行卡预留手机号
+     * @apiGroup User
+     *
+     * @apiParam {String} mobile 手机号码
+     * @apiParamExample {json} 发送报文:
+    {
+    "app": {
+    "mobile": "13136180523"
+    },
+    "sign": "4297f44b13955235245b2497399d7a93"
+    }
+     *
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功",
+    "sign":"4297f44b13955235245b2497399d7a93"
+    }
+     * @apiUse CreateUserError
+     */
+
+
+    /**
+     * @api {post} user/getUserBankList 得到我的银行卡列表
+     * @apiVersion 1.0.0
+     * @apiName getUserBankList
+     * @apiDescription 得到我的银行卡列表
+     * @apiGroup User
+     *
+     *
+     *
+     * @apiSuccess {Object[]} userBankList 银行卡列表
+     * @apiSuccess {Number} userBankList.userBankID 该银行卡ID
+     * @apiSuccess {String} userBankList.bankAccount 姓名
+     * @apiSuccess {String} userBankList.bankNumberAsterisk 银行卡号码,加密
+     * @apiSuccess {String} userBankList.bankNameFull 银行全称,带支行
+     * @apiSuccess {String} userBankList.mobile 预留手机号
+     * @apiSuccess {String} userBankList.isDefault 1默认,0非默认
+     * @apiSuccess {Object} userBankList.bank 银行
+     * @apiSuccess {String} userBankList.bank.bankName 银行名称
+     * @apiSuccess {String} userBankList.bank.appIcon 银行app图标
+     * @apiSuccess {String} userBankList.bank.color 银行颜色(废弃)
+     * @apiSuccess {String} userBankList.bank.backgroundColor 银行背景色
+     * @apiSuccess {String} userBankList.bank.quotaTitle 限额名称描述
+     * @apiSuccess {String} userBankList.bank.quotaSingleOrder 单笔限额,单位元
+     * @apiSuccess {String} userBankList.bank.quotaSingleDay 单日限额
+     * @apiSuccess {String} userBankList.bank.quotaSingleMouth 单月限额
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功",
+    "content": {
+    "userBankList": [
+    {
+    "userBankID": 5,
+    "bankAccount": "张奇",
+    "bankNameFull": "",
+    "mobile": "17316900863",
+    "isDefault": 1,
+    "bank": {
+    "bankName": "中国建设银行",
+    "color": "#5991F0",
+    "quotaTitle": "限额:",
+    "quotaText": "单笔5千 单日五万 单月150万",
+    "quotaSingleDay": 5000000,
+    "quotaSingleOrder": 500000,
+    "appIcon": "http://wxapp.dahengdian.com/static/mobile/image/zhongguo_icon2x.png",
+    "pcIcon": "",
+    "quotaSingleMonth": 500000000,
+    "backgroundColor": "#5991F0"
+    },
+    "bankNumberAsterisk": "6217 **** **** **** 6968"
+    }
+    ]
+    }
+    }
+     * @apiUse CreateUserError
+     */
+
+
+    /**
+     * @api {post} user/getUserHongbaoList 得到我的红包列表
+     * @apiVersion 1.0.0
+     * @apiName getUserHongbaoList
+     * @apiDescription 得到我的红包列表
+     * @apiGroup User
+     *
+     * @apiParam {Number=0,1,2,3} [status] 红包状态,0为所有,1-未使用,2-已使用,3-已过期
+     * @apiParamExample {json} 发送报文:
+    {
+    "status": 1
+    }
+     *
+     * @apiSuccess {Object[]} userHongbaoList 红包列表列表
+     * @apiSuccess {Number} userHongbaoList.userHongbaoID 红包ID
+     * @apiSuccess {Object} userHongbaoList.hongbao 红包
+     * @apiSuccess {String} userHongbaoList.hongbao.title 红包名称
+     * @apiSuccess {String} userHongbaoList.hongbao.money 红包金额,现金券时有效
+     * @apiSuccess {String} userHongbaoList.hongbao.year 加息年化,加息券有效
+     * @apiSuccess {Number} userHongbaoList.hongbao.typeID 1-现金券,2-加息券
+     * @apiSuccess {String} userHongbaoList.hongbao.minMoney 投资满多少可使用
+     * @apiSuccess {Number} userHongbaoList.hongbao.minDay 不低于多少天的产品可以使用,比如该值为30时,那么低于30天产品可以使用
+     * @apiSuccess {String} userHongbaoList.hongbao.minMoneyText minMoney描述
+     * @apiSuccess {String} userHongbaoList.hongbao.minDayText minDay描述
+     * @apiSuccess {String} userHongbaoList.hongbao.buyText 购买时描述
+     * @apiSuccess {String} userHongbaoList.beginTime 有效开始时间
+     * @apiSuccess {String} userHongbaoList.endTime 有效结束时间
+     * @apiSuccess {Number} userHongbaoList.status 1-未使用,2-已使用,3-已过期
+     * @apiSuccess {String} userHongbaoList.addTime 添加时间
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功",
+    "content": {
+    "hongbaoList": [
+    {
+    "userHongbaoID": 2,
+    "beginTime": "2017-12-24",
+    "endTime": "2018-01-08",
+    "addTime": "2017-12-24 22:30:31",
+    "status": 1,
+    "hongbao": {
+    "title": "新手注册",
+    "typeID": 1,
+    "minDay": 0,
+    "minMoney": "0.00",
+    "year": "0.00",
+    "money": "100.00",
+    "minMoneyText": "满0元使用",
+    "minDayText": "所有产品通用",
+    "buyText":"现金券88元"
+    }
+    }
+    ]
+    }
+    }
+     * @apiUse CreateUserError
+     */
+
+
+    /**
+     * @api {post} user/getUserInfo 得到个人信息唯一接口
+     * @apiVersion 1.0.0
+     * @apiName getUserInfo
+     * @apiDescription 得到个人信息唯一接口
+     * @apiGroup User
+     *
+     * @apiSuccess {Object} userInfo 红包列表列表
+     * @apiSuccess {Number} userInfo.userID 红包ID
+     * @apiSuccess {Object} userInfo.mobile 手机号,该手机号只做展示用
+     * @apiSuccess {String} userInfo.passport 身份证
+     * @apiSuccess {String} userInfo.trueName 真实姓名
+     * @apiSuccess {String} userInfo.avatar 头像
+     * @apiSuccess {String} userInfo.gender 性别,0-不男不女,1-男,2-女
+     * @apiSuccess {String} userInfo.loginTime 最后一次登录时间
+     * @apiSuccess {Number=0,1} userInfo.isAuthTrueName 是否实名认证,0否
+     * @apiSuccess {Number=0,1} userInfo.isAuthBank 是否绑定银行,目前用于判断实名认证和银行卡认证,0否
+     * @apiSuccess {Number=0,1} userInfo.isNewInvest 是否是首投用户,0否
+     * @apiSuccess {Object} userInfo.userAccount 个人资金账户概况
+     * @apiSuccess {String} userInfo.userAccount.money 可用余额
+     * @apiSuccess {String} userInfo.userAccount.moneyTotal 资产总额
+     * @apiSuccess {String} userInfo.userAccount.moneyAcc 累积收益
+     * @apiSuccess {String} userInfo.userAccount.moneyYesterday 昨日收益
+     * @apiSuccess {String} userInfo.userAccount.moneyToday 今日收益
+     * @apiSuccess {String} userInfo.userAccount.waitBen 待收总本金
+     * @apiSuccess {String} userInfo.userAccount.waitInterest 待收总利息
+     * @apiSuccess {String} userInfo.userAccount.hasInvestBenTotal 共已投入本金
+     * @apiSuccess {String} userInfo.userAccount.hasInvestMoneyTotal 共已投入实际金额
+     * @apiSuccess {String} userInfo.userAccount.hasRepayBenTotal 共已收回的本金
+     * @apiSuccess {String} userInfo.userAccount.hasRepayInterestTotal 共已收回的利息
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功",
+    "content": {
+    "userInfo": {
+    "userID": 8,
+    "mobile": "17316900863",
+    "trueName": "张奇",
+    "passport": "230253654125663547",
+    "avatar": "",
+    "gender": 0,
+    "loginTime": 0,
+    "isAuthTrueName": 0,
+    "isAuthBank": 0,
+    "isNewInvest": 0,
+    "userAccount": {
+    "moneyTotal": "0.00",
+    "money": "0.00",
+    "moneyAcc": "0.00",
+    "moneyYesterday": 0,
+    "moneyToday": "0.00",
+    "waitBen": 0,
+    "waitInterest": "0.00",
+    "hasInvestBenTotal": 0,
+    "hasInvestMoneyTotal": "0.00",
+    "hasRepayBenTotal": "0.00",
+    "hasRepayInterestTotal":""
+    }
+    }
+    }
+    }
+     * @apiUse CreateUserError
+     */
+    /**
+     * @api {post} user/getUserInfo 得到个人信息唯一接口
+     * @apiVersion 1.0.1
+     * @apiName getUserInfo
+     * @apiDescription 得到个人信息唯一接口
+     * @apiGroup User
+     *
+     * @apiSuccess {Object} userInfo 红包列表列表
+     * @apiSuccess {Number} userInfo.userID 红包ID
+     * @apiSuccess {Object} userInfo.mobile 手机号,该手机号只做展示用
+     * @apiSuccess {String} userInfo.passport 身份证
+     * @apiSuccess {String} userInfo.trueName 真实姓名
+     * @apiSuccess {String} userInfo.avatar 头像
+     * @apiSuccess {String} userInfo.gender 性别,0-不男不女,1-男,2-女
+     * @apiSuccess {String} userInfo.loginTime 最后一次登录时间
+     * @apiSuccess {Number=0,1} userInfo.isAuthTrueName 是否实名认证,0否
+     * @apiSuccess {Number=0,1} userInfo.isAuthBank 是否绑定银行,目前用于判断实名认证和银行卡认证,0否
+     * @apiSuccess {Number=0,1} userInfo.isNewInvest 是否是首投用户,0否
+     * @apiSuccess {Object} userInfo.userAccount 个人资金账户概况
+     * @apiSuccess {String} userInfo.userAccount.money 可用余额
+     * @apiSuccess {String} userInfo.userAccount.moneyTotal 资产总额
+     * @apiSuccess {String} userInfo.userAccount.moneyAcc 累积收益
+     * @apiSuccess {String} userInfo.userAccount.moneyYesterday 昨日收益
+     * @apiSuccess {String} userInfo.userAccount.moneyToday 今日收益
+     * @apiSuccess {String} userInfo.userAccount.waitBen 待收总本金
+     * @apiSuccess {String} userInfo.userAccount.waitInterest 待收总利息
+     * @apiSuccess {String} userInfo.userAccount.hasInvestBenTotal 共已投入本金
+     * @apiSuccess {String} userInfo.userAccount.hasInvestMoneyTotal 共已投入实际金额
+     * @apiSuccess {String} userInfo.userAccount.hasRepayBenTotal 共已收回的本金
+     * @apiSuccess {String} userInfo.userAccount.hasRepayInterestTotal 共已收回的利息
+     * @apiSuccess {Object} userInfo.bank 默认银行卡,如果客户未绑定银行卡,则不显示该字段
+     * @apiSuccess {Number} userInfo.bank.userBankID 银行卡ID
+     * @apiSuccess {String} userInfo.bank.bankNumber 银行卡号码
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功",
+    "content": {
+    "userInfo": {
+    "userID": 8,
+    "mobile": "17316900863",
+    "trueName": "张奇",
+    "passport": "230253654125663547",
+    "avatar": "",
+    "gender": 0,
+    "loginTime": 0,
+    "isAuthTrueName": 0,
+    "isAuthBank": 0,
+    "isNewInvest": 0,
+    "userAccount": {
+    "moneyTotal": "0.00",
+    "money": "0.00",
+    "moneyAcc": "0.00",
+    "moneyYesterday": 0,
+    "moneyToday": "0.00",
+    "waitBen": 0,
+    "waitInterest": "0.00",
+    "hasInvestBenTotal": 0,
+    "hasInvestMoneyTotal": "0.00",
+    "hasRepayBenTotal": "0.00",
+    "hasRepayInterestTotal":""
+    },
+    "bank": {
+    "userBankID": 123,
+    "bankNumber": "62236541254796441"
+    }
+    }
+    }
+    }
+     * @apiUse CreateUserError
+     */
+
+
+    /**
+     * @api {post} user/getUserFinanceList 得到交易流水
+     * @apiVersion 1.0.0
+     * @apiName getUserFinanceList
+     * @apiDescription 得到交易流水
+     * @apiGroup User
+     *
+     * @apiParam {String=[0,1,2,3,4,5]} mode 模块 0-所有,1-充值,2-提现,3-下单,4-回款,5-其他
+     * @apiParam {Number} [pageIndex] 页码
+     * @apiParam {Number} [pageItemCount] 每页条数
+     * @apiParamExample {json} 发送报文:
+    {
+    "mode": 1,
+    "pageIndex":1,
+    "pageItemCount":0
+    }
+     *
+     * @apiSuccess {String} mode 模块标识,MODE_RECHARGE-充值,MODE_DRAWCASH-提现,MODE_CANG-购买,MODE_REPAY_INTEREST-利息回款,MODE_REPAY_BEN-本金回款,MODE_EXT-其他
+     * @apiSuccess {Number} modeID 模块对应的条目ID
+     * @apiSuccess {String} modeText 模块描述(状态描述)
+     * @apiSuccess {String} addTime 添加时间
+     * @apiSuccess {String} updateTime 更新时间
+     * @apiSuccess {Number} userID 用户ID
+     * @apiSuccess {String} moneyPre 交易之前可用余额
+     * @apiSuccess {String} money 交易金额
+     * @apiSuccess {String} moneyNow 交易之后可用余额
+     * @apiSuccess {Number} status 状态
+     * @apiSuccess {Number} userFinanceID 流水ID
+     * @apiSuccess {Number} pageIndex 页码
+     * @apiSuccess {Number} pageItemCount 每页条数
+     * @apiSuccessExample {json} 返回json数据(举例):
+    {
+    "code": 1,
+    "msg": "操作成功",
+    "content": {
+    "financeList": [
+    {
+    "userFinanceID": 5778,
+    "mode": "MODE_RECHARGE",
+    "modeID": 536,
+    "money": "0.10",
+    "addTime": "2017-12-30 19:17:38",
+    "userID": 8,
+    "status": 1,
+    "updateTime": "2017-12-30 19:17:38",
+    "moneyPre": "0.10",
+    "moneyNow": "0.20",
+    "modeText": "失败"
+    }
+    ],
+    "count": 1,
+    "pageItemCount": 10
+    }
+    }
+     * @apiUse CreateUserError
+     */
+

+ 22 - 0
application/apidoc/logic/apidoc.json

@@ -0,0 +1,22 @@
+{
+  "name": "p2p 文档",
+  "version": "1.0.0",
+  "description": "适用于Android、IOS、Web",
+  "title": "Custom apiDoc browser title",
+
+  
+  "header": {
+    "title": "写在调用接口之前",
+    "filename": "header.md"
+  },
+  "footer": {
+    "title": "版本控制",
+    "filename": "footer.md"
+  },
+  
+  "template": {
+  	"withCompare": true,
+  	"withGenerator": false,
+  	"jQueryAjaxSetup": true
+  }
+}

+ 7 - 0
application/apidoc/logic/footer.md

@@ -0,0 +1,7 @@
+***
+## 版本控制
+* beta v0.0.1
+* 2017-12-13 20:19 
+* 张大胆
+***
+浙江博佳投资管理有限公司

+ 92 - 0
application/apidoc/logic/header.md

@@ -0,0 +1,92 @@
+***
+>## 介绍
+* 介绍
+
+***
+#
+>## <font color=#0088cc size=5>请求规则</font>
+* 测试根地址http://wxapp.dahengdian.com/mobile/
+* 生产根地址 ?????
+* 根地址请移动端配置好,方便后期发展其他版本
+* 接口完成地址拼接方法,http://wxapp.dahengdian.com/mobile/ + cang/getCangList,既为http://wxapp.dahengdian.com/mobile/cang/getCangList,其中http://wxapp.dahengdian.com/mobile/为根地址,<font color=#FF0000 size=3>cang/getCangList为接口标志</font>
+* post请求,json数据
+
+
+#
+>## <font color=#0088cc size=5>请求参数</font>
+#### 公共参数
+字段 | 类型 | 描述
+----|------|----
+token | String  | 登录凭证,32位MD5加密字符串,保质期7 * 86400(七天)
+time | String  | 请求时间,格式为2017-01-01 12:12:13
+appV | String  | APP版本
+apiV | String  | API版本
+osV | String  | 操作系统版本
+osType | Number | 1为ios,2为android,3为pc
+ip | String | ipv4
+channel | String | 渠道标志符
+deviceID | String | 宿主app的唯一标识,长度不限
+sign | String  | 32位MD5加密字符串
+
+
+###
+#### 应用参数
+字段 | 类型 | 描述
+----|------|----
+app | String  | 应用数据
+```json
+{
+    "token": "3e9183e7caa30617c833f06ca86d4134", 
+    "time": "2017-12-20 12:52:12", 
+    "appV": "1.0.2",
+    "apiV": "1.0.2",
+    "osV": "Android 6.02",
+    "osType": 2,
+    "ip": "192.168.0.1",
+    "deviceID": "ioajdjfalkslkdiapaa65a4ds54fa5sd1f",
+    "channel": "asdfasdfasdf",
+    "sign": "9ca2d3bf6ce8936c1e8ecab9ae40c6bf",
+    "app": {
+      "status": 1
+    }
+}
+```
+#
+>## <font color=#0088cc size=5>返回参数</font>
+#### 公共参数
+字段 | 类型 | 描述
+----|------|----
+time | String  | 请求时间,格式为2017-01-01 12:12:13
+sign | String  | 签名,32位MD5加密字符串
+
+###
+#### 应用参数  
+字段 | 类型 | 描述
+----|------|----
+app | String  | 应用数据json格式化字符串,app为json对象,包含code,msg,content三个字段,其中code为错误标识,1为操作成功,负数代表错误;msg错误说明;content为业务数据
+```json
+{
+    "app": {
+        "code": 1,
+        "msg": "操作成功",
+        "content": {
+            "cangID": "6"
+        }
+    },
+    "time": "2017-12-20 12:52:12",
+    "sign": "4297f44b13955235245b2497399d7a93"
+}
+``` 
+#
+>## <font color=#0088cc size=5>sign签名规则</font>
+* 请求sign = md5(key + token + time + appV +apiV + osV + osType + deviceID + ip + channel + app),其中登录前状态所有与服务器交互,token为空字符串
+* 返回sign = md5(key + time + app)
+* sign 签名为小写
+
+
+
+>## <font color=#0088cc size=5>Android 推送/H5跳转协议</font>
+ * bj://h5url?url=https://www.baidu.com/ 打开新的h5页面
+ * bj://home?url=https://www.baidu.com/  打开首页
+ * bj://detail?url=https://www.baidu.com/ 打开产品详情
+ * bj://huodong?url=https://www.baidu.com/   打开活动页(显示第三个tab)

+ 17 - 0
application/command.php

@@ -0,0 +1,17 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: yunwuxin <448901948@qq.com>
+// +----------------------------------------------------------------------
+
+return [
+    'app\crontab\command\Cang',
+    'app\crontab\command\Send',
+    'app\crontab\command\Notify',
+    'app\crontab\command\Subject',
+];

+ 17 - 0
application/common.php

@@ -0,0 +1,17 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: 流年 <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+// 应用公共文件
+function mobileAsterisk($mobile)
+{
+    $mobile_asterisk = substr($mobile,0,4)."****".substr($mobile,8,3);
+    return $mobile_asterisk;
+}

+ 244 - 0
application/config.php

@@ -0,0 +1,244 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+return [
+    // +----------------------------------------------------------------------
+    // | 应用设置
+    // +----------------------------------------------------------------------
+
+        // 应用命名空间
+        'app_namespace'          => 'app',
+    // 应用调试模式
+    'app_debug'              => true,
+    // 应用Trace
+    'app_trace'              => false,
+    // 应用模式状态
+    'app_status'             => '',
+    // 是否支持多模块
+    'app_multi_module'       => true,
+    // 入口自动绑定模块
+    'auto_bind_module'       => false,
+    // 注册的根命名空间
+    'root_namespace'         => [],
+    // 扩展函数文件
+    'extra_file_list'        => [THINK_PATH . 'helper' . EXT],
+    // 默认输出类型
+    'default_return_type'    => 'html',
+    // 默认AJAX 数据返回格式,可选json xml ...
+    'default_ajax_return'    => 'json',
+    // 默认JSONP格式返回的处理方法
+    'default_jsonp_handler'  => 'jsonpReturn',
+    // 默认JSONP处理方法
+    'var_jsonp_handler'      => 'callback',
+    // 默认时区
+    'default_timezone'       => 'PRC',
+    // 是否开启多语言
+    'lang_switch_on'         => false,
+    // 默认全局过滤方法 用逗号分隔多个
+    'default_filter'         => '',
+    // 默认语言
+    'default_lang'           => 'zh-cn',
+    // 应用类库后缀
+    'class_suffix'           => false,
+    // 控制器类后缀
+    'controller_suffix'      => false,
+
+    // +----------------------------------------------------------------------
+    // | 模块设置
+    // +----------------------------------------------------------------------
+
+    // 默认模块名
+    'default_module'         => 'index',
+    // 禁止访问模块
+    'deny_module_list'       => ['common'],
+    // 默认控制器名
+    'default_controller'     => 'Index',
+    // 默认操作名
+    'default_action'         => 'index',
+    // 默认验证器
+    'default_validate'       => '',
+    // 默认的空控制器名
+    'empty_controller'       => 'Error',
+    // 操作方法后缀
+    'action_suffix'          => '',
+    // 自动搜索控制器
+    'controller_auto_search' => false,
+
+    // +----------------------------------------------------------------------
+    // | URL设置
+    // +----------------------------------------------------------------------
+
+    // PATHINFO变量名 用于兼容模式
+    'var_pathinfo'           => 's',
+    // 兼容PATH_INFO获取
+    'pathinfo_fetch'         => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'],
+    // pathinfo分隔符
+    'pathinfo_depr'          => '/',
+    // URL伪静态后缀
+    'url_html_suffix'        => 'html',
+    // URL普通方式参数 用于自动生成
+    'url_common_param'       => false,
+    // URL参数方式 0 按名称成对解析 1 按顺序解析
+    'url_param_type'         => 0,
+    // 是否开启路由
+    'url_route_on'           => true,
+    // 路由使用完整匹配
+    'route_complete_match'   => false,
+    // 路由配置文件(支持配置多个)
+    'route_config_file'      => ['route'],
+    // 是否强制使用路由
+    'url_route_must'         => false,
+    // 域名部署
+    'url_domain_deploy'      => false,
+    // 域名根,如thinkphp.cn
+    'url_domain_root'        => '',
+    // 是否自动转换URL中的控制器和操作名
+    'url_convert'            => true,
+    // 默认的访问控制器层
+    'url_controller_layer'   => 'controller',
+    // 表单请求类型伪装变量
+    'var_method'             => '_method',
+    // 表单ajax伪装变量
+    'var_ajax'               => '_ajax',
+    // 表单pjax伪装变量
+    'var_pjax'               => '_pjax',
+    // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则
+    'request_cache'          => false,
+    // 请求缓存有效期
+    'request_cache_expire'   => null,
+    // 全局请求缓存排除规则
+    'request_cache_except'   => [],
+
+    // +----------------------------------------------------------------------
+    // | 模板设置
+    // +----------------------------------------------------------------------
+
+    'template'               => [
+        // 模板引擎类型 支持 php think 支持扩展
+        'type'         => 'Think',
+        // 模板路径
+        'view_path'    => '',
+        // 模板后缀
+        'view_suffix'  => 'html',
+        // 模板文件名分隔符
+        'view_depr'    => '_',
+        // 模板引擎普通标签开始标记
+        'tpl_begin'    => '{',
+        // 模板引擎普通标签结束标记
+        'tpl_end'      => '}',
+        // 标签库标签开始标记
+        'taglib_begin' => '{',
+        // 标签库标签结束标记
+        'taglib_end'   => '}',
+    ],
+
+    // 视图输出字符串内容替换
+    'view_replace_str'       => [],
+    // 默认跳转页面对应的模板文件
+    'dispatch_success_tmpl'  => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl',
+    'dispatch_error_tmpl'    => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl',
+
+    // +----------------------------------------------------------------------
+    // | 异常及错误设置
+    // +----------------------------------------------------------------------
+
+    // 异常页面的模板文件
+    'exception_tmpl'         => THINK_PATH . 'tpl' . DS . 'think_exception.tpl',
+
+    // 错误显示信息,非调试模式有效
+    'error_message'          => '页面错误!请稍后再试~',
+    // 显示错误信息
+    'show_error_msg'         => false,
+    // 异常处理handle类 留空使用 \think\exception\Handle
+    'exception_handle'       => '\app\core\exception\Http',
+
+    // +----------------------------------------------------------------------
+    // | 日志设置
+    // +----------------------------------------------------------------------
+
+    'log'                    => [
+        // 日志记录方式,内置 file socket 支持扩展
+        'type'  => 'File',
+        // 日志保存目录
+        'path'  => LOG_PATH,
+        // 日志记录级别
+        'level' => [],
+        'apart_level'   =>  ['crontab','pay','check','fuyou','behavior','laojiaqian']
+    ],
+
+    // +----------------------------------------------------------------------
+    // | Trace设置 开启 app_trace 后 有效
+    // +----------------------------------------------------------------------
+    'trace'                  => [
+        // 内置Html Console 支持扩展
+        'type' => 'Html',
+    ],
+
+    // +----------------------------------------------------------------------
+    // | 缓存设置
+    // +----------------------------------------------------------------------
+
+    'cache'                  => [
+        // 驱动方式
+        'type'   => 'File',
+        // 缓存保存目录
+        'path'   => CACHE_PATH,
+        // 缓存前缀
+        'prefix' => '',
+        // 缓存有效期 0表示永久缓存
+        'expire' => 0,
+
+        'cache_subdir' => false
+    ],
+
+    // +----------------------------------------------------------------------
+    // | 会话设置
+    // +----------------------------------------------------------------------
+
+    'session'                => [
+        'id'             => '',
+        // SESSION_ID的提交变量,解决flash上传跨域
+        'var_session_id' => '',
+        // SESSION 前缀
+        'prefix'         => 'think',
+        // 驱动方式 支持redis memcache memcached
+        'type'           => '',
+        // 是否自动开启 SESSION
+        'auto_start'     => true,
+    ],
+
+    // +----------------------------------------------------------------------
+    // | Cookie设置
+    // +----------------------------------------------------------------------
+    'cookie'                 => [
+        // cookie 名称前缀
+        'prefix'    => '',
+        // cookie 保存时间
+        'expire'    => 0,
+        // cookie 保存路径
+        'path'      => '/',
+        // cookie 有效域名
+        'domain'    => '',
+        //  cookie 启用安全传输
+        'secure'    => false,
+        // httponly设置
+        'httponly'  => '',
+        // 是否使用 setcookie
+        'setcookie' => true,
+    ],
+
+    //分页配置
+    'paginate'               => [
+        'type'      => 'bootstrap',
+        'var_page'  => 'page',
+        'list_rows' => 15,
+    ]
+];

+ 27 - 0
application/core/exception/AppException.php

@@ -0,0 +1,27 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: zhangdadan
+ * Date: 2017/6/6
+ * Time: 23:09
+ */
+
+namespace app\core\exception;
+
+class AppException extends \RuntimeException
+{
+    private $statusCode;
+    private $headers;
+
+    public function __construct($code = 0, $message = null, \Exception $previous = null, array $headers = [])
+    {
+        $this->statusCode = 200;
+        $this->headers    = $headers;
+
+        parent::__construct($message, $code, $previous);
+    }
+
+    public function getStatusCode() {
+        return $this->statusCode;
+    }
+}

+ 33 - 0
application/core/exception/Http.php

@@ -0,0 +1,33 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: zhangdadan
+ * Date: 2017/6/6
+ * Time: 23:09
+ */
+
+
+namespace app\core\exception;
+use Exception;
+use think\exception\Handle;
+use think\exception\HttpException;
+use think\Response;
+use tool\Common;
+
+class Http extends Handle
+{
+    public function render(Exception $e)
+    {
+        if ($e instanceof HttpException) {
+            $statusCode = $e->getStatusCode();
+            Response::create(Common::rj($statusCode, $e->getMessage()), 'json')->code($statusCode)->send();
+        }
+        else if ($e instanceof AppException) {
+            $statusCode = $e->getStatusCode();
+            Response::create(Common::rj($e->getCode(), $e->getMessage()), 'json')->code($statusCode)->send();
+        }
+        //TODO::开发者对异常的操作
+        //可以在此交由系统处理
+        return parent::render($e);
+    }
+}

+ 24 - 0
application/core/model/Active.php

@@ -0,0 +1,24 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+use think\Model;
+
+
+class Active extends Model
+{
+    protected $pk = 'activeID';
+    protected $resultSetType = 'collection';
+    protected $updateTime = 'updateTime';
+    protected $createTime = 'addTime';
+    protected $autoWriteTimestamp = true;
+
+
+
+}

+ 19 - 0
application/core/model/Bank.php

@@ -0,0 +1,19 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+
+use think\Model;
+
+
+class Bank extends Model
+{
+    protected $resultSetType = 'collection';
+    protected $pk = 'bankID';
+}

+ 24 - 0
application/core/model/BankPlatform.php

@@ -0,0 +1,24 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+
+use think\Model;
+
+
+class BankPlatform extends Model
+{
+    protected $resultSetType = 'collection';
+    protected $pk = 'bankPlatformID';
+
+
+    public function bank() {
+        return $this->belongsTo('bank', 'bankID');
+    }
+}

+ 51 - 0
application/core/model/Banner.php

@@ -0,0 +1,51 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+use think\Model;
+
+
+class Banner extends Model
+{
+    protected $pk = 'bannerID';
+    protected $resultSetType = 'collection';
+    protected $updateTime = 'updateTime';
+    protected $createTime = 'addTime';
+    protected $autoWriteTimestamp = true;
+
+    const STATUS_ONLINE = 1;
+    const STATUS_OFFLINE = 2;
+
+    const STATUSS = [
+        self::STATUS_ONLINE=>'已上线',
+        self::STATUS_OFFLINE=>'已下线'
+    ];
+
+    public function getStatusTextAttr($value, $data) {
+        return self::STATUSS[$data['status']];
+    }
+
+    public function getClientTypeTextAttr($value, $data) {
+        if($data['clientType'] == 1) {
+            return 'app';
+        }
+        else if($data['clientType'] == 2) {
+            return 'pc';
+        }
+        return '未知';
+    }
+
+   /* public function getUpdateTimeAttr($value) {
+        return Common::timetodate($value, 6);
+    }
+
+    public function getAddTimeAttr($value) {
+        return Common::timetodate($value, 6);
+    }*/
+}

+ 139 - 0
application/core/model/Cang.php

@@ -0,0 +1,139 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+use think\Model;
+use tool\Common;
+
+class   Cang extends Model
+{
+    protected $pk = 'cangID';
+    protected $resultSetType = 'collection';
+    protected $updateTime = 'updateTime';
+    protected $createTime = 'addTime';
+    protected $autoWriteTimestamp = true;
+
+    const STATUS_PAY = 1;
+    const STATUS_UNPAY = 2;
+    const STATUS_INTEREST = 3;
+    const STATUS_REPAY = 4;
+    const STATUS_FINISH = 10;
+    const STATUSS = [
+        self::STATUS_PAY=>'持有中',
+        self::STATUS_UNPAY=>'未支付',
+        self::STATUS_INTEREST=>'计息中',
+        self::STATUS_REPAY=>'回款中',
+        self::STATUS_FINISH=>'已回款'
+    ];
+
+    public function subject() {
+        return $this->belongsTo('Subject', 'subjectID');
+    }
+
+    public function cangRepay() {
+        return $this->hasMany('CangRepay', 'cangID');
+    }
+
+    public function user() {
+        return $this->belongsTo('User', 'userID');
+    }
+
+    public function setMoneySubjectAttr($value) {
+        return $value * 100;
+    }
+
+    public function getMoneySubjectAttr($value) {
+        return Common::price2($value / 100);
+    }
+
+    public function setBenAttr($value) {
+        return $value * 100;
+    }
+
+    public function getBenAttr($value) {
+        return Common::price2($value / 100);
+    }
+
+    public function setMoneyAttr($value) {
+        return $value * 100;
+    }
+
+    public function getMoneyAttr($value) {
+        return Common::price2($value / 100);
+    }
+
+    public function setInterestAttr($value) {
+        return $value * 100;
+    }
+
+    public function getInterestAttr($value) {
+        return Common::price2($value / 100);
+    }
+
+    public function getInterestBeginTimeAttr($value)
+    {
+        return Common::timetodate($value, 0);
+    }
+
+    public function getPayTimeAttr($value)
+    {
+        return Common::timetodate($value);
+    }
+
+    public function getInterestEndTimeAttr($value)
+    {
+        return Common::timetodate($value + 86400, 0);
+    }
+
+    public function getRepayTimeTextAttr($value)
+    {
+        return '到期日15点前还款';
+    }
+
+    /*public function getStatusAttr($value) {
+        if($value == self::STATUS_PAY) {
+            if(THINK_START_TIME < $this->getData['interestBeginTime']) {
+                return self::STATUS_PAY;
+            }
+            else if(THINK_START_TIME >= $this->getData['interestBeginTime'] &&  THINK_START_TIME < $this->getData['interestEndTime']){
+                return self::STATUS_INTEREST;
+            }
+            else {
+                return self::STATUS_REPAY;
+            }
+        }
+        return $value;
+    }*/
+
+    public function getStatusTextAttr($value, $data) {
+        return self::STATUSS[$data['status']];
+    }
+
+    public function getIsForgedTextAttr($value, $data) {
+        if($data['isForged'] === 1) {
+            return '虚拟账号';
+        }
+        return '自然人';
+    }
+
+    //设置计息状态
+    public function setStatusInterest() {
+        if($this->status != self::STATUS_PAY) {
+            return true;
+        }
+        $this->status = self::STATUS_INTEREST;
+        $this->save();
+        return true;
+    }
+
+    public static function createAlias($id)
+    {
+        return 'CP' . Common::timetodate(THINK_START_TIME, 10) .  sprintf("%08d", $id);
+    }
+}

+ 89 - 0
application/core/model/CangRepay.php

@@ -0,0 +1,89 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+use think\Model;
+use tool\Common;
+
+class CangRepay extends Model
+{
+
+    protected $pk = 'cangRepayID';
+    protected $resultSetType = 'collection';
+    const STATUS_UNREPAY = 1;
+    const STATUS_REPAY = 2;
+    const STATUS_REACH = 3;
+
+    const STATUSS = [
+        self::STATUS_UNREPAY=>'未回款',
+        self::STATUS_REPAY=>'已回款',
+        self::STATUS_REACH=>'已到款'
+    ];
+
+    public function cang() {
+        return $this->belongsTo('Cang', 'cangID');
+    }
+
+    public function subject() {
+        return $this->belongsTo('Subject', 'subjectID');
+    }
+
+    public function setMoneyAttr($value) {
+        return $value * 100;
+    }
+
+    public function getMoneyAttr($value) {
+        return Common::price2($value / 100);
+    }
+
+    public function getReachTimeAttr($value)
+    {
+        return Common::timetodate($value, 0);
+    }
+
+    public function getRepayTimeAttr($value)
+    {
+        return Common::timetodate($value, 0);
+    }
+
+    public function getResultTimeAttr($value)
+    {
+        return Common::timetodate($value, 0);
+    }
+
+    public function getStatusTextAttr($value, $data) {
+
+        return self::STATUSS[$data['status']];
+    }
+
+    public function getRepayTypeTextAttr($value)
+    {
+        if($value == 1) {
+            return '本金';
+        }
+        else if($value == 2){
+            return '利息';
+        }
+        return '';
+    }
+
+    public function repay() {
+        //第一步,更新cang
+        $this->data['status'] = self::STATUS_REPAY;
+        $this->save();
+
+        //第二步,更新用户账户
+        if($this->data['repayTypeID'] == 1) {
+            UserAccount::MODE_repayBen_addMoney($this->data['money'], $this->data['cangID'], $this->data['userID']);
+        }
+        else {
+            UserAccount::MODE_repayInterest_addMoney($this->data['money'], $this->data['cangID'], $this->data['userID']);
+        }
+    }
+}

+ 44 - 0
application/core/model/Cash.php

@@ -0,0 +1,44 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+use think\Config;
+use think\Log;
+use think\Model;
+use tool\Common;
+
+class Cash extends Model
+{
+    protected $resultSetType = 'collection';
+    protected $updateTime = 'updateTime';
+    protected $createTime = 'addTime';
+    protected $autoWriteTimestamp = true;
+    const MODE_CANG = 'MODE_CANG';//满多少送金
+    const MODE_INTRODUCE = 'MODE_INTRODUCE';//邀请,满多少送金
+    const MODE_INTRODUCE_BEI = 'MODE_INTRODUCE_BEI';//邀请,满多少送金
+    const MODE_INTRODUCE_COMMISSION = 'MODE_INTRODUCE_COMMISSION';//邀请,满多少送金
+    const STATUS_OK = 1;
+    const STATUS_ERROR = 2;
+
+    public function setMoneyAttr($value) {
+        return $value * 100;
+    }
+
+    public function getMoneyAttr($value) {
+        return Common::price2($value / 100);
+    }
+
+    public function getEstimateTimeAttr($value) {
+        return Common::timetodate($value, 0);
+    }
+
+    public function getResultTimeAttr($value) {
+        return Common::timetodate($value);
+    }
+}

+ 22 - 0
application/core/model/Channel.php

@@ -0,0 +1,22 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+use think\Model;
+
+
+class Channel extends Model
+{
+    protected $pk = 'channelID';
+    protected $resultSetType = 'collection';
+    protected $updateTime = 'updateTime';
+    protected $createTime = 'addTime';
+    protected $autoWriteTimestamp = true;
+
+}

+ 41 - 0
application/core/model/DMB.php

@@ -0,0 +1,41 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/8/3
+ * Time: 9:35
+ */
+
+namespace app\api\model;
+
+
+class DMB
+{
+    private $offset = 1;
+    private $limit = 10;
+    private $status = 0;
+
+    public function setOffset($offset = 1) {
+        $this->offset = $offset;
+    }
+
+    public function getOffset() {
+        return $this->offset;
+    }
+
+    public function setLimit($limit = 10) {
+        $this->limit = $limit;
+    }
+
+    public function getLimit() {
+        return $this->limit;
+    }
+
+    public function setStatus($status = 0) {
+        $this->status = $status;
+    }
+
+    public function getStauts() {
+        return $this->status;
+    }
+}

+ 29 - 0
application/core/model/Fang.php

@@ -0,0 +1,29 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+use think\Model;
+use tool\Common;
+
+class Fang extends Model
+{
+    protected $pk = 'fangID';
+    protected $resultSetType = 'collection';
+    protected $updateTime = 'updateTime';
+    protected $createTime = 'addTime';
+    protected $autoWriteTimestamp = true;
+
+    public function setMoneyAttr($value) {
+        return $value * 100;
+    }
+
+    public function getMoneyAttr($value) {
+        return Common::price2($value / 100);
+    }
+}

+ 116 - 0
application/core/model/Hongbao.php

@@ -0,0 +1,116 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+use think\Model;
+use tool\Common;
+
+
+class Hongbao extends Model
+{
+    protected $pk = 'hongbaoID';
+    protected $resultSetType = 'collection';
+    protected $updateTime = 'updateTime';
+    protected $createTime = 'addTime';
+    protected $autoWriteTimestamp = true;
+
+    const STATUS_ONLINE = 1;
+    const STATUS_OFFLINE = 2;
+
+    const STATUSS = [
+        self::STATUS_ONLINE=>'已启用',
+        self::STATUS_OFFLINE=>'未启用',
+    ];
+
+
+    const TYPE_XIANJIN = 1;
+    const TYPE_JIAXI = 2;
+    const TYPESS = [
+        [
+            'typeID'=>self::TYPE_XIANJIN,
+            'name'=>'现金券'
+        ],
+        [
+            'typeID'=>self::TYPE_JIAXI,
+            'name'=>'加息券'
+        ]
+    ];
+
+    public function getTypeList() {
+        return self::TYPESS;
+    }
+
+
+    public function setMinMoneyAttr($value) {
+        return $value * 100;
+    }
+
+    public function getYearAttr($value) {
+        return sprintf("%.1f",$value);
+    }
+
+    public function getMinMoneyAttr($value) {
+        return Common::price2($value / 100);
+    }
+
+    public function setMaxMoneyAttr($value) {
+        return $value * 100;
+    }
+
+    public function getMaxMoneyAttr($value) {
+        return Common::price2($value / 100);
+    }
+
+    public function setMoneyAttr($value) {
+        return $value * 100;
+    }
+
+    public function getMoneyAttr($value) {
+        return Common::price2($value / 100);
+    }
+
+    public function getStatusTextAttr($value, $data) {
+        return self::STATUSS[$data['status']];
+    }
+
+    public function getTypeNameAttr($value, $data) {
+        foreach (self::TYPESS as $item) {
+            if($item['typeID'] == $data['typeID']) {
+                return $item['name'];
+            }
+        }
+        return '未知';
+    }
+
+    public function getMinDayTextAttr($value, $data) {
+        if($data['minDay'] == 0) {
+            return '所有产品通用';
+        }
+        return '投资不低于'.$data['minDay'].'天使用';
+    }
+
+    public function getMinMoneyTextAttr($value, $data) {
+        $minMoney = (int)$this->getMinMoneyAttr($data['minMoney']);
+        if($minMoney == 0) {
+            return '满0元使用';
+        }
+        return '满'.$minMoney.'元使用';
+    }
+
+    public function getBuyTextAttr($value, $data) {
+        $text = '';
+        if($data['typeID'] == self::TYPE_JIAXI) {
+            $text = '加息'.$data['year'].'%';
+        }
+        else {
+            $text = '现金券'.(int)$this->getMoneyAttr($data['money']).'元';
+        }
+        return $text;
+    }
+}

+ 226 - 0
application/core/model/HongbaoPlan.php

@@ -0,0 +1,226 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+use think\Cache;
+use think\Log;
+use think\Model;
+use tool\Common;
+
+
+class HongbaoPlan extends Model
+{
+    protected $pk = 'hongbaoPlanID';
+    protected $resultSetType = 'collection';
+    protected $updateTime = 'updateTime';
+    protected $createTime = 'addTime';
+    protected $autoWriteTimestamp = true;
+
+    const STATUS_ONLINE = 1;
+    const STATUS_OFFLINE = 2;
+    const STATUS_OVER = 3;
+
+    const STATUSS = [
+        self::STATUS_ONLINE=>'已启用',
+        self::STATUS_OFFLINE=>'未启用',
+        self::STATUS_OVER=>'已发放',
+    ];
+
+
+    const TYPE_USER_NEW = 1;
+    const TYPE_TIMEING = 2;
+    const TYPESS = [
+        [
+            'typeID'=>self::TYPE_USER_NEW,
+            'name'=>'新手注册'
+        ],
+        [
+            'typeID'=>self::TYPE_TIMEING,
+            'name'=>'定时发送'
+        ]
+    ];
+
+    public function hongbao() {
+        return $this->belongsTo('Hongbao', 'hongbaoID');
+    }
+
+    public function getTypeList() {
+        return self::TYPESS;
+    }
+
+    public function getSendTimeAttr($value) {
+        return Common::timetodate($value);
+    }
+
+    public function getStatusTextAttr($value, $data) {
+        return self::STATUSS[$data['status']];
+    }
+
+    public function getTypeNameAttr($value, $data) {
+        foreach (self::TYPESS as $item) {
+            if($item['typeID'] == $data['typeID']) {
+                return $item['name'];
+            }
+        }
+        return '未知';
+    }
+
+    //新手注册领红包
+    public function sendUserOnRegister($user) {
+        //当前新手注册只能为一个有效
+        $hongbaoPlan = self::where([
+            'typeID'=>1
+        ])->find();
+
+        $hongbaoList = Hongbao::where([
+            'hongbaoID'=>['in', $hongbaoPlan['hongbaoIDS']]
+        ])->select();
+        $data = [];
+        if($hongbaoList->isEmpty()) {
+            return false;
+        }
+        foreach ($hongbaoList->toArray() as $k=>$item) {
+            //如果当前红包不可用
+            if($item['status'] != Hongbao::STATUS_ONLINE) {
+                continue;
+            }
+
+            $userHongbao = [];
+            $userHongbao['userID'] = $user['userID'];
+            $userHongbao['hongbaoID'] = $item['hongbaoID'];
+            if($item['effectTimeType'] == 1) {
+                $userHongbao['beginTime'] = Common::datetotime(Common::timetodate(THINK_START_TIME, 0));
+                $userHongbao['endTime'] = Common::datetotime(Common::timetodate(THINK_START_TIME, 0)) + $item['term'] * 86400;
+            }
+            else if($item['effectTimeType'] == 2) {
+                $userHongbao['beginTime'] = $item['beginTime'];
+                $userHongbao['endTime'] = $item['endTime'];
+            }
+            $userHongbao['getType'] = 1;
+            $userHongbao['status'] = UserHongbao::STATUS_UNUSED;
+            $userHongbao['addTime'] = THINK_START_TIME;
+            $userHongbao['updateTime'] = THINK_START_TIME;
+            $data[] = $userHongbao;
+        }
+        (new UserHongbao())->insertAll($data);
+        return true;
+    }
+
+    //自动派发红包
+    public function sendUserOnTiming() {
+        $userSpan = 99;
+        $hongbaoPlanList = self::with(['hongbao'])->where([
+            'typeID'=>2,
+            'sendTime'=>['lt', (int)THINK_START_TIME],
+            'status'=>HongbaoPlan::STATUS_ONLINE
+        ])->select();
+
+        foreach ($hongbaoPlanList->toArray() as $k=>$item) {
+
+            //对于某一个红包,
+            $userBeginID = Cache::get('HongbaoPlan'.$item['hongbaoPlanID'].'UserBeginID');
+            $userBeginID = $userBeginID ? $userBeginID : 1;
+            $userMaxID = User::max('userID');
+            if($userBeginID > $userMaxID) {
+                //已经全部发放完成
+                self::update([
+                    'status'=>HongbaoPlan::STATUS_OVER
+                ], [
+                    'hongbaoPlanID'=>$item['hongbaoPlanID']
+                ]);
+                Cache::rm('HongbaoPlan'.$item['hongbaoPlanID'].'UserBeginID');
+                continue;
+            }
+
+            $userEndID = $userBeginID + $userSpan;
+            $userList = User::where([
+                'isForged'=>0,
+                'userID'=>['between', [$userBeginID, $userEndID]]
+            ])->select();
+
+            $data = [];
+            foreach ($userList as $user) {
+                //给用户发红包啦
+                if ($item['hongbao']['status'] != Hongbao::STATUS_ONLINE) {
+                    continue;
+                }
+
+                //判断用户是否重复领取
+                $userHongbao = [];
+                $userHongbao['userID'] = $user['userID'];
+                $userHongbao['hongbaoID'] = $item['hongbaoID'];
+                if ($item['hongbao']['effectTimeType'] == 1) {
+                    $userHongbao['beginTime'] = Common::datetotime(Common::timetodate(THINK_START_TIME, 0));
+                    $userHongbao['endTime'] = Common::datetotime(Common::timetodate(THINK_START_TIME, 0)) + $item['hongbao']['term'] * 86400;
+                } else if ($item['hongbao']['effectTimeType'] == 2) {
+                    $userHongbao['beginTime'] = $item['hongbao']['beginTime'];
+                    $userHongbao['endTime'] = $item['hongbao']['endTime'];
+                }
+                $userHongbao['getType'] = 2;
+                $userHongbao['status'] = UserHongbao::STATUS_UNUSED;
+                $userHongbao['addTime'] = THINK_START_TIME;
+                $userHongbao['updateTime'] = THINK_START_TIME;
+                $userHongbao['hongbaoPlanID'] = $item['hongbaoPlanID'];
+                $data[] = $userHongbao;
+            }
+            (new UserHongbao())->insertAll($data);
+            Cache::set('HongbaoPlan'.$item['hongbaoPlanID'].'UserBeginID', $userEndID + 1);
+        }
+
+    }
+
+    //给某个用户发红包
+    public function sendUser($user, $hongbaoIDS, $operator, $note, $mobile) {
+
+        $hongbaoList = Hongbao::where([
+            'hongbaoID'=>['in', $hongbaoIDS]
+        ])->select();
+        $data = [];
+        if($hongbaoList->isEmpty()) {
+            return false;
+        }
+        foreach ($hongbaoList->toArray() as $k=>$item) {
+            //如果当前红包不可用
+            if($item['status'] != Hongbao::STATUS_ONLINE) {
+                continue;
+            }
+            if($user) {
+                $userHongbao = [];
+                $userHongbao['userID'] = $user['userID'];
+                $userHongbao['hongbaoID'] = $item['hongbaoID'];
+                if($item['effectTimeType'] == 1) {
+                    $userHongbao['beginTime'] = Common::datetotime(Common::timetodate(THINK_START_TIME, 0));
+                    $userHongbao['endTime'] = Common::datetotime(Common::timetodate(THINK_START_TIME, 0)) + $item['term'] * 86400;
+                }
+                else if($item['effectTimeType'] == 2) {
+                    $userHongbao['beginTime'] = $item['beginTime'];
+                    $userHongbao['endTime'] = $item['endTime'];
+                }
+                $userHongbao['getType'] = 1;
+                $userHongbao['status'] = UserHongbao::STATUS_UNUSED;
+                $userHongbao['addTime'] = THINK_START_TIME;
+                $userHongbao['updateTime'] = THINK_START_TIME;
+                $userHongbao['operator'] = $operator;
+                $userHongbao['note'] = $note;
+                $data[] = $userHongbao;
+            }
+
+
+            //发送一个短信
+            Sms::create([
+                'mobile'=>$mobile,
+                'message'=>\app\core\service\SMS::message_setJiaxiYuebiao($user ? $user['trueName'] : '佳乾客户', '一张新年加息券'.$item['year'], 'http://t.cn/RQC0dnv'),
+                'note'=>'狗年约标',
+                'sendTime'=>THINK_START_TIME
+            ]);
+        }
+        (new UserHongbao())->insertAll($data);
+        return true;
+    }
+}

+ 36 - 0
application/core/model/InterestTimeType.php

@@ -0,0 +1,36 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+
+use think\Model;
+
+
+class InterestTimeType extends Model
+{
+    protected $resultSetType = 'collection';
+    protected $pk = 'interestTimeTypeID';
+
+
+
+
+
+
+    public static function getInterestTimeTypeList($defaultInterestTimeType = 1) {
+        $list = InterestTimeType::all();
+        $list = $list->toArray();
+        $resultList = [];
+        foreach ($list as $k=>$item) {
+            if($item['interestTimeTypeID'] == $defaultInterestTimeType) {
+                array_push($resultList, $item);
+            }
+        }
+        return $resultList;
+    }
+}

+ 19 - 0
application/core/model/InterestType.php

@@ -0,0 +1,19 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+
+use think\Model;
+
+
+class InterestType extends Model
+{
+    protected $resultSetType = 'collection';
+    protected $pk = 'interestTypeID';
+}

+ 24 - 0
application/core/model/Introduce.php

@@ -0,0 +1,24 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+use think\Config;
+use think\Log;
+use think\Model;
+use tool\Common;
+
+class UserIntroduceCash extends Model
+{
+    protected $resultSetType = 'collection';
+    protected $updateTime = false;
+    protected $createTime = 'addTime';
+    protected $autoWriteTimestamp = true;
+    const STATUS_OK = 1;
+    const STATUS_ERROR = 1;
+}

+ 64 - 0
application/core/model/Loan.php

@@ -0,0 +1,64 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+use think\Model;
+use tool\Common;
+
+class Loan extends Model
+{
+    protected $pk = 'loanID';
+    protected $resultSetType = 'collection';
+    protected $updateTime = 'updateTime';
+    protected $createTime = 'addTime';
+    protected $autoWriteTimestamp = true;
+
+
+    const STATUS_OK = 1;
+    const STATUS_INVALID = 2;
+    const STATUSS = [
+        self::STATUS_OK=>'有效的',
+        self::STATUS_INVALID=>'无效的'
+    ];
+
+    public function subjectList() {
+        return $this->hasMany('Subject', 'loanID');
+    }
+
+    public function certTypeText($value, $data) {
+        $text = '未知';
+        if($data['certType'] == 1) {
+            $text = '身份证';
+        }
+        else if($data['certType'] == 1){
+            $text = '营业执照';
+        }
+        return $text;
+    }
+
+    public function pledgeTypeText($value, $data) {
+        $text = '未知';
+        if($data['pledgeType'] == 1) {
+            $text = '车辆抵押';
+        }
+        return $text;
+    }
+
+    public function getStatusTextAttr($value, $data) {
+        return self::STATUSS[$data['status']];
+    }
+
+    public function setMoneyAttr($value) {
+        return $value * 100;
+    }
+
+    public function getMoneyAttr($value) {
+        return Common::price2($value / 100);
+    }
+}

+ 37 - 0
application/core/model/Master.php

@@ -0,0 +1,37 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+use think\Config;
+use think\Db;
+use think\Exception;
+use think\Log;
+use think\Model;
+use tool\Common;
+
+class Master extends Model
+{
+    protected $resultSetType = 'collection';
+    protected $updateTime = 'updateTime';
+    protected $createTime = 'addTime';
+    protected $autoWriteTimestamp = true;
+
+    public function createPassword($password) {
+        return md5('aisdfa90asopdf0as8d0f8a0s9d8f0asdfjasdfaqw'.$password);
+    }
+
+    public function createToken() {
+        return md5(THINK_START_TIME.Common::token_create(10));
+    }
+
+    public function createTokenOverTime() {
+        return (int)THINK_START_TIME + 7 * 86400;
+    }
+
+}

+ 22 - 0
application/core/model/Sms.php

@@ -0,0 +1,22 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+
+use think\Model;
+
+
+class Sms extends Model
+{
+    protected $resultSetType = 'collection';
+    protected $pk = 'smsID';
+    protected $updateTime = 'updateTime';
+    protected $createTime = 'addTime';
+    protected $autoWriteTimestamp = true;
+}

+ 274 - 0
application/core/model/Subject.php

@@ -0,0 +1,274 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+
+use think\Config;
+use think\Model;
+use tool\Common;
+
+
+class Subject extends Model
+{
+    protected $pk = 'subjectID';
+    protected $resultSetType = 'collection';
+    protected $updateTime = 'updateTime';
+    protected $createTime = 'addTime';
+    protected $autoWriteTimestamp = true;
+
+    const STATUS_LOCK = 1;
+    const STATUS_ONLINE_CHECK = 2;
+    const STATUS_ONLINE = 3;
+    const STATUS_FULL = 4;
+    const STATUS_OVERTIME = 5;
+    const STATUS_REPAY = 6;
+
+    const STATUSS = [
+        self::STATUS_LOCK=>'锁定',
+        self::STATUS_ONLINE_CHECK=>'等待上架',
+        self::STATUS_ONLINE=>'抢购中',
+        self::STATUS_FULL=>'已卖光',
+        self::STATUS_OVERTIME=>'已到期',
+        self::STATUS_REPAY=>'已还款'
+    ];
+
+    const STATUS_LOAN_NULL = 1;
+    const STATUS_LOAN_FANG_WAIT = 2;
+    const STATUS_LOAN_FANG = 3;
+    const STATUS_LOAN_FINISH = 4;
+    const STATUS_LOANS = [
+        self::STATUS_LOAN_NULL=>'未到放款时间',
+        self::STATUS_LOAN_FANG_WAIT=>'待放款',
+        self::STATUS_LOAN_FANG=>'收款中',
+        self::STATUS_LOAN_FINISH=>'已收款'
+    ];
+
+    public function subjectType()
+    {
+        return $this->belongsTo('SubjectType', 'subjectTypeID');
+    }
+
+    public function interestType()
+    {
+        return $this->belongsTo('InterestType', 'interestTypeID');
+    }
+
+    public function interestTimeType()
+    {
+        return $this->belongsTo('InterestTimeType', 'interestTimeTypeID');
+    }
+
+    public function subjectStat()
+    {
+        return $this->hasOne('SubjectStat', 'subjectID');
+    }
+
+    public function cangList()
+    {
+        return $this->hasMany('Cang', 'subjectID');
+    }
+
+    public function getStatusTextAttr($value, $data) {
+        return self::STATUSS[$data['status']];
+    }
+
+    public function getStatusLoanTextAttr($value, $data) {
+        return self::STATUS_LOANS[$data['statusLoan']];
+    }
+
+    public function getUnitAttr($value, $data) {
+        return '天';
+    }
+
+    public function getYearAttr($value) {
+        return sprintf("%.1f",$value);
+    }
+
+    public function getYearSystemAttr($value) {
+        return sprintf("%.1f",$value);
+    }
+
+    public function getYearExtAttr($value) {
+        return sprintf("%.1f",$value);
+    }
+
+    public static function getStatusList() {
+        return self::STATUSS;
+    }
+
+    public static function createAlias() {
+        return Common::timetodate(THINK_START_TIME, 10).Common::token_create(6);
+    }
+
+    public function getReleaseTimeAttr($value) {
+        return Common::timetodate($value, 6);
+    }
+
+    public function getBeginTimeAttr($value) {
+        return Common::timetodate($value, 6);
+    }
+
+    public function getEndTimeAttr($value) {
+        return Common::timetodate($value, 6);
+    }
+
+    public function getRepayInterestTimeAttr($value) {
+        return Common::timetodate($value, 6);
+    }
+
+    public function getOverTimeAttr($value) {
+        return Common::timetodate($value, 0);
+    }
+
+    public function getFullTimeAttr($value) {
+        if(!$value) {
+            return '';
+        }
+        return Common::timetodate($value);
+    }
+
+    public function getInterestBeginTimeAttr($value, $data) {
+        return '购买日';
+    }
+
+    public function getSubjectTypeIconAttr($value, $data) {
+        $icon = '';
+        if($data['subjectTypeID'] == 1) {
+            $icon = 'http://slb.dahengdian.com/jiaqiancaifu/2017/12/30/A3hShPxTCV.png';
+        }
+        else if($data['subjectTypeID'] == 2) {
+            $icon = 'http://slb.dahengdian.com/jiaqiancaifu/2018/01/03/loLuc5moxc.png';
+            //http://slb.dahengdian.com/jiaqiancaifu/2018/01/11/orrP4nOlQn.png
+        }
+        else if($data['subjectTypeID'] == 3) {
+            $icon = 'http://slb.dahengdian.com/jiaqiancaifu/2018/01/03/QioKU4FSfn.png';
+        }
+        else {
+            $icon = 'http://slb.dahengdian.com/jiaqiancaifu/2017/12/30/A3hShPxTCV.png';
+        }
+        return $icon;
+    }
+
+    public function setPriceAttr($value) {
+        return $value * 100;
+    }
+
+    public function getPriceAttr($value) {
+        return (int)($value / 100);
+    }
+
+    public function setBasePriceAttr($value) {
+        return $value * 100;
+    }
+
+    public function getBasePriceAttr($value) {
+        return Common::price2($value / 100);
+    }
+
+    public function setBaseMaxPriceAttr($value) {
+        return $value * 100;
+    }
+
+    public function getBaseMaxPriceAttr($value) {
+        return Common::price2($value / 100);
+    }
+
+    public function getRepayTimeAttr($value, $data) {
+        $repaytimeDelaySpan = self::getRepaytimeDelaySpan();
+        return Common::timetodate($repaytimeDelaySpan + $data['overTime'], 0);
+    }
+
+    public function getReachTimeAttr($value, $data) {
+        $reachTimeDelaySpan = self::getReachtimeDelaySpan();
+        return Common::timetodate($reachTimeDelaySpan * 86400 + $data['overTime'], 0);
+    }
+
+    public function getInvestDayAttr($value, $data) {
+        $overtimeIsinterest = self::getOvertimeIsinterest();
+
+        $investDay = ($data['overTime'] - Common::datetotime(Common::timetodate(THINK_START_TIME, 0))) / 86400;
+        if($overtimeIsinterest == 1) {
+            $investDay = $investDay - 1;
+        }
+        if($data['interestTimeTypeID'] == 2) {
+            $investDay = $investDay + 1;
+        }
+        return $investDay;
+    }
+
+    public static function getRepaytimeDelaySpan() {
+        return Config::get('interest.repaytime_delay_span');
+    }
+
+    public static function getDefaultInterestTimeType() {
+        return Config::get('interest.default_interest_time_type');
+    }
+
+    public static function getOvertimeIsinterest() {
+        return Config::get('interest.overtime_isinterest');
+    }
+
+    public static function getReachtimeDelaySpan() {
+        return Config::get('interest.reachtime_delay_span');
+    }
+
+    public static function getDailyReleaseSpan() {
+        return Config::get('interest.default_daily_release_span');
+    }
+
+    public static function setSubjectFull($subject) {
+        //满标计息
+        if($subject['interestTimeTypeID'] == 1) {
+            $interestBeginTime = Common::datetotime(Common::timetodate(THINK_START_TIME, 0));
+            if(self::getOvertimeIsinterest() == 1) {
+                $interestEndTime = $subject->getData('overTime');
+            }
+            else {
+                $interestEndTime = $subject->getData('overTime') - 86400;
+            }
+            $investDay = $subject['investDay'];//投资天数
+
+            //批量更新数据cang
+            Cang::where([
+                'subjectID'=>$subject['subjectID']
+            ])->chunk(100, function($subjectList) use($subject, $interestBeginTime, $interestEndTime, $investDay) {
+                foreach ($subjectList as $k=>$item) {
+                    $interest = $item['moneySubject'] * $subject['year'] / 100 / 365 * $investDay;//预付利息
+                    Cang::update([
+                        'interestBeginTime'=>$interestBeginTime,
+                        'interestEndTime'=>$interestEndTime,
+                        'investDay'=>$investDay,
+                        'interest'=>$interest,
+                        'status'=>Cang::STATUS_INTEREST //计息状态开始
+                    ],[
+                        'cangID'=>$item['cangID']
+                    ]);
+
+                    CangRepay::update([
+                        'money'=>$interest
+                        //'status'=>Cang::STATUS_INTEREST //计息状态开始
+                    ],[
+                        'cangID'=>$item['cangID'],
+                        'repayTypeID'=>2
+                    ]);
+                }
+            });
+        }
+
+        //最后更新subject
+        self::update([
+            'status'=> self::STATUS_FULL,
+            'statusLoan'=>self::STATUS_LOAN_FANG_WAIT,
+            'fullTime'=>THINK_START_TIME
+        ],[
+           'subjectID'=> $subject['subjectID']
+        ]);
+    }
+
+}

+ 28 - 0
application/core/model/SubjectStat.php

@@ -0,0 +1,28 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+
+use think\Model;
+use tool\Common;
+
+
+class SubjectStat extends Model
+{
+    protected $resultSetType = 'collection';
+    protected $pk = 'subjectStatID';
+
+    public function setMoneyTotalInvestAttr($value) {
+        return $value * 100;
+    }
+
+    public function getMoneyTotalInvestAttr($value) {
+        return (int)($value / 100);
+    }
+}

+ 20 - 0
application/core/model/SubjectType.php

@@ -0,0 +1,20 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+
+use think\Model;
+
+
+class SubjectType extends Model
+{
+    protected $resultSetType = 'collection';
+    protected $pk = 'subjectTypeID';
+
+}

+ 77 - 0
application/core/model/User.php

@@ -0,0 +1,77 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+use think\Config;
+use think\Db;
+use think\Exception;
+use think\Log;
+use think\Model;
+use tool\Common;
+
+class User extends Model
+{
+    protected $resultSetType = 'collection';
+    protected $updateTime = 'updateTime';
+    protected $createTime = 'addTime';
+    protected $autoWriteTimestamp = true;
+
+    const STATUS_OK = 0;
+    const STATUS_UNBANDING = 1;
+
+    const STATUSS = [
+        self::STATUS_OK=>'正常',
+        self::STATUS_UNBANDING=>'锁定',
+    ];
+
+    public function userAccount() {
+        return $this->hasOne('userAccount', 'userID');
+    }
+
+    public function channel() {
+        return $this->belongsTo('channel', 'channelID');
+    }
+
+    public function createUUID($userID) {
+        return Common::timetodate(THINK_START_TIME,110).mt_rand(1000,9999).sprintf('%06s', $userID);
+    }
+
+    public function userBank() {
+        return $this->hasOne('userBank', 'userID');
+    }
+
+    public function createPassword($password) {
+        return md5('uaaoidusoia9a8d8fsd7f900a7d9sfadjfjadjf'.$password);
+    }
+
+    public function createToken() {
+        return md5(THINK_START_TIME.Common::token_create(10));
+    }
+
+    public function createTokenOverTime() {
+        return (int)THINK_START_TIME + 7 * 86400;
+    }
+
+    public function getMobileAsteriskAttr($value, $data) {
+        return Common::mobileAsterisk($data['mobile']);
+    }
+
+    public function getLoginTimeAttr($value)
+    {
+        if($value == 0) {
+            return '';
+        }
+        return 0;
+    }
+
+    public function getAvatarAttr($value, $data) {
+        return 'http://slb.dahengdian.com/jiaqiancaifu/2018/01/03/V5KL8LKbLE.png';
+    }
+
+}

+ 413 - 0
application/core/model/UserAccount.php

@@ -0,0 +1,413 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+use app\core\model\UserFinance;
+use think\Config;
+use think\Db;
+use think\Exception;
+use think\Log;
+use think\Model;
+use tool\Common;
+
+class UserAccount extends Model
+{
+    protected $pk = 'userAccountID';
+    protected $resultSetType = 'collection';
+    protected $updateTime = 'updateTime';
+    protected $createTime = 'updateTime';
+    protected $autoWriteTimestamp = true;
+
+    public function setMoneyAttr($value)
+    {
+        return $value * 100;
+    }
+
+    public function getMoneyTotalAttr($value, $data)
+    {
+        return Common::price2(($data['waitBen'] + $data['waitInterest'] + $data['money']) / 100);
+    }
+
+    public function getMoneyAttr($value)
+    {
+        return Common::price2($value / 100);
+    }
+
+    public function setMoneyFrozenAttr($value)
+    {
+        return $value * 100;
+    }
+
+    public function getMoneyFrozenAttr($value)
+    {
+        return Common::price2($value / 100);
+    }
+
+    public function setMoneyAccAttr($value)
+    {
+        return $value * 100;
+    }
+
+    public function getMoneyAccAttr($value)
+    {
+        return Common::price2($value / 100);
+    }
+
+    /*public function setMoneyYesterdayAttr($value)
+    {
+        return $value * 100;
+    }
+
+    public function getMoneyTodayAccAttr($value)
+    {
+        return Common::price2($value / 100);
+    }
+
+    public function setMoneyTodayAttr($value)
+    {
+        return $value * 100;
+    }
+
+    public function getMoneyTodayAttr($value)
+    {
+        return Common::price2($value / 100);
+    }*/
+
+    public function setHasInvestBenTotalAttr($value)
+    {
+        return $value * 100;
+    }
+
+    public function getHasInvestBenTotalAttr($value)
+    {
+        return Common::price2($value / 100);
+    }
+
+    public function setHasInvestMoneyTotalAttr($value)
+    {
+        return $value * 100;
+    }
+
+    public function getHasInvestMoneyTotalAttr($value)
+    {
+        return Common::price2($value / 100);
+    }
+
+    public function setHasRepayBenTotalAttr($value)
+    {
+        return $value * 100;
+    }
+
+    public function gethasRepayBenTotalAttr($value)
+    {
+        return Common::price2($value / 100);
+    }
+
+    public function setHasRepayInterestTotalAttr($value)
+    {
+        return $value * 100;
+    }
+
+    public function getHasRepayInterestTotalAttr($value)
+    {
+        return Common::price2($value / 100);
+    }
+
+    public function setWaitBenAttr($value)
+    {
+        return $value * 100;
+    }
+
+    public function getWaitBenAttr($value)
+    {
+        return Common::price2($value / 100);
+    }
+
+    public function setWaitInterestAttr($value)
+    {
+        return $value * 100;
+    }
+
+    public function getWaitInterestAttr($value)
+    {
+        return Common::price2($value / 100);
+    }
+
+    public function setIntroduceMoneyAttr($value)
+    {
+        return $value * 100;
+    }
+
+    public function getIntroduceMoneyAttr($value)
+    {
+        return Common::price2($value / 100);
+    }
+
+
+    public function updateProfit($cang  = false) {
+        $todayTime = Common::datetotime(Common::timetodate(THINK_START_TIME, 0));
+        if($this['todayTime'] != $todayTime) {
+            //更新昨天收益
+            //$this['moneyYesterday'] = $this['moneyToday'];
+
+            //更新今日收益
+            $cangList = Cang::where([
+                'isForged'=>0,
+                'status'=>['in', [Cang::STATUS_INTEREST]],
+                'userID'=>$this['userID']
+            ])->select();
+            $money = 0;
+            $moneyAcc = 0;
+            if(!$cangList->isEmpty()) {
+                foreach ($cangList as $k=>$item) {
+                    $moneyOneDay = round($item['interest'] / $item['investDay'], 6);
+                    $money += $moneyOneDay;
+                    if(!$this['todayTime']) {
+                        $moneyAcc = $moneyAcc + $moneyOneDay + (($todayTime - Common::datetotime(Common::timetodate($item->getData('interestBeginTime')))) / 86400) * $moneyOneDay;
+                        //Log::info('day:'.(($todayTime - Common::datetotime(Common::timetodate($item->getData('interestBeginTime')))) / 86400));
+                    }
+                }
+            }
+            $money = round($money, 4);
+
+            $this['moneyToday'] = $money;
+            $this['moneyAcc'] = round($this['moneyAcc'] + $moneyAcc, 4);
+            $this['todayTime'] = $todayTime;
+            $this->save();
+            //$this->userAccount['moneyAcc'] =
+        }
+        else {
+            if($cang) {
+                $this['moneyAcc'] = $this['moneyAcc'] + round($cang['interest'] / $cang['investDay'], 2);
+                $this['moneyToday'] = $this['moneyToday'] + round($cang['interest'] / $cang['investDay'], 4);
+                $this->save();
+            }
+        }
+        return $this;
+    }
+
+
+    /**
+     * 充值时,更新money,并生成账务流水,该方法只做充值时余额增加时使用
+     * @param $recharge 充值对象
+     * @param $user 用户对象
+     * @param $reachTime 第三方生成流水时间
+     */
+    public function MODE_recharge_addMoney(UserRecharge $recharge, User $user, $reachTime)
+    {
+        //1、更新账户资产
+        $userAccount = self::get([
+            'userID' => $user['userID']
+        ]);
+        $moneyPre = $userAccount['money'];
+        $moneyNow = $userAccount['money'] + $recharge['money'];
+        $userAccount['money'] = $userAccount['money'] + $recharge['money'];
+        $userAccount->save();
+
+
+        //2、更新用户流水
+        UserFinance::create([
+            'mode' => UserFinance::MODE_RECHARGE,
+            'modeID' => $recharge['userRechargeID'],
+            'money' => $recharge['money'],
+            'userID' => $user['userID'],
+            'status' => UserFinance::STATUS_OK,
+            'moneyPre' => $moneyPre,
+            'moneyNow' => $moneyNow
+        ]);
+
+        //3、更新充值记录
+        UserRecharge::update([
+            'status' => UserRecharge::STATUS_PAY,
+            'outerReachTime' => $reachTime
+        ], [
+            'userRechargeID' => $recharge['userRechargeID']
+        ]);
+
+        return $userAccount;
+    }
+
+    /**
+     * 发起提现到零钱的请求
+     * @param $userDrawcash
+     * @param $user - 发起申请人
+     * @param $submitTime - 提交时间
+     */
+    public function MODE_drawcash_decMoney_submit(&$msg, UserDrawcash $userDrawcash, User $user, $submitTime)
+    {
+        //1、更新账户资产,余额减少,冻结金额增多
+        $msg = '操作成功';
+        $userAccount = self::get([
+            'userID' => $user['userID']
+        ]);
+
+        $moneyPre = $userAccount['money'];
+        $moneyNow = $userAccount['money'] - $userDrawcash['money'];
+        if ($moneyNow < 0) {
+            $msg = '余额不足';
+            return false;
+        }
+        $userAccount['money'] = $userAccount['money'] - $userDrawcash['money'];
+        $userAccount['moneyFrozen'] = $userAccount['moneyFrozen'] + $userDrawcash['money'];
+        $userAccount->save();
+
+        //2、生成一个提现流水,处于冻结状态,什么时候收到异步通知,我们在改变该流水
+        UserFinance::create([
+            'mode' => UserFinance::MODE_DRAWCASH,
+            'modeID' => $userDrawcash['userDrawcashID'],
+            'money' => 0 - $userDrawcash['money'],
+            'userID' => $user['userID'],
+            'status' => UserFinance::STATUS_FROZEN,
+            'moneyPre' => $moneyPre,
+            'moneyNow' => $moneyNow
+        ]);
+
+
+        //3、更新提现记录
+        UserDrawcash::update([
+            'status' => UserDrawcash::STATUS_ING,
+            'submitTime' => $submitTime
+        ], [
+            'userDrawcashID' => $userDrawcash['userDrawcashID']
+        ]);
+        return $userAccount;
+    }
+
+    /**
+     * 持仓时,更新money,并生成账务流水,该方法只做持仓时余额减少时使用
+     * @param $money 更新金钱
+     * @param $rechargeID 充值ID
+     * @param $userID 用户ID
+     * @param $outer 第三方支付等
+     */
+    public function MODE_cang_decMoney($cang, $user, $interest)
+    {
+
+        //1、更新账户资产
+        $userAccount = self::get([
+            'userID' => $user['userID']
+        ]);
+        $moneyPre = $userAccount['money'];
+        $moneyNow = $userAccount['money'] - $cang['money'];
+        $userAccount['waitBen'] = $userAccount['waitBen'] + $cang['ben'];
+        $userAccount['waitInterest'] = $userAccount['waitInterest'] + $interest;
+        $userAccount['hasInvestBenTotal'] = $userAccount['hasInvestBenTotal'] + $cang['ben'];
+        $userAccount['money'] = $moneyNow;
+        $userAccount->save();
+
+
+        //2、更新用户流水
+        UserFinance::create([
+            'mode' => UserFinance::MODE_CANG,
+            'modeID' => $cang['cangID'],
+            'money' => 0 - $cang['money'],
+            'userID' => $user['userID'],
+            'status' => UserFinance::STATUS_OK,
+            'moneyPre' => $moneyPre,
+            'moneyNow' => $moneyNow
+        ]);
+
+        return $userAccount;
+    }
+
+    /**
+     * 返息,更新money,并生成账务流水,该方法只做持返息余额增加时使用
+     * @param $money 更新金钱
+     * @param $cangID 持仓ID
+     * @param $userID 用户ID
+     */
+    public function MODE_repayInterest_addMoney($cangRepay, $user)
+    {
+        //1、更新账户资产
+        $userAccount = self::get([
+            'userID' => $user['userID']
+        ]);
+        $moneyPre = $userAccount['money'];
+        $moneyNow = $userAccount['money'] + $cangRepay['money'];
+        $userAccount['money'] = $moneyNow;
+        $userAccount['waitInterest'] = $userAccount['waitInterest'] - $cangRepay['money'];
+        $userAccount['moneyAcc'] = $userAccount['moneyAcc'] + $cangRepay['money'];
+        $userAccount->save();
+
+        //2、更新用户流水
+        UserFinance::create([
+            'mode' => UserFinance::MODE_REPAY_INTEREST,
+            'modeID' => $cangRepay['cangRepayID'],
+            'money' => $cangRepay['money'],
+            'userID' => $user['userID'],
+            'status' => UserFinance::STATUS_OK,
+            'moneyPre' => $moneyPre,
+            'moneyNow' => $moneyNow
+        ]);
+        return $userAccount;
+    }
+
+    /**
+     * 返本,更新money,并生成账务流水,该方法只做返本时余额增加时使用
+     * @param $money 更新金钱
+     * @param $cangID 持仓ID
+     * @param $userID 用户ID
+     */
+    public function MODE_repayBen_addMoney($cangRepay, $user)
+    {
+        //1、更新账户资产
+        $userAccount = self::get([
+            'userID' => $user['userID']
+        ]);
+        $moneyPre = $userAccount['money'];
+        $moneyNow = $userAccount['money'] + $cangRepay['money'];
+        $userAccount['money'] = $moneyNow;
+        $userAccount['waitBen'] = $userAccount['waitBen'] - $cangRepay['money'];
+        $userAccount->save();
+
+        //2、更新用户流水
+        UserFinance::create([
+            'mode' => UserFinance::MODE_REPAY_BEN,
+            'modeID' => $cangRepay['cangRepayID'],
+            'money' => $cangRepay['money'],
+            'userID' => $user['userID'],
+            'status' => UserFinance::STATUS_OK,
+            'moneyPre' => $moneyPre,
+            'moneyNow' => $moneyNow
+        ]);
+        return $userAccount;
+    }
+
+    /**
+     * 返本,送现金
+     * @param $cash 现金
+     * @param $user 用户
+     * @param $userID 用户ID
+     */
+    public function MODE_cashsend_addMoney(Cash $cash, User $user) {
+        //1、更新账户资产
+        $userAccount = self::get([
+            'userID' => $user['userID']
+        ]);
+        $moneyPre = $userAccount['money'];
+        $moneyNow = $userAccount['money'] + $cash['money'];
+        $userAccount['money'] = $userAccount['money'] + $cash['money'];
+        $userAccount->save();
+
+
+        //2、更新用户流水
+        UserFinance::create([
+            'mode' => UserFinance::MODE_CASHSEND,
+            'modeID' => $cash['cashID'],
+            'money' => $cash['money'],
+            'userID' => $user['userID'],
+            'status' => UserFinance::STATUS_OK,
+            'moneyPre' => $moneyPre,
+            'moneyNow' => $moneyNow
+        ]);
+        return $userAccount;
+    }
+
+
+}

+ 33 - 0
application/core/model/UserBank.php

@@ -0,0 +1,33 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+use think\Model;
+use tool\Common;
+
+class UserBank extends Model
+{
+    protected $resultSetType = 'collection';
+    protected $updateTime = 'updateTime';
+    protected $createTime = 'addTime';
+    protected $autoWriteTimestamp = true;
+
+
+    const STATUS_OK = 1;
+    const STATUS_FAIL = 2;
+
+
+    public function bank() {
+        return $this->belongsTo('Bank', 'bankID');
+    }
+
+    public function getBankNumberAsteriskAttr($value, $data) {
+        return Common::bankNumberAsterisk($data['bankNumber']);
+    }
+}

+ 32 - 0
application/core/model/UserCancelLog.php

@@ -0,0 +1,32 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+use think\Config;
+use think\Log;
+use think\Model;
+use tool\Common;
+
+class UserCancelLog extends Model
+{
+    protected $resultSetType = 'collection';
+    protected $updateTime = false;
+    protected $createTime = 'addTime';
+    protected $autoWriteTimestamp = true;
+
+
+    const STATUS_SUCCESS = 1;
+    const STATUS_UN = 2;
+    const STATUS_ERROR = 3;
+    const STATUSS = [
+        self::STATUS_SUCCESS=>'已成功',
+        self::STATUS_UN=>'未完成',
+        self::STATUS_ERROR=>'失败'
+    ];
+}

+ 98 - 0
application/core/model/UserDrawcash.php

@@ -0,0 +1,98 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+use think\Config;
+use think\Log;
+use think\Model;
+use tool\Common;
+
+class UserDrawcash extends Model
+{
+    protected $resultSetType = 'collection';
+    protected $updateTime = 'updateTime';
+    protected $createTime = 'applyTime';
+    protected $autoWriteTimestamp = true;
+    const REACH_IMM = 'REACH_IMM';
+    const REACH_HOUR2 = 'REACH_HOUR2';
+    const REACH_DAY2 = 'REACH_DAY2';
+    const REACHS = [
+        self::REACH_IMM=>'即时到帐',
+        self::REACH_HOUR2=>'两小时内到帐',
+        self::REACH_DAY2=>'两天内到帐'
+    ];
+
+    const TYPE_BANK = 'TYPE_BANK';
+    const TYPE_WXCHANGE = 'TYPE_WXCHANGE';
+    const TYPES = [
+        self::TYPE_BANK=>'提现到银行',
+        self::TYPE_WXCHANGE=>'提现到零钱'
+    ];
+
+    const STATUS_OK = 1;
+    const STATUS_SUBMIT = 2;
+    const STATUS_ING = 3;
+    const STATUS_REFUSE = 4;
+    const STATUS_ERROR = 5;
+    const STATUSS = [
+        self::STATUS_OK=>'已到账',
+        self::STATUS_SUBMIT=>'提交中',
+        self::STATUS_ING=>'提现中',
+        self::STATUS_REFUSE=>'已拒绝',
+        self::STATUS_ERROR=>'失败'
+    ];
+
+    const BANK_TYPE_WXMCH = 'WXMCH';
+    const BANK_TYPE_WXSERVICE = 'WXSERVICE';
+
+
+    public function getDrawcashIDAttr($value, $data) {
+        return $data['id'];
+    }
+
+    public function setMoneyAttr($value) {
+        return $value * 100;
+    }
+
+    public function getMoneyAttr($value) {
+        return Common::price2($value / 100);
+    }
+
+    public function getApplyTimeAttr($value)
+    {
+        return Common::timetodate($value, 4);
+    }
+
+    public function getResultTimeAttr($value)
+    {
+        return Common::timetodate($value, 4);
+    }
+
+    public function getReachTimeAttr($value)
+    {
+        return Common::timetodate($value, 4);
+    }
+
+    public function getTypeNameAttr($value, $data) {
+        return self::TYPES[$data['type']];
+    }
+
+    public function getStatusTextAttr($value, $data) {
+        return self::STATUSS[$data['status']];
+    }
+
+    public function getReachTextAttr($value, $data) {
+        return self::REACHS[$data['reach']];
+    }
+
+    public function createAlias($id)
+    {
+        return 'DH' . Common::timetodate(THINK_START_TIME, 10) .  sprintf("%08d", $id);
+    }
+}

+ 95 - 0
application/core/model/UserFinance.php

@@ -0,0 +1,95 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+use think\Model;
+use tool\Common;
+
+class UserFinance extends Model
+{
+    protected $resultSetType = 'collection';
+    protected $updateTime = 'updateTime';
+    protected $createTime = 'addTime';
+    protected $autoWriteTimestamp = true;
+    const MODE_RECHARGE = 'MODE_RECHARGE';//充值
+    const MODE_DRAWCASH = 'MODE_DRAWCASH';//提现
+    const MODE_CANG = 'MODE_CANG';//下单
+    const MODE_REPAY_INTEREST = 'MODE_REPAY_INTEREST';//还息
+    const MODE_REPAY_BEN = 'MODE_REPAY_BEN';//还本
+    const MODE_EXT = 'MODE_EXT';//其他
+    const MODE_BI = 'MODE_BI';//本息
+    const MODE_CASHSEND = 'MODE_CASHSEND';//送现金
+    const STATUS_OK = 1;
+    const STATUS_INVALID = 2;
+    const STATUS_FROZEN =3;
+
+    public function setMoneyAttr($value) {
+        return $value * 100;
+    }
+
+    public function getMoneyAttr($value) {
+        return Common::price2($value / 100);
+    }
+
+    public function setMoneyPreAttr($value) {
+        return $value * 100;
+    }
+
+    public function getMoneyPreAttr($value) {
+        return Common::price2($value / 100);
+    }
+
+    public function setMoneyNowAttr($value) {
+        return $value * 100;
+    }
+
+    public function getMoneyNowAttr($value) {
+        return Common::price2($value / 100);
+    }
+
+    public function getModeTextAttr($value, $data) {
+        $modeText = '未知';
+        switch ($data['mode']) {
+            case 'MODE_RECHARGE':
+                $modeText = '充值'.($data['status'] == self::STATUS_OK ? '成功' : '失败');
+                break;
+            case 'MODE_DRAWCASH':
+                //$modeText = '提现'.$data['status'] == self::STATUS_OK ? '成功' : '失败';
+                if($data['status'] == self::STATUS_OK) {
+                    $modeText = '提现成功';
+                }
+                else if($data['status'] == self::STATUS_FROZEN){
+                    $modeText = '预备到账';
+                }
+                else {
+                    $modeText = '提现失败';
+                }
+                break;
+            case 'MODE_CANG':
+                $modeText = '购买'.($data['status'] == self::STATUS_OK ? '成功' : '失败');
+                break;
+            case 'MODE_REPAY_INTEREST':
+                $modeText = '本金回款'.$data['status'] == self::STATUS_OK ? '成功' : '失败';
+                break;
+            case 'MODE_REPAY_BEN':
+                $modeText = '利息回款'.$data['status'] == self::STATUS_OK ? '成功' : '失败';
+                break;
+            case 'MODE_EXT':
+                $modeText = $data['status'] == self::STATUS_OK ? '成功' : '失败';
+                break;
+            case 'MODE_CASHSEND':
+                $modeText = '送现金'.$data['status'] == self::STATUS_OK ? '成功' : '失败';
+                break;
+            default:
+                $modeText = '未知';
+                break;
+        }
+        return $modeText;
+    }
+}

+ 42 - 0
application/core/model/UserHongbao.php

@@ -0,0 +1,42 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+use think\Model;
+use tool\Common;
+
+class UserHongbao extends Model
+{
+    protected $resultSetType = 'collection';
+    protected $updateTime = 'updateTime';
+    protected $createTime = 'addTime';
+    protected $autoWriteTimestamp = true;
+
+    const STATUS_UNUSED = 1;
+    const STATUS_USED = 2;
+    const STATUS_OUTTIME = 3;
+    const STATUSS = [
+        self::STATUS_UNUSED=>'未用过',
+        self::STATUS_USED=>'已使用',
+        self::STATUS_OUTTIME=>'已过期',
+    ];
+
+
+    public function hongbao() {
+        return $this->belongsTo('Hongbao', 'hongbaoID');
+    }
+
+    public function getBeginTimeAttr($value) {
+        return Common::timetodate($value, 0);
+    }
+
+    public function getEndTimeAttr($value) {
+        return Common::timetodate($value, 0);
+    }
+}

+ 25 - 0
application/core/model/UserHonor.php

@@ -0,0 +1,25 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+use think\Config;
+use think\Log;
+use think\Model;
+use tool\Common;
+
+class UserHonor extends Model
+{
+    protected $resultSetType = 'collection';
+    protected $updateTime = 'updateTime';
+    protected $createTime = 'addTime';
+    protected $autoWriteTimestamp = true;
+    const MODE_CANG = 'MODE_CANG';
+    const MODE_SHARE = 'MODE_SHARE';
+    const STATUS_OK = 1;
+}

+ 75 - 0
application/core/model/UserRecharge.php

@@ -0,0 +1,75 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\model;
+
+use think\Config;
+use think\Log;
+use think\Model;
+use tool\Common;
+
+class UserRecharge extends Model
+{
+    protected $resultSetType = 'collection';
+    protected $updateTime = 'updateTime';
+    protected $createTime = 'addTime';
+    protected $autoWriteTimestamp = true;
+
+    const TYPE_BANK = 'TYPE_BANK';
+    const TYPE_WXCHANGE = 'TYPE_WXCHANGE';
+    const TYPES = [
+        self::TYPE_BANK=>'银行卡充值',
+        self::TYPE_WXCHANGE=>'微信零钱充值'
+    ];
+
+    const STATUS_PAY = 1;
+    const STATUS_UNPAY = 2;
+    const STATUS_ERROR = 3;
+    const STATUSS = [
+        self::STATUS_PAY=>'已充值',
+        self::STATUS_UNPAY=>'没有支付',
+        self::STATUS_ERROR=>'充值失败',
+    ];
+
+    public function user() {
+        return $this->belongsTo('user', 'userID');
+    }
+
+    public function setMoneyAttr($value) {
+        return $value * 100;
+    }
+
+    public function getMoneyAttr($value) {
+        return Common::price2($value / 100);
+    }
+
+    public function getResultTimeAttr($value)
+    {
+        return Common::timetodate($value, 4);
+    }
+
+    public function getOuterReachTimeAttr($value)
+    {
+        return Common::timetodate($value, 4);
+    }
+
+    public function getTypeNameAttr($value, $data) {
+        return self::TYPES[$data['type']];
+    }
+
+    public function getStatusTextAttr($value, $data) {
+        return self::STATUSS[$data['status']];
+    }
+
+    public function createAlias($id)
+    {
+        return 'RC' . Common::timetodate(THINK_START_TIME, 10) .  sprintf("%08d", $id);
+    }
+
+
+}

+ 55 - 0
application/core/service/Check.php

@@ -0,0 +1,55 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\service;
+
+use app\core\model\Cang as Model;
+use app\core\model\Subject;
+use think\Config;
+use tool\Common;
+
+class Check
+{
+    private $platform;
+    public function __construct($platform)
+    {
+        $this->platform = $platform;
+    }
+
+    //$money金额小数
+    public function checkCardDebit(&$msg, $trueName, $passport, $mobile, $bankNumber, $passportType = 0)
+    {
+        //富友平台
+        if($this->platform == 'fuyou') {
+            //富友平台
+            vendor('fuyou.CheckCard');
+            $check = new \CheckCard();
+            return $check->checkCardDebit($msg, $trueName, $passport, $mobile, $bankNumber, $passportType);
+        }
+        //支付宝平台
+        else if($this->platform == 'alipay'){
+
+        }
+
+        return false;
+    }
+
+    public function notify() {
+        //富友平台
+        if($this->platform == 'fuyou') {
+            //富友平台
+            vendor('fuyou.PayNotify');
+            $payNotify = new \PayNotify();
+            return $payNotify->mobile();
+        }
+        //支付宝平台
+        else if($this->platform == 'alipay'){
+
+        }
+    }
+}

+ 250 - 0
application/core/service/Finance.php

@@ -0,0 +1,250 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\service;
+
+use app\core\model\Cang;
+use app\core\model\CangRepay;
+use app\core\model\Subject;
+use app\core\model\SubjectStat;
+use app\core\model\UserAccount;
+use app\core\model\UserDrawcash;
+use app\core\model\UserHongbao;
+use app\core\model\UserRecharge;
+use app\core\model\User as UserModel;
+use think\Config;
+use think\Db;
+use think\Exception;
+use think\Log;
+use tool\Common;
+
+class Finance
+{
+    private $platform;
+
+    public function __construct()
+    {
+        vendor('fuyou.Gold');
+        $this->platform = new \Gold();
+    }
+
+    //添加新用户
+    public function userAdd(&$msg, \User $user) {
+        vendor('payModel.User');
+        return $this->platform->add($msg, $user);
+    }
+
+    //充值
+    public function userRecharge(&$msg, \Recharge $recharge) {
+        vendor('payModel.Recharge');
+        return $this->platform->recharge($msg, $recharge);
+    }
+
+    //充值回调
+    public function userRecharge_notify(&$msg, $outerNumber, $money, $mobile) {
+        $userRecharge = UserRecharge::get([
+            'outerNumber'=>$outerNumber,
+            'status'=>UserRecharge::STATUS_UNPAY
+        ]);
+        if(!$userRecharge) {
+            $msg = '该记录已失效';
+            return false;
+        }
+
+        if($userRecharge->getData('money') != $money) {
+            $msg = '金额不对';
+            return false;
+        }
+
+        $user = UserModel::get($userRecharge['userID']);
+        if(!$user) {
+            $msg = '该充值用户已经丢失';
+            return false;
+        }
+
+        $userAccount = new UserAccount();
+        //到账时间有点问题
+        $userAccount->MODE_recharge_addMoney($userRecharge, $user, THINK_START_TIME);
+        $msg = '充值成功';
+        return true;
+    }
+
+    //提现
+    public function userDrawcash(&$msg, \Drawcash $drawcash) {
+        vendor('payModel.Drawcash');
+        return $this->platform->drawcash($msg, $drawcash);
+    }
+
+    //提现回调
+    public function userDrawcash_notify(&$msg, $outerNumber, $money, $mobile) {
+        $userDrawcash = UserDrawcash::get([
+            'outerNumber'=>$outerNumber,
+            'status'=>UserDrawcash::STATUS_SUBMIT
+        ]);
+        if(!$userDrawcash) {
+            $msg = '不存在该提现记录';
+            return false;
+        }
+
+        if($userDrawcash->getData('money') != $money) {
+            $msg = '金额不对';
+            return false;
+        }
+
+        $user = UserModel::get($userDrawcash['userID']);
+        if(!$user) {
+            $msg = '该提现用户已经丢失';
+            return false;
+        }
+
+        $userAccount = new UserAccount();
+        //到账时间有点问题
+        $userAccount->MODE_drawcash_decMoney_submit($msg, $userDrawcash, $user, THINK_START_TIME);
+        $msg = '操作成功';
+        return true;
+    }
+
+    //注销用户
+    public function userCancel(&$msg, $mobile, $pageUrl) {
+        return $this->platform->userCancel($msg, $mobile, $pageUrl);
+    }
+
+    //下单
+    public function order(&$msg, \Trade $trade) {
+        vendor('payModel.Trade');
+        return $this->platform->order($msg, $trade);
+    }
+
+    public function order_notify(&$msg, $outerNumber) {
+
+        //第一步,得到cang
+        $cang = Cang::get([
+            'outerNumber'=>$outerNumber,
+            'status'=>UserRecharge::STATUS_UNPAY
+        ]);
+        if($cang) {
+            $msg = '不存在订单';
+            return true;
+        }
+
+        //第二步,得到红包相关
+        $hongbaoMoney = 0;//现金券
+        $hongbaoYear = 0;//加息年化
+        $hongbaoIDS = explode(',', $cang['hongbao']);
+
+        foreach ($hongbaoIDS as $k => $hongbaoID) {
+            $userHongbao = UserHongbao::with(['hongbao'])->where([
+                'userHongbaoID'=>$hongbaoID,
+                'status'=>UserHongbao::STATUS_UNUSED,
+                'userID'=>$cang['userID']
+            ])->find();
+            if(!$userHongbao) {
+                continue;
+            }
+            if($userHongbao->hongbao['typeID'] == 1) {
+                $hongbaoMoney += $userHongbao->hongbao['money'];
+            }
+            else if($userHongbao->hongbao['typeID'] == 2) {
+                $hongbaoYear += $userHongbao->hongbao['year'];
+            }
+        }
+
+        Db::startTrans();
+        try{
+
+            //第三步,更新支付状态
+            $cang['payTime'] = THINK_START_TIME;
+            $cang['status'] = Cang::STATUS_PAY;
+            $cang->save();
+
+
+            //第四步,计算总年化,更新支付状态
+            $year = $cang-['year'] + $cang-['yearExt'] + $cang['yearSystem'];//总的年化
+            $interest = 0;
+            if($cang['interestTimeTypeID'] == 2 || $cang['interestTimeTypeID'] == 3) {
+                $interest = round($cang->subject['moneySubject'] * $year / 100 / 365 * $cang->subject['investDay'], 2);//预付利息
+            }
+
+
+            //第五步,更新回款清单
+            //更新本金回款清单
+            $cangRepaySave = [
+                'money'=>$cang['ben'],
+                'repayTime'=>Common::datetotime($cang->subject['repayTime']),
+                'reachTime'=>Common::datetotime($cang->subject['reachTime']),
+                'userID' => $cang['userID'],
+                'subjectID' => $cang['subjectID'],
+                'cangID'=>$cang['cangID'],
+                'status'=>CangRepay::STATUS_UNREPAY,
+                'repayTypeID'=>1
+            ];
+
+            CangRepay::create($cangRepaySave);
+            //更新利息回款清单
+            $cangRepaySave['repayTypeID'] = 2;
+            $cangRepaySave['money'] = $interest;
+            CangRepay::create($cangRepaySave);
+
+
+            //第六步,更新账户金额及流水
+            $user = User::get($cang['userID']);
+            $user->userAccount = $user->userAccount->MODE_cang_decMoney($cang, $user);
+
+            //第十一步,更新标的统计
+            SubjectStat::where([
+                'subjectID'=>$cang['subjectID']
+            ])->setInc('moneyTotalInvest', $cang['moneySubject'] * 100);
+            SubjectStat::where([
+                'subjectID'=>$this->app['subjectID']
+            ])->setInc('timesInvest');
+
+        }
+        catch (Exception $e) {
+            // 回滚事务
+            Log::error($e->getMessage().'|'.$e->getLine().'|'.$e->getFile());
+            Db::rollback();
+            throw new AppException(-9, $e->getMessage());
+        }
+
+
+        //第十二步,判断是否满标
+        if($cang->subject->subjectStat['moneyTotalInvest'] == $cang->subject['price']) {
+            //如果满标了,设置满标
+            Subject::setSubjectFull($cang->subject);
+        }
+        $msg = '操作成功';
+        return true;
+    }
+
+
+    //放款
+    public function fang(&$msg, \Trade $trade) {
+        vendor('payModel.Trade');
+        return $this->platform->order($msg, $trade);
+    }
+
+    public function fang_notify(&$msg, $outerNumber) {}
+
+
+    //还款
+    public function userRepay(&$msg, \Trade $trade) {
+        vendor('payModel.Trade');
+        return $this->platform->repay($msg, $trade);
+    }
+
+    //查询用户
+    public function queryUser(&$msg, $userList) {
+        return $this->platform->queryUser($msg, $userList);
+    }
+
+
+    //查询余额
+    public function balance(&$msg, $mobile) {
+        return $this->platform->balance($msg, $mobile);
+    }
+}

+ 33 - 0
application/core/service/Master.php

@@ -0,0 +1,33 @@
+<?php
+
+/**
+ * Created by PhpStorm.
+ * 服务提供者
+ * User: qissen
+ * Date: 2017/6/7
+ * Time: 7:36
+ * 注意调用顺序,checkClientType,checkData必须先调用,才可以验证其他
+ */
+
+namespace app\core\service;
+use app\core\model\Master as Model;
+use tool\Common;
+
+class Master
+{
+
+    //发送验证码,手机号
+    public static function getMasterByToken($token) {
+        if(!$token) {
+            return false;
+        }
+        $user = Model::with(['userAccount'])->where([
+            'token'=>$token
+        ])->find();
+        if($user['tokenOverTime'] < THINK_START_TIME) {
+            return false;
+        }
+        return $user;
+    }
+
+}

+ 55 - 0
application/core/service/Pay.php

@@ -0,0 +1,55 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\core\service;
+
+use app\core\model\Cang as Model;
+use app\core\model\Subject;
+use think\Config;
+use tool\Common;
+
+class Pay
+{
+    private $platform;
+    public function __construct()
+    {
+        $this->platform = Config::get('platform.default_pay_gateway');
+    }
+
+    //$money金额小数
+    public function createOrder($money)
+    {
+        //富友平台
+        if($this->platform == 'fuyou') {
+            //富友平台
+            vendor('fuyou.Pay');
+            $pay = new \Pay();
+            return $pay->createOrder($money * 100);
+        }
+        //支付宝平台
+        else if($this->platform == 'alipay'){
+
+        }
+
+        return false;
+    }
+
+    public function notify() {
+        //富友平台
+        if($this->platform == 'fuyou') {
+            //富友平台
+            vendor('fuyou.PayNotify');
+            $payNotify = new \PayNotify();
+            return $payNotify->mobile();
+        }
+        //支付宝平台
+        else if($this->platform == 'alipay'){
+
+        }
+    }
+}

+ 96 - 0
application/core/service/SMS.php

@@ -0,0 +1,96 @@
+<?php
+
+/**
+ * Created by PhpStorm.
+ * 服务提供者
+ * User: qissen
+ * Date: 2017/6/7
+ * Time: 7:36
+ * 注意调用顺序,checkClientType,checkData必须先调用,才可以验证其他
+ */
+
+namespace app\core\service;
+use think\Cache;
+use think\Validate;
+use Yunpian_SMS\SMS as Service;
+use tool\Common;
+
+class SMS
+{
+
+    //发送验证码,手机号
+    public function sendVerificationCode($mobile = '') {
+
+        $validate = new Validate([
+            'mobile'  => 'require|length:11'
+        ],[
+            'name.require' => '手机号码必须填写',
+            'name.length' => '手机号码格式不正确'
+        ]);
+        $result   = $validate->check([
+            'mobile'=>$mobile
+        ]);
+        if(!$result){
+            return Common::rm(-101, $validate->getError());
+        }
+
+        $package = Cache::get('verificationCode'.$mobile);
+        if(!empty($package)) {
+            if ($package['outTime'] > THINK_START_TIME) {
+                return Common::rm(-102, '您发送验证码过快,请等待' . (int)($package['outTime'] - THINK_START_TIME) . '后重新发送');
+            }
+
+            if ($package['times'] > 100) {
+                return Common::rm(-103, '您发送的短信太频繁了,请稍后再次验证');
+            }
+        }
+        else {
+            $package = [
+                'times'=>0
+            ];
+        }
+
+        /*$code = 1849970;*/
+        $code = mt_rand(100000, 999999);
+        $text = '【佳乾财富】您的验证码是'.$code.'。如非本人操作,请忽略本短信';
+        $result = Service::send_sms($mobile, $text);
+        if($result === true) {
+            $package['times']++;
+            $package['outTime'] = THINK_START_TIME + 30;
+            $package['code'] = $code;
+            Cache::set('verificationCode'.$mobile, $package, 600);
+            return Common::rm(1, '操作成功');
+        }
+        return Common::rm(-102, $result);
+    }
+
+    //获取验证码
+    public function checkVerificationCode($mobile = '', $code = '') {
+        $result = Cache::get('verificationCode'.$mobile);
+        if(!$result) {
+            return Common::rm(-101, '验证码已经失效了');
+        }
+        if($result['code'] != $code) {
+            return Common::rm(-102, '验证码失败');
+        }
+        return Common::rm(1, '验证码通过');
+    }
+
+
+    //发送短信
+    public static function sendSMS($mobile, $text) {
+        Service::send_sms($mobile, $text);
+    }
+
+    //还款发送短信
+    public static function message_setCodeRepay($trueName, $title, $linkUrl) {
+        return '【佳乾财富】您好,'.$trueName.',您在投资的'.$title.'所得本息已到账,请打开app注意查收,'.$linkUrl;
+    }
+
+    //还款发送短信
+    public static function message_setJiaxiYuebiao($trueName, $yearExt, $linkUrl) {
+        //	【佳乾财富】亲爱的#truename#,#year#%加息券已到账请打开app查收,新app #linkurl#。新年到来之际,祝您财运旺旺,万事如意!
+        //【佳乾财富】亲爱的#truename#,#year#%已到账,请打开app查收,新app地址 #linkurl#。
+        return '【佳乾财富】亲爱的'.$trueName.','.$yearExt.'%已到账,请打开app查收,新app地址 '.$linkUrl.'。';
+    }
+}

+ 325 - 0
application/core/service/Stat.php

@@ -0,0 +1,325 @@
+<?php
+
+/**
+ * Created by PhpStorm.
+ * 服务提供者
+ * User: qissen
+ * Date: 2017/6/7
+ * Time: 7:36
+ * 注意调用顺序,checkClientType,checkData必须先调用,才可以验证其他
+ */
+
+namespace app\core\service;
+use app\core\model\Cang;
+use app\core\model\User as ModelUser;
+use app\core\model\UserRecharge;
+use think\Cache;
+use think\Db;
+use tool\Common;
+
+class Stat
+{
+
+    public static function getStat() {
+        //Cache::rm('stat');
+        $stat = Cache::get('stat');
+        if(!$stat) {
+            $stat = [];
+            $stat += self::getStatToday();
+            $stat += self::getStatYesterday();
+            $stat += self::getStatAll();
+            $stat += self::getStatWeek();
+            $stat += self::getStatCang30DayList();
+            Cache::set('stat', $stat, 60);
+        }
+        return $stat;
+    }
+
+
+
+    public static function getStatToday()
+    {
+        $stat = [];
+        $stat['moneySubjectTotal_today_ios'] = Db::view('cang', 'moneySubject,userID,status,addTime')
+            ->view('user', 'userID,osType', 'cang.userID=user.userID and user.isForged=0')
+            ->where('user.osType=1')
+            ->where('status', 'EGT', Cang::STATUS_PAY)
+            ->whereTime('addTime', 'today')
+            ->sum('moneySubject');
+        $stat['moneySubjectTotal_today_ios'] = number_format($stat['moneySubjectTotal_today_ios'] / 100);
+
+        $stat['moneySubjectTotal_today_android'] = Db::view('cang', 'moneySubject,userID,status,addTime')
+            ->view('user', 'userID,osType', 'cang.userID=user.userID and user.isForged=0')
+            ->where('user.osType=2')
+            ->where('status', 'EGT', Cang::STATUS_PAY)
+            ->whereTime('addTime', 'today')
+            ->sum('moneySubject');
+        $stat['moneySubjectTotal_today_android'] = number_format($stat['moneySubjectTotal_today_android'] / 100);
+
+        $stat['moneySubjectTotal_today_pc'] = Db::view('cang', 'moneySubject,userID,status,addTime')
+            ->view('user', 'userID,osType', 'cang.userID=user.userID and user.isForged=0')
+            ->where('user.osType=3')
+            ->where('status', 'EGT', Cang::STATUS_PAY)
+            ->whereTime('addTime', 'today')
+            ->sum('moneySubject');
+        $stat['moneySubjectTotal_today_pc'] = number_format($stat['moneySubjectTotal_today_pc'] / 100);
+
+        $stat['moneySubjectTotal_today_wap'] = Db::view('cang', 'moneySubject,userID,status,addTime')
+            ->view('user', 'userID,osType', 'cang.userID=user.userID and user.isForged=0')
+            ->where('user.osType=4')
+            ->where('status', 'EGT', Cang::STATUS_PAY)
+            ->whereTime('addTime', 'today')
+            ->sum('moneySubject');
+        $stat['moneySubjectTotal_today_wap'] = number_format($stat['moneySubjectTotal_today_wap'] / 100);
+
+        $stat['moneySubjectTotal_today'] = Db::view('cang', 'moneySubject,userID,status,addTime')
+            ->view('user', 'userID,osType', 'cang.userID=user.userID and user.isForged=0')
+            ->where('status', 'EGT', Cang::STATUS_PAY)
+            ->whereTime('addTime', 'today')
+            ->sum('moneySubject');
+        $stat['moneySubjectTotal_today'] = number_format($stat['moneySubjectTotal_today'] / 100);
+
+
+        $stat['cangCount_today'] = Db::name('cang')
+            ->where('status', 'EGT', Cang::STATUS_PAY)
+            ->where('isForged', 0)
+            ->whereTime('addTime', 'today')
+            ->count();
+
+
+        $stat['userTotal_today'] = Db::name('user')
+            ->whereTime('addTime', 'today')
+            ->count();
+
+        $stat['userTotal_today_auth'] = Db::name('user')
+            ->whereTime('addTime', 'today')
+            ->where('isAuthBank', 1)
+            ->count();
+
+        return $stat;
+    }
+
+    public static function getStatYesterday() {
+        $stat = [];
+        $stat['moneySubjectTotal_yesterday_ios'] = Db::view('cang', 'moneySubject,userID,status,addTime')
+            ->view('user', 'userID,osType', 'cang.userID=user.userID and user.isForged=0')
+            ->where('user.osType=1')
+            ->where('status','EGT', Cang::STATUS_PAY)
+            ->whereTime('addTime', 'yesterday')
+            ->sum('moneySubject');
+        $stat['moneySubjectTotal_yesterday_ios'] = number_format($stat['moneySubjectTotal_yesterday_ios'] / 100);
+
+        $stat['moneySubjectTotal_yesterday_android'] = Db::view('cang', 'moneySubject,userID,status,addTime')
+            ->view('user', 'userID,osType', 'cang.userID=user.userID and user.isForged=0')
+            ->where('user.osType=2')
+            ->where('status','EGT', Cang::STATUS_PAY)
+            ->whereTime('addTime', 'yesterday')
+            ->sum('moneySubject');
+        $stat['moneySubjectTotal_yesterday_android'] = number_format($stat['moneySubjectTotal_yesterday_android'] / 100);
+
+        $stat['moneySubjectTotal_yesterday_pc'] = Db::view('cang', 'moneySubject,userID,status,addTime')
+            ->view('user', 'userID,osType', 'cang.userID=user.userID and user.isForged=0')
+            ->where('user.osType=3')
+            ->where('status','EGT', Cang::STATUS_PAY)
+            ->whereTime('addTime', 'yesterday')
+            ->sum('moneySubject');
+        $stat['moneySubjectTotal_yesterday_pc'] = number_format($stat['moneySubjectTotal_yesterday_pc'] / 100);
+
+        $stat['moneySubjectTotal_yesterday_wap'] = Db::view('cang', 'moneySubject,userID,status,addTime')
+            ->view('user', 'userID,osType', 'cang.userID=user.userID and user.isForged=0')
+            ->where('user.osType=4')
+            ->where('status','EGT', Cang::STATUS_PAY)
+            ->whereTime('addTime', 'yesterday')
+            ->sum('moneySubject');
+        $stat['moneySubjectTotal_yesterday_wap'] = number_format($stat['moneySubjectTotal_yesterday_wap'] / 100);
+
+        $stat['moneySubjectTotal_yesterday'] = Db::view('cang', 'moneySubject,userID,status,addTime')
+            ->view('user', 'userID,osType', 'cang.userID=user.userID and user.isForged=0')
+            ->where('status','EGT', Cang::STATUS_PAY)
+            ->whereTime('addTime', 'yesterday')
+            ->sum('moneySubject');
+        $stat['moneySubjectTotal_yesterday'] = number_format($stat['moneySubjectTotal_yesterday'] / 100);
+
+
+        $stat['cangCount_yesterday'] = Db::name('cang')
+            ->where('status','EGT', Cang::STATUS_PAY)
+            ->where('isForged',0)
+            ->whereTime('addTime', 'yesterday')
+            ->count();
+
+
+        $stat['userTotal_yesterday'] = Db::name('user')
+            ->whereTime('addTime', 'yesterday')
+            ->count();
+
+        $stat['userTotal_yesterday_auth'] = Db::name('user')
+            ->whereTime('addTime', 'yesterday')
+            ->where('isAuthBank', 1)
+            ->count();
+        return $stat;
+    }
+
+    public static function getStatWeek() {
+        $stat = [];
+        $stat['moneySubjectTotal_week_ios'] = Db::view('cang', 'moneySubject,userID,status,addTime')
+            ->view('user', 'userID,osType', 'cang.userID=user.userID and user.isForged=0')
+            ->where('user.osType=1')
+            ->where('status','EGT', Cang::STATUS_PAY)
+            ->whereTime('addTime', 'week')
+            ->sum('moneySubject');
+        $stat['moneySubjectTotal_week_ios'] = number_format($stat['moneySubjectTotal_week_ios'] / 100);
+
+        $stat['moneySubjectTotal_week_android'] = Db::view('cang', 'moneySubject,userID,status,addTime')
+            ->view('user', 'userID,osType', 'cang.userID=user.userID and user.isForged=0')
+            ->where('user.osType=2')
+            ->where('status','EGT', Cang::STATUS_PAY)
+            ->whereTime('addTime', 'week')
+            ->sum('moneySubject');
+        $stat['moneySubjectTotal_week_android'] = number_format($stat['moneySubjectTotal_week_android'] / 100);
+
+        $stat['moneySubjectTotal_week_pc'] = Db::view('cang', 'moneySubject,userID,status,addTime')
+            ->view('user', 'userID,osType', 'cang.userID=user.userID and user.isForged=0')
+            ->where('user.osType=3')
+            ->where('status','EGT', Cang::STATUS_PAY)
+            ->whereTime('addTime', 'week')
+            ->sum('moneySubject');
+        $stat['moneySubjectTotal_week_pc'] = number_format($stat['moneySubjectTotal_week_pc'] / 100);
+
+        $stat['moneySubjectTotal_week_wap'] = Db::view('cang', 'moneySubject,userID,status,addTime')
+            ->view('user', 'userID,osType', 'cang.userID=user.userID and user.isForged=0')
+            ->where('user.osType=4')
+            ->where('status','EGT', Cang::STATUS_PAY)
+            ->whereTime('addTime', 'week')
+            ->sum('moneySubject');
+        $stat['moneySubjectTotal_week_wap'] = number_format($stat['moneySubjectTotal_week_wap'] / 100);
+
+        $stat['moneySubjectTotal_week'] = Db::view('cang', 'moneySubject,userID,status,addTime')
+            ->view('user', 'userID,osType', 'cang.userID=user.userID and user.isForged=0')
+            ->where('status','EGT', Cang::STATUS_PAY)
+            ->whereTime('addTime', 'week')
+            ->sum('moneySubject');
+        $stat['moneySubjectTotal_week'] = number_format($stat['moneySubjectTotal_week'] / 100);
+
+
+        $stat['cangCount_week'] = Db::name('cang')
+            ->where('status','EGT', Cang::STATUS_PAY)
+            ->where('isForged',0)
+            ->whereTime('addTime', 'week')
+            ->count();
+
+
+        $stat['userTotal_week'] = Db::name('user')
+            ->whereTime('addTime', 'week')
+            ->count();
+
+        $stat['userTotal_week_auth'] = Db::name('user')
+            ->whereTime('addTime', 'week')
+            ->where('isAuthBank', 1)
+            ->count();
+        return $stat;
+    }
+
+    public static function getStatAll() {
+        $stat = [];
+        $stat['moneySubjectTotal_all_ios'] = Db::view('cang', 'moneySubject,userID,status,addTime')
+            ->view('user', 'userID,osType', 'cang.userID=user.userID and user.isForged=0')
+            ->where('user.osType=1')
+            ->where('status','EGT', Cang::STATUS_PAY)
+            ->sum('moneySubject');
+        $stat['moneySubjectTotal_all_ios'] = number_format($stat['moneySubjectTotal_all_ios'] / 100);
+
+        $stat['moneySubjectTotal_all_android'] = Db::view('cang', 'moneySubject,userID,status,addTime')
+            ->view('user', 'userID,osType', 'cang.userID=user.userID and user.isForged=0')
+            ->where('user.osType=2')
+            ->where('status','EGT', Cang::STATUS_PAY)
+            ->sum('moneySubject');
+        $stat['moneySubjectTotal_all_android'] = number_format($stat['moneySubjectTotal_all_android'] / 100);
+
+        $stat['moneySubjectTotal_all_pc'] = Db::view('cang', 'moneySubject,userID,status,addTime')
+            ->view('user', 'userID,osType', 'cang.userID=user.userID and user.isForged=0')
+            ->where('user.osType=3')
+            ->where('status','EGT', Cang::STATUS_PAY)
+            ->sum('moneySubject');
+        $stat['moneySubjectTotal_all_pc'] = number_format($stat['moneySubjectTotal_all_pc'] / 100);
+
+        $stat['moneySubjectTotal_all_wap'] = Db::view('cang', 'moneySubject,userID,status,addTime')
+            ->view('user', 'userID,osType', 'cang.userID=user.userID and user.isForged=0')
+            ->where('user.osType=4')
+            ->where('status','EGT', Cang::STATUS_PAY)
+            ->sum('moneySubject');
+        $stat['moneySubjectTotal_all_wap'] = number_format($stat['moneySubjectTotal_all_wap'] / 100);
+
+        $stat['moneySubjectTotal_all'] = Db::view('cang', 'moneySubject,userID,status,addTime')
+            ->view('user', 'userID,osType', 'cang.userID=user.userID and user.isForged=0')
+            ->where('status','EGT', Cang::STATUS_PAY)
+            ->sum('moneySubject');
+        $stat['moneySubjectTotal_all'] = number_format($stat['moneySubjectTotal_all'] / 100);
+
+        $stat['cunTotal_all'] = Db::view('cang', 'moneySubject,userID,status,addTime')
+            ->view('user', 'userID,osType', 'cang.userID=user.userID and user.isForged=0')
+            ->view('subject', 'BACKUPID', 'subject.subjectID=cang.subjectID')
+            ->where('status','in', [Cang::STATUS_PAY,Cang::STATUS_INTEREST, Cang::STATUS_REPAY])
+            ->where('subject.BACKUPID', 0)
+            ->sum('moneySubject');
+        $stat['cunTotal_all'] = number_format($stat['cunTotal_all'] / 100);
+
+
+        $stat['cangCount_all'] = Db::name('cang')
+            ->where('status','EGT', Cang::STATUS_PAY)
+            ->where('isForged',0)
+            ->count();
+
+
+        $stat['userTotal_all'] = Db::name('user')
+            ->count();
+
+        $stat['userTotal_all_auth'] = Db::name('user')
+            ->where('isAuthBank', 1)
+            ->count();
+        return $stat;
+    }
+
+    public static function getStatCang30DayList() {
+        $list = Db::query("select FROM_UNIXTIME(addTime, '%Y-%m-%d') date, sum(moneySubject) as moneyTotal,count(*) as count from a_cang where isForged=0 and addTime between ".(THINK_START_TIME - 30 * 86400)." and ".THINK_START_TIME." group by date");
+        foreach ($list as $k=>$item) {
+            $list[$k]['moneyTotal'] = (int)($item['moneyTotal'] / 100);
+        }
+        $stat['cang30DayList'] = [
+            'dateList'=>array_column($list, 'date'),
+            'moneyTotalList'=>array_column($list, 'moneyTotal'),
+            'countList'=>array_column($list, 'count')
+        ];
+        return $stat;
+    }
+
+    public static function getStatUserAction() {
+        $listAll = Cache::get('statUserAction');
+        if(!$listAll) {
+            $listAll = [];
+            $list = ModelUser::where([
+                'isForged' => 0
+            ])->field('mobile,trueName')->order('addTime desc')->limit(0, 10)->select();
+            foreach ($list as $k => $item) {
+                array_push($listAll, Common::mobileAsterisk($item['mobile']) . ' 刚刚开通新账号');
+            }
+
+            $list = UserRecharge::with(['user'])->where([
+                'status' => UserRecharge::STATUS_PAY
+            ])->order('addTime desc')->limit(0, 20)->select();
+            foreach ($list as $k => $item) {
+                array_push($listAll, Common::mobileAsterisk($item->user['mobile']) . '完成了一笔' . $item['money'] . '元' . '的充值');
+            }
+
+            $list = Cang::with(['subject', 'user'])->where([
+                'isForged' => 0
+            ])->group('userID')->order('addTime desc')->limit(0, 20)->select();
+            foreach ($list as $k => $item) {
+                array_push($listAll, Common::mobileAsterisk($item->user['mobile']) . '投资了' . $item->subject['title'] . ' ' . $item['moneySubject'] . '元');
+            }
+
+            $listAll = array_values(Common::shuffle_assoc($listAll));
+            Cache::set('statUserAction', $listAll, 60);
+        }
+        return $listAll;
+    }
+}

+ 432 - 0
application/core/service/Tongbu.php

@@ -0,0 +1,432 @@
+<?php
+
+/**
+ * Created by PhpStorm.
+ * 服务提供者
+ * User: qissen
+ * Date: 2017/6/7
+ * Time: 7:36
+ * 注意调用顺序,checkClientType,checkData必须先调用,才可以验证其他
+ */
+
+namespace app\core\service;
+use app\core\model\Bank;
+use app\core\model\Cang;
+use app\core\model\CangRepay;
+use app\core\model\Channel;
+use app\core\model\HongbaoPlan;
+use app\core\model\Subject;
+use app\core\model\User;
+use app\core\model\UserAccount;
+use app\core\model\UserBank;
+use app\core\model\UserDrawcash;
+use app\core\model\UserFinance;
+use app\core\model\UserRecharge;
+use think\Db;
+use think\Log;
+use tool\Common;
+
+class Tongbu
+{
+    private $db_config_from = [
+        // 数据库类型
+        'type'        => 'mysql',
+        // 服务器地址
+        'hostname'    => 'rm-bp1m6abztwo27gum6.mysql.rds.aliyuncs.com',
+        // 数据库名
+        'database'    => 'goldapi',
+        // 数据库用户名
+        'username'    => 'sqlyog',
+        // 数据库密码
+        'password'    => 'Qissen111111',
+        // 数据库编码默认采用utf8
+        'charset'     => 'utf8',
+        // 数据库表前缀
+        'prefix'      => 's_',
+    ];
+
+
+    public function DY_user($mobile) {
+        $isTongbu = false;
+        $from_list = Db::connect($this->db_config_from)->query('select * from s_user where card_no_auth=1  and username=\''.$mobile.'\'');
+        foreach ($from_list as $k=>$item) {
+            if($item['tongbu'] == 1) {
+                return false;
+            }
+            $isTongbu = true;
+            /*if($password) {
+                if($item['password'] != md5($password)) {
+                    return -2;
+                }
+            }*/
+            Log::info('执行了一次同步');
+            $hasTongbu = true;
+            //用户
+            $user = User::get([
+                'mobile'=>$item['username']
+            ]);
+            if(!$user) {
+                $user = new User();
+            }
+            $user['BACKUPID'] = $item['id'];//BACKUPID
+            $user['password'] = (new User())->createPassword(THINK_START_TIME);//重新设置新密码
+            $user['mobile'] = $item['username'];//手机号
+            $user['trueName'] = $item['real_name'];//真实姓名
+            $user['isAuthTrueName'] = $item['card_no_auth'];//实名认证
+            $user['isAuthBank'] = $item['card_no_auth'];//实名认证
+            $user['passport'] = $item['card_no'];//身份证
+            $user['email'] = $item['email'];//银行卡认证
+            $user['osType'] = $item['device_type'];//银行卡认证
+            $user['isNewInvest'] = 0;
+            if($item['device_type'] == 4) {
+                $user['osType'] = 3;
+            }
+            if($item['device_type'] == 3) {
+                $user['osType'] = 4;
+            }
+            if($item['level'] == 1) {
+                $user['isNewInvest'] = 1;
+            }
+            $channel = Channel::get([
+                'code'=>$item['channel']
+            ]);
+            if($channel) {
+                $user['channelID'] = $channel['channelID'];//渠道名称
+                if($item['channel_web_id'] == 40) {
+                    $user['channelID'] = 59;
+                }
+            }
+            else {
+                $item['channelID'] = 0;
+            }
+            if($item['add_time']) {
+                $user['addTime'] = Common::datetotime($item['add_time']);//添加时间
+            }
+            else {
+                $user['addTime'] = 0;//添加时间
+            }
+            $user->save();
+            (new HongbaoPlan())->sendUserOnRegister($user);
+
+            //账户
+            $from_account = Db::connect($this->db_config_from)->query('select * from s_user_account where user_id='.$item['id']);
+
+            $account = UserAccount::get([
+                'userID'=>$user['userID']
+            ]);
+            if(!$account) {
+                $account = new UserAccount();
+            }
+
+
+            if(isset($from_account[0])) {
+                $account['BACKUPID'] = $from_account[0]['id'];
+                $account['userID'] = $user['userID'];
+                $account['money'] = $from_account[0]['account_able'];
+                $account['moneyAcc'] = $from_account[0]['total_invest_interest'];
+                $account['moneyFrozen'] = $from_account[0]['account_freeze'];
+                $account['waitBen'] = $from_account[0]['wait_capital'];
+                $account['waitInterest'] = $from_account[0]['wait_interest'];
+
+
+                $account['hasInvestBenTotal'] = 0;
+                $account['hasInvestMoneyTotal'] = 0;
+                $account['hasRepayBenTotal'] = $from_account[0]['total_invest_capital'];
+                $account['hasRepayInterestTotal'] = $from_account[0]['total_invest_interest'];
+                $account->save();
+            }
+            else {
+                $account['userID'] = $from_account[0]['user_id'];
+                $account->save();
+            }
+
+
+            //新增银行卡
+            $from_bank = Db::connect($this->db_config_from)->query('select * from s_user_bank where user_id='.$item['id']);
+            foreach ($from_bank as $_k=>$_item) {
+                $bank = Bank::where([
+                    'bankAccountCode'=>$_item['bank_code']
+                ])->find();
+
+                //用户银行卡
+                $userBank = UserBank::get([
+                    'BACKUPID'=>$_item['id']
+                ]);
+                if(!$userBank) {
+                    $userBank = new UserBank();
+                }
+                $userBank['BACKUPID'] = $_item['id'];//BACKUPID
+                $userBank['userID'] = $user['userID'];//手机号
+                $userBank['bankNameFull'] = $_item['bank_name'];//
+                $userBank['bankID'] = isset($bank['bankID']) ? $bank['bankID'] : 1;//实名认证
+                $userBank['bankAccount'] = $_item['acct_name'];
+                $userBank['bankNumber'] = $_item['bank_card_no'];
+                $userBank['trueName'] = $_item['acct_name'];
+                $userBank['mobile'] = $_item['mobile'];
+                $userBank['addTime'] = Common::datetotime($_item['add_time']);
+                $userBank['status'] = 1;
+                $userBank['isDefault'] = 1;
+                $userBank->save();
+            }
+
+            //新增交易
+            $from_cangList = Db::connect($this->db_config_from)->query('select * from s_user_due_detail where user_id='.$item['id']);
+            foreach ($from_cangList as $_k=>$_item) {
+
+                $subject = Subject::get([
+                    'BACKUPID'=>$_item['project_id']
+                ]);
+
+                $user = User::get([
+                    'BACKUPID'=>$_item['user_id']
+                ]);
+                $status = 0;
+                if($_item['status'] == 1) {
+                    $status = Cang::STATUS_INTEREST;
+                }
+                else if($_item['status'] == 2) {
+                    $status = Cang::STATUS_FINISH;
+                }
+                else if($_item['type'] == 3) {
+                    $status = Cang::STATUS_REPAY;
+                }
+
+                //$from_recharge = Db::connect($this->db_config_from)->query('select * from s_recharge_log where recharge_no=\''.$_item['recharge_no'].'\''.' and user_id='.$_item['user_id'].' and project_id='.$_item['project_id']);
+                //if(!$from_recharge) {
+                //    continue;
+                //}
+                //$from_recharge = $from_recharge[0];
+
+                $cang = Cang::get([
+                    'BACKUPID'=>$_item['id']
+                ]);
+
+                if(!$cang) {
+                    $cang = new Cang();
+                }
+
+                $cang['BACKUPID'] = $_item['id'];
+                $cang['subjectID'] = isset($subject['subjectID']) ? $subject['subjectID'] : 0;
+                $cang['userID'] = $user['userID'];
+                $cang['moneySubject'] = $_item['due_capital'];
+                $cang['status'] = $status;
+                $cang['addTime'] = Common::datetotime($_item['add_time']);
+                $cang['payTime'] = Common::datetotime($_item['add_time']);
+                $cang['updateTime'] = Common::datetotime($_item['add_time']);
+                $cang['interestBeginTime'] = Common::datetotime($_item['start_time']);
+                $cang['interestEndTime'] = Common::datetotime($_item['due_time']);
+                $cang['repayTime'] = Common::datetotime($_item['due_time']);
+                $cang['year'] = $subject['year'];
+                $cang['ben'] = $_item['due_capital'];
+                $cang['yearSystem'] = $subject['yearSystem'];
+                $cang['interest'] = $_item['due_interest'];
+                $cang['investDay'] = $_item['duration_day'];
+                $cang['interestTimeTypeID'] = isset($subject['interestTimeTypeID']) ? $subject['interestTimeTypeID']: 0;
+                if($_item['ghost_phone']) {
+                    $cang['isForged'] = 1;
+                    $cang['userID'] = 4;
+                }
+                $cang['osType'] = $_item['device_type'];
+                if($_item['device_type'] == 3) {
+                    $cang['osType'] = 4;
+                }
+                else if($_item['device_type'] == 4) {
+                    $cang['osType'] = 3;
+                }
+                $cang['money'] = $_item['due_capital'];
+                $cang->save();
+
+                CangRepay::where([
+                    'cangID'=>$cang['cangID']
+                ])->delete();
+
+
+
+                //生成本
+                $cangRepay = new CangRepay();
+                $cangRepay['money'] = $_item['due_capital'];
+                $cangRepay['repayTime'] = Common::datetotime($_item['due_time']);
+                $cangRepay['reachTime'] = Common::datetotime($_item['due_time']) + 86400;
+                $cangRepay['cangID'] = $cang['cangID'];
+                $cangRepay['subjectID'] = $subject['subjectID'];
+                $cangRepay['userID'] = $user['userID'];
+                $cangRepay['status'] = CangRepay::STATUS_UNREPAY;
+                if($_item['status'] == 2) {
+                    $cangRepay['status'] = CangRepay::STATUS_REPAY;
+                }
+                $cangRepay['repayTypeID'] = 1;
+                $cangRepay->save();
+
+
+                //生成息
+                $cangRepay = new CangRepay();
+                $cangRepay['money'] = $_item['due_interest'];
+                $cangRepay['repayTime'] = Common::datetotime($_item['due_time']);
+                $cangRepay['reachTime'] = Common::datetotime($_item['due_time']) + 86400;
+                $cangRepay['cangID'] = $cang['cangID'];
+                $cangRepay['subjectID'] = $subject['subjectID'];
+                $cangRepay['userID'] = $user['userID'];
+                $cangRepay['status'] = CangRepay::STATUS_UNREPAY;
+                if($_item['status'] == 2) {
+                    $cangRepay['status'] = CangRepay::STATUS_REPAY;
+                }
+                $cangRepay['repayTypeID'] = 2;
+                $cangRepay->save();
+
+
+
+            }
+
+
+            //生成充值记录
+            $from_list = Db::connect($this->db_config_from)->query('select * from s_user_wallet_records where recharge_no<>\'\' and value > 0 and type=1 and status<>3 and user_id='.$item['id']);
+            foreach ($from_list as $__k=>$__item) {
+
+                //用户
+                $user = User::get([
+                    'BACKUPID'=>$__item['user_id']
+                ]);
+                if(!$user || $__item['user_id'] == 0) {
+                    continue;
+                }
+
+                //银行
+                $userBank = UserBank::get([
+                    'BACKUPID'=>$__item['user_bank_id']
+                ]);
+                if(!$userBank) {
+                    continue;
+                }
+
+                //余额
+                $userRecharge = UserRecharge::get([
+                    'BACKUPID'=>$__item['id']
+                ]);
+                if(!$userRecharge) {
+                    $userRecharge = new UserRecharge();
+                }
+                $status = 0;
+                if($__item['status'] == 1) {
+                    $status = UserRecharge::STATUS_PAY;
+                }
+                else if($__item['status'] == 2) {
+                    $status = UserRecharge::STATUS_UNPAY;
+                }
+                else if($__item['status'] == 3) {
+                    $status = UserRecharge::STATUS_ERROR;
+                }
+                $userRecharge['BACKUPID'] = $__item['id'];
+                $userRecharge['userID'] = $user['userID'];
+                $userRecharge['money'] = $__item['value'];
+                $userRecharge['status'] = $status;
+                $userRecharge['outerNumber'] = $__item['recharge_no'].'-'.$__item['trade_no'];
+                $userRecharge['type'] = 'TYPE_BANK';
+                $userRecharge['bankID'] = $userBank['bankID'];
+                $userRecharge['bankAccount'] = $userBank['bankAccount'];
+                $userRecharge['bankNumber'] = $userBank['bankNumber'];
+                $userRecharge['bankName'] = $userBank['bankNameFull'];
+                $userRecharge['addTime'] = Common::datetotime($__item['add_time']);
+                $userRecharge['trueName'] = $userBank['trueName'];
+                $userRecharge['mobile'] = $userBank['mobile'];
+                $userRecharge['userBankID'] = $userBank['userBankID'];
+                $userRecharge->save();
+
+                UserFinance::create([
+                    'mode'=>UserFinance::MODE_RECHARGE,
+                    'modeID'=>$userRecharge['userRechargeID'],
+                    'money'=>$__item['value'],
+                    'addTime'=>Common::datetotime($__item['add_time']),
+                    'userID'=>$user['userID'],
+                    'status'=>UserFinance::STATUS_OK,
+                    'updateTime'=>Common::datetotime($__item['add_time'])
+                ]);
+            }
+
+
+
+            //生成提现记录
+            $from_list = Db::connect($this->db_config_from)->query('select * from s_user_wallet_records where recharge_no<>\'\' and value < 0 and type=2 and status<>3 and user_id='.$item['id']);
+            foreach ($from_list as $__k=>$__item) {
+
+                //用户
+                $user = User::get([
+                    'BACKUPID'=>$__item['user_id']
+                ]);
+                if(!$user || $__item['user_id'] == 0) {
+                    continue;
+                }
+
+                //银行
+                $userBank = UserBank::get([
+                    'BACKUPID'=>$__item['user_bank_id']
+                ]);
+                if(!$userBank) {
+                    continue;
+                }
+
+                //余额
+                $userDrawcash = UserDrawcash::get([
+                    'BACKUPID'=>$__item['id']
+                ]);
+                if(!$userDrawcash) {
+                    $userDrawcash = new UserDrawcash();
+                }
+                $status = 0;
+                if($__item['status'] == 1) {
+                    $status = UserDrawcash::STATUS_OK;
+                }
+                else if($__item['status'] == 2) {
+                    $status = UserDrawcash::STATUS_ING;
+                }
+                else if($item['status'] == 3) {
+                    $status = UserDrawcash::STATUS_ERROR;
+                }
+                $userDrawcash['BACKUPID'] = $__item['id'];
+                $userDrawcash['userID'] = $user['userID'];
+                $userDrawcash['money'] = $__item['value'];
+                $userDrawcash['status'] = $status;
+                $userDrawcash['outerNumber'] = $__item['recharge_no'].'-'.$__item['trade_no'];
+                $userDrawcash['type'] = 'TYPE_BANK';
+                $userDrawcash['bankID'] = $userBank['bankID'];
+                $userDrawcash['bankAccount'] = $userBank['bankAccount'];
+                $userDrawcash['bankNumber'] = $userBank['bankNumber'];
+                $userDrawcash['bankName'] = $userBank['bankNameFull'];
+                $userDrawcash['applyTime'] = Common::datetotime($__item['add_time']);
+                $userDrawcash['trueName'] = $userBank['trueName'];
+                $userDrawcash['mobile'] = $userBank['mobile'];
+                $userDrawcash['userBankID'] = $userBank['userBankID'];
+                $userDrawcash->save();
+
+                UserFinance::create([
+                    'mode'=>UserFinance::MODE_DRAWCASH,
+                    'modeID'=>$userDrawcash['userDrawcashID'],
+                    'money'=>$__item['value'],
+                    'addTime'=>Common::datetotime($__item['add_time']),
+                    'userID'=>$user['userID'],
+                    'status'=>UserFinance::STATUS_OK,
+                    'updateTime'=>Common::datetotime($__item['add_time'])
+                ]);
+            }
+
+            Db::connect($this->db_config_from)->execute('UPDATE s_user SET tongbu=1 WHERE username=\''.$mobile.'\'');
+        }
+
+        return $isTongbu;
+    }
+
+    public function DY_password($mobile, $password = '') {
+        $from_list = Db::connect($this->db_config_from)->query('select * from s_user where card_no_auth=1  and username=\''.$mobile.'\'');
+        foreach ($from_list as $k=>$item) {
+            if($item['tongbu_password'] == 1) {
+                return false;
+            }
+            if ($item['password'] == md5($password)) {
+                //tongbu_password
+                Db::connect($this->db_config_from)->execute('UPDATE s_user SET tongbu_password=1 WHERE username=\''.$mobile.'\'');
+                return true;
+            }
+        }
+        return false;
+    }
+
+}

+ 62 - 0
application/core/service/User.php

@@ -0,0 +1,62 @@
+<?php
+
+/**
+ * Created by PhpStorm.
+ * 服务提供者
+ * User: qissen
+ * Date: 2017/6/7
+ * Time: 7:36
+ * 注意调用顺序,checkClientType,checkData必须先调用,才可以验证其他
+ */
+
+namespace app\core\service;
+use app\core\model\User as Model;
+use think\Cache;
+use tool\Common;
+
+class User
+{
+
+    //发送验证码,手机号
+    public static function getUserByToken($token, $osType) {
+        if(!$token) {
+            return false;
+        }
+
+        $user = false;
+        if($osType == 1 || $osType == 2) {
+            $user = Model::with(['userAccount'])->where([
+                'token'=>$token
+            ])->find();
+            if($user['tokenOverTime'] < THINK_START_TIME) {
+                return false;
+            }
+        }
+        else if($osType == 3){
+            $user = Model::with(['userAccount'])->where([
+                'tokenPc'=>$token
+            ])->find();
+            if($user['tokenOverTimePc'] < THINK_START_TIME) {
+                return false;
+            }
+        }
+        else if($osType == 4){
+            $user = Model::with(['userAccount'])->where([
+                'tokenWap'=>$token
+            ])->find();
+            if($user['tokenOverTimeWap'] < THINK_START_TIME) {
+                return false;
+            }
+        }
+
+        return $user;
+    }
+
+
+    public static function introduceUser($fromUser, $toUser) {
+        //引导奖励
+        
+
+    }
+
+}

+ 12 - 0
application/crontab.sh

@@ -0,0 +1,12 @@
+#!/bin/bash
+  
+step=5 #间隔的秒数,不能大于60
+
+for (( i = 0; i < 60; i=(i+step) )); do
+    $(php '/home/wwwroot/wxapp.dahengdian.com/think' Cang)
+    $(php '/home/wwwroot/wxapp.dahengdian.com/think' Send)
+    $(php '/home/wwwroot/wxapp.dahengdian.com/think' Subject)
+    sleep $step
+done
+
+exit 0

+ 88 - 0
application/crontab/command/Cang.php

@@ -0,0 +1,88 @@
+<?php
+/**
+ * 持仓到期自动结算
+ * User: qissen
+ * Date: 2017/11/26
+ * Time: 11:26a
+ */
+namespace app\crontab\command;
+
+use app\core\model\Cang as Model;
+use app\core\model\CangRepay;
+use think\console\Command;
+use think\console\Input;
+use think\console\Output;
+use think\Log;
+use tool\Common;
+
+class Cang extends Command
+{
+    protected function configure()
+    {
+        $this->setName('Cang')->setDescription('Cang开始');
+    }
+
+    protected function execute(Input $input, Output $output)
+    {
+        //在这里我们进行结算
+        Log::info('Cang:'.Common::timetodate(THINK_START_TIME));
+
+
+        $this->setStatusInterest();
+
+        $this->setStatusRepayIng();
+
+
+        $output->writeln("Cang开始");
+    }
+
+
+
+
+    /**
+     * 设置持仓状态:持有状态->计息状态
+     */
+    private function setStatusInterest() {
+        Model::where([
+            'interestBeginTime'=>['lt', THINK_START_TIME],
+            'status'=>Model::STATUS_PAY
+        ])->chunk(100, function($list) {
+            foreach ($list as $item) {
+                $item->status = Model::STATUS_INTEREST;
+                $item->save();
+            }
+        });
+    }
+
+
+    /**
+     * 设置持仓状态:计息状态->回款中
+     */
+    private function setStatusRepayIng() {
+
+        //兼容老佳乾,老佳乾客户全部转移后,可注释
+        Model::where([
+            'interestEndTime'=>['lt', THINK_START_TIME],
+            'alias'=>'',
+            'status'=>Model::STATUS_INTEREST
+        ])->chunk(100, function($list) {
+            foreach ($list as $item) {
+                $item->status = Model::STATUS_REPAY;
+                $item->save();
+            }
+        });
+        //end
+
+        Model::where([
+            'interestEndTime'=>['lt', THINK_START_TIME - 86400],
+            'alias'=>['neq', ''],
+            'status'=>Model::STATUS_INTEREST
+        ])->chunk(100, function($list) {
+            foreach ($list as $item) {
+                $item->status = Model::STATUS_REPAY;
+                $item->save();
+            }
+        });
+
+    }
+}

+ 677 - 0
application/crontab/command/Notify.php

@@ -0,0 +1,677 @@
+<?php
+/**
+ * 发送
+ * User: qissen
+ * Date: 2017/11/26
+ * Time: 11:26a
+ */
+namespace app\crontab\command;
+
+use app\core\model\Bank;
+use app\core\model\CangRepay;
+use app\core\model\Channel;
+use app\core\model\Hongbao;
+use app\core\model\Loan;
+use app\core\model\Subject;
+use app\core\model\SubjectStat;
+use app\core\model\User;
+use app\core\model\Cang as CangModel;
+use app\core\model\UserAccount;
+use app\core\model\UserBank;
+use app\core\model\UserDrawcash;
+use app\core\model\UserHongbao;
+use app\core\model\UserRecharge;
+use think\console\Command;
+use think\console\Input;
+use think\console\Output;
+use think\Db;
+use think\Log;
+use tool\Common;
+
+class Notify extends Command
+{
+    private $db_config_from = [
+        // 数据库类型
+        'type'        => 'mysql',
+        // 服务器地址
+        'hostname'    => 'rm-bp1m6abztwo27gum6.mysql.rds.aliyuncs.com',
+        // 数据库名
+        'database'    => 'goldapi',
+        // 数据库用户名
+        'username'    => 'sqlyog',
+        // 数据库密码
+        'password'    => 'Qissen111111',
+        // 数据库编码默认采用utf8
+        'charset'     => 'utf8',
+        // 数据库表前缀
+        'prefix'      => 's_',
+    ];
+
+    private $db_config_to = [
+        // 数据库类型
+        'type'        => 'mysql',
+        // 服务器地址
+        'hostname'    => 'rm-bp1cy713yknm2326x.mysql.rds.aliyuncs.com',
+        // 数据库名
+        'database'    => 'p2p',
+        // 数据库用户名
+        'username'    => 'sqlyog',
+        // 数据库密码
+        'password'    => 'Qissen111111',
+        // 数据库编码默认采用utf8
+        'charset'     => 'utf8',
+        // 数据库表前缀
+        'prefix'      => 'a_',
+    ];
+
+    protected function configure()
+    {
+        $this->setName('Notify')->setDescription('Notify开始');
+    }
+
+    protected function execute(Input $input, Output $output)
+    {
+
+        Log::info('Notify:'.Common::timetodate(THINK_START_TIME));
+        //执行顺序不能变
+        $this->DY_subject();
+        //$this->DY_user();
+        //$this->DY_bank();
+        //$this->DY_recharge();
+        //$this->DY_drawcash();
+        //$this->DY_hongbao();
+        //$this->loan();
+        //$this->user();
+
+
+        $output->writeln("Notify结束");
+    }
+
+    private function DY_channel() {
+        //Log::info(Db::connect($this->db_config_from)->query('select * from s_constant'));
+        $from_channelList = Db::connect($this->db_config_from)->query('select * from s_constant where parent_id=9');
+
+        $to_data = [];
+
+        foreach ($from_channelList as $k=>$item) {
+            $to_data[$k]['name'] = $item['cons_key'];
+            $to_data[$k]['code'] = $item['cons_value'];
+            $to_data[$k]['addTime'] = Common::datetotime($item['add_time']);
+            $to_data[$k]['type'] = 1;
+        }
+
+        (new Channel())->insertAll($to_data);
+
+        //Db::connect($this->db_config_to);
+    }
+
+    private function DY_hongbao() {
+        $perCount = 100;
+        for($i = 0; $i < 5000; $i++) {
+
+            $from_list = Db::connect($this->db_config_from)->query('select id,user_id,title,min_due,min_invest,amount,create_time,expire_time,status from s_user_redenvelope '.' LIMIT '.($i * $perCount).','.$perCount);
+            foreach ($from_list as $k => $item) {
+                $user = User::get([
+                    'BACKUPID' => $item['user_id']
+                ]);
+                if(!$user) {
+                    continue;
+                }
+                $hongbao = Hongbao::get([
+                    'title' => $item['title'],
+                    'minDay' => $item['min_due'],
+                    'minMoney' => $item['min_invest'] * 100,
+                    'money' => $item['amount'] * 100
+                ]);
+                if(!$hongbao) {
+                    continue;
+                }
+                //用户
+                $userHongbao = UserHongbao::get([
+                    'BACKUPID' => $item['id']
+                ]);
+                if (!$userHongbao) {
+                    $userHongbao = new UserHongbao();
+                }
+                $status = 0;
+                if ($item['status'] == 0) {
+                    $status = UserHongbao::STATUS_UNUSED;
+                } else if ($item['status'] == 1) {
+                    $status = UserHongbao::STATUS_USED;
+                } else if ($item['status'] == 2) {
+                    $status = UserHongbao::STATUS_OUTTIME;
+                }
+                $userHongbao['BACKUPID'] = $item['id'];
+                $userHongbao['hongbaoID'] = $hongbao['hongbaoID'];
+                $userHongbao['userID'] = $user['userID'];
+                $userHongbao['getType'] = 1;
+                $userHongbao['status'] = $status;
+                $userHongbao['hongbaoPlanID'] = 5;
+                $userHongbao['addTime'] = Common::datetotime($item['create_time']);
+                $userHongbao['beginTime'] = Common::datetotime($item['create_time']);
+                $userHongbao['endTime'] = Common::datetotime($item['expire_time']);
+                $userHongbao->save();
+            }
+        }
+    }
+
+    private function DY_user() {
+        $perCount = 100;
+        for($i = 0; $i < 300; $i++) {
+            $from_list = Db::connect($this->db_config_from)->query('select * from s_user where card_no_auth=1 LIMIT '.($i * $perCount).','.$perCount);
+            foreach ($from_list as $k=>$item) {
+
+                //用户
+                $user = User::get([
+                    'mobile'=>$item['username']
+                ]);
+                if(!$user) {
+                    $user = new User();
+                }
+                $user['BACKUPID'] = $item['id'];//BACKUPID
+                $user['mobile'] = $item['username'];//手机号
+                $user['trueName'] = $item['real_name'];//真实姓名
+                $user['isAuthTrueName'] = $item['card_no_auth'];//实名认证
+                $user['isAuthBank'] = $item['card_no_auth'];//实名认证
+                $user['passport'] = $item['card_no'];//身份证
+                $user['email'] = $item['email'];//银行卡认证
+                if($item['level'] == 2) {
+                    $user['isNewInvest'] = 1;
+                }
+                $channel = Channel::get([
+                    'code'=>$item['channel']
+                ]);
+                if($channel) {
+                    $user['channelID'] = $channel['channelID'];//渠道名称
+                    if($item['channel_web_id'] == 40) {
+                        $user['channelID'] = 59;
+                    }
+                }
+                else {
+                    $item['channel_web_id'] = 0;
+                }
+                if($item['add_time']) {
+                    $user['addTime'] = Common::datetotime($item['add_time']);//添加时间
+                }
+                else {
+                    $user['addTime'] = 0;//添加时间
+                }
+                $user->save();
+
+                //账户
+                $from_account = Db::connect($this->db_config_from)->query('select * from s_user_account where user_id='.$item['id']);
+
+                $account = UserAccount::get([
+                    'userID'=>$user['userID']
+                ]);
+                if(!$account) {
+                    $account = new UserAccount();
+                }
+
+
+                if(isset($from_account[0])) {
+                    $account['BACKUPID'] = $from_account[0]['id'];
+                    $account['userID'] = $user['userID'];
+                    $account['money'] = $from_account[0]['account_able'];
+                    $account['moneyAcc'] = $from_account[0]['total_invest_interest'];
+                    $account['moneyFrozen'] = $from_account[0]['account_freeze'];
+                    //$to_data['moneyYesterday'] = $account[''];
+                    //$to_data['moneyToday'] = $account[''];
+                    $account['waitBen'] = $from_account[0]['wait_capital'];
+                    $account['waitInterest'] = $from_account[0]['wait_interest'];
+
+
+                    $account['hasInvestBenTotal'] = 0;
+                    $account['hasInvestMoneyTotal'] = 0;
+                    $account['hasRepayBenTotal'] = $from_account[0]['total_invest_capital'];
+                    $account['hasRepayInterestTotal'] = $from_account[0]['total_invest_interest'];
+                    $account->save();
+                }
+                else {
+                    $account['userID'] = $from_account[0]['user_id'];
+                    $account->save();
+                }
+
+
+                //新增银行卡
+
+
+            }
+        }
+    }
+
+    private function DY_bank() {
+        $from_list = Db::connect($this->db_config_from)->query('select * from s_user_bank');
+        foreach ($from_list as $k=>$item) {
+
+            //用户
+            $user = User::get([
+                'BACKUPID'=>$item['user_id']
+            ]);
+            if(!$user) {
+                continue;
+            }
+
+            //银行
+            $bank = Bank::get([
+                'bankAccountCode'=>$item['bank_code']
+            ]);
+
+            //用户银行卡
+            $userBank = UserBank::get([
+                'BACKUPID'=>$item['id']
+            ]);
+
+            if(!$userBank) {
+                $userBank = new UserBank();
+            }
+            $userBank['BACKUPID'] = $item['id'];//BACKUPID
+            $userBank['userID'] = $user['userID'];//手机号
+            $userBank['bankNameFull'] = $item['bank_name'];//
+            $userBank['bankID'] = isset($bank['bankID']) ? $bank['bankID'] : 0;//实名认证
+            $userBank['bankNameFull'] = $item['bank_name'];
+            $userBank['bankAccount'] = $item['acct_name'];
+            $userBank['bankNumber'] = $item['bank_card_no'];
+            $userBank['trueName'] = $item['acct_name'];
+            $userBank['mobile'] = $item['mobile'];
+            $userBank['addTime'] = Common::datetotime($item['add_time']);
+            $userBank['status'] = 1;
+            $userBank['isDefault'] = 1;
+            $userBank->save();
+        }
+    }
+
+    private function DY_recharge() {
+        $from_list = Db::connect($this->db_config_from)->query('select * from s_user_wallet_records where recharge_no<>\'\' and value > 0 and type=1');
+
+        foreach ($from_list as $k=>$item) {
+
+            //用户
+            $user = User::get([
+                'BACKUPID'=>$item['user_id']
+            ]);
+            if(!$user || $item['user_id'] == 0) {
+                continue;
+            }
+
+            //银行
+            $userBank = UserBank::get([
+                'BACKUPID'=>$item['user_bank_id']
+            ]);
+            if(!$userBank) {
+                continue;
+            }
+
+            //余额
+            $userRecharge = UserRecharge::get([
+                'BACKUPID'=>$item['id']
+            ]);
+            if(!$userRecharge) {
+                $userRecharge = new UserRecharge();
+            }
+            $status = 0;
+            if($item['status'] == 1) {
+                $status = UserRecharge::STATUS_PAY;
+            }
+            else if($item['status'] == 2) {
+                $status = UserRecharge::STATUS_UNPAY;
+            }
+            else if($item['status'] == 3) {
+                $status = UserRecharge::STATUS_ERROR;
+            }
+            $userRecharge['BACKUPID'] = $item['id'];
+            $userRecharge['userID'] = $user['userID'];
+            $userRecharge['money'] = $item['value'];
+            $userRecharge['status'] = $status;
+            $userRecharge['outerNumber'] = $item['recharge_no'].'-'.$item['trade_no'];
+            $userRecharge['type'] = 'TYPE_BANK';
+            $userRecharge['bankID'] = $userBank['bankID'];
+            $userRecharge['bankAccount'] = $userBank['bankAccount'];
+            $userRecharge['bankNumber'] = $userBank['bankNumber'];
+            $userRecharge['bankName'] = $userBank['bankNameFull'];
+            $userRecharge['addTime'] = Common::datetotime($item['add_time']);
+            $userRecharge['trueName'] = $userBank['trueName'];
+            $userRecharge['mobile'] = $userBank['mobile'];
+            $userRecharge['userBankID'] = $userBank['userBankID'];
+            $userRecharge->save();
+        }
+    }
+
+    private function DY_drawcash() {
+        $from_list = Db::connect($this->db_config_from)->query('select * from s_user_wallet_records where recharge_no<>\'\' and value < 0 and type=2');
+        foreach ($from_list as $k=>$item) {
+
+            //用户
+            $user = User::get([
+                'BACKUPID'=>$item['user_id']
+            ]);
+            if(!$user || $item['user_id'] == 0) {
+                continue;
+            }
+
+            //银行
+            $userBank = UserBank::get([
+                'BACKUPID'=>$item['user_bank_id']
+            ]);
+            if(!$userBank) {
+                continue;
+            }
+
+            //余额
+            $userDrawcash = UserDrawcash::get([
+                'BACKUPID'=>$item['id']
+            ]);
+            if(!$userDrawcash) {
+                $userDrawcash = new UserDrawcash();
+            }
+            $status = 0;
+            if($item['status'] == 1) {
+                $status = UserDrawcash::STATUS_OK;
+            }
+            else if($item['status'] == 2) {
+                $status = UserDrawcash::STATUS_ING;
+            }
+            else if($item['status'] == 3) {
+                $status = UserDrawcash::STATUS_ERROR;
+            }
+            $userDrawcash['BACKUPID'] = $item['id'];
+            $userDrawcash['userID'] = $user['userID'];
+            $userDrawcash['money'] = $item['value'];
+            $userDrawcash['status'] = $status;
+            $userDrawcash['outerNumber'] = $item['recharge_no'].'-'.$item['trade_no'];
+            $userDrawcash['type'] = 'TYPE_BANK';
+            $userDrawcash['bankID'] = $userBank['bankID'];
+            $userDrawcash['bankAccount'] = $userBank['bankAccount'];
+            $userDrawcash['bankNumber'] = $userBank['bankNumber'];
+            $userDrawcash['bankName'] = $userBank['bankNameFull'];
+            $userDrawcash['applyTime'] = Common::datetotime($item['add_time']);
+            $userDrawcash['trueName'] = $userBank['trueName'];
+            $userDrawcash['mobile'] = $userBank['mobile'];
+            $userDrawcash['userBankID'] = $userBank['userBankID'];
+            $userDrawcash->save();
+        }
+    }
+
+    private function DY_recharge1() {
+        $from_list = Db::connect($this->db_config_from)->query('select * from s_recharge_log');
+        foreach ($from_list as $k=>$item) {
+
+            //用户
+            $user = User::get([
+                'BACKUPID'=>$item['user_id']
+            ]);
+            if(!$user || $item['user_id'] == 0) {
+                continue;
+            }
+
+            //银行
+            $userBank = UserBank::get([
+                'bankNumber'=>$item['card_no']
+            ]);
+
+
+            //余额
+            $userRecharge = UserRecharge::get([
+                'BACKUPID'=>$item['id']
+            ]);
+            if(!$userRecharge) {
+                $userRecharge = new UserRecharge();
+            }
+            $userRecharge['BACKUPID'] = $item['id'];//BACKUPID
+            $userRecharge['userID'] = $user['userID'];//手机号
+            $userRecharge['money'] = $item['amount'];//
+            $userRecharge['status'] = 1;
+            $userRecharge['type'] = 'TYPE_BANK';
+            $userRecharge['bankID'] = $userBank['bankID'];
+            $userRecharge['bankAccount'] = $userBank['bankAccount'];
+            $userRecharge['bankNumber'] = $userBank['bankNumber'];
+            $userRecharge['bankName'] = $userBank['bankName'];
+            $userRecharge['addTime'] = Common::datetotime($item['add_time']);
+            $userRecharge['trueName'] = $userBank['trueName'];
+            $userRecharge['mobile'] = $userBank['mobile'];
+            $userRecharge['userBankID'] = $userBank['userBankID'];
+            $userRecharge->save();
+        }
+    }
+
+    private function DY_loan() {
+        $from_contractList = Db::connect($this->db_config_from)->query('select * from s_contract');
+        foreach ($from_contractList as $k=>$item) {
+
+
+
+            $loan = Loan::get([
+                'alias'=>$item['name']
+            ]);
+
+            if(!$loan) {
+                $loan = new Loan();
+            }
+
+            $loan['alias'] = $item['name'];
+            $loan['beginTime'] = $item['start_time'];
+            $loan['endTime'] = $item['end_time'];
+            $loan['money'] = $item['price'];
+            $loan['year'] = $item['interest'];
+            $loan['name'] = $item['financing'];
+            $loan['addTime'] = $item['add_time'];
+            $loan['certType'] = 1;
+            $loan['certContent'] = $item['idcard'];
+            $loan['status'] = 1;
+            $loan['pledgeType'] = 1;
+            $loan->save();
+        }
+    }
+
+    private function DY_subject() {
+        $from_subjectList = Db::connect($this->db_config_from)->query('select * from s_project where amount > 0');
+        foreach ($from_subjectList as $k=>$item) {
+            $subjectTypeID = 1;
+            if($item['type'] == 4) {
+                $subjectTypeID = 1;
+            }
+            else if($item['type'] == 5) {
+                $subjectTypeID = 2;
+            }
+            else if($item['type'] == 6) {
+                $subjectTypeID = 3;
+            }
+            else if($item['type'] == 7) {
+                $subjectTypeID = 4;
+            }
+
+            $status = Subject::STATUS_ONLINE_CHECK;
+            $statusLoan = Subject::STATUS_LOAN_NULL;
+            if($item['status'] == 1) {
+                $status = Subject::STATUS_ONLINE_CHECK;
+            }
+            else if($item['status'] == 2) {
+                $status = Subject::STATUS_ONLINE;
+            }
+            else if($item['status'] == 3) {
+                $status = Subject::STATUS_FULL;
+                $statusLoan = Subject::STATUS_LOAN_FANG_WAIT;
+            }
+            else if($item['status'] == 4) {
+                $status = Subject::STATUS_FULL;
+                $statusLoan = Subject::STATUS_LOAN_FANG_WAIT;
+            }
+            else if($item['status'] == 5) {
+                $status = Subject::STATUS_REPAY;
+            }
+            else if($item['status'] == 6) {
+                $status = Subject::STATUS_FULL;
+                $statusLoan = Subject::STATUS_LOAN_FANG;
+            }
+            else if($item['status'] == 7) {
+                $status = Subject::STATUS_FULL;
+                $statusLoan = Subject::STATUS_LOAN_FANG;
+            }
+
+
+            $subject = Subject::get([
+                'BACKUPID'=>$item['id']
+            ]);
+
+            if(!$subject) {
+                $subject = new Subject();
+            }
+
+            $loan = Loan::get([
+                'alias'=>$item['contract_no']
+            ]);
+            $subject['BACKUPID'] = $item['id'];
+            $subject['title'] = $item['title'];
+            $subject['subjectTypeID'] = $subjectTypeID;
+            $subject['interestTypeID'] = 1;
+            $subject['interestTimeTypeID'] = 2;
+            $subject['term'] = $item['duration'];
+            $subject['price'] = $item['amount'];
+            $subject['year'] = $item['user_interest'];
+            $subject['yearSystem'] = isset($item['user_platform_subsidy']) ? $item['user_platform_subsidy'] : 0;
+            $subject['basePrice'] = $item['money_min'];
+            $subject['baseMaxPrice'] = $item['money_max'];
+            $subject['multiplePrice'] = 0;
+            $subject['releaseTime'] = Common::datetotime($item['start_time']);
+            /*$subject['beginTime'] = Common::datetotime($item['start_time']);
+            $subject['endTime'] = Common::datetotime($item['end_time']);*/
+            $subject['isIndexApp'] = 0;
+            $subject['isIndexPc'] = 0;
+            $subject['status'] = $status;
+            $subject['statusLoan'] = $statusLoan;
+            $subject['loanID'] = $loan ? $loan['alias'] : 0;
+            $subject['hongbao'] = '';
+            $subject['overTime'] = Common::datetotime($item['end_time']);
+            $subject['fullTime'] = isset($item['soldout_time']) ? $item['soldout_time'] : 0;
+            $subject['stage'] = $item['stage'];
+            //dump($subject);exit;
+            //dump($subject);exit;
+            $subject->save();
+
+            //$from_account = Db::connect($this->db_config_from)->query('select * from s_user_account where user_id='.$item['id']);
+            $subjectStat = SubjectStat::get([
+                'subjectID'=>$subject['subjectID']
+            ]);
+            if(!$subjectStat) {
+                $subjectStat = new SubjectStat();
+            }
+            $subjectStat['subjectID'] = $subject['subjectID'];
+            $subjectStat['moneyTotalInvest'] = $item['amount'] - $item['able'];
+            $subjectStat['timesInvest'] = 0;
+            $subjectStat->save();
+        }
+    }
+
+    private function DY_cang() {
+        $from_cangList = Db::connect($this->db_config_from)->query('select * from s_user_due_detail');
+        foreach ($from_cangList as $k=>$item) {
+
+            $subject = Subject::get([
+                'BACKUPID'=>$item['project_id']
+            ]);
+
+            $user = User::get([
+                'BACKUPID'=>$item['user_id']
+            ]);
+            $status = 0;
+            if($item['status'] == 1) {
+                $status = CangModel::STATUS_INTEREST;
+            }
+            else if($item['status'] == 2) {
+                $status = CangModel::STATUS_FINISH;
+            }
+            else if($item['type'] == 3) {
+                $status = CangModel::STATUS_REPAY;
+            }
+
+            $from_recharge = Db::connect($this->db_config_from)->query('select * from s_recharge_log where recharge_no=\''.$item['recharge_no'].'\''.' and user_id='.$item['user_id'].' and project_id='.$item['project_id']);
+            if(!$from_recharge) {
+                continue;
+            }
+            $from_recharge = $from_recharge[0];
+
+            $cang = CangModel::get([
+                'BACKUPID'=>$item['id']
+            ]);
+
+            if(!$cang) {
+                $cang = new CangModel();
+            }
+
+            $cang['BACKUPID'] = $item['id'];
+            $cang['subjectID'] = $subject['subjectID'];
+            $cang['userID'] = $user['userID'];
+            $cang['moneySubject'] = $item['due_capital'];
+            $cang['status'] = $status;
+            $cang['addTime'] = $item['user_interest'];
+            $cang['payTime'] = isset($item['user_platform_subsidy']) ? $item['user_platform_subsidy'] : 0;
+            $cang['updateTime'] = $item['money_min'];
+            $cang['interestBeginTime'] = Common::datetotime($item['start_time']);
+            $cang['interestEndTime'] = Common::datetotime($item['due_time']);
+            $cang['repayTime'] = Common::datetotime($item['end_time']);
+            $cang['year'] = $subject['year'];
+            $cang['ben'] = $item['due_capital'];
+            $cang['yearSystem'] = $subject['yearSystem'];
+            $cang['interest'] = $item['due_interest'];
+            $cang['investDay'] = $item['duration_day'];
+            $cang['interestTimeTypeID'] = $subject['interestTimeTypeID'];
+            if($item['ghost_phone']) {
+                $cang['isForged'] = 1;
+                $cang['userID'] = 4;
+            }
+            $cang['osType'] = $item['device_type'];
+            if($item['device_type'] == 3) {
+                $cang['osType'] = 4;
+            }
+            else if($item['device_type'] == 4) {
+                $cang['osType'] = 3;
+            }
+            $cang['money'] = $from_recharge['amount'];
+            $cang->save();
+
+            $cangRepay = CangRepay::where([
+                'cangID'=>$cang['cangID']
+            ])->select();
+            if($cangRepay->isEmpty()) {
+                $cangRepay = new CangRepay();
+            }
+            else {
+                $cangRepay->destroy();
+            }
+
+            //生成本
+            $cangRepay['money'] = $item['due_capital'];
+            $cangRepay['repayTime'] = Common::datetotime($item['end_time']);
+            $cangRepay['reachTime'] = Common::datetotime($item['end_time']) + 86400;
+            $cangRepay['cangID'] = $cang['cangID'];
+            $cangRepay['subjectID'] = $subject['subjectID'];
+            $cangRepay['userID'] = $user['userID'];
+            $cangRepay['status'] = CangRepay::STATUS_UNREPAY;
+            if($item['status'] == 2) {
+                $cangRepay['status'] = CangRepay::STATUS_REPAY;
+            }
+            $cangRepay['repayTypeID'] = 1;
+            $cangRepay->save();
+
+            //生成息
+            $cangRepay['money'] = $item['due_interest'];
+            $cangRepay['repayTime'] = Common::datetotime($item['end_time']);
+            $cangRepay['reachTime'] = Common::datetotime($item['end_time']) + 86400;
+            $cangRepay['cangID'] = $cang['cangID'];
+            $cangRepay['subjectID'] = $subject['subjectID'];
+            $cangRepay['userID'] = $user['userID'];
+            $cangRepay['status'] = CangRepay::STATUS_UNREPAY;
+            if($item['status'] == 2) {
+                $cangRepay['status'] = CangRepay::STATUS_REPAY;
+            }
+            $cangRepay['repayTypeID'] = 2;
+            $cangRepay->isUpdate(false)->save();
+
+            //生成流水
+
+        }
+    }
+
+}
+
+

+ 60 - 0
application/crontab/command/Send.php

@@ -0,0 +1,60 @@
+<?php
+/**
+ * 发送
+ * User: qissen
+ * Date: 2017/11/26
+ * Time: 11:26a
+ */
+namespace app\crontab\command;
+
+use app\core\model\HongbaoPlan;
+use app\core\service\SMS;
+use think\console\Command;
+use think\console\Input;
+use think\console\Output;
+use think\Log;
+use tool\Common;
+
+class Send extends Command
+{
+    protected function configure()
+    {
+        $this->setName('Send')->setDescription('Send开始');
+    }
+
+    protected function execute(Input $input, Output $output)
+    {
+        //在这里我们进行结算
+        Log::info('Send:'.Common::timetodate(THINK_START_TIME));
+
+        $this->sendSMS();
+        $this->hongbaoPlan();
+
+        $output->writeln("Send结束");
+    }
+
+    /**
+     * 红包派送计划 - 定时发送
+     */
+    private function hongbaoPlan() {
+        (new HongbaoPlan())->sendUserOnTiming();
+    }
+
+
+    /**
+     * 短信发送
+     */
+    private function sendSMS() {
+        \app\core\model\Sms::where([
+            'status'=>0,
+            'sendTime'=>['lt', THINK_START_TIME]
+        ])->chunk(100, function($list) {
+            foreach ($list as $item) {
+                SMS::sendSMS($item['mobile'], $item['message']);
+                $item->status = 1;
+                $item->save();
+            }
+        });
+    }
+
+}

+ 225 - 0
application/crontab/command/Subject.php

@@ -0,0 +1,225 @@
+<?php
+/**
+ * 持仓到期自动结算
+ * User: qissen
+ * Date: 2017/11/26
+ * Time: 11:26a
+ */
+namespace app\crontab\command;
+
+use app\core\model\Subject as Model;
+use app\core\model\SubjectStat;
+use app\core\model\User;
+
+use think\console\Command;
+use think\console\Input;
+use think\console\Output;
+use think\Log;
+use tool\Common;
+
+class Subject extends Command
+{
+    protected function configure()
+    {
+        $this->setName('Subject')->setDescription('Subject开始');
+    }
+
+    protected function execute(Input $input, Output $output)
+    {
+        //在这里我们进行结算
+        Log::info('Subject:'.Common::timetodate(THINK_START_TIME));
+
+
+        $this->setStatusOnline();
+        $this->setStatusOverTime();
+        $this->setRandCreateCang();
+
+
+        $output->writeln("Subject开始");
+    }
+
+
+
+
+    /**
+     * 设置上线
+     */
+    private function setStatusOnline() {
+        Model::where([
+            'releaseTime'=>['lt', THINK_START_TIME],
+            'status'=>Model::STATUS_ONLINE_CHECK
+        ])->chunk(100, function($list) {
+            foreach ($list as $item) {
+                $item->status = Model::STATUS_ONLINE;
+                $item->listOrder = THINK_START_TIME;
+                $item->save();
+
+
+
+                //将临近的app去掉首页
+                if($item['isIndexApp']) {
+                    $model = Model::where([
+                        'subjectTypeID'=>$item['subjectTypeID'],
+                        'BACKUPID'=>0,
+                        'status'=>Model::STATUS_ONLINE,
+                        'subjectID'=>['neq', $item['subjectID']]
+                    ])->order('addTime desc')->find();
+                    if(!$model) {
+                        continue;
+                    }
+                    $model['isIndexPc'] = 0;
+                    $model['isIndexApp'] = 0;
+                    $model->save();
+                }
+
+
+
+
+                /********************* 如果进行只能上线一个标请将我打开 ***********************
+                //将同类型最近一个产品设置为满标
+                $model = Model::where([
+                    'subjectTypeID'=>$item['subjectTypeID'],
+                    'BACKUPID'=>0,
+                    'status'=>Model::STATUS_ONLINE,
+                    'subjectID'=>['neq', $item['subjectID']]
+                ])->order('addTime desc')->find();
+                if(!$model) {
+                    continue;
+                }
+                //第0步,得到money
+                $money = $model['price'] - $model->subjectStat['moneyTotalInvest'];
+                if($money <= 0) {
+                    continue;
+                }
+
+
+                //第一步,得到一个虚拟账户
+                $userList = User::where([
+                    'isForged'=>1
+                ])->field(['userID'])->select();
+                if($userList->isEmpty()) {
+                    continue;
+                }
+                $userIDS = array_column($userList->toArray(), 'userID');
+                $userIDIndex = mt_rand(0, count($userIDS) - 1);
+                $userID = $userIDS[$userIDIndex];
+                $user = User::get($userID);
+
+
+                //第二步,保存一个仓
+                $cang = \app\core\model\Cang::create([
+                    'subjectID' => $model['subjectID'],
+                    'userID' => $user['userID'],
+                    'moneySubject' => $money,
+                    'ben' => $money,
+                    'status'=>\app\core\model\Cang::STATUS_PAY,
+                    'isForged'=>1
+                ]);
+                $cang['alias'] = \app\core\model\Cang::createAlias($cang['cangID']);
+                $cang->save();
+
+                //第三步,对产品进行统计
+                SubjectStat::where([
+                    'subjectID'=>$model['subjectID']
+                ])->setInc('moneyTotalInvest', $money * 100);
+                SubjectStat::where([
+                    'subjectID'=>$model['subjectID']
+                ])->setInc('timesInvest');
+
+                //第四步,将该标去掉首页符号
+                $model['isIndexPc'] = 0;
+                $model['isIndexApp'] = 0;
+                $model->save();
+
+                //第四步,设置为满标
+                Model::setSubjectFull($model);
+
+                ********************************** end *************************************/
+            }
+        });
+    }
+
+
+    private function setStatusOverTime() {
+       Model::where([
+            'overTime'=>['lt', THINK_START_TIME],
+            'status'=>Model::STATUS_FULL
+        ])->chunk(100, function($list) {
+            foreach ($list as $item) {
+                $item->status = Model::STATUS_OVERTIME;
+                $item->save();
+            }
+        });
+    }
+
+
+    //随机虚拟认购
+    private function setRandCreateCang() {
+        Model::where([
+            'status'=>Model::STATUS_ONLINE,
+            'BACKUPID'=>0
+        ])->chunk(100, function($list) {
+            foreach ($list as $model) {
+
+                //第0步,得到money
+                $moneyStill = $model['price'] - $model->subjectStat['moneyTotalInvest'];
+                if($moneyStill <= 0) {
+                    continue;
+                }
+                //$hour = date("H",time());
+                $cang = \app\core\model\Cang::where([
+                    'subjectID'=>$model['subjectID']
+                ])->order('addTime desc')->find();
+                if($cang && $cang->getData('addTime') + mt_rand(8000,12000) > THINK_START_TIME) {
+                    continue;
+                }
+                $moneyS = [1000, 1000, 1000, 2000, 5000, 10000];
+                $index = mt_rand(0,5);
+                $money = $moneyS[$index];//一次投2000
+                if($moneyStill < $money) {
+                    $money = $moneyStill;
+                }
+
+                //第一步,得到一个虚拟账户
+                $userList = User::where([
+                    'isForged'=>1
+                ])->field(['userID'])->select();
+                if($userList->isEmpty()) {
+                    continue;
+                }
+                $userIDS = array_column($userList->toArray(), 'userID');
+                $userIDIndex = mt_rand(0, count($userIDS) - 1);
+                $userID = $userIDS[$userIDIndex];
+                $user = User::get($userID);
+
+
+                //第二步,保存一个仓
+                $cang = \app\core\model\Cang::create([
+                    'subjectID' => $model['subjectID'],
+                    'userID' => $user['userID'],
+                    'moneySubject' => $money,
+                    'ben' => $money,
+                    'status'=>\app\core\model\Cang::STATUS_PAY,
+                    'isForged'=>1
+                ]);
+                $cang['alias'] = \app\core\model\Cang::createAlias($cang['cangID']);
+                $cang->save();
+
+                //第三步,对产品进行统计
+                SubjectStat::where([
+                    'subjectID'=>$model['subjectID']
+                ])->setInc('moneyTotalInvest', $money * 100);
+                SubjectStat::where([
+                    'subjectID'=>$model['subjectID']
+                ])->setInc('timesInvest');
+
+
+                //第四步,判断是否满标
+                if($model->subjectStat['moneyTotalInvest'] + $money == $model['price']) {
+                    //如果满标了,设置满标
+                    Model::setSubjectFull($model);
+                }
+            }
+        });
+    }
+}

+ 52 - 0
application/database.php

@@ -0,0 +1,52 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+return [
+    // 数据库类型
+    'type'            => 'mysql',
+    // 服务器地址
+    'hostname'        => 'rm-bp1m6abztwo27gum6.mysql.rds.aliyuncs.com',
+    // 数据库名
+    'database'        => 'jiafajinfu',
+    // 用户名
+    'username'        => 'sqlyog',
+    // 密码
+    'password'        => 'Qissen111111',
+    // 端口
+    'hostport'        => '3306',
+    // 连接dsn
+    'dsn'             => '',
+    // 数据库连接参数
+    'params'          => [],
+    // 数据库编码默认采用utf8
+    'charset'         => 'utf8',
+    // 数据库表前缀
+    'prefix'          => 'a_',
+    // 数据库调试模式
+    'debug'           => true,
+    // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
+    'deploy'          => 0,
+    // 数据库读写是否分离 主从式有效
+    'rw_separate'     => false,
+    // 读写分离后 主服务器数量
+    'master_num'      => 1,
+    // 指定从服务器序号
+    'slave_no'        => '',
+    // 是否严格检查字段是否存在
+    'fields_strict'   => true,
+    // 数据集返回类型
+    'resultset_type'  => 'array',
+    // 自动写入时间戳字段
+    'auto_timestamp'  => false,
+    // 时间字段取出后的默认时间格式
+    'datetime_format' => 'Y-m-d H:i:s',
+    // 是否需要进行SQL性能分析
+    'sql_explain'     => false,
+];

+ 18 - 0
application/extra/interest.php

@@ -0,0 +1,18 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+return [
+    'overtime_isinterest'=>0,//到期时间是否结息,1为结息,0为不结息
+    'repaytime_delay_span'=>0,//标的到期时间间隔多少秒再自动还款,比如43200,为中午12点自动打款;0为标的到期,马上还款
+    'reachtime_delay_span'=>1,//天
+    'default_interest_time_type'=>3,//默认起息时间类型ID,1为满标计息
+    'default_daily_release_span'=>20000,//每日发飙时间,从凌晨算起
+];

+ 15 - 0
application/extra/platform.php

@@ -0,0 +1,15 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+return [
+    'default_pay_gateway'=>'fuyou',//fuyou,alipay
+    'default_check_gateway'=>'fuyou',//fuyou,alipay
+];

+ 85 - 0
application/extra/skin_channel.php

@@ -0,0 +1,85 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+return [
+    'app_skin_config'=>[
+        //首页三个大button
+        'index_button'=>[
+            [
+                'imageUrl'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/03/12/2DJ6lGxJNx.png',
+                'link'=>'mobile_v_2_1/h5/userInvitationPage',
+                'text'=>'邀请有礼',
+                'subText'=>'邀请有礼',
+                'share'=>[
+                    'headImgUrl'=>'https://static.qimai.cn/static/img/newaso100@2x.png',
+                    'title'=>'邀请有礼',
+                    'desc'=>'邀请有礼',
+                    'link'=>'http://www.qq.com'
+                ]
+            ],
+            [
+                'imageUrl'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/03/12/fW45nMvpRt.png',
+                'link'=>'mobile_v_2_1/h5/safe',
+                'text'=>'安全保障',
+                'subText'=>'安全保障',
+                'share'=>[
+                    'headImgUrl'=>'https://static.qimai.cn/static/img/newaso100@2x.png',
+                    'title'=>'安全保障',
+                    'desc'=>'安全保障',
+                    'link'=>'http://www.qq.com'
+                ]
+            ],
+            [
+                'imageUrl'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/03/12/2yFn5kVdD6.png',
+                'link'=>'mobile_v_2_1/h5/activeList',
+                'text'=>'活动中心',
+                'subText'=>'活动中心',
+                'share'=>[
+                    'headImgUrl'=>'https://static.qimai.cn/static/img/newaso100@2x.png',
+                    'title'=>'活动中心',
+                    'desc'=>'活动中心',
+                    'link'=>'http://www.qq.com'
+                ]
+            ],
+            [
+                'imageUrl'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/03/12/goiOOA1lIw.png',
+                'link'=>'http://www.bojiatouzi.com/web/banner/act2018031705?######',
+                'text'=>'新手888元',
+                'subText'=>'新手888元',
+                'share'=>[
+                    'headImgUrl'=>'https://static.qimai.cn/static/img/newaso100@2x.png',
+                    'title'=>'活动中心',
+                    'desc'=>'活动中心',
+                    'link'=>'http://www.qq.com'
+                ]
+            ]
+        ],
+        //首页底部button
+        'index_bottomIcon'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/01/16/OFlkpTWxoI.png',
+
+
+        //产品图标
+        'subjectType_icon'=>[
+            '1'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/02/09/b1sPV5W6OB.png',
+            '2'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/02/09/s16evgtDPL.png',
+            '3'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/02/09/O8mROol5Od.png',
+            '4'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/02/09/X5X3Qkzgzr.png',
+            '5'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/02/09/X5X3Qkzgzr.png'
+        ],
+        'companyInfo'=>[
+            'name'=>'浙江博佳投资管理有限公司',
+            'brand'=>'佳乾财富',
+            'phone'=>'400-003-2312',
+            'web'=>'http://www.jiafajinfu.com',
+            'wechat'=>'jiafajinfu'
+        ]
+    ],
+];

+ 84 - 0
application/extra/skin_channel_20180306.php

@@ -0,0 +1,84 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+return [
+    'app_skin_config'=>[
+        //首页三个大button
+        'index_button'=>[
+            [
+                'imageUrl'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/03/12/2DJ6lGxJNx.png',
+                'link'=>'mobile_v_2_1/h5/userInvitationPage',
+                'text'=>'邀请有礼',
+                'subText'=>'邀请有礼',
+                'share'=>[
+                    'headImgUrl'=>'https://static.qimai.cn/static/img/newaso100@2x.png',
+                    'title'=>'邀请有礼',
+                    'desc'=>'邀请有礼',
+                    'link'=>'http://www.qq.com'
+                ]
+            ],
+            [
+                'imageUrl'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/03/12/fW45nMvpRt.png',
+                'link'=>'mobile_v_2_1/h5/safe',
+                'text'=>'安全保障',
+                'subText'=>'安全保障',
+                'share'=>[
+                    'headImgUrl'=>'https://static.qimai.cn/static/img/newaso100@2x.png',
+                    'title'=>'安全保障',
+                    'desc'=>'安全保障',
+                    'link'=>'http://www.qq.com'
+                ]
+            ]/*,
+            [
+                'imageUrl'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/03/12/2yFn5kVdD6.png',
+                'link'=>'mobile_v_2_1/h5/activeList',
+                'text'=>'活动中心',
+                'subText'=>'活动中心',
+                'share'=>[
+                    'headImgUrl'=>'https://static.qimai.cn/static/img/newaso100@2x.png',
+                    'title'=>'活动中心',
+                    'desc'=>'活动中心',
+                    'link'=>'http://www.qq.com'
+                ]
+            ],*/,
+            [
+                'imageUrl'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/03/12/goiOOA1lIw.png',
+                'link'=>'http://www.bojiatouzi.com/web/banner/act2018031705?######',
+                'text'=>'新手888元',
+                'subText'=>'新手888元',
+                'share'=>[
+                    'headImgUrl'=>'https://static.qimai.cn/static/img/newaso100@2x.png',
+                    'title'=>'活动中心',
+                    'desc'=>'活动中心',
+                    'link'=>'http://www.qq.com'
+                ]
+            ]
+        ],
+        //首页底部button
+        'index_bottomIcon'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/01/16/OFlkpTWxoI.png',
+
+        //产品图标
+        'subjectType_icon'=>[
+            '1'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/01/11/dsGEqFT7wN.png',
+            '2'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/01/03/loLuc5moxc.png',
+            '3'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/01/03/QioKU4FSfn.png',
+            '4'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/01/11/5qwgXumNnM.png',
+            '5'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/01/11/5qwgXumNnM.png'
+        ],
+        'companyInfo'=>[
+            'name'=>'柳河蒙银村镇银行股份有限公司',
+            'brand'=>'佳乾财富',
+            'phone'=>'400-003-2312',
+            'web'=>'http://www.jiafajinfu.com',
+            'wechat'=>'jiafajinfu'
+        ]
+    ],
+];

+ 72 - 0
application/extra/skin_channel_20180308.php

@@ -0,0 +1,72 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+return [
+    'app_skin_config'=>[
+        //首页三个大button
+        'index_button'=>[
+            [
+                'imageUrl'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/02/08/8hjT5P9D0d.png',
+                'link'=>'mobile_v_2_1/h5/userInvitationPage',
+                'text'=>'邀请有礼',
+                'subText'=>'注册即送888元大礼包,佳乾邀您一起理财赚钱!',
+                'share'=>[
+                    'headImgUrl'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/03/15/QI89aO8YXT.png',
+                    'title'=>'佳乾财富送您18%专享标',
+                    'desc'=>'注册即送888元大礼包,佳乾邀您一起理财赚钱!',
+                    'link'=>'https://jiaqiancaifu.dahengdian.com/active/index/register?introduce=@uuid@'
+                ]
+            ],
+            [
+                'imageUrl'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/02/08/IOPOqaHTei.png',
+                'link'=>'mobile_v_2_1/h5/activeList',
+                'text'=>'活动中心',
+                'subText'=>'活动中心',
+                'share'=>[
+                    'headImgUrl'=>'https://static.qimai.cn/static/img/newaso100@2x.png',
+                    'title'=>'活动中心',
+                    'desc'=>'活动中心',
+                    'link'=>'http://www.qq.com'
+                ]
+            ],
+            [
+                'imageUrl'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/02/08/hhWK3Ea7Dk.png',
+                'link'=>'http://www.bojiatouzi.com/web/banner/act2018031705?######',
+                'text'=>'新手888元',
+                'subText'=>'新手888元',
+                'share'=>[
+                    'headImgUrl'=>'https://static.qimai.cn/static/img/newaso100@2x.png',
+                    'title'=>'活动中心',
+                    'desc'=>'活动中心',
+                    'link'=>'http://www.qq.com'
+                ]
+            ]
+        ],
+        //首页底部button
+        'index_bottomIcon'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/01/16/OFlkpTWxoI.png',
+
+        //产品图标
+        'subjectType_icon'=>[
+            '1'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/01/11/dsGEqFT7wN.png',
+            '2'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/01/03/loLuc5moxc.png',
+            '3'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/01/03/QioKU4FSfn.png',
+            '4'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/01/11/5qwgXumNnM.png',
+            '5'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/01/11/5qwgXumNnM.png'
+        ],
+        'companyInfo'=>[
+            'name'=>'柳河蒙银村镇银行股份有限公司',
+            'brand'=>'加法金服',
+            'phone'=>'400-003-2312',
+            'web'=>'http://www.jiafajinfu.com',
+            'wechat'=>'jiafajinfu'
+        ]
+    ],
+];

+ 85 - 0
application/extra/skin_channel_20180313.php

@@ -0,0 +1,85 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+return [
+    'app_skin_config'=>[
+        //首页三个大button
+        'index_button'=>[
+            [
+                'imageUrl'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/03/12/2DJ6lGxJNx.png',
+                'link'=>'mobile_v_2_1/h5/userInvitationPage',
+                'text'=>'邀请有礼',
+                'subText'=>'邀请有礼',
+                'share'=>[
+                    'headImgUrl'=>'https://static.qimai.cn/static/img/newaso100@2x.png',
+                    'title'=>'邀请有礼',
+                    'desc'=>'邀请有礼',
+                    'link'=>'http://www.qq.com'
+                ]
+            ],
+            [
+                'imageUrl'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/03/12/fW45nMvpRt.png',
+                'link'=>'mobile_v_2_1/h5/safe',
+                'text'=>'安全保障',
+                'subText'=>'安全保障',
+                'share'=>[
+                    'headImgUrl'=>'https://static.qimai.cn/static/img/newaso100@2x.png',
+                    'title'=>'安全保障',
+                    'desc'=>'安全保障',
+                    'link'=>'http://www.qq.com'
+                ]
+            ],
+            [
+                'imageUrl'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/03/12/2yFn5kVdD6.png',
+                'link'=>'mobile_v_2_1/h5/activeList',
+                'text'=>'活动中心',
+                'subText'=>'活动中心',
+                'share'=>[
+                    'headImgUrl'=>'https://static.qimai.cn/static/img/newaso100@2x.png',
+                    'title'=>'活动中心',
+                    'desc'=>'活动中心',
+                    'link'=>'http://www.qq.com'
+                ]
+            ],
+            [
+                'imageUrl'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/03/12/goiOOA1lIw.png',
+                'link'=>'http://www.bojiatouzi.com/web/banner/act2018031705?######',
+                'text'=>'新手888元',
+                'subText'=>'新手888元',
+                'share'=>[
+                    'headImgUrl'=>'https://static.qimai.cn/static/img/newaso100@2x.png',
+                    'title'=>'活动中心',
+                    'desc'=>'活动中心',
+                    'link'=>'http://www.qq.com'
+                ]
+            ]
+        ],
+        //首页底部button
+        'index_bottomIcon'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/01/16/OFlkpTWxoI.png',
+
+
+        //产品图标
+        'subjectType_icon'=>[
+            '1'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/02/09/b1sPV5W6OB.png',
+            '2'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/02/09/s16evgtDPL.png',
+            '3'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/02/09/O8mROol5Od.png',
+            '4'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/02/09/X5X3Qkzgzr.png',
+            '5'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/02/09/X5X3Qkzgzr.png'
+        ],
+        'companyInfo'=>[
+            'name'=>'四川仪陇惠民村镇银行有限责任公司',
+            'brand'=>'佳乾财富',
+            'phone'=>'400-003-2312',
+            'web'=>'http://www.jiafajinfu.com',
+            'wechat'=>'jiafajinfu'
+        ]
+    ],
+];

+ 16 - 0
application/extra/system.php

@@ -0,0 +1,16 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+return [
+    'mobile_key'=>'aladfa5a4g46jh4vb44n4e4r4t',//fuyou,alipay
+    'pc_key'=>'aladfa5a4g46jh4vb44n4e4r4t',//fuyou,alipay
+    'wap_key'=>'aladfa5a4g46jh4vb44n4e4r4t',//fuyou,alipay
+];

+ 13 - 0
application/index/controller/Index.php

@@ -0,0 +1,13 @@
+<?php
+namespace app\index\controller;
+
+
+use think\Controller;
+use think\Log;
+
+class Index extends Controller
+{
+    public function index() {
+        $this->redirect('http://slb.dahengdian.com/jiaqiancaifu/jqcf_2.0.0_bojia_20180115094647_release_200_jiagu_sign.apk');
+    }
+}

+ 15 - 0
application/laojiaqian/controller/Index.php

@@ -0,0 +1,15 @@
+<?php
+namespace app\laojiaqian\controller;
+use app\laojiaqian\model\User;
+use think\Controller;
+use think\Log;
+
+class Index extends Controller
+{
+    public function index()
+    {
+        dump(User::get([
+            'id'=>1
+        ]));
+    }
+}

+ 34 - 0
application/laojiaqian/model/Project.php

@@ -0,0 +1,34 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\laojiaqian\model;
+
+use think\Model;
+
+
+class Project extends Model
+{
+    protected $autoWriteTimestamp = true;
+    protected $connection = [
+        // 数据库类型
+        'type'        => 'mysql',
+        // 服务器地址
+        'hostname'    => 'rm-bp1m6abztwo27gum6.mysql.rds.aliyuncs.com',
+        // 数据库名
+        'database'    => 'goldapi',
+        // 数据库用户名
+        'username'    => 'sqlyog',
+        // 数据库密码
+        'password'    => 'Qissen111111',
+        // 数据库编码默认采用utf8
+        'charset'     => 'utf8',
+        // 数据库表前缀
+        'prefix'      => 's_',
+    ];
+
+}

+ 33 - 0
application/laojiaqian/model/User.php

@@ -0,0 +1,33 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\laojiaqian\model;
+
+use think\Model;
+
+
+class User extends Model
+{
+    protected $autoWriteTimestamp = true;
+    protected $connection = [
+        // 数据库类型
+        'type'        => 'mysql',
+        // 服务器地址
+        'hostname'    => 'rm-bp1m6abztwo27gum6.mysql.rds.aliyuncs.com',
+        // 数据库名
+        'database'    => 'goldapi',
+        // 数据库用户名
+        'username'    => 'sqlyog',
+        // 数据库密码
+        'password'    => 'Qissen111111',
+        // 数据库编码默认采用utf8
+        'charset'     => 'utf8',
+        // 数据库表前缀
+        'prefix'      => 's_',
+    ];
+}

+ 41 - 0
application/laojiaqian/model/UserDueDetail.php

@@ -0,0 +1,41 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: qisse
+ * Date: 2017/6/27
+ * Time: 20:02
+ */
+
+namespace app\laojiaqian\model;
+
+use think\Model;
+
+
+class UserDueDetail extends Model
+{
+    protected $autoWriteTimestamp = true;
+    protected $connection = [
+        // 数据库类型
+        'type'        => 'mysql',
+        // 服务器地址
+        'hostname'    => 'rm-bp1m6abztwo27gum6.mysql.rds.aliyuncs.com',
+        // 数据库名
+        'database'    => 'goldapi',
+        // 数据库用户名
+        'username'    => 'sqlyog',
+        // 数据库密码
+        'password'    => 'Qissen111111',
+        // 数据库编码默认采用utf8
+        'charset'     => 'utf8',
+        // 数据库表前缀
+        'prefix'      => 's_',
+    ];
+
+    public function user() {
+        return $this->belongsTo('user', 'user_id');
+    }
+
+    public function project() {
+        return $this->belongsTo('project', 'project_id');
+    }
+}

+ 30 - 0
application/master/config.php

@@ -0,0 +1,30 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+return [
+    'resources'=>'/static/master',
+    'cookie'                 => [
+        // cookie 名称前缀
+        'prefix'    => 'master_',
+        // cookie 保存时间
+        'expire'    => 30 * 86400,
+        // cookie 保存路径
+        'path'      => '/',
+        // cookie 有效域名
+        'domain'    => '',
+        //  cookie 启用安全传输
+        'secure'    => false,
+        // httponly设置
+        'httponly'  => '',
+        // 是否使用 setcookie
+        'setcookie' => true,
+    ]
+];

+ 49 - 0
application/master/controller/Base.php

@@ -0,0 +1,49 @@
+<?php
+namespace app\master\controller;
+use app\core\exception\AppException;
+use app\core\model\Master;
+use think\Log;
+
+
+class Base
+{
+    public $master;
+    public $data = [];
+    public $request;
+    public $app;
+
+
+    public function __construct()
+    {
+
+        header("Access-Control-Allow-Origin: *");
+        $this->request = request();
+        $this->data = $this->request->post();
+        if(!isset($this->data['token'])) {
+            throw new AppException(-1002, 'token是必传字段');
+        }
+
+        if($this->request->action() != strtolower('loginByPassword')) {
+            $master = Master::get([
+                'token'=>$this->data['token']
+            ]);
+            if(!$master) {
+                throw new AppException(-1001, '不存在token');
+            }
+            if($master['tokenOverTime'] < THINK_START_TIME) {
+                throw new AppException(-1002, '登录超时,请重新登录');
+            }
+            $this->request->bind('master', $master);
+            if(!\app\master\logic\Master::checkAuth($master, str_replace('master/', '', $this->request->path()))) {
+                throw new AppException(-1003, '没有权限');
+            }
+        }
+        $this->request->bind('app', isset($this->data['app']) ? $this->data['app'] : []);
+        $this->__initialize();
+    }
+
+    public function __call($name, $arguments)
+    {
+        // TODO: Implement __call() method.
+    }
+}

+ 29 - 0
application/master/controller/Cang.php

@@ -0,0 +1,29 @@
+<?php
+namespace app\master\controller;
+use app\master\logic\Cang as Logic;
+use think\Config;
+
+
+class Cang extends Base
+{
+
+    public function getCangRepayList() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function getCangList() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function actionRepay() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public $logic;
+    public function __initialize() {
+        $this->logic = new Logic($this->request);
+    }
+}

+ 46 - 0
application/master/controller/H5manger.php

@@ -0,0 +1,46 @@
+<?php
+namespace app\master\controller;
+
+
+use app\core\model\HongbaoPlan;
+use app\core\model\User;
+use app\core\service\Finance;
+use think\Controller;
+use think\Db;
+use tool\Common;
+
+class H5manger extends Controller
+{
+
+    public function index() {
+        $finance = new \app\master\logic\Index();
+        $result = $finance->balance($msg, '18989706775');
+        dump($result);
+    }
+
+    public function hongbao() {
+        /*$user = User::get([
+            'mobile'=>'18101707268'
+        ]);
+        (new HongbaoPlan())->sendUserOnRegister($user);*/
+    }
+
+
+    public function getStat30Days() {
+        //echo "select FROM_UNIXTIME(addTime, '%y-%m-%d') dates, sum(moneySubject) from a_cang where isForged=0 and addTime between ".(THINK_START_TIME - 7 * 86400)." and ".Common::timetodate(THINK_START_TIME, 0)." group by dates";exit;
+        dump(Db::query("select FROM_UNIXTIME(addTime, '%Y-%m-%d') date, sum(moneySubject) as moneyTotal,count(*) as count from a_cang where isForged=0 and addTime between ".(THINK_START_TIME - 30 * 86400)." and ".THINK_START_TIME." group by date"));
+    }
+
+    public function cancelUser() {
+        $finance = new Finance();
+        //$user = Model::get($this->app['userID']);
+        $result = $finance->userCancel($msg, request()->param('mobile'), 'http://www.jiaqiancaifu.com');
+        return view(__FUNCTION__, [
+            'resourcePath'=>'/static/'.request()->path(),
+            'param'=>$result['param'],
+            'url'=>$result['url']
+        ]);
+    }
+
+}
+

+ 23 - 0
application/master/controller/Index.php

@@ -0,0 +1,23 @@
+<?php
+namespace app\master\controller;
+use think\Controller;
+use app\master\logic\Index as Logic;
+use think\Log;
+
+class Index extends Base
+{
+    public function getStat()
+    {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function getCangList() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+    public $logic;
+    public function __initialize() {
+        $this->logic = new Logic($this->request);
+    }
+}

+ 57 - 0
application/master/controller/Laojiaqian.php

@@ -0,0 +1,57 @@
+<?php
+namespace app\master\controller;
+
+
+use app\master\logic\Laojiaqian as Logic;
+
+class Laojiaqian extends Base
+{
+
+    //注销金账户
+    /*public function cancelPlatformUser() {
+
+        $param = request()->param();
+
+        vendor('payModel.User');
+        $user = new \User();
+        $user->setMobile($param['mobile']);
+        $user->setPageBackurl('http://wxapp.dahengdian.com/master/notify/cancelUser');
+        $data = (new Finance())->userCancel($msg, $user);
+
+
+        $model = Model::get([
+            'mobile'=>$param['mobile']
+        ]);
+        if($model) {
+            $model->isAuthTrueName = 0;
+            $model->isAuthBank = 0;
+            $model->save();
+
+            UserBank::destroy([
+                'userID'=>$model['userID']
+            ]);
+        }
+
+
+
+
+        return view(__FUNCTION__, [
+            'resourcePath'=>'/static/'.request()->path(),
+            'param'=>$data['param'],
+            'url'=>$data['url']
+        ]);
+    }*/
+
+
+    public function getCangList() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public $logic;
+    public function __initialize() {
+        $this->logic = new Logic($this->request);
+    }
+
+}
+

+ 33 - 0
application/master/controller/Loan.php

@@ -0,0 +1,33 @@
+<?php
+namespace app\master\controller;
+use app\master\logic\Loan as Logic;
+
+
+class Loan extends Base
+{
+    //更新一个banner
+    public function update() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function getDetail() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function getLoanList() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function actionDelete() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public $logic;
+    public function __initialize() {
+        $this->logic = new Logic($this->request);
+    }
+}

+ 118 - 0
application/master/controller/Market.php

@@ -0,0 +1,118 @@
+<?php
+namespace app\master\controller;
+use app\master\logic\Market as Logic;
+
+
+class Market extends Base
+{
+    //更新一个banner
+    public function activeUpdate() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function activeGetDetail() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function activeGetList() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function activeActionOnlineApp() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function activeActionOfflineApp() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function activeActionOnlinePc() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function activeActionOfflinePc() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function activeActionDelete() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function hongbaoGetTypeList() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function hongbaoUpdate() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function hongbaoGetList() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function hongbaoGetDetail() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function hongbaoActionOnline() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function hongbaoActionOffline() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function hongbaoPlanGetTypeList() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function hongbaoPlanUpdate() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function hongbaoPlanGetDetail() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function hongbaoPlanGetList() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function hongbaoPlanActionDelete() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function hongbaoPlanSendUser() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function hongbaoPlanMade() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public $logic;
+    public function __initialize() {
+        $this->logic = new Logic($this->request);
+    }
+}

+ 24 - 0
application/master/controller/Master.php

@@ -0,0 +1,24 @@
+<?php
+namespace app\master\controller;
+use app\master\logic\Master as Logic;
+
+
+class Master extends Base
+{
+    //得到产品类型
+    public function loginByPassword() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    //登出
+    public function logout() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public $logic;
+    public function __initialize() {
+        $this->logic = new Logic($this->request);
+    }
+}

+ 45 - 0
application/master/controller/Notify.php

@@ -0,0 +1,45 @@
+<?php
+namespace app\master\controller;
+
+use app\core\service\Finance;
+use app\master\logic\User as Logic;
+
+
+
+class Notify
+{
+
+    //注销金账户
+    public function cancelUser() {
+        //dump(request());
+        echo ':)';exit;
+    }
+
+    public function recharge() {
+        //dump(request());
+        echo ':)';exit;
+    }
+
+    public function drawcash() {
+        //dump(request());
+        echo ':)';exit;
+    }
+
+    public function trade() {
+        //dump(request());
+        echo ':)';exit;
+    }
+
+    public function refundTicket() {
+        //dump(request());
+        echo ':)';exit;
+    }
+
+    public function updateUser() {
+        //dump(request());
+        echo ':)';exit;
+    }
+
+
+
+}

+ 54 - 0
application/master/controller/Setting.php

@@ -0,0 +1,54 @@
+<?php
+namespace app\master\controller;
+use app\master\logic\Setting as Logic;
+
+
+class Setting extends Base
+{
+    //更新一个banner
+    public function bannerUpdate() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function bannerGetDetail() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    //得到banner列表
+    public function getBannerList() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function bannerActionOnline() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function bannerActionOffline() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function channelUpdate() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function channelGetList() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function channelGetDetail() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public $logic;
+    public function __initialize() {
+        $this->logic = new Logic($this->request);
+    }
+}

+ 126 - 0
application/master/controller/Subject.php

@@ -0,0 +1,126 @@
+<?php
+namespace app\master\controller;
+use app\core\model\InterestTimeType;
+use app\core\model\InterestType;
+use app\core\model\SubjectType;
+use app\core\model\Subject as Model;
+use app\master\logic\Subject as Logic;
+use think\Config;
+
+
+class Subject extends Base
+{
+    //得到产品类型
+    public function getSubjectTypeList() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    //得到计息类型
+    public function getInterestTypeList() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    //生成一个标的
+    public function update() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    //得到列表
+    public function getSubjectList() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    //得到状态列表
+    public function getStatusList() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    //得到放款列表
+    public function getStatusLoanList() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    //审核通过,上线
+    public function actionOnline() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    //审核通过,上线
+    public function actionDelete() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    //虚拟认购
+    public function actionForged() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    //得到详细
+    public function getDetail() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function actionFang() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+
+    public function actionExport() {
+        $function = __FUNCTION__;
+        return json($this->logic->$function());
+    }
+    /*public function index()
+    {
+        $subjectTypeList = SubjectType::all();
+        $statusList = Model::getStatusList();
+        $this->assign('subjectTypeList',$subjectTypeList->toArray());
+        $this->assign('statusList',$statusList);
+        // 模板输出
+        return $this->fetch();
+    }
+
+    public function update()
+    {
+
+        $subjectTypeList = SubjectType::all();
+        $interestTypeList = InterestType::all();
+        $interestTimeTypeList = InterestTimeType::getInterestTimeTypeList(Config::get('interest.default_interest_time_type'));
+
+        // 模板变量赋值
+        $this->assign('subjectTypeList', $subjectTypeList->toArray());
+        $this->assign('interestTypeList', $interestTypeList->toArray());
+        $this->assign('interestTimeTypeList', $interestTimeTypeList);
+        $this->assign('defaultInterestTimeTypeID', Config::get('interest.default_interest_time_type'));
+        $this->assign('overtimeIsinterest', Config::get('interest.overtime_isinterest'));
+        $this->assign('repaytimeDelaySpan', Config::get('interest.repaytime_delay_span'));
+
+        // 或者批量赋值
+        $this->assign([
+            'name'  => 'ThinkPHP',
+            'email' => 'thinkphp@qq.com'
+        ]);
+        // 模板输出
+        return $this->fetch();
+    }*/
+
+
+
+
+
+
+
+    public $logic;
+    public function __initialize() {
+        $this->logic = new Logic($this->request);
+    }
+}

+ 66 - 0
application/master/controller/Test.php

@@ -0,0 +1,66 @@
+<?php
+namespace app\master\controller;
+
+
+class Test
+{
+    public function loginByPassword()
+    {
+        $curl = curl_init($this->urlCreate('master/loginByPassword'));
+        $app = [
+            'mobile'=>'17316900863',
+            'password'=>'111111'
+        ];
+        curl_setopt($curl, CURLOPT_HEADER, 0);
+        curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($this->loginDataCreate($app)));
+        curl_setopt($curl, CURLOPT_POST,true);
+        curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
+        return curl_exec($curl);
+    }
+
+    public function cangCreate()
+    {
+        $curl = curl_init($this->urlCreate('cang/cangCreate'));
+        $app = [
+            'mobile'=>'17316900863',
+            'password'=>'111111'
+        ];
+        curl_setopt($curl, CURLOPT_HEADER, 0);
+        curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($this->loginDataCreate($app)));
+        curl_setopt($curl, CURLOPT_POST,true);
+        curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
+        return curl_exec($curl);
+    }
+
+    public function hongbaoPlanSendUser()
+    {
+        $curl = curl_init($this->urlCreate('market/hongbaoPlanSendUser'));
+        $app = [
+            'userID'=>15728,
+            'hongbaoIDS'=>[42,43]
+        ];
+        curl_setopt($curl, CURLOPT_HEADER, 0);
+        curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($this->dataCreate($app)));
+        curl_setopt($curl, CURLOPT_POST,true);
+        curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
+        return curl_exec($curl);
+    }
+
+    public function urlCreate($apiIcon) {
+        return 'http://wxapp.dahengdian.com/master/'.$apiIcon;
+    }
+
+    //dataCreate
+    public function dataCreate($app = []) {
+        $data['token'] = '0a15d8e33aacbc6930fdca3c47112ad9';
+        $data['app'] = $app;
+        return $data;
+    }
+
+
+    public function loginDataCreate($app = []) {
+        $data['token'] = '';
+        $data['app'] = $app;
+        return $data;
+    }
+}

+ 0 - 0
application/master/controller/Upload.php


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