OrdertimescardtecordController.php 1002 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace app\index\controller;
  3. use think\exception\ValidateException;
  4. use app\model\OrderTimescardRecord;
  5. class OrdertimescardtecordController extends Base
  6. {
  7. public function writeoff()
  8. {
  9. $orderid = input('post.orderid', '', 'serach_in');
  10. $uid = input('post.uid', '', 'serach_in');
  11. $is_timing = input('post.is_timing', '', 'serach_in');
  12. $time = time();
  13. if ($is_timing == 1) {
  14. $data = OrderTimescardRecord::where([
  15. 'order_id' => $orderid,
  16. 'is_complete' => 0,
  17. ])->find();
  18. } else {
  19. $data = OrderTimescardRecord::create([
  20. 'order_id' => $orderid,
  21. 'uid' => $uid,
  22. 'yue_begin_time' => $time,
  23. 'yue_end_time' => $time,
  24. 'begin_time' => $time,
  25. 'is_complete' => 1,
  26. 'end_time' => $time
  27. ]);
  28. }
  29. return $this->json(['data' => $data]);
  30. }
  31. }