Ver código fonte

Merge branch 'dev'

# Conflicts:
#	app/validate/api/store/order/StoreOrderCreateValidate.php
shichen 4 meses atrás
pai
commit
750ac3c7b5

+ 20 - 0
app/common/dao/store/order/PickUpDao.php

@@ -13,4 +13,24 @@ class PickUpDao extends BaseDao
13 13
     {
14 14
         return PickUp::class;
15 15
     }
16
+
17
+    public function search(array $where)
18
+    {
19
+        return PickUp::getDB()
20
+            ->when(isset($where['name']) && $where['name'] !== '', function ($query) use ($where) {
21
+                $query->where('name', 'like', '%' . $where['name'] . '%');
22
+            })
23
+            ->when(isset($where['address']) && $where['address'] !== '', function ($query) use ($where) {
24
+                $query->where('address', 'like', '%' . $where['address'] . '%');
25
+            })
26
+            ->when(isset($where['user_name']) && $where['user_name'] !== '', function ($query) use ($where) {
27
+                $query->where('user_name', 'like', '%' . $where['user_name'] . '%');
28
+            })
29
+            ->when(isset($where['mobile']) && $where['mobile'] !== '', function ($query) use ($where) {
30
+                $query->where('mobile', 'like', '%' . $where['mobile'] . '%');
31
+            })
32
+            ->when(isset($where['status']) && $where['status'] !== '', function ($query) use ($where) {
33
+                $query->where('status', $where['status']);
34
+            });
35
+    }
16 36
 }

+ 42 - 1
app/common/repositories/store/order/PickUpRepository.php

@@ -19,6 +19,47 @@ class PickUpRepository extends BaseRepository
19 19
 
20 20
     public function getlist()
21 21
     {
22
-        return $this->dao->selectWhere(['status'=>1]);
22
+        return $this->dao->selectWhere(['status' => 1]);
23
+    }
24
+
25
+    /**
26
+     * @param array $where
27
+     * @param $page
28
+     * @param $limit
29
+     * @return array
30
+     * @throws \think\db\exception\DataNotFoundException
31
+     * @throws \think\db\exception\DbException
32
+     * @throws \think\db\exception\ModelNotFoundException
33
+     * @author 史晨
34
+     * @date 2026/3/20 10:13
35
+     * 自提点地址列表
36
+     */
37
+    public function adminList(array $params): array
38
+    {
39
+        $page = $params['page'] ?? 1;
40
+        $limit = $params['limit'] ?? 10;
41
+        unset($params['page'], $params['limit']);
42
+        $query = $this->dao->search($params);
43
+        $list = $query->page($page, $limit)
44
+            ->order('id', 'desc')
45
+            ->select()
46
+            ->toArray();
47
+        $count = $query->count();
48
+        return ['list' => $list, 'count' => $count];
49
+    }
50
+
51
+    public function add($params)
52
+    {
53
+        return $this->dao->create($params);
54
+    }
55
+
56
+    public function get($id)
57
+    {
58
+        return $this->dao->get($id);
59
+    }
60
+
61
+    public function update($id, $params)
62
+    {
63
+        return $this->dao->update($id, $params);
23 64
     }
24 65
 }

+ 2 - 1
app/common/repositories/store/order/StoreGroupOrderRepository.php

@@ -806,7 +806,8 @@ class StoreGroupOrderRepository extends BaseRepository
806 806
                         ->setPension($productEntity->getPension())
807 807
                         ->setAttrValuePensionNum($productAttrValueEntity->getPensionNum())
808 808
                         ->toArray()
809
-                )->setPickUpId($storeOrderCreateRequestEntity->getPickUpId());
809
+                )->setPickUpId($storeOrderCreateRequestEntity->getPickUpId())
810
+                ->setMark($storeOrderCreateRequestEntity->getMark());
810 811
             $storeOrderEntityList[] = $storeOrderEntity;
811 812
         }
812 813
 

