Commit 7d60e23d54c9c0050ff51a221b143c6c4ce3052b
1 parent
32926e46
Exists in
master
app-wx(v0.1.0 build 12)
1. F 短链接跳转功能
Showing
4 changed files
with
26 additions
and
91 deletions
Show diff stats
app-wx/config/params.php
app-wx/controllers/BaseController.php
@@ -183,6 +183,17 @@ class BaseController extends AppController | @@ -183,6 +183,17 @@ class BaseController extends AppController | ||
183 | $baseURL = Yii::$app->request->getHostInfo(); | 183 | $baseURL = Yii::$app->request->getHostInfo(); |
184 | } | 184 | } |
185 | 185 | ||
186 | + $path = $this->request->get('j_path'); | ||
187 | + $model= $this->request->get('j_model'); | ||
188 | + $paramOne= $this->request->get('pOne'); | ||
189 | + if (!empty($path) && !empty($model)) { | ||
190 | + $locationUrl = Yii::$app->params["frontEndBaseUrl"].$model."#".$path; | ||
191 | + if (!empty($paramOne)) { | ||
192 | + $locationUrl .= "/".urldecode($paramOne); | ||
193 | + } | ||
194 | + header("Location: $locationUrl");exit; | ||
195 | + } | ||
196 | + | ||
186 | if(YII_ENV_DEV && $appUser->isGuest){ | 197 | if(YII_ENV_DEV && $appUser->isGuest){ |
187 | //header("Location: " .$baseURL . "/user#login" ); | 198 | //header("Location: " .$baseURL . "/user#login" ); |
188 | //exit; | 199 | //exit; |
app-wx/controllers/SiteController.php
@@ -38,94 +38,16 @@ class SiteController extends BaseController | @@ -38,94 +38,16 @@ class SiteController extends BaseController | ||
38 | */ | 38 | */ |
39 | public function actionIndex() | 39 | public function actionIndex() |
40 | { | 40 | { |
41 | - //获取当前用户的模型model | ||
42 | - $engineerId = $this->getEngineerId(); | ||
43 | - $engineer = new stdClass(); | 41 | + |
44 | /** | 42 | /** |
45 | * 构造user的共用信息 | 43 | * 构造user的共用信息 |
46 | */ | 44 | */ |
47 | - $engineer = $this->buildEngineerResult($engineerId); | ||
48 | - | ||
49 | - return $this->render('index', | ||
50 | - [ | ||
51 | - 'engineer' => $engineer, | ||
52 | - ] | ||
53 | - ); | ||
54 | - } | ||
55 | 45 | ||
56 | - private function buildEngineerResult($engineerId) | ||
57 | - { | ||
58 | - $query = Engineer::find() | ||
59 | - ->select(['engineer.id', 'engineer_profile.headimgurl','engineer_profile.nickname']) | ||
60 | - ->leftJoin('engineer_profile', "engineer.id = engineer_profile.engineer_id") | ||
61 | - ->where(['engineer.id' => $engineerId]); | ||
62 | - $query->asArray(); | ||
63 | - $engineerArray = $query->one(); | ||
64 | - | ||
65 | - if(empty($engineerArray)){ | ||
66 | - return false; | ||
67 | - } | ||
68 | 46 | ||
69 | - $engineer = new stdClass(); | ||
70 | - $engineer->id = (int)$engineerArray['id']; | ||
71 | - $engineer->headimgurl = $engineerArray['headimgurl']; | ||
72 | - $engineer->nickname = $engineerArray['nickname']; | ||
73 | - return $engineer; | 47 | + return $this->render('index'); |
74 | } | 48 | } |
75 | 49 | ||
76 | 50 | ||
77 | - /** | ||
78 | - * | ||
79 | - */ | ||
80 | - public function actionAjaxJweixin() | ||
81 | - { | ||
82 | - // 设置微信分享内容 | ||
83 | - $result = new stdClass(); | ||
84 | - | ||
85 | - $engineerId = $this->getEngineerId(); | ||
86 | - | ||
87 | - $baseUrl = $this->site->base_url; | ||
88 | - if (isset($_GET['from'])) { | ||
89 | - $url = $_GET['from']; | ||
90 | - } else { | ||
91 | - $url = $baseUrl; | ||
92 | - } | ||
93 | - | ||
94 | - $sign = WxHelper::getWxJSSDK()->getSignContext($url); | ||
95 | - | ||
96 | - $result->appid = $sign->appId; | ||
97 | - $result->timestamp = $sign->timestamp; | ||
98 | - $result->noncestr = $sign->nonceStr; | ||
99 | - $result->signature = $sign->signature; | ||
100 | - | ||
101 | - | ||
102 | - //$sn = $engineer ? urlencode(base64_encode($engineer->id)) : ''; | ||
103 | - // 携带当前用户的邀请码参数,实现推荐用户功能 | ||
104 | - $sn = ''; | ||
105 | - $engineer = Engineer::findOne($engineerId); | ||
106 | - if ($engineer) { | ||
107 | - if (empty($engineer->invite_code)) { | ||
108 | - $engineer->invite_code = Engineer::createInviteCode($engineerId); | ||
109 | - $engineer->save(); | ||
110 | - } | ||
111 | - $sn = $engineer->invite_code; | ||
112 | - } | ||
113 | - $result->user_bridge_url = $baseUrl . '/wechat/bridging?sn=' . $sn . '&tourl=' . urlencode($url); | ||
114 | - $result->sn = $sn; | ||
115 | - | ||
116 | - if ($engineer) { | ||
117 | - $profile = EngineerProfile::findOne(['engineer_id' => $engineer->id]); | ||
118 | - $result->title = $this->wx->name; | ||
119 | - $result->icon = $profile->headimgurl; | ||
120 | - } else { | ||
121 | - $result->title = $this->wx->name; | ||
122 | - $result->icon = ''; | ||
123 | - } | ||
124 | - $result->desc = $this->wx->intro; | ||
125 | - | ||
126 | - | ||
127 | - return $this->renderJson($result); | ||
128 | - } | ||
129 | 51 | ||
130 | /* | 52 | /* |
131 | * 错误页面 | 53 | * 错误页面 |
@@ -151,8 +73,8 @@ class SiteController extends BaseController | @@ -151,8 +73,8 @@ class SiteController extends BaseController | ||
151 | { | 73 | { |
152 | $this->layout = '/error'; | 74 | $this->layout = '/error'; |
153 | $viewTpl = 'error/block.php'; | 75 | $viewTpl = 'error/block.php'; |
154 | - $service_phone = SysSetting::getServicePhone(); | ||
155 | - return $this->render($viewTpl,['service_phone'=>$service_phone]); | 76 | + $service_phone = '4000000000'; |
77 | + return $this->render($viewTpl,['service_phone'=> $service_phone]); | ||
156 | } | 78 | } |
157 | 79 | ||
158 | /** 关注提示 | 80 | /** 关注提示 |
@@ -162,7 +84,7 @@ class SiteController extends BaseController | @@ -162,7 +84,7 @@ class SiteController extends BaseController | ||
162 | { | 84 | { |
163 | $this->layout = '/error'; | 85 | $this->layout = '/error'; |
164 | $viewTpl = 'error/subscribe.php'; | 86 | $viewTpl = 'error/subscribe.php'; |
165 | - $service_phone = SysSetting::getServicePhone(); | 87 | + $service_phone = '4000000000'; |
166 | return $this->render($viewTpl,['service_phone'=>$service_phone]); | 88 | return $this->render($viewTpl,['service_phone'=>$service_phone]); |
167 | } | 89 | } |
168 | 90 | ||
@@ -174,7 +96,7 @@ class SiteController extends BaseController | @@ -174,7 +96,7 @@ class SiteController extends BaseController | ||
174 | $this->layout = '/error'; | 96 | $this->layout = '/error'; |
175 | $viewTpl = 'error/block.php'; | 97 | $viewTpl = 'error/block.php'; |
176 | $id = $this->request->get('id'); | 98 | $id = $this->request->get('id'); |
177 | - $service_phone = SysSetting::getServicePhone(); | 99 | + $service_phone = '4000000000'; |
178 | $errorMsg = '当前没有权限查看该内容'; | 100 | $errorMsg = '当前没有权限查看该内容'; |
179 | if ($id == 1) { | 101 | if ($id == 1) { |
180 | $errorMsg = '请进行认证以后再来查看该页面'; | 102 | $errorMsg = '请进行认证以后再来查看该页面'; |
@@ -184,16 +106,18 @@ class SiteController extends BaseController | @@ -184,16 +106,18 @@ class SiteController extends BaseController | ||
184 | 106 | ||
185 | public function actionIndex2() | 107 | public function actionIndex2() |
186 | { | 108 | { |
187 | - | ||
188 | return $this->renderPartial('index2'); | 109 | return $this->renderPartial('index2'); |
189 | } | 110 | } |
190 | 111 | ||
191 | /** | 112 | /** |
192 | - * 跳转到接单教程界面 | 113 | + * 推送给客户的短链接 |
114 | + * @return \yii\web\Response | ||
193 | */ | 115 | */ |
194 | - public function actionToTutorialPage() | 116 | + public function actionT() |
195 | { | 117 | { |
196 | - header("Location: http://mp.weixin.qq.com/mp/homepage?__biz=MzIyNDc5ODMwOA==&hid=1&sn=4f8b8972dc5f471a85618dde0f6a5987&scene=18"); | ||
197 | - exit; | 118 | + $shortUUID = $this->request->get('o'); |
119 | + $locationUrl = Yii::$app->params["frontEndBaseUrl"]."order/customer#customer-order/".$shortUUID.'/1'; | ||
120 | + return $this->redirect($locationUrl); | ||
198 | } | 121 | } |
122 | + | ||
199 | } | 123 | } |
app-wx/modules/order/controllers/DefaultController.php
@@ -308,7 +308,7 @@ class DefaultController extends BaseController | @@ -308,7 +308,7 @@ class DefaultController extends BaseController | ||
308 | ['name' => '奔驰E280'], | 308 | ['name' => '奔驰E280'], |
309 | ]; | 309 | ]; |
310 | foreach ($models as $k => $v) { | 310 | foreach ($models as $k => $v) { |
311 | - if (false !== strpos($v['name'], strtoupper($keyword))) { | 311 | + if (false !== strpos(strtoupper($v['name']), strtoupper($keyword))) { |
312 | $items[] = $v; | 312 | $items[] = $v; |
313 | } | 313 | } |
314 | } | 314 | } |