diff --git a/app-ht/config/params.php b/app-ht/config/params.php index a1f383b..5c74be7 100644 --- a/app-ht/config/params.php +++ b/app-ht/config/params.php @@ -1,5 +1,5 @@ 'v1.8.6 build 15', - 'MANUFACTURE_ROLE_ID' => 1 + 'MANUFACTURE_ROLE_ID' => 1, + 'VERSION' => 'v1.8.6 build 15', ]; \ No newline at end of file diff --git a/app-ht/modules/datas/config/perm.php b/app-ht/modules/datas/config/perm.php index d10bcc3..84d5999 100644 --- a/app-ht/modules/datas/config/perm.php +++ b/app-ht/modules/datas/config/perm.php @@ -3,7 +3,7 @@ return [ 'label' => '数据统计', 'items' => [ - 'shop_city' => [ + 'data-stats' => [ 'label' => '数据统计', 'items' => [ 2 => '数据统计', diff --git a/app-ht/modules/device/controllers/DeviceController.php b/app-ht/modules/device/controllers/DeviceController.php index d2f96b3..9c0ca66 100644 --- a/app-ht/modules/device/controllers/DeviceController.php +++ b/app-ht/modules/device/controllers/DeviceController.php @@ -329,7 +329,17 @@ class DeviceController extends BaseController $type = $req->post('type'); $keyword = $req->post('query'); $e = new stdClass(); - $list = CreateBatchRepository::getSerialNoComponent($type, $keyword); + $where = []; + if ('manufacture' == $type) { + $user = Yii::$app->user->identity; + if (isset($user->is_manufacture) && $user->is_manufacture == 1) { + $where = 'sys_user_id = '.$user->id; + + } else { + $where = 'id >0'; + } + } + $list = CreateBatchRepository::getSerialNoComponent($type, $where); $e->list = $list; return $this->renderJson($e); diff --git a/app-ht/modules/home/controllers/BoardController.php b/app-ht/modules/home/controllers/BoardController.php index 03cf3d9..c1bbe36 100644 --- a/app-ht/modules/home/controllers/BoardController.php +++ b/app-ht/modules/home/controllers/BoardController.php @@ -37,179 +37,6 @@ class BoardController extends BaseController return $this->render("index", $params); } - // 获取仪表盘信息 - public function actionGetData() - { - $act = $this->request->get('pickOrder'); - $e= new stdClass(); - - if (empty($act)) { - $e->engineerAuth = $this->getEngineerAuth(EngineerStatus::STATUS_REALNAME_REVIEW); - $e->engineerAvaliable = $this->getEngineerAuth(); - $e->engineerSkillAuth = $this->getEngineerSkillAuth(); - $e->deviceReview = $this->getDeviceReview(); - $e->appeal = $this->getAppeal(); - $e->errorInvoice = $this->getErrorInvoice(); - $e->withdraw = $this->getWithdraw(); - } else { - $queryPickOrder = RepairOrderModel::find(); - $queryPickOrder->where(['status' => RepairOrderStatus::STATUS_WAIT_PICK]); - $count = $queryPickOrder->count(); - if (empty($count)) { - $count = 0; - } - $e->pickOrderCount = $count; - } - - return $this->renderJson($e); - } - - // 获取订单数据 - public function actionGetOrderData() - { - $e = new stdClass(); - $e->success = true; - $end = time(); - $endT = strtotime(date('Y-m-d')) + 1; - $start = $endT - 6 * 24 * 3600; - $status = array( - RepairOrderStatus::STATUS_FINISH, - RepairOrderStatus::STATUS_WAIT_RATE, - RepairOrderStatus::STATUS_USER_CANCEL, - RepairOrderStatus::STATUS_ENGINEER_CANCEL, - RepairOrderStatus::STATUS_USER_CLOSE, - RepairOrderStatus::STATUS_ENGINEER_CLOSE - ); - - $type = 0; - $orderListTmp = $this->getOrder($start, $end, $type, $status); - $orderList = array(); - if ($orderListTmp) { - foreach ($orderListTmp as $k => $v) { - $orderList[$v['mydate']] = $v; - } - } - $dateList = $this->genDate($start); - $data =array(); - foreach ($dateList as $kk => $vv) { - $myArr = array(); - $myArr['date'] = $kk; - if ($type == 0) { - $myArr['pay_price'] = isset($orderList[$kk]['pay_price']) ? $orderList[$kk]['pay_price'] : 0; - $myArr['repair_price'] = isset($orderList[$kk]['repair_price']) ? $orderList[$kk]['repair_price'] : 0; - } - - $data[] = $myArr; - } - $e->data = $data; - return $this->renderJson($e); - } - - // 热力图 - public function actionGetHeatData() - { - $e= new stdClass(); - $e->success = true; - $north_east= $this->request->get('north_east'); - $south_west = $this->request->get('south_west'); - $zoom = $this->request->get('zoom'); - $distance = 25000; //25公里内的点 - $earthRadius = Distance::EARTH_RADIUS; - $table1 = 'address'; - $end = time(); - $endT =strtotime(date('Y-m-d')) + 1; - $start = $endT - 6 * 24 * 3600; - $status =array( - RepairOrderStatus::STATUS_FINISH, - RepairOrderStatus::STATUS_WAIT_RATE, - RepairOrderStatus::STATUS_USER_CANCEL, - RepairOrderStatus::STATUS_ENGINEER_CANCEL, - RepairOrderStatus::STATUS_USER_CLOSE, - RepairOrderStatus::STATUS_ENGINEER_CLOSE - ); - - /* - $vRadian= "$earthRadius * acos( cos( radians('$lat') ) * cos( radians( $table1.latitude ) ) * cos( radians( $table1.longitude ) - radians('$lng') ) + - sin( radians('$lat') ) * sin( radians( $table1.latitude ) ) )"; - */ - - $repairOrderModel = RepairOrderModel::find(); - $repairOrderModel->leftJoin("address","address.id = repair_order.address_id"); - $repairOrderModel->select(["concat(address.latitude,'_',address.longitude) as latlng", "count(*) as mycount"]); - $repairOrderModel->where(['repair_order.status' => $status]); - $repairOrderModel->andFilterWhere(['>', 'repair_order.created_at', $start]); - $repairOrderModel->andFilterWhere(['<', 'repair_order.created_at', $end]); - - $repairOrderModel->andFilterWhere(['<', "address.latitude", $north_east[0]]); - $repairOrderModel->andFilterWhere(['>', "address.latitude", $south_west[0]]); - - $repairOrderModel->andFilterWhere(['<', "address.longitude", $north_east[1]]); - $repairOrderModel->andFilterWhere(['>', "address.longitude", $south_west[1]]); - $repairOrderModel->groupBy('latlng'); - $repairOrderModel->asArray(); - $olist = $repairOrderModel->all(); - - - $item = array('max' => 100, 'data' => array()); - if ($olist) { - foreach ($olist as $k => $v) { - $latlngTemp = explode('_', $v['latlng']); - $item['data'][] = array('lat' => $latlngTemp[0], 'lng' => $latlngTemp[1], 'count' => $v['mycount']); - } - } - $e->item =$item; - return $this->renderJson($e); - } - - // 获取通知 - public function actionGetNotice() - { - $act = $this->request->post('act'); - if ($act == 'remove') { - $id = $this->request->post('id'); - return $this->removeNotice($id); - } - $e = new stdClass(); - $e->success = false; - - $e->count = 0; - - $noticeInfoModel = NoticeInfoModel::find(); - $noticeInfoModel->where(['status' => NoticeInfoModel::STATUS_UNREAD]); - - $noticeInfoModel->asArray(); - $count = $noticeInfoModel->count(); - $noticeInfoModel->limit(6); - $nList = $noticeInfoModel->all(); - $e->msgList = array(); - if ($nList) { - $tt = time(); - foreach ($nList as $k => $v) { - $v['created_date_time'] = date('Y-m-d H:i:s', $v['created_at']); - $v['created_time'] = $this->getTime($v['created_at'], $tt); - $nList[$k] = $v; - } - $e->count = $count; - $e->msgList = $nList; - $e->success = true; - } - - return $this->renderJson($e); - } - - // 删除 - protected function removeNotice($id) - { - $e= new stdClass(); - $e->success = false; - $e->error = 'Fail'; - $noticeInfo = NoticeInfoModel::findOne($id); - if ($noticeInfo && $noticeInfo->delete()) { - $e->success = true; - } - - return $this->renderJson($e); - } // 判断时间 protected function getTime($t, $curT) @@ -241,124 +68,4 @@ class BoardController extends BaseController return $dataArr; } - // 贴码设备 - protected function getDeviceReview() - { - $bindDeviceModel = BindDeviceApplyModel::find(); - $wh = array('status' => BindDeviceApplyModel::STATUS_APPLYING); - $bindDeviceModel->where($wh); - $count = $bindDeviceModel->count(); - - $url = Url::toRoute('/device/userdevice/apply?status=0'); - $returnArr = array(0, $url); - if ($count > 0) { - $returnArr = array($count, $url); - } - - return $returnArr; - } - - // 质保申请 - protected function getAppeal() - { - $repairOrderAppealModel = RepairOrderAppealModel::find(); - $wh = array('status' => RepairOrderAppealModel::STATUS_APPEALING); - $repairOrderAppealModel->where($wh); - $count = $repairOrderAppealModel->count(); - $url = Url::toRoute('/trade/appeal/index'); - $returnArr = array(0, $url); - if ($count > 0) { - $returnArr = array($count, $url); - } - - return $returnArr; - } - - // 工程师认证 - protected function getEngineerAuth($status = EngineerStatus::STATUS_SKILL_AUTH) - { - $engineerModel = EngineerModel::find(); - $wh = array('status' => $status, 'is_fake_id' => 0); - $engineerModel->where($wh); - $count = $engineerModel->count(); - $url = Url::toRoute('/engineer/engineer/index?status=2'); - $returnArr = array(0, $url); - if ($count > 0) { - $returnArr = array($count, $url); - } - - return $returnArr; - } - - // 技能审核,这里不能以人为单位,应该以技能为单位,一个人可以多项技能认证 - protected function getEngineerSkillAuth() - { - $engineerSkillModel = EngineerSkillsModel::find(); - $wh = array('engineer_skills.status' => EngineerSkillsModel::STATUS_REVIEWING); - $engineerSkillModel->select(["engineer_skills.engineer_id"]); - $engineerSkillModel->distinct(); - $engineerSkillModel->where($wh); - - $count = $engineerSkillModel->count(); - $url = Url::toRoute('/engineer/engineer/index?status=6'); - $returnArr = array(0, $url); - if ($count > 0) { - $returnArr = array($count, $url); - } - - return $returnArr; - } - - // 提现审核 - protected function getWithdraw() - { - $count = EngineerWithdrawRepository::getReviewingWithdrawCount(); - $url = Url::toRoute('/engineer/withdraw/index'); - $returnArr = array(0, $url); - if ($count > 0) { - $returnArr = array($count, $url); - } - - return $returnArr; - } - - // 发票出错 - protected function getErrorInvoice($kplx = InvoiceApi::KPLX_NORMAL) - { - $invoiceModel = InvoiceModel::find(); - $wh = array('status' => InvoiceModel::STATUS_ERROR, 'kplx' => $kplx); - $invoiceModel->where($wh); - $count = $invoiceModel->count(); - $url = Url::toRoute(['/invoice/invoice/index', 'invoice_status' => InvoiceModel::STATUS_ERROR]); - $returnArr = array(0, $url); - if ($count > 0) { - $returnArr = array($count, $url); - } - - return $returnArr; - } - - /* 订单数据 */ - //获取订单数量(当日和七天,已支付,未支付) - protected function getOrder($start, $end, $selectType = 0, $status = 0) - { - $orderModel = RepairOrderModel::find(); - if ($status != 0) { - $orderModel->where(['status' => $status]); - } - - if ($selectType == 0) { - $orderModel->select(['FROM_UNIXTIME(`created_at`, "%Y-%m-%d") as mydate','sum(pay_price) as pay_price','sum(repair_price) as repair_price']); - } else { - $orderModel->select(['FROM_UNIXTIME(`created_at`, "%Y-%m-%d") as mydate','count(*) as cc']); - } - - $orderModel->andFilterWhere(['>', 'created_at', $start]); - $orderModel->andFilterWhere(['<', 'created_at', $end]); - $orderModel->groupBy('mydate'); - $orderModel->asArray(); - $oList = $orderModel->all(); - - return $oList; - } } \ No newline at end of file diff --git a/app-ht/modules/home/views/board/index.php b/app-ht/modules/home/views/board/index.php index d4cb83b..4e481ba 100644 --- a/app-ht/modules/home/views/board/index.php +++ b/app-ht/modules/home/views/board/index.php @@ -61,13 +61,5 @@ $this->params['breadcrumbs'][] = '控制面板'; diff --git a/app-ht/modules/upgrade/controllers/UpgradeController.php b/app-ht/modules/upgrade/controllers/UpgradeController.php index 900953d..06c218f 100644 --- a/app-ht/modules/upgrade/controllers/UpgradeController.php +++ b/app-ht/modules/upgrade/controllers/UpgradeController.php @@ -76,7 +76,7 @@ class UpgradeController extends BaseController } $user = Yii::$app->user->identity; if (isset($user->is_manufacture) && $user->is_manufacture == 1) { - $where[] = ['like', 'mf.sys_user_id', $user->id]; + $where[] = ['=', 'mf.sys_user_id', $user->id];// ??? } if ($type == 0) { $pageList = UpgradeRepository::getPageList($where, 0 , 0); diff --git a/app-ht/views/layouts/_main-header.php b/app-ht/views/layouts/_main-header.php index e9cbd08..2a00449 100644 --- a/app-ht/views/layouts/_main-header.php +++ b/app-ht/views/layouts/_main-header.php @@ -13,10 +13,10 @@ use yii\helpers\Url;