Commit b5b47ff16dafb80a193a0da668e914d459ec9c63
1 parent
b8970364
Exists in
master
app-ht
1. F 厂商,项目,型号关键字搜索可以按编码搜索
Showing
9 changed files
with
55 additions
and
46 deletions
Show diff stats
app-ht/modules/device/views/device/export.php
... | ... | @@ -35,6 +35,7 @@ $cnt = 0; |
35 | 35 | <th width="7%">设备ID</th> |
36 | 36 | <th width="7%">申请时间</th> |
37 | 37 | <th width="7%">授权时间</th> |
38 | + <th width="7%">生成时间</th> | |
38 | 39 | <th width="7%">状态</th> |
39 | 40 | </tr> |
40 | 41 | </thead> |
... | ... | @@ -72,6 +73,9 @@ $cnt = 0; |
72 | 73 | <?= $item['auth_at']? date('Y-m-d H:i:s', $item['auth_at']):'暂无' ?> |
73 | 74 | </td> |
74 | 75 | <td class="td-cls"> |
76 | + <?= $item['created_at']? date('Y-m-d H:i:s', $item['created_at']):'暂无' ?> | |
77 | + </td> | |
78 | + <td class="td-cls"> | |
75 | 79 | <?= $statusList[$item['status']] ?> |
76 | 80 | </td> |
77 | 81 | </tr> | ... | ... |
app-ht/modules/manufacturer/controllers/ManufacturerController.php
... | ... | @@ -50,7 +50,11 @@ class ManufacturerController extends BaseController |
50 | 50 | |
51 | 51 | $where = ['and']; |
52 | 52 | if ($name) { |
53 | - $where[] = ['like', 'name', $name]; | |
53 | + $where[] = [ | |
54 | + 'or', | |
55 | + ['like', 'name', $name], | |
56 | + ['like', 'manufacture_no', $name], | |
57 | + ]; | |
54 | 58 | } |
55 | 59 | if ($phone) { |
56 | 60 | $where[] = ['like', 'phone', $phone]; | ... | ... |
app-ht/modules/model/controllers/ModelController.php
... | ... | @@ -53,7 +53,11 @@ class ModelController extends BaseController |
53 | 53 | $where[] = ['<=', 'm.created_at', $endTime]; |
54 | 54 | } |
55 | 55 | if ($name) { |
56 | - $where[] = ['like', 'm.name', $name]; | |
56 | + $where[] = [ | |
57 | + 'or', | |
58 | + ['like', 'm.name', $name], | |
59 | + ['like', 'm.model_no', $name], | |
60 | + ]; | |
57 | 61 | } |
58 | 62 | if ($type == 0) { |
59 | 63 | $pageList = ModelRepository::getPageList($where, 0 , 0); | ... | ... |
app-ht/modules/production/controllers/ProductionController.php
... | ... | @@ -62,6 +62,7 @@ class ProductionController extends BaseController |
62 | 62 | $productionEndTime = strtotime($productionEndTime) + 86400; |
63 | 63 | $where[] = ['<=', 'p.name', $productionEndTime]; |
64 | 64 | } |
65 | + | |
65 | 66 | if ($type == 0) { |
66 | 67 | $pageList = ProductionRepository::getPageList($where, 0 , 0); |
67 | 68 | $pages = null; | ... | ... |
app-ht/modules/project/controllers/ProjectController.php
... | ... | @@ -53,7 +53,12 @@ class ProjectController extends BaseController |
53 | 53 | $where[] = ['<=', 'p.created_at', $endTime]; |
54 | 54 | } |
55 | 55 | if ($name) { |
56 | - $where[] = ['like', 'p.name', $name]; | |
56 | + | |
57 | + $where[] = [ | |
58 | + 'or', | |
59 | + ['like', 'p.name', $name], | |
60 | + ['like', 'p.project_no', $name], | |
61 | + ]; | |
57 | 62 | } |
58 | 63 | if ($type == 0) { |
59 | 64 | $pageList = ProjectRepository::getPageList($where, 0, 0); | ... | ... |
app-ht/modules/upgrade/controllers/UpgradeController.php
... | ... | @@ -125,7 +125,7 @@ class UpgradeController extends BaseController |
125 | 125 | { |
126 | 126 | $request = Yii::$app->request; |
127 | 127 | $version = $request->post("version"); // 版本 |
128 | - if (empty($version)) { | |
128 | + if (empty(trim($version))) { | |
129 | 129 | Yii::$app->session->setFlash('error', '版本不能为空'); |
130 | 130 | return $this->render('create'); |
131 | 131 | } |
... | ... | @@ -237,7 +237,7 @@ class UpgradeController extends BaseController |
237 | 237 | $params = $this->dataList(1); |
238 | 238 | return $this->render('index', $params); |
239 | 239 | } |
240 | - if (empty($version)) { | |
240 | + if (empty(trim($version))) { | |
241 | 241 | Yii::$app->session->setFlash('error', '版本不能为空'); |
242 | 242 | return $this->render('edit', ["info" => $upgrade]); |
243 | 243 | } | ... | ... |
app-ht/modules/upgrade/views/upgrade/index.php
... | ... | @@ -72,8 +72,8 @@ $this->params['breadcrumbs'][] = $this->title; |
72 | 72 | <table class="table table-striped table-bordered" id="brand-table"> |
73 | 73 | <thead> |
74 | 74 | <tr> |
75 | - <th width="10%">APP版本号</th> | |
76 | - <th width="10%">安装包名称</th> | |
75 | + <th width="10%">版本号</th> | |
76 | + <th width="10%">包名称</th> | |
77 | 77 | <th width="12%">升级批次信息</th> |
78 | 78 | <th width="10%">上传时间</th> |
79 | 79 | <th width="10%">发布状态</th> | ... | ... |
console/controllers/TestController.php
... | ... | @@ -7,14 +7,15 @@ namespace console\controllers; |
7 | 7 | * Time: 11:32 AM |
8 | 8 | */ |
9 | 9 | |
10 | +use Yii; | |
10 | 11 | use common\exts\Aes; |
11 | 12 | use common\exts\RSACrypt; |
12 | 13 | use common\exts\Http; |
13 | 14 | use common\helpers\Utils; |
14 | -use domain\device\Device; | |
15 | + | |
15 | 16 | use GuzzleHttp\Psr7; |
16 | 17 | use yii\console\Controller; |
17 | -use GuzzleHttp\Psr7\Request; | |
18 | + | |
18 | 19 | use function chr; |
19 | 20 | |
20 | 21 | class TestController extends Controller |
... | ... | @@ -33,33 +34,7 @@ class TestController extends Controller |
33 | 34 | //md5($arr['']) |
34 | 35 | } |
35 | 36 | |
36 | - public function actionDeviceAuth() | |
37 | - { | |
38 | - $url = 'http://kingb:8012/app-api/web/authDevice'; | |
39 | - //$url = 'http://47.107.95.101/app-api/web/authDevice'; | |
40 | - $manufactureNo = '0001'; | |
41 | - $device_id = 'DEVICE00000A'; | |
42 | - $projectNo = '0001'; | |
43 | - $modelNo = '0001'; | |
44 | - $productionNo = '0001'; | |
45 | - $timestamp = time(); | |
46 | - $salt = '13456'; | |
47 | - $sign = md5($manufactureNo. $projectNo. $modelNo . $productionNo . $timestamp .$device_id. $salt); | |
48 | - $params = [ | |
49 | - 'manufacture' => $manufactureNo, | |
50 | - 'device_id' => $device_id, | |
51 | - 'project' => $projectNo, | |
52 | - 'model' => $modelNo, | |
53 | - 'production' => $productionNo, | |
54 | - 'timestamp' => $timestamp, | |
55 | - 'sign' => $sign, | |
56 | - ]; | |
57 | - $params = json_encode($params); | |
58 | - //$params = '{"manufacture":"0002","device_id":"6705BF36C37F","project":"0002","model":"0003","production":"0002","timestamp":"1500000000","sign":"2b67361ba972020496f1a1b3df388499"}'; | |
59 | - $postResult = Http::POST($url, $params); | |
60 | - echo $postResult; | |
61 | 37 | |
62 | - } | |
63 | 38 | |
64 | 39 | public function actionUpgrade() |
65 | 40 | { |
... | ... | @@ -181,7 +156,8 @@ class TestController extends Controller |
181 | 156 | { |
182 | 157 | $url = 'http://kingb:8012/app-api/web/CryptTxt'; |
183 | 158 | $randKey = '98765432';//Utils::rand(32); |
184 | - $rsa = new RSACrypt(); | |
159 | + $rsaKeys = Yii::$app->params['AUTH_DEVICE_RSA_PKCS_1']; | |
160 | + $rsa = new RSACrypt($rsaKeys['PRIVATE'], $rsaKeys['PUBLIC']); | |
185 | 161 | $aes = new Aes($randKey); |
186 | 162 | $deviceId = 'oelooeloeloeloe'; |
187 | 163 | $manufactureNo = '0001'; |
... | ... | @@ -202,19 +178,19 @@ class TestController extends Controller |
202 | 178 | /** |
203 | 179 | * |
204 | 180 | */ |
205 | - public function actionAuthDeviceT() | |
181 | + public function actionAuthDevice() | |
206 | 182 | { |
207 | - $url = 'http://kingb:8012/app-api/web/authDeviceT'; | |
208 | - //$url = 'http://47.107.95.101/app-api/web/authDeviceT'; | |
183 | + $url = 'http://kingb:8012/app-api/web/authDevice'; | |
184 | + $url = 'http://47.107.95.101/app-api/web/authDevice'; | |
209 | 185 | $manufactureNo = '0001'; |
210 | - $device_id = 'DEVICE00000A'; | |
186 | + $device_id = 'DEVICE00000B'; | |
211 | 187 | $projectNo = '0001'; |
212 | 188 | $modelNo = '0001'; |
213 | 189 | $productionNo = '0001'; |
214 | 190 | $timestamp = time(); |
215 | 191 | |
216 | 192 | |
217 | - $randKey = Utils::rand(16).$timestamp; | |
193 | + $randKey = Utils::rand(16); | |
218 | 194 | $salt = "13456"; |
219 | 195 | $sign = md5($manufactureNo. $projectNo. $modelNo . $productionNo . $timestamp .$device_id. $salt); |
220 | 196 | $deviceParams = [ |
... | ... | @@ -227,9 +203,11 @@ class TestController extends Controller |
227 | 203 | 'sign' => $sign, |
228 | 204 | ]; |
229 | 205 | $deviceParams = json_encode($deviceParams); |
230 | - $rsa = new RSACrypt(); | |
206 | + $rsaKeys = Yii::$app->params['AUTH_DEVICE_RSA_PKCS_1']; | |
207 | + $rsa = new RSACrypt($rsaKeys['PRIVATE'], $rsaKeys['PUBLIC']); | |
208 | + | |
231 | 209 | $randomKey = $rsa->encrypt($randKey); |
232 | - $aes = new Aes($randKey); | |
210 | + $aes = new Aes(substr(md5($randKey.'12356'), 8, 16)); | |
233 | 211 | $params = [ |
234 | 212 | 'randomKey' => $randomKey, |
235 | 213 | 'content' => $aes->encrypt($deviceParams) |
... | ... | @@ -247,11 +225,18 @@ class TestController extends Controller |
247 | 225 | public function actionA() |
248 | 226 | { |
249 | 227 | $str = "87654321"; |
250 | - $rsa = new RSACrypt(); | |
251 | - $deStr = "i5fNIUnPIFuSWeSIfh6f2Ehrm101XQMKRKuJ86QdrswO90jzcTw6LxWZDDe9YaS6KEnnUP8QaKuFKNEZlY+UsLWxBSKLwPEt3Qf7TAV6bXQBIYBzOXZTFpjvaBa+v1nQFrBPhYBo\/2RF5uVhk8xEilIe7A2XQLEvvhowIjFJevE="; | |
228 | + $rsaKeys = Yii::$app->params['AUTH_DEVICE_RSA_PKCS_1']; | |
229 | + $rsa = new RSACrypt($rsaKeys['PRIVATE'], $rsaKeys['PUBLIC']); | |
230 | + $deStr = "SRAeq\/pjyDA+0TtCTo06cbskERUUXvmGh3FdocS9AFmMsYDN\/TACQeU9pZhB5zKYHsJSTo\/JawuN\nG0ZBFd1B6TvJ\/1PkX30cvL9i03Ujo1JVe1njhMrig3mvNd7RDAylNzaFAAHU\/Wb\/94kf7gRGNyTj\ngj78Oe0bLdwasz4vBFE=\n"; | |
252 | 231 | |
253 | 232 | //echo $deStr."\r\n"; |
254 | - echo $rsa->decrypt($deStr); | |
233 | + $randKey = $rsa->decrypt($deStr); | |
234 | +echo $randKey."\r\n"; | |
235 | + $randKey = substr(md5($randKey.'12356'), 8, 16)."\r\n"; | |
236 | + echo $randKey."\r\n"; | |
237 | + $aes = new Aes($randKey); | |
238 | + echo $aes->decrypt("nZ8U4BlG0vxckrPM0lquvGDZ9Yuv32+MbYKZG8cqfMGJcltEEquc9v88bzpzm2dpkX5nR4ugLxfw\nc65yqYouozxyX+UdXPNHqaOYIQK\/MVWi+GkYsEafezJhozyGrLWAo7hHIdYcV\/fnm7xyEAaN\/91Q\nWdrhYmGvMf1IusGPBDaRnZtJ+mR1MhElZP73mQppFlusI8EJVFcEx\/z\/SkE9ywhPqAsK721xV+Fe\ncd7sNKs=\n"); | |
239 | + | |
255 | 240 | } |
256 | 241 | |
257 | 242 | } | ... | ... |
domain/upgrade/Upgrade.php
... | ... | @@ -20,6 +20,9 @@ class Upgrade |
20 | 20 | static function create($item) |
21 | 21 | { |
22 | 22 | try { |
23 | + if (isset($item["version"])) { | |
24 | + $item["version"] = trim($item["version"]); | |
25 | + } | |
23 | 26 | $where = [ |
24 | 27 | 'version' => $item["version"], |
25 | 28 | 'manufacture_id' => $item["manufacture_id"], |
... | ... | @@ -67,6 +70,9 @@ class Upgrade |
67 | 70 | if (empty($upgradeModel)) { |
68 | 71 | return false; |
69 | 72 | } |
73 | + if (isset($item['version'])) { | |
74 | + $item['version'] = trim($item['version']); | |
75 | + } | |
70 | 76 | if (isset($item['version']) && $upgradeModel->version != $item['version']) { |
71 | 77 | $where = [ |
72 | 78 | 'version' => $item["version"], | ... | ... |