OrderDelay.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace app\api\controller\v1;
  3. use app\api\controller\Base;
  4. use app\hander\HelpHander;
  5. use think\App;
  6. use think\Db;
  7. use think\exception\Handle;
  8. class OrderDelay extends Base
  9. {
  10. //延迟原因
  11. public function reasons(){
  12. $delay_reasons = Db::name('delay_reason')
  13. ->where('org_id', $this->orgId)
  14. ->where('enable', 1)
  15. ->where('del', 0)
  16. ->select();
  17. HelpHander::success($delay_reasons?$delay_reasons:[]);
  18. }
  19. //申请延迟
  20. public function add(){
  21. $id = input('id/d',0);
  22. if($id <= 0){
  23. HelpHander::error('参数错误');
  24. }
  25. $delay_reason_id = input('delay_reason_id/d',0);
  26. if (empty($delay_reason_id)) {
  27. HelpHander::error('请选择延迟原因');
  28. }
  29. $res = model("Orders")->delay_reason($id, $delay_reason_id,1);
  30. if (!$res) {
  31. HelpHander::error(model("Orders")->getError());
  32. }
  33. HelpHander::success('操作成功');
  34. }
  35. // 取消延时
  36. public function cancel(){
  37. $id = input('id/d',0);
  38. if($id <= 0){
  39. HelpHander::error('参数错误');
  40. }
  41. $res = model("Orders")->batchcanceldelay($id);
  42. if (!$res) {
  43. HelpHander::error(model("Orders")->getError());
  44. }
  45. HelpHander::success('操作成功');
  46. }
  47. }