lqmac 1 year ago
parent b34ba39b57
commit dffdec1ef4
  1. 7
      application/admin/controller/Warehouse.php
  2. 8
      application/api/controller/Order.php
  3. 16
      application/api/controller/User.php

@ -58,8 +58,11 @@ class Warehouse extends Backend
if ($info) { if ($info) {
if ($info['status'] == 0) { if ($info['status'] == 0) {
$v['show_status'] = 2; $v['show_status'] = 2;
} elseif ($info['status'] == 2) { } elseif ($info['status'] == 3) {
$v['show_status'] = 3; $v['show_status'] = 3;
if ($info['is_end'] == 1) {
$v['show_status'] = 0;
}
} else { } else {
$v['show_status'] = 0; $v['show_status'] = 0;
} }
@ -198,7 +201,7 @@ class Warehouse extends Backend
$this->error(__('No Results were found')); $this->error(__('No Results were found'));
if ($this->request->isPost()){ if ($this->request->isPost()){
$params = $this->request->post("row/a"); $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){ if(!$ret){
$this->error(__('Operation failed')); $this->error(__('Operation failed'));
} }

@ -44,10 +44,10 @@ class Order extends Api
$time = time(); $time = time();
foreach ($list as $key => &$value) { foreach ($list as $key => &$value) {
if ($value['id'] != $user['warehouse_id']) { // if ($value['id'] != $user['warehouse_id']) {
unset($list[$key]); // unset($list[$key]);
continue; // continue;
} // }
$value['is_allow_access'] = 0; $value['is_allow_access'] = 0;
if ($user['pid'] > 0) { if ($user['pid'] > 0) {

@ -635,13 +635,17 @@ class User extends Api
$query->where('payee_id', $user['id'])->whereor('payer_id', $user['id']); $query->where('payee_id', $user['id'])->whereor('payer_id', $user['id']);
})->where(function ($query) { })->where(function ($query) {
$query->whereIn('status', [1]); $query->whereIn('status', [1,2]);
})->select(); })->select();
foreach ($list as $key => &$value) { foreach ($list as $key => &$value) {
if ($value['payer_id'] == $user['id']) { if ($value['payer_id'] == $user['id']) {
$value['type'] = 1; $value['type'] = 1;
//付款人不需要看到付款待确认的记录
if ($value['status' == 2]) {
unset($list[$key]);
}
} else { } else {
$value['type'] = 2; $value['type'] = 2;
} }
@ -664,9 +668,9 @@ class User extends Api
if (!$info) { if (!$info) {
$this->error("记录不存在"); $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) { if (!$is_all) {
Db::name('order') Db::name('order')
->whereTime('createtime', 'today') ->whereTime('createtime', 'today')
@ -689,12 +693,12 @@ class User extends Api
if (!$info) { if (!$info) {
$this->error("记录不存在"); $this->error("记录不存在");
} }
if ($info['status'] != 1) { if ($info['status'] != 2) {
$this->error("付款人还没支付,不能确认收款"); $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) { if (!$is_all) {
Db::name('order') Db::name('order')
->whereTime('createtime', 'today') ->whereTime('createtime', 'today')

Loading…
Cancel
Save