Store.php
1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
namespace addons\groupon\controller;
use addons\groupon\exception\Exception;
use addons\groupon\model\Store as ModelStore;
use addons\groupon\model\User;
use addons\groupon\model\UserStore;
class Store extends Base
{
protected $noNeedLogin = ['nearby', 'detail'];
protected $noNeedRight = ['*'];
public function index()
{
$user = User::info();
$userStore = UserStore::where('user_id', $user->id)->select();
$store_id_arr = array_column($userStore, 'store_id');
$stores = [];
if ($store_id_arr) {
$stores = ModelStore::show()->where('id', 'in', $store_id_arr)->select();
}
$this->success('获取自提点列表', $stores);
}
public function nearby()
{
$params = $this->request->get();
$stores = ModelStore::getStoreList($params);
$this->success('获取自提点列表', $stores);
}
public function detail() {
$params = $this->request->get();
$store = ModelStore::getStoreDetail($params);
$this->success('获取自提点', $store);
}
}