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

修改订单

... ... @@ -88,8 +88,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="-2195">
<caret line="251" column="0" lean-forward="true" selection-start-line="251" selection-start-column="0" selection-end-line="251" selection-end-column="0" />
<state relative-caret-position="450">
<caret line="344" column="64" lean-forward="false" selection-start-line="344" selection-start-column="64" selection-end-line="344" selection-end-column="64" />
<folding>
<element signature="e#574#693#0#PHP" expanded="false" />
<element signature="e#699#1012#0#PHP" expanded="false" />
... ... @@ -99,17 +99,18 @@
<element signature="e#5512#5930#0#PHP" expanded="false" />
<element signature="e#6179#6269#0#PHP" expanded="false" />
<element signature="e#6347#6443#0#PHP" expanded="false" />
<element signature="e#12255#14030#0#PHP" expanded="false" />
<element signature="e#14103#14523#0#PHP" expanded="false" />
<element signature="e#14528#22620#0#PHP" expanded="false" />
<element signature="e#22637#22934#0#PHP" expanded="false" />
<element signature="e#22939#23332#0#PHP" expanded="false" />
<element signature="e#23359#26837#0#PHP" expanded="false" />
<element signature="e#26866#29771#0#PHP" expanded="false" />
<element signature="e#31771#33208#0#PHP" expanded="false" />
<element signature="e#32230#33186#0#PHP" expanded="false" />
<element signature="e#35598#37346#0#PHP" expanded="false" />
<element signature="e#37854#38071#0#PHP" expanded="false" />
<element signature="e#11858#13633#0#PHP" expanded="false" />
<element signature="e#13706#14126#0#PHP" expanded="false" />
<element signature="e#21801#22098#0#PHP" expanded="false" />
<element signature="e#22103#22496#0#PHP" expanded="false" />
<element signature="e#22523#26001#0#PHP" expanded="false" />
<element signature="e#26030#28935#0#PHP" expanded="false" />
<element signature="e#28964#32883#0#PHP" expanded="false" />
<element signature="e#30935#32372#0#PHP" expanded="false" />
<element signature="e#31394#32350#0#PHP" expanded="false" />
<element signature="e#32912#36995#0#PHP" expanded="false" />
<element signature="e#34762#36510#0#PHP" expanded="false" />
<element signature="e#37018#37235#0#PHP" expanded="false" />
</folding>
</state>
</provider>
... ... @@ -333,7 +334,7 @@
<workItem from="1575541798312" duration="2359000" />
<workItem from="1575592025964" duration="640000" />
<workItem from="1575599624364" duration="95000" />
<workItem from="1575680867057" duration="12030000" />
<workItem from="1575680867057" duration="12355000" />
</task>
<task id="LOCAL-00001" summary="调试">
<created>1574145133364</created>
... ... @@ -346,7 +347,7 @@
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="321929000" />
<option name="totallyTimeSpent" value="322254000" />
</component>
<component name="TodoView">
<todo-panel id="selected-file">
... ... @@ -367,7 +368,7 @@
<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="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.24265505" 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.15669206" 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" />
... ... @@ -854,8 +855,8 @@
</entry>
<entry file="file://$PROJECT_DIR$/application/api/controller/Pay.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-2195">
<caret line="251" column="0" lean-forward="true" selection-start-line="251" selection-start-column="0" selection-end-line="251" selection-end-column="0" />
<state relative-caret-position="450">
<caret line="344" column="64" lean-forward="false" selection-start-line="344" selection-start-column="64" selection-end-line="344" selection-end-column="64" />
<folding>
<element signature="e#574#693#0#PHP" expanded="false" />
<element signature="e#699#1012#0#PHP" expanded="false" />
... ... @@ -865,17 +866,18 @@
<element signature="e#5512#5930#0#PHP" expanded="false" />
<element signature="e#6179#6269#0#PHP" expanded="false" />
<element signature="e#6347#6443#0#PHP" expanded="false" />
<element signature="e#12255#14030#0#PHP" expanded="false" />
<element signature="e#14103#14523#0#PHP" expanded="false" />
<element signature="e#14528#22620#0#PHP" expanded="false" />
<element signature="e#22637#22934#0#PHP" expanded="false" />
<element signature="e#22939#23332#0#PHP" expanded="false" />
<element signature="e#23359#26837#0#PHP" expanded="false" />
<element signature="e#26866#29771#0#PHP" expanded="false" />
<element signature="e#31771#33208#0#PHP" expanded="false" />
<element signature="e#32230#33186#0#PHP" expanded="false" />
<element signature="e#35598#37346#0#PHP" expanded="false" />
<element signature="e#37854#38071#0#PHP" expanded="false" />
<element signature="e#11858#13633#0#PHP" expanded="false" />
<element signature="e#13706#14126#0#PHP" expanded="false" />
<element signature="e#21801#22098#0#PHP" expanded="false" />
<element signature="e#22103#22496#0#PHP" expanded="false" />
<element signature="e#22523#26001#0#PHP" expanded="false" />
<element signature="e#26030#28935#0#PHP" expanded="false" />
<element signature="e#28964#32883#0#PHP" expanded="false" />
<element signature="e#30935#32372#0#PHP" expanded="false" />
<element signature="e#31394#32350#0#PHP" expanded="false" />
<element signature="e#32912#36995#0#PHP" expanded="false" />
<element signature="e#34762#36510#0#PHP" expanded="false" />
<element signature="e#37018#37235#0#PHP" expanded="false" />
</folding>
</state>
</provider>
... ...
... ... @@ -189,31 +189,25 @@ class Pay extends Api
}
$money = $res['money'] - $data['total'];
$uid = $this->uid;
$login = Db::name('user')
->where('id',$uid)
->field('id,is_vip')
->find();
// 启动事务
Db::startTrans();
try{
if(!empty($pic_id)){
//将购买次数加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($login['is_vip'] == 0){
$pic = Db::name('pic')->field('id,price,buy_num,money')->where('id',$v)->find();
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$pic['money']+$pic['price']]);
if($user['is_vip'] == 0){
$money = $pic['money'] + $pic['price'];
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$money]);
}else{
//是会员
$pic = Db::name('pic')->field('id,price,buy_num,money')->where('id',$v)->find();
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$pic['money']+$pic['price']]);
$money = $pic['money'] + $pic['price'] * 0.75;
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$money]);
}
}
//拼接发送短信的内容
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
... ... @@ -349,32 +343,25 @@ class Pay extends Api
$this->error(['code'=>2,'msg'=>'余额不足,请充值后重试']);
}
$money = $res['money'] - $data['total'];
$uid = $this->uid;
$login = Db::name('user')
->where('id',$uid)
->field('id,is_vip')
->find();
// 启动事务
Db::startTrans();
try{
if(!empty($pic_id)){
//修改购买次数
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($login['is_vip'] == 0){
$pic = Db::name('pic')->field('id,price,buy_num,money')->where('id',$v)->find();
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$pic['money']+$pic['price']]);
if($user['is_vip'] == 0){
$money = $pic['money'] + $pic['price'];
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$money]);
}else{
//是会员
$pic = Db::name('pic')->field('id,price,buy_num,money')->where('id',$v)->find();
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$pic['money']+$pic['price']]);
$money = $pic['money'] + $pic['price'] * 0.75;
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$money]);
}
}
//拼接发送短信内容
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)){
//修改购买次数
... ...
... ... @@ -6612,7 +6612,7 @@
<div class="row mt0 footer">
<div class="col-md-6" align="left">
Generated on 2019-12-07 13:30:24 </div>
Generated on 2019-12-07 13:36:02 </div>
<div class="col-md-6" align="right">
<a href="https://www.fastadmin.net" target="_blank">FastAdmin</a>
</div>
... ...