From dffdec1ef40a4f060650a0fa67395791156c6cf3 Mon Sep 17 00:00:00 2001 From: lqmac Date: Tue, 24 Oct 2023 13:32:47 +0800 Subject: [PATCH] 1 --- application/admin/controller/Warehouse.php | 7 +++++-- application/api/controller/Order.php | 8 ++++---- application/api/controller/User.php | 16 ++++++++++------ 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/application/admin/controller/Warehouse.php b/application/admin/controller/Warehouse.php index ebef303..efe4ba9 100755 --- a/application/admin/controller/Warehouse.php +++ b/application/admin/controller/Warehouse.php @@ -58,8 +58,11 @@ class Warehouse extends Backend if ($info) { if ($info['status'] == 0) { $v['show_status'] = 2; - } elseif ($info['status'] == 2) { + } elseif ($info['status'] == 3) { $v['show_status'] = 3; + if ($info['is_end'] == 1) { + $v['show_status'] = 0; + } } else { $v['show_status'] = 0; } @@ -198,7 +201,7 @@ class Warehouse extends Backend $this->error(__('No Results were found')); if ($this->request->isPost()){ $params = $this->request->post("row/a"); - $ret = Expend::where('date', date("Y-m-d"))->update(['status' => 3]); + $ret = Expend::where('date', date("Y-m-d"))->update(['is_end' => 1]); if(!$ret){ $this->error(__('Operation failed')); } diff --git a/application/api/controller/Order.php b/application/api/controller/Order.php index 05561e3..1fbebd5 100755 --- a/application/api/controller/Order.php +++ b/application/api/controller/Order.php @@ -44,10 +44,10 @@ class Order extends Api $time = time(); foreach ($list as $key => &$value) { - if ($value['id'] != $user['warehouse_id']) { - unset($list[$key]); - continue; - } + // if ($value['id'] != $user['warehouse_id']) { + // unset($list[$key]); + // continue; + // } $value['is_allow_access'] = 0; if ($user['pid'] > 0) { diff --git a/application/api/controller/User.php b/application/api/controller/User.php index d591aeb..c268785 100755 --- a/application/api/controller/User.php +++ b/application/api/controller/User.php @@ -635,13 +635,17 @@ class User extends Api $query->where('payee_id', $user['id'])->whereor('payer_id', $user['id']); })->where(function ($query) { - $query->whereIn('status', [1]); + $query->whereIn('status', [1,2]); })->select(); foreach ($list as $key => &$value) { if ($value['payer_id'] == $user['id']) { $value['type'] = 1; + //付款人不需要看到付款待确认的记录 + if ($value['status' == 2]) { + unset($list[$key]); + } } else { $value['type'] = 2; } @@ -664,9 +668,9 @@ class User extends Api if (!$info) { $this->error("记录不存在"); } - Db::name('income_expend')->where("id", $id)->update(["pay_voucher" => $pay_voucher, "updatetime" => time()]); + Db::name('income_expend')->where("id", $id)->update(["pay_voucher" => $pay_voucher, "updatetime" => time(),'status' => 2]); //是否都提交了了支付凭证,更新我的买单为支付待确认 - $is_all = Db::name('income_expend')->whereTime('createtime', 'today')->where("payer_id", $user['id'])->where('pay_voucher','<>', '')->find(); + $is_all = Db::name('income_expend')->whereTime('createtime', 'today')->where("payer_id", $user['id'])->where('pay_voucher', '')->find(); if (!$is_all) { Db::name('order') ->whereTime('createtime', 'today') @@ -689,12 +693,12 @@ class User extends Api if (!$info) { $this->error("记录不存在"); } - if ($info['status'] != 1) { + if ($info['status'] != 2) { $this->error("付款人还没支付,不能确认收款"); } - Db::name('income_expend')->where("id", $id)->update(['status' => 2, "updatetime" => time()]); + Db::name('income_expend')->where("id", $id)->update(['status' => 3, "updatetime" => time()]); //把今天自己的订单都改为已完成 - $is_all = Db::name('income_expend')->whereTime('createtime', 'today')->where("payee_id", $user['id'])->where('status','<>', 2)->find(); + $is_all = Db::name('income_expend')->whereTime('createtime', 'today')->where("payee_id", $user['id'])->where('status','<>', 3)->find(); if (!$is_all) { Db::name('order') ->whereTime('createtime', 'today')