作者 王晓刚
1 个管道 的构建 通过 耗费 1 秒

调试提现

@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 <project version="4"> 2 <project version="4">
3 <component name="ChangeListManager"> 3 <component name="ChangeListManager">
4 <list default="true" id="309ad746-5b2a-4c29-af46-e7925a35765c" name="默认的" comment=""> 4 <list default="true" id="309ad746-5b2a-4c29-af46-e7925a35765c" name="默认的" comment="">
  5 + <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
5 <change beforePath="$PROJECT_DIR$/application/admin/controller/UserMoneyLogAudit.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/admin/controller/UserMoneyLogAudit.php" afterDir="false" /> 6 <change beforePath="$PROJECT_DIR$/application/admin/controller/UserMoneyLogAudit.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/admin/controller/UserMoneyLogAudit.php" afterDir="false" />
6 </list> 7 </list>
7 <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> 8 <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@@ -49,8 +50,8 @@ @@ -49,8 +50,8 @@
49 <file leaf-file-name="UserMoneyLogAudit.php" pinned="false" current-in-tab="true"> 50 <file leaf-file-name="UserMoneyLogAudit.php" pinned="false" current-in-tab="true">
50 <entry file="file://$PROJECT_DIR$/application/admin/controller/UserMoneyLogAudit.php"> 51 <entry file="file://$PROJECT_DIR$/application/admin/controller/UserMoneyLogAudit.php">
51 <provider selected="true" editor-type-id="text-editor"> 52 <provider selected="true" editor-type-id="text-editor">
52 - <state relative-caret-position="453">  
53 - <caret line="155" column="35" selection-start-line="155" selection-start-column="35" selection-end-line="155" selection-end-column="35" /> 53 + <state relative-caret-position="504">
  54 + <caret line="130" column="25" lean-forward="true" selection-start-line="130" selection-start-column="25" selection-end-line="130" selection-end-column="25" />
54 <folding> 55 <folding>
55 <element signature="e#40#74#0#PHP" expanded="true" /> 56 <element signature="e#40#74#0#PHP" expanded="true" />
56 </folding> 57 </folding>
@@ -61,8 +62,8 @@ @@ -61,8 +62,8 @@
61 <file leaf-file-name="wechat.php" pinned="false" current-in-tab="false"> 62 <file leaf-file-name="wechat.php" pinned="false" current-in-tab="false">
62 <entry file="file://$PROJECT_DIR$/application/extra/wechat.php"> 63 <entry file="file://$PROJECT_DIR$/application/extra/wechat.php">
63 <provider selected="true" editor-type-id="text-editor"> 64 <provider selected="true" editor-type-id="text-editor">
64 - <state relative-caret-position="595">  
65 - <caret line="50" column="18" selection-start-line="50" selection-start-column="9" selection-end-line="50" selection-end-column="18" /> 65 + <state relative-caret-position="833">
  66 + <caret line="49" column="65" selection-start-line="49" selection-start-column="65" selection-end-line="49" selection-end-column="65" />
66 </state> 67 </state>
67 </provider> 68 </provider>
68 </entry> 69 </entry>
@@ -131,7 +132,6 @@ @@ -131,7 +132,6 @@
131 <component name="IdeDocumentHistory"> 132 <component name="IdeDocumentHistory">
132 <option name="CHANGED_PATHS"> 133 <option name="CHANGED_PATHS">
133 <list> 134 <list>
134 - <option value="$PROJECT_DIR$/application/home/controller/Upload.php" />  
135 <option value="$PROJECT_DIR$/application/home/controller/Share.php" /> 135 <option value="$PROJECT_DIR$/application/home/controller/Share.php" />
136 <option value="$PROJECT_DIR$/application/home/controller/Member.php" /> 136 <option value="$PROJECT_DIR$/application/home/controller/Member.php" />
137 <option value="$PROJECT_DIR$/.gitlab-ci.yml" /> 137 <option value="$PROJECT_DIR$/.gitlab-ci.yml" />
@@ -181,6 +181,7 @@ @@ -181,6 +181,7 @@
181 <option value="$PROJECT_DIR$/public/assets/js/backend/user_money_log_audit.js" /> 181 <option value="$PROJECT_DIR$/public/assets/js/backend/user_money_log_audit.js" />
182 <option value="$PROJECT_DIR$/application/admin/view/user_money_log_audit/edit.html" /> 182 <option value="$PROJECT_DIR$/application/admin/view/user_money_log_audit/edit.html" />
183 <option value="$PROJECT_DIR$/application/admin/controller/PayView.php" /> 183 <option value="$PROJECT_DIR$/application/admin/controller/PayView.php" />
  184 + <option value="$PROJECT_DIR$/application/extra/wechat.php" />
