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

修改总金额

@@ -88,8 +88,8 @@ @@ -88,8 +88,8 @@
88 <file leaf-file-name="Pay.php" pinned="false" current-in-tab="true"> 88 <file leaf-file-name="Pay.php" pinned="false" current-in-tab="true">
89 <entry file="file://$PROJECT_DIR$/application/api/controller/Pay.php"> 89 <entry file="file://$PROJECT_DIR$/application/api/controller/Pay.php">
90 <provider selected="true" editor-type-id="text-editor"> 90 <provider selected="true" editor-type-id="text-editor">
91 - <state relative-caret-position="129">  
92 - <caret line="195" column="41" lean-forward="true" selection-start-line="195" selection-start-column="41" selection-end-line="195" selection-end-column="41" /> 91 + <state relative-caret-position="702">
  92 + <caret line="212" column="64" lean-forward="false" selection-start-line="212" selection-start-column="64" selection-end-line="212" selection-end-column="64" />
93 <folding> 93 <folding>
94 <element signature="e#574#693#0#PHP" expanded="false" /> 94 <element signature="e#574#693#0#PHP" expanded="false" />
95 <element signature="e#699#1012#0#PHP" expanded="false" /> 95 <element signature="e#699#1012#0#PHP" expanded="false" />
@@ -99,19 +99,22 @@ @@ -99,19 +99,22 @@
99 <element signature="e#5512#5930#0#PHP" expanded="false" /> 99 <element signature="e#5512#5930#0#PHP" expanded="false" />
100 <element signature="e#6179#6269#0#PHP" expanded="false" /> 100 <element signature="e#6179#6269#0#PHP" expanded="false" />
101 <element signature="e#6347#6443#0#PHP" expanded="false" /> 101 <element signature="e#6347#6443#0#PHP" expanded="false" />
102 - <element signature="e#11994#13769#0#PHP" expanded="false" />  
103 - <element signature="e#13842#14262#0#PHP" expanded="false" />  
104 - <element signature="e#14267#21920#0#PHP" expanded="false" />  
105 - <element signature="e#21937#22234#0#PHP" expanded="false" />  
106 - <element signature="e#22239#22632#0#PHP" expanded="false" />  
107 - <element signature="e#22659#26137#0#PHP" expanded="false" />  
108 - <element signature="e#26166#29071#0#PHP" expanded="false" />  
109 - <element signature="e#29100#33019#0#PHP" expanded="false" />  
110 - <element signature="e#31071#32508#0#PHP" expanded="false" />  
111 - <element signature="e#31530#32486#0#PHP" expanded="false" />  
112 - <element signature="e#33048#37131#0#PHP" expanded="false" />  
113 - <element signature="e#34898#36646#0#PHP" expanded="false" />  
114 - <element signature="e#37154#37371#0#PHP" expanded="false" /> 102 + <element signature="e#9132#11216#0#PHP" expanded="false" />
  103 + <element signature="e#11280#11398#0#PHP" expanded="false" />
  104 + <element signature="e#12255#14030#0#PHP" expanded="false" />
  105 + <element signature="e#14103#14523#0#PHP" expanded="false" />
  106 + <element signature="e#14528#22620#0#PHP" expanded="false" />
  107 + <element signature="e#22637#22934#0#PHP" expanded="false" />
  108 + <element signature="e#22939#23332#0#PHP" expanded="false" />
  109 + <element signature="e#23359#26837#0#PHP" expanded="false" />
  110 + <element signature="e#26866#29771#0#PHP" expanded="false" />
  111 + <element signature="e#29800#33863#0#PHP" expanded="false" />
  112 + <element signature="e#31623#31872#0#PHP" expanded="false" />
  113 + <element signature="e#31915#33352#0#PHP" expanded="false" />
  114 + <element signature="e#32374#33330#0#PHP" expanded="false" />
  115 + <element signature="e#33892#38355#0#PHP" expanded="false" />
  116 + <element signature="e#36122#37870#0#PHP" expanded="false" />
  117 + <element signature="e#38378#38595#0#PHP" expanded="false" />
115 </folding> 118 </folding>
116 </state> 119 </state>
117 </provider> 120 </provider>
@@ -203,9 +206,9 @@ @@ -203,9 +206,9 @@
203 <sorting>DEFINITION_ORDER</sorting> 206 <sorting>DEFINITION_ORDER</sorting>
204 </component> 207 </component>
205 <component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" /> 208 <component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
206 - <component name="ProjectFrameBounds" extendedState="7">  
207 - <option name="x" value="307" />  
208 - <option name="y" value="132" /> 209 + <component name="ProjectFrameBounds">
  210 + <option name="x" value="120" />
  211 + <option name="y" value="42" />
209 <option name="width" value="1700" /> 212 <option name="width" value="1700" />
210 <option name="height" value="1000" /> 213 <option name="height" value="1000" />
211 </component> 214 </component>
@@ -335,7 +338,7 @@ @@ -335,7 +338,7 @@
335 <workItem from="1575541798312" duration="2359000" /> 338 <workItem from="1575541798312" duration="2359000" />
336 <workItem from="1575592025964" duration="640000" /> 339 <workItem from="1575592025964" duration="640000" />
337 <workItem from="1575599624364" duration="95000" /> 340 <workItem from="1575599624364" duration="95000" />
338 - <workItem from="1575680867057" duration="12522000" /> 341 + <workItem from="1575680867057" duration="12849000" />
339 </task> 342 </task>
340 <task id="LOCAL-00001" summary="调试"> 343 <task id="LOCAL-00001" summary="调试">
341 <created>1574145133364</created> 344 <created>1574145133364</created>
@@ -348,7 +351,7 @@ @@ -348,7 +351,7 @@
348 <servers /> 351 <servers />
349 </component> 352 </component>
350 <component name="TimeTrackingManager"> 353 <component name="TimeTrackingManager">
351 - <option name="totallyTimeSpent" value="322421000" /> 354 + <option name="totallyTimeSpent" value="322748000" />
352 </component> 355 </component>
353 <component name="TodoView"> 356 <component name="TodoView">
354 <todo-panel id="selected-file"> 357 <todo-panel id="selected-file">
@@ -360,10 +363,10 @@ @@ -360,10 +363,10 @@
360 </todo-panel> 363 </todo-panel>
361 </component> 364 </component>
362 <component name="ToolWindowManager"> 365 <component name="ToolWindowManager">
363 - <frame x="-8" y="-8" width="1936" height="1056" extended-state="7" /> 366 + <frame x="120" y="42" width="1700" height="1000" extended-state="0" />
364 <editor active="true" /> 367 <editor active="true" />
365 <layout> 368 <layout>
366 - <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.1705757" sideWeight="0.5" order="1" side_tool="false" content_ui="combo" /> 369 + <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.19512194" sideWeight="0.5" order="1" side_tool="false" content_ui="combo" />
367 <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" /> 370 <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" />
368 <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" /> 371 <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" />
369 <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" /> 372 <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" />
@@ -857,8 +860,8 @@ @@ -857,8 +860,8 @@
857 </entry> 860 </entry>
858 <entry file="file://$PROJECT_DIR$/application/api/controller/Pay.php"> 861 <entry file="file://$PROJECT_DIR$/application/api/controller/Pay.php">
859 <provider selected="true" editor-type-id="text-editor"> 862 <provider selected="true" editor-type-id="text-editor">
860 - <state relative-caret-position="129">  
861 - <caret line="195" column="41" lean-forward="true" selection-start-line="195" selection-start-column="41" selection-end-line="195" selection-end-column="41" /> 863 + <state relative-caret-position="702">
  864 + <caret line="212" column="64" lean-forward="false" selection-start-line="212" selection-start-column="64" selection-end-line="212" selection-end-column="64" />
