Преглед на файлове

Merge branch 'dev' of wugg/fivechang into master

panlumeng преди 3 години
родител
ревизия
4bbca71f14
променени са 6 файла, в които са добавени 268 реда и са изтрити 185 реда
  1. 1 0
      .env
  2. 1 0
      .gitignore
  3. 226 181
      application/Admin/controller/Account.php
  4. 19 1
      application/Admin/controller/Stock.php
  5. 19 1
      application/Home/controller/Base.php
  6. 2 2
      application/Home/controller/Login.php

+ 1 - 0
.env

@@ -0,0 +1 @@
+APP_DEBUG = false

[APP]
DEFAULT_TIMEZONE = Asia/Shanghai


[LANG]
default_lang = zh-cn

+ 1 - 0
.gitignore

@@ -4,4 +4,5 @@ composer.lock
 application/config.php
 application/database.php
 runtime
+.env
 

+ 226 - 181
application/Admin/controller/Account.php

@@ -4,6 +4,7 @@
  */
 
 namespace app\Admin\controller;
+
 use think\Db;
 
 class Account extends Base
@@ -15,49 +16,70 @@ class Account extends Base
     }
 
     /**
-    * @param status
-    * @param username
-    * @param mobile
-    * @param nickname
-    * @param page
-    * @param size
+     * @param status
+     * @param username
+     * @param mobile
+     * @param nickname
+     * @param page
+     * @param size
      */
