Forráskód Böngészése

Wesmiler 人人车 初始化项目 0816

APPLE 3 éve
szülő
commit
13529345a8
100 módosított fájl, 263 hozzáadás és 179 törlés
  1. 0 0
      application/.htaccess
  2. 0 0
      application/admin/controller/Auth.php
  3. 0 0
      application/admin/controller/Index.php
  4. 0 0
      application/admin/controller/agent/Agent.php
  5. 0 0
      application/admin/controller/auth/Permission.php
  6. 0 0
      application/admin/controller/auth/Role.php
  7. 0 0
      application/admin/controller/auth/User.php
  8. 0 0
      application/admin/controller/store/Article.php
  9. 0 0
      application/admin/controller/store/Banner.php
  10. 10 1
      application/admin/controller/store/Farmland.php
  11. 13 3
      application/admin/controller/store/Mission.php
  12. 1 1
      application/admin/controller/store/Product.php
  13. 0 0
      application/admin/controller/store/Receiver.php
  14. 0 0
      application/admin/controller/store/Rescue.php
  15. 0 0
      application/admin/controller/store/Seller.php
  16. 0 0
      application/admin/controller/store/Skill.php
  17. 0 149
      application/admin/controller/store/Store.php
  18. 0 0
      application/admin/controller/store/System.php
  19. 38 2
      application/admin/controller/store/Taxi.php
  20. 0 0
      application/admin/controller/store/TaxiServiceCategory.php
  21. 1 7
      application/admin/controller/system/Annex.php
  22. 0 0
      application/admin/controller/system/Config.php
  23. 0 0
      application/admin/controller/system/DataDictionary.php
  24. 0 0
      application/admin/controller/system/OperationLog.php
  25. 0 0
      application/admin/controller/system/Setting.php
  26. 11 2
      application/admin/controller/taxi/User.php
  27. 0 0
      application/admin/controller/users/Group.php
  28. 38 1
      application/admin/controller/users/MotorAgent.php
  29. 0 0
      application/admin/controller/users/MotorAgentWithdraw.php
  30. 0 0
      application/admin/controller/users/Relation.php
  31. 40 2
      application/admin/controller/users/User.php
  32. 0 0
      application/admin/model/OperationLog.php
  33. 0 0
      application/admin/model/Permissions.php
  34. 0 0
      application/admin/model/PermissionsAccess.php
  35. 0 0
      application/admin/model/PermissionsRole.php
  36. 0 0
      application/admin/model/Roles.php
  37. 0 0
      application/admin/model/Users.php
  38. 0 0
      application/admin/model/agent/Agent.php
  39. 39 4
      application/admin/model/users/MotorAgent.php
  40. 0 0
      application/admin/model/users/MotorAgentWithdraw.php
  41. 0 0
      application/agent/config/casbin.php
  42. 0 0
      application/agent/controller/Auth.php
  43. 0 0
      application/agent/controller/auth/Permission.php
  44. 0 0
      application/agent/controller/auth/PermissionRole.php
  45. 0 0
      application/agent/controller/auth/Role.php
  46. 0 0
      application/agent/controller/auth/User.php
  47. 0 0
      application/agent/controller/finance/Log.php
  48. 20 6
      application/agent/controller/finance/Stats.php
  49. 0 0
      application/agent/controller/finance/Withdraw.php
  50. 0 0
      application/agent/controller/order/Goods.php
  51. 0 0
      application/agent/controller/order/Mission.php
  52. 0 0
      application/agent/controller/order/Skill.php
  53. 0 0
      application/agent/controller/order/Taxi.php
  54. 0 0
      application/agent/controller/system/Config.php
  55. 0 0
      application/agent/middleware/AttackCheckMiddleware.php
  56. 0 0
      application/agent/middleware/CasbinAuthMiddleware.php
  57. 0 0
      application/agent/middleware/JWTAuthMiddleware.php
  58. 0 0
      application/agent/model/auth/Access.php
  59. 0 0
      application/agent/model/auth/Log.php
  60. 0 0
      application/agent/model/auth/Permission.php
  61. 47 0
      application/agent/model/auth/PermissionRole.php
  62. 0 0
      application/agent/model/auth/Role.php
  63. 0 0
      application/agent/model/auth/User.php
  64. 0 0
      application/agent/model/finance/Log.php
  65. 0 0
      application/agent/model/finance/Stats.php
  66. 0 0
      application/agent/model/finance/Withdraw.php
  67. 0 0
      application/agent/model/order/Goods.php
  68. 0 0
      application/agent/model/order/Mission.php
  69. 0 0
      application/agent/model/order/Skill.php
  70. 0 0
      application/agent/model/order/Taxi.php
  71. 0 0
      application/agent/model/system/Config.php
  72. 0 0
      application/agent/service/JWTAuth.php
  73. 0 0
      application/agent/service/Qrcode.php
  74. 0 0
      application/agent/service/SmsCode.php
  75. 0 0
      application/agent/validate/finance/Withdraw.php
  76. 0 0
      application/api/controller/ApiController.php
  77. 0 0
      application/api/controller/v1/Address.php
  78. 0 0
      application/api/controller/v1/Banner.php
  79. 0 0
      application/api/controller/v1/Common.php
  80. 0 0
      application/api/controller/v1/Farmland.php
  81. 0 0
      application/api/controller/v1/Goods.php
  82. 0 0
      application/api/controller/v1/Mission.php
  83. 0 0
      application/api/controller/v1/Rescue.php
  84. 0 0
      application/api/controller/v1/Skill.php
  85. 0 0
      application/api/controller/v1/Store.php
  86. 0 0
      application/api/controller/v1/System.php
  87. 0 0
      application/api/controller/v1/Taxi.php
  88. 1 1
      application/api/controller/v1/TaxiServiceCategory.php
  89. 4 0
      application/api/controller/v1/User.php
  90. 0 0
      application/api/controller/v1/Wechat.php
  91. 0 0
      application/api/controller/v1/taxi/MotorRecord.php
  92. 0 0
      application/api/controller/v1/taxi/User.php
  93. 0 0
      application/api/controller/v1/user/MotorAgent.php
  94. 0 0
      application/api/middleware/JWTAuthMiddleware.php
  95. 0 0
      application/api/model/taxi/Award.php
  96. 0 0
      application/api/model/taxi/MotorRecord.php
  97. 0 0
      application/api/model/taxi/User.php
  98. 0 0
      application/api/model/taxi/UserPaymentOrder.php
  99. 0 0
      application/api/model/user/MotorAgent.php
  100. 0 0
      application/api/service/JWTAuth.php

