wugg 3 years ago
parent
commit
43c2966e3a

+ 83 - 1
app/admin/controller/Conf.php

@@ -49,6 +49,88 @@ class Conf extends BaseController
         return  app_show(0,"获取成功",$info);
     }
 
-    public  function add(){}
+    public  function add(){
+        $post = $this->request->post();
+        $name = isset($post['name'])&& $post['name']!='' ? trim($post['name']) :"";
+        if($name==""){
+            return error_show(1004,"参数name 不能为空");
+        }
+        $ist = Db::name("config")->where(["name"=>$name,"is_del"=>0])->find();
+        if(!empty($ist)){
+            return error_show(1004,"配置名称已存在");
+        }
+        $setv = isset($post['setv'])&& $post['setv']!='' ? trim($post['setv']) :"";
+        if($setv==""){
+            return error_show(1004,"参数setv 不能为空");
+        }
+        $start= isset($post['start'])&& $post['start']!='' ? $post['start'] :date("Y-m-d H:i:s");
+        $end= isset($post['end'])&& $post['end']!='' ? $post['end'] :null;
+        $status= isset($post['status'])&& $post['status']!='' ? intval($post['satus']) :"1";
+        $data= [
+            "name"=>$name,
+            "setv"=>$setv,
+            'status'=>$status,
+            "starttime"=>$start,
+            "endtime"=>$end,
+            "addtime"=>date("Y-m-d H:i:s"),
+            "updatetime"=>date("Y-m-d H:i:s")
+        ];
+       $iser=Db::name("config")->insert($data);
+       return $iser ? app_show(0,"新建成功"):error_show(1008,"新建失败");
+    }
+
+    public  function edit(){
+        $post = $this->request->post();
+        $id = isset($post['id'])&& $post['id']!='' ? intval($post['id']) :"";
+        if($id==""){
+            return error_show(1004,"参数id 不能为空");
+        }
+        $data = Db::name("config")->where(['id'=>$id,"is_del"=>0])->find();
+        if(empty($data)){
+            return error_show(1005,"未找到数据");
+        }
+        $name = isset($post['name'])&& $post['name']!='' ? trim($post['name']) :"";
+        if($name==""){
+            return error_show(1004,"参数name 不能为空");
+        }
+        $ist = Db::name("config")->where(["name"=>$name,"is_del"=>0])->find();
+        if(!empty($ist)&&$ist['id']!=$id){
+            return error_show(1004,"配置名称已存在");
+        }
+        $setv = isset($post['setv'])&& $post['setv']!='' ? trim($post['setv']) :"";
+        if($setv==""){
+            return error_show(1004,"参数setv 不能为空");
+        }
+        $start= isset($post['start'])&& $post['start']!='' ? $post['start'] :date("Y-m-d H:i:s");
+        $end= isset($post['end'])&& $post['end']!='' ? $post['end'] :null;
+        $status= isset($post['status'])&& $post['status']!='' ? intval($post['satus']) :"1";
+        $data= [
+            "id"=>$id,
+            "name"=>$name,
+            "setv"=>$setv,
+            'status'=>$status,
+            "starttime"=>$start,
+            "endtime"=>$end,
+            "updatetime"=>date("Y-m-d H:i:s")
+        ];
+        $iser=Db::name("config")->save($data);
+        return $iser ? app_show(0,"新建成功"):error_show(1008,"新建失败");
+    }
+
+    public  function  delete(){
+        $post = $this->request->post();
+        $id = isset($post['id'])&& $post['id']!='' ? intval($post['id']) :"";
+        if($id==""){
+            return error_show(1004,"参数id 不能为空");
+        }
+        $data = Db::name("config")->where(['id'=>$id,"is_del"=>0])->find();
+        if(empty($data)){
+            return error_show(1005,"未找到数据");
+        }
+        $data['is_del']=1;
+        $data['updatetime']=date("Y-m-d H:i:s");
+        $iser=Db::name("config")->save($data);
+        return $iser ? app_show(0,"删除成功"):error_show(1008,"删除失败");
+    }
 
 }

+ 6 - 18
app/admin/controller/User.php

@@ -27,7 +27,7 @@ class User extends BaseController
         $page = isset($post['page'])&& $post['page']!='' ? intval($post['page']) : 1;
         $size = isset($post['size'])&& $post['size']!='' ? intval($post['size']) : 10;
         $condition = ['page'=>$page,'size'=>$size];
-        $data = GetUserlist($token,$condition);
+        $data = Getlist($token,$condition);
         if(!empty($data) && $data['code']!=0){
             return error_show($effetc['code'],$effetc['message']);
         }
@@ -86,27 +86,15 @@ class User extends BaseController
         if(!empty($effetc) && $effetc['code']!=0){
             return error_show($effetc['code'],$effetc['message']);
         }
-        $newPwd= isset($post['passwd']) ? trim($post['passwd']) : "";
+        $newPwd= isset($post['newpwd']) ? trim($post['newpwd']) : "";
         if($newPwd==""){
             return error_show(1001,'新密码不能为空');
         }