862 <folding> 865 <folding>
863 <element signature="e#574#693#0#PHP" expanded="false" /> 866 <element signature="e#574#693#0#PHP" expanded="false" />
864 <element signature="e#699#1012#0#PHP" expanded="false" /> 867 <element signature="e#699#1012#0#PHP" expanded="false" />
@@ -868,19 +871,22 @@ @@ -868,19 +871,22 @@
868 <element signature="e#5512#5930#0#PHP" expanded="false" /> 871 <element signature="e#5512#5930#0#PHP" expanded="false" />
869 <element signature="e#6179#6269#0#PHP" expanded="false" /> 872 <element signature="e#6179#6269#0#PHP" expanded="false" />
870 <element signature="e#6347#6443#0#PHP" expanded="false" /> 873 <element signature="e#6347#6443#0#PHP" expanded="false" />
871 - <element signature="e#11994#13769#0#PHP" expanded="false" />  
872 - <element signature="e#13842#14262#0#PHP" expanded="false" />  
873 - <element signature="e#14267#21920#0#PHP" expanded="false" />  
874 - <element signature="e#21937#22234#0#PHP" expanded="false" />  
875 - <element signature="e#22239#22632#0#PHP" expanded="false" />  
876 - <element signature="e#22659#26137#0#PHP" expanded="false" />  
877 - <element signature="e#26166#29071#0#PHP" expanded="false" />  
878 - <element signature="e#29100#33019#0#PHP" expanded="false" />  
879 - <element signature="e#31071#32508#0#PHP" expanded="false" />  
880 - <element signature="e#31530#32486#0#PHP" expanded="false" />  
881 - <element signature="e#33048#37131#0#PHP" expanded="false" />  
882 - <element signature="e#34898#36646#0#PHP" expanded="false" />  
883 - <element signature="e#37154#37371#0#PHP" expanded="false" /> 874 + <element signature="e#9132#11216#0#PHP" expanded="false" />
  875 + <element signature="e#11280#11398#0#PHP" expanded="false" />
  876 + <element signature="e#12255#14030#0#PHP" expanded="false" />
  877 + <element signature="e#14103#14523#0#PHP" expanded="false" />
  878 + <element signature="e#14528#22620#0#PHP" expanded="false" />
  879 + <element signature="e#22637#22934#0#PHP" expanded="false" />
  880 + <element signature="e#22939#23332#0#PHP" expanded="false" />
  881 + <element signature="e#23359#26837#0#PHP" expanded="false" />
  882 + <element signature="e#26866#29771#0#PHP" expanded="false" />
  883 + <element signature="e#29800#33863#0#PHP" expanded="false" />
  884 + <element signature="e#31623#31872#0#PHP" expanded="false" />
  885 + <element signature="e#31915#33352#0#PHP" expanded="false" />
  886 + <element signature="e#32374#33330#0#PHP" expanded="false" />
  887 + <element signature="e#33892#38355#0#PHP" expanded="false" />
  888 + <element signature="e#36122#37870#0#PHP" expanded="false" />
  889 + <element signature="e#38378#38595#0#PHP" expanded="false" />
884 </folding> 890 </folding>
885 </state> 891 </state>
886 </provider> 892 </provider>
@@ -191,6 +191,7 @@ class Pay extends Api @@ -191,6 +191,7 @@ class Pay extends Api
191 $uid = $this->uid; 191 $uid = $this->uid;
192 $login = Db::name('user') 192 $login = Db::name('user')
193 ->where('id',$uid) 193 ->where('id',$uid)
  194 + ->field('id,is_vip')