+ 0 - 0
application/.htaccess


+ 0 - 0
application/admin/controller/Auth.php


+ 0 - 0
application/admin/controller/Index.php


+ 0 - 0
application/admin/controller/agent/Agent.php


+ 0 - 0
application/admin/controller/auth/Permission.php


+ 0 - 0
application/admin/controller/auth/Role.php


+ 0 - 0
application/admin/controller/auth/User.php


+ 0 - 0
application/admin/controller/store/Article.php


+ 0 - 0
application/admin/controller/store/Banner.php


+ 10 - 1
application/admin/controller/store/Farmland.php

@@ -677,6 +677,9 @@ class Farmland extends AdminController
     {
         // 接收数据
         $params = $this->request->param();
+        if(strpos($params['img'],'[') !== false){
+            $params['img']=substr($params['img'], 2, -2);
+        }
         // 数据校验
         $valid = $this->validate($params,[
             'name|分类' => 'require',
@@ -695,9 +698,15 @@ class Farmland extends AdminController
     {
         // 接收数据
         $params = $this->request->param();
+        if(strpos($params['img'],'[') !== false){
+            $params['img']=substr($params['img'], 2, -2);
+        }
+         
         // 查询
         $goods = model('common/FarmlandVariety')->findBy($id);
-
+       
+        
+        
         // 是否更改状态操作
         if (isset($params['status']) && $params['status'] != '') {
             $valid = $this->validate($params, [

+ 13 - 3
application/admin/controller/store/Mission.php

@@ -5,7 +5,7 @@ namespace app\admin\controller\store;
 
 use app\common\controller\AdminController;
 use app\http\IResponse;
-
+use think\db;
 class Mission extends AdminController
 {
 
@@ -91,7 +91,8 @@ class Mission extends AdminController
         (true !== $valid) && IResponse::failure($valid);
 
         // 更新信息
-        $mission->updateBy($id, $params);
+        //$mission->updateBy($id, $params);
+        $mission->where('id',$id)->update($params);
 
         return IResponse::success('更新技能信息成功');
     }
@@ -188,6 +189,9 @@ class Mission extends AdminController
         $params = $this->request->param();
         // 查询用户
         $driver = model('common/MissionUser')->findBy($id);
+       
+        
+        
 
         // 是否更改状态操作
         if (isset($params['status']) && $params['status'] != '') {
@@ -209,7 +213,13 @@ class Mission extends AdminController
         (true !== $valid) && IResponse::failure($valid);
 
         // 更新用户信息
-        $driver->updateBy($id, $params);
+        //$driver->updateBy($id, $params);
+     
+       // $driver->where('id',$id)->update($params);
+        
+        unset($params['remarks']);
+        Db::table('ins_mission_user')->where('id', $id)->update($params);
+    
 
         return IResponse::success('更新配送员信息成功');
     }

+ 1 - 1
application/admin/controller/store/Product.php

@@ -367,7 +367,7 @@ class Product extends AdminController
 
         $order = model('common/GoodsOrder');
 
-        return IResponse::paginate($order->where($where)->with(['user','seller','addr'])
+        return IResponse::paginate($order->where($where)->with(['user','seller','addr','detail'])
             ->order(['created_at' => 'desc'])
             ->paginate(input('limit'),false));
     }

+ 0 - 0
application/admin/controller/store/Receiver.php


+ 0 - 0
application/admin/controller/store/Rescue.php


+ 0 - 0
application/admin/controller/store/Seller.php


+ 0 - 0
application/admin/controller/store/Skill.php


+ 0 - 149
application/admin/controller/store/Store.php

@@ -1,149 +0,0 @@
-<?php
-
-
-namespace app\admin\controller\store;
-
-
-use app\common\controller\AdminController;
-use app\http\IResponse;
-
-class Store extends AdminController
-{
-
-    /**
-     *
-     * @author 许祖兴 < zuxing.xu@lettered.cn>
-     * @date 2020/7/15 18:20
-     *
-     * @return mixed
-     * @throws \think\exception\DbException
-     */
-    public function index()
-    {
-        $where = [];
-        $type = $this->request->get('type', 0);
-        if($type>0){
-            $where['type'] = $type;
-        }
-        //组合搜索
-        $model = model('common/Store');
-
-        return IResponse::paginate($model->where($where)
-            ->paginate(input('limit'),false));
-    }
-
-    /**
-     * 新增
-     *
-     * @author 许祖兴 < zuxing.xu@lettered.cn>
-     * @date 2020/06/07 23:59
-     *
-     * @return mixed
-     */
-    public function save()
-    {
-        // 接收数据
-        $params = $this->request->param();
-        // 数据校验
-        $valid = $this->validate($params, [
-            'name|门店名称' => 'require',
-            'logo|门头LOGO图片' => 'require',
-            'type|门店类型' => 'require',
-            'content|介绍内容' => 'require',
-            'location|位置' => 'require',
-            'time_slot|服务时段' => 'require'
-        ]);
-        // 错误返回
-        (true !== $valid) && IResponse::failure($valid);
-        // 保存数据
-        $coordinate = isset($params['coordinate'])? trim($params['coordinate']) : '';
-        $coordinate = $coordinate? explode(',', $coordinate) : [];
-        $params['latitude'] = isset($coordinate[0])? $coordinate[0] : '';
-        $params['ongitude'] = isset($coordinate[1])? $coordinate[1] : '';
-        unset($params['coordinate']);
-        $model = model("common/Store")->storeBy($params);
-
-        return $model ? IResponse::success([],'新增门店信息成功'):
-            IResponse::failure('新增门店信息异常');
-    }
-
-    /**
-     * 更新数据
-     *
-     * @author 许祖兴 < zuxing.xu@lettered.cn>
-     * @date 2020/06/07 14:24
-     *
-     * @param $id
-     * @return \think\response\Json
-     */
-    public function update($id)
-    {
-        // 接收数据
-        $params = $this->request->param();
-        // 查询用户
-        $model = model('common/Store')->findBy($id);
-
-        // 是否更改状态操作
-        if (isset($params['status']) && $params['status'] != '') {
-            $valid = $this->validate($params, [
-                'status|配置状态' => 'require|integer'
-            ]);
-        }else {
-            // 数据校验
-            $valid = $this->validate($params, [
-                'name|门店名称' => 'require',
-                'logo|门头LOGO图片' => 'require',
-                'type|门店类型' => 'require',
-                'content|介绍内容' => 'require',
-                'location|位置' => 'require',
-                'time_slot|服务时段' => 'require'
-            ]);
-        }
-        // 错误返回
-        (true !== $valid) && IResponse::failure($valid);
-
-        // 更新信息
-        $coordinate = isset($params['coordinate'])? trim($params['coordinate']) : '';
-        $coordinate = $coordinate? explode(',', $coordinate) : [];
-        $params['latitude'] = isset($coordinate[0])? $coordinate[0] : '';
-        $params['ongitude'] = isset($coordinate[1])? $coordinate[1] : '';
-        $model->updateBy($id, $params);
-
-        return IResponse::success('更新门店信息成功');
-    }
-
-    /**
-     * 删除
-     *
-     * @author 许祖兴 < zuxing.xu@lettered.cn>
-     * @date 2020/3/16 14:22
-     *
-     * @param $id
-     * @return \think\response\Json
-     */
-    public function delete($id)
-    {
-        model('common/Store')->deleteBy($id);
-        return IResponse::success([],'删除门店成功');
-    }
-
-    /**
-     * 批量操作
-     *
-     * @return mixed
-     */
-    public function plectron(){
-        // 收参数
-        $params = $this->request->param();
-
-        foreach (str2arr($params['ids']) as $id){
-            $model = model('common/Store')->getBy($id);
-            if ($this->request->isDelete()){
-                return IResponse::success([],'删除门店成功');
-            }
-            $model->allowField(true)->updateBy($id, $params);
-        }
-        return IResponse::success([],'操作成功');
-    }
-
-}

+ 0 - 0
application/admin/controller/store/System.php


+ 38 - 2
application/admin/controller/store/Taxi.php

@@ -8,7 +8,7 @@ use app\http\IResponse;
 use EasyWeChat\Factory;
 use EasyWeChat\Kernel\Exceptions\Exception;
 use EasyWeChat\Payment\Kernel\Exceptions\InvalidSignException;
-
+use think\Db;
 class Taxi extends AdminController
 {
 
@@ -250,12 +250,48 @@ class Taxi extends AdminController
 
     public function deleteUser($id)
     {
+        IResponse::failure('xxnxx');
         // 1. 删除用户
         model('common/TaxiUser')->deleteBy($id);
         // 2. 删除用户所属车辆
         // model('common/Taxi')->where(['taxi_user_id' => $id])->delete();
         return IResponse::success([],'删除用户成功');
     }
+    
+    public function ppuser($ids){
+         // 收参数
+        $params = $this->request->param();
+        foreach (str2arr($params['ids']) as $id){
+            $user = model('common/Users')->getBy($id);
+            if ($this->request->isDelete()){
+                $user->deleteBy($id);
+            }
+            
+             $olduser=Db::table('ins_taxi_user')->where('id',$id)->find();
+            if(!$olduser){
+                return IResponse::failure('用户不存在!');
+            }
+            
+            if( $params['status']==1){//启用
+                if( $olduser['status']==3 or $olduser['status']==5){
+                    //3待审,5待支付 时候 不用做任何操作
+                }else{
+                    $res=Db::table('ins_taxi_user')->update(['status' => $params['status'],'id'=>$id]);
+                }
+                
+                
+            }
+            
+            if( $params['status']==0){//禁用
+                 if( $olduser['status']==3 or $olduser['status']==5){
+                    //3待审,5待支付 时候 不用做任何操作
+                }else{
+                    $res=Db::table('ins_taxi_user')->update(['status' => 4,'id'=>$id]);
+                }
+            }
+        }
+        return IResponse::success([],'操作成功');
+    }
 
 
     /******************** 订单 *********************/
@@ -335,7 +371,7 @@ class Taxi extends AdminController
                             'value' => $order['order_no'],
                         ],
                         'thing5' => [
-                            'value' => '电话请保持通畅,师傅正在赶往路上,请稍候',
+                            'value' => ' 师傅正在接单,预计十分钟到达',
                         ],
                         'thing11' => [
                             'value' => $driver['user']['uname'],

+ 0 - 0
application/admin/controller/store/TaxiServiceCategory.php


+ 1 - 7
application/admin/controller/system/Annex.php

@@ -39,16 +39,12 @@ class Annex extends AdminController
                 // 'create_at' => filectime(app()->getRootPath() . '/public/uploads/' . rawurlencode($dir))
             ];
         }
-
         // halt($dirs);
         // 取出本地存储文件
         foreach ($filesystem->getFiles() as $file) {
-            if($file == '..' || $file == '.DS_Store'){
-                continue;
-            }
 
             $type = get_file_ext($file);
-//            $file = isset($file['name'])? ltrim($file['name'],'/') : '';
+
             $info = [
                 'name' => $file,
                 'type' => $type,
@@ -56,13 +52,11 @@ class Annex extends AdminController
                 'url' => get_annex_url($path . '/' . $file),
                 'create_at' => filectime(app()->getRootPath() . "/public/uploads/" . $path . '/' . $file)
             ];
-
             if (in_array($type, ['png', 'jpg', 'jpeg', 'gif'])) {
                 $info['thumbs'] = get_annex_url($path . '/' . $file);
             }
             $annex[] = $info;
         }
-
         $total = count($annex);
         $array = [];
         // 分页处理

+ 0 - 0
application/admin/controller/system/Config.php


+ 0 - 0
application/admin/controller/system/DataDictionary.php


+ 0 - 0
application/admin/controller/system/OperationLog.php


+ 0 - 0
application/admin/controller/system/Setting.php


+ 11 - 2
application/admin/controller/taxi/User.php

@@ -29,10 +29,12 @@ class User extends AdminController
      */
     public function check($ids)
     {
+       
         $row = $this->model::get($ids);
         if (!$row) {
             IResponse::failure('记录不存在');
         }
+       
 
         $result = false;
         $this->model->startTrans();
@@ -50,6 +52,7 @@ class User extends AdminController
         }
         IResponse::failure('失败');
     }
+    
 
     /**
      * @desc 发放合伙资产
@@ -61,16 +64,19 @@ class User extends AdminController
      * @author weichuanbao<654745815@qq.com>
      * @date 2022/1/7 0007
      */
+     
     public function partnership($ids)
     {
         $row = $this->model->with('user')->find($ids);
+       
         if (!$row) {
             IResponse::failure('记录不存在');
         }
 
         $params = input();
         $params['amount'] = input('amount', 0);
-
+        
+       
         $MotorRecord = new MotorRecord();
 
         $result = false;
@@ -78,6 +84,7 @@ class User extends AdminController
         try {
             $row->user->partnership = $params['amount'];
             $result = $row->user->save();
+         
 
             $MotorRecord->setMoneyLog($row['user'], 'partnership', $params['amount'], 30, '发放合伙资产');
             $MotorRecord->saveMoneyLog();
@@ -90,7 +97,9 @@ class User extends AdminController
 
         if ($result) {
             IResponse::success([],'成功');
+        }else{
+            IResponse::failure('失败');
         }
-        IResponse::failure('失败');
+        
     }
 }

+ 0 - 0
application/admin/controller/users/Group.php


+ 38 - 1
application/admin/controller/users/MotorAgent.php

@@ -187,8 +187,9 @@ class MotorAgent extends AdminController
         if (!$row) {
             IResponse::failure('记录不存在');
         }
+   
         if ($row['status'] >= 30) {
-//            IResponse::failure('不可操作');
+            IResponse::failure('用户已经通过审核,无需操作');
         }
 
         $user = model('\app\common\model\Users')->field('id,is_motor_agent')->find($row['user_id']);
@@ -204,6 +205,9 @@ class MotorAgent extends AdminController
 
             // 新建角色
             $Role = new \app\agent\model\auth\Role();
+//            $PermissionRole = new \app\agent\model\auth\PermissionRole();
+            // 获取角色权限
+//            $permissionRole = $PermissionRole::get(2);
             $role = $Role::create([
                 'name' => 'motor_agent_'.$row['user_id'],
                 'description' => '系统管理员',
@@ -221,6 +225,8 @@ class MotorAgent extends AdminController
             // 写入用户权限
             $AgentCasbin = new \CasbinAdapter\Think\Facades\AgentCasbin();
             $result = $AgentCasbin::AddRoleForUser('user_id_' . $admin['id'], $role['name']);
+            // 赋予角色权限
+            $this->model->authority($role['id'], $role['name']);
 
             $this->model->commit();
         }
@@ -234,6 +240,29 @@ class MotorAgent extends AdminController
         }
         IResponse::failure('失败');
     }
+    
+    /**
+     * @desc 删除
+     * @param $ids
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     * @author weichuanbao<654745815@qq.com>
+     * @date 2021/12/22 0022
+     */
+    public function deluser($ids)
+    {
+        $row = $this->model::get($ids);
+        if (!$row) {
+            IResponse::failure('记录不存在');
+        }
+   
+        Db::table('ins_users_motor_agent')->where('$ids',1)->delete();
+        IResponse::success([],'操作成功');
+
+        
+    }
 
     /**
      * @desc 发放合伙资产
@@ -286,6 +315,14 @@ class MotorAgent extends AdminController
      */
     public function delete($id)
     {
+        
         //
+         $row = $this->model::get($ids);
+        if (!$row) {
+            IResponse::failure('记录不存在');
+        }
+   
+        Db::table('ins_users_motor_agent')->where('$ids',1)->delete();
+        IResponse::success([],'操作成功');
     }
 }

+ 0 - 0
application/admin/controller/users/MotorAgentWithdraw.php


+ 0 - 0
application/admin/controller/users/Relation.php


+ 40 - 2
application/admin/controller/users/User.php

@@ -115,13 +115,51 @@ class User extends AdminController
     public function plectron(){
         // 收参数
         $params = $this->request->param();
-
+       
+        
         foreach (str2arr($params['ids']) as $id){
             $user = model('common/Users')->getBy($id);
             if ($this->request->isDelete()){
                 $user->deleteBy($id);
             }
-            $user->allowField(true)->updateBy($id, $params);
+            //表里不存ids这个字段,要把ids改回表对应的字段名:id
+            
+            //user这个模型没有updateBy这个方法,所以回报错,既然循环,也不可能直接单个id对应
+            // $user->allowField(true)->updateBy($id, $params);
+            //懒得去补模型的方法了,我直接用原生写法对表操作了。
+            //2022-3-3 丘 改动
+            
+            
+            //判断 原状态 和 修改致状态 未交费之前 冻结,启用动作  都忽略;
+            
+            
+            $olduser=Db::table('ins_users_motor_agent')->where('id',$id)->find();
+            if(!$olduser){
+                return IResponse::failure('用户不存在!');
+            }
+            
+            if( $params['status']==40){
+                if($olduser['status']<40){
+                    //没有通过交费 啥也不做
+                }else{
+                    //做解冻,或冬季操作
+                    $res=Db::table('ins_users_motor_agent')->update(['status' => $params['status'],'id'=>$id]);
+                }
+            }
+            
+            if( $params['status']==50){
+                if($olduser['status']<40){
+                    //没有通过交费 啥也不做
+                }else{
+                    //做解冻,或冬季操作
+                    $res=Db::table('ins_users_motor_agent')->update(['status' => $params['status'],'id'=>$id]);
+                }
+            }
+            
+           
+    
+            
+            
         }
         return IResponse::success([],'操作成功');
     }

+ 0 - 0
application/admin/model/OperationLog.php


+ 0 - 0
application/admin/model/Permissions.php


+ 0 - 0
application/admin/model/PermissionsAccess.php


+ 0 - 0
application/admin/model/PermissionsRole.php


+ 0 - 0
application/admin/model/Roles.php


+ 0 - 0
application/admin/model/Users.php


+ 0 - 0
application/admin/model/agent/Agent.php


+ 39 - 4
application/admin/model/users/MotorAgent.php

@@ -2,11 +2,11 @@
 
 namespace app\admin\model\users;
 
-use app\common\model\GoodsOrder;
-use app\common\model\MissionOrder;
-use app\common\model\SkillOrder;
+use app\agent\model\auth\Access;
+use app\agent\model\auth\Permission;
+use app\agent\model\auth\PermissionRole;
+use app\agent\model\auth\Role;
 use app\common\model\TaxiOrder;
-use app\http\IResponse;
 use think\Model;
 
 class MotorAgent extends Model
@@ -32,6 +32,13 @@ class MotorAgent extends Model
             ->field('id,nickname,partnership');
     }
 
+    /**
+     * @desc 摩的代理统计数据
+     * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
     public function stats()
     {
         $user = $this->where('status', '>', 20)
@@ -59,4 +66,32 @@ class MotorAgent extends Model
             'total_amount' => $total_amount,
         ];
     }
+
+    public function authority($RoleId, $roleName)
+    {
+        $Role = new Role();
+        $Access = new Access();
+        $Permission = new Permission();
+        $PermissionRole = new PermissionRole();
+
+        // 获取角色信息
+        $role = $Role::get($RoleId);
+        if ($role){
+            $admin = $PermissionRole::where('role_id', 2)->find();
+            $PermissionRole::create([
+                'role_id' => $RoleId,
+                'permission_idx' => $admin['permission_idx']
+            ]);
+
+            $access = $Access->where('v0', 'motor_agent_173')
+                ->select();
+
+            foreach ($access as $item) {
+                $item->v0 = $roleName;
+                $item->hidden = ['id'];
+            }
+
+            $Access->allowField(true)->saveAll($access->toArray());
+        }
+    }
 }

+ 0 - 0
application/admin/model/users/MotorAgentWithdraw.php


+ 0 - 0
application/agent/config/casbin.php


+ 0 - 0
application/agent/controller/Auth.php


+ 0 - 0
application/agent/controller/auth/Permission.php


+ 0 - 0
application/agent/controller/auth/PermissionRole.php


+ 0 - 0
application/agent/controller/auth/Role.php


+ 0 - 0
application/agent/controller/auth/User.php


+ 0 - 0
application/agent/controller/finance/Log.php


+ 20 - 6
application/agent/controller/finance/Stats.php

@@ -40,18 +40,33 @@ class Stats extends AgentController
         $modelArray = [$TaxiOrder];
 
         // 消费总额包含 商品、接单、技能、摩的
+        $where = [
+            'area_id' => $area_id,
+            'status' => [0,2,3,4]
+        ];
         // 直接读取支付记录表吧
-        $count = ['total' => 0, 'today' => 0, 'month' => 0, 'year' => 0];
+        $count = [
+            'total' => $TaxiOrder->where($where)->sum('price'),
+            'today' => $TaxiOrder->where($where)->whereTime('created_at', 'd')->sum('price'),
+            'month' => $TaxiOrder->where($where)->whereTime('created_at', 'm')->sum('price'),
+            'year' => $TaxiOrder->where($where)->whereTime('created_at', 'y')->sum('price')
+        ];
         // 订单统计
-        $order = ['total' => 0, 'today' => 0, 'month' => 0, 'year' => 0];
-        foreach ($modelArray as $key => $item) {
+        $order = [
+            'total' => $TaxiOrder->where($where)->count(),
+            'today' => $TaxiOrder->where($where)->whereTime('created_at', 'd')->count(),
+            'month' => $TaxiOrder->where($where)->whereTime('created_at', 'm')->count(),
+            'year' => $TaxiOrder->where($where)->whereTime('created_at', 'y')->count()
+        ];
+        /*foreach ($modelArray as $key => $item) {
             $row = $this->model->getStats(
                 $item,
                 $key ? 'pay_price' : 'price',
                 'id',
                 [
                     'area_id' => $area_id,
-                    'status' => [0,2,3,4]],
+                    'status' => [0,2,3,4]
+                ],
                 [
                     'paylog'
                 ]
@@ -60,8 +75,7 @@ class Stats extends AgentController
                 $count[$index] += array_sum($row[$index]);
                 $order[$index] += count($row[$index]);
             }
-        }
-
+        }*/
 
         // 统计图
         $res = [];

+ 0 - 0
application/agent/controller/finance/Withdraw.php


+ 0 - 0
application/agent/controller/order/Goods.php


+ 0 - 0
application/agent/controller/order/Mission.php


+ 0 - 0
application/agent/controller/order/Skill.php


+ 0 - 0
application/agent/controller/order/Taxi.php


+ 0 - 0
application/agent/controller/system/Config.php


+ 0 - 0
application/agent/middleware/AttackCheckMiddleware.php


+ 0 - 0
application/agent/middleware/CasbinAuthMiddleware.php


+ 0 - 0
application/agent/middleware/JWTAuthMiddleware.php


+ 0 - 0
application/agent/model/auth/Access.php


+ 0 - 0
application/agent/model/auth/Log.php


+ 0 - 0
application/agent/model/auth/Permission.php


+ 47 - 0
application/agent/model/auth/PermissionRole.php

@@ -0,0 +1,47 @@
+<?php
+
+namespace app\agent\model\auth;
+
+use app\common\model\BaseModel;
+
+class PermissionRole extends BaseModel
+{
+
+    /**
+     * @var string
+     */
+    protected $name = 'agent_system_permissions_roles';
+
+    /**
+     * @var bool 自模型关闭软删除
+     */
+    protected $deleteTime = false;
+    /**
+     * @var array
+     */
+    protected $auto = [];
+    /**
+     * @var array
+     */
+    protected $type = [
+        'role_id'          =>  'integer',
+        'permission_idx'   =>  'string'
+    ];
+
+    /**
+     * 模型事件定义
+     *
+     * @author 许祖兴 < zuxing.xu@lettered.cn>
+     * @date 2020/3/26 20:54
+     *
+     * @return void
+     */
+    public static function init()
+    {
+        self::event('before_insert', function ($before) {
+
+        });
+    }
+
+
+}

+ 0 - 0
application/agent/model/auth/Role.php


+ 0 - 0
application/agent/model/auth/User.php


+ 0 - 0
application/agent/model/finance/Log.php


+ 0 - 0
application/agent/model/finance/Stats.php


+ 0 - 0
application/agent/model/finance/Withdraw.php


+ 0 - 0
application/agent/model/order/Goods.php


+ 0 - 0
application/agent/model/order/Mission.php


+ 0 - 0
application/agent/model/order/Skill.php


+ 0 - 0
application/agent/model/order/Taxi.php


+ 0 - 0
application/agent/model/system/Config.php


+ 0 - 0
application/agent/service/JWTAuth.php


+ 0 - 0
application/agent/service/Qrcode.php


+ 0 - 0
application/agent/service/SmsCode.php


+ 0 - 0
application/agent/validate/finance/Withdraw.php


+ 0 - 0
application/api/controller/ApiController.php


+ 0 - 0
application/api/controller/v1/Address.php


+ 0 - 0
application/api/controller/v1/Banner.php


+ 0 - 0
application/api/controller/v1/Common.php


+ 0 - 0
application/api/controller/v1/Farmland.php


+ 0 - 0
application/api/controller/v1/Goods.php


+ 0 - 0
application/api/controller/v1/Mission.php


+ 0 - 0
application/api/controller/v1/Rescue.php


+ 0 - 0
application/api/controller/v1/Skill.php


+ 0 - 0
application/api/controller/v1/Store.php


+ 0 - 0
application/api/controller/v1/System.php


+ 0 - 0
application/api/controller/v1/Taxi.php


+ 1 - 1
application/api/controller/v1/TaxiServiceCategory.php

@@ -24,7 +24,7 @@ class TaxiServiceCategory extends ApiController
         $params['page'] = input('page/d', 1);
         $params['limit'] = input('limit/d', 10);
 
-        $list = $this->model->field('id,name,image,url,type,price')
+        $list = $this->model->field('id,name,image,url,type')
             ->where('status', 1)
             ->page($params['page'], $params['limit'])
             ->select();

+ 4 - 0
application/api/controller/v1/User.php

@@ -4,6 +4,7 @@ namespace app\api\controller\v1;
 
 use app\api\controller\ApiController;
 use app\api\service\SmsCode;
+use app\common\model\Users;
 use app\http\IResponse;
 use EasyWeChat\Factory;
 use Lettered\Support\Upload;
@@ -168,6 +169,9 @@ class User extends ApiController
                 'desc' => '用户提现', // 企业付款操作说明信息。必填
             ]);
             $result = $result['return_code'] == 'SUCCESS' && $result['result_code'] != 'FAIL';
+
+            $Users = new Users();
+            $Users->changeBalance($user['id'], $ret['amount'], '余额提现');
             Db::commit();
         }
         catch(Exception $e) {

+ 0 - 0
application/api/controller/v1/Wechat.php


+ 0 - 0
application/api/controller/v1/taxi/MotorRecord.php


+ 0 - 0
application/api/controller/v1/taxi/User.php


+ 0 - 0
application/api/controller/v1/user/MotorAgent.php


+ 0 - 0
application/api/middleware/JWTAuthMiddleware.php


+ 0 - 0
application/api/model/taxi/Award.php


+ 0 - 0
application/api/model/taxi/MotorRecord.php


+ 0 - 0
application/api/model/taxi/User.php


+ 0 - 0
application/api/model/taxi/UserPaymentOrder.php


+ 0 - 0
application/api/model/user/MotorAgent.php


+ 0 - 0
application/api/service/JWTAuth.php


Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott