You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
895 B
33 lines
895 B
<?php
|
|
|
|
namespace App\Http\Controllers\Api;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Order;
|
|
use App\Models\User;
|
|
use App\Common\OrderStatus;
|
|
|
|
class VerificationController extends Controller
|
|
{
|
|
//核销订单
|
|
public function verify()
|
|
{
|
|
$id = (int)request()->input('id'); //订单ID
|
|
|
|
$user = User::firstWhere(['id' => $this->user_id, 'status' => 1]);
|
|
if (!$user || $user->verifier != 1) {
|
|
return $this->error('对不起,你没有核销权限,请联系管理员');
|
|
}
|
|
|
|
$order = Order::query()->where('agent_id', $this->agent_id)->find($id);
|
|
if (!$order) {
|
|
return $this->error('订单不存在或无权限');
|
|
}
|
|
if (!in_array($order->status, [OrderStatus::PAID, OrderStatus::PAID_RETAINAGE, OrderStatus::OFFLINE_UNPAID])) {
|
|
return $this->error('当前订单状态不允许核销');
|
|
}
|
|
$order->status = 16;
|
|
$order->save();
|
|
|
|
return $this->success();
|
|
}
|
|
}
|