浏览代码

账单编辑

afa 3 月之前
父节点
当前提交
0b1827e35d
共有 1 个文件被更改,包括 7 次插入2 次删除
  1. 7 2
      app/api/controller/MoneyLog.php

+ 7 - 2
app/api/controller/MoneyLog.php

@@ -92,8 +92,13 @@ class MoneyLog extends Base
             try {
                   validate(MoneyValidate::class)->scene('edit')->check($data);
                   
-                  $rows = $monuyModel->where('id', $data['id'])->where('user_id', $this->userinfo['id'])->whereDay('createtime')->where('status', $monuyModel::STATUS_NORMAL)->find();
-                  if(!$rows) $this->error('数据不存在');
+                  $rows = $monuyModel->where('id', $data['id'])->where('user_id', $this->userinfo['id'])->where('status', $monuyModel::STATUS_NORMAL)->find();
+                  if(!$rows) throw new \Exception('订单不存在');
+
+                  $dateString = date('Ymd', strtotime($rows->createtime . ' +2 days'));
+                  // 将日期字符串转换为时间戳
+                  if(date('Ymd') > $dateString) throw new \Exception('已超出修改时间限制');
+                  
                   //发货数据
                   $data['create_month'] = date('Ym', strtotime($data['create_date']));//创建月份
                   $result = $rows->save($data);