panlumeng 3 年之前
父節點
當前提交
a340bf9eaf

+ 48 - 2
application/Admin/controller/Account.php

@@ -42,11 +42,22 @@ class Account extends Base
         if($mobile!=""){
             $where['mobile'] = ["like"=>"%{$mobile}%"];
         }
+
         $count= Db::name("account_list")->where($where)->count();
         $total = ceil($count/$size);
         $page = $page>=$total? $total:$page;
+
         $list = Db::name("account_list")->where($where)->page($page,$size)->order("addtime desc")->select();
-        return app_show(0,"获取成功",["list"=>$list,"count"=>$count]);
+        $i=[];
+        foreach ($list as $vus ){
+            $vi = Db::name('rela_video')->join('fc_video a','a.id=rela_video.video_id','left')->field('a.video_sn,a.video_name,a.video_url,a.video_img')->where(['accountid'=>$vus['id'],'is_del'=>0,])->select();
+            if(empty($vi)){
+                $vi=[];
+            }
+            $vus['info']=$vi;
+            $i[]=$vus;
+        }
+        return app_show(0,"获取成功",["list"=>$i,"count"=>$count]);
     }
 
     /**
@@ -127,11 +138,28 @@ class Account extends Base
                 if($info>0){
                     $rela=["accountid"=>$acccount,"account_info"=>$info];
                     $rela_acc=Db::name("rela_account")->insert($rela);
+
+                   // $rele = [["video_id"=>$video,"accountid"=>$video,"addtime"=>$video]];
+                   $l=[];
+                    foreach ($video as $value){
+
+                      $temp=["video_id"=>$value,"accountid"=>$acccount,"addtime"=>date("Y-m-d H:i:s")];
+                        $l[]=$temp;
+                    }
+
+                    $rele_a= Db::name("rela_video")->insertAll($l);
+                    if($rele_a==false){
+                        Db::rollback();
+                        return error_show(1002,"绑定失败");
+                    }else{
+                        write_log("视频绑定成功",$this->userinfo,"account","add");
+                    }
                     if($rela_acc){
                         write_log("账户{$username}新建成功",$this->userinfo,"account","add");
                         Db::commit();
                         return app_show(0,"账户新建成功");
                     }
+
                 }
             }
             Db::rollback();
@@ -226,13 +254,31 @@ class Account extends Base
         }
 
         $rela['remark'] = isset($this->post['remark'])&&$this->post['remark']!=="" ? trim($this->post['remark']) :"";
-        $video =  isset($this->post['video'])&&$this->post['video']!=="" ? trim($this->post['video']) :"";
+        $video =  isset($this->post['video'])&&$this->post['video']!=="" ? $this->post['video'] :"";
         $rela['updatetime'] = date("Y-m-d H:i:s");
+
         Db::startTrans();
         try {
             $acccount = Db::name("account")->update($info);
             if($acccount){
                 $infoacc = Db::name("account_info")->update($rela);
+                $del = Db::name('rela_video')->where(["is_del"=>0,"accountid"=>$id])->select();
+                    if($del==true){
+                        $dl = Db::name('rela_video')->where(["is_del"=>0,"accountid"=>$id])->update(["updatetime"=>date("Y-m-d H:i:s"),"is_del"=>1]);
+                    }
+              //$relo=["video_id"=>$video,"accountid"=>$video,"addtime"=>date("Y-m-d H:i:s")];
+                $k=[];
+                foreach ($video as $valu){
+                    $temp=["video_id"=>$valu,"accountid"=>$id,"addtime"=>date("Y-m-d H:i:s")];
+                    $k[]=$temp;
+                }
+                $rele_a= Db::name("rela_video")->insertAll($k);
+                if($rele_a==false){
+                    Db::rollback();
+                    return error_show(1002,"绑定失败");
+                }else{
+                    write_log("视频绑定成功",$this->userinfo,"account","edit");
+                }
                 if($infoacc){
                         write_log("账户{$username}新建成功",$this->userinfo,"account","edit");
                         Db::commit();

+ 3 - 1
application/Admin/controller/Stock2.php

@@ -160,7 +160,9 @@ class Stock2 extends Base
         if($status===""){
             return error_show(1004,"参数不能为空");
         }
-
+        if(!in_array($status,[0,1])){
+            return error_show(1004,"参数status无效值");
+        }
 
         try{
             $data = ['status'=>$status,"updatetime"=>date("Y-m-d H:i:s")];

+ 2 - 2
application/Home/controller/Order.php

@@ -27,7 +27,7 @@ class Order extends Base
         $count =Db::name("order_info")->where($where)->count();
         $total = ceil($count/$size);
         $page = $page>$total?$total:$page;
-        $list = Db::name("order_info")->where($where)->page($page,$size)->field("id,order_sn,order_num,order_time,delivery_time,post_code,post_name,status")
+        $list = Db::name("order_info")->where($where)->page($page,$size)->field("id,order_sn,order_num,order_time,delivery_time,post_code,post_name,status,unit,unit_weight")
             ->select();
         return app_show(0,"获取成功",["list"=>$list,"count"=>$count]);
     }
@@ -42,7 +42,7 @@ class Order extends Base
             return error_show(1004,"参数id 不能为空");
         }
         $order = Db::name("order_info")->where(["is_del"=>0,"accountid"=>$this->userinfo['id'],"id"=>$id])->field("id,
-        order_sn,order_num,order_time,delivery_time,status, post_code,post_name,provice_name,city_name,area_name,addr,contector,contector_mobile,nickname")->find();
+        order_sn,order_num,order_time,delivery_time,status, post_code,post_name,provice_name,city_name,area_name,addr,contector,contector_mobile,nickname,unit,unit_weight")->find();
         if(empty($order)){
             return error_show(1005,"未找到订单数据");
         }

+ 6 - 3
application/Home/controller/Vdlist.php

@@ -30,9 +30,12 @@ class Vdlist extends Base
 
         $where = ['b.id'=>$id,'a.accountid'=>$this->userinfo['id'],'b.is_del'=>0,'b.status'=>1,'a.is_del'=>0,'a.status'=>1];
 
-        $look = Db::name("rela_video")->alias('a')->join("video b","a.video_id=b.id","left")->where($where)->field("b.id,b.video_sn,b.video_name,b.video_url,b.video_img,b.remark,b.video_desc")->order("b.weight desc")->find();
-       //var_dump(Db::name("rela_video")->getLastSql());
-        return app_show(0,"预览成功",$look);
+        $look = Db::name("rela_video")->alias('a')->join("video b","a.video_id=b.id","left")->where($where)->field("b.id,b.video_sn,b.video_name,b.video_url,b.video_img,b.remark")->find();
+       // var_dump(Db::name("rela_video")->getLastSql());
+        if($look==false){
+            return error_show(1002,"预览失败");
+        }else
+            return app_show(0,"预览成功",$look);
     }
 
 

+ 2 - 2
application/common.php

@@ -61,7 +61,7 @@ function error_show($code,$msg=""){
     ];
 
     echo  json_encode($data);
-
+die();
 }
 
 /**
@@ -76,7 +76,7 @@ function app_show($code,$msg="",$list=[]){
         "data"=>$list
     ];
     echo  json_encode($data);
-
+die();
 }
 function makeNo($str){