wupengfei 2 年之前
父节点
当前提交
a865c63ee4
共有 3 个文件被更改,包括 140 次插入89 次删除
  1. 31 89
      .idea/workspace.xml
  2. 91 0
      application/api/controller/ApplePay.php
  3. 18 0
      application/api/controller/Publics.php

+ 31 - 89
.idea/workspace.xml

@@ -2,8 +2,9 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="39916099-6c76-4a34-b5a2-40f5b4c0c928" name="Default Changelist" comment="">
+      <change afterPath="$PROJECT_DIR$/application/api/controller/ApplePay.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/application/api/controller/Order.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Order.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/application/api/controller/Publics.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Publics.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -120,19 +121,15 @@
     </include_path>
   </component>
   <component name="ProjectId" id="2Cq2VDBB0vwEIeAlTs7rD2GB5Re" />
-  <component name="ProjectLevelVcsManager">
-    <ConfirmationsSetting value="2" id="Add" />
-  </component>
   <component name="ProjectViewState">
     <option name="hideEmptyMiddlePackages" value="true" />
     <option name="showExcludedFiles" value="true" />
     <option name="showLibraryContents" value="true" />
   </component>
   <component name="PropertiesComponent">
-    <property name="ASKED_ADD_EXTERNAL_FILES" value="true" />
     <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
     <property name="WebServerToolWindowFactoryState" value="false" />
-    <property name="last_opened_file_path" value="$PROJECT_DIR$/../xiang_api" />
+    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
     <property name="node.js.detected.package.eslint" value="true" />
     <property name="node.js.detected.package.tslint" value="true" />
     <property name="node.js.path.for.package.eslint" value="project" />
@@ -141,15 +138,13 @@
     <property name="node.js.selected.package.tslint" value="(autodetect)" />
   </component>
   <component name="RecentsManager">
-    <key name="MoveFile.RECENT_KEYS">
-      <recent name="D:\zs\xianglian_test_api\application\common\library" />
-    </key>
     <key name="CopyFile.RECENT_KEYS">
       <recent name="D:\zs\xianglian_test_api\application\api\controller" />
+      <recent name="D:\zs\xianglian_test_api\vendor" />
+      <recent name="D:\zs\xianglian_test_api\application\common\library" />
+    </key>
+    <key name="MoveFile.RECENT_KEYS">
       <recent name="D:\zs\xianglian_test_api\application\common\library" />
-      <recent name="D:\zs\xianglian_test_api\public" />
-      <recent name="D:\zs\xianglian_test_api\application\common\library\llp\src\params" />
-      <recent name="D:\zs\xianglian_test_api\application\common\library\llp" />
     </key>
   </component>
   <component name="SvnConfiguration">
@@ -191,108 +186,55 @@
       <workItem from="1661907612419" duration="1964000" />
       <workItem from="1661993129480" duration="5797000" />
       <workItem from="1662078424351" duration="16877000" />
