544782275@qq.com 3 年之前
父节点
当前提交
fa221deb52
共有 72 个文件被更改,包括 3894 次插入3519 次删除
  1. 1 1
      application/admin/view/config/storage-oss.html
  2. 5 3
      application/api/controller/Base.php
  3. 361 0
      application/api/controller/Consult.php
  4. 375 0
      application/api/controller/Index.php
  5. 297 25
      application/api/controller/Login.php
  6. 452 667
      application/api/controller/Member.php
  7. 329 0
      application/api/controller/Operation.php
  8. 0 802
      application/api/controller/Order.php
  9. 120 0
      application/api/controller/Search.php
  10. 3 6
      application/api/controller/Upload.php
  11. 31 18
      application/common.php
  12. 13 38
      application/store/controller/Background.php
  13. 13 38
      application/store/controller/Banner.php
  14. 3 4
      application/store/controller/Complain.php
  15. 179 0
      application/store/controller/Consult.php
  16. 113 0
      application/store/controller/ConsultCate.php
  17. 25 88
      application/store/controller/Goods.php
  18. 113 0
      application/store/controller/GoodsCate.php
  19. 113 0
      application/store/controller/Media.php
  20. 11 117
      application/store/controller/Member.php
  21. 61 0
      application/store/controller/Message.php
  22. 62 60
      application/store/controller/Notice.php
  23. 0 136
      application/store/controller/Order.php
  24. 0 160
      application/store/controller/Principal.php
  25. 113 0
      application/store/controller/Versions.php
  26. 23 0
      application/store/view/background/form.html
  27. 35 0
      application/store/view/background/index.html
  28. 30 0
      application/store/view/banner/form.html
  29. 79 0
      application/store/view/banner/index.html
  30. 30 0
      application/store/view/banner/index_search.html
  31. 2 2
      application/store/view/complain/index.html
  32. 6 6
      application/store/view/complain/index_search.html
  33. 18 0
      application/store/view/config/index-about-us.html
  34. 18 0
      application/store/view/config/index-privacy-policy.html
  35. 9 12
      application/store/view/config/index-store-config.html
  36. 10 3
      application/store/view/config/index-store-message1.html
  37. 34 8
      application/store/view/config/index-store-message2.html
  38. 11 5
      application/store/view/config/index.html
  39. 112 0
      application/store/view/consult/form.html
  40. 89 0
      application/store/view/consult/index.html
  41. 58 0
      application/store/view/consult/index_search.html
  42. 3 3
      application/store/view/consult_cate/form.html
  43. 19 13
      application/store/view/consult_cate/index.html
  44. 2 2
      application/store/view/consult_cate/index_search.html
  45. 24 233
      application/store/view/goods/form.html
  46. 16 25
      application/store/view/goods/index.html
  47. 8 8
      application/store/view/goods/index_search.html
  48. 0 136
      application/store/view/goods/no_edit.html
  49. 0 64
      application/store/view/goods/stock.html
  50. 3 3
      application/store/view/goods_cate/form.html
  51. 13 14
      application/store/view/goods_cate/index.html
  52. 2 2
      application/store/view/goods_cate/index_search.html
  53. 31 0
      application/store/view/media/form.html
  54. 77 0
      application/store/view/media/index.html
  55. 30 0
      application/store/view/media/index_search.html
  56. 18 14
      application/store/view/member/index.html
  57. 8 58
      application/store/view/member/index_search.html
  58. 40 0
      application/store/view/message/index.html
  59. 5 14
      application/store/view/message/index_search.html
  60. 58 0
      application/store/view/notice/form.html
  61. 72 0
      application/store/view/notice/index.html
  62. 30 0
      application/store/view/notice/index_search.html
  63. 0 380
      application/store/view/order/form.html
  64. 0 85
      application/store/view/order/index.html
  65. 0 41
      application/store/view/order/index_search.html
  66. 0 65
      application/store/view/principal/form.html
  67. 0 52
      application/store/view/principal/index.html
  68. 0 30
      application/store/view/sales_personnel/form.html
  69. 0 46
      application/store/view/sales_personnel/index.html
  70. 0 32
      application/store/view/sales_personnel/index_search.html
  71. 33 0
      application/store/view/versions/form.html
  72. 45 0
      application/store/view/versions/index.html

+ 1 - 1
application/admin/view/config/storage-oss.html

@@ -51,7 +51,7 @@
         <div class="layui-form-item">
             <label class="layui-form-label">AccessKey<br><span class="nowrap color-desc">访问密钥</span></label>
             <div class="layui-input-block">
-                <input type="text" name="storage_oss_keyid" required value="{:sysconf('storage_oss_keyid')}" maxlength="16" placeholder="请输入OSS AccessKey (访问密钥)" class="layui-input">
+                <input type="text" name="storage_oss_keyid" required value="{:sysconf('storage_oss_keyid')}" maxlength="30" placeholder="请输入OSS AccessKey (访问密钥)" class="layui-input">
                 <p class="help-block">可以在 [ 阿里云 > 个人中心 ] 设置并获取到访问密钥。</p>
             </div>
         </div>

+ 5 - 3
application/api/controller/Base.php

@@ -39,6 +39,7 @@ class Base extends Controller
     protected function check_login()
     {
         $authorization = app()->request->header('Authorization');
+        //var_dump($authorization.'111');exit();
         if(empty($authorization) || $authorization == null){
             $this->error('Token不存在,拒绝访问','',0);
         }
@@ -48,11 +49,12 @@ class Base extends Controller
             $authInfo = json_decode($jwtAuth, true);
             if (!empty($authInfo['uid'])) {
                 $member = Db::name('store_member')->field('status')->where('id',$authInfo['uid'])->find();
-                if(empty($member['status'])){
+                if($member['status']){
+                    $this->uid = $authInfo['uid'];
+                    return $this->uid;
+                }else{
                     $this->error('该会员已被禁用','',0);
                 }
-                $this->uid = $authInfo['uid'];
-                return $this->uid;
             } else {
                 $this->error('Token验证不通过,用户不存在','',0);
             }

+ 361 - 0
application/api/controller/Consult.php

@@ -0,0 +1,361 @@
+<?php
+
+// +----------------------------------------------------------------------
+// | ThinkAdmin
+// +----------------------------------------------------------------------
+// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
+// +----------------------------------------------------------------------
+// | 官方网站: http://demo.thinkadmin.top
+// +----------------------------------------------------------------------
+// | 开源协议 ( https://mit-license.org )
+// +----------------------------------------------------------------------
+// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
+// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
+// +----------------------------------------------------------------------
+
+namespace app\api\controller;
+
+use app\api\controller\Base;
+use think\Db;
+/**
+ * @title 咨询管理
+ * @controller Consult
+ * @group base
+ */
+class Consult extends Base
+{
+    /**
+     * @title 咨询轮播图列表
+     * @desc 咨询轮播图列表
+     * @author QGF
+     * @url /api/Consult/banner
+     * @method GET
+     * @tag 咨询轮播图列表
+     * @return name:-- type:array default:-- desc:咨询列表(logo:轮播图片地址)
+     */
+    public function banner(){
+        $banner = Db::name('store_banner')->field('logo')->where('status',1)->where('is_deleted',0)->limit(0,5)->order('sort','desc')->select();
+        $this->success('获取成功',$banner);
+    }
+    /**
+     * @title 咨询分类
+     * @desc  咨询分类
+     * @author HG
+     * @url /api/Consult/cate
+     * @method GET
+     * @tag 咨询分类
+     * @return name:-- type:array default:-- desc:咨询列表(id:咨询ID,title:咨询标题)
+     */
+    public function cate(){
+        $cate = Db::name('store_consult_cate')->field('id,title')->where('status',1)->where('is_deleted',0)->order('sort','desc')->select();
+        $this->success('获取成功',$cate);
+    }
+    /**
+     * @title 咨询列表
+     * @desc 咨询列表
+     * @author HG
+     * @url /api/Consult/consult_list
+     * @method GET
+     * @tag 咨询列表
+     * @header name:Authorization require:0 desc:Token
+     * @param name:id type:int require:0 default:-- desc:新闻分类ID(搜索不用穿,其他必须传)
+     * @param name:is_recommend type:int require:0 default:0 desc:推荐的咨询(访问推荐咨询传1)
+     * @param name:is_attention type:int require:0 default:0 desc:关注的咨询(访问关注咨询传1)
+     * @param name:keyword type:string require:0 default:-- desc:搜索的关键词
+     * @param name:page type:int require:0 default:1 desc:页数(默认为1)
+     * @param name:page_size type:int require:0 default:10 desc:每页数量(默认为10)
+     * @return name:id type:string default:-- desc:咨询ID
+     * @return name:title type:string default:-- desc:咨询标题
+     * @return name:content type:string default:-- desc:咨询内容
+     * @return name:image type:array default:-- desc:咨询图片(数组形式)
+     * @return name:video type:string default:-- desc:视频地址
+     * @return name:comment_num type:int default:-- desc:评论数量
+     * @return name:media_logo type:string default:-- desc:媒体图标
+     * @return name:media_title type:string default:-- desc:媒体名称
+     * @return name:duration type:string default:-- desc:发布的时长
+     */
+    public function consult_list(){
+        $id = input('id');
+        $is_recommend = input('is_recommend');
+        $is_attention = input('is_attention');
+        $keyword = input('keyword');
+        $page = input('page',1);
+        $pageSize = input('page_size',10);
+        if($keyword){
+            $where = "title like '%".$keyword."%'";
+            //保存搜索的关键词
+            $uid = $this->get_uid();
+            if($uid){
+                $search_id = Db::name('store_search_keyword')->where('user_id',$uid)->where('type',2)->where('name',$keyword)->value('id');
+                if(empty($search_id)){
+                    Db::name('store_search_keyword')->insert(array('user_id' => $uid, 'name' => $keyword,'type'=>2));
+                }
+            }
+        }else{
+            $where = "id > 0";
+        }
+        if($id){
+            $where .= " and cate_id = ".$id;
+        }
+        if($is_recommend){
+            $where .= " and is_recommend = 1";
+        }
+        if($is_attention){
+            $this->check_login();
+            $uid = $this->uid;
+            //查看关注的媒体或用户
+            $user_id_arr = Db::name('store_attention')->where('user_id',$uid)->where('status',1)->column('from_user_id');
+            if($user_id_arr){
+                $user_id_str = implode(',',$user_id_arr);
+            }else{
+                $user_id_str = '0';
+            }
+            $where .= " and user_id in (".$user_id_str.")";
+        }
+        $field = 'id,user_id,type,title,content,media_id,image,video,create_at';
+        $list = Db::name('store_consult')->field($field)->where('status',1)->where('is_deleted',0)->where($where)->page($page,$pageSize)->order(['sort'=>'desc','id'=>'desc'])->select();
+        if($list){
+            foreach($list as &$value) {
+                //获取评论数量
+                $value['comment_num'] = Db::name('store_comment')->where('forum_id',$value['id'])->where('type',1)->where('forum_type',2)->count('id');
+                $value['image'] = image_path($value['image']);
+                if($value['type'] == 1){     //后台媒体
+                    //媒体信息
+                    $media_info = Db::name('store_media')->field('logo,title')->where('id',$value['user_id'])->find();
+                    $value['media_logo'] = $media_info['logo'];
+                    $value['media_title'] = $media_info['title'];
+                }else{      //用户
+                    //用户信息
+                    $media_info = Db::name('store_member')->field('headimg,name')->where('id',$value['user_id'])->find();
+                    $value['media_logo'] = $media_info['headimg'];
+                    $value['media_title'] = $media_info['name'];
+                }
+                $remain_time = time() - strtotime($value['create_at']);
+                $value['duration'] = get_stay_time($remain_time);
+                unset($value['media_id']);
+                unset($value['user_id']);
+                unset($value['type']);
+                unset($value['create_at']);
+            }
+        }
+        $this->success('获取成功',$list);
+    }
+    /**
+     * @title 咨询详情
+     * @desc 咨询详情
+     * @author HG
+     * @url /api/Consult/consult_detail
+     * @method GET
+     * @tag 咨询详情
+     * @header name:Authorization require:1 desc:Token
+     * @param name:id type:int require:1 default:-- desc:咨询ID
+     * @return name:id type:int default:-- desc:咨询的id
+     * @return name:title type:string default:-- desc:咨询标题
+     * @return name:user_id type:int default:-- desc:媒体/用户ID
+     * @return name:content type:string default:-- desc:新增内容(富文本)
+     * @return name:comment_num type:int default:-- desc:评论数量
+     * @return name:like_num type:int default:-- desc:点赞数量
+     * @return name:transpond_num type:int default:-- desc:转发数量
+     * @return name:is_attention type:int default:-- desc:是否关注媒体(0:未关注,1:已关注)
+     * @return name:is_like type:int default:-- desc:是否点赞(0:未点赞,1:已点赞)
+     * @return name:is_collect type:int default:-- desc:是否收藏(0:未收藏,1:已收藏)
+     * @return name:media_logo type:string default:-- desc:媒体logo/用户头像
+     * @return name:media_title type:string default:-- desc:媒体名称/用户名称
+     * @return name:duration type:string default:-- desc:时间(user_type等于1是时长,等于2是时间)
+     * @return name:user_type type:int default:-- desc:发布者类型(1:用户,2:媒体。媒体发布的有作者)
+     */
+    public function consult_detail(){
+        $uid = $this->get_uid();
+        $id = input('id');
+        if(empty($id)){
+            $this->error('参数错误');
+        }
+        $field = 'id,title,user_id,content,author,create_at';
+        $consult_info = Db::name('store_consult')->field($field)->where('id',$id)->where('status',1)->where('is_deleted',0)->find();
+        if(empty($consult_info)){
+            $this->error('咨询信息有误');
+        }
+        //获取评论数量
+        $consult_info['comment_num'] = Db::name('store_comment')->where('forum_id',$id)->where('type',2)->where('forum_type',1)->count('id');
+        //点赞数量
+        $consult_info['like_num'] = Db::name('store_like')->where('forum_id',$id)->where('type',2)->where('status',1)->count('id');
+        //转发数量
+        $consult_info['transpond_num'] = Db::name('store_transpond')->where('forum_id',$id)->where('type',2)->where('status',1)->count('id');
+        $consult_info['is_attention'] = 0;
+        $consult_info['is_like'] = 0;
+        $consult_info['is_collect'] = 0;
+        if($uid){
+            //是否关注
+            $is_attention = Db::name('store_attention')->where('from_user_id',$consult_info['user_id'])->where('user_id',$uid)->where('status',1)->count('id');
+            if($is_attention){
+                $consult_info['is_attention'] = 1;
+            }
+            //是否点赞
+            $is_like = Db::name('store_like')->where('forum_id',$id)->where('type',2)->where('user_id',$uid)->where('status',1)->count('id');
+            if($is_like){
+                $consult_info['is_like'] = 1;
+            }
+            //是否收藏
+            $is_collect = Db::name('store_collect')->where('forum_id',$id)->where('type',2)->where('user_id',$uid)->where('status',1)->count('id');
+            if($is_collect){
+                $consult_info['is_collect'] = 1;
+            }
+        }
+        $user_type = user_type($consult_info['user_id']);//1:用户 2:媒体
+        if($user_type == 1){
+            $user_info = Db::name('store_member')->field('name,headimg')->where('id',$consult_info['user_id'])->find();
+            $consult_info['media_logo'] = $user_info['name'];
+            $consult_info['media_title'] = $user_info['headimg'];
+        }else{
+            $media_info = Db::name('store_media')->field('logo,title')->where('id',$consult_info['user_id'])->find();
+            $consult_info['media_logo'] = $media_info['title'];
+            $consult_info['media_title'] = $media_info['logo'];
+        }
+        if($user_type == 1){
+            $remain_time = time() - strtotime($consult_info['create_at']);
+            $consult_info['duration'] = get_stay_time($remain_time);
+        }else{
+            $consult_info['duration'] = date('Y-m-d',strtotime($consult_info['create_at']));
+        }
+        $consult_info['user_type'] = $user_type;
+        unset($consult_info['create_at']);
+        if($uid && $uid != $consult_info['user_id']){
+            //增加浏览量
+            $browse_id = Db::name('store_browse')->where('user_id',$uid)->where('forum_id',$id)->where('type',2)->value('id');
+            if(empty($browse_id)){
+                $data = array(
+                    'user_id' => $uid,
+                    'from_user_id' => $consult_info['user_id'],
+                    'forum_id' => $id,
+                    'type' => 2,
+                    'status' => 1
+                );
+                Db::name('store_browse')->insert($data);
+            }
+        }
+        $this->success('获取成功',$consult_info);
+    }
+    /**
+     * @title 咨询评论列表
+     * @desc 咨询评论列表
+     * @author QGF
+     * @url /api/Consult/consult_comment_list
+     * @method GET
+     * @tag 咨询评论列表
+     * @header name:Authorization require:1 desc:Token
+     * @param name:page type:int require:0 default:1 desc:页数(默认为1)
+     * @param name:page_size type:int require:0 default:10 desc:每页数量(默认为10)
+     * @param name:id type:int require:1 default:-- desc:咨询ID
+     * @return name:-- type:array default:-- desc:id:评论ID,content:评论内容,create_time:评论时间,headimg:评论者头像,name:评论者名称,apply_num:这条评论回复的数量
+     */
+    public function consult_comment_list(){
+        $id = input('id');
+        $page = input('page',1);
+        $pageSize = input('page_size',10);
+        if(empty($id)){
+            $this->error('参数错误');
+        }
+        $consult_info = Db::name('store_consult')->field('id')->where('id',$id)->where('status',1)->where('is_deleted',0)->find();
+        if(empty($consult_info)){
+            $this->error('咨询信息有误');
+        }
+        //评论列表
+        $comment_list = Db::name('store_comment')->field('id,user_id,content,create_time')->where('forum_id',$id)->where('type',1)->where('forum_type',2)->page($page,$pageSize)->order(['id'=>'desc'])->select();
+        if($comment_list){
+            foreach ($comment_list as $key=>&$value){
+                $user_info = Db::name('store_member')->field('name,headimg,privacy_switch')->where('id',$value['user_id'])->find();
+                if($user_info['privacy_switch']){
+                    unset($comment_list[$key]);
+                    continue;
+                }
+                $value['user_name'] = $user_info['name'];
+                $value['user_headimg'] = $user_info['headimg'];
+                //获取该条评论回复的数量
+                $value['apply_num'] = Db::name('store_comment')->where('forum_id',$id)->where('type',2)->where('forum_type',2)->where('root_comment_id',$value['id'])->count('id');
+                unset($value['user_id']);
+            }
+        }
+        $this->success('获取成功',$comment_list);
+    }
+    /**
+     * @title 咨询回复评论列表
+     * @desc 咨询回复评论列表
+     * @author QGF
+     * @url /api/Consult/consult_reply_comment_list
+     * @method GET
+     * @tag 咨询回复评论列表
+     * @header name:Authorization require:1 desc:Token
+     * @param name:page type:int require:0 default:1 desc:页数(默认为1)
+     * @param name:page_size type:int require:0 default:10 desc:每页数量(默认为10)
+     * @param name:id type:int require:1 default:-- desc:评论ID
+     * @return name:comment type:array default:-- desc:id:评论ID,content:评论内容,content:评论内容,headimg:评论者头像,name:评论者名称
+     * @return name:list type:array default:-- desc:content:评论内容,create_time:评论时间,headimg:评论者头像,name:评论者名称
+     */
+    public function consult_reply_comment_list(){
+        $id = input('id');
+        $page = input('page',1);
+        $pageSize = input('page_size',10);
+        if(empty($id)){
+            $this->error('参数错误');
+        }
+        //查看评论的信息
+        $comment_info = Db::name('store_comment')->field('id,user_id,content')->where('id',$id)->where('type',1)->where('forum_type',2)->find();
+        if(empty($comment_info)){
+            $this->error('评论信息有误');
+        }
+        $member_info = Db::name('store_member')->field('name,headimg')->where('id',$comment_info['user_id'])->find();
+        $comment_info['user_name'] = $member_info['name'];
+        $comment_info['user_headimg'] = $member_info['headimg'];
+        unset($comment_info['user_id']);
+        //回复评论列表
+        $comment_list = Db::name('store_comment')->field('user_id,content,create_time')->where('root_comment_id',$id)->where('type',2)->page($page,$pageSize)->order(['id'=>'desc'])->select();
+        if($comment_list){
+            foreach ($comment_list as &$value){
+                $user_info = Db::name('store_member')->field('name,headimg')->where('id',$value['user_id'])->find();
+                $value['user_name'] = $user_info['name'];
+                $value['user_headimg'] = $user_info['headimg'];
+                unset($value['user_id']);
+            }
+        }
+        $data = array(
+            'comment' => $comment_info,
+            'list' => $comment_list
+        );
+        $this->success('获取成功',$data);
+    }
+    /**
+     * @title 被关注者发布的咨询列表
+     * @desc 被关注者发布的咨询列表
+     * @author QGF
+     * @url /api/Consult/attention_consult_list
+     * @method GET
+     * @tag 被关注者发布的咨询列表
+     * @header name:Authorization require:1 desc:Token
+     * @param name:user_id type:int require:1 default:-- desc:媒体或用户ID
+     * @return name:id type:string default:-- desc:咨询ID
+     * @return name:title type:string default:-- desc:咨询标题
+     * @return name:image type:string default:-- desc:咨询图片(一个图片地址)
+     * @return name:comment_num type:int default:-- desc:评论数量
+     * @return name:duration type:string default:-- desc:发布的时长
+     */
+    public function attention_consult_list(){
+        $user_id = input('user_id');
+        $page = input('page',1);
+        $pageSize = input('page_size',10);
+        if(empty($user_id)){
+            $this->error('参数错误');
+        }
+        $list = Db::name('store_consult')->field('id,title,image,create_at')->where('status',1)->where('is_deleted',0)->where('user_id',$user_id)->page($page,$pageSize)->order(['is_recommend'=>'desc','sort'=>'desc','id'=>'desc'])->select();
+        if($list){
+            foreach($list as &$value) {
+                //获取评论数量
+                $value['comment_num'] = Db::name('store_comment')->where('forum_id',$value['id'])->where('type',1)->where('forum_type',2)->count('id');
+                $value['image'] = image_path($value['image'])[0];
+                $remain_time = time() - strtotime($value['create_at']);
+                $value['duration'] = get_stay_time($remain_time);
+                unset($value['create_at']);
+            }
+        }
+        $this->success('获取成功',$list);
+    }
+}

+ 375 - 0
application/api/controller/Index.php

@@ -0,0 +1,375 @@
+<?php
+
+// +----------------------------------------------------------------------
+// | ThinkAdmin
+// +----------------------------------------------------------------------
+// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
+// +----------------------------------------------------------------------
+// | 官方网站: http://demo.thinkadmin.top
+// +----------------------------------------------------------------------
+// | 开源协议 ( https://mit-license.org )
+// +----------------------------------------------------------------------
+// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
+// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
+// +----------------------------------------------------------------------
+
+namespace app\api\controller;
+
+use app\api\controller\Base;
+use think\Db;
+use think\Model;
+/**
+ * @title 首页(新闻)管理
+ * @controller Index
+ * @group base
+ */
+class Index extends Base
+{
+    /**
+     * @title 新闻分类
+     * @desc  新闻分类
+     * @author HG
+     * @url /api/Index/cate
+     * @method GET
+     * @tag 新闻分类
+     * @return name:-- type:array default:-- desc:新闻列表(id:新闻ID,title:新闻标题)
+     */
+    public function cate(){
+        $cate = Db::name('store_goods_cate')->field('id,title')->where('status',1)->where('is_deleted',0)->order('sort','desc')->select();
+        $this->success('获取成功',$cate);
+    }
+    /**
+     * @title 新闻列表
+     * @desc 新闻列表
+     * @author HG
+     * @url /api/Index/news_list
+     * @method GET
+     * @tag 新闻列表
+     * @header name:Authorization require:1 desc:Token
+     * @param name:id type:int require:0 default:-- desc:新闻分类ID(搜索不用穿,其他必须传)
+     * @param name:last_id type:int require:0 default:1 desc:最新的新闻id(为获取新的新闻数量)
+     * @param name:keyword type:string require:0 default:-- desc:搜索的关键词
+     * @param name:page type:int require:0 default:1 desc:页数(默认为1)
+     * @param name:page_size type:int require:0 default:10 desc:每页数量(默认为10)
+     * @return name:last_id type:string default:-- desc:最后一个新闻的id(用于下次刷新获取更新的新闻数量)
+     * @return name:num type:string default:-- desc:新增新闻的数量
+     * @return name:list type:array default:-- desc:新闻列表(id:新闻ID,title:新闻标题,image:新闻图片(数组格式),video:视频地址,comment_num:评论数量,is_top:是否置顶(0:不置顶,1:置顶),media_logo:媒体图标,media_title:媒体名称,duration:发布时长)
+     */
+    public function news_list(){
+        $id = input('id');
+        $last_id = input('last_id');
+        $keyword = input('keyword');
+        $page = input('page',1);
+        $pageSize = input('page_size',10);
+        if($keyword){
+            $where = "title like '%".$keyword."%'";
+            //保存搜索的关键词
+            $uid = $this->get_uid();
+            if($uid){
+                $search_id = Db::name('store_search_keyword')->where('user_id',$uid)->where('type',1)->where('name',$keyword)->value('id');
+                if(empty($search_id)){
+                    Db::name('store_search_keyword')->insert(array('user_id' => $uid, 'name' => $keyword));
+                }
+            }
+        }else{
+            $where = "id > 0";
+        }
+        if($id){
+            $where .= " and cate_id = ".$id;
+        }
+        $field = 'id,title,user_id,image,video,is_top,create_at';
+        $list = Db::name('store_goods')->field($field)->where('status',1)->where('is_deleted',0)->where($where)->page($page,$pageSize)->order(['is_top'=>'desc','sort'=>'desc','id'=>'desc'])->select();
+        //新的新闻数量
+        $num = 0;
+        if($last_id){
+            $num = Db::name('store_goods')->field($field)->where('status',1)->where('cate_id',$id)->where('is_deleted',0)->where('id','>',$last_id)->count('id');
+        }
+        //获取最大ID
+        $result_last_id = Db::name('store_goods')->field($field)->where('status',1)->where('cate_id',$id)->where('is_deleted',0)->order('id desc')->value('id');
+        if($list){
+            foreach($list as &$value) {
+                //获取评论数量
+                $value['comment_num'] = Db::name('store_comment')->where('forum_id',$value['id'])->where('type',1)->where('forum_type',1)->count('id');
+                $value['image'] = image_path($value['image']);
+                //媒体信息
+                $media_info = Db::name('store_media')->field('logo,title')->where('id',$value['user_id'])->find();
+                $value['media_logo'] = $media_info['logo'];
+                $value['media_title'] = $media_info['title'];
+                $remain_time = time() - strtotime($value['create_at']);
+                $value['duration'] = get_stay_time($remain_time);
+                unset($value['user_id']);
+                unset($value['create_at']);
+            }
+        }
+        $data = array(
+            'last_id' => $result_last_id?$result_last_id:0,
+            'num' => $num,
+            'list' => $list
+        );
+        $this->success('获取成功',$data);
+    }
+    /**
+     * @title 新闻详情
+     * @desc 新闻详情
+     * @author HG
+     * @url /api/Index/news_detail
+     * @method GET
+     * @tag 新闻详情
+     * @header name:Authorization require:1 desc:Token
+     * @param name:id type:int require:1 default:-- desc:新闻ID
+     * @return name:id type:int default:-- desc:新闻的id
+     * @return name:title type:string default:-- desc:新闻标题
+     * @return name:user_id type:int default:-- desc:媒体ID
+     * @return name:content type:string default:-- desc:新增内容(富文本)
+     * @return name:comment_num type:int default:-- desc:评论数量
+     * @return name:like_num type:int default:-- desc:点赞数量
+     * @return name:transpond_num type:int default:-- desc:转发数量
+     * @return name:is_attention type:int default:-- desc:是否关注媒体(0:未关注,1:已关注)
+     * @return name:is_like type:int default:-- desc:是否点赞(0:未点赞,1:已点赞)
+     * @return name:is_collect type:int default:-- desc:是否收藏(0:未收藏,1:已收藏)
+     * @return name:media_logo type:string default:-- desc:媒体logo
+     * @return name:media_title type:string default:-- desc:媒体名称
+     * @return name:duration type:string default:-- desc:发布时长
+     */
+    public function news_detail(){
+        $uid = $this->get_uid();
+        $id = input('id');
+        if(empty($id)){
+            $this->error('参数错误');
+        }
+        $field = 'id,title,user_id,content,create_at';
+        $news_info = Db::name('store_goods')->field($field)->where('id',$id)->where('status',1)->where('is_deleted',0)->find();
+        if(empty($news_info)){
+            $this->error('新闻信息有误');
+        }
+        //获取评论数量
+        $news_info['comment_num'] = Db::name('store_comment')->where('forum_id',$id)->where('type',1)->where('forum_type',1)->count('id');
+        //点赞数量
+        $news_info['like_num'] = Db::name('store_like')->where('forum_id',$id)->where('type',1)->where('status',1)->count('id');
+        //转发数量
+        $news_info['transpond_num'] = Db::name('store_transpond')->where('forum_id',$id)->where('type',1)->where('status',1)->count('id');
+        $news_info['is_attention'] = 0;
+        $news_info['is_like'] = 0;
+        $news_info['is_collect'] = 0;
+        if($uid){
+            //是否关注
+            $is_attention = Db::name('store_attention')->where('from_user_id',$news_info['user_id'])->where('user_id',$uid)->where('status',1)->count('id');
+            if($is_attention){
+                $news_info['is_attention'] = 1;
+            }
+            //是否点赞
+            $is_like = Db::name('store_like')->where('forum_id',$id)->where('type',1)->where('user_id',$uid)->where('status',1)->count('id');
+            if($is_like){
+                $news_info['is_like'] = 1;
+            }
+            //是否收藏
+            $is_collect = Db::name('store_collect')->where('forum_id',$id)->where('type',1)->where('user_id',$uid)->where('status',1)->count('id');
+            if($is_collect){
+                $news_info['is_collect'] = 1;
+            }
+        }
+        //媒体信息
+        $media_info = Db::name('store_media')->field('logo,title')->where('id',$news_info['user_id'])->find();
+        $news_info['media_logo'] = $media_info['logo'];
+        $news_info['media_title'] = $media_info['title'];
+        $remain_time = time() - strtotime($news_info['create_at']);
+        $news_info['duration'] = get_stay_time($remain_time);
+        unset($news_info['create_at']);
+        if($uid && $uid != $news_info['user_id']){
+            //增加浏览量
+            $browse_id = Db::name('store_browse')->where('user_id',$uid)->where('forum_id',$id)->where('type',1)->value('id');
+            if(empty($browse_id)){
+                $data = array(
+                    'user_id' => $uid,
+                    'from_user_id' => $news_info['user_id'],
+                    'forum_id' => $id,
+                    'type' => 1,
+                    'status' => 1
+                );
+                Db::name('store_browse')->insert($data);
+            }
+        }
+        $this->success('获取成功',$news_info);
+    }
+    /**
+     * @title 新闻评论列表
+     * @desc 新闻评论列表
+     * @author QGF
+     * @url /api/Index/news_comment_list
+     * @method GET
+     * @tag 新闻评论列表
+     * @header name:Authorization require:1 desc:Token
+     * @param name:page type:int require:0 default:1 desc:页数(默认为1)
+     * @param name:page_size type:int require:0 default:10 desc:每页数量(默认为10)
+     * @param name:id type:int require:1 default:-- desc:新闻ID
+     * @return name:-- type:array default:-- desc:id:评论ID,content:评论内容,create_time:评论时间,headimg:评论者头像,name:评论者名称,apply_num:这条评论回复的数量
+     */
+    public function news_comment_list(){
+        $id = input('id');
+        $page = input('page',1);
+        $pageSize = input('page_size',10);
+        if(empty($id)){
+            $this->error('参数错误');
+        }
+        $news_info = Db::name('store_goods')->field('id')->where('id',$id)->where('status',1)->where('is_deleted',0)->find();
+        if(empty($news_info)){
+            $this->error('新闻信息有误');
+        }
+        //评论列表
+        $comment_list = Db::name('store_comment')->field('id,user_id,content,create_time')->where('forum_id',$id)->where('type',1)->where('forum_type',1)->page($page,$pageSize)->order(['id'=>'desc'])->select();
+        if($comment_list){
+            foreach ($comment_list as $key=>&$value){
+                $user_info = Db::name('store_member')->field('name,headimg,privacy_switch')->where('id',$value['user_id'])->find();
+                if($user_info['privacy_switch']){
+                    unset($comment_list[$key]);
+                    continue;
+                }
+                $value['user_name'] = $user_info['name'];
+                $value['user_headimg'] = $user_info['headimg'];
+                //获取该条评论回复的数量
+                $value['apply_num'] = Db::name('store_comment')->where('forum_id',$id)->where('type',2)->where('forum_type',1)->where('root_comment_id',$value['id'])->count('id');
+                unset($value['user_id']);
+            }
+        }
+        $this->success('获取成功',$comment_list);
+    }
+    /**
+     * @title 新闻回复评论列表
+     * @desc 新闻回复评论列表
+     * @author QGF
+     * @url /api/Index/news_reply_comment_list
+     * @method GET
+     * @tag 新闻回复评论列表
+     * @header name:Authorization require:1 desc:Token
+     * @param name:page type:int require:0 default:1 desc:页数(默认为1)
+     * @param name:page_size type:int require:0 default:10 desc:每页数量(默认为10)
+     * @param name:id type:int require:1 default:-- desc:评论ID
+     * @return name:comment type:array default:-- desc:id:评论ID,content:评论内容,content:评论内容,headimg:评论者头像,name:评论者名称
+     * @return name:list type:array default:-- desc:content:评论内容,create_time:评论时间,headimg:评论者头像,name:评论者名称
+     */
+    public function news_reply_comment_list(){
+        $id = input('id');
+        $page = input('page',1);
+        $pageSize = input('page_size',10);
+        if(empty($id)){
+            $this->error('参数错误');
+        }
+        //查看评论的信息
+        $comment_info = Db::name('store_comment')->field('id,user_id,content')->where('id',$id)->where('type',1)->where('forum_type',1)->find();
+        if(empty($comment_info)){
+            $this->error('评论信息有误');
+        }
+        $member_info = Db::name('store_member')->field('name,headimg')->where('id',$comment_info['user_id'])->find();
+        $comment_info['user_name'] = $member_info['name'];
+        $comment_info['user_headimg'] = $member_info['headimg'];
+        unset($comment_info['user_id']);
+        //回复评论列表
+        $comment_list = Db::name('store_comment')->field('user_id,content,create_time')->where('root_comment_id',$id)->where('type',2)->page($page,$pageSize)->order(['id'=>'desc'])->select();
+        if($comment_list){
+            foreach ($comment_list as &$value){
+                $user_info = Db::name('store_member')->field('name,headimg')->where('id',$value['user_id'])->find();
+                $value['user_name'] = $user_info['name'];
+                $value['user_headimg'] = $user_info['headimg'];
+                unset($value['user_id']);
+            }
+        }
+        $data = array(
+            'comment' => $comment_info,
+            'list' => $comment_list
+        );
+        $this->success('获取成功',$data);
+    }
+    /**
+     * @title 关注详情
+     * @desc 关注详情
+     * @author QGF
+     * @url /api/Index/attention_detail
+     * @method GET
+     * @tag 关注详情
+     * @header name:Authorization require:1 desc:Token
+     * @param name:user_id type:int require:1 default:-- desc:媒体或用户ID
+     * @return name:user_type type:int default:-- desc:关注类型(1:用户,2:媒体(用户只发布咨询,媒体有新闻和咨询))
+     * @return name:user_name type:string default:-- desc:姓名
+     * @return name:user_headimg type:string default:-- desc:头像地址
+     * @return name:is_attention type:int default:-- desc:是否关注(0:未关注,1:已关注)
+     * @return name:like_num type:int default:-- desc:获得点赞的数量
+     * @return name:attention_num type:int default:-- desc:获得关注的数量
+     */
+    public function attention_detail(){
+        $user_id = input('user_id');
+        if(empty($user_id)){
+            $this->error('参数错误');
+        }
+        $user_type = user_type($user_id);//1:用户 2:媒体
+        if($user_type == 1){
+            $user_info = Db::name('store_member')->field('name,headimg')->where('id',$user_id)->find();
+            $user_name = $user_info['name'];
+            $user_headimg = $user_info['headimg'];
+        }else{
+            $media_info = Db::name('store_media')->field('logo,title')->where('id',$user_id)->find();
+            $user_name = $media_info['title'];
+            $user_headimg = $media_info['logo'];
+        }
+        //是否关注
+        $is_attention = 0;
+        $uid = $this->get_uid();
+        if($uid){
+            $attention_id = Db::name('store_attention')->where('from_user_id',$user_id)->where('user_id',$uid)->where('status',1)->count('id');
+            if($attention_id){
+                $is_attention = 1;
+            }
+        }
+        //共获得点赞数
+        $like_num = Db::name('store_like')->where('from_user_id',$user_id)->where('status',1)->count('id');
+        //共关注的数
+        $attention_num = Db::name('store_attention')->where('from_user_id',$user_id)->where('status',1)->count('id');
+        $data = array(
+            'user_type' => $user_type,
+            'user_name' => $user_name,
+            'user_headimg' => $user_headimg,
+            'is_attention' => $is_attention,
+            'like_num' => $like_num,
+            'attention_num' => $attention_num
+        );
+        $this->success('获取成功',$data);
+    }
+    /**
+     * @title 被关注者发布的新闻列表
+     * @desc 被关注者发布的新闻列表
+     * @author QGF
+     * @url /api/Index/attention_news_list
+     * @method GET
+     * @tag 被关注者发布的新闻列表
+     * @header name:Authorization require:1 desc:Token
+     * @param name:user_id type:int require:1 default:-- desc:媒体或用户ID
+     * @return name:id type:string default:-- desc:新闻ID
+     * @return name:title type:string default:-- desc:新闻标题
+     * @return name:image type:string default:-- desc:新闻图片(一个图片地址)
+     * @return name:comment_num type:int default:-- desc:评论数量
+     * @return name:duration type:string default:-- desc:发布的时长
+     */
+    public function attention_news_list(){
+        $user_id = input('user_id');
+        $page = input('page',1);
+        $pageSize = input('page_size',10);
+        if(empty($user_id)){
+            $this->error('参数错误');
+        }
+        $user_type = user_type($user_id);//1:用户 2:媒体
+        if($user_type == 1){
+            $this->error('发布者身份有误');
+        }
+        $list = Db::name('store_goods')->field('id,title,image,create_at')->where('status',1)->where('is_deleted',0)->where('user_id',$user_id)->page($page,$pageSize)->order(['is_top'=>'desc','sort'=>'desc','id'=>'desc'])->select();
+        if($list){
+            foreach($list as &$value) {
+                //获取评论数量
+                $value['comment_num'] = Db::name('store_comment')->where('forum_id',$value['id'])->where('type',1)->where('forum_type',1)->count('id');
+                $value['image'] = image_path($value['image'])[0];
+                $remain_time = time() - strtotime($value['create_at']);
+                $value['duration'] = get_stay_time($remain_time);
+                unset($value['create_at']);
+            }
+        }
+        $this->success('获取成功',$list);
+    }
+}

+ 297 - 25
application/api/controller/Login.php

@@ -15,61 +15,328 @@
 
 namespace app\api\controller;
 
-use app\admin\controller\Config;
+use AlibabaCloud\Client\AlibabaCloud;
+use AlibabaCloud\Client\Exception\ClientException;
+use AlibabaCloud\Client\Exception\ServerException;
 use app\api\controller\Base;
-use EasyWeChat\Factory;
-use Firebase\JWT\JWT;
 use think\Db;
-use think\Request;
-
+use Firebase\JWT\JWT;
+use EasyWeChat\Factory;
 /**
  * @title 登录
  * @controller Login
- * @group base
+ * @group worker
  */
 class Login extends Base
 {
     /**
-     * @title 登录
-     * @desc 登录
+     * @title 用户协议
+     * @desc 用户协议
      * @author QGF
-     * @url /Login/login
+     * @url /api/Login/agreement
      * @method GET
-     * @tag 登录
-     * @param name:phone type:int require:1 default:-- desc:账号
+     * @tag 用户协议
+     * @return name:-- type:string default:-- desc:用户协议内容(富文本)
+     */
+    public function agreement(){
+        $this->success('获取成功',htmlspecialchars_decode(sysconf('agreement')));
+    }
+    /**
+     * @title 注册
+     * @desc 注册
+     * @author QGF
+     * @url /api/Login/register
+     * @method POST
+     * @tag 注册
+     * @param name:phone type:int require:1 default:-- desc:手机号
+     * @param name:code type:int require:1 default:-- desc:短信验证码
      * @param name:password type:string require:1 default:-- desc:密码
-     * @return name:token type:string desc:用户token
      */
-    public function login(){
+    public function register(){
         $phone = input('phone');
+        $code = input('code');
         $password = input('password');
-        if(empty($phone) || empty($password)){
+        if(empty($phone) || empty($code) || empty($password)){
+            $this ->error('参数错误');
+        }
+        $sms_id = $this->verify_sms($phone,$code);
+        if(empty($sms_id)){
+            $this->error('验证码不正确');
+        }
+        $member_id = Db::name('store_member')->where('phone',$phone)->value('id');
+        if(!empty($member_id)){
+            $this->error('该手机号已被注册');
+        }
+        $data = array(
+            'phone'=>$phone,
+            'password' => md5($password),
+            'decode_password' => $password,
+            'name' => substr($phone,-4),
+            'headimg' => 'https://zjth2021.oss-cn-beijing.aliyuncs.com/0909a49add201291/a20687c6493d3eab.jpg',
+            'background' => Db::name('store_background')->where('id',1)->value('logo'),
+        );
+        Db::name('store_member')->insert($data);
+        $member_id = Db::name('store_member')->where('phone',$phone)->value('id');
+        Db::name('store_member_sms')->where('id',$sms_id)->update(array('used'=>1));
+        $token = self::create_jwt($member_id);
+        $this->success('注册成功',$token);
+    }
+    /**
+     * @title 微信登录(小程序)
+     * @desc 微信登录(小程序)
+     * @author QGF
+     * @url /api/Login/we_chat_login
+     * @method POST
+     * @tag 登录 授权
+     * @param name:code type:int require:1 default:-- desc:code值
+     * @param name:headimg type:string require:1 default:-- desc:头像地址
+     * @param name:name type:string require:1 default:-- desc:昵称
+     * @return name:openid type:string default:-- desc:用户openid(未绑定手机号)
+     * @return name:headimg type:string default:-- desc:用户头像地址(未绑定手机号)
+     * @return name:name type:string default:屈耀光 desc:用户昵称(未绑定手机号)
+     * @return name:token type:string default:-- desc:用户登录成功后的token值(已绑定手机号)
+     */
+    public function we_chat_login(){
+        $code = input('code');
+        $headimg = input('headimg');
+        $name = input('name');
+        if(empty($code) || empty($headimg) || empty($name)){
             $this->error('参数错误');
         }
-        $member_id = Db::name('store_member')->field('id')->where('phone',$phone)->where('is_deleted',0)->where('type','>=',3)->value('id');
+        $app = Factory::miniProgram(config('app.mini_program'));
+        $data = $app->auth->session($code);
+        if(empty($data['openid'])){
+            $this->error('微信登录失败');
+        }
+        $member = Db::name('store_member')->field('id,phone')->where('openid',$data['openid'])->find();
+        if(empty($member['phone'])){
+            $member_data = array(
+                'openid' => $data['openid'],
+                'headimg' => $headimg,
+                'name' => $name
+            );
+            $this->success('授权成功',$member_data);
+        }
+        $uid = $member['id'];
+        if(empty($uid)){
+            $this->error('数据有误');
+        }
+        $token = self::create_jwt($uid);
+        $this->success('登录成功',$token);
+    }
+    /**
+     * @title 微信登录(app)
+     * @desc 微信登录
+     * @author QGF
+     * @url /api/Login/we_chat_app
+     * @method POST
+     * @tag 登录 授权
+     * @param name:code type:int require:1 default:oRZeJ55dhq8y6gHI9PVwCrv0gvSM desc:code值
+     * @return name:-- type:json default:-- desc:微信注册返回授权后的信息(openid:微信openid,name:微信昵称,headimgurl:微信头像地址,token:token值(这时为空)注:仅微信注册有)
+     * @return name:token type:string default:-- desc:用户微信登录成功后的token值(仅用户登录有)
+     */
+    public function we_chat_app(){
+        $code = input('code');
+        if(empty($code)){
+            $this->error('参数错误');
+        }
+        $res = requestGet('https://api.weixin.qq.com/sns/oauth2/access_token?appid='.config('app_program')['app_id'].'&secret='.config('app_program')['secret'].'&code='.$code.'&grant_type=authorization_code');
+        $res = json_decode($res,true);
+        $user_info = requestGet('https://api.weixin.qq.com/sns/userinfo?access_token='.$res['access_token'].'&openid='.$res['openid']);
+        $user_info = json_decode($user_info,true);
+        $data['openid'] = $user_info['openid'];
+        $data['name'] = $user_info['nickname'];
+        $data['headimg'] = $user_info['headimg'];
+        $data['token'] = '';
+        $member_id = Db::name('store_member')->where('app_openid',$data['openid'])->value('id');
         if(empty($member_id)){
-            $this->error('账号不存在');
+            $this->success('授权成功',$data);
+        }else{
+            $token = self::create_jwt($member_id);
+            $data['token'] = $token;
+            $this->success('登录成功',$data);
+        }
+    }
+    /**
+     * @title 密码登录
+     * @desc 密码登录
+     * @author QGF
+     * @url /api/Login/password_login
+     * @method POST
+     * @tag 密码登录
+     * @param name:phone type:int require:1 default:-- desc:手机号
+     * @param name:password type:string require:1 default:-- desc:密码
+     * @return name:token type:string default:-- desc:用户登录成功后的token值
+     */
+    public function password_login(){
+        $phone = input('phone');
+        $password = input('password');
+        if(empty($password) || empty($phone)){
+            $this->error('参数错误');
         }
-        $member_id = Db::name('store_member')->field('id')->where('phone',$phone)->where('password',md5($password))->value('id');
+        $member_id = Db::name('store_member')->where('phone',$phone)->where('password',md5($password))->value('id');
         if(empty($member_id)){
-            $this->error('账号或密码错误');
+            $this->error('手机号或密码错误');
         }
         $token = self::create_jwt($member_id);
-        $type = Db::name('store_member')->where('id',$member_id)->value('type');
-        $data = array(
-            'token' => $token,
-            'type' => $type
+        $this->success('登录成功',$token);
+    }
+    /**
+     * @title 绑定手机号(点击微信登录时还没注册,绑定完手机号提交信息去注册)
+     * @desc 绑定手机号
+     * @author QGF
+     * @url /api/Login/binding_phone
+     * @method POST
+     * @tag 绑定手机号
+     * @param name:platform type:1 require:0 default:1 desc:平台(注:1:小程序2:app)
+     * @param name:phone type:int require:1 default:-- desc:要绑定的手机号
+     * @param name:code type:int require:1 default:-- desc:短信验证码
+     * @param name:openid type:string require:1 default:-- desc:微信授权返回的openid
+     * @param name:name type:string require:1 default:-- desc:微信授权返回的用户昵称
+     * @param name:headimg type:string require:1 default:-- desc:微信授权返回的用户头像地址
+     * @return name:token type:string default:-- desc:绑定成功后的token值
+     */
+    public function binding_phone(){
+        $phone = input('phone');
+        $code = input('code');
+        $openid = input('openid');
+        $name = input('name');
+        $headimg = input('headimg');
+        $platform = input('platform',1); //1:小程序,2:app
+        if(empty($phone) || empty($code) || empty($openid) || empty($name) || empty($headimg)){
+            $this ->error('参数错误');
+        }
+        $sms_id = $this->verify_sms($phone,$code);
+        if(empty($sms_id)){
+            $this->error('验证码不正确');
+        }
+        $member_id = Db::name('store_member')->where('phone',$phone)->value('id');
+        if(!$member_id){
+            $data = array(
+                'phone'=>$phone,
+                'name' => $name,
+                'headimg' => $headimg,
+            );
+            if($platform == 1){
+                $data['openid'] = $openid;
+            }else{
+                $data['app_openid'] = $openid;
+            }
+            Db::name('store_member')->insert($data);
+            $member_id = Db::name('store_member')->where('phone',$phone)->value('id');
+        }else{
+            if($platform == 1){
+                $update_data['openid'] = $openid;
+            }else{
+                $update_data['app_openid'] = $openid;
+            }
+            Db::name('store_member')->where('id',$member_id)->update($update_data);
+        }
+        Db::name('store_member_sms')->where('id',$sms_id)->update(array('used'=>1));
+        $token = self::create_jwt($member_id);
+        $this->success('注册成功',$token);
+    }
+    /**
+     * @title 忘记密码
+     * @desc 忘记密码
+     * @author QGF
+     * @url /api/Login/reset_password
+     * @method POST
+     * @tag 忘记密码
+     * @param name:phone type:int require:1 default:-- desc:手机号
+     * @param name:code type:int require:1 default:-- desc:短信验证码
+     * @param name:password type:string require:1 default:-- desc:密码
+     */
+    public function reset_password(){
+        $phone = input('phone');
+        $code = input('code');
+        $password = input('password');
+        if(empty($phone) || empty($code) || empty($password)){
+            $this ->error('参数错误');
+        }
+        $sms_id = $this->verify_sms($phone,$code);
+        if(empty($sms_id)){
+            $this->error('验证码不正确');
+        }
+        $member = Db::name('store_member')->field('id,decode_password')->where('phone',$phone)->find();
+        if(empty($member['id'])){
+            $this ->error('该手机号未注册');
+        }
+        if($password == $member['decode_password']){
+            $this ->error('新密码与原密码一致,直接登录');
+        }
+        $update_data = array(
+            'password'=>md5($password),
+            'decode_password'=>$password
         );
-        $this->success('登录成功',$data);
+        Db::name('store_member')->where('phone',$phone)->update($update_data);
+        Db::name('store_member_sms')->where('id',$sms_id)->update(array('used'=>1));
+        $this->success('修改密码成功');
+    }
+    /**
+     * @title 发送短信验证码
+     * @desc 发送短信验证码
+     * @author QGF
+     * @url /api/Login/send_sms
+     * @method POST
+     * @tag 短信验证码
+     * @param name:phone type:int require:1 default:-- desc:要获取验证码的手机号
+     * @return name:code type:string default:-- desc:验证码
+     */
+    public function send_sms(){
+        $phone = input('phone');
+        if(empty($phone)){
+            $this ->error('参数错误');
+        }
+        $code = rand(0,9).rand(0,9).rand(0,9).rand(0,9).rand(0,9).rand(0,9);
+        AlibabaCloud::accessKeyClient('LTAI5tDNASTjwM9mDSGckY3N', 'nAKY40GjGz4hf5A9RpoffDmaYWNL3y')->regionId('cn-hangzhou')->asDefaultClient();
+        try {
+            $result = AlibabaCloud::rpc()
+                ->product('Dysmsapi')
+                ->version('2017-05-25')
+                ->action('SendSms')
+                ->method('POST')
+                ->host('dysmsapi.aliyuncs.com')
+                ->options([
+                    'query' => [
+                        'RegionId' => "cn-hangzhou",
+                        'PhoneNumbers' => $phone,
+                        'SignName' => "碳汇资产",
+                        'TemplateCode' => "SMS_222240090",
+                        'TemplateParam' => json_encode(array("code"=>$code)),
+                    ],
+                ])->request();
+            $result = $result->toArray();
+            $sms_data = array(
+                'phone'=>$phone,
+                'code'=>$code,
+                'result'=>$result['Message']
+            );
+            Db::name('store_member_sms')->insert($sms_data);
+        } catch (ClientException $e) {
+            echo $e->getErrorMessage() . PHP_EOL;
+        } catch (ServerException $e) {
+            echo $e->getErrorMessage() . PHP_EOL;
+        }
+        $this->success('发送成功',$code);
+    }
+    //校验短信验证码
+    public function verify_sms($phone = '',$code = ''){
+        $store_member_sms = Db::name('store_member_sms')->field('id,code')->where('phone',$phone)->where('used',0)->order('id desc')->find();
+        if($store_member_sms['code'] == $code){
+            return $store_member_sms['id'];
+        }else{
+            return 0;
+        }
     }
     //token加密
-    public function create_jwt($userId)
+    public function create_jwt($uid)
     {
         $key = md5(config('app.jwt')); //jwt的签发密钥,验证token的时候需要用到
         $time = time(); //签发时间
         $expire = $time + config('app.jwt_time'); //过期时间
         $token = array(
-            "uid" => $userId,
+            "uid" => $uid,
             "iss" => "https://zain.com",//签发组织
             "aud" => "https://zain.com", //签发作者
             "iat" => $time,
@@ -79,4 +346,9 @@ class Login extends Base
         $jwt = JWT::encode($token, $key);
         return $jwt;
     }
+    public function  get_token(){
+        $uid = input('uid',500);
+        $token = $this->create_jwt($uid);
+        $this->success('',$token);
+    }
 }

+ 452 - 667
application/api/controller/Member.php

@@ -45,808 +45,593 @@ class Member extends Base
      * @return name:phone type:int default:-- desc:手机号
      * @return name:name type:string default:-- desc:姓名
      * @return name:headimg type:string default:-- desc:头像地址
-     * @return name:type type:int default:-- desc:人员类型(3:车间主任,4:仓库人员,5:副厂长,6:厂长,7:领导)
-     * @return name:type_name type:string default:-- desc:人员类型名称
+     * @return name:synopsis type:string default:-- desc:个人简介
+     * @return name:news_switch type:int default:-- desc:推送消息开关(0:关闭,1:开启)
+     * @return name:privacy_switch type:int default:-- desc:隐私设置开关(0:关闭,1:开启)
+     * @return name:news_num type:int default:-- desc:未读消息的数量
+     * @return name:background type:string default:-- desc:个人中心背景图片地址
      */
     public function member_info(){
         $uid = $this->uid;
-        $field = 'phone,name,headimg,workshop,type';
-        $member_info = Db::name('store_member')->field($field)->where('id',$uid)->find();
-        if(empty($member_info)){
+        $field = 'phone,name,headimg,synopsis,news_switch,privacy_switch,status,background';
+        $user_info = Db::name('store_member')->field($field)->where('id',$uid)->find();
+        if(empty($user_info)){
             $this->error('用户信息不正确');
         }
-        $member_info['type_name'] = member_type_arr()[$member_info['type']];
-        if($member_info['type'] == 3){
-            $member_info['type_name'] = digital_conversion()[$member_info['workshop']].$member_info['type_name'];
+        if($user_info['status'] == 0){
+            $this->error('该用户已被禁用');
         }
-        unset($member_info['workshop']);
-        $this->success('获取成功',$member_info);
+        //查看未读消息的数量
+        $user_info['news_num'] = Db::name('store_news')->where('user_id',$uid)->where('status',0)->count('id');
+        unset($user_info['status']);
+        $this->success('获取成功',$user_info);
     }
     /**
-     * @title 修改头像
-     * @desc 修改头像
+     * @title 编辑个人信息
+     * @desc 编辑个人信息
      * @author QGF
-     * @url /api/Member/edit_headimg
-     * @method GET
-     * @tag 修改头像
+     * @url /api/Member/edit_member_info
+     * @method POST
+     * @tag 编辑信息
      * @header name:Authorization require:1 desc:Token
-     * @return name:headimg type:string default:-- desc:要修改的头像地址
+     * @param name:type type:int require:1 default:-- desc:修改的类型(1:头像,2:昵称,3:个人简介)
+     * @param name:headimg type:string require:0 default:-- desc:头像地址(type为1时必传)
+     * @param name:name type:string require:0 default:-- desc:姓名(type为2时必传)
+     * @param name:synopsis type:string require:0 default:-- desc:个人简介(type为3时必传)
      */
-    public function edit_headimg(){
+    public function edit_member_info(){
         $uid = $this->uid;
+        $type = input('type');
         $headimg = input('headimg');
-        if(empty($headimg)){
+        $name = input('name');
+        $synopsis = input('synopsis');
+        if(empty($type)){
             $this->error('参数错误');
         }
-        $member = Db::name('store_member')->field('headimg')->where('id',$uid)->find();
-        if($member['headimg'] == $headimg){
-            $this->error('没有要修改的内容');
-        }
-        $update_data = array(
-            'headimg'=>$headimg
-        );
-        $res = Db::name('store_member')->where('id',$uid)->update($update_data);
-        if($res !==false){
-            $this->success('保存成功');
+        if($type == 1){
+            if(empty($headimg)){
+                $this->error('参数错误');
+            }
+            $update_data = array('headimg'=>$headimg);
+        }elseif($type == 2){
+            if(empty($name)){
+                $this->error('参数错误');
+            }
+            $update_data = array('name'=>$name);
         }else{
-            $this->error('保存失败');
-        }
-    }
-    /**
-     * @title 董事长风采
-     * @desc 董事长风采
-     * @author QGF
-     * @url /api/Member/chairman_show
-     * @method GET
-     * @tag 董事长风采
-     * @header name:Authorization require:1 desc:Token
-     * @return name:-- type:striny default:-- desc:董事长风采(富文本)
-     */
-    public function chairman_show(){
-        $this->success('获取成功',htmlspecialchars_decode(sysconf('chairman_show')));
-    }
-    /**
-     * @title 企业文化
-     * @desc 企业文化
-     * @author QGF
-     * @url /api/Member/enterprise_culture
-     * @method GET
-     * @tag 企业文化
-     * @header name:Authorization require:1 desc:Token
-     * @return name:-- type:striny default:-- desc:企业文化(富文本)
-     */
-    public function enterprise_culture(){
-        $this->success('获取成功',htmlspecialchars_decode(sysconf('enterprise_culture')));
-    }
-    /**
-     * @title 公司联系方式
-     * @desc 公司联系方式
-     * @author QGF
-     * @url /api/Member/contact_way
-     * @method GET
-     * @tag 公司联系方式
-     * @header name:Authorization require:1 desc:Token
-     * @return name:company_name type:striny default:-- desc:公司名称
-     * @return name:company_address type:striny default:-- desc:公司地址
-     * @return name:company_phone type:striny default:-- desc:公司电话
-     */
-    public function contact_way(){
-        $company_name = sysconf('company_name');
-        $company_address = sysconf('company_address');
-        $company_phone = sysconf('company_phone');
-        $data = array(
-            'company_name' => $company_name,
-            'company_address' => $company_address,
-            'company_phone' => $company_phone
-        );
-        $this->success('获取成功',$data);
-    }
-    /**
-     * @title 公司通讯录
-     * @desc  公司通讯录
-     * @author HG
-     * @url /api/Member/member_list
-     * @method GET
-     * @tag 公司通讯录
-     * @header name:Authorization require:1 desc:Token
-     * @return name:headimg type:string default:-- desc:头像地址
-     * @return name:name type:string default:-- desc:姓名
-     * @return name:phone type:string default:-- desc:手机号
-     * @return name:type_name type:string default:-- desc:标识名称
-     */
-    public function member_list(){
-        $uid = $this->uid;
-        $member_list = Db::name('store_member')->field('headimg,name,phone,type,workshop')->where('id','<>',$uid)->where('is_deleted',0)->select();
-        foreach ($member_list as &$value){
-            if($value['type'] == 1){
-                $value['type_name'] = digital_conversion()[$value['workshop']].'车间员工';
-            }elseif ($value['type'] == 2){
-                $value['type_name'] = '销售人员';
-            }elseif($value['type'] == 3){
-                $value['type_name'] = digital_conversion()[$value['workshop']].'车间主任';
-            }else{
-                $value['type_name'] = member_type_arr()[$value['type']];
+            if(empty($synopsis)){
+                $this->error('参数错误');
             }
-            unset($value['type']);
-            unset($value['workshop']);
+            $update_data = array('synopsis'=>$synopsis);
         }
-        $this->success('获取成功',$member_list);
+        Db::name('store_member')->where('id',$uid)->update($update_data);
+        $this->success('编辑成功');
     }
     /**
-     * @title 考勤情况反馈
-     * @desc  考勤情况反馈
-     * @author HG
-     * @url /api/Member/attendance_feedback
-     * @method GET
-     * @tag 考勤情况反馈
-     * @header name:Authorization require:1 desc:Token
-     * @return name:id type:int default:-- desc:工人id
-     * @return name:name type:string default:-- desc:姓名
-     * @return name:workshop type:string default:-- desc:部门名称
-     */
-    public function attendance_feedback(){
-        $uid = $this->uid;
-        $member_info = Db::name('store_member')->field('type,workshop')->where('id',$uid)->find();
-        $type = $member_info['type'];
-        $workshop = $member_info['workshop'];
-        if($type != 3){
-            $this->error('不是车间主任');
-        }
-        $worker_list = Db::name('store_member')->field('id,name')->where('type',1)->where('workshop',$workshop)->select();
-        if(empty($worker_list)){
-            $this->success('暂无车间员工',array());
-        }
-        $workshop = workshop_arr()[$workshop];
-        foreach ($worker_list as &$value){
-            $value['workshop'] = $workshop;
-        }
-        $this->success('获取成功',$worker_list);
-    }
-    /**
-     * @title 提交考勤情况反馈
-     * @desc  提交考勤情况反馈
-     * @author HG
-     * @url /api/Member/submit_attendance
-     * @method GET
-     * @tag 提交考勤情况反馈
+     * @title 更换背景图片
+     * @desc 更换背景图片
+     * @author QGF
+     * @url /api/Member/update_background
+     * @method POST
+     * @tag 更换背景图片
      * @header name:Authorization require:1 desc:Token
-     * @param name:staff_info type:json require:1 default:-- desc:工人考勤信息。staff_info[0][id](工人id),staff_info[0][time](工作时长
+     * @param name:background type:string require:1 default:-- desc:头像地址(type为1时必传)
      */
-    public function submit_attendance(){
+    public function update_background(){
         $uid = $this->uid;
-        $staff_info = input('staff_info');
-        if(empty($staff_info)){
+        $background = input('background');
+        if(empty($background)){
             $this->error('参数错误');
         }
-        $member_info = Db::name('store_member')->field('type,workshop,name')->where('id',$uid)->find();
-        $type = $member_info['type'];
-        $workshop = $member_info['workshop'];
-        if($type != 3){
-            $this->error('不是车间主任');
-        }
-        if(!is_array($staff_info)){
-            $staff_info = json_decode($staff_info,true);
-            if(!is_array($staff_info)){
-                $this->success('工人考勤信息参数有误');
-            }
-        }
-        $attendance_id = Db::name('store_attendance')->where('date',date('Y-m-d'))->where('workshop',$workshop)->value('id');
-        if($attendance_id){
-            $this->error('今天你已提交过');
-        }
-        foreach ($staff_info as $value){
-            $user_name = Db::name('store_member')->where('id',$value['id'])->value('name');
-            $is_attendance = $value['time']?1:0;
-            $attendance_data = array(
-                'workshop' => $workshop,
-                'shop_manager' => $member_info['name'],
-                'user_id' => $value['id'],
-                'user_name' => $user_name,
-                'is_attendance' => $is_attendance,
-                'attendance_time' => $value['time'],
-                'date' => date('Y-m-d')
-            );
-            Db::name('store_attendance')->insert($attendance_data);
-        }
-        $this->success('提交成功');
+        Db::name('store_member')->where('id',$uid)->update(array('background'=>$background));
+        $this->success('编辑成功');
     }
     /**
-     * @title 生产情况反馈
-     * @desc  生产情况反馈
-     * @author HG
-     * @url /api/Member/product_feedback
-     * @method GET
-     * @tag 生产情况反馈
+     * @title 修改手机号
+     * @desc 修改手机号
+     * @author QGF
+     * @url /api/Member/update_phone
+     * @method POST
+     * @tag 修改手机号
      * @header name:Authorization require:1 desc:Token
-     * @param name:id type:int require:1 default:-- desc:订单ID
-     * @return name:id type:int default:-- desc:工人id
-     * @return name:name type:string default:-- desc:姓名
-     * @return name:workshop type:string default:-- desc:部门名称
-     * @return name:product_info type:array default:-- desc:生产部件信息(parts_id:部件id,parts_price:部件价格,parts_name:部件名称)
+     * @param name:old_phone type:int require:1 default:-- desc:原手机号
+     * @param name:old_code type:int require:1 default:-- desc:原手机号验证码
+     * @param name:new_phone type:int require:1 default:-- desc:新手机号
+     * @param name:new_code type:int require:1 default:-- desc:新手机号验证码
      */
-    public function product_feedback(){
+    public function update_phone(){
         $uid = $this->uid;
-        $id = input('id');
-        if(empty($id)){
+        $old_phone = input('old_phone');
+        $old_code = input('old_code');
+        $new_phone = input('new_phone');
+        $new_code = input('new_code');
+        if(empty($old_phone) || empty($old_code) || empty($new_phone) || empty($new_code)){
             $this->error('参数错误');
         }
-        $member_info = Db::name('store_member')->field('type,workshop')->where('id',$uid)->find();
-        $type = $member_info['type'];
-        $workshop = $member_info['workshop'];
-        if($type != 3){
-            $this->error('不是车间主任');
+        if($old_phone == $new_phone){
+            $this->error('手机号一致,无需修改');
+        }
+        $member = Db::name('store_member')->field('id,phone')->where('id',$uid)->find();
+        if($member['phone'] != $old_phone){
+            $this->error('原手机号不正确');
         }
-        $product_info = Db::name('store_product_flow')->where('order_id',$id)->where('workshop',$workshop)->value('product_info');
-        if(empty($product_info)){
-            $this->error('订单信息有误');
+        $obj = new Login();
+        $old_sms_id = $obj->verify_sms($old_phone,$old_code);
+        if(empty($old_sms_id)){
+            $this->error('原手机号验证码不正确');
         }
-        $product_info = json_decode($product_info,true);
-        foreach ($product_info as &$product_value){
-            $product_value['parts_name'] = Db::name('store_parts')->where('id',$product_value['parts_id'])->value('name');
-            unset($product_value['parts_num']);
+        $new_sms_id = $obj->verify_sms($new_phone,$new_code);
+        if(empty($new_sms_id)){
+            $this->error('新手机号验证码不正确');
         }
-        $worker_list = Db::name('store_member')->field('id,name')->where('type',1)->where('workshop',$workshop)->select();
-        if(empty($worker_list)){
-            $this->success('暂无车间员工',array());
+        //判断新手机号是否已注册
+        $member_id = Db::name('store_member')->where('phone',$new_phone)->value('id');
+        if($member_id){
+            $this->error('新手机号已注册过');
         }
 
-        $workshop = workshop_arr()[$workshop];
-        foreach ($worker_list as &$value){
-            $value['workshop'] = $workshop;
-            $value['product_info'] = $product_info;
+        $res = Db::name('store_member')->where('id',$uid)->update(array('phone'=>$new_phone));
+        if($res !==false){
+            Db::name('store_member_sms')->where('id',$old_sms_id)->update(array('used'=>1));
+            Db::name('store_member_sms')->where('id',$new_sms_id)->update(array('used'=>1));
+            $this->success('更换成功');
+        }else{
+            $this->error('更换失败');
         }
-        $this->success('获取成功',$worker_list);
     }
     /**
-     * @title 提交生产情况反馈
-     * @desc  提交生产情况反馈
-     * @author HG
-     * @url /api/Member/submit_product
-     * @method GET
-     * @tag 提交生产情况反馈
-     * @header name:Authorization require:1 desc:Token
-     * @param name:id type:int require:1 default:-- desc:订单ID
-     * @param name:staff_info type:json require:1 default:-- desc:工人生产信息。staff_info[0][id](工人id),staff_info[0][product_info][0][parts_id](部件id,),staff_info[0][product_info][0][parts_num](生产数量)
+     * @title 修改密码
+     * @desc 修改密码
+     * @author QGF
+     * @url /api/Member/update_password
+     * @method POST
+     * @tag 修改密码
+     * @param name:phone type:int require:1 default:-- desc:手机号
+     * @param name:code type:int require:1 default:-- desc:短信验证码
+     * @param name:password type:string require:1 default:-- desc:新密码
      */
-    public function submit_product(){
-        $uid = $this->uid;
-        $id = input('id');
-        $staff_info = input('staff_info');
-        if(empty($id) || empty($staff_info)){
-            $this->error('参数错误');
+    public function update_password(){
+        $phone = input('phone');
+        $code = input('code');
+        $password = input('password');
+        if(empty($phone) || empty($code) || empty($password)){
+            $this ->error('参数错误');
         }
-        $member_info = Db::name('store_member')->field('type,workshop,name')->where('id',$uid)->find();
-        $type = $member_info['type'];
-        $workshop = $member_info['workshop'];
-        if($type != 3){
-            $this->error('不是车间主任');
+        $obj = new Login();
+        $sms_id = $obj->verify_sms($phone,$code);
+        if(empty($sms_id)){
+            $this->error('验证码不正确');
         }
-        if(!is_array($staff_info)){
-            $staff_info = json_decode($staff_info,true);
-            if(!is_array($staff_info)){
-                $this->success('工人考勤信息参数有误');
-            }
-        }
-        $product_id = Db::name('store_product_case')->where('date',date('Y-m-d'))->where('order_id',$id)->where('workshop',$workshop)->value('id');
-        if($product_id){
-            $this->error('今天你已提交过');
+        $member = Db::name('store_member')->field('id,decode_password')->where('phone',$phone)->find();
+        if(empty($member['id'])){
+            $this ->error('该手机号未注册');
         }
-        $order_no = Db::name('store_product_flow')->where('order_id',$id)->where('workshop',$workshop)->value('order_no');
-        //当天该车间一共生产的总量
-        $workshop_product_num = 0;
-        foreach ($staff_info as $value){
-            $user_name = Db::name('store_member')->where('id',$value['id'])->value('name');
-            $product_num = 0;
-            foreach ($value['product_info'] as $product_value){
-                $product_num += $product_value['parts_num'];
-            }
-            $workshop_product_num += $product_num;
-            $product_data = array(
-                'order_id' => $id,
-                'order_no' => $order_no,
-                'workshop' => $workshop,
-                'shop_manager' => $member_info['name'],
-                'user_id' => $value['id'],
-                'user_name' => $user_name,
-                'product_num' => $product_num,
-                'product_info' => json_encode($value['product_info']),
-                'date' => date('Y-m-d')
-            );
-            Db::name('store_product_case')->insert($product_data);
+        if($password == $member['decode_password']){
+            $this ->error('新密码与原密码一致,无需修改');
         }
-        //更新流程表已经生产的数量
-        Db::name('store_product_flow')->where('order_id',$id)->where('workshop',$workshop)->setInc('reality_num',$workshop_product_num);
-        $this->success('提交成功');
+        $update_data = array(
+            'password'=>md5($password),
+            'decode_password'=>$password
+        );
+        Db::name('store_member')->where('phone',$phone)->update($update_data);
+        Db::name('store_member_sms')->where('id',$sms_id)->update(array('used'=>1));
+        $this->success('修改密码成功');
     }
     /**
-     * @title 奖励金额列表
-     * @desc 奖励金额列表
+     * @title 获取版本号
+     * @desc 获取版本号
      * @author QGF
-     * @url /api/Member/award_amount_list
+     * @url /api/Member/store_versions
      * @method GET
-     * @tag 奖励金额
-     * @header name:Authorization require:1 desc:Token
-     * @return name:amount type:decimal default:100.00 desc:金额值
-     * @return name:ID type:int default:1 desc:金额ID
+     * @tag 获取版本号
+     * @param name:type type:int require:1 default:1 desc:类型(1:安卓,2:IOS。默认安卓)
+     * @return name:title type:string default:-- desc:版本号
+     * @return name:content type:string default:-- desc:修改内容
      */
-    public function award_amount_list(){
-        $amount_list = Db::name('store_award_amount')->field('id,amount')->where('status',1)->where('is_deleted',0)->order('sort desc')->order('id desc')->select();
-        if(count($amount_list)){
-            foreach($amount_list as &$value){
-                $value['ID'] = $value['id'];
-                unset($value['id']);
-            }
-        }
-        $this->success('获取成功',$amount_list);
+    public function store_versions(){
+        $type = input('type',1);
+        $store_versions = Db::name('store_versions')->field('title,content')->where('type',$type)->find();
+        $this->success('获取成功',$store_versions);
     }
     /**
-     * @title 选择奖励人员
-     * @desc  选择奖励人员
-     * @author HG
-     * @url /api/Member/select_member_list
-     * @method GET
-     * @tag 选择奖励人员
+     * @title 消息推送开关设置
+     * @desc 消息推送开关设置
+     * @author QGF
+     * @url /api/Member/update_news_switch
+     * @method POST
+     * @tag 消息推送开关设置
      * @header name:Authorization require:1 desc:Token
-     * @return name:id type:int default:-- desc:工人ID
-     * @return name:name type:string default:-- desc:工人姓名
+     * @param name:news_switch type:string require:1 default:-- desc:开关(0:关闭,1:开启)
      */
-    public function select_member_list(){
+    public function update_news_switch(){
         $uid = $this->uid;
-        $member_info = Db::name('store_member')->field('type,workshop')->where('id',$uid)->find();
-        $type = $member_info['type'];
-        $workshop = $member_info['workshop'];
-        if(!in_array($type,array('3','5','6'))){
-            $this->error('该身份没有权限');
+        $news_switch = input('news_switch');
+        if(!isset($news_switch)){
+            $this->error('参数错误');
         }
-        if($type == 3){
-            $member_list = Db::name('store_member')->field('id,name')->where('id','<>',$uid)->where('type',1)->where('workshop',$workshop)->where('is_deleted',0)->select();
-        }else{
-            $member_list = Db::name('store_member')->field('id,name')->where('id','<>',$uid)->where('type',1)->where('is_deleted',0)->select();
+        $old_news_switch = Db::name('store_member')->where('id',$uid)->value('news_switch');
+        if($old_news_switch == $news_switch){
+            $this->error('已是当前状态,无需操作');
         }
-        $this->success('获取成功',$member_list);
+        Db::name('store_member')->where('id',$uid)->update(array('news_switch'=>$news_switch));
+        $this->success('操作成功');
     }
     /**
-     * @title 提交奖励
-     * @desc 提交奖励
+     * @title 隐私开关设置
+     * @desc 隐私开关设置
      * @author QGF
-     * @url /api/Member/submit_award
+     * @url /api/Member/update_privacy_switch
      * @method POST
-     * @tag 提交奖励
+     * @tag 隐私开关设置
      * @header name:Authorization require:1 desc:Token
-     * @param name:explain type:string require:1 default:-- desc:奖励说明
-     * @param name:images type:string require:1 default:-- desc:奖励的图片地址,多张图片以英文逗号(,)分隔
-     * @param name:user_id type:int require:1 default:-- desc:奖励的工人ID
-     * @param name:amount type:string require:1 default:-- desc:奖励的金额
+     * @param name:privacy_switch type:string require:1 default:-- desc:开关(0:关闭,1:开启)
      */
-    public function submit_award(){
+    public function update_privacy_switch(){
         $uid = $this->uid;
-        $explain = input('explain');
-        $images = input('images');
-        $user_id = input('user_id');
-        $amount = input('amount');
-        if(empty($explain) || empty($images) || empty($user_id) || empty($amount)){
+        $privacy_switch = input('privacy_switch');
+        if(!isset($privacy_switch)){
             $this->error('参数错误');
         }
-        $award_id = Db::name('store_award_list')->where('date',date('Y-m-d'))->where('user_id',$user_id)->value('id');
-        if($award_id){
-            $this->error('该员工今天已奖励过');
-        }
-        $data = [
-            'submit_user_id' => $uid,
-            'user_id' => $user_id,
-            'explain' => $explain,
-            'images' => $images,
-            'amount' => $amount,
-            'date' => date('Y-m-d')
-        ];
-        $res = Db::name('store_award_list')->insert($data);
-        if($res !==false){
-            //更新员工总奖励
-            $integral = Db::name('store_member')->where('id',$user_id)->value('integral');
-            Db::name('store_member')->where('id',$user_id)->update(array('integral'=>$integral + $amount));
-            $this->success('提交成功');
-        }else{
-            $this->error('提交失败');
+        $old_privacy_switch = Db::name('store_member')->where('id',$uid)->value('privacy_switch');
+        if($old_privacy_switch == $privacy_switch){
+            $this->error('已是当前状态,无需操作');
         }
+        Db::name('store_member')->where('id',$uid)->update(array('privacy_switch'=>$privacy_switch));
+        $this->success('操作成功');
     }
     /**
-     * @title 工作(现场情况反馈)
-     * @desc 工作(现场情况反馈)
+     * @title 隐私政策
+     * @desc 隐私政策
      * @author QGF
-     * @url /api/Member/worker_feedback
-     * @method POST
-     * @tag 工作(现场情况反馈)
-     * @header name:Authorization require:1 desc:Token
-     * @param name:explain type:string require:1 default:-- desc:反馈内容
-     * @param name:images type:string require:1 default:-- desc:反馈的图片地址,多张图片以英文逗号(,)分隔
+     * @url /api/Member/privacy_policy
+     * @method GET
+     * @tag 隐私政策
+     * @return name:-- type:string default:-- desc:隐私政策
      */
-    public function worker_feedback(){
-        $uid = $this->uid;
-        $explain = input('explain');
-        $images = input('images');
-        if(empty($explain) || empty($images)){
-            $this->error('参数错误');
-        }
-        $complain_id = Db::name('store_complain')->where('date',date('Y-m-d'))->where('type',1)->where('user_id',$uid)->value('id');
-        if($complain_id){
-            $this->error('你已提交过今天的任务反馈');
-        }
-        $data = [
-            'user_id' => $uid,
-            'question' => $explain,
-            'images' => $images,
-            'date' => date('Y-m-d')
-        ];
-        $res = Db::name('store_complain')->insert($data);
-        if($res !==false){
-            $this->success('提交成功');
-        }else{
-            $this->error('提交失败');
-        }
+    public function privacy_policy(){
+        $this->success('获取成功',htmlspecialchars_decode(sysconf('privacy_policy')));
     }
     /**
-     * @title 任务反馈
-     * @desc 任务反馈
+     * @title 关于我们
+     * @desc 关于我们
      * @author QGF
-     * @url /api/Member/task_feedback
-     * @method POST
-     * @tag 任务反馈
+     * @url /api/Member/about_us
+     * @method GET
+     * @tag 关于我们
+     * @return name:-- type:string default:-- desc:关于我们
+     */
+    public function about_us(){
+        $this->success('获取成功',htmlspecialchars_decode(sysconf('about_us')));
+    }
+    /**
+     * @title 我的关注
+     * @desc 我的关注
+     * @author QGF
+     * @url /api/Member/my_attention
+     * @method GET
+     * @tag 我的关注
      * @header name:Authorization require:1 desc:Token
-     * @param name:explain type:string require:1 default:-- desc:反馈内容
-     * @param name:images type:string require:1 default:-- desc:反馈的图片地址,多张图片以英文逗号(,)分隔
+     * @param name:page type:int require:0 default:1 desc:页数(默认为1)
+     * @param name:page_size type:int require:0 default:10 desc:每页数量(默认为10)
+     * @return name:user_name type:string default:-- desc:用户姓名/媒体名称
+     * @return name:user_headimg type:string default:-- desc:用户头像/媒体logo
+     * @return name:attention_num type:int default:-- desc:粉丝数量
      */
-    public function task_feedback(){
+    public function my_attention(){
         $uid = $this->uid;
-        $explain = input('explain');
-        $images = input('images');
-        if(empty($explain) || empty($images)){
-            $this->error('参数错误');
-        }
-        $complain_id = Db::name('store_complain')->where('date',date('Y-m-d'))->where('type',2)->where('user_id',$uid)->value('id');
-        if($complain_id){
-            $this->error('你已提交过今天的任务反馈');
-        }
-        $data = [
-            'user_id' => $uid,
-            'question' => $explain,
-            'images' => $images,
-            'type' => 2,
-            'date' => date('Y-m-d')
-        ];
-        $res = Db::name('store_complain')->insert($data);
-        if($res !==false){
-            $this->success('提交成功');
-        }else{
-            $this->error('提交失败');
+        $page = input('page',1);
+        $pageSize = input('page_size',10);
+        $list = Db::name('store_attention')->field('from_user_id')->where('user_id',$uid)->where('status',1)->page($page,$pageSize)->order('id','desc')->select();
+        if($list){
+            foreach ($list as &$value){
+                $user_type = user_type($value['from_user_id']);//1:用户 2:媒体
+                if($user_type == 1){
+                    $user_info = Db::name('store_member')->field('name,headimg')->where('id',$value['from_user_id'])->find();
+                    $value['user_name'] = $user_info['name'];
+                    $value['user_headimg'] = $user_info['headimg'];
+                }else{
+                    $media_info = Db::name('store_media')->field('logo,title')->where('id',$value['from_user_id'])->find();
+                    $value['user_name'] = $media_info['title'];
+                    $value['user_headimg'] = $media_info['logo'];
+                }
+                //共关注的数
+                $value['attention_num'] = Db::name('store_attention')->where('from_user_id',$value['from_user_id'])->where('status',1)->count('id');
+                unset($value['from_user_id']);
+            }
         }
+        $this->success('获取成功',$list);
     }
     /**
-     * @title 积分奖励(领导)
-     * @desc  积分奖励(领导)
-     * @author HG
-     * @url /api/Member/reward_list
+     * @title 我的收藏
+     * @desc 我的收藏
+     * @author QGF
+     * @url /api/Member/my_collect
      * @method GET
-     * @tag 积分奖励(领导)
+     * @tag 我的收藏
      * @header name:Authorization require:1 desc:Token
-     * @return name:explain type:striny default:-- desc:奖励说明
-     * @return name:images type:array default:-- desc:奖励图片地址(数组)
-     * @return name:amount type:striny default:-- desc:奖励金额
-     * @return name:create_at type:striny default:-- desc:时间
-     * @return name:user_name type:striny default:-- desc:员工姓名
+     * @param name:type type:int require:0 default:1 desc:类型(1:新闻(默认),2:咨询)
+     * @param name:page type:int require:0 default:1 desc:页数(默认为1)
+     * @param name:page_size type:int require:0 default:10 desc:每页数量(默认为10)
+     * @return name:id type:int default:-- desc:新闻或咨询ID
+     * @return name:title type:string default:-- desc:标题
+     * @return name:content type:string default:-- desc:内容(咨询独有)
+     * @return name:image type:array default:-- desc:图片数组
+     * @return name:video type:string default:-- desc:视频地址
+     * @return name:is_top type:int default:-- desc:是否置顶(0:不置顶,1:置顶)(新闻独有)
+     * @return name:comment_num type:int default:-- desc:评论数量
+     * @return name:media_logo type:string default:-- desc:用户头像或媒体logo
+     * @return name:media_title type:string default:-- desc:用户姓名或媒体名称
+     * @return name:duration type:string default:-- desc:时长
      */
-    public function reward_list(){
+    public function my_collect(){
         $uid = $this->uid;
-        $member_info = Db::name('store_member')->field('type')->where('id',$uid)->find();
-        $type = $member_info['type'];
-        if($type != 7){
-            $this->error('该身份没有权限');
-        }
-        $award_list = Db::name('store_award_list')->field('user_id,explain,images,amount,create_at')->order('id desc')->select();
-        if(empty($award_list)){
-            $this->success('获取成功',array());
-        }
-        foreach ($award_list as &$value){
-            $value['images'] = image_path($value['images']);
-            $value['user_name'] = Db::name('store_member')->where('id',$value['user_id'])->value('name');
-            unset($value['user_id']);
+        $type = input('type',1);
+        $page = input('page',1);
+        $pageSize = input('page_size',10);
+        $id_arr = Db::name('store_collect')->field('forum_id')->where('user_id',$uid)->where('status',1)->where('type',$type)->page($page,$pageSize)->order('id','desc')->column('forum_id');
+        if(empty($id_arr)){
+            $this->success('获取成功',[]);
         }
-        $this->success('获取成功',$award_list);
+        $list = $this->get_list($type,$id_arr,$page,$pageSize);
+        $this->success('获取成功',$list);
     }
     /**
-     * @title 奖励统计(领导)
-     * @desc  奖励统计(领导)
-     * @author HG
-     * @url /api/Member/reward_statistics
+     * @title 我的浏览
+     * @desc 我的浏览
+     * @author QGF
+     * @url /api/Member/my_browse
      * @method GET
-     * @tag 奖励统计(领导)
+     * @tag 我的浏览
      * @header name:Authorization require:1 desc:Token
-     * @return name:id type:int default:-- desc:工人id
-     * @return name:name type:string default:-- desc:姓名
-     * @return name:integral type:string default:-- desc:奖励金额
+     * @param name:type type:int require:0 default:1 desc:类型(1:新闻(默认),2:咨询)
+     * @param name:page type:int require:0 default:1 desc:页数(默认为1)
+     * @param name:page_size type:int require:0 default:10 desc:每页数量(默认为10)
+     * @return name:id type:int default:-- desc:新闻或咨询ID
+     * @return name:title type:string default:-- desc:标题
+     * @return name:content type:string default:-- desc:内容(咨询独有)
+     * @return name:image type:array default:-- desc:图片数组
+     * @return name:video type:string default:-- desc:视频地址
+     * @return name:is_top type:int default:-- desc:是否置顶(0:不置顶,1:置顶)(新闻独有)
+     * @return name:comment_num type:int default:-- desc:评论数量
+     * @return name:media_logo type:string default:-- desc:用户头像或媒体logo
+     * @return name:media_title type:string default:-- desc:用户姓名或媒体名称
+     * @return name:duration type:string default:-- desc:时长
      */
-    public function reward_statistics(){
+    public function my_browse(){
         $uid = $this->uid;
-        $member_info = Db::name('store_member')->field('type')->where('id',$uid)->find();
-        $type = $member_info['type'];
-        if($type != 7){
-            $this->error('该身份没有权限');
-        }
-        $member_list = Db::name('store_member')->field('name,integral')->where('type',1)->where('integral','>',0)->order('integral desc')->select();
-        if(empty($member_list)){
-            $this->success('获取成功',array());
+        $type = input('type',1);
+        $page = input('page',1);
+        $pageSize = input('page_size',10);
+        $id_arr = Db::name('store_browse')->field('forum_id')->where('user_id',$uid)->where('status',1)->where('type',$type)->page($page,$pageSize)->order('id','desc')->column('forum_id');
+        if(empty($id_arr)){
+            $this->success('获取成功',[]);
         }
-        $this->success('获取成功',$member_list);
+        $list = $this->get_list($type,$id_arr,$page,$pageSize);
+        $this->success('获取成功',$list);
     }
     /**
-     * @title 员工考勤(领导)
-     * @desc  员工考勤(领导)
-     * @author HG
-     * @url /api/Member/attendance_list
+     * @title 我的点赞
+     * @desc 我的点赞
+     * @author QGF
+     * @url /api/Member/my_like
      * @method GET
-     * @tag 员工考勤(领导)
+     * @tag 我的点赞
      * @header name:Authorization require:1 desc:Token
-     * @param name:workshop type:int require:1 default:-- desc:车间ID
-     * @param name:date type:string require:1 default:-- desc:时间(格式:2021-06-30)
-     * @return name:workshop type:string default:-- desc:车间名称
-     * @return name:workshop_name type:string default:-- desc:车间主任姓名
-     * @return name:workshop_num type:int default:-- desc:车间人数
-     * @return name:should_workshop_num type:int default:-- desc:应出勤人数
-     * @return name:attendance_num type:int default:-- desc:实际出勤人数
-     * @return name:attendance_list type:array default:-- desc:出勤人名单(user_name:出勤人员姓名,attendance_time:出勤时长)
+     * @param name:type type:int require:0 default:1 desc:类型(1:新闻(默认),2:咨询)
+     * @param name:page type:int require:0 default:1 desc:页数(默认为1)
+     * @param name:page_size type:int require:0 default:10 desc:每页数量(默认为10)
+     * @return name:id type:int default:-- desc:新闻或咨询ID
+     * @return name:title type:string default:-- desc:标题
+     * @return name:content type:string default:-- desc:内容(咨询独有)
+     * @return name:image type:array default:-- desc:图片数组
+     * @return name:video type:string default:-- desc:视频地址
+     * @return name:is_top type:int default:-- desc:是否置顶(0:不置顶,1:置顶)(新闻独有)
+     * @return name:comment_num type:int default:-- desc:评论数量
+     * @return name:media_logo type:string default:-- desc:用户头像或媒体logo
+     * @return name:media_title type:string default:-- desc:用户姓名或媒体名称
+     * @return name:duration type:string default:-- desc:时长
      */
-    public function attendance_list(){
+    public function my_like(){
         $uid = $this->uid;
-        $workshop = input('workshop');
-        $date = input('date');
-        if(empty($workshop) || empty($date)){
-            $this->error('参数错误');
-        }
-        $member_info = Db::name('store_member')->field('type')->where('id',$uid)->find();
-        $type = $member_info['type'];
-        if($type != 7){
-            $this->error('该身份没有权限');
-        }
-        $workshop_name = Db::name('store_member')->where('type',3)->where('workshop',$workshop)->value('name');
-        $attendance_list = Db::name('store_attendance')->field('user_name,attendance_time')->where('workshop',$workshop)->where('date',$date)->where('is_attendance',1)->select();
-        if(empty($attendance_list)){
-            $this->success('获取成功',array());
+        $type = input('type',1);
+        $page = input('page',1);
+        $pageSize = input('page_size',10);
+        $id_arr = Db::name('store_like')->field('forum_id')->where('user_id',$uid)->where('status',1)->where('type',$type)->page($page,$pageSize)->order('id','desc')->column('forum_id');
+        if(empty($id_arr)){
+            $this->success('获取成功',[]);
         }
-        //车间人数
-        $workshop_num = Db::name('store_member')->field('id,name')->where('type',1)->where('workshop',$workshop)->count('id');
-        //应出勤
-        $should_workshop_num = Db::name('store_attendance')->where('workshop',$workshop)->where('date',$date)->count('id');
-        $attendance_num = Db::name('store_attendance')->where('workshop',$workshop)->where('date',$date)->where('is_attendance',1)->count('id');
-        $data = array(
-            'workshop' => workshop_arr()[$workshop],
-            'workshop_name' => $workshop_name,
-            'workshop_num' => $workshop_num,
-            'should_workshop_num' => $should_workshop_num,
-            'attendance_num' => $attendance_num,
-            'attendance_list' => $attendance_list
-        );
-        $this->success('获取成功',$data);
+        $list = $this->get_list($type,$id_arr,$page,$pageSize);
+        $this->success('获取成功',$list);
     }
     /**
-     * @title 员工计件(领导)
-     * @desc  员工计件(领导)
-     * @author HG
-     * @url /api/Member/product_case
+     * @title 我的评论
+     * @desc 我的评论
+     * @author QGF
+     * @url /api/Member/my_comment
      * @method GET
-     * @tag 员工计件(领导)
+     * @tag 我的评论
      * @header name:Authorization require:1 desc:Token
-     * @param name:workshop type:int require:1 default:-- desc:车间ID
-     * @param name:date type:string require:1 default:-- desc:时间(格式:2021-06-30)
-     * @return name:workshop type:string default:-- desc:车间名称
-     * @return name:workshop_name type:string default:-- desc:车间主任姓名
-     * @return name:workshop_num type:int default:-- desc:车间人数
-     * @return name:product_num type:int default:-- desc:生产件数
-     * @return name:product_list type:array default:-- desc:生产件数详情(user_name:人员姓名,product_info:生产信息(数组:parts_num:数量,parts_name:部件名称))
+     * @param name:type type:int require:0 default:1 desc:类型(1:新闻(默认),2:咨询)
+     * @param name:page type:int require:0 default:1 desc:页数(默认为1)
+     * @param name:page_size type:int require:0 default:10 desc:每页数量(默认为10)
+     * @return name:id type:int default:-- desc:新闻或咨询ID
+     * @return name:title type:string default:-- desc:标题
+     * @return name:content type:string default:-- desc:内容(咨询独有)
+     * @return name:image type:array default:-- desc:图片数组
+     * @return name:video type:string default:-- desc:视频地址
+     * @return name:is_top type:int default:-- desc:是否置顶(0:不置顶,1:置顶)(新闻独有)
+     * @return name:comment_num type:int default:-- desc:评论数量
+     * @return name:media_logo type:string default:-- desc:用户头像或媒体logo
+     * @return name:media_title type:string default:-- desc:用户姓名或媒体名称
+     * @return name:duration type:string default:-- desc:时长
      */
-    public function product_case(){
+    public function my_comment(){
         $uid = $this->uid;
-        $workshop = input('workshop');
-        $date = input('date');
-        if(empty($workshop) || empty($date)){
-            $this->error('参数错误');
-        }
-        $member_info = Db::name('store_member')->field('type')->where('id',$uid)->find();
-        $type = $member_info['type'];
-        if($type != 7){
-            $this->error('该身份没有权限');
-        }
-        $workshop_name = Db::name('store_member')->where('type',3)->where('workshop',$workshop)->value('name');
-        $product_list = Db::name('store_product_case')->field('user_name,product_info')->where('workshop',$workshop)->where('date',$date)->select();
-        if(empty($product_list)){
-            $this->success('获取成功',array());
+        $type = input('type',1);
+        $page = input('page',1);
+        $pageSize = input('page_size',10);
+        $id_arr = Db::name('store_comment')->field('forum_id')->where('user_id',$uid)->where('forum_type',$type)->where('type',1)->page($page,$pageSize)->order('id','desc')->column('forum_id');
+        if(empty($id_arr)){
+            $this->success('获取成功',[]);
         }
-        //车间人数
-        $workshop_num = Db::name('store_member')->field('id,name')->where('type',1)->where('workshop',$workshop)->count('id');
-        //生产件数
-        $product_num = 0;
-        foreach ($product_list as &$value){
-            $value['product_info'] = json_decode($value['product_info'],true);
-            foreach ($value['product_info'] as &$v){
-                $v['parts_name'] = Db::name('store_parts')->where('id',$v['parts_id'])->value('name');
-                $product_num += $v['parts_num'];
-                unset($v['parts_id']);
+        $list = $this->get_list($type,$id_arr,$page,$pageSize);
+        $this->success('获取成功',$list);
+    }
+    public function get_list($type = 1,$id_arr = array(),$page = 1,$pageSize = 10){
+        if($type == 1){    //新闻
+            $field = 'id,title,user_id,image,video,is_top,create_at';
+            $list = Db::name('store_goods')->field($field)->where('status',1)->where('is_deleted',0)->where('id','in',$id_arr)->page($page,$pageSize)->order(['is_top'=>'desc','sort'=>'desc','id'=>'desc'])->select();
+            if($list){
+                foreach($list as &$value) {
+                    //获取评论数量
+                    $value['comment_num'] = Db::name('store_comment')->where('forum_id',$value['id'])->where('type',1)->where('forum_type',1)->count('id');
+                    $value['image'] = image_path($value['image']);
+                    //媒体信息
+                    $media_info = Db::name('store_media')->field('logo,title')->where('id',$value['user_id'])->find();
+                    $value['media_logo'] = $media_info['logo'];
+                    $value['media_title'] = $media_info['title'];
+                    $remain_time = time() - strtotime($value['create_at']);
+                    $value['duration'] = get_stay_time($remain_time);
+                    unset($value['user_id']);
+                    unset($value['create_at']);
+                }
+            }
+        }else{    //咨询
+            $field = 'id,user_id,type,title,content,media_id,image,video,create_at';
+            $list = Db::name('store_consult')->field($field)->where('status',1)->where('is_deleted',0)->where('id','in',$id_arr)->page($page,$pageSize)->order(['sort'=>'desc','id'=>'desc'])->select();
+            if($list){
+                foreach($list as &$value) {
+                    //获取评论数量
+                    $value['comment_num'] = Db::name('store_comment')->where('forum_id',$value['id'])->where('type',1)->where('forum_type',2)->count('id');
+                    $value['image'] = image_path($value['image']);
+                    if($value['type'] == 1){     //后台媒体
+                        //媒体信息
+                        $media_info = Db::name('store_media')->field('logo,title')->where('id',$value['user_id'])->find();
+                        $value['media_logo'] = $media_info['logo'];
+                        $value['media_title'] = $media_info['title'];
+                    }else{      //用户
+                        //用户信息
+                        $media_info = Db::name('store_member')->field('headimg,name')->where('id',$value['user_id'])->find();
+                        $value['media_logo'] = $media_info['headimg'];
+                        $value['media_title'] = $media_info['name'];
+                    }
+                    $remain_time = time() - strtotime($value['create_at']);
+                    $value['duration'] = get_stay_time($remain_time);
+                    unset($value['media_id']);
+                    unset($value['user_id']);
+                    unset($value['type']);
+                    unset($value['create_at']);
+                }
             }
         }
-        $data = array(
-            'workshop' => workshop_arr()[$workshop],
-            'workshop_name' => $workshop_name,
-            'workshop_num' => $workshop_num,
-            'product_num' => $product_num,
-            'product_list' => $product_list
-        );
-        $this->success('获取成功',$data);
+        return $list;
     }
     /**
-     * @title 工作圈(领导)
-     * @desc  工作圈(领导)
-     * @author HG
-     * @url /api/Member/work_circle
+     * @title 消息列表
+     * @desc 消息列表
+     * @author QGF
+     * @url /api/Member/news_list
      * @method GET
-     * @tag 工作圈(领导)
+     * @tag 消息列表
      * @header name:Authorization require:1 desc:Token
      * @param name:page type:int require:0 default:1 desc:页数(默认为1)
      * @param name:page_size type:int require:0 default:10 desc:每页数量(默认为10)
-     * @param name:keyword type:string require:0 default:-- desc:搜索的关键词
-     * @param name:start_time type:string require:0 default:-- desc:开始时间(格式:2021-05-14)
-     * @param name:end_time type:string require:0 default:-- desc:结束时间(格式:2021-05-15)
-     * @return name:question type:string default:-- desc:生产说明文字
-     * @return name:images type:string default:-- desc:生成图片地址(数组)
-     * @return name:create_at type:string default:-- desc:反馈时间
-     * @return name:user_headimg type:string default:-- desc:反馈人头像地址
-     * @return name:user_name type:string default:-- desc:反馈人姓名
-     * @return name:workshop_name type:string default:-- desc:反馈人归属车间名或厂长,副厂长
+     * @return name:-- type:array default:-- desc:消息信息(content:内容,type:类型(1:系统消息,2:用户消息),icon:消息前面的图标,type_name:消息类型名称,duration:时长)
      */
-    public function work_circle(){
+    public function news_list(){
         $uid = $this->uid;
         $page = input('page',1);
         $pageSize = input('page_size',10);
-        $keyword = input('keyword');
-        $start_time = input('start_time');
-        $end_time = input('end_time');
-        $where = 'type = 1';
-        if($keyword){
-            $where .= " and question like '%".$keyword."%'";
-        }
-        if($start_time && $end_time){
-            $start_time = $start_time.' 00:00:00';
-            $end_time = $end_time.' 24:00:00';
-            $complain_list = Db::name('store_complain')->field('user_id,question,images,create_at')->whereBetweenTime('create_at',$start_time,$end_time)->where($where)->order('id desc')->page($page,$pageSize)->select();
-        }else{
-            $complain_list = Db::name('store_complain')->field('user_id,question,images,create_at')->where($where)->order('id desc')->page($page,$pageSize)->select();
-        }
-        if(empty($complain_list)){
-            $this->success('获取成功',array());
-        }
-        foreach ($complain_list as &$value){
-            $value['images'] = image_path($value['images']);
-            $member_info = Db::name('store_member')->field('headimg,name,workshop,type')->where('id',$value['user_id'])->find();
-            $value['user_headimg'] = $member_info['headimg'];
-            $value['user_name'] = $member_info['name'];
-            if($member_info['type'] == 3){
-                $value['workshop_name'] = workshop_arr()[$member_info['workshop']];
-            }elseif ($member_info['type'] == 5){
-                $value['workshop_name'] = '副厂长';
-            }elseif ($member_info['type'] == 6){
-                $value['workshop_name'] = '厂长';
+        $news_list = Db::name('store_news')->field('content,type,comment_user_id,create_at')->where('user_id',$uid)->page($page,$pageSize)->order('id','desc')->select();
+        $type_arr = array('1'=>'系统消息','2'=>'用户消息');
+        if($news_list){
+            foreach ($news_list as &$value){
+                if($value['type'] == 1){
+                    $value['icon'] = 'https://zjth2021.oss-cn-beijing.aliyuncs.com/164e89b793f57189/eea68607b8a59a4b.png';
+                }else{
+                    $value['icon'] = Db::name('store_member')->where('id',$value['comment_user_id'])->value('headimg');
+                }
+                $value['type_name'] = $type_arr[$value['type']];
+                $remain_time = time() - strtotime($value['create_at']);
+                $value['duration'] = get_stay_time($remain_time);
+                unset($value['comment_user_id']);
+                unset($value['create_at']);
             }
-            unset($value['user_id']);
         }
-        $this->success('获取成功',$complain_list);
+        //未读改成已读
+        Db::name('store_news')->where('user_id',$uid)->where('status',0)->update(array('status'=>1));
+        $this->success('获取成功',$news_list);
     }
     /**
-     * @title 生产统计(领导)
-     * @desc  生产统计(领导)
-     * @author HG
-     * @url /api/Member/product_statistics
-     * @method GET
-     * @tag 生产统计(领导)
+     * @title 平台反馈
+     * @desc 平台反馈
+     * @author QGF
+     * @url /api/Member/submit_complain
+     * @method POST
+     * @tag 平台反馈
      * @header name:Authorization require:1 desc:Token
-     * @param name:start_time type:string require:0 default:-- desc:开始时间(格式:2021-05-14)
-     * @param name:end_time type:string require:0 default:-- desc:结束时间(格式:2021-05-15)
-     * @return name:question type:string default:-- desc:生产说明文字
-     * @return name:images type:string default:-- desc:生成图片地址(数组)
-     * @return name:create_at type:string default:-- desc:反馈时间
-     * @return name:user_headimg type:string default:-- desc:反馈人头像地址
-     * @return name:user_name type:string default:-- desc:反馈人姓名
-     * @return name:workshop_name type:string default:-- desc:反馈人归属车间名或厂长,副厂长
+     * @param name:explain type:string require:1 default:-- desc:反馈内容
+     * @param name:images type:string require:1 default:-- desc:反馈的图片地址,多张图片以英文逗号(,)分隔
      */
-    public function product_statistics(){
+    public function submit_complain(){
         $uid = $this->uid;
-        $start_time = input('start_time');
-        $end_time = input('end_time');
-        $member_info = Db::name('store_member')->field('type')->where('id',$uid)->find();
-        $type = $member_info['type'];
-        if($type != 7){
-            $this->error('该身份没有权限');
+        $explain = input('explain');
+        $images = input('images');
+        if(empty($explain) || empty($images)){
+            $this->error('参数错误');
         }
-        //共生产的数量
-        $workshop = array();
-        if($start_time && $end_time){
-            $start_time = $start_time.' 00:00:00';
-            $end_time = $end_time.' 24:00:00';
-            $num_all = Db::name('store_product_case')->whereBetweenTime('create_at',$start_time,$end_time)->sum('product_num');
-            foreach (workshop_arr() as $key=>$value){
-                $num = Db::name('store_product_case')->where('workshop',$key)->whereBetweenTime('create_at',$start_time,$end_time)->sum('product_num');
-                $workshop[$key-1]['workshop_name'] = $value;
-                $workshop[$key-1]['num'] = $num;
-            }
+        $data = [
+            'user_id' => $uid,
+            'question' => $explain,
+            'images' => $images,
+            'type' => 2,
+            'date' => date('Y-m-d')
+        ];
+        $res = Db::name('store_complain')->insert($data);
+        if($res !==false){
+            $this->success('提交成功');
         }else{
-            $num_all = Db::name('store_product_case')->sum('product_num');
-            foreach (workshop_arr() as $key=>$value){
-                $num = Db::name('store_product_case')->where('workshop',$key)->sum('product_num');
-                $workshop[$key-1]['workshop_name'] = $value;
-                $workshop[$key-1]['num'] = $num;
-            }
+            $this->error('提交失败');
         }
-        $data = array(
-            'num_all' => $num_all,
-            'workshop' => $workshop
-        );
-        $this->success('获取成功',$data);
     }
     /**
-     * @title 统计详情(领导)
-     * @desc  统计详情(领导)
-     * @author HG
-     * @url /api/Member/statistics_detail
-     * @method GET
-     * @tag 统计详情(领导)
+     * @title 发表咨询
+     * @desc 发表咨询
+     * @author QGF
+     * @url /api/Member/publish_consult
+     * @method POST
+     * @tag 发表咨询
      * @header name:Authorization require:1 desc:Token
-     * @param name:workshop type:int require:1 default:-- desc:车间ID
-     * @return name:workshop_name type:string default:-- desc:车间名称
-     * @return name:num_all type:int default:-- desc:生产总数量
-     * @return name:product_info type:array default:-- desc:生成详情(parts_name:部件名称,num:数量)
+     * @param name:cate_id type:int require:1 default:-- desc:咨询分类ID
+     * @param name:title type:string require:1 default:-- desc:咨询标题
+     * @param name:content type:string require:1 default:-- desc:咨询内容
+     * @param name:image type:string require:1 default:-- desc:咨询图片,多张图片以英文逗号分隔
+     * @param name:video type:string require:0 default:-- desc:咨询视频
      */
-    public function statistics_detail(){
+    public function publish_consult(){
         $uid = $this->uid;
-        $workshop = input('workshop');
-        if(empty($workshop)){
+        $cate_id = input('cate_id');
+        $title = input('title');
+        $content = input('content');
+        $image = input('image');
+        $video = input('video');
+        if(empty($cate_id) || empty($title) || empty($image) || empty($content)){
             $this->error('参数错误');
         }
-        $member_info = Db::name('store_member')->field('type')->where('id',$uid)->find();
-        $type = $member_info['type'];
-        if($type != 7){
-            $this->error('该身份没有权限');
-        }
-        $workshop_name = workshop_arr()[$workshop];
-        $num = Db::name('store_product_case')->where('workshop',$workshop)->sum('product_num');
-        $product_case = Db::name('store_product_case')->field('product_info')->where('workshop',$workshop)->select();
-        if(empty($product_case)){
-            $this->success('获取成功',$product_case);
-        }
-        $product_info = array();
-        foreach ($product_case as $value){
-            $product_arr = json_decode($value['product_info'],true);
-            foreach ($product_arr as $v){
-                if(!in_array($v['parts_id'],array_keys($product_info))){
-                    $product_info[$v['parts_id']] = $v['parts_num'];
-                }else{
-                    foreach ($product_info as $key=>&$product_value){
-                        if($key == $v['parts_id']){
-                            $product_value = $product_value + $v['parts_num'];
-                        }
-                    }
-                }
-            }
-        }
-        $case_info = array();
-        $arr = array();
-        if($product_info){
-            foreach ($product_info as $product_key=>$product_info_value){
-                $arr['parts_name'] = Db::name('store_parts')->where('id',$product_key)->value('name');
-                $arr['num'] = intval($product_info_value);
-                array_push($case_info,$arr);
-            }
+        $data = [
+            'user_id' => $uid,
+            'cate_id' => $cate_id,
+            'title' => $title,
+            'content' => $content,
+            'image' => $image,
+            'video' => $video,
+            'type' => 2
+        ];
+        $res = Db::name('store_consult')->insert($data);
+        if($res !==false){
+            $this->success('发布成功');
+        }else{
+            $this->error('发布失败');
         }
-        $data = array(
-            'workshop_name' => $workshop_name,
-            'num_all' => $num,
-            'product_info' => $case_info
-        );
-        $this->success('获取成功',$data);
     }
 }

+ 329 - 0
application/api/controller/Operation.php

@@ -0,0 +1,329 @@
+<?php
+
+// +----------------------------------------------------------------------
+// | ThinkAdmin
+// +----------------------------------------------------------------------
+// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
+// +----------------------------------------------------------------------
+// | 官方网站: http://demo.thinkadmin.top
+// +----------------------------------------------------------------------
+// | 开源协议 ( https://mit-license.org )
+// +----------------------------------------------------------------------
+// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
+// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
+// +----------------------------------------------------------------------
+
+namespace app\api\controller;
+
+use app\api\controller\Base;
+use think\Db;
+use think\Model;
+/**
+ * @title 操作管理(关注,评论,点赞,收藏。。。)
+ * @controller Operation
+ * @group member
+ */
+class Operation extends Base
+{
+    function initialize()
+    {
+        $this->check_login();
+    }
+    /**
+     * @title 关注/取消关注
+     * @desc 关注/取消关注
+     * @author QGF
+     * @url /api/Operation/attention
+     * @method GET
+     * @tag 关注/取消关注
+     * @header name:Authorization require:1 desc:Token
+     * @param name:user_id type:int require:1 default:-- desc:被关注/取消关注的用户ID/媒体ID(详情返回的user_id字段)
+     * @param name:operation_type type:int require:1 default:-- desc:操作类型(0:取消关注,1:关注)
+     */
+    public function attention(){
+        $uid = $this->uid;
+        $user_id = input('user_id');
+        $type = input('operation_type');
+        if(empty($user_id) || !isset($type)){
+            $this->error('参数错误');
+        }
+        if($uid == $user_id){
+            $this->error('不能操作自己');
+        }
+        $attention = Db::name('store_attention')->where('user_id',$uid)->where('from_user_id',$user_id)->find();
+        if($type == 0){    //取消关注
+            if(empty($attention['status'])){
+                $this->error('没关注无需取消');
+            }
+            Db::name('store_attention')->where('user_id',$uid)->where('from_user_id',$user_id)->update(array('status'=>0));
+        }else{
+            if(!empty($attention['status'])){
+                $this->error('已关注无需继续关注');
+            }
+            if($attention['id']){
+                Db::name('store_attention')->where('user_id',$uid)->where('from_user_id',$user_id)->update(array('status'=>1));
+            }else{
+                $data = array(
+                    'user_id' => $uid,
+                    'from_user_id' => $user_id,
+                    'type' => user_type($user_id),
+                    'status' => 1
+                );
+                Db::name('store_attention')->insert($data);
+            }
+        }
+        $this->success('操作成功');
+    }
+    /**
+     * @title 提交评论
+     * @desc 提交评论
+     * @author QGF
+     * @url /api/Operation/submit_comment
+     * @method GET
+     * @tag 提交评论
+     * @header name:Authorization require:1 desc:Token
+     * @param name:type type:int require:1 default:-- desc:类型(1:新闻,2:咨询)
+     * @param name:id type:int require:1 default:-- desc:新闻ID或咨询ID
+     * @param name:content type:string require:1 default:-- desc:评论内容
+     */
+    public function submit_comment(){
+        $uid = $this->uid;
+        $type = input('type');
+        $id = input('id');
+        $content = input('content');
+        if(empty($type) || empty($id) || empty($content)){
+            $this->error('参数错误');
+        }
+        $table_nme = $type==1?'store_goods':'store_consult';
+        $type_name = $type==1?'新闻':'咨询';
+        $info = Db::name($table_nme)->field('user_id,title')->where('id',$id)->where('status',1)->where('is_deleted',0)->find();
+        if(empty($info)){
+            $this->error($type_name.'信息有误');
+        }
+        if($uid == $info['user_id']){
+            $this->error('不能操作自己');
+        }
+        $comment_info = Db::name('store_comment')->field('id')->where('user_id',$uid)->where('forum_id',$id)->where('type',1)->where('forum_type',$type)->find();
+        if(!empty($comment_info)){
+            $this->error('已评论过该'.$type_name);
+        }
+        $comment_data = array(
+            'user_id' => $uid,
+            'from_user_id' => $info['user_id'],
+            'forum_id' => $id,
+            'content' => $content,
+            'forum_type' => $type,
+            'type' => 1
+        );
+        Db::name('store_comment')->insert($comment_data);
+        $comment_id = Db::name('store_comment')->getLastInsID();
+        Db::name('store_comment')->where('id',$comment_id)->update(array('root_comment_id'=>$comment_id));
+        $user_type = user_type($info['user_id']);
+        if($user_type == 1){       //用户发表的咨询有评论的会给发表者发送信息通知
+            $user_name = Db::name('store_member')->where('id',$uid)->value('name');
+            $news_data = array(
+                'user_id' => $info['user_id'],  //获得这个消息的会员
+                'content' => $user_name.'评论了你发表的'.$info['title'].'咨询',
+                'comment_user_id' => $uid,
+                'type' => 2,
+            );
+            Db::name('store_news')->insert($news_data);
+        }
+        $this->success('评论成功');
+    }
+    /**
+     * @title 回复评论
+     * @desc 回复评论
+     * @author QGF
+     * @url /api/Operation/reply_comment
+     * @method GET
+     * @tag 回复评论
+     * @header name:Authorization require:1 desc:Token
+     * @param name:comment_id type:int require:1 default:-- desc:要回复的评论ID
+     * @param name:content type:string require:1 default:-- desc:评论内容
+     */
+    public function reply_comment(){
+        $uid = $this->uid;
+        $comment_id = input('comment_id');//要回复的评论ID
+        $content = input('content');//回复评论的内容
+        if(empty($content) || empty($comment_id)){
+            $this->error('参数错误');
+        }
+        $comment = Db::name('store_comment')->field('forum_id,user_id,root_comment_id')->where('id',$comment_id)->find();
+        if(empty($comment)){
+            $this->error('要回复的评论信息有误');
+        }
+        if($comment['user_id'] == $uid){
+            $this->error('不能回复自己的评论');
+        }
+        //判断要是否回复过次评论了
+        $reply_comment = Db::name('store_comment')->field('id')->where('user_id',$uid)->where('type',2)->where('comment_id',$comment_id)->find();
+        if(!empty($reply_comment)){
+            $this->error('已回复过此评论');
+        }
+        $root_comment_id = $comment['root_comment_id']?$comment['root_comment_id']:$comment_id;
+        $comment_data = array(
+            'forum_id' => $comment['forum_id'],
+            'user_id' => $uid,
+            'from_user_id' => $comment['user_id'],
+            'content' => $content,
+            'comment_id' => $comment_id,
+            'root_comment_id' => $root_comment_id,
+            'type' => 2
+        );
+        Db::name('store_comment')->insert($comment_data);
+        //回复的谁给谁消息通知
+        $user_name = Db::name('store_member')->where('id',$uid)->value('name');
+        $news_data = array(
+            'user_id' => $comment['user_id'],  //获得这个消息的会员
+            'content' => $user_name.'回复的你的评论',
+            'comment_user_id' => $uid,
+            'type' => 2,
+        );
+        Db::name('store_news')->insert($news_data);
+        $this->success('回复评论成功');
+    }
+    /**
+     * @title 点赞/取消点赞
+     * @desc 点赞/取消点赞
+     * @author QGF
+     * @url /api/Operation/like
+     * @method GET
+     * @tag 点赞/取消点赞
+     * @header name:Authorization require:1 desc:Token
+     * @param name:id type:int require:1 default:-- desc:新闻或咨询ID
+     * @param name:operation_type type:int require:1 default:-- desc:操作类型(0:取消点赞,1:点赞)
+     * @param name:type type:int require:1 default:-- desc:信息类型(1:新闻,2:咨询)
+     */
+    public function like(){
+        $uid = $this->uid;
+        $id = input('id');
+        $operation_type = input('operation_type');
+        $type = input('type');
+        if(empty($id) || !isset($operation_type) || empty($type)){
+            $this->error('参数错误');
+        }
+        $table_nme = $type==1?'store_goods':'store_consult';
+        $type_name = $type==1?'新闻':'咨询';
+        $info = Db::name($table_nme)->field('user_id')->where('id',$id)->where('status',1)->where('is_deleted',0)->find();
+        if(empty($info)){
+            $this->error($type_name.'信息有误');
+        }
+        if($uid == $info['user_id']){
+            $this->error('不能操作自己');
+        }
+        $like = Db::name('store_like')->where('user_id',$uid)->where('forum_id',$id)->where('user_id',$uid)->find();
+        if($operation_type == 0){    //取消关注
+            if(empty($like['status'])){
+                $this->error('没点赞无需取消');
+            }
+            Db::name('store_like')->where('user_id',$uid)->where('forum_id',$id)->update(array('status'=>0));
+        }else{
+            if(!empty($like['status'])){
+                $this->error('已点赞无需继续点赞');
+            }
+            if($like['id']){
+                Db::name('store_like')->where('user_id',$uid)->where('forum_id',$id)->where('type',$type)->update(array('status'=>1));
+            }else{
+                $data = array(
+                    'user_id' => $uid,
+                    'from_user_id' => $info['user_id'],
+                    'forum_id' => $id,
+                    'type' => $type,
+                    'status' => 1
+                );
+                Db::name('store_like')->insert($data);
+            }
+        }
+        $this->success('操作成功');
+    }
+    /**
+     * @title 收藏/取消收藏
+     * @desc 收藏/取消收藏
+     * @author QGF
+     * @url /api/Operation/collect
+     * @method GET
+     * @tag 收藏/取消收藏
+     * @header name:Authorization require:1 desc:Token
+     * @param name:id type:int require:1 default:-- desc:新闻或咨询ID
+     * @param name:operation_type type:int require:1 default:-- desc:操作类型(0:取消收藏,1:收藏)
+     * @param name:type type:int require:1 default:-- desc:信息类型(1:新闻,2:咨询)
+     */
+    public function collect(){
+        $uid = $this->uid;
+        $id = input('id');
+        $operation_type = input('operation_type');
+        $type = input('type');
+        if(empty($id) || !isset($operation_type) || empty($type)){
+            $this->error('参数错误');
+        }
+        $table_nme = $type==1?'store_goods':'store_consult';
+        $type_name = $type==1?'新闻':'咨询';
+        $info = Db::name($table_nme)->field('user_id')->where('id',$id)->where('status',1)->where('is_deleted',0)->find();
+        if(empty($info)){
+            $this->error($type_name.'信息有误');
+        }
+        if($uid == $info['user_id']){
+            $this->error('不能操作自己');
+        }
+        $collect = Db::name('store_collect')->where('user_id',$uid)->where('forum_id',$id)->where('type',$type)->find();
+        if($operation_type == 0){    //取消收藏
+            if(empty($collect['status'])){
+                $this->error('没收藏无需取消');
+            }
+            Db::name('store_collect')->where('user_id',$uid)->where('forum_id',$id)->where('type',$type)->update(array('status'=>0));
+        }else{
+            if(!empty($collect['status'])){
+                $this->error('已收藏无需继续点赞');
+            }
+            if($collect['id']){
+                Db::name('store_collect')->where('user_id',$uid)->where('forum_id',$id)->where('type',$type)->update(array('status'=>1));
+            }else{
+                $data = array(
+                    'user_id' => $uid,
+                    'from_user_id' => $info['user_id'],
+                    'forum_id' => $id,
+                    'type' => $type,
+                    'status' => 1
+                );
+                Db::name('store_collect')->insert($data);
+            }
+        }
+        $this->success('操作成功');
+    }
+    /**
+     * @title 转发
+     * @desc 转发(转发成功调用此接口)
+     * @author QGF
+     * @url /api/Operation/transpond
+     * @method GET
+     * @tag 转发
+     * @header name:Authorization require:1 desc:Token
+     * @param name:id type:int require:1 default:-- desc:新闻或咨询ID
+     * @param name:type type:int require:1 default:-- desc:信息类型(1:新闻,2:咨询)
+     */
+    public function transpond(){
+        $uid = $this->uid;
+        $id = input('id');
+        $type = input('type');
+        if(empty($id) || empty($type)){
+            $this->error('参数错误');
+        }
+        $table_nme = $type==1?'store_goods':'store_consult';
+        $type_name = $type==1?'新闻':'咨询';
+        $info = Db::name($table_nme)->field('user_id')->where('id',$id)->where('status',1)->where('is_deleted',0)->find();
+        if(empty($info)){
+            $this->error($type_name.'信息有误');
+        }
+        if($uid == $info['user_id']){
+            $this->error('不能操作自己');
+        }
+        $data = array(
+            'user_id' => $uid,
+            'forum_id' => $id,
+            'type' => $type
+        );
+        Db::name('store_transpond')->insert($data);
+        $this->success('操作成功');
+    }
+}

+ 0 - 802
application/api/controller/Order.php

@@ -1,802 +0,0 @@
-<?php
-
-// +----------------------------------------------------------------------
-// | ThinkAdmin
-// +----------------------------------------------------------------------
-// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
-// +----------------------------------------------------------------------
-// | 官方网站: http://demo.thinkadmin.top
-// +----------------------------------------------------------------------
-// | 开源协议 ( https://mit-license.org )
-// +----------------------------------------------------------------------
-// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
-// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
-// +----------------------------------------------------------------------
-
-namespace app\api\controller;
-
-use app\api\controller\Base;
-use think\Db;
-/**
- * @title 订单管理
- * @controller Order
- * @group base
- */
-class Order extends Base
-{
-    function initialize()
-    {
-        $this->check_login();
-    }
-    /**
-     * @title 订单列表
-     * @desc  订单列表
-     * @author HG
-     * @url /api/Order/order_list
-     * @method GET
-     * @tag 订单列表
-     * @header name:Authorization require:1 desc:Token
-     * @param name:flow_status type:tinyint require:0 default:-1 desc:流转状态(0未流转,1已流转。不传默认为-1,查询所有的。注:只有车间主任,副厂长,厂长才能传此参数)
-     * @param name:deliver_status type:tinyint require:0 default:-1 desc:发货状态(0未发货,1已发货。不传默认为-1,查询所有的。注:只有厂库管理人员和领导才能传此参数)
-     * @param name:is_library type:tinyint require:0 default:0 desc:是否是厂库订单(0:不是,1:是。注:只有领导才能传此参数)
-     * @param name:key_type type:tinyint require:0 default:-- desc:搜索类型(1:销售人员,2:订单号,3:交付时间。当keyword有值时必填)
-     * @param name:keyword type:string require:0 default:-- desc:搜索的关键词
-     * @param name:start_time type:string require:0 default:-- desc:开始时间(格式:2021-05-14)
-     * @param name:end_time type:string require:0 default:-- desc:结束时间(格式:2021-05-15)
-     * @param name:page type:int require:0 default:1 desc:页数(默认为1)
-     * @param name:page_size type:int require:0 default:10 desc:每页数量(默认为10)
-     * @param name:identity type:int require:0 default:-- desc:生产流选择的身份(1:一部车间,2:二部车间,3:三部车间。依次类推到八部车间,9:厂长。注:只有领导端点击生产流需要传此参数,且是必传)
-     * @return name:id type:int default:-- desc:订单ID
-     * @return name:order_no type:string default:-- desc:订单编号
-     * @return name:price_total type:string default:-- desc:合同金额
-     * @return name:deliver_at type:string default:-- desc:交付时间
-     * @return name:is_show_flow type:tinyint default:-- desc:是否显示流转按钮(0:不显示,1:显示)
-     * @return name:is_show_feedback type:tinyint default:-- desc:是否显示反馈按钮(0:不显示,1:显示)
-     * @return name:user_name type:string default:-- desc:销售人员姓名
-     * @return name:status type:string default:-- desc:发货状态(1:已完成未发货2:已发货)
-     */
-    public function order_list(){
-        $uid = $this->uid;
-        $flow_status = input('flow_status',-1);
-        $deliver_status = input('deliver_status',-1);
-        $is_library = input('is_library',0);
-        $key_type = input('key_type');
-        $keyword = input('keyword');
-        $start_time = input('start_time');
-        $end_time = input('end_time');
-        $page = input('page',1);
-        $pageSize = input('page_size',10);
-        $identity = input('identity');
-        if($keyword && empty($key_type)){
-            $this->error('参数错误');
-        }
-        $member_info = Db::name('store_member')->field('type,workshop')->where('id',$uid)->find();
-        if($identity){
-            if($identity == 9){
-                $type = 6;
-                $workshop = 0;
-            }else{
-                $type = 3;
-                $workshop = $identity;
-            }
-        }else{
-            $type = $member_info['type'];
-            $workshop = $member_info['workshop'];
-        }
-        $where = 'id > 0';
-        if($type == 3){
-            $where .= " and need_workshop like '%".$workshop."%'";
-        }elseif($type == 5){
-            $where .= ' and is_bcp = 1';
-        }elseif ($type == 4 || ($type == 7 && $is_library == 1)){
-            if($deliver_status == 0){
-                $where .= ' and status = 1';
-            }elseif($deliver_status == 1){
-                $where .= ' and status = 2';
-            }else{
-                $where .= ' and status > 0';
-            }
-        }
-        if($flow_status == 0){
-            if($type == 3){
-                $where .= " and no_flow_workshop like '%".$workshop."%'";
-            }elseif($type == 5){
-                $where .= ' and assistant_factory_is_flow = 0';
-            }elseif($type == 6){
-                $where .= ' and factory_is_flow = 0';
-            }
-        }elseif($flow_status == 1){
-            if($type == 3){
-                $where .= " and flow_workshop like '%".$workshop."%'";
-            }elseif($type == 5){
-                $where .= ' and assistant_factory_is_flow = 1';
-            }elseif($type == 6){
-                $where .= ' and factory_is_flow = 1';
-            }
-        }
-        if($keyword){
-            if($key_type == 1){     //销售人员
-                $sell_user_id = Db::name('store_member')->field('id')->where('type',2)->where('name',$keyword)->find();
-                if($sell_user_id){
-                    $where .= " and user_id = ".$sell_user_id['id'];
-                }else{
-                    $where .= " and user_id = 0";
-                }
-            }elseif ($key_type == 2){   //订单号
-                $where .= " and order_no = '{$keyword}'";
-            }elseif ($key_type == 3){   //交付时间
-                $where .= " and deliver_at = '{$keyword}'";
-            }
-        }
-        $field = 'id,user_id,order_no,price_total,deliver_at,status';
-        if($start_time && $end_time){
-            $start_time = $start_time.' 00:00:00';
-            $end_time = $end_time.' 24:00:00';
-            $order_list = Db::name('store_order')->field($field)->where($where)->whereBetweenTime('create_at',$start_time,$end_time)->order('id desc')->page($page,$pageSize)->select();
-        }else{
-            $order_list = Db::name('store_order')->field($field)->where($where)->order('id desc')->page($page,$pageSize)->select();
-        }
-        if(empty($order_list)){
-            $this->success('获取成功',array());
-        }
-        foreach ($order_list as &$value){
-            $value['is_show_flow'] = $this->is_show_flow($value['id']);
-            $value['user_name'] = Db::name('store_member')->where('id',$value['user_id'])->value('name');
-            //是否显示反馈按钮
-            $value['is_show_feedback'] = 0;
-            if($value['is_show_flow'] && $type == 3){
-                //查看今天是否已反馈
-                $case_id = Db::name('store_product_case')->where('workshop',$workshop)->where('order_id',$value['id'])->where('date',date('Y-m-d'))->value('id');
-                if(empty($case_id)){
-                    $value['is_show_flow'] = 1;
-                }
-            }
-            unset($value['user_id']);
-        }
-        $this->success('获取成功',$order_list);
-    }
-    //是否显示流转按钮
-    public function is_show_flow($order_id){
-        $uid = $this->uid;
-        $is_show_flow = 0;
-        //$order_id = 1;
-        $member_info = Db::name('store_member')->field('type,workshop')->where('id',$uid)->find();
-        $type = $member_info['type'];
-        $workshop = $member_info['workshop'];
-        $order_info = Db::name('store_order')->field('is_bcp,need_workshop,no_flow_workshop,assistant_factory_is_flow,factory_is_flow')->where('id',$order_id)->find();
-        if($type == 3){
-            if($order_info['no_flow_workshop']){
-                $no_flow_workshop = explode(',',$order_info['no_flow_workshop']);
-                if(in_array($workshop,$no_flow_workshop)){
-                    $need_workshop = explode(',',$order_info['need_workshop']);
-                    $key = array_search($workshop,$need_workshop);
-                    if($key == 0){
-                        $is_show_flow = 1;
-                    }else{
-                        $prev_workshop = $need_workshop[$key-1];
-                        if(!in_array($prev_workshop,$no_flow_workshop)){
-                            $is_show_flow = 1;
-                        }
-                    }
-                }
-            }
-        }elseif($type == 5){
-            if($order_info['assistant_factory_is_flow'] == 0){
-                $is_show_flow = 1;
-            }
-        }elseif($type == 6){
-            if($order_info['factory_is_flow'] == 0){
-                if($order_info['is_bcp'] == 0){
-                    $is_show_flow = 1;
-                }else{
-                    if($order_info['assistant_factory_is_flow'] == 1){
-                        $is_show_flow = 1;
-                    }
-                }
-            }
-        }
-        return $is_show_flow;
-    }
-    /**
-     * @title 订单详情
-     * @desc  订单详情
-     * @author HG
-     * @url /api/Order/order_detail
-     * @method GET
-     * @tag 订单详情
-     * @header name:Authorization require:1 desc:Token
-     * @param name:id type:int require:1 default:-- desc:订单ID
-     * @return name:id type:int default:-- desc:订单ID
-     * @return name:order_no type:string default:-- desc:订单编号
-     * @return name:goods_no type:string default:-- desc:货号
-     * @return name:goods_size type:string default:-- desc:尺寸
-     * @return name:goods_price type:string default:-- desc:单价
-     * @return name:box_size type:string default:-- desc:装率
-     * @return name:volume type:string default:-- desc:体积
-     * @return name:goods_num type:string default:-- desc:数量
-     * @return name:box_num type:string default:-- desc:箱数
-     * @return name:price_total type:string default:-- desc:总金额
-     * @return name:is_bcp type:string default:-- desc:是否是半成品(0:不是,1:是)
-     * @return name:bcp_image type:array default:-- desc:半成品图片地址(数组格式)
-     * @return name:description type:string default:-- desc:描述
-     * @return name:goods_image type:array default:-- desc:图片地址(数组格式)
-     * @return name:product_info type:array default:-- desc:生产信息(数组格式,name:名称,num:数量)
-     * @return name:client_name type:string default:-- desc:客户名称
-     * @return name:client_country type:string default:-- desc:国家
-     * @return name:client_mail type:string default:-- desc:客户邮箱
-     * @return name:client_phone type:string default:-- desc:客户手机
-     * @return name:client_contrac_no type:string default:-- desc:下单号(合同号)
-     * @return name:deliver_at type:string default:-- desc:交付日期
-     * @return name:receipt_file type:string default:-- desc:客户回执单地址
-     * @return name:compact_file type:string default:-- desc:原始合同地址
-     * @return name:status type:string default:-- desc:发货状态(1:已完成未发货2:已发货)
-     * @return name:is_show_flow type:tinyint default:-- desc:是否显示流转按钮(0:不显示,1:显示)
-     * @return name:is_show_feedback type:tinyint default:-- desc:是否显示反馈按钮(0:不显示,1:显示)
-     * @return name:is_already_flow type:tinyint default:-- desc:是否已流转(0:未流转,1:已流转。注:只有已流转的才显示流转信息模块)
-     * @return name:finish_at type:string default:-- desc:完成时间
-     * @return name:shipments_at type:string default:-- desc:发货时间
-     * @return name:flow_info type:array default:-- desc:流转信息(数组格式,identity:身份名称,name:负责人姓名,headimg:负责人头像,first_time:预计完成日期,second_time:实际完成日期,flow_status:流转状态(0:未流转,1:已流转)),feedback:反馈信息
-     * @return name:enter_storage_info type:array default:-- desc:入库信息(数组格式,client_contrac_no:合同单号,date:入库时间,num:入库数量(只有仓库人员才有值)
-     * @return name:out_storage_info type:array default:-- desc:出库信息(数组格式,client_contrac_no:合同单号,date:出库时间,num:出库数量(只有仓库人员才有值)
-     * @return name:deliver_info type:array default:-- desc:发货信息(数组格式,open_container:集装箱打开图片地址(数组),encasement:正在装箱图片地址(数组),pack_finish:pack_finish(数组),pack_tape:封锁集装箱图片地址(数组),pack_entirety:装箱整体拍照图片地址(数组),lading_ticket:提单票图片地址(数组),driver_signature:司机签字图片地址(数组),pack_person:装箱人员记录拍照图片地址(数组),receipt_signature:收货签字图片地址(数组)(只有仓库人员或者领导才有值)
-     * @return name:up_flow_at type:string default:-- desc:上层流转时间(为空就是没有不展示)
-     */
-    public function order_detail(){
-        $uid = $this->uid;
-        $id = input('id');
-        if(empty($id)){
-            $this->error('参数错误');
-        }
-        $member_info = Db::name('store_member')->field('type,workshop')->where('id',$uid)->find();
-        $type = $member_info['type'];
-        $workshop = $member_info['workshop'];
-        $field = 'id,order_no,goods_no,goods_size,goods_price,box_size,volume,goods_num,box_num,price_total,is_bcp,bcp_image,description,goods_image,product_info,client_name,client_country,client_mail,client_phone,client_contrac_no,deliver_at,receipt_file,compact_file,status,factory_is_flow,flow_at,create_at,finish_at,shipments_at';
-        $where = '';
-        if($type == 3){
-            $where .= "need_workshop like '%".$workshop."%'";
-        }elseif($type == 5){
-            $where .= 'is_bcp = 1';
-        }elseif ($type == 4){
-            $where .= 'status > 0';
-        }
-        $order_info = Db::name('store_order')->field($field)->where($where)->where('id',$id)->find();
-        if(empty($order_info)){
-            $this->error('订单信息有误');
-        }
-        $order_info['bcp_image'] = image_path($order_info['bcp_image']);
-        $order_info['goods_image'] = image_path($order_info['goods_image']);
-        $order_info['product_info'] = json_decode($order_info['product_info'],true);
-        $order_info['is_show_flow'] = $this->is_show_flow($order_info['id']);
-        //是否显示反馈按钮
-        $order_info['is_show_feedback'] = 0;
-        if($order_info['is_show_flow'] == 1 && $type == 3){
-            //查看是否已提交过反馈
-            $store_product_flow = Db::name('store_product_flow')->field('feedback')->where('order_id',$id)->where('workshop',$workshop)->find();
-            if(empty($store_product_flow['feedback'])){
-                $order_info['is_show_feedback'] = 1;
-            }
-        }
-        //是否已流转
-        $order_info['is_already_flow'] = 0;
-        if($type == 6 || $type == 7){
-            $order_info['is_already_flow'] = $order_info['factory_is_flow']?1:0;
-        }elseif($type == 3 && $order_info['factory_is_flow']){
-            $order_info['is_already_flow'] = Db::name('store_product_flow')->where('order_id',$id)->where('workshop',$workshop)->value('is_flow');
-        }
-        //流转信息
-        $order_info['flow_info'] = array();
-        if($order_info['is_already_flow']){
-            $factory_member_info = Db::name('store_member')->field('headimg,name')->where('type',6)->where('is_deleted',0)->find();
-            $factory_info['identity'] = '厂长';
-            $factory_info['name'] = $factory_member_info['name'];
-            $factory_info['headimg'] = $factory_member_info['headimg'];
-            $factory_info['first_time'] = date('Y-m-d',strtotime($order_info['create_at']));
-            $factory_info['second_time'] = date('Y-m-d',strtotime($order_info['flow_at']));
-            $factory_info['flow_status'] = 1;
-            $factory_info['feedback'] = '';
-            $order_info['flow_info'][0] = $factory_info;
-            $store_product_flow = Db::name('store_product_flow')->field('workshop,start_at,end_at,reality_at,is_flow,feedback')->where('order_id',$id)->select();
-            foreach ($store_product_flow as $key=>$flow_value){
-                $workshop_member_info = Db::name('store_member')->field('headimg,name')->where('type',3)->where('workshop',$flow_value['workshop'])->where('is_deleted',0)->find();
-                $workshop_info['identity'] = digital_conversion()[$flow_value['workshop']].'车间主任';
-                $workshop_info['name'] = $workshop_member_info['name'];
-                $workshop_info['headimg'] = $workshop_member_info['headimg'];
-                if($flow_value['is_flow']){
-                    $workshop_info['first_time'] = $flow_value['end_at'];
-                    $workshop_info['second_time'] = $flow_value['reality_at'];
-                }else{
-                    $workshop_info['first_time'] = $flow_value['start_at'];
-                    $workshop_info['second_time'] = $flow_value['end_at'];
-                }
-                $workshop_info['flow_status'] = $flow_value['is_flow'];
-                $workshop_info['feedback'] = $flow_value['feedback'];
-                $order_info['flow_info'][$key+1] = $workshop_info;
-            }
-        }
-        //入库信息
-        $order_info['enter_storage_info'] = array();
-        //出库信息
-        $order_info['out_storage_info'] = array();
-        if($type == 4){
-            $enter_storage = Db::name('store_inventory')->field('client_contrac_no,date,num')->where('order_id',$id)->where('type',1)->select();
-            if($enter_storage){
-                $order_info['enter_storage_info'] = $enter_storage;
-            }
-            $out_storage = Db::name('store_inventory')->field('client_contrac_no,date,num')->where('order_id',$id)->where('type',2)->select();
-            if($out_storage){
-                $order_info['out_storage_info'] = $out_storage;
-            }
-        }
-        //发货信息
-        $order_info['deliver_info'] = array();
-        if(in_array($type,[4,7])){
-            $store_deliver = Db::name('store_deliver')->field('open_container,encasement,pack_finish,pack_tape,pack_entirety,lading_ticket,driver_signature,pack_person,receipt_signature')->where('order_id',$id)->find();
-            if($store_deliver){
-                $store_deliver['open_container'] = image_path($store_deliver['open_container']);
-                $store_deliver['encasement'] = image_path($store_deliver['encasement']);
-                $store_deliver['pack_finish'] = image_path($store_deliver['pack_finish']);
-                $store_deliver['pack_tape'] = image_path($store_deliver['pack_tape']);
-                $store_deliver['pack_entirety'] = image_path($store_deliver['pack_entirety']);
-                $store_deliver['lading_ticket'] = image_path($store_deliver['lading_ticket']);
-                $store_deliver['driver_signature'] = image_path($store_deliver['driver_signature']);
-                $store_deliver['pack_person'] = image_path($store_deliver['pack_person']);
-                $store_deliver['receipt_signature'] = image_path($store_deliver['receipt_signature']);
-                $order_info['deliver_info'] = $store_deliver;
-            }
-        }
-        //上层流转时间
-        $order_info['up_flow_at'] = '';
-        if($type == 3){
-            if($order_info['is_show_flow'] || $order_info['is_already_flow']){
-                //找这个订单第一个流转ID
-                $product_flow_first = Db::name('store_product_flow')->field('id,workshop')->where('order_id',$id)->order('id asc')->find();
-                if($workshop != $product_flow_first['workshop']){
-                    $current_flow_id = Db::name('store_product_flow')->where('order_id',$id)->where('workshop',$workshop)->value('id');
-                    $order_info['up_flow_at'] = Db::name('store_product_flow')->where('id',$current_flow_id-1)->value('flow_at');
-                }
-            }
-        }
-        unset($order_info['factory_is_flow']);
-        unset($order_info['create_at']);
-        unset($order_info['flow_at']);
-        $this->success('获取成功',$order_info);
-    }
-    /**
-     * @title 生产反馈
-     * @desc 生产反馈
-     * @author QGF
-     * @url /api/Order/product_feedback
-     * @method POST
-     * @tag 生产反馈
-     * @header name:Authorization require:1 desc:Token
-     * @param name:id type:int require:1 default:-- desc:订单ID
-     * @param name:content type:string require:1 default:-- desc:反馈的内容
-     */
-    public function product_feedback(){
-        $uid = $this->uid;
-        $id = input('id');
-        $content = input('content');
-        if(empty($id) || empty($content)){
-            $this->error('参数错误');
-        }
-        $member_info = Db::name('store_member')->field('type,workshop')->where('id',$uid)->find();
-        $type = $member_info['type'];
-        $workshop = $member_info['workshop'];
-        if($type != 3){
-            $this->error('身份信息不正确');
-        }
-        $store_product_flow = Db::name('store_product_flow')->where('order_id',$id)->where('workshop',$workshop)->find();
-        if(empty($store_product_flow)){
-            $this->error('流转信息有误');
-        }
-        if($store_product_flow['feedback']){
-            $this->error('你已反馈过');
-        }
-        Db::name('store_product_flow')->where('id',$store_product_flow['id'])->update(array('feedback'=>$content));
-        $this->success('反馈成功');
-    }
-    /**
-     * @title 上传半成品
-     * @desc 上传半成品
-     * @author QGF
-     * @url /api/Order/submit_semi_finished
-     * @method POST
-     * @tag 上传半成品
-     * @header name:Authorization require:1 desc:Token
-     * @param name:id type:int require:1 default:-- desc:订单ID
-     * @param name:images type:string require:1 default:-- desc:半成品图片地址(多张以英文逗号(,)分隔)
-     */
-    public function submit_semi_finished(){
-        $uid = $this->uid;
-        $id = input('id');
-        $images = input('images');
-        if(empty($id) || empty($images)){
-            $this->error('参数错误');
-        }
-        $type = Db::name('store_member')->where('id',$uid)->value('type');
-        if($type != 5){
-            $this->error('该账号不是副厂长,不可上传半成品');
-        }
-        $order_info = Db::name('store_order')->field('id,bcp_image')->where('is_bcp',1)->where('id',$id)->find();
-        if(empty($order_info)){
-            $this->error('订单信息有误');
-        }
-        if($order_info['bcp_image']){
-            $this->error('你已上传过半成品');
-        }
-        Db::name('store_order')->where('id',$id)->update(array('bcp_image'=>$images,'assistant_factory_is_flow'=>1));
-        $this->success('上传成功');
-    }
-    /**
-     * @title 部件列表
-     * @desc 部件列表
-     * @author QGF
-     * @url /api/Order/parts_list
-     * @method GET
-     * @tag 部件列表
-     * @header name:Authorization require:0 desc:Token
-     * @return name:name type:string default:-- desc:部件名称
-     * @return name:id type:int default:-- desc:部件id
-     */
-    public function parts_list(){
-        $parts_list = Db::name('store_parts')->field('id,name')->where('status',1)->where('is_deleted',0)->order('id','desc')->select();
-        if(empty($parts_list)){
-            $this->success('暂无零部件',array());
-        }
-        foreach ($parts_list as &$value){
-
-        }
-        $this->success('获取成功',$parts_list);
-    }
-    /**
-     * @title 厂长流转
-     * @desc 厂长流转
-     * @author QGF
-     * @url /api/Order/factory_flow
-     * @method GET
-     * @tag 厂长流转
-     * @header name:Authorization require:0 desc:Token
-     * @param name:id type:int require:1 default:-- desc:订单ID
-     * @param name:flow_info type:json require:1 default:-- desc:流转信息。flow_info[0][workshop](车间(一车间就是1,二车间就是2))),flow_info[0][start_time](预计开始生产时间),flow_info[0][end_time](预计结束生产时间),flow_info[0][parts_info][0][parts_id](部件id),flow_info[0][parts_info][0][parts_num](部件数量),flow_info[0][parts_info][0][parts_price](部件价格)
-     */
-    public function factory_flow(){
-        $uid = $this->uid;
-        $id = input('id');
-        $flow_info = input('flow_info');
-        if(empty($id) || empty($flow_info)){
-            $this->error('参数错误');
-        }
-        if(!is_array($flow_info)){
-            $flow_info = json_decode($flow_info,true);
-            if(!is_array($flow_info)){
-                $this->success('流转信息参数有误');
-            }
-        }
-        $type = Db::name('store_member')->where('id',$uid)->value('type');
-        if($type != 6){
-            $this->error('该账号不是厂长,不可操作');
-        }
-        $order_info = Db::name('store_order')->field('id,order_no')->where('id',$id)->where('factory_is_flow',0)->find();
-        if(empty($order_info)){
-            $this->error('订单信息有误');
-        }
-        $need_workshop = '';
-        foreach($flow_info as $value){
-            $need_workshop .= $value['workshop'].',';
-            //一共需要的天数
-            $day = intval((strtotime($value['end_time'])-strtotime($value['start_time']))/86400);
-            //一共需要完成零部件的数量
-            $num = 0;
-            foreach($value['parts_info'] as $v){
-                $num += $v['parts_num'];
-            }
-            $data = array(
-                'order_id' => $id,
-                'order_no' => $order_info['order_no'],
-                'workshop' => $value['workshop'],
-                'start_at' => $value['start_time'],
-                'end_at' => $value['end_time'],
-                'day' => $day + 1,
-                'num' => $num,
-                'product_info' => json_encode($value['parts_info'])
-            );
-            Db::name('store_product_flow')->insert($data);
-        }
-        $need_workshop = substr($need_workshop, 0, -1);
-        Db::name('store_order')->where('id',$id)->update(array('factory_is_flow'=>1,'need_workshop'=>$need_workshop,'no_flow_workshop'=>$need_workshop,'flow_at'=>date('Y-m-d H:i:s')));
-        $this->success('流转成功');
-    }
-    /**
-     * @title 车间主任流转
-     * @desc 车间主任流转
-     * @author QGF
-     * @url /api/Order/workshop_factory_flow
-     * @method GET
-     * @tag 车间主任流转
-     * @header name:Authorization require:0 desc:Token
-     * @param name:id type:int require:1 default:-- desc:订单ID
-     */
-    public function workshop_factory_flow(){
-        $uid = $this->uid;
-        $id = input('id');
-        if(empty($id)){
-            $this->error('参数错误');
-        }
-        $is_show_flow = $this->is_show_flow($id);
-        if(empty($is_show_flow)){
-            $this->error('订单信息有误');
-        }
-        $member_info = Db::name('store_member')->field('type,workshop')->where('id',$uid)->find();
-        $workshop = $member_info['workshop'];
-        $store_product_flow = Db::name('store_product_flow')->field('id,start_at')->where('order_id',$id)->where('workshop',$workshop)->find();
-        $reality_day = intval((strtotime(date('Y-m-d'))-strtotime($store_product_flow['start_at']))/86400);
-        $update_data = array(
-            'reality_at' => date('Y-m-d'),
-            'reality_day' => $reality_day + 1,
-            'is_flow' => 1,
-            'flow_at' => date('Y-m-d H:i:s'),
-        );
-        Db::name('store_product_flow')->where('order_id',$id)->where('workshop',$workshop)->update($update_data);
-        $order_info = Db::name('store_order')->field('flow_workshop,no_flow_workshop')->where('id',$id)->find();
-        $no_flow_workshop_arr = explode(',',$order_info['no_flow_workshop']);
-        $no_flow_workshop = array_merge(array_diff($no_flow_workshop_arr, array($workshop)));
-        if($order_info['flow_workshop']){
-            $flow_workshop = $order_info['flow_workshop'].','.$workshop;
-        }else{
-            $flow_workshop = $workshop;
-        }
-        $order_update_data = array(
-            'flow_workshop' => $flow_workshop,
-            'no_flow_workshop' => '',
-        );
-        if(empty($no_flow_workshop)){
-            $order_update_data['status'] = 1;
-            $order_update_data['finish_at'] = date('Y-m-d H:i:s');
-        }else{
-            $order_update_data['no_flow_workshop'] = implode(',',$no_flow_workshop);
-        }
-        Db::name('store_order')->where('id',$id)->update($order_update_data);
-        $this->success('流转成功');
-    }
-    /**
-     * @title 提交入库/出库
-     * @desc 提交入库/出库
-     * @author QGF
-     * @url /api/Order/submit_inventory
-     * @method POST
-     * @tag 提交入库/出库
-     * @header name:Authorization require:1 desc:Token
-     * @param name:id type:int require:1 default:-- desc:订单ID
-     * @param name:type type:tinyint require:1 default:1 desc:类型(1:入库,2:出库。默认为1(入库))
-     * @param name:date type:string require:1 default:-- desc:入库/出库时间
-     * @param name:num type:int require:1 default:-- desc:入库/出库数量
-     * @param name:client_contrac_no type:string require:1 default:-- desc:合同号
-     */
-    public function submit_inventory(){
-        $uid = $this->uid;
-        $id = input('id');
-        $type = input('type',1);
-        $date = input('date');
-        $num = input('num');
-        $client_contrac_no = input('client_contrac_no');
-        if(empty($id) || empty($type) || empty($date) || empty($client_contrac_no) || empty($num)){
-            $this->error('参数错误');
-        }
-        $member_info = Db::name('store_member')->field('type,name')->where('id',$uid)->find();
-        $member_type = $member_info['type'];
-        if($member_type != 4){
-            $this->error('不是厂库人员');
-        }
-        $order_client_contrac_no = Db::name('store_order')->where('id',$id)->value('client_contrac_no');
-        if($order_client_contrac_no != $client_contrac_no){
-            $this->error('合同号不正确');
-        }
-        $data = array(
-            'user_id' => $uid,
-            'order_id' => $id,
-            'client_contrac_no' => $client_contrac_no,
-            'num' => $num,
-            'date' => $date,
-            'type' => $type
-        );
-        Db::name('store_inventory')->insert($data);
-        $this->success('提交成功');
-    }
-    /**
-     * @title 发货
-     * @desc 发货
-     * @author QGF
-     * @url /api/Order/deliver
-     * @method POST
-     * @tag 发货
-     * @header name:Authorization require:1 desc:Token
-     * @param name:id type:int require:1 default:-- desc:订单ID
-     * @param name:open_container type:string require:1 default:-- desc:集装箱打开图片地址,多张图片以英文逗号(,)分隔
-     * @param name:encasement type:string require:1 default:-- desc:正在装箱图片地址,多张图片以英文逗号(,)分隔
-     * @param name:pack_finish type:string require:1 default:-- desc:装箱完成图片地址,多张图片以英文逗号(,)分隔
-     * @param name:pack_tape type:string require:1 default:-- desc:封锁集装箱图片地址,多张图片以英文逗号(,)分隔
-     * @param name:pack_entirety type:string require:1 default:-- desc:装箱整体拍照图片地址,多张图片以英文逗号(,)分隔
-     * @param name:lading_ticket type:string require:1 default:-- desc:提单票图片地址,多张图片以英文逗号(,)分隔
-     * @param name:driver_signature type:string require:1 default:-- desc:司机签字图片地址,多张图片以英文逗号(,)分隔
-     * @param name:pack_person type:string require:1 default:-- desc:装箱人员记录拍照图片地址,多张图片以英文逗号(,)分隔
-     * @param name:receipt_signature type:string require:1 default:-- desc:收货签字图片地址,多张图片以英文逗号(,)分隔
-     */
-    public function deliver(){
-        $uid = $this->uid;
-        $id = input('id');
-        $open_container = input('open_container');
-        $encasement = input('encasement');
-        $pack_finish = input('pack_finish');
-        $pack_tape = input('pack_tape');
-        $pack_entirety = input('pack_entirety');
-        $lading_ticket = input('lading_ticket');
-        $driver_signature = input('driver_signature');
-        $pack_person = input('pack_person');
-        $receipt_signature = input('receipt_signature');
-        if(empty($id) || empty($open_container) || empty($encasement) || empty($pack_finish) || empty($pack_tape) || empty($pack_entirety) || empty($lading_ticket) || empty($driver_signature) || empty($pack_person) || empty($receipt_signature)){
-            $this->error('参数错误');
-        }
-        $member_info = Db::name('store_member')->field('type,name')->where('id',$uid)->find();
-        $member_type = $member_info['type'];
-        if($member_type != 4){
-            $this->error('不是厂库人员');
-        }
-        $order_status = Db::name('store_order')->where('id',$id)->value('status');
-        if($order_status != 1){
-            $this->error('订单状态有误');
-        }
-        $data = array(
-            'user_id' => $uid,
-            'order_id' => $id,
-            'open_container' => $open_container,
-            'encasement' => $encasement,
-            'pack_finish' => $pack_finish,
-            'pack_tape' => $pack_tape,
-            'pack_entirety' => $pack_entirety,
-            'lading_ticket' => $lading_ticket,
-            'driver_signature' => $driver_signature,
-            'pack_person' => $pack_person,
-            'receipt_signature' => $receipt_signature
-        );
-        Db::name('store_deliver')->insert($data);
-        Db::name('store_order')->where('id',$id)->update(array('status'=>2));
-        $this->success('发货成功');
-    }
-    /**
-     * @title 效率
-     * @desc 效率
-     * @author QGF
-     * @url /api/Order/efficiency
-     * @method GET
-     * @tag 效率
-     * @header name:Authorization require:0 desc:Token
-     * @param name:id type:int require:1 default:-- desc:订单ID
-     * @return name:task_completion type:int default:-- desc:任务完成情况
-     * @return name:task_completion_efficiency type:int default:-- desc:任务完成效率
-     * @return name:workshop_list type:array default:-- desc:生产部门列表(workshop:生产车间名称,status:生产状态名称)
-     */
-    public function efficiency(){
-        $uid = $this->uid;
-        $id = input('id');
-        if(empty($id)){
-            $this->error('参数错误');
-        }
-        $member_info = Db::name('store_member')->field('workshop,type')->where('id',$uid)->find();
-        $type = $member_info['type'];
-        $order_info = Db::name('store_order')->field('need_workshop,no_flow_workshop')->where('id',$id)->find();
-        $need_workshop_arr = explode(',',$order_info['need_workshop']);
-        $workshop_list = array();
-        //当前车间的工作状态
-        $workshop_status = 0;
-        foreach ($need_workshop_arr as $key=>&$value){
-            $workshop_list[$key]['workshop'] = workshop_arr()[$value];
-            //是否流转
-            $is_flow = Db::name('store_product_flow')->where('order_id',$id)->where('workshop',$value)->value('is_flow');
-            if($is_flow){
-                $workshop_list[$key]['status'] = '已经完成全部任务流转完成';
-                if($value == $member_info['workshop']){
-                    $workshop_status = 2;
-                }
-            }else{
-                $is_show_flow = 0;
-                if($order_info['no_flow_workshop']){
-                    $no_flow_workshop = explode(',',$order_info['no_flow_workshop']);
-                    if(in_array($value,$no_flow_workshop)){
-                        $need_workshop = explode(',',$order_info['need_workshop']);
-                        $key = array_search($value,$need_workshop);
-                        if($key == 0){
-                            $is_show_flow = 1;
-                        }else{
-                            $prev_workshop = $need_workshop[$key-1];
-                            if(!in_array($prev_workshop,$no_flow_workshop)){
-                                $is_show_flow = 1;
-                            }
-                        }
-                    }
-                }
-                if($is_show_flow == 1){
-                    $workshop_list[$key]['status'] = '正在努力生产中';
-                    if($value == $member_info['workshop']){
-                        $workshop_status = 1;
-                    }
-                }else{
-                    $workshop_list[$key]['status'] = '等待生产';
-                    if($value == $member_info['workshop']){
-                        $workshop_status = 0;
-                    }
-                }
-            }
-        }
-        //车间看到的是自己车间的效率,其他看到的是整个订单的效率
-        $task_completion = 0;
-        $task_completion_efficiency = 0;
-        if($type == 3 && $workshop_status > 0){
-            $product_flow = Db::name('store_product_flow')->where('order_id',$id)->where('workshop',$member_info['workshop'])->find();
-            $task_completion = intval($product_flow['reality_num']/$product_flow['num']*100);
-            if($workshop_status == 1){
-                $days_num = intval($product_flow['num']/$product_flow['day']); //每天需要完成的数量
-                $reality_day = intval((strtotime(date('Y-m-d'))-strtotime($product_flow['start_at']))/86400);
-                //查看今天是否提交生产
-                $product_case_id = Db::name('store_product_case')->where('order_id',$id)->where('workshop',$member_info['workshop'])->where('date',date('Y-m-d'))->value('id');
-                if($product_case_id){
-                    $reality_day = $reality_day + 1;
-                }
-                //实际每天完成的数量
-                $reality_days_num = intval($product_flow['reality_num']/$reality_day);
-                if($reality_days_num == $days_num){
-                    $task_completion_efficiency = 100;
-                }elseif($reality_days_num > $days_num){
-                    $task_completion_efficiency = 100 + intval(($reality_days_num - $days_num)/$days_num*100);
-                }else{
-                    $task_completion_efficiency = 100 - intval(($days_num - $reality_days_num)/$days_num*100);
-                }
-            }else{
-                if($product_flow['day'] == $product_flow['reality_day']){
-                    $task_completion_efficiency = 100;
-                }elseif ($product_flow['day'] > $product_flow['reality_day']){
-                    $task_completion_efficiency = 100 + intval(($product_flow['day'] - $product_flow['reality_day'])/$product_flow['day']*100);
-                }else{
-                    $task_completion_efficiency = 100 - intval(($product_flow['reality_day'] - $product_flow['day'])/$product_flow['day']*100);
-                }
-            }
-        }
-        if($type != 3){
-            //该订单一共需要生产的数量
-            $num = Db::name('store_product_flow')->where('order_id',$id)->sum('num');
-            //该订单实际已生产的数量
-            $reality_num = Db::name('store_product_flow')->where('order_id',$id)->sum('reality_num');
-            //该订单一共需要生产的天数
-            $day = Db::name('store_product_flow')->where('order_id',$id)->sum('day');
-            //该订单一共实际生产的天数
-            $reality_day = Db::name('store_product_flow')->where('order_id',$id)->sum('reality_day');
-
-            $order_status = Db::name('store_order')->where('id',$id)->value('status');
-            $task_completion = intval($reality_num/$num*100);
-            if($order_status == 0){
-                $days_num = intval($num/$day); //每天需要完成的数量
-                $reality_days_num = intval($reality_num/$reality_day); //实际每天完成的数量
-                if($days_num == $reality_days_num){
-                    $task_completion_efficiency = 100;
-                }elseif ($reality_days_num > $days_num){
-                    $task_completion_efficiency = 100 + intval(($reality_days_num - $days_num)/$days_num*100);
-                }else{
-                    $task_completion_efficiency = 100 - intval(($days_num - $reality_days_num)/$days_num*100);
-                }
-            }else{
-                if($day == $reality_day){
-                    $task_completion_efficiency = 100;
-                }elseif ($day > $reality_day){
-                    $task_completion_efficiency = 100 + intval(($day - $reality_day)/$day*100);
-                }else{
-                    $task_completion_efficiency = 100 - intval(($reality_day - $day)/$day*100);
-                }
-            }
-        }
-        $data = array(
-            'task_completion' => $task_completion,
-            'task_completion_efficiency' => $task_completion_efficiency,
-            'workshop_list' => $workshop_list
-        );
-        $this->success('获取成功',$data);
-    }
-}

+ 120 - 0
application/api/controller/Search.php

@@ -0,0 +1,120 @@
+<?php
+
+// +----------------------------------------------------------------------
+// | ThinkAdmin
+// +----------------------------------------------------------------------
+// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
+// +----------------------------------------------------------------------
+// | 官方网站: http://demo.thinkadmin.top
+// +----------------------------------------------------------------------
+// | 开源协议 ( https://mit-license.org )
+// +----------------------------------------------------------------------
+// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
+// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
+// +----------------------------------------------------------------------
+
+namespace app\api\controller;
+
+use app\api\controller\Base;
+use think\Db;
+use think\Model;
+/**
+ * @title 搜索管理
+ * @controller Search
+ * @group member
+ */
+class Search extends Base
+{
+    /**
+     * @title 搜索推荐(新闻)
+     * @desc 搜索推荐
+     * @author QGF
+     * @url /api/Search/news_search_recommend
+     * @method GET
+     * @tag 搜索推荐
+     * @header name:Authorization require:1 desc:Token
+     * @return name:-- type:array default:-- desc:搜索推荐词语列表(title:词语名称)
+     */
+    public function news_search_recommend(){
+        //查找新闻标题
+        $list = Db::name('store_goods')->field('title')->where('status',1)->where('is_deleted',0)->page(1,10)->order(['is_top'=>'desc','sort'=>'desc','id'=>'desc'])->select();
+        $this->success('获取成功',$list);
+    }
+    /**
+     * @title 搜索历史(新闻)
+     * @desc 搜索历史
+     * @author QGF
+     * @url /api/Search/news_search_history
+     * @method GET
+     * @tag 搜索历史
+     * @header name:Authorization require:0 desc:Token
+     *  @return name:-- type:array default:-- desc:搜索历史词语列表(name:词语名称)
+     */
+    public function news_search_history(){
+        $uid = $this->get_uid();
+        $keyword_list = Db::name('store_search_keyword')->field('name')->where('user_id',$uid)->where('type',1)->select();
+        $this->success('获取成功',$keyword_list);
+    }
+    /**
+     * @title 删除搜索历史(新闻)
+     * @desc 删除搜索历史
+     * @author QGF
+     * @url /api/Search/deleted_news_search_history
+     * @method GET
+     * @tag 删除搜索历史
+     * @header name:Authorization require:1 desc:Token
+     *  @return name:-- type:array default:-- desc:搜索历史词语列表(name:词语名称)
+     */
+    public function deleted_news_search_history(){
+        $this->check_login();
+        $uid = $this->uid;
+        Db::name('store_search_keyword')->where('user_id',$uid)->where('type',1)->delete();
+        $this->success('删除成功');
+    }
+    /**
+     * @title 搜索推荐(咨询)
+     * @desc 搜索推荐
+     * @author QGF
+     * @url /api/Search/consult_search_recommend
+     * @method GET
+     * @tag 搜索推荐
+     * @header name:Authorization require:1 desc:Token
+     * @return name:-- type:array default:-- desc:搜索推荐词语列表(title:词语名称)
+     */
+    public function consult_search_recommend(){
+        //查找新闻标题
+        $list = Db::name('store_consult')->field('title')->where('status',1)->where('is_deleted',0)->page(1,10)->order(['is_recommend'=>'desc','sort'=>'desc','id'=>'desc'])->select();
+        $this->success('获取成功',$list);
+    }
+    /**
+     * @title 搜索历史(咨询)
+     * @desc 搜索历史
+     * @author QGF
+     * @url /api/Search/consult_search_history
+     * @method GET
+     * @tag 搜索历史
+     * @header name:Authorization require:0 desc:Token
+     *  @return name:-- type:array default:-- desc:搜索历史词语列表(name:词语名称)
+     */
+    public function consult_search_history(){
+        $uid = $this->get_uid();
+        $keyword_list = Db::name('store_search_keyword')->field('name')->where('user_id',$uid)->where('type',2)->select();
+        $this->success('获取成功',$keyword_list);
+    }
+    /**
+     * @title 删除搜索历史(咨询)
+     * @desc 删除搜索历史
+     * @author QGF
+     * @url /api/Search/deleted_consult_search_history
+     * @method GET
+     * @tag 删除搜索历史
+     * @header name:Authorization require:1 desc:Token
+     *  @return name:-- type:array default:-- desc:搜索历史词语列表(name:词语名称)
+     */
+    public function deleted_consult_search_history(){
+        $this->check_login();
+        $uid = $this->uid;
+        Db::name('store_search_keyword')->where('user_id',$uid)->where('type',2)->delete();
+        $this->success('删除成功');
+    }
+}

+ 3 - 6
application/api/controller/Upload.php

@@ -90,9 +90,9 @@ class Upload extends Base
         $data=$this->getPolicy($type.'/');
         $this->success('操作成功',$data);
     }
-    protected $id= 'LTAI5tF4i8gTzxgP2pybHWdo';
-    protected $key= 'r0YxVLtsPfUl71Etp74sOHuckSwYaZ';
-    protected $host = 'https://shiquangongyi.oss-cn-beijing.aliyuncs.com';
+    protected $id= 'LTAI5tDNASTjwM9mDSGckY3N';
+    protected $key= 'nAKY40GjGz4hf5A9RpoffDmaYWNL3y';
+    protected $host = 'https://zjth2021.oss-cn-beijing.aliyuncs.com';
 
     public function getPolicy($path,$maxSize=5000000){
         $now = time();
@@ -129,7 +129,4 @@ class Upload extends Base
         $expiration = substr($expiration, 0, $pos);
         return $expiration."Z";
     }
-
-
-
 }

+ 31 - 18
application/common.php

@@ -1,17 +1,31 @@
 <?php
+/**
+ * @param string $address 地址
+ * @return array
+ */
 
-//获取订单编号
-function get_order_sn(){
-    $order_id_main = date('YmdHis') . rand(10000000,99999999);
-    $order_id_len = strlen($order_id_main);
-    $order_id_sum = 0;
-    for($i=0; $i<$order_id_len; $i++){
-        $order_id_sum += (int)(substr($order_id_main,$i,1));
+
+/**
+ * 秒转换为天
+ */
+function get_stay_time($remain_time, $is_hour = 1, $is_minutes = 1)
+{
+    $day = floor($remain_time / (3600*24));
+    $day = $day > 0 ? $day.'天' : '';
+    $hour = floor(($remain_time % (3600*24)) / 3600);
+    $hour = $hour > 0 ? $hour.'小时' : '';
+    if($is_hour && $is_minutes) {
+        $minutes = floor((($remain_time % (3600*24)) % 3600) / 60);
+        $minutes = $minutes > 0 ? $minutes.'分钟' : '';
+        return $day.$hour.$minutes;
+    }
+
+    if($hour) {
+        return $day.$hour;
     }
-    $osn = $order_id_main . str_pad((100 - $order_id_sum % 100) % 100,2,'0',STR_PAD_LEFT);
-    return $osn;
+    return $day;
 }
-//获取全图片地址 $image_data 返回数组
+//获取全图片地址 $image_data
 function image_path($image_data){
     if(empty($image_data)){
         return $image_data;
@@ -25,13 +39,12 @@ function image_path($image_data){
     }
     return $image_res;
 }
-function workshop_arr(){
-    return array(1=>'生产一车间',2=>'生产二车间',3=>'生产三车间',4=>'生产四车间',5=>'生产五车间',6=>'生产六车间',7=>'生产七车间',8=>'生产八车间');
-}
-function member_type_arr(){
-    return array(3=>'车间主任',4=>'仓库人员',5=>'副厂长',6=>'厂长',7=>'领导');
-}
-function digital_conversion(){
-    return array(1=>'一',2=>'二',3=>'三',4=>'四',5=>'五',6=>'六',7=>'七',8=>'八');
+//通过user_id判断是用户还是媒体(返回1:用户 2:媒体)
+function user_type($user_id){
+    $type = 1;
+    if($user_id < 500){
+        $type = 2;
+    }
+    return $type;
 }
 

+ 13 - 38
application/store/controller/Parts.php → application/store/controller/Background.php

@@ -16,23 +16,22 @@
 namespace app\store\controller;
 
 use library\Controller;
-use think\Db;
 
 /**
- * 零部件管理管理
+ * 背景图管理
  * Class GoodsCate
  * @package app\store\controller
  */
-class Parts extends Controller
+class Background extends Controller
 {
     /**
      * 绑定数据表
      * @var string
      */
-    protected $table = 'store_parts';
+    protected $table = 'store_background';
 
     /**
-     * 零部件管理管理
+     * 背景图管理
      * @auth true
      * @menu true
      * @throws \think\Exception
@@ -43,37 +42,13 @@ class Parts extends Controller
      */
     public function index()
     {
-        $this->title = '零部件管理管理';
-        $query = $this->_query($this->table)->like('name')->equal('status');
+        $this->title = '背景图管理';
+        $query = $this->_query($this->table);
         $query->where(['is_deleted' => '0'])->order('sort desc,id desc')->page();
     }
-    /**
-     * 表单数据处理
-     * @param array $data
-     * @throws \think\Exception
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     * @throws \think\exception\PDOException
-     */
-    protected function _form_filter(&$data)
-    {
 
-        if ($this->request->isGet()) {
-
-        } elseif ($this->request->isPost()) {
-            if(isset($data['id'])){
-                $id = Db::name('store_parts')->where('id','<>',$data['id'])->where('is_deleted',0)->where('name',$data['name'])->value('id');
-            }else{
-                $id = Db::name('store_parts')->where('name',$data['name'])->where('is_deleted',0)->value('id');
-            }
-            if($id){
-                $this->error('不可添加相同的金额');
-            }
-        }
-    }
     /**
-     * 添加零部件管理
+     * 添加背景图
      * @auth true
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
@@ -83,12 +58,12 @@ class Parts extends Controller
      */
     public function add()
     {
-        $this->title = '添加零部件管理';
+        $this->title = '添加背景图';
         $this->_form($this->table, 'form');
     }
 
     /**
-     * 编辑零部件管理
+     * 编辑背景图
      * @auth true
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
@@ -98,12 +73,12 @@ class Parts extends Controller
      */
     public function edit()
     {
-        $this->title = '编辑零部件管理';
+        $this->title = '编辑背景图';
         $this->_form($this->table, 'form');
     }
 
     /**
-     * 禁用零部件管理
+     * 禁用背景图
      * @auth true
      * @throws \think\Exception
      * @throws \think\exception\PDOException
@@ -114,7 +89,7 @@ class Parts extends Controller
     }
 
     /**
-     * 启用零部件管理
+     * 启用背景图
      * @auth true
      * @throws \think\Exception
      * @throws \think\exception\PDOException
@@ -125,7 +100,7 @@ class Parts extends Controller
     }
 
     /**
-     * 删除零部件管理
+     * 删除背景图
      * @auth true
      * @throws \think\Exception
      * @throws \think\exception\PDOException

+ 13 - 38
application/store/controller/Award.php → application/store/controller/Banner.php

@@ -16,23 +16,22 @@
 namespace app\store\controller;
 
 use library\Controller;
-use think\Db;
 
 /**
- * 奖励金额管理
+ * 轮播图管理
  * Class GoodsCate
  * @package app\store\controller
  */
-class Award extends Controller
+class Banner extends Controller
 {
     /**
      * 绑定数据表
      * @var string
      */
-    protected $table = 'store_award_amount';
+    protected $table = 'StoreBanner';
 
     /**
-     * 奖励金额管理
+     * 轮播图管理
      * @auth true
      * @menu true
      * @throws \think\Exception
@@ -43,37 +42,13 @@ class Award extends Controller
      */
     public function index()
     {
-        $this->title = '奖励金额管理';
-        $query = $this->_query($this->table)->like('amount')->equal('status');
+        $this->title = '轮播图管理';
+        $query = $this->_query($this->table)->like('title')->equal('status');
         $query->where(['is_deleted' => '0'])->order('sort desc,id desc')->page();
     }
-    /**
-     * 表单数据处理
-     * @param array $data
-     * @throws \think\Exception
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     * @throws \think\exception\PDOException
-     */
-    protected function _form_filter(&$data)
-    {
 
-        if ($this->request->isGet()) {
-
-        } elseif ($this->request->isPost()) {
-            if(isset($data['id'])){
-                $id = Db::name('store_award_amount')->where('id','<>',$data['id'])->where('is_deleted',0)->where('amount',$data['amount'])->value('id');
-            }else{
-                $id = Db::name('store_award_amount')->where('amount',$data['amount'])->where('is_deleted',0)->value('id');
-            }
-            if($id){
-                $this->error('不可添加相同的金额');
-            }
-        }
-    }
     /**
-     * 添加奖励金额
+     * 添加轮播图
      * @auth true
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
@@ -83,12 +58,12 @@ class Award extends Controller
      */
     public function add()
     {
-        $this->title = '添加奖励金额';
+        $this->title = '添加轮播图';
         $this->_form($this->table, 'form');
     }
 
     /**
-     * 编辑奖励金额
+     * 编辑轮播图
      * @auth true
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
@@ -98,12 +73,12 @@ class Award extends Controller
      */
     public function edit()
     {
-        $this->title = '编辑奖励金额';
+        $this->title = '编辑轮播图';
         $this->_form($this->table, 'form');
     }
 
     /**
-     * 禁用奖励金额
+     * 禁用轮播图
      * @auth true
      * @throws \think\Exception
      * @throws \think\exception\PDOException
@@ -114,7 +89,7 @@ class Award extends Controller
     }
 
     /**
-     * 启用奖励金额
+     * 启用轮播图
      * @auth true
      * @throws \think\Exception
      * @throws \think\exception\PDOException
@@ -125,7 +100,7 @@ class Award extends Controller
     }
 
     /**
-     * 删除奖励金额
+     * 删除轮播图
      * @auth true
      * @throws \think\Exception
      * @throws \think\exception\PDOException

+ 3 - 4
application/store/controller/Complain.php

@@ -51,8 +51,8 @@ class Complain extends Controller
         if($this->request->request('phone')){
             $where[]=['m.phone','like','%'.$this->request->request('phone').'%'];
         }
-        if($this->request->request('nickname')){
-            $where[]=['m.nickname','like','%'.$this->request->request('nickname').'%'];
+        if($this->request->request('name')){
+            $where[]=['m.name','like','%'.$this->request->request('name').'%'];
         }
         if($this->request->request('question')){
             $where[]=['a.question','like','%'.$this->request->request('question').'%'];
@@ -73,12 +73,11 @@ class Complain extends Controller
      */
     protected function _index_page_filter(array &$data)
     {
-
         $mids = array_unique(array_merge(array_column($data, 'user_id'), array_column($data, 'from_mid')));
         $memberList = Db::name('StoreMember')->whereIn('id', $mids)->select();
         foreach ($data as &$vo) {
             if($vo['images']){
-                $vo['images'] = explode('|',$vo['images']);
+                $vo['images'] = image_path($vo['images']);
             }
             list($vo['member'], $vo['from_member'], $vo['list']) = [[], [], []];
 

+ 179 - 0
application/store/controller/Consult.php

@@ -0,0 +1,179 @@
+<?php
+
+// +----------------------------------------------------------------------
+// | ThinkAdmin
+// +----------------------------------------------------------------------
+// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
+// +----------------------------------------------------------------------
+// | 官方网站: http://demo.thinkadmin.top
+// +----------------------------------------------------------------------
+// | 开源协议 ( https://mit-license.org )
+// +----------------------------------------------------------------------
+// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
+// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
+// +----------------------------------------------------------------------
+
+namespace app\store\controller;
+
+use library\Controller;
+use library\tools\Data;
+use think\Db;
+
+/**
+ * 咨询管理
+ * Class Consult
+ * @package app\store\controller
+ */
+class Consult extends Controller
+{
+    /**
+     * 指定数据表
+     * @var string
+     */
+    protected $table = 'StoreConsult';
+
+    /**
+     * 咨询管理
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function index()
+    {
+        $this->title = '咨询管理';
+        $query = $this->_query($this->table)->equal('status,cate_id,type')->like('title');
+        $query->where(['is_deleted' => '0'])->order(['is_recommend'=>'desc','sort'=>'desc','id'=>'desc'])->page();
+    }
+
+    /**
+     * 数据列表处理
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    protected function _index_page_filter(&$data)
+    {
+        foreach ($data as &$vo) {
+            $vo['cate_name'] = Db::name('store_consult_cate')->where('id',$vo['cate_id'])->value('title');
+            if($vo['type'] == 1){
+                $media_info = Db::name('store_media')->field('logo,title')->where('id',$vo['user_id'])->find();
+                $vo['media_logo'] = $media_info['logo'];
+                $vo['media_title'] = $media_info['title'];
+            }else{
+                $media_info = Db::name('store_member')->field('headimg,name')->where('id',$vo['user_id'])->find();
+                $vo['media_logo'] = $media_info['headimg'];
+                $vo['media_title'] = $media_info['name'];
+            }
+        }
+        $this->cate_arr = Db::name('store_consult_cate')->field('id,title')->where('status',1)->where('is_deleted',0)->select();
+    }
+
+    /**
+     * 添加咨询
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function add()
+    {
+        $this->title = '添加咨询信息';
+        $this->cate_arr = Db::name('store_consult_cate')->field('id,title')->where('status',1)->where('is_deleted',0)->select();
+        $this->media_arr = Db::name('store_media')->field('id,title')->where('status',1)->where('is_deleted',0)->select();
+        $this->is_recommend = array('0'=>'不推荐','1'=>'推荐');
+        $this->_form($this->table, 'form');
+    }
+
+    /**
+     * 编辑咨询
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function edit()
+    {
+        $this->title = '编辑咨询信息';
+        $this->_form($this->table, 'form');
+    }
+
+    /**
+     * 表单数据处理
+     * @param array $data
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    protected function _form_filter(&$data)
+    {
+        // 生成活动ID
+        if ($this->request->isGet()) {
+            $this->cate_arr = Db::name('store_consult_cate')->field('id,title')->where('status',1)->where('is_deleted',0)->select();
+            $this->media_arr = Db::name('store_media')->field('id,title')->where('status',1)->where('is_deleted',0)->select();
+            //获取用户
+            if(isset($data['type']) && $data['type'] == 2){
+                $data['user_name'] = Db::name('store_member')->where('id',$data['user_id'])->value('name');
+            }
+            $this->is_recommend = array('0'=>'不推荐','1'=>'推荐');
+        } elseif ($this->request->isPost()) {
+            if (empty($data['image'])) $this->error('展示图片不能为空,请上传图片');
+            $data['user_id'] = $data['media_id'];
+        }
+    }
+
+    /**
+     * 表单结果处理
+     * @param boolean $result
+     */
+    protected function _form_result($result)
+    {
+        if ($result && $this->request->isPost()) {
+            $this->success('活动编辑成功!', 'javascript:history.back()');
+        }
+    }
+
+    /**
+     * 禁用咨询
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function forbid()
+    {
+        $this->_save($this->table, ['status' => '0']);
+    }
+
+    /**
+     * 启用咨询
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function resume()
+    {
+        $this->_save($this->table, ['status' => '1']);
+    }
+
+    /**
+     * 删除咨询
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function remove()
+    {
+        $this->_delete($this->table);
+    }
+
+}

+ 113 - 0
application/store/controller/ConsultCate.php

@@ -0,0 +1,113 @@
+<?php
+
+// +----------------------------------------------------------------------
+// | ThinkAdmin
+// +----------------------------------------------------------------------
+// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
+// +----------------------------------------------------------------------
+// | 官方网站: http://demo.thinkadmin.top
+// +----------------------------------------------------------------------
+// | 开源协议 ( https://mit-license.org )
+// +----------------------------------------------------------------------
+// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
+// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
+// +----------------------------------------------------------------------
+
+namespace app\store\controller;
+
+use library\Controller;
+
+/**
+ * 咨询分类管理
+ * Class GoodsCate
+ * @package app\store\controller
+ */
+class ConsultCate extends Controller
+{
+    /**
+     * 绑定数据表
+     * @var string
+     */
+    protected $table = 'StoreConsultCate';
+
+    /**
+     * 咨询分类管理
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function index()
+    {
+        $this->title = '咨询分类管理';
+        $query = $this->_query($this->table)->like('title')->equal('status');
+        $query->where(['is_deleted' => '0'])->order('sort desc,id desc')->page();
+    }
+
+    /**
+     * 添加咨询分类
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function add()
+    {
+        $this->title = '添加咨询分类';
+        $this->_form($this->table, 'form');
+    }
+
+    /**
+     * 编辑咨询分类
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function edit()
+    {
+        $this->title = '编辑咨询分类';
+        $this->_form($this->table, 'form');
+    }
+
+    /**
+     * 禁用咨询分类
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function forbid()
+    {
+        $this->_save($this->table, ['status' => '0']);
+    }
+
+    /**
+     * 启用咨询分类
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function resume()
+    {
+        $this->_save($this->table, ['status' => '1']);
+    }
+
+    /**
+     * 删除咨询分类
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function remove()
+    {
+        $this->_delete($this->table);
+    }
+
+}

+ 25 - 88
application/store/controller/Goods.php

@@ -20,7 +20,7 @@ use library\tools\Data;
 use think\Db;
 
 /**
- * 活动信息管理
+ * 新闻管理
  * Class Goods
  * @package app\store\controller
  */
@@ -33,7 +33,7 @@ class Goods extends Controller
     protected $table = 'StoreGoods';
 
     /**
-     * 活动信息管理
+     * 新闻管理
      * @auth true
      * @menu true
      * @throws \think\Exception
@@ -44,9 +44,9 @@ class Goods extends Controller
      */
     public function index()
     {
-        $this->title = '活动信息管理';
+        $this->title = '新闻管理';
         $query = $this->_query($this->table)->equal('status,cate_id')->like('title');
-        $query->where(['is_deleted' => '0'])->order('sort desc,id desc')->page();
+        $query->where(['is_deleted' => '0'])->order(['is_top'=>'desc','sort'=>'desc','id'=>'desc'])->page();
     }
 
     /**
@@ -58,19 +58,17 @@ class Goods extends Controller
      */
     protected function _index_page_filter(&$data)
     {
-        $this->clist = Db::name('StoreGoodsCate')->where(['is_deleted' => '0', 'status' => '1'])->select();
-        $list = Db::name('StoreGoodsList')->where('status', '1')->whereIn('goods_id', array_unique(array_column($data, 'id')))->select();
         foreach ($data as &$vo) {
-            list($vo['list'], $vo['cate']) = [[], []];
-            foreach ($list as $goods) if ($goods['goods_id'] === $vo['id']) array_push($vo['list'], $goods);
-            foreach ($this->clist as $cate) if ($cate['id'] === $vo['cate_id']) $vo['cate'] = $cate;
-            $vo['coupon'] = Db::name('store_coupon_config')->where('id',$vo['coupon_id'])->value('title');
-            $vo['platform'] = platform()[$vo['platform_id']];
+            $vo['cate_name'] = Db::name('store_goods_cate')->where('id',$vo['cate_id'])->value('title');
+            $media_info = Db::name('store_media')->field('logo,title')->where('id',$vo['media_id'])->find();
+            $vo['media_logo'] = $media_info['logo'];
+            $vo['media_title'] = $media_info['title'];
         }
+        $this->cate_arr = Db::name('store_goods_cate')->field('id,title')->where('status',1)->where('is_deleted',0)->select();
     }
 
     /**
-     * 添加活动信息
+     * 添加新闻
      * @auth true
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
@@ -80,14 +78,15 @@ class Goods extends Controller
      */
     public function add()
     {
-        $this->no_edit = input('no_edit')?input('no_edit'):0;
-        $this->title = '添加活动信息';
-        $this->isAddMode = '1';
+        $this->title = '添加新闻信息';
+        $this->cate_arr = Db::name('store_goods_cate')->field('id,title')->where('status',1)->where('is_deleted',0)->select();
+        $this->media_arr = Db::name('store_media')->field('id,title')->where('status',1)->where('is_deleted',0)->select();
+        $this->is_top = array('0'=>'不置顶','1'=>'置顶');
         $this->_form($this->table, 'form');
     }
 
     /**
-     * 编辑活动信息
+     * 编辑新闻
      * @auth true
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
@@ -97,14 +96,8 @@ class Goods extends Controller
      */
     public function edit()
     {
-        $this->no_edit = input('no_edit')?input('no_edit'):0;
-        $this->title = '编辑活动信息';
-        $this->isAddMode = '0';
-        if($this->no_edit == 1){
-            $this->_form($this->table, 'no_edit');
-        }else{
-            $this->_form($this->table, 'form');
-        }
+        $this->title = '编辑新闻信息';
+        $this->_form($this->table, 'form');
     }
 
     /**
@@ -119,69 +112,13 @@ class Goods extends Controller
     protected function _form_filter(&$data)
     {
         // 生成活动ID
-        if (empty($data['id'])) $data['id'] = Data::uniqidNumberCode(14);
         if ($this->request->isGet()) {
-            $fields = 'goods_spec,goods_id,status,price_market market,price_selling selling,number_virtual `virtual`,number_express express';
-            $defaultValues = Db::name('StoreGoodsList')->where(['goods_id' => $data['id']])->column($fields);
-            $this->defaultValues = json_encode($defaultValues, JSON_UNESCAPED_UNICODE);
-            $this->cates = Db::name('StoreGoodsCate')->where(['is_deleted' => '0', 'status' => '1'])->order('sort desc,id desc')->select();
-            $this->platform = platform();
-            $this->nature = array('1'=>'一天','2'=>'每天');
-            $this->dining_type = array('1'=>'早餐','2'=>'午餐','3'=>'下午茶','4'=>'晚餐','5'=>'宵夜');
-            $this->is_recommend = array('0'=>'不是','1'=>'是');
-            $this->coupons = Db::name('store_coupon_config')->where(['is_deleted' => '0', 'status' => '1'])->order('id desc')->select();
-            $this->map_lev = 18;
-            if(empty($data['longitude'])){
-                $data['longitude'] = '118.362905';
-                $this->map_lev = 16;
-            }
-            if(empty($data['latitude'])){
-                $data['latitude'] = '35.108186';
-            }
+            $this->cate_arr = Db::name('store_goods_cate')->field('id,title')->where('status',1)->where('is_deleted',0)->select();
+            $this->media_arr = Db::name('store_media')->field('id,title')->where('status',1)->where('is_deleted',0)->select();
+            $this->is_top = array('0'=>'不置顶','1'=>'置顶');
         } elseif ($this->request->isPost()) {
-            if (empty($data['logo'])) $this->error('活动LOGO不能为空,请上传图片');
-            if (empty($data['image'])) $this->error('活动展示图片不能为空,请上传图片');
-            if($data['start_time'] >= $data['end_time']){
-                $this->error('结束时间需大于开始时间');
-            }
-
-            if(empty($data['province']) || empty($data['city']) || empty($data['county'])){
-                $this->error('请选择活动地址');
-            }
-            if(empty($data['address'])){
-                $this->error('请填写活动地址');
-            }
-            $data['is_breakfast'] = 0;
-            $data['is_lunch'] = 0;
-            $data['is_tea'] = 0;
-            $data['is_supper'] = 0;
-            $data['is_night_meal'] = 0;
-            if($data['dining_type'] == 1){
-                $data['is_breakfast'] = 1;
-            }elseif($data['dining_type'] == 2){
-                $data['is_lunch'] = 1;
-            }elseif($data['dining_type'] == 3){
-                $data['is_tea'] = 1;
-            }elseif($data['dining_type'] == 4){
-                $data['is_supper'] = 1;
-            }elseif($data['dining_type'] == 5){
-                $data['is_night_meal'] = 1;
-            }
-            //是否为推荐活动
-            if($data['is_recommend'] == 1){
-                Db::name('store_goods')->where('is_recommend',1)->update(array('is_recommend'=>0));
-            }
-            //查看是否为当天修改
-            if(isset($data['update_at'])){
-                if(date('Y-m-d',strtotime($data['update_at'])) < date('Y-m-d')){
-                    $data['number_sales'] = 0;
-                    $data['number_stock'] = $data['number'];
-                    $data['is_sell_out'] = 0;
-                }
-            }else{
-                $data['number_stock'] = $data['number'];
-            }
-            $data['update_at'] = date('Y-m-d H:i:s');
+            if (empty($data['image'])) $this->error('展示图片不能为空,请上传图片');
+            $data['user_id'] = $data['media_id'];
         }
     }
 
@@ -197,7 +134,7 @@ class Goods extends Controller
     }
 
     /**
-     * 禁用活动信息
+     * 禁用新闻
      * @auth true
      * @throws \think\Exception
      * @throws \think\exception\PDOException
@@ -208,7 +145,7 @@ class Goods extends Controller
     }
 
     /**
-     * 启用活动信息
+     * 启用新闻
      * @auth true
      * @throws \think\Exception
      * @throws \think\exception\PDOException
@@ -219,7 +156,7 @@ class Goods extends Controller
     }
 
     /**
-     * 删除活动信息
+     * 删除新闻
      * @auth true
      * @throws \think\Exception
      * @throws \think\exception\PDOException

+ 113 - 0
application/store/controller/GoodsCate.php

@@ -0,0 +1,113 @@
+<?php
+
+// +----------------------------------------------------------------------
+// | ThinkAdmin
+// +----------------------------------------------------------------------
+// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
+// +----------------------------------------------------------------------
+// | 官方网站: http://demo.thinkadmin.top
+// +----------------------------------------------------------------------
+// | 开源协议 ( https://mit-license.org )
+// +----------------------------------------------------------------------
+// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
+// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
+// +----------------------------------------------------------------------
+
+namespace app\store\controller;
+
+use library\Controller;
+
+/**
+ * 新闻分类管理
+ * Class GoodsCate
+ * @package app\store\controller
+ */
+class GoodsCate extends Controller
+{
+    /**
+     * 绑定数据表
+     * @var string
+     */
+    protected $table = 'StoreGoodsCate';
+
+    /**
+     * 新闻分类管理
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function index()
+    {
+        $this->title = '新闻分类管理';
+        $query = $this->_query($this->table)->like('title')->equal('status');
+        $query->where(['is_deleted' => '0'])->order('sort desc,id desc')->page();
+    }
+
+    /**
+     * 添加新闻分类
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function add()
+    {
+        $this->title = '添加新闻分类';
+        $this->_form($this->table, 'form');
+    }
+
+    /**
+     * 编辑新闻分类
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function edit()
+    {
+        $this->title = '编辑新闻分类';
+        $this->_form($this->table, 'form');
+    }
+
+    /**
+     * 禁用新闻分类
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function forbid()
+    {
+        $this->_save($this->table, ['status' => '0']);
+    }
+
+    /**
+     * 启用新闻分类
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function resume()
+    {
+        $this->_save($this->table, ['status' => '1']);
+    }
+
+    /**
+     * 删除新闻分类
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function remove()
+    {
+        $this->_delete($this->table);
+    }
+
+}

+ 113 - 0
application/store/controller/Media.php

@@ -0,0 +1,113 @@
+<?php
+
+// +----------------------------------------------------------------------
+// | ThinkAdmin
+// +----------------------------------------------------------------------
+// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
+// +----------------------------------------------------------------------
+// | 官方网站: http://demo.thinkadmin.top
+// +----------------------------------------------------------------------
+// | 开源协议 ( https://mit-license.org )
+// +----------------------------------------------------------------------
+// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
+// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
+// +----------------------------------------------------------------------
+
+namespace app\store\controller;
+
+use library\Controller;
+
+/**
+ * 新闻媒体管理
+ * Class GoodsCate
+ * @package app\store\controller
+ */
+class Media extends Controller
+{
+    /**
+     * 绑定数据表
+     * @var string
+     */
+    protected $table = 'store_media';
+
+    /**
+     * 新闻媒体管理
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function index()
+    {
+        $this->title = '新闻媒体管理';
+        $query = $this->_query($this->table)->like('title')->equal('status');
+        $query->where(['is_deleted' => '0'])->order('sort desc,id desc')->page();
+    }
+
+    /**
+     * 添加新闻媒体
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function add()
+    {
+        $this->title = '添加新闻媒体';
+        $this->_form($this->table, 'form');
+    }
+
+    /**
+     * 编辑新闻媒体
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function edit()
+    {
+        $this->title = '编辑新闻媒体';
+        $this->_form($this->table, 'form');
+    }
+
+    /**
+     * 禁用新闻媒体
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function forbid()
+    {
+        $this->_save($this->table, ['status' => '0']);
+    }
+
+    /**
+     * 启用新闻媒体
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function resume()
+    {
+        $this->_save($this->table, ['status' => '1']);
+    }
+
+    /**
+     * 删除新闻媒体
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function remove()
+    {
+        $this->_delete($this->table);
+    }
+
+}

+ 11 - 117
application/store/controller/Member.php

@@ -16,7 +16,6 @@
 namespace app\store\controller;
 
 use library\Controller;
-use think\Db;
 
 /**
  * 会员信息管理
@@ -44,7 +43,7 @@ class Member extends Controller
     public function index()
     {
         $this->title = '会员信息管理';
-        $query = $this->_query($this->table)->where('is_deleted',0)->where('type',1)->equal('workshop')->like('name,phone');
+        $query = $this->_query($this->table)->where('is_deleted',0)->like('nickname,phone');
         $query->dateBetween('create_at')->order('id desc')->page();
     }
     /**
@@ -57,127 +56,22 @@ class Member extends Controller
     protected function _index_page_filter(&$data)
     {
         foreach ($data as $k=>&$v){
-            $v['workshop'] = workshop_arr()[$v['workshop']];
+
         }
-        $this->workshop_arr = workshop_arr();
     }
-    //删除工人
+    //删除货主
     public function remove()
     {
         $this->_save($this->table, ['is_deleted' => '1']);
     }
-    /**
-     * 导入员工
-     * @auth true
-     * @menu true
-     * @throws \think\Exception
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     * @throws \think\exception\PDOException
-     */
-    public function lead(){
-        $file = request()->file('file');
-        $file_size = $_FILES['file']['size'];
-        if ($file_size > 5 * 1024 * 1024) {
-            $this->error('文件大小不能超过5M');
-        }
-        //限制上传表格类型
-        $fileExtendName = substr(strrchr($_FILES['file']["name"], '.'), 1);
-        if ($fileExtendName != 'xls') {
-            $this->error('必须为excel表格,且必须为xls格式!');
-        }
-        $dir = dirname(realpath(dirname($_SERVER['SCRIPT_FILENAME']))) . '/public/upload';
-        if(!file_exists($dir)){
-            //检查是否有该文件夹,如果没有就创建,并给予最高权限
-            mkdir($dir, 0700,true);
-        }
-        $info = $file->move($dir);
-        if (empty($info)) {
-            $this->error('文件过大或格式不正确导致上传失败-_-!');
-        }
-        //获取上传到后台的文件名
-        $fileName = $info->getSaveName();
-        $filePath = dirname(realpath(dirname($_SERVER['SCRIPT_FILENAME'])))."/public/upload/{$fileName}";
-        $reader = \PHPExcel_IOFactory::createReader('Excel2007');
-        $filename = str_replace(strrchr($_FILES['file']["name"], "."),"",$_FILES['file']["name"]);
-        //载入excel文件
-        $excel = $reader->load($filePath);
-        $list = $excel->getActiveSheet()->toArray();
-        $data = array();
-        foreach ($list as $key=>$li){
-            if($key != 0){
-                $data[] = $li;
-            }
-        }
-        if(empty($data)){
-            $this->error('表格中无数据');
-        }
-        //查看是否有重复的员工或者归属车间填写有误的
-        $is_repetition = 0;
-        $is_mistake = 0;
-        foreach ($data as $value){
-            $member_id = Db::name('store_member')->where('phone',$value[1])->value('id');
-            if($is_repetition == 0 && $member_id){
-                $is_repetition = 1;
-            }
-            if($is_mistake == 0 && array_search($value[2],workshop_arr()) == 0){
-                $is_mistake = 1;
-            }
-        }
-        if($is_repetition){
-            $this->error('表格中员工已导入过,请确认无误后再进行导入');
-        }
-        if($is_mistake){
-            $this->error('表格中归属车间有误,请确认无误后再进行导入');
-        }
-        foreach ($data as $v){
-            $insert_data = array(
-                'headimg' => 'http://pic.gujiafuwu.com/0909a49add201291/a20687c6493d3eab.jpg',
-                'name' => $v[0],
-                'phone' => $v[1],
-                'workshop' => array_search($v[2],workshop_arr())
-            );
-            Db::name('store_member')->insert($insert_data);
-        }
-        $this->success('导入成功');
-    }
-    //导出模板
-    public function export(){
-        $data = array(
-            array(
-                'content'=>'张三',
-                'job_type' => '18263693519',
-                'plan_time' => '生产一车间'
-            )
-        );
-        $field=array(
-            'A' => array('content', '员工姓名'),
-            'B' => array('job_type', '员工手机号'),
-            'C' => array('plan_time', '归属车间'),
-        );
-        $this->phpExcelList($field,$data,'导入员工模板');
+    //禁用货主
+    public function forbid()
+    {
+        $this->_save($this->table, ['status' => '0']);
     }
-    public function phpExcelList($field=[],$list=[],$title='文件'){
-        $PHPExcel=new \PHPExcel();
-        $PHPSheet=$PHPExcel->getActiveSheet();
-        $PHPSheet->setTitle('demo'); //给当前活动sheet设置名称
-        foreach($list as $key=>$value)
-        {
-            foreach($field as $k=>$v){
-                if($key == 0){
-                    $PHPSheet= $PHPExcel->getActiveSheet()->setCellValue($k.'1',$v[1]);
-                }
-                $i=$key+2;
-                $PHPExcel->getActiveSheet()->setCellValue($k . $i, $value[$v[0]]);
-
-            }
-        }
-        $PHPWriter = \PHPExcel_IOFactory::createWriter($PHPExcel,'Excel2007'); //按照指定格式生成Excel文件,
-        // Redirect output to a client’s web browser (Excel5)
-        header('Content-Type: application/vnd.ms-excel'); // 告诉浏览器生成一个excel05版的表格
-        header("Content-Disposition: attachment;filename={$title}.xls"); //告诉浏览器输出文件的名称
-        header('Cache-Control: max-age=0'); //禁止缓存
-        $PHPWriter->save("php://output"); //输出到浏览器
+    //启用货主
+    public function resume()
+    {
+        $this->_save($this->table, ['status' => '1']);
     }
 }

+ 61 - 0
application/store/controller/Message.php

@@ -0,0 +1,61 @@
+<?php
+
+// +----------------------------------------------------------------------
+// | ThinkAdmin
+// +----------------------------------------------------------------------
+// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
+// +----------------------------------------------------------------------
+// | 官方网站: http://demo.thinkadmin.top
+// +----------------------------------------------------------------------
+// | 开源协议 ( https://mit-license.org )
+// +----------------------------------------------------------------------
+// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
+// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
+// +----------------------------------------------------------------------
+
+namespace app\store\controller;
+
+use library\Controller;
+
+/**
+ * 短信发送管理
+ * Class Message
+ * @package app\store\controller
+ */
+class Message extends Controller
+{
+    /**
+     * 绑定数据表
+     * @var string
+     */
+    protected $table = 'StoreMemberSms';
+
+    /**
+     * 短信发送管理
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function index()
+    {
+        $this->title = '短信发送管理';
+        $query = $this->_query($this->table)->like('phone,content,result');
+        $query->dateBetween('create_at')->order('id desc')->page();
+    }
+
+    /**
+     * 删除短信记录
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function remove()
+    {
+        $this->_delete($this->table);
+    }
+
+}

+ 62 - 60
application/store/controller/SalesPersonnel.php → application/store/controller/Notice.php

@@ -17,21 +17,22 @@ namespace app\store\controller;
 
 use library\Controller;
 use think\Db;
+
 /**
- * 销售人员管理
+ * 系统消息管理
  * Class GoodsCate
  * @package app\store\controller
  */
-class SalesPersonnel extends Controller
+class Notice extends Controller
 {
     /**
      * 绑定数据表
      * @var string
      */
-    protected $table = 'StoreMember';
+    protected $table = 'store_notice';
 
     /**
-     * 销售人员管理
+     * 系统消息管理
      * @auth true
      * @menu true
      * @throws \think\Exception
@@ -42,24 +43,53 @@ class SalesPersonnel extends Controller
      */
     public function index()
     {
-        $this->title = '销售人员列表';
-        $query = $this->_query($this->table)->where('is_deleted',0)->where('type',2)->like('name,phone');
-        $query->dateBetween('create_at')->order('id desc')->page();
+        $this->title = '系统消息管理';
+        $query = $this->_query($this->table)->like('title')->equal('status');
+        $query->where(['is_deleted' => '0'])->order('sort desc,id desc')->page();
     }
 
     /**
-     * 数据列表处理
-     * @param array $data
+     * 添加系统消息
+     * @auth true
+     * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\ModelNotFoundException
      * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
      */
-    protected function _index_page_filter(&$data)
+    public function add()
     {
-        foreach ($data as $k=>&$v){
-
+        $this->title = '添加系统消息';
+        if($this->request->isPost()){
+            //全部用户发方
+            $user_ids=Db::table('store_member')->where('news_switch',1)->where('status',1)->where('is_deleted',0)->column('id');
+            foreach ($user_ids as $k=>$v){
+                $data=[];
+                $data['user_id'] = $v;
+                $data['content'] = $this->request->post('title');
+                Db::name('store_news')->insert($data);
+            }
+            Db::name('store_notice')->insert(array('title'=>$this->request->post('title')));
+            $this->success('添加成功');
+        }else{
+            $this->_form($this->table, 'form');
         }
     }
+
+    /**
+     * 编辑系统消息
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function edit()
+    {
+        $this->title = '编辑系统消息';
+        $this->_form($this->table, 'form');
+    }
     /**
      * 表单数据处理
      * @param array $data
@@ -71,80 +101,52 @@ class SalesPersonnel extends Controller
      */
     protected function _form_filter(&$data)
     {
-        if ($this->request->isGet()) {
-
-        }elseif ($this->request->isPost()){
-            if(!preg_match("/^1[23456789]\d{9}$/", $data['phone'])){
-                $this->error('手机号格式不正确');
-            }
-            //查看手机号是否已有账号
-            $member_id = Db::name('store_member')->where('phone',$data['phone'])->value('id');
-            if($member_id){
-                $this->error('该手机号已有账号');
+        if($this->request->isPost()){
+            //全部用户发方
+            $user_ids=Db::table('store_member')->where('status',1)->where('is_deleted',0)->column('id');
+            foreach ($user_ids as $k=>$v){
+                $data=[];
+                $data['user_id'] = $v;
+                $data['content'] = $this->request->post('title');
+                Db::name('store_news')->insert($data);
             }
-            $data['headimg'] = 'http://pic.gujiafuwu.com/0909a49add201291/a20687c6493d3eab.jpg';
-            $data['type'] = 2;
+
+        }else{
+            $this->member=Db::table('store_member')->field('id,name')->where('status',1)->where('is_deleted',0)->select();
+            $this->member_count=count($this->member);
         }
     }
     /**
-     * 表单结果处理
-     * @param boolean $result
-     */
-    protected function _form_result($result)
-    {
-        $phone = Db::name('store_member')->where('id',$result)->value('phone');
-        $system_user_data = array(
-            'username' => $phone,
-            'authorize'=> 1,
-            'password' => md5( substr($phone,-6)),
-            'member_id' => $result
-        );
-        Db::name('system_user')->insert($system_user_data);
-    }
-    /**
-     * 添加销售人员
+     * 禁用系统消息
      * @auth true
      * @throws \think\Exception
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
      * @throws \think\exception\PDOException
      */
-    public function add()
+    public function forbid()
     {
-        $this->title = '添加销售人员';
-        $this->_form($this->table, 'form');
+        $this->_save($this->table, ['status' => '0']);
     }
 
     /**
-     * 编辑销售人员
+     * 启用系统消息
      * @auth true
      * @throws \think\Exception
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
      * @throws \think\exception\PDOException
      */
-    public function edit()
+    public function resume()
     {
-        $this->title = '编辑销售人员';
-        $this->_form($this->table, 'form');
+        $this->_save($this->table, ['status' => '1']);
     }
 
     /**
-     * 删除销售人员
+     * 删除系统消息
      * @auth true
      * @throws \think\Exception
      * @throws \think\exception\PDOException
      */
     public function remove()
     {
-        $id_arr = explode(',',$_POST['id']);
-        //删除系统用户
-        foreach ($id_arr as $value){
-            Db::name('system_user')->where('member_id',$value)->update(array('is_deleted'=>1));
-        }
-        $this->_save($this->table, ['is_deleted' => '1']);
+        $this->_delete($this->table);
     }
 
 }

+ 0 - 136
application/store/controller/Order.php

@@ -1,136 +0,0 @@
-<?php
-
-// +----------------------------------------------------------------------
-// | ThinkAdmin
-// +----------------------------------------------------------------------
-// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
-// +----------------------------------------------------------------------
-// | 官方网站: http://demo.thinkadmin.top
-// +----------------------------------------------------------------------
-// | 开源协议 ( https://mit-license.org )
-// +----------------------------------------------------------------------
-// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
-// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
-// +----------------------------------------------------------------------
-
-namespace app\store\controller;
-
-use library\Controller;
-use library\tools\Data;
-use think\Db;
-
-/**
- * 订单记录管理
- * Class Order
- * @package app\store\controller
- */
-class Order extends Controller
-{
-    /**
-     * 绑定数据表
-     * @var string
-     */
-    protected $table = 'StoreOrder';
-
-    /**
-     * 订单记录管理
-     * @auth true
-     * @menu true
-     * @throws \think\Exception
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     * @throws \think\exception\PDOException
-     */
-    public function index()
-    {
-        $this->title = '订单记录管理';
-        $member_id = session('user.member_id');
-        $this->member_id = $member_id;
-        if($member_id){
-            $this->_query($this->table)->where('user_id',$member_id)->like('phone')->like('order_no,goods_no')->equal('client_name,client_phone,client_contrac_no')->order('id desc')->page();
-        }else{
-            $this->_query($this->table)->like('phone')->like('order_no,goods_no')->equal('client_name,client_phone,client_contrac_no')->order('id desc')->page();
-        }
-    }
-
-    /**
-     * 订单列表处理
-     * @param array $data
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    protected function _index_page_filter(array &$data)
-    {
-        foreach ($data as &$vo) {
-            $vo['user_name'] = Db::name('store_member')->where('id',$vo['user_id'])->value('name');
-            $vo['user_phone'] = Db::name('store_member')->where('id',$vo['user_id'])->value('phone');
-            $vo['goods_image'] = image_path($vo['goods_image']);
-            $vo['product_info'] = json_decode($vo['product_info'],true);
-            $vo['bcp_image'] = image_path($vo['bcp_image']);
-        }
-    }
-    /**
-     * 添加订单信息
-     * @auth true
-     * @throws \think\Exception
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     * @throws \think\exception\PDOException
-     */
-    public function add()
-    {
-        $this->title = '添加订单信息';
-        $this->isAddMode = '1';
-        $this->_form($this->table, 'form');
-    }
-    /**
-     * 表单数据处理
-     * @param array $data
-     * @throws \think\Exception
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     * @throws \think\exception\PDOException
-     */
-    protected function _form_filter(&$data)
-    {
-
-        if ($this->request->isGet()) {
-
-
-        } elseif ($this->request->isPost()) {
-            if(empty($data['receipt_file'])){
-                $this->error('请上传客户回执单');
-            }
-            if(empty($data['compact_file'])){
-                $this->error('请上传原始合同');
-            }
-            $list = json_decode($data['lists'],true);
-            if(empty($list)){
-                $this->error('请填写生产信息');
-            }
-            $product_info = array();
-            foreach ($list as $key=>$value){
-                $product_info[$key]['name'] = $value[0]['name'];
-                $product_info[$key]['num'] = $value[0]['num'];
-            }
-            $data['product_info'] = json_encode($product_info);
-            $data['order_no'] = get_order_sn();
-            $data['user_id'] = session('user.member_id');
-        }
-    }
-
-    /**
-     * 表单结果处理
-     * @param boolean $result
-     */
-    protected function _form_result($result)
-    {
-        if ($result && $this->request->isPost()) {
-            $this->success('订单编辑成功!', 'javascript:history.back()');
-        }
-    }
-}

+ 0 - 160
application/store/controller/Principal.php

@@ -1,160 +0,0 @@
-<?php
-
-// +----------------------------------------------------------------------
-// | ThinkAdmin
-// +----------------------------------------------------------------------
-// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
-// +----------------------------------------------------------------------
-// | 官方网站: http://demo.thinkadmin.top
-// +----------------------------------------------------------------------
-// | 开源协议 ( https://mit-license.org )
-// +----------------------------------------------------------------------
-// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
-// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
-// +----------------------------------------------------------------------
-
-namespace app\store\controller;
-
-use library\Controller;
-use think\Db;
-/**
- * 负责人管理
- * Class GoodsCate
- * @package app\store\controller
- */
-class Principal extends Controller
-{
-    /**
-     * 绑定数据表
-     * @var string
-     */
-    protected $table = 'StoreMember';
-
-    /**
-     * 负责人管理
-     * @auth true
-     * @menu true
-     * @throws \think\Exception
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     * @throws \think\exception\PDOException
-     */
-    public function index()
-    {
-        $this->title = '负责人列表';
-        $query = $this->_query($this->table)->where('is_deleted',0)->where('type','in',[3,4,5,6,7])->like('name,phone');
-        $query->dateBetween('create_at')->order('id desc')->page();
-    }
-
-    /**
-     * 数据列表处理
-     * @param array $data
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    protected function _index_page_filter(&$data)
-    {
-        foreach ($data as $k=>&$v){
-            $v['type'] = member_type_arr()[$v['type']];
-            if($v['workshop']){
-                $v['workshop'] = workshop_arr()[$v['workshop']];
-            }else{
-                $v['workshop'] = '--';
-            }
-        }
-    }
-    /**
-     * 表单数据处理
-     * @param array $data
-     * @throws \think\Exception
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     * @throws \think\exception\PDOException
-     */
-    protected function _form_filter(&$data)
-    {
-        if ($this->request->isGet()) {
-            $this->type = member_type_arr();
-            $this->workshop = workshop_arr();
-        }elseif ($this->request->isPost()){
-            if(!preg_match("/^1[23456789]\d{9}$/", $data['phone'])){
-                $this->error('手机号格式不正确');
-            }
-            //查看手机号是否已有账号
-            $member_id = Db::name('store_member')->where('phone',$data['phone'])->where('is_deleted',0)->value('id');
-            if($member_id){
-                $this->error('该手机号已有账号');
-            }
-            $where = 'type = '.$data['type'];
-            if($data['type'] == 3){
-                $where .= ' and workshop = '.$data['workshop'];
-            }else{
-                $data['workshop'] = 0;
-            }
-            $user_id = Db::name('store_member')->where($where)->where('is_deleted',0)->value('id');
-            if($user_id){
-                $this->error('该类型的负责人已有账号');
-            }
-            $data['headimg'] = 'http://pic.gujiafuwu.com/0909a49add201291/a20687c6493d3eab.jpg';
-            $data['password'] = md5(substr($data['phone'],-6));
-            $data['decode_password'] = substr($data['phone'],-6);
-        }
-    }
-    /**
-     * 表单结果处理
-     * @param boolean $result
-     */
-    protected function _form_result($result)
-    {
-
-    }
-    /**
-     * 添加负责人
-     * @auth true
-     * @throws \think\Exception
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     * @throws \think\exception\PDOException
-     */
-    public function add()
-    {
-        $this->title = '添加负责人';
-        $this->_form($this->table, 'form');
-    }
-
-    /**
-     * 编辑负责人
-     * @auth true
-     * @throws \think\Exception
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     * @throws \think\exception\PDOException
-     */
-    public function edit()
-    {
-        $this->title = '编辑负责人';
-        $this->_form($this->table, 'form');
-    }
-
-    /**
-     * 删除负责人
-     * @auth true
-     * @throws \think\Exception
-     * @throws \think\exception\PDOException
-     */
-    public function remove()
-    {
-        $id_arr = explode(',',$_POST['id']);
-        //删除系统用户
-        foreach ($id_arr as $value){
-            Db::name('system_user')->where('member_id',$value)->update(array('is_deleted'=>1));
-        }
-        $this->_save($this->table, ['is_deleted' => '1']);
-    }
-
-}

+ 113 - 0
application/store/controller/Versions.php

@@ -0,0 +1,113 @@
+<?php
+
+// +----------------------------------------------------------------------
+// | ThinkAdmin
+// +----------------------------------------------------------------------
+// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
+// +----------------------------------------------------------------------
+// | 官方网站: http://demo.thinkadmin.top
+// +----------------------------------------------------------------------
+// | 开源协议 ( https://mit-license.org )
+// +----------------------------------------------------------------------
+// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
+// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
+// +----------------------------------------------------------------------
+
+namespace app\store\controller;
+
+use library\Controller;
+
+/**
+ * 版本管理
+ * Class GoodsCate
+ * @package app\store\controller
+ */
+class Versions extends Controller
+{
+    /**
+     * 绑定数据表
+     * @var string
+     */
+    protected $table = 'store_versions';
+
+    /**
+     * 版本管理
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function index()
+    {
+        $this->title = '版本管理';
+        $query = $this->_query($this->table)->like('title')->equal('status');
+        $query->where(['is_deleted' => '0'])->order('sort desc,id desc')->page();
+    }
+
+    /**
+     * 添加版本
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function add()
+    {
+        $this->title = '添加版本';
+        $this->_form($this->table, 'form');
+    }
+
+    /**
+     * 编辑版本
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function edit()
+    {
+        $this->title = '编辑版本';
+        $this->_form($this->table, 'form');
+    }
+
+    /**
+     * 禁用版本
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function forbid()
+    {
+        $this->_save($this->table, ['status' => '0']);
+    }
+
+    /**
+     * 启用版本
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function resume()
+    {
+        $this->_save($this->table, ['status' => '1']);
+    }
+
+    /**
+     * 删除版本
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function remove()
+    {
+        $this->_delete($this->table);
+    }
+
+}

+ 23 - 0
application/store/view/background/form.html

@@ -0,0 +1,23 @@
+<form onsubmit="return false;" action="{:request()->url()}" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off">
+
+    <div class="layui-card-body">
+
+        <div class="layui-row margin-bottom-15">
+            <label class="layui-col-xs2 think-form-label">背景图图片</label>
+            <label class="layui-col-xs8 think-form-group-left">
+                <input name="logo" required value='{$vo.logo|default=""}' placeholder="请上传背景图图片" class="layui-input">
+            </label>
+            <a class="layui-col-xs2 layui-btn think-form-group-right" data-file="btn" data-field="logo" data-type="png,jpg,gif">
+                <i class="layui-icon layui-icon-upload"></i> 上传图片
+            </a>
+        </div>
+
+    </div>
+
+    <div class="hr-line-dashed"></div>
+    <div class="layui-form-item text-center">
+        {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
+        <button class="layui-btn" type='submit'>保存数据</button>
+        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗?" data-close>取消编辑</button>
+    </div>
+</form>

+ 35 - 0
application/store/view/background/index.html

@@ -0,0 +1,35 @@
+{extend name='admin@main'}
+
+
+{block name="content"}
+<div class="think-box-shadow">
+    <table class="layui-table margin-top-10" lay-skin="line">
+        {notempty name='list'}
+        <thead>
+        <tr>
+            <th class='text-left nowrap'>背景图图片</th>
+            <th class="text-center">操作</th>
+        </tr>
+        </thead>
+        {/notempty}
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='text-left nowrap'>
+                <img data-tips-image="{$vo.logo|default=''}"  src="{$vo.logo|default=''}" width="100px">
+            </td>
+
+            </td>
+            <td class='text-center nowrap'>
+                {if auth("store/background/edit")}
+                <a data-title="编辑背景图" class="layui-btn layui-btn-sm" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
+                {/if}
+
+            </td>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+    {empty name='list'}<span class="notdata">没有记录哦</span>{/empty}
+</div>
+{/block}

+ 30 - 0
application/store/view/banner/form.html

@@ -0,0 +1,30 @@
+<form onsubmit="return false;" action="{:request()->url()}" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off">
+
+    <div class="layui-card-body">
+
+        <div class="layui-row margin-bottom-15">
+            <label class="layui-col-xs2 think-form-label">轮播图图片</label>
+            <label class="layui-col-xs8 think-form-group-left">
+                <input name="logo" required value='{$vo.logo|default=""}' placeholder="请上传轮播图图片" class="layui-input">
+            </label>
+            <a class="layui-col-xs2 layui-btn think-form-group-right" data-file="btn" data-field="logo" data-type="png,jpg,gif">
+                <i class="layui-icon layui-icon-upload"></i> 上传图片
+            </a>
+        </div>
+
+        <div class="layui-row margin-bottom-15">
+            <label class="layui-col-xs2 think-form-label">轮播图名称</label>
+            <label class="layui-col-xs10">
+                <input name="title" required value='{$vo.title|default=""}' placeholder="请输入轮播图名称" class="layui-input">
+            </label>
+        </div>
+
+    </div>
+
+    <div class="hr-line-dashed"></div>
+    <div class="layui-form-item text-center">
+        {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
+        <button class="layui-btn" type='submit'>保存数据</button>
+        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗?" data-close>取消编辑</button>
+    </div>
+</form>

+ 79 - 0
application/store/view/banner/index.html

@@ -0,0 +1,79 @@
+{extend name='admin@main'}
+
+{block name="button"}
+{if auth("store/banner/add")}
+<button data-modal='{:url("add")}' data-title="添加轮播图" class='layui-btn layui-btn-sm layui-btn-primary'>添加轮播图</button>
+{/if}
+{if auth("store/banner/remove")}
+<button data-action='{:url("remove")}' data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除轮播图</button>
+{/if}
+{/block}
+
+{block name="content"}
+<div class="think-box-shadow">
+    {include file='banner/index_search'}
+    <table class="layui-table margin-top-10" lay-skin="line">
+        {notempty name='list'}
+        <thead>
+        <tr>
+            <th class='list-table-check-td think-checkbox'>
+                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
+            </th>
+            <th class='list-table-sort-td'>
+                <button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
+            </th>
+            <th class='text-left nowrap'>轮播图名称</th>
+            <th class='text-left nowrap'>轮播图图片</th>
+            <th class="text-center">状态</th>
+            <th class="text-center">添加时间</th>
+            <th class="text-center">操作</th>
+            <th></th>
+        </tr>
+        </thead>
+        {/notempty}
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='list-table-check-td think-checkbox'>
+                <input class="list-check-box" value='{$vo.id}' type='checkbox'>
+            </td>
+            <td class='list-table-sort-td'>
+                <input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input">
+            </td>
+            <td class='text-left nowrap'>
+
+                {$vo.title|default=''}
+
+            </td>
+            <td class='text-left nowrap'>
+                <img data-tips-image="{$vo.logo|default=''}"  src="{$vo.logo|default=''}" width="50px">
+            </td>
+
+            <td class='text-center nowrap'>
+                {eq name='vo.status' value='0'}<span class="layui-badge">已禁用</span>{else}<span class="layui-badge layui-bg-green">使用中</span>{/eq}<br>
+            </td>
+            <td class='text-center nowrap'>{$vo.create_at|format_datetime}</td>
+            <td class='text-center nowrap'>
+
+                {if auth("store/banner/edit")}
+                <a data-title="编辑轮播图" class="layui-btn layui-btn-sm" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
+                {/if}
+
+                {if $vo.status eq 1 and auth("store/banner/forbid")}
+                <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('forbid')}" data-value="id#{$vo.id};status#0">禁 用</a>
+                {elseif auth("store/banner/resume")}
+                <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('resume')}" data-value="id#{$vo.id};status#1">启 用</a>
+                {/if}
+
+                {if auth("store/banner/remove")}
+                <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除数据吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}">删 除</a>
+                {/if}
+
+            </td>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+    {empty name='list'}<span class="notdata">没有记录哦</span>{/empty}
+</div>
+{/block}

+ 30 - 0
application/store/view/banner/index_search.html

@@ -0,0 +1,30 @@
+<fieldset>
+    <legend>条件搜索</legend>
+    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">轮播图名称</label>
+            <div class="layui-input-inline">
+                <input name="title" value="{$Think.get.title|default=''}" placeholder="请输入轮播图名称" class="layui-input">
+            </div>
+        </div>
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">使用状态</label>
+            <div class="layui-input-inline">
+                <select class="layui-select" name="status">
+                    {foreach [''=>'- 全部状态 -','1'=>'使用中的轮播图','0'=>'已禁用的轮播图'] as $k=>$v}
+                    <!--{eq name='Think.get.status' value='$k.""'}-->
+                    <option selected value="{$k}">{$v}</option>
+                    <!--{else}-->
+                    <option value="{$k}">{$v}</option>
+                    <!--{/eq}-->
+                    {/foreach}
+                </select>
+            </div>
+        </div>
+
+        <div class="layui-form-item layui-inline">
+            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
+        </div>
+    </form>
+    <script>form.render()</script>
+</fieldset>

+ 2 - 2
application/store/view/complain/index.html

@@ -26,8 +26,8 @@
                 <img data-tips-image style="width:40px;height:40px" src="{$vo.member.headimg|default=''}" class="margin-right-5 text-top">
                 {/notempty}
                 <div class="inline-block">
-                    会员昵称:{$vo.member.nickname|default='--'}<br>
-                    会员手机:{$vo.member.phone|default='--'}<br>
+                    姓名:{$vo.member.name|default='--'}<br>
+                    手机:{$vo.member.phone|default='--'}<br>
                 </div>
             </td>
             <td class='text-left nowrap'>

+ 6 - 6
application/store/view/complain/index_search.html

@@ -2,22 +2,22 @@
     <legend>条件搜索</legend>
     <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
         <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">会员手机号</label>
+            <label class="layui-form-label">手机号</label>
             <div class="layui-input-inline">
-                <input name="phone" value="{$Think.get.phone|default=''}" placeholder="请输入会员手机号" class="layui-input">
+                <input name="phone" value="{$Think.get.phone|default=''}" placeholder="请输入手机号" class="layui-input">
             </div>
         </div>
         <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">会员昵称</label>
+            <label class="layui-form-label">姓名</label>
             <div class="layui-input-inline">
-                <input name="nickname" value="{$Think.get.nickname|default=''}" placeholder="请输入会员昵称" class="layui-input">
+                <input name="nickname" value="{$Think.get.nickname|default=''}" placeholder="请输入姓名" class="layui-input">
             </div>
         </div>
 
         <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">问题意见</label>
+            <label class="layui-form-label">反馈内容</label>
             <div class="layui-input-inline">
-                <input name="question" value="{$Think.get.question|default=''}" placeholder="请输入问题意见" class="layui-input">
+                <input name="question" value="{$Think.get.question|default=''}" placeholder="请输入反馈内容" class="layui-input">
             </div>
         </div>
 

+ 18 - 0
application/store/view/config/index-about-us.html

@@ -0,0 +1,18 @@
+<form onsubmit="return false;" data-auto="true" action="{:url('save')}" method="post" class='layui-form layui-card' autocomplete="off">
+
+    <div class="layui-card-body padding-40">
+        <label class="layui-form-item margin-top-20 block relative">
+            <span class="color-green margin-right-10">关于我们</span><span class="nowrap color-desc">AboutUs</span>
+            <textarea name="about_us">{:sysconf('about_us')}</textarea>
+        </label>
+        <div class="layui-form-item text-center margin-top-20">
+            <button class="layui-btn" type="submit">保存配置</button>
+        </div>
+    </div>
+    <script>
+        window.form.render();
+        require(['ckeditor', 'angular'], function () {
+            window.createEditor('[name="about_us"]', {height: 500});
+        })
+    </script>
+</form>

+ 18 - 0
application/store/view/config/index-privacy-policy.html

@@ -0,0 +1,18 @@
+<form onsubmit="return false;" data-auto="true" action="{:url('save')}" method="post" class='layui-form layui-card' autocomplete="off">
+
+    <div class="layui-card-body padding-40">
+        <label class="layui-form-item margin-top-20 block relative">
+            <span class="color-green margin-right-10">隐私政策</span><span class="nowrap color-desc">PrivacyPolicy</span>
+            <textarea name="privacy_policy">{:sysconf('privacy_policy')}</textarea>
+        </label>
+        <div class="layui-form-item text-center margin-top-20">
+            <button class="layui-btn" type="submit">保存配置</button>
+        </div>
+    </div>
+    <script>
+        window.form.render();
+        require(['ckeditor', 'angular'], function () {
+            window.createEditor('[name="privacy_policy"]', {height: 500});
+        })
+    </script>
+</form>

+ 9 - 12
application/store/view/config/index-store-config.html

@@ -2,20 +2,17 @@
 
     <div class="layui-card-body padding-40">
         <label class="layui-form-item block relative">
-            <span class="color-green margin-right-10">公司名称</span><span class="nowrap color-desc">CompanyName</span>
-            <input name="company_name" required placeholder="请输入公司名称" value="{:sysconf('company_name')}" class="layui-input">
-            <p class="help-block">用于移动端展示公司的名称</p>
+            <span class="color-green margin-right-10">平台展示名称</span><span class="nowrap color-desc">StoreTitle</span>
+            <input name="store_title" required placeholder="请输入平台展示名称" value="{:sysconf('store_title')}" class="layui-input">
+            <p class="help-block">用于小程序展示的标题</p>
         </label>
-        <label class="layui-form-item block relative">
-            <span class="color-green margin-right-10">公司地址</span><span class="nowrap color-desc">CompanyAddress</span>
-            <input name="company_address" required placeholder="请输入公司地址" value="{:sysconf('company_address')}" class="layui-input">
-            <p class="help-block">用于移动端展示公司的地址</p>
-        </label>
-        <label class="layui-form-item block relative">
-            <span class="color-green margin-right-10">公司电话</span><span class="nowrap color-desc">CompanyPhone</span>
-            <input name="company_phone" required placeholder="请输入公司电话" value="{:sysconf('company_phone')}" class="layui-input">
-            <p class="help-block">用于移动端展示公司的电话</p>
+
+        <label class="layui-form-item margin-top-20 block relative">
+            <span class="color-green margin-right-10">美团APPID</span><span class="nowrap color-desc">MtAppid</span>
+            <input name="mt_appid" required placeholder="请输入appid" value="{:sysconf('mt_appid')}" class="layui-input">
+            <p class="help-block">要跳转到美团小程序的appid</p>
         </label>
+
         <div class="layui-form-item text-center margin-top-20">
             <button class="layui-btn" type="submit">保存配置</button>
         </div>

+ 10 - 3
application/store/view/config/index-store-message1.html

@@ -3,17 +3,24 @@
     <div class="layui-card-body padding-40">
 
         <label class="layui-form-item margin-top-20 block relative">
-            <span class="color-green margin-right-10">企业文化</span><span class="nowrap color-desc">EnterpriseCulture</span>
-            <textarea name="enterprise_culture">{:sysconf('enterprise_culture')}</textarea>
+            <span class="color-green margin-right-10">用户协议</span><span class="nowrap color-desc">User agreement</span>
+            <textarea name="agreement">{:sysconf('agreement')}</textarea>
         </label>
+
+
         <div class="layui-form-item text-center margin-top-20">
             <button class="layui-btn" type="submit">保存配置</button>
         </div>
+
     </div>
     <script>
         window.form.render();
+
+
         require(['ckeditor', 'angular'], function () {
-            window.createEditor('[name="enterprise_culture"]', {height: 500});
+            window.createEditor('[name="agreement"]', {height: 500});
+
+
         })
     </script>
 </form>

+ 34 - 8
application/store/view/config/index-store-message2.html

@@ -2,18 +2,44 @@
 
     <div class="layui-card-body padding-40">
 
+        <label class="layui-form-item block relative">
+            <span class="color-green margin-right-10">接口查询状态</span><span class="nowrap color-desc">UserState</span>
+            {if empty($query2.code)}
+            <p class="layui-input layui-bg-gray color-red">{$query2.msg|default=''}</p>
+            {elseif $query2.code eq 1}
+            <p class="layui-input layui-bg-gray color-green">平台剩余 {$query2.num|default=0} 元可用余额,{$query2.msg|default=''}</p>
+            {else}
+            <p class="layui-input layui-bg-gray color-text">没有结果</p>
+            {/if}
+        </label>
+
         <label class="layui-form-item margin-top-20 block relative">
-            <span class="color-green margin-right-10">董事长风采</span><span class="nowrap color-desc">ChairmanShow</span>
-            <textarea name="chairman_show">{:sysconf('chairman_show')}</textarea>
+            <span class="color-green margin-right-10">短信平台账号</span><span class="nowrap color-desc">Username</span>
+            <input name="sms_zt_username2" required placeholder="请输入短信平台账号" value="{:sysconf('sms_zt_username2')}" class="layui-input">
+            <p class="help-block">短信平台账号,可以联系18122377655获取账号与密码</p>
         </label>
+
+        <label class="layui-form-item margin-top-20 block relative">
+            <span class="color-green margin-right-10">短信平台密码</span><span class="nowrap color-desc">Password</span>
+            <input name="sms_zt_password2" required placeholder="请输入短信平台密码" value="{:sysconf('sms_zt_password2')}" class="layui-input">
+            <p class="help-block">短信平台密码,可以联系18122377655获取账号与密码</p>
+        </label>
+
+        <label class="layui-form-item margin-top-20 block relative">
+            <span class="color-green margin-right-10">短信发送安全码</span><span class="nowrap color-desc">Secure</span>
+            <input name="sms_secure2" required placeholder="请输入短信发送安全码" value="{:sysconf('sms_secure2')}" class="layui-input">
+            <p class="help-block">短信发送安全码,调用接口发短信时需要传入此参数</p>
+        </label>
+
+        <label class="layui-form-item margin-top-20 block relative">
+            <span class="color-green margin-right-10">注册短信模板</span><span class="nowrap color-desc">Template</span>
+            <textarea class="layui-textarea" required name="sms_reg_template2" placeholder="请输入短信平台密码">{:sysconf('sms_reg_template2')}</textarea>
+            <p class="help-block">会员注册短信模板,验证码变量使用 {code} 代替</p>
+        </label>
+
         <div class="layui-form-item text-center margin-top-20">
             <button class="layui-btn" type="submit">保存配置</button>
         </div>
+
     </div>
-    <script>
-        window.form.render();
-        require(['ckeditor', 'angular'], function () {
-            window.createEditor('[name="chairman_show"]', {height: 500});
-        })
-    </script>
 </form>

+ 11 - 5
application/store/view/config/index.html

@@ -4,14 +4,20 @@
 
 <div class="layui-tab layui-tab-card think-bg-white">
     <ul class="layui-tab-title notselect">
-        <li data-type='store-config-type-params'>参数设置</li>
-        <li data-type="store-config-type-sms1">企业文化</li>
-        <li data-type="store-config-type-sms1">董事长风采</li>
+        <!--<li data-type='store-config-type-params'>活动参数设置</li>-->
+        <li data-type="store-config-type-sms1">用户协议设置</li>
+        <li data-type="store-config-type-sms2">隐私政策</li>
+        <li data-type="store-config-type-sms2">关于我们</li>
+        <!--<li data-type="store-config-type-sms1">国内短信设置</li>
+        <li data-type="store-config-type-sms2">国际短信设置</li>-->
     </ul>
     <div class="layui-tab-content">
-        <div class="layui-tab-item">{include file='config/index-store-config'}</div>
+        <!--<div class="layui-tab-item">{include file='config/index-store-config'}</div>-->
         <div class="layui-tab-item">{include file='config/index-store-message1'}</div>
-        <div class="layui-tab-item">{include file='config/index-store-message2'}</div>
+        <div class="layui-tab-item">{include file='config/index-privacy-policy'}</div>
+        <div class="layui-tab-item">{include file='config/index-about-us'}</div>
+        <!--<div class="layui-tab-item">{include file='config/index-store-message1'}</div>
+        <div class="layui-tab-item">{include file='config/index-store-message2'}</div>-->
     </div>
 </div>
 

+ 112 - 0
application/store/view/consult/form.html

@@ -0,0 +1,112 @@
+{extend name='admin@main'}
+
+{block name="content"}
+
+{include file='store@goods/form_style'}
+
+<form onsubmit="return false;" id="GoodsForm" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off">
+
+    <div class="layui-card-body think-box-shadow padding-left-40">
+
+        <div class="layui-form-item layui-row layui-col-space15">
+
+            <label class="layui-col-xs9 relative">
+                <span class="color-green">咨询标题</span>
+                <input name="title" required class="layui-input" placeholder="请输入咨询标题" value="{$vo.title|default=''}">
+            </label>
+        </div>
+
+        <div class="layui-form-item layui-row layui-col-space15">
+            <label class="layui-col-xs3 relative">
+                <span class="color-green">咨询分类</span>
+                <select class="layui-select" required name="cate_id" lay-search>
+                    {foreach $cate_arr as $cate}
+                    {if isset($vo.cate_id) and $vo.cate_id eq $cate.id}
+                    <option selected value="{$cate.id}">{$cate.title|default=''}</option>
+                    {else}
+                    <option value="{$cate.id}">{$cate.title|default=''}</option>
+                    {/if}
+                    {/foreach}
+                </select>
+            </label>
+            <label class="layui-col-xs3 relative">
+                <span class="color-green">是否推荐</span>
+                <select class="layui-select" required name="is_recommend" lay-search>
+                    {foreach $is_recommend as $key=>$value}
+                    {if isset($vo.is_recommend) and $vo.is_recommend eq $key}
+                    <option selected value="{$key}">{$value|default=''}</option>
+                    {else}
+                    <option value="{$key}">{$value|default=''}</option>
+                    {/if}
+                    {/foreach}
+                </select>
+            </label>
+        </div>
+
+
+        <div class="layui-form-item layui-row layui-col-space15">
+            {if isset($vo.type) && $vo.type == 2}
+            <label class="layui-col-xs9 relative" style="width: 408px">
+                <span class="color-green">咨询来源</span>
+                <input name="user_name" class="layui-input" placeholder="" readonly="readonly" value="{$vo.user_name|default=''}">
+                <input type="hidden" name="media_id" value="{$vo.user_id}">
+            </label>
+            {else}
+            <label class="layui-col-xs3 relative">
+                <span class="color-green">咨询来源</span>
+                <select class="layui-select" required name="media_id" lay-search>
+                    {foreach $media_arr as $media}
+                    {if isset($vo.media_id) and $vo.media_id eq $media.id}
+                    <option selected value="{$media.id}">{$media.title|default=''}</option>
+                    {else}
+                    <option value="{$media.id}">{$media.title|default=''}</option>
+                    {/if}
+                    {/foreach}
+                </select>
+            </label>
+            {/if}
+            <label class="layui-col-xs9 relative" style="width: 408px">
+                <span class="color-green">咨询作者</span>
+                <input name="author" class="layui-input" placeholder="请输入咨询作者" value="{$vo.author|default=''}">
+            </label>
+        </div>
+
+        <div class="layui-form-item">
+            <span class="color-green label-required-prev">咨询视频及图片(如果不是视频可以不添加,图片用于咨询列表的展示,可以添加多张,注意图片尺寸)</span>
+            <table class="layui-table">
+                <thead>
+                <tr>
+                    <th class="text-center">视频</th>
+                    <th class="text-left">图片</th>
+                </tr>
+                <tr>
+                    <td width="90px" class="text-center"><input name="video" type="hidden" value="{$vo.video|default=''}"></td>
+                    <td width="auto" class="text-left"><input name="image" type="hidden" value="{$vo.image|default=''}"></td>
+                </tr>
+                </thead>
+            </table>
+            <script>$('[name="video"]').uploadOneVideo(),$('[name="image"]').uploadMultipleImage()</script>
+        </div>
+
+        <div class="layui-form-item block">
+            <span class="label-required-prev color-green">咨询详细内容</span>
+            <textarea name="content" style="width:100%;height: 500px;">{$vo.content|default=''|raw}</textarea>
+        </div>
+        <div class="layui-form-item text-center">
+            {notempty name='vo.id'}<input type="hidden" name="id" value="{$vo.id}">{/notempty}
+            {notempty name='vo.update_at'}<input type="hidden" name="update_at" value="{$vo.update_at}">{/notempty}
+            <button class="layui-btn layui-btn-danger" ng-click="hsitoryBack()" type="button">取消编辑</button>
+            <button class="layui-btn" type="submit">保存活动</button>
+        </div>
+    </div>
+</form>
+{/block}
+
+{block name='script'}
+<script>
+    window.form.render();
+    require(['ckeditor', 'angular','pcasunzips'], function () {
+        //window.createEditor('[name="content"]', {height: 500});
+    })
+</script>
+{/block}

+ 89 - 0
application/store/view/consult/index.html

@@ -0,0 +1,89 @@
+{extend name='admin@main'}
+
+{block name="button"}
+<!--{if auth("store/consult/add")}-->
+<button data-open='{:url("add")}' data-title="添加咨询" class='layui-btn layui-btn-sm layui-btn-primary'>添加咨询</button>
+<!--{/if}-->
+<!--{if auth("store/consult/remove")}-->
+<button data-action='{:url("remove")}' data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除咨询</button>
+<!--{/if}-->
+{/block}
+
+{block name="content"}
+<div class="think-box-shadow">
+    {include file='consult/index_search'}
+    <table class="layui-table margin-top-10" lay-skin="line">
+        {notempty name='list'}
+        <thead>
+        <tr>
+            <th class='list-table-check-td think-checkbox'>
+                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
+            </th>
+            <th class='list-table-sort-td'>
+                <button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
+            </th>
+            <th class='text-left nowrap' width="22%">咨询标题</th>
+            <th class='text-left nowrap' width="15%">咨询分类</th>
+            <th class='text-left nowrap' width="12%">来源媒体/用户</th>
+            <th class='text-left nowrap' width="8%">咨询作者</th>
+            <th class='text-left nowrap' width="12%">新发布状态</th>
+            <th class='text-left nowrap' width="15%">发布时间</th>
+            <th class='text-center nowrap' width="15%">操作</th>
+        </tr>
+        </thead>
+        {/notempty}
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr data-dbclick>
+            <td class='list-table-check-td think-checkbox'><input class="list-check-box" value='{$vo.id}' type='checkbox'></td>
+            <td class='list-table-sort-td'><input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input"></td>
+            <td class='text-left nowrap'>
+                {$vo.title|default=''}
+            </td>
+            <td class='text-left nowrap padding-0 relative'>
+                {$vo.cate_name|default=''}
+            </td>
+            <td class='text-left nowrap padding-0 relative'>
+                {notempty name='vo.media_logo'}
+                <img data-tips-image style="width:20px;height:20px;vertical-align:top" src="{$vo.media_logo|default=''}" class="margin-right-5">
+                {/notempty}
+                <div class="inline-block">{$vo.media_title|default='--'}</div>
+            </td>
+            <td class='text-left nowrap padding-0 relative'>
+                {$vo.author|default='--'}
+            </td>
+            <td class='text-left nowrap'>
+                {eq name='vo.status' value='0'}<span class="layui-badge">已下架</span>{else}<span class="layui-badge layui-bg-green">发布中</span>{/eq}<br>
+            </td>
+            <td class='text-left nowrap padding-0 relative'>
+                {$vo.create_at|default='--'}
+            </td>
+            <td class='text-center nowrap'>
+
+                <div class="nowrap margin-bottom-5">
+                    {if auth("store/consult/edit")}
+                    <a data-dbclick class="layui-btn layui-btn-sm" data-open='{:url("edit")}?id={$vo.id}&no_edit=0'>编 辑</a>
+                    {else}
+                    <a data-tips-text="您没有编辑活动的权限哦!" class="layui-btn layui-btn-sm layui-btn-primary layui-disabled">编 辑</a>
+                    {/if}
+
+                    {if isset($vo.status) and $vo.status eq 1}
+                        <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('forbid')}" data-value="id#{$vo.id};status#0">下 架</a>
+                    {else}
+                        <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('resume')}" data-value="id#{$vo.id};status#1">上 架</a>
+                    {/if}
+                    {if auth("store/consult/remove")}
+                        <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除数据吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}">删 除</a>
+                    {/if}
+                </div>
+
+            </td>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+
+</div>
+{/block}

+ 58 - 0
application/store/view/consult/index_search.html

@@ -0,0 +1,58 @@
+<fieldset>
+    <legend>条件搜索</legend>
+    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">咨询标题</label>
+            <div class="layui-input-inline">
+                <input name="title" value="{$Think.get.title|default=''}" placeholder="请输入咨询标题" class="layui-input">
+            </div>
+        </div>
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">咨询分类</label>
+            <div class="layui-input-inline">
+                <select class="layui-select" name="cate_id" lay-search>
+                    <option value="">-- 全部咨询 --</option>
+                    {foreach $cate_arr as $v}
+                    <!--{eq name='Think.get.cate_id' value='$v.id.""'}-->
+                    <option selected value="{$v.id}">{$v.title}</option>
+                    <!--{else}-->
+                    <option value="{$v.id}">{$v.title}</option>
+                    <!--{/eq}-->
+                    {/foreach}
+                </select>
+            </div>
+        </div>
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">发布状态</label>
+            <div class="layui-input-inline">
+                <select class="layui-select" name="status">
+                    {foreach [''=>'- 全部状态 -','1'=>'发布中','0'=>'已下架'] as $k=>$v}
+                    <!--{eq name='Think.get.status' value='$k.""'}-->
+                    <option selected value="{$k}">{$v}</option>
+                    <!--{else}-->
+                    <option value="{$k}">{$v}</option>
+                    <!--{/eq}-->
+                    {/foreach}
+                </select>
+            </div>
+        </div>
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">发布者</label>
+            <div class="layui-input-inline">
+                <select class="layui-select" name="type">
+                    {foreach [''=>'- 全部 -','1'=>'后台','2'=>'用户'] as $k=>$v}
+                    <!--{eq name='Think.get.type' value='$k.""'}-->
+                    <option selected value="{$k}">{$v}</option>
+                    <!--{else}-->
+                    <option value="{$k}">{$v}</option>
+                    <!--{/eq}-->
+                    {/foreach}
+                </select>
+            </div>
+        </div>
+        <div class="layui-form-item layui-inline">
+            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
+        </div>
+    </form>
+    <script>form.render()</script>
+</fieldset>

+ 3 - 3
application/store/view/parts/form.html → application/store/view/consult_cate/form.html

@@ -2,14 +2,14 @@
 
     <div class="layui-card-body">
 
-
         <div class="layui-row margin-bottom-15">
-            <label class="layui-col-xs2 think-form-label">零部件名称</label>
+            <label class="layui-col-xs2 think-form-label">咨询分类名称</label>
             <label class="layui-col-xs10">
-                <input name="name" required value='{$vo.name|default=""}' placeholder="请输入零部件名称" class="layui-input">
+                <input name="title" required value='{$vo.title|default=""}' placeholder="请输入咨询分类名称" class="layui-input">
             </label>
         </div>
 
+
     </div>
 
     <div class="hr-line-dashed"></div>

+ 19 - 13
application/store/view/parts/index.html → application/store/view/consult_cate/index.html

@@ -1,17 +1,17 @@
 {extend name='admin@main'}
 
 {block name="button"}
-{if auth("store/parts/add")}
-<button data-modal='{:url("add")}' data-title="添加充值金额" class='layui-btn layui-btn-sm layui-btn-primary'>添加零部件</button>
+{if auth("store/consult_cate/add")}
+<button data-modal='{:url("add")}' data-title="添加咨询分类" class='layui-btn layui-btn-sm layui-btn-primary'>添加咨询分类</button>
 {/if}
-{if auth("store/parts/remove")}
-<button data-action='{:url("remove")}' data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除零部件</button>
+{if auth("store/consult_cate/remove")}
+<button data-action='{:url("remove")}' data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除咨询分类</button>
 {/if}
 {/block}
 
 {block name="content"}
 <div class="think-box-shadow">
-    {include file='parts/index_search'}
+    {include file='consult_cate/index_search'}
     <table class="layui-table margin-top-10" lay-skin="line">
         {notempty name='list'}
         <thead>
@@ -19,9 +19,12 @@
             <th class='list-table-check-td think-checkbox'>
                 <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
             </th>
-            <th class='text-left nowrap'>零部件</th>
+            <th class='list-table-sort-td'>
+                <button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
+            </th>
+            <th class='text-left nowrap'>分类名称</th>
             <th class="text-center">状态</th>
-            <th class="text-center">时间</th>
+            <th class="text-center">添加时间</th>
             <th class="text-center">操作</th>
         </tr>
         </thead>
@@ -32,8 +35,11 @@
             <td class='list-table-check-td think-checkbox'>
                 <input class="list-check-box" value='{$vo.id}' type='checkbox'>
             </td>
+            <td class='list-table-sort-td'>
+                <input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input">
+            </td>
             <td class='text-left nowrap'>
-                {$vo.name|default=''}
+                {$vo.title|default=''}
             </td>
             <td class='text-center nowrap'>
                 {eq name='vo.status' value='0'}<span class="layui-badge">已禁用</span>{else}<span class="layui-badge layui-bg-green">使用中</span>{/eq}<br>
@@ -41,17 +47,17 @@
             <td class='text-center nowrap'>{$vo.create_at|format_datetime}</td>
             <td class='text-center nowrap'>
 
-                {if auth("store/parts/edit")}
-                <a data-title="编辑" class="layui-btn layui-btn-sm" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
+                {if auth("store/consult_cate/edit")}
+                <a data-title="编辑咨询分类" class="layui-btn layui-btn-sm" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
                 {/if}
 
-                {if $vo.status eq 1 and auth("store/parts/forbid")}
+                {if $vo.status eq 1 and auth("store/consult_cate/forbid")}
                 <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('forbid')}" data-value="id#{$vo.id};status#0">禁 用</a>
-                {elseif auth("store/parts/resume")}
+                {elseif auth("store/consult_cate/resume")}
                 <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('resume')}" data-value="id#{$vo.id};status#1">启 用</a>
                 {/if}
 
-                {if auth("store/parts/remove")}
+                {if auth("store/consult_cate/remove")}
                 <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除数据吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}">删 除</a>
                 {/if}
 

+ 2 - 2
application/store/view/award/index_search.html → application/store/view/consult_cate/index_search.html

@@ -2,9 +2,9 @@
     <legend>条件搜索</legend>
     <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
         <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">奖励金额</label>
+            <label class="layui-form-label">分类名称</label>
             <div class="layui-input-inline">
-                <input name="amount" value="{$Think.get.amount|default=''}" placeholder="请输入奖励金额" class="layui-input">
+                <input name="title" value="{$Think.get.title|default=''}" placeholder="请输入分类名称" class="layui-input">
             </div>
         </div>
         <div class="layui-form-item layui-inline">

+ 24 - 233
application/store/view/goods/form.html

@@ -7,59 +7,16 @@
 <form onsubmit="return false;" id="GoodsForm" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off">
 
     <div class="layui-card-body think-box-shadow padding-left-40">
-        <div class="layui-form-item layui-row layui-col-space15" id="r-result">
-
-            <label class="layui-col-xs9 relative">
-                <span class="color-green">搜索定位</span>
-                <input type="text" id="suggestId" class="layui-input" placeholder="请输入要搜索的内容" ><span style="color: red;">注:输入获取位置后需在地图上点击选择精确位置获取经纬度,此处输入的内容只是为了定位获取经纬度</span>
-            </label>
-        </div>
-        <div id="searchResultPanel" style="border:1px solid #C0C0C0;width:150px;height:auto; display:none;"></div>
-        <div class="layui-form-item layui-row layui-col-space15" style="width: 75%;height: 500px">
-            <label class="layui-col-xs3 relative" style="width: 100%;height: 100%">
-                <span class="color-green">地图</span>
-                <div id="container" style="width: 100%;height: 100%"></div>
-            </label>
-        </div>
-        <div class="layui-form-item layui-row layui-col-space15">
-            <label class="layui-col-xs3 relative">
-                <span class="color-green">经度值</span>
-                <input  type="text" id="longitude" name="longitude" readonly="readonly"  value="{$vo.longitude|default='118.362989'}" class="layui-input" >
-            </label>
-            <label class="layui-col-xs3 relative">
-                <span class="color-green">纬度值</span>
-                <input  type="text" id="latitude" name="latitude" readonly="readonly"  value="{$vo.latitude|default='35.098162'}" class="layui-input" >
-            </label>
-        </div>
 
         <div class="layui-form-item layui-row layui-col-space15">
-
-            <label class="layui-col-xs9 relative">
-                <span class="color-green">活动地址</span>
-                <div class="" >
-                    <div class="color-blue" style="line-height:38px;">{$vo.province|default=''} {$vo.city|default=''} {$vo.county|default=''}</div>
-                    <div class="layui-row">
-                        <div class="layui-col-xs4 margin-right-5" style="width: 120px;"><select class="layui-select block full-width" lay-ignore name="province"></select></div>
-                        <div class="layui-col-xs4 margin-right-5" style="width: 120px;"><select class="layui-select block full-width" lay-ignore name="city"></select></div>
-                        <div class="layui-col-xs4 margin-right-5" style="width: 120px;"><select class="layui-select block full-width" lay-ignore name="county"></select></div>
-                    </div>
-                </div>
+            <label class="layui-col-xs3 relative" style="width: 35%;">
+                <span class="color-green">新闻标题</span>
+                <input name="title" required class="layui-input" placeholder="请输入新闻标题" value="{$vo.title|default=''}">
             </label>
-        </div>
-        <div class="layui-form-item layui-row layui-col-space15">
-
-            <label class="layui-col-xs9 relative">
-                <span class="color-green">活动详细地址</span>
-                <input name="address" required class="layui-input" placeholder="请输入活动详细地址" value="{$vo.address|default=''}">
-                <span style="color: red;">注:该详细地址用于手机端展示</span>
-            </label>
-        </div>
-
-        <div class="layui-form-item layui-row layui-col-space15">
-            <label class="layui-col-xs3 relative">
-                <span class="color-green">活动分类</span>
+            <label class="layui-col-xs3 relative" style="width: 35%;">
+                <span class="color-green">新闻分类</span>
                 <select class="layui-select" required name="cate_id" lay-search>
-                    {foreach $cates as $cate}
+                    {foreach $cate_arr as $cate}
                     {if isset($vo.cate_id) and $vo.cate_id eq $cate.id}
                     <option selected value="{$cate.id}">{$cate.title|default=''}</option>
                     {else}
@@ -68,58 +25,14 @@
                     {/foreach}
                 </select>
             </label>
-            <label class="layui-col-xs9 relative" style="width: 50%;">
-                <span class="color-green">活动名称</span>
-                <input name="title" required class="layui-input" placeholder="请输入活动名称" value="{$vo.title|default=''}">
-            </label>
         </div>
 
         <div class="layui-form-item layui-row layui-col-space15">
-            <label class="layui-col-xs3 relative">
-                <span class="color-green">归属平台</span>
-                <select class="layui-select" required name="platform_id" lay-search>
-                    {foreach $platform as $key=>$value}
-                    {if isset($vo.platform_id) and $vo.platform_id eq $key}
-                    <option selected value="{$key}">{$value|default=''}</option>
-                    {else}
-                    <option value="{$key}">{$value|default=''}</option>
-                    {/if}
-                    {/foreach}
-                </select>
-            </label>
-            <label class="layui-col-xs3 relative">
-                <span class="color-green">选择优惠券</span>
-                <select class="layui-select" required name="coupon_id" lay-search>
-                    {foreach $coupons as $coupon}
-                    {if isset($vo.coupon_id) and $vo.coupon_id eq $coupon.id}
-                    <option selected value="{$coupon.id}">{$coupon.title|default=''}</option>
-                    {else}
-                    <option value="{$coupon.id}">{$coupon.title|default=''}</option>
-                    {/if}
-                    {/foreach}
-                </select>
-            </label>
-        </div>
-
-
-        <div class="layui-form-item layui-row layui-col-space15">
-            <label class="layui-col-xs3 relative">
-                <span class="color-green">活动性质</span>
-                <select class="layui-select" required name="nature" lay-search>
-                    {foreach $nature as $key=>$value}
-                    {if isset($vo.nature) and $vo.nature eq $key}
-                    <option selected value="{$key}">{$value|default=''}</option>
-                    {else}
-                    <option value="{$key}">{$value|default=''}</option>
-                    {/if}
-                    {/foreach}
-                </select>
-            </label>
-            <label class="layui-col-xs3 relative">
-                <span class="color-green">选择餐饮类型</span>
-                <select class="layui-select" required name="dining_type" lay-search>
-                    {foreach $dining_type as $key=>$value}
-                    {if isset($vo.dining_type) and $vo.dining_type eq $key}
+            <label class="layui-col-xs3 relative" style="width: 35%;">
+                <span class="color-green">是否置顶</span>
+                <select class="layui-select" required name="is_top" lay-search>
+                    {foreach $is_top as $key=>$value}
+                    {if isset($vo.is_top) and $vo.is_top eq $key}
                     <option selected value="{$key}">{$value|default=''}</option>
                     {else}
                     <option value="{$key}">{$value|default=''}</option>
@@ -127,57 +40,14 @@
                     {/foreach}
                 </select>
             </label>
-        </div>
-
-        <div class="layui-form-item layui-row layui-col-space15">
-
-            <label class="layui-col-xs3 relative">
-                <span class="color-green">活动标签</span>
-                <input name="label" required class="layui-input" placeholder="请输入活动标签" value="{$vo.label|default=''}">
-            </label>
-            <label class="layui-col-xs3 relative">
-                <span class="color-green">虚拟销量</span>
-                <input name="virtual_sales" required class="layui-input" placeholder="请输入虚拟销量" value="{$vo.virtual_sales|default=''}">
-            </label>
-        </div>
-
-        <div class="layui-form-item layui-row layui-col-space15">
-
-            <label class="layui-col-xs3 relative">
-                <span class="color-green">活动评分</span>
-                <input name="score" required class="layui-input" placeholder="请输入活动评分" value="{$vo.score|default=''}">
-            </label>
-            <label class="layui-col-xs3 relative">
-                <span class="color-green">送达时间</span>
-                <input name="time" required class="layui-input" placeholder="送达时间" value="{$vo.time|default=''}">&nbsp;&nbsp;<span style="color: red">注:单位分钟,例如:1小时40分钟则输入100</span>
-            </label>
-        </div>
-
-        <div class="layui-form-item layui-row layui-col-space15">
-
-            <label class="layui-col-xs3 relative">
-                <span class="color-green">报名开始时间</span>
-                <input name="start_time" required class="layui-input"  placeholder="请输入报名开始时间" value="{$vo.start_time|default=''}" id="start_time-date">
-            </label>
-            <label class="layui-col-xs3 relative">
-                <span class="color-green">报名结束时间</span>
-                <input name="end_time" required class="layui-input"  placeholder="请输入报名结束时间" value="{$vo.end_time|default=''}" id="end_time-date">
-            </label>
-        </div>
-
-        <div class="layui-form-item layui-row layui-col-space15">
-            <label class="layui-col-xs3 relative">
-                <span class="color-green">名额数量</span>
-                <input name="number" required class="layui-input" placeholder="请输入名额数量" value="{$vo.number|default=''}">
-            </label>
-            <label class="layui-col-xs3 relative">
-                <span class="color-green">是否为推荐活动</span>
-                <select class="layui-select" required name="is_recommend" lay-search>
-                    {foreach $is_recommend as $key=>$value}
-                    {if isset($vo.is_recommend) and $vo.is_recommend eq $key}
-                    <option selected value="{$key}">{$value|default=''}</option>
+            <label class="layui-col-xs3 relative" style="width: 35%;">
+                <span class="color-green">新闻来源</span>
+                <select class="layui-select" required name="media_id" lay-search>
+                    {foreach $media_arr as $media}
+                    {if isset($vo.media_id) and $vo.media_id eq $media.id}
+                    <option selected value="{$media.id}">{$media.title|default=''}</option>
                     {else}
-                    <option value="{$key}">{$value|default=''}</option>
+                    <option value="{$media.id}">{$media.title|default=''}</option>
                     {/if}
                     {/foreach}
                 </select>
@@ -185,26 +55,24 @@
         </div>
 
         <div class="layui-form-item">
-            <span class="color-green label-required-prev">活动LOGO及轮播展示图片</span>
+            <span class="color-green label-required-prev">新闻视频及图片(如果不是视频可以不添加,图片用于新闻列表的展示,可以添加多张,注意图片尺寸)</span>
             <table class="layui-table">
                 <thead>
                 <tr>
-                    <th class="text-center">LOGO</th>
-                    <th class="text-left">展示图片</th>
+                    <th class="text-center">视频</th>
+                    <th class="text-left">图片</th>
                 </tr>
                 <tr>
-                    <td width="90px" class="text-center"><input name="logo" type="hidden" value="{$vo.logo|default=''}"></td>
+                    <td width="90px" class="text-center"><input name="video" type="hidden" value="{$vo.video|default=''}"></td>
                     <td width="auto" class="text-left"><input name="image" type="hidden" value="{$vo.image|default=''}"></td>
                 </tr>
                 </thead>
             </table>
-            <script>$('[name="logo"]').uploadOneImage(), $('[name="image"]').uploadMultipleImage()</script>
+            <script>$('[name="video"]').uploadOneVideo(),$('[name="image"]').uploadMultipleImage()</script>
         </div>
 
-
-
         <div class="layui-form-item block">
-            <span class="label-required-prev color-green">活动详细内容</span>
+            <span class="label-required-prev color-green">新闻详细内容</span>
             <textarea name="content">{$vo.content|default=''|raw}</textarea>
         </div>
         <div class="layui-form-item text-center">
@@ -218,87 +86,10 @@
 {/block}
 
 {block name='script'}
-<textarea class="layui-hide" id="goods-specs">{$vo.specs|raw|default=''}</textarea>
-<textarea class="layui-hide" id="goods-value">{$defaultValues|raw|default=''}</textarea>
-<script>
-    function G(id) {
-        return document.getElementById(id);
-    }
-    var map = new BMapGL.Map('container'); // 创建Map实例
-    map.centerAndZoom(new BMapGL.Point("{$vo.longitude}", "{$vo.latitude}"), "{$map_lev}"); // 初始化地图,设置中心点坐标和地图级别
-    map.enableScrollWheelZoom(true); // 开启鼠标滚轮缩放
-    var marker = new BMapGL.Marker(new BMapGL.Point("{$vo.longitude}", "{$vo.latitude}"));
-    map.addOverlay(marker);
-    map.addEventListener('click', function (e) {
-        map.clearOverlays();
-        G('longitude').value = e.latlng.lng.toFixed(6);
-        G('latitude').value = e.latlng.lat.toFixed(6);
-        var marker = new BMapGL.Marker(new BMapGL.Point(e.latlng.lng, e.latlng.lat));
-        map.addOverlay(marker);
-    });
-
-    var ac = new BMapGL.Autocomplete(    //建立一个自动完成的对象
-        {"input" : "suggestId"
-            ,"location" : map
-        });
-    ac.addEventListener("onhighlight", function(e) {  //鼠标放在下拉列表上的事件
-        var str = "";
-        var _value = e.fromitem.value;
-        var value = "";
-        if (e.fromitem.index > -1) {
-            value = _value.province +  _value.city +  _value.district +  _value.street +  _value.business;
-        }
-        str = "FromItem<br />index = " + e.fromitem.index + "<br />value = " + value;
-
-        value = "";
-        if (e.toitem.index > -1) {
-            _value = e.toitem.value;
-            value = _value.province +  _value.city +  _value.district +  _value.street +  _value.business;
-        }
-        str += "<br />ToItem<br />index = " + e.toitem.index + "<br />value = " + value;
-        G("searchResultPanel").innerHTML = str;
-    });
-
-    var myValue;
-    ac.addEventListener("onconfirm", function(e) {    //鼠标点击下拉列表后的事件
-        var _value = e.item.value;
-        myValue = _value.province +  _value.city +  _value.district +  _value.street +  _value.business;
-        G("searchResultPanel").innerHTML ="onconfirm<br />index = " + e.item.index + "<br />myValue = " + myValue;
-
-        setPlace();
-    });
-
-    function setPlace(){
-        map.clearOverlays();    //清除地图上所有覆盖物
-        function myFun(){
-            var pp = local.getResults().getPoi(0).point;    //获取第一个智能搜索的结果
-            map.centerAndZoom(pp, 18);
-            map.addOverlay(new BMapGL.Marker(pp));    //添加标注
-        }
-        var local = new BMapGL.LocalSearch(map, { //智能搜索
-            onSearchComplete: myFun
-        });
-        local.search(myValue);
-    }
-</script>
 <script>
     window.form.render();
     require(['ckeditor', 'angular','pcasunzips'], function () {
         window.createEditor('[name="content"]', {height: 500});
-        new PCAS("province", "city", "county", '{$vo.province|default=""}', '{$vo.city|default=""}', '{$vo.county|default=""}');
-        //日期时间范围
-        laydate.render({
-            elem: '#start_time-date'
-            ,type: 'time'
-            ,range: false
-            ,min:'nowTime'
-        });
-        laydate.render({
-            elem: '#end_time-date'
-            ,type: 'time'
-            ,range: false
-            ,min:'nowTime'
-        });
     })
 </script>
 {/block}

+ 16 - 25
application/store/view/goods/index.html

@@ -2,10 +2,10 @@
 
 {block name="button"}
 <!--{if auth("store/goods/add")}-->
-<button data-open='{:url("add")}' data-title="添加活动" class='layui-btn layui-btn-sm layui-btn-primary'>添加活动</button>
+<button data-open='{:url("add")}' data-title="添加活动" class='layui-btn layui-btn-sm layui-btn-primary'>添加新闻</button>
 <!--{/if}-->
 <!--{if auth("store/goods/remove")}-->
-<button data-action='{:url("remove")}' data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除活动</button>
+<button data-action='{:url("remove")}' data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除新闻</button>
 <!--{/if}-->
 {/block}
 
@@ -22,12 +22,11 @@
             <th class='list-table-sort-td'>
                 <button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
             </th>
-            <th class='text-left nowrap' width="22%">活动信息</th>
-            <th class='text-left nowrap' width="15%">活动时间</th>
-            <th class='text-left nowrap' width="12%">活动地址</th>
-            <th class='text-center nowrap' width="8%">归属平台</th>
-            <th class='text-left nowrap' width="12%">活动优惠</th>
-            <th class='text-left nowrap' width="15%">活动状态</th>
+            <th class='text-left nowrap' width="25%">新闻标题</th>
+            <th class='text-left nowrap' width="15%">新闻分类</th>
+            <th class='text-left nowrap' width="12%">来源媒体</th>
+            <th class='text-left nowrap' width="12%">新发布状态</th>
+            <th class='text-left nowrap' width="15%">发布时间</th>
             <th class='text-center nowrap' width="15%">操作</th>
         </tr>
         </thead>
@@ -38,30 +37,22 @@
             <td class='list-table-check-td think-checkbox'><input class="list-check-box" value='{$vo.id}' type='checkbox'></td>
             <td class='list-table-sort-td'><input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input"></td>
             <td class='text-left nowrap'>
-                {notempty name='vo.logo'}
-                <img data-tips-image style="width:60px;height:60px" src="{$vo.logo|default=''}" class="margin-right-5 text-top">
-                {/notempty}
-                <div class="inline-block">
-                    活动名称:{$vo.title|default='--'}<br>
-                    所属分类:{$vo.cate.title|default='--'}<br>
-                    剩余名额:{$vo.number_stock|default='--'}<br>
-                </div>
+                {$vo.title|default=''}
             </td>
             <td class='text-left nowrap padding-0 relative'>
-               每天 {$vo.start_time|default='--'} - {$vo.end_time|default='--'}
+                {$vo.cate_name|default=''}
             </td>
             <td class='text-left nowrap padding-0 relative'>
-                {$vo.province|default='--'} {$vo.city|default=''} {$vo.county|default=''}<br>
-                {$vo.address|default=''}
+                {notempty name='vo.media_logo'}
+                <img data-tips-image style="width:20px;height:20px;vertical-align:top" src="{$vo.media_logo|default=''}" class="margin-right-5">
+                {/notempty}
+                <div class="inline-block">{$vo.media_title|default='--'}</div>
             </td>
-            <td class='text-center nowrap padding-0 relative'>
-                {$vo.platform|default='--'}
+            <td class='text-left nowrap'>
+                {eq name='vo.status' value='0'}<span class="layui-badge">已下架</span>{else}<span class="layui-badge layui-bg-green">发布中</span>{/eq}<br>
             </td>
             <td class='text-left nowrap padding-0 relative'>
-                {$vo.coupon|default='--'}
-            </td>
-            <td class='text-left nowrap'>
-                销售状态:{eq name='vo.status' value='0'}<span class="layui-badge">已下架</span>{else}<span class="layui-badge layui-bg-green">销售中</span>{/eq}<br>
+                {$vo.create_at|default='--'}
             </td>
             <td class='text-center nowrap'>
 

+ 8 - 8
application/store/view/goods/index_search.html

@@ -2,17 +2,17 @@
     <legend>条件搜索</legend>
     <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
         <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">商品名称</label>
+            <label class="layui-form-label">新闻标题</label>
             <div class="layui-input-inline">
-                <input name="title" value="{$Think.get.title|default=''}" placeholder="请输入商品名称" class="layui-input">
+                <input name="title" value="{$Think.get.title|default=''}" placeholder="请输入新闻标题" class="layui-input">
             </div>
         </div>
         <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">商品分类</label>
+            <label class="layui-form-label">新闻分类</label>
             <div class="layui-input-inline">
                 <select class="layui-select" name="cate_id" lay-search>
-                    <option value="">-- 全部商品 --</option>
-                    {foreach $clist as $v}
+                    <option value="">-- 全部新闻 --</option>
+                    {foreach $cate_arr as $v}
                     <!--{eq name='Think.get.cate_id' value='$v.id.""'}-->
                     <option selected value="{$v.id}">{$v.title}</option>
                     <!--{else}-->
@@ -23,10 +23,10 @@
             </div>
         </div>
         <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">销售状态</label>
+            <label class="layui-form-label">发布状态</label>
             <div class="layui-input-inline">
                 <select class="layui-select" name="status">
-                    {foreach [''=>'- 全部状态 -','1'=>'销售中商品','0'=>'已下架商品'] as $k=>$v}
+                    {foreach [''=>'- 全部状态 -','1'=>'发布中','0'=>'已下架'] as $k=>$v}
                     <!--{eq name='Think.get.status' value='$k.""'}-->
                     <option selected value="{$k}">{$v}</option>
                     <!--{else}-->
@@ -41,4 +41,4 @@
         </div>
     </form>
     <script>form.render()</script>
-</fieldset>
+</fieldset>

+ 0 - 136
application/store/view/goods/no_edit.html

@@ -1,136 +0,0 @@
-{extend name='admin@main'}
-
-{block name="content"}
-
-{include file='store@goods/form_style'}
-
-<form onsubmit="return false;" id="GoodsForm" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off">
-
-    <div class="layui-card-body think-box-shadow padding-left-40">
-
-        <div class="layui-form-item layui-row layui-col-space15">
-            <label class="layui-col-xs3 relative">
-                <span class="color-green">活动分类</span>
-                {foreach $cates as $cate}
-                {if isset($vo.cate_id) and $vo.cate_id eq $cate.id}
-                <input name="title" readonly="readonly" required class="layui-input"  value="{$cate.title|default=''}">
-                {/if}
-                {/foreach}
-            </label>
-            <label class="layui-col-xs9 relative">
-                <span class="color-green">活动名称</span>
-                <input name="title" readonly="readonly" required class="layui-input" placeholder="请输入活动名称" value="{$vo.title|default=''}">
-            </label>
-        </div>
-
-        <div class="layui-form-item layui-row layui-col-space15">
-            <label class="layui-col-xs3 relative">
-                <span class="color-green">归属平台</span>
-                {foreach $platform as $key=>$value}
-                {if isset($vo.platform_id) and $vo.platform_id eq $key}
-                <input name="title" readonly="readonly" required class="layui-input"  value="{$value|default=''}">
-                {/if}
-                {/foreach}
-            </label>
-            <label class="layui-col-xs3 relative">
-                <span class="color-green">选择优惠券</span>
-                {foreach $coupons as $coupon}
-                {if isset($vo.coupon_id) and $vo.coupon_id eq $coupon.id}
-                <input name="title" readonly="readonly" required class="layui-input"  value="{$coupon.title|default=''}">
-                {/if}
-                {/foreach}
-            </label>
-        </div>
-
-        <div class="layui-form-item layui-row layui-col-space15">
-
-            <label class="layui-col-xs3 relative">
-                <span class="color-green">报名开始时间</span>
-                <input name="start_time" readonly="readonly" required class="layui-input" style="width:300px" placeholder="请输入报名开始时间" value="{$vo.start_time|default=''}" id="start_time-date">
-            </label>
-            <label class="layui-col-xs3 relative">
-                <span class="color-green">报名结束时间</span>
-                <input name="end_time" readonly="readonly" required class="layui-input" style="width:300px" placeholder="请输入报名结束时间" value="{$vo.end_time|default=''}" id="end_time-date">
-            </label>
-        </div>
-
-        <div class="layui-form-item layui-row layui-col-space15">
-            <label class="layui-col-xs9 relative">
-                <span class="color-green">名额数量</span>
-                <input name="number_stock" readonly="readonly" required class="layui-input" placeholder="请输入名额数量" value="{$vo.number_stock|default=''}">
-            </label>
-        </div>
-
-        <div class="layui-form-item layui-row layui-col-space15">
-
-            <label class="layui-col-xs9 relative">
-                <span class="color-green">活动地址</span>
-                <div class="" >
-                    <div class="color-blue" style="line-height:38px;">{$vo.province|default='--'} {$vo.city|default=''} {$vo.county|default=''}</div>
-                    <!--<div class="layui-row">
-                        <div class="layui-col-xs4 margin-right-5" style="width: 120px;"><select class="layui-select block full-width" lay-ignore name="province"></select></div>
-                        <div class="layui-col-xs4 margin-right-5" style="width: 120px;"><select class="layui-select block full-width" lay-ignore name="city"></select></div>
-                        <div class="layui-col-xs4 margin-right-5" style="width: 120px;"><select class="layui-select block full-width" lay-ignore name="county"></select></div>
-                    </div>-->
-                </div>
-            </label>
-        </div>
-        <div class="layui-form-item layui-row layui-col-space15">
-
-            <label class="layui-col-xs9 relative">
-                <span class="color-green">活动详细地址</span>
-                <input name="address" readonly="readonly" required class="layui-input" placeholder="请输入活动详细地址" value="{$vo.address|default=''}">
-            </label>
-        </div>
-
-        <div class="layui-form-item">
-            <span class="color-green label-required-prev">活动LOGO及轮播展示图片</span>
-            <table class="layui-table">
-                <thead>
-                <tr>
-                    <th class="text-center">LOGO</th>
-                    <th class="text-left">展示图片</th>
-                </tr>
-                <tr>
-                    <td width="90px" class="text-center"><input name="logo" type="hidden" value="{$vo.logo|default=''}"></td>
-                    <td width="auto" class="text-left"><input name="image" type="hidden" value="{$vo.image|default=''}"></td>
-                </tr>
-                </thead>
-            </table>
-            <script>$('[name="logo"]').uploadOneImage(), $('[name="image"]').uploadMultipleImage()</script>
-        </div>
-
-        <div class="layui-form-item block">
-            <span class="label-required-prev color-green">活动详细内容</span>
-            <textarea name="content" readonly="readonly">{$vo.content|default=''|raw}</textarea>
-        </div>
-
-    </div>
-</form>
-{/block}
-
-{block name='script'}
-<textarea class="layui-hide" id="goods-specs">{$vo.specs|raw|default=''}</textarea>
-<textarea class="layui-hide" id="goods-value">{$defaultValues|raw|default=''}</textarea>
-<script>
-
-    window.form.render();
-    require(['ckeditor', 'angular','pcasunzips'], function () {
-        window.createEditor('[name="content"]', {height: 500});
-        new PCAS("province", "city", "county", '{$vo.province|default=""}', '{$vo.city|default=""}', '{$vo.county|default=""}');
-        laydate.render({
-            elem: '#start_time-date'
-            ,type: 'time'
-            ,range: false
-            ,min:'nowTime'
-        });
-        //日期时间范围
-        laydate.render({
-            elem: '#end_time-date'
-            ,type: 'time'
-            ,range: false
-            ,min:'nowTime'
-        });
-    })
-</script>
-{/block}

+ 0 - 64
application/store/view/goods/stock.html

@@ -1,64 +0,0 @@
-<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
-
-    <div class="layui-card-body">
-
-        <div class="layui-form-item">
-            <label class="layui-form-label">商品名称</label>
-            <div class="layui-input-block">
-                <div class="layui-input layui-bg-gray">{$vo.title}</div>
-            </div>
-        </div>
-
-        <div class="layui-form-item">
-            <label class="layui-form-label">规格详情</label>
-            <div class="layui-input-block">
-                <table class="layui-table">
-                    <thead>
-                    <tr>
-                        <th class="text-left">商品规格</th>
-                        <th class="text-center">销售价格</th>
-                        <th class="text-center">库存统计</th>
-                        <th class="text-center">总销统计</th>
-                        <th class="text-center">库存剩余</th>
-                        <th class="text-center">入库数量</th>
-                    </tr>
-                    </thead>
-                    <!--{foreach $vo.list as $goods}-->
-                    <tr>
-                        <td class="padding-0" width="50%">
-                            <input class="layui-input layui-bg-gray border-0" disabled value="{$goods.goods_spec}">
-                        </td>
-                        <td class="padding-0" width="10%">
-                            <input class="layui-input text-center layui-bg-gray border-0 padding-left-0" disabled value="¥{$goods.price_selling}">
-                        </td>
-                        <td class="padding-0" width="10%">
-                            <input class="layui-input text-center layui-bg-gray border-0 padding-left-0" disabled value="{$goods.number_stock}">
-                        </td>
-                        <td class="padding-0" width="10%">
-                            <input class="layui-input text-center layui-bg-gray border-0 padding-left-0" disabled value="{$goods.number_sales} ">
-                        </td>
-                        <td class="padding-0" width="10%">
-                            <input class="layui-input text-center layui-bg-gray border-0 padding-left-0" disabled value="{$goods.number_stock-$goods.number_sales} ">
-                        </td>
-                        <td class="padding-0" width="10%">
-                            <input type="hidden" name="goods_id[]" value="{$goods.goods_id|default=''}">
-                            <input type="hidden" name="goods_spec[]" value="{$goods.goods_spec|default=''}">
-                            <input class="layui-input text-center border-0 padding-left-0" onblur="this.value=parseInt(this.value)||0" name="goods_number[]" value="0">
-                        </td>
-                    </tr>
-                    <!--{/foreach}-->
-                </table>
-            </div>
-        </div>
-
-    </div>
-
-    <div class="hr-line-dashed"></div>
-
-    <div class="layui-form-item text-center">
-        <button class="layui-btn" type='submit'>确定入库</button>
-        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消入库吗?" data-close>取消入库</button>
-        <!--{notempty name='vo.id'}--><input type='hidden' value='{$vo.id}' name='id'><!--{/notempty}-->
-    </div>
-
-</form>

+ 3 - 3
application/store/view/award/form.html → application/store/view/goods_cate/form.html

@@ -2,14 +2,14 @@
 
     <div class="layui-card-body">
 
-
         <div class="layui-row margin-bottom-15">
-            <label class="layui-col-xs2 think-form-label">奖励金额</label>
+            <label class="layui-col-xs2 think-form-label">新闻分类名称</label>
             <label class="layui-col-xs10">
-                <input name="amount" required value='{$vo.amount|default=""}' placeholder="请输入奖励金额" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" class="layui-input">
+                <input name="title" required value='{$vo.title|default=""}' placeholder="请输入新闻分类名称" class="layui-input">
             </label>
         </div>
 
+
     </div>
 
     <div class="hr-line-dashed"></div>

+ 13 - 14
application/store/view/award/index.html → application/store/view/goods_cate/index.html

@@ -1,17 +1,17 @@
 {extend name='admin@main'}
 
 {block name="button"}
-{if auth("store/award/add")}
-<button data-modal='{:url("add")}' data-title="添加奖励金额" class='layui-btn layui-btn-sm layui-btn-primary'>添加奖励金额</button>
+{if auth("store/goods_cate/add")}
+<button data-modal='{:url("add")}' data-title="添加新闻分类" class='layui-btn layui-btn-sm layui-btn-primary'>添加新闻分类</button>
 {/if}
-{if auth("store/award/remove")}
-<button data-action='{:url("remove")}' data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除奖励金额</button>
+{if auth("store/goods_cate/remove")}
+<button data-action='{:url("remove")}' data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除新闻分类</button>
 {/if}
 {/block}
 
 {block name="content"}
 <div class="think-box-shadow">
-    {include file='award/index_search'}
+    {include file='goods_cate/index_search'}
     <table class="layui-table margin-top-10" lay-skin="line">
         {notempty name='list'}
         <thead>
@@ -22,9 +22,9 @@
             <th class='list-table-sort-td'>
                 <button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
             </th>
-            <th class='text-left nowrap'>奖励金额</th>
+            <th class='text-left nowrap'>分类名称</th>
             <th class="text-center">状态</th>
-            <th class="text-center">时间</th>
+            <th class="text-center">添加时间</th>
             <th class="text-center">操作</th>
         </tr>
         </thead>
@@ -39,8 +39,7 @@
                 <input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input">
             </td>
             <td class='text-left nowrap'>
-
-                {$vo.amount|default=''}
+                {$vo.title|default=''}
             </td>
             <td class='text-center nowrap'>
                 {eq name='vo.status' value='0'}<span class="layui-badge">已禁用</span>{else}<span class="layui-badge layui-bg-green">使用中</span>{/eq}<br>
@@ -48,17 +47,17 @@
             <td class='text-center nowrap'>{$vo.create_at|format_datetime}</td>
             <td class='text-center nowrap'>
 
-                {if auth("store/award/edit")}
-                <a data-title="编辑" class="layui-btn layui-btn-sm" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
+                {if auth("store/goods_cate/edit")}
+                <a data-title="编辑新闻分类" class="layui-btn layui-btn-sm" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
                 {/if}
 
-                {if $vo.status eq 1 and auth("store/award/forbid")}
+                {if $vo.status eq 1 and auth("store/goods_cate/forbid")}
                 <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('forbid')}" data-value="id#{$vo.id};status#0">禁 用</a>
-                {elseif auth("store/award/resume")}
+                {elseif auth("store/goods_cate/resume")}
                 <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('resume')}" data-value="id#{$vo.id};status#1">启 用</a>
                 {/if}
 
-                {if auth("store/award/remove")}
+                {if auth("store/goods_cate/remove")}
                 <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除数据吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}">删 除</a>
                 {/if}
 

+ 2 - 2
application/store/view/parts/index_search.html → application/store/view/goods_cate/index_search.html

@@ -2,9 +2,9 @@
     <legend>条件搜索</legend>
     <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
         <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">零部件名称</label>
+            <label class="layui-form-label">分类名称</label>
             <div class="layui-input-inline">
-                <input name="name" value="{$Think.get.name|default=''}" placeholder="请输入零部件名称" class="layui-input">
+                <input name="title" value="{$Think.get.title|default=''}" placeholder="请输入分类名称" class="layui-input">
             </div>
         </div>
         <div class="layui-form-item layui-inline">

+ 31 - 0
application/store/view/media/form.html

@@ -0,0 +1,31 @@
+<form onsubmit="return false;" action="{:request()->url()}" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off">
+
+    <div class="layui-card-body">
+
+        <div class="layui-row margin-bottom-15">
+            <label class="layui-col-xs2 think-form-label">媒体图标</label>
+            <label class="layui-col-xs8 think-form-group-left">
+                <input name="logo" required value='{$vo.logo|default=""}' placeholder="请上传媒体图标" class="layui-input">
+            </label>
+            <a class="layui-col-xs2 layui-btn think-form-group-right" data-file="btn" data-field="logo" data-type="png,jpg,gif">
+                <i class="layui-icon layui-icon-upload"></i> 上传图片
+            </a>
+        </div>
+
+        <div class="layui-row margin-bottom-15">
+            <label class="layui-col-xs2 think-form-label">媒体名称</label>
+            <label class="layui-col-xs10">
+                <input name="title" required value='{$vo.title|default=""}' placeholder="请输入媒体名称" class="layui-input">
+            </label>
+        </div>
+
+
+    </div>
+
+    <div class="hr-line-dashed"></div>
+    <div class="layui-form-item text-center">
+        {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
+        <button class="layui-btn" type='submit'>保存数据</button>
+        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗?" data-close>取消编辑</button>
+    </div>
+</form>

+ 77 - 0
application/store/view/media/index.html

@@ -0,0 +1,77 @@
+{extend name='admin@main'}
+
+{block name="button"}
+{if auth("store/media/add")}
+<button data-modal='{:url("add")}' data-title="添加服务媒体" class='layui-btn layui-btn-sm layui-btn-primary'>添加新闻媒体</button>
+{/if}
+{if auth("store/media/remove")}
+<button data-action='{:url("remove")}' data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除新闻媒体</button>
+{/if}
+{/block}
+
+{block name="content"}
+<div class="think-box-shadow">
+    {include file='media/index_search'}
+    <table class="layui-table margin-top-10" lay-skin="line">
+        {notempty name='list'}
+        <thead>
+        <tr>
+            <th class='list-table-check-td think-checkbox' style="width: 5%">
+                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
+            </th>
+            <th class='list-table-sort-td' style="width: 5%">
+                <button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
+            </th>
+            <th class='text-left nowrap' style="width: 20%">媒体图标</th>
+            <th class='text-left nowrap' style="width: 20%">媒体名称</th>
+            <th class="text-left" style="width: 10%">状态</th>
+            <th class="text-left" style="width: 20%">创建时间</th>
+            <th class="text-left" style="width: 20%">操作</th>
+        </tr>
+        </thead>
+        {/notempty}
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='list-table-check-td think-checkbox'>
+                <input class="list-check-box" value='{$vo.id}' type='checkbox'>
+            </td>
+            <td class='list-table-sort-td'>
+                <input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input">
+            </td>
+            <td class='text-left nowrap'>
+                {notempty name='vo.logo'}
+                <img data-tips-image style="width:40px;height:40px;vertical-align:top" src="{$vo.logo|default=''}" class="margin-right-5">
+                {/notempty}
+            </td>
+            <td class='text-left nowrap'>
+                {$vo.title|default=''}
+            </td>
+            <td class='text-left nowrap'>
+                {eq name='vo.status' value='0'}<span class="layui-badge">已禁用</span>{else}<span class="layui-badge layui-bg-green">使用中</span>{/eq}<br>
+            </td>
+            <td class='text-left nowrap'>{$vo.create_at|format_datetime}</td>
+            <td class='text-left nowrap'>
+
+                {if auth("store/media/edit")}
+                <a data-title="编辑媒体" class="layui-btn layui-btn-sm" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
+                {/if}
+
+                {if $vo.status eq 1 and auth("store/media/forbid")}
+                <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('forbid')}" data-value="id#{$vo.id};status#0">禁 用</a>
+                {elseif auth("store/media/resume")}
+                <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('resume')}" data-value="id#{$vo.id};status#1">启 用</a>
+                {/if}
+
+                {if auth("store/media/remove")}
+                <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除数据吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}">删 除</a>
+                {/if}
+
+            </td>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+{/block}

+ 30 - 0
application/store/view/media/index_search.html

@@ -0,0 +1,30 @@
+<fieldset>
+    <legend>条件搜索</legend>
+    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">媒体名称</label>
+            <div class="layui-input-inline">
+                <input name="title" value="{$Think.get.title|default=''}" placeholder="请输入媒体名称" class="layui-input">
+            </div>
+        </div>
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">使用状态</label>
+            <div class="layui-input-inline">
+                <select class="layui-select" name="status">
+                    {foreach [''=>'- 全部状态 -','1'=>'使用中的媒体','0'=>'已禁用的媒体'] as $k=>$v}
+                    <!--{eq name='Think.get.status' value='$k.""'}-->
+                    <option selected value="{$k}">{$v}</option>
+                    <!--{else}-->
+                    <option value="{$k}">{$v}</option>
+                    <!--{/eq}-->
+                    {/foreach}
+                </select>
+            </div>
+        </div>
+
+        <div class="layui-form-item layui-inline">
+            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
+        </div>
+    </form>
+    <script>form.render()</script>
+</fieldset>

+ 18 - 14
application/store/view/member/index.html

@@ -7,34 +7,38 @@
         {notempty name='list'}
         <thead>
         <tr>
-            <th class='list-table-check-td think-checkbox'>
-                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
-            </th>
-            <th class='text-left nowrap'>工人姓名</th>
-            <th class='text-left nowrap'>工人手机</th>
-            <th class='text-left nowrap'>归属车间</th>
-            <th class='text-left nowrap'>积分奖励</th>
-            <th class='text-left nowrap'>导入时间</th>
-            <th class="text-center">操作</th>
+            <th class='text-left nowrap' style="width: 10%">头像</th>
+            <th class='text-left nowrap' style="width: 15%">姓名</th>
+            <th class='text-left nowrap' style="width: 15%">手机号</th>
+            <th class='text-left nowrap' style="width: 20%">个人简介</th>
+            <th class='text-left nowrap' style="width: 20%">注册时间</th>
+            <th class="text-center" style="width: 20%">操作</th>
         </tr>
         </thead>
         {/notempty}
         <tbody>
         {foreach $list as $key=>$vo}
         <tr>
-            <td class='list-table-check-td think-checkbox'>
-                <label><input class="list-check-box" value='{$vo.id}' type='checkbox'></label>
+            <td class='text-left nowrap'>
+                {notempty name='vo.headimg'}
+                <img data-tips-image style="width:20px;height:20px;vertical-align:top" src="{$vo.headimg|default=''}" class="margin-right-5">
+                {/notempty}
             </td>
             <td class='text-left nowrap'>
                 <div class="inline-block">{$vo.name|default='--'}</div>
             </td>
             <td class='text-left'>{$vo.phone|default='--'}</td>
-            <td class='text-left'>{$vo.workshop|default='--'}</td>
-            <td class='text-left'>{$vo.integral|default='--'}</td>
+            <td class='text-left'>{$vo.synopsis|default='--'}</td>
             <td class='text-left'>{$vo.create_at|format_datetime}</td>
             <td class='text-center nowrap'>
+                {if $vo.status eq 1 and auth("forbid")}
+                <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('forbid')}" data-value="id#{$vo.id};status#0">禁 用</a>
+                {elseif auth("resume")}
+                <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('resume')}" data-value="id#{$vo.id};status#1">启 用</a>
+                {/if}
+
                 {if auth("store/member/remove")}
-                <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除该工人吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}">删 除</a>
+                <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除该用户吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}">删 除</a>
                 {/if}
             </td>
         </tr>

+ 8 - 58
application/store/view/member/index_search.html

@@ -2,81 +2,31 @@
     <legend>条件搜索</legend>
     <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
         <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">员工名称</label>
+            <label class="layui-form-label">姓名</label>
             <div class="layui-input-inline">
-                <input name="name" value="{$Think.get.name|default=''}" placeholder="请输入员工名称" class="layui-input">
+                <input name="nickname" value="{$Think.get.nickname|default=''}" placeholder="请输入微信昵称" class="layui-input">
             </div>
         </div>
         <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">员工手机</label>
+            <label class="layui-form-label">手机</label>
             <div class="layui-input-inline">
-                <input name="phone" value="{$Think.get.phone|default=''}" placeholder="请输入员工手机号" class="layui-input">
-            </div>
-        </div>
-        <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">归属车间</label>
-            <div class="layui-input-inline">
-                <select class="layui-select" name="workshop">
-                    <option value="">-- 全部车间 --</option>
-                    {foreach $workshop_arr as $k=>$v}
-                    <!--{eq name='Think.get.workshop' value='$k.""'}-->
-                    <option selected value="{$k}">{$v}</option>
-                    <!--{else}-->
-                    <option value="{$k}">{$v}</option>
-                    <!--{/eq}-->
-                    {/foreach}
-                </select>
+                <input name="phone" value="{$Think.get.phone|default=''}" placeholder="请输入手机号" class="layui-input">
             </div>
         </div>
 
         <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">导入时间</label>
+            <label class="layui-form-label">注册时间</label>
             <div class="layui-input-inline">
-                <input name="create_at" value="{$Think.get.create_at|default=''}" placeholder="请选择导入时间" class="layui-input">
+                <input name="create_at" value="{$Think.get.create_at|default=''}" placeholder="请选择注册时间" class="layui-input">
             </div>
         </div>
         <div class="layui-form-item layui-inline">
             <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
-            <button type="button" data-export-list class="layui-btn layui-btn-primary" id="download"><i class="layui-icon layui-icon-export"></i> 导出模板</button>
-        </div>
-        <div class="layui-form-item layui-inline" style="margin-left: 5px;">
-            <div  data-title="导入" class='layui-btn layui-btn-sm layui-btn-primary' id="lead">导入员工</div>
+            <button type="button" data-export-list class="layui-btn layui-btn-primary layui-hide"><i class="layui-icon layui-icon-export"></i> 导 出</button>
         </div>
     </form>
     <script>
         form.render();
-        laydate.render({range: true, elem: '[name="create_at"]'});
-        layui.use('upload', function(){
-            var upload = layui.upload;
-            //执行实例
-            var uploadInst = upload.render({
-                elem: '#lead' //绑定元素
-                ,url: '/store/member/lead'
-                ,accept: 'file' //普通文件,
-                ,data:{
-                    subject_id:function(){
-                        return $('#subject').val();
-                    }
-                }
-                ,before: function(obj){ //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
-                }
-                ,done: function(res){
-                    if(res.code == 0){
-                        layer.msg(res.info);
-                    }else{
-                        layer.msg('导入成功');
-                        setTimeout(function(){
-                            location.reload();
-                        },2000);
-                    }
-                }
-                ,error: function(){
-                    layer.msg('上传失败');
-                }
-            });
-        });
-        $('#download').click(function () {
-            window.location.href = "{:url('export')}";
-        });
+        laydate.render({range: true, elem: '[name="create_at"]'})
     </script>
 </fieldset>

+ 40 - 0
application/store/view/message/index.html

@@ -0,0 +1,40 @@
+{extend name='admin@main'}
+
+{block name="content"}
+<div class="think-box-shadow">
+    {include file='message/index_search'}
+    <table class="layui-table margin-top-10" lay-skin="line">
+        {notempty name='list'}
+        <thead>
+        <tr>
+            <th class='list-table-check-td think-checkbox'>
+                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
+            </th>
+            <th class='text-left nowrap'>发送手机</th>
+            <th class='text-left nowrap'>短信内容</th>
+            <th class='text-left nowrap'>返回结果</th>
+            <th class='text-left nowrap'>发送时间</th>
+            <th></th>
+        </tr>
+        </thead>
+        {/notempty}
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='list-table-check-td think-checkbox'><input class="list-check-box" value='{$vo.id}' type='checkbox'></td>
+            <td>{$vo.phone|default=''}</td>
+            <td>验证码为:{$vo.code|default=''}</td>
+            <td>{$vo.result|default=''}</td>
+            <td>{$vo.create_at|default=''}<br></td>
+            <td>
+                {if auth("store/member/remove")}
+                <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除数据吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}">删 除</a>
+                {/if}
+            </td>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+{/block}

+ 5 - 14
application/store/view/principal/index_search.html → application/store/view/message/index_search.html

@@ -2,22 +2,16 @@
     <legend>条件搜索</legend>
     <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
         <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">负责人名称</label>
+            <label class="layui-form-label">发送手机</label>
             <div class="layui-input-inline">
-                <input name="name" value="{$Think.get.name|default=''}" placeholder="请输入负责人名称" class="layui-input">
-            </div>
-        </div>
-        <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">负责人手机</label>
-            <div class="layui-input-inline">
-                <input name="phone" value="{$Think.get.phone|default=''}" placeholder="请输入负责人手机号" class="layui-input">
+                <input name="phone" value="{$Think.get.phone|default=''}" placeholder="请输入会员手机" class="layui-input">
             </div>
         </div>
 
         <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">创建时间</label>
+            <label class="layui-form-label">发送时间</label>
             <div class="layui-input-inline">
-                <input name="create_at" value="{$Think.get.create_at|default=''}" placeholder="请选择创建时间" class="layui-input">
+                <input name="create_at" value="{$Think.get.create_at|default=''}" placeholder="请选择发送时间" class="layui-input">
             </div>
         </div>
         <div class="layui-form-item layui-inline">
@@ -25,8 +19,5 @@
             <button type="button" data-export-list class="layui-btn layui-btn-primary layui-hide"><i class="layui-icon layui-icon-export"></i> 导 出</button>
         </div>
     </form>
-    <script>
-        form.render();
-        laydate.render({range: true, elem: '[name="create_at"]'});
-    </script>
+    <script>window.laydate.render({range: true, elem: '[name="create_at"]'})</script>
 </fieldset>

+ 58 - 0
application/store/view/notice/form.html

@@ -0,0 +1,58 @@
+<form onsubmit="return false;" action="{:request()->url()}" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off">
+
+    <div class="layui-card-body">
+
+
+        <div class="layui-row margin-bottom-15">
+            <label class="layui-form-label label-required">系统消息</label>
+            <div class="layui-input-block">
+                <input name="title" required value='{$vo.title|default=""}' placeholder="请输入系统消息" class="layui-input">
+            </div>
+        </div>
+
+        <!--<div class="layui-row margin-bottom-15">
+            <div>
+                <label class="layui-col-xs2 think-form-label" >发放:</label>
+                <label class="think-radio layui-col-xs2 think-form-label margin-top-0 padding-left-0 text-left padding-right-0" style="width: 40%;">
+                    <input type="radio" checked  name="user" value="1" lay-ignore class="margin-left-10" lay-filter="user" onclick="checkeds(this)">全部用户({$member_count}人)
+                    <input type="radio" name="user" value="0" lay-ignore lay-filter="user" onclick="checkeds(this)" >指定用户
+
+                </label>
+            </div>
+        </div>-->
+
+
+        <div class="layui-row margin-bottom-15" id="goods" style="display: none">
+            <div>
+                <label class="layui-col-xs2 think-form-label">选择用户:</label>
+                <label class="layui-col-xs10">
+                    <select class="layui-select" required name="user_ids" lay-search >
+                        <!-- {foreach $member as $me}-->
+                        <option  value="{$me.id}">{$me.name}</option>
+                        <!-- {/foreach}-->
+                    </select>
+                </label>
+            </div>
+        </div>
+    </div>
+
+    <div class="hr-line-dashed"></div>
+    <div class="layui-form-item text-center">
+        {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
+        <button class="layui-btn" type='submit'>保存数据</button>
+        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗?" data-close>取消编辑</button>
+    </div>
+    <script>
+        window.form.render();
+        require(['ckeditor', 'angular'], function () {
+            window.createEditor('[name="content"]', {height: 260});
+        })
+        function checkeds(obj){
+            if($(obj).attr('value')==0){
+                $('#goods').show();
+            }else{
+                $('#goods').hide();
+            }
+        }
+    </script>
+</form>

+ 72 - 0
application/store/view/notice/index.html

@@ -0,0 +1,72 @@
+{extend name='admin@main'}
+
+{block name="button"}
+{if auth("store/notice/add")}
+<button data-modal='{:url("add")}' data-title="添加系统消息" class='layui-btn layui-btn-sm layui-btn-primary'>添加系统消息</button>
+{/if}
+{if auth("store/notice/remove")}
+<button data-action='{:url("remove")}' data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除系统消息</button>
+{/if}
+{/block}
+
+{block name="content"}
+<div class="think-box-shadow">
+    {include file='notice/index_search'}
+    <table class="layui-table margin-top-10" lay-skin="line">
+        {notempty name='list'}
+        <thead>
+        <tr>
+            <th class='list-table-check-td think-checkbox'>
+                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
+            </th>
+            <th class='list-table-sort-td'>
+                <button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
+            </th>
+            <th class='text-left nowrap'>系统消息标题</th>
+            <th class="text-center">状态</th>
+            <th class="text-center">时间</th>
+            <th>操作</th>
+        </tr>
+        </thead>
+        {/notempty}
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='list-table-check-td think-checkbox'>
+                <input class="list-check-box" value='{$vo.id}' type='checkbox'>
+            </td>
+            <td class='list-table-sort-td'>
+                <input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input">
+            </td>
+            <td class='text-left nowrap'>
+
+                {$vo.title|default=''}
+            </td>
+            <td class='text-center nowrap'>
+                {eq name='vo.status' value='0'}<span class="layui-badge">已禁用</span>{else}<span class="layui-badge layui-bg-green">使用中</span>{/eq}<br>
+            </td>
+            <td class='text-center nowrap'>{$vo.create_at|format_datetime}</td>
+            <td class='text-left nowrap'>
+
+                <!--{if auth("store/notice/edit")}
+                <a data-title="编辑系统消息" class="layui-btn layui-btn-sm" data-open='{:url("edit")}?id={$vo.id}'>编 辑</a>
+                {/if}-->
+
+                <!--{if $vo.status eq 1 and auth("store/notice/forbid")}
+                <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('forbid')}" data-value="id#{$vo.id};status#0">禁 用</a>
+                {elseif auth("store/notice/resume")}
+                <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('resume')}" data-value="id#{$vo.id};status#1">启 用</a>
+                {/if}-->
+
+                {if auth("store/notice/remove")}
+                <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除数据吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}">删 除</a>
+                {/if}
+
+            </td>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+{/block}

+ 30 - 0
application/store/view/notice/index_search.html

@@ -0,0 +1,30 @@
+<fieldset>
+    <legend>条件搜索</legend>
+    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">系统消息</label>
+            <div class="layui-input-inline">
+                <input name="title" value="{$Think.get.title|default=''}" placeholder="请输入系统消息" class="layui-input">
+            </div>
+        </div>
+        <!--<div class="layui-form-item layui-inline">
+            <label class="layui-form-label">使用状态</label>
+            <div class="layui-input-inline">
+                <select class="layui-select" name="status">
+                    {foreach [''=>'- 全部状态 -','1'=>'使用中','0'=>'已禁用'] as $k=>$v}
+                    &lt;!&ndash;{eq name='Think.get.status' value='$k.""'}&ndash;&gt;
+                    <option selected value="{$k}">{$v}</option>
+                    &lt;!&ndash;{else}&ndash;&gt;
+                    <option value="{$k}">{$v}</option>
+                    &lt;!&ndash;{/eq}&ndash;&gt;
+                    {/foreach}
+                </select>
+            </div>
+        </div>-->
+
+        <div class="layui-form-item layui-inline">
+            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
+        </div>
+    </form>
+    <script>form.render()</script>
+</fieldset>

+ 0 - 380
application/store/view/order/form.html

@@ -1,380 +0,0 @@
-{extend name='admin@main'}
-
-{block name="content"}
-{include file='store@goods/form_style'}
-<style>
-    .layui-form-radio{
-        margin: 0 !important;
-        padding-right:0 !important;
-    }
-</style>
-<form onsubmit="return false;" id="GoodsForm" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off">
-    <div class="layui-card-body think-box-shadow padding-left-40">
-
-        <div class="layui-form-item layui-row layui-col-space15">
-            <label class="layui-col-xs9 relative">
-                <span class="color-green">货号</span>
-                <input name="goods_no" required class="layui-input" placeholder="请输入货号" value="{$vo.goods_no|default=''}">
-            </label>
-        </div>
-
-        <div class="layui-form-item layui-row layui-col-space15">
-            <label class="layui-col-xs9 relative">
-                <span class="color-green">货品尺寸</span>
-                <input name="goods_size" required class="layui-input" placeholder="请输入货品尺寸" value="{$vo.goods_size|default=''}">
-            </label>
-        </div>
-
-        <div class="layui-form-item layui-row layui-col-space15">
-            <label class="layui-col-xs9 relative">
-                <span class="color-green">货品单价</span>
-                <input name="goods_price" class="layui-input" placeholder="请输入货品单价" value="{$vo.goods_price|default=''}">
-            </label>
-        </div>
-
-        <div class="layui-form-item layui-row layui-col-space15">
-            <label class="layui-col-xs9 relative">
-                <span class="color-green">装率(装修尺寸)</span>
-                <input name="box_size" required class="layui-input" placeholder="请输入装率(装修尺寸)" value="{$vo.box_size|default=''}">
-            </label>
-        </div>
-
-        <div class="layui-form-item layui-row layui-col-space15">
-            <label class="layui-col-xs9 relative">
-                <span class="color-green">体积</span>
-                <input name="volume" class="layui-input" placeholder="请输入体积" value="{$vo.volume|default=''}">
-            </label>
-        </div>
-
-        <div class="layui-form-item layui-row layui-col-space15">
-            <label class="layui-col-xs9 relative">
-                <span class="color-green">数量</span>
-                <input name="goods_num" class="layui-input" placeholder="请输入数量" value="{$vo.goods_num|default=''}">
-            </label>
-        </div>
-
-        <div class="layui-form-item layui-row layui-col-space15">
-            <label class="layui-col-xs9 relative">
-                <span class="color-green">箱数</span>
-                <input name="box_num" class="layui-input" placeholder="请输入箱数" value="{$vo.box_num|default=''}">
-            </label>
-        </div>
-
-        <div class="layui-form-item layui-row layui-col-space15">
-            <label class="layui-col-xs9 relative">
-                <span class="color-green">总金额</span>
-                <input name="price_total" class="layui-input" placeholder="请输入总金额" value="{$vo.price_total|default=''}">
-            </label>
-        </div>
-
-
-        <div class="layui-form-item" data-storage-type="qiniu">
-            <label class="layui-form-labe color-green">是否是半成品</label>
-            <div class="layui-input-block margin-left-0 margin-top-15">
-                {foreach [1=>'是',0=>'不是'] as $sk=>$sv}
-                <!--{php}isset($vo['is_bcp']) or $vo['is_bcp']=0;{/php}-->
-                <!--{if $vo['is_bcp'] eq $sk}-->
-                <label >
-                    <input checked type="radio" name="is_bcp" value="{$sk}"  lay-filter="is_bcp">
-                </label>
-                <!--{else}-->
-                <label>
-                    <input type="radio" name="is_bcp" value="{$sk}"  lay-filter="is_bcp" >
-                </label>
-                <!--{/if}-->
-                <span class="margin-right-10">{$sv}</span>
-                {/foreach}
-            </div>
-        </div>
-
-        <div class="layui-form-item">
-            <span class="color-green label-required-prev">生产信息</span>
-            <div ng-repeat="x in specs track by $index" style="width: 75%;display:none" class="margin-bottom-10" ng-class="{true:'layui-show'}[isAddMode&&specs.length>0]" >
-                <div class="goods-spec-box padding-10 margin-0 relative" style="background:#ddd">
-                    <span class="text-center goods-spec-title">分组</span>
-                    <label class="label-required-null inline-block"><input ng-blur="x.name=trimSpace(x.name)" ng-model="x.name" required placeholder="请输入分组名称"></label>
-                    <div class="pull-right">
-                        <a class="layui-btn layui-btn-sm layui-btn-primary goods-spec-btn" ng-click="addSpecVal(x.list)">增加</a>
-                        <a class="layui-btn layui-btn-sm layui-btn-primary goods-spec-btn" ng-class="{false:'layui-bg-gray'}[$index>0]" ng-click="upSpecRow(specs,$index)">上移</a>
-                        <a class="layui-btn layui-btn-sm layui-btn-primary goods-spec-btn" ng-class="{false:'layui-bg-gray'}[$index<specs.length-1]" ng-click="dnSpecRow(specs,$index)">下移</a>
-                        <a class="layui-btn layui-btn-sm layui-btn-primary goods-spec-btn" ng-click="delSpecRow(specs,$index)" ng-if="specs.length>1">删除</a>
-                    </div>
-                </div>
-                <div class="goods-spec-box padding-10 margin-0 layui-bg-gray block relative" ng-if="x.list && x.list.length > 0">
-                    <label class="label-required-null inline-block margin-right-10 margin-bottom-5 relative nowrap" ng-repeat="xx in x.list">
-                        <input type="checkbox" lay-ignore ng-model="xx.check" ng-click="xx.check=checkListChecked(x.list,$event.target.checked)">
-                        <input type="text" ng-blur="xx.name=trimSpace(xx.name)" ng-model="xx.name" ng-keyup="xx.name=$event.target.value" required placeholder="请输入产品名称">
-                        <a ng-if="x.list.length>1" ng-click="x.list=delSpecVal(x.list,$index)" class="layui-icon layui-icon-close font-s12 goods-spec-close"></a>
-                    </label>
-                </div>
-            </div>
-            <!--<a ng-if="isAddMode&&specs.length<3" class="layui-btn layui-btn-sm layui-btn-primary" ng-click="addSpecRow(specs)">增加分组</a>-->
-            <table class="layui-table margin-top-10" style="width: 75%;">
-                <thead>
-                <tr>
-                    <th ng-repeat="x in specsTreeNava track by $index" class="nowrap" ng-bind="x"></th>
-
-                    <th width="20%"  class="text-center nowrap">产品数量 <a ng-click="batchSet('virtual',0)" data-tips-text="批量设置" class="layui-icon">&#xe63c;</a></th>
-
-                </tr>
-                </thead>
-                <tbody>
-                <tr ng-repeat="rows in specsTreeData track by $index">
-                    <td class="layui-bg-gray" ng-if="td.show" rowspan="{{td.span}}" ng-repeat="td in rows" ng-bind="td.name"></td>
-
-                    <td class="padding-0">
-                        <label class="padding-0 margin-0">
-                            <input ng-blur="rows[0].num=setValue(rows[0].key,'num',$event.target.value,'(parseInt(_)||0)')" class="layui-input border-0 padding-left-0 text-center" ng-model="rows[0].num">
-                        </label>
-                    </td>
-
-                </tr>
-                </tbody>
-            </table>
-            <!--<p class="color-desc">请从仓储平台获取商品SKU与商品条码,请注意尽量不要重复,也不能产生订单后再修改!</p>-->
-            <textarea class="layui-textarea layui-hide" name="specs">{{specs}}</textarea>
-            <textarea class="layui-textarea layui-hide" name="lists">{{specsTreeData}}</textarea>
-        </div>
-        <div class="layui-form-item layui-row layui-col-space15">
-            <label class="layui-col-xs9 relative">
-                <span class="color-green">描述</span>
-                <textarea  class="layui-textarea" name="description" style="min-height: 100px;">{$vo.description|default=""}</textarea>
-            </label>
-        </div>
-
-        <div class="layui-form-item">
-            <span class="color-green label-required-prev">服务详情图</span>
-            <table class="layui-table"  style="width: 75%;">
-                <thead>
-                <tr>
-
-                    <th class="text-left">展示图片</th>
-                </tr>
-                <tr>
-                    <td width="auto" class="text-left"><input name="goods_image" type="hidden" value="{$vo.goods_image|default=''}"></td>
-                </tr>
-                </thead>
-            </table>
-            <script>$('[name="goods_image"]').uploadMultipleImage()</script>
-        </div>
-
-        <div class="layui-form-item layui-row layui-col-space15">
-            <label class="layui-col-xs9 relative">
-                <span class="color-green">客户名称</span>
-                <input name="client_name" required class="layui-input" placeholder="请输入客户名称" value="{$vo.client_name|default=''}">
-            </label>
-        </div>
-
-        <div class="layui-form-item layui-row layui-col-space15">
-            <label class="layui-col-xs9 relative">
-                <span class="color-green">国家</span>
-                <input name="client_country" required class="layui-input" placeholder="请输入货品尺寸" value="{$vo.client_country|default='中国'}">
-            </label>
-        </div>
-        <div class="layui-form-item layui-row layui-col-space15">
-            <label class="layui-col-xs9 relative">
-                <span class="color-green">邮箱</span>
-                <input name="client_mail" required class="layui-input" placeholder="请输入邮箱" value="{$vo.client_mail|default=''}">
-            </label>
-        </div>
-        <div class="layui-form-item layui-row layui-col-space15">
-            <label class="layui-col-xs9 relative">
-                <span class="color-green">电话</span>
-                <input name="client_phone" required class="layui-input" placeholder="请输入邮箱" value="{$vo.client_phone|default=''}">
-            </label>
-        </div>
-        <div class="layui-form-item layui-row layui-col-space15">
-            <label class="layui-col-xs9 relative">
-                <span class="color-green">下单号(合同号)</span>
-                <input name="client_contrac_no" required class="layui-input" placeholder="请输入邮箱" value="{$vo.client_contrac_no|default=''}">
-            </label>
-        </div>
-        <div class="layui-form-item layui-row layui-col-space15">
-            <label class="layui-col-xs9 relative">
-                <span class="color-green">交付日期</span>
-                <input type="text" name="deliver_at" class="layui-input" value="{:sysconf('deliver_at')}" id="deliver_at" placeholder="yyyy-MM-dd">
-            </label>
-        </div>
-        <div class="layui-form-item">
-            <span class="color-green label-required-prev">客户回执单</span>
-            <table class="layui-table"  style="width: 75%;">
-                <thead>
-                <tr>
-                    <th class="text-left">回执单</th>
-                </tr>
-                <tr>
-                    <td width="10px" class="text-left"><input name="receipt_file" type="hidden" value="{$vo.receipt_file|default=''}"></td>
-                </tr>
-                </thead>
-            </table>
-            <script>$('[name="receipt_file"]').uploadOneImage()</script>
-        </div>
-
-
-        <div class="layui-form-item">
-            <span class="color-green label-required-prev">原始合同</span>
-            <table class="layui-table"  style="width: 75%;">
-                <thead>
-                <tr>
-
-                    <th class="text-left">原始合同</th>
-                </tr>
-                <tr>
-                    <td width="auto" class="text-left"><input name="compact_file" type="hidden" value="{$vo.compact_file|default=''}"></td>
-                </tr>
-                </thead>
-            </table>
-            <script>$('[name="compact_file"]').uploadOneImage()</script>
-        </div>
-
-        <div class="layui-form-item text-center">
-            {notempty name='vo.id'}<input type="hidden" name="id" value="{$vo.id}">{/notempty}
-            <button class="layui-btn layui-btn-danger" ng-click="hsitoryBack()" type="button">取消编辑</button>
-            <button class="layui-btn" type="submit">保存订单</button>
-        </div>
-
-    </div>
-</form>
-{/block}
-
-{block name='script'}
-<textarea class="layui-hide" id="goods-specs">{$vo.specs|raw|default=''}</textarea>
-<textarea class="layui-hide" id="goods-value">{$defaultValues|raw|default=''}</textarea>
-<script>
-    window.form.render();
-
-
-    require(['ckeditor', 'angular'], function () {
-        var app = angular.module("GoodsForm", []).run(callback);
-        angular.bootstrap(document.getElementById(app.name), [app.name]);
-
-        function callback($rootScope) {
-            $rootScope.isAddMode = parseInt('{$isAddMode|default=0}');
-            $rootScope.maps = JSON.parse(angular.element('#goods-value').val() || '[]') || {};
-            $rootScope.specs = JSON.parse(angular.element('#goods-specs').val() || '[{"name":"产品名称","list":[{"name":"请输入产品名称","check":true}]}]');
-            // 批量设置数值
-            $rootScope.batchSet = function (type, fixed) {
-                layer.prompt({title: '请输入数值', formType: 0}, function (value, index) {
-                    $rootScope.$apply(function () {
-                        var val = (parseFloat(value) || 0).toFixed(fixed);
-                        for (var i in $rootScope.specsTreeData) for (var j in $rootScope.specsTreeData[i]) {
-                            $rootScope.specsTreeData[i][j][type] = val;
-                        }
-                    });
-                    layer.close(index);
-                });
-            };
-            // 返回商品列表
-            $rootScope.hsitoryBack = function () {
-                $.msg.confirm('确定要取消编辑吗?', function (index) {
-                    history.back(), $.msg.close(index);
-                });
-            };
-            // 设置默认值
-            $rootScope.setValue = function (key, type, value, call) {
-                $rootScope.maps[key] || ($rootScope.maps[key] = {});
-                return $rootScope.maps[key][type] = eval(call.replace('_', "'" + value + "'"));
-            };
-            // 读取默认值
-            $rootScope.getValue = function (key, callback) {
-                if (typeof callback === 'function') {
-                    return callback($rootScope.maps[key] || {});
-                }
-                return {};
-            };
-            // 去除空白字符
-            $rootScope.trimSpace = function (value) {
-                return (value + '').replace(/\s*/ig, '');
-            };
-            // 生成交叉表格数据
-            $rootScope.specsTreeData = [];
-            $rootScope.specsTreeNava = [];
-            // 当前商品规格发生变化时重新计算规格列表
-            $rootScope.$watch('specs', function () {
-                var data = $rootScope.specs, list = [], navs = [], table = [[]];
-                // 过滤无效记录
-                for (var i in data) {
-                    var tmp = [];
-                    for (var j in data[i].list) if (data[i].list[j].check && data[i].list[j].name.length > 0) {
-                        data[i].list[j].span = 1, data[i].list[j].show = true, data[i].list[j].group = data[i].name;
-                        tmp.push(data[i].list[j]);
-                    }
-                    list.push(tmp), navs.push(data[i].name);
-                }
-                $rootScope.specsTreeNava = navs;
-                // 表格交叉
-                for (var i in list) {
-                    var tmp = [];
-                    for (var j in table) for (var k in list[i]) tmp.push(table[j].concat(list[i][k]));
-                    table = tmp;
-                }
-                // 表格合并
-                list = angular.fromJson(angular.toJson(table));
-                for (var i in list) {
-                    var key = [], _key = '';
-                    for (var td in list[i]) key.push(list[i][td].group + '::' + list[i][td].name);
-                    for (var td in list[i]) if (_key.length === 0) {
-                        list[i][0].key = _key = key.join(';;');
-                        list[i][0].num = $rootScope.getValue(_key, function (data) {
-                            return data.num || '0';
-                        });
-                    }
-                }
-                $rootScope.specsTreeData = list;
-            }, true);
-            // 判断规则是否能取消选择
-            $rootScope.checkListChecked = function (list, check) {
-                for (var i in list) if (list[i].check) return check;
-                return true;
-            };
-            // 增加整行规格分组
-            $rootScope.addSpecRow = function (data) {
-                data.push({name: '规格分组', list: [{name: '规格属性', check: true}]})
-            };
-            // 下移整行规格分组
-            $rootScope.dnSpecRow = function (data, $index) {
-                var tmp = [], cur = data[$index];
-                if ($index > data.length - 2) return false;
-                for (var i in data) {
-                    (parseInt(i) !== parseInt($index)) && tmp.push(data[i]);
-                    (parseInt(i) === parseInt($index) + 1) && tmp.push(cur);
-                }
-                return $rootScope.specs = tmp;
-            };
-            // 上移整行规格分组
-            $rootScope.upSpecRow = function (data, $index) {
-                var tmp = [], cur = data[$index];
-                if ($index < 1) return false;
-                for (var i in data) {
-                    (parseInt(i) === parseInt($index) - 1) && tmp.push(cur);
-                    (parseInt(i) !== parseInt($index)) && tmp.push(data[i]);
-                }
-                return $rootScope.specs = tmp;
-            };
-            // 移除整行规格分组
-            $rootScope.delSpecRow = function (data, $index) {
-                var tmp = [];
-                for (var i in data) if (parseInt(i) !== parseInt($index)) tmp.push(data[i]);
-                return $rootScope.specs = tmp;
-            };
-            // 增加分组的属性
-            $rootScope.addSpecVal = function (list) {
-                list.push({name: '规格属性', check: true});
-            };
-            // 移除分组的属性
-            $rootScope.delSpecVal = function (data, $index) {
-                var temp = [];
-                for (var i in data) if (parseInt(i) !== parseInt($index)) temp.push(data[i]);
-                return temp;
-            };
-        }
-    })
-    layui.use('laydate', function(){
-        var laydate = layui.laydate;
-        //时间选择器
-        laydate.render({
-            elem: '#deliver_at'
-        });
-    });
-</script>
-{/block}

+ 0 - 85
application/store/view/order/index.html

@@ -1,85 +0,0 @@
-{extend name='admin@main'}
-
-
-{block name="button"}
-{if $member_id > 0}
-<div style="margin-right: 20px;">
-<button data-open='{:url("add")}' data-title="添加订单" class='layui-btn layui-btn-sm layui-btn-primary'>添加订单</button>
-</div>
-{/if}
-{/block}
-
-{block name="content"}
-<div class="think-box-shadow">
-    {include file='order/index_search'}
-    <table class="layui-table margin-top-10" lay-skin="line">
-        {notempty name='list'}
-        <thead>
-        <tr>
-            <th class="text-left nowrap">详细信息</th>
-            <th class="text-left nowrap">订单信息</th>
-            <th class='text-left nowrap'>生产信息</th>
-            <th class='text-left nowrap'>半成品信息</th>
-            <th class='text-left nowrap'>客户信息</th>
-        </tr>
-        </thead>
-        {/notempty}
-        <tbody>
-        {foreach $list as $key=>$vo}
-        <tr>
-            <td class="text-left nowrap relative">
-                尺寸:<span class="color-blue">{$vo.goods_size|default=''}</span><br>
-                单价:<span class="color-blue">{$vo.goods_price|default=''}</span><br>
-                装率:<span class="color-blue">{$vo.box_size|default=''}</span><br>
-                体积:<span class="color-blue">{$vo.volume|default=''}</span><br>
-                数量:<span class="color-blue">{$vo.goods_num|default=''}</span><br>
-                箱数:<span class="color-blue">{$vo.box_num|default=''}</span><br>
-                总金额:<span class="color-blue">{$vo.price_total|default=''}</span><br>
-            </td>
-            <td class='text-left nowrap'>
-                订单单号:<span class="color-blue">{$vo.order_no|default=''}</span><br>
-                货号:<span class="color-blue">{$vo.goods_no|default=''}</span><br>
-                是否是半成品:<span class="color-blue">{if $vo.is_bcp == 1}是{else}不是{/if}</span><br>
-                描述:<span class="color-blue">{$vo.description|default=''}</span><br>
-                图片:<span class="color-blue">
-                        {if $vo.goods_image}
-                            {foreach $vo.goods_image as $v}
-                            <img data-tips-image style="width:20px;height:20px" src="{$v|default=''}" class="margin-right-5 text-top">
-                            {/foreach}
-                        {/if}
-                    </span><br>
-                提交时间:{$vo.create_at|format_datetime}<br>
-            </td>
-            <td class="text-left nowrap">
-                {if $vo.product_info}
-                {foreach $vo.product_info as $v}
-                    {$v['name']}:<span class="color-blue">{$v['num']|default=''}</span><br>
-                {/foreach}
-                {/if}
-            </td>
-            <td class="text-left nowrap">
-                {if $vo.bcp_image}
-                    {foreach $vo.bcp_image as $v}
-                        <img data-tips-image style="width:20px;height:20px" src="{$v|default=''}" class="margin-right-5 text-top">
-                    {/foreach}
-                {else}
-                    暂无半成品
-                {/if}
-            </td>
-            <td class="text-left nowrap relative">
-                客户名称:<span class="color-blue">{$vo.client_name|default=''}</span><br>
-                国家:<span class="color-blue">{$vo.client_country|default=''}</span><br>
-                邮箱:<span class="color-blue">{$vo.client_mail|default=''}</span><br>
-                电话:<span class="color-blue">{$vo.client_phone|default=''}</span><br>
-                下单号:<span class="color-blue">{$vo.client_contrac_no|default=''}</span><br>
-                交付日期:<span class="color-blue">{$vo.deliver_at|default=''}</span><br>
-            </td>
-        </tr>
-        {/foreach}
-        </tbody>
-    </table>
-
-    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
-
-</div>
-{/block}

+ 0 - 41
application/store/view/order/index_search.html

@@ -1,41 +0,0 @@
-<fieldset>
-    <legend>条件搜索</legend>
-    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
-        <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">订单单号</label>
-            <div class="layui-input-inline">
-                <input name="order_no" value="{$Think.get.order_no|default=''}" placeholder="请输入订单单号" class="layui-input">
-            </div>
-        </div>
-        <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">货号</label>
-            <div class="layui-input-inline">
-                <input name="goods_no" value="{$Think.get.goods_no|default=''}" placeholder="请输入货号" class="layui-input">
-            </div>
-        </div>
-        <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">下单号</label>
-            <div class="layui-input-inline">
-                <input name="client_contrac_no" value="{$Think.get.client_contrac_no|default=''}" placeholder="请输入下单号" class="layui-input">
-            </div>
-        </div>
-        <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">客户姓名</label>
-            <div class="layui-input-inline">
-                <input name="client_name" value="{$Think.get.client_name|default=''}" placeholder="请输入客户姓名" class="layui-input">
-            </div>
-        </div>
-        <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">客户手机</label>
-            <div class="layui-input-inline">
-                <input name="client_phone" value="{$Think.get.client_phone|default=''}" placeholder="请输入客户手机" class="layui-input">
-            </div>
-        </div>
-        <div class="layui-form-item layui-inline">
-            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
-        </div>
-    </form>
-    <script>
-        window.form.render();
-    </script>
-</fieldset>

+ 0 - 65
application/store/view/principal/form.html

@@ -1,65 +0,0 @@
-
-<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
-    <div class="layui-card-body">
-
-        <div class="layui-form-item">
-            <label class="layui-form-label label-required">负责人类型</label>
-            <div class="layui-input-block">
-                <select class="layui-select" lay-filter="type" name="type">
-                    {foreach $type as $k=>$v}
-                    <!--{if isset($vo.type) && $vo.type==$k}-->
-                    <option selected value="{$k}">{$v}</option>
-                    <!--{else}-->
-                    <option value="{$k}">{$v}</option>
-                    <!--{/if}-->
-                    {/foreach}
-                </select>
-            </div>
-        </div>
-
-        <div class="layui-form-item workshop">
-            <label class="layui-form-label label-required">归属车间</label>
-            <div class="layui-input-block">
-                <select class="layui-select" name="workshop">
-                    {foreach $workshop as $k=>$v}
-                    <!--{if isset($vo.workshop) && $vo.type==$k}-->
-                    <option selected value="{$k}">{$v}</option>
-                    <!--{else}-->
-                    <option value="{$k}">{$v}</option>
-                    <!--{/if}-->
-                    {/foreach}
-                </select>
-            </div>
-        </div>
-
-        <div class="layui-form-item">
-            <label class="layui-form-label label-required">负责人姓名</label>
-            <div class="layui-input-block">
-                <input name="name" required  value='{$vo.name|default=""}' placeholder="请输入负责人姓名" class="layui-input">
-            </div>
-        </div>
-        <div class="layui-form-item">
-            <label class="layui-form-label label-required">负责人手机</label>
-            <div class="layui-input-block">
-                <input name="phone" value='{$vo.phone|default=""}' required placeholder="请输入负责人手机" class="layui-input">
-            </div>
-        </div>
-
-        <div class="hr-line-dashed" style="margin:20px 0 30px 0;"></div>
-        {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
-        <div class="layui-form-item text-center">
-            <button class="layui-btn" type='submit'>保存数据</button>
-            <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗?" data-close>取消编辑</button>
-        </div>
-        <script>
-            window.form.render();
-            form.on('select(type)', function(data){
-                if(data.value == 3){
-                    $('.workshop').show();
-                }else{
-                    $('.workshop').hide();
-                }
-            });
-        </script>
-
-</form>

+ 0 - 52
application/store/view/principal/index.html

@@ -1,52 +0,0 @@
-{extend name='admin@main'}
-{block name="button"}
-{if auth("store/Principal/add")}
-<div style="margin-right: 20px;">
-<button data-modal='{:url("add")}' data-title="添加负责人" class='layui-btn layui-btn-sm layui-btn-primary'>添加负责人</button>
-</div>
-{/if}
-{/block}
-{block name="content"}
-<div class="think-box-shadow">
-    {include file='principal/index_search'}
-    <table class="layui-table margin-top-10" lay-skin="line">
-        {notempty name='list'}
-        <thead>
-        <tr>
-            <th class='list-table-check-td think-checkbox'>
-                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
-            </th>
-            <th class='text-left nowrap'>负责人姓名</th>
-            <th class='text-left nowrap'>负责人手机</th>
-            <th class='text-left nowrap'>负责人类型</th>
-            <th class='text-left nowrap'>归属车间</th>
-            <th class='text-left nowrap'>创建时间</th>
-            <th class="text-center">操作</th>
-        </tr>
-        </thead>
-        {/notempty}
-        <tbody>
-        {foreach $list as $key=>$vo}
-        <tr>
-            <td class='list-table-check-td think-checkbox'>
-                <label><input class="list-check-box" value='{$vo.id}' type='checkbox'></label>
-            </td>
-            <td class='text-left nowrap'>
-                <div class="inline-block">{$vo.name|default='--'}</div>
-            </td>
-            <td class='text-left'>{$vo.phone|default='--'}</td>
-            <td class='text-left'>{$vo.type|default='--'}</td>
-            <td class='text-left'>{$vo.workshop|default='--'}</td>
-            <td class='text-left'>{$vo.create_at|format_datetime}</td>
-            <td class='text-center nowrap'>
-                {if auth("store/principal/remove")}
-                <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除该负责人吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}">删 除</a>
-                {/if}
-            </td>
-        </tr>
-        {/foreach}
-        </tbody>
-    </table>
-    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
-</div>
-{/block}

+ 0 - 30
application/store/view/sales_personnel/form.html

@@ -1,30 +0,0 @@
-
-<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
-    <div class="layui-card-body">
-
-
-        <div class="layui-form-item">
-            <label class="layui-form-label label-required">销售人员姓名</label>
-            <div class="layui-input-block">
-                <input name="name" required  value='{$vo.name|default=""}' placeholder="请输入销售人员姓名" class="layui-input">
-            </div>
-        </div>
-        <div class="layui-form-item">
-            <label class="layui-form-label label-required">销售人员手机</label>
-            <div class="layui-input-block">
-                <input name="phone" value='{$vo.phone|default=""}' required placeholder="请输入销售人员手机" class="layui-input">
-            </div>
-        </div>
-
-
-        <div class="hr-line-dashed"></div>
-        {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
-        <div class="layui-form-item text-center">
-            <button class="layui-btn" type='submit'>保存数据</button>
-            <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗?" data-close>取消编辑</button>
-        </div>
-        <script>
-            window.form.render();
-        </script>
-
-</form>

+ 0 - 46
application/store/view/sales_personnel/index.html

@@ -1,46 +0,0 @@
-{extend name='admin@main'}
-{block name="button"}
-{if auth("store/SalesPersonnel/add")}
-<button data-modal='{:url("add")}' data-title="添加销售人员" class='layui-btn layui-btn-sm layui-btn-primary'>添加销售人员</button>
-{/if}
-{/block}
-{block name="content"}
-<div class="think-box-shadow">
-    {include file='sales_personnel/index_search'}
-    <table class="layui-table margin-top-10" lay-skin="line">
-        {notempty name='list'}
-        <thead>
-        <tr>
-            <th class='list-table-check-td think-checkbox'>
-                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
-            </th>
-            <th class='text-left nowrap'>人员姓名</th>
-            <th class='text-left nowrap'>人员手机</th>
-            <th class='text-left nowrap'>创建时间</th>
-            <th class="text-center">操作</th>
-        </tr>
-        </thead>
-        {/notempty}
-        <tbody>
-        {foreach $list as $key=>$vo}
-        <tr>
-            <td class='list-table-check-td think-checkbox'>
-                <label><input class="list-check-box" value='{$vo.id}' type='checkbox'></label>
-            </td>
-            <td class='text-left nowrap'>
-                <div class="inline-block">{$vo.name|default='--'}</div>
-            </td>
-            <td class='text-left'>{$vo.phone|default='--'}</td>
-            <td class='text-left'>{$vo.create_at|format_datetime}</td>
-            <td class='text-center nowrap'>
-                {if auth("store/sales_personnel/remove")}
-                <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除该销售人员吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}">删 除</a>
-                {/if}
-            </td>
-        </tr>
-        {/foreach}
-        </tbody>
-    </table>
-    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
-</div>
-{/block}

+ 0 - 32
application/store/view/sales_personnel/index_search.html

@@ -1,32 +0,0 @@
-<fieldset>
-    <legend>条件搜索</legend>
-    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
-        <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">销售人员名称</label>
-            <div class="layui-input-inline">
-                <input name="name" value="{$Think.get.name|default=''}" placeholder="请输入销售人员名称" class="layui-input">
-            </div>
-        </div>
-        <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">销售人员手机</label>
-            <div class="layui-input-inline">
-                <input name="phone" value="{$Think.get.phone|default=''}" placeholder="请输入销售人员手机号" class="layui-input">
-            </div>
-        </div>
-
-        <div class="layui-form-item layui-inline">
-            <label class="layui-form-label">创建时间</label>
-            <div class="layui-input-inline">
-                <input name="create_at" value="{$Think.get.create_at|default=''}" placeholder="请选择创建时间" class="layui-input">
-            </div>
-        </div>
-        <div class="layui-form-item layui-inline">
-            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
-            <button type="button" data-export-list class="layui-btn layui-btn-primary layui-hide"><i class="layui-icon layui-icon-export"></i> 导 出</button>
-        </div>
-    </form>
-    <script>
-        form.render();
-        laydate.render({range: true, elem: '[name="create_at"]'});
-    </script>
-</fieldset>

+ 33 - 0
application/store/view/versions/form.html

@@ -0,0 +1,33 @@
+<form onsubmit="return false;" action="{:request()->url()}" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off">
+
+    <div class="layui-card-body">
+
+
+        <div class="layui-row margin-bottom-15">
+            <label class="layui-form-label label-required">版本号</label>
+            <div class="layui-input-block">
+                <input name="title" required value='{$vo.title|default=""}' placeholder="请输入公告名称" class="layui-input">
+            </div>
+        </div>
+
+        <div class="layui-row margin-bottom-15">
+            <label class="layui-form-label label-required">修改内容</label>
+            <div class="layui-input-block">
+                <textarea name="content">{$vo.content|default=''|raw}</textarea>
+            </div>
+        </div>
+    </div>
+
+    <div class="hr-line-dashed"></div>
+    <div class="layui-form-item text-center">
+        {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
+        <button class="layui-btn" type='submit'>保存数据</button>
+        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗?" data-close>取消编辑</button>
+    </div>
+    <script>
+        window.form.render();
+        require(['ckeditor', 'angular'], function () {
+            window.createEditor('[name="content"]', {height: 260});
+        })
+    </script>
+</form>

+ 45 - 0
application/store/view/versions/index.html

@@ -0,0 +1,45 @@
+{extend name='admin@main'}
+
+
+{block name="content"}
+<div class="think-box-shadow">
+
+    <table class="layui-table margin-top-10" lay-skin="line">
+        {notempty name='list'}
+        <thead>
+        <tr>
+
+            <th class='text-left nowrap'>系统类型</th>
+            <th class='text-left nowrap'>版本标题</th>
+            <th class="text-center">状态</th>
+            <th class="text-center">时间</th>
+            <th class="text-center">操作</th>
+        </tr>
+        </thead>
+        {/notempty}
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='text-left nowrap'>
+                {if $vo.type == 1} 安卓 {else} IOS {/if}
+            </td>
+            <td class='text-left nowrap'>
+
+                {$vo.title|default=''}
+            </td>
+            <td class='text-center nowrap'>
+                {eq name='vo.status' value='0'}<span class="layui-badge">已禁用</span>{else}<span class="layui-badge layui-bg-green">使用中</span>{/eq}<br>
+            </td>
+            <td class='text-center nowrap'>{$vo.create_at|format_datetime}</td>
+            <td class='text-center nowrap'>
+                {if auth("store/versions/edit")}
+                <a data-title="编辑版本" class="layui-btn layui-btn-sm" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
+                {/if}
+            </td>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+{/block}