wugg 10 months ago
parent
commit
c4c438c236
1 changed files with 8 additions and 71 deletions
  1. 8 71
      app/admin/controller/Platform.php

+ 8 - 71
app/admin/controller/Platform.php

@@ -18,7 +18,7 @@ class Platform extends Base
             'platform_type',
             'use_type',
             'is_select_pay_rate' => 0,
-            'desc' => '',
+            'desc' => '0',
             'status' => 0,
             'pay_list' => []
         ], 'post', 'trim');
@@ -28,7 +28,7 @@ class Platform extends Base
             'platform_type|对接平台' => 'require|number|in:0,1,2',
             'use_type|对接类型' => 'require|number|in:0,1,2',
             'is_select_pay_rate|是否开启支付渠道' => 'require|number|in:0,1',
-            'desc|描述' => 'max:255',
+            'desc|权重' => 'float',
             'status|状态' => 'number|in:0,1',
             'pay_list|渠道配置' => 'requireIf:is_select_pay_rate,1|array|max:100'
         ]);
@@ -88,13 +88,7 @@ class Platform extends Base
                 }
                 if ($insert_da) Db::name('platform_channel')->insertAll($insert_da);
             }
-//                return error_show(0,"新建成功");
-//            }else{
-//                return error_show(1003,"新建失败");
-//            }
-
             Db::commit();
-
             return json_show(0, '新建成功');
         } catch (Exception $exception) {
             Db::rollback();
@@ -111,73 +105,44 @@ class Platform extends Base
             'size' => 10,
             'platform_name' => '',
             'platform_type' => '',
-//            'use_type' => '',
             'status' => '',
             'start' => '',
             'end' => '',
             'is_show' => 1,
             'creater' => ''
-//            'company_name' => '',
         ], 'post', 'trim');
-
-//        $page = isset($this->post['page']) && $this->post['page']!=="" ? intval($this->post['page']):"1";
-//        $size = isset($this->post['size']) && $this->post['size'] !=="" ? intval($this->post['size']):"10";
+        
         $where = [["p.is_del", "=", 0]];
-//        $platform_name = isset($this->post['platform_name']) && $this->post['platform_name'] !=="" ? trim($this->post['platform_name']):"";
-        if ($param['platform_name'] != "") $where[] = ['p.platform_name', "like", '%' . $param['platform_name'] . '%'];
-
-//        $platform_type = isset($this->post['platform_type']) && $this->post['platform_type'] !=="" ? intval($this->post['platform_type']):"";
-        if ($param['platform_type'] !== "") $where[] = ['p.platform_type', "=", $param['platform_type']];
 
-//         $use_type = isset($this->post['use_type']) && $this->post['use_type'] !=="" ? intval($this->post['use_type']):"";
-//        if ($param['use_type'] !== "") $where[] = ['p.use_type', "=", $param['use_type']];
+        if ($param['platform_name'] != "") $where[] = ['p.platform_name', "like", '%' . $param['platform_name'] . '%'];
+		 if ($param['platform_type'] !== "") $where[] = ['p.platform_type', "=", $param['platform_type']];
 
-//        $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status']) :"";
         if ($param['status'] !== "") $where[] = ['p.status', "=", $param['status']];
 
-//        $start = isset($this->post['start']) && $this->post['start']!=="" ? $this->post['start']:"";
         if ($param['start'] !== "") $where[] = ['p.addtime', ">=", date('Y-m-d H:i:s', strtotime($param['start']))];
 
-//        $end = isset($this->post['end']) && $this->post['end']!=="" ? $this->post['end']:"";
         if ($param['end'] !== "") $where[] = ['p.addtime', "<", date('Y-m-d H:i:s', strtotime($param['end']) + 24 * 3600)];
-
-//        $is_show=isset($this->post['is_show']) && $this->post['is_show']!=="" ? intval($this->post['is_show']):"1";
         if ($param['is_show'] == 1) {
             $role = $this->checkRole();
             if (!empty($role['platform'])) $where[] = ["p.id", "in", $role['platform']];
         }