-      <workItem from="1662338111391" duration="11340000" />
-      <workItem from="1662424050521" duration="12213000" />
-      <workItem from="1662528829964" duration="290000" />
-      <workItem from="1662707319406" duration="6920000" />
-      <workItem from="1663029342642" duration="7492000" />
-      <workItem from="1663115674240" duration="4443000" />
-      <workItem from="1663216918470" duration="8726000" />
-      <workItem from="1663289317281" duration="15747000" />
-      <workItem from="1663374110844" duration="1190000" />
-      <workItem from="1663548946235" duration="6998000" />
-      <workItem from="1663721088316" duration="8491000" />
-      <workItem from="1663807608622" duration="4087000" />
-      <workItem from="1663893226586" duration="1783000" />
-      <workItem from="1664001111572" duration="6000" />
-      <workItem from="1664241269344" duration="31206000" />
-      <workItem from="1664412292263" duration="17849000" />
-      <workItem from="1664498426748" duration="1828000" />
-      <workItem from="1665189424516" duration="5903000" />
-      <workItem from="1665206980198" duration="2686000" />
-      <workItem from="1665276340708" duration="10975000" />
-      <workItem from="1665362528726" duration="3110000" />
-      <workItem from="1665448771087" duration="636000" />
-      <workItem from="1665451039898" duration="8365000" />
-      <workItem from="1665535774839" duration="2954000" />
-      <workItem from="1665543792569" duration="7208000" />
-      <workItem from="1665621143495" duration="2513000" />
-      <workItem from="1665708328289" duration="8744000" />
-      <workItem from="1665794611802" duration="1412000" />
-      <workItem from="1665967743750" duration="10802000" />
-      <workItem from="1666054299511" duration="1287000" />
-      <workItem from="1666140530691" duration="3265000" />
-    </task>
-    <task id="LOCAL-00001" summary=".">
-      <created>1663731279977</created>
-      <option name="number" value="00001" />
-      <option name="presentableId" value="LOCAL-00001" />
-      <option name="project" value="LOCAL" />
-      <updated>1663731279977</updated>
+      <workItem from="1662125586057" duration="84000" />
+      <workItem from="1666659725165" duration="2671000" />
+      <workItem from="1666746113072" duration="2067000" />
+      <workItem from="1666850555551" duration="9000" />
     </task>
-    <task id="LOCAL-00002" summary=".">
-      <created>1663731299706</created>
-      <option name="number" value="00002" />
-      <option name="presentableId" value="LOCAL-00002" />
-      <option name="project" value="LOCAL" />
-      <updated>1663731299706</updated>
-    </task>
-    <option name="localTasksCounter" value="3" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
     <option name="version" value="1" />
   </component>
-  <component name="VcsManagerConfiguration">
-    <option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
-    <MESSAGE value="." />
-    <option name="LAST_COMMIT_MESSAGE" value="." />
-  </component>
   <component name="WindowStateProjectService">
     <state x="918" y="532" key="#com.intellij.fileTypes.FileTypeChooser" timestamp="1661735232629">
       <screen x="0" y="0" width="2560" height="1400" />
     </state>
     <state x="918" y="532" key="#com.intellij.fileTypes.FileTypeChooser/0.0.2560.1400@0.0.2560.1400" timestamp="1661735232629" />
-    <state x="1221" y="472" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog" timestamp="1665282512172">
-      <screen x="0" y="0" width="2560" height="1400" />
-    </state>
-    <state x="1221" y="472" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog/0.0.2560.1400@0.0.2560.1400" timestamp="1665282512172" />
-    <state x="1242" y="398" key="CommitChangelistDialog2" timestamp="1663731298581">
+    <state x="1221" y="472" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog" timestamp="1660096773939">
       <screen x="0" y="0" width="2560" height="1400" />
     </state>
-    <state x="1242" y="398" key="CommitChangelistDialog2/0.0.2560.1400@0.0.2560.1400" timestamp="1663731298581" />
-    <state x="113" y="131" width="2188" height="1150" key="DiffContextDialog" timestamp="1666165636203">
+    <state x="1221" y="472" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog/0.0.2560.1400@0.0.2560.1400" timestamp="1660096773939" />
+    <state x="401" y="129" width="1992" height="1150" key="DiffContextDialog" timestamp="1662015482697">
       <screen x="0" y="0" width="2560" height="1400" />
     </state>
-    <state x="113" y="131" width="2188" height="1150" key="DiffContextDialog/0.0.2560.1400@0.0.2560.1400" timestamp="1666165636203" />
-    <state x="1125" y="483" key="FileChooserDialogImpl" timestamp="1665476140468">
-      <screen x="0" y="0" width="2560" height="1400" />
-    </state>
-    <state x="1125" y="483" key="FileChooserDialogImpl/0.0.2560.1400@0.0.2560.1400" timestamp="1665476140468" />
-    <state width="498" height="446" key="SwitcherDM" timestamp="1665709382534">
-      <screen x="0" y="0" width="2560" height="1400" />
+    <state x="401" y="129" width="1992" height="1150" key="DiffContextDialog/0.0.2560.1400@0.0.2560.1400" timestamp="1662015482697" />
+    <state x="844" y="359" key="FileChooserDialogImpl" timestamp="1666763920443">
+      <screen x="0" y="0" width="1920" height="1040" />
     </state>
