切换导航条
此项目
正在载入...
登录
李忠强
/
temporaryfood
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
李忠强
3 years ago
提交
a068c6d8af778eb2af60f5fe8e11ceb67d0eb3a7
1 个父辈
353bc6fa
master
更新
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
7 行增加
和
10 行删除
application/api/controller/Notify.php
application/api/controller/Order.php
application/api/controller/Notify.php
查看文件 @
a068c6d
...
...
@@ -23,17 +23,12 @@ class Notify extends Api
public
function
orderNotify
()
{
$paytype
=
$this
->
request
->
param
(
'type'
);
Db
::
name
(
'pay'
)
->
insert
([
'number'
=>
111
,
'text'
=>
''
]);
$pay
=
Service
::
checkNotify
(
$paytype
);
if
(
!
$pay
)
{
Db
::
name
(
'pay'
)
->
insert
([
'number'
=>
222
,
'text'
=>
''
]);
echo
'签名错误'
;
return
;
return
'签名错误'
;
}
$data
=
$pay
->
verify
();
if
(
is_array
(
$data
))
$data
=
json_encode
(
$data
);
Db
::
name
(
'pay'
)
->
insert
([
'number'
=>
333
,
'text'
=>
$data
]);
exit
();
$data
=
json_decode
(
$data
,
true
);
if
(
!
is_array
(
$data
))
$data
=
json_decode
(
$data
,
true
);
$model
=
new
\app\api\model\Order
();
$goodsmodel
=
new
\app\api\model\OrderGoods
();
$skumodel
=
new
\app\api\model\GoodsSpec
();
...
...
@@ -53,15 +48,17 @@ class Notify extends Api
$order
->
isUpdate
()
->
save
();
// 减少库存
$sales_actual
=
0
;
$goods_ids
=
[];
$list
=
$goodsmodel
->
where
(
'order_id'
,
$order
[
'id'
])
->
select
();
foreach
(
$list
as
$key
=>
$value
){
$goods_ids
[]
=
$value
[
'goods_id'
];
$sales_actual
+=
$value
[
'total_num'
];
if
(
$value
[
'deduct_stock_type'
]
==
20
){
$skumodel
->
where
(
'goods_spec_id'
,
$value
[
'goods_spec_id'
])
->
setDec
(
'stock_num'
,
$value
[
'total_num'
]);
}
}
// 增加销量
$goods_model
->
setInc
(
'sales_actual'
,
$sales_actual
);
$goods_model
->
whereIn
(
'goods_id'
,
$goods_ids
)
->
setInc
(
'sales_actual'
,
$sales_actual
);
// 判断是否邀请成功
$user
=
\app\api\model\User
::
get
(
$order
[
'user_id'
]);
if
(
$user
[
'invite_user_id'
]
>
0
&&
$user
[
'invite_status'
]
!=
1
)
{
...
...
@@ -97,7 +94,7 @@ class Notify extends Api
$buymodel
->
isUpdate
(
false
)
->
saveAll
(
$data
);
}
catch
(
Exception
$e
)
{
}
echo
$pay
->
success
()
->
send
();
return
$pay
->
success
()
->
send
();
}
...
...
application/api/controller/Order.php
查看文件 @
a068c6d
...
...
@@ -553,7 +553,7 @@ class Order extends Api
if
(
!
$openid
)
$this
->
error
(
'未注册用户'
);
$params
=
[
'type'
=>
'wechat'
,
'o
ut_trade_no'
=>
$order
[
'order_no'
],
'o
rderid'
=>
$order
[
'order_no'
],
'title'
=>
'订单号-'
.
$order
[
'order_no'
],
// 'amount' => $order['pay_price'],
'amount'
=>
0.01
,
...
...
请
注册
或
登录
后发表评论