184 <option value="$PROJECT_DIR$/application/admin/controller/UserMoneyLogAudit.php" /> 185 <option value="$PROJECT_DIR$/application/admin/controller/UserMoneyLogAudit.php" />
185 </list> 186 </list>
186 </option> 187 </option>
@@ -266,6 +267,17 @@ @@ -266,6 +267,17 @@
266 <path> 267 <path>
267 <item name="advertising" type="b2602c69:ProjectViewProjectNode" /> 268 <item name="advertising" type="b2602c69:ProjectViewProjectNode" />
268 <item name="advertising" type="462c0819:PsiDirectoryNode" /> 269 <item name="advertising" type="462c0819:PsiDirectoryNode" />
  270 + <item name="application" type="462c0819:PsiDirectoryNode" />
  271 + </path>
  272 + <path>
  273 + <item name="advertising" type="b2602c69:ProjectViewProjectNode" />
  274 + <item name="advertising" type="462c0819:PsiDirectoryNode" />
  275 + <item name="application" type="462c0819:PsiDirectoryNode" />
  276 + <item name="extra" type="462c0819:PsiDirectoryNode" />
  277 + </path>
  278 + <path>
  279 + <item name="advertising" type="b2602c69:ProjectViewProjectNode" />
  280 + <item name="advertising" type="462c0819:PsiDirectoryNode" />
269 <item name="public" type="462c0819:PsiDirectoryNode" /> 281 <item name="public" type="462c0819:PsiDirectoryNode" />
270 </path> 282 </path>
271 <path> 283 <path>
@@ -336,7 +348,7 @@ @@ -336,7 +348,7 @@
336 <workItem from="1572087949120" duration="1641000" /> 348 <workItem from="1572087949120" duration="1641000" />
337 <workItem from="1572223206994" duration="28857000" /> 349 <workItem from="1572223206994" duration="28857000" />
338 <workItem from="1572309778506" duration="26117000" /> 350 <workItem from="1572309778506" duration="26117000" />
339 - <workItem from="1572395935540" duration="9942000" /> 351 + <workItem from="1572395935540" duration="10986000" />
340 </task> 352 </task>
341 <task id="LOCAL-00001" summary="数据库配置"> 353 <task id="LOCAL-00001" summary="数据库配置">
342 <created>1571972429395</created> 354 <created>1571972429395</created>
@@ -548,11 +560,32 @@ @@ -548,11 +560,32 @@
548 <option name="project" value="LOCAL" /> 560 <option name="project" value="LOCAL" />
549 <updated>1572416100217</updated> 561 <updated>1572416100217</updated>
550 </task> 562 </task>
551 - <option name="localTasksCounter" value="31" /> 563 + <task id="LOCAL-00031" summary="调试提现">
  564 + <created>1572416152695</created>
  565 + <option name="number" value="00031" />
  566 + <option name="presentableId" value="LOCAL-00031" />
  567 + <option name="project" value="LOCAL" />
  568 + <updated>1572416152695</updated>
  569 + </task>
  570 + <task id="LOCAL-00032" summary="调试提现">
  571 + <created>1572416234275</created>
  572 + <option name="number" value="00032" />
  573 + <option name="presentableId" value="LOCAL-00032" />
  574 + <option name="project" value="LOCAL" />
  575 + <updated>1572416234275</updated>
  576 + </task>
  577 + <task id="LOCAL-00033" summary="调试提现">
  578 + <created>1572416277819</created>
  579 + <option name="number" value="00033" />
  580 + <option name="presentableId" value="LOCAL-00033" />
  581 + <option name="project" value="LOCAL" />
  582 + <updated>1572416277819</updated>
  583 + </task>
  584 + <option name="localTasksCounter" value="34" />
552 <servers /> 585 <servers />
553 </component> 586 </component>
554 <component name="TimeTrackingManager"> 587 <component name="TimeTrackingManager">
555 - <option name="totallyTimeSpent" value="195167000" /> 588 + <option name="totallyTimeSpent" value="196211000" />
556 </component> 589 </component>
557 <component name="ToolWindowManager"> 590 <component name="ToolWindowManager">
558 <frame x="-8" y="-8" width="1936" height="1056" extended-state="6" /> 591 <frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
@@ -936,13 +969,6 @@ @@ -936,13 +969,6 @@
936 </state> 969 </state>
937 </provider> 970 </provider>
938 </entry> 971 </entry>
939 - <entry file="file://$PROJECT_DIR$/application/extra/wechat.php">  
940 - <provider selected="true" editor-type-id="text-editor">  
941 - <state relative-caret-position="595">  
942 - <caret line="50" column="18" selection-start-line="50" selection-start-column="9" selection-end-line="50" selection-end-column="18" />  
943 - </state>  
944 - </provider>  
945 - </entry>  
946 <entry file="file://$PROJECT_DIR$/public/assets/js/backend/user_money_log.js"> 972 <entry file="file://$PROJECT_DIR$/public/assets/js/backend/user_money_log.js">
947 <provider selected="true" editor-type-id="text-editor"> 973 <provider selected="true" editor-type-id="text-editor">
948 <state relative-caret-position="544"> 974 <state relative-caret-position="544">
@@ -964,10 +990,17 @@ @@ -964,10 +990,17 @@
964 </state> 990 </state>
965 </provider> 991 </provider>
966 </entry> 992 </entry>
  993 + <entry file="file://$PROJECT_DIR$/application/extra/wechat.php">
  994 + <provider selected="true" editor-type-id="text-editor">
  995 + <state relative-caret-position="833">
  996 + <caret line="49" column="65" selection-start-line="49" selection-start-column="65" selection-end-line="49" selection-end-column="65" />
  997 + </state>
  998 + </provider>
  999 + </entry>