-//        $company_name = isset($this->post['company_name']) && $this->post['company_name'] !== "" ? trim($this->post['company_name']) : "";
-//        if ($param['company_name'] !== "") $where[] = ["p.createrid", 'in', get_company_item_user_by_name($param['company_name'])];
         if ($param['creater'] != '') $where[] = ['p.creater', 'like', '%' . $param['creater'] . '%'];
 
         $count = Db::name('platform')
             ->alias('p')
             ->where($where)
             ->count('p.id');
-//        $total = ceil($count / $size);
-//        $page = $page >= $total ? $total : $page;
         $list = Db::name('platform')
             ->alias('p')
-//            ->leftJoin("depart_user u", "u.uid=p.createrid AND u.is_del=0")
             ->where($where)
             ->page($param['page'], $param['size'])
-            ->order(['p.addtime' => 'desc', 'p.id' => 'desc'])
-//            ->append(['company_name'])
-//            ->withAttr('company_name',function ($val,$data){
-//                return implode('/', array_column(GetPart($data['itemid']), 'name'));
-//            })
+            ->order(['p.desc' => 'desc', 'p.id' => 'desc'])
             ->select()
             ->toArray();
-
         $createrid = array_column($list, 'createrid');
         $company = get_company_name_by_uid($createrid);
-
         foreach ($list as &$value) {
             $value['company_name'] = $company[$value['createrid']] ?? '';
-//            $value['pay_list'] = Db::name('platform_pay_rate')
-//                ->where(['platform_id' => $value['id'], 'is_del' => 0])
-//                ->select()
-//                ->toArray();
         }
 
         return app_show(0, "获取成功", ['list' => $list, 'count' => $count]);
@@ -192,9 +157,8 @@ class Platform extends Base
             'platform_type',
             'use_type',
             'is_select_pay_rate' => 0,
-            'desc' => '',
+            'desc' => 0,
             'status' => 0,
-//            'pay_title' => '',
             'pay_list' => []
         ], 'post', 'trim');
 
@@ -204,7 +168,7 @@ class Platform extends Base
             'platform_type|对接平台' => 'require|number|in:0,1,2',
             'use_type|对接类型' => 'require|number|in:0,1,2',
             'is_select_pay_rate|是否开启支付渠道' => 'require|number|in:0,1',
-            'desc|描述' => 'max:255',
+            'desc|排序权重' => 'float',
             'status|状态' => 'number|in:0,1',
             'pay_list|渠道配置' => 'requireIf:is_select_pay_rate,1|array|max:100'
         ]);
@@ -229,8 +193,6 @@ class Platform extends Base
 
             $date = date('Y-m-d H:i:s');
 
-//            $platform_code = makeNo("PT");
-
             $data = [
                 "platform_name" => $param['platform_name'],
                 "platform_type" => $param['platform_type'],
@@ -274,31 +236,6 @@ class Platform extends Base
             Db::rollback();
             return json_show(1004, '更新失败,' . $exception->getMessage());
         }
-
-
-//        $data = [
-//            "id" => $id,
-//            "platform_code" => $platform_code,
-//            "platform_name" => $platform_name,
-//            "platform_type" => $platform_type,
-//            "use_type"=>$use_type,
-////            "createrid" => $action_id,
-////            "creater" => $action_name,
-//            "desc" => $desc,
-//            "status" => $status,
-//            "is_del" => 0,
-//            "updatetime" => date("Y-m-d H:i:s")
-//        ];
-//        $datainfo = Db::name('platform')->save($data);
-//        $temp = array_diff($data,$info);
-//        $json = json_encode($temp,JSON_UNESCAPED_UNICODE);
-//        $jsp = json_encode($info,JSON_UNESCAPED_UNICODE);
-//        if ($datainfo) {
-//            ChangeLog::logAdd(8,$info['platform_code'],$jsp,$json,$this->post['token'],$this->post);
-//            return error_show(0, "更新成功");
-//        } else {
-//            return error_show(1002, "更新失败");
-//        }
     }
 
     public function info()