海南旅游SAAS
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.

29 lines
684 B

  1. <?php
  2. namespace App\Http\Controllers\Api;
  3. use App\Http\Controllers\Controller;
  4. use App\Models\Order;
  5. use App\Models\User;
  6. class VerificationController extends Controller
  7. {
  8. //核销订单
  9. public function verify()
  10. {
  11. $id = (int)request()->input('id'); //订单ID
  12. $user = User::firstWhere(['id' => $this->user_id, 'status' => 1]);
  13. if (!$user || $user->verifier != 1) {
  14. return $this->error('对不起,你没有核销权限,请联系管理员');
  15. }
  16. $order = Order::query()->find($id);
  17. if (!in_array($order->status, [2, 3])) {
  18. return $this->error('当前订单状态不允许核销');
  19. }
  20. $order->status = 16;
  21. $order->save();
  22. return $this->success();
  23. }
  24. }