967 <entry file="file://$PROJECT_DIR$/application/admin/controller/UserMoneyLogAudit.php"> 1000 <entry file="file://$PROJECT_DIR$/application/admin/controller/UserMoneyLogAudit.php">
968 <provider selected="true" editor-type-id="text-editor"> 1001 <provider selected="true" editor-type-id="text-editor">
969 - <state relative-caret-position="453">  
970 - <caret line="155" column="35" selection-start-line="155" selection-start-column="35" selection-end-line="155" selection-end-column="35" /> 1002 + <state relative-caret-position="504">
  1003 + <caret line="130" column="25" lean-forward="true" selection-start-line="130" selection-start-column="25" selection-end-line="130" selection-end-column="25" />
971 <folding> 1004 <folding>
972 <element signature="e#40#74#0#PHP" expanded="true" /> 1005 <element signature="e#40#74#0#PHP" expanded="true" />
973 </folding> 1006 </folding>
@@ -111,24 +111,33 @@ class UserMoneyLogAudit extends Backend @@ -111,24 +111,33 @@ class UserMoneyLogAudit extends Backend
111 if(empty($params['type'])){ 111 if(empty($params['type'])){
112 $this->error("请选择审核状态"); 112 $this->error("请选择审核状态");
113 } 113 }
114 -// $result = $row->allowField(true)->save($params); 114 + $admin = Db::name('admin')->where(['id'=>$row['admin_id']])->find();
115 if($params['type'] == 2){ 115 if($params['type'] == 2){
116 //审核通过 116 //审核通过
117 - $admin = Db::name('admin')->where(['id'=>$row['admin_id']])->find();  
118 $user = Db::name('user')->where(['id'=>$admin['user_id']])->find(); 117 $user = Db::name('user')->where(['id'=>$admin['user_id']])->find();
119 $third = Db::name('third')->where(['user_id'=>$admin['user_id']])->find(); 118 $third = Db::name('third')->where(['user_id'=>$admin['user_id']])->find();
120 //红包券充值比例 119 //红包券充值比例
121 $exp_ratio = Db::name('exp_ratio')->where(['id'=>1])->find(); 120 $exp_ratio = Db::name('exp_ratio')->where(['id'=>1])->find();
122 $withdraw = $this->merchantPay($third['openid'],$user['nickname'],$row['money']*$exp_ratio['ratio']*0.01,'商户提现'); 121 $withdraw = $this->merchantPay($third['openid'],$user['nickname'],$row['money']*$exp_ratio['ratio']*0.01,'商户提现');
123 - dump($withdraw);  
124 if($withdraw['return_code'] == 'SUCCESS') { 122 if($withdraw['return_code'] == 'SUCCESS') {
125 if ($withdraw['result_code'] == 'SUCCESS') { 123 if ($withdraw['result_code'] == 'SUCCESS') {
126 - // 提现成功,将余额扣除 124 + // 提现成功
127 125
  126 + }else{
  127 + $this->error($withdraw['err_code_des']);
128 } 128 }
  129 + }else{
  130 + $this->error($withdraw['return_msg']);
  131 + }
  132 + }else if($params['type'] == 3){
  133 + //审核失败,返还红包券
  134 + $result1 = Db::name('admin')->where(['id'=>$row['admin_id']])->setInc('money',$row['money']);
  135 + if(empty($result1)){
  136 + Db::rollback();
  137 + $this->error('sql执行失败');
129 } 138 }
130 } 139 }
131 - exit(); 140 + $result = $row->allowField(true)->save($params);
132 Db::commit(); 141 Db::commit();
133 } catch (ValidateException $e) { 142 } catch (ValidateException $e) {
134 Db::rollback(); 143 Db::rollback();
@@ -154,7 +163,6 @@ class UserMoneyLogAudit extends Backend @@ -154,7 +163,6 @@ class UserMoneyLogAudit extends Backend
154 163
155 public function merchantPay($openid,$user_name,$price,$desc){ 164 public function merchantPay($openid,$user_name,$price,$desc){
156 $options = config('wechat'); 165 $options = config('wechat');
157 - dump($options);  
158 $app = new Application($options); 166 $app = new Application($options);
159 $merchantPay = $app->merchant_pay; 167 $merchantPay = $app->merchant_pay;
160 $merchantPayData = [ 168 $merchantPayData = [