+ 11 - 3
app/common/repositories/user/FeedbackRepository.php

@@ -48,11 +48,19 @@ class FeedbackRepository extends BaseRepository
48 48
         })->select();
49 49
 
50 50
         foreach ($list as &$item) {
51
-            $userReply = Db::name('feedback_reply')
51
+            $isReply = Db::name('feedback_reply')
52 52
                 ->where(['feedback_id' => $item['feedback_id']])
53
-                ->where(['admin_read' => 0])
53
+                ->where(['user_id', '>', 0])
54 54
                 ->find();
55
-            $item['userReply'] = $userReply ? 1 : 0;
55
+            if (!$isReply) {
56
+                $item['userReply'] = 0;
57
+            }else{
58
+                $userReply = Db::name('feedback_reply')
59
+                    ->where(['feedback_id' => $item['feedback_id']])
60
+                    ->where(['admin_read' => 0])
61
+                    ->find();
62
+                $item['userReply'] = $userReply ? 1 : 0;
63
+            }
56 64
         }
57 65
 
58 66
         return compact('count', 'list');

+ 84 - 0
app/controller/admin/system/pickUp/PickUp.php

@@ -0,0 +1,84 @@
1
+<?php
2
+
3
+namespace app\controller\admin\system\pickUp;
4
+
5
+use app\common\repositories\store\order\PickUpRepository;
6
+
7
+class PickUp
8
+{
9
+
10
+    protected $repository;
11
+
12
+    /**
13
+     * @param PickUpRepository $repository
14
+     */
15
+    public function __construct(PickUpRepository $repository)
16
+    {
17
+        $this->repository = $repository;
18
+    }
19
+
20
+    /**
21
+     * @return mixed
22
+     * @throws \think\db\exception\DataNotFoundException
23
+     * @throws \think\db\exception\DbException
24
+     * @throws \think\db\exception\ModelNotFoundException
25
+     * @author 史晨
26
+     * @date 2026/3/20 10:13
27
+     * 自提点地址列表
28
+     */
29
+    public function getList()
30
+    {
31
+        $params = request()->get();
32
+        $list = $this->repository->adminList($params);
33
+        return app('json')->success($list);
34
+    }
35
+
36
+    /**
37
+     * @return mixed
38
+     * @author 史晨
39
+     * @date 2026/3/20 10:32
40
+     * 添加自提点
41
+     */
42
+    public function add()
43
+    {
44
+        $params = request()->post();
45
+        $res = $this->repository->add($params);
46
+        if (!$res) {
47
+            return app('json')->fail('添加失败');
48
+        }
49
+        return app('json')->success('添加成功');
50
+    }
51
+
52
+    /**
53
+     * @param $id
54
+     * @return mixed
55
+     * @author 史晨
56
+     * @date 2026/3/20 10:32
57
+     * 获取自提点信息
58
+     */
59
+    public function get($id)
60
+    {
61
+        $data = $this->repository->get($id);
62
+        if (!$data) {
63
+            return app('json')->fail('获取失败');
64
+        }
65
+        return app('json')->success($data);
66
+    }
67
+
68
+    /**
69
+     * @param $id
70
+     * @return mixed
71
+     * @author 史晨
72
+     * @date 2026/3/20 10:33
73
+     * 更新自提点信息
74
+     */
75
+    public function update($id)
76
+    {
77
+        $params = request()->post();
78
+        $res = $this->repository->update($id, $params);
79
+        if (!$res) {
80
+            return app('json')->fail('添加失败');
81
+        }
82
+        return app('json')->success('添加成功');
83
+    }
84
+}

+ 4 - 6
app/validate/api/store/order/StoreOrderCreateValidate.php

@@ -17,9 +17,8 @@ class StoreOrderCreateValidate extends CommonValidate
17 17
         'address_id' => 'require|integer',
18 18
         'pay_type' => 'require|integer',
19 19
         'share_id' => 'integer',