-    public function List(){
-        $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;
-        $status = isset($this->post['status'])&&$this->post['status']!=="" ? intval($this->post['status']) :"";
-        $where=[];
-        if($status!==""){
-            $where['status'] = $status;
+    public function List()
+    {
+        $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;
+        $status = isset($this->post['status']) && $this->post['status'] !== "" ? intval($this->post['status']) : "";
+        $where = [];
+        if ($status !== "") {
+            $where['a.status'] = $status;
         }
-        $username =  isset($this->post['username'])&&$this->post['username']!=="" ? trim($this->post['username']) :"";
-        if($username!=""){
-            $where['username'] = ["like","%{$username}%"];
+        $username = isset($this->post['username']) && $this->post['username'] !== "" ? trim($this->post['username']) : "";
+        if ($username != "") {
+            $where['username'] = ["like", "%{$username}%"];
         }
-        $nickname =  isset($this->post['nickname'])&&$this->post['nickname']!=="" ? trim($this->post['nickname']) :"";
-        if($nickname!=""){
-            $where['nickname'] = ["like"=>"%{$nickname}%"];
+        $nickname = isset($this->post['nickname']) && $this->post['nickname'] !== "" ? trim($this->post['nickname']) : "";
+        if ($nickname != "") {
+            $where['nickname'] = ["like" => "%{$nickname}%"];
         }
-        $mobile =  isset($this->post['mobile'])&&$this->post['mobile']!=="" ? trim($this->post['mobile']) :"";
-        if($mobile!=""){
-            $where['mobile'] = ["like"=>"%{$mobile}%"];
+        $mobile = isset($this->post['mobile']) && $this->post['mobile'] !== "" ? trim($this->post['mobile']) : "";
+        if ($mobile != "") {
+            $where['c.mobile'] = ["like" => "%{$mobile}%"];
         }
+        $count = Db::name("account")->alias('a')
+            ->join("fc_rela_account b", "a.id = b.accountid", "left")
+            ->join("fc_account_info c", "b.account_info= c.id", "left")
+            ->where($where)->count();
+        $total = ceil($count / $size);
+        $page = $page >= $total ? $total : $page;
 
-        $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();
-        $i=[];
-        foreach ($list as $vus ){
-            $vi = Db::name('rela_video')->join('fc_video a','a.id=fc_rela_video.video_id','left')->field('a.video_sn,a.video_name,a.video_url,a.video_img')->where(['accountid'=>$vus['id'],'a.is_del'=>0,])->select();
-            if(empty($vi)){
-                $vi=[];
+        $list = Db::name("account")->alias('a')->where($where)->page($page, $size)
+            ->join("fc_rela_account b", "a.id = b.accountid", "left")
+            ->join("fc_account_info c", "b.account_info= c.id", "left")
+            ->field("`a`.`id` AS `id`,
+	                      `a`.`username` AS `username`,
+	                      `a`.`password` AS `password`,
+	                      `a`.`salt` AS `salt`,
+	                      `a`.`status` AS `status`,
+                          `a`.`is_del` AS `is_del`,
+                          `a`.`starttime` AS `starttime`,
+                          `a`.`expiretime` AS `expiretime`,
+                          `a`.`activetime` AS `activetime`,
+                          `a`.`addtime` AS `addtime`,
+                           `c`.`nickname` AS `nickname`,
+                           `c`.`avatar` AS `avatar`,
+                           `c`.`mobile` AS `mobile`,
+                           `c`.`remark` AS `remark`,
+                           `c`.`sex` AS `sex`")
+            ->order("a.id desc")->select();
+        $i = [];
+        foreach ($list as $vus) {
+            $vi = Db::name('rela_video')->join('fc_video a', 'a.id=fc_rela_video.video_id', 'left')->field('a.video_sn,a.video_name,a.video_url,a.video_img')->where(['accountid' => $vus['id'], 'a.is_del' => 0,])->select();
+            if (empty($vi)) {
+                $vi = [];
             }
-            $vus['info']=$vi;
-            $i[]=$vus;
+            $vus['info'] = $vi;
+            $i[] = $vus;
         }
-        return app_show(0,"获取成功",["list"=>$i,"count"=>$count]);
+        return app_show(0, "获取成功", ["list" => $i, "count" => $count]);
     }
 
     /**
@@ -69,106 +91,107 @@ class Account extends Base
      * @param remark
      * @param video
      */
-    public function  Create(){
-        $username =  isset($this->post['username'])&&$this->post['username']!=="" ? trim($this->post['username']) :"";
-        if($username==""){
-           return error_show(1004,"参数username 不能为空");
+    public function Create()
+    {
+        $username = isset($this->post['username']) && $this->post['username'] !== "" ? trim($this->post['username']) : "";
+        if ($username == "") {
+            return error_show(1004, "参数username 不能为空");
         }
-        if(!checkAccount($username)){
-            return error_show(1004,"账户格式不正确");
+        if (!checkAccount($username)) {
+            return error_show(1004, "账户格式不正确");
         }
-        $isT= Db::name("account")->where(["is_del"=>0,"username"=>$username])->find();
-        if($isT){
-            return error_show(1004,"账户名已存在");
+        $isT = Db::name("account")->where(["is_del" => 0, "username" => $username])->find();
+        if ($isT) {
+            return error_show(1004, "账户名已存在");
         }
-        $pasword =  isset($this->post['password'])&&$this->post['password']!=="" ? trim($this->post['password']) :"";
-        if($pasword==""){
-            return error_show(1004,"参数password 不能为空");
+        $pasword = isset($this->post['password']) && $this->post['password'] !== "" ? trim($this->post['password']) : "";
+        if ($pasword == "") {
+            return error_show(1004, "参数password 不能为空");
         }
-        if(!checkPasswd($pasword)){
-            return error_show(1004,"密码格式不正确");
+        if (!checkPasswd($pasword)) {
+            return error_show(1004, "密码格式不正确");
         }
-        $starttime = isset($this->post['starttime'])&&$this->post['starttime']!=="" ? $this->post['starttime'] :"";
-        if($starttime==""){
-            return error_show(1004,"参数starttime 不能为空");
+        $starttime = isset($this->post['starttime']) && $this->post['starttime'] !== "" ? $this->post['starttime'] : "";
+        if ($starttime == "") {
+            return error_show(1004, "参数starttime 不能为空");
         }
-        $expiretime = isset($this->post['expiretime'])&&$this->post['expiretime']!=="" ? $this->post['expiretime'] :"";
-        if($expiretime==""){
-            return error_show(1004,"参数expiretime 不能为空");
+        $expiretime = isset($this->post['expiretime']) && $this->post['expiretime'] !== "" ? $this->post['expiretime'] : "";
+        if ($expiretime == "") {
+            return error_show(1004, "参数expiretime 不能为空");
         }
-        $nickname =  isset($this->post['nickname'])&&$this->post['nickname']!=="" ? trim($this->post['nickname']) :"";
+        $nickname = isset($this->post['nickname']) && $this->post['nickname'] !== "" ? trim($this->post['nickname']) : "";
 //        if($nickname==""){
 //            return error_show(1004,"参数nickname 不能为空");
 //        }
-        $mobile =  isset($this->post['mobile'])&&$this->post['mobile']!=="" ? trim($this->post['mobile']) :"";
+        $mobile = isset($this->post['mobile']) && $this->post['mobile'] !== "" ? trim($this->post['mobile']) : "";
 //        if($mobile==""){
 //            return error_show(1004,"参数mobile 不能为空");
 //        }
-        $remark = isset($this->post['remark'])&&$this->post['remark']!=="" ? trim($this->post['remark']) :"";
-        $video =  isset($this->post['video'])&&$this->post['video']!=="" ? $this->post['video'] :"";
-        if($video==""){
-            return error_show(1004,"参数video 不能为空");
+        $remark = isset($this->post['remark']) && $this->post['remark'] !== "" ? trim($this->post['remark']) : "";
+        $video = isset($this->post['video']) && $this->post['video'] !== "" ? $this->post['video'] : "";
+        if ($video == "") {
+            return error_show(1004, "参数video 不能为空");
         }
         Db::startTrans();
         try {
             $salt = makeSalt();
-            $pas = sha1($pasword.$salt);
-            $data=[
-                "username"=>$username,
-                "password"=>$pas,
-                "pwd"=>$pasword,
-                "salt"=>$salt,
-                "status"=>0,
-                "is_del"=>0,
-                "starttime"=>$starttime,
-                "expiretime"=>$expiretime,
-                "addtime"=>date("Y-m-d H:i:s"),
-                "updatetime"=>date("Y-m-d H:i:s")
+            $pas = sha1($pasword . $salt);
+            $data = [
+                "username" => $username,
+                "password" => $pas,
+                "pwd" => $pasword,
+                "salt" => $salt,
+                "status" => 0,
+                "is_del" => 0,
+                "starttime" => $starttime,
+                "expiretime" => $expiretime,
+                "addtime" => date("Y-m-d H:i:s"),
+                "updatetime" => date("Y-m-d H:i:s")
             ];
-            $acccount = Db::name("account")->insert($data,false,true);
-            if($acccount>0){
-                $user=[
-                    "nickname"=>$nickname,
-                    "mobile"=>$mobile,
-                    "avatar"=>"",
-                    "remark"=>$remark,
-                    "sex"=>"",
-                    "addtime"=>date("Y-m-d H:i:s"),
-                    "updatetime"=>date("Y-m-d H:i:s")
+            $acccount = Db::name("account")->insert($data, false, true);
+            if ($acccount > 0) {
+                $user = [
+                    "nickname" => $nickname,
+                    "mobile" => $mobile,
+                    "avatar" => "",
+                    "remark" => $remark,
+                    "sex" => "",
+                    "addtime" => date("Y-m-d H:i:s"),
+                    "updatetime" => date("Y-m-d H:i:s")
                 ];
-                $info = Db::name("account_info")->insert($user,false,true);
-                if($info>0){
-                    $rela=["accountid"=>$acccount,"account_info"=>$info];
-                    $rela_acc=Db::name("rela_account")->insert($rela);
+                $info = Db::name("account_info")->insert($user, false, true);
+                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){
+                    // $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;
+                        $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){
+                    $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");
+                        return error_show(1002, "绑定失败");
+                    } else {
+                        write_log("视频绑定成功", $this->userinfo, "account", "add");
                     }
-                    if($rela_acc){
-                        write_log("账户{$username}新建成功",$this->userinfo,"account","add");
+                    if ($rela_acc) {
+                        write_log("账户{$username}新建成功", $this->userinfo, "account", "add");
                         Db::commit();
-                        return app_show(0,"账户新建成功");
+                        return app_show(0, "账户新建成功");
                     }
 
                 }
             }
             Db::rollback();
-            return error_show(1005,"账户新建失败");
-        }catch (\Exception $e){
+            return error_show(1005, "账户新建失败");
+        } catch (\Exception $e) {
             Db::rollback();
-            return error_show(1003,$e->getMessage());
+            return error_show(1003, $e->getMessage());
         }
     }
 
@@ -179,24 +202,45 @@ class Account extends Base
      * @throws \think\db\exception\ModelNotFoundException
      * @throws \think\exception\DbException
      */
-    public function Read(){
-        $id=isset($this->post['id'])&&$this->post["id"]!="" ? intval($this->post['id']):"";
-        if($id==""){
-            return error_show(1004,"参数id 不能为空");
+    public function Read()
+    {
+        $id = isset($this->post['id']) && $this->post["id"] != "" ? intval($this->post['id']) : "";
+        if ($id == "") {
+            return error_show(1004, "参数id 不能为空");
         }
-        $info = Db::name("account_list")->where(["id"=>$id])->find();
-        if(empty($info)){
-            return error_show(1005,"未找到数据");
+        $info = Db::name("account")->alias('a')->where(["a.id" => $id])
+            ->join("fc_rela_account b", "a.id = b.accountid", "left")
+            ->join("fc_account_info c", "b.account_info= c.id", "left")
+            ->field("`a`.`id` AS `id`,
+	                      `a`.`username` AS `username`,
+	                      `a`.`password` AS `password`,
+	                      `a`.`salt` AS `salt`,
+	                      `a`.`status` AS `status`,
+                          `a`.`is_del` AS `is_del`,
+                          `a`.`starttime` AS `starttime`,
+                          `a`.`expiretime` AS `expiretime`,
+                          `a`.`activetime` AS `activetime`,
+                          `a`.`addtime` AS `addtime`,
+                           `c`.`nickname` AS `nickname`,
+                           `c`.`avatar` AS `avatar`,
+                           `c`.`mobile` AS `mobile`,
+                           `c`.`remark` AS `remark`,
+                           `c`.`sex` AS `sex`")
+            ->find();
+        if (empty($info)) {
+            return error_show(1005, "未找到数据");
         }
-        if($info["is_del"]==1){
-            return error_show(1005,"账户已被删除");
+        if ($info["is_del"] == 1) {
+            return error_show(1005, "账户已被删除");
         }
-        $info['status_n'] = $info['status']==0 ? "未激活": $info['status']==1? "已激活":"已失效";
+        $info['status_n'] = $info['status'] == 0 ? "未激活" : $info['status'] == 1 ? "已激活" : "已失效";
 
-        $vi = Db::name('rela_video')->join('fc_video a','a.id=fc_rela_video.video_id','left')->field('a.video_sn,a.video_name,a.video_url,a.video_img,fc_rela_video.video_id,a.status')->where(['accountid'=>$id,'a.is_del'=>0,'fc_rela_video.is_del'=>0])->select();
+        $vi = Db::name('rela_video')->join('fc_video a', 'a.id=fc_rela_video.video_id', 'left')
+            ->field('a.video_sn,a.video_name,a.video_url,a.video_img,fc_rela_video.video_id,a.status')
+            ->where(['accountid' => $id, 'a.is_del' => 0, 'fc_rela_video.is_del' => 0])->select();
         //var_dump(Db::name('rela_video')->getLastSql());
-        $info['info']= $vi;
-        return app_show(0,"获取成功",$info );
+        $info['info'] = $vi;
+        return app_show(0, "获取成功", $info);
 
     }
 
@@ -210,103 +254,104 @@ class Account extends Base
      * @param remark
      * @param video
      */
-    public function Save(){
-        $id=isset($this->post['id'])&&$this->post['id']!=""? intval($this->post['id']) :"";
-        if($id==""){
-            return error_show(1004,"参数id 不能为空");
+    public function Save()
+    {
+        $id = isset($this->post['id']) && $this->post['id'] != "" ? intval($this->post['id']) : "";
+        if ($id == "") {
+            return error_show(1004, "参数id 不能为空");
         }
-        $info= Db::name("account")->where(["is_del"=>0,"id"=>$id])->find();
-        if(empty($info)){
-            return error_show(1004,"未找到数据");
+        $info = Db::name("account")->where(["is_del" => 0, "id" => $id])->find();
+        if (empty($info)) {
+            return error_show(1004, "未找到数据");
         }
-        $username =  isset($this->post['username'])&&$this->post['username']!=="" ? trim($this->post['username']) :"";
-        if($username!=""){
-            $isT= Db::name("account")->where(["is_del"=>0,"username"=>$username,"id"=>["<>",$id]])->find();
-            if($isT){
-                return error_show(1004,"账户名已存在");
+        $username = isset($this->post['username']) && $this->post['username'] !== "" ? trim($this->post['username']) : "";
+        if ($username != "") {
+            $isT = Db::name("account")->where(["is_del" => 0, "username" => $username, "id" => ["<>", $id]])->find();
+            if ($isT) {
+                return error_show(1004, "账户名已存在");
             }
             $info['username'] = $username;
         }
 
-        $pasword =  isset($this->post['password'])&&$this->post['password']!=="" ? trim($this->post['password']) :"";
-        if($pasword!=""){
-           $salt=makeSalt();
-           $info['password']=sha1($pasword.$salt);
-           $info['pwd']=$pasword;
+        $pasword = isset($this->post['password']) && $this->post['password'] !== "" ? trim($this->post['password']) : "";
+        if ($pasword != "") {
+            $salt = makeSalt();
+            $info['password'] = sha1($pasword . $salt);
+            $info['pwd'] = $pasword;
 
         }
-        $starttime = isset($this->post['starttime'])&&$this->post['starttime']!=="" ? $this->post['starttime'] :"";
-        if($starttime!=""){
-           $info['starttime'] = $starttime;
+        $starttime = isset($this->post['starttime']) && $this->post['starttime'] !== "" ? $this->post['starttime'] : "";
+        if ($starttime != "") {
+            $info['starttime'] = $starttime;
         }
-        $expiretime = isset($this->post['expiretime'])&&$this->post['expiretime']!=="" ? $this->post['expiretime'] :"";
-        if($expiretime!=""){
+        $expiretime = isset($this->post['expiretime']) && $this->post['expiretime'] !== "" ? $this->post['expiretime'] : "";
+        if ($expiretime != "") {
             $expire = strtotime($expiretime);
-            if($expire>time()){
-                $info['status'] = $info['activetime']==""? 0:1;
-            }else{
-                $info['status'] =2;
+            if ($expire > time()) {
+                $info['status'] = $info['activetime'] == "" ? 0 : 1;
+            } else {
+                $info['status'] = 2;
             }
             $info['expiretime'] = $expiretime;
         }
         $info['updatetime'] = date("Y-m-d H:i:s");
-        $rela = Db::name("account_info")->alias("a")->Join("fc_rela_account b","b.account_info=a.id","left")->where(["b.accountid"=>$id])->field("a.*")->find();
-        $nickname =  isset($this->post['nickname'])&&$this->post['nickname']!=="" ? trim($this->post['nickname']) :"";
-        if($nickname!=""){
-            $rela['nickname']=$nickname;
+        $rela = Db::name("account_info")->alias("a")->Join("fc_rela_account b", "b.account_info=a.id", "left")->where(["b.accountid" => $id])->field("a.*")->find();
+        $nickname = isset($this->post['nickname']) && $this->post['nickname'] !== "" ? trim($this->post['nickname']) : "";
+        if ($nickname != "") {
+            $rela['nickname'] = $nickname;
         }
-        $mobile =  isset($this->post['mobile'])&&$this->post['mobile']!=="" ? trim($this->post['mobile']) :"";
-        if($mobile!=""){
-            $rela['mobile']=$mobile;
+        $mobile = isset($this->post['mobile']) && $this->post['mobile'] !== "" ? trim($this->post['mobile']) : "";
+        if ($mobile != "") {
+            $rela['mobile'] = $mobile;
         }
 
-        $rela['remark'] = isset($this->post['remark'])&&$this->post['remark']!=="" ? trim($this->post['remark']) :"";
-        $video =  isset($this->post['video'])&&$this->post['video']!=="" ? $this->post['video'] :"";
-        if($video==""){
-            return error_show(1004,"参数video 不能为空");
+        $rela['remark'] = isset($this->post['remark']) && $this->post['remark'] !== "" ? trim($this->post['remark']) : "";
+        $video = isset($this->post['video']) && $this->post['video'] !== "" ? $this->post['video'] : "";
+        if ($video == "") {
+            return error_show(1004, "参数video 不能为空");
         }
         $rela['updatetime'] = date("Y-m-d H:i:s");
 
         Db::startTrans();
-      try {
+        try {
             $acccount = Db::name("account")->update($info);
-            if($acccount){
+            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(["addtime"=>date("Y-m-d H:i:s"),"is_del"=>1]);
-                    }
-                $k=[];
-                 $vb = Db::name('video')->where(['status'=>0,'id'=>["in",$video]])->select();
-                 if(!empty($vb)){
-                     return error_show(1004,"存在已禁用的视频");
-                 }
-                foreach ($video as $valu){
-                    $temp=["video_id"=>$valu,"accountid"=>$id,"addtime"=>date("Y-m-d H:i:s")];
-                    $k[]=$temp;
+                $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(["addtime" => date("Y-m-d H:i:s"), "is_del" => 1]);
                 }
-                $rele_a= Db::name("rela_video")->insertAll($k);
-                if($rele_a==false){
+                $k = [];
+                $vb = Db::name('video')->where(['status' => 0, 'id' => ["in", $video]])->select();
+                if (!empty($vb)) {
+                    return error_show(1004, "存在已禁用的视频");
+                }
+                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");
+                    return error_show(1002, "绑定失败");
+                } else {
+                    write_log("视频绑定成功", $this->userinfo, "account", "edit");
                 }
 
-                if($infoacc){
-                        write_log("账户{$username}新建成功",$this->userinfo,"account","edit");
-                        Db::commit();
-                        return app_show(0,"账户编辑成功");
-                }else{
+                if ($infoacc) {
+                    write_log("账户{$username}新建成功", $this->userinfo, "account", "edit");
+                    Db::commit();
+                    return app_show(0, "账户编辑成功");
+                } else {
                     Db::rollback();
-                    return error_show(1005,"账户编辑失败");
+                    return error_show(1005, "账户编辑失败");
                 }
             }
             Db::rollback();
-            return error_show(1005,"账户编辑失败");
-    }catch (\Exception $e){
+            return error_show(1005, "账户编辑失败");
+        } catch (\Exception $e) {
             Db::rollback();
-            return error_show(1003,$e->getMessage());
+            return error_show(1003, $e->getMessage());
         }
     }
 }

+ 19 - 1
application/Admin/controller/Stock.php

@@ -157,7 +157,25 @@ class Stock extends Base
         if($id==""){
             return error_show(1004,"参数id 不能为空");
         }
-        $account = Db::name("account_list")->where(["is_del"=>0,"id"=>$id])->find();
+        $account = Db::name("account")->alias('a')->where(["a.is_del"=>0,"a.id"=>$id])
+            ->join("fc_rela_account b", "a.id = b.accountid", "left")
+            ->join("fc_account_info c", "b.account_info= c.id", "left")
+            ->field("`a`.`id` AS `id`,
+	                      `a`.`username` AS `username`,
+	                      `a`.`password` AS `password`,
+	                      `a`.`salt` AS `salt`,
+	                      `a`.`status` AS `status`,
+                          `a`.`is_del` AS `is_del`,
+                          `a`.`starttime` AS `starttime`,
+                          `a`.`expiretime` AS `expiretime`,
+                          `a`.`activetime` AS `activetime`,
+                          `a`.`addtime` AS `addtime`,
+                           `c`.`nickname` AS `nickname`,
+                           `c`.`avatar` AS `avatar`,
+                           `c`.`mobile` AS `mobile`,
+                           `c`.`remark` AS `remark`,
+                           `c`.`sex` AS `sex`")
+            ->find();
         if(empty($account)){
             return error_show(1005,"账户信息不存在");
         }

+ 19 - 1
application/Home/controller/Base.php

@@ -29,7 +29,25 @@ class Base
             return error_show(1004,"未找到账户id");
         }
 
-        $userinfo = Db::name("account_list")->where(["id"=>$tokeninfo['accountid']])->field("id,username,status,starttime,expiretime,activetime,addtime,nickname,avatar,mobile,remark")->find();
+        $userinfo = Db::name("account")->alias('a')->where(["a.id"=>$tokeninfo['accountid']])
+            ->join("fc_rela_account b", "a.id = b.accountid", "left")
+            ->join("fc_account_info c", "b.account_info= c.id", "left")
+            ->field("`a`.`id` AS `id`,
+	                      `a`.`username` AS `username`,
+	                      `a`.`password` AS `password`,
+	                      `a`.`salt` AS `salt`,
+	                      `a`.`status` AS `status`,
+                          `a`.`is_del` AS `is_del`,
+                          `a`.`starttime` AS `starttime`,
+                          `a`.`expiretime` AS `expiretime`,
+                          `a`.`activetime` AS `activetime`,
+                          `a`.`addtime` AS `addtime`,
+                           `c`.`nickname` AS `nickname`,
+                           `c`.`avatar` AS `avatar`,
+                           `c`.`mobile` AS `mobile`,
+                           `c`.`remark` AS `remark`,
+                           `c`.`sex` AS `sex`")
+            ->find();
         //var_dump($userinfo);
         if(empty($userinfo)){
             return error_show(1004,"未找到账户数据");

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

@@ -30,10 +30,10 @@ class Login
         $account = Db::name("account")->where(["is_del"=>0,"username"=>$username])->find();
 
         if(empty($account)){
-            return error_show(1005,"账户未找到");
+            return error_show(1005,"卡号不正确");
         }
         if($account['status']==2){
-            return error_show(1005,"账户已过有效期");
+            return error_show(1005,"卡号已过有效期");
         }
         $now =time();
         $expire = strtotime($account['expiretime']);