diff --git a/app-ht/config/main.php b/app-ht/config/main.php index 6a1de9a..4605928 100644 --- a/app-ht/config/main.php +++ b/app-ht/config/main.php @@ -19,7 +19,12 @@ $config = [ 'runtimePath' => Yii::getAlias('@rootRuntime').'/app-ht/', 'bootstrap' => ['log'], 'modules' => [ - + 'order' => [ + 'class' => 'app\ht\modules\order\Module', + ], + 'maintainer' => [ + 'class' => 'app\ht\modules\maintainer\Module', + ], 'system'=>[ 'class' => 'app\ht\modules\system\Module', ], diff --git a/app-ht/config/params.php b/app-ht/config/params.php index 317a012..8ca189d 100644 --- a/app-ht/config/params.php +++ b/app-ht/config/params.php @@ -1,5 +1,4 @@ 'v0.0.1 build 1', + 'VERSION' => 'v0.0.1 build 2', ]; \ No newline at end of file diff --git a/app-ht/controllers/SiteController.php b/app-ht/controllers/SiteController.php index 02f0dce..9d36817 100644 --- a/app-ht/controllers/SiteController.php +++ b/app-ht/controllers/SiteController.php @@ -183,104 +183,6 @@ class SiteController extends BaseController { $maxSize = 1048576; // 1024 * 1024 = 1MB - //定义允许上传的文件扩展名 - $extArr = array('gif', 'jpg', 'jpeg', 'png', 'bmp'); - - //PHP上传失败 - if (!empty($_FILES['imgFile']['error'])) { - switch ($_FILES['imgFile']['error']) { - case '1': - $error = '图片超过系统允许的大小。'; // php.ini允许的大小(默认2MB) - break; - case '2': - $error = '图片超过表单允许的大小。'; - break; - case '3': - $error = '图片只有部分被上传。'; - break; - case '4': - $error = '请选择图片。'; - break; - case '6': - $error = '找不到临时目录。'; - break; - case '7': - $error = '写文件到硬盘出错。'; - break; - case '8': - $error = 'File upload stopped by extension。'; - break; - case '999': - default: - $error = '未知错误。'; - } - $this->editorAlert($error); - } - - // 确保临时文件夹是否已经创建 - //if (!file_exists($savePath)) { - // mkdir($savePath, 0777, true); - //} - - //有上传文件时 - if (empty($_FILES) === false) { - //原文件名 - $fileName = $_FILES['imgFile']['name']; - //服务器上临时文件名 - $tmpName = $_FILES['imgFile']['tmp_name']; - //文件大小 - $fileSize = $_FILES['imgFile']['size']; - //检查文件名 - if (!$fileName) { - $this->editorAlert("请选择文件。"); - } - - /* - //检查目录 - if (@is_dir($savePath) === false) { - $this->editorAlert("上传目录不存在。"); - } - //检查目录写权限 - if (@is_writable($savePath) === false) { - $this->editorAlert("上传目录没有写权限。"); - } - //检查是否已上传 - if (@is_uploaded_file($tmpName) === false) { - $this->editorAlert("上传失败。"); - } - */ - - //检查文件大小 - if ($fileSize > $maxSize) { - $this->editorAlert("图片大小不能超过" . Utils::formatBytes($maxSize)); - } - - //获得文件扩展名 -// $tempArr = explode(".", $fileName); -// $fileExt = array_pop($tempArr); -// $fileExt = trim($fileExt); -// $fileExt = strtolower($fileExt); - $tmp = explode('.', $fileName); - $fileExt = end($tmp); - - //检查扩展名 - if (in_array($fileExt, $extArr) === false) { - $this->editorAlert("上传文件扩展名是不允许的扩展名。\n只允许" . implode(",", $extArr) . "格式。"); - } - - //新文件名 - $newFileName = date("YmdHis") . '_' . rand(10000, 99999) . '.' . $fileExt; - - $savePath = ImageManager::getTempImgPath($fileExt); - //移动文件 - $filePath = $savePath . '/' . $newFileName; - ImageManager::add($tmpName, $filePath); - - $fileUrl = ImageManager::getUrl($filePath); - - echo json_encode(array('error' => 0, 'url' => $fileUrl)); - exit; - } } /** diff --git a/app-ht/modules/maintainer/BaseModule.php b/app-ht/modules/maintainer/BaseModule.php new file mode 100755 index 0000000..ac737be --- /dev/null +++ b/app-ht/modules/maintainer/BaseModule.php @@ -0,0 +1,17 @@ + + */ +class Module extends BaseModule +{ + public function init() + { + parent::init(); + + //$this->params['perm'] = require(__DIR__ . '/config/perm.php'); + } +} \ No newline at end of file diff --git a/app-ht/modules/maintainer/controllers/UserController.php b/app-ht/modules/maintainer/controllers/UserController.php new file mode 100644 index 0000000..5cdef50 --- /dev/null +++ b/app-ht/modules/maintainer/controllers/UserController.php @@ -0,0 +1,123 @@ +dataList(1); + /** + * 渲染模板 + */ + return $this->render('index', $params); + } + + /** + * 查询数据列表 + */ + protected function dataList($type = '') + { + $request = Yii::$app->request; + $createTime = $request->get('createTime'); + $endTime = $request->get('endTime'); + $mobile = $request->get('mobile'); + $name = $request->get('name'); + + $gets = [ + 'createTime' => $createTime, + 'endTime' => $endTime, + 'mobile' => $mobile, + 'name' => $name, + ]; + + $where = ['and']; + if ($createTime) { + $createTime = strtotime($createTime); + $where[] = ['>=', 'user.created_at', $createTime]; + } + if ($endTime) { + $endTime = strtotime($endTime) + 86400; + $where[] = ['<=', 'user.created_at', $endTime]; + } + if ($mobile) { + $where[] = ['like', 'user.mobile', $mobile]; + } + if ($name) { + $where[] = ['like', 'user.name', $name]; + } + + + if ($type == 0) { + $pageList = UserRepository::getAdminUserList(0, 0, $where); + $pages = null; + } else { + $pageSize = 20; + $pages = new Pagination(['totalCount' => UserRepository::getAdminUserListCount($where), 'pageSize' => $pageSize]); + $pageList = UserRepository::getAdminUserList($pages->offset, $pages->limit, $where); + } + + /** + * 数据整理 + */ + return [ + 'listdata' => $pageList, + 'pages' => $pages, + 'gets' => $gets + ]; + } + /** + * 导出订单数据 + * @return string + */ + public function actionExportDa() + { + $data = $this->dataList(0); + + return $this->renderPartial("exportDa", $data); + } + + /** + * @return string + */ + public function actionInfo() + { + $id = $this->request->get('id'); + + $userModel = UserRepository::findOne(['id' => $id]); + if (empty($userModel)) { + $params = []; + return $this->render('info', $params); + } + + $user = [ + 'id' => $userModel->id, + 'uuid' => $userModel->uuid, + 'mobile' => $userModel->mobile, + 'username' => $userModel->user_name, + 'name' => $userModel->name, + 'licensePic' => ImageManager::getUrl($userModel->license_pic), + 'licensePicMin' => ImageManager::getUrl($userModel->license_pic, 'min'), + 'created_at' => $userModel->created_at + ]; + $params['user'] = $user; + + return $this->render('info', $params); + } +} \ No newline at end of file diff --git a/app-ht/modules/maintainer/views/user/exportDa.php b/app-ht/modules/maintainer/views/user/exportDa.php new file mode 100644 index 0000000..09b2bf2 --- /dev/null +++ b/app-ht/modules/maintainer/views/user/exportDa.php @@ -0,0 +1,55 @@ + + + + +
+ + + + +ID | +维修厂名称 | +维修厂电话 | +注册时间 | +
---|---|---|---|
=$user['id'] ?> | +=$user['name']?> | +=$user['mobile']?> | +=date('Y-m-d H:i', $user['created_at'])?> | + +
ID | +维修厂名称 | +维修厂电话 | +注册时间 | + +操作 | +
---|---|---|---|---|
=$user['id'] ?> | +=$user['name']?> | +=$user['mobile']?> | +=date('Y-m-d H:i', $user['created_at'])?> | + ++ 查看详情 + + | +
+ 没有找到数据 +
+ +维修单ID | +车牌号 | +车型号 | +顾客名 | +顾客手机 | +预修故障 | +预修金额 | +预完成维修时间 | +报修时间 | +维修金额 | +订单状态 | +维修厂名 | +维修厂电话 | +顾客星评 | +顾客评论 | +
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
=$order['id'] ?> | +=$order['car_no']?> | +=$order['car_model']?> | +=$order['customer']?> | +=$order['contact_mobile']?> | ++ | + + | + + | +=date('Y-m-d H:i', $order['created_at'])?> | += $order['order_price']?$order['order_price']:'-'?> | += $gets['statusList'][$order['status']]?> | += $order['maintainer']?> | += $order['maintainer_mobile']?> | ++ | ++ + | + +
维修单ID | +车牌号 | +车型号 | +顾客名 | +顾客手机 | +预修信息 | +报修时间 | +维修金额 | +订单状态 | +维修厂名 | +维修厂电话 | +顾客评论 | +操作 | +
---|---|---|---|---|---|---|---|---|---|---|---|---|
=$order['id'] ?> | +=$order['car_no']?> | +=$order['car_model']?> | +=$order['customer']?> | +=$order['contact_mobile']?> | +";
+ } else {
+ echo "预维故障:未填 "; + } + if ($order['predict_price']) { + echo "预维修金额:".$order['predict_price']." "; + } else { + echo "预维修金额:未填 "; + } + if ($order['predict_finish_time']) { + echo "预修完成日期:". date('Y年m月d日 H时',$order['predict_finish_time'])." "; + } else { + echo "预修完成日期:未填 "; + } + ?> |
+ =date('Y-m-d H:i', $order['created_at'])?> | += $order['order_price']?$order['order_price']:'未录入'?> | += $gets['statusList'][$order['status']]?> | += $order['maintainer']?> | += $order['maintainer_mobile']?> | +"; + } else { + echo "车主暂未评价"; + } + if ($order['comment']) { + echo '内容:'.$order['comment']; + } + ?> | ++ 查看详情 + + | +
+ 没有找到数据 +
+ +