Parcourir la source

重塑order结构

chenxiqiang il y a 6 ans
Parent
révision
5f7eb06e14

+ 7
- 1
manage-server/app/Http/Controllers/CommonController.php Voir le fichier

@@ -150,7 +150,11 @@ class CommonController extends Controller
150 150
     {
151 151
         //$user = session('wechat.oauth_user.default');
152 152
         //$wechat_id = $user->getId();
153
+
153 154
         $wechat_id = $request->header("openid");
155
+        if(!$wechat_id) {
156
+            $wechat_id = $request->input("openid");
157
+        }
154 158
         if($wechat_id) {
155 159
             $os = array();
156 160
             $houseApplianceCleanOrder = HouseApplianceCleanOrder::where("wechat_id", $wechat_id)->get();
@@ -176,6 +180,7 @@ class CommonController extends Controller
176 180
                     $data["order_type"] = $order->order_type;
177 181
                     $data["photo"] = $order->photo;
178 182
                     $data["created_at"] = $order->created_at->toDateTimeString();
183
+                    $data["comment"] = false;
179 184
                     array_push($orders, $data);
180 185
                 }
181 186
             }
@@ -188,7 +193,8 @@ class CommonController extends Controller
188 193
                 $data["price"] = $order->price;
189 194
                 $data["order_type"] = $order->order_type;
190 195
                 $data["photo"] = $order->photo;
191
-                $data["created_at"] = $order->created_at->toDateTimeString();
196
+                $data["created_at"] = $order->created_at->toDateTimeString();;
197
+                $data["comment"] = false;
192 198
                 array_push($orders, $data);
193 199
             }
