Prechádzať zdrojové kódy

wesmiler 抢表商城

APPLE 3 rokov pred
rodič
commit
b5b06a115e

+ 26 - 0
app/Http/Controllers/Admin/OrderController.php

@@ -47,4 +47,30 @@ class OrderController extends Backend
         );
         return $message;
     }
+
+    /**
+     * 已收款
+     * @return array
+     */
+    public function received()
+    {
+        if(OrderService::make()->received()){
+            return message(OrderService::make()->getError(), true);
+        }else{
+            return message(OrderService::make()->getError(), false);
+        }
+    }
+
+    /**
+     * 已发货
+     * @return array
+     */
+    public function deliver()
+    {
+        if(OrderService::make()->deliver()){
+            return message(OrderService::make()->getError(), true);
+        }else{
+            return message(OrderService::make()->getError(), false);
+        }
+    }
 }

+ 28 - 0
app/Http/Controllers/Api/v1/NoticeController.php

@@ -0,0 +1,28 @@
+<?php
+
+namespace App\Http\Controllers\Api\v1;
+
+use App\Http\Controllers\Api\webApp;
+use App\Models\NoticeModel;
+use App\Services\Common\ArticleService;
+use App\Services\Common\NoticeService;
+
+/**
+ * 公告
+ * Class NoticeController
+ * @package App\Http\Controllers\Api
+ */
+class NoticeController extends webApp
+{
+
+    /**
+     * 详情
+     */
+    public function info()
+    {
+        $id = request()->post('id', 0);
+        $info = NoticeModel::getInfo($id);
+        return message(1010, true, $info);
+    }
+
+}

+ 14 - 0
app/Models/NoticeModel.php

@@ -22,4 +22,18 @@ class NoticeModel extends BaseModel
 {
     // 设置数据表
     protected $table = 'notice';
+
+    /**
+     * 获取会员信息
+     * @param int $id 会员ID
+     * @return array|string
+     * @author laravel开发员
+     * @since 2020/11/11
+     */
+    public function getInfo($id)
+    {
+        $info = parent::getInfo($id); // TODO: Change the autogenerated stub
+
+        return $info;
+    }
 }

+ 1 - 0
app/Services/Common/NoticeService.php

@@ -134,4 +134,5 @@ class NoticeService extends BaseService
 
         return $datas;
     }
+
 }

+ 61 - 1
app/Services/Common/OrderService.php

@@ -298,7 +298,67 @@ class OrderService extends BaseService
     }
 
     /**
-     *
+     * 已收款
+     * @return bool
+     */
+    public function received()
+    {
+        $params = request()->all();
+        $id = isset($params['id'])? $params['id'] : 0;
+        $info = $this->model->where(['id'=> $id,'mark'=>1])->first();
+        $status = isset($info['status'])? $info['status'] : 0;
+        if(!$id || empty($info)){
+            $this->error = 2081;
+            return false;
+        }
+
+        if($status != 2){
+            $this->error = 2090;
+            return false;
+        }
+
+        if($this->model->where(['id'=> $id])->update(['status'=> 3, 'update_time'=> time()])){
+            $this->error = 2092;
+            return true;
+        }else{
+            $this->error = 2093;
+            return false;
+        }
+    }
+
+    /**
+     * 已发货
+     * @return bool
+     */
+    public function deliver()
+    {
+        $params = request()->all();
+        $id = isset($params['id'])? $params['id'] : 0;
+        $express = isset($params['express'])? $params['express'] : '';
+        $expressNo = isset($params['express_no'])? $params['express_no'] : '';
+        $info = $this->model->where(['id'=> $id,'mark'=>1])->first();
+        $status = isset($info['status'])? $info['status'] : 0;
+        if(!$id || empty($info)){
+            $this->error = 2081;
+            return false;
+        }
+
+        if(!in_array($status, [2,3])){
+            $this->error = 2090;
+            return false;
+        }
+
+        if($this->model->where(['id'=> $id])->update(['status'=> 4,'express'=> $express,'express_no'=> $expressNo, 'update_time'=> time()])){
+            $this->error = 2094;
+            return true;
+        }else{
+            $this->error = 2095;
+            return false;
+        }
+    }
+
+    /**
+     * 已收货
      * @return bool
      */
     public function receive()