cqp 3 veckor sedan
förälder
incheckning
85c1f6fff7
3 ändrade filer med 34 tillägg och 187 borttagningar
  1. 0 40
      app/Http/Controllers/Api/EmployeeController.php
  2. 34 0
      app/Service/EmployeeService.php
  3. 0 147
      routes/wx.php

+ 0 - 40
app/Http/Controllers/Api/EmployeeController.php

@@ -2,25 +2,11 @@
 
 namespace App\Http\Controllers\Api;
 
-
-use App\Model\Employee;
 use App\Service\EmployeeService;
 use Illuminate\Http\Request;
 
 class EmployeeController extends BaseController
 {
-    public function getTopMessage(Request $request){
-        $service = new EmployeeService();
-        $user = $request->userData->toArray();
-        list($status,$data) = $service->getTopMessage($request->all(),$user);
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-    }
-
     public function getLoginMan(Request $request){
         $user = $request->userData->toArray();
 
@@ -40,32 +26,6 @@ class EmployeeController extends BaseController
         }
     }
 
-    public function employeeEditImg(Request $request)
-    {
-        $service = new EmployeeService();
-        $user = $request->userData->toArray();
-        list($status,$data) = $service->employeeEditImg($request->all(),$user);
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-    }
-
-    public function getEmployeeImg(Request $request)
-    {
-        $service = new EmployeeService();
-        $user = $request->userData->toArray();
-        list($status,$data) = $service->getEmployeeImg($user);
-
-        if($status){
-            return $this->json_return(200,'',$data);
-        }else{
-            return $this->json_return(201,$data);
-        }
-    }
-
     public function employeeEdit(Request $request)
     {
         $service = new EmployeeService();

+ 34 - 0
app/Service/EmployeeService.php

@@ -29,6 +29,40 @@ use Mockery\Exception;
  */
 class EmployeeService extends Service
 {
+    public function employeeEditOther($data,$user){
+        list($status,$msg) = $this->employeeOtherRule($data,$user);
+        if(!$status) return [$status,$msg];
+
+        try {
+            DB::beginTransaction();
+            $model = new Employee();
+            $model = $model->where('id',$user['id'])->first();
+            $model->password = Hash::make($data['new_password']);
+            $model->save();
+
+            DB::commit();
+        }catch (\Exception $exception){
+            DB::rollBack();
+            return [false, $exception->getMessage()];
+        }
+
+        return [true,''];
+    }
+
+    public function employeeOtherRule($data,$user){
+        if(! isset($data['old_password'])) return [false,'请输入原密码'];
+        if($data['old_password'] == "") return [false,'原密码不能为空'];
+        if(! isset($data['new_password'])) return [false,'请输入新密码'];
+        if($data['new_password'] == "") return [false,'新密码不能为空'];
+        if(! isset($data['re_password'])) return [false,'请输入确认密码'];
+        if($data['re_password'] == "") return [false,'确认密码不能为空'];
+        if(! Hash::check($data['old_password'], $user['password'])) return [false,'原密码错误'];
+        if($data['new_password'] == $data['old_password']) return [false,'原密码与新密码一致'];
+        if($data['new_password'] !== $data['re_password']) return [false,'新密码与确认密码不一致'];
+
+        return [true,''];
+    }
+
     /**
      * 用户编辑
      * @param $data

+ 0 - 147
routes/wx.php

@@ -16,153 +16,6 @@ Route::any('wxSetUser', 'Api\WxController@setUser');
 Route::any('wxSetMobile', 'Api\WxController@setMobile');
 Route::any('wxLogin', 'Api\WxController@login');
 Route::any('wxH5', 'Api\WxController@wxH5');
-Route::any('ttt', 'Api\WxController@ttt');
-Route::any('getTopMessage', 'Api\WxController@getTopMessage');
 Route::group(['middleware'=> ['checkWx']],function ($route){
 
-    $route->any('oaCheck', 'Api\OaController@oaCheck');
-    $route->any('oaOrderState', 'Api\OaController@oaOrderState');
-    $route->any('checkAllOver', 'Api\OaController@checkAllOver');
-
-    //不需要账号登录的
-    //文件上传统一方法
-    $route->any('uploadFile', 'Api\FileUploadController@uploadFile');
-    $route->any('saleOrderList', 'Api\WxController@saleOrderList');
-    $route->any('checkAll', 'Api\CheckController@checkAll')->middleware('OssFileDeal');
-
-    //可见范围
-    $route->any('seeRange', 'Api\RangeController@seeRange');
-
-    //需要账号登录的
-    //采购单
-    $route->any('purchaseOrderList', 'Api\WxController@purchaseOrderList');
-    $route->any('purchaseOrderEdit', 'Api\PurchaseOrderController@purchaseOrderEdit')->middleware('OssFileDeal');
-    $route->any('purchaseOrderDetail', 'Api\PurchaseOrderController@purchaseOrderDetail');
-    $route->any('purchaseOrderAdd', 'Api\PurchaseOrderController@purchaseOrderAdd')->middleware('OssFileDeal');
-    $route->any('purchaseOrderDel', 'Api\PurchaseOrderController@purchaseOrderDel')->middleware('OssFileDeal');
-
-    //合同
-    $route->any('salesOrderGet', 'Api\SalesOrderController@salesOrderGet');
-    $route->any('salesOrderList', 'Api\SalesOrderController@salesOrderList');
-    $route->any('salesOrderEdit', 'Api\SalesOrderController@salesOrderEdit');
-    $route->any('salesOrderDetail', 'Api\SalesOrderController@salesOrderDetail');
-    $route->any('salesOrderAdd', 'Api\SalesOrderController@salesOrderAdd');
-    $route->any('salesOrderDel', 'Api\SalesOrderController@salesOrderDel');
-    $route->any('salesOrderDispatchCompany', 'Api\SalesOrderController@salesOrderDispatchCompany');
-    $route->any('salesOrderGetBuildFee', 'Api\SalesOrderController@salesOrderGetBuildFee');
-
-    $route->any('constructionOperation', 'Api\ConstructionController@constructionOperation');
-    $route->any('constructionGet', 'Api\ConstructionController@constructionGet');
-    $route->any('constructionList', 'Api\ConstructionController@constructionList');
-    $route->any('constructionEdit', 'Api\ConstructionController@constructionEdit')->middleware('OssFileDeal');
-    $route->any('constructionDetail', 'Api\ConstructionController@constructionDetail');
-    $route->any('constructionAdd', 'Api\ConstructionController@constructionAdd')->middleware('OssFileDeal');
-    $route->any('constructionDel', 'Api\ConstructionController@constructionDel')->middleware('OssFileDeal');
-    $route->any('deliveryNoteList', 'Api\ConstructionController@deliveryNoteList');
-    $route->any('deliveryNoteDetail', 'Api\ConstructionController@deliveryNoteDetail');
-    $route->any('deliveryNoteEdit', 'Api\ConstructionController@deliveryNoteEdit')->middleware('OssFileDeal');
-    $route->any('deliveryNoteDel', 'Api\ConstructionController@deliveryNoteDel')->middleware('OssFileDeal');
-    $route->any('constructionEditOther', 'Api\ConstructionController@constructionEditOther');
-
-    $route->any('employeeList', 'Api\EmployeeController@employeeList');
-    $route->any('departList', 'Api\EmployeeController@departList');
-    $route->any('storehouseList', 'Api\StorehouseController@storehouseList');
-    $route->any('basicTypeList', 'Api\BasicTypeController@basicTypeList');
-    $route->any('basicTypeCustomerList', 'Api\BasicTypeController@basicTypeCustomerList');
-    $route->any('productList', 'Api\ProductController@productList');
-    $route->any('supplierList', 'Api\SupplierController@customerList');
-    $route->any('customerCapitalList', 'Api\CustomerController@customerList2');
-    $route->any('sportsBagOrderList', 'Api\SportsBagController@orderList');
-    $route->any('productAdd', 'Api\ProductController@productAdd')->middleware('OssFileDeal');
-    $route->any('productCategoryList', 'Api\ProductController@productCategoryList');
-    $route->any('productList2', 'Api\ProductController@productList2');
-
-    //退换货
-    $route->any('ReturnExchangeOrderList', 'Api\ReturnExchangeOrderController@ReturnExchangeOrderList');
-    $route->any('ReturnExchangeOrderEdit', 'Api\ReturnExchangeOrderController@ReturnExchangeOrderEdit');
-    $route->any('ReturnExchangeOrderDetail', 'Api\ReturnExchangeOrderController@ReturnExchangeOrderDetail');
-    $route->any('ReturnExchangeOrderAdd', 'Api\ReturnExchangeOrderController@ReturnExchangeOrderAdd');
-    $route->any('ReturnExchangeOrderDel', 'Api\ReturnExchangeOrderController@ReturnExchangeOrderDel');
-
-    //盘点单
-    $route->any('inventoryList', 'Api\InventoryController@inventoryList');
-    $route->any('inventoryEdit', 'Api\InventoryController@inventoryEdit');
-    $route->any('inventoryDetail', 'Api\InventoryController@inventoryDetail');
-    $route->any('inventoryAdd', 'Api\InventoryController@inventoryAdd');
-    $route->any('inventoryDel', 'Api\InventoryController@inventoryDel');
-
-    //排班设置
-    $route->any('scheduleList', 'Api\ScheduleController@getList');
-    $route->any('scheduleEdit', 'Api\ScheduleController@edit');
-    $route->any('scheduleDetail', 'Api\ScheduleController@detail');
-    $route->any('scheduleAdd', 'Api\ScheduleController@add');
-    $route->any('scheduleDel', 'Api\ScheduleController@del');
-    $route->any('scheduleGetForConstruction', 'Api\ScheduleController@scheduleGetForConstruction');
-    $route->any('getScheduleSetting', 'Api\ScheduleController@getScheduleSetting');
-    //排期
-    $route->any('pq','Api\DeleteController@pq');
-
-    $route->any('fpMan','Api\DeleteController@fp');
-
-    $route->any('menuList', 'Api\SysMenuController@menuList');
-
-    //设置列表
-    $route->any('productInventorySetList', 'Api\ProductInventoryController@productInventorySetList');
-    $route->any('getMySetting', 'Api\ProductInventoryController@getMySetting');
-
-    $route->any('getSettingTotal', 'Api\ScheduleController@getSettingTotal');
-    $route->any('getSettingGetDetail', 'Api\ScheduleController@getSettingGetDetail');
-    $route->any('getSettingTotal2', 'Api\ScheduleController@getSettingTotal2');
-    $route->any('getSettingGetDetail2', 'Api\ScheduleController@getSettingGetDetail2');
-    //客户
-    $route->any('customerList', 'Api\CustomerController@customerWxList');
-    $route->any('customerEdit', 'Api\CustomerController@customerEdit')->middleware('OssFileDeal');
-    $route->any('customerAdd', 'Api\CustomerController@customerAdd')->middleware('OssFileDeal');
-    $route->any('customerDel', 'Api\CustomerController@customerDel')->middleware('OssFileDeal');
-    $route->any('customerDetail', 'Api\CustomerController@customerDetail');
-    $route->any('customerGrabbing', 'Api\CustomerController@customerGrabbing');
-
-    //收付款
-    $route->any('paymentReceiptGet', 'Api\PaymentReceiptController@paymentReceiptGet');
-    $route->any('paymentReceiptList', 'Api\PaymentReceiptController@paymentReceiptList');
-    $route->any('paymentReceiptAdd', 'Api\PaymentReceiptController@paymentReceiptAdd')->middleware('OssFileDeal');
-    $route->any('paymentReceiptEdit', 'Api\PaymentReceiptController@paymentReceiptEdit')->middleware('OssFileDeal');
-    $route->any('paymentReceiptDel', 'Api\PaymentReceiptController@paymentReceiptDel')->middleware('OssFileDeal');
-    $route->any('paymentReceiptDetail', 'Api\PaymentReceiptController@paymentReceiptDetail');
-
-    //跟进记录
-    $route->any('followUpRecordAdd', 'Api\FollowUpRecordController@followUpRecordAdd')->middleware('OssFileDeal');
-    $route->any('productCategoryList2', 'Api\ProductController@productCategoryList2');
-    $route->any('getLoginMan','Api\EmployeeController@getLoginMan');
-    $route->any('followUpRecordList', 'Api\FollowUpRecordController@followUpRecordList');
-    $route->any('followUpRecordDetail', 'Api\FollowUpRecordController@followUpRecordDetail');
-
-    $route->any('productGroupByList', 'Api\ProductController@productGroupByList');//选择列表页
-    $route->any('productGroupByListDetail', 'Api\ProductController@productGroupByListDetail');//选择列表页详情
-
-    //u8获取sn码
-    $route->any('snListAccording','Api\DataSyncToU8Controller@snListAccording');
-    $route->any('getSnFromU8','Api\DataSyncToU8Controller@getSnFromU8');
-    //补录
-    $route->any('constructionEditSn', 'Api\ConstructionController@constructionEditSn');
-    //生成质保
-    $route->any('warrantyAdd', 'Api\TSpaceController@warrantyAdd'); //生成质保
-    $route->any('snListAccordingFromConstruction', 'Api\ConstructionController@snListAccording'); //是否补录的判断
-    $route->any('detailSnConstruction', 'Api\ConstructionController@detailSn'); //施工单产品
-
-    $route->any('basicTypeUseList', 'Api\BasicTypeController@basicTypeUseList');
-
-    //客资报表
-    $route->any('customerReportStepOfFirst', 'Api\StatisticsController@customerReportStepOfFirst');
-    $route->any('customerReportStepOfSecond', 'Api\StatisticsController@customerReportStepOfSecond');
-    $route->any('customerReportStepOfThird', 'Api\StatisticsController@customerReportStepOfThird');
-
-    //销售报表
-    $route->any('saleReportStepOfFirst', 'Api\StatisticsController@saleReportStepOfFirst');
-    $route->any('saleReportStepOfSecond', 'Api\StatisticsController@saleReportStepOfSecond');
-    $route->any('saleReportStepOfThird', 'Api\StatisticsController@saleReportStepOfThird');
-    $route->any('saleReportStepOfFour', 'Api\StatisticsController@saleReportStepOfFour');
-    $route->any('saleReportStepOfFive', 'Api\StatisticsController@saleReportStepOfFive');
-
-    $route->any('getChatDetail', 'Api\DaHuangFengController@getChatDetail');
 });