194 200
             return Response()->json([

+ 2
- 0
manage-server/app/Http/Controllers/HouseApplianceCleanOrderController.php Voir le fichier

@@ -28,6 +28,7 @@ class HouseApplianceCleanOrderController extends Controller
28 28
         $phone = $request->input('phone');
29 29
         $status = $request->input('status');
30 30
         $price = $request->input('price');
31
+        $photo = $request->input('photo');
31 32
         if ($id) {
32 33
             $houseApplianceCleanOrder = HouseApplianceCleanOrder::find($id);
33 34
             $houseApplianceCleanOrder->status = $status;
@@ -42,6 +43,7 @@ class HouseApplianceCleanOrderController extends Controller
42 43
             $houseApplianceCleanOrder->contact = $contact;
43 44
             $houseApplianceCleanOrder->phone = $phone;
44 45
             $houseApplianceCleanOrder->wechat_id = $wechat_id;
46
+            $houseApplianceCleanOrder->photo = $photo;
45 47
             $houseApplianceCleanOrder->save();
46 48
             return Response()->json([
47 49
                 "status" => 0,

+ 2
- 0
manage-server/app/Http/Controllers/HouseCleanOrderController.php Voir le fichier

@@ -34,6 +34,7 @@ class HouseCleanOrderController extends Controller
34 34
         $phone = $request->input('phone');
35 35
         $status = $request->input('status');
36 36
         $price = $request->input('price');
37
+        $photo = $request->input('photo');
37 38
         if ($id) {
38 39
             $houseCleanOrder = HouseCleanOrder::find($id);
39 40
             $houseCleanOrder->status = $status;
@@ -54,6 +55,7 @@ class HouseCleanOrderController extends Controller
54 55
             $houseCleanOrder->picture4 = $picture4;
55 56
             $houseCleanOrder->picture5 = $picture5;
56 57
             $houseCleanOrder->wechat_id = $wechat_id;
58
+            $houseCleanOrder->photo = $photo;
57 59
             $houseCleanOrder->save();
58 60
             return Response()->json([
59 61
                 "status" => 0,

+ 2
- 0
manage-server/app/Http/Controllers/HousekeeperOrderController.php Voir le fichier

@@ -32,6 +32,7 @@ class HousekeeperOrderController extends Controller
32 32
         $phone = $request->input('phone');
33 33
         $status = $request->input('status');
34 34
         $price = $request->input('price');
35
+        $photo = $request->input('photo');
35 36
         if ($id) {
36 37
             $housekeeperOrder = HousekeeperOrder::find($id);
37 38
             $housekeeperOrder->status = $status;
@@ -51,6 +52,7 @@ class HousekeeperOrderController extends Controller
51 52
             $housekeeperOrder->contact = $contact;
52 53
             $housekeeperOrder->phone = $phone;
53 54
             $housekeeperOrder->wechat_id = $wechat_id;
55
+            $housekeeperOrder->photo = $photo;
54 56
             $housekeeperOrder->save();
55 57
             return Response()->json([
56 58
                 "status" => 0,

+ 2
- 0
manage-server/app/Http/Controllers/MaternityMatronOrderController.php Voir le fichier

@@ -31,6 +31,7 @@ class MaternityMatronOrderController extends Controller
31 31
         $phone = $request->input('phone');
32 32
         $status = $request->input('status');
33 33
         $price = $request->input('price');
34
+        $photo = $request->input('photo');
34 35
         if ($id) {
35 36
             $maternityMatronOrder = MaternityMatronOrder::find($id);
36 37
             $maternityMatronOrder->status = $status;
@@ -49,6 +50,7 @@ class MaternityMatronOrderController extends Controller
49 50
             $maternityMatronOrder->contact = $contact;
50 51
             $maternityMatronOrder->phone = $phone;
51 52
             $maternityMatronOrder->wechat_id = $wechat_id;
53
+            $maternityMatronOrder->photo = $photo;
52 54
             $maternityMatronOrder->save();
53 55
             return Response()->json([
54 56
                 "status" => 0,

+ 2
- 1
manage-server/app/Http/Controllers/ProductOrderController.php Voir le fichier

@@ -32,6 +32,7 @@ class ProductOrderController extends Controller
32 32
         $contact = $request->input('contact');
33 33
         $phone = $request->input('phone');
34 34
         $status = $request->input('status');
35
+        $photo = $request->input('photo');
35 36
         if ($id) {
36 37
             $productOrder = ProductOrder::find($id);
37 38
             $productOrder->status = $status;
@@ -46,7 +47,6 @@ class ProductOrderController extends Controller
46 47
             $product = Product::find($product_id);
47 48
             $unit = $product->price;
48 49
             $product_name = $product->name;
49
-
50 50
             $productOrder->product_id = $product_id;
51 51
             $productOrder->product_name = $product_name;
52 52
             $productOrder->wechat_id = $wechat_id;
@@ -58,6 +58,7 @@ class ProductOrderController extends Controller
58 58
             $productOrder->address = $address;
59 59
             $productOrder->contact = $contact;
60 60
             $productOrder->phone = $phone;
61
+            $productOrder->photo = $photo;
61 62
             $productOrder->wechat_id = $wechat_id;
62 63
             $productOrder->save();
63 64
             return Response()->json([

+ 14
- 16
manage-server/app/Models/HouseApplianceCleanOrder.php Voir le fichier

@@ -2,28 +2,26 @@
2 2
 
3 3
 namespace App\Models;
4 4
 
5
-use Illuminate\Database\Eloquent\Model;
6 5
 
7 6
 /**
8 7
  * Class HouseApplianceCleanOrder
9 8
  * @package App\Models
10 9
  * 家电清洁
11 10
  */
12
-class HouseApplianceCleanOrder extends Model
11
+class HouseApplianceCleanOrder extends Order
13 12
 {
14
-    public $classify1 = "家政";
15
-    public $classify2 = "家电清洁";
16
-    public $order_type = "house_appliance_clean_order";
17 13
 
18
-    protected $fillable = [
19
-        'wechat_id', // 微信号id(open_id)
20
-		'appliances', // 项目, 数组形式,多个数量则出现多次
21
-    	'address', // 服务地址
22
-    	'contact', // 联系人
23
-    	'phone',	//联系电话
24
-    	'status', // 订单状态
25
-        'price', // 订单价格
26
-        'type', // 订单分类
27
-        'photo' // 显示的图片
28
-    ];
14
+    function __construct() {
15
+        parent::__construct("家政", "家电清洁", "house_appliance_clean_order");
16
+        $fillable = ['appliances'];// 项目, 数组形式,多个数量则出现多次
17
+        parent::mergeFillable(parent::getFillable(), $fillable);
18
+    }
19
+
20
+    /**
21
+     * 获取博客文章的评论
22
+     */
23
+    public function comments()
24
+    {
25
+        return $this->hasMany('App\Comment');
26
+    }
29 27
 }

+ 22
- 21
manage-server/app/Models/HouseCleanOrder.php Voir le fichier

@@ -2,33 +2,34 @@
2 2
 
3 3
 namespace App\Models;
4 4
 
5
-use Illuminate\Database\Eloquent\Model;
6 5
 
7 6
 /**
8 7
  * Class HouseCleanOrder
9 8
  * @package App\Models
10 9
  * 家居清洁订单
11 10
  */
12
-class HouseCleanOrder extends Model
11
+class HouseCleanOrder extends Order
13 12
 {
14
-    public $classify1 = "家政";
15
-    public $classify2 = "家居清洁";
16
-    public $order_type = "house_clean_order";
17 13
 
18
-    protected $fillable = [
19
-        'wechat_id', // 微信号id(open_id)
20
-		'type', // 清洁类型
21
-		'area', // 清洁面积
22
-    	'address', // 服务地址
23
-    	'contact', // 联系人
24
-    	'phone',	//联系电话
25
-		'picture1', // 图片1, 保持的是服务器上的图片地址
26
-		'picture2', // 图片2, 保持的是服务器上的图片地址
27
-		'picture3', // 图片3, 保持的是服务器上的图片地址
28
-		'picture4', // 图片4, 保持的是服务器上的图片地址
29
-		'picture5', // 图片5, 保持的是服务器上的图片地址
30
-    	'status', // 订单状态
31
-        'price', // 订单价格
32
-        'photo' // 显示的图片
33
-    ];
14
+    function __construct() {
15
+        parent::__construct("家政", "家居清洁", "house_clean_order");
16
+        $fillable = [
17
+            'type', // 清洁类型
18
+            'area', // 清洁面积
19
+            'picture1', // 图片1, 保持的是服务器上的图片地址
20
+            'picture2', // 图片2, 保持的是服务器上的图片地址
21
+            'picture3', // 图片3, 保持的是服务器上的图片地址
22
+            'picture4', // 图片4, 保持的是服务器上的图片地址
23
+            'picture5', // 图片5, 保持的是服务器上的图片地址
24
+        ];
25
+        parent::mergeFillable(parent::getFillable(), $fillable);
26
+    }
27
+
28
+    /**
29
+     * 获取博客文章的评论
30
+     */
31
+    public function comments()
32
+    {
33
+        return $this->hasMany('App\Comment');
34
+    }
34 35
 }

+ 19
- 19
manage-server/app/Models/HousekeeperOrder.php Voir le fichier

@@ -2,32 +2,32 @@
2 2
 
3 3
 namespace App\Models;
4 4
 
5
-use Illuminate\Database\Eloquent\Model;
6 5
 
7 6
 /**
8 7
  * Class HousekeeperOrder
9 8
  * @package App\Models
10 9
  * 保姆订单
11 10
  */
12
-class HousekeeperOrder extends Model
11
+class HousekeeperOrder extends Order
13 12
 {
14 13
 
15
-    public $classify1 = "家政";
16
-    public $classify2 = "保姆";
17
-    public $order_type = "housekeeper_order";
14
+    function __construct() {
15
+        parent::__construct("家政", "保姆", "housekeeper_order");
16
+        $fillable = [
17
+            'contents', // 服务内容, 数组形式,多个数量则出现多次
18
+            'people_num', //人口数量
19
+            'area', // 房屋面积
20
+            'server_time', // 服务时间: 全白天/住家
21
+            'rest', // 休息安排
22
+        ];
23
+        parent::mergeFillable(parent::getFillable(), $fillable);
24
+    }
18 25
 
19
-    protected $fillable = [
20
-        'wechat_id', // 微信号id(open_id)
21
-		'contents', // 服务内容, 数组形式,多个数量则出现多次
22
-    	'people_num', //人口数量
23
-        'area', // 房屋面积
24
-        'server_time', // 服务时间: 全白天/住家
25
-        'rest', // 休息安排
26
-        'address', // 服务地址
27
-    	'contact', // 联系人
28
-    	'phone',	//联系电话
29
-        'status', // 订单状态
30
-        'price', // 订单价格
31
-        'photo' // 显示的图片
32
-    ];
26
+    /**
27
+     * 获取博客文章的评论
28
+     */
29
+    public function comments()
30
+    {
31
+        return $this->hasMany('App\Comment');
32
+    }
33 33
 }

+ 18
- 18
manage-server/app/Models/MaternityMatronOrder.php Voir le fichier

@@ -2,31 +2,31 @@
2 2
 
3 3
 namespace App\Models;
4 4
 
5
-use Illuminate\Database\Eloquent\Model;
6 5
 
7 6
 /**
8 7
  * Class MaternityMatronOrder
9 8
  * @package App\Models
10 9
  * 月嫂订单
11 10
  */
12
-class MaternityMatronOrder extends Model
11
+class MaternityMatronOrder extends Order
13 12
 {
14 13
 
15
-    public $classify1 = "家政";
16
-    public $classify2 = "月嫂";
17
-    public $order_type = "maternity_matron_order";
14
+    function __construct() {
15
+        parent::__construct("家政", "月嫂", "maternity_matron_order");
16
+        $fillable = [
17
+            'level', // 月嫂等级
18
+            'expected_date', // 预产期
19
+            'server_time', // 服务时间
20
+            'special_demand', // 特殊需求
21
+        ];
22
+        parent::mergeFillable(parent::getFillable(), $fillable);
23
+    }
18 24
 
19
-    protected $fillable = [
20
-        'wechat_id', // 微信号id(open_id)
21
-        'level', // 月嫂等级
22
-        'expected_date', // 预产期
23
-        'server_time', // 服务时间
24
-        'special_demand', // 特殊需求
25
-        'address', // 服务地址
26
-        'contact', // 联系人
27
-        'phone',	//联系电话
28
-        'status', // 订单状态
29
-        'price', // 订单价格
30
-        'photo' // 显示的图片
31
-    ];
25
+    /**
26
+     * 获取博客文章的评论
27
+     */
28
+    public function comments()
29
+    {
30
+        return $this->hasMany('App\Comment');
31
+    }
32 32
 }

+ 21
- 22
manage-server/app/Models/ProductOrder.php Voir le fichier

@@ -2,34 +2,33 @@
2 2
 
3 3
 namespace App\Models;
4 4
 
5
-use Illuminate\Database\Eloquent\Model;
6
-
7 5
 /**
8 6
  * Class ProductOrder
9 7
  * @package App\Models
10 8
  * 产品订单
11 9
  */
12
-class ProductOrder extends Model
10
+class ProductOrder extends Order
13 11
 {
14 12
 
15
-    public $classify1 = "产品";
16
-    public $classify2 = "产品";
17
-    public $order_type = "product_order";
13
+    function __construct() {
14
+        parent::__construct("产品", "产品", "product_order");
15
+        $fillable = [
16
+            'product_id', // 产品名称
17
+            'product_name', // 产品信息
18
+            'color', // 产品颜色款色
19
+            'unit', // 产品单格
20
+            'amount', // 产品数量
21
+            'remark', // 买家备注
22
+            'info', // 卖家信息
23
+        ];
24
+        parent::mergeFillable(parent::getFillable(), $fillable);
25
+    }
18 26
 
19
-    protected $fillable = [
20
-        'wechat_id', // 微信号id(open_id)
21
-    	'product_id', // 产品名称
22
-		'product_name', // 产品信息
23
-        'color', // 产品颜色款色
24
-		'unit', // 产品单格
25
-		'amount', // 产品数量
26
-		'price', // 订单总价
27
-		'status', // 订单状态
28
-		'remark', // 买家备注
29
-		'info', // 卖家信息
30
-		'contact', // 买家联系人
31
-		'address', // 买家地址
32
-		'phone', // 买家手机号码,
33
-        'photo' // 显示的图片
34
-	];
27
+    /**
28
+     * 获取博客文章的评论
29
+     */
30
+    public function comments()
31
+    {
32
+        return $this->hasMany('App\Comment');
33
+    }
35 34
 }

Loading…
Annuler
Enregistrer