194 ->find(); 195 ->find();
195 // 启动事务 196 // 启动事务
196 Db::startTrans(); 197 Db::startTrans();
@@ -198,19 +199,21 @@ class Pay extends Api @@ -198,19 +199,21 @@ class Pay extends Api
198 if(!empty($pic_id)){ 199 if(!empty($pic_id)){
199 //将购买次数加1 200 //将购买次数加1
200 foreach ($pic_id as $key => $v){ 201 foreach ($pic_id as $key => $v){
201 - //拼接发送短信的内容  
202 - $pic = Db::name('pic')->field('id,title,url,code')->where('id',$v)->find();  
203 - $str .= "图片标题:$pic[title],云盘地址:$pic[url],提取码:$pic[code],";  
204 //非会员 202 //非会员
205 if($login['is_vip'] == 0){ 203 if($login['is_vip'] == 0){
206 - $money = $pic['money'] + $pic['price'];  
207 - Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$money]); 204 + $pic = Db::name('pic')->field('id,price,buy_num,money')->where('id',$v)->find();
  205 + Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$pic['money']+$pic['price']]);
208 }else{ 206 }else{
209 //是会员 207 //是会员
210 - $money = $pic['money'] + $pic['price'] * 0.75;  
211 - Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$money]); 208 + $pic = Db::name('pic')->field('id,price,buy_num,money')->where('id',$v)->find();
  209 + Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$pic['money']+$pic['price']]);
212 } 210 }
213 } 211 }
  212 + //拼接发送短信的内容
  213 + foreach ($pic_id as $key => $v){
  214 + $pic = Db::name('pic')->field('id,title,url,code')->where('id',$v)->find();
  215 + $str .= "图片标题:$pic[title],云盘地址:$pic[url],提取码:$pic[code],";
  216 + }
214 } 217 }
215 if(!empty($video_id)){ 218 if(!empty($video_id)){
216 //将购买次数加1 219 //将购买次数加1
@@ -346,25 +349,32 @@ class Pay extends Api @@ -346,25 +349,32 @@ class Pay extends Api
346 $this->error(['code'=>2,'msg'=>'余额不足,请充值后重试']); 349 $this->error(['code'=>2,'msg'=>'余额不足,请充值后重试']);
347 } 350 }
348 $money = $res['money'] - $data['total']; 351 $money = $res['money'] - $data['total'];
  352 + $uid = $this->uid;
  353 + $login = Db::name('user')
  354 + ->where('id',$uid)
  355 + ->field('id,is_vip')
  356 + ->find();
349 // 启动事务 357 // 启动事务
350 Db::startTrans(); 358 Db::startTrans();
351 try{ 359 try{
352 if(!empty($pic_id)){ 360 if(!empty($pic_id)){
353 //修改购买次数 361 //修改购买次数
354 foreach ($pic_id as $key => $v){ 362 foreach ($pic_id as $key => $v){
355 - //拼接发送短信的内容  
356 - $pic = Db::name('pic')->field('id,title,url,code')->where('id',$v)->find();  
357 - $str .= "图片标题:$pic[title],云盘地址:$pic[url],提取码:$pic[code],";  
358 //非会员 363 //非会员
359 - if($user['is_vip'] == 0){  
360 - $money = $pic['money'] + $pic['price'];  
361 - Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$money]); 364 + if($login['is_vip'] == 0){
  365 + $pic = Db::name('pic')->field('id,price,buy_num,money')->where('id',$v)->find();
  366 + Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$pic['money']+$pic['price']]);
362 }else{ 367 }else{
363 //是会员 368 //是会员
364 - $money = $pic['money'] + $pic['price'] * 0.75;  
365 - Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$money]); 369 + $pic = Db::name('pic')->field('id,price,buy_num,money')->where('id',$v)->find();
  370 + Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$pic['money']+$pic['price']]);
366 } 371 }
367 } 372 }
  373 + //拼接发送短信内容
  374 + foreach ($pic_id as $key => $v){
  375 + $pic = Db::name('pic')->field('id,title,url,code')->where('id',$v)->find();
  376 + $str .= "图片标题:$pic[title],云盘地址:$pic[url],提取码:$pic[code],";
  377 + }
