Update UserRebateService.php

This commit is contained in:
邹景立 2022-05-08 19:37:48 +08:00
parent c90c65afd2
commit 4db65f5203

View File

@ -20,7 +20,7 @@ class UserRebateService extends Service
* @param integer $uuid * @param integer $uuid
* @return array [total, count, lock] * @return array [total, count, lock]
*/ */
public function amount(int $uuid): array public static function amount(int $uuid): array
{ {
if ($uuid > 0) { if ($uuid > 0) {
$count = DataUserTransfer::mk()->whereRaw("uuid='{$uuid}' and status>0")->sum('amount'); $count = DataUserTransfer::mk()->whereRaw("uuid='{$uuid}' and status>0")->sum('amount');
@ -43,10 +43,10 @@ class UserRebateService extends Service
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
*/ */
public function confirm(string $orderNo): array public static function confirm(string $orderNo): array
{ {
$map = [['status', '>=', 4], ['order_no', '=', $orderNo]]; $map = [['status', '>=', 4], ['order_no', '=', $orderNo]];
$order = ShopOrder::mk()->where($map)->find(); $order = ShopOrder::mk()->where($map)->findOrEmpty()->toArray();
if (empty($order)) return [0, '需处理的订单状态异常!']; if (empty($order)) return [0, '需处理的订单状态异常!'];
$map = [['status', '=', 0], ['order_no', 'like', "{$orderNo}%"]]; $map = [['status', '=', 0], ['order_no', 'like', "{$orderNo}%"]];
DataUserRebate::mk()->where($map)->update(['status' => 1]); DataUserRebate::mk()->where($map)->update(['status' => 1]);