xieruidong 2 tahun lalu
induk
melakukan
5e5ac454e0

+ 10 - 0
application/admin/model/OrderInfo.php

@@ -0,0 +1,10 @@
+<?php
+
+namespace app\admin\model;
+
+use think\Model;
+
+
+class OrderInfo extends \app\common\model\OrderInfo
+{
+}

+ 15 - 0
application/admin/model/Refund.php

@@ -0,0 +1,15 @@
+<?php
+
+namespace app\admin\model;
+
+use think\Model;
+
+/**
+ * 短信验证码
+ */
+class Refund Extends \app\common\model\Refund
+{
+    public function orderInfo(){
+        return $this->hasOne(OrderInfo::class);
+    }
+}

+ 10 - 1
application/api/controller/mall/Orders.php

@@ -299,6 +299,15 @@ class Orders extends Api
      * @ApiParams (name=id,description=订单ID)
      */
     public function commit(){
-
+        $data=$this->_validate([
+            'id'=>['require','integer'],
+        ]);
+        $user=$this->auth->getUser();
+        $order=$user->orders()->findOrFail($data['id']);
+        if(!$order->allowOver()){
+            $this->error('该订单不允许确认');
+        }
+        $order->makeOver();
+        $this->success();
     }
 }

+ 13 - 0
application/common/model/Orders.php

@@ -155,6 +155,11 @@ class Orders extends Model
             $logistics->save($newData);
         }
     }
+    #确认收货
+    public function makeOver(){
+        $this['status']=self::S_OVER;
+        $this->save();
+    }
 
 
 
@@ -181,6 +186,14 @@ class Orders extends Model
             self::S_WAIT_PAY,
         ]);
     }
+    /**
+     * 是否允许确认收货
+     */
+    public function allowOver(){
+        return in_array($this['status'],[
+            self::S_WAIT_REC,
+        ]);
+    }
 
 
 

+ 1 - 1
public/api.html

@@ -11730,7 +11730,7 @@
 
                 </div>
                 <div class="col-md-6" align="right">
-                    Generated on 2022-09-27 13:44:41 <a href="./" target="_blank">后台管理</a>
+                    Generated on 2022-09-27 13:51:10 <a href="./" target="_blank">后台管理</a>
                 </div>
             </div>