368 } 378 }
369 if(!empty($video_id)){ 379 if(!empty($video_id)){
370 //修改购买次数 380 //修改购买次数
@@ -647,19 +657,19 @@ class Pay extends Api @@ -647,19 +657,19 @@ class Pay extends Api
647 //判断用户是否为会员 657 //判断用户是否为会员
648 if(!empty($pic_id)){ 658 if(!empty($pic_id)){
649 foreach ($pic_id as $key => $v){ 659 foreach ($pic_id as $key => $v){
650 - //短信内容  
651 - $pic = Db::name('pic')->field('id,title,url,code,price,buy_num,money')->where('id',$v)->find();  
652 - $str .= "图片标题:$pic[title],云盘地址:$pic[url],提取码:$pic[code],";  
653 //非会员 660 //非会员
654 if($user['is_vip'] == 0){ 661 if($user['is_vip'] == 0){
655 - $money = $pic['money'] + $pic['price'];  
656 - Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$money]); 662 + $pic = Db::name('pic')->field('id,price,buy_num,money')->where('id',$v)->find();
  663 + Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$pic['money']+$pic['price']]);
657 }else{ 664 }else{
658 //是会员 665 //是会员
659 - $money = $pic['money'] + $pic['price'] * 0.75;  
660 - Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$money]); 666 + $pic = Db::name('pic')->field('id,price,buy_num,money')->where('id',$v)->find();
  667 + Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$pic['money']+$pic['price']]);
661 } 668 }
662 - 669 + }
  670 + foreach ($pic_id as $key => $v){
  671 + $pic = Db::name('pic')->field('id,title,url,code')->where('id',$v)->find();
  672 + $str .= "图片标题:$pic[title],云盘地址:$pic[url],提取码:$pic[code],";
663 } 673 }
664 } 674 }
665 if(!empty($video_id)){ 675 if(!empty($video_id)){
@@ -720,21 +730,29 @@ class Pay extends Api @@ -720,21 +730,29 @@ class Pay extends Api
720 $user = Db::name('user')->where('id',$data['user_id'])->find(); 730 $user = Db::name('user')->where('id',$data['user_id'])->find();
721 $mobile = $user['mobile']; 731 $mobile = $user['mobile'];
722 $str = "【仁甲看见】"; 732 $str = "【仁甲看见】";
  733 +
  734 + //判断用户是否为会员
  735 + $login = Db::name('user')
  736 + ->where('id',$data['user_id'])
  737 + ->field('id,is_vip')
  738 + ->find();
  739 +
723 if(!empty($pic_id)){ 740 if(!empty($pic_id)){
724 foreach ($pic_id as $key => $v){ 741 foreach ($pic_id as $key => $v){
725 - //短信内容  
726 - $pic = Db::name('pic')->field('id,title,url,code')->where('id',$v)->find();  
727 - $str .= "图片标题:$pic[title],云盘地址:$pic[url],提取码:$pic[code],";  
728 //非会员 742 //非会员
729 - if($user['is_vip'] == 0){  
730 - $money = $pic['money'] + $pic['price'];  
731 - Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$money]); 743 + if($login['is_vip'] == 0){
  744 + $pic = Db::name('pic')->field('id,price,buy_num,money')->where('id',$v)->find();
  745 + Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$pic['money']+$pic['price']]);
732 }else{ 746 }else{
733 //是会员 747 //是会员
734 - $money = $pic['money'] + $pic['price'] * 0.75;  
735 - Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$money]); 748 + $pic = Db::name('pic')->field('id,price,buy_num,money')->where('id',$v)->find();
  749 + Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$pic['money']+$pic['price']]);
736 } 750 }
737 } 751 }
  752 + foreach ($pic_id as $key => $v){
  753 + $pic = Db::name('pic')->field('id,title,url,code')->where('id',$v)->find();
  754 + $str .= "图片标题:$pic[title],云盘地址:$pic[url],提取码:$pic[code],";
  755 + }
738 } 756 }
739 if(!empty($video_id)){ 757 if(!empty($video_id)){
740 foreach ($video_id as $key => $val){ 758 foreach ($video_id as $key => $val){