切换导航条
此项目
正在载入...
登录
郭盛
/
areial
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
郭盛
5 years ago
提交
45752001ce2696d73a79ea835d76950a189dab3f
1 个父辈
bdb71ab2
1 个管道 的构建
通过
耗费 5 秒
修改微信支付
变更
3
构建
1
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
243 行增加
和
151 行删除
.idea/workspace.xml
application/api/controller/Pay.php
public/api.html
.idea/workspace.xml
查看文件 @
4575200
...
...
@@ -2,9 +2,8 @@
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"e93f11c2-a7d9-4d35-8b1c-8dd18e7f5fef"
name=
"Default"
comment=
""
>
<change
type=
"MODIFICATION"
beforePath=
"$PROJECT_DIR$/application/admin/lang/zh-cn/video.php"
afterPath=
"$PROJECT_DIR$/application/admin/lang/zh-cn/video.php"
/>
<change
type=
"MODIFICATION"
beforePath=
"$PROJECT_DIR$/application/api/controller/Pay.php"
afterPath=
"$PROJECT_DIR$/application/api/controller/Pay.php"
/>
<change
type=
"MODIFICATION"
beforePath=
"$PROJECT_DIR$/public/a
ssets/js/backend/video.js"
afterPath=
"$PROJECT_DIR$/public/assets/js/backend/video.js
"
/>
<change
type=
"MODIFICATION"
beforePath=
"$PROJECT_DIR$/public/a
pi.html"
afterPath=
"$PROJECT_DIR$/public/api.html
"
/>
</list>
<option
name=
"EXCLUDED_CONVERTED_TO_IGNORED"
value=
"true"
/>
<option
name=
"TRACKING_ENABLED"
value=
"true"
/>
...
...
@@ -91,8 +90,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=
"44"
>
<caret
line=
"408"
column=
"58"
lean-forward=
"true"
selection-start-line=
"408"
selection-start-column=
"58"
selection-end-line=
"408"
selection-end-column=
"58"
/>
<state
relative-caret-position=
"525"
>
<caret
line=
"312"
column=
"27"
lean-forward=
"true"
selection-start-line=
"312"
selection-start-column=
"27"
selection-end-line=
"312"
selection-end-column=
"27"
/>
<folding>
<element
signature=
"e#574#693#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#699#1012#0#PHP"
expanded=
"false"
/>
...
...
@@ -102,11 +101,12 @@
<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#6806#15962#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#7772#9181#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#11546#11997#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#13212#13330#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#14187#15962#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#16035#16455#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#16460#26484#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#18227#19634#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#23664#23782#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#24230#24461#0#PHP"
expanded=
"false"
/>
...
...
@@ -115,17 +115,27 @@
<element
signature=
"e#26803#27196#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#27223#30701#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#30730#33635#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#33664#37727#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#35779#37216#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#37264#37366#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#37756#42219#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#39986#41734#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#42242#42459#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#36003#39724#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#40902#48074#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#43168#46889#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#46945#47055#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#47331#47400#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#48097#48314#0#PHP"
expanded=
"false"
/>
</folding>
</state>
</provider>
</entry>
</file>
<file
leaf-file-name=
"07.log"
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/runtime/log/201912/07.log"
>
<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"
/>
<folding
/>
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component
name=
"FindInProjectRecents"
>
...
...
@@ -133,6 +143,7 @@
<find>
image
</find>
<find>
init($token)
</find>
<find>
BaseCli
</find>
<find>
picpay
</find>
</findStrings>
<dirStrings>
<dir>
D:\htdocs\areial
</dir>
...
...
@@ -144,7 +155,6 @@
<component
name=
"IdeDocumentHistory"
>
<option
name=
"CHANGED_PATHS"
>
<list>
<option
value=
"$PROJECT_DIR$/application/admin/model/Pic.php"
/>
<option
value=
"$PROJECT_DIR$/application/admin/model/Type.php"
/>
<option
value=
"$PROJECT_DIR$/application/admin/view/pic/index.html"
/>
<option
value=
"$PROJECT_DIR$/application/index/controller/User.php"
/>
...
...
@@ -195,6 +205,7 @@
<option
value=
"$PROJECT_DIR$/application/admin/lang/zh-cn/video.php"
/>
<option
value=
"$PROJECT_DIR$/public/assets/js/backend/video.js"
/>
<option
value=
"$PROJECT_DIR$/application/api/controller/Pay.php"
/>
<option
value=
"$PROJECT_DIR$/runtime/log/201912/07.log"
/>
</list>
</option>
</component>
...
...
@@ -213,10 +224,10 @@
</component>
<component
name=
"PhpWorkspaceProjectConfiguration"
backward_compatibility_performed=
"true"
/>
<component
name=
"ProjectFrameBounds"
extendedState=
"7"
>
<option
name=
"x"
value=
"221"
/>
<option
name=
"y"
value=
"64"
/>
<option
name=
"width"
value=
"1700"
/>
<option
name=
"height"
value=
"1100"
/>
<option
name=
"x"
value=
"-60"
/>
<option
name=
"y"
value=
"56"
/>
<option
name=
"width"
value=
"1871"
/>
<option
name=
"height"
value=
"1007"
/>
</component>
<component
name=
"ProjectView"
>
<navigator
currentView=
"ProjectPane"
proportions=
""
version=
"1"
>
...
...
@@ -243,33 +254,20 @@
<path>
<item
name=
"areial"
type=
"b2602c69:ProjectViewProjectNode"
/>
<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=
"admin"
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=
"runtime"
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"
/>
<item
name=
"runtime"
type=
"2a2b976b:PhpTreeStructureProvider$1"
/>
<item
name=
"log"
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=
"lang"
type=
"2a2b976b:PhpTreeStructureProvider$1"
/>
<item
name=
"runtime"
type=
"2a2b976b:PhpTreeStructureProvider$1"
/>
<item
name=
"log"
type=
"2a2b976b:PhpTreeStructureProvider$1"
/>
<item
name=
"201912"
type=
"2a2b976b:PhpTreeStructureProvider$1"
/>
</path>
</expand>
<select
/>
...
...
@@ -357,7 +355,7 @@
<workItem
from=
"1575541798312"
duration=
"2359000"
/>
<workItem
from=
"1575592025964"
duration=
"640000"
/>
<workItem
from=
"1575599624364"
duration=
"95000"
/>
<workItem
from=
"1575680867057"
duration=
"
1531
5000"
/>
<workItem
from=
"1575680867057"
duration=
"
2115
5000"
/>
</task>
<task
id=
"LOCAL-00001"
summary=
"调试"
>
<created>
1574145133364
</created>
...
...
@@ -370,7 +368,7 @@
<servers
/>
</component>
<component
name=
"TimeTrackingManager"
>
<option
name=
"totallyTimeSpent"
value=
"3
2521
4000"
/>
<option
name=
"totallyTimeSpent"
value=
"3
3105
4000"
/>
</component>
<component
name=
"TodoView"
>
<todo-panel
id=
"selected-file"
>
...
...
@@ -383,6 +381,7 @@
</component>
<component
name=
"ToolWindowManager"
>
<frame
x=
"-8"
y=
"-8"
width=
"1936"
height=
"1056"
extended-state=
"7"
/>
<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.1705757"
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"
/>
...
...
@@ -391,7 +390,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.16648531
"
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=
"false"
show_stripe_button=
"true"
weight=
"0.15886833
"
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"
/>
...
...
@@ -439,13 +438,6 @@
<watches-manager
/>
</component>
<component
name=
"editorHistoryManager"
>
<entry
file=
"file://$PROJECT_DIR$/application/admin/controller/Vip.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"568"
>
<caret
line=
"25"
column=
"5"
lean-forward=
"true"
selection-start-line=
"25"
selection-start-column=
"5"
selection-end-line=
"25"
selection-end-column=
"5"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/application/admin/lang/zh-cn/vip.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"200"
>
...
...
@@ -879,10 +871,18 @@
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/runtime/log/201912/07.log"
>
<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"
/>
<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=
"44"
>
<caret
line=
"408"
column=
"58"
lean-forward=
"true"
selection-start-line=
"408"
selection-start-column=
"58"
selection-end-line=
"408"
selection-end-column=
"58"
/>
<state
relative-caret-position=
"525"
>
<caret
line=
"312"
column=
"27"
lean-forward=
"true"
selection-start-line=
"312"
selection-start-column=
"27"
selection-end-line=
"312"
selection-end-column=
"27"
/>
<folding>
<element
signature=
"e#574#693#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#699#1012#0#PHP"
expanded=
"false"
/>
...
...
@@ -892,11 +892,12 @@
<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#6806#15962#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#7772#9181#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#11546#11997#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#13212#13330#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#14187#15962#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#16035#16455#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#16460#26484#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#18227#19634#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#23664#23782#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#24230#24461#0#PHP"
expanded=
"false"
/>
...
...
@@ -905,12 +906,12 @@
<element
signature=
"e#26803#27196#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#27223#30701#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#30730#33635#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#33664#37727#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#35779#37216#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#37264#37366#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#37756#42219#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#39986#41734#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#42242#42459#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#36003#39724#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#40902#48074#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#43168#46889#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#46945#47055#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#47331#47400#0#PHP"
expanded=
"false"
/>
<element
signature=
"e#48097#48314#0#PHP"
expanded=
"false"
/>
</folding>
</state>
</provider>
...
...
application/api/controller/Pay.php
查看文件 @
4575200
...
...
@@ -688,16 +688,14 @@ class Pay extends Api
//图片支付订单结果通知(无需调用)
public
function
picOrderNotify
(){
Log
::
info
(
'11111111'
);
$config
=
config
(
'verify.wx_pay'
);
$app
=
Factory
::
payment
(
$config
);
$response
=
$app
->
handlePaidNotify
(
function
(
$message
,
$fail
){
//return_code 表示通信状态
if
(
$message
[
'return_code'
]
===
'SUCCESS'
)
{
if
(
$message
[
'result_code'
]
===
'SUCCESS'
)
{
//支付成功,更新订单状态
$toporder
[
'status'
]
=
2
;
$toporder
[
'paytime'
]
=
time
();
Log
::
info
(
$message
);
//找到该订单信息
$data
=
Db
::
name
(
'order'
)
->
where
(
'id'
,
$message
[
'out_trade_no'
])
->
find
();
$pic_id
=
explode
(
','
,
$data
[
'pic_id'
]);
...
...
@@ -706,61 +704,113 @@ class Pay extends Api
$user
=
Db
::
name
(
'user'
)
->
where
(
'id'
,
$data
[
'user_id'
])
->
find
();
$mobile
=
$user
[
'mobile'
];
$str
=
"【仁甲看见】"
;
// 启动事务
Db
::
startTrans
();
try
{
if
(
!
empty
(
$pic_id
)){
//将购买次数加1
foreach
(
$pic_id
as
$key
=>
$v
){
//非会员
if
(
$user
[
'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'
]]);
}
else
{
//是会员
$pic
=
Db
::
name
(
'pic'
)
->
field
(
'id,price,buy_num,money'
)
->
where
(
'id'
,
$v
)
->
find
();
$total_money
=
$pic
[
'money'
]
+
(
$pic
[
'price'
]
*
0.75
);
Db
::
name
(
'pic'
)
->
where
(
'id'
,
$pic
[
'id'
])
->
update
([
'buy_num'
=>
$pic
[
'buy_num'
]
+
1
,
'money'
=>
$total_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
(
$pic_id
)){
foreach
(
$pic_id
as
$key
=>
$v
){
//非会员
if
(
!
empty
(
$video_id
)){
//判断是否为会员
if
(
$user
[
'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'
]]);
//不是会员的情况
//将购买次数加1
foreach
(
$video_id
as
$key
=>
$val
){
$video
=
Db
::
name
(
'video'
)
->
field
(
'id,buy_num,price,four_price,eight_price,money'
)
->
where
(
'id'
,
$val
[
'id'
])
->
find
();
if
(
$val
[
'attr'
]
==
1
){
$video_money
=
$video
[
'money'
]
+
$video
[
'price'
];
}
elseif
(
$val
[
'attr'
]
==
2
){
$video_money
=
$video
[
'money'
]
+
$video
[
'four_price'
];
}
else
{
$video_money
=
$video
[
'money'
]
+
$video
[
'eight_price'
];
}
Db
::
name
(
'video'
)
->
where
(
'id'
,
$video
[
'id'
])
->
update
([
'buy_num'
=>
$video
[
'buy_num'
]
+
1
,
'money'
=>
$video_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'
]]);
//是会员的情况
//将购买次数加1
foreach
(
$video_id
as
$key
=>
$val
){
$video
=
Db
::
name
(
'video'
)
->
field
(
'id,buy_num,price,four_price,eight_price,money'
)
->
where
(
'id'
,
$val
[
'id'
])
->
find
();
if
(
$val
[
'attr'
]
==
1
){
$video_money
=
$video
[
'money'
]
+
(
$video
[
'price'
]
*
0.75
);
}
elseif
(
$val
[
'attr'
]
==
2
){
$video_money
=
$video
[
'money'
]
+
(
$video
[
'four_price'
]
*
0.75
);
}
else
{
$video_money
=
$video
[
'money'
]
+
(
$video
[
'eight_price'
]
*
0.75
);
}
Db
::
name
(
'video'
)
->
where
(
'id'
,
$video
[
'id'
])
->
update
([
'buy_num'
=>
$video
[
'buy_num'
]
+
1
,
'money'
=>
$video_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
)){
foreach
(
$video_id
as
&
$val
){
if
(
$val
[
'attr'
]
==
1
){
$val
[
'attr'
]
=
'2k'
;
}
elseif
(
$val
[
'attr'
]
==
2
){
$val
[
'attr'
]
=
'4k'
;
}
else
{
$val
[
'attr'
]
=
'8k'
;
//判断视频的属性
foreach
(
$video_id
as
&
$val
){
if
(
$val
[
'attr'
]
==
1
){
$val
[
'attr'
]
=
'2k'
;
}
elseif
(
$val
[
'attr'
]
==
2
){
$val
[
'attr'
]
=
'4k'
;
}
else
{
$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
();
$str
.=
"视频标题:
$video[title],云盘地址:$video[four_url],提取码:$video[four_code]
"
;
}
elseif
(
$v
[
'attr'
]
==
'2k'
){
$video
=
Db
::
name
(
'video'
)
->
field
(
'id,title,two_url,two_code'
)
->
where
(
'id'
,
$v
[
'id'
])
->
find
();
$str
.=
"视频标题:
$video[title],云盘地址:$video[two_url],提取码:$video[two_code]
"
;
}
elseif
(
$v
[
'attr'
]
==
'8k'
){
$video
=
Db
::
name
(
'video'
)
->
field
(
'id,title,eight_url,eight_code'
)
->
where
(
'id'
,
$v
[
'id'
])
->
find
();
$str
.=
"视频标题:
$video[title],云盘地址:$video[eight_url],提取码:$video[eight_code]
"
;
//拼接发送短信的内容
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
();
$str
.=
"视频标题:
$video[title],云盘地址:$video[four_url],提取码:$video[four_code]
"
;
}
elseif
(
$v
[
'attr'
]
==
'2k'
){
$video
=
Db
::
name
(
'video'
)
->
field
(
'id,title,two_url,two_code'
)
->
where
(
'id'
,
$v
[
'id'
])
->
find
();
$str
.=
"视频标题:
$video[title],云盘地址:$video[two_url],提取码:$video[two_code]
"
;
}
elseif
(
$v
[
'attr'
]
==
'8k'
){
$video
=
Db
::
name
(
'video'
)
->
field
(
'id,title,eight_url,eight_code'
)
->
where
(
'id'
,
$v
[
'id'
])
->
find
();
$str
.=
"视频标题:
$video[title],云盘地址:$video[eight_url],提取码:$video[eight_code]
"
;
}
}
}
}
//发送短信
if
(
!
empty
(
$mobile
)){
$result
=
$this
->
sms
(
$mobile
,
$str
);
//发送短信
if
(
!
empty
(
$mobile
)){
$result
=
$this
->
sms
(
$mobile
,
$str
);
}
//支付成功,更新订单状态
$toporder
[
'status'
]
=
2
;
$toporder
[
'paytime'
]
=
time
();
$res
=
Db
::
name
(
'order'
)
->
where
(
'num'
,
$message
[
'out_trade_no'
])
->
update
(
$toporder
);
if
(
$res
){
true
;
}
// 提交事务
Db
::
commit
();
}
catch
(
\Exception
$e
)
{
dump
(
$e
->
getMessage
());
// 回滚事务
Db
::
rollback
();
$this
->
error
(
'购买失败'
);
}
}
else
{
//支付失败
$toporder
[
'status'
]
=
1
;
Db
::
name
(
'order'
)
->
where
(
'num'
,
$message
[
'out_trade_no'
])
->
update
(
$toporder
);
}
}
else
{
return
$fail
(
'通信失败,请稍后再通知我'
);
}
Db
::
name
(
'order'
)
->
where
(
'num'
,
$message
[
'out_trade_no'
])
->
update
(
$toporder
);
return
true
;
// 返回处理完成
});
$response
->
send
();
}
...
...
@@ -773,78 +823,119 @@ class Pay extends Api
//return_code 表示通信状态
if
(
$message
[
'return_code'
]
===
'SUCCESS'
)
{
if
(
$message
[
'result_code'
]
===
'SUCCESS'
)
{
//支付成功,更新订单状态
$toporder
[
'status'
]
=
2
;
$toporder
[
'paytime'
]
=
time
();
$data
=
Db
::
name
(
'order'
)
->
where
(
'id'
,
$message
[
'out_trade_no'
])
->
find
();
$pic_id
=
explode
(
','
,
$data
[
'pic_id'
]);
$video_id
=
unserialize
(
$data
[
'video_id'
]);
$user
=
Db
::
name
(
'user'
)
->
where
(
'id'
,
$data
[
'user_id'
])
->
find
();
$mobile
=
$user
[
'mobile'
];
$str
=
"【仁甲看见】"
;
//判断用户是否为会员
$login
=
Db
::
name
(
'user'
)
->
where
(
'id'
,
$data
[
'user_id'
])
->
field
(
'id,is_vip'
)
->
find
();
if
(
!
empty
(
$pic_id
)){
foreach
(
$pic_id
as
$key
=>
$v
){
//非会员
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'
]]);
}
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'
]]);
// 启动事务
Db
::
startTrans
();
try
{
if
(
!
empty
(
$pic_id
)){
//将购买次数加1
foreach
(
$pic_id
as
$key
=>
$v
){
//非会员
if
(
$user
[
'is_vip'
]
==
0
){
$pic
=
Db
::
name
(
'pic'
)
->
field
(
'id,price,buy_num,money'
)
->
where
(
'id'
,
$v
)
->
find
();
$total_money
=
$pic
[
'money'
]
+
$pic
[
'price'
];
Db
::
name
(
'pic'
)
->
where
(
'id'
,
$pic
[
'id'
])
->
update
([
'buy_num'
=>
$pic
[
'buy_num'
]
+
1
,
'money'
=>
$total_money
]);
}
else
{
//是会员
$pic
=
Db
::
name
(
'pic'
)
->
field
(
'id,price,buy_num,money'
)
->
where
(
'id'
,
$v
)
->
find
();
$total_money
=
$pic
[
'money'
]
+
(
$pic
[
'price'
]
*
0.75
);
Db
::
name
(
'pic'
)
->
where
(
'id'
,
$pic
[
'id'
])
->
update
([
'buy_num'
=>
$pic
[
'buy_num'
]
+
1
,
'money'
=>
$total_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]
,"
;
}
}
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'
;
}
elseif
(
$val
[
'attr'
]
==
2
){
$val
[
'attr'
]
=
'4k'
;
if
(
!
empty
(
$video_id
)){
//判断是否为会员
if
(
$user
[
'is_vip'
]
==
0
){
//不是会员的情况
//将购买次数加1
foreach
(
$video_id
as
$key
=>
$val
){
$video
=
Db
::
name
(
'video'
)
->
field
(
'id,buy_num,price,four_price,eight_price,money'
)
->
where
(
'id'
,
$val
[
'id'
])
->
find
();
if
(
$val
[
'attr'
]
==
1
){
$video_money
=
$video
[
'money'
]
+
$video
[
'price'
];
}
elseif
(
$val
[
'attr'
]
==
2
){
$video_money
=
$video
[
'money'
]
+
$video
[
'four_price'
];
}
else
{
$video_money
=
$video
[
'money'
]
+
$video
[
'eight_price'
];
}
Db
::
name
(
'video'
)
->
where
(
'id'
,
$video
[
'id'
])
->
update
([
'buy_num'
=>
$video
[
'buy_num'
]
+
1
,
'money'
=>
$video_money
]);
}
}
else
{
$val
[
'attr'
]
=
'8k'
;
//是会员的情况
//将购买次数加1
foreach
(
$video_id
as
$key
=>
$val
){
$video
=
Db
::
name
(
'video'
)
->
field
(
'id,buy_num,price,four_price,eight_price,money'
)
->
where
(
'id'
,
$val
[
'id'
])
->
find
();
if
(
$val
[
'attr'
]
==
1
){
$video_money
=
$video
[
'money'
]
+
(
$video
[
'price'
]
*
0.75
);
}
elseif
(
$val
[
'attr'
]
==
2
){
$video_money
=
$video
[
'money'
]
+
(
$video
[
'four_price'
]
*
0.75
);
}
else
{
$video_money
=
$video
[
'money'
]
+
(
$video
[
'eight_price'
]
*
0.75
);
}
Db
::
name
(
'video'
)
->
where
(
'id'
,
$video
[
'id'
])
->
update
([
'buy_num'
=>
$video
[
'buy_num'
]
+
1
,
'money'
=>
$video_money
]);
}
}
}
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
();
$str
.=
"视频标题:
$video[title],云盘地址:$video[four_url],提取码:$video[four_code]
"
;
}
elseif
(
$v
[
'attr'
]
==
'2k'
){
$video
=
Db
::
name
(
'video'
)
->
field
(
'id,title,two_url,two_code'
)
->
where
(
'id'
,
$v
[
'id'
])
->
find
();
$str
.=
"视频标题:
$video[title],云盘地址:$video[two_url],提取码:$video[two_code]
"
;
}
elseif
(
$v
[
'attr'
]
==
'8k'
){
$video
=
Db
::
name
(
'video'
)
->
field
(
'id,title,eight_url,eight_code'
)
->
where
(
'id'
,
$v
[
'id'
])
->
find
();
$str
.=
"视频标题:
$video[title],云盘地址:$video[eight_url],提取码:$video[eight_code]
"
;
//判断视频的属性
foreach
(
$video_id
as
&
$val
){
if
(
$val
[
'attr'
]
==
1
){
$val
[
'attr'
]
=
'2k'
;
}
elseif
(
$val
[
'attr'
]
==
2
){
$val
[
'attr'
]
=
'4k'
;
}
else
{
$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
();
$str
.=
"视频标题:
$video[title],云盘地址:$video[four_url],提取码:$video[four_code]
"
;
}
elseif
(
$v
[
'attr'
]
==
'2k'
){
$video
=
Db
::
name
(
'video'
)
->
field
(
'id,title,two_url,two_code'
)
->
where
(
'id'
,
$v
[
'id'
])
->
find
();
$str
.=
"视频标题:
$video[title],云盘地址:$video[two_url],提取码:$video[two_code]
"
;
}
elseif
(
$v
[
'attr'
]
==
'8k'
){
$video
=
Db
::
name
(
'video'
)
->
field
(
'id,title,eight_url,eight_code'
)
->
where
(
'id'
,
$v
[
'id'
])
->
find
();
$str
.=
"视频标题:
$video[title],云盘地址:$video[eight_url],提取码:$video[eight_code]
"
;
}
}
}
}
if
(
!
empty
(
$mobile
)){
$result
=
$this
->
sms
(
$mobile
,
$str
);
//发送短信
if
(
!
empty
(
$mobile
)){
$result
=
$this
->
sms
(
$mobile
,
$str
);
}
//支付成功,更新订单状态
$toporder
[
'status'
]
=
2
;
$toporder
[
'paytime'
]
=
time
();
$res
=
Db
::
name
(
'order'
)
->
where
(
'num'
,
$message
[
'out_trade_no'
])
->
update
(
$toporder
);
if
(
$res
){
true
;
}
// 提交事务
Db
::
commit
();
}
catch
(
\Exception
$e
)
{
dump
(
$e
->
getMessage
());
// 回滚事务
Db
::
rollback
();
$this
->
error
(
'购买失败'
);
}
}
else
{
//支付失败
$toporder
[
'status'
]
=
1
;
Db
::
name
(
'vorder'
)
->
where
(
'num'
,
$message
[
'out_trade_no'
])
->
update
(
$toporder
);
}
}
else
{
return
$fail
(
'通信失败,请稍后再通知我'
);
}
Db
::
name
(
'vorder'
)
->
where
(
'num'
,
$message
[
'out_trade_no'
])
->
update
(
$toporder
);
return
true
;
// 返回处理完成
});
$response
->
send
();
...
...
public/api.html
查看文件 @
4575200
...
...
@@ -6612,7 +6612,7 @@
<div
class=
"row mt0 footer"
>
<div
class=
"col-md-6"
align=
"left"
>
Generated on 2019-12-07 1
4:25:24
</div>
Generated on 2019-12-07 1
5:39:18
</div>
<div
class=
"col-md-6"
align=
"right"
>
<a
href=
"https://www.fastadmin.net"
target=
"_blank"
>
FastAdmin
</a>
</div>
...
...
请
注册
或
登录
后发表评论