-        $oldpasswd= isset($post['oldpasswd']) ? trim($post['oldpasswd']) : "";
-        if($oldpasswd==""){
-            return error_show(1001,'旧密码不能为空');
+        $oldpwd = isset($post['oldpwd'])?trim($post['oldpwd']):"";
+        if($oldpwd==""){
+            return error_show(1002,"原密码不能为空");
         }
-
-
-        $account =model("AdminAccount")->GetAccountByUid($effetc['user']['id']);
-        if(!empty ($account) && $account->status!=1){
-            return error_show(10005, '账户已被禁止登录');
-        }
-        if($account->password!=sha1($oldpasswd.$account->salt)){
-            return error_show(10005, '旧密码错误!');
-        }
-        $salt=makeSalt();
-        $data=['password'=>sha1($newPwd.$salt),'salt'=>$salt,"updatetime"=>date("Y-m-d H:i:s")];
-
-        return  AdminAccount::update($data,["id"=>$account->id]) ? app_show(0, '密码修改成功') : error_show(1001,"密码修改失败");
+        $data = resetpasswd($token,['newpwd'=>$newPwd,'oldpwd'=>$oldpwd]);
     }
 
     public  function  userAll(){

+ 46 - 6
app/admin/controller/WareHouse.php

@@ -30,9 +30,13 @@ class WareHouse extends BaseController
         if($name==''){
             return error_show(1004,'参数name 不能为空');
         }
-        $supplier = isset($post['supplierid'])&& $post['supplierid']!='' ?intval($post['supplierid']) :'';
+        $supplier = isset($post['supplierNo'])&& $post['supplierNo']!='' ?trim($post['supplierNo']) :'';
         if($supplier==''){
-            return error_show(1004,'参数supplierid 不能为空');
+            return error_show(1004,'参数supplierNo 不能为空');
+        }
+        $supplierinfo = Db::name("supplier")->where(["code"=>$supplier])->find();
+        if(empty($supplierinfo)){
+            return error_show(1004,'未找到供应商数据');
         }
         $wsmtype = isset($post['wsmtype'])&& $post['wsmtype']!='' ?intval($post['wsmtype']) :'';
         if($wsmtype==''){
@@ -59,7 +63,7 @@ class WareHouse extends BaseController
             'wsm_code'=>makeNo("WSM"),
             'name'=>$name,
             'wsm_type'=>$wsmtype,
-            'supplierid'=>$supplier,
+            'supplierNo'=>$supplier,
             'addr'=>$addr,
             'contactor'=>$contactor,
             'mobile'=>$mobile,
@@ -74,10 +78,46 @@ class WareHouse extends BaseController
 
     public function list(){
         $post  =$this->request->post();
-        $supplier = isset($post['supplierid'])&& $post['supplierid']!='' ?intval($post['supplierid']) :'';
-        if($supplier==''){
-            return error_show(1004,'参数supplierid 不能为空');
+
+        $condition = [['is_del'=>0]];
+        $supplier = isset($post['supplierNo'])&&$post['supplierNo']!="" ? trim($post['supplierNo']) :"";
+        if($supplier!=""){
+            $condition[]=["supplierNo"=>$supplier];
+        }
+        $supplier = isset($post['supplierNo'])&&$post['supplierNo']!="" ? trim($post['supplierNo']) :"";
+        if($supplier!=""){
+            $condition[]=["supplierNo"=>$supplier];
+        }
+        $wsm_code = isset($post['wsm_code'])&&$post['wsm_code']!="" ? trim($post['wsm_code']) :"";
+        if($wsm_code!=""){
+            $condition[]=["wsm_code"=>$wsm_code];
+        }
+        $start = isset($post['start'])&&$post['start']!="" ? $post['start'] :"";
+        if($start!=""){
+            $condition[]=["addtime"=>[">=",$start]];
         }
+        $end = isset($post['end'])&&$post['end']!="" ? $post['end'] :"";
+        if($start!=""){
+            $condition[]=["addtime"=>[">=",$end]];
+        }
+        $mobile = isset($post['mobile'])&&$post['mobile']!="" ?  trim($post['mobile']) :"";
+        if($mobile!=""){
+            $condition[]=["mobile"=>["like","%{$mobile}%"]];
+        }
+        $contactor = isset($post['contactor'])&&$post['contactor']!="" ? trim($post['contactor']) :"";
+        if($contactor!=""){
+            $condition[]=["contactor"=>["like","%{$contactor}%"]];
+        }
+        $page = isset($post['page']) &&$post['page']!=='' ?intval($post['page']) :1;
+        $size = isset($post['size']) &&$post['size']!=='' ?intval($post['size']) :10;
+        $count = Db::name("warehouse_info")->where($condition)->count();
+        $page>=ceil($count/$size) ? $page = ceil($count/$size): '';
+        $list = Db::name("warehouse_info")->where($condition)->page($page,$size)->order("addtime desc")->select();
+        return  app_show(0,"获取成功",['list'=>$list,"count"=>$count]);
+    }
+
+    public function  info(){
+        $post  =$this->request->post();
 
     }
 }

+ 3 - 0
app/admin/route/app.php

@@ -63,3 +63,6 @@ Route::rule('userlist', 'admin/User/list');
 Route::rule('userinfo', 'admin/User/userInfo');
 Route::rule('userall', 'admin/User/userList');
 
+Route::rule("loglist","admin/System/index");
+Route::rule("versionlist","admin/System/version");
+Route::rule("lastversion","admin/System/LastVersion");

+ 10 - 0
app/common.php

@@ -226,6 +226,16 @@ function UploadImg($files)
      return json_decode($response,true);
  }
 
+function resetpasswd($token,$condition){
+    $host = Config::get("app");
+
+    $url = $host["api_host"]."/Api/passsave";
+    $condition['token']=$token;
+    $response=curl_request($url,$condition);
+
+    return json_decode($response,true);
+}
+
 /**
  * @param $token
  * @param $condition