Pārlūkot izejas kodu

重塑order结构

chenxiqiang 6 gadus atpakaļ
vecāks
revīzija
f0cbbe02e6

+ 29
- 0
manage-server/app/Http/Middleware/CheckToken.php Parādīt failu

@@ -0,0 +1,29 @@
1
+<?php
2
+
3
+namespace App\Http\Middleware;
4
+
5
+use Closure;
6
+
7
+class CheckToken
8
+{
9
+    /**
10
+     * Handle an incoming request.
11
+     *
12
+     * @param  \Illuminate\Http\Request  $request
13
+     * @param  \Closure  $next
14
+     * @return mixed
15
+     */
16
+    public function handle($request, Closure $next)
17
+    {
18
+
19
+        $wechat_id = $request->input("openid");
20
+        if(!$wechat_id) {
21
+            return Response()->json([
22
+                "status" => -1,
23
+                "error" => 403,
24
+                "message" => "openid不能为空,请先登陆"
25
+            ]);
26
+        }
27
+        return $next($request);
28
+    }
29
+}

+ 1
- 1
manage-server/app/Models/HouseApplianceCleanOrder.php Parādīt failu

@@ -18,7 +18,7 @@ class HouseApplianceCleanOrder extends Order
18 18
     }
19 19
 
20 20
     /**
21
-     * 获取博客文章的评论
21
+     * 获取评论
22 22
      */
23 23
     public function comments()
24 24
     {

+ 1
- 1
manage-server/app/Models/HouseCleanOrder.php Parādīt failu

@@ -26,7 +26,7 @@ class HouseCleanOrder extends Order
26 26
     }
27 27
 
28 28
     /**
29
-     * 获取博客文章的评论
29
+     * 获取评论
30 30
      */
31 31
     public function comments()
32 32
     {

+ 1
- 1
manage-server/app/Models/HousekeeperOrder.php Parādīt failu

@@ -24,7 +24,7 @@ class HousekeeperOrder extends Order
24 24
     }
25 25
 
26 26
     /**
27
-     * 获取博客文章的评论
27
+     * 获取评论
28 28
      */
29 29
     public function comments()
30 30
     {

+ 1
- 1
manage-server/app/Models/MaternityMatronOrder.php Parādīt failu

@@ -23,7 +23,7 @@ class MaternityMatronOrder extends Order
23 23
     }
24 24
 
25 25
     /**
26
-     * 获取博客文章的评论
26
+     * 获取评论
27 27
      */
28 28
     public function comments()
29 29
     {

+ 41
- 0
manage-server/app/Models/Order.php Parādīt failu

@@ -0,0 +1,41 @@
1
+<?php
2
+
3
+namespace App\Models;
4
+
5
+use Illuminate\Database\Eloquent\Model;
6
+
7
+class Order extends Model
8
+{
9
+    public $classify1 = "";
10
+    public $classify2 = "";
11
+    public $order_type = "";
12
+
13
+    function __construct($classify1 = "", $classify2 = "", $order_type = "") {
14
+        $this->classify1 = $classify1;
15
+        $this->classify2 = $classify2;
16
+        $this->order_type = $order_type;
17
+    }
18
+
19
+    protected $fillable = [
20
+        'wechat_id', // 微信号id(open_id)
21
+        'address', // 服务地址
22
+        'contact', // 联系人
23
+        'phone',	//联系电话
24
+        'status', // 订单状态, 0.待处理 1.待支付 2.已支付
25
+        'price', // 订单价格
26
+        'photo', // 显示的图片
27
+        'comment_id', // 评论id
28
+    ];
29
+
30
+    public function setFillable($fillable) {
31
+        $this->fillable = $fillable;
32
+    }
33
+
34
+    public function getFillable() {
35
+        return $this->fillable;
36
+    }
37
+
38
+    public function mergeFillable($fillable) {
39
+        $this->fillable = array_merge($this->fillable, $fillable);
40
+    }
41
+}

+ 0
- 7
manage-server/app/Models/ProductOrder.php Parādīt failu

@@ -24,11 +24,4 @@ class ProductOrder extends Order
24 24
         parent::mergeFillable(parent::getFillable(), $fillable);
25 25
     }
26 26
 
27
-    /**
28
-     * 获取博客文章的评论
29
-     */
30
-    public function comments()
31
-    {
32
-        return $this->hasMany('App\Comment');
33
-    }
34 27
 }

+ 1
- 0
manage-server/database/migrations/2018_08_10_074321_create_product_orders_table.php Parādīt failu

@@ -46,6 +46,7 @@ class CreateProductOrdersTable extends Migration
46 46
             $table->string('address');
47 47
             $table->string('phone');
48 48
             $table->string('photo');
49
+            $table->unsignedInteger('comment_id');
49 50
         });
50 51
     }
51 52
 

+ 1
- 0
manage-server/database/migrations/2018_08_10_075128_create_maternity_matron_orders_table.php Parādīt failu

@@ -39,6 +39,7 @@ class CreateMaternityMatronOrdersTable extends Migration
39 39
             $table->integer('status');
40 40
             $table->double('price');
41 41
             $table->string('photo');
42
+            $table->unsignedInteger('comment_id');
42 43
         });
43 44
     }
44 45
 

+ 1
- 0
manage-server/database/migrations/2018_08_10_075742_create_housekeeper_orders_table.php Parādīt failu

@@ -42,6 +42,7 @@ class CreateHousekeeperOrdersTable extends Migration
42 42
             $table->integer('status');
43 43
             $table->double('price');
44 44
             $table->string('photo');
45
+            $table->unsignedInteger('comment_id');
45 46
         });
46 47
     }
47 48
 

+ 1
- 0
manage-server/database/migrations/2018_08_10_080158_create_house_clean_orders_table.php Parādīt failu

@@ -46,6 +46,7 @@ class CreateHouseCleanOrdersTable extends Migration
46 46
             $table->integer('status');
47 47
             $table->double('price');
48 48
             $table->string('photo');
49
+            $table->unsignedInteger('comment_id');
49 50
         });
50 51
     }
51 52
 

+ 1
- 0
manage-server/database/migrations/2018_08_10_080546_create_house_applicance_clean_orders_table.php Parādīt failu

@@ -34,6 +34,7 @@ class CreateHouseApplicanceCleanOrdersTable extends Migration
34 34
             $table->integer('status');
35 35
             $table->double('price');
36 36
             $table->string('photo');
37
+            $table->unsignedInteger('comment_id');
37 38
         });
38 39
     }
39 40
 

Loading…
Atcelt
Saglabāt