WIN-2308041133\Administrator 4 дней назад
Родитель
Сommit
895a8dc524
2 измененных файлов с 6 добавлено и 31 удалено
  1. 4 6
      app/model/api/ContractTemplate.php
  2. 2 25
      app/system/controller/ContractTemplate.php

+ 4 - 6
app/model/api/ContractTemplate.php

@@ -15,18 +15,14 @@ class ContractTemplate extends Model
         $post["pageSize"] = $post["pageSize"]>50 ? 50 : (int)$post["pageSize"];
         $post["page"]     = $post["page"]<=0     ? 1  : (int)$post["page"];
         $where=[];
-//        if(isset($post["status"]) && in_array((string)$post["status"], ["0","1"])){
-//            $where[]=["status","=",(int)$post["status"]];
-//        }
+
         if(!empty($post["title"])){
             $where[]=["title","like","%{$post["title"]}%"];
         }
         if(isset($post["is_show"]) && in_array((string)$post["is_show"], ["0","1"])){
             $where[]=["is_show","=",(int)$post["is_show"]];
         }
-//        if(isset($post["is_recommend"]) && in_array((string)$post["is_recommend"], ["0","1"])){
-//            $where[]=["is_recommend","=",(int)$post["is_recommend"]];
-//        }
+
         $totalCount = $this->where($where)->count();
         $data=null;
         if($totalCount>0){
@@ -54,6 +50,8 @@ class ContractTemplate extends Model
                 $data[$k]["time"]       = date("Y-m-d H:i:s",$v["time"]);
                 $data[$k]["admin_time"] = date("Y-m-d H:i:s",$v["admin_time"]);
 //            }
+            $data[$k]["content"] = json_decode($data[$k]["content"]);
+            unset($data[$k]["code"]);
         }
         
         

+ 2 - 25
app/system/controller/ContractTemplate.php

@@ -56,30 +56,16 @@ class ContractTemplate extends BaseController
             $post = UtilService::getMore([
                 ['id', ''],
                 ['title', '', 'empty', '请填写模板标题'],
-//            ['price','0','is_numeric','请输入正确的模板售价'],
-//            ['old_price','0','is_numeric','请输入正确的模板原价'],
                 ['imgs', [], 'empty', '请上传商品主图'],
-//            ['imgs',[]],
                 ['is_show', '0'],
-//            ['is_recommend','0'],
-//            ['is_init','0'],
-//            ['code','','empty','请输入CODE'],
-//            ['status','0'],
                 ['content', []],
             ], $request);
             $save = [];
             $save["title"] = $post["title"];
-//        $save["price"]        = floatval($post["price"]);
-//        $save["old_price"]    = floatval($post["old_price"]);
             $save["is_show"] = (int)$post["is_show"] == 1 ? 1 : 0;
             $save["imgs"] = empty($post["imgs"]) ? "" : implode(",", $post["imgs"]);
-//        $save["is_hot"]       = (int)$post["is_hot"]      == 1 ? 1 : 0;
-//        $save["is_recommend"] = (int)$post["is_recommend"]== 1 ? 1 : 0;
-//        $save["is_init"]      = (int)$post["is_init"]     == 1 ? 1 : 0;
             $save["content"] = json_encode($post["content"]);;
-//        $save["unreal_sales"] = (int)$post["unreal_sales"];
             $save["admin_time"] = time();
-            @file_put_contents('quanju.txt', json_encode($request->adminInfo) . "-管理员信息\r\n", 8);
 
             if (!empty($request->adminInfo) && isset($request->adminInfo['id'])) {
                 $save["admin_id"] = $request->adminInfo['id'];
@@ -87,19 +73,10 @@ class ContractTemplate extends BaseController
                 // 处理 id 不存在的情况
                 $save["admin_id"] = 0; // 或者其他默认值
             }
-//        if($save["price"]<0 || $save["old_price"]<0){
-//            return app('json')->fail("请输入正确的价格");
-//        }
+
 
             $id = empty($post["id"]) ? 0 : (int)$post["id"];
-//        $codeWhere[]=["code","=",$save["code"]];
-//            if ($id > 0) {
-//                $codeWhere[] = ["id", "<>", $id];
-//            }
-//        $count = (new ContractTemplateModel)->where($codeWhere)->where("id","<>",$id)->count();
-//        if($count>0){
-//            return app('json')->fail("当前code已存在");
-//        }
+
             if (empty($id) || $id == "0") {
                 $save["time"] = time();
                 $r = (new ContractTemplateModel)->insert($save);