20
-        'mark' => 'string',
21
-        // 'pick_up_id' => 'require|integer',
22
-        'pick_up_id' => 'integer'
20
+        'mark' => 'max:255',
21
+        'pick_up_id' => 'require|integer'
23 22
     ];
24 23
 
25 24
     protected $message = [
@@ -34,8 +33,8 @@ class StoreOrderCreateValidate extends CommonValidate
34 33
         'pay_type.require' => '支付方式不能为空!',
35 34
         'pay_type.integer' => '支付方式类型错误!',
36 35
         'share_id.integer' => 'share_id 必须是整数!',
37
-        'mark.string' => '备注类型错误',
38
-        // 'pick_up_id.require' => '缺少提货点ID参数!',
36
+        'mark.between' => '备注超出范围',
37
+        'pick_up_id.require' => '缺少提货点ID参数!',
39 38
         'pick_up_id.integer' => '提货点ID必须是整数!',
40 39
     ];
41 40
 
@@ -47,7 +46,6 @@ class StoreOrderCreateValidate extends CommonValidate
47 46
     public function validateRequest(): array
48 47
     {
49 48
         $data = $this->request->post();
50
-        if (!isset($data['pick_up_id'])) $data['pick_up_id'] = 0;
51 49
         Log::info('request-api-store-order-create-params:' . json_encode($data));
52 50
         if (!$this->check($data)) {
53 51
             return ['status' => 'error', 'message' => $this->getError()];

+ 11 - 3
route/admin.php

@@ -100,7 +100,7 @@ Route::group(config('admin.api_admin_prefix') . '/', function () {
100 100
             Route::get('lst', '/lst')->name('configAwardLst');
101 101
             Route::post('update/:key', '/update')->name('configAwardUpdate');
102 102
             Route::get('update/table', '/updateTable')->name('configAwardUpdateForm');
103
-        })->prefix('admin.system.config.award');    
103
+        })->prefix('admin.system.config.award');
104 104
 
105 105
         Route::group('config/others', function () {
106 106
             Route::get('lst', 'ConfigOthers/lst')->name('configOthersSettingLst');
@@ -155,7 +155,7 @@ Route::group(config('admin.api_admin_prefix') . '/', function () {
155 155
 
156 156
         //上传图片
157 157
         Route::post('upload/image/:id/:field', 'admin.system.attachment.Attachment/image')->name('uploadImage');
158
-        
158
+
159 159
         //上传视频
160 160
         Route::post('upload/video/:id/:field', 'admin.system.attachment.Attachment/video')->name('merchantUploadVideo');
161 161
 
@@ -317,6 +317,14 @@ Route::group(config('admin.api_admin_prefix') . '/', function () {
317 317
             Route::get('category/form/:id', '/updateForm')->name('systemMerchantCategoryUpdateForm');
318 318
         })->prefix('admin.system.merchant.MerchantCategory');
319 319
 
320
+        // 自提点管理
321
+        Route::group('system/pickUp', function () {
322
+            Route::get('list', '/getList')->name('systemPickUpList');
323
+            Route::post('add', '/add')->name('systemPickUpAdd');
324
+            Route::get('get/:id', '/get')->name('systemPickUpGet');
325
+            Route::post('update/:id', '/update')->name('systemPickUpUpdate');
326
+        })->prefix('admin.system.pickUp.PickUp');
327
+
320 328
 
321 329
         //用户标签
322 330
         Route::group('user/label', function () {
@@ -577,7 +585,7 @@ Route::group(config('admin.api_admin_prefix') . '/', function () {
577 585
             Route::post('upload/image', '/uploadImage')->name('wechatUploadImage');
578 586
             Route::post('upload/voice', '/uploadVoice')->name('wechatUploadVoice');
579 587
         })->prefix('admin.wechat.WechatReply');
580
-	
588
+
581 589
 	// 商家管理
582 590
         Route::group('merchant/contribute', function () {
583 591
             Route::post("list","admin.merchant.MerchantContribute/list");//图片列表