转移商户model到common公共model
This commit is contained in:
parent
ce83c26013
commit
5bdf8b9975
@ -1,26 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* 表单页面
|
||||
*
|
||||
*/
|
||||
namespace app\admin\controller\merchant;
|
||||
|
||||
use app\admin\BaseController;
|
||||
|
||||
class Merchant extends BaseController{
|
||||
|
||||
protected $model;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
function classify(){
|
||||
|
||||
}
|
||||
|
||||
public function system() {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,118 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @date :2023年03月2日
|
||||
* @author:刘孝全
|
||||
* @email:q8197264@126.com
|
||||
*
|
||||
* @ 商户入驻申请管理
|
||||
*/
|
||||
namespace app\admin\controller\merchant;
|
||||
|
||||
use app\admin\BaseController;
|
||||
use app\validate\merchant\MerchantApplymentsValidate;
|
||||
use app\admin\model\merchant\MerchantApplyments as MerchantApplymentsModel;
|
||||
|
||||
class MerchantApplyments extends BaseController
|
||||
{
|
||||
/**
|
||||
* @var MerchantModel
|
||||
*/
|
||||
protected $model;
|
||||
|
||||
/**
|
||||
* Merchant constructor.
|
||||
* @param App $app
|
||||
* @param MerchantRepository $repository
|
||||
*/
|
||||
function __construct(MerchantApplymentsModel $model){
|
||||
$this->model = $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO 创建申请
|
||||
* @param MerchantApplymentsValidate $validate
|
||||
* @return \think\response\Json
|
||||
* @author Qinii
|
||||
* @day 6/22/21
|
||||
*/
|
||||
public function create(MerchantApplymentsValidate $validate)
|
||||
{
|
||||
// if(!systemConfig('open_wx_sub_mch')) return app('json')->fail('未开启子商户入驻');
|
||||
$data = $this->checkParams($validate);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO 创建申请
|
||||
* @param MerchantApplymentsValidate $validate
|
||||
* @return \think\response\Json
|
||||
* @author Qinii
|
||||
* @day 6/22/21
|
||||
*/
|
||||
public function detail()
|
||||
{}
|
||||
|
||||
/**
|
||||
* TODO 编辑提交
|
||||
* @param MerchantApplymentsValidate $validate
|
||||
* @return \think\response\Json
|
||||
* @author Qinii
|
||||
* @day 6/22/21
|
||||
*/
|
||||
public function update($id,MerchantApplymentsValidate $validate)
|
||||
{}
|
||||
|
||||
/**
|
||||
* TODO 查询更新状态
|
||||
* @param MerchantApplymentsValidate $validate
|
||||
* @return \think\response\Json
|
||||
* @author Qinii
|
||||
* @day 6/22/21
|
||||
*/
|
||||
public function check()
|
||||
{}
|
||||
|
||||
/**
|
||||
* TODO 上传图片
|
||||
* @param MerchantApplymentsValidate $validate
|
||||
* @return \think\response\Json
|
||||
* @author Qinii
|
||||
* @day 6/22/21
|
||||
*/
|
||||
public function uploadImage($field)
|
||||
{}
|
||||
|
||||
/**
|
||||
* TODO 检验参数
|
||||
* @param MerchantApplymentsValidate $validate
|
||||
* @return \think\response\Json
|
||||
* @author Qinii
|
||||
* @day 6/22/21
|
||||
*/
|
||||
public function checkParams(MerchantApplymentsValidate $validate)
|
||||
{
|
||||
//'organization_cert_info',
|
||||
$data = $this->request->params([
|
||||
'organization_type','business_license_info','id_doc_type','id_card_info','id_doc_info','need_account_info','account_info','contact_info','sales_scene_info','merchant_shortname','qualifications','business_addition_pics','business_addition_desc'
|
||||
]);
|
||||
|
||||
if($data['id_doc_type'] == 1){
|
||||
unset($data['id_doc_info']);
|
||||
}else{
|
||||
unset($data['id_card_info']);
|
||||
}
|
||||
|
||||
if(in_array($data['organization_type'],['2401','2500'])){
|
||||
unset($data['business_license_info']);
|
||||
}
|
||||
|
||||
if(isset($data['qualifications']) && !$data['qualifications']) unset($data['qualifications']);
|
||||
|
||||
if(isset($data['business_addition_pics']) && !$data['business_addition_pics']) unset($data['business_addition_pics']);
|
||||
if($data['organization_type'] !== 2 && isset($data['id_card_info']['id_card_address'])){
|
||||
unset($data['id_card_info']['id_card_address']);
|
||||
}
|
||||
$validate->check($data);
|
||||
return $data;
|
||||
}
|
||||
}
|
@ -1,133 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* 商户菜单管理
|
||||
*
|
||||
* @author:刘孝全
|
||||
* @email:q8197264@126.com
|
||||
* @date :2023年03月3日
|
||||
*/
|
||||
namespace app\admin\controller\merchant\system\merchant\auth;
|
||||
|
||||
use app\admin\BaseController;
|
||||
use app\common\model\merchant\system\auth\Menu as MenuModel;
|
||||
use think\facade\View;
|
||||
use app\common\controller\FormatList;
|
||||
use think\exception\ValidateException;
|
||||
|
||||
/**
|
||||
* class Menu
|
||||
*/
|
||||
class Menu extends BaseController
|
||||
{
|
||||
protected $menu;
|
||||
protected $params;
|
||||
|
||||
function __construct(MenuModel $menu) {
|
||||
// $this->adminInfo = get_login_admin();
|
||||
|
||||
$this->menu = $menu;
|
||||
|
||||
$this->params = get_params() ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 空白菜单页,由前端 ajax 获取数据
|
||||
*/
|
||||
function Index() {
|
||||
return view('merchant/system/auth/index');
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单列表
|
||||
*/
|
||||
function Lst(){
|
||||
// 查出商户所有菜单数据
|
||||
$data = $this->menu->Search([], 1);
|
||||
|
||||
to_assign(0,'',$data['list']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 表单页
|
||||
* TODO: 操作日志要另建表做关联
|
||||
* 操作日志待开发
|
||||
*
|
||||
*/
|
||||
function AddForm(FormatList $format){
|
||||
$id = isset($this->params['id']) ? $this->params['id'] : 0;
|
||||
$pid = isset($this->params['pid']) ? $this->params['pid'] : 0;
|
||||
if($id>0){
|
||||
$detail = $this->menu->Find($id);
|
||||
$detail['name'] = $detail['title'];
|
||||
View::assign('detail', $detail);
|
||||
}
|
||||
// 查出商户所有菜单数据
|
||||
$data = $this->menu->Search([], 1);
|
||||
$menus = $format->DropDownMenu($data['list']);
|
||||
|
||||
View::assign('id', $id);
|
||||
View::assign('pid', $pid);
|
||||
View::assign('menus',$menus);
|
||||
|
||||
return view('merchant/system/auth/add');
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加菜单
|
||||
*/
|
||||
function Add(){
|
||||
echo 'add';
|
||||
$this->params['src'] = preg_replace('# #','',$this->params['src']);
|
||||
// if ($param['id'] == 0) {
|
||||
try {
|
||||
validate(RuleCheck::class)->scene('add')->check($this->params);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$this->params['create_time'] = time();
|
||||
$rid = Db::name('AdminRule')->strict(false)->field(true)->insertGetId($this->params);
|
||||
//自动为系统所有者管理组分配新增的节点
|
||||
$group = Db::name('AdminGroup')->find(1);
|
||||
if (!empty($group)) {
|
||||
$newGroup['id'] = 1;
|
||||
$newGroup['rules'] = $group['rules'] . ',' . $rid;
|
||||
Db::name('AdminGroup')->strict(false)->field(true)->update($newGroup);
|
||||
add_log('add', $rid, $this->params);
|
||||
}
|
||||
// }
|
||||
// 删除后台节点缓存
|
||||
clear_cache('adminRules');
|
||||
return to_assign();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑菜单
|
||||
*/
|
||||
function Edit(){
|
||||
echo 'edit';
|
||||
if ($this->params['id'] > 0) {
|
||||
try {
|
||||
validate(RuleCheck::class)->scene('edit')->check($this->params);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
Db::name('AdminRule')->strict(false)->field(true)->update($this->params);
|
||||
add_log('edit', $this->params['id'], $this->params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除菜单
|
||||
*/
|
||||
function Del(){
|
||||
$id = get_params("id");
|
||||
try{
|
||||
$this->menu->Del($id);
|
||||
return to_assign(0, "删除节点成功");
|
||||
}catch(ValidateException $e){
|
||||
return to_assign(1, $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @usage 商户管理
|
||||
* @
|
||||
* @author 刘孝全
|
||||
*/
|
||||
namespace app\admin\model;
|
||||
use think\model;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
* 商户管理model
|
||||
*/
|
||||
class Merchant extends Model
|
||||
{
|
||||
/**
|
||||
* 店铺类型.
|
||||
*
|
||||
*@param int $page 当前页数
|
||||
*@param int $limit 获取记录行数
|
||||
*
|
||||
*@return Array $list
|
||||
*/
|
||||
public function GetType($offset,$limit){
|
||||
$rows = empty($limit) ? get_config('app . page_size') : $limit;
|
||||
|
||||
$where = [];
|
||||
$list = self::where($where)
|
||||
->field('id,user_id,title,content,create_time,status,is_read,read_time')
|
||||
->page($offset)
|
||||
->limit($limit)
|
||||
->select();
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ 店铺类型说明
|
||||
*
|
||||
* return string
|
||||
*/
|
||||
public function GetDescription(){}
|
||||
|
||||
/**
|
||||
* @ 店铺保证金
|
||||
*
|
||||
* return list
|
||||
*/
|
||||
public function Getdeposit(){}
|
||||
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\admin\model\merchant;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class MerchantApplyments extends Model
|
||||
{
|
||||
protected $table = "eb_merchant_intention";
|
||||
|
||||
function __construct(){}
|
||||
|
||||
function GetList(){
|
||||
$list = self::where()->select();
|
||||
|
||||
return $list;
|
||||
}
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* 商户菜单 model
|
||||
*
|
||||
* @author:刘孝全
|
||||
* @email:q8197264@126.com
|
||||
* @date :2023年03月3日
|
||||
*/
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\admin\model\system\auth;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* Class Menu
|
||||
*/
|
||||
class Menu extends Model
|
||||
{
|
||||
// 指定连接到商城库
|
||||
protected $connection = 'shop';
|
||||
|
||||
// 指定此model关联表
|
||||
protected $table = 'eb_system_menu';
|
||||
|
||||
/**
|
||||
* 按条件获取商户菜单数据
|
||||
*
|
||||
* @param array $where 过滤字段条件
|
||||
* @param int $is_mer 菜单类型: 0商城平台菜单 1商户菜单
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function Search(array $where=[], int $is_mer=2):array
|
||||
{
|
||||
// 按条件 拼接 select 前sql
|
||||
$query = self::where('is_mer', $is_mer)->order('sort DESC,menu_id ASC');
|
||||
if (isset($where['pid'])) $query->where('pid', (int)$where['pid']);
|
||||
if (isset($where['keyword'])) $query->whereLike('menu_name|route', "%{$where['keyword']}%");
|
||||
if (isset($where['is_menu'])) $query->where('is_menu', (int)$where['is_menu']);
|
||||
|
||||
// 查询记录总行数
|
||||
// $count = $query->count();
|
||||
|
||||
// 隐藏指定字段
|
||||
$list = $query->hidden(['update_time', 'path'])->select()->toArray();
|
||||
|
||||
// 合并为一个数组并返回
|
||||
// compact('count', 'list');
|
||||
|
||||
return $list;
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\admin\model\system\auth;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class Role extends Model
|
||||
{
|
||||
//
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\admin\model\system\merchant;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class MerchantType extends Model
|
||||
{
|
||||
//
|
||||
}
|
@ -1,150 +0,0 @@
|
||||
{extend name="common/base" /}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<form class="layui-form p-4">
|
||||
<h3 class="pb-3">功能菜单/节点</h3>
|
||||
{if condition="$id eq 0"}
|
||||
<table class="layui-table layui-table-form">
|
||||
<tr>
|
||||
<td class="layui-td-gray-2">父级菜单/节点<font>*</font>
|
||||
</td>
|
||||
<td>
|
||||
<select name="pid" lay-verify="required" lay-reqText="请选择父级菜单/节点">
|
||||
<option value="0">作为顶级菜单/节点</option>
|
||||
{volist name="$menus" id="v"}
|
||||
<option value="{$v.id}" {eq name="pid" value="$v.id" }selected="" {/eq}>{$v.title} </option>
|
||||
{/volist}
|
||||
</select>
|
||||
</td>
|
||||
<td class="layui-td-gray-2">左侧菜单显示<font>*</font>
|
||||
</td>
|
||||
<td>
|
||||
<input type="radio" name="menu" value="1" title="是">
|
||||
<input type="radio" name="menu" value="2" title="不是">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">菜单/节点名称<font>*</font>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入菜单/节点名称"
|
||||
lay-reqText="请输入菜单/节点名称" class="layui-input">
|
||||
</td>
|
||||
<td class="layui-td-gray">操作日志名称<font>*</font>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="name" lay-verify="required" placeholder="请输入操作日志名称" lay-reqText="请输入操作日志名称"
|
||||
autocomplete="off" class="layui-input">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">菜单/节点URL</td>
|
||||
<td>
|
||||
<input type="text" name="src" placeholder="请输入菜单/节点URL,可空" autocomplete="off" class="layui-input">
|
||||
</td>
|
||||
<td class="layui-td-gray">菜单排序</td>
|
||||
<td>
|
||||
<input type="text" name="sort" value="0" placeholder="请输入数字,越小越靠前" autocomplete="off"
|
||||
class="layui-input">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">菜单图标</td>
|
||||
<td colspan="3">
|
||||
<input type="text" name="icon" style="width:150px; display:inline" placeholder="请输入图标,可空"
|
||||
autocomplete="off" class="layui-input">
|
||||
如:bi-gear<a href="{__GOUGU__}/icon/index.html" target="_blank" style="margin-left:10px; color:#007AFF">[查看图标]</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{else/}
|
||||
<table class="layui-table layui-table-form">
|
||||
<tr>
|
||||
<td class="layui-td-gray-2">父级菜单/节点<font>*</font>
|
||||
</td>
|
||||
<td>
|
||||
<select name="pid" lay-verify="required" lay-reqText="请选择父级菜单/节点">
|
||||
<option value="0">作为顶级节点</option>
|
||||
{volist name="$menus" id="v"}
|
||||
<option value="{$v.id}" {eq name="$detail.pid" value="$v.id" }selected="" {/eq}>{$v.title}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</td>
|
||||
<td class="layui-td-gray-2">左侧菜单显示<font>*</font>
|
||||
</td>
|
||||
<td>
|
||||
<input type="radio" name="menu" value="1" title="是" {eq name="$detail.menu" value="1" } checked{/eq}>
|
||||
<input type="radio" name="menu" value="2" title="不是" {eq name="$detail.menu" value="2" } checked{/eq}>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">菜单/节点名称<font>*</font>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="title" value="{$detail.title}" lay-verify="required" autocomplete="off"
|
||||
placeholder="请输入菜单/节点名称" lay-reqText="请输入菜单/节点名称" class="layui-input">
|
||||
</td>
|
||||
<td class="layui-td-gray">操作日志名称<font>*</font>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="name" value="{$detail.name}" lay-verify="required" placeholder="请输入操作日志名称"
|
||||
lay-reqText="请输入操作日志名称" autocomplete="off" class="layui-input">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">菜单/节点URL</td>
|
||||
<td>
|
||||
<input type="text" name="src" value="{$detail.src}" placeholder="请输入菜单/节点URL,可空" autocomplete="off"
|
||||
class="layui-input">
|
||||
</td>
|
||||
<td class="layui-td-gray">菜单排序</td>
|
||||
<td>
|
||||
<input type="text" name="sort" value="{$detail.sort}" placeholder="请输入数字,越小越靠前" autocomplete="off"
|
||||
class="layui-input">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">菜单图标</td>
|
||||
<td colspan="3">
|
||||
<input style="width:150px; display:inline" type="text" name="icon" value="{$detail.icon}" placeholder="请输入图标,可空" autocomplete="off" class="layui-input">
|
||||
<i class="bi {$detail.icon}"></i><a href="{__GOUGU__}/icon/index.html" target="_blank" style="margin-left:10px; color:#007AFF">[查看图标]</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{/if}
|
||||
<div style="padding: 10px 0">
|
||||
<input type="hidden" name="id" value="{$id}">
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</form>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
const moduleInit = ['tool'];
|
||||
function gouguInit() {
|
||||
var form = layui.form,tool=layui.tool;
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
if (!data.field.menu || data.field.menu == '') {
|
||||
layer.msg('请选择是否在左侧菜单显示');
|
||||
return false;
|
||||
}
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
setTimeout(function () {
|
||||
parent.location.reload();
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
tool.post("/admin/rule/add", data.field, callback);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
Loading…
x
Reference in New Issue
Block a user