-    <state width="498" height="446" key="SwitcherDM/0.0.2560.1400@0.0.2560.1400" timestamp="1665709382534" />
-    <state x="1059" y="598" key="com.intellij.ide.util.TipDialog" timestamp="1665448811701">
+    <state x="844" y="359" key="FileChooserDialogImpl/0.0.1920.1040@0.0.1920.1040" timestamp="1666763920443" />
+    <state x="1125" y="483" key="FileChooserDialogImpl/0.0.2560.1400@0.0.2560.1400" timestamp="1661995750679" />
+    <state width="498" height="446" key="SwitcherDM" timestamp="1659750581001">
       <screen x="0" y="0" width="2560" height="1400" />
     </state>
-    <state x="1059" y="598" key="com.intellij.ide.util.TipDialog/0.0.2560.1400@0.0.2560.1400" timestamp="1665448811701" />
-    <state x="1401" y="707" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2" timestamp="1665629012476">
-      <screen x="0" y="0" width="2560" height="1400" />
+    <state width="498" height="446" key="SwitcherDM/0.0.2560.1400@0.0.2560.1400" timestamp="1659750581001" />
+    <state x="854" y="443" key="com.intellij.ide.util.TipDialog" timestamp="1666755257913">
+      <screen x="0" y="0" width="1920" height="1040" />
     </state>
-    <state x="1401" y="707" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2/0.0.2560.1400@0.0.2560.1400" timestamp="1665629012476" />
-    <state x="1088" y="459" width="912" height="548" key="find.popup" timestamp="1663231311548">
+    <state x="854" y="443" key="com.intellij.ide.util.TipDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1666755257913" />
+    <state x="1138" y="596" key="com.intellij.ide.util.TipDialog/0.0.2560.1400@0.0.2560.1400" timestamp="1661476175578" />
+    <state x="1401" y="707" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2" timestamp="1660120657439">
       <screen x="0" y="0" width="2560" height="1400" />
     </state>
-    <state x="1088" y="459" width="912" height="548" key="find.popup/0.0.2560.1400@0.0.2560.1400" timestamp="1663231311548" />
-    <state x="864" y="335" key="run.anything.popup" timestamp="1665710362633">
+    <state x="1401" y="707" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2/0.0.2560.1400@0.0.2560.1400" timestamp="1660120657439" />
+    <state x="1088" y="459" width="912" height="548" key="find.popup" timestamp="1661309810003">
       <screen x="0" y="0" width="2560" height="1400" />
     </state>
-    <state x="864" y="335" key="run.anything.popup/0.0.2560.1400@0.0.2560.1400" timestamp="1665710362633" />
-    <state x="1083" y="310" width="672" height="678" key="search.everywhere.popup" timestamp="1665285034967">
+    <state x="1088" y="459" width="912" height="548" key="find.popup/0.0.2560.1400@0.0.2560.1400" timestamp="1661309810003" />
+    <state x="1082" y="310" width="672" height="678" key="search.everywhere.popup" timestamp="1660378258238">
       <screen x="0" y="0" width="2560" height="1400" />
     </state>
-    <state x="1083" y="310" width="672" height="678" key="search.everywhere.popup/0.0.2560.1400@0.0.2560.1400" timestamp="1665285034967" />
+    <state x="1082" y="310" width="672" height="678" key="search.everywhere.popup/0.0.2560.1400@0.0.2560.1400" timestamp="1660378258238" />
   </component>
   <component name="XDebuggerManager">
     <breakpoint-manager>

+ 91 - 0
application/api/controller/ApplePay.php

