diff --git a/application/admin/controller/general/Config.php b/application/admin/controller/general/Config.php index 5dac56c..fd6cb08 100644 --- a/application/admin/controller/general/Config.php +++ b/application/admin/controller/general/Config.php @@ -40,11 +40,12 @@ class Config extends Backend /** * 查看 */ - public function index() + public function index($group = null) { $siteList = []; - $groupList = ConfigModel::getGroupList(); + $groupList = ConfigModel::getGroupList($group); foreach ($groupList as $k => $v) { + if($group && $group!=$k)continue; $siteList[$k]['name'] = $k; $siteList[$k]['title'] = $v; $siteList[$k]['list'] = []; @@ -147,7 +148,9 @@ class Config extends Backend } else { $value = is_array($value) ? implode(',', $value) : $value; } - $v['value'] = $value; + //$value去掉两端空格 + $value = trim($value); + $v['value'] = $value ; $configList[] = $v->toArray(); } } diff --git a/application/admin/controller/manystore/Index.php b/application/admin/controller/manystore/Index.php index 075f06e..5e15cb5 100644 --- a/application/admin/controller/manystore/Index.php +++ b/application/admin/controller/manystore/Index.php @@ -2,6 +2,8 @@ namespace app\admin\controller\manystore; +use app\admin\model\User; +use app\common\model\school\classes\Order; use app\manystore\model\Manystore; use app\manystore\model\ManystoreShop; use app\manystore\model\ManystoreAuthGroup; @@ -31,12 +33,28 @@ class Index extends Backend protected $childrenGroupIds = []; protected $childrenAdminIds = []; + + //不用审核允许修改的字段 + protected $no_auth_fields = ['image','images','address_city','province',"city","district","address","address_detail", + "longitude","latitude","content","desc" + ]; + + //更新数据是否需要触发审核开关 + protected $need_auth = false; + protected $have_auth = false; + + protected $success_auth = false; + protected $error_auth = false; + + public function _initialize() { parent::_initialize(); $this->model = new Manystore(); $this->shopModel = new ManystoreShop(); + $this->view->assign("statusList", $this->shopModel->getStatusList()); + $this->view->assign("typeList", $this->shopModel->getTypeList()); } /** @@ -44,6 +62,10 @@ class Index extends Backend */ public function index() { + //当前是否为关联查询 + $this->relationSearch = true; + //设置过滤方法 + $this->request->filter(['strip_tags', 'trim']); if ($this->request->isAjax()) { //如果发送的来源是Selectpage,则转发到Selectpage if ($this->request->request('keyField')) { @@ -51,16 +73,21 @@ class Index extends Backend } list($where, $sort, $order, $offset, $limit) = $this->buildparams(); + + + $total = $this->model + ->with(['shop',"user"]) ->where($where) ->where(array('is_main'=>1)) ->order($sort, $order) ->count(); $list = $this->model + ->with(['shop',"user"]) ->where($where) ->where(array('is_main'=>1)) - ->field(['password', 'salt', 'token'], true) +// ->field(['password', 'salt', 'token'], true) ->order($sort, $order) ->limit($offset, $limit) ->select(); @@ -72,6 +99,160 @@ class Index extends Backend return $this->view->fetch(); } + + protected function authClasses(&$params,&$shop,$row=null){ + //审核失败需填写原因 + if($shop["status"] == '2' && empty($shop["reason"])){ + $this->error("审核失败需填写原因"); + } + + if($shop["status"] == '2'){ + //审核不通过会平台下架 + $params["status"] = 'hidden'; + } + + //更新 + if($row){ + + if($shop["status"] != '1' && $row["status"] == '1'){ + $this->error("审核已通过的课程不允许再修改审核状态!"); + } + + if($shop["status"] != '0' && $row["status"] == '0'){ + //填写审核时间和审核人 + $shop["auth_time"] = time(); + $shop["admin_id"] = $this->auth->id; + if($shop["status"] == '1'){ + //审核通过 + $this->success_auth = true; + } + if($shop["status"] == '2'){ + //审核通过 + $this->error_auth = true; + } + } + + //审核通过 + if($this->success_auth){ + //如果是平台下架,则更新成正常下架 + if($params["status"] == 'hidden') $params["status"] = 'normal'; + //调用通过事件 + $data = ['shop' => $row]; + \think\Hook::listen('shop_auth_success_after', $data); + + + } + if($this->error_auth){ + //审核不通过会平台下架 + $params["status"] = 'hidden'; + //调用通过事件 + //调用通过事件 + $data = ['shop' => $row]; + \think\Hook::listen('shop_auth_fail_after', $data); + + } + + + }else{ + //新增 + } + + } + + + protected function updateCheck($id,$params=[],$shop=[],$row=null){ + if($shop && $row){ + + if(!$this->no_auth_fields_check($shop,$row)){ + return true; + } + } + + // 课程存在未完成订单则不允许操作 + $order = Order::where("manystore_id",$id)->where("status","in","0,3")->find(); + if($order)$this->error("存在正在使用中的课程订单或存在正在售后中的课程订单无法继续操作!"); + // 课程存在售后订单则不允许操作 + } + + + + protected function update_check(&$params,&$shop,$row=null) + { + + + + $shop["user_id"] = $params["user_id"]; + if(!$shop["user_id"])throw new \Exception("认证用户不存在!"); + $user = User::get($shop["user_id"]); + if(!$user) throw new \Exception("认证用户不存在!"); + + + + //独立地点需传定位信息 +// if(empty($params["address_city"]) +// || empty($params["province"]) +// || empty($params["city"]) +// || empty($params["district"]) +// || empty($params["longitude"]) +// || empty($params["latitude"])) $this->error("独立地点需传定位信息"); + + + + //特有认证判断 + $this->authClasses($params,$shop,$row); +// var_dump($row);die; + + + //更新 + if($row){ + $this->have_auth = false; + if($this->need_auth){ + //判断更新的变动数据 + $this->no_auth_fields_check($params,$shop,$row); + + if($this->have_auth){ + //注释掉先不一刀切 +// $params['status'] = "hidden"; + $shop['status'] = "0"; + } + } + + $this->updateCheck($row->id,$params,$shop,$row); + + + //名称title不能与其他课程重复 + $check_title = $this->shopModel->where('id','<>',$row["id"])->where('name',$shop["name"])->find(); + if($check_title){ + $this->error("机构或个人认证名称已存在或被其他机构占用,请更改!"); + } + //user_id不能与其他机构重复 + $check_user_id = $this->shopModel->where('id','<>',$row["id"])->where('user_id',$shop["user_id"])->find(); + if($check_user_id){ + $this->error("机构或个人认证用户已存在或被其他机构占用,请更改!"); + } + + }else{ + //新增 + + + //名称title不能重复 + $check_title = $this->shopModel->where('name',$shop["name"])->find(); + if($check_title){ + $this->error("机构或个人认证名称已存在或被其他机构占用,请更改!"); + } + //user_id不能与其他机构重复 + $check_user_id = $this->shopModel->where('user_id',$shop["user_id"])->find(); + if($check_user_id){ + $this->error("机构或个人认证用户已存在或被其他机构占用,请更改!"); + } + } + + } + + + + + /** * 添加 */ @@ -88,6 +269,8 @@ class Index extends Backend db()->startTrans(); try{ + $shop["user_id"] = $params['user_id']; + $this->update_check($params,$shop,$row=null); $shop_info = $this->shopModel->save($shop); if($shop_info === false){ $this->error($this->shopModel->getError()); @@ -157,7 +340,8 @@ class Index extends Backend $params = $this->request->post("row/a"); $shop = $this->request->post("shop/a"); if ($params) { - + $shop["user_id"] = $params['user_id']; + $this->update_check($params,$shop,$shop_info); $result = $shop_info->save($shop); if($result === false){ $this->error(__("修改商家信息资料失败")); @@ -213,6 +397,9 @@ class Index extends Backend if(!$row){ $this->error(__('No Results were found')); } + + $this->updateCheck($ids); + db()->startTrans(); try{ $result = $row->delete(); diff --git a/application/admin/controller/school/classes/ClassesLib.php b/application/admin/controller/school/classes/ClassesLib.php index a2e269c..c2c2391 100644 --- a/application/admin/controller/school/classes/ClassesLib.php +++ b/application/admin/controller/school/classes/ClassesLib.php @@ -186,6 +186,9 @@ class ClassesLib extends Backend if(!$manystore){ $this->error("店铺不存在"); } + if(!(new \app\common\model\dyqc\ManystoreShop)->checkFull($shop_id))$this->error("对方的认证信息未完善,请您先去帮忙完善!"); + + $params["manystore_id"] = $manystore["id"]; @@ -258,6 +261,7 @@ class ClassesLib extends Backend $params["feel"] = "0"; } + //更新 if($row){ $this->have_auth = false; diff --git a/application/admin/controller/school/classes/Teacher.php b/application/admin/controller/school/classes/Teacher.php index b6dadd9..d7fd856 100644 --- a/application/admin/controller/school/classes/Teacher.php +++ b/application/admin/controller/school/classes/Teacher.php @@ -41,6 +41,7 @@ class Teacher extends Backend parent::_initialize(); $this->view->assign("statusList", $this->model->getStatusList()); + $this->view->assign("recommendList", $this->model->getRecommendList()); } diff --git a/application/admin/controller/style/HomeImages.php b/application/admin/controller/style/HomeImages.php new file mode 100644 index 0000000..9b0782e --- /dev/null +++ b/application/admin/controller/style/HomeImages.php @@ -0,0 +1,37 @@ +model = new \app\admin\model\style\HomeImages; + $this->view->assign("typeList", $this->model->getTypeList()); + } + + + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + +} diff --git a/application/admin/lang/zh-cn/manystore/index.php b/application/admin/lang/zh-cn/manystore/index.php index 623d4e8..f068dfe 100644 --- a/application/admin/lang/zh-cn/manystore/index.php +++ b/application/admin/lang/zh-cn/manystore/index.php @@ -9,27 +9,45 @@ return [ 'Please input correct nickname' => '昵称仅支持输入中文、英文字母(大小写)、数字、下划线', 'Please input length nickname' => '昵称请最多填写10个字符', - 'Logo' => '商家Logo', - 'Name' => '店铺名称', - 'Image' => '店铺封面图', - 'Images' => '店铺环境图片', + 'user_id' => '申请用户', + 'Logo' => 'Logo', + 'Name' => '申请人姓名|机构名称', + 'Image' => '封面图', + 'Images' => '环境图片', 'Address_city' => '城市选择', 'Province' => '省编号', 'City' => '市编号', 'District' => '县区编号', - 'Address' => '店铺地址', - 'Address_detail' => '店铺详细地址', + 'Address' => '地址', + 'Address_detail' => '详细地址', 'Longitude' => '经度', 'Latitude' => '纬度', - 'Yyzzdm' => '营业执照', - 'Yyzz_images' => '营业执照照片', + 'Yyzzdm' => '营业执照号(个人认证不需要)', + 'Yyzz_images' => '营业执照照片(个人认证不需要)', + 'hidden' => '禁用', + + 'Front_idcard_image' => '身份证正面', + 'Reverse_idcard_image' => '身份证反面', 'Tel' => '服务电话', - 'Content' => '店铺详情', - 'Status' => '审核状态', + 'Content' => '详情', + 'Status' => '账号状态', 'Status 0' => '待审核', 'Status 1' => '审核通过', - 'Status 2' => '审核失败', + 'Status 2' => '审核不通过', 'Reason' => '审核不通过原因', 'Create_time' => '创建时间', - 'Update_time' => '修改时间' + 'Update_time' => '修改时间', + 'Auth_status' => '审核状态', + 'Auth_status 0' => '待审核', + 'Auth_status 1' => '审核通过', + 'Auth_status 2' => '审核不通过', + 'Auth_time' => '审核时间', + 'Admin_id' => '审核管理员id', + 'User.nickname' => '昵称', + 'User.mobile' => '手机号', + 'User.avatar' => '头像', + 'Type' => '认证类型', + 'Type 1' => '个人认证', + 'Type 2' => '机构认证', + 'Desc' => '申请备注', ]; diff --git a/application/admin/lang/zh-cn/manystore/indexshop.php b/application/admin/lang/zh-cn/manystore/indexshop.php new file mode 100644 index 0000000..dd927d6 --- /dev/null +++ b/application/admin/lang/zh-cn/manystore/indexshop.php @@ -0,0 +1,52 @@ + '所属组别', + 'Loginfailure' => '登录失败次数', + 'Login time' => '最后登录', + 'Please input correct username' => '用户名只能由3-12位数字、字母、下划线组合', + 'Please input correct password' => '密码长度必须在6-16位之间,不能包含空格', + 'Please input correct nickname' => '昵称仅支持输入中文、英文字母(大小写)、数字、下划线', + 'Please input length nickname' => '昵称请最多填写10个字符', + + 'Logo' => 'Logo', + 'Name' => '名称', + 'Image' => '封面图', + 'Images' => '环境图片', + 'Address_city' => '城市选择', + 'Province' => '省编号', + 'City' => '市编号', + 'District' => '县区编号', + 'Address' => '地址', + 'Address_detail' => '详细地址', + 'Longitude' => '经度', + 'Latitude' => '纬度', + 'Yyzzdm' => '营业执照号', + 'Yyzz_images' => '营业执照照片', + 'hidden' => '禁用', + + 'Front_idcard_image' => '身份证正面', + 'Reverse_idcard_image' => '身份证反面', + 'Tel' => '服务电话', + 'Content' => '详情', + 'Status' => '账号状态', + 'Status 0' => '待审核', + 'Status 1' => '审核通过', + 'Status 2' => '审核不通过', + 'Reason' => '审核不通过原因', + 'Create_time' => '创建时间', + 'Update_time' => '修改时间', + 'Auth_status' => '审核状态', + 'Auth_status 0' => '待审核', + 'Auth_status 1' => '审核通过', + 'Auth_status 2' => '审核不通过', + 'Auth_time' => '审核时间', + 'Admin_id' => '审核管理员id', + 'User.nickname' => '昵称', + 'User.mobile' => '手机号', + 'User.avatar' => '头像', + 'Type' => '类型', + 'Type 1' => '个人', + 'Type 2' => '机构', + 'Desc' => '申请备注', +]; diff --git a/application/admin/lang/zh-cn/manystore/indexuser.php b/application/admin/lang/zh-cn/manystore/indexuser.php new file mode 100644 index 0000000..dd927d6 --- /dev/null +++ b/application/admin/lang/zh-cn/manystore/indexuser.php @@ -0,0 +1,52 @@ + '所属组别', + 'Loginfailure' => '登录失败次数', + 'Login time' => '最后登录', + 'Please input correct username' => '用户名只能由3-12位数字、字母、下划线组合', + 'Please input correct password' => '密码长度必须在6-16位之间,不能包含空格', + 'Please input correct nickname' => '昵称仅支持输入中文、英文字母(大小写)、数字、下划线', + 'Please input length nickname' => '昵称请最多填写10个字符', + + 'Logo' => 'Logo', + 'Name' => '名称', + 'Image' => '封面图', + 'Images' => '环境图片', + 'Address_city' => '城市选择', + 'Province' => '省编号', + 'City' => '市编号', + 'District' => '县区编号', + 'Address' => '地址', + 'Address_detail' => '详细地址', + 'Longitude' => '经度', + 'Latitude' => '纬度', + 'Yyzzdm' => '营业执照号', + 'Yyzz_images' => '营业执照照片', + 'hidden' => '禁用', + + 'Front_idcard_image' => '身份证正面', + 'Reverse_idcard_image' => '身份证反面', + 'Tel' => '服务电话', + 'Content' => '详情', + 'Status' => '账号状态', + 'Status 0' => '待审核', + 'Status 1' => '审核通过', + 'Status 2' => '审核不通过', + 'Reason' => '审核不通过原因', + 'Create_time' => '创建时间', + 'Update_time' => '修改时间', + 'Auth_status' => '审核状态', + 'Auth_status 0' => '待审核', + 'Auth_status 1' => '审核通过', + 'Auth_status 2' => '审核不通过', + 'Auth_time' => '审核时间', + 'Admin_id' => '审核管理员id', + 'User.nickname' => '昵称', + 'User.mobile' => '手机号', + 'User.avatar' => '头像', + 'Type' => '类型', + 'Type 1' => '个人', + 'Type 2' => '机构', + 'Desc' => '申请备注', +]; diff --git a/application/admin/lang/zh-cn/school/classes/teacher.php b/application/admin/lang/zh-cn/school/classes/teacher.php index e058b9f..7a23407 100644 --- a/application/admin/lang/zh-cn/school/classes/teacher.php +++ b/application/admin/lang/zh-cn/school/classes/teacher.php @@ -30,5 +30,8 @@ return [ 'Shop.city' => '市编号', 'Shop.district' => '县区编号', 'Shop.address' => '店铺地址', - 'Shop.address_detail' => '店铺详细地址' + 'Shop.address_detail' => '店铺详细地址', + 'Recommend' => '平台首页推荐', + 'Recommend 0' => '否', + 'Recommend 1' => '是', ]; diff --git a/application/admin/lang/zh-cn/style/home_images.php b/application/admin/lang/zh-cn/style/home_images.php new file mode 100644 index 0000000..2673431 --- /dev/null +++ b/application/admin/lang/zh-cn/style/home_images.php @@ -0,0 +1,12 @@ + '展示图', + 'Type' => '跳转类型', + 'Type in' => '内部跳转', + 'Type out' => '外部跳转', + 'Url' => '跳转链接', + 'Weigh' => '权重', + 'Createtime' => '创建时间', + 'Deletetime' => '删除时间' +]; diff --git a/application/admin/model/school/classes/Teacher.php b/application/admin/model/school/classes/Teacher.php index 8873287..94ac554 100644 --- a/application/admin/model/school/classes/Teacher.php +++ b/application/admin/model/school/classes/Teacher.php @@ -25,7 +25,8 @@ class Teacher extends Model // 追加属性 protected $append = [ - 'status_text' + 'status_text', + 'recommend_text', ]; @@ -39,7 +40,17 @@ class Teacher extends Model if (!empty($value)) return cdnurl($value, true); } + public function getRecommendList() + { + return ['0' => __('Recommend 0'), '1' => __('Recommend 1')]; + } + public function getRecommendTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['recommend']) ? $data['recommend'] : ''); + $list = $this->getRecommendList(); + return isset($list[$value]) ? $list[$value] : ''; + } protected static function init() diff --git a/application/admin/model/style/HomeImages.php b/application/admin/model/style/HomeImages.php new file mode 100644 index 0000000..1532e08 --- /dev/null +++ b/application/admin/model/style/HomeImages.php @@ -0,0 +1,59 @@ +getPk(); + $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]); + } + }); + } + + + public function getTypeList() + { + return ['in' => __('Type in'), 'out' => __('Type out')]; + } + + + public function getTypeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['type']) ? $data['type'] : ''); + $list = $this->getTypeList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + + + +} diff --git a/application/admin/validate/style/HomeImages.php b/application/admin/validate/style/HomeImages.php new file mode 100644 index 0000000..1482608 --- /dev/null +++ b/application/admin/validate/style/HomeImages.php @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/admin/view/manystore/index/add.html b/application/admin/view/manystore/index/add.html index c3ec4fe..1165bb4 100644 --- a/application/admin/view/manystore/index/add.html +++ b/application/admin/view/manystore/index/add.html @@ -35,6 +35,13 @@ +
+ +
+ +
+
+
@@ -51,13 +58,27 @@
+
+ +
+ + + +
+
+ +
@@ -86,7 +107,7 @@
- +
@@ -114,7 +135,7 @@
- +
@@ -125,7 +146,7 @@
-
@@ -139,24 +160,28 @@
- +
- +
+ +
+ +
- +
- +
@@ -166,10 +191,46 @@
    + +
    + + +
    + +
    +
    + +
    + + +
    + +
    +
      +
      +
      +
      + +
      +
      + +
      + + +
      + +
      +
        +
        +
        + + + +
        - +
        @@ -179,12 +240,41 @@
        + + + +
        + +
        + +
        +
        + + + +
        {:build_radios('shop[status]', ['0'=>__('Status 0'), '1'=>__('Status 1'), '2'=>__('Status 2')],1)}
        + + +
        + +
        + +
        +
        + + + + + + + +
        diff --git a/application/admin/view/manystore/index/edit.html b/application/admin/view/manystore/index/edit.html index 059d4d8..469a0a4 100644 --- a/application/admin/view/manystore/index/edit.html +++ b/application/admin/view/manystore/index/edit.html @@ -35,6 +35,14 @@
        + +
        + +
        + +
        +
        +
        @@ -58,13 +66,28 @@
        + +
        + +
        + + + +
        +
        + +
        @@ -93,7 +116,7 @@
        - +
        @@ -121,18 +144,18 @@
        - +
        - - - + + +
        -
        @@ -146,24 +169,27 @@
        - +
        - +
        + +
        +
        - +
        - +
        @@ -173,10 +199,51 @@
          + + +
          + + + + +
          + +
          +
          + +
          + + +
          + +
          +
            +
            +
            +
            + +
            +
            + +
            + + +
            + +
            +
              +
              +
              + + + + + +
              - +
              @@ -187,12 +254,39 @@
              + + +
              + +
              + +
              +
              + + + +
              {:build_radios('shop[status]', ['0'=>__('Status 0'), '1'=>__('Status 1'), '2'=>__('Status 2')], $shop['status'])}
              + +
              + +
              + +
              +
              + + + + + + + +
              diff --git a/application/admin/view/manystore/index/index.html b/application/admin/view/manystore/index/index.html index ed221b2..98b0428 100644 --- a/application/admin/view/manystore/index/index.html +++ b/application/admin/view/manystore/index/index.html @@ -1,5 +1,13 @@
              - {:build_heading()} +
              + {:build_heading(null,FALSE)} + +
              diff --git a/application/admin/view/school/classes/classes_lib/edit.html b/application/admin/view/school/classes/classes_lib/edit.html index 446f065..63bacf3 100644 --- a/application/admin/view/school/classes/classes_lib/edit.html +++ b/application/admin/view/school/classes/classes_lib/edit.html @@ -134,7 +134,7 @@ -
              +