正在显示
11 个修改的文件
包含
301 行增加
和
4 行删除
@@ -126,4 +126,58 @@ class ActivityController extends HomeBaseController | @@ -126,4 +126,58 @@ class ActivityController extends HomeBaseController | ||
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
129 | + /** | ||
130 | + * @title 行程日历 | ||
131 | + * @description 默认访问接口(默认不填是当前月份,如果填写传值是上方日历选项卡的栏目时间戳) | ||
132 | + * @author sᴏᴜʟ ᴏғ ᴄɪɴᴅᴇʀ | ||
133 | + * @url /activity/Activity/journeyCalendar | ||
134 | + * @method POST | ||
135 | + * | ||
136 | + * @param name:timestamp type:int require:1 default:1538323200 other: desc:选项卡时间戳 | ||
137 | + */ | ||
138 | + public function journeyCalendar() | ||
139 | + { | ||
140 | + $calendar = []; | ||
141 | + for ($m = 1; $m < 13; $m++) { | ||
142 | + $label = getMonthEnglishWords($m - 1); | ||
143 | + $date = date("Y-$m"); | ||
144 | + $calendar[$m - 1]['label'] = $label; | ||
145 | + $calendar[$m - 1]['date'] = $date; | ||
146 | + $calendar[$m - 1]['timestamp'] = strtotime(date("Y-$m-01")); | ||
147 | + } | ||
148 | + $monthStart = (empty(request()->param('timestamp'))) ? strtotime(date("Y-m-01")) : request()->param('timestamp'); | ||
149 | + $monthEnd = strtotime('+1months', $monthStart); | ||
150 | + echo json_encode([ | ||
151 | + 'nav' => $calendar, | ||
152 | + 'activity_list' => $this->journeyActivity($monthStart, $monthEnd) | ||
153 | + ]); | ||
154 | + exit(); | ||
155 | + } | ||
156 | + | ||
157 | + private function journeyActivity($monthStart, $monthEnd) | ||
158 | + { | ||
159 | + $map = [ | ||
160 | + 'start_time' => ['between', [$monthStart, $monthEnd]], | ||
161 | + 'is_on_sale' => ['eq', 1] | ||
162 | + ]; | ||
163 | + $res = Db::name('activity_schedule')->alias('s') | ||
164 | + ->field('a.id,a.name,a.thumb,s.price,s.maximum,real_join_num,addition_join_num,s.start_time') | ||
165 | + ->join('activity a', 'a.id=s.activity_id') | ||
166 | + ->where($map) | ||
167 | + ->order('start_time DESC') | ||
168 | + ->select()->toArray(); | ||
169 | + $model = new ActivityModel; | ||
170 | + foreach ($res as $k => $v) { | ||
171 | + $v['start_time'] = date('Y.m.d', $v['start_time']); | ||
172 | + $v['sales_num'] = $v['real_join_num'] + $v['addition_join_num']; | ||
173 | + $v['residue_num'] = $v['maximum'] - $v['sales_num']; | ||
174 | + unset($v['real_join_num']); | ||
175 | + unset($v['addition_join_num']); | ||
176 | + unset($v['maximum']); | ||
177 | + $v['is_collect'] = $model->isCollect($v['id'], session('user.id')); | ||
178 | + $res[$k] = $v; | ||
179 | + } | ||
180 | + return $res; | ||
181 | + } | ||
182 | + | ||
129 | } | 183 | } |
@@ -23,7 +23,7 @@ class ActivityModel extends Model | @@ -23,7 +23,7 @@ class ActivityModel extends Model | ||
23 | * @throws \think\db\exception\ModelNotFoundException | 23 | * @throws \think\db\exception\ModelNotFoundException |
24 | * @throws \think\exception\DbException | 24 | * @throws \think\exception\DbException |
25 | */ | 25 | */ |
26 | - public function activityList($tId = null, $nowTime, $userId, $keyword=null) | 26 | + public function activityList($tId = null, $nowTime, $userId, $keyword = null) |
27 | { | 27 | { |
28 | $where = []; | 28 | $where = []; |
29 | if ($tId != null) { | 29 | if ($tId != null) { |
@@ -148,7 +148,7 @@ class ActivityModel extends Model | @@ -148,7 +148,7 @@ class ActivityModel extends Model | ||
148 | * @param $userId | 148 | * @param $userId |
149 | * @return int|string | 149 | * @return int|string |
150 | */ | 150 | */ |
151 | - private function isCollect($activityId, $userId) | 151 | + public function isCollect($activityId, $userId) |
152 | { | 152 | { |
153 | $isCollected = Db::name('collect')->where(['activity_id' => $activityId, 'user_id' => $userId])->count(); | 153 | $isCollected = Db::name('collect')->where(['activity_id' => $activityId, 'user_id' => $userId])->count(); |
154 | return $isCollected; | 154 | return $isCollected; |
app/admin/controller/TeamController.php
0 → 100644
1 | +<?php | ||
2 | +/** | ||
3 | + * Created by PhpStorm. | ||
4 | + * User: yhbr | ||
5 | + * Date: 2018/9/6 | ||
6 | + * Time: 14:20 | ||
7 | + */ | ||
8 | + | ||
9 | +namespace app\admin\controller; | ||
10 | +use cmf\controller\AdminBaseController; | ||
11 | +use think\Db; | ||
12 | + | ||
13 | +class TeamController extends AdminBaseController | ||
14 | +{ | ||
15 | + | ||
16 | + public function index() | ||
17 | + { | ||
18 | + $res = Db::name('team_customization') | ||
19 | + ->field('id,team_name,team_num,start_time') | ||
20 | + ->order('start_time DESC') | ||
21 | + ->paginate(20); | ||
22 | + return $this->fetch('', [ | ||
23 | + 'posts' => $res, | ||
24 | + 'page' => $res->render() | ||
25 | + ]); | ||
26 | + } | ||
27 | + | ||
28 | + public function detail() | ||
29 | + { | ||
30 | + $info = Db::name('team_customization')->where(['id' => request()->param('id')])->find(); | ||
31 | + return $this->fetch('', [ | ||
32 | + 'info' => $info | ||
33 | + ]); | ||
34 | + } | ||
35 | + | ||
36 | +} |
app/order/controller/OrderController.php
0 → 100644
1 | +<?php | ||
2 | +namespace app\order\controller; | ||
3 | +use cmf\controller\HomeBaseController; | ||
4 | +use think\Db; | ||
5 | + | ||
6 | +/** | ||
7 | + * @title 订单模块 | ||
8 | + */ | ||
9 | +class OrderController extends HomeBaseController | ||
10 | +{ | ||
11 | + | ||
12 | + /** | ||
13 | + * @title 活动列表 | ||
14 | + * @description 默认访问接口 | ||
15 | + * @author sᴏᴜʟ ᴏғ ᴄɪɴᴅᴇʀ | ||
16 | + * @url /order/Order/confirm | ||
17 | + * @method POST | ||
18 | + */ | ||
19 | + public function confirm() | ||
20 | + { | ||
21 | + $request = request(); | ||
22 | + $activity_id = $request->param('activity_id'); | ||
23 | + if ($request->isPost()) { | ||
24 | + $activity = Db::name('activity')->field('name')->find(); | ||
25 | + } else { | ||
26 | + return $this->fetch(); | ||
27 | + } | ||
28 | + } | ||
29 | + | ||
30 | +} |
app/order/controller/OrderControoler.php
已删除
100644 → 0
app/team/controller/TeamController.php
0 → 100644
1 | +<?php | ||
2 | +namespace app\team\controller; | ||
3 | +use cmf\controller\HomeBaseController; | ||
4 | +use Think\Db; | ||
5 | + | ||
6 | +/** | ||
7 | + * @title 团队定制模块 | ||
8 | + */ | ||
9 | +class TeamController extends HomeBaseController | ||
10 | +{ | ||
11 | + | ||
12 | + /** | ||
13 | + * @title 提交表单 | ||
14 | + * @description 默认访问接口 | ||
15 | + * @author sᴏᴜʟ ᴏғ ᴄɪɴᴅᴇʀ | ||
16 | + * @url /team/Team/teamCustomization | ||
17 | + * @method POST | ||
18 | + * | ||
19 | + * @param name:team_name type:char require:1 default:法兰不死队 other: desc:团队名称 | ||
20 | + * @param name:team_num type:int require:1 default:999 other: desc:团队人员数量 | ||
21 | + * @param name:start_time type:date require:1 default:2018-09-01 other: desc:出发日期 | ||
22 | + * @param name:end_time type:date require:1 default:2018-10-01 other: desc:结束日期 | ||
23 | + * @param name:city type:char require:1 default:天津市 other: desc:市 | ||
24 | + * @param name:county type:char require:1 default:南开区 other: desc:区 | ||
25 | + * @param name:street type:char require:1 default:华苑 other: desc:街道 | ||
26 | + * @param name:contact type:char require:1 default:李大师 other: desc:联系人 | ||
27 | + * @param name:tel type:char require:1 default:15122554643 other: desc:电话 | ||
28 | + * @param name:wechat type:char require:1 default:xxx other: desc:微信号 | ||
29 | + * @param name:desc type:text require:1 default:欢迎来到德莱联盟 other: desc:需求描述 | ||
30 | + */ | ||
31 | + public function teamCustomization() | ||
32 | + { | ||
33 | + $request = request(); | ||
34 | + if ($request->isPost()) { | ||
35 | + $post = $request->param(); | ||
36 | + $result = $this->validate( | ||
37 | + [ | ||
38 | + 'team_name' => $post['team_name'], | ||
39 | + 'team_num' => $post['team_num'], | ||
40 | + 'start_time' => $post['start_time'], | ||
41 | + 'end_time' => $post['end_time'], | ||
42 | + 'contact' => $post['contact'], | ||
43 | + 'tel' => $post['tel'], | ||
44 | + 'wechat' => $post['wechat'], | ||
45 | + 'desc' => $post['desc'] | ||
46 | + ], | ||
47 | + [ | ||
48 | + 'team_name' => 'require', | ||
49 | + 'team_num' => 'require', | ||
50 | + 'start_time' => 'require', | ||
51 | + 'end_time' => 'require', | ||
52 | + 'contact' => 'require', | ||
53 | + 'tel' => 'require', | ||
54 | + 'wechat' => 'require', | ||
55 | + 'desc' => 'require' | ||
56 | + ]); | ||
57 | + if (true !== $result) { | ||
58 | + echo json_encode(['msg' => $result, 'code' => 40000]); | ||
59 | + exit(); | ||
60 | + } else { | ||
61 | + $post['address'] = $post['city'] . $post['county'] . $post['street']; | ||
62 | + unset($post['city']); | ||
63 | + unset($post['county']); | ||
64 | + unset($post['street']); | ||
65 | + if (Db::name('team_customization')->insert($post)) { | ||
66 | + echo json_encode(['msg' => '提交成功', 'code' => 20000]); | ||
67 | + exit(); | ||
68 | + } else { | ||
69 | + echo json_encode(['msg' => '提交失败', 'code' => 40000]); | ||
70 | + exit(); | ||
71 | + } | ||
72 | + } | ||
73 | + } else { | ||
74 | + return $this->fetch(); | ||
75 | + } | ||
76 | + } | ||
77 | + | ||
78 | +} |
@@ -88,7 +88,7 @@ class CenterController extends HomeBaseController | @@ -88,7 +88,7 @@ class CenterController extends HomeBaseController | ||
88 | * @url /user/Center/discountCoupon | 88 | * @url /user/Center/discountCoupon |
89 | * @method POST | 89 | * @method POST |
90 | * | 90 | * |
91 | - * @param name:status type:char require:1 default:1 desc:1未使用2已使用3已过期 | 91 | + * @param name:status type:int require:1 default:1 desc:1未使用2已使用3已过期 |
92 | * | 92 | * |
93 | * @return version:版本号 | 93 | * @return version:版本号 |
94 | * @return code:错误码 | 94 | * @return code:错误码 |
1 | +<include file="public@header"/> | ||
2 | +</head> | ||
3 | +<body> | ||
4 | +<div class="wrap js-check-wrap"> | ||
5 | + <ul class="nav nav-tabs"> | ||
6 | + <li class="active"><a href="javascript:;">团队定制</a></li> | ||
7 | + </ul> | ||
8 | + | ||
9 | + <div class="body"> | ||
10 | + <li><h2>团队定制</h2></li> | ||
11 | + <li><div class="left">团队名称</div><div class="text">{$info.team_name}</div></li> | ||
12 | + <li><div class="left">团队人数</div><div class="text">{$info.team_num}</div></li> | ||
13 | + <li><div class="left">出行日期</div><div class="text">{$info.start_time}至{$info.end_time}</div></li> | ||
14 | + <li><div class="left">出发地点</div><div class="text">{$info.address}</div></li> | ||
15 | + <li><div class="left">联系人</div><div class="text">{$info.contact}</div></li> | ||
16 | + <li><div class="left">手机号码</div><div class="text">{$info.tel}</div></li> | ||
17 | + <li><div class="left">微信号码</div><div class="text">{$info.wechat}</div></li> | ||
18 | + <li><div class="left">需求描述</div></li> | ||
19 | + <div style="padding-left: 25%">{$info.desc}</div> | ||
20 | + </div> | ||
21 | + | ||
22 | +</div> | ||
23 | +<style> | ||
24 | + .body{width:50%; margin:0 auto; margin-top: 20px;} | ||
25 | + .body li{width: 100%; height: 45px; line-height: 45px; list-style: none; font-size: large} | ||
26 | + .body li h2{text-align: center} | ||
27 | + .left{float: left; width: 50%; text-align: center} | ||
28 | + .text{float: left; width: 50%; text-align: center} | ||
29 | +</style> | ||
30 | +<script src="__STATIC__/js/admin.js"></script> | ||
31 | +</body> | ||
32 | +</html> |
1 | +<include file="public@header"/> | ||
2 | +</head> | ||
3 | +<body> | ||
4 | +<div class="wrap js-check-wrap"> | ||
5 | + <ul class="nav nav-tabs"> | ||
6 | + <li class="active"><a href="javascript:;">团队定制</a></li> | ||
7 | + </ul> | ||
8 | + | ||
9 | + <form class="js-ajax-form" action="" method="post"> | ||
10 | + <table class="table table-hover table-bordered table-list"> | ||
11 | + <tr> | ||
12 | + <th>序号</th> | ||
13 | + <th>团队姓名</th> | ||
14 | + <th>团队人数</th> | ||
15 | + <th>出发日期</th> | ||
16 | + <th>查看</th> | ||
17 | + </tr> | ||
18 | + <volist name="posts" id="vo" key="k"> | ||
19 | + <tr> | ||
20 | + <td>{$k}</td> | ||
21 | + <td>{$vo.team_name}</td> | ||
22 | + <td>{$vo.team_num}</td> | ||
23 | + <td>{$vo.start_time}</td> | ||
24 | + <td><a href="{:url('Team/detail',['id'=>$vo['id']])}">查看详情</a></td> | ||
25 | + </tr> | ||
26 | + </volist> | ||
27 | + </table> | ||
28 | + <ul class="pagination">{$page|default=''}</ul> | ||
29 | + </form> | ||
30 | +</div> | ||
31 | +<script src="__STATIC__/js/admin.js"></script> | ||
32 | +<script> | ||
33 | + $(".form-control").change(function () { | ||
34 | + $.ajax({ | ||
35 | + url:"{:url('Type/listOrder')}", | ||
36 | + data:{ | ||
37 | + id:$(this).attr('data-id'), | ||
38 | + listorder:$(this).val() | ||
39 | + }, | ||
40 | + type:"POST", | ||
41 | + dataType:"JSON" | ||
42 | + }) | ||
43 | + }) | ||
44 | +</script> | ||
45 | +</body> | ||
46 | +</html> |
@@ -1869,3 +1869,22 @@ function createQRcode($savePath, $qrData = 'PHP QR Code :)', $qrLevel = 'L', $qr | @@ -1869,3 +1869,22 @@ function createQRcode($savePath, $qrData = 'PHP QR Code :)', $qrLevel = 'L', $qr | ||
1869 | return FALSE; | 1869 | return FALSE; |
1870 | } | 1870 | } |
1871 | 1871 | ||
1872 | +function getMonthEnglishWords($index) | ||
1873 | +{ | ||
1874 | + $arr = [ | ||
1875 | + 0 => 'Jan.', | ||
1876 | + 1 => 'Feb.', | ||
1877 | + 2 => 'Mar.', | ||
1878 | + 3 => 'Apr.', | ||
1879 | + 4 => 'May.', | ||
1880 | + 5 => 'Jun.', | ||
1881 | + 6 => 'Jul.', | ||
1882 | + 7 => 'Aug.', | ||
1883 | + 8 => 'Sep.', | ||
1884 | + 9 => 'Oct.', | ||
1885 | + 10 => 'Nov.', | ||
1886 | + 11 => 'Dec.' | ||
1887 | + ]; | ||
1888 | + return $arr[$index]; | ||
1889 | +} | ||
1890 | + |
@@ -11,7 +11,9 @@ class Doc | @@ -11,7 +11,9 @@ class Doc | ||
11 | 'app\portal\controller\IndexController', | 11 | 'app\portal\controller\IndexController', |
12 | 'app\escort\controller\EscortController', | 12 | 'app\escort\controller\EscortController', |
13 | 'app\activity\controller\ActivityController', | 13 | 'app\activity\controller\ActivityController', |
14 | - 'app\user\controller\CenterController' | 14 | + 'app\user\controller\CenterController', |
15 | + 'app\team\controller\TeamController', | ||
16 | + 'app\order\controller\OrderController' | ||
15 | ], | 17 | ], |
16 | 'password' => 'bronet', | 18 | 'password' => 'bronet', |
17 | 'static_path' => '', | 19 | 'static_path' => '', |
-
请 注册 或 登录 后发表评论