@@ -0,0 +1,91 @@
+<?php
+namespace app\api\controller;
+use think\Controller;
+use think\Db;
+/**
+ * 苹果支付
+ * Class ApplePay
+ */
+class ApplePay extends Base
+{
+
+    protected $noNeedLogin = [];
+    protected $noNeedRight = '*';
+    protected $orderNum = null;
+    protected $model = null;
+    protected $relationSearch = true;
+    protected $appleCode = [
+        21000 => 'App Store无法读取你提供的JSON数据',
+        21002 => '收据数据不符合格式',
+        21003 => '收据无法被验证',
+        21004 => '你提供的共享密钥和账户的共享密钥不一致',
+        21005 => '收据服务器当前不可用',
+        21006 => '收据是有效的,但订阅服务已经过期。当收到这个信息时,解码后的收据信息也包含在返回内容中',
+        21007 => '收据信息是测试用(sandbox),但却被发送到产品环境中验证',
+        21008 => '收据信息是产品环境中使用,但却被发送到测试环境中验证'
+    ];
+
+    /**
+     * @title 验证支付票据 完成订单接口
+     */
+    public function verifyReceipt()
+    {
+        $receipt = $this->request->param('receipt/s', '');
+        if (empty($receipt)) $this->error('订单错误');
+        $this->orderNum = $this->request->param('order_id/s', '');
+
+        $order = $this->model->where(array('order_id' => $this->orderNum))->find();
+        if (empty($order)) {
+            $this->error('订单错误');
+        }
+        if ($order['state'] == 1) $this->error('订单已成功支付,请确认');
+        $time = time();
+
+        file_put_contents("applePay.txt", "\n" . date("Y-m-d H:i:s", $time) . ",支付凭证:" . $receipt, FILE_APPEND);$jsonItem = json_encode(['receipt-data' => $receipt]);
+
+        $url = 'https://buy.itunes.apple.com/verifyReceipt';      //正式
+        //模拟post提交(下面会贴出来),将前端获取到的凭证,去和苹果换取详细的支付信息
+        $result = $this->http_post_json($jsonItem, $url);
+        if ($result['status'] == '21007') {
+            //验证失败 返回app错误状态
+            $url = 'https://sandbox.itunes.apple.com/verifyReceipt';  //测试
+            $result = $this->http_post_json($jsonItem, $url);
+        }
+        file_put_contents("applePay.txt", json_encode($result) . "\n" . "\n", FILE_APPEND);
+        //如果检测到 等于 0 就是支付成功,其他的错误码去获取对应错误信息
+        if ($result['status'] !== 0) {
+            //验证失败 返回app错误状态
+            $this->error($this->appleCode[$result['status']]);
+        }
+
+
+        //接下来就是做自己的业务逻辑
+
+        $this->success('充值成功');
+    }
+
+
+    //模拟post提交
+    public function http_post_json($json, $url)
+    {
+        $ch = curl_init($url);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+        curl_setopt($ch, CURLOPT_POST, true);
+        curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);  //这两行一定要加,不加会报SSL 错误
+        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
+        $response = curl_exec($ch);
+        $errno = curl_errno($ch);
+        $errmsg = curl_error($ch);
+        curl_close($ch);
+        $data = json_decode($response, true);
+        return $data;
+    }
+
+
+
+
+
+
+
+}

+ 18 - 0
application/api/controller/Publics.php

@@ -166,4 +166,22 @@ class Publics extends Base
         $this->success('成功',$array);
     }
 
+
+
+
+    /**
+     * @title 云钱包提现设置
+     * @desc 云钱包提现设置
+     * @url /api/Publics/getCloudWalletConfig
+     * @method POST
+     * @tag 基础
+     * @return name:cloud_min type:float desc:最小提现金额
+     * @return name:cloud_max type:float desc:最大提现金额
+     * @return name:cloud_fee type:int desc:提现手续费【固定金额】
+     **/
+
+    public function getCloudWalletConfig()
+    {
+        $this->success('成功',['cloud_min'=>5,'cloud_max'=>1000,'cloud_fee'=>2]);
+    }
 }