作者 郭盛
1 个管道 的构建 通过 耗费 1 秒

微信支付

... ... @@ -5,7 +5,6 @@
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/api/index/controller/OrderController.php" afterPath="$PROJECT_DIR$/api/index/controller/OrderController.php" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/api/index/controller/PayController.php" afterPath="$PROJECT_DIR$/api/index/controller/PayController.php" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/api/index/controller/UserController.php" afterPath="$PROJECT_DIR$/api/index/controller/UserController.php" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
... ... @@ -27,99 +26,36 @@
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="UserController.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/api/index/controller/UserController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="66">
<caret line="99" column="7" lean-forward="true" selection-start-line="99" selection-start-column="7" selection-end-line="99" selection-end-column="7" />
<folding>
<element signature="e#366#715#0#PHP" expanded="false" />
<element signature="e#720#1532#0#PHP" expanded="false" />
<element signature="e#1538#1796#0#PHP" expanded="false" />
<element signature="e#1801#2184#0#PHP" expanded="false" />
<element signature="e#2190#2419#0#PHP" expanded="false" />
<element signature="e#2424#4059#0#PHP" expanded="false" />
<element signature="e#4065#4305#0#PHP" expanded="false" />
<element signature="e#4310#4545#0#PHP" expanded="false" />
<element signature="e#4551#4898#0#PHP" expanded="false" />
<element signature="e#4903#5349#0#PHP" expanded="false" />
<element signature="e#5355#5615#0#PHP" expanded="false" />
<element signature="e#5620#5821#0#PHP" expanded="false" />
<element signature="e#5827#6089#0#PHP" expanded="false" />
<element signature="e#6094#6299#0#PHP" expanded="false" />
<element signature="e#6305#6784#0#PHP" expanded="false" />
<element signature="e#6789#8908#0#PHP" expanded="false" />
<element signature="e#8931#9462#0#PHP" expanded="false" />
<element signature="e#9468#9748#0#PHP" expanded="false" />
<element signature="e#9753#10145#0#PHP" expanded="false" />
<element signature="e#10151#10435#0#PHP" expanded="false" />
<element signature="e#10440#11479#0#PHP" expanded="false" />
<element signature="e#11485#11773#0#PHP" expanded="false" />
<element signature="e#11778#12813#0#PHP" expanded="false" />
<element signature="e#12819#13400#0#PHP" expanded="false" />
<element signature="e#13405#14793#0#PHP" expanded="false" />
<element signature="e#14799#15255#0#PHP" expanded="false" />
<element signature="e#15260#17223#0#PHP" expanded="false" />
<element signature="e#17246#17601#0#PHP" expanded="false" />
<element signature="e#17607#18320#0#PHP" expanded="false" />
<element signature="e#18325#19782#0#PHP" expanded="false" />
<element signature="e#19788#20249#0#PHP" expanded="false" />
<element signature="e#20254#23276#0#PHP" expanded="false" />
<element signature="e#23282#23891#0#PHP" expanded="false" />
<element signature="e#23896#25181#0#PHP" expanded="false" />
<element signature="e#25187#25544#0#PHP" expanded="false" />
<element signature="e#25549#26430#0#PHP" expanded="false" />
<element signature="e#26436#26788#0#PHP" expanded="false" />
<element signature="e#26793#27871#0#PHP" expanded="false" />
<element signature="e#27877#28232#0#PHP" expanded="false" />
<element signature="e#28237#29331#0#PHP" expanded="false" />
<element signature="e#29337#29761#0#PHP" expanded="false" />
<element signature="e#29766#30377#0#PHP" expanded="false" />
<element signature="e#30383#30879#0#PHP" expanded="false" />
<element signature="e#30884#32581#0#PHP" expanded="false" />
<element signature="e#32587#32871#0#PHP" expanded="false" />
<element signature="e#32876#33512#0#PHP" expanded="false" />
<element signature="e#33533#33852#0#PHP" expanded="false" />
<element signature="e#33858#34266#0#PHP" expanded="false" />
<element signature="e#34272#35031#0#PHP" expanded="false" />
<element signature="e#35050#35914#0#PHP" expanded="false" />
<element signature="e#35940#36340#0#PHP" expanded="false" />
<element signature="e#36363#36936#0#PHP" expanded="false" />
<element signature="e#36959#37769#0#PHP" expanded="false" />
<element signature="e#37775#38374#0#PHP" expanded="false" />
<element signature="e#38379#39343#0#PHP" expanded="false" />
<element signature="e#39349#40016#0#PHP" expanded="false" />
<element signature="e#40021#41062#0#PHP" expanded="false" />
<element signature="e#41068#41731#0#PHP" expanded="false" />
<element signature="e#41736#42763#0#PHP" expanded="false" />
<element signature="e#42770#43201#0#PHP" expanded="false" />
<element signature="e#43206#43784#0#PHP" expanded="false" />
<element signature="e#43790#44219#0#PHP" expanded="false" />
<element signature="e#44224#44826#0#PHP" expanded="false" />
<element signature="e#44832#45259#0#PHP" expanded="false" />
<element signature="e#45264#45830#0#PHP" expanded="false" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="OrderController.php" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/api/index/controller/OrderController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="480">
<caret line="91" column="26" lean-forward="false" selection-start-line="91" selection-start-column="26" selection-end-line="91" selection-end-column="26" />
<state relative-caret-position="650">
<caret line="110" column="40" lean-forward="true" selection-start-line="110" selection-start-column="40" selection-end-line="110" selection-end-column="40" />
<folding>
<element signature="e#131#162#0#PHP" expanded="true" />
<element signature="e#336#608#0#PHP" expanded="false" />
<element signature="e#614#976#0#PHP" expanded="false" />
<element signature="e#981#2020#0#PHP" expanded="false" />
<element signature="e#2026#2263#0#PHP" expanded="false" />
<element signature="e#2268#2965#0#PHP" expanded="false" />
<element signature="e#2971#3213#0#PHP" expanded="false" />
<element signature="e#3219#3557#0#PHP" expanded="false" />
<element signature="e#3562#4434#0#PHP" expanded="false" />
<element signature="e#4440#4919#0#PHP" expanded="false" />
<element signature="e#4924#5491#0#PHP" expanded="false" />
<element signature="e#3069#3407#0#PHP" expanded="false" />
<element signature="e#3412#4284#0#PHP" expanded="false" />
<element signature="e#4290#4769#0#PHP" expanded="false" />
<element signature="e#4774#5341#0#PHP" expanded="false" />
<element signature="e#5347#5589#0#PHP" expanded="false" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="WeixinPay.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/simplewind/extend/wxapp/pay/WeixinPay.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1770">
<caret line="28" column="37" lean-forward="true" selection-start-line="28" selection-start-column="37" selection-end-line="28" selection-end-column="37" />
<folding>
<element signature="e#4049#4323#0#PHP" expanded="false" />
<element signature="e#4342#4805#0#PHP" expanded="false" />
<element signature="e#4835#5267#0#PHP" expanded="false" />
</folding>
</state>
</provider>
... ... @@ -128,14 +64,12 @@
<file leaf-file-name="PayController.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/api/index/controller/PayController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="305">
<caret line="60" column="0" lean-forward="true" selection-start-line="60" selection-start-column="0" selection-end-line="60" selection-end-column="0" />
<state relative-caret-position="-200">
<caret line="4" column="4" lean-forward="false" selection-start-line="4" selection-start-column="4" selection-end-line="4" selection-end-column="4" />
<folding>
<element signature="e#324#855#0#PHP" expanded="false" />
<element signature="e#861#925#0#PHP" expanded="false" />
<element signature="e#930#1763#0#PHP" expanded="false" />
<element signature="e#1769#1850#0#PHP" expanded="false" />
<element signature="e#1855#3907#0#PHP" expanded="false" />
<element signature="e#3914#3937#0#PHP" expanded="false" />
<element signature="e#3942#4201#0#PHP" expanded="false" />
<element signature="e#4208#4257#0#PHP" expanded="false" />
... ... @@ -215,9 +149,9 @@
<option value="$PROJECT_DIR$/app/admin/controller/PointController.php" />
<option value="$PROJECT_DIR$/simplewind/cmf/common.php" />
<option value="$PROJECT_DIR$/simplewind/extend/wxapp/pay/WeixinPay.php" />
<option value="$PROJECT_DIR$/api/index/controller/OrderController.php" />
<option value="$PROJECT_DIR$/api/index/controller/PayController.php" />
<option value="$PROJECT_DIR$/api/index/controller/UserController.php" />
<option value="$PROJECT_DIR$/api/index/controller/PayController.php" />
<option value="$PROJECT_DIR$/api/index/controller/OrderController.php" />
</list>
</option>
</component>
... ... @@ -236,8 +170,8 @@
</component>
<component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
<component name="ProjectFrameBounds" extendedState="1">
<option name="x" value="117" />
<option name="y" value="124" />
<option name="x" value="52" />
<option name="y" value="31" />
<option name="width" value="1814" />
<option name="height" value="1042" />
</component>
... ... @@ -414,15 +348,15 @@
<workItem from="1575506248144" duration="15103000" />
<workItem from="1575527294268" duration="10705000" />
<workItem from="1575543830603" duration="2980000" />
<workItem from="1575592067577" duration="6259000" />
<workItem from="1575592067577" duration="7358000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="501756000" />
<option name="totallyTimeSpent" value="502855000" />
</component>
<component name="ToolWindowManager">
<frame x="117" y="124" width="1814" height="1042" extended-state="1" />
<frame x="52" y="31" width="1814" height="1042" extended-state="1" />
<editor active="true" />
<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.15621437" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
... ... @@ -476,13 +410,6 @@
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/public/themes/admin_simpleboot3/admin/rtype/edit.html">
<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$/app/admin/controller/ShoptypeController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="148">
... ... @@ -874,14 +801,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/simplewind/cmf/common.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="802">
<caret line="1850" column="1" lean-forward="false" selection-start-line="1850" selection-start-column="1" selection-end-line="1850" selection-end-column="1" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/simplewind/vendor/overtrue/wechat/src/Foundation/Application.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="291">
... ... @@ -890,36 +809,30 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/simplewind/extend/wxapp/pay/WeixinPay.php">
<entry file="file://$PROJECT_DIR$/simplewind/vendor/overtrue/wechat/src/Payment/Order.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="97">
<caret line="104" column="21" lean-forward="false" selection-start-line="104" selection-start-column="21" selection-end-line="104" selection-end-column="21" />
<folding>
<element signature="e#4049#4323#0#PHP" expanded="false" />
<element signature="e#4342#4805#0#PHP" expanded="false" />
<element signature="e#4835#5267#0#PHP" expanded="false" />
</folding>
<state relative-caret-position="679">
<caret line="78" column="20" lean-forward="false" selection-start-line="78" selection-start-column="20" selection-end-line="78" selection-end-column="20" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/simplewind/vendor/overtrue/wechat/src/Payment/Order.php">
<entry file="file://$PROJECT_DIR$/simplewind/vendor/overtrue/wechat/src/Payment/API.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="679">
<caret line="78" column="20" lean-forward="false" selection-start-line="78" selection-start-column="20" selection-end-line="78" selection-end-column="20" />
<state relative-caret-position="293">
<caret line="124" column="20" lean-forward="false" selection-start-line="124" selection-start-column="20" selection-end-line="124" selection-end-column="20" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/api/index/controller/PayController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="305">
<caret line="60" column="0" lean-forward="true" selection-start-line="60" selection-start-column="0" selection-end-line="60" selection-end-column="0" />
<state relative-caret-position="-200">
<caret line="4" column="4" lean-forward="false" selection-start-line="4" selection-start-column="4" selection-end-line="4" selection-end-column="4" />
<folding>
<element signature="e#324#855#0#PHP" expanded="false" />
<element signature="e#861#925#0#PHP" expanded="false" />
<element signature="e#930#1763#0#PHP" expanded="false" />
<element signature="e#1769#1850#0#PHP" expanded="false" />
<element signature="e#1855#3907#0#PHP" expanded="false" />
<element signature="e#3914#3937#0#PHP" expanded="false" />
<element signature="e#3942#4201#0#PHP" expanded="false" />
<element signature="e#4208#4257#0#PHP" expanded="false" />
... ... @@ -932,7 +845,7 @@
</entry>
<entry file="file://$PROJECT_DIR$/api/index/controller/UserController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="66">
<state relative-caret-position="500">
<caret line="99" column="7" lean-forward="true" selection-start-line="99" selection-start-column="7" selection-end-line="99" selection-end-column="7" />
<folding>
<element signature="e#366#715#0#PHP" expanded="false" />
... ... @@ -1004,22 +917,41 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/simplewind/cmf/common.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="540">
<caret line="1844" column="9" lean-forward="false" selection-start-line="1844" selection-start-column="9" selection-end-line="1844" selection-end-column="9" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/simplewind/extend/wxapp/pay/WeixinPay.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1770">
<caret line="28" column="37" lean-forward="true" selection-start-line="28" selection-start-column="37" selection-end-line="28" selection-end-column="37" />
<folding>
<element signature="e#4049#4323#0#PHP" expanded="false" />
<element signature="e#4342#4805#0#PHP" expanded="false" />
<element signature="e#4835#5267#0#PHP" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/api/index/controller/OrderController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="480">
<caret line="91" column="26" lean-forward="false" selection-start-line="91" selection-start-column="26" selection-end-line="91" selection-end-column="26" />
<state relative-caret-position="650">
<caret line="110" column="40" lean-forward="true" selection-start-line="110" selection-start-column="40" selection-end-line="110" selection-end-column="40" />
<folding>
<element signature="e#131#162#0#PHP" expanded="true" />
<element signature="e#336#608#0#PHP" expanded="false" />
<element signature="e#614#976#0#PHP" expanded="false" />
<element signature="e#981#2020#0#PHP" expanded="false" />
<element signature="e#2026#2263#0#PHP" expanded="false" />
<element signature="e#2268#2965#0#PHP" expanded="false" />
<element signature="e#2971#3213#0#PHP" expanded="false" />
<element signature="e#3219#3557#0#PHP" expanded="false" />
<element signature="e#3562#4434#0#PHP" expanded="false" />
<element signature="e#4440#4919#0#PHP" expanded="false" />
<element signature="e#4924#5491#0#PHP" expanded="false" />
<element signature="e#3069#3407#0#PHP" expanded="false" />
<element signature="e#3412#4284#0#PHP" expanded="false" />
<element signature="e#4290#4769#0#PHP" expanded="false" />
<element signature="e#4774#5341#0#PHP" expanded="false" />
<element signature="e#5347#5589#0#PHP" expanded="false" />
</folding>
</state>
</provider>
... ...
... ... @@ -100,23 +100,15 @@ class OrderController extends RestBaseController
$where['user_id'] = ['eq',$user_id];
$data = Db::name('order')->where($where)->find();
if(empty($data)){
$this->error(['code'=>41001,'msg'=>'数据错误']);
$this->error(['code'=>41001,'msg'=>'数据错误,没有此订单']);
}
if($data['status'] == 2){
$this->error('您已经支付过了,无需重复支付');
}
//微信支付
$openid = $this->getOpenid();
$pay = new WeixinPay();
$this->success('SUCCESS',$pay->pay($openid['openid'],$data['num'],"废品回收",$data['total'],cmf_api_url('index/pay/notify','','',true)));
}
public function getOpenid()
{
$user_id = $this->getUserId();
$openid = Db::name('third_party_user')
->where('user_id',$user_id)
->field('openid')
->find();
return $openid;
$this->success('SUCCESS',$pay->pay($openid['openid'],$data['num'],"废品回收",$data['total']*100,cmf_api_url('index/pay/notify','','',true)));
}
/**
... ... @@ -192,4 +184,15 @@ class OrderController extends RestBaseController
}
$this->success('SUCCESS',$list);
}
public function getOpenid()
{
$user_id = $this->getUserId();
$openid = Db::name('third_party_user')
->where('user_id',$user_id)
->field('openid')
->find();
return $openid;
}
}
\ No newline at end of file
... ...