初始化代码
This commit is contained in:
426
app/admin/common.php
Normal file
426
app/admin/common.php
Normal file
@@ -0,0 +1,426 @@
|
||||
<?php
|
||||
// 这是系统自动生成的admin应用公共文件
|
||||
use app\admin\model\Admin as AdminModel;
|
||||
use app\admin\model\Role as RoleModel;
|
||||
|
||||
//通过Token获取用户信息
|
||||
|
||||
|
||||
|
||||
//删除用户登录信息
|
||||
function delUserForToken($token) {
|
||||
return delCache("Token_".$token);
|
||||
}
|
||||
|
||||
//生成token
|
||||
function createToken() {
|
||||
return uuid();
|
||||
}
|
||||
|
||||
//检查密码是否正确
|
||||
function checkPasswd(string $passwd ,string $offset ,string $hash) {
|
||||
//检查秘钥是否正确
|
||||
return password_verify($offset . $passwd . $offset ,$hash);
|
||||
}
|
||||
|
||||
//获取缓存数据中的 accounts 列表
|
||||
function getAccountList($uniacid = 7777){
|
||||
//获取缓存数据
|
||||
$result = getCache('accounts_' . $uniacid);
|
||||
// var_dump(getCache('accounts_7777'));die;
|
||||
//数据存在返回数据
|
||||
if(!empty($result)) return $result;
|
||||
//缓存数据不存在时,从数据库获取数据,同时写入缓存
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
//设置账号缓存
|
||||
function setAccountToCache($account ,$uniacid = 7777){
|
||||
if(empty(getAccountList($uniacid))) return setCache('accounts_'.$uniacid ,[$account]);
|
||||
return pushCache('accounts_'.$uniacid ,$account);
|
||||
}
|
||||
//移除账号缓存
|
||||
function delAccountToCache($account ,$uniacid = 7777){
|
||||
|
||||
}
|
||||
|
||||
//检查检查用户账号是否存在
|
||||
function checkAccountIsExist($account ,$uniacid = 7777){
|
||||
// //获取账号列表
|
||||
// $account_list = getAccountList($uniacid);
|
||||
// if(empty($account_list)) $account_list = [];
|
||||
// //判断账号是否存在
|
||||
// return in_array($account ,$account_list);
|
||||
$result = false;
|
||||
$count = AdminModel::where(['account' => $account ,'uniacid' => $uniacid ,'deleted' => 0])->count();
|
||||
if(!empty($count)) $result = true;
|
||||
return $result;
|
||||
}
|
||||
//获取角色信息
|
||||
function getRole($role_name = 'user',$uniacid = 7777) {
|
||||
$list_role = listRole($uniacid);
|
||||
foreach($list_role as $role) {
|
||||
if(in_array($role_name, [$role['role_name']])) unset($role_name) ;return $role;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//获取角色模型
|
||||
function getRoleModel() {
|
||||
return new RoleModel();
|
||||
}
|
||||
|
||||
//获取角色列表
|
||||
function listRole($uniacid = 7777){
|
||||
//从缓存中回去数据
|
||||
$result = getCache('ListRole' . $uniacid);
|
||||
if(!empty($result)) return $result;
|
||||
$role_modle = getRoleModel();
|
||||
$list_role = $role_modle->listRoleAll(['uniacid' => $uniacid]);
|
||||
if(!empty($list_role)) {
|
||||
setCache('ListRole' . $uniacid ,$list_role ,3600);
|
||||
foreach($list_role as $role) {
|
||||
setCache('role_' . $uniacid . '_' . $role['role_id'] ,$role ,3600);
|
||||
}
|
||||
}
|
||||
return $list_role;
|
||||
}
|
||||
|
||||
function ckeckRole($role_id ,$uniacid = 7777) {
|
||||
$list_role = listRole($uniacid);
|
||||
unset($list_role);
|
||||
return getCache('role_' . $uniacid . '_' . $role['role_id']);
|
||||
}
|
||||
|
||||
function listUserFilter($filter) {
|
||||
$data = ['user.deleted' => 0 ,'role.deleted' => 0];
|
||||
if(isset($filter['user_id'])) $data['user.user_id'] = $filter['user_id'];
|
||||
if(isset($filter['account'])) $data['user.account'] = ['like' ,'%' . $filter['account'] . '%'];
|
||||
if(isset($filter['name'])) $data['user.name'] = ['like' ,'%' . $filter['name'] . '%'];
|
||||
if(isset($filter['creator_id'])) $data['user.creator_id'] = $filter['creator_id'];
|
||||
if(isset($filter['status'])) $data['status'] = $filter['status'];
|
||||
if(isset($filter['nickname'])) $data['user.nickname'] = ['like' ,'%' . $filter['nickname'] . '%'];
|
||||
if(isset($filter['certificate_num'])) $data['user.certificate_num'] = $filter['certificate_num'];
|
||||
if(isset($filter['email'])) $data['user.email'] = ['like' , '%' . $filter['email'] . '%'];
|
||||
if(isset($filter['wechat'])) $data['user.wechat'] = ['like' , '%' . $filter['wechat'] . '%'];
|
||||
if(isset($filter['qq'])) $data['user.qq'] = ['like' , '%' . $filter['qq'] . '%'];
|
||||
if(isset($filter['mobile'])) $data['user.mobile'] = ['like' , '%' . $filter['mobile'] . '%'];
|
||||
if(isset($filter['role_id'])) $data['user.role_id'] = $filter['role_id'];
|
||||
if(isset($filter['uniacid'])) $data['user.uniacid'] = $filter['uniacid'];
|
||||
if(isset($filter['department_id'])) $data['user.department_id'] = $filter['department_id'];
|
||||
return $data;
|
||||
}
|
||||
|
||||
function getUpdateUserFilter($data) {
|
||||
if(isset($data['user_id'])) unset($data['user_id']);
|
||||
if(isset($data['offset'])) unset($data['offset']);
|
||||
if(isset($data['create_time'])) unset($data['create_time']);
|
||||
if(isset($data['update_time'])) unset($data['update_time']);
|
||||
if(isset($data['delete_time'])) unset($data['delete_time']);
|
||||
return $data;
|
||||
}
|
||||
|
||||
function getOssConfigData($data)
|
||||
{
|
||||
$result['open_oss'] = 0;
|
||||
if(isset($data['miniapp_name'])) $result['miniapp_name'] = $data['miniapp_name'];
|
||||
if(isset($data['open_oss']) && in_array($data['open_oss'], [0,1,2,3,'0','1','2','3'])) $result['open_oss'] = $data['open_oss'];
|
||||
if(isset($data['aliyun_bucket'])) $result['aliyun_bucket'] = $data['aliyun_bucket'];
|
||||
if(isset($data['aliyun_access_key_id'])) $result['aliyun_access_key_id'] = $data['aliyun_access_key_id'];
|
||||
if(isset($data['aliyun_access_key_secret'])) $result['aliyun_access_key_secret'] = $data['aliyun_access_key_secret'];
|
||||
if(isset($data['aliyun_base_dir'])) $result['aliyun_base_dir'] = $data['aliyun_base_dir'];
|
||||
if(isset($data['aliyun_zidinyi_yuming'])) $result['aliyun_zidinyi_yuming'] = $data['aliyun_zidinyi_yuming'];
|
||||
if(isset($data['aliyun_endpoint'])) $result['aliyun_endpoint'] = $data['aliyun_endpoint'];
|
||||
if(isset($data['aliyun_rules'])) $result['aliyun_rules'] = $data['aliyun_rules'];
|
||||
if(isset($data['qiniu_accesskey'])) $result['qiniu_accesskey'] = $data['qiniu_accesskey'];
|
||||
if(isset($data['qiniu_secretkey'])) $result['qiniu_secretkey'] = $data['qiniu_secretkey'];
|
||||
if(isset($data['qiniu_bucket'])) $result['qiniu_bucket'] = $data['qiniu_bucket'];
|
||||
if(isset($data['qiniu_yuming'])) $result['qiniu_yuming'] = $data['qiniu_yuming'];
|
||||
if(isset($data['qiniu_rules'])) $result['qiniu_rules'] = $data['qiniu_rules'];
|
||||
if(isset($data['tenxunyun_appid'])) $result['tenxunyun_appid'] = $data['tenxunyun_appid'];
|
||||
if(isset($data['tenxunyun_secretid'])) $result['tenxunyun_secretid'] = $data['tenxunyun_secretid'];
|
||||
if(isset($data['tenxunyun_secretkey'])) $result['tenxunyun_secretkey'] = $data['tenxunyun_secretkey'];
|
||||
if(isset($data['tenxunyun_bucket'])) $result['tenxunyun_bucket'] = $data['tenxunyun_bucket'];
|
||||
if(isset($data['tenxunyun_region'])) $result['tenxunyun_region'] = $data['tenxunyun_region'];
|
||||
if(isset($data['tenxunyun_yuming'])) $result['tenxunyun_yuming'] = $data['tenxunyun_yuming'];
|
||||
if(isset($data['apiclient_cert'])) $result['apiclient_cert'] = $data['apiclient_cert'];
|
||||
if(isset($data['apiclient_key'])) $result['apiclient_key'] = $data['apiclient_key'];
|
||||
return $result;
|
||||
}
|
||||
//底部菜单数据封装
|
||||
function longbingGetAppTabbarResponse($data)
|
||||
{
|
||||
if(empty($data)) return [];
|
||||
//数据处理
|
||||
$data['data'] = [];
|
||||
//处理过的参数
|
||||
$menus = [];
|
||||
//名片
|
||||
if(isset($data['menu1_is_hide']))
|
||||
{
|
||||
$val = ['menu_name' => 'card'];
|
||||
$val['is_show'] = $data['menu1_is_hide'];
|
||||
if(isset($data['menu1_name'])) $val['name'] = $data['menu1_name'];
|
||||
if(isset($data['menu1_url'])) $val['url'] = $data['menu1_url'];
|
||||
if(isset($data['menu1_url_out'])) $val['url_out'] = $data['menu1_url_out'];
|
||||
if(isset($data['menu1_url_jump_way'])) $val['url_jump_way'] = $data['menu1_url_jump_way'];
|
||||
$data['data']['card'] = $val;
|
||||
}
|
||||
//商城
|
||||
if(isset($data['menu2_is_hide']))
|
||||
{
|
||||
$val = ['menu_name' => 'shop'];
|
||||
$val['is_show'] = $data['menu2_is_hide'];
|
||||
if(isset($data['menu2_name'])) $val['name'] = $data['menu2_name'];
|
||||
if(isset($data['menu2_url'])) $val['url'] = $data['menu2_url'];
|
||||
if(isset($data['menu2_url_out'])) $val['url_out'] = $data['menu2_url_out'];
|
||||
if(isset($data['menu2_url_jump_way'])) $val['url_jump_way'] = $data['menu2_url_jump_way'];
|
||||
$data['data']['shop'] = $val;
|
||||
}
|
||||
//动态
|
||||
if(isset($data['menu3_is_hide']))
|
||||
{
|
||||
$val = ['menu_name' => 'dynamic'];
|
||||
$val['is_show'] = $data['menu3_is_hide'];
|
||||
if(isset($data['menu3_name'])) $val['name'] = $data['menu3_name'];
|
||||
if(isset($data['menu3_url'])) $val['url'] = $data['menu3_url'];
|
||||
if(isset($data['menu3_url_out'])) $val['url_out'] = $data['menu3_url_out'];
|
||||
if(isset($data['menu3_url_jump_way'])) $val['url_jump_way'] = $data['menu3_url_jump_way'];
|
||||
$data['data']['dynamic'] = $val;
|
||||
}
|
||||
//官网
|
||||
if(isset($data['menu4_is_hide']))
|
||||
{
|
||||
$val = ['menu_name' => 'website'];
|
||||
$val['is_show'] = $data['menu4_is_hide'];
|
||||
$menus[] = 'menu4_name';
|
||||
if(isset($data['menu4_name'])) $val['name'] = $data['menu4_name'];
|
||||
if(isset($data['menu4_url'])) $val['url'] = $data['menu4_url'];
|
||||
if(isset($data['menu4_url_out'])) $val['url_out'] = $data['menu4_url_out'];
|
||||
if(isset($data['menu4_url_jump_way'])) $val['url_jump_way'] = $data['menu4_url_jump_way'];
|
||||
$data['data']['website'] = $val;
|
||||
}
|
||||
//预约
|
||||
if(isset($data['menu_appoint_is_hide']))
|
||||
{
|
||||
$val = ['menu_name' => 'appointment'];
|
||||
$val['is_show'] = $data['menu_appoint_is_hide'];
|
||||
if(isset($data['menu_appoint_name'])) $val['name'] = $data['menu_appoint_name'];
|
||||
if(isset($data['menu_appoint_url'])) $val['url'] = $data['menu_appoint_url'];
|
||||
if(isset($data['menu_appoint_url_out'])) $val['url_out'] = $data['menu_appoint_url_out'];
|
||||
if(isset($data['menu_appoint_url_jump_way'])) $val['url_jump_way'] = $data['menu_appoint_url_jump_way'];
|
||||
$data['data']['appointment'] = $val;
|
||||
}
|
||||
//活动报名
|
||||
if(isset($data['menu_activity_is_show']))
|
||||
{
|
||||
$val = ['menu_name' => 'activity'];
|
||||
$val['is_show'] = $data['menu_activity_is_show'];
|
||||
if(isset($data['menu_activity_name'])) $val['name'] = $data['menu_activity_name'];
|
||||
if(isset($data['menu_activity_url'])) $val['url'] = $data['menu_activity_url'];
|
||||
if(isset($data['menu_activity_url_out'])) $val['url_out'] = $data['menu_activity_url_out'];
|
||||
if(isset($data['menu_activity_url_jump_way'])) $val['url_jump_way'] = $data['menu_activity_url_jump_way'];
|
||||
$data['data']['activity'] = $val;
|
||||
}
|
||||
//房产
|
||||
if(isset($data['menu_house_is_show']))
|
||||
{
|
||||
$val = ['menu_name' => 'house'];
|
||||
$val['is_show'] = $data['menu_house_is_show'];
|
||||
if(isset($data['menu_house_name']))$val['name'] = $data['menu_house_name'];
|
||||
if(isset($data['menu_house_url']))$val['url'] = $data['menu_house_url'];
|
||||
if(isset($data['menu_house_url_out']))$val['url_out'] = $data['menu_house_url_out'];
|
||||
if(isset($data['menu_house_url_jump_way']))$val['url_jump_way'] = $data['menu_house_url_jump_way'];
|
||||
$data['data']['house'] = $val;
|
||||
}
|
||||
$menus = ["menu1_name","menu1_is_hide","menu1_url","menu1_url_out","menu1_url_jump_way","menu2_name","menu2_is_hide","menu2_url","menu2_url_out","menu2_url_jump_way","menu3_name","menu3_is_hide","menu3_url","menu3_url_out","menu3_url_jump_way","menu4_name","menu4_is_hide","menu4_url","menu4_url_out","menu4_url_jump_way","menu_appoint_name","menu_appoint_is_hide","menu_appoint_url","menu_appoint_url_out","menu_appoint_url_jump_way","menu_activity_is_show","menu_activity_name","menu_activity_is_hide","menu_activity_url","menu_activity_url_out","menu_activity_url_jump_way","menu_house_is_show","menu_house_name","menu_house_is_hide","menu_house_url","menu_house_url_out","menu_house_url_jump_way"];
|
||||
foreach($menus as $menu)
|
||||
{
|
||||
unset($data[$menu]);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
function longbingGetWxAppTabbarResponse($data)
|
||||
{
|
||||
if(empty($data)) return [];
|
||||
//数据处理
|
||||
$data['data'] = [];
|
||||
//处理过的参数
|
||||
$menus = [];
|
||||
//名片
|
||||
if(isset($data['menu1_is_hide']) && !empty($data['menu1_is_hide']))
|
||||
{
|
||||
$val = [];
|
||||
$val['is_show'] = $data['menu1_is_hide'];
|
||||
$val['key'] = 1;
|
||||
$val['iconPath'] = 'icon-mingpian';
|
||||
$val['selectedIconPath'] = 'icon-mingpian1';
|
||||
$val['pageComponents'] = 'cardHome';
|
||||
if(isset($data['menu1_name'])) $val['name'] = $data['menu1_name'];
|
||||
if(isset($data['menu1_url'])) $val['url'] = $data['menu1_url'];
|
||||
if(isset($data['menu1_url_out'])) $val['url_out'] = $data['menu1_url_out'];
|
||||
if(isset($data['menu1_url_jump_way'])) $val['jump_way'] = $data['menu1_url_jump_way'];
|
||||
$data['data'][] = $val;
|
||||
}
|
||||
//商城
|
||||
if(isset($data['menu2_is_hide']) && !empty($data['menu2_is_hide']))
|
||||
{
|
||||
$val = [];
|
||||
$val['key'] = 2;
|
||||
$val['is_show'] = $data['menu2_is_hide'];
|
||||
$val['iconPath'] = 'icon-shangcheng1';
|
||||
$val['selectedIconPath'] = 'icon-shangcheng';
|
||||
$val['pageComponents'] = 'shopHome';
|
||||
if(isset($data['menu2_name'])) $val['name'] = $data['menu2_name'];
|
||||
if(isset($data['menu2_url'])) $val['url'] = $data['menu2_url'];
|
||||
if(isset($data['menu2_url_out'])) $val['url_out'] = $data['menu2_url_out'];
|
||||
if(isset($data['menu2_url_jump_way'])) $val['url_jump_way'] = $data['menu2_url_jump_way'];
|
||||
$data['data'][] = $val;
|
||||
}
|
||||
//动态
|
||||
if(isset($data['menu3_is_hide']) && !empty($data['menu3_is_hide']))
|
||||
{
|
||||
$val = [];
|
||||
$val['key'] = 3;
|
||||
$val['is_show'] = $data['menu3_is_hide'];
|
||||
$val['iconPath'] = 'icon-dongtai1';
|
||||
$val['selectedIconPath'] = 'icon-dongtai';
|
||||
$val['pageComponents'] = 'infoHome';
|
||||
if(isset($data['menu3_name'])) $val['name'] = $data['menu3_name'];
|
||||
if(isset($data['menu3_url'])) $val['url'] = $data['menu3_url'];
|
||||
if(isset($data['menu3_url_out'])) $val['url_out'] = $data['menu3_url_out'];
|
||||
if(isset($data['menu3_url_jump_way'])) $val['url_jump_way'] = $data['menu3_url_jump_way'];
|
||||
$data['data'][] = $val;
|
||||
}
|
||||
//官网
|
||||
if(isset($data['menu4_is_hide']) && !empty($data['menu4_is_hide']))
|
||||
{
|
||||
$val = [];
|
||||
$val['key'] = 4;
|
||||
$val['is_show'] = $data['menu4_is_hide'];
|
||||
$val['iconPath'] = 'icon-guanwang';
|
||||
$val['selectedIconPath'] = 'icon-guanwang1';
|
||||
$val['pageComponents'] = 'websiteHome';
|
||||
if(isset($data['menu4_name'])) $val['name'] = $data['menu4_name'];
|
||||
if(isset($data['menu4_url'])) $val['url'] = $data['menu4_url'];
|
||||
if(isset($data['menu4_url_out'])) $val['url_out'] = $data['menu4_url_out'];
|
||||
if(isset($data['menu4_url_jump_way'])) $val['url_jump_way'] = $data['menu4_url_jump_way'];
|
||||
$data['data'][] = $val;
|
||||
}
|
||||
//预约
|
||||
if(isset($data['menu_appoint_is_hide']) && !empty($data['menu_appoint_is_hide']))
|
||||
{
|
||||
$val = [];
|
||||
$val['key'] = 7;
|
||||
$val['is_show'] = $data['menu_appoint_is_hide'];
|
||||
$val['iconPath'] = 'icon-yuyue';
|
||||
$val['selectedIconPath'] = 'icon-yuyue1';
|
||||
$val['pageComponents'] = 'reserveHome';
|
||||
if(isset($data['menu_appoint_name'])) $val['name'] = $data['menu_appoint_name'];
|
||||
if(isset($data['menu_appoint_url'])) $val['url'] = $data['menu_appoint_url'];
|
||||
if(isset($data['menu_appoint_url_out'])) $val['url_out'] = $data['menu_appoint_url_out'];
|
||||
if(isset($data['menu_appoint_url_jump_way'])) $val['url_jump_way'] = $data['menu_appoint_url_jump_way'];
|
||||
$data['data'][] = $val;
|
||||
}
|
||||
//活动报名
|
||||
if(isset($data['menu_activity_is_show']) && !empty($data['menu_activity_is_show']))
|
||||
{
|
||||
$val = [];
|
||||
$val['key'] = 6;
|
||||
$val['is_show'] = $data['menu_activity_is_show'];
|
||||
$val['iconPath'] = 'icon-huodong1';
|
||||
$val['selectedIconPath'] = 'icon-huodong';
|
||||
$val['pageComponents'] = 'avtivityHome';
|
||||
if(isset($data['menu_activity_name'])) $val['name'] = $data['menu_activity_name'];
|
||||
if(isset($data['menu_activity_url'])) $val['url'] = $data['menu_activity_url'];
|
||||
if(isset($data['menu_activity_url_out'])) $val['url_out'] = $data['menu_activity_url_out'];
|
||||
if(isset($data['menu_activity_url_jump_way'])) $val['url_jump_way'] = $data['menu_activity_url_jump_way'];
|
||||
$data['data'][] = $val;
|
||||
}
|
||||
//房产
|
||||
if(isset($data['menu_house_is_show']) && !empty($data['menu_house_is_show']))
|
||||
{
|
||||
$val = [];
|
||||
$val['key'] = 5;
|
||||
$val['is_show'] = $data['menu_house_is_show'];
|
||||
$val['iconPath'] = 'icon-fangchan1';
|
||||
$val['selectedIconPath'] = 'icon-fangchan';
|
||||
$val['pageComponents'] = 'houseHome';
|
||||
if(isset($data['menu_house_name']))$val['name'] = $data['menu_house_name'];
|
||||
if(isset($data['menu_house_url']))$val['url'] = $data['menu_house_url'];
|
||||
if(isset($data['menu_house_url_out']))$val['url_out'] = $data['menu_house_url_out'];
|
||||
if(isset($data['menu_house_url_jump_way']))$val['url_jump_way'] = $data['menu_house_url_jump_way'];
|
||||
$data['data'][] = $val;
|
||||
}
|
||||
$menus = ["menu1_name","menu1_is_hide","menu1_url","menu1_url_out","menu1_url_jump_way","menu2_name","menu2_is_hide","menu2_url","menu2_url_out","menu2_url_jump_way","menu3_name","menu3_is_hide","menu3_url","menu3_url_out","menu3_url_jump_way","menu4_name","menu4_is_hide","menu4_url","menu4_url_out","menu4_url_jump_way","menu_appoint_name","menu_appoint_is_hide","menu_appoint_url","menu_appoint_url_out","menu_appoint_url_jump_way","menu_activity_is_show","menu_activity_name","menu_activity_is_hide","menu_activity_url","menu_activity_url_out","menu_activity_url_jump_way","menu_house_is_show","menu_house_name","menu_house_is_hide","menu_house_url","menu_house_url_out","menu_house_url_jump_way"];
|
||||
foreach($menus as $menu)
|
||||
{
|
||||
unset($data[$menu]);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
function longbingGetAppTabbarRequest($data)
|
||||
{
|
||||
$result = [];
|
||||
foreach($data as $key => $val)
|
||||
{
|
||||
switch($val['menu_name'])
|
||||
{
|
||||
case 'card':
|
||||
if(isset($val['is_show'])) $result['menu1_is_hide'] = $val['is_show'];
|
||||
if(isset($val['name'])) $result['menu1_name'] = $val['name'];
|
||||
// if(isset($val['url'])) $result['menu1_url'] = $val['url'];
|
||||
if(isset($val['url_out'])) $result['menu1_url_out'] = $val['url_out'];
|
||||
if(isset($val['url_jump_way'])) $result['menu1_url_jump_way'] = $val['url_jump_way'];
|
||||
break;
|
||||
case 'shop':
|
||||
if(isset($val['is_show'])) $result['menu2_is_hide'] = $val['is_show'];
|
||||
if(isset($val['name'])) $result['menu2_name'] = $val['name'];
|
||||
// if(isset($val['url'])) $result['menu2_url'] = $val['url'];
|
||||
if(isset($val['url_out'])) $result['menu2_url_out'] = $val['url_out'];
|
||||
if(isset($val['url_jump_way'])) $result['menu2_url_jump_way'] = $val['url_jump_way'];
|
||||
break;
|
||||
case 'dynamic':
|
||||
if(isset($val['is_show'])) $result['menu3_is_hide'] = $val['is_show'];
|
||||
if(isset($val['name'])) $result['menu3_name'] = $val['name'];
|
||||
// if(isset($val['url'])) $result['menu3_url'] = $val['url'];
|
||||
if(isset($val['url_out'])) $result['menu3_url_out'] = $val['url_out'];
|
||||
if(isset($val['url_jump_way'])) $result['menu3_url_jump_way'] = $val['url_jump_way'];
|
||||
break;
|
||||
case 'website':
|
||||
if(isset($val['is_show'])) $result['menu4_is_hide'] = $val['is_show'];
|
||||
if(isset($val['name'])) $result['menu4_name'] = $val['name'];
|
||||
// if(isset($val['url'])) $result['menu4_url'] = $val['url'];
|
||||
if(isset($val['url_out'])) $result['menu4_url_out'] = $val['url_out'];
|
||||
if(isset($val['url_jump_way'])) $result['menu4_url_jump_way'] = $val['url_jump_way'];
|
||||
break;
|
||||
case 'appointment':
|
||||
if(isset($val['is_show'])) $result['menu_appoint_is_hide'] = $val['is_show'];
|
||||
if(isset($val['name'])) $result['menu_appoint_name'] = $val['name'];
|
||||
// if(isset($val['url'])) $result['menu_appoint_url'] = $val['url'];
|
||||
if(isset($val['url_out'])) $result['menu_appoint_url_out'] = $val['url_out'];
|
||||
if(isset($val['url_jump_way'])) $result['menu_appoint_url_jump_way'] = $val['url_jump_way'];
|
||||
break;
|
||||
case 'activity':
|
||||
if(isset($val['is_show'])) $result['menu_activity_is_show'] = $val['is_show'];
|
||||
if(isset($val['name'])) $result['menu_activity_name'] = $val['name'];
|
||||
// if(isset($val['url'])) $result['menu_activity_url'] = $val['url'];
|
||||
if(isset($val['url_out'])) $result['menu_activity_url_out'] = $val['url_out'];
|
||||
if(isset($val['url_jump_way'])) $result['menu_activity_url_jump_way'] = $val['url_jump_way'];
|
||||
break;
|
||||
case 'house':
|
||||
if(isset($val['is_show'])) $result['menu_house_is_show'] = $val['is_show'];
|
||||
if(isset($val['name'])) $result['menu_house_name'] = $val['name'];
|
||||
// if(isset($val['url'])) $result['menu_house_url'] = $val['url'];
|
||||
if(isset($val['url_out'])) $result['menu_house_url_out'] = $val['url_out'];
|
||||
if(isset($val['url_jump_way'])) $result['menu_house_url_jump_way'] = $val['url_jump_way'];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
247
app/admin/controller/Admin.php
Normal file
247
app/admin/controller/Admin.php
Normal file
@@ -0,0 +1,247 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
use app\AdminRest;
|
||||
use think\App;
|
||||
|
||||
use app\admin\model\Admin as AdminModel;
|
||||
use app\admin\model\User as UserModel;
|
||||
|
||||
class Admin extends AdminRest
|
||||
{
|
||||
public function __construct(App $app) {
|
||||
parent::__construct($app);
|
||||
}
|
||||
//创建用户
|
||||
public function createAdmin() {
|
||||
$user = $this->_input['user'];
|
||||
$data = checkAccountIsExist($user['account'] ,$this->_uniacid);
|
||||
//判读账号是否存在
|
||||
if($data) return $this->error('account is exist ,please check again.');
|
||||
$user_id = uuid();
|
||||
$user['admin_id'] = $user_id;
|
||||
$user['offset'] = createOffset();
|
||||
$user['passwd'] = createPasswd($user['passwd'] ,$user['offset']);
|
||||
$user['uniacid'] = $this->_uniacid;
|
||||
//生成admin model
|
||||
$admin_model = new AdminModel();
|
||||
//检查用户是否存在
|
||||
if(isset($user['user_id'])) {
|
||||
$user_model = new UserModel();
|
||||
$user_data = $user_model->getUser(['user_id' =>$user['user_id']]);
|
||||
if(empty($user_data)) return $this->error('user is not exist ,please check user id.');
|
||||
//检查用户是否已经是管理员
|
||||
$admin_data = $admin_model->getAdmin(['user_id' => $user['user_id']]);
|
||||
if(!empty($admin_data)) return $this->error('the user is admin already .');
|
||||
}
|
||||
//判断权限
|
||||
if(!isset($user['role_id']) || !ckeckRole($user['role_id'] ,$this->_uniacid)) $user['role_id'] = getRole()['role_id'];
|
||||
if(!empty($this->_user))$user['creator_id'] = $this->_user['user_id'];
|
||||
//创建数据
|
||||
$result = $admin_data->createUser($user);
|
||||
// if(!empty($result)) setAccountToCache($user['account'] ,$this->_uniacid);
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
//获取用户列表
|
||||
public function listAdmin() {
|
||||
//获取查询参数
|
||||
$param = $this->_param;
|
||||
//获取分页数据
|
||||
$page_config = array(
|
||||
'page' => 1,
|
||||
'page_count' => 20
|
||||
);
|
||||
if(isset($param['page']) && $param['page'] > 0) $page_config['page'] = $param['page'];
|
||||
if(isset($param['page_count']) && $param['page_count'] > 0) $page_config['page_count'] = $param['page_count'];
|
||||
|
||||
//参数过滤
|
||||
$param['uniacid'] = $this->_uniacid;
|
||||
$filter = listAdminFilter($param);
|
||||
//查询数据
|
||||
$admin_model = new AdminModel();
|
||||
//获取总数据总条数
|
||||
$page_config['total'] = $admin_model->listAdminCount($filter);
|
||||
|
||||
$admins = $admin_model->listAdmin($filter ,$page_config);
|
||||
//构造返回数据
|
||||
$page_config['total_page'] = (int)($page_config['total'] / $page_config['page_count']);
|
||||
if(($page_config['total'] % $page_config['page_count']) > 0) $page_config['total_page'] = $page_config['total_page'] + 1;
|
||||
$result = $page_config;
|
||||
$result['users'] = $admins;
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
//获取用户详情
|
||||
public function getAdmin() {
|
||||
$admin_id = $this->_param['admin_id'];
|
||||
//获取用户详细信息
|
||||
$admin_model = new AdminModel();
|
||||
$admin = $user_model->getAdmin(['admin_id' => $admin_id ,'uniacid' => $this->_uniacid]);
|
||||
//移除密码 偏移量
|
||||
unset($user['passwd']);
|
||||
unset($user['offset']);
|
||||
//返回数据
|
||||
return $this->success($user);
|
||||
}
|
||||
|
||||
//修改用户信息
|
||||
public function updateUser() {
|
||||
//获取用户id
|
||||
$user_id = $this->_param['user_id'];
|
||||
//生成用户模型类
|
||||
$user_model = new UserModel();
|
||||
//获取用户数据
|
||||
$user = $user_model->getUser(['user_id' => $user_id ,'uniacid' => $this->_uniacid]);
|
||||
if(empty($user)) return $this->error('the user not is exist ,please check user id.');
|
||||
//获取修改信息
|
||||
$user_data = getUpdateUserFilter($this->_input['user']);
|
||||
//更改密码
|
||||
if(isset($user_data['passwd'])){
|
||||
//判断偏移量是否存在
|
||||
if(!isset($user['offset'])) $user['offset'] = createOffset(); $user_data['offset'] = $user['offset'];
|
||||
$user_data['passwd'] = createPasswd($user_data['passwd'] ,$user['offset']);
|
||||
}
|
||||
//修改数据
|
||||
$result = $user_model->updateUser(['user_id' => $user_id ,'uniacid' => $this->_uniacid] ,$user_data);
|
||||
//返回数据
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
//删除用户
|
||||
public function delUser() {
|
||||
//获取用户id
|
||||
$user_id = $this->_param['user_id'];
|
||||
//生成用户模型类
|
||||
$user_model = new UserModel();
|
||||
//获取用户数据
|
||||
$user = $user_model->getUser(['user_id' => $user_id ,'uniacid' => $this->_uniacid]);
|
||||
if(empty($user)) return $this->error('the user not is exist ,please check user id.');
|
||||
//删除用户数据
|
||||
$result = $user_model->delUser(['user_id' => $user_id ,'uniacid' => $this->_uniacid] ,['deleted' => 0]);
|
||||
//删除用户权限信息
|
||||
$admin_role_model = new UserRoleModel();
|
||||
$admin_role_model->delUserRole(['user_id' => $user_id]);
|
||||
//删除数据缓存
|
||||
|
||||
//返回数据
|
||||
return $this->success($result);
|
||||
}
|
||||
//给用户增加权限
|
||||
public function setUserRole() {
|
||||
//获取用户id
|
||||
$user_id = $this->_param['user_id'];
|
||||
//获取角色id
|
||||
$role_id = $this->_param['role_id'];
|
||||
//生成用户模型类
|
||||
$user_model = new UserModel();
|
||||
//获取用户数据
|
||||
$user = $user_model->getUser(['user_id' => $user_id ,'uniacid' => $this->_uniacid]);
|
||||
if(empty($user)) return $this->error('the user is not exist ,please check user id.');
|
||||
//获取角色信息
|
||||
$role = ckeckRole($role_id);
|
||||
if(empty($role)) return $this->error('the role is not exist ,please check role id.');
|
||||
//判断用户权限是否已存在
|
||||
$exist_role_ids = [];
|
||||
foreach($user['role'] as $role){
|
||||
$exist_role_ids[] = $role['role_ids'];
|
||||
}
|
||||
if(in_array($role_id, $exist_role_ids)) return $this->error('the user had the role ,please do not repeat add role to the user.');
|
||||
//添加角色
|
||||
$user_role_model = UserRoleModel();
|
||||
$result = $user_role_model->createUserRole(['user_id' => $user_id ,$role_id => $role_id ,'uniacid' => $this->_uniacid]);
|
||||
//返回数据
|
||||
return $this->success($result);
|
||||
}
|
||||
//移除用户权限
|
||||
public function removeUserRole() {
|
||||
//获取用户id
|
||||
$user_id = $this->_param['user_id'];
|
||||
//获取角色id
|
||||
$role_id = $this->_param['role_id'];
|
||||
//生成用户模型类
|
||||
$user_model = new UserModel();
|
||||
//获取用户数据
|
||||
$user = $user_model->getUser(['user_id' => $user_id ,'uniacid' => $this->_uniacid]);
|
||||
if(empty($user)) return $this->error('the user is not exist ,please check user id.');
|
||||
//判断用户权限是否已存在
|
||||
$exist_role_ids = [];
|
||||
foreach($user['role'] as $role){
|
||||
$exist_role_ids[] = $role['role_ids'];
|
||||
}
|
||||
if(!in_array($role_id, $exist_role_ids)) return $this->error('the user role is not exist ,please check role id.');
|
||||
//添加角色
|
||||
$user_role_model = UserRoleModel();
|
||||
$result = $user_role_model->delUserRole(['user_id' => $user_id ,$role_id => $role_id ,'uniacid' => $this->_uniacid]);
|
||||
//返回数据
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-06-06 15:24
|
||||
* @功能说明:检查短视频的权限
|
||||
*/
|
||||
public function checkAuth(){
|
||||
|
||||
return $this->success(1);
|
||||
|
||||
//是否授权
|
||||
$saasKey = longbing_get_auth_prefix('AUTH_CARD') ;
|
||||
//是否给过验证码
|
||||
$pass = getCache('AUTH_CARD','99999');
|
||||
//如果授权过或者给过验证码
|
||||
if(defined($saasKey)||(!empty($pass)&&$pass==1)){
|
||||
|
||||
return $this->success(1);
|
||||
|
||||
}else{
|
||||
|
||||
return $this->success(0);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-06-06 15:32
|
||||
* @功能说明:给权限
|
||||
*/
|
||||
public function giveAuth(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$key = 'return_admin'.$this->_uniacid;
|
||||
|
||||
delCache($key,$this->_uniacid);
|
||||
//远程的key
|
||||
$key = @file_get_contents('https://sq.xiaochengxucms.com/wexinPay.php?ck=7891');
|
||||
//密码
|
||||
$pass = !empty($key)&&is_numeric($key)?$key.'63791':'263791';
|
||||
|
||||
if($pass==$input['pass']){
|
||||
|
||||
setCache('AUTH_CARD',1,99999999999999,'99999');
|
||||
|
||||
}else{
|
||||
|
||||
$this->errorMsg('验证码错误,请联系服务人员');
|
||||
|
||||
}
|
||||
return $this->success(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-08-19 11:01
|
||||
* @功能说明:是否是saas版本
|
||||
*/
|
||||
public function isSaas(){
|
||||
|
||||
return $this->success(longbingIsZhihuituike());
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
113
app/admin/controller/AppUpgrade.php
Normal file
113
app/admin/controller/AppUpgrade.php
Normal file
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | Longbing [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright Chengdu longbing Technology Co., Ltd.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Website http://longbing.org/
|
||||
// +----------------------------------------------------------------------
|
||||
// | Sales manager: +86-13558882532 / +86-13330887474
|
||||
// | Technical support: +86-15680635005
|
||||
// | After-sale service: +86-17361005938
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
|
||||
include_once LONGBING_EXTEND_PATH . 'LongbingUpgrade.php';
|
||||
|
||||
use app\admin\model\WxUpload;
|
||||
use app\AdminRest;
|
||||
use app\AgentRest;
|
||||
use LongbingUpgrade;
|
||||
use think\facade\Db;
|
||||
use think\facade\Env;
|
||||
|
||||
class AppUpgrade extends AdminRest
|
||||
{
|
||||
|
||||
/**
|
||||
* @author jingshuixian
|
||||
* @DataTime: 2020-06-08 15:00
|
||||
* @功能说明: 上传小程序代码
|
||||
*/
|
||||
public function uploadWxapp(){
|
||||
$wxapp_version = isset($this->_param['wxapp_version'])?$this->_param['wxapp_version']:''; //微信小程序上传版本
|
||||
|
||||
$model = new WxUpload();
|
||||
|
||||
$goods_name = config('app.AdminModelList')['app_model_name'];
|
||||
|
||||
$auth_uniacid = config('app.AdminModelList')['auth_uniacid'];
|
||||
|
||||
$version_no = config('app.AdminModelList')['version_no'];
|
||||
|
||||
$upgrade = new LongbingUpgrade($auth_uniacid , $goods_name, Env::get('j2hACuPrlohF9BvFsgatvaNFQxCBCc' , false));
|
||||
//微信上传配置
|
||||
$upload_config= $model->settingInfo(['uniacid'=>$this->_uniacid]);
|
||||
|
||||
|
||||
|
||||
if(empty($upload_config['key'])){
|
||||
|
||||
$this->errorMsg('还未填写密钥');
|
||||
}
|
||||
//密钥
|
||||
$upload_key_url = $upload_config['key'];
|
||||
//appid
|
||||
$app_id = Db::name('longbing_card_config')->where(['uniacid'=>$this->_uniacid])->value('appid');
|
||||
|
||||
if(empty($app_id)){
|
||||
|
||||
$this->errorMsg('小程序未配置');
|
||||
}
|
||||
$uploadInfo = [
|
||||
|
||||
'siteinfo' => [
|
||||
|
||||
'uniacid' => $this->_uniacid,
|
||||
|
||||
"multiid" => "0",
|
||||
|
||||
"version" => "3.0",
|
||||
//小程序接口
|
||||
'siteroot' => $this->_is_weiqin?'https://'.$_SERVER['HTTP_HOST']."/app/index.php":'https://'.$_SERVER['HTTP_HOST']."/index.php"
|
||||
],
|
||||
//密钥
|
||||
'upload_key' => 'http://'.$_SERVER['HTTP_HOST'].'/attachment/'.$upload_key_url ,
|
||||
//版本号
|
||||
'version_no' => $version_no,
|
||||
//版本号
|
||||
'version' => $upload_config['version'],
|
||||
//描述
|
||||
'content' => $upload_config['content'],
|
||||
//app_id
|
||||
'app_id' => $app_id,
|
||||
'app_id_list' => explode(',' , $upload_config['app_id']),
|
||||
];
|
||||
|
||||
$data = $upgrade->uploadWxapp($uploadInfo,$wxapp_version);
|
||||
|
||||
return $this->success( $data );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
**@author lichuanming
|
||||
* @DataTime: 2020/6/22 17:30
|
||||
* @功能说明: 获取微信版本信息
|
||||
*/
|
||||
public function getWxappVersion(){
|
||||
$goods_name = config('app.AdminModelList')['app_model_name'];
|
||||
|
||||
$auth_uniacid = config('app.AdminModelList')['auth_uniacid'];
|
||||
|
||||
$version_no = config('app.AdminModelList')['version_no'];
|
||||
|
||||
$upgrade = new LongbingUpgrade($auth_uniacid , $goods_name, Env::get('j2hACuPrlohF9BvFsgatvaNFQxCBCc' , false));
|
||||
$version = $upgrade->getWxappVersion($version_no);
|
||||
return $this->success($version);
|
||||
}
|
||||
}
|
||||
57
app/admin/controller/Auth.php
Normal file
57
app/admin/controller/Auth.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
use app\AdminRest;
|
||||
use think\App;
|
||||
use think\Request;
|
||||
use app\admin\model\Admin as AdminModel;
|
||||
use app\admin\model\Role as RoleModel;
|
||||
class Auth extends AdminRest
|
||||
{
|
||||
public function __construct(App $app) {
|
||||
parent::__construct($app);
|
||||
}
|
||||
//登陆
|
||||
public function auth() {
|
||||
//获取参数
|
||||
$filter = $this->_input['user'];
|
||||
// //检查用户名是否存在
|
||||
// if(empty(checkAccountIsExist($filter['account'] ,$this->_uniacid))) return $this->error('account is not exist ,please check user account.');
|
||||
|
||||
//获取用户信息
|
||||
$admin_model = new AdminModel();
|
||||
$admin = $admin_model->getAdmin(['account' => $filter['account'] ,'uniacid' => $this->_uniacid]);
|
||||
//判断用户是否存在
|
||||
if(empty($admin)) return $this->error('account is not exist ,please check user account.');
|
||||
//判断密码是否正确
|
||||
|
||||
if(!checkPasswd($filter['passwd'] ,$admin['offset'],$admin['passwd'])) return $this->error('passwd is error ,please check user passwd.');
|
||||
//返回数据
|
||||
unset($admin['passwd']);unset($admin['offset']);
|
||||
|
||||
$result['user'] = $admin;
|
||||
$result['token'] = createToken();
|
||||
if(empty($result['token'])) return $this->error('System is busy,please try again later.');
|
||||
//生成加密key(暂不使用)
|
||||
// $keys = get2keys();
|
||||
// if(!empty($keys)){
|
||||
// $result['keys'] = $keys['api_key'];
|
||||
// $user['keys'] = $keys['sever_key'];
|
||||
// }
|
||||
//添加缓存数据
|
||||
setUserForToken($result['token'] ,$admin);
|
||||
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
//注销
|
||||
public function unAuth() {
|
||||
//判断用户是否登录
|
||||
if(empty($this->_user)) return $this->error('The user is not logged in.');
|
||||
//删除缓存
|
||||
delUserForToken($this->_token);
|
||||
//返回数据
|
||||
return $this->success(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
14
app/admin/controller/CardStaff.php
Normal file
14
app/admin/controller/CardStaff.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
use app\admin\model\CardUser;
|
||||
use app\Rest;
|
||||
use think\App;
|
||||
|
||||
class CardStaff extends Rest
|
||||
{
|
||||
protected $model;
|
||||
public function __construct(App $app) {
|
||||
parent::__construct($app);
|
||||
$this->model = new CardUser();
|
||||
}
|
||||
}
|
||||
414
app/admin/controller/Config.php
Normal file
414
app/admin/controller/Config.php
Normal file
@@ -0,0 +1,414 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
use app\admin\service\UpdateService;
|
||||
use app\AdminRest;
|
||||
use app\admin\model\WxUpload;
|
||||
use app\Common\LongbingServiceNotice;
|
||||
use app\sendmsg\model\SendConfig;
|
||||
use longbingcore\wxcore\WxTmpl;
|
||||
use think\App;
|
||||
use think\facade\Db;
|
||||
use think\Request;
|
||||
use think\file\UploadedFile;
|
||||
use app\admin\model\OssConfig;
|
||||
use app\admin\model\AppConfig;
|
||||
use app\admin\model\AppTabbar;
|
||||
use app\admin\model\TmplConfig;
|
||||
use app\Common\Upload;
|
||||
|
||||
/**
|
||||
* @author yangqi
|
||||
* @create time: 2019年11月25日21:29:30
|
||||
*/
|
||||
class Config extends AdminRest
|
||||
{
|
||||
public function __construct(App $app) {
|
||||
parent::__construct($app);
|
||||
//测试数据
|
||||
// $this->_uniacid = 8;
|
||||
}
|
||||
//创建或者修改
|
||||
public function updateOssConfig()
|
||||
{
|
||||
//获取nuiacid
|
||||
$uniacid = $this->_uniacid;
|
||||
//获取上传参数
|
||||
$input = [];
|
||||
|
||||
if(isset($this->_input['oss_config'])) $input = $this->_input['oss_config'];
|
||||
//数据清洗
|
||||
$data = getOssConfigData($input);
|
||||
|
||||
$data['uniacid'] = $uniacid;
|
||||
//生成操作模型
|
||||
$oss_config_model = new OssConfig();
|
||||
//查询数据是否存在
|
||||
$oss_config = $oss_config_model->getConfig(['uniacid' => $uniacid]);
|
||||
|
||||
$result = false;
|
||||
|
||||
$data['is_sync'] = 1;
|
||||
|
||||
if(empty($oss_config))
|
||||
{
|
||||
$result = $oss_config_model->createConfig($data);
|
||||
}else{
|
||||
//检查上传配置是否正确
|
||||
$result = $oss_config_model->updateConfig(['uniacid' => $uniacid] ,$data);
|
||||
}
|
||||
$config = longbingGetOssConfig($uniacid ,true);
|
||||
|
||||
if(!empty($result) && !empty($data['open_oss']))
|
||||
{
|
||||
$path = LONGBING_EXTEND_PATH . 'timg.jpg';
|
||||
if(file_exists($path)){
|
||||
$file = new UploadedFile($path ,'test.jpg');
|
||||
$file_upload_model = new Upload($uniacid);
|
||||
$check = $file_upload_model->upload('picture' ,$file);
|
||||
|
||||
if(empty($check)) return $this->error(lang('upload config error'));
|
||||
}
|
||||
}
|
||||
return $this->success($result);
|
||||
|
||||
}
|
||||
//获取配置
|
||||
public function getOssConfig()
|
||||
{
|
||||
//获取uniacid
|
||||
$uniacid = $this->_uniacid;
|
||||
//生成操作模型
|
||||
$oss_config_model = new OssConfig();
|
||||
//获取数据
|
||||
$config = $oss_config_model->getConfig(['uniacid' => $uniacid]);
|
||||
if(!empty($config)) unset($config['id']);
|
||||
return $this->success($config);
|
||||
}
|
||||
|
||||
|
||||
//小程序设置
|
||||
public function getAppConfig()
|
||||
{
|
||||
//获取参数
|
||||
$uniacid = $this->_uniacid;
|
||||
//获取数据
|
||||
$result = longbingGetAppConfig($uniacid);
|
||||
|
||||
//返回数据
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
//小程序设置
|
||||
public function setAppConfig()
|
||||
{
|
||||
//获取参数
|
||||
$uniacid = $this->_uniacid;
|
||||
//获取数据
|
||||
$input = null;
|
||||
|
||||
|
||||
if(isset($this->_input['app_config'])) $input = $this->_input['app_config'];
|
||||
|
||||
if(empty($input)) return $this->error('not app config data ,please check input data.');
|
||||
|
||||
$input['uniacid'] = $this->_uniacid;
|
||||
//获取数据
|
||||
$result = longbingGetAppConfig($uniacid);
|
||||
|
||||
$app_config_model = new AppConfig();
|
||||
|
||||
$input['is_sync'] = 1;
|
||||
|
||||
//企业微信小程序通知
|
||||
if(!empty($input['notice_switch'])&&$input['notice_switch']==4){
|
||||
|
||||
$insrt['yq_corpid'] = $input['yq_corpid'];
|
||||
|
||||
$insrt['yq_corpsecret'] = $input['yq_corpsecret'];
|
||||
|
||||
$insrt['yq_agentid'] = $input['yq_agentid'];
|
||||
|
||||
$send_model = new SendConfig();
|
||||
|
||||
$data = $send_model->configUpdate(['uniacid'=>$this->_uniacid],$insrt);
|
||||
|
||||
unset($input['yq_corpid']);
|
||||
|
||||
unset($input['yq_corpsecret']);
|
||||
|
||||
unset($input['yq_agentid']);
|
||||
}
|
||||
|
||||
if(!isset($result['uniacid']) || empty($result))
|
||||
{
|
||||
//创建
|
||||
$result = $app_config_model->createConfig($input);
|
||||
}else{
|
||||
//更新
|
||||
$result = $app_config_model->updateConfig(['id' => $result['id']] ,$input);
|
||||
}
|
||||
|
||||
longbingGetAppConfig($uniacid ,true);
|
||||
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
|
||||
//自动同步服务通知模板
|
||||
public function autoServiceNoticeTemplate()
|
||||
{
|
||||
//获取配置信息
|
||||
$config = longbingGetAppConfig($this->_uniacid);
|
||||
if(!isset($config['appid']) || empty($config['appid']) || !isset($config['app_secret']) || empty($config['app_secret'])) return $this->error('wx app site not exist ,please check site message.');
|
||||
//获取accesstoken
|
||||
$ac = longbingSingleGetAccessTokenByUniacid($this->_uniacid);
|
||||
//判断accesstoken是否存在
|
||||
if(empty($ac)) return $this->error(lang('wx app site error'));
|
||||
//生成获取服务通知模板的url
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/wxopen/template/add?access_token={$ac}";
|
||||
//生成数据
|
||||
$data = [ 'id' => 'AT1442', 'keyword_id_list' => [ 4, 7, 1 ] ];
|
||||
$data = json_encode( $data );
|
||||
//获取数据
|
||||
$result = longbingCurl( $url, $data ,'POST');
|
||||
//解析数据
|
||||
$result = json_decode( $result, true );
|
||||
if ( isset( $result[ 'errcode' ] ) && $result[ 'errcode' ] == 40001 ) {
|
||||
//重新获取accesstoken
|
||||
$ac = longbingSingleGetAccessTokenByUniacid($this->_uniacid ,true);
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/wxopen/template/add?access_token={$ac}";
|
||||
//获取数据
|
||||
$result = longbingCurl( $url, $data ,'POST');
|
||||
//数据接续
|
||||
$result = json_decode( $result, true );
|
||||
}
|
||||
//判断
|
||||
|
||||
if ( isset( $result[ 'errcode' ] ) && !empty($result[ 'errcode' ]) ) return $this->error(lang('auto get template error'));
|
||||
//更新设置信息
|
||||
$app_config_model = new AppConfig();
|
||||
$mini_template_id = $result['template_id'];
|
||||
$result = $app_config_model->updateConfig(['id' => $config['id']] ,['mini_template_id' => $mini_template_id]);
|
||||
if($result) longbingGetAppConfig($this->_uniacid ,true); $result = ['mini_template_id' => $mini_template_id];
|
||||
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
//获取底部菜单
|
||||
public function getTabbar()
|
||||
{
|
||||
//获取参数
|
||||
$uniacid = $this->_uniacid;
|
||||
//获取数据
|
||||
$result = longbingGetAppTabbar($uniacid ,true);
|
||||
//数据封装
|
||||
$result = longbingGetAppTabbarResponse($result);
|
||||
|
||||
$pluginAuth = longbingGetPluginAuth($uniacid);
|
||||
$plugin_map = [
|
||||
"activity"=> 'activity',
|
||||
'appointment' => 'appoint',
|
||||
'house' => 'house',
|
||||
];
|
||||
$meta_map = [
|
||||
'card' => 'BusinessCard',
|
||||
'shop' => 'Malls',
|
||||
'dynamic' => 'Dynamic',
|
||||
'website' => 'Website',
|
||||
];
|
||||
|
||||
|
||||
foreach ($result['data'] as $k => $item) {
|
||||
if (in_array($k, array_keys($plugin_map)) && ($pluginAuth['plugin'][$plugin_map[$k]] == 0)) {
|
||||
unset($result['data'][$k]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (in_array($k, array_keys($meta_map)) && ($pluginAuth['web_manage_meta_config'][$meta_map[$k]] == 0)) {
|
||||
unset($result['data'][$k]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$result = array_merge($result, $pluginAuth);
|
||||
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
//设置底部菜单
|
||||
public function setTabbar()
|
||||
{
|
||||
//获取参数
|
||||
$uniacid = $this->_uniacid;
|
||||
$input = null;
|
||||
if(isset($this->_input['data'])) $input = $this->_input['data'];
|
||||
$input = longbingGetAppTabbarRequest($input);
|
||||
if(empty($input)) return $this->error('not tabbar data');
|
||||
// var_dump($input);die;
|
||||
//获取数据
|
||||
$tabbar = longbingGetAppTabbar($uniacid);
|
||||
|
||||
|
||||
//限制只能有5个tabbar
|
||||
$menu_now = [
|
||||
'menu1_is_hide' => $tabbar['menu1_is_hide'],
|
||||
'menu2_is_hide' => $tabbar['menu2_is_hide'],
|
||||
'menu3_is_hide' => $tabbar['menu3_is_hide'],
|
||||
'menu4_is_hide' => $tabbar['menu4_is_hide'],
|
||||
'menu_appoint_is_hide' => $tabbar['menu_appoint_is_hide'],
|
||||
'menu_activity_is_show' => $tabbar['menu_activity_is_show'],
|
||||
'menu_house_is_show' => $tabbar['menu_house_is_show'],
|
||||
];
|
||||
|
||||
$permissions = longbingGetPluginAuth($this->_uniacid);
|
||||
|
||||
$not_tabbars = [];
|
||||
if(!empty($permissions) && !empty($permissions['plugin']))
|
||||
{
|
||||
//预约
|
||||
if(!isset($permissions['plugin']['appoint']) || empty($permissions['plugin']['appoint']))
|
||||
{
|
||||
$not_tabbars[] = 'menu_appoint_is_hide';
|
||||
$input['menu_appoint_is_hide'] = 0;
|
||||
}
|
||||
//活动
|
||||
if(!isset($permissions['plugin']['activity']) || empty($permissions['plugin']['activity']))
|
||||
{
|
||||
$not_tabbars[] = 'menu_activity_is_show';
|
||||
$input['menu_activity_is_show'] = 0;
|
||||
}
|
||||
//房产
|
||||
if(!isset($permissions['plugin']['house']) || empty($permissions['plugin']['house']))
|
||||
{
|
||||
$not_tabbars[] = 'menu_house_is_show';
|
||||
$input['menu_house_is_show'] = 0;
|
||||
}
|
||||
//官网
|
||||
if(!isset($permissions['web_manage_meta_config']['Website']) || empty($permissions['web_manage_meta_config']['Website']))
|
||||
{
|
||||
$not_tabbars[] = 'menu4_is_hide';
|
||||
$input['menu4_is_hide'] = 0;
|
||||
}
|
||||
//商场
|
||||
if(!isset($permissions['web_manage_meta_config']['Malls']) || empty($permissions['web_manage_meta_config']['Malls']))
|
||||
{
|
||||
$not_tabbars[] = 'menu2_is_hide';
|
||||
$input['menu3_is_hide'] = 0;
|
||||
}
|
||||
//动态
|
||||
if(!isset($permissions['web_manage_meta_config']['Dynamic']) || empty($permissions['web_manage_meta_config']['Dynamic']))
|
||||
{
|
||||
$not_tabbars[] = 'menu3_is_hide';
|
||||
$input['menu3_is_hide'] = 0;
|
||||
}
|
||||
}
|
||||
// var_dump($not_tabbars);die;
|
||||
$max_tabbar_count = env('MAX_TABBAR_COUNT', 5);
|
||||
$all_tabbar_count = 0;
|
||||
foreach ($menu_now as $k => $v) {
|
||||
if (isset($input[$k])) $v = $input[$k];
|
||||
if(!in_array($k ,$not_tabbars)) $all_tabbar_count = $all_tabbar_count + $v;
|
||||
}
|
||||
|
||||
// $max_tabbar_count = env('MAX_TABBAR_COUNT', 5);
|
||||
// $all_tabbar_count = $menu_now['menu1_is_hide']
|
||||
// + $menu_now['menu2_is_hide']
|
||||
// + $menu_now['menu3_is_hide']
|
||||
// + $menu_now['menu4_is_hide']
|
||||
// + $menu_now['menu_appoint_is_hide']
|
||||
// + $menu_now['menu_activity_is_show']
|
||||
// + $menu_now['menu_house_is_show'];
|
||||
|
||||
if ($all_tabbar_count > $max_tabbar_count) {
|
||||
return $this->error('显示的菜单栏不能大于 ' . $max_tabbar_count);
|
||||
}
|
||||
|
||||
//判断数据是否存在
|
||||
$result = false;
|
||||
$tabbar_model = new AppTabbar();
|
||||
if(empty($tabbar)){
|
||||
$input['uniacid'] = $uniacid;
|
||||
$result = $tabbar_model->createTabbar($input);
|
||||
}else{
|
||||
$result = $tabbar_model->updateTabbar(['id' => $tabbar['id']] ,$input);
|
||||
}
|
||||
longbingGetAppTabbar($uniacid ,true);
|
||||
return $this->success($result);
|
||||
}
|
||||
//清理缓存
|
||||
public function clearCache()
|
||||
{
|
||||
//获取数据
|
||||
$uniacid = $this->_uniacid;
|
||||
|
||||
setCache('test',1,10,8888);
|
||||
|
||||
setCache('test',1,10,$uniacid);
|
||||
|
||||
$result = clearCache($uniacid);
|
||||
|
||||
clearCache(8888);
|
||||
|
||||
UpdateService::installSql(8888,2);
|
||||
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-06-08 18:51
|
||||
* @功能说明:小程序上传配置详情
|
||||
*/
|
||||
public function wxUploadInfo(){
|
||||
|
||||
$model = new WxUpload();
|
||||
|
||||
$dis = [
|
||||
|
||||
'uniacid' => $this->_uniacid
|
||||
];
|
||||
//详情
|
||||
$data = $model->settingInfo($dis);
|
||||
|
||||
$data['app_id'] = !empty($data['app_id'])?explode(',',$data['app_id']):[];
|
||||
|
||||
return $this->success($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-06-08 18:51
|
||||
* @功能说明:小程序上传配置详情
|
||||
*/
|
||||
public function wxUploadUpdate(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$model = new WxUpload();
|
||||
|
||||
$dis = [
|
||||
|
||||
'uniacid' => $this->_uniacid
|
||||
];
|
||||
|
||||
$data = [
|
||||
//密钥
|
||||
'key' => $input['key'],
|
||||
//版本号
|
||||
'version' => $input['version'],
|
||||
//描述
|
||||
'content' => $input['content'],
|
||||
//appid
|
||||
'app_id' => $input['app_id'],
|
||||
];
|
||||
//详情
|
||||
$data = $model->settingUpdate($dis,$data);
|
||||
|
||||
return $this->success($data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
97
app/admin/controller/Coupon.php
Normal file
97
app/admin/controller/Coupon.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
use app\Rest;
|
||||
use think\App;
|
||||
use app\admin\model\Coupon as CouponModel;
|
||||
use app\admin\model\ShopType;
|
||||
use app\admin\model\Goods;
|
||||
class Coupon extends Rest
|
||||
{
|
||||
|
||||
protected $model;
|
||||
public function __construct(App $app) {
|
||||
parent::__construct($app);
|
||||
$this->model = new CouponModel();
|
||||
}
|
||||
/**
|
||||
* 获取福包列表
|
||||
*/
|
||||
public function couponList(){
|
||||
$page = $this->_input['page'];
|
||||
$name = $this->_input['name'];
|
||||
$dis['uniacid'] = $this->_uniacid;
|
||||
$dis['status'] = ['>',-1];
|
||||
if(!empty($name)){
|
||||
$dis['title'] = ['like',"%$name%"];
|
||||
}
|
||||
$data = $this->model->couponList($dis,$page);
|
||||
$this->success($data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改福包
|
||||
*/
|
||||
public function couponUpdate(){
|
||||
$dis = ['id'=>$this->_input['id']];
|
||||
$res = $this->model->couponUpdate($dis,$this->_input);
|
||||
$this->success($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加福包
|
||||
*/
|
||||
public function couponsAdd(){
|
||||
$this->_input['uniacid'] = $this->_uniacid;
|
||||
$res = $this->model->couponAdd($this->_input);
|
||||
$this->success($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 软删除福包
|
||||
*/
|
||||
public function couponDel(){
|
||||
$dis['id'] = $this->_input['id'];
|
||||
$data['status'] = -1;
|
||||
$res = $this->model->couponUpdate($dis,$data);
|
||||
$this->success($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取福包详情
|
||||
*
|
||||
*/
|
||||
public function couponsInfo(){
|
||||
$dis = ['id'=>$this->_input['id']];
|
||||
$res = $this->model->couponInfo($dis);
|
||||
$this->success($res);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*获取所有分类
|
||||
*/
|
||||
public function getCate(){
|
||||
$cateModel = new ShopType();
|
||||
$dis['uniacid'] = $this->_uniacid;
|
||||
$dis['status'] = 1;
|
||||
$data = $cateModel->catSortSelect($dis);
|
||||
$this->success($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取限用的商品
|
||||
*/
|
||||
public function getGoods(){
|
||||
$goodsModel = new Goods();
|
||||
$dis['uniacid'] = $this->_uniacid;
|
||||
$dis['status'] = 1;
|
||||
$data = $goodsModel->goodsSelect($dis);
|
||||
$this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
119
app/admin/controller/Department.php
Normal file
119
app/admin/controller/Department.php
Normal file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
use app\Rest;
|
||||
use think\App;
|
||||
use think\Request;
|
||||
use app\admin\model\User as UserModel;
|
||||
use app\admin\model\Department as DepartmentModel;
|
||||
class Department extends Rest
|
||||
{
|
||||
public function __construct(App $app) {
|
||||
parent::__construct($app);
|
||||
}
|
||||
|
||||
//新建Departmet
|
||||
public function createDepartmet() {
|
||||
//获取创建部门数据
|
||||
$department = $this->_input['department'];
|
||||
//生成相关数据
|
||||
$department['department_id'] = uuid();
|
||||
//获取创建者user_id
|
||||
if(isset($this->_user)) $department['creator_id'] = $this->_user['user_id'];
|
||||
//修改数据
|
||||
$result = $deparmet_model->updateDepartment(['deparement_id' => $department_id ,'uniacid' => $this->_uniacid] ,$data);
|
||||
//返回数据
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
//获取Departmet列表
|
||||
public function listDepartmet() {
|
||||
//筛选部门信息
|
||||
$param = $this->_param;
|
||||
//获取分页信息
|
||||
$page_config = array(
|
||||
'page' => 1,
|
||||
'page_count' => 20
|
||||
);
|
||||
//设置页码
|
||||
if(isset($param['page']) && $param['page'] > 0) $page_config['page'] = $param['page'];
|
||||
//设置每页的数据
|
||||
if(isset($param['page_count']) && $param['page_count'] > 0) $page_config['page_count'] = $param['page_count'];
|
||||
//查询过滤
|
||||
$filter = $param;
|
||||
//默认uniacid
|
||||
$filter['uniacid'] = $this->_uniacid;
|
||||
//生成部门模型
|
||||
$department_model = new DepartmentModel();
|
||||
//获取部门总数
|
||||
$page_config['total'] = $department_model->listDepartmentCount($filter);
|
||||
$departmets = $department_model->listDepartment($filter);
|
||||
//生生成返回数据
|
||||
$page_config['total_page'] = (int)($page_config['total'] / $page_config['page_count']);
|
||||
if(($page_config['total'] % $page_config['page_count']) > 0) $page_config['total_page'] = $page_config['total_page'] + 1;
|
||||
//设置返回参数
|
||||
$result = $page_config;
|
||||
//返回数据
|
||||
$result['departments'] = $departmets;
|
||||
return $this->success($result);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//获取Departmet详情
|
||||
public function getDepartmet() {
|
||||
//获取部门id
|
||||
$department_id = $this->_param['department_id'];
|
||||
//获取部门详情
|
||||
$deparmet_model = new DepartmentModel();
|
||||
//获取部门信息
|
||||
$department = $department_model->getDepartment(['deparement_id' => $department_id ,'uniacid' => $this->_uniacid]);
|
||||
//判断部门信息是否存在
|
||||
if(!empty($department)){
|
||||
//获取部门下的子部门
|
||||
$deparements = $department_model->listDepartmentAll(['parent_id' => $department_id ,'uniacid' => $this->_uniacid]);
|
||||
if(!empty($departments)) $department['departments'] = $deparements;
|
||||
//获取部门下的员工
|
||||
$user_model = new UserModel();
|
||||
$users = $user_model->listUserAll(['department_id' => $department_id ,'uniacid' => $this->_uniacid]);
|
||||
if(!empty($users)) $department['users'] = $users;
|
||||
}
|
||||
//返回数据
|
||||
return $this->success($department);
|
||||
}
|
||||
|
||||
//更新Departmet
|
||||
public function updateDepartmet() {
|
||||
//获取部门id
|
||||
$department_id = $this->_param['department_id'];
|
||||
//获取修改数据
|
||||
$data = $this->_input['department'];
|
||||
//获取部门详情
|
||||
$deparmet_model = new DepartmentModel();
|
||||
$department = $department_model->getDepartment(['deparement_id' => $department_id ,'uniacid' => $this->_uniacid]);
|
||||
if(empty($department)) return $this->error('the department not exist ,please check department id .');
|
||||
if(empty($data)) return $this->error('the department change data is note exist ,please check department data.');
|
||||
//修改数据
|
||||
$result = $deparmet_model->updateDepartment(['deparement_id' => $department_id ,'uniacid' => $this->_uniacid] ,$data);
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
//删除Departmet
|
||||
public function delDepartmet() {
|
||||
//获取部门id
|
||||
$department_id = $this->_param['department_id'];
|
||||
//生成部门模型
|
||||
$deparmet_model = new DepartmentModel();
|
||||
//获取部门信息
|
||||
$department = $department_model->getDepartment(['deparement_id' => $department_id ,'uniacid' => $this->_uniacid]);
|
||||
if(empty($department)) return $this->error('the department not exist ,please check department id .');
|
||||
//删除数据
|
||||
$result = $deparmet_model->delDepartment(['deparement_id' => $department_id ,'uniacid' => $this->_uniacid] ,$data);
|
||||
if(!empty($result)) {
|
||||
$user_model = new UserModel();
|
||||
//设置部门为空
|
||||
$user_model->updateUser(['uniacid' => $this->_uniacid ,'department_id' => $department_id] ,['department_id' => 0]);
|
||||
}
|
||||
return $this->success($result);
|
||||
}
|
||||
}
|
||||
355
app/admin/controller/File.php
Normal file
355
app/admin/controller/File.php
Normal file
@@ -0,0 +1,355 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
use app\AdminRest;
|
||||
use think\App;
|
||||
use think\Request;
|
||||
use app\admin\model\AttachmentGroup;
|
||||
use app\admin\model\CoreAttachment;
|
||||
use app\Common\Upload;
|
||||
class File extends AdminRest
|
||||
{
|
||||
public $uid = 0;
|
||||
|
||||
public function __construct(App $app) {
|
||||
parent::__construct($app);
|
||||
//测试数据
|
||||
// $this->_uniacid = 2;
|
||||
$this->uid = 0;
|
||||
}
|
||||
|
||||
//创建分组
|
||||
public function createGroup()
|
||||
{
|
||||
//获取参数
|
||||
$input = $this->_input;
|
||||
//兼容写法-- lichuanming 2020/5/13
|
||||
if(!isset($input['group']['name']) && !isset($input['name'])) return $this->error('not group name ,please check .');
|
||||
$group['name'] = isset($input['group']['name'])?$input['group']['name']:$input['name'];
|
||||
//获取uid
|
||||
// if(!empty($this->uid)) $group['uid'] = $this->uid;
|
||||
$group['uniacid'] = $this->_uniacid;
|
||||
//生成分组模型
|
||||
$group_model = new AttachmentGroup();
|
||||
$group_count = $group_model->where('uniacid','=',$this->_uniacid)->count('id');
|
||||
if($group_count >= 20){ //分组不超过20个
|
||||
return $this->error('分组最多限制为20个!');
|
||||
}
|
||||
|
||||
$repeat = $group_model->where(['uniacid'=>$this->_uniacid,'name'=>$group['name']])->count();
|
||||
if($repeat){
|
||||
return $this->error('已存在同名分组');
|
||||
}
|
||||
|
||||
$result = $group_model->createGroup($group);
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
//获取分组列表
|
||||
public function listGroup()
|
||||
{
|
||||
//获取参数
|
||||
$param = $this->_param;
|
||||
if(isset($param['name'])) $filter[] = $param['name'];
|
||||
$filter['uniacid'] = $this->_uniacid;
|
||||
//获取uid
|
||||
// if(!empty($this->uid)) $filter['uid'] = $this->uid;
|
||||
//生成分组模型
|
||||
$group_model = new AttachmentGroup();
|
||||
//获取数据
|
||||
$result = $group_model->listGroup($filter);
|
||||
return $this->success(['groups' => $result]);
|
||||
}
|
||||
|
||||
//更新分组列表
|
||||
public function updateGroup()
|
||||
{
|
||||
//获取参数
|
||||
$group_id = $this->_param['group_id'];
|
||||
//获取更新数据
|
||||
$data = $this->_input['group'];
|
||||
//生成分组模型
|
||||
$group_model = new AttachmentGroup();
|
||||
|
||||
$repeat = $group_model->where(['uniacid'=>$this->_uniacid,'name'=>$data['name']])->where('id','<>',$group_id)->count();
|
||||
if($repeat){
|
||||
return $this->error('已存在同名分组');
|
||||
}
|
||||
|
||||
//更新数据
|
||||
$result = $group_model->updateGroup(['id' => $group_id,'uniacid'=>$this->_uniacid] ,$data);
|
||||
//返回数据
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
//删除分组信息
|
||||
public function delGroup()
|
||||
{
|
||||
//获取参数
|
||||
if(!isset($this->_param['group_id'])) return $this->error('not group id');
|
||||
$group_id = $this->_param['group_id'];
|
||||
|
||||
$where = array(
|
||||
['group_id','=',$group_id],
|
||||
['uniacid','=',$this->_uniacid]
|
||||
);
|
||||
//生成分组模型
|
||||
$attachment_model = new CoreAttachment();
|
||||
$file_count = $attachment_model->where($where)->count('id');
|
||||
if($file_count > 0){
|
||||
return $this->error('目前分组中有文件数据,不可删除,如要删除,请先清除文件数据');
|
||||
}
|
||||
$group_model = new AttachmentGroup();
|
||||
//删除数据
|
||||
$result = $group_model->delGroup(['id' => $group_id]);
|
||||
//返回数据
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
**@author lichuanming
|
||||
* @DataTime: 2020/5/15 14:35
|
||||
* @功能说明:批量删除分组
|
||||
*/
|
||||
public function delAllGroup(){
|
||||
if(!isset($this->_param['group_id'])) return $this->error('not group id');
|
||||
$group_id = $this->_param['group_id'];
|
||||
|
||||
$attachment_model = new CoreAttachment();
|
||||
if(is_array($group_id)){
|
||||
foreach ($group_id as $id){
|
||||
$where = array(
|
||||
['group_id','=',$id],
|
||||
['uniacid','=',$this->_uniacid]
|
||||
);
|
||||
$file_count = $attachment_model->where($where)->count('id');
|
||||
if($file_count > 0){
|
||||
return $this->error('目前分组中有文件数据,不可删除,如要删除,请先清除文件数据');
|
||||
}
|
||||
}
|
||||
$group_model = new AttachmentGroup();
|
||||
//删除数据
|
||||
$result = $group_model->delGroup(['id' => $group_id]);
|
||||
//返回数据
|
||||
return $this->success($result);
|
||||
}else{
|
||||
return $this->delGroup();
|
||||
}
|
||||
}
|
||||
|
||||
//上传文件
|
||||
public function uploadFile()
|
||||
{
|
||||
$input = $this->_param;
|
||||
$file = $this->request->file('file');
|
||||
if(empty($file)) return $this->error('not file ,please check file.');
|
||||
$uploda_model = new Upload($this->_uniacid);
|
||||
$type = 'picture';
|
||||
if(isset($input['type'])) $type = $input['type'];
|
||||
$info = $uploda_model->upload($type ,$file);
|
||||
$result = false;
|
||||
if(!empty($info))
|
||||
{
|
||||
$info['uid'] = $this->uid;
|
||||
$info['longbing_attachment_path'] = longbingGetFilePath($info['attachment'] , $this->_host,$this->_uniacid);
|
||||
$info['longbing_from'] = 'web';
|
||||
$attachment_model = new CoreAttachment();
|
||||
$result = $attachment_model->createAttach($info);
|
||||
if(!empty($result)) $result = $info;
|
||||
}
|
||||
//数据处理
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
|
||||
public function uploadFiles()
|
||||
{
|
||||
//获取参数
|
||||
$input = $this->_param;
|
||||
//获取文件列表
|
||||
$files = $this->request->file('file');
|
||||
//检查文件是否存在
|
||||
if(empty($files)) return $this->error('not file ,please check file.');
|
||||
//设置类型
|
||||
$type = 'picture';
|
||||
if(isset($input['type'])) $type = $input['type'];
|
||||
|
||||
//上传文件分组 --lichuanming 2020/5/13
|
||||
$group_id = -1;
|
||||
if(isset($input['group_id'])) $group_id = $input['group_id'];
|
||||
|
||||
$result = [];
|
||||
//生成上传模型
|
||||
$uploda_model = new Upload($this->_uniacid);
|
||||
foreach($files as $file)
|
||||
{
|
||||
//上传文件
|
||||
$info = $uploda_model->upload($type ,$file);
|
||||
|
||||
if(!empty($info))
|
||||
{
|
||||
//获取上传者id
|
||||
$info['uid'] = $this->uid;
|
||||
$info['attachment_path'] = longbingGetFilePath($info['attachment'] , $this->_host,$this->_uniacid ,$info['longbing_driver']);
|
||||
//文件分组界定 --lichuanming 2020/5/13
|
||||
$info['group_id'] = $group_id;
|
||||
$info['uniacid'] = $this->_uniacid;
|
||||
//写入数据库
|
||||
$attachment_model = new CoreAttachment();
|
||||
$data = $attachment_model->createAttach($info);
|
||||
//判断写入数据库是否成功
|
||||
if(!empty($data)) $result[] = $info;
|
||||
}
|
||||
}
|
||||
//数据处理
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//获取文件列表
|
||||
public function listFile()
|
||||
{
|
||||
$param = $this->_param;
|
||||
$filter['uniacid'] = $this->_uniacid;
|
||||
$filter['type'] = 1;
|
||||
|
||||
$filter['uid'] = 0;
|
||||
|
||||
|
||||
//判断分组是否存在
|
||||
if(isset($param['group_id'])) $filter['group_id'] = $param['group_id']?$param['group_id']:['0','-1'];
|
||||
//判断文件类型是否存在
|
||||
if(isset($param['type']) && in_array($param['type'], [1,2,3,'1','2','3'])) $filter['type'] = $param['type'];
|
||||
//判断用户id是否存在
|
||||
// if(isset($this->uid)) return $this->error('not login,please login');
|
||||
// $filter['uid'] = $this->uid;
|
||||
//获取和生成分页信息
|
||||
$page_config = array(
|
||||
'page' => 1,
|
||||
'page_count' => 10
|
||||
);
|
||||
if(isset($param['page']) && $param['page'] > 0) $page_config['page'] = $param['page'];
|
||||
if(isset($param['page_count']) && $param['page_count'] > 0) $page_config['page_count'] = $param['page_count'];
|
||||
//生成模型类
|
||||
$file_model = new CoreAttachment();
|
||||
//查询总数
|
||||
$count = $file_model->listAttachCount($filter);
|
||||
$files = $file_model->listAttach($filter ,$page_config);
|
||||
$files = transImagesOne($files ,['attachment'] ,$this->_uniacid);
|
||||
// foreach($files as $key => $val)
|
||||
// {
|
||||
// $files[$key]['attachment_path'] = longbingGetFilePath($val['attachment'] ,$this->_host ,$this->_uniacid);
|
||||
// }
|
||||
//生成返回数据
|
||||
$page_config['total'] = $count;
|
||||
$page_config['total_page'] = (int)($page_config['total'] / $page_config['page_count']);
|
||||
if(($page_config['total'] % $page_config['page_count']) > 0) $page_config['total_page'] = $page_config['total_page'] + 1;
|
||||
$result = $page_config;
|
||||
$result['files'] = $files;
|
||||
//返回数据
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
//获取文件
|
||||
public function getFile()
|
||||
{
|
||||
$param = $this->_param;
|
||||
$filter['uniacid'] = $this->_uniacid;
|
||||
$filter['id'] = $param['id'];
|
||||
// $filter['uid'] = $this->uid;
|
||||
//生成模型
|
||||
$file_model = new CoreAttachment();
|
||||
//查询数据
|
||||
$file = $file_model->getFile($filter);
|
||||
// if(isset($file['attachment']))
|
||||
// {
|
||||
// $file['attachment_path'] = longbingGetFilePath($file['attachment'] ,$this->_host ,$this->_uniacid);
|
||||
// }
|
||||
//返回数据
|
||||
return $this->success($file);
|
||||
}
|
||||
|
||||
//删除文件
|
||||
public function delFile()
|
||||
{
|
||||
//获取参数
|
||||
$input = $this->_input;
|
||||
//获取参数
|
||||
if(!isset($input['ids'])) return $this->error('not file id,please check.');
|
||||
$filter['ids'] = $input['ids'];
|
||||
// $filter['uid'] = $this->uid;
|
||||
$filter['uniacid'] = $this->_uniacid;
|
||||
//生成模型
|
||||
$file_model = new CoreAttachment();
|
||||
//删除
|
||||
$result = $file_model->delAttach($filter);
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-04-08 14:16
|
||||
* @功能说明:获取上传配置
|
||||
*/
|
||||
public function uploadConfig(){
|
||||
|
||||
$data = longbingGetOssConfig($this->_uniacid);
|
||||
|
||||
$data['uniacid'] = $this->_uniacid;
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-04-08 14:17
|
||||
* @功能说明:上传文件到数据库
|
||||
*/
|
||||
public function addFile(){
|
||||
|
||||
$info = $this->_input;
|
||||
|
||||
$group_id = -1;
|
||||
|
||||
if(isset($info['group_id'])) {
|
||||
|
||||
$group_id = $info['group_id'];
|
||||
}
|
||||
//获取上传者id
|
||||
$info['uid'] = $this->uid;
|
||||
//$info['attachment_path'] = longbingGetFilePath($info['attachment'] , $this->_host,$this->_uniacid ,$info['longbing_driver']);
|
||||
//文件分组界定 --lichuanming 2020/5/13
|
||||
$info['group_id'] = $group_id;
|
||||
|
||||
$info['uniacid'] = $this->_uniacid;
|
||||
|
||||
$info['createtime'] = time();
|
||||
|
||||
$attachment_model = new CoreAttachment();
|
||||
|
||||
$data = $attachment_model->addAttach($info);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-08-13 15:26
|
||||
* @功能说明:图片移动分组
|
||||
*/
|
||||
public function moveGroup(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$attachment_model = new CoreAttachment();
|
||||
|
||||
$res = $attachment_model->where('id','in',$input['file_id'])->update(['group_id'=>$input['group_id']]);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
13
app/admin/controller/Index.php
Normal file
13
app/admin/controller/Index.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
use app\Rest;
|
||||
use think\App;
|
||||
use think\facade\View;
|
||||
class Index extends Rest
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
|
||||
return View::fetch();
|
||||
}
|
||||
}
|
||||
297
app/admin/controller/Menu.php
Normal file
297
app/admin/controller/Menu.php
Normal file
@@ -0,0 +1,297 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
use app\Rest;
|
||||
use app\AdminRest;
|
||||
use think\App;
|
||||
use think\Request;
|
||||
use app\admin\model\User as UserModel;
|
||||
use app\admin\model\Role as RoleModel;
|
||||
use app\admin\model\Module as ModuleModel;
|
||||
use app\admin\model\Menu as MenuModel;
|
||||
class Menu extends AdminRest
|
||||
{
|
||||
public function __construct(App $app) {
|
||||
parent::__construct($app);
|
||||
}
|
||||
|
||||
//获取菜单列表
|
||||
public function listMenu() {
|
||||
//获取查询参数
|
||||
$param = $this->_param;
|
||||
//获取模块
|
||||
$module_model = new ModuleModel();
|
||||
$module_filter = ['is_base' => 1];
|
||||
if(isset($param['is_base'])) $module_filter['is_base'] = $param['is_base'];
|
||||
$modules = $module_model->listModuleAll($module_filter ,$this->_uniacid);
|
||||
//生成返回数据
|
||||
$result = [];
|
||||
foreach($modules as $module){
|
||||
$data = [];
|
||||
if(isset($module['path'])) $data['path'] = $module['path'];
|
||||
if(isset($module['component'])) $data['component'] = $module['component'];
|
||||
if(isset($module['redirect'])) $data['redirect'] = $module['redirect'];
|
||||
if(isset($module['is_base'])) $data['is_base'] = $module['is_base'];
|
||||
if(isset($module['menuName'])) $data['meta']['menuName'] = $module['menuName'];
|
||||
if(isset($module['icon'])) $data['meta']['icon'] = $module['icon'];
|
||||
//获取菜单信息
|
||||
$meun_model = new MenuModel();
|
||||
$menu_filter = ['uniacid' => $this->_uniacid , 'module_id' => $module['module_id'] ,'parent_id' => 0];
|
||||
$module['status'] = 0;
|
||||
if(!empty($module['is_base']) || !empty($module['is_public']))
|
||||
{
|
||||
$module['status'] = 1;
|
||||
}else{
|
||||
if(isset($module['module_app']['status'])) $module['status'] = $module['module_app']['status'];
|
||||
}
|
||||
if(empty($module['status'])) continue;
|
||||
$menus = $meun_model->listMenu($menu_filter);
|
||||
$child = [];
|
||||
$subNavNames = [];
|
||||
foreach($menus as $menu) {
|
||||
if(empty($menu['is_son_menu'])) {
|
||||
$child_data = [];
|
||||
if(isset($menu['menu_path'])) $child_data['path'] = $menu['menu_path'];
|
||||
if(isset($menu['component'])) $child_data['component'] = $menu['component'];
|
||||
if(isset($menu['name'])) $child_data['neme'] = $menu['name'];
|
||||
$child_data['meta']['title'] = null;
|
||||
if(isset($menu['title'])) $child_data['meta']['title'] = $menu['title'];
|
||||
$child_data['meta']['isOnly'] = true;
|
||||
if(empty($menu['isOnly'])) $child_data['meta']['isOnly'] = false;
|
||||
$child_data['meta']['pagePermission'] = [];
|
||||
$menu_filter['parent_id'] = $menu['menu_id'];
|
||||
$menu_filter['is_action'] = 1;
|
||||
$actions = $meun_model->listMenu($menu_filter);
|
||||
$auth = [];
|
||||
foreach($actions as $action){
|
||||
$auth[] = $action['name'];
|
||||
}
|
||||
$child_data['meta']['auth'] = $auth;
|
||||
$child[] = $child_data;
|
||||
}else{
|
||||
$subNavName = [];
|
||||
if(isset($menu['name'])) {
|
||||
$subNavName['subNavName'] = $menu['name'];
|
||||
}else{
|
||||
$subNavName['subNavName'] = null;
|
||||
}
|
||||
$menu_filter['parent_id'] = $menu['menu_id'];
|
||||
$menu_filter['is_action'] = 0;
|
||||
$leval_2_menus = $meun_model->listMenu($menu_filter);
|
||||
foreach($leval_2_menus as $leval_2_menu) {
|
||||
$url = [];
|
||||
if(isset($leval_2_menu['name'])) $url['name'] = $leval_2_menu['name'];
|
||||
if(isset($leval_2_menu['url'])) $url['url'] = $leval_2_menu['url'];
|
||||
$subNavName['url'][] = $url;
|
||||
$child_data = [];
|
||||
if(isset($leval_2_menu['menu_path'])) $child_data['path'] = $leval_2_menu['menu_path'];
|
||||
if(isset($leval_2_menu['name'])) $child_data['name'] = $leval_2_menu['name'];
|
||||
if(isset($leval_2_menu['component'])) $child_data['component'] = $leval_2_menu['component'];
|
||||
|
||||
if(isset($leval_2_menu['title'])) $child_data['meta']['title'] = $leval_2_menu['title'];
|
||||
// if(isset($leval_2_menu['component'])) $child_data['meta']['component'] = $leval_2_menu['component'];
|
||||
$child_data['meta']['isOnly'] = false;
|
||||
if(!empty($leval_2_menu['isOnly'])) $child_data['meta']['isOnly'] = true;
|
||||
|
||||
$child_data['meta']['auth'] = [];
|
||||
|
||||
if(!empty($leval_2_menu['is_son_menu'])){
|
||||
$pagePermissions = [];
|
||||
$menu_filter['parent_id'] = $leval_2_menu['menu_id'];
|
||||
$menu_filter['is_action'] = 0;
|
||||
$leval_3_menus = $meun_model->listMenu($menu_filter);
|
||||
|
||||
// if(in_array('c3', [$leval_2_menu['menu_id']])){
|
||||
// var_dump(json_encode($leval_3_menus));die;
|
||||
// }
|
||||
|
||||
foreach($leval_3_menus as $leval_3_menu){
|
||||
$pagePermission = [];
|
||||
if(isset($leval_3_menu['title'])) $pagePermission['title'] = $leval_3_menu['title'];
|
||||
if(isset($leval_3_menu['index'])) $pagePermission['index'] = $leval_3_menu['index'];
|
||||
$menu_filter['parent_id'] = $leval_3_menu['menu_id'];
|
||||
$menu_filter['is_action'] = 1;
|
||||
$actions = $meun_model->listMenu($menu_filter);
|
||||
foreach($actions as $action) {
|
||||
$pagePermission['auth'][] = $action['name'];
|
||||
}
|
||||
$pagePermissions[] = $pagePermission;
|
||||
}
|
||||
$child_data['meta']['pagePermission'] = $pagePermissions;
|
||||
}
|
||||
$child[] = $child_data;
|
||||
}
|
||||
$subNavNames[] = $subNavName;
|
||||
|
||||
}
|
||||
}
|
||||
$data['meta']['subNavName'] = $subNavNames;
|
||||
$data['children'] = $child;
|
||||
$result[] = $data;
|
||||
}
|
||||
return $this->success($result);
|
||||
}
|
||||
//获取菜单详情
|
||||
public function getMenu() {
|
||||
$param = $this->_param;
|
||||
$module_filter = [];
|
||||
if(isset($param['module_id'])) $module_filter['module_id'] = $param['module_id'];
|
||||
if(empty($module_filter)) return $this->error('module id is not exist ,please check param.');
|
||||
$module_model = new ModuleModel();
|
||||
//获取模块信息
|
||||
$module = $module_model->getModule($module_filter ,$this->_uniacid);
|
||||
|
||||
if(empty($module)) $this->success([]);
|
||||
$module['status'] = 0;
|
||||
if(!empty($module['is_base']) || !empty($module['is_public']))
|
||||
{
|
||||
$module['status'] = 1;
|
||||
}else{
|
||||
if(isset($module['module_app']['status'])) $module['status'] = $module['module_app']['status'];
|
||||
}
|
||||
if(empty($module['status'])) return $this->success([]);
|
||||
//生成返回数据
|
||||
$data = [];
|
||||
if(isset($module['path'])) $data['path'] = $module['path'];
|
||||
if(isset($module['component'])) $data['component'] = $module['component'];
|
||||
if(isset($module['redirect'])) $data['redirect'] = $module['redirect'];
|
||||
if(isset($module['is_base'])) $data['is_base'] = $module['is_base'];
|
||||
if(isset($module['menuName'])) $data['meta']['menuName'] = $module['menuName'];
|
||||
if(isset($module['icon'])) $data['meta']['icon'] = $module['icon'];
|
||||
//获取菜单信息
|
||||
$meun_model = new MenuModel();
|
||||
$menu_filter = ['uniacid' => $this->_uniacid , 'module_id' => $module['module_id'] ,'parent_id' => 0];
|
||||
$module['status'] = 0;
|
||||
if(!empty($module['is_base']) || !empty($module['is_public']))
|
||||
{
|
||||
$module['status'] = 1;
|
||||
}else{
|
||||
if(isset($module['module_app']['status'])) $module['status'] = $module['module_app']['status'];
|
||||
}
|
||||
$menus = $meun_model->listMenu($menu_filter);
|
||||
if(empty($menus)) return $this->success($data);
|
||||
$child = [];
|
||||
$subNavNames = [];
|
||||
foreach($menus as $menu) {
|
||||
if(empty($menu['is_son_menu'])) {
|
||||
$child_data = [];
|
||||
if(isset($menu['menu_path'])) $child_data['path'] = $menu['menu_path'];
|
||||
if(isset($menu['component'])) $child_data['component'] = $menu['component'];
|
||||
if(isset($menu['name'])) $child_data['neme'] = $menu['name'];
|
||||
$child_data['meta']['title'] = null;
|
||||
if(isset($menu['title'])) $child_data['meta']['title'] = $menu['title'];
|
||||
$child_data['meta']['isOnly'] = true;
|
||||
if(empty($menu['isOnly'])) $child_data['meta']['isOnly'] = false;
|
||||
$child_data['meta']['pagePermission'] = [];
|
||||
$menu_filter['parent_id'] = $menu['menu_id'];
|
||||
$menu_filter['is_action'] = 1;
|
||||
$actions = $meun_model->listMenu($menu_filter);
|
||||
$auth = [];
|
||||
foreach($actions as $action){
|
||||
$auth[] = $action['name'];
|
||||
}
|
||||
$child_data['meta']['auth'] = $auth;
|
||||
$child[] = $child_data;
|
||||
}else{
|
||||
$subNavName = [];
|
||||
if(isset($menu['name'])) {
|
||||
$subNavName['subNavName'] = $menu['name'];
|
||||
}else{
|
||||
$subNavName['subNavName'] = null;
|
||||
}
|
||||
$menu_filter['parent_id'] = $menu['menu_id'];
|
||||
$menu_filter['is_action'] = 0;
|
||||
$leval_2_menus = $meun_model->listMenu($menu_filter);
|
||||
foreach($leval_2_menus as $leval_2_menu) {
|
||||
$url = [];
|
||||
if(isset($leval_2_menu['name'])) $url['name'] = $leval_2_menu['name'];
|
||||
if(isset($leval_2_menu['url'])) $url['url'] = $leval_2_menu['url'];
|
||||
$subNavName['url'][] = $url;
|
||||
$child_data = [];
|
||||
if(isset($leval_2_menu['menu_path'])) $child_data['path'] = $leval_2_menu['menu_path'];
|
||||
if(isset($leval_2_menu['name'])) $child_data['name'] = $leval_2_menu['name'];
|
||||
if(isset($leval_2_menu['component'])) $child_data['component'] = $leval_2_menu['component'];
|
||||
|
||||
if(isset($leval_2_menu['title'])) $child_data['meta']['title'] = $leval_2_menu['title'];
|
||||
// if(isset($leval_2_menu['component'])) $child_data['meta']['component'] = $leval_2_menu['component'];
|
||||
$child_data['meta']['isOnly'] = false;
|
||||
if(!empty($leval_2_menu['isOnly'])) $child_data['meta']['isOnly'] = true;
|
||||
|
||||
$child_data['meta']['auth'] = [];
|
||||
|
||||
if(!empty($leval_2_menu['is_son_menu'])){
|
||||
$pagePermissions = [];
|
||||
$menu_filter['parent_id'] = $leval_2_menu['menu_id'];
|
||||
$menu_filter['is_action'] = 0;
|
||||
$leval_3_menus = $meun_model->listMenu($menu_filter);
|
||||
|
||||
// if(in_array('c3', [$leval_2_menu['menu_id']])){
|
||||
// var_dump(json_encode($leval_3_menus));die;
|
||||
// }
|
||||
|
||||
foreach($leval_3_menus as $leval_3_menu){
|
||||
$pagePermission = [];
|
||||
if(isset($leval_3_menu['title'])) $pagePermission['title'] = $leval_3_menu['title'];
|
||||
if(isset($leval_3_menu['index'])) $pagePermission['index'] = $leval_3_menu['index'];
|
||||
$menu_filter['parent_id'] = $leval_3_menu['menu_id'];
|
||||
$menu_filter['is_action'] = 1;
|
||||
$actions = $meun_model->listMenu($menu_filter);
|
||||
foreach($actions as $action) {
|
||||
$pagePermission['auth'][] = $action['name'];
|
||||
}
|
||||
$pagePermissions[] = $pagePermission;
|
||||
}
|
||||
$child_data['meta']['pagePermission'] = $pagePermissions;
|
||||
}
|
||||
$child[] = $child_data;
|
||||
}
|
||||
$subNavNames[] = $subNavName;
|
||||
}
|
||||
}
|
||||
$data['meta']['subNavName'] = $subNavNames;
|
||||
$data['children'] = $child;
|
||||
return $this->success($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* By.jingshuixian
|
||||
* 2019年11月23日14:17:16
|
||||
*/
|
||||
public function getMenuList()
|
||||
{
|
||||
//By.jingshuixian
|
||||
//2019年11月23日16:23:26
|
||||
//测试新的载入方式
|
||||
$menu_data = longbing_init_info_data('AdminMenu');
|
||||
return $this->success($menu_data);
|
||||
|
||||
|
||||
|
||||
|
||||
//所有的菜单的json文件
|
||||
$allAdminMenus = include APP_PATH . "Common/extend/menu/allAdminMenus.php";
|
||||
//平台的菜单配置
|
||||
$memu_config = Config('app.adminMenus');
|
||||
//菜单权限
|
||||
$pluginAuth = longbingGetPluginAuth($this->_uniacid);
|
||||
$auth = $pluginAuth['web_manage_meta_config'];
|
||||
|
||||
|
||||
$auth_meta_permission = [];//前端导航栏配置json
|
||||
foreach ($memu_config as $menu_name) {
|
||||
if (!isset($allAdminMenus[$menu_name]) || ($menu_name !== 'App' && $auth[$menu_name] !== 1) ) {
|
||||
continue;
|
||||
}
|
||||
$menu_data = json_decode($allAdminMenus[$menu_name], true);
|
||||
//如果代理管理端有版权设置, 【系统】菜单中的子菜单【版权管理】不展示
|
||||
|
||||
|
||||
|
||||
$auth_meta_permission[] = $menu_data;
|
||||
|
||||
}
|
||||
|
||||
return $this->success($auth_meta_permission);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
94
app/admin/controller/Module.php
Normal file
94
app/admin/controller/Module.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
use app\Rest;
|
||||
use app\AdminRest;
|
||||
use think\App;
|
||||
use think\Request;
|
||||
use app\admin\model\User as UserModel;
|
||||
use app\admin\model\Module as ModuleModel;
|
||||
class Module extends Rest
|
||||
{
|
||||
public function __construct(App $app) {
|
||||
parent::__construct($app);
|
||||
}
|
||||
|
||||
//获取应用列表
|
||||
public function listModule() {
|
||||
//获取模块信息
|
||||
$param = $this->_param;
|
||||
$module_model = new ModuleModel();
|
||||
//设置默认数据
|
||||
$filter['is_base'] = 1;
|
||||
if(isset($param['is_base'])) $filter['is_base'] = $param['is_base'];
|
||||
//获取模块列表
|
||||
$modules = $module_model->listModuleAll($filter ,$this->_uniacid);
|
||||
// echo json_encode($modules ,true);die;
|
||||
$result = [];
|
||||
//处理数据
|
||||
foreach($modules as $module)
|
||||
{
|
||||
//设置默认数据
|
||||
$module['status'] = 1;
|
||||
//判断模块是否是基础模块
|
||||
if(empty($module['is_base'])){
|
||||
//判断插件是否授权
|
||||
if(isset($module['module_app']['status']))
|
||||
{
|
||||
//设置状态
|
||||
$module['status'] = $module['module_app']['status'];
|
||||
}else{
|
||||
$module['status'] = 0;
|
||||
}
|
||||
}
|
||||
//移除module_app信息
|
||||
unset($module['module_app']);
|
||||
$result[] = $module;
|
||||
|
||||
}
|
||||
//返回数据
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
//获取应用详情
|
||||
public function getModule() {
|
||||
//获取参数
|
||||
$param = $this->_param;
|
||||
$filter = [];
|
||||
//判断相关参数是否存在
|
||||
if(isset($param['module_id'])) $filter['module_id'] = $param['module_id'];
|
||||
if(isset($param['is_base'])) $filter['is_base'] = $param['is_base'];
|
||||
//判断查询参数是否存在,不存在抛出异常
|
||||
if(empty($filter)) return $this->error('module id is not exist ,please check param.');
|
||||
//生成模块模型
|
||||
$module_model = new ModuleModel();
|
||||
//查询模块信息
|
||||
$module = $module_model->getModule($filter ,$this->_uniacid);
|
||||
if(!empty($module)) {
|
||||
$module['status'] = 0;
|
||||
if(!empty($module['is_public']) || !empty($module['is_base'])){
|
||||
$module['status'] = 1;
|
||||
}else{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//判断是否是公共模块
|
||||
if(empty($module['is_public'])){
|
||||
//数据处理
|
||||
if(empty($module['is_base'])){
|
||||
if(isset($module['module_app']['status']))
|
||||
{
|
||||
$module['status'] = $module['module_app']['status'];
|
||||
}else{
|
||||
$module['status'] = 0;
|
||||
}
|
||||
}
|
||||
//移除module_app数据
|
||||
unset($module['module_app']);
|
||||
}
|
||||
}
|
||||
//返回数据
|
||||
return $this->success($module);
|
||||
}
|
||||
}
|
||||
98
app/admin/controller/Role.php
Normal file
98
app/admin/controller/Role.php
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
use app\Rest;
|
||||
use think\App;
|
||||
use think\Request;
|
||||
use app\admin\model\User as UserModel;
|
||||
use app\admin\model\Role as RoleModel;
|
||||
class Role extends Rest
|
||||
{
|
||||
public function __construct(App $app) {
|
||||
parent::__construct($app);
|
||||
}
|
||||
//创建权限
|
||||
public function createRole() {
|
||||
//获去角色信息
|
||||
$role = $this->_input['role'];
|
||||
//生成和填充相关数据
|
||||
$role['role_id'] = uuid();
|
||||
$role['uniacid'] = $this->_uniacid;
|
||||
//生成权限数据库操作模型
|
||||
$role_model = new RoleModel;
|
||||
//创建
|
||||
$result = $role_model->createRole($role);
|
||||
//返回相关数据
|
||||
return $this->seccess($result);
|
||||
|
||||
}
|
||||
//获取权限列表
|
||||
public function listRole() {
|
||||
//获取权限查询信息
|
||||
$param = $this->_param;
|
||||
//获取分页信息
|
||||
$page_config = array(
|
||||
'page' => 1,
|
||||
'page_count' => 20
|
||||
);
|
||||
if(isset($param['page']) && $param['page'] > 0) $page_config['page'] = $param['page'];
|
||||
if(isset($param['page_count']) && $param['page_count'] > 0) $page_config['page_count'] = $param['page_count'];
|
||||
//查询过滤
|
||||
$filter = $param;
|
||||
$filter['uniacid'] = $this->_uniacid;
|
||||
//生成权限操作模型
|
||||
$role_model = new RoleModel();
|
||||
//获取权限列表
|
||||
$page_config['totle'] = $role_model->listRoleCount($filter);
|
||||
$roles = $role_model->listRole($filter ,$page_config);
|
||||
//生成返回数据
|
||||
$page_config['total_page'] = (int)($page_config['total'] / $page_config['page_count']);
|
||||
if(($page_config['total'] % $page_config['page_count']) > 0) $page_config['total_page'] = $page_config['total_page'] + 1;
|
||||
$result = $page_config;
|
||||
$result['roles'] = $roles;
|
||||
return $this->success($result);
|
||||
}
|
||||
//获取权限详情
|
||||
public function getRole() {
|
||||
//获取权限id
|
||||
$role_id = $this->_param['role_id'];
|
||||
//生成权限操作模型
|
||||
$role_model = new RoleModel();
|
||||
//获取权限数据
|
||||
$role = $role_model->getRole(['role_id' => $role_id ,'uniacid' => $this->_uniacid]);
|
||||
return $this->success($role);
|
||||
}
|
||||
//更改权限信息
|
||||
public function updateRole() {
|
||||
//获取角色id
|
||||
$role_id = $this->_param['role_id'];
|
||||
//判断权限是否存在
|
||||
$role_model = new RoleModel();
|
||||
$role = $role_model->getRole(['role_id' => $role_id ,'uniacid' => $this->_uniacid]);
|
||||
if(empty($role)) return $this->error('the role is nit exist ,please check the role id.');
|
||||
//获去角色更新信息
|
||||
$role = $this->_input['role'];
|
||||
//更新
|
||||
$result = $role_model->updateRole(['role_id' => $role_id ,'uniacid' => $this->_uniacid] ,$role);
|
||||
//返回相关数据
|
||||
return $this->seccess($result);
|
||||
}
|
||||
//删除权限信息
|
||||
public function delRole() {
|
||||
//获取角色id
|
||||
$role_id = $this->_param['role_id'];
|
||||
//判断权限是否存在
|
||||
$role_model = new RoleModel();
|
||||
$role = $role_model->getRole(['role_id' => $role_id ,'uniacid' => $this->_uniacid]);
|
||||
if(empty($role)) return $this->error('the role is nit exist ,please check the role id.');
|
||||
//更新
|
||||
$result = $role_model->delRole(['role_id' => $role_id ,'uniacid' => $this->_uniacid]);
|
||||
if(!empty($result)) {
|
||||
$user_model = new UserModel();
|
||||
$user_model->update(['role_id' => $role_id ,'uniacid' => $this->_uniacid] ,['role_id' => 0]);
|
||||
}
|
||||
//返回相关数据
|
||||
return $this->seccess($result);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
51
app/admin/controller/Update.php
Normal file
51
app/admin/controller/Update.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
use app\admin\service\UpdateService;
|
||||
use app\AdminRest;
|
||||
use app\card\info\InitData;
|
||||
use app\diy\service\DiyService;
|
||||
use think\App;
|
||||
|
||||
class Update extends AdminRest
|
||||
{
|
||||
public function __construct(App $app) {
|
||||
parent::__construct($app);
|
||||
}
|
||||
|
||||
/**
|
||||
* By.jingshuixian
|
||||
* 2019年11月23日21:43:47
|
||||
* 升级脚本导入执行
|
||||
*/
|
||||
public function update(){
|
||||
|
||||
// return $this->success([]);
|
||||
$key = 'init_all_data';
|
||||
|
||||
$data = getCache($key,$this->_uniacid);
|
||||
|
||||
if(!empty($data)){
|
||||
|
||||
return $this->success([]);
|
||||
|
||||
}
|
||||
|
||||
setCache($key,1,7200,$this->_uniacid);
|
||||
|
||||
UpdateService::installSql($this->_uniacid);
|
||||
|
||||
UpdateService::initWeiqinConfigData();
|
||||
|
||||
DiyService::addDefaultDiyData($this->_uniacid);
|
||||
//各个模块初始化数据事件
|
||||
event('InitModelData');
|
||||
//处理雷达
|
||||
lbInitRadarMsg($this->_uniacid);
|
||||
|
||||
return $this->success([]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
168
app/admin/controller/User.php
Normal file
168
app/admin/controller/User.php
Normal file
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
use app\Rest;
|
||||
use think\App;
|
||||
use think\Request;
|
||||
use app\admin\model\Admin as UserModel;
|
||||
use app\admin\model\AdminRole as UserRoleModel;
|
||||
class User extends Rest
|
||||
{
|
||||
public function __construct(App $app) {
|
||||
parent::__construct($app);
|
||||
}
|
||||
//创建用户
|
||||
public function createUser() {
|
||||
$user = $this->_input['user'];
|
||||
$data = checkAccountIsExist($user['account'] ,$this->_uniacid);
|
||||
//判读账号是否存在
|
||||
if($data) return $this->error('account is exist ,please check again.');
|
||||
|
||||
$user_id = uuid();
|
||||
$user['user_id'] = $user_id;
|
||||
$user['offset'] = createOffset();
|
||||
$user['passwd'] = createPasswd($user['passwd'] ,$user['offset']);
|
||||
$user['uniacid'] = $this->_uniacid;
|
||||
//判断权限
|
||||
if(!isset($user['role_id']) || !ckeckRole($user['role_id'] ,$this->_uniacid)) $user['role_id'] = getRole()['role_id'];
|
||||
if(!empty($this->_user))$user['creator_id'] = $this->_user['user_id'];
|
||||
//创建数据
|
||||
$user_model = new UserModel();
|
||||
$result = $user_model->createUser($user);
|
||||
// if(!empty($result)) setAccountToCache($user['account'] ,$this->_uniacid);
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
//获取用户列表
|
||||
public function listUser() {
|
||||
//获取查询参数
|
||||
$param = $this->_param;
|
||||
//获取分页数据
|
||||
$page_config = array(
|
||||
'page' => 1,
|
||||
'page_count' => 20
|
||||
);
|
||||
if(isset($param['page']) && $param['page'] > 0) $page_config['page'] = $param['page'];
|
||||
if(isset($param['page_count']) && $param['page_count'] > 0) $page_config['page_count'] = $param['page_count'];
|
||||
|
||||
//参数过滤
|
||||
$param['uniacid'] = $this->_uniacid;
|
||||
$filter = listUserFilter($param);
|
||||
//查询数据
|
||||
$user_model = new UserModel();
|
||||
//获取总数据总条数
|
||||
$page_config['total'] = $user_model->listUserCount($filter);
|
||||
|
||||
$users = $user_model->listUser($filter ,$page_config);
|
||||
//构造返回数据
|
||||
$page_config['total_page'] = (int)($page_config['total'] / $page_config['page_count']);
|
||||
if(($page_config['total'] % $page_config['page_count']) > 0) $page_config['total_page'] = $page_config['total_page'] + 1;
|
||||
$result = $page_config;
|
||||
$result['users'] = $users;
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
//获取用户详情
|
||||
public function getUser() {
|
||||
$user_id = $this->_param['user_id'];
|
||||
//获取用户详细信息
|
||||
$user_model = new UserModel();
|
||||
$user = $user_model->getUser(['user_id' => $user_id ,'uniacid' => $this->_uniacid]);
|
||||
//移除密码 偏移量
|
||||
unset($user['passwd']);
|
||||
unset($user['offset']);
|
||||
//返回数据
|
||||
return $this->success($user);
|
||||
}
|
||||
|
||||
//修改用户信息
|
||||
public function updateUser() {
|
||||
//获取用户id
|
||||
$user_id = $this->_param['user_id'];
|
||||
//生成用户模型类
|
||||
$user_model = new UserModel();
|
||||
//获取用户数据
|
||||
$user = $user_model->getUser(['user_id' => $user_id ,'uniacid' => $this->_uniacid]);
|
||||
if(empty($user)) return $this->error('the user not is exist ,please check user id.');
|
||||
//获取修改信息
|
||||
$user_data = getUpdateUserFilter($this->_input['user']);
|
||||
//更改密码
|
||||
if(isset($user_data['passwd'])){
|
||||
//判断偏移量是否存在
|
||||
if(!isset($user['offset'])) $user['offset'] = createOffset(); $user_data['offset'] = $user['offset'];
|
||||
$user_data['passwd'] = createPasswd($user_data['passwd'] ,$user['offset']);
|
||||
}
|
||||
//修改数据
|
||||
$result = $user_model->updateUser(['user_id' => $user_id ,'uniacid' => $this->_uniacid] ,$user_data);
|
||||
//返回数据
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
//删除用户
|
||||
public function delUser() {
|
||||
//获取用户id
|
||||
$user_id = $this->_param['user_id'];
|
||||
//生成用户模型类
|
||||
$user_model = new UserModel();
|
||||
//获取用户数据
|
||||
$user = $user_model->getUser(['user_id' => $user_id ,'uniacid' => $this->_uniacid]);
|
||||
if(empty($user)) return $this->error('the user not is exist ,please check user id.');
|
||||
//删除用户数据
|
||||
$result = $user_model->delUser(['user_id' => $user_id ,'uniacid' => $this->_uniacid] ,['deleted' => 0]);
|
||||
//删除用户权限信息
|
||||
$admin_role_model = new UserRoleModel();
|
||||
$admin_role_model->delUserRole(['user_id' => $user_id]);
|
||||
//删除数据缓存
|
||||
|
||||
//返回数据
|
||||
return $this->success($result);
|
||||
}
|
||||
//给用户增加权限
|
||||
public function setUserRole() {
|
||||
//获取用户id
|
||||
$user_id = $this->_param['user_id'];
|
||||
//获取角色id
|
||||
$role_id = $this->_param['role_id'];
|
||||
//生成用户模型类
|
||||
$user_model = new UserModel();
|
||||
//获取用户数据
|
||||
$user = $user_model->getUser(['user_id' => $user_id ,'uniacid' => $this->_uniacid]);
|
||||
if(empty($user)) return $this->error('the user is not exist ,please check user id.');
|
||||
//获取角色信息
|
||||
$role = ckeckRole($role_id);
|
||||
if(empty($role)) return $this->error('the role is not exist ,please check role id.');
|
||||
//判断用户权限是否已存在
|
||||
$exist_role_ids = [];
|
||||
foreach($user['role'] as $role){
|
||||
$exist_role_ids[] = $role['role_ids'];
|
||||
}
|
||||
if(in_array($role_id, $exist_role_ids)) return $this->error('the user had the role ,please do not repeat add role to the user.');
|
||||
//添加角色
|
||||
$user_role_model = UserRoleModel();
|
||||
$result = $user_role_model->createUserRole(['user_id' => $user_id ,$role_id => $role_id ,'uniacid' => $this->_uniacid]);
|
||||
//返回数据
|
||||
return $this->success($result);
|
||||
}
|
||||
//移除用户权限
|
||||
public function removeUserRole() {
|
||||
//获取用户id
|
||||
$user_id = $this->_param['user_id'];
|
||||
//获取角色id
|
||||
$role_id = $this->_param['role_id'];
|
||||
//生成用户模型类
|
||||
$user_model = new UserModel();
|
||||
//获取用户数据
|
||||
$user = $user_model->getUser(['user_id' => $user_id ,'uniacid' => $this->_uniacid]);
|
||||
if(empty($user)) return $this->error('the user is not exist ,please check user id.');
|
||||
//判断用户权限是否已存在
|
||||
$exist_role_ids = [];
|
||||
foreach($user['role'] as $role){
|
||||
$exist_role_ids[] = $role['role_ids'];
|
||||
}
|
||||
if(!in_array($role_id, $exist_role_ids)) return $this->error('the user role is not exist ,please check role id.');
|
||||
//添加角色
|
||||
$user_role_model = UserRoleModel();
|
||||
$result = $user_role_model->delUserRole(['user_id' => $user_id ,$role_id => $role_id ,'uniacid' => $this->_uniacid]);
|
||||
//返回数据
|
||||
return $this->success($result);
|
||||
}
|
||||
}
|
||||
47
app/admin/controller/Wx.php
Normal file
47
app/admin/controller/Wx.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
use think\App;
|
||||
use app\ApiRest;
|
||||
class Wx extends ApiRest
|
||||
{
|
||||
// 继承 验证用户登陆
|
||||
public function __construct ( App $app )
|
||||
{
|
||||
parent::__construct( $app );
|
||||
}
|
||||
|
||||
public function getTabbar()
|
||||
{
|
||||
$tabbars = longbingGetAppTabbar($this->_uniacid);
|
||||
$tabbars = longbingGetWxAppTabbarResponse($tabbars);
|
||||
|
||||
|
||||
$pluginAuth = longbingGetPluginAuth($this->_uniacid);
|
||||
|
||||
$plugin_map = [
|
||||
"activity"=> 'activity',
|
||||
'appointment' => 'appoint',
|
||||
'house' => 'house',
|
||||
];
|
||||
$meta_map = [
|
||||
'card' => 'BusinessCard',
|
||||
'shop' => 'Malls',
|
||||
'dynamic' => 'Dynamic',
|
||||
'website' => 'Website',
|
||||
];
|
||||
|
||||
|
||||
foreach ($tabbars['data'] as $k => $item) {
|
||||
if (in_array($k, array_keys($plugin_map)) && ($pluginAuth['plugin'][$plugin_map[$k]] == 0)) {
|
||||
unset($tabbars['data'][$k]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (in_array($k, array_keys($meta_map)) && ($pluginAuth['web_manage_meta_config'][$meta_map[$k]] == 0)) {
|
||||
unset($tabbars['data'][$k]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return $this->success($tabbars);
|
||||
}
|
||||
}
|
||||
95
app/admin/controller/WxFile.php
Normal file
95
app/admin/controller/WxFile.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
use app\ApiRest;
|
||||
use think\App;
|
||||
use think\Request;
|
||||
use app\admin\model\AttachmentGroup;
|
||||
use app\admin\model\CoreAttachment;
|
||||
use app\Common\Upload;
|
||||
class WxFile extends ApiRest
|
||||
{
|
||||
protected $uid = null;
|
||||
public function __construct(App $app) {
|
||||
parent::__construct($app);
|
||||
//测试数据
|
||||
$this->uid = $this->getUserId();
|
||||
}
|
||||
//上传文件
|
||||
public function uploadFile()
|
||||
{
|
||||
$input = $this->_param;
|
||||
$file = $this->request->file('file');
|
||||
if(empty($file)) $file = $this->request->file('files');
|
||||
if(empty($file)) $file = $this->request->file('filePath');
|
||||
if(empty($file)) return $this->error('not file ,please check file.');
|
||||
$uploda_model = new Upload($this->_uniacid);
|
||||
$type = 'picture';
|
||||
if(isset($input['type'])) $type = $input['type'];
|
||||
$info = $uploda_model->upload($type ,$file);
|
||||
$result = false;
|
||||
if(!empty($info))
|
||||
{
|
||||
if(isset($info['attachment']) && !empty($info['attachment']))
|
||||
{
|
||||
$info['attachment_path'] = $info['attachment'];
|
||||
$info = transImagesOne($info ,['attachment_path'] ,$this->_uniacid);
|
||||
}
|
||||
//获取上传者id
|
||||
$info['uid'] = $this->uid;
|
||||
// $info['attachment_path'] = longbingGetFilePath($info['attachment'] , $this->_host,$this->_uniacid);
|
||||
//数据来源
|
||||
$info['from'] = 'wx';
|
||||
//写入数据库
|
||||
$attachment_model = new CoreAttachment();
|
||||
$data = $attachment_model->createAttach($info);
|
||||
//判断写入数据库是否成功
|
||||
if(!empty($data)) $result = $info;
|
||||
}
|
||||
//数据处理
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
public function uploadFiles()
|
||||
{
|
||||
//获取参数
|
||||
$input = $this->_param;
|
||||
//获取文件列表
|
||||
$files = $this->request->file('file');
|
||||
if(empty($files)) $files = $this->request->file('files');
|
||||
if(empty($files)) $files = $this->request->file('filePath');
|
||||
//检查文件是否存在
|
||||
if(empty($files)) return $this->error('not file ,please check file.');
|
||||
//设置类型
|
||||
$type = 'picture';
|
||||
if(isset($input['type'])) $type = $input['type'];
|
||||
$result = [];
|
||||
//生成上传模型
|
||||
$uploda_model = new Upload($this->_uniacid);
|
||||
foreach($files as $file)
|
||||
{
|
||||
//上传文件
|
||||
$info = $uploda_model->upload($type ,$file);
|
||||
|
||||
if(!empty($info))
|
||||
{
|
||||
if(isset($info['attachment']) && !empty($info['attachment']))
|
||||
{
|
||||
$info['attachment_path'] = $info['attachment'];
|
||||
$info = transImagesOne($info ,['attachment_path'] ,$this->_uniacid);
|
||||
}
|
||||
//获取上传者id
|
||||
$info['uid'] = $this->uid;
|
||||
// $info['attachment_path'] = longbingGetFilePath($info['attachment'] , $this->_host,$this->_uniacid);
|
||||
//数据来源
|
||||
$info['from'] = 'wx';
|
||||
//写入数据库
|
||||
$attachment_model = new CoreAttachment();
|
||||
$data = $attachment_model->createAttach($info);
|
||||
//判断写入数据库是否成功
|
||||
if(!empty($data)) $result[] = $info;
|
||||
}
|
||||
}
|
||||
//数据处理
|
||||
return $this->success($result);
|
||||
}
|
||||
}
|
||||
5
app/admin/event.php
Normal file
5
app/admin/event.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
// 这是系统自动生成的admin应用event定义文件
|
||||
return [
|
||||
|
||||
];
|
||||
283
app/admin/info/AdminMenu.php
Normal file
283
app/admin/info/AdminMenu.php
Normal file
@@ -0,0 +1,283 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: shuixian
|
||||
* Date: 2019/11/20
|
||||
* Time: 18:29
|
||||
*/
|
||||
|
||||
|
||||
$copyRight = '{"name": "CopyrightConfig","url": "/sys/copyright"},' ;
|
||||
|
||||
$uplode_wecht = !longbingIsWeiqin()|| config('app.AdminModelList')['app_model_name'] =='longbing_card'?',{"name": "SProWechat","url": "/sys/wechat"}':'';
|
||||
|
||||
$menu = <<<SYS
|
||||
{
|
||||
"path": "/sys",
|
||||
"component": "Layout",
|
||||
"redirect": "/sys/config",
|
||||
"meta": {
|
||||
"menuName": "System",
|
||||
"icon": "icon-xitong",
|
||||
"subNavName": [
|
||||
{
|
||||
"name": "SProSetting",
|
||||
"url": [
|
||||
{
|
||||
"name": "SProConfig",
|
||||
"url": "/sys/config"
|
||||
},
|
||||
{
|
||||
"name": "SProLink",
|
||||
"url": "/sys/link"
|
||||
},
|
||||
{
|
||||
"name": "SProPayment",
|
||||
"url": "/sys/payment"
|
||||
}
|
||||
|
||||
$uplode_wecht
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "OtherSetting",
|
||||
"url": [
|
||||
$copyRight
|
||||
{
|
||||
"name": "AllNotice",
|
||||
"url": "/sys/clientNotice"
|
||||
},{
|
||||
"name": "ShareSet",
|
||||
"url": "/sys/share"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"path": "config",
|
||||
"name": "SProConfig",
|
||||
"component": "/system/smallProcedure/config",
|
||||
"meta": {
|
||||
"keepAlive": true,
|
||||
"title": "SystemSetting",
|
||||
"auth": [
|
||||
],
|
||||
"isOnly": false,
|
||||
"pagePermission": [
|
||||
{
|
||||
"title": "SProConfig",
|
||||
"index": 0,
|
||||
"auth": [
|
||||
"view",
|
||||
"add",
|
||||
"edit",
|
||||
"del",
|
||||
"outport"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "payment",
|
||||
"name": "SProPayment",
|
||||
"component": "/system/smallProcedure/payment",
|
||||
"meta": {
|
||||
"title": "SystemSetting",
|
||||
"isOnly": false,
|
||||
"auth": [
|
||||
],
|
||||
"pagePermission": [
|
||||
{
|
||||
"title": "SProPayment",
|
||||
"index": 0,
|
||||
"auth": [
|
||||
"view",
|
||||
"add",
|
||||
"edit",
|
||||
"del",
|
||||
"outport"]
|
||||
}]
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "wechat",
|
||||
"name": "SProWechat",
|
||||
"component": "/system/smallProcedure/wechat",
|
||||
"meta": {
|
||||
"title": "SystemSetting",
|
||||
"isOnly": false,
|
||||
"auth": [
|
||||
],
|
||||
"pagePermission": [
|
||||
{
|
||||
"title": "SProWechat",
|
||||
"index": 0,
|
||||
"auth": [
|
||||
"view",
|
||||
"add",
|
||||
"edit",
|
||||
"del",
|
||||
"outport"]
|
||||
}]
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "link",
|
||||
"name": "SProLink",
|
||||
"component": "/system/smallProcedure/link",
|
||||
"meta": {
|
||||
"keepAlive": true,
|
||||
"title": "SystemSetting",
|
||||
"auth": [
|
||||
],
|
||||
"isOnly": false,
|
||||
"pagePermission": [
|
||||
{
|
||||
"title": "SProLink",
|
||||
"index": 0,
|
||||
"auth": [
|
||||
"view",
|
||||
"add",
|
||||
"edit",
|
||||
"del",
|
||||
"outport"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "copyright",
|
||||
"name": "CopyrightConfig",
|
||||
"component": "/system/other/copyright",
|
||||
"meta": {
|
||||
"keepAlive": true,
|
||||
"title": "SystemSetting",
|
||||
"auth": [
|
||||
],
|
||||
"isOnly": false,
|
||||
"pagePermission": [
|
||||
{
|
||||
"title": "CopyrightConfig",
|
||||
"index": 0,
|
||||
"auth": [
|
||||
"view",
|
||||
"add",
|
||||
"edit",
|
||||
"del",
|
||||
"outport"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "clientNotice",
|
||||
"name": "AllNotice",
|
||||
"component": "/system/other/clientNotice",
|
||||
"meta": {
|
||||
"keepAlive": true,
|
||||
"title": "SystemSetting",
|
||||
"auth": [
|
||||
],
|
||||
"isOnly": false,
|
||||
"pagePermission": [
|
||||
{
|
||||
"title": "clientNotice",
|
||||
"url": "/sys/clientNotice",
|
||||
"index": 0,
|
||||
"auth": [
|
||||
"view",
|
||||
"add",
|
||||
"edit",
|
||||
"del",
|
||||
"outport"
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "radarNotice",
|
||||
"url": "/sys/radarNotice",
|
||||
"index": 1,
|
||||
"auth": [
|
||||
"view",
|
||||
"add",
|
||||
"edit",
|
||||
"del",
|
||||
"outport"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "radarNotice",
|
||||
"name": "AllNotice",
|
||||
"component": "/system/other/radarNotice",
|
||||
"meta": {
|
||||
"keepAlive": true,
|
||||
"title": "SystemSetting",
|
||||
"auth": [
|
||||
],
|
||||
"isOnly": false,
|
||||
"pagePermission": [
|
||||
{
|
||||
"title": "clientNotice",
|
||||
"url": "/sys/clientNotice",
|
||||
"index": 0,
|
||||
"auth": [
|
||||
"view",
|
||||
"add",
|
||||
"edit",
|
||||
"del",
|
||||
"outport"
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "radarNotice",
|
||||
"url": "/sys/radarNotice",
|
||||
"index": 1,
|
||||
"auth": [
|
||||
"view",
|
||||
"add",
|
||||
"edit",
|
||||
"del",
|
||||
"outport"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "share",
|
||||
"name": "ShareSet",
|
||||
"component": "/system/other/share",
|
||||
"meta": {
|
||||
"keepAlive": true,
|
||||
"title": "SystemSetting",
|
||||
"auth": [],
|
||||
"isOnly": false,
|
||||
"pagePermission": [{
|
||||
"title": "ShareSet",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"
|
||||
|
||||
]
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
SYS;
|
||||
|
||||
//return json_decode(['System' => $menu], true);
|
||||
return ['admin' => $menu];
|
||||
|
||||
|
||||
29
app/admin/info/Info.php
Normal file
29
app/admin/info/Info.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: shuixian
|
||||
* Date: 2019/11/20
|
||||
* Time: 18:30
|
||||
*/
|
||||
|
||||
return [
|
||||
|
||||
//模块名称[必填]
|
||||
'name' => 'admin',
|
||||
//模块标题[必填]
|
||||
'title' =>'系统',
|
||||
//内容简介
|
||||
'desc' =>'',
|
||||
//封面图标
|
||||
'icon' =>'',
|
||||
//模块类型[必填] model:模块 可以出现在左侧一级 app:应用中心 , 是一个应用中心的应用
|
||||
'type' => 'model',
|
||||
// 模块唯一标识[必填],格式:模块名.开发者标识.module
|
||||
'identifier' => 'admin.longbing.module',
|
||||
// 版本[必填],格式采用三段式:主版本号.次版本号.修订版本号
|
||||
'version' => '1.1.42',
|
||||
// 模块依赖[可选],格式[[模块名, 模块唯一标识, 依赖版本, 对比方式]]
|
||||
'need_module' => [],
|
||||
// 插件依赖[可选],格式[[插件名, 插件唯一标识, 依赖版本, 对比方式]]
|
||||
'need_plugin' => [],
|
||||
];
|
||||
84
app/admin/info/PermissionAdmin.php
Normal file
84
app/admin/info/PermissionAdmin.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | Longbing [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright Chengdu longbing Technology Co., Ltd.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Website http://longbing.org/
|
||||
// +----------------------------------------------------------------------
|
||||
// | Sales manager: +86-13558882532 / +86-13330887474
|
||||
// | Technical support: +86-15680635005
|
||||
// | After-sale service: +86-17361005938
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace app\admin\info;
|
||||
|
||||
use longbingcore\permissions\PermissionAbstract;
|
||||
|
||||
/**
|
||||
* 模块功能权限
|
||||
* Class PermissionAdmin
|
||||
*/
|
||||
class PermissionAdmin extends PermissionAbstract {
|
||||
|
||||
const tabbarKey = null;
|
||||
//后台管理菜单对应key[必填] , 当前模块文件夹名称
|
||||
const adminMenuKey = 'admin';
|
||||
public $saasKey ;
|
||||
const apiPaths = [];
|
||||
|
||||
|
||||
public function __construct(int $uniacid,$infoConfigOptions = [])
|
||||
{
|
||||
$this->saasKey = longbing_get_auth_prefix('AUTH_MINI') ;
|
||||
parent::__construct($uniacid, self::tabbarKey, self::adminMenuKey, $this->saasKey, self::apiPaths , $infoConfigOptions);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 返回saas端授权结果
|
||||
* @return bool
|
||||
*/
|
||||
public function sAuth(): bool
|
||||
{
|
||||
return true ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回p端授权结果
|
||||
* @return bool
|
||||
*/
|
||||
public function pAuth(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回c端授权结果
|
||||
*
|
||||
* @param int $user_id
|
||||
* @return bool
|
||||
* @author ArtizanZhang
|
||||
* @DataTime: 2019/12/9 17:13
|
||||
*/
|
||||
public function cAuth(int $user_id): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取授权数量
|
||||
*
|
||||
* @author shuixian
|
||||
* @DataTime: 2019/12/19 19:02
|
||||
*/
|
||||
public function getAuthNumber(){
|
||||
$authNumber = $this->getAuthVaule( $this->saasKey ,2 ) ;
|
||||
$authNumber = $authNumber == 0 ? 99999999 : $authNumber ;
|
||||
return $authNumber ;
|
||||
}
|
||||
}
|
||||
667
app/admin/info/RadarMessage.php
Normal file
667
app/admin/info/RadarMessage.php
Normal file
@@ -0,0 +1,667 @@
|
||||
<?php
|
||||
|
||||
$radar_msg = [
|
||||
[
|
||||
"sign"=> "praises",
|
||||
"type"=> 2,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请尽快把握商机",
|
||||
"operation"=> "查看",
|
||||
"item"=> "名片",
|
||||
"show_count"=> 1,
|
||||
"table_name"=> "",
|
||||
"field"=> "",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "copy",
|
||||
"type"=> 1,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "对你已建立信任,保持联系持续跟进",
|
||||
"operation"=> "将",
|
||||
"item"=> "手机号码存入了手机通讯录",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "",
|
||||
"field"=> "",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "copy",
|
||||
"type"=> 2,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "咨询意向强烈,及时联系确保沟通顺畅",
|
||||
"operation"=> "拨打",
|
||||
"item"=> "手机号",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "longbing_card_user_info",
|
||||
"field"=> "phone",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "copy",
|
||||
"type"=> 3,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请随时保持电话畅通",
|
||||
"operation"=> "拨打",
|
||||
"item"=> "公司电话",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "",
|
||||
"field"=> "",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "copy",
|
||||
"type"=> 4,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "客户请随时可能加你微信",
|
||||
"operation"=> "复制了",
|
||||
"item"=> "微信",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "",
|
||||
"field"=> "",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "copy",
|
||||
"type"=> 5,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "可能随时邮寄文件给你,请注意查收",
|
||||
"operation"=> "复制了",
|
||||
"item"=> "邮箱",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "",
|
||||
"field"=> "",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "copy",
|
||||
"type"=> 6,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请及时留意雷达动态",
|
||||
"operation"=> "复制",
|
||||
"item"=> "公司名称",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "",
|
||||
"field"=> "",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "copy",
|
||||
"type"=> 7,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "对你的公司非常感兴趣",
|
||||
"operation"=> "查看了",
|
||||
"item"=> "公司地址",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "",
|
||||
"field"=> "",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "copy",
|
||||
"type"=> 8,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请及时留意雷达动态",
|
||||
"operation"=> "咨询",
|
||||
"item"=> "产品",
|
||||
"show_count"=> 1,
|
||||
"table_name"=> "",
|
||||
"field"=> "",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "copy",
|
||||
"type"=> 9,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请及时留意雷达动态",
|
||||
"operation"=> "播放",
|
||||
"item"=> "语音",
|
||||
"show_count"=> 1,
|
||||
"table_name"=> "",
|
||||
"field"=> "",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "copy",
|
||||
"type"=> 10,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "正在帮你裂变人脉,请及时留意雷达动态(快去表达一下你的感谢)",
|
||||
"operation"=> "保存了",
|
||||
"item"=> "名片海报",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "",
|
||||
"field"=> "",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "copy",
|
||||
"type"=> 11,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请随时保持电话畅通",
|
||||
"operation"=> "拨打",
|
||||
"item"=> "400热线",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "",
|
||||
"field"=> "",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 1,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请尽快把握商机",
|
||||
"operation"=> "浏览",
|
||||
"item"=> "商城列表",
|
||||
"show_count"=> 1,
|
||||
"table_name"=> "longbing_card_shop_type",
|
||||
"field"=> "title",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 2,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请尽快把握商机,主动提供细致的商品讲解将大大有利于成交",
|
||||
"operation"=> "正在查看你的",
|
||||
"item"=> "商品",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "longbing_card_goods",
|
||||
"field"=> "name",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 3,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "看来TA对公司动态感兴趣",
|
||||
"operation"=> "浏览",
|
||||
"item"=> "动态列表",
|
||||
"show_count"=> 1,
|
||||
"table_name"=> "",
|
||||
"field"=> "",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 4,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请尽快把握商机",
|
||||
"operation"=> "点赞",
|
||||
"item"=> "动态",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "longbing_card_timeline",
|
||||
"field"=> "title",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 5,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请尽快把握商机",
|
||||
"operation"=> "评论了",
|
||||
"item"=> "动态",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "longbing_card_timeline",
|
||||
"field"=> "title",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 6,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "",
|
||||
"operation"=> "查看了",
|
||||
"item"=> "企业官网",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "",
|
||||
"field"=> "",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 7,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "",
|
||||
"operation"=> "正在查看",
|
||||
"item"=> "动态",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "longbing_card_timeline",
|
||||
"field"=> "title",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 8,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "",
|
||||
"operation"=> "正在查看",
|
||||
"item"=> "动态视频",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "longbing_card_timeline",
|
||||
"field"=> "title",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 9,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "",
|
||||
"operation"=> "正在查看",
|
||||
"item"=> "动态外链",
|
||||
"show_count"=> 1,
|
||||
"table_name"=> "longbing_card_timeline",
|
||||
"field"=> "title",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 10,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请尽快把握商机",
|
||||
"operation"=> "通过动态列表跳转小程序",
|
||||
"item"=> "",
|
||||
"show_count"=> 1,
|
||||
"table_name"=> "longbing_card_timeline",
|
||||
"field"=> "title",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 11,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请尽快把握商机",
|
||||
"operation"=> "浏览",
|
||||
"item"=> "商品分类列表",
|
||||
"show_count"=> 1,
|
||||
"table_name"=> "longbing_card_shop_type",
|
||||
"field"=> "title",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 12,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请尽快展开跟进",
|
||||
"operation"=> "正在阅读",
|
||||
"item"=> "文章",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "lb_marketing_article_v2",
|
||||
"field"=> "title",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 13,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "正在帮你裂变人脉,请及时留意雷达动态(快去表达一下你的感谢)",
|
||||
"operation"=> "分享了",
|
||||
"item"=> "文章",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "lb_marketing_article_v2",
|
||||
"field"=> "title",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 14,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "正在帮你裂变人脉,请及时留意雷达动态(快去表达一下你的感谢)",
|
||||
"operation"=> "保存",
|
||||
"item"=> "文章海报",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "lb_marketing_article_v2",
|
||||
"field"=> "title",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 15,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "",
|
||||
"operation"=> "查看了",
|
||||
"item"=> "预约",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "",
|
||||
"field"=> "",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 16,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请尽快把握商机",
|
||||
"operation"=> "浏览",
|
||||
"item"=> "预约栏目",
|
||||
"show_count"=> 1,
|
||||
"table_name"=> "lb_appoint_classify",
|
||||
"field"=> "title",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 17,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "预约活动",
|
||||
"operation"=> "正在查看",
|
||||
"item"=> "预约",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "lb_appoint_project",
|
||||
"field"=> "title",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 18,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请尽快处理",
|
||||
"operation"=> "在官网留言",
|
||||
"item"=> "",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "longbing_card_form",
|
||||
"field"=> "name,phone,content",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 19,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请前往订单中心查看详情",
|
||||
"operation"=> "订单商品已发货,系统订单号为:",
|
||||
"item"=> "",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "longbing_card_shop_order",
|
||||
"field"=> "out_trade_no",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 20,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请前往订单中心查看详情",
|
||||
"operation"=> "自提商品已提货",
|
||||
"item"=> "",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "longbing_card_shop_order",
|
||||
"field"=> "out_trade_no",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 21,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请等待管理员审核并注意查收",
|
||||
"operation"=> "已申请退款",
|
||||
"item"=> "",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "longbing_card_shop_order",
|
||||
"field"=> "out_trade_no",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 22,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请前往订单中心查看详情",
|
||||
"operation"=> "已取消申请退款",
|
||||
"item"=> "",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "longbing_card_shop_order",
|
||||
"field"=> "out_trade_no",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 23,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请前往订单中心查看详情",
|
||||
"operation"=> "管理员拒绝退款",
|
||||
"item"=> "",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "longbing_card_shop_order",
|
||||
"field"=> "out_trade_no",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 24,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请注意查收",
|
||||
"operation"=> "退款成功",
|
||||
"item"=> "",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "longbing_card_shop_order",
|
||||
"field"=> "out_trade_no",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 25,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "",
|
||||
"operation"=> "查看了",
|
||||
"item"=> "活动",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "",
|
||||
"field"=> "",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 26,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请尽快把握商机",
|
||||
"operation"=> "浏览",
|
||||
"item"=> "活动报名分类列表",
|
||||
"show_count"=> 1,
|
||||
"table_name"=> "lb_activity_classify",
|
||||
"field"=> "title",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 27,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请尽快把握商机",
|
||||
"operation"=> "正在查看",
|
||||
"item"=> "活动",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "lb_activity_activity",
|
||||
"field"=> "title",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 28,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请在活动开始前提醒客户",
|
||||
"operation"=> "已参加了活动",
|
||||
"item"=> "",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "lb_activity_activity",
|
||||
"field"=> "title",
|
||||
"send"=> 2,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 29,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "",
|
||||
"operation"=> "正在查看",
|
||||
"item"=> "房源信息",
|
||||
"show_count"=> 1,
|
||||
"table_name"=> "",
|
||||
"field"=> "",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 30,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请尽快把握商机",
|
||||
"operation"=> "查看了",
|
||||
"item"=> "房源",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "longbing_card_house",
|
||||
"field"=> "title",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "praise",
|
||||
"type"=> 1,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请尽快把握商机",
|
||||
"operation"=> "语音点赞",
|
||||
"item"=> "",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "",
|
||||
"field"=> "",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "praise",
|
||||
"type"=> 2,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请尽快把握商机",
|
||||
"operation"=> "查看",
|
||||
"item"=> "名片",
|
||||
"show_count"=> 1,
|
||||
"table_name"=> "",
|
||||
"field"=> "",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
]
|
||||
|
||||
];
|
||||
|
||||
return $radar_msg;
|
||||
10
app/admin/lang/zh-cn.php
Normal file
10
app/admin/lang/zh-cn.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
return [
|
||||
'hello thinkphp' => '欢迎使用ThinkPHP',
|
||||
'data type error' => '数据类型错误',
|
||||
'tabbar count can not be greater than' => '菜单栏数量不能大于',
|
||||
'auto get template error' => '自动获取服务通知模板失败,请稍后再试。',
|
||||
'wx app site error ,please check site message.' => '微信小程序配置异常,请检查站点配置',
|
||||
'wx app site error' => '微信小程序配置异常,请检查站点配置',
|
||||
'upload config error' => '上传配置错误,请检查上传配置是否正确。'
|
||||
];
|
||||
5
app/admin/middleware.php
Normal file
5
app/admin/middleware.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
// 这是系统自动生成的admin应用middleware定义文件
|
||||
return [
|
||||
|
||||
];
|
||||
68
app/admin/model/Admin.php
Normal file
68
app/admin/model/Admin.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
class Admin extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_admin';
|
||||
//初始化
|
||||
// function __construct() {
|
||||
// parent::__construct();
|
||||
// }
|
||||
|
||||
//权限关联
|
||||
public function role(){
|
||||
return $this->hasOne('Role' , 'role_id' ,'role_id');
|
||||
}
|
||||
//公司关联
|
||||
public function company() {
|
||||
return $this->hasOne('Company' ,'company_id' ,'company_id');
|
||||
}
|
||||
//创建admin
|
||||
public function createAdmin($data) {
|
||||
return $this->createRow($data);
|
||||
}
|
||||
|
||||
//修改admin
|
||||
public function updateAdmin($filter ,$data) {
|
||||
return $this->updateRow($filter ,$data);
|
||||
}
|
||||
|
||||
//删除admin
|
||||
public function delAdmin($filter) {
|
||||
return $this->delRow($filter);
|
||||
}
|
||||
|
||||
//获取admin详情
|
||||
public function getAdmin($filter) {
|
||||
$data = $this->with(['company' => function($query) {
|
||||
$query->where(['deleted' => 0 ,'status' => 1])->field('company_name ,is_top');
|
||||
}])
|
||||
->where($filter)
|
||||
->find();
|
||||
if(!empty($data)) $data = $data->toArray();
|
||||
// $data = Db::name($this->name)
|
||||
// ->alias('admin')
|
||||
// ->leftJoin('user' ,'admin.user_id = user.user_id')
|
||||
// ->where(['admin.account' => 'admin'])
|
||||
// ->find();
|
||||
return $data;
|
||||
}
|
||||
|
||||
//获取admin列表
|
||||
public function listAdmin($filter ,$page_config) {
|
||||
|
||||
}
|
||||
|
||||
//获取admin总数
|
||||
public function listAdminCount($filter) {
|
||||
|
||||
}
|
||||
|
||||
//获取所有admin
|
||||
public function listAdminAll($filter) {
|
||||
|
||||
}
|
||||
}
|
||||
32
app/admin/model/AdminRole.php
Normal file
32
app/admin/model/AdminRole.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
class AdminRole extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_admin_role';
|
||||
protected $pk = 'ur_id';
|
||||
|
||||
//初始化
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected static function init(){
|
||||
//TODO:初始化内容
|
||||
}
|
||||
|
||||
//创建用户权限
|
||||
public function createUserRole($data){
|
||||
$data['ur_id'] = uuid();
|
||||
$data['create_time'] = $this->time();
|
||||
return $this->save($data);
|
||||
}
|
||||
//删除用户权限
|
||||
public function delUserRole($filter){
|
||||
return $this->delRow($filter);
|
||||
}
|
||||
|
||||
}
|
||||
83
app/admin/model/AppConfig.php
Normal file
83
app/admin/model/AppConfig.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\Model;
|
||||
|
||||
|
||||
|
||||
class AppConfig extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_card_config';
|
||||
|
||||
|
||||
protected static function init ()
|
||||
{
|
||||
//TODO:初始化内容
|
||||
}
|
||||
|
||||
|
||||
public function initConfig ($uniacid)
|
||||
{
|
||||
return self::create( [ 'uniacid' => $uniacid, ] );
|
||||
}
|
||||
|
||||
public function getConfig ($uniacid)
|
||||
{
|
||||
$key = 'longbing_card_config_';
|
||||
|
||||
$cacheData = getCache($key, $uniacid);
|
||||
|
||||
// 暂时关闭缓存
|
||||
$cacheData = false;
|
||||
|
||||
if ($cacheData)
|
||||
{
|
||||
$cacheData['fromCache'] = 1;
|
||||
return $cacheData;
|
||||
}
|
||||
|
||||
$data = self::where( [ [ 'uniacid', '=', $uniacid ] ] )
|
||||
->find();
|
||||
|
||||
if ( !$data )
|
||||
{
|
||||
$data = $this->initConfig($uniacid);
|
||||
}
|
||||
|
||||
$data = $data->toArray();
|
||||
|
||||
|
||||
$data = transImagesOne( $data, [ 'vr_cover', 'default_video', 'default_voice', 'appoint_pic', 'click_copy_show_img',
|
||||
'shop_carousel_more', 'copyright', 'default_video_cover' ], $uniacid
|
||||
);
|
||||
setCache( $key, $data, 36000, $uniacid );
|
||||
|
||||
return $data;
|
||||
}
|
||||
//获取
|
||||
public function getConfigByUniacid($uniacid)
|
||||
{
|
||||
$result = $this->where(['uniacid' => $uniacid])->find();
|
||||
if(!empty($result)){
|
||||
$result = $result->toArray();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
//创建
|
||||
public function createConfig($data)
|
||||
{
|
||||
$data['create_time'] = time();
|
||||
$result = $this->save($data);
|
||||
return !empty($result);
|
||||
}
|
||||
|
||||
//更新
|
||||
public function updateConfig($filter ,$data)
|
||||
{
|
||||
$data['update_time'] = time();
|
||||
$result = $this->where($filter)->update($data);
|
||||
return !empty($result);
|
||||
}
|
||||
}
|
||||
52
app/admin/model/AppTabbar.php
Normal file
52
app/admin/model/AppTabbar.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\Model;
|
||||
|
||||
|
||||
//底部菜单
|
||||
class AppTabbar extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_card_tabbar';
|
||||
|
||||
//创建
|
||||
public function createTabbar($data)
|
||||
{
|
||||
$data['create_time'] = time();
|
||||
$result = $this->save($data);
|
||||
return !empty($result);
|
||||
}
|
||||
|
||||
//获取
|
||||
public function getTabbar($filter)
|
||||
{
|
||||
$result = $this->where($filter)->find();
|
||||
if(!empty($result)) $result = $result->toArray();
|
||||
return $result;
|
||||
}
|
||||
|
||||
//修改
|
||||
public function updateTabbar($filter ,$data)
|
||||
{
|
||||
$data['update_time'] = time();
|
||||
$result = $this->where($filter)->update($data);
|
||||
return !empty($result);
|
||||
}
|
||||
|
||||
//删除
|
||||
public function delTabbar($filter)
|
||||
{
|
||||
$result = $this->destoryTabbar($filter);
|
||||
return !empty($result);
|
||||
}
|
||||
|
||||
//删除(真删除)
|
||||
public function destoryTabbar($filter)
|
||||
{
|
||||
$result = $this->where($filter)->delete() ;
|
||||
return !empty($result);
|
||||
}
|
||||
|
||||
}
|
||||
69
app/admin/model/AttachmentGroup.php
Normal file
69
app/admin/model/AttachmentGroup.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
class AttachmentGroup extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'lbfarm_attachment_group';
|
||||
//查询器
|
||||
public function searchNameAttr($query, $value, $data)
|
||||
{
|
||||
$query->where('name','like', '%' . $value . '%');
|
||||
}
|
||||
|
||||
|
||||
//创建
|
||||
function createGroup($data)
|
||||
{
|
||||
$result = $this->save($data);
|
||||
return !empty($result);
|
||||
}
|
||||
|
||||
//更新
|
||||
function updateGroup($filter ,$data)
|
||||
{
|
||||
$result = $this->where($filter)->update($data);
|
||||
return !empty($result);
|
||||
}
|
||||
|
||||
//获取列表
|
||||
// function listGroup($filter)
|
||||
// {
|
||||
// $result = $this->where($filter)->select();
|
||||
// if(!empty($result)) $result = $result->toArray();
|
||||
// return $result;
|
||||
// }
|
||||
|
||||
//获取列表
|
||||
function listGroup($filter)
|
||||
{
|
||||
$result = $this->withSearch(['name'] ,$filter)->where('uniacid','=',$filter['uniacid'])
|
||||
->order('id')
|
||||
->select();
|
||||
if(!empty($result)) $result = $result->toArray();
|
||||
return $result;
|
||||
}
|
||||
|
||||
//获取单个数据
|
||||
function getGroup($filter)
|
||||
{
|
||||
$result = $this->where($filter)->find();
|
||||
if(!empty($result)) $result = $result->toArray();
|
||||
return $result;
|
||||
}
|
||||
|
||||
//删除
|
||||
function delGroup($filter)
|
||||
{
|
||||
return $this->destoryGroup($filter);
|
||||
}
|
||||
|
||||
//删除(真删除)
|
||||
function destoryGroup($filter)
|
||||
{
|
||||
$result = $this->where($filter)->delete();
|
||||
return !empty($result);
|
||||
}
|
||||
}
|
||||
20
app/admin/model/CardUser.php
Normal file
20
app/admin/model/CardUser.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class CardUser extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_card_user';
|
||||
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
//TODO:初始化内容
|
||||
}
|
||||
public function username($idlist){
|
||||
return $this->whereIn('id',$idlist)->field('id,avatarUrl')->select();
|
||||
}
|
||||
}
|
||||
69
app/admin/model/Company.php
Normal file
69
app/admin/model/Company.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
class Company extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_company';
|
||||
//初始化
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
//创建公司信息
|
||||
function createCompany($data) {
|
||||
$data['create_time'] = $this->time;
|
||||
return $this->createRow($data);
|
||||
}
|
||||
|
||||
//修改公司信息
|
||||
function updateCompany($filter ,$data) {
|
||||
$filter['deleted'] = 0;
|
||||
return $this->updateRow($filter ,$data);
|
||||
}
|
||||
|
||||
//删除公司信息
|
||||
function delCompany($filter){
|
||||
$filter['deleted'] = 0;
|
||||
return $this->delRow($filter);
|
||||
}
|
||||
|
||||
//获取公司详情
|
||||
function getCompany($filter) {
|
||||
$filter['company.deleted'] = 0;
|
||||
$company = $this
|
||||
->alias('company')
|
||||
->leftJoin('user user' ,'company.creator_id = user.user_id')
|
||||
->where($filter)
|
||||
->field(['company.*' ,'user.user_name as creator_name'])
|
||||
->find();
|
||||
return $company;
|
||||
}
|
||||
|
||||
//获取公司列表
|
||||
function listCompany($filter ,$page_config) {
|
||||
$filter['user.deleted'] = 0;
|
||||
$companys = $this
|
||||
->alias('company')
|
||||
->leftJoin('user user' ,'company.creator_id = user.user_id')
|
||||
->where($filter)
|
||||
->field(['company.*' ,'user.user_name as creator_name'])
|
||||
->page($page_config['page'] ,$page_config['page_count'])
|
||||
->select();
|
||||
return $companys;
|
||||
}
|
||||
|
||||
//获取公司总数
|
||||
function listCompanyCount($filter) {
|
||||
$filter['user.deleted'] = 0;
|
||||
$count = $this
|
||||
->alias('company')
|
||||
->leftJoin('user user' ,'company.creator_id = user.user_id')
|
||||
->field(['company.company_id'])
|
||||
->where($filter)
|
||||
->count();
|
||||
return $count;
|
||||
}
|
||||
}
|
||||
89
app/admin/model/CoreAttachment.php
Normal file
89
app/admin/model/CoreAttachment.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
class CoreAttachment extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'lbfarm_attachment';
|
||||
|
||||
//查询器
|
||||
public function searchIdsAttr($query, $ids, $data)
|
||||
{
|
||||
$query->where('id','in' ,$ids);
|
||||
}
|
||||
//创建
|
||||
public function createAttach($data)
|
||||
{
|
||||
$data['module_upload_dir'] = 0;
|
||||
$data['displayorder'] = 0;
|
||||
$data['group_id'] = !empty($data['group_id'])?$data['group_id']:0;
|
||||
$result = $this->save($data);
|
||||
$result = !empty($result);
|
||||
return $result;
|
||||
}
|
||||
|
||||
//更新
|
||||
public function updateAttach($filter ,$data)
|
||||
{
|
||||
$result = $this->where($filter)->update($data);
|
||||
$result = !empty($result);
|
||||
return $result;
|
||||
}
|
||||
|
||||
//获取列表
|
||||
public function listAttach($filter ,$page_config)
|
||||
{
|
||||
$start_row = ($page_config['page'] - 1) * $page_config['page_count'];
|
||||
$end_row = $page_config['page_count'];
|
||||
$result = $this->where($filter)
|
||||
->order('createtime' ,'desc')
|
||||
->limit($start_row ,$end_row)
|
||||
->select();
|
||||
if(!empty($result)) $result = $result->toArray();
|
||||
return $result;
|
||||
}
|
||||
|
||||
//获取数据总数
|
||||
public function listAttachCount($filter)
|
||||
{
|
||||
$result = $this->where($filter)
|
||||
->count();
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
//创建
|
||||
public function addAttach($data)
|
||||
{
|
||||
$data['module_upload_dir'] = 0;
|
||||
|
||||
$result = $this->insert($data);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
//获取
|
||||
public function getAttach($filter)
|
||||
{
|
||||
$result = $this->where($filter)->find();
|
||||
if(!empty($result)) $result = $result->toArray();
|
||||
return $result;
|
||||
}
|
||||
|
||||
//删除
|
||||
public function delAttach($filter)
|
||||
{
|
||||
return $this->destoryAttach($filter);
|
||||
}
|
||||
|
||||
//删除(真删除)
|
||||
public function destoryAttach($filter)
|
||||
{
|
||||
//return $this->where($filter)->delete();
|
||||
$result = $this->withSearch(['ids'] ,$filter)->delete();
|
||||
return !empty($result);
|
||||
}
|
||||
|
||||
}
|
||||
107
app/admin/model/Coupon.php
Normal file
107
app/admin/model/Coupon.php
Normal file
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class Coupon extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_card_coupon';
|
||||
|
||||
|
||||
// protected static function init()
|
||||
// {
|
||||
// //TODO:初始化内容
|
||||
// }
|
||||
/**
|
||||
* @var array
|
||||
* 查询器
|
||||
*/
|
||||
protected $append = [
|
||||
'status_text',
|
||||
'type_text'
|
||||
];
|
||||
/**
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return mixed
|
||||
* 状态
|
||||
*/
|
||||
public function getStatusTextAttr($value,$data){
|
||||
$status = [-1=>'已删除',0=>'未发布',1=>'已发布'];
|
||||
return $status[$data['status']];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return mixed
|
||||
* 类型
|
||||
*/
|
||||
public function getTypeTextAttr($value,$data){
|
||||
$type = [1=>'线上',2=>'线下'];
|
||||
return $type[$data['type']];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return false|string
|
||||
* 到期时间
|
||||
*/
|
||||
public function getEndTimeAttr($value,$data){
|
||||
return date('Y-m-d H:i:s',$data['end_time']);
|
||||
}
|
||||
/**
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return false|string
|
||||
* 创建时间
|
||||
*/
|
||||
public function getCreateTimeAttr($value,$data){
|
||||
return date('Y-m-d H:i:s',$data['create_time']);
|
||||
}
|
||||
|
||||
/*获取福包列表
|
||||
*/
|
||||
public function couponList($dis,$page=10){
|
||||
|
||||
$data = self::where($dis)->order('top desc')->paginate($page)->toArray();
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改福包
|
||||
*/
|
||||
|
||||
public function couponUpdate($dis,$data){
|
||||
$data['update_time'] = time();
|
||||
$res = Db::name($this->name)->where($dis)->update($data);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 添加福包
|
||||
*/
|
||||
|
||||
public function couponAdd($data){
|
||||
$data['create_time'] = time();
|
||||
$res = Db::name($this->name)->insert($data);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取福包详情
|
||||
*/
|
||||
|
||||
public function couponInfo($dis){
|
||||
$data = Db::name($this->name)->where($dis)->find();
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
56
app/admin/model/Department.php
Normal file
56
app/admin/model/Department.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
class Department extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'department';
|
||||
protected $pk = 'department_id';
|
||||
|
||||
//初始化
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
//TODO:初始化内容
|
||||
}
|
||||
//新建部门
|
||||
public function createDepartment($data) {
|
||||
return $this->createRow($data);
|
||||
}
|
||||
//更新部门信息
|
||||
public function updateDepartment($filter ,$data) {
|
||||
return $this->updateRow($filter ,$data);
|
||||
}
|
||||
//删除部门信息
|
||||
public function delDepartment($filter) {
|
||||
return $this->delRow($filter);
|
||||
}
|
||||
//获取部门信息
|
||||
public function getDepartment($filter) {
|
||||
return $this->getRow($filter);
|
||||
}
|
||||
//获取部门列表信息
|
||||
public function listDepartment($filter ,$page_config = ['page' => 1 ,'page_count' => 20]) {
|
||||
$filter['deleted'] = 0;
|
||||
$result = Db::name($this->name)
|
||||
->where($filter)
|
||||
->page($page_congig['page'] ,$page_config['page_count'])
|
||||
->select();
|
||||
}
|
||||
//获取部门列表总数
|
||||
public function listDepartmentCount($filter) {
|
||||
$filter['deleted'] = 0;
|
||||
$result = Db::name($this->name)
|
||||
->where($filter)
|
||||
->count();
|
||||
}
|
||||
//获取所有部门列表信息
|
||||
public function listDepartmentAll($filter) {
|
||||
return $this->listRow($filter);
|
||||
}
|
||||
}
|
||||
68
app/admin/model/Goods.php
Normal file
68
app/admin/model/Goods.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class Goods extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_card_goods';
|
||||
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
//TODO:初始化内容
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品列表
|
||||
*/
|
||||
public function goodList($dis,$page=10){
|
||||
$data = self::where($dis)->paginate($page)->toArray();
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品
|
||||
*/
|
||||
|
||||
public function goodsUpdate($dis,$data){
|
||||
$data['update_time'] = time();
|
||||
$res = self::where($dis)->update($data);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 添加商品
|
||||
*/
|
||||
|
||||
public function goodsAdd($data){
|
||||
$data['create_time'] = time();
|
||||
$res = self::insert($data);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品详情
|
||||
*/
|
||||
|
||||
public function goodsInfo($dis){
|
||||
$data = self::where($dis)->find();
|
||||
return !empty($data)?$data->toArray():$data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有分类
|
||||
*/
|
||||
public function goodsSelect($dis){
|
||||
$data = self::where($dis)->select();
|
||||
return !empty($data)?$data->toArray():$data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
23
app/admin/model/Menu.php
Normal file
23
app/admin/model/Menu.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
class Menu extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_menu';
|
||||
//初始化
|
||||
// function __construct() {
|
||||
// parent::__construct();
|
||||
// }
|
||||
|
||||
//获取菜单列表
|
||||
function listMenu($filter) {
|
||||
$filter['deleted'] = 0;
|
||||
$result = $this->where($filter)
|
||||
->select();
|
||||
if(!empty($result)) $result = $result->toArray();
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
54
app/admin/model/Module.php
Normal file
54
app/admin/model/Module.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
class Module extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_module';
|
||||
//pk
|
||||
protected $pk = 'module_id';
|
||||
//初始化
|
||||
// function __construct() {
|
||||
// parent::__construct();
|
||||
// }
|
||||
|
||||
//权限关联
|
||||
public function menu()
|
||||
{
|
||||
return $this->hasMany('menu' , 'module_id' ,'module_id');
|
||||
}
|
||||
//模块与app之间的关系
|
||||
public function moduleApp()
|
||||
{
|
||||
return $this->hasOne('moduleApp' ,'module_id' ,'module_id');
|
||||
}
|
||||
//获取模块列表
|
||||
public function listModuleAll($filter ,$uniacid = '7777')
|
||||
{
|
||||
$filter['deleted'] = 0;
|
||||
$result = $this->with(['moduleApp' => function($query) use ($uniacid) {
|
||||
$query->where(['deleted' => 0 ,'uniacid' => $uniacid]);
|
||||
}])
|
||||
->where($filter)
|
||||
->select();
|
||||
if(!empty($result)) $result = $result->toArray();
|
||||
return $result;
|
||||
}
|
||||
public function getModule($filter ,$uniacid = '7777')
|
||||
{
|
||||
$filter['deleted'] = 0;
|
||||
$result = $this->with(['moduleApp' => function($query) use ($uniacid) {
|
||||
$query->where(['deleted' => 0 ,'uniacid' => $uniacid]);
|
||||
}])
|
||||
->where($filter)
|
||||
->find();
|
||||
if(!empty($result)) $result = $result->toArray();
|
||||
return $result;
|
||||
}
|
||||
//获取模块列表(分页)
|
||||
public function listModule() {
|
||||
|
||||
}
|
||||
}
|
||||
67
app/admin/model/OssConfig.php
Normal file
67
app/admin/model/OssConfig.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
class OssConfig extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'lbfarm_oos_config';
|
||||
|
||||
//创建
|
||||
public function createConfig($data)
|
||||
{
|
||||
$data['create_time'] = time();
|
||||
$data['open_oss'] = 0;
|
||||
$result = $this->save($data);
|
||||
if(empty($result)) return false;
|
||||
return true;
|
||||
}
|
||||
//修改
|
||||
public function updateConfig($filter ,$data)
|
||||
{
|
||||
$filter['deleted'] = 0;
|
||||
$data['update_time'] = time();
|
||||
$result = $this->where($filter)->update($data);
|
||||
if(empty($result)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//获取列表
|
||||
public function listConfig($filter)
|
||||
{
|
||||
$filter['deleted'] = 0;
|
||||
$result = $this->where($filter)->select();
|
||||
if(!empty($result)) $result->toArray();
|
||||
return $result;
|
||||
}
|
||||
//获取总数
|
||||
public function listConfigCount($filter)
|
||||
{
|
||||
$filter['deleted'] = 0;
|
||||
$result = $this->where($filter)->count();
|
||||
return $result;
|
||||
}
|
||||
|
||||
//获取单条数据
|
||||
public function getConfig($filter)
|
||||
{
|
||||
$filter['deleted'] = 0;
|
||||
$result = $this->where($filter)->find();
|
||||
if(!empty($result)) $result = $result->toArray();
|
||||
return $result;
|
||||
}
|
||||
|
||||
//删除
|
||||
public function delConfig($filter)
|
||||
{
|
||||
$filter['deleted'] = 0;
|
||||
return $this->updateConfig($filter ,['deleted' => 0 ,'delete_time' => time()]);
|
||||
}
|
||||
//删除(真删除)
|
||||
public function destoryConfig($filter)
|
||||
{
|
||||
return $this->where($filter)->delete();
|
||||
}
|
||||
|
||||
}
|
||||
58
app/admin/model/Role.php
Normal file
58
app/admin/model/Role.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
|
||||
class Role extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'role';
|
||||
protected $pk = 'role_id';
|
||||
protected $schema = [
|
||||
'role_id' => 'string',
|
||||
'role_name' => 'string',
|
||||
'is_system' => 'int',
|
||||
'description' => 'string',
|
||||
'create_time' => 'int',
|
||||
'uniacid' => 'int',
|
||||
'update_time' => 'int',
|
||||
'deleted' => 'int'
|
||||
];
|
||||
protected $resultSetType = 'array';
|
||||
//初始化
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
//TODO:初始化内容
|
||||
}
|
||||
//用户关联绑定
|
||||
public function user() {
|
||||
return $this->belongsTo('AdminUser' ,'role_id' ,'role_id');
|
||||
}
|
||||
|
||||
|
||||
//获取权限信息
|
||||
public function getRole($filter) {
|
||||
return $this->getRow($filter);
|
||||
}
|
||||
//获取权限列表
|
||||
public function listRoleAll($filter) {
|
||||
// return $this->select($filter);
|
||||
return $this->listRow($filter ,['role_id' ,'role_name' ,'is_system' ,'description' ,'deleted']);
|
||||
}
|
||||
//创建权限
|
||||
public function createRole($data) {
|
||||
return $this->createRow($data);
|
||||
}
|
||||
//更新权限
|
||||
public function updateRole($filter ,$data) {
|
||||
return $this->updateRow($filter ,$data);
|
||||
}
|
||||
//删除权限
|
||||
public function deleteRole($filter) {
|
||||
return $this->deleteRow($filter);
|
||||
}
|
||||
}
|
||||
51
app/admin/model/SellingProfit.php
Normal file
51
app/admin/model/SellingProfit.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
use app\admin\model\ShopOrderGoods;
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
|
||||
class SellingProfit extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_card_selling_profit';
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
//TODO:初始化内容
|
||||
}
|
||||
/**
|
||||
* @param $dis
|
||||
* @param int $page
|
||||
* @return mixed
|
||||
* 获取分销列表
|
||||
*/
|
||||
public function profitList($dis,$page = 10) {
|
||||
$data = Db::name($this->name)
|
||||
->alias('a')
|
||||
->leftJoin('longbing_card_user b' ,'a.user_id = b.id')
|
||||
->leftJoin('longbing_card_user_info c' ,'a.user_id = c.fans_id')
|
||||
->where($dis)
|
||||
->field(['a.*' ,'b.nickName','c.name'])
|
||||
->order('a.total_profit desc','a.id decs')
|
||||
->paginate($page)
|
||||
->toArray();
|
||||
return $data;
|
||||
}
|
||||
/**
|
||||
* @param $dis
|
||||
* @param $data
|
||||
* @return int
|
||||
* 修改商城配置
|
||||
*/
|
||||
public function configUpdate($dis,$data){
|
||||
$data['update_time'] = time();
|
||||
$res = self::where($dis)->update($data);
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
68
app/admin/model/ShopBanner.php
Normal file
68
app/admin/model/ShopBanner.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
use app\admin\model\ShopOrderGoods;
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class ShopBanner extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_card_shop_carousel';
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
//TODO:初始化内容
|
||||
}
|
||||
/**
|
||||
* @param $dis
|
||||
* @param int $page
|
||||
* @return mixed
|
||||
* 获取商城轮播图列表
|
||||
*/
|
||||
public function bannerList($dis,$page=10){
|
||||
$data = self::where($dis)->paginate($page)->toArray();
|
||||
return $data;
|
||||
}
|
||||
/**
|
||||
* @param $dis
|
||||
* @param $data
|
||||
* @return int
|
||||
* 修改商城轮播图
|
||||
*/
|
||||
public function bannerUpdate($dis,$data){
|
||||
$data['update_time'] = time();
|
||||
$res = self::where($dis)->update($data);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* 添加商城轮播图
|
||||
*/
|
||||
public function bannerAdd($data){
|
||||
$data['create_time'] = time();
|
||||
$res = self::insert($data);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $dis
|
||||
* 删除商城轮播图
|
||||
*/
|
||||
|
||||
public function bannerDel($dis){
|
||||
$res = self::where($dis)->delete();
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $dis
|
||||
* 轮播图详情
|
||||
*/
|
||||
public function bannerInfo($dis){
|
||||
$data = self::where($dis)->find();
|
||||
return !empty($data)?$data->toArray():$data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
73
app/admin/model/ShopOrder.php
Normal file
73
app/admin/model/ShopOrder.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
use app\admin\model\ShopOrderGoods;
|
||||
|
||||
|
||||
|
||||
class ShopOrder extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_card_shop_order';
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
//TODO:初始化内容
|
||||
}
|
||||
protected $append = [
|
||||
'goods_text',
|
||||
];
|
||||
/**
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return mixed
|
||||
* 查询器 获取子订单
|
||||
*/
|
||||
public function getGoodsTextAttr($value,$data)
|
||||
{
|
||||
$orer_goods = new ShopOrderGoods();
|
||||
$dis['order_id'] = $data['id'];
|
||||
return $orer_goods->orderGoodsInfo($dis);
|
||||
}
|
||||
/**
|
||||
* @param $dis
|
||||
* @param int $page
|
||||
* @return mixed
|
||||
* 获取订单列表
|
||||
*/
|
||||
public function orderList($dis,$page=10){
|
||||
$data = self::where($dis)->paginate($page)->toArray();
|
||||
return $data;
|
||||
}
|
||||
/**
|
||||
* @param $dis
|
||||
* @param $data
|
||||
* @return int
|
||||
* 修改订单
|
||||
*/
|
||||
|
||||
public function orderUpdate($dis,$data){
|
||||
$data['update_time'] = time();
|
||||
$res = self::where($dis)->update($data);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $dis
|
||||
* @return mixed
|
||||
* 获取订单详情
|
||||
*/
|
||||
|
||||
public function orderInfo($dis,$field='*'){
|
||||
$data = self::where($dis)->field($field)->find();
|
||||
return !empty($data)?$data->toArray():$data;
|
||||
}
|
||||
|
||||
//查询公司的金额
|
||||
public function getCompanyPrice($company_id,$start,$end){
|
||||
return $this->whereIn('company_id',$company_id)->whereBetween('create_time',[$start,$end])->where('pay_status',1)->where('order_status',3)->sum('total_price');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
33
app/admin/model/ShopOrderGoods.php
Normal file
33
app/admin/model/ShopOrderGoods.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
class ShopOrderGoods extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_card_shop_order_item';
|
||||
|
||||
//初始化
|
||||
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
//TODO:初始化内容
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 获取自订单详情
|
||||
*/
|
||||
public function orderGoodsInfo($dis){
|
||||
return self::where($dis)->select()->toArray();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
94
app/admin/model/ShopOrderRefund.php
Normal file
94
app/admin/model/ShopOrderRefund.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
use app\admin\model\ShopOrderGoods;
|
||||
use app\admin\model\ShopOrder;
|
||||
|
||||
|
||||
|
||||
class ShopOrderRefund extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'card_shop_order_refund';
|
||||
protected $orer_goods_model;
|
||||
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
//TODO:初始化内容
|
||||
}
|
||||
protected $append = [
|
||||
'goods_text',
|
||||
'order_text'
|
||||
];
|
||||
/**
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return mixed
|
||||
* 获取器 获取子订单
|
||||
*/
|
||||
public function getGoodsTextAttr($value,$data){
|
||||
$orer_goods_model = new ShopOrderGoods();
|
||||
$dis = !empty($data['order_goods_id'])?['id'=>$data['order_goods_id']]:['order_id'=>$data['order_id']];
|
||||
return $orer_goods_model->orderGoodsInfo($dis);
|
||||
}
|
||||
/**
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return mixed
|
||||
* 获取器 获取订单
|
||||
*/
|
||||
public function getOrderTextAttr($value,$data){
|
||||
$orer_model = new ShopOrder();
|
||||
$dis['id'] = $data['order_id'];
|
||||
// $field = ''
|
||||
return $orer_model->orderInfo($dis);
|
||||
|
||||
}
|
||||
/**
|
||||
* 获取订单列表
|
||||
*/
|
||||
public function refundList($dis,$page=10){
|
||||
$data = self::where($dis)->paginate($page)->toArray();
|
||||
$data['data'] = $this->changeInfo($data['data']);
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改订单
|
||||
*/
|
||||
|
||||
public function refundUpdate($dis,$data){
|
||||
$data['update_time'] = time();
|
||||
$res = Db::name($this->name)->where($dis)->update($data);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单详情
|
||||
*/
|
||||
|
||||
public function refundInfo($dis){
|
||||
$data = self::where($dis)->find()->toArray();
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* 转换数据
|
||||
*/
|
||||
public function changeInfo($data){
|
||||
if(!empty($data)){
|
||||
foreach ($data as &$v){
|
||||
$v['price'] = empty($v['price'])?$v['order_text']['price']:$v['price'];
|
||||
$v['goods_text'][0]['number'] = !empty($v['number'])?$v['number']:$v['goods_text'][0]['number'];
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
43
app/admin/model/ShopSetting.php
Normal file
43
app/admin/model/ShopSetting.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
use app\admin\model\ShopOrderGoods;
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
|
||||
class ShopSetting extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_card_config';
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
//TODO:初始化内容
|
||||
}
|
||||
/**
|
||||
* @param $dis
|
||||
* @param int $page
|
||||
* @return mixed
|
||||
* 获取商城配置
|
||||
*/
|
||||
public function configInfo($dis){
|
||||
$data = self::where($dis)->find();
|
||||
return !empty($data)?$data->toArray():$data;
|
||||
}
|
||||
/**
|
||||
* @param $dis
|
||||
* @param $data
|
||||
* @return int
|
||||
* 修改商城配置
|
||||
*/
|
||||
public function configUpdate($dis,$data){
|
||||
$data['update_time'] = time();
|
||||
$res = self::where($dis)->update($data);
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
101
app/admin/model/ShopType.php
Normal file
101
app/admin/model/ShopType.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class ShopType extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_card_shop_type';
|
||||
// protected $pk = 'role_id';
|
||||
protected $schema = [
|
||||
|
||||
];
|
||||
protected $resultSetType = 'array';
|
||||
//初始化
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
//TODO:初始化内容
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品列表
|
||||
*/
|
||||
public function cateList($dis,$page=10){
|
||||
$data = Db::name($this->name)->where($dis)->paginate($page)->toArray();
|
||||
return $this->getTree($data['data'],0);
|
||||
}
|
||||
/**
|
||||
* @param $data
|
||||
* @param $pId
|
||||
* @return array
|
||||
* 递归无限极
|
||||
*/
|
||||
public function getTree($data, $pId){
|
||||
$tree = array();
|
||||
if(!empty($data)){
|
||||
foreach($data as $k => $v) {
|
||||
if($v['pid'] == $pId) {
|
||||
$v[''] = $this->getTree($data, $v['id']);
|
||||
$tree[] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $tree;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改分类
|
||||
*/
|
||||
public function cateUpdate($dis,$data){
|
||||
$data['update_time'] = time();
|
||||
$res = Db::name($this->name)->where($dis)->update($data);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 添加分类
|
||||
*/
|
||||
|
||||
public function cateAdd($data){
|
||||
$data['create_time'] = time();
|
||||
$res = Db::name($this->name)->insert($data);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分类详情
|
||||
*/
|
||||
|
||||
public function cateInfo($dis){
|
||||
$data = Db::name($this->name)->where($dis)->find();
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询分类
|
||||
*/
|
||||
public function catSelect($dis=array()){
|
||||
$data = Db::name($this->name)->where($dis)->select();
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 排序好的分类
|
||||
*/
|
||||
|
||||
public function catSortSelect($dis=array()){
|
||||
$data = Db::name($this->name)->where($dis)->select();
|
||||
return $this->getTree($data,0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
101
app/admin/model/User.php
Normal file
101
app/admin/model/User.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
class User extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'user';
|
||||
//初始化
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
//权限关联
|
||||
public function role()
|
||||
{
|
||||
return $this->hasOne('Role' , 'role_id' ,'role_id');
|
||||
}
|
||||
|
||||
//获取用户信息
|
||||
public function getUser($filter) {
|
||||
$user = Db::name($this->name)
|
||||
->where(['deleted' => 0])
|
||||
->where($filter)
|
||||
->find();
|
||||
if(isset($user['user_id'])){
|
||||
$user['role'] = Db::name('user_role')
|
||||
->alias('ur')
|
||||
->leftJoin('role role' ,'ur.role_id = role.role_id')
|
||||
->where(['role.deleted' => 0 ,'ur.deleted' => 0])
|
||||
->where(['ur.user_id' => $user['user_id']])
|
||||
->field(['role.role_name' ,'role.role_id'])
|
||||
->select();
|
||||
}
|
||||
return $user;
|
||||
}
|
||||
//获取所有用户
|
||||
public function listUserAll($filter) {
|
||||
$users = Db::name($this->name)
|
||||
->alias('user')
|
||||
->leftJoin('department dp' ,'user.department_id = dp.department_id')
|
||||
->where(['user.deleted' => 0 ,'dp.deleted' => 0])
|
||||
->where($filter)
|
||||
->field(['user.*' ,'dp.department_name'])
|
||||
->select();
|
||||
// ->leftJoin('role role' ,'user.role_id = role.role_id')
|
||||
// ->where(['user.deleted' => 0 ,'role.deleted' => 0])
|
||||
// ->where($filter)
|
||||
// ->field(['user.*' ,'role.role_name'])
|
||||
// ->select();
|
||||
return $users;
|
||||
}
|
||||
//获取用户列表
|
||||
public function listUser($filter ,$page_config = ['page' => 1 ,'page_count' => 10]) {
|
||||
// $start_row = ($page_config['page'] - 1) * $page_config['page_count'];
|
||||
// $end_row = $page_config['page'] * $page_config['page_count'];
|
||||
$users = Db::name($this->name)
|
||||
->alias('user')
|
||||
// ->leftJoin('role role' ,'user.role_id = role.role_id')
|
||||
// ->where(['user.deleted' => 0 ,'role.deleted' => 0])
|
||||
// ->where($filter)
|
||||
// ->field(['user.*' ,'role.role_name'])
|
||||
->leftJoin('department dp' ,'user.department_id = dp.department_id')
|
||||
->where(['user.deleted' => 0 ,'dp.deleted' => 0])
|
||||
->where($filter)
|
||||
->field(['user.id' ,'dp.department_name'])
|
||||
->page($page_config['page'] ,$page_config['page_count'])
|
||||
->select();
|
||||
return $users;
|
||||
}
|
||||
//获取用户总数
|
||||
public function listUserCount($filter) {
|
||||
return $users = Db::name($this->name)
|
||||
->alias('user')
|
||||
// ->leftJoin('role role' ,'user.role_id = role.role_id')
|
||||
// ->where(['user.deleted' => 0 ,'role.deleted' => 0])
|
||||
// ->where($filter)
|
||||
// ->field(['user.*' ,'role.role_name'])
|
||||
->leftJoin('department dp' ,'user.department_id = dp.department_id')
|
||||
->where(['user.deleted' => 0 ,'dp.deleted' => 0])
|
||||
->where($filter)
|
||||
->field(['user.id'])
|
||||
->count();
|
||||
}
|
||||
|
||||
//创建用户
|
||||
public function createUser($data) {
|
||||
return $this->createRow($data);
|
||||
}
|
||||
|
||||
//修改用户
|
||||
public function updateUser($filter ,$data) {
|
||||
return $this->updateRow($filter ,$data);
|
||||
}
|
||||
|
||||
//删除用户
|
||||
public function delUser($filter) {
|
||||
return $this->deleteRow($filter);
|
||||
}
|
||||
}
|
||||
66
app/admin/model/WxUpload.php
Normal file
66
app/admin/model/WxUpload.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\Model;
|
||||
|
||||
|
||||
|
||||
class WxUpload extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_card_wx_upload';
|
||||
|
||||
protected $resultSetType = 'collection';
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-03-18 12:23
|
||||
* @功能说明:查找配置
|
||||
*/
|
||||
public function settingInfo($dis,$field='*'){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
if(empty($data)){
|
||||
|
||||
$this->insert($dis);
|
||||
}
|
||||
|
||||
return $this->where($dis)->field($field)->find()->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-06-08 18:49
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function settingAdd($data){
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-03-18 12:24
|
||||
* @功能说明:配置编辑
|
||||
*/
|
||||
public function settingUpdate($dis,$data){
|
||||
|
||||
$data['app_id'] = !empty($data['app_id'])?implode(',',$data['app_id']):'';
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
19
app/admin/model/moduleApp.php
Normal file
19
app/admin/model/moduleApp.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
class ModuleApp extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_module_app';
|
||||
//初始化
|
||||
// function __construct() {
|
||||
// parent::__construct();
|
||||
// }
|
||||
|
||||
//关联信息
|
||||
public function Module(){
|
||||
return $this->belongsTo('Module' ,'module_id' ,'module_id');
|
||||
}
|
||||
}
|
||||
5
app/admin/provider.php
Normal file
5
app/admin/provider.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
// 这是系统自动生成的admin应用provider定义文件
|
||||
return [
|
||||
|
||||
];
|
||||
110
app/admin/route/route.php
Normal file
110
app/admin/route/route.php
Normal file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
use think\facade\Route;
|
||||
/**
|
||||
* @model admin
|
||||
* @author yangqi
|
||||
* @create time 2019年11月25日23:09:59
|
||||
*
|
||||
*/
|
||||
|
||||
Route::group('admin' ,function() {
|
||||
//系统设置
|
||||
Route::group('config' ,function(){
|
||||
//获取底部菜单信息
|
||||
Route::get('getTabbar' ,'Config/getTabbar');
|
||||
//设置底部菜单
|
||||
Route::post('setTabbar' ,'Config/setTabbar');
|
||||
//设置小程序
|
||||
Route::post('setAppConfig' ,'Config/setAppConfig');
|
||||
//获取小程序设置
|
||||
Route::get('getAppConfig' ,'Config/getAppConfig');
|
||||
//获取模版消息配置
|
||||
// Route::post('test' ,'Config/test');
|
||||
|
||||
Route::get('test' ,'Config/test');
|
||||
//自动同步小程序模信息
|
||||
Route::get('async' ,'Config/autoServiceNoticeTemplate');
|
||||
//清除缓存
|
||||
Route::get('clear' ,'Config/clearCache');
|
||||
//获取上传配置
|
||||
Route::get('getOssConfig' ,'Config/getOssConfig');
|
||||
//更新上传配置
|
||||
Route::post('updateOssConfig' ,'Config/updateOssConfig');
|
||||
//微信上传配置详情
|
||||
Route::get('wxUploadInfo' ,'Config/wxUploadInfo');
|
||||
//微信上传配置修改
|
||||
Route::post('wxUploadUpdate' ,'Config/wxUploadUpdate');
|
||||
//上传小程序
|
||||
Route::post('uploadWxapp' ,'AppUpgrade/uploadWxapp');
|
||||
//小程序版本信息
|
||||
Route::post('wxappVersion' ,'AppUpgrade/getWxappVersion');
|
||||
});
|
||||
//文件处理
|
||||
Route::group('file' ,function() {
|
||||
//创建分组
|
||||
Route::post('createGroup' ,'File/createGroup');
|
||||
//获取分组列表
|
||||
Route::get('listGroup' ,'File/listGroup');
|
||||
//更新分组
|
||||
Route::post('updateGroup' ,'File/updateGroup');
|
||||
//删除分组
|
||||
Route::post('delGroup' ,'File/delGroup');
|
||||
Route::post('delAllGroup' ,'File/delAllGroup');
|
||||
|
||||
//上传文件
|
||||
Route::post('uploadFiles' ,'File/uploadFiles');
|
||||
|
||||
//上传文件
|
||||
Route::post('uploadFile' ,'File/uploadFile');
|
||||
|
||||
Route::get('uploadConfig' ,'File/uploadConfig');
|
||||
|
||||
Route::post('addFile' ,'File/addFile');
|
||||
//获取文件列表
|
||||
Route::get('listFile' ,'File/listFile');
|
||||
//获取文件
|
||||
Route::get('getFile/:file_id', 'File/getFile');
|
||||
//删除文件
|
||||
Route::post('delFile' ,'File/delFile');
|
||||
|
||||
//移动分组(file_id 一维数组可批量传,group_id:分组id)
|
||||
Route::post('moveGroup' ,'File/moveGroup');
|
||||
});
|
||||
|
||||
|
||||
//更新后台模块数据信息
|
||||
Route::get('updateModel' ,'Update/update');
|
||||
|
||||
Route::get('checkAuth' ,'Admin/checkAuth');
|
||||
|
||||
Route::get('giveAuth' ,'Admin/giveAuth');
|
||||
|
||||
Route::get('isSaas' ,'Admin/isSaas');
|
||||
|
||||
});
|
||||
|
||||
Route::group('app' ,function() {
|
||||
//获取底部菜单
|
||||
Route::get('getTabbar' ,'Wx/getTabbar');
|
||||
Route::group('wx' ,function() {
|
||||
//上传文件
|
||||
Route::post('uploadFiles' ,'WxFile/uploadFiles');
|
||||
Route::post('uploadFile' ,'WxFile/uploadFile');
|
||||
Route::get('getTabbar' ,'Wx/getTabbar');
|
||||
});
|
||||
});
|
||||
//获取底部菜单
|
||||
Route::get('getTabbar' ,'Wx/getTabbar');
|
||||
Route::group('wx' ,function() {
|
||||
//上传文件
|
||||
Route::post('uploadFiles' ,'WxFile/uploadFiles');
|
||||
Route::post('uploadFile' ,'WxFile/uploadFile');
|
||||
Route::get('getTabbar' ,'Wx/getTabbar');
|
||||
});
|
||||
//By.jingshuixian 跳转代理管理端
|
||||
Route::get('', function (){
|
||||
|
||||
header('Location:'. '/agent/index');
|
||||
header('Refresh: ');
|
||||
|
||||
});
|
||||
207
app/admin/service/UpdateService.php
Normal file
207
app/admin/service/UpdateService.php
Normal file
@@ -0,0 +1,207 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | Longbing [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright Chengdu longbing Technology Co., Ltd.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Website http://longbing.org/
|
||||
// +----------------------------------------------------------------------
|
||||
// | Sales manager: +86-13558882532 / +86-13330887474
|
||||
// | Technical support: +86-15680635005
|
||||
// | After-sale service: +86-17361005938
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\admin\service;
|
||||
use app\Common\model\LongbingWeqingWxApp as WxAppWeqingWxApp;
|
||||
use app\admin\model\AppConfig;
|
||||
use app\admin\model\OssConfig;
|
||||
use app\admin\model\AppTabbar;
|
||||
|
||||
use longbingcore\permissions\AdminMenu;
|
||||
use think\facade\Db;
|
||||
|
||||
class UpdateService
|
||||
{
|
||||
|
||||
/**
|
||||
* 安装脚本
|
||||
*
|
||||
* @param $_uniacid
|
||||
* @author shuixian
|
||||
* @DataTime: 2020/1/4 9:40
|
||||
*/
|
||||
public static function installSql($_uniacid,$type=1){
|
||||
|
||||
//打算进入首页时,自动初始化和安装系统,不在外面进行安装
|
||||
//可以根据当前的版本号创建锁定文件,不用每次都执行
|
||||
|
||||
|
||||
//执行SQL
|
||||
/*$updateSqlData = longbing_init_info_data('UpdateSql');
|
||||
|
||||
foreach ($updateSqlData as $sql ){
|
||||
Db::query($sql) ;
|
||||
}*/
|
||||
|
||||
//更加配置模块,自动载入php
|
||||
$myModelList = config('app.AdminModelList');
|
||||
|
||||
$myModelList = $myModelList['saas_auth_admin_model_list'];
|
||||
|
||||
//$myModelList = AdminMenu::getAuthList($_uniacid);
|
||||
|
||||
//1.筛选权限模块
|
||||
//2.加载权限执行脚本
|
||||
//3.判断升级脚本是否存在
|
||||
//4.判断是否升级过了,版本号是否正确 (UpdateSql.lock)
|
||||
// var_dump($myModelList); exit;
|
||||
foreach ($myModelList as $model_name => $model_item ) {
|
||||
$updateSqlPath = APP_PATH . $model_name . '/info/UpdateSql.php' ;
|
||||
$lockPath = APP_PATH . $model_name . '/info/UpdateSql.lock' ;
|
||||
$infoPath = APP_PATH . $model_name . '/info/Info.php' ;
|
||||
$infoData = include $infoPath ;
|
||||
|
||||
$isUpdate = false ;
|
||||
$nowVersion = array_key_exists('version',$infoData) ? $infoData['version'] : '0.0.0';
|
||||
if(file_exists($lockPath)){ // 有锁定文件,需要进一步判断模块版本号
|
||||
|
||||
$lockVersion = file_get_contents($lockPath); //读取锁定文件版本号
|
||||
$isUpdate = longbing_compare_version($lockVersion, $nowVersion) ? true : false ;
|
||||
|
||||
}else{
|
||||
//锁定文件不存在,直接升级
|
||||
$isUpdate = true ;
|
||||
}
|
||||
|
||||
if($type==2){
|
||||
|
||||
$isUpdate = true ;
|
||||
|
||||
}
|
||||
|
||||
if($isUpdate && file_exists($updateSqlPath)){
|
||||
$sql = include $updateSqlPath ;
|
||||
$sql = str_replace(PHP_EOL, '', $sql);
|
||||
$sqlArray = explode(';', $sql);
|
||||
foreach ($sqlArray as $_value) {
|
||||
if(!empty($_value)){
|
||||
|
||||
try{
|
||||
Db::query($_value) ;
|
||||
}catch (\Exception $e){
|
||||
if (!APP_DEBUG){
|
||||
//echo '操作失败: '.$_value . '<br> <br>' ;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//调试模式下,不写入锁定文件 ,方便调试
|
||||
if (!APP_DEBUG){
|
||||
file_put_contents($lockPath , $nowVersion) ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化微擎数据
|
||||
*
|
||||
* @author shuixian
|
||||
* @DataTime: 2020/1/4 9:42
|
||||
*/
|
||||
public static function initWeiqinConfigData(){
|
||||
if(longbingIsWeiqin())
|
||||
{
|
||||
//获取uniacid
|
||||
global $_GPC, $_W;
|
||||
$uniacid = $_W[ 'uniacid' ];
|
||||
if(!empty($uniacid))
|
||||
{
|
||||
//获取数据
|
||||
//获取config
|
||||
$app_config = longbingGetAppConfig($uniacid);
|
||||
//判断config是否存在或者是否同步
|
||||
if(empty($app_config) || empty($app_config['is_sync']))
|
||||
{
|
||||
//获取微擎配置
|
||||
$weiqing_wx_app_model = new WxAppWeqingWxApp();
|
||||
$weiqing_wx_app = $weiqing_wx_app_model->getApp(['uniacid' => $uniacid]);
|
||||
// var_dump($weiqing_wx_app);die;
|
||||
if(!empty($weiqing_wx_app))
|
||||
{
|
||||
$data = ['is_sync' => 1];
|
||||
if(isset($weiqing_wx_app['key']) && !empty($weiqing_wx_app['key'])) $data['appid'] = $weiqing_wx_app['key'];
|
||||
if(isset($weiqing_wx_app['secret']) && !empty($weiqing_wx_app['secret'])) $data['app_secret'] = $weiqing_wx_app['secret'];
|
||||
if(isset($weiqing_wx_app['name']) && !empty($weiqing_wx_app['name'])) $data['mini_app_name'] = $weiqing_wx_app['name'];
|
||||
$app_config_model = new AppConfig();
|
||||
if(empty($app_config))
|
||||
{
|
||||
$data['uniacid'] = $uniacid;
|
||||
$data['force_phone'] = 0;
|
||||
$app_config_model->createConfig($data);
|
||||
}else{
|
||||
$app_config_model->updateConfig(['uniacid' => $uniacid],$data);
|
||||
}
|
||||
longbingGetAppConfig($uniacid ,true);
|
||||
}
|
||||
}
|
||||
//同步存储设置
|
||||
$oss_config = longbingGetOssConfig($uniacid);
|
||||
if(empty($oss_config) || empty($oss_config['is_sync'])){
|
||||
$weiqing_oss = null;
|
||||
if(isset($_W['setting']['remote_complete_info'][$_W['uniacid']])) $weiqing_oss = $_W['setting']['remote_complete_info'][$_W['uniacid']];
|
||||
if(empty($weiqing_oss) && isset($_W['setting']['remote_complete_info'])) $weiqing_oss = $_W['setting']['remote_complete_info'];
|
||||
if(!empty($weiqing_oss))
|
||||
{
|
||||
$data = ['is_sync' => 1];
|
||||
if(isset($weiqing_oss['qiniu'])){
|
||||
$data['open_oss'] = 2;
|
||||
if(isset($weiqing_oss['qiniu']['accesskey']) && !empty($weiqing_oss['qiniu']['accesskey'])) $data['qiniu_accesskey'] = $weiqing_oss['qiniu']['accesskey'];
|
||||
if(isset($weiqing_oss['qiniu']['secretkey']) && !empty($weiqing_oss['qiniu']['secretkey'])) $data['qiniu_secretkey'] = $weiqing_oss['qiniu']['secretkey'];
|
||||
if(isset($weiqing_oss['qiniu']['bucket']) && !empty($weiqing_oss['qiniu']['bucket'])) $data['qiniu_bucket'] = $weiqing_oss['qiniu']['bucket'];
|
||||
if(isset($weiqing_oss['qiniu']['url']) && !empty($weiqing_oss['qiniu']['url'])) $data['qiniu_yuming'] = $weiqing_oss['qiniu']['url'];
|
||||
}
|
||||
$oss_config_model = new OssConfig();
|
||||
if(empty($oss_config))
|
||||
{
|
||||
$data['uniacid'] = $uniacid;
|
||||
$oss_config_model->createConfig($data);
|
||||
}else{
|
||||
$oss_config_model->updateConfig(['uniacid' => $uniacid] ,$data);
|
||||
}
|
||||
longbingGetOssConfig($uniacid ,true);
|
||||
}
|
||||
}
|
||||
//初始化地步菜单
|
||||
/*$tabbars = longbingGetAppTabbar($uniacid);
|
||||
if(empty($tabbars))
|
||||
{
|
||||
$tabbar_model = new AppTabbar();
|
||||
$data = array(
|
||||
'uniacid' => $uniacid,
|
||||
'menu2_is_hide' => 0,
|
||||
'menu3_is_hide' => 0,
|
||||
'menu4_is_hide' => 0,
|
||||
'menu_activity_is_show' => 0,
|
||||
'menu_house_is_show' => 0,
|
||||
'menu_appoint_is_hide' => 0
|
||||
);
|
||||
$tabbar_model->createTabbar($data);
|
||||
$tabbars = longbingGetAppTabbar($uniacid ,true);
|
||||
}*/
|
||||
longbingGetCompanyConfig($uniacid);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user