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

修改支付

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="e93f11c2-a7d9-4d35-8b1c-8dd18e7f5fef" name="Default" comment="" />
<list default="true" id="e93f11c2-a7d9-4d35-8b1c-8dd18e7f5fef" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/application/api/controller/Pay.php" afterPath="$PROJECT_DIR$/application/api/controller/Pay.php" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
... ... @@ -14,7 +17,7 @@
<file leaf-file-name="User.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/application/api/controller/User.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="614">
<state relative-caret-position="1702">
<caret line="1584" column="5" lean-forward="true" selection-start-line="1584" selection-start-column="5" selection-end-line="1584" selection-end-column="5" />
<folding>
<element signature="e#365#484#0#PHP" expanded="false" />
... ... @@ -89,8 +92,8 @@
<file leaf-file-name="Pay.php" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/application/api/controller/Pay.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2214">
<caret line="720" column="25" lean-forward="true" selection-start-line="720" selection-start-column="25" selection-end-line="720" selection-end-column="25" />
<state relative-caret-position="-748">
<caret line="364" column="40" lean-forward="true" selection-start-line="364" selection-start-column="40" selection-end-line="364" selection-end-column="40" />
<folding>
<element signature="e#38#68#0#PHP" expanded="true" />
<element signature="e#472#591#0#PHP" expanded="false" />
... ... @@ -99,32 +102,33 @@
<element signature="e#2966#3286#0#PHP" expanded="false" />
<element signature="e#3291#5342#0#PHP" expanded="false" />
<element signature="e#5348#5766#0#PHP" expanded="false" />
<element signature="e#5771#12687#0#PHP" expanded="false" />
<element signature="e#10876#12620#0#PHP" expanded="false" />
<element signature="e#12704#13001#0#PHP" expanded="false" />
<element signature="e#13007#13402#0#PHP" expanded="false" />
<element signature="e#13408#13828#0#PHP" expanded="false" />
<element signature="e#13833#20820#0#PHP" expanded="false" />
<element signature="e#19006#20752#0#PHP" expanded="false" />
<element signature="e#20847#24549#0#PHP" expanded="false" />
<element signature="e#24579#27523#0#PHP" expanded="false" />
<element signature="e#27552#30975#0#PHP" expanded="false" />
<element signature="e#34764#34981#0#PHP" expanded="false" />
<element signature="e#5771#13038#0#PHP" expanded="false" />
<element signature="e#7407#7695#0#PHP" expanded="false" />
<element signature="e#7772#8045#0#PHP" expanded="false" />
<element signature="e#8201#8511#0#PHP" expanded="false" />
<element signature="e#8586#9037#0#PHP" expanded="false" />
<element signature="e#9114#10158#0#PHP" expanded="false" />
<element signature="e#10252#10370#0#PHP" expanded="false" />
<element signature="e#13055#13352#0#PHP" expanded="false" />
<element signature="e#13358#13753#0#PHP" expanded="false" />
<element signature="e#13759#14179#0#PHP" expanded="false" />
<element signature="e#15818#16106#0#PHP" expanded="false" />
<element signature="e#16182#16455#0#PHP" expanded="false" />
<element signature="e#16610#16920#0#PHP" expanded="false" />
<element signature="e#16995#17446#0#PHP" expanded="false" />
<element signature="e#17523#18567#0#PHP" expanded="false" />
<element signature="e#18661#18779#0#PHP" expanded="false" />
<element signature="e#19636#21382#0#PHP" expanded="false" />
<element signature="e#21477#25179#0#PHP" expanded="false" />
<element signature="e#25209#28153#0#PHP" expanded="false" />
<element signature="e#28182#31605#0#PHP" expanded="false" />
<element signature="e#31634#35371#0#PHP" expanded="false" />
<element signature="e#35394#35611#0#PHP" expanded="false" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Backend.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/application/common/controller/Backend.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="125">
<caret line="5" column="17" lean-forward="true" selection-start-line="5" selection-start-column="17" selection-end-line="5" selection-end-column="17" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FindInProjectRecents">
... ... @@ -206,8 +210,8 @@
</component>
<component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
<component name="ProjectFrameBounds" extendedState="1">
<option name="x" value="141" />
<option name="y" value="49" />
<option name="x" value="-33" />
<option name="y" value="37" />
<option name="width" value="1776" />
<option name="height" value="1014" />
</component>
... ... @@ -238,6 +242,19 @@
<item name="areial" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="application" type="2a2b976b:PhpTreeStructureProvider$1" />
</path>
<path>
<item name="areial" type="b2602c69:ProjectViewProjectNode" />
<item name="areial" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="application" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="api" type="2a2b976b:PhpTreeStructureProvider$1" />
</path>
<path>
<item name="areial" type="b2602c69:ProjectViewProjectNode" />
<item name="areial" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="application" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="api" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="controller" type="2a2b976b:PhpTreeStructureProvider$1" />
</path>
</expand>
<select />
</subPane>
... ... @@ -248,7 +265,7 @@
</component>
<component name="PropertiesComponent">
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../project/zhaozhao" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../scrap1/scrap" />
</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
... ... @@ -300,7 +317,7 @@
<workItem from="1574469667436" duration="25235000" />
<workItem from="1574641631900" duration="15479000" />
<workItem from="1574669596135" duration="11747000" />
<workItem from="1574727687281" duration="15711000" />
<workItem from="1574727687281" duration="17586000" />
</task>
<task id="LOCAL-00001" summary="调试">
<created>1574145133364</created>
... ... @@ -313,7 +330,7 @@
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="245982000" />
<option name="totallyTimeSpent" value="247857000" />
</component>
<component name="TodoView">
<todo-panel id="selected-file">
... ... @@ -325,16 +342,16 @@
</todo-panel>
</component>
<component name="ToolWindowManager">
<frame x="141" y="49" width="1776" height="1014" extended-state="1" />
<frame x="-33" y="37" width="1776" height="1014" extended-state="1" />
<layout>
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.14160839" sideWeight="0.5" order="1" side_tool="false" content_ui="combo" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.14160839" sideWeight="0.5" order="1" 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.32912987" sideWeight="0.5" order="9" 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.33" sideWeight="0.5" order="0" 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="0" 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="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="true" weight="0.33" 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="2" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.12884834" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.12884834" sideWeight="0.5" order="2" 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="6" 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="0" 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="7" side_tool="false" content_ui="tabs" />
... ... @@ -721,9 +738,36 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/extend/nsms/nsms.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="350">
<caret line="14" column="13" lean-forward="false" selection-start-line="14" selection-start-column="13" selection-end-line="14" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/application/common/controller/Backend.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="125">
<caret line="5" column="17" lean-forward="true" selection-start-line="5" selection-start-column="17" selection-end-line="5" selection-end-column="17" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/application/nsms/nsms.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="283">
<caret line="15" column="13" lean-forward="false" selection-start-line="15" selection-start-column="13" selection-end-line="15" selection-end-column="13" />
<folding>
<element signature="e#461#1049#0#PHP" expanded="false" />
<element signature="e#1055#2041#0#PHP" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/application/api/controller/User.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="614">
<state relative-caret-position="1702">
<caret line="1584" column="5" lean-forward="true" selection-start-line="1584" selection-start-column="5" selection-end-line="1584" selection-end-column="5" />
<folding>
<element signature="e#365#484#0#PHP" expanded="false" />
... ... @@ -794,38 +838,10 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/extend/nsms/nsms.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="350">
<caret line="14" column="13" lean-forward="false" selection-start-line="14" selection-start-column="13" selection-end-line="14" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/application/common/controller/Backend.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="125">
<caret line="5" column="17" lean-forward="true" selection-start-line="5" selection-start-column="17" selection-end-line="5" selection-end-column="17" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/application/nsms/nsms.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="388">
<caret line="61" column="20" lean-forward="false" selection-start-line="61" selection-start-column="20" selection-end-line="61" selection-end-column="20" />
<folding>
<element signature="e#294#455#0#PHP" expanded="false" />
<element signature="e#461#1049#0#PHP" expanded="false" />
<element signature="e#1055#2041#0#PHP" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/application/api/controller/Pay.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2214">
<caret line="720" column="25" lean-forward="true" selection-start-line="720" selection-start-column="25" selection-end-line="720" selection-end-column="25" />
<state relative-caret-position="-748">
<caret line="364" column="40" lean-forward="true" selection-start-line="364" selection-start-column="40" selection-end-line="364" selection-end-column="40" />
<folding>
<element signature="e#38#68#0#PHP" expanded="true" />
<element signature="e#472#591#0#PHP" expanded="false" />
... ... @@ -834,17 +850,28 @@
<element signature="e#2966#3286#0#PHP" expanded="false" />
<element signature="e#3291#5342#0#PHP" expanded="false" />
<element signature="e#5348#5766#0#PHP" expanded="false" />
<element signature="e#5771#12687#0#PHP" expanded="false" />
<element signature="e#10876#12620#0#PHP" expanded="false" />
<element signature="e#12704#13001#0#PHP" expanded="false" />
<element signature="e#13007#13402#0#PHP" expanded="false" />
<element signature="e#13408#13828#0#PHP" expanded="false" />
<element signature="e#13833#20820#0#PHP" expanded="false" />
<element signature="e#19006#20752#0#PHP" expanded="false" />
<element signature="e#20847#24549#0#PHP" expanded="false" />
<element signature="e#24579#27523#0#PHP" expanded="false" />
<element signature="e#27552#30975#0#PHP" expanded="false" />
<element signature="e#34764#34981#0#PHP" expanded="false" />
<element signature="e#5771#13038#0#PHP" expanded="false" />
<element signature="e#7407#7695#0#PHP" expanded="false" />
<element signature="e#7772#8045#0#PHP" expanded="false" />
<element signature="e#8201#8511#0#PHP" expanded="false" />
<element signature="e#8586#9037#0#PHP" expanded="false" />
<element signature="e#9114#10158#0#PHP" expanded="false" />
<element signature="e#10252#10370#0#PHP" expanded="false" />
<element signature="e#13055#13352#0#PHP" expanded="false" />
<element signature="e#13358#13753#0#PHP" expanded="false" />
<element signature="e#13759#14179#0#PHP" expanded="false" />
<element signature="e#15818#16106#0#PHP" expanded="false" />
<element signature="e#16182#16455#0#PHP" expanded="false" />
<element signature="e#16610#16920#0#PHP" expanded="false" />
<element signature="e#16995#17446#0#PHP" expanded="false" />
<element signature="e#17523#18567#0#PHP" expanded="false" />
<element signature="e#18661#18779#0#PHP" expanded="false" />
<element signature="e#19636#21382#0#PHP" expanded="false" />
<element signature="e#21477#25179#0#PHP" expanded="false" />
<element signature="e#25209#28153#0#PHP" expanded="false" />
<element signature="e#28182#31605#0#PHP" expanded="false" />
<element signature="e#31634#35371#0#PHP" expanded="false" />
<element signature="e#35394#35611#0#PHP" expanded="false" />
</folding>
</state>
</provider>
... ...
... ... @@ -175,9 +175,11 @@ class Pay extends Api
if($data['status'] == 2){
$this->error('该订单已支付过了');
}else{
//查看该用户的信息
$res = Db::name('user')
->where('id',$data['user_id'])
->find();
//判断总价是否正确
if($data['total'] > $res['money']){
$this->error(['code'=>2,'msg'=>'余额不足,请充值后重试']);
}
... ... @@ -187,12 +189,24 @@ class Pay extends Api
Db::startTrans();
try{
if(!empty($pic_id)){
//将购买次数加1
foreach ($pic_id as $key => $v){
$pic = Db::name('pic')->field('id,buy_num')->where('id',$v)->find();
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1]);
}
//拼接发送短信的内容
foreach ($pic_id as $key => $v){
$pic = Db::name('pic')->field('id,title,url,code')->where('id',$v)->find();
$str .= "图片标题:$pic[title],云盘地址:$pic[url],提取码:$pic[code],";
}
}
if(!empty($video_id)){
//将购买次数加1
foreach ($video_id as $key => $val){
$video = Db::name('video')->field('id,buy_num')->where('id',$val['id'])->find();
Db::name('video')->where('id',$video['id'])->update(['buy_num'=>$video['buy_num']+1]);
}
//判断视频的属性
foreach ($video_id as &$val){
if($val['attr'] == 1){
$val['attr'] = '2k';
... ... @@ -202,6 +216,7 @@ class Pay extends Api
$val['attr'] = '8k';
}
}
//拼接发送短信的内容
foreach ($video_id as $k=>$v){
if($v['attr'] == '4k'){
$video = Db::name('video')->field('id,title,four_url,four_code')->where('id',$v['id'])->find();
... ... @@ -215,18 +230,11 @@ class Pay extends Api
}
}
}
//发送短信
if(!empty($mobile)){
$result = $this->sms($mobile,$str);
}
foreach ($pic_id as $key => $v){
$pic = Db::name('pic')->field('id,buy_num')->where('id',$v)->find();
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1]);
}
foreach ($video_id as $key => $val){
$video = Db::name('video')->field('id,buy_num')->where('id',$val['id'])->find();
Db::name('video')->where('id',$video['id'])->update(['buy_num'=>$video['buy_num']+1]);
}
$arr = Db::name('user')->where('id',$data['user_id'])->update(['money'=>$money]);
$res = Db::name('order')->where('id',$order_id)->update(['status'=>2,'paytime'=>time()]);
if($res && $arr){
... ... @@ -354,12 +362,24 @@ class Pay extends Api
Db::startTrans();
try{
if(!empty($pic_id)){
//修改购买次数
foreach ($pic_id as $key => $v){
$pic = Db::name('pic')->field('id,buy_num')->where('id',$v)->find();
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1]);
}
//拼接发送短信内容
foreach ($pic_id as $key => $v){
$pic = Db::name('pic')->field('id,title,url,code')->where('id',$v)->find();
$str .= "图片标题:$pic[title],云盘地址:$pic[url],提取码:$pic[code],";
}
}
if(!empty($video_id)){
//修改购买次数
foreach ($video_id as $key => $val){
$video = Db::name('video')->field('id,buy_num')->where('id',$val['id'])->find();
Db::name('video')->where('id',$video['id'])->update(['buy_num'=>$video['buy_num']+1]);
}
//判断视频的属性
foreach ($video_id as &$val){
if($val['attr'] == 1){
$val['attr'] = '2k';
... ... @@ -369,6 +389,7 @@ class Pay extends Api
$val['attr'] = '8k';
}
}
//拼接发送短信的内容
foreach ($video_id as $k=>$v){
if($v['attr'] == '4k'){
$video = Db::name('video')->field('id,title,four_url,four_code')->where('id',$v['id'])->find();
... ... @@ -382,17 +403,11 @@ class Pay extends Api
}
}
}
//发送短信
if(!empty($mobile)){
$result = $this->sms($mobile,$str);
}
foreach ($pic_id as $key => $v){
$pic = Db::name('pic')->field('id,buy_num')->where('id',$v)->find();
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1]);
}
foreach ($video_id as $key => $val){
$video = Db::name('video')->field('id,buy_num')->where('id',$val['id'])->find();
Db::name('video')->where('id',$video['id'])->update(['buy_num'=>$video['buy_num']+1]);
}
$arr = Db::name('user')->where('id',$data['user_id'])->update(['money'=>$money]);
$res = Db::name('order')->where('id',$order_id)->update(['status'=>2,'paytime'=>time()]);
if($res && $arr){
... ...
... ... @@ -6384,7 +6384,7 @@
<div class="row mt0 footer">
<div class="col-md-6" align="left">
Generated on 2019-11-26 13:41:10 </div>
Generated on 2019-11-26 17:01:35 </div>
<div class="col-md-6" align="right">
<a href="https://www.fastadmin.net" target="_blank">FastAdmin</a>
</div>
... ...