liugc 1 год назад
Родитель
Сommit
26c92fd082

+ 13 - 1
app/adminapi/controller/property/PropertyOrderController.php

@@ -125,7 +125,19 @@ class PropertyOrderController extends BaseAdminController
         }
         return $this->fail(PropertyOrderLogic::getError());
     }
-
+    /**
+     * @notes 客服取消订单
+     * @return \think\response\Json
+     */
+    public function cancel()
+    {
+        $params = (new PropertyOrderValidate())->post()->goCheck('detail');
+        $result = PropertyOrderLogic::cancel($params);
+        if (true === $result) {
+            return $this->success('取消成功', [], 1, 1);
+        }
+        return $this->fail(PropertyOrderLogic::getError());
+    }
 
 
 }

+ 28 - 0
app/adminapi/controller/property/PropertySurplusLogController.php

@@ -104,5 +104,33 @@ class PropertySurplusLogController extends BaseAdminController
         return $this->data($result);
     }
 
+    /**
+     * @notes 入账
+     * @return \think\response\Json
+     */
+    public function entry()
+    {
+        $params = (new PropertySurplusLogValidate())->post()->goCheck('detail');
+        $params['status'] = 1;
+        $result = PropertySurplusLogLogic::edit($params);
+        if (true === $result) {
+            return $this->success('入账成功', [], 1, 1);
+        }
+        return $this->fail(PropertySurplusLogLogic::getError());
+    }
+    /**
+     * @notes 取消提现
+     * @return \think\response\Json
+     */
+    public function cancel()
+    {
+        $params = (new PropertySurplusLogValidate())->post()->goCheck('detail');
+        $params['status'] = 2;
+        $result = PropertySurplusLogLogic::edit($params);
+        if (true === $result) {
+            return $this->success('取消成功', [], 1, 1);
+        }
+        return $this->fail(PropertySurplusLogLogic::getError());
+    }
 
 }

+ 26 - 0
app/adminapi/logic/property/PropertyOrderLogic.php

@@ -200,6 +200,32 @@ class PropertyOrderLogic extends BaseLogic
     }
 
 
+    /**
+     * @notes 取消
+     * @param array $params
+     * @return bool
+     * @author likeadmin
+     * @date 2024/09/19 14:48
+     */
+    public static function cancel(array $params): bool
+    {
+        Db::startTrans();
+        try {
+            $upData['order_status'] = 2;
+            $orderStatus = PropertyOrder::where('id', $params['id'])->value('order_status');
+            if($orderStatus == 0){
+                PropertyOrder::where('id', $params['id'])->update($upData);
+            }else{
+                throw new Exception('当前订单状态不允许操作');
+            }
+            Db::commit();
+            return true;
+        } catch (\Exception $e) {
+            Db::rollback();
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
 
 
 

+ 9 - 4
app/adminapi/logic/property/PropertySurplusLogLogic.php

@@ -77,12 +77,17 @@ class PropertySurplusLogLogic extends BaseLogic
                 throw new Exception('状态不允许操作');
             }
 
-            if($params['status'] == 1){
-                self::EntryCash($params);
+            if(intval($params['status']) === 1){
+                $res = self::EntryCash($params);
             }
-            if($params['status'] == 1){
-                self::CancelCash($params);
+            if(intval($params['status']) === 2){
+                $res = self::CancelCash($params);
             }
+            if(!$res){
+                throw new Exception(self::getError());
+            }
+
+
             /*PropertySurplusLog::where('id', $params['id'])->update([
                 'in_out' => $params['in_out'],
                 'property_commission_id' => $params['property_commission_id'],

+ 1 - 1
app/api/controller/PropertyController.php

@@ -15,7 +15,7 @@ use think\facade\Log;
  */
 class PropertyController extends BaseApiController
 {
-    public array $notNeedLogin = ['orderByQrcode', 'withdrawCash','orderLists'];
+    public array $notNeedLogin = ['orderByQrcode'];
     /**
      * @notes 二维码扫码下物业单
      * @return \think\response\Json