You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
BIN
hyhproject/.DS_Store
vendored
Executable file
BIN
hyhproject/.DS_Store
vendored
Executable file
Binary file not shown.
BIN
hyhproject/._.DS_Store
Executable file
BIN
hyhproject/._.DS_Store
Executable file
Binary file not shown.
4
hyhproject/.htaccess
Executable file
4
hyhproject/.htaccess
Executable file
@ -0,0 +1,4 @@
|
||||
<FilesMatch (.*)\.(html|php)$>
|
||||
order allow,deny
|
||||
deny from all
|
||||
</FilesMatch>
|
BIN
hyhproject/admin/.DS_Store
vendored
Executable file
BIN
hyhproject/admin/.DS_Store
vendored
Executable file
Binary file not shown.
BIN
hyhproject/admin/._.DS_Store
Executable file
BIN
hyhproject/admin/._.DS_Store
Executable file
Binary file not shown.
12
hyhproject/admin/behavior/InitConfig.php
Executable file
12
hyhproject/admin/behavior/InitConfig.php
Executable file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
namespace wstmart\admin\behavior;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 初始化基础数据
|
||||
*/
|
||||
class InitConfig
|
||||
{
|
||||
public function run(&$params){
|
||||
WSTConf('listenUrl',WSTVisitPrivilege());
|
||||
}
|
||||
}
|
37
hyhproject/admin/behavior/ListenLoginStatus.php
Executable file
37
hyhproject/admin/behavior/ListenLoginStatus.php
Executable file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
namespace wstmart\admin\behavior;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 检测用户有没有登录
|
||||
*/
|
||||
class ListenLoginStatus
|
||||
{
|
||||
public function run(&$params){
|
||||
$STAFF = session('WST_STAFF');
|
||||
$allowUrl = ['admin/index/login',
|
||||
'admin/index/checklogin',
|
||||
'admin/index/logout',
|
||||
'admin/index/logout',
|
||||
'admin/index/getverify',
|
||||
'admin/cronjobs/autocancelnopay',
|
||||
'admin/cronjobs/autoappraise',
|
||||
'admin/cronjobs/autoreceive',
|
||||
'admin/cronjobs/autosendmsg'
|
||||
];
|
||||
$request = request();
|
||||
$visit = strtolower($request->module()."/".$request->controller()."/".$request->action());
|
||||
if(empty($STAFF) && !in_array($visit,$allowUrl)){
|
||||
if($request->isAjax()){
|
||||
echo json_encode(['status'=>-999,'msg'=>'对不起,您还没有登录,请先登录']);
|
||||
}else{
|
||||
if('quanlianggongmall' == input('key')){
|
||||
header("Location:".url('admin/index/login?key=quanlianggongmall'));
|
||||
}else{
|
||||
echo 'hello';
|
||||
}
|
||||
|
||||
}
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
24
hyhproject/admin/behavior/ListenOperate.php
Executable file
24
hyhproject/admin/behavior/ListenOperate.php
Executable file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace wstmart\admin\behavior;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 记录用户的访问日志
|
||||
*/
|
||||
class ListenOperate
|
||||
{
|
||||
public function run(&$params){
|
||||
$urls = WSTConf('listenUrl');
|
||||
$request = request();
|
||||
$visit = strtolower($request->module()."/".$request->controller()."/".$request->action());
|
||||
if(array_key_exists($visit,$urls)&& $visit!='admin/logoperates/pagequery'){
|
||||
$privilege = current($urls[$visit]);
|
||||
$data = [];
|
||||
$data['menuId'] = $privilege['menuId'];
|
||||
$data['operateUrl'] = $_SERVER['REQUEST_URI'];
|
||||
$data['operateDesc'] = $privilege['name'];
|
||||
$data['content'] = !empty($_REQUEST)?json_encode($_REQUEST):'';
|
||||
$data['operateIP'] = $request->ip();
|
||||
model('admin/LogOperates')->add($data);
|
||||
}
|
||||
}
|
||||
}
|
33
hyhproject/admin/behavior/ListenPrivilege.php
Executable file
33
hyhproject/admin/behavior/ListenPrivilege.php
Executable file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
namespace wstmart\admin\behavior;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 检测有没有访问权限
|
||||
*/
|
||||
class ListenPrivilege
|
||||
{
|
||||
public function run(&$params){
|
||||
$privileges = session('WST_STAFF.privileges');
|
||||
$staffId = (int)session('WST_STAFF.staffId');
|
||||
if($staffId!=1){
|
||||
$urls = WSTConf('listenUrl');
|
||||
$request = request();
|
||||
$visit = strtolower($request->module()."/".$request->controller()."/".$request->action());
|
||||
if(array_key_exists($visit,$urls) && !$this->checkUserCode($urls[$visit],$privileges)){
|
||||
if($request->isAjax()){
|
||||
echo json_encode(['status'=>-998,'msg'=>'对不起,您没有操作权限,请与管理员联系']);
|
||||
}else{
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
echo "对不起,您没有操作权限,请与管理员联系";
|
||||
}
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
private function checkUserCode($urlCodes,$userCodes){
|
||||
foreach ($urlCodes as $key => $value) {
|
||||
if(in_array($key,$userCodes))return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
58
hyhproject/admin/common/function.php
Executable file
58
hyhproject/admin/common/function.php
Executable file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
use think\Db;
|
||||
/**
|
||||
* ============================================================================
|
||||
*/
|
||||
/**
|
||||
* 加载系统访问路径
|
||||
*/
|
||||
function WSTVisitPrivilege(){
|
||||
$listenUrl = cache('WST_LISTEN_URL');
|
||||
if(!$listenUrl){
|
||||
$list = model('admin/Privileges')->getAllPrivileges();
|
||||
$listenUrl = [];
|
||||
foreach ($list as $v){
|
||||
if($v['privilegeUrl']=='')continue;
|
||||
$listenUrl[strtolower($v['privilegeUrl'])][$v['privilegeCode']] = ['code'=>$v['privilegeCode'],
|
||||
'url'=>strtolower($v['privilegeUrl']),
|
||||
'name'=>$v['privilegeName'],
|
||||
'isParent'=>true,
|
||||
'menuId'=>$v['menuId']
|
||||
];
|
||||
if(strpos($v['otherPrivilegeUrl'],'/')!==false){
|
||||
$t = explode(',',$v['otherPrivilegeUrl']);
|
||||
foreach ($t as $vv){
|
||||
if(strpos($vv,'/')!==false){
|
||||
$listenUrl[strtolower($vv)][$v['privilegeCode']] = ['code'=>$v['privilegeCode'],
|
||||
'url'=>strtolower($vv),
|
||||
'name'=>$v['privilegeName'],
|
||||
'isParent'=>false,
|
||||
'menuId'=>$v['menuId']
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cache('WST_LISTEN_URL',$listenUrl);
|
||||
}
|
||||
return $listenUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断有没有权限
|
||||
* @param $code 权限代码
|
||||
* @param $type 返回的类型 true-boolean false-string
|
||||
*/
|
||||
function WSTGrant($code){
|
||||
$STAFF = session("WST_STAFF");
|
||||
if(in_array($code,$STAFF['privileges']))return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信配置
|
||||
*/
|
||||
function WXAdmin(){
|
||||
$wechat = new \wechat\WSTWechat(WSTConf('CONF.wxAppId'),WSTConf('CONF.wxAppKey'));
|
||||
return $wechat;
|
||||
}
|
17
hyhproject/admin/conf/config.php
Executable file
17
hyhproject/admin/conf/config.php
Executable file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
return [
|
||||
'paginate' => [
|
||||
'type' => 'bootstrap',
|
||||
'var_page' => 'page',
|
||||
'list_rows' => 15,
|
||||
]
|
||||
];
|
BIN
hyhproject/admin/controller/.DS_Store
vendored
Executable file
BIN
hyhproject/admin/controller/.DS_Store
vendored
Executable file
Binary file not shown.
BIN
hyhproject/admin/controller/._.DS_Store
Executable file
BIN
hyhproject/admin/controller/._.DS_Store
Executable file
Binary file not shown.
50
hyhproject/admin/controller/Accreds.php
Executable file
50
hyhproject/admin/controller/Accreds.php
Executable file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Accreds as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 商家认证控制器
|
||||
*/
|
||||
class Accreds extends Base{
|
||||
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
/*
|
||||
* 获取数据
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
return $m->getById(Input("id/d",0));
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
return $m->add();
|
||||
}
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
|
||||
|
||||
}
|
181
hyhproject/admin/controller/Addons.php
Executable file
181
hyhproject/admin/controller/Addons.php
Executable file
@ -0,0 +1,181 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Addons as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 插件控制器
|
||||
*/
|
||||
class Addons extends Base{
|
||||
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
return $m->getById(Input("id/d",0));
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
return $m->add();
|
||||
}
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置插件页面
|
||||
*/
|
||||
public function toEdit(){
|
||||
$m = new M();
|
||||
$addon = $m->getById();
|
||||
if(!$addon) $this->error('插件未安装');
|
||||
$addon_class = get_addon_class($addon['name']);
|
||||
if(!class_exists($addon_class)){
|
||||
trace("插件{$addon['name']}无法实例化,",'ADDONS','ERR');
|
||||
}
|
||||
$data = new $addon_class;
|
||||
$addon['addons_path'] = $data->addons_path;
|
||||
$this->meta_title = '设置插件-'.$data->info['title'];
|
||||
$db_config = $addon['config'];
|
||||
$addon['config'] = include $data->config_file;
|
||||
|
||||
if($db_config){
|
||||
$db_config = json_decode($db_config, true);
|
||||
foreach ($addon['config'] as $key => $value) {
|
||||
if($value['type'] != 'group'){
|
||||
$addon['config'][$key]['value'] = isset($db_config[$key])?$db_config[$key]:"";
|
||||
}else{
|
||||
foreach ($value['options'] as $gourp => $options) {
|
||||
foreach ($options['options'] as $gkey => $value) {
|
||||
$addon['config'][$key]['options'][$gourp]['options'][$gkey]['value'] = $db_config[$gkey];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->assign('data',$addon);
|
||||
$this->assign('addonId',(int)input("id"));
|
||||
return $this->fetch("config");
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存插件设置
|
||||
*/
|
||||
public function saveConfig(){
|
||||
$m = new M();
|
||||
$m->saveConfig();
|
||||
|
||||
$addon = $m->getById();
|
||||
$addonName = $addon["name"];
|
||||
$class = get_addon_class($addonName);
|
||||
if(!class_exists($class)){
|
||||
return WSTReturn("插件不存在",-1);
|
||||
}
|
||||
$addons = new $class;
|
||||
$addons->saveConfig();
|
||||
|
||||
return $this->fetch("list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 卸载插件
|
||||
*/
|
||||
public function install(){
|
||||
$m = new M();
|
||||
$addon = $m->getById();
|
||||
$addonName = $addon["name"];
|
||||
$class = get_addon_class($addonName);
|
||||
if(!class_exists($class)){
|
||||
return WSTReturn("插件不存在",-1);
|
||||
}
|
||||
$addons = new $class;
|
||||
$flag = $addons->install();
|
||||
if(!$flag){
|
||||
return WSTReturn("安装失败",-1);
|
||||
}else{
|
||||
return $m->editStatus(1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 卸载插件
|
||||
*/
|
||||
public function uninstall(){
|
||||
$m = new M();
|
||||
$addon = $m->getById();
|
||||
$addonName = $addon["name"];
|
||||
$class = get_addon_class($addonName);
|
||||
if(!class_exists($class)){
|
||||
return WSTReturn("插件不存在",-1);
|
||||
}
|
||||
$addons = new $class;
|
||||
$flag = $addons->uninstall();
|
||||
if(!$flag){
|
||||
return WSTReturn("卸载失败",-1);
|
||||
}else{
|
||||
return $m->del();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用插件
|
||||
*/
|
||||
public function enable(){
|
||||
$m = new M();
|
||||
$addon = $m->getById();
|
||||
$addonName = $addon["name"];
|
||||
$class = get_addon_class($addonName);
|
||||
if(!class_exists($class)){
|
||||
return WSTReturn("插件不存在",-1);
|
||||
}
|
||||
$addons = new $class;
|
||||
$flag = $addons->enable();
|
||||
if(!$flag){
|
||||
return WSTReturn("启用失败",-1);
|
||||
}else{
|
||||
return $m->editStatus(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 禁用插件
|
||||
*/
|
||||
public function disable(){
|
||||
|
||||
$m = new M();
|
||||
$addon = $m->getById();
|
||||
$addonName = $addon["name"];
|
||||
$class = get_addon_class($addonName);
|
||||
if(!class_exists($class)){
|
||||
return WSTReturn("插件不存在",-1);
|
||||
}
|
||||
$addons = new $class;
|
||||
$flag = $addons->disable();
|
||||
if(!$flag){
|
||||
return WSTReturn("禁用失败",-1);
|
||||
}else{
|
||||
return $m->editStatus(2);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
68
hyhproject/admin/controller/Adgoods.php
Executable file
68
hyhproject/admin/controller/Adgoods.php
Executable file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Adgoods as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 广告控制器
|
||||
*/
|
||||
class Adgoods extends Base{
|
||||
|
||||
public function index(){
|
||||
$result=db('ads')->field('adName,adId')->order('adId desc')->select();
|
||||
return $this->fetch("list",['result'=>$result]);
|
||||
}
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
/**
|
||||
* 跳去编辑页面
|
||||
*/
|
||||
public function toEdit(){
|
||||
$m = new M();
|
||||
$data = $m->getById(Input("id/d",0));
|
||||
if($data) $data['adName']=db('ads')->where('adId',$data['adId'])->value('adName');
|
||||
$result=db('ads')->field('adName,adId')->order('adId desc')->select();
|
||||
return $this->fetch("edit",['data'=>$data,'result'=>$result]);
|
||||
}
|
||||
/*
|
||||
* 获取数据
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
return $m->getById(Input("id/d",0));
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
return $m->add();
|
||||
}
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
/**
|
||||
* 修改广告排序
|
||||
*/
|
||||
public function changeSort(){
|
||||
$m = new M();
|
||||
return $m->changeSort();
|
||||
}
|
||||
|
||||
|
||||
}
|
63
hyhproject/admin/controller/Adpositions.php
Executable file
63
hyhproject/admin/controller/Adpositions.php
Executable file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\AdPositions as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 广告位置控制器
|
||||
*/
|
||||
class Adpositions extends Base{
|
||||
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
/**
|
||||
* 跳去编辑页面
|
||||
*/
|
||||
public function toEdit(){
|
||||
$m = new M();
|
||||
$assign = ['data'=>$m->getById(Input("get.id/d",0))];
|
||||
return $this->fetch("edit",$assign);
|
||||
}
|
||||
/*
|
||||
* 获取数据
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
return $m->getById(Input("id/d",0));
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
return $m->add();
|
||||
}
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
/**
|
||||
* 获取位置信息(用于广告)
|
||||
*/
|
||||
public function getPositon(){
|
||||
$m = new M();
|
||||
return $m->getPositon((int)input('post.positionType/d'));
|
||||
}
|
||||
}
|
65
hyhproject/admin/controller/Ads.php
Executable file
65
hyhproject/admin/controller/Ads.php
Executable file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Ads as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 广告控制器
|
||||
*/
|
||||
class Ads extends Base{
|
||||
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
/**
|
||||
* 跳去编辑页面
|
||||
*/
|
||||
public function toEdit(){
|
||||
$m = new M();
|
||||
$data = $m->getById(Input("id/d",0));
|
||||
return $this->fetch("edit",['data'=>$data]);
|
||||
}
|
||||
/*
|
||||
* 获取数据
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
return $m->getById(Input("id/d",0));
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
return $m->add();
|
||||
}
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
/**
|
||||
* 修改广告排序
|
||||
*/
|
||||
public function changeSort(){
|
||||
$m = new M();
|
||||
return $m->changeSort();
|
||||
}
|
||||
|
||||
|
||||
}
|
92
hyhproject/admin/controller/Areas.php
Executable file
92
hyhproject/admin/controller/Areas.php
Executable file
@ -0,0 +1,92 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Areas as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 地区控制器
|
||||
*/
|
||||
class Areas extends Base{
|
||||
|
||||
public function index(){
|
||||
$m = new M();
|
||||
$pArea=array('areaId'=>0,'parentId'=>0);
|
||||
$parentId = Input("get.parentId/d",0);
|
||||
if($parentId>0){
|
||||
$pArea = $m->getFieldsById($parentId,['areaName,areaId,parentId']);
|
||||
}
|
||||
$this->assign("pArea",$pArea);
|
||||
return $this->fetch("list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
$rs = $m->pageQuery();
|
||||
return WSTGrid($rs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否显示/隐藏
|
||||
*/
|
||||
public function editiIsShow(){
|
||||
$m = new M();
|
||||
$rs = $m->editiIsShow();
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取地区
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
$rs = $m->getById((int)Input("post.id"));
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 排序字母
|
||||
*/
|
||||
public function letterObtain(){
|
||||
$m = new M();
|
||||
$rs = $m->letterObtain();
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
$rs = $m->add();
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
$rs = $m->edit();
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
$rs = $m->del();
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*/
|
||||
public function listQuery(){
|
||||
$m = new M();
|
||||
$list = $m->listQuery(Input("post.parentId/d",0));
|
||||
return WSTReturn("", 1,$list);
|
||||
}
|
||||
}
|
96
hyhproject/admin/controller/Articlecats.php
Executable file
96
hyhproject/admin/controller/Articlecats.php
Executable file
@ -0,0 +1,96 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\ArticleCats as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 文章分类控制器
|
||||
*/
|
||||
class ArticleCats extends Base{
|
||||
|
||||
public function index(){
|
||||
$m = new M();
|
||||
return $this->fetch("list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
$rs = $m->pageQuery();
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 获取列表
|
||||
*/
|
||||
public function listQuery(){
|
||||
$m = new M();
|
||||
$rs = $m->listQuery(input('parentId/d',0));
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 设置是否显示/隐藏
|
||||
*/
|
||||
public function editiIsShow(){
|
||||
$m = new M();
|
||||
$rs = $m->editiIsShow();
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文章分类
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
$rs = $m->getById((int)Input("post.id"));
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文章分类列表
|
||||
*/
|
||||
public function listQuery2(){
|
||||
$m = new M();
|
||||
$rs = $m->listQuery2();
|
||||
if((int)input('id')==0 && (int)input('hasRoot')==1){
|
||||
$rs = ['id'=>0,'name'=>'全部','pId'=>0,'isParent'=>true,'children'=>$rs,'open'=>true];
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
$rs = $m->add();
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
$rs = $m->edit();
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改分类名称
|
||||
*/
|
||||
public function editName(){
|
||||
$m = new M();
|
||||
$rs = $m->editName();
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
$rs = $m->del();
|
||||
return $rs;
|
||||
}
|
||||
}
|
94
hyhproject/admin/controller/Articles.php
Executable file
94
hyhproject/admin/controller/Articles.php
Executable file
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Articles as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 文章控制器
|
||||
*/
|
||||
class Articles extends Base{
|
||||
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
$rs = $m->pageQuery();
|
||||
return WSTGrid($rs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文章
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
$rs = $m->get(Input("post.id/d",0));
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否显示/隐藏
|
||||
*/
|
||||
public function editiIsShow(){
|
||||
$m = new M();
|
||||
$rs = $m->editiIsShow();
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳去新增/编辑页面
|
||||
*/
|
||||
public function toEdit(){
|
||||
$id = Input("get.id/d",0);
|
||||
$m = new M();
|
||||
if($id>0){
|
||||
$object = $m->getById($id);
|
||||
}else{
|
||||
$object = $m->getEModel('articles');
|
||||
$object['catName'] = '';
|
||||
}
|
||||
$this->assign('object',$object);
|
||||
$this->assign('articlecatList',model('Article_Cats')->listQuery(0));
|
||||
return $this->fetch("edit");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
$rs = $m->add();
|
||||
return $rs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
$rs = $m->edit();
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
$rs = $m->del();
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
public function delByBatch(){
|
||||
$m = new M();
|
||||
$rs = $m->delByBatch();
|
||||
return $rs;
|
||||
}
|
||||
}
|
83
hyhproject/admin/controller/Attributes.php
Executable file
83
hyhproject/admin/controller/Attributes.php
Executable file
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Attributes as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 属性控制器
|
||||
*/
|
||||
class Attributes extends Base{
|
||||
|
||||
public function index(){
|
||||
$this->assign('catId', input("catId/d"));
|
||||
return $this->fetch("list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
$rs = $m->pageQuery();
|
||||
return WSTGrid($rs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function listQuery(){
|
||||
$m = new M();
|
||||
$rs = $m->listQuery();
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 跳去编辑页面
|
||||
*/
|
||||
public function toEdit(){
|
||||
//获取该记录信息
|
||||
$this->assign('data', $this->get());
|
||||
$m = new M();
|
||||
$this->assign('catId', input("catId/d",0));
|
||||
return $this->fetch("edit");
|
||||
}
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
$rs = $m->getById(input("attrId/d"));
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 显示隐藏
|
||||
*/
|
||||
public function setToggle(){
|
||||
$m = new M();
|
||||
$rs = $m->setToggle();
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
$rs = $m->add();
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
$rs = $m->edit();
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
$rs = $m->del();
|
||||
return $rs;
|
||||
}
|
||||
|
||||
}
|
56
hyhproject/admin/controller/Banks.php
Executable file
56
hyhproject/admin/controller/Banks.php
Executable file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Banks as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 银行控制器
|
||||
*/
|
||||
class Banks extends Base{
|
||||
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
$rs = $m->pageQuery();
|
||||
return WSTGrid($rs);
|
||||
}
|
||||
/*
|
||||
* 获取数据
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
$rs = $m->getById(Input("id/d",0));
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
$rs = $m->add();
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
public function edit(){
|
||||
|
||||
$m = new M();
|
||||
$rs = $m->edit();
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
$rs = $m->del();
|
||||
return $rs;
|
||||
}
|
||||
|
||||
|
||||
}
|
33
hyhproject/admin/controller/Base.php
Executable file
33
hyhproject/admin/controller/Base.php
Executable file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 基础控制器
|
||||
*/
|
||||
use think\Controller;
|
||||
class Base extends Controller {
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->assign("v",WSTConf('CONF.wstVersion'));
|
||||
}
|
||||
protected function fetch($template = '', $vars = [], $replace = [], $config = [])
|
||||
{
|
||||
$replace['__ADMIN__'] = str_replace('/index.php','',\think\Request::instance()->root()).'/hyhproject/admin/view';
|
||||
return $this->view->fetch($template, $vars, $replace, $config);
|
||||
}
|
||||
|
||||
public function getVerify(){
|
||||
WSTVerify();
|
||||
}
|
||||
|
||||
public function uploadPic(){
|
||||
return WSTUploadPic(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑器上传文件
|
||||
*/
|
||||
public function editorUpload(){
|
||||
return WSTEditUpload(1);
|
||||
}
|
||||
}
|
86
hyhproject/admin/controller/Brands.php
Executable file
86
hyhproject/admin/controller/Brands.php
Executable file
@ -0,0 +1,86 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Brands as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 品牌控制器
|
||||
*/
|
||||
class Brands extends Base{
|
||||
|
||||
public function index(){
|
||||
$g = model('GoodsCats');
|
||||
$this->assign('gcatList',$g->listQuery(0));
|
||||
return $this->fetch("list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
$rs = $m->pageQuery();
|
||||
return WSTGrid($rs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取品牌
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
$rs = $m->get((int)Input("post.id"));
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳去新增/编辑页面
|
||||
*/
|
||||
public function toEdit(){
|
||||
$id = Input("get.id/d",0);
|
||||
$m = new M();
|
||||
if($id>0){
|
||||
$object = $m->getById($id);
|
||||
}else{
|
||||
$object = $m->getEModel('brands');
|
||||
}
|
||||
$this->assign('object',$object);
|
||||
$this->assign('gcatList',model('GoodsCats')->listQuery(0));
|
||||
return $this->fetch("edit");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
$rs = $m->add();
|
||||
return $rs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
$rs = $m->edit();
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
$rs = $m->del();
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改品牌排序
|
||||
*/
|
||||
public function changeSort(){
|
||||
$m = new M();
|
||||
return $m->changeSort();
|
||||
}
|
||||
|
||||
}
|
30
hyhproject/admin/controller/Carts.php
Executable file
30
hyhproject/admin/controller/Carts.php
Executable file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Carts as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 基础控业务处理
|
||||
*/
|
||||
use think\Db;
|
||||
class Carts extends Base{
|
||||
//购物车列表
|
||||
public function cart(){
|
||||
$m = new M();
|
||||
return $this->fetch('carts');
|
||||
}
|
||||
//获取分页
|
||||
public function cartsByPage(){
|
||||
$m=new M();
|
||||
$result=$m->cartsByPage();
|
||||
$result['status'] = 1;
|
||||
return WSTGrid($result);
|
||||
}
|
||||
/**
|
||||
* 导出购物车数据
|
||||
*/
|
||||
public function toExport(){
|
||||
$m = new M();
|
||||
$rs = $m->toExport();
|
||||
$this->assign('rs',$rs);
|
||||
}
|
||||
}
|
198
hyhproject/admin/controller/Cashdraws.php
Executable file
198
hyhproject/admin/controller/Cashdraws.php
Executable file
@ -0,0 +1,198 @@
|
||||
<?php
|
||||
|
||||
namespace wstmart\admin\controller;
|
||||
|
||||
use wstmart\admin\model\CashDraws as M;
|
||||
|
||||
/**
|
||||
|
||||
* ============================================================================
|
||||
|
||||
* 提现控制器
|
||||
|
||||
*/
|
||||
|
||||
class Cashdraws extends Base{
|
||||
|
||||
|
||||
|
||||
public function index(){
|
||||
|
||||
return $this->fetch("list");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 获取分页
|
||||
|
||||
*/
|
||||
|
||||
public function pageQuery(){
|
||||
|
||||
$m = new M();
|
||||
|
||||
return WSTGrid($m->pageQuery());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 跳去编辑页面
|
||||
|
||||
*/
|
||||
|
||||
public function toHandle(){
|
||||
|
||||
//获取该记录信息
|
||||
|
||||
$m = new M();
|
||||
|
||||
$this->assign('object', $m->getById());
|
||||
|
||||
return $this->fetch("edit");
|
||||
|
||||
}
|
||||
/**
|
||||
* 查看报表
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function viewReport(){
|
||||
|
||||
$m = new M();
|
||||
$date = input('get.searchDate');
|
||||
if(!$date){
|
||||
$date = date('Y-m-d');
|
||||
}
|
||||
$orders = $m->viewReport($date);
|
||||
$this->assign("searchDate",$date);
|
||||
$this->assign('orders',$orders);
|
||||
return $this->fetch("view_report");
|
||||
}
|
||||
/**
|
||||
* 修改报表信息
|
||||
*/
|
||||
public function setReport(){
|
||||
$data['money'] =(int) session('reData.money');//充值/扣除数量
|
||||
$mobileCode =(int)input('mobileCode');//验证码
|
||||
if($data['money'] <= 0){
|
||||
exit(jsonReturn('请求超时请重试!'));
|
||||
}
|
||||
if(session('reData.reCode') != $mobileCode){
|
||||
exit(jsonReturn('验证码错误'));
|
||||
}
|
||||
$reDate = session('reData.reDate');//充值/扣除日期
|
||||
$reType =(int) session('reData.reType');//1充值2扣除
|
||||
if($reType == 1){
|
||||
$reTypeName = '充值';
|
||||
}else{
|
||||
$data['money']*=-1;
|
||||
$reTypeName = '扣除';
|
||||
}
|
||||
$data['adminId'] = session('WST_STAFF.staffId');
|
||||
$data['logContent'] = session('WST_STAFF.staffName').$reTypeName;
|
||||
$data['setTime'] = strtotime($reDate);
|
||||
$data['createTime'] = time();
|
||||
$m = Model('common/Table');
|
||||
$m->setTable('log_day_money');
|
||||
if(false !== $m->insertInfo($data)){
|
||||
session('reData',null);
|
||||
exit(jsonReturn('操作成功',1));
|
||||
}
|
||||
exit(jsonReturn('操作失败'));
|
||||
}
|
||||
/**
|
||||
* 获取操作验证码
|
||||
*/
|
||||
public function getMobileCode(){
|
||||
$mobile = getAdminPhone();
|
||||
//董事长您好:会计${name}需要修改财务报表,日期:${date},${reType}金额:${money}元,核验码${code},请告之。
|
||||
$data = input('post.');
|
||||
$model_logsms = model('common/LogSms');
|
||||
$phoneVerify = rand(1000,9999);
|
||||
$name = session('WST_STAFF.staffName');
|
||||
$date = $data['reDate'];
|
||||
if($data['reType'] == 1){
|
||||
$reTypeName = '充值';
|
||||
}else{
|
||||
$reTypeName = '扣除';
|
||||
}
|
||||
$money = $data['money'];
|
||||
$data['reCode'] = $phoneVerify;
|
||||
$tpl = WSTMsgTemplates('PHONE_ADMIN_SET_REPORT_NOTICE');
|
||||
$rv['status'] = -1;
|
||||
$rv['msg'] = '发送失败';
|
||||
if( $tpl['tplContent']!='' && $tpl['status']=='1'){
|
||||
$params = ['tpl'=>$tpl,'params'=>['name'=>$name,'date'=>$date,'reType'=>$reTypeName,'money'=>$money,'code'=>$phoneVerify]];
|
||||
$m = Model('common/LogSms');
|
||||
$rv = $m->sendSMS(0,$mobile,$params,'PHONE_ADMIN_SET_REPORT_NOTICE',$phoneVerify);
|
||||
}
|
||||
if(1 == $rv['status']){
|
||||
session('reData',$data);
|
||||
}
|
||||
exit(json_encode($rv));
|
||||
}
|
||||
/**
|
||||
|
||||
* 修改
|
||||
|
||||
*/
|
||||
|
||||
public function handle(){
|
||||
|
||||
$drawsStatus = (int)input('cashSatus',-1);
|
||||
|
||||
$m = new M();
|
||||
|
||||
if($drawsStatus==1){
|
||||
|
||||
return $m->handle();
|
||||
|
||||
}else{
|
||||
|
||||
return $m->handleFail();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 查看提现内容
|
||||
|
||||
*/
|
||||
|
||||
public function toView(){
|
||||
|
||||
$m = new M();
|
||||
|
||||
$this->assign('object', $m->getById());
|
||||
|
||||
return $this->fetch("view");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* 导出
|
||||
|
||||
*/
|
||||
|
||||
public function toExport(){
|
||||
|
||||
$m = new M();
|
||||
|
||||
$rs = $m->toExport();
|
||||
|
||||
$this->assign('rs',$rs);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
57
hyhproject/admin/controller/Chargeitems.php
Executable file
57
hyhproject/admin/controller/Chargeitems.php
Executable file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\ChargeItems as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 充值项控制器
|
||||
*/
|
||||
class Chargeitems extends Base{
|
||||
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
/**
|
||||
* 跳去编辑页面
|
||||
*/
|
||||
public function toEdit(){
|
||||
$m = new M();
|
||||
$assign = ['data'=>$m->getById(Input("get.id/d",0))];
|
||||
return $this->fetch("edit",$assign);
|
||||
}
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
return $m->getById(Input("id/d",0));
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
return $m->add();
|
||||
}
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
|
||||
}
|
42
hyhproject/admin/controller/Cronjobs.php
Executable file
42
hyhproject/admin/controller/Cronjobs.php
Executable file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\CronJobs as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 定时任务控制器
|
||||
*/
|
||||
class Cronjobs extends Base{
|
||||
/**
|
||||
* 取消未付款订单
|
||||
*/
|
||||
public function autoCancelNoPay(){
|
||||
$m = new M();
|
||||
$rs = $m->autoCancelNoPay();
|
||||
return json($rs);
|
||||
}
|
||||
/**
|
||||
* 自动好评
|
||||
*/
|
||||
public function autoAppraise(){
|
||||
$m = new M();
|
||||
$rs = $m->autoAppraise();
|
||||
return json($rs);
|
||||
}
|
||||
/**
|
||||
* 自动确认收货
|
||||
*/
|
||||
public function autoReceive(){
|
||||
$m = new M();
|
||||
$rs = $m->autoReceive();
|
||||
return json($rs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送队列消息
|
||||
*/
|
||||
public function autoSendMsg(){
|
||||
$m = new M();
|
||||
$rs = $m->autoSendMsg();
|
||||
return json($rs);
|
||||
}
|
||||
}
|
44
hyhproject/admin/controller/Datacats.php
Executable file
44
hyhproject/admin/controller/Datacats.php
Executable file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\DataCats as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 系统数据分类控制器
|
||||
*/
|
||||
class Datacats extends Base{
|
||||
/**
|
||||
* 根据
|
||||
*/
|
||||
public function listQuery(){
|
||||
$m = new M();
|
||||
return $m->listQuery((int)Input("post.id",-1));
|
||||
}
|
||||
/**
|
||||
* 根据catId获取数据分类
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
return $m->getById((int)Input("post.id"));
|
||||
}
|
||||
/**
|
||||
* 新增数据分类
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
return $m->add();
|
||||
}
|
||||
/**
|
||||
* 编辑数据分类
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
/**
|
||||
* 删除数据分类
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
}
|
55
hyhproject/admin/controller/Datas.php
Executable file
55
hyhproject/admin/controller/Datas.php
Executable file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Datas as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 系统数据控制器
|
||||
*/
|
||||
class Datas extends Base{
|
||||
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
/**
|
||||
* 根据catId获取子数据
|
||||
*/
|
||||
public function childQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->childQuery());
|
||||
}
|
||||
/**
|
||||
* 获取菜单列表
|
||||
*/
|
||||
public function listQuery(){
|
||||
$m = new M();
|
||||
return $m->dataQuery((int)Input("post.id",-1));
|
||||
}
|
||||
/**
|
||||
* 获取菜单
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
return $m->getById((int)Input("post.id"));
|
||||
}
|
||||
/**
|
||||
* 新增菜单
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
return $m->add();
|
||||
}
|
||||
/**
|
||||
* 编辑菜单
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
/**
|
||||
* 删除菜单
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
}
|
37
hyhproject/admin/controller/Ectday.php
Executable file
37
hyhproject/admin/controller/Ectday.php
Executable file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\EctDay as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 提现控制器
|
||||
*/
|
||||
class Ectday extends Base{
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*/
|
||||
public function toExport(){
|
||||
$m = new M();
|
||||
$rs = $m->toExport();
|
||||
$this->assign('rs',$rs);
|
||||
}
|
||||
//获取查看页面
|
||||
public function ectPage(){
|
||||
$m=new M();
|
||||
$result=$m->ectTarget();
|
||||
$this->assign('result',$result);
|
||||
return $this->fetch('ectpage');
|
||||
|
||||
}
|
||||
}
|
21
hyhproject/admin/controller/Ectdeal.php
Executable file
21
hyhproject/admin/controller/Ectdeal.php
Executable file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\EctDeal as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 提现控制器
|
||||
*/
|
||||
class Ectdeal extends Base{
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
$result=$m->pageQuery();
|
||||
return WSTGrid($result);
|
||||
}
|
||||
}
|
50
hyhproject/admin/controller/Ecttarget.php
Executable file
50
hyhproject/admin/controller/Ecttarget.php
Executable file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\EctTarget as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 提现控制器
|
||||
*/
|
||||
class Ecttarget extends Base{
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*/
|
||||
public function toExport(){
|
||||
$m = new M();
|
||||
$rs = $m->toExport();
|
||||
$this->assign('rs',$rs);
|
||||
}
|
||||
//获取记录信息
|
||||
public function toHandle(){
|
||||
$m=new M();
|
||||
$result=$m->toHandle();
|
||||
$this->assign('object',$result);
|
||||
return $this->fetch('ecttarget');
|
||||
}
|
||||
//进行审核操作
|
||||
public function ectTarget(){
|
||||
$m=new M();
|
||||
$result=$m->ectTarget();
|
||||
exit(json_encode($result));
|
||||
}
|
||||
//获取查看页面
|
||||
public function ectPage(){
|
||||
$m=new M();
|
||||
$result=$m->ectTarget();
|
||||
$this->assign('result',$result);
|
||||
return $this->fetch('ectpage');
|
||||
|
||||
}
|
||||
}
|
56
hyhproject/admin/controller/Express.php
Executable file
56
hyhproject/admin/controller/Express.php
Executable file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Express as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 快递控制器
|
||||
*/
|
||||
class Express extends Base{
|
||||
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
$rs = $m->pageQuery();
|
||||
return WSTGrid($rs);
|
||||
}
|
||||
/*
|
||||
* 获取数据
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
$rs = $m->getById(Input("id/d",0));
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
$rs = $m->add();
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
public function edit(){
|
||||
|
||||
$m = new M();
|
||||
$rs = $m->edit();
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
$rs = $m->del();
|
||||
return $rs;
|
||||
}
|
||||
|
||||
|
||||
}
|
59
hyhproject/admin/controller/Friendlinks.php
Executable file
59
hyhproject/admin/controller/Friendlinks.php
Executable file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Friendlinks as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 友情链接控制器
|
||||
*/
|
||||
class Friendlinks extends Base{
|
||||
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
/**
|
||||
* 跳去编辑页面
|
||||
*/
|
||||
public function toEdit(){
|
||||
$m = new M();
|
||||
$rs = $m->getById((int)Input("post.id"));
|
||||
$this->assign("object",$rs);
|
||||
return $this->fetch("edit");
|
||||
}
|
||||
/*
|
||||
* 获取数据
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
return $m->getById(Input("id/d",0));
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
return $m->add();
|
||||
}
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
|
||||
|
||||
}
|
132
hyhproject/admin/controller/Goods.php
Executable file
132
hyhproject/admin/controller/Goods.php
Executable file
@ -0,0 +1,132 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Goods as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 商品控制器
|
||||
*/
|
||||
class Goods extends Base{
|
||||
/**
|
||||
* 查看上架商品列表
|
||||
*/
|
||||
public function index(){
|
||||
$this->assign("areaList",model('areas')->listQuery(0));
|
||||
return $this->fetch('list_sale');
|
||||
}
|
||||
/**
|
||||
* 批量删除商品
|
||||
*/
|
||||
public function batchDel(){
|
||||
$m = new M();
|
||||
return $m->batchDel();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置违规商品
|
||||
*/
|
||||
public function illegal(){
|
||||
$m = new M();
|
||||
return $m->illegal();
|
||||
}
|
||||
/**
|
||||
* 批量设置违规商品
|
||||
*/
|
||||
public function batchIllegal(){
|
||||
$m = new M();
|
||||
return $m->batchIllegal();
|
||||
}
|
||||
/**
|
||||
* 通过商品审核
|
||||
*/
|
||||
public function allow(){
|
||||
$m = new M();
|
||||
return $m->allow();
|
||||
}
|
||||
/**
|
||||
* 批量通过商品审核
|
||||
*/
|
||||
public function batchAllow(){
|
||||
$m = new M();
|
||||
return $m->batchAllow();
|
||||
}
|
||||
/**
|
||||
* 获取上架商品列表
|
||||
*/
|
||||
public function saleByPage(){
|
||||
$m = new M();
|
||||
$rs = $m->saleByPage();
|
||||
$rs['status'] = 1;
|
||||
return WSTGrid($rs);
|
||||
}
|
||||
/**
|
||||
* 已下架的商品
|
||||
*/
|
||||
public function shelves(){
|
||||
$this->assign("areaList",model('areas')->listQuery(0));
|
||||
return $this->fetch('goods/list_shelves');
|
||||
}
|
||||
/**
|
||||
* 获取已下架的商品
|
||||
*/
|
||||
public function shelvesByPage(){
|
||||
$m = new M();
|
||||
$rs = $m->shelvesByPage();
|
||||
$rs['status'] = 1;
|
||||
return WSTGrid($rs);
|
||||
}
|
||||
/**
|
||||
* 审核中的商品
|
||||
*/
|
||||
public function auditIndex(){
|
||||
$this->assign("areaList",model('areas')->listQuery(0));
|
||||
return $this->fetch('goods/list_audit');
|
||||
}
|
||||
/**
|
||||
* 获取审核中的商品
|
||||
*/
|
||||
public function auditByPage(){
|
||||
$m = new M();
|
||||
$rs = $m->auditByPage();
|
||||
$rs['status'] = 1;
|
||||
return WSTGrid($rs);
|
||||
}
|
||||
/**
|
||||
* 审核中的商品
|
||||
*/
|
||||
public function illegalIndex(){
|
||||
$this->assign("areaList",model('areas')->listQuery(0));
|
||||
return $this->fetch('list_illegal');
|
||||
}
|
||||
/**
|
||||
* 获取违规商品列表
|
||||
*/
|
||||
public function illegalByPage(){
|
||||
$m = new M();
|
||||
$rs = $m->illegalByPage();
|
||||
$rs['status'] = 1;
|
||||
return WSTGrid($rs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
/**
|
||||
* 导出购物车数据
|
||||
*/
|
||||
public function toExportSale(){
|
||||
$m = new M();
|
||||
$rs = $m->toExportSale();
|
||||
$this->assign('rs',$rs);
|
||||
}
|
||||
/**
|
||||
* 商品ECT支付状态
|
||||
*/
|
||||
public function goodsEct(){
|
||||
$m = new M();
|
||||
return $m->goodsEct();
|
||||
}
|
||||
}
|
49
hyhproject/admin/controller/Goodsappraises.php
Executable file
49
hyhproject/admin/controller/Goodsappraises.php
Executable file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\GoodsAppraises as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 商品评价控制器
|
||||
*/
|
||||
class Goodsappraises extends Base{
|
||||
|
||||
public function index(){
|
||||
//获取地区
|
||||
$area1 = model('areas')->listQuery(0);
|
||||
return $this->fetch("list",['area1'=>$area1,]);
|
||||
}
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
/**
|
||||
* 跳去编辑页面
|
||||
*/
|
||||
public function toEdit(){
|
||||
$m = new M();
|
||||
$data = $m->getById(input("get.id/d",0));
|
||||
if($data['images']!='')
|
||||
$data['images'] = explode(',',$data['images']);
|
||||
$assign = ['data'=>$data];
|
||||
return $this->fetch("edit",$assign);
|
||||
}
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
|
||||
|
||||
}
|
97
hyhproject/admin/controller/Goodscats.php
Executable file
97
hyhproject/admin/controller/Goodscats.php
Executable file
@ -0,0 +1,97 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\GoodsCats as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 商品分类控制器
|
||||
*/
|
||||
class GoodsCats extends Base{
|
||||
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return $m->pageQuery();
|
||||
}
|
||||
/**
|
||||
* 获取列表
|
||||
*/
|
||||
public function listQuery(){
|
||||
$m = new M();
|
||||
$rs = $m->listQuery(input('parentId/d',0));
|
||||
return WSTReturn("", 1,$rs);
|
||||
}
|
||||
/**
|
||||
* 获取商品分类
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
return $m->get((int)Input("post.id"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否自营显示/隐藏
|
||||
*/
|
||||
public function editiIsSelfShow(){
|
||||
$m = new M();
|
||||
return $m->editiIsSelfShow();
|
||||
}
|
||||
/**
|
||||
* 设置是否推荐/不推荐
|
||||
*/
|
||||
public function editiIsFloor(){
|
||||
$m = new M();
|
||||
return $m->editiIsFloor();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否显示/隐藏
|
||||
*/
|
||||
public function editiIsShow(){
|
||||
$m = new M();
|
||||
return $m->editiIsShow();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
return $m->add();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
/**
|
||||
* 编辑分类名
|
||||
*/
|
||||
public function editName(){
|
||||
$m = new M();
|
||||
return $m->editName();
|
||||
}
|
||||
/**
|
||||
* 编辑分类排序
|
||||
*/
|
||||
public function editOrder(){
|
||||
$m = new M();
|
||||
return $m->editOrder();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
}
|
203
hyhproject/admin/controller/Goodsclassify.php
Executable file
203
hyhproject/admin/controller/Goodsclassify.php
Executable file
@ -0,0 +1,203 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\GoodsClassify as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 商品控制器
|
||||
*/
|
||||
class Goodsclassify extends Base{
|
||||
/*查看商品总分类*/
|
||||
public function index(){
|
||||
return $this->fetch('list');
|
||||
}
|
||||
/**获取商品总分类分页*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
$rs = $m->pageQuery();
|
||||
return WSTGrid($rs);
|
||||
}
|
||||
/**获取总分类数据*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
$rs = $m->getById(input("goodsclassifyId/d"));
|
||||
return $rs;
|
||||
}
|
||||
//添加商品总分类
|
||||
public function add(){
|
||||
$m=new M();
|
||||
$rs=$m->add();
|
||||
return $rs;
|
||||
}
|
||||
//修改商品总分类
|
||||
public function edit(){
|
||||
$m=new M();
|
||||
$rs=$m->edit();
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 获取商品分类数据
|
||||
*/
|
||||
public function gets(){
|
||||
$m = new M();
|
||||
$rs = $m->getByIds(input("goodsclassifyId/d"));
|
||||
return $rs;
|
||||
}
|
||||
//获取商品分类详情
|
||||
public function catdetail(){
|
||||
$m=new M();
|
||||
$row= $m->catdetail();
|
||||
$id=input('goodsclassifyId');
|
||||
$this->assign("id",$id);
|
||||
return $this->fetch('catdetail');
|
||||
}
|
||||
//获取商品分类分页
|
||||
public function catdetailPage(){
|
||||
$m = new M();
|
||||
$rs = $m->catdetailPage();
|
||||
$rs['status'] = 1;
|
||||
return WSTGrid($rs);
|
||||
}
|
||||
/**删除商品总分类下的商品分类*/
|
||||
public function catdel(){
|
||||
$m = new M();
|
||||
return $m->catdel();
|
||||
}
|
||||
//获取商品详情
|
||||
public function detail(){
|
||||
$m=new M();
|
||||
$row= $m->detail();
|
||||
$id=input('catId');
|
||||
$this->assign("id",$id);
|
||||
return $this->fetch('detail');
|
||||
}
|
||||
//获取商品详情页面
|
||||
public function detailByPage(){
|
||||
$m = new M();
|
||||
$rs = $m->detailByPage();
|
||||
$rs['status'] = 1;
|
||||
return WSTGrid($rs);
|
||||
}
|
||||
/**删除商品总分类*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
/*添加商品分类*/
|
||||
public function add_cat(){
|
||||
$m = new M();
|
||||
return $m->add_cat();
|
||||
}
|
||||
//获取设置活动页页面
|
||||
public function setdetail(){
|
||||
$id=input('goodsclassifyId');
|
||||
$result=db('goods_classify')->where('goodsclassifyId',$id)->value('goodsclassifyName');
|
||||
$this->assign(["id"=>$id,'result'=>$result]);
|
||||
$classify=db('recom_classify')->where('classifyId',$id)->field('recomId,recomName')->select();
|
||||
$this->assign('classify',$classify);
|
||||
return $this->fetch('setdetail');
|
||||
}
|
||||
//获取商品详情页面
|
||||
public function setdetailPage(){
|
||||
$m = new M();
|
||||
$rs = $m->setdetailPage();
|
||||
return WSTGrid($rs);
|
||||
}
|
||||
//更改活动商品的排序号
|
||||
public function changeSet(){
|
||||
$m = new M();
|
||||
$rs = $m->changeSet();
|
||||
return $rs;
|
||||
}
|
||||
//获取设置活动页页面
|
||||
public function recom(){
|
||||
$id=input('goodsclassifyId');
|
||||
$result=db('goods_classify')->where('goodsclassifyId',$id)->value('goodsclassifyName');
|
||||
$this->assign(["id"=>$id,'result'=>$result]);
|
||||
$classify=db('recom_classify')->where('classifyId',$id)->field('recomId,recomName')->select();
|
||||
$this->assign('classify',$classify);
|
||||
return $this->fetch('recom');
|
||||
}
|
||||
//更改活动商品的排序号
|
||||
public function changeRecom(){
|
||||
$m = new M();
|
||||
$rs = $m->changeRecom();
|
||||
return $rs;
|
||||
}
|
||||
//删除推荐商品
|
||||
public function recomActiveDel(){
|
||||
$m = new M();
|
||||
return $m->recomActiveDel();
|
||||
}
|
||||
/**获取总分类数据*/
|
||||
public function getrecomActive(){
|
||||
$m = new M();
|
||||
$rs = $m->getrecomActiveId(input("recomActiveId/d"));
|
||||
return $rs;
|
||||
}
|
||||
//添加商品总分类
|
||||
public function addrecomActive(){
|
||||
$m=new M();
|
||||
$rs=$m->addrecomActive();
|
||||
return $rs;
|
||||
}
|
||||
//获取商品详情页面
|
||||
public function recomPage(){
|
||||
$m = new M();
|
||||
$rs = $m->recomPage();
|
||||
return WSTGrid($rs);
|
||||
}
|
||||
/*查看活动页的活动分类*/
|
||||
public function cats(){
|
||||
$this->assign('classifyId',input('classifyId'));
|
||||
$classify=db('goods_classify')->where('goodsclassifyId',input('classifyId'))->value('goodsclassifyName');
|
||||
$this->assign('classify',$classify);
|
||||
return $this->fetch('cats');
|
||||
}
|
||||
//查看活动页的活动详情
|
||||
public function catsPage(){
|
||||
$m = new M();
|
||||
$rs = $m->catsPage();
|
||||
return WSTGrid($rs);
|
||||
}
|
||||
/**
|
||||
* 获取活动数据
|
||||
*/
|
||||
public function getCats(){
|
||||
$m = new M();
|
||||
$rs = $m->getCatsId(input("recomId/d"));
|
||||
return $rs;
|
||||
}
|
||||
/*添加分类活动分类*/
|
||||
public function addCats(){
|
||||
$m = new M();
|
||||
return $m->addCats();
|
||||
}
|
||||
/*更改分类活动分类*/
|
||||
public function editCats(){
|
||||
$m = new M();
|
||||
return $m->editCats();
|
||||
}
|
||||
//删除活动页活动分类
|
||||
public function catsDel(){
|
||||
$m = new M();
|
||||
return $m->catsDel();
|
||||
}
|
||||
/**
|
||||
* 获取活动商品详情
|
||||
*/
|
||||
public function getGoods(){
|
||||
$m = new M();
|
||||
$rs = $m->getGoodsId(input("id/d"));
|
||||
return $rs;
|
||||
}
|
||||
/*添加分类活动分类*/
|
||||
public function addGoods(){
|
||||
$m = new M();
|
||||
return $m->addGoods();
|
||||
}
|
||||
//删除活动商品
|
||||
public function goodsDel(){
|
||||
$m = new M();
|
||||
return $m->goodsDel();
|
||||
}
|
||||
}
|
44
hyhproject/admin/controller/Goodsconsult.php
Executable file
44
hyhproject/admin/controller/Goodsconsult.php
Executable file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\GoodsConsult as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 商品咨询控制器
|
||||
*/
|
||||
class GoodsConsult extends Base{
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
/**
|
||||
* 跳去编辑页面
|
||||
*/
|
||||
public function toEdit(){
|
||||
$m = new M();
|
||||
$data = $m->getById(input("get.id/d",0));
|
||||
$assign = ['data'=>$data];
|
||||
return $this->fetch("edit",$assign);
|
||||
}
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
|
||||
|
||||
}
|
65
hyhproject/admin/controller/Homemenus.php
Executable file
65
hyhproject/admin/controller/Homemenus.php
Executable file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\HomeMenus as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 前台菜单控制器
|
||||
*/
|
||||
class Homemenus extends Base{
|
||||
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单列表
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return $m->pageQuery();
|
||||
}
|
||||
/**
|
||||
* 获取菜单
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
return $m->getById((int)input("post.menuId"));
|
||||
}
|
||||
/**
|
||||
* 新增菜单
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
return $m->add();
|
||||
}
|
||||
/**
|
||||
* 编辑菜单
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
/**
|
||||
* 删除菜单
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示隐藏
|
||||
*/
|
||||
public function setToggle(){
|
||||
$m = new M();
|
||||
return $m->setToggle();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改排序
|
||||
*/
|
||||
public function changeSort(){
|
||||
$m = new M();
|
||||
return $m->changeSort();
|
||||
}
|
||||
}
|
29
hyhproject/admin/controller/Hooks.php
Executable file
29
hyhproject/admin/controller/Hooks.php
Executable file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Hooks as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 广告控制器
|
||||
*/
|
||||
class Hooks extends Base{
|
||||
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
return $m->getById(Input("id/d",0));
|
||||
}
|
||||
|
||||
}
|
102
hyhproject/admin/controller/Images.php
Executable file
102
hyhproject/admin/controller/Images.php
Executable file
@ -0,0 +1,102 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Images as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 图片空间控制器
|
||||
*/
|
||||
class Images extends Base{
|
||||
/**
|
||||
* 进入主页面
|
||||
*/
|
||||
public function index(){
|
||||
return $this->fetch();
|
||||
}
|
||||
/**
|
||||
* 获取概况
|
||||
* 后台商城消息 编辑器中的图片只记录上传图片容量 删除相关数据时无法标记图片为已删除状态
|
||||
*/
|
||||
public function summary(){
|
||||
$m = new M();
|
||||
$data = $m->summary();
|
||||
return WSTReturn("", 1,$data);
|
||||
}
|
||||
/**
|
||||
* 进入列表页面
|
||||
*/
|
||||
public function lists(){
|
||||
$datas = model('Datas')->listQuery(3);
|
||||
$this->assign('datas',$datas);
|
||||
$this->assign('keyword',input('get.keyword'));
|
||||
return $this->fetch('list');
|
||||
}
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
/**
|
||||
* 检测图片信息
|
||||
*/
|
||||
// public function checkImages(){
|
||||
// $imgPath = input('get.imgPath');
|
||||
// $m = WSTConf('CONF.wstMobileImgSuffix');
|
||||
// $imgPath = str_replace($m.'.','.',$imgPath);
|
||||
// $imgPath = str_replace($m.'_thumb.','.',$imgPath);
|
||||
// $imgPath = str_replace('_thumb.','.',$imgPath);
|
||||
// $imgPath_thumb = str_replace('.','_thumb.',$imgPath);
|
||||
// $mimg = '';
|
||||
// $mimg_thumb = '';
|
||||
// if($m!=''){
|
||||
// $mimg = str_replace('.',$m.'.',$imgPath);
|
||||
// $mimg_thumb = str_replace('.',$m.'_thumb.',$imgPath);
|
||||
// }
|
||||
// $data['imgpath']=$imgPath;
|
||||
// $data['img']=file_exists(WSTRootPath()."/".$imgPath)?true:false;
|
||||
// $data['thumb']=file_exists(WSTRootPath()."/".$imgPath_thumb)?true:false;
|
||||
// $data['thumbpath']=$imgPath_thumb;
|
||||
// $data['mimg']=file_exists(WSTRootPath()."/".$mimg)?true:false;
|
||||
// $data['mimgpath']=$mimg;
|
||||
// $data['mthumb']=file_exists(WSTRootPath()."/".$mimg_thumb)?true:false;
|
||||
// $data['mthumbpath']=$mimg_thumb;
|
||||
// return $this->fetch('view',$data);
|
||||
// }
|
||||
/**
|
||||
* 检测图片信息 mark 20180609
|
||||
*/
|
||||
public function checkImages(){
|
||||
$imgPath = input('get.imgPath');
|
||||
$m = WSTConf('CONF.wstMobileImgSuffix');
|
||||
$imgPath = str_replace($m.'.','.',$imgPath);
|
||||
$imgPath = str_replace($m.'_thumb.','.',$imgPath);
|
||||
$imgPath = str_replace('_thumb.','.',$imgPath);
|
||||
$imgPath_thumb = str_replace('.','_thumb.',$imgPath);
|
||||
$mimg = '';
|
||||
$mimg_thumb = '';
|
||||
if($m!=''){
|
||||
$mimg = str_replace('.',$m.'.',$imgPath);
|
||||
$mimg_thumb = str_replace('.',$m.'_thumb.',$imgPath);
|
||||
}
|
||||
$data['imgpath']=$imgPath;
|
||||
$data['img']=file_exists(WSTRootPath()."/".$imgPath)?true:false;
|
||||
//添加判断oss上是否存在 mark 2010608 by zl
|
||||
$data['img_oss']=file_exists_oss($imgPath)?true:false;
|
||||
|
||||
$data['thumb']=file_exists(WSTRootPath()."/".$imgPath_thumb)?true:false;
|
||||
$data['thumbpath']=$imgPath_thumb;
|
||||
$data['mimg']=file_exists(WSTRootPath()."/".$mimg)?true:false;
|
||||
$data['mimgpath']=$mimg;
|
||||
$data['mthumb']=file_exists(WSTRootPath()."/".$mimg_thumb)?true:false;
|
||||
$data['mthumbpath']=$mimg_thumb;
|
||||
return $this->fetch('view',$data);
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
}
|
98
hyhproject/admin/controller/Index.php
Executable file
98
hyhproject/admin/controller/Index.php
Executable file
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Staffs;
|
||||
use wstmart\admin\model\Menus;
|
||||
use wstmart\admin\model\Index as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 首页控制器
|
||||
*/
|
||||
class Index extends Base{
|
||||
/**
|
||||
* 跳去登录页
|
||||
*/
|
||||
public function login(){
|
||||
if('quanlianggongmall' == input('key')){
|
||||
model('CronJobs')->autoByAdmin();
|
||||
return $this->fetch("/login");
|
||||
}else{
|
||||
echo 'hello';
|
||||
}
|
||||
}
|
||||
|
||||
public function index(){
|
||||
$m = new Menus();
|
||||
$ms = $m->getMenus();
|
||||
// dump($ms);die;
|
||||
$this->assign("sysMenus",$ms);
|
||||
return $this->fetch("/index");
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
*/
|
||||
public function checkLogin(){
|
||||
$m = new Staffs();
|
||||
return $m->checkLogin();
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出系统
|
||||
*/
|
||||
public function logout(){
|
||||
session('WST_STAFF',null);
|
||||
return WSTReturn("退出成功,正在跳转页面", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统预览
|
||||
*/
|
||||
public function main(){
|
||||
$m = new M();
|
||||
$rs = $m->summary();
|
||||
$this->assign("object",$rs);
|
||||
return $this->fetch("/main");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户权限
|
||||
*/
|
||||
public function getGrants(){
|
||||
$rs = session('WST_STAFF');
|
||||
if(empty($rs))return WSTReturn("您未登录,请先登录系统",-1);
|
||||
$rs = $rs['privileges'];
|
||||
$grants = [];
|
||||
foreach ($rs as $v){
|
||||
$grants[$v] = true;
|
||||
}
|
||||
return WSTReturn("权限加载成功",1, $grants);
|
||||
}
|
||||
/**
|
||||
* 清除缓存
|
||||
*/
|
||||
public function clearcache(){
|
||||
WSTClearAllCache();
|
||||
return WSTReturn("清除成功!", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最新版本提示
|
||||
*/
|
||||
public function getVersion(){
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* 输入授权码
|
||||
*/
|
||||
public function enterLicense(){
|
||||
return $this->fetch("/enter_license");
|
||||
}
|
||||
/**
|
||||
* 验证授权码
|
||||
*/
|
||||
public function verifyLicense(){
|
||||
|
||||
}
|
||||
|
||||
}
|
51
hyhproject/admin/controller/Informs.php
Executable file
51
hyhproject/admin/controller/Informs.php
Executable file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Informs as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 订单投诉控制器
|
||||
*/
|
||||
class Informs extends Base{
|
||||
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
/**
|
||||
* 查看举报信息
|
||||
*/
|
||||
public function view(){
|
||||
$m = model('informs');
|
||||
if((int)Input('cid')>0){
|
||||
$data = $m->getDetail();
|
||||
$this->assign('data',$data);
|
||||
}
|
||||
return $this->fetch('view');
|
||||
}
|
||||
/**
|
||||
* 跳去处理页面
|
||||
*/
|
||||
public function toHandle(){
|
||||
$m = model('informs');
|
||||
if(Input('cid')>0){
|
||||
$data = $m->getDetail();
|
||||
$this->assign('data',$data);
|
||||
}
|
||||
return $this->fetch("handle");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
/**
|
||||
* 举报记录
|
||||
*/
|
||||
public function finalHandle(){
|
||||
return model('Informs')->finalHandle();
|
||||
}
|
||||
|
||||
|
||||
}
|
41
hyhproject/admin/controller/Logmoneys.php
Executable file
41
hyhproject/admin/controller/Logmoneys.php
Executable file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\LogMoneys as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 资金流水日志控制器
|
||||
*/
|
||||
class Logmoneys extends Base{
|
||||
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户分页
|
||||
*/
|
||||
public function pageQueryByUser(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQueryByUser());
|
||||
}
|
||||
/**
|
||||
* 获取商分页
|
||||
*/
|
||||
public function pageQueryByShop(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQueryByShop());
|
||||
}
|
||||
/**
|
||||
* 获取指定记录
|
||||
*/
|
||||
public function tologmoneys(){
|
||||
$m = new M();
|
||||
$object = $m->getUserInfoByType();
|
||||
$this->assign("object",$object);
|
||||
return $this->fetch("list_log");
|
||||
}
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
}
|
28
hyhproject/admin/controller/Logoperates.php
Executable file
28
hyhproject/admin/controller/Logoperates.php
Executable file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\LogOperates as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 操作日志控制器
|
||||
*/
|
||||
class Logoperates extends Base{
|
||||
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
/**
|
||||
* 获取指定记录
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
return $m->getById(input('id/d',0));
|
||||
}
|
||||
}
|
22
hyhproject/admin/controller/Logsms.php
Executable file
22
hyhproject/admin/controller/Logsms.php
Executable file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\LogSms as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 登录日志控制器
|
||||
*/
|
||||
class Logsms extends Base{
|
||||
|
||||
public function index(){
|
||||
|
||||
return $this->fetch("list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
}
|
22
hyhproject/admin/controller/Logstafflogins.php
Executable file
22
hyhproject/admin/controller/Logstafflogins.php
Executable file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\LogStaffLogins as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 登录日志控制器
|
||||
*/
|
||||
class Logstafflogins extends Base{
|
||||
|
||||
public function index(){
|
||||
|
||||
return $this->fetch("list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
}
|
22
hyhproject/admin/controller/Member.php
Executable file
22
hyhproject/admin/controller/Member.php
Executable file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Member as M;
|
||||
|
||||
class Member extends Base{
|
||||
public function index(){
|
||||
return $this->fetch('member');
|
||||
}
|
||||
//分页获取
|
||||
public function memberByPage(){
|
||||
$m=new M();
|
||||
return WSTGrid($m->memberByPage());
|
||||
}
|
||||
/**
|
||||
* 导出订单
|
||||
*/
|
||||
public function toExport(){
|
||||
$m = new M();
|
||||
$rs = $m->toExport();
|
||||
$this->assign('rs',$rs);
|
||||
}
|
||||
}
|
49
hyhproject/admin/controller/Menus.php
Executable file
49
hyhproject/admin/controller/Menus.php
Executable file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Menus as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 菜单控制器
|
||||
*/
|
||||
class Menus extends Base{
|
||||
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单列表
|
||||
*/
|
||||
public function listQuery(){
|
||||
$m = new M();
|
||||
return $m->listQuery((int)Input("post.id",-1));
|
||||
}
|
||||
/**
|
||||
* 获取菜单
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
return $m->getById((int)Input("post.id"));
|
||||
}
|
||||
/**
|
||||
* 新增菜单
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
return $m->add();
|
||||
}
|
||||
/**
|
||||
* 编辑菜单
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
/**
|
||||
* 删除菜单
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
}
|
78
hyhproject/admin/controller/Messages.php
Executable file
78
hyhproject/admin/controller/Messages.php
Executable file
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Messages as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 商城消息控制器
|
||||
*/
|
||||
class Messages extends Base{
|
||||
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
/**
|
||||
* 查找用户
|
||||
*/
|
||||
public function userQuery(){
|
||||
$m = model('users');
|
||||
return $m->getByName(input('post.loginName'));
|
||||
}
|
||||
/**
|
||||
* 发送消息
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
return $m->add();
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
/**
|
||||
* 查看完整消息
|
||||
*/
|
||||
public function showFullMsg(){
|
||||
$m = new M();
|
||||
$rs = $m->getById(Input("id/d",0));
|
||||
return $this->fetch('msg', ['data'=>$rs]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
49
hyhproject/admin/controller/Mobilebtns.php
Executable file
49
hyhproject/admin/controller/Mobilebtns.php
Executable file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\MobileBtns as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 移动端按钮管理控制器
|
||||
*/
|
||||
class Mobilebtns extends Base{
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
/*
|
||||
* 获取数据
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
return $m->getById(Input("id/d",0));
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
return $m->add();
|
||||
}
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
|
||||
|
||||
}
|
69
hyhproject/admin/controller/Navs.php
Executable file
69
hyhproject/admin/controller/Navs.php
Executable file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Navs as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 导航控制器
|
||||
*/
|
||||
class Navs extends Base{
|
||||
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
/**
|
||||
* 跳去编辑页面
|
||||
*/
|
||||
public function toEdit(){
|
||||
//获取省级信息
|
||||
$this->assign('area1',model('areas')->listQuery(0));
|
||||
$m = new M();
|
||||
$rs = $m->getById((int)Input("get.id"));
|
||||
$this->assign("data",$rs);
|
||||
return $this->fetch("edit");
|
||||
}
|
||||
/*
|
||||
* 获取数据
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
return $m->getById((int)Input("id"));
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
return $m->add();
|
||||
}
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
/**
|
||||
* 显示隐藏
|
||||
*/
|
||||
public function editiIsShow(){
|
||||
$m = new M();
|
||||
return $m->editiIsShow();
|
||||
}
|
||||
|
||||
|
||||
}
|
120
hyhproject/admin/controller/Ordercomplains.php
Executable file
120
hyhproject/admin/controller/Ordercomplains.php
Executable file
@ -0,0 +1,120 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\OrderComplains as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 订单投诉控制器
|
||||
*/
|
||||
class OrderComplains extends Base{
|
||||
|
||||
public function index(){
|
||||
$areaList = model('areas')->listQuery(0);
|
||||
$this->assign("areaList",$areaList);
|
||||
return $this->fetch("list");
|
||||
}
|
||||
/**
|
||||
* 查看投诉信息
|
||||
*/
|
||||
public function view(){
|
||||
$m = model('OrderComplains');
|
||||
if((int)Input('cid')>0){
|
||||
$data = $m->getDetail();
|
||||
$this->assign('order',$data);
|
||||
$rs = model('orders')->getByView($data['orderId']);
|
||||
$this->assign('object',$rs);
|
||||
}
|
||||
return $this->fetch('view');
|
||||
}
|
||||
/**
|
||||
* 跳去处理页面
|
||||
*/
|
||||
public function toHandle(){
|
||||
$m = model('OrderComplains');
|
||||
if(Input('cid')>0){
|
||||
$data = $m->getDetail();
|
||||
$this->assign('order',$data);
|
||||
$rs = model('orders')->getByView($data['orderId']);
|
||||
$this->assign('object',$rs);
|
||||
}
|
||||
return $this->fetch("handle");
|
||||
}
|
||||
/**
|
||||
* 转交给应诉人回应
|
||||
*/
|
||||
public function deliverRespond(){
|
||||
return model('OrderComplains')->deliverRespond();
|
||||
}
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
/**
|
||||
* 仲裁投诉记录
|
||||
*/
|
||||
public function finalHandle(){
|
||||
return model('OrderComplains')->finalHandle();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* 获取数据
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
return $m->getById(Input("id/d",0));
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
return $m->add();
|
||||
}
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
|
||||
|
||||
}
|
46
hyhproject/admin/controller/Orderrefunds.php
Executable file
46
hyhproject/admin/controller/Orderrefunds.php
Executable file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\OrderRefunds as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 退款订单控制器
|
||||
*/
|
||||
class Orderrefunds extends Base{
|
||||
/**
|
||||
* 退款列表
|
||||
*/
|
||||
public function refund(){
|
||||
$areaList = model('areas')->listQuery(0);
|
||||
$this->assign("areaList",$areaList);
|
||||
return $this->fetch("list");
|
||||
}
|
||||
public function refundPageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->refundPageQuery());
|
||||
}
|
||||
/**
|
||||
* 跳去退款界面
|
||||
*/
|
||||
public function toRefund(){
|
||||
$m = new M();
|
||||
$object = $m->getInfoByRefund();
|
||||
$this->assign("object",$object);
|
||||
return $this->fetch("box_refund");
|
||||
}
|
||||
/**
|
||||
* 退款
|
||||
*/
|
||||
public function orderRefund(){
|
||||
$m = new M();
|
||||
return $m->orderRefund();
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出订单
|
||||
*/
|
||||
public function toExport(){
|
||||
$m = new M();
|
||||
$rs = $m->toExport();
|
||||
$this->assign('rs',$rs);
|
||||
}
|
||||
}
|
95
hyhproject/admin/controller/Orders.php
Executable file
95
hyhproject/admin/controller/Orders.php
Executable file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace wstmart\admin\controller;
|
||||
|
||||
use wstmart\admin\model\Orders as M;
|
||||
|
||||
/**
|
||||
|
||||
* ============================================================================
|
||||
|
||||
* 订单控制器
|
||||
|
||||
*/
|
||||
|
||||
class Orders extends Base{
|
||||
|
||||
/**
|
||||
|
||||
* 订单列表
|
||||
|
||||
*/
|
||||
|
||||
public function index(){
|
||||
|
||||
$areaList = model('areas')->listQuery(0);
|
||||
|
||||
$this->assign("areaList",$areaList);
|
||||
|
||||
$this->assign("userId",(int)input('userId'));
|
||||
|
||||
return $this->fetch("list");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* 获取分页
|
||||
|
||||
*/
|
||||
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery((int)input('orderStatus',10000)));
|
||||
}
|
||||
//凭证列表
|
||||
public function certificate(){
|
||||
return $this->fetch("certificate_list");
|
||||
}
|
||||
//获取凭证列表
|
||||
public function getCertificate(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->getCertificate());
|
||||
}
|
||||
//凭证设置
|
||||
public function certificateSet(){
|
||||
$m = new M();
|
||||
exit(json_encode($m->certificateSet()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* 获取订单详情
|
||||
|
||||
*/
|
||||
|
||||
public function view(){
|
||||
|
||||
$m = new M();
|
||||
|
||||
$rs = $m->getByView(Input("id/d",0));
|
||||
|
||||
$this->assign("object",$rs);
|
||||
|
||||
return $this->fetch("view");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* 导出订单
|
||||
|
||||
*/
|
||||
|
||||
public function toExport(){
|
||||
|
||||
$m = new M();
|
||||
|
||||
$rs = $m->toExport();
|
||||
|
||||
$this->assign('rs',$rs);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
64
hyhproject/admin/controller/Payments.php
Executable file
64
hyhproject/admin/controller/Payments.php
Executable file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Payments as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 支付控制器
|
||||
*/
|
||||
class Payments extends Base{
|
||||
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
/**
|
||||
* 跳去编辑页面
|
||||
*/
|
||||
public function toEdit(){
|
||||
$m = new M();
|
||||
$rs = $m->getById((int)Input("get.id"));
|
||||
$payConfig = json_decode($rs['payConfig']);
|
||||
//判断是否为空
|
||||
if(!empty($payConfig)){
|
||||
foreach($payConfig as $k=>$v)
|
||||
$rs[$k]=$v;
|
||||
}
|
||||
$this->assign("object",$rs);
|
||||
return $this->fetch("pay_".input('get.payCode'));
|
||||
}
|
||||
/*
|
||||
* 获取数据
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
return $m->getById((int)Input("id"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
//商家选择支付方式
|
||||
public function pay(){
|
||||
$m=new M();
|
||||
return $m->pay();
|
||||
}
|
||||
|
||||
}
|
213
hyhproject/admin/controller/Platform.php
Executable file
213
hyhproject/admin/controller/Platform.php
Executable file
@ -0,0 +1,213 @@
|
||||
<?php
|
||||
|
||||
namespace wstmart\admin\controller;
|
||||
|
||||
use wstmart\admin\model\Platform as M;
|
||||
|
||||
/**
|
||||
|
||||
* ============================================================================
|
||||
|
||||
* 基础控业务处理
|
||||
|
||||
*/
|
||||
|
||||
|
||||
class Platform extends Base{
|
||||
|
||||
//列表
|
||||
|
||||
public function index(){
|
||||
|
||||
$where=[];
|
||||
|
||||
$map=[];
|
||||
|
||||
$page_map=[];
|
||||
|
||||
//接受时间
|
||||
|
||||
if (Request()->isPost()) {
|
||||
|
||||
$start_date=input('start');
|
||||
|
||||
$end_date=input('end');
|
||||
|
||||
$start=strtotime($start_date);
|
||||
|
||||
$end=strtotime($end_date);
|
||||
|
||||
if($start && $end){
|
||||
|
||||
$where['createTime'] =array('between',[$start,$end]);
|
||||
|
||||
$map['createTime'] =array('between',[$start_date,$end_date]);
|
||||
|
||||
$page_map['create_time']=array('between',[$start,$end]);
|
||||
|
||||
}elseif($start){
|
||||
|
||||
$where['createTime'] =array('egt',$start);
|
||||
|
||||
$map['createTime'] =array('egt',$start_date);
|
||||
|
||||
$page_map['create_time']=array('egt',$start);
|
||||
|
||||
}elseif($end){
|
||||
|
||||
$where['createTime'] =array('elt',$end);
|
||||
|
||||
$page_map['create_time']=array('elt',$end);
|
||||
|
||||
$map['createTime'] =array('egt',$end_date);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//判断时间周期内的注册数量
|
||||
|
||||
$where['loginSrc']=0;
|
||||
|
||||
$result['pcNum'] = db('login_src')->where($where)->count();
|
||||
|
||||
$where['loginSrc']=1;
|
||||
|
||||
$result['webappNum'] = db('login_src')->where($where)->count();
|
||||
|
||||
$where['loginSrc']=2 ;
|
||||
|
||||
$result['appNum'] = db('login_src')->where($where)->count();
|
||||
|
||||
//查询出所有新注册用户
|
||||
|
||||
unset($where['loginSrc']);
|
||||
|
||||
//dump($ids);
|
||||
|
||||
//下过单的用户
|
||||
|
||||
if(Request()->isAjax()){
|
||||
|
||||
$userIds=db('login_src')->where($where)->field('userId')->select();
|
||||
|
||||
$ids=[];
|
||||
|
||||
foreach ($userIds as &$value) {
|
||||
|
||||
$ids[]=$value['userId'];
|
||||
|
||||
}
|
||||
|
||||
$map['userId']=array('in',$ids);
|
||||
|
||||
$page_map['userId']=array('in',$ids);
|
||||
|
||||
}
|
||||
|
||||
$map['isPay']=1;
|
||||
|
||||
$result['validUser']=db('orders')->where($map)->group('userId')->count('userId');
|
||||
|
||||
//总单数
|
||||
|
||||
$orderNum=db('orders')->where($map)->count('orderId');
|
||||
|
||||
//总浏览
|
||||
|
||||
$viewNum=db('page_view')->where($page_map)->count('id');
|
||||
|
||||
// dump($orderNum);
|
||||
|
||||
// dump($viewNum);
|
||||
|
||||
//转换率
|
||||
|
||||
if($orderNum==0 || $viewNum==0){
|
||||
|
||||
$result['orderRade']="0".'%';
|
||||
|
||||
}else{
|
||||
|
||||
$result['orderRade']=(round($orderNum/$viewNum,2)*100).'%';
|
||||
|
||||
}
|
||||
|
||||
//dump($result);
|
||||
|
||||
if (Request()->isAjax()) {
|
||||
|
||||
exit(jsonReturn('',1,$result));
|
||||
|
||||
}
|
||||
|
||||
$this->assign('object',$result);
|
||||
|
||||
//dump($result);
|
||||
|
||||
return $this->fetch('platform');
|
||||
|
||||
}
|
||||
|
||||
// //获取分页
|
||||
|
||||
// public function platformByPage(){
|
||||
|
||||
// $m=new M();
|
||||
|
||||
// $result=$m->platformByPage();
|
||||
|
||||
// $result['status'] = 1;
|
||||
|
||||
// return WSTGrid($result);
|
||||
|
||||
// }
|
||||
//查看券值记录
|
||||
|
||||
public function viewData(){
|
||||
if(Request()->isAjax()){
|
||||
$dataType = input('post.dataType');
|
||||
$start_date = input('start');
|
||||
$end_date = input('end');
|
||||
$start = strtotime($start_date);
|
||||
$end = strtotime($end_date);
|
||||
$m = Model('common/Table');
|
||||
$m->setTable('user_vouchers_notice');
|
||||
$result['num'] = 0;
|
||||
$where = [];
|
||||
$map = [];
|
||||
if($start && $end){
|
||||
$where['createTime'] =array('between',[$start,$end]);
|
||||
$map['createTime'] =array('between',[$start_date,$end_date]);
|
||||
}elseif($start){
|
||||
$where['createTime'] =array('egt',$start);
|
||||
$map['createTime'] =array('egt',$start_date);
|
||||
}elseif($end){
|
||||
$where['createTime'] =array('elt',$end);
|
||||
$map['createTime'] =array('egt',$end_date);
|
||||
}
|
||||
switch ($dataType) {
|
||||
case 1://预获产品券
|
||||
$result['num'] = $m->getSum(array_merge($where,['moneyType'=>1]),'expectedProductNum');
|
||||
$result['num'] -= $m->getSum(array_merge($where,['moneyType'=>0]),'expectedProductNum');
|
||||
break;
|
||||
case 2://预获优惠券
|
||||
$result['num'] = $m->getSum(array_merge($where,['moneyType'=>1]),'expectedCouponsNum');
|
||||
$result['num'] -= $m->getSum(array_merge($where,['moneyType'=>0]),'expectedCouponsNum');
|
||||
break;
|
||||
case 3://产品券
|
||||
case 4://优惠券
|
||||
case 5://旺旺券
|
||||
$dataType-=2;
|
||||
$m->setTable('log_moneys');
|
||||
$result['num'] = $m->getSum(array_merge($map,['dataFlag'=>1,'moneyType'=>1,'moneyName'=>$dataType]),'money');
|
||||
$result['num'] -= $m->getSum(array_merge($map,['dataFlag'=>1,'moneyType'=>0,'moneyName'=>$dataType]),'money');
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
exit(jsonReturn('',1,$result));
|
||||
}
|
||||
return $this->fetch('view_data');
|
||||
}
|
||||
}
|
58
hyhproject/admin/controller/Privileges.php
Executable file
58
hyhproject/admin/controller/Privileges.php
Executable file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Privileges as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 权限控制器
|
||||
*/
|
||||
class privileges extends Base{
|
||||
/**
|
||||
* 获取权限列表
|
||||
*/
|
||||
public function listQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->listQuery((int)Input("id")));
|
||||
}
|
||||
/**
|
||||
* 获取权限
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
return $m->getById((int)Input("id"));
|
||||
}
|
||||
/**
|
||||
* 新增权限
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
return $m->add();
|
||||
}
|
||||
/**
|
||||
* 编辑权限
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
/**
|
||||
* 删除权限
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
/**
|
||||
* 检测权限代码是否存在
|
||||
*/
|
||||
public function checkPrivilegeCode(){
|
||||
$m = new M();
|
||||
return $m->checkPrivilegeCode();
|
||||
}
|
||||
/**
|
||||
* 获取角色的权限
|
||||
*/
|
||||
public function listQueryByRole(){
|
||||
$m = new M();
|
||||
return $m->listQueryByRole((int)Input("id"));
|
||||
}
|
||||
}
|
97
hyhproject/admin/controller/Recommends.php
Executable file
97
hyhproject/admin/controller/Recommends.php
Executable file
@ -0,0 +1,97 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Recommends as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 推荐管理控制器
|
||||
*/
|
||||
class Recommends extends Base{
|
||||
/**
|
||||
* 查看商品推荐
|
||||
*/
|
||||
public function goods(){
|
||||
return $this->fetch('goods');
|
||||
}
|
||||
/**
|
||||
* 查询商品
|
||||
*/
|
||||
public function searchGoods(){
|
||||
$rs = model('Goods')->searchQuery();
|
||||
return WSTReturn("", 1,$rs);
|
||||
}
|
||||
/**
|
||||
* 推荐商品
|
||||
*/
|
||||
public function editGoods(){
|
||||
$m = new M();
|
||||
return $m->editGoods();
|
||||
}
|
||||
/**
|
||||
* 获取已选择商品
|
||||
*/
|
||||
public function listQueryByGoods(){
|
||||
$m = new M();
|
||||
$rs= $m->listQueryByGoods();
|
||||
return WSTReturn("", 1,$rs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看店铺推荐
|
||||
*/
|
||||
public function shops(){
|
||||
return $this->fetch('shops');
|
||||
}
|
||||
/**
|
||||
* 查询店铺
|
||||
*/
|
||||
public function searchShops(){
|
||||
$rs = model('Shops')->searchQuery();
|
||||
return WSTReturn("", 1,$rs);
|
||||
}
|
||||
/**
|
||||
* 推荐店铺
|
||||
*/
|
||||
public function editShops(){
|
||||
$m = new M();
|
||||
return $m->editShops();
|
||||
}
|
||||
/**
|
||||
* 获取已选择店铺
|
||||
*/
|
||||
public function listQueryByShops(){
|
||||
$m = new M();
|
||||
$rs= $m->listQueryByShops();
|
||||
return WSTReturn("", 1,$rs);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查看品牌推荐
|
||||
*/
|
||||
public function brands(){
|
||||
return $this->fetch('brands');
|
||||
}
|
||||
/**
|
||||
* 查询品牌
|
||||
*/
|
||||
public function searchBrands(){
|
||||
$rs = model('Brands')->searchBrands();
|
||||
return WSTReturn("", 1,$rs);
|
||||
}
|
||||
/**
|
||||
* 推荐品牌
|
||||
*/
|
||||
public function editBrands(){
|
||||
$m = new M();
|
||||
$rs= $m->editBrands();
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 获取已选择品牌
|
||||
*/
|
||||
public function listQueryByBrands(){
|
||||
$m = new M();
|
||||
$rs= $m->listQueryByBrands();
|
||||
return WSTReturn("", 1,$rs);
|
||||
}
|
||||
}
|
159
hyhproject/admin/controller/Reports.php
Executable file
159
hyhproject/admin/controller/Reports.php
Executable file
@ -0,0 +1,159 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Reports as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 报表控制器
|
||||
*/
|
||||
class Reports extends Base{
|
||||
/**
|
||||
* 商品销售排行
|
||||
*/
|
||||
public function toTopSaleGoods(){
|
||||
$this->assign("startDate",date('Y-m-d',strtotime("-1month")));
|
||||
$this->assign("endDate",date('Y-m-d'));
|
||||
return $this->fetch("/reports/top_sale_goods");
|
||||
}
|
||||
/**
|
||||
* 获取商品排行数据
|
||||
*/
|
||||
public function topSaleGoodsByPage(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->topSaleGoodsByPage());
|
||||
}
|
||||
/**
|
||||
* 店铺销售排行
|
||||
*/
|
||||
public function toTopShopSales(){
|
||||
$this->assign("startDate",date('Y-m-d',strtotime("-1month")));
|
||||
$this->assign("endDate",date('Y-m-d'));
|
||||
return $this->fetch("/reports/top_sale_shop");
|
||||
}
|
||||
/**
|
||||
* 获取店铺排行数据
|
||||
*/
|
||||
public function topShopSalesByPage(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->topShopSalesByPage());
|
||||
}
|
||||
/**
|
||||
* 获取销售额
|
||||
*/
|
||||
public function toStatSales(){
|
||||
$this->assign("startDate",date('Y-m-d',strtotime("-1month")));
|
||||
$this->assign("endDate",date('Y-m-d'));
|
||||
return $this->fetch("/reports/stat_sales");
|
||||
}
|
||||
public function statSales(){
|
||||
$m = new M();
|
||||
return $m->statSales();
|
||||
}
|
||||
/**
|
||||
* 获取订单统计
|
||||
*/
|
||||
public function toStatOrders(){
|
||||
$this->assign("startDate",date('Y-m-d',strtotime("-1month")));
|
||||
$this->assign("endDate",date('Y-m-d'));
|
||||
return $this->fetch("/reports/stat_orders");
|
||||
}
|
||||
/*
|
||||
*
|
||||
*/
|
||||
public function getOrders(){
|
||||
$m = new M();
|
||||
return $m->getOrders();
|
||||
}
|
||||
public function statOrders(){
|
||||
$m = new M();
|
||||
return $m->statOrders();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取每日新增用户
|
||||
*/
|
||||
public function toStatNewUser(){
|
||||
$this->assign("startDate",date('Y-m-d',strtotime("-1month")));
|
||||
$this->assign("endDate",date('Y-m-d'));
|
||||
return $this->fetch("/reports/stat_new_user");
|
||||
}
|
||||
public function statNewUser(){
|
||||
$start = date('Y-m-d 00:00:00',strtotime(input('startDate')));
|
||||
$end = date('Y-m-d 23:59:59',strtotime(input('endDate')));
|
||||
$where='dataFlag=1 AND userStatus=1 AND userType=0';
|
||||
$totalNum=db('users')->where($where)->count('userId');
|
||||
if($start!='' && $end!=''){
|
||||
$start = date('Y-m-d 00:00:00',strtotime(input('startDate')));
|
||||
$end = date('Y-m-d 23:59:59',strtotime(input('endDate')));
|
||||
$where.=' AND createTime BETWEEN "'.$start.'" AND "'.$end.'"';
|
||||
}else if($start!=''){
|
||||
$start = date('Y-m-d 00:00:00',strtotime(input('startDate')));
|
||||
$where.= ' AND createTime>="'.$start.'"';
|
||||
}else if($end!=''){
|
||||
$end = date('Y-m-d 00:00:00',strtotime(input('endDate')));
|
||||
$where.= ' AND createTime<="'.$end.'"';
|
||||
}
|
||||
$aa=array('dsad');
|
||||
$groupNum=db('users')->where($where)->count('userId');
|
||||
$groupRate=$groupNum/$totalNum;
|
||||
$m = new M();
|
||||
$a= $m->statNewUser();
|
||||
$a['groupNum']=$groupNum;
|
||||
$a['groupRate']=$groupRate;
|
||||
$this->assign('a',$a);
|
||||
return $a;
|
||||
}
|
||||
/*
|
||||
* 首页获取新增用户
|
||||
*/
|
||||
public function getNewUser(){
|
||||
$m = new M();
|
||||
$data = cache('userNumData');
|
||||
if(empty($data)){
|
||||
$rdata = $m->statNewUser();
|
||||
cache('userNumData',$rdata,7200);
|
||||
}else{
|
||||
$rdata = cache('userNumData');
|
||||
}
|
||||
return $rdata;
|
||||
}
|
||||
/**
|
||||
* 会员登录统计
|
||||
*/
|
||||
public function toStatUserLogin(){
|
||||
$this->assign("startDate",date('Y-m-d',strtotime("-1month")));
|
||||
$this->assign("endDate",date('Y-m-d'));
|
||||
return $this->fetch("/reports/stat_user_login");
|
||||
}
|
||||
public function statUserLogin(){
|
||||
$m = new M();
|
||||
return $m->statUserLogin();
|
||||
}
|
||||
/**
|
||||
* 导出商品销售订单
|
||||
*/
|
||||
public function toExportGoods(){
|
||||
$m = new M();
|
||||
$rs = $m->toExportGoods();
|
||||
$this->assign('rs',$rs);
|
||||
}
|
||||
/**
|
||||
* 导出商家销售订单
|
||||
*/
|
||||
public function toExportShop(){
|
||||
$m = new M();
|
||||
$rs = $m->toExportShop();
|
||||
$this->assign('rs',$rs);
|
||||
}
|
||||
// 店铺商品销售统计
|
||||
public function detail(){
|
||||
$this->assign("startDate",date('Y-m-d',strtotime("-1month")));
|
||||
$this->assign("endDate",date('Y-m-d'));
|
||||
return $this->fetch('detail');
|
||||
}
|
||||
public function detailByPage(){
|
||||
$m=new M();
|
||||
$result=$m->detailByPage();
|
||||
return $result;
|
||||
}
|
||||
}
|
60
hyhproject/admin/controller/Roles.php
Executable file
60
hyhproject/admin/controller/Roles.php
Executable file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Roles as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 角色控制器
|
||||
*/
|
||||
class Roles extends Base{
|
||||
|
||||
public function index(){
|
||||
|
||||
return $this->fetch("list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
/**
|
||||
* 获取菜单
|
||||
*/
|
||||
public function get(){
|
||||
|
||||
$m = new M();
|
||||
return $m->get((int)Input("post.id"));
|
||||
}
|
||||
/**
|
||||
* 跳去编辑页面
|
||||
*/
|
||||
public function toEdit(){
|
||||
$m = new M();
|
||||
$rs = $m->getById((int)Input("get.id"));
|
||||
$this->assign("object",$rs);
|
||||
return $this->fetch("edit");
|
||||
}
|
||||
/**
|
||||
* 新增菜单
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
return $m->add();
|
||||
}
|
||||
/**
|
||||
* 编辑菜单
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
/**
|
||||
* 删除菜单
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
}
|
102
hyhproject/admin/controller/Settlements.php
Executable file
102
hyhproject/admin/controller/Settlements.php
Executable file
@ -0,0 +1,102 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Settlements as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 结算控制器
|
||||
*/
|
||||
class Settlements extends Base{
|
||||
public function index(){
|
||||
return $this->fetch('list');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
/**
|
||||
* 跳去结算页面
|
||||
*/
|
||||
public function toHandle(){
|
||||
$m = new M();
|
||||
$object = $m->getById();
|
||||
$this->assign("object",$object);
|
||||
return $this->fetch('edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理订单
|
||||
*/
|
||||
public function handle(){
|
||||
$m = new M();
|
||||
return $m->handle();
|
||||
}
|
||||
/**
|
||||
* 跳去结算详情
|
||||
*/
|
||||
public function toView(){
|
||||
$m = new M();
|
||||
$object = $m->getById();
|
||||
$this->assign("object",$object);
|
||||
return $this->fetch('view');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单商品
|
||||
*/
|
||||
public function pageGoodsQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageGoodsQuery());
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
* 以下是平台主动生成结算单
|
||||
************************************************/
|
||||
/**
|
||||
* 进入平台结算野蛮
|
||||
*/
|
||||
public function toShopIndex(){
|
||||
$this->assign("areaList",model('areas')->listQuery(0));
|
||||
return $this->fetch('list_shop');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取待结算的商家列表
|
||||
*/
|
||||
public function pageShopQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageShopQuery());
|
||||
}
|
||||
/**
|
||||
* 进入订单列表页面
|
||||
*/
|
||||
public function toOrders(){
|
||||
$this->assign("id",(int)input('id'));
|
||||
return $this->fetch('list_order');
|
||||
}
|
||||
/**
|
||||
* 获取商家的待结算订单列表
|
||||
*/
|
||||
public function pageShopOrderQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageShopOrderQuery());
|
||||
}
|
||||
/**
|
||||
* 生成结算单
|
||||
*/
|
||||
public function generateSettleByShop(){
|
||||
$m = new M();
|
||||
return $m->generateSettleByShop();
|
||||
}
|
||||
/**
|
||||
* 导出
|
||||
*/
|
||||
public function toExport(){
|
||||
$m = new M();
|
||||
$rs = $m->toExport();
|
||||
$this->assign('rs',$rs);
|
||||
}
|
||||
}
|
294
hyhproject/admin/controller/Shops.php
Executable file
294
hyhproject/admin/controller/Shops.php
Executable file
@ -0,0 +1,294 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Shops as M;
|
||||
use wstmart\common\model\Table as TM;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 店铺控制器
|
||||
*/
|
||||
class Shops extends Base{
|
||||
public function index(){
|
||||
$this->assign("areaList",model('areas')->listQuery(0));
|
||||
$this->assign("catList",model('GoodsCats')->listQuery(0));
|
||||
return $this->fetch("list");
|
||||
|
||||
}
|
||||
|
||||
public function stopIndex(){
|
||||
$this->assign("areaList",model('areas')->listQuery(0));
|
||||
return $this->fetch("list_stop");
|
||||
}
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
/**
|
||||
* 停用店铺列表
|
||||
*/
|
||||
public function pageStopQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery(-1));
|
||||
}
|
||||
// 商家登录
|
||||
public function detail(){
|
||||
$this->assign("startDate",date('Y-m-d',strtotime("-1month")));
|
||||
$this->assign("endDate",date('Y-m-d'));
|
||||
return $this->fetch('detail');
|
||||
}
|
||||
public function detailByPage(){
|
||||
$m=new M();
|
||||
$result=$m->detailByPage();
|
||||
return WSTGrid($result);
|
||||
}
|
||||
/**
|
||||
* 获取菜单
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
return $m->get((int)Input("post.id"));
|
||||
}
|
||||
/**
|
||||
* 跳去编辑页面
|
||||
*/
|
||||
public function toEdit(){
|
||||
$m = new M();
|
||||
$id = (int)Input("get.id");
|
||||
if($id>0){
|
||||
$object = $m->getById((int)Input("get.id"));
|
||||
$object['auxiliary']=db('shop_auxiliary')->where('shopId',$object['shopId'])->select();
|
||||
$data['object']=$object;
|
||||
}else{
|
||||
$object = $m->getEModel('shops');
|
||||
$object['catshops'] = [];
|
||||
$object['accreds'] = [];
|
||||
$object['loginName'] = '';
|
||||
$data['object']=$object;
|
||||
}
|
||||
$data['goodsCatList'] = model('goodsCats')->listQuery(0);
|
||||
$data['accredList'] = model('accreds')->listQuery(0);
|
||||
$data['bankList'] = model('banks')->listQuery();
|
||||
$data['areaList'] = model('areas')->listQuery(0);
|
||||
if($id>0){
|
||||
return $this->fetch("edit",$data);
|
||||
}else{
|
||||
return $this->fetch("add",$data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增菜单
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
return $m->add();
|
||||
}
|
||||
/**
|
||||
* 编辑菜单
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
/**
|
||||
* 删除菜单
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测店铺编号是否存在
|
||||
*/
|
||||
public function checkShopSn(){
|
||||
$m = new M();
|
||||
$isChk = $m->checkShopSn(input('post.shopSn'),input('shopId/d'));
|
||||
if(!$isChk){
|
||||
return ['ok'=>'该店铺编号可用'];
|
||||
}else{
|
||||
return ['error'=>'对不起,该店铺编号已存在'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 自营店铺后台
|
||||
*/
|
||||
public function inself(){
|
||||
$staffId=session("WST_STAFF");
|
||||
if(!empty($staffId)){
|
||||
$id=1;
|
||||
$s = new M();
|
||||
$r = $s->selfLogin($id);
|
||||
if($r['status']==1){
|
||||
header("Location: ".Url('home/shops/index'));
|
||||
exit();
|
||||
}
|
||||
}
|
||||
header("Location: ".Url('home/shops/selfShop'));
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳去店铺申请列表
|
||||
*/
|
||||
public function apply(){
|
||||
$this->assign("areaList",model('Position')->listQuery());
|
||||
//$this->assign("areaList",model('areas')->listQuery(0));
|
||||
return $this->fetch("list_apply");
|
||||
}
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQueryByApply(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQueryByApply());
|
||||
}
|
||||
/**
|
||||
* 获取店铺申请列表
|
||||
*/
|
||||
public function shopApplyList(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->shopApplyList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 去处理开店申请
|
||||
*/
|
||||
public function applyEdit(){
|
||||
$data = [];
|
||||
$id = input('get.id/d');
|
||||
// dump($id);
|
||||
$m = new TM();
|
||||
$m->setTable('shops');
|
||||
$data['object'] = $m->getInfo(['shopId'=>$id],'*');
|
||||
$data['object']['applyTime'] = date('Y-m-d H:i:s',$data['object']['createTime']);
|
||||
//改成用户表
|
||||
$m->setTable('users');
|
||||
$data['object']['user'] = $m->getInfo(['userId'=>$data['object']['userId']],'loginName,trueName');
|
||||
$areas=['province','city','county','town','village'];
|
||||
$data['object']['area'] = '';
|
||||
foreach ($areas as $v) {
|
||||
$m->setTable('position_'.$v);
|
||||
$data['object']['area'] .=$m->getField([$v.'_id'=>$data['object'][$v.'Id']],$v.'_name').'-';
|
||||
}
|
||||
|
||||
|
||||
// //改成省表
|
||||
// $m->setTable('position_province');
|
||||
// $data['object']['area'] = $m->getField(['province_id'=>$data['object']['provinceId']],'province_name');
|
||||
// //改成市表
|
||||
// $m->setTable('position_city');
|
||||
// $data['object']['area'] .='-'.$m->getField(['city_id'=>$data['object']['cityId']],'city_name');
|
||||
// //改成区表
|
||||
// $m->setTable('position_county');
|
||||
// $data['object']['area'] .='-'.$m->getField(['county_id'=>$data['object']['countyId']],'county_name');
|
||||
// //改成乡镇表
|
||||
// $m->setTable('position_town');
|
||||
// $data['object']['area'] .='-'.$m->getField(['town_id'=>$data['object']['townId']],'town_name');
|
||||
// //改成村表
|
||||
// $m->setTable('position_village');
|
||||
// $data['object']['area'] .='-'.$m->getField(['village_id'=>$data['object']['villageId']],'village_name');
|
||||
// dump($data);die;
|
||||
return $this->fetch("apply_edit",$data);
|
||||
}
|
||||
/**
|
||||
* 去处理开店申请
|
||||
*/
|
||||
public function toHandleApply(){
|
||||
$data = [];
|
||||
$data['shoplicense']=db('shop_license')
|
||||
->where('shopId',(int)input("get.id"))
|
||||
->find();
|
||||
$data['cashDeposit'] = db('shops_deposit')->where('shopId',(int)input("get.id"))->find();
|
||||
$data['object'] = model('shops')->getShopApply((int)input("get.id"));
|
||||
$data['goodsCatList'] = model('goodsCats')->listQuery(0);
|
||||
$data['accredList'] = model('accreds')->listQuery(0);
|
||||
$data['bankList'] = model('banks')->listQuery();
|
||||
$data['areaList'] = model('areas')->listQuery(0);
|
||||
return $this->fetch("edit_apply",$data);
|
||||
}
|
||||
|
||||
public function delApply(){
|
||||
$m = new M();
|
||||
return $m->delApply();
|
||||
}
|
||||
|
||||
/**
|
||||
* 开店申请处理
|
||||
*/
|
||||
public function handleApply(){
|
||||
$m = new M();
|
||||
return $m->handleApply();
|
||||
}
|
||||
/**
|
||||
* 导出订单
|
||||
*/
|
||||
public function toExport(){
|
||||
$m = new M();
|
||||
$rs = $m->toExport();
|
||||
$this->assign('rs',$rs);
|
||||
}
|
||||
/**
|
||||
* 导出商家登录订单
|
||||
*/
|
||||
public function toExports(){
|
||||
$m = new M();
|
||||
$rs = $m->toExports();
|
||||
$this->assign('rs',$rs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理质保金页面
|
||||
*/
|
||||
public function toDeposit(){
|
||||
$m = new M();
|
||||
return $this->fetch('deposit');
|
||||
}
|
||||
/**
|
||||
* 质保金充值或扣除
|
||||
*/
|
||||
public function topDeposit(){
|
||||
$m = new M();
|
||||
$result = $m->topDeposit();
|
||||
exit(json_encode($result));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取店铺名称
|
||||
*/
|
||||
public function upShopName(){
|
||||
$m = new M();
|
||||
$res = $m->upShopName();
|
||||
// dump($res);die;
|
||||
exit(json_encode($res));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改佣金扣点
|
||||
*/
|
||||
public function commission(){
|
||||
$m = new M();
|
||||
$obj = $m->commission((int)Input("post.shopId"));
|
||||
exit(json_encode($obj));
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置店铺佣金扣点,业务员提成
|
||||
*/
|
||||
public function upCommission(){
|
||||
$m = new M();
|
||||
$result = $m->upCommission();
|
||||
exit(json_encode($result));
|
||||
}
|
||||
/**
|
||||
* 查询业务员信息
|
||||
*/
|
||||
public function staffs(){
|
||||
$m = new M();
|
||||
$data = $m->staffs();
|
||||
exit(json_encode($data));
|
||||
}
|
||||
}
|
76
hyhproject/admin/controller/Speccats.php
Executable file
76
hyhproject/admin/controller/Speccats.php
Executable file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\SpecCats as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 规格类别控制器
|
||||
*/
|
||||
class Speccats extends Base{
|
||||
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳去编辑页面
|
||||
*/
|
||||
public function toEdit(){
|
||||
//获取该记录信息
|
||||
$this->assign('data', $this->get());
|
||||
return $this->fetch("edit");
|
||||
}
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
return $m->getById(input("catId/d"));
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
return $m->add();
|
||||
}
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
/**
|
||||
* 显示隐藏
|
||||
*/
|
||||
public function setToggle(){
|
||||
$m = new M();
|
||||
return $m->setToggle();
|
||||
}
|
||||
|
||||
public function checkCatName(){
|
||||
$m = new M();
|
||||
$rs = $m->checkCatName();
|
||||
if($rs["status"]==1){
|
||||
return array("ok"=>"");
|
||||
}else{
|
||||
return array("error"=>$rs["msg"]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
92
hyhproject/admin/controller/Staffs.php
Executable file
92
hyhproject/admin/controller/Staffs.php
Executable file
@ -0,0 +1,92 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Staffs as M;
|
||||
use wstmart\admin\model\Roles as R;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 职员控制器
|
||||
*/
|
||||
class Staffs extends Base{
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
/**
|
||||
* 获取
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
return $m->get((int)Input("post.id"));
|
||||
}
|
||||
/**
|
||||
* 跳去新增界面
|
||||
*/
|
||||
public function toAdd(){
|
||||
$id = (int)Input("get.id",0);
|
||||
$m = new M();
|
||||
$this->assign("object",['staffId'=>0,'workStatus'=>1,'staffStatus'=>1]);
|
||||
$m = new R();
|
||||
$this->assign("roles",$m->listQuery());
|
||||
return $this->fetch("add");
|
||||
}
|
||||
/**
|
||||
* 跳去编辑页面
|
||||
*/
|
||||
public function toEdit(){
|
||||
$id = (int)Input("get.id",0);
|
||||
$m = new M();
|
||||
$rs = $m->getById($id);
|
||||
$this->assign("object",$rs);
|
||||
$m = new R();
|
||||
$this->assign("roles",$m->listQuery());
|
||||
return $this->fetch("edit");
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
return $m->add();
|
||||
}
|
||||
/**
|
||||
* 编辑菜单
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
/**
|
||||
* 删除菜单
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
/**
|
||||
* 检测账号是否重复
|
||||
*/
|
||||
public function checkLoginKey(){
|
||||
$m = new M();
|
||||
return $m->checkLoginKey(input('post.key'));
|
||||
}
|
||||
/**
|
||||
* 编辑自己密码
|
||||
*/
|
||||
public function editMyPass(){
|
||||
$m = new M();
|
||||
return $m->editMyPass((int)session('WST_STAFF.staffId'));
|
||||
}
|
||||
/**
|
||||
* 编辑职员密码
|
||||
*/
|
||||
public function editPass(){
|
||||
$m = new M();
|
||||
return $m->editPass((int)input('post.staffId'));
|
||||
}
|
||||
}
|
33
hyhproject/admin/controller/Styles.php
Executable file
33
hyhproject/admin/controller/Styles.php
Executable file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Styles as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 风格配置控制器
|
||||
*/
|
||||
class Styles extends Base{
|
||||
|
||||
public function index(){
|
||||
$m = new M();
|
||||
$rs = $m->getCats();
|
||||
$m->initStyles();
|
||||
$this->assign('cats',$rs);
|
||||
return $this->fetch();
|
||||
}
|
||||
/**
|
||||
* 获取风格列表
|
||||
*/
|
||||
public function listQueryBySys(){
|
||||
$m = new M();
|
||||
$rs = $m->listQuery();
|
||||
return WSTReturn('',1,$rs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
public function changeStyle(){
|
||||
$m = new M();
|
||||
return $m->changeStyle();
|
||||
}
|
||||
}
|
30
hyhproject/admin/controller/Sysconfigs.php
Executable file
30
hyhproject/admin/controller/Sysconfigs.php
Executable file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\SysConfigs as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 商城配置控制器
|
||||
*/
|
||||
class Sysconfigs extends Base{
|
||||
|
||||
public function index(){
|
||||
$m = new M();
|
||||
$object = $m->getSysConfigs();
|
||||
$this->assign("object",$object);
|
||||
$list = model('admin/staffs')->listQuery();
|
||||
$this->assign("list",$list);
|
||||
$tm = Model('common/Table');
|
||||
$tm->setTable('data_configs');
|
||||
$dataConfigs = $tm->getList([],'*');
|
||||
$this->assign("dataConfigs",$dataConfigs);
|
||||
return $this->fetch("edit");
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
}
|
95
hyhproject/admin/controller/Templatemsgs.php
Executable file
95
hyhproject/admin/controller/Templatemsgs.php
Executable file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\TemplateMsgs as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 消息模板控制器
|
||||
*/
|
||||
class Templatemsgs extends Base{
|
||||
|
||||
public function index(){
|
||||
$this->assign('src',(int)input('src'));
|
||||
return $this->fetch("list");
|
||||
}
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageMsgQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery(0,'TEMPLATE_SYS'));
|
||||
}
|
||||
/**
|
||||
* 设置是否显示/隐藏
|
||||
*/
|
||||
public function editiIsShow(){
|
||||
$m = new M();
|
||||
$rs = $m->editiIsShow();
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 跳转去新增页面
|
||||
*/
|
||||
public function toEditMsg(){
|
||||
$id = (int)input('id');
|
||||
$m = new M();
|
||||
if($id>0){
|
||||
$data = $m->getById($id);
|
||||
}else{
|
||||
$data = $m->getEModel('template_msgs');
|
||||
}
|
||||
$this->assign('object',$data);
|
||||
return $this->fetch("edit_msg");
|
||||
}
|
||||
/**
|
||||
* 跳转去新增页面
|
||||
*/
|
||||
public function toEditEmail(){
|
||||
$id = (int)input('id');
|
||||
$m = new M();
|
||||
if($id>0){
|
||||
$data = $m->getById($id);
|
||||
}else{
|
||||
$data = $m->getEModel('template_email');
|
||||
}
|
||||
$this->assign('object',$data);
|
||||
return $this->fetch("edit_email");
|
||||
}
|
||||
/**
|
||||
* 跳转去新增页面
|
||||
*/
|
||||
public function toEditSMS(){
|
||||
$id = (int)input('id');
|
||||
$m = new M();
|
||||
if($id>0){
|
||||
$data = $m->getById($id);
|
||||
}else{
|
||||
$data = $m->getEModel('template_sms');
|
||||
}
|
||||
$this->assign('object',$data);
|
||||
return $this->fetch("edit_sms");
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageEmailQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageEmailQuery());
|
||||
}
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageSMSQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery(2,'TEMPLATE_SMS'));
|
||||
}
|
||||
|
||||
}
|
59
hyhproject/admin/controller/Userranks.php
Executable file
59
hyhproject/admin/controller/Userranks.php
Executable file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\UserRanks as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 会员等级控制器
|
||||
*/
|
||||
class Userranks extends Base{
|
||||
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
/**
|
||||
* 跳去编辑页面
|
||||
*/
|
||||
public function toEdit(){
|
||||
$m = new M();
|
||||
$assign = ['data'=>$this->get(),
|
||||
'object'=>$m->getById((int)Input("post.id"))];
|
||||
return $this->fetch("edit",$assign);
|
||||
}
|
||||
/*
|
||||
* 获取数据
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
return $m->getById((int)Input("id"));
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
return $m->add();
|
||||
}
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
|
||||
|
||||
}
|
253
hyhproject/admin/controller/Users.php
Executable file
253
hyhproject/admin/controller/Users.php
Executable file
@ -0,0 +1,253 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Users as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 会员控制器
|
||||
*/
|
||||
class Users extends Base{
|
||||
/**
|
||||
* 个体认证审核
|
||||
*/
|
||||
public function personalReview(){
|
||||
return $this->fetch("personal_review_list");
|
||||
}
|
||||
/**
|
||||
* 个体认证审核列表
|
||||
*/
|
||||
public function getPersonalReview(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->getReview(1));
|
||||
}
|
||||
|
||||
/**
|
||||
* 个体认证操作
|
||||
*/
|
||||
public function personalAction(){
|
||||
$m = new M();
|
||||
return $m->authAction(1);
|
||||
}
|
||||
/**
|
||||
* 个体认证审核
|
||||
*/
|
||||
public function companyReview(){
|
||||
return $this->fetch("company_review_list");
|
||||
}
|
||||
/**
|
||||
* 个体认证审核列表
|
||||
*/
|
||||
public function getCompanyReview(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->getReview(2));
|
||||
}
|
||||
|
||||
/**
|
||||
* 个体认证操作
|
||||
*/
|
||||
public function companyAction(){
|
||||
$m = new M();
|
||||
return $m->authAction(2);
|
||||
}
|
||||
/**
|
||||
* 获取亲人认证/报备列表
|
||||
*/
|
||||
public function authFamilyList(){
|
||||
$m = Model('AuthFamily');
|
||||
if(1 == (int)input( 'post.isPersonal')){//亲人认证
|
||||
$m->setTable('auth_family_personal');
|
||||
}
|
||||
$where['userId'] = (int)input( 'post.userId');
|
||||
$data = $m->getList($where,'*');
|
||||
return WSTReturn('',1,$data);
|
||||
}
|
||||
/**
|
||||
* 获取亲人认证/报备列表
|
||||
*/
|
||||
public function familyList(){
|
||||
$m = Model('AuthFamily');
|
||||
if(1 == (int)input( 'post.isPersonal')){//亲人认证
|
||||
$m->setTable('auth_family_personal');
|
||||
}
|
||||
$where['userId'] = (int)input( 'post.userId');
|
||||
$data = $m->getList($where,'*');
|
||||
return WSTReturn('',1,$data);
|
||||
}
|
||||
/**
|
||||
* 获取合作人列表
|
||||
*/
|
||||
public function authCompanyList(){
|
||||
$m = Model('Table');
|
||||
$m->setTable('auth_company_partner');
|
||||
$where['userId'] = (int)input( 'post.userId');
|
||||
$where['dataFlag'] = 1;
|
||||
$data = $m->getList($where,'*');
|
||||
return WSTReturn('',1,$data);
|
||||
}
|
||||
/**
|
||||
* 获取银行卡
|
||||
*/
|
||||
public function authCompanyBank(){
|
||||
$m = Model('CompanyBank');
|
||||
$where['userId'] = (int)input( 'post.userId');
|
||||
$data = $m->getList($where,'*');
|
||||
return WSTReturn('',1,$data);
|
||||
}
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
/**
|
||||
* 申请列表
|
||||
*/
|
||||
public function userUpdateList(){
|
||||
return $this->fetch("update_list");
|
||||
}
|
||||
/**
|
||||
* 获取申请列表
|
||||
*/
|
||||
public function getUserUpdateList(){
|
||||
$m = new M();
|
||||
$data = $m->getUserUpdateList();
|
||||
return WSTGrid($data);
|
||||
}
|
||||
/**
|
||||
* 申请升级操作
|
||||
*/
|
||||
public function setUserUpdate(){
|
||||
$m = new M();
|
||||
$data = $m->setUserUpdate();
|
||||
exit(json_encode($data));
|
||||
}
|
||||
/**
|
||||
* 查看会员定返数据
|
||||
*/
|
||||
public function viewUserDayData(){
|
||||
return $this->fetch("user_day_list");
|
||||
}
|
||||
/**
|
||||
* 获取申请列表
|
||||
*/
|
||||
public function getViewUserDayData(){
|
||||
$m = new M();
|
||||
$data = $m->getViewUserDayData();
|
||||
return WSTGrid($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
/**
|
||||
* 跳去编辑页面
|
||||
*/
|
||||
public function toEdit(){
|
||||
$m = new M();
|
||||
$data = $this->get();
|
||||
$assign = ['data'=>$data];
|
||||
return $this->fetch("edit",$assign);
|
||||
}
|
||||
/**
|
||||
* 跳去充值页面
|
||||
*/
|
||||
public function toRecharge(){
|
||||
$m = new M();
|
||||
$data = $this->get();
|
||||
$assign = ['data'=>$data];
|
||||
return $this->fetch("recharge",$assign);
|
||||
}
|
||||
/*
|
||||
* 获取数据
|
||||
*/
|
||||
public function get(){
|
||||
$m = new M();
|
||||
return $m->getById((int)Input("id"));
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
return $m->add();
|
||||
}
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
/**
|
||||
* 充值
|
||||
*/
|
||||
public function recharge(){
|
||||
$m = new M();
|
||||
return $m->recharge();
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
public function getUserByKey(){
|
||||
$m = new M();
|
||||
return $m->getUserByKey();
|
||||
}
|
||||
/**********************************************************************************************
|
||||
* 账号管理 *
|
||||
**********************************************************************************************/
|
||||
/**
|
||||
* 账号管理页面
|
||||
*/
|
||||
public function accountIndex(){
|
||||
return $this->fetch("account_list");
|
||||
}
|
||||
/**
|
||||
* 判断账号是否存在
|
||||
*/
|
||||
public function checkLoginKey(){
|
||||
$rs = WSTCheckLoginKey(Input('post.loginName'),Input('post.userId/d',0));
|
||||
if($rs['status']==1){
|
||||
return ['ok'=>$rs['msg']];
|
||||
}else{
|
||||
return ['error'=>$rs['msg']];
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
public function changeUserStatus($id, $status){
|
||||
$m = new M();
|
||||
return $m->changeUserStatus($id, $status);
|
||||
}
|
||||
public function editAccount(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
/**
|
||||
* 获取所有用户id
|
||||
*/
|
||||
public function getAllUserId()
|
||||
{
|
||||
$m = new M();
|
||||
return $m->getAllUserId();
|
||||
}
|
||||
/**
|
||||
* 重置支付密码
|
||||
*/
|
||||
public function resetPayPwd(){
|
||||
$m = new M();
|
||||
return $m->resetPayPwd();
|
||||
}
|
||||
/**
|
||||
* 导出订单
|
||||
*/
|
||||
public function toExport(){
|
||||
$m = new M();
|
||||
$rs = $m->toExport();
|
||||
$this->assign('rs',$rs);
|
||||
}
|
||||
}
|
42
hyhproject/admin/controller/Userscores.php
Executable file
42
hyhproject/admin/controller/Userscores.php
Executable file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\UserScores as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 积分日志控制器
|
||||
*/
|
||||
class Userscores extends Base{
|
||||
|
||||
public function toUserScores(){
|
||||
$m = new M();
|
||||
$object = $m->getUserInfo();
|
||||
$this->assign("object",$object);
|
||||
return $this->fetch("list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery());
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳去新增界面
|
||||
*/
|
||||
public function toAdd(){
|
||||
$m = new M();
|
||||
$object = $m->getUserInfo();
|
||||
$this->assign("object",$object);
|
||||
return $this->fetch("box");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
return $m->addByAdmin();
|
||||
}
|
||||
}
|
24
hyhproject/admin/controller/Wsysconfigs.php
Executable file
24
hyhproject/admin/controller/Wsysconfigs.php
Executable file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\SysConfigs as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 微信配置控制器
|
||||
*/
|
||||
class Wsysconfigs extends Base{
|
||||
|
||||
public function index(){
|
||||
$m = new M();
|
||||
$object = $m->getSysConfigs();
|
||||
$this->assign("object",$object);
|
||||
return $this->fetch("edit");
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit(1);
|
||||
}
|
||||
}
|
87
hyhproject/admin/controller/Wxmenus.php
Executable file
87
hyhproject/admin/controller/Wxmenus.php
Executable file
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Wxmenus as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 微信自定义列表控制器
|
||||
*/
|
||||
class Wxmenus extends Base{
|
||||
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return $m->pageQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
*/
|
||||
public function listQuery(){
|
||||
$m = new M();
|
||||
return $m->listQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* 与微信菜单同步
|
||||
*/
|
||||
public function synchroWx(){
|
||||
$m = new M();
|
||||
return $m->synchroWx();
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步到微信菜单
|
||||
*/
|
||||
public function synchroAd(){
|
||||
$m = new M();
|
||||
return $m->synchroAd();
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳去新增/编辑页面
|
||||
*/
|
||||
public function toEdit(){
|
||||
$menuId = Input("get.menuId/d",0);
|
||||
$parentId = Input("get.parentId/d",0);
|
||||
$m = new M();
|
||||
if($menuId>0){
|
||||
$object = $m->getById($menuId);
|
||||
}else{
|
||||
$object = $m->getEModel('wx_menus');
|
||||
}
|
||||
$this->assign('menuId',$menuId);
|
||||
$this->assign('parentId',$parentId);
|
||||
$this->assign('object',$object);
|
||||
return $this->fetch("edit");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
return $m->add();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
}
|
85
hyhproject/admin/controller/Wxpassivereplys.php
Executable file
85
hyhproject/admin/controller/Wxpassivereplys.php
Executable file
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\WxPassiveReplys as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 微信被动回复管理控制器
|
||||
*/
|
||||
class Wxpassivereplys extends Base{
|
||||
// 文本消息列表
|
||||
public function text(){
|
||||
return $this->fetch("text");
|
||||
}
|
||||
/**
|
||||
* 获取文本消息分页
|
||||
*/
|
||||
public function textPageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->textPageQuery());
|
||||
}
|
||||
/**
|
||||
* 跳去文本消息新增/编辑页面
|
||||
*/
|
||||
public function textEdit(){
|
||||
$id = Input("get.id/d",0);
|
||||
$m = new M();
|
||||
$data = $m->getById($id);
|
||||
$this->assign('data',$data);
|
||||
return $this->fetch("text_edit");
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 图文消息列表
|
||||
public function news(){
|
||||
return $this->fetch("news");
|
||||
}
|
||||
/**
|
||||
* 获取图文消息分页
|
||||
*/
|
||||
public function newsPageQuery(){
|
||||
$m = new M();
|
||||
return $m->newsPageQuery();
|
||||
}
|
||||
/**
|
||||
* 跳去图文消息新增/编辑页面
|
||||
*/
|
||||
public function newsEdit(){
|
||||
$id = Input("get.id/d",0);
|
||||
$m = new M();
|
||||
$data = $m->getById($id);
|
||||
$this->assign('data',$data);
|
||||
return $this->fetch("news_edit");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
public function sendNews(){
|
||||
$wx = WXAdmin();
|
||||
$wx->_doText();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
return $m->add();
|
||||
}
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
}
|
49
hyhproject/admin/controller/Wxtemplatemsgs.php
Executable file
49
hyhproject/admin/controller/Wxtemplatemsgs.php
Executable file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\TemplateMsgs as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 微信消息模板控制器
|
||||
*/
|
||||
class Wxtemplatemsgs extends Base{
|
||||
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return WSTGrid($m->pageQuery(3,'TEMPLATE_WX'));
|
||||
}
|
||||
/**
|
||||
* 跳转去新增页面
|
||||
*/
|
||||
public function toEdit(){
|
||||
$id = (int)input('id');
|
||||
$m = new M();
|
||||
if($id>0){
|
||||
$data = $m->getById($id);
|
||||
}else{
|
||||
$data = $m->getEModel('template_msgs');
|
||||
}
|
||||
$this->assign('object',$data);
|
||||
return $this->fetch("edit");
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
*/
|
||||
public function edit(){
|
||||
return model('WxTemplateParams')->edit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取参数列表
|
||||
*/
|
||||
public function listQuery(){
|
||||
return model('WxTemplateParams')->listQuery((int)input('post.parentId'));
|
||||
}
|
||||
|
||||
}
|
53
hyhproject/admin/controller/Wxusers.php
Executable file
53
hyhproject/admin/controller/Wxusers.php
Executable file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
namespace wstmart\admin\controller;
|
||||
use wstmart\admin\model\Wxusers as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 微信用户控制器
|
||||
*/
|
||||
class Wxusers extends Base{
|
||||
public function recodeUnionId(){
|
||||
$m = new M();
|
||||
return json_encode($m->recodeUnionId());
|
||||
}
|
||||
|
||||
public function index(){
|
||||
return $this->fetch("list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return $m->pageQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* 与微信用户管理同步
|
||||
*/
|
||||
public function synchroWx(){
|
||||
$m = new M();
|
||||
return $m->synchroWx();
|
||||
}
|
||||
public function wxLoad(){
|
||||
$m = new M();
|
||||
return $m->wxLoad();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定对象
|
||||
*/
|
||||
public function getById(){
|
||||
$m = new M();
|
||||
return $m->getById((int)input('id'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
}
|
172
hyhproject/admin/model/Accreds.php
Executable file
172
hyhproject/admin/model/Accreds.php
Executable file
@ -0,0 +1,172 @@
|
||||
<?php
|
||||
|
||||
namespace wstmart\admin\model;
|
||||
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
|
||||
* ============================================================================
|
||||
|
||||
* 商家认证业务处理
|
||||
|
||||
*/
|
||||
|
||||
class Accreds extends Base{
|
||||
|
||||
/**
|
||||
|
||||
* 分页
|
||||
|
||||
*/
|
||||
|
||||
public function pageQuery(){
|
||||
|
||||
return $this->where('dataFlag',1)->field(true)->order('accredId desc')->paginate(input('limit/d'));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* 列表
|
||||
|
||||
*/
|
||||
|
||||
public function listQuery(){
|
||||
|
||||
return $this->where('dataFlag',1)->field(true)->select();
|
||||
|
||||
}
|
||||
|
||||
public function getById($id){
|
||||
|
||||
return $this->get(['accredId'=>$id,'dataFlag'=>1]);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* 新增
|
||||
|
||||
*/
|
||||
|
||||
public function add(){
|
||||
|
||||
$data = input('post.');
|
||||
|
||||
$data['createTime'] = date('Y-m-d H:i:s');
|
||||
|
||||
WSTUnset($data,'accredId');
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
try{
|
||||
|
||||
$result = $this->validate('Accreds.add')->allowField(true)->save($data);
|
||||
|
||||
if(false !==$result){
|
||||
|
||||
$id = $this->accredId;
|
||||
|
||||
//启用上传图片
|
||||
|
||||
WSTUseImages(1, $id, $data['accredImg']);
|
||||
|
||||
if(false !== $result){
|
||||
|
||||
Db::commit();
|
||||
|
||||
return WSTReturn("新增成功", 1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}catch (\Exception $e) {
|
||||
|
||||
Db::rollback();errLog($e);
|
||||
|
||||
}
|
||||
|
||||
return WSTReturn('新增失败',-1);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* 编辑
|
||||
|
||||
*/
|
||||
|
||||
public function edit(){
|
||||
|
||||
$data = input('post.');
|
||||
|
||||
WSTUnset($data,'createTime');
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
try{
|
||||
|
||||
WSTUseImages(1, (int)$data['accredId'], $data['accredImg'], 'accreds', 'accredImg');
|
||||
|
||||
$result = $this->validate('Accreds.edit')->allowField(true)->save($data,['accredId'=>(int)$data['accredId']]);
|
||||
|
||||
if(false !== $result){
|
||||
|
||||
Db::commit();
|
||||
|
||||
return WSTReturn("编辑成功", 1);
|
||||
|
||||
}
|
||||
|
||||
}catch (\Exception $e) {
|
||||
|
||||
Db::rollback();errLog($e);
|
||||
|
||||
}
|
||||
|
||||
return WSTReturn('编辑失败',-1);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* 删除
|
||||
|
||||
*/
|
||||
|
||||
public function del(){
|
||||
|
||||
$id = (int)input('post.id/d');
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
try{
|
||||
|
||||
$result = $this->setField(['dataFlag'=>-1,'accredId'=>$id]);
|
||||
|
||||
WSTUnuseImage('accreds','accredImg',$id);
|
||||
|
||||
if(false !== $result){
|
||||
|
||||
Db::commit();
|
||||
|
||||
return WSTReturn("删除成功", 1);
|
||||
|
||||
}
|
||||
|
||||
}catch (\Exception $e) {
|
||||
|
||||
Db::rollback();errLog($e);
|
||||
|
||||
}
|
||||
|
||||
return WSTReturn('删除失败',-1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
68
hyhproject/admin/model/AdPositions.php
Executable file
68
hyhproject/admin/model/AdPositions.php
Executable file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
namespace wstmart\admin\model;
|
||||
use think\Db;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 广告位置业务处理
|
||||
*/
|
||||
class AdPositions extends Base{
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$positionType = (int)input('positionType');
|
||||
$key = input('key');
|
||||
$where = [];
|
||||
$where['dataFlag'] = 1;
|
||||
if($positionType>0)$where['positionType'] = $positionType;
|
||||
if($key !='')$where['positionCode'] = ['like','%'.$key.'%'];
|
||||
return $this->where($where)->field(true)->order('apSort asc,positionId desc')->paginate(input('limit/d'));
|
||||
}
|
||||
public function getById($id){
|
||||
return $this->get(['positionId'=>$id,'dataFlag'=>1]);
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$data = input('post.');
|
||||
WSTUnset($data,'positionId');
|
||||
$result = $this->validate('AdPositions.add')->allowField(true)->save($data);
|
||||
if(false !== $result){
|
||||
return WSTReturn("新增成功", 1);
|
||||
}else{
|
||||
return WSTReturn($this->getError(),-1);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit(){
|
||||
$Id = (int)input('post.positionId');
|
||||
$result = $this->validate('AdPositions.edit')->allowField(true)->save(input('post.'),['positionId'=>$Id]);
|
||||
if(false !== $result){
|
||||
return WSTReturn("编辑成功", 1);
|
||||
}else{
|
||||
return WSTReturn($this->getError(),-1);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$id = (int)input('post.id/d');
|
||||
$result = $this->setField(['positionId'=>$id,'dataFlag'=>-1]);
|
||||
if(false !== $result){
|
||||
return WSTReturn("删除成功", 1);
|
||||
}else{
|
||||
return WSTReturn($this->getError(),-1);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 获取广告位置
|
||||
*/
|
||||
public function getPositon($typeId){
|
||||
return $this->where(['positionType'=>$typeId,'dataFlag'=>1])->order('apSort asc,positionId asc')->select();
|
||||
}
|
||||
|
||||
}
|
139
hyhproject/admin/model/Addons.php
Executable file
139
hyhproject/admin/model/Addons.php
Executable file
@ -0,0 +1,139 @@
|
||||
<?php
|
||||
namespace wstmart\admin\model;
|
||||
use think\Db;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 插件业务处理
|
||||
*/
|
||||
class Addons extends Base{
|
||||
|
||||
/**
|
||||
* 获取插件列表
|
||||
* @param string $addon_dir
|
||||
*/
|
||||
public function pageQuery($addon_dir = ''){
|
||||
if(!$addon_dir)
|
||||
$addon_dir = WST_ADDON_PATH;
|
||||
$dirs = array_map('basename',glob($addon_dir.'*', GLOB_ONLYDIR));
|
||||
if($dirs === FALSE || !file_exists($addon_dir)){
|
||||
$this->error = '插件目录不可读或者不存在';
|
||||
return FALSE;
|
||||
}
|
||||
$addons = array();
|
||||
$where['dataFlag'] = 1;
|
||||
$where['name'] = array('not in',$dirs);
|
||||
$this->where($where)->delete();
|
||||
|
||||
$names = $this->column("name");
|
||||
$names = array_map('strtolower', $names);
|
||||
$list = array();
|
||||
foreach ($dirs as $value) {
|
||||
if(!in_array($value,$names)){
|
||||
$class = get_addon_class($value);
|
||||
if(!class_exists($class)){ // 实例化插件失败忽略执行
|
||||
\Think\Log::record('插件'.$value.'的入口文件不存在!');
|
||||
continue;
|
||||
}
|
||||
$obj = new $class;
|
||||
$data = $obj->info;
|
||||
$config = $obj->getConfig();
|
||||
$data["isConfig"] = count($config)?1:0;
|
||||
$data["createTime"] = date("Y-m-d H:i:s");
|
||||
$data["updateTime"] = date("Y-m-d H:i:s");
|
||||
$data["dataFlag"] = 1;
|
||||
$list[] = $data;
|
||||
}
|
||||
}
|
||||
$this->saveAll($list);
|
||||
$keyWords = input("keyWords");
|
||||
$parentId = input('get.parentId/d',0);
|
||||
$sort = input('sort');
|
||||
$where = array();
|
||||
$where["dataFlag"] = 1;
|
||||
$where["name|title"] = array("like","%$keyWords%");
|
||||
$order = 'addonId desc';
|
||||
if($sort){
|
||||
$sort = str_replace('.',' ',$sort);
|
||||
$order = $sort;
|
||||
}
|
||||
$page = $this->where($where)->order($order)->paginate(input('post.limit/d'))->toArray();
|
||||
if(count($page['Rows'])>0){
|
||||
foreach ($page['Rows'] as $key => $v){
|
||||
$page['Rows'][$key]['statusName'] = WSTLangAddonStatus($v['status']);
|
||||
$page['Rows'][$key]['hasConf'] = ($v['isConfig']!='')?1:0;
|
||||
}
|
||||
}
|
||||
cache('WST_ADDONS_MAPS',null);
|
||||
return $page;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存插件设置
|
||||
*/
|
||||
public function saveConfig(){
|
||||
$id = input("id/d",0);
|
||||
$config = isset($_POST['config'])?$_POST['config']:array();
|
||||
$data["config"] = json_encode($config);
|
||||
$data["updateTime"] = date('Y-m-d H:i:s');
|
||||
$flag = $this->save($data,['addonId'=>$id]);
|
||||
if($flag !== false){
|
||||
return WSTReturn("保存成功", 1);
|
||||
}else{
|
||||
return WSTReturn('保存失败',-1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定记录
|
||||
*/
|
||||
public function getById(){
|
||||
$id = input("id/d",0);
|
||||
return $this->get(['addonId'=>$id,'dataFlag'=>1])->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
|
||||
return WSTReturn("新增成功", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit(){
|
||||
return WSTReturn("编辑成功", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$id = (int)input('post.id/d');
|
||||
$result = $this->where(["addonId"=>$id,'dataFlag'=>1])->delete();
|
||||
if($result!==false){
|
||||
cache('WST_ADDONS_MAPS',null);
|
||||
return WSTReturn("卸载成功", 1);
|
||||
}
|
||||
return WSTReturn('卸载失败',-1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改插件状态
|
||||
*/
|
||||
public function editStatus($status){
|
||||
$id = (int)input('post.id/d');
|
||||
$data = array();
|
||||
$data["status"] = $status;
|
||||
$data["updateTime"] = date('Y-m-d H:i:s');
|
||||
$result = $this->save($data,['addonId'=>$id]);
|
||||
if($result!==false){
|
||||
return WSTReturn("操作成功", 1);
|
||||
}
|
||||
return WSTReturn('操作失败',-1);
|
||||
}
|
||||
|
||||
|
||||
}
|
224
hyhproject/admin/model/Adgoods.php
Executable file
224
hyhproject/admin/model/Adgoods.php
Executable file
@ -0,0 +1,224 @@
|
||||
<?php
|
||||
|
||||
namespace wstmart\admin\model;
|
||||
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
|
||||
* ============================================================================
|
||||
|
||||
* 广告业务处理
|
||||
|
||||
*/
|
||||
|
||||
class adgoods extends Base{
|
||||
|
||||
/**
|
||||
|
||||
* 分页
|
||||
|
||||
*/
|
||||
|
||||
public function pageQuery(){
|
||||
|
||||
$where = [];
|
||||
|
||||
$apId = (int)input('adId');
|
||||
|
||||
if($apId>0)$where['a.adId'] = $apId;
|
||||
|
||||
return Db::name('adgoods')->alias('a')
|
||||
|
||||
->join('ads ap','a.adId=ap.adId','left')
|
||||
|
||||
->join('goods g','g.goodsId=a.goodsId')
|
||||
|
||||
->field('a.adId,adName,g.goodsId,goodsName,a.startDate,a.endDate,adGoodsImg,a.adGoodsStatus,a.adGoodsId')
|
||||
|
||||
->where($where)->order('a.adId desc')
|
||||
|
||||
->order('a.goodsId','asc')
|
||||
|
||||
->paginate(input('limit/d'));
|
||||
|
||||
}
|
||||
|
||||
public function getById($id){
|
||||
|
||||
$result= $this->get(['adGoodsId'=>$id]);
|
||||
|
||||
//$result['adName']=db('ads')->where('adId',$result['adId'])->value('adName');
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* 新增
|
||||
|
||||
*/
|
||||
|
||||
public function add(){
|
||||
|
||||
$data = input('post.');
|
||||
|
||||
$data['createTime'] = time();
|
||||
|
||||
WSTUnset($data,'adGoodsId');
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
try{
|
||||
|
||||
$goods=db('goods')->where(['goodsId'=>$data['goodsId'],'dataFlag'=>1,'isSale'=>1,'goodsStatus'=>1])->find();
|
||||
|
||||
if(!$goods) return WSTReturn('无此商品,请重新选择商品');
|
||||
|
||||
$result = $this->validate('adgoods.add')->allowField(true)->save($data);
|
||||
|
||||
if(false !== $result){
|
||||
|
||||
WSTClearAllCache();
|
||||
|
||||
$id = $this->adId;
|
||||
|
||||
//启用上传图片
|
||||
|
||||
WSTUseImages(1, $id, $data['adGoodsImg']);
|
||||
|
||||
Db::commit();
|
||||
|
||||
return WSTReturn("新增成功", 1);
|
||||
|
||||
}else{
|
||||
|
||||
return WSTReturn($this->getError(),-1);
|
||||
|
||||
}
|
||||
|
||||
}catch (\Exception $e) {
|
||||
|
||||
Db::rollback();errLog($e);
|
||||
|
||||
}
|
||||
|
||||
return WSTReturn('新增失败',-1);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* 编辑
|
||||
|
||||
*/
|
||||
|
||||
public function edit(){
|
||||
|
||||
$data = input('post.');
|
||||
|
||||
WSTUnset($data,'createTime');
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
try{
|
||||
|
||||
//WSTUseImages(1, (int)$data['adId'], $data['adFile'], 'ads-pic', 'adFile');
|
||||
|
||||
$result = $this->validate('adgoods.edit')->allowField(true)->save($data,['adGoodsId'=>(int)$data['adGoodsId']]);
|
||||
|
||||
if(false !== $result){
|
||||
|
||||
WSTClearAllCache();
|
||||
|
||||
Db::commit();
|
||||
|
||||
return WSTReturn("编辑成功", 1);
|
||||
|
||||
}else{
|
||||
|
||||
return WSTReturn($this->getError(),-1);
|
||||
|
||||
}
|
||||
|
||||
}catch (\Exception $e) {
|
||||
|
||||
Db::rollback();errLog($e);
|
||||
|
||||
}
|
||||
|
||||
return WSTReturn('编辑失败',-1);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* 删除
|
||||
|
||||
*/
|
||||
|
||||
public function del(){
|
||||
|
||||
$id = (int)input('post.id/d');
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
try{
|
||||
|
||||
$result = $this->where(['adGoodsId'=>$id])->delete();
|
||||
|
||||
WSTUnuseImage('adgoods','adGoodsImg',$id);
|
||||
|
||||
if($result){
|
||||
|
||||
WSTClearAllCache();
|
||||
|
||||
Db::commit();
|
||||
|
||||
return WSTReturn("删除成功", 1);
|
||||
|
||||
}
|
||||
|
||||
}catch (\Exception $e) {
|
||||
|
||||
Db::rollback();errLog($e);
|
||||
|
||||
return WSTReturn('删除失败',-1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* 修改广告排序
|
||||
|
||||
*/
|
||||
|
||||
public function changeSort(){
|
||||
|
||||
$id = (int)input('id');
|
||||
|
||||
$adSort = (int)input('adSort');
|
||||
|
||||
$result = $this->setField(['adId'=>$id,'adSort'=>$adSort]);
|
||||
|
||||
if(false !== $result){
|
||||
|
||||
WSTClearAllCache();
|
||||
|
||||
return WSTReturn("操作成功", 1);
|
||||
|
||||
}else{
|
||||
|
||||
return WSTReturn($this->getError(),-1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
228
hyhproject/admin/model/Ads.php
Executable file
228
hyhproject/admin/model/Ads.php
Executable file
@ -0,0 +1,228 @@
|
||||
<?php
|
||||
|
||||
namespace wstmart\admin\model;
|
||||
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
|
||||
* ============================================================================
|
||||
|
||||
* 广告业务处理
|
||||
|
||||
*/
|
||||
|
||||
class ads extends Base{
|
||||
|
||||
/**
|
||||
|
||||
* 分页
|
||||
|
||||
*/
|
||||
|
||||
public function pageQuery(){
|
||||
|
||||
$where = [];
|
||||
|
||||
$where['a.dataFlag'] = 1;
|
||||
|
||||
$pt = (int)input('positionType');
|
||||
|
||||
$apId = (int)input('adPositionId');
|
||||
|
||||
if($pt>0)$where['a.positionType'] = $pt;
|
||||
|
||||
if($apId!=0)$where['a.adPositionId'] = $apId;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return Db::name('ads')->alias('a')
|
||||
|
||||
->join('ad_positions ap','a.positionType=ap.positionType AND a.adPositionId=ap.positionId AND ap.dataFlag=1','left')
|
||||
|
||||
->field('adId,adName,adPositionId,adURL,adStartDate,adEndDate,adPositionId,adFile,adClickNum,ap.positionName,a.adSort')
|
||||
|
||||
->where($where)->order('adId desc')
|
||||
|
||||
->order('adSort','asc')
|
||||
|
||||
->paginate(input('limit/d'));
|
||||
|
||||
}
|
||||
|
||||
public function getById($id){
|
||||
|
||||
return $this->get(['adId'=>$id,'dataFlag'=>1]);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* 新增
|
||||
|
||||
*/
|
||||
|
||||
public function add(){
|
||||
|
||||
$data = input('post.');
|
||||
|
||||
$data['createTime'] = date('Y-m-d H:i:s');
|
||||
|
||||
$data['adSort'] = (int)$data['adSort'];
|
||||
|
||||
WSTUnset($data,'adId');
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
try{
|
||||
|
||||
$result = $this->validate('ads.add')->allowField(true)->save($data);
|
||||
|
||||
if(false !== $result){
|
||||
|
||||
WSTClearAllCache();
|
||||
|
||||
$id = $this->adId;
|
||||
|
||||
//启用上传图片
|
||||
|
||||
WSTUseImages(1, $id, $data['adFile']);
|
||||
|
||||
Db::commit();
|
||||
|
||||
return WSTReturn("新增成功", 1);
|
||||
|
||||
}else{
|
||||
|
||||
return WSTReturn($this->getError(),-1);
|
||||
|
||||
}
|
||||
|
||||
}catch (\Exception $e) {
|
||||
|
||||
Db::rollback();errLog($e);
|
||||
|
||||
}
|
||||
|
||||
return WSTReturn('新增失败',-1);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* 编辑
|
||||
|
||||
*/
|
||||
|
||||
public function edit(){
|
||||
|
||||
$data = input('post.');
|
||||
|
||||
$data['adSort'] = (int)$data['adSort'];
|
||||
|
||||
WSTUnset($data,'createTime');
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
try{
|
||||
|
||||
WSTUseImages(1, (int)$data['adId'], $data['adFile'], 'ads-pic', 'adFile');
|
||||
|
||||
$result = $this->validate('ads.edit')->allowField(true)->save($data,['adId'=>(int)$data['adId']]);
|
||||
|
||||
if(false !== $result){
|
||||
|
||||
WSTClearAllCache();
|
||||
|
||||
Db::commit();
|
||||
|
||||
return WSTReturn("编辑成功", 1);
|
||||
|
||||
}else{
|
||||
|
||||
return WSTReturn($this->getError(),-1);
|
||||
|
||||
}
|
||||
|
||||
}catch (\Exception $e) {
|
||||
|
||||
Db::rollback();errLog($e);
|
||||
|
||||
}
|
||||
|
||||
return WSTReturn('编辑失败',-1);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* 删除
|
||||
|
||||
*/
|
||||
|
||||
public function del(){
|
||||
|
||||
$id = (int)input('post.id/d');
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
try{
|
||||
|
||||
$result = $this->setField(['adId'=>$id,'dataFlag'=>-1]);
|
||||
|
||||
WSTUnuseImage('ads','adFile',$id);
|
||||
|
||||
if(false !== $result){
|
||||
|
||||
WSTClearAllCache();
|
||||
|
||||
Db::commit();
|
||||
|
||||
return WSTReturn("删除成功", 1);
|
||||
|
||||
}
|
||||
|
||||
}catch (\Exception $e) {
|
||||
|
||||
Db::rollback();errLog($e);
|
||||
|
||||
return WSTReturn('删除失败',-1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* 修改广告排序
|
||||
|
||||
*/
|
||||
|
||||
public function changeSort(){
|
||||
|
||||
$id = (int)input('id');
|
||||
|
||||
$adSort = (int)input('adSort');
|
||||
|
||||
$result = $this->setField(['adId'=>$id,'adSort'=>$adSort]);
|
||||
|
||||
if(false !== $result){
|
||||
|
||||
WSTClearAllCache();
|
||||
|
||||
return WSTReturn("操作成功", 1);
|
||||
|
||||
}else{
|
||||
|
||||
return WSTReturn($this->getError(),-1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
69
hyhproject/admin/model/Alipays.php
Executable file
69
hyhproject/admin/model/Alipays.php
Executable file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
namespace wstmart\admin\model;
|
||||
use think\Loader;
|
||||
use think\Db;
|
||||
use Env;
|
||||
use wstmart\common\model\Payments as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 阿里支付控制器
|
||||
*/
|
||||
class Alipays extends Base{
|
||||
|
||||
/**
|
||||
* 退款
|
||||
*/
|
||||
public function orderRefund($refund,$order){
|
||||
|
||||
$content = input('post.content');
|
||||
$refundId = (int)input('post.id');
|
||||
$request_no = $order['orderNo'].$order['userId'];
|
||||
$backMoney = $refund["backMoney"];
|
||||
$tradeNo = $order['tradeNo'];
|
||||
$refund_reason = "订单【".$order['orderNo']."】退款";
|
||||
|
||||
require Env::get('root_path') . 'extend/alipay/aop/AopClient.php';
|
||||
require Env::get('root_path') . 'extend/alipay/aop/request/AlipayTradeRefundRequest.php';
|
||||
$m = new M();
|
||||
$payment = $m->getPayment("alipays");
|
||||
$aop = new \AopClient ();
|
||||
$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
|
||||
$aop->appId = $payment["appId"];
|
||||
$aop->rsaPrivateKey = $payment["rsaPrivateKey"];
|
||||
$aop->alipayrsaPublicKey=$payment["alipayrsaPublicKey"];
|
||||
$aop->apiVersion = '1.0';
|
||||
$aop->signType = 'RSA2';
|
||||
$aop->postCharset='UTF-8';
|
||||
$aop->format='json';
|
||||
$request = new \AlipayTradeRefundRequest ();
|
||||
|
||||
$request->setBizContent("{" .
|
||||
"\"trade_no\":\"$tradeNo\"," .
|
||||
"\"refund_amount\":\"$backMoney\"," .
|
||||
"\"refund_reason\":\"$refund_reason\"," .
|
||||
"\"out_request_no\":\"$request_no\"" .
|
||||
" }");
|
||||
|
||||
$result = $aop->execute ( $request);
|
||||
|
||||
$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
|
||||
$resultCode = $result->$responseNode->code;
|
||||
if(!empty($resultCode) && $resultCode == 10000){
|
||||
if($result->$responseNode->fund_change=="Y"){
|
||||
$obj = array();
|
||||
$obj['refundTradeNo'] = $request_no;//退款单号
|
||||
$obj['content'] = $content;
|
||||
$obj['refundId'] = $refundId;
|
||||
$rs = model('admin/OrderRefunds')->complateOrderRefund($obj);
|
||||
if($rs['status']==1){
|
||||
return WSTReturn("退款成功",1);
|
||||
}else{
|
||||
return WSTReturn("退款失败",1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$msg = $result->$responseNode->sub_msg;
|
||||
return WSTReturn($msg,-1);
|
||||
}
|
||||
}
|
||||
}
|
169
hyhproject/admin/model/Areas.php
Executable file
169
hyhproject/admin/model/Areas.php
Executable file
@ -0,0 +1,169 @@
|
||||
<?php
|
||||
namespace wstmart\admin\model;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 地区业务处理
|
||||
*/
|
||||
class Areas extends Base{
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$parentId = input('get.parentId/d',0);
|
||||
return $this->where(['dataFlag'=>1,'parentId'=>$parentId])->order('areaId desc')->paginate(input('post.limit/d'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定对象
|
||||
*/
|
||||
public function getById($id){
|
||||
return $this->get(['dataFlag'=>1,'areaId'=>$id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取地区
|
||||
*/
|
||||
public function getFieldsById($id,$fileds){
|
||||
return $this->where(['dataFlag'=>1,'areaId'=>$id])->field($fileds)->find();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示是否显示/隐藏
|
||||
*/
|
||||
public function editiIsShow(){
|
||||
//获取子集
|
||||
$ids = array();
|
||||
$ids[] = input('post.id/d',0);
|
||||
$ids = $this->getChild($ids,$ids);
|
||||
$isShow = input('post.isShow/d',0)?0:1;
|
||||
$result = $this->where("areaId in(".implode(',',$ids).")")->update(['isShow' => $isShow]);
|
||||
if(false !== $result){
|
||||
return WSTReturn("操作成功", 1);
|
||||
}else{
|
||||
return WSTReturn($this->getError(),-1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 迭代获取下级
|
||||
*/
|
||||
public function getChild($ids = array(),$pids = array()){
|
||||
$result = $this->where("dataFlag=1 and parentId in(".implode(',',$pids).")")->select();
|
||||
if(count($result)>0){
|
||||
$cids = array();
|
||||
foreach ($result as $key =>$v){
|
||||
$cids[] = $v['areaId'];
|
||||
}
|
||||
$ids = array_merge($ids,$cids);
|
||||
return $this->getChild($ids,$cids);
|
||||
}else{
|
||||
return $ids;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据子分类获取其父级分类
|
||||
*/
|
||||
public function getParentIs($id,$data = array()){
|
||||
$data[] = $id;
|
||||
$parentId = $this->where('areaId',$id)->value('parentId');
|
||||
if($parentId==0){
|
||||
krsort($data);
|
||||
return $data;
|
||||
}else{
|
||||
return $this->getParentIs($parentId, $data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取自己以及父级的地区名称
|
||||
*/
|
||||
public function getParentNames($id,$data = array()){
|
||||
$areas = $this->where('areaId',$id)->field('parentId,areaName')->find();
|
||||
$data[] = $areas['areaName'];
|
||||
if((int)$areas['parentId']==0){
|
||||
krsort($data);
|
||||
return $data;
|
||||
}else{
|
||||
return $this->getParentNames((int)$areas['parentId'], $data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 排序字母
|
||||
*/
|
||||
public function letterObtain(){
|
||||
$areaName = input('code');
|
||||
if($areaName =='')return WSTReturn("", 1);
|
||||
$areaName = WSTGetFirstCharter($areaName);
|
||||
if($areaName){
|
||||
return WSTReturn($areaName, 1);
|
||||
}else{
|
||||
return WSTReturn("", 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$areaType = 0;
|
||||
$parentId = input('post.parentId/d',0);
|
||||
if($parentId>0){
|
||||
$prs = $this->getFieldsById($parentId,['areaType']);
|
||||
$areaType = $prs['areaType']+1;
|
||||
}
|
||||
$data = input('post.');
|
||||
WSTUnset($data,'areaId,dataFlag');
|
||||
$data['areaType'] = $areaType;
|
||||
$data['createTime'] = date('Y-m-d H:i:s');
|
||||
$result = $this->validate('Areas.add')->allowField(true)->save($data);
|
||||
if(false !== $result){
|
||||
return WSTReturn("新增成功", 1);
|
||||
}else{
|
||||
return WSTReturn($this->getError(),-1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit(){
|
||||
$areaId = input('post.areaId/d');
|
||||
$result = $this->validate('Areas.edit')->allowField(['areaName','isShow','areaSort','areaKey'])->save(input('post.'),['areaId'=>$areaId]);
|
||||
$ids = array();
|
||||
$ids[] = $areaId;
|
||||
$ids = $this->getChild($ids,$ids);
|
||||
$this->where("areaId in(".implode(',',$ids).")")->update(['isShow' => input('post.')['isShow']]);
|
||||
if(false !== $result){
|
||||
return WSTReturn("修改成功", 1);
|
||||
}else{
|
||||
return WSTReturn($this->getError(),-1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$ids = array();
|
||||
$ids[] = input('post.id/d');
|
||||
$ids = $this->getChild($ids,$ids);
|
||||
$data = [];
|
||||
$data['dataFlag'] = -1;
|
||||
$result = $this->where("areaId in(".implode(',',$ids).")")->update($data);
|
||||
if(false !== $result){
|
||||
return WSTReturn("删除成功", 1);
|
||||
}else{
|
||||
return WSTReturn($this->getError(),-1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取地区列表
|
||||
*/
|
||||
public function listQuery($parentId){
|
||||
return $this->where(['dataFlag'=>1,'parentId'=>$parentId,'isShow'=>1])->field('areaId,areaName,parentId')->order('areaSort desc')->select();
|
||||
}
|
||||
}
|
337
hyhproject/admin/model/ArticleCats.php
Executable file
337
hyhproject/admin/model/ArticleCats.php
Executable file
@ -0,0 +1,337 @@
|
||||
<?php
|
||||
|
||||
namespace wstmart\admin\model;
|
||||
|
||||
/**
|
||||
|
||||
* ============================================================================
|
||||
|
||||
* 文章分类业务处理
|
||||
|
||||
*/
|
||||
|
||||
use think\Db;
|
||||
|
||||
class ArticleCats extends Base{
|
||||
|
||||
/**
|
||||
|
||||
* 获取树形分类
|
||||
|
||||
*/
|
||||
|
||||
public function pageQuery(){
|
||||
|
||||
$parentId = input('catId/d',0);
|
||||
|
||||
$data = $this->where(['dataFlag'=>1,'parentId'=>$parentId])->order('catId desc')->paginate(1000)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* 获取列表
|
||||
|
||||
*/
|
||||
|
||||
public function listQuery($parentId){
|
||||
|
||||
$rs = $this->where(['dataFlag'=>1,'parentId'=>$parentId])->order('catSort asc,catName asc')->select();
|
||||
|
||||
if(count($rs)>0){
|
||||
|
||||
foreach ($rs as $key => $v){
|
||||
|
||||
$rs[$key]['childrenurl'] = url('admin/articlecats/listQuery',array('parentId'=>$v['catId']));
|
||||
|
||||
$rs[$key]['children'] = [];
|
||||
|
||||
$rs[$key]['isextend'] = false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $rs;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* 获取指定对象
|
||||
|
||||
*/
|
||||
|
||||
public function getById($id){
|
||||
|
||||
return $this->get(['dataFlag'=>1,'catId'=>$id]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 获取文章分类列表
|
||||
|
||||
*/
|
||||
|
||||
public function listQuery2(){
|
||||
|
||||
$id = (int)input('id');
|
||||
|
||||
return $this->where(['dataFlag'=>1,'isShow'=>1,'parentId'=>$id])->field('catId as id,catName as name,parentId as pId, 1 as isParent')->order('catSort desc')->select();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* 修改分类名称
|
||||
|
||||
*/
|
||||
|
||||
public function editName(){
|
||||
|
||||
if(input('catName')=='')return WSTReturn("操作失败,商品分类名称不能为空");
|
||||
|
||||
$id = (int)input('id');
|
||||
|
||||
$result = $this->where("catId = ".$id)->update(['catName' => input('catName')]);
|
||||
|
||||
if(false !== $result){
|
||||
|
||||
WSTClearAllCache();
|
||||
|
||||
return WSTReturn("操作成功", 1);
|
||||
|
||||
}else{
|
||||
|
||||
return WSTReturn($this->getError(),-1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 显示是否显示/隐藏
|
||||
|
||||
*/
|
||||
|
||||
public function editiIsShow(){
|
||||
|
||||
$ids = array();
|
||||
|
||||
$id = input('post.id/d');
|
||||
|
||||
$ids = $this->getChild($id);
|
||||
|
||||
$isShow = input('post.isShow/d')?1:0;
|
||||
|
||||
$result = $this->where("catId in(".implode(',',$ids).")")->update(['isShow' => $isShow]);
|
||||
|
||||
if(false !== $result){
|
||||
|
||||
WSTClearAllCache();
|
||||
|
||||
return WSTReturn("操作成功", 1);
|
||||
|
||||
}else{
|
||||
|
||||
return WSTReturn($this->getError(),-1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 迭代获取下级
|
||||
|
||||
* 获取一个分类下的所有子级分类id
|
||||
|
||||
*/
|
||||
|
||||
public function getChild($pid=1){
|
||||
|
||||
$data = $this->where("dataFlag=1")->select();
|
||||
|
||||
//获取该分类id下的所有子级分类id
|
||||
|
||||
$ids = $this->_getChild($data, $pid, true);//每次调用都清空一次数组
|
||||
|
||||
//把自己也放进来
|
||||
|
||||
array_unshift($ids, $pid);
|
||||
|
||||
return $ids;
|
||||
|
||||
}
|
||||
|
||||
public function _getChild($data, $pid, $isClear=false){
|
||||
|
||||
static $ids = array();
|
||||
|
||||
if($isClear)//是否清空数组
|
||||
|
||||
$ids = array();
|
||||
|
||||
foreach($data as $k=>$v)
|
||||
|
||||
{
|
||||
|
||||
if($v['parentId']==$pid && $v['dataFlag']==1)
|
||||
|
||||
{
|
||||
|
||||
$ids[] = $v['catId'];//将找到的下级分类id放入静态数组
|
||||
|
||||
//再找下当前id是否还存在下级id
|
||||
|
||||
$this->_getChild($data, $v['catId']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $ids;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 新增
|
||||
|
||||
*/
|
||||
|
||||
public function add(){
|
||||
|
||||
$parentId = input('post.parentId/d');
|
||||
|
||||
$data = input('post.');
|
||||
|
||||
WSTUnset($data,'catId,catType,dataFlag');
|
||||
|
||||
$data['parentId'] = $parentId;
|
||||
|
||||
$data['createTime'] = date('Y-m-d H:i:s');
|
||||
|
||||
$result = $this->validate('ArticleCats.add')->allowField(true)->save($data);
|
||||
|
||||
if(false !== $result){
|
||||
|
||||
WSTClearAllCache();
|
||||
|
||||
return WSTReturn("新增成功", 1);
|
||||
|
||||
}else{
|
||||
|
||||
return WSTReturn($this->getError(),-1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 编辑
|
||||
|
||||
*/
|
||||
|
||||
public function edit(){
|
||||
|
||||
$catId = input('post.id/d');
|
||||
|
||||
$result = $this->validate('ArticleCats.edit')->allowField(['catName','isShow','catSort'])->save(input('post.'),['catId'=>$catId]);
|
||||
|
||||
$ids = array();
|
||||
|
||||
$ids = $this->getChild($catId);
|
||||
|
||||
$this->where("catId in(".implode(',',$ids).")")->update(['isShow' => input('post.')['isShow']]);
|
||||
|
||||
if(false !== $result){
|
||||
|
||||
WSTClearAllCache();
|
||||
|
||||
return WSTReturn("修改成功", 1);
|
||||
|
||||
}else{
|
||||
|
||||
return WSTReturn($this->getError(),-1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 删除
|
||||
|
||||
*/
|
||||
|
||||
public function del(){
|
||||
|
||||
$ids = array();
|
||||
|
||||
$id = input('post.id/d');
|
||||
|
||||
$ids = $this->getChild($id);
|
||||
|
||||
$data = [];
|
||||
|
||||
$data['dataFlag'] = -1;
|
||||
|
||||
$rs = $this->getById($id);
|
||||
|
||||
if($rs['catType']==1){
|
||||
|
||||
return WSTReturn("不能删除该分类", -1);
|
||||
|
||||
}else{
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
try{
|
||||
|
||||
$result = $this->where("catId in(".implode(',',$ids).")")->update($data);
|
||||
|
||||
if(false !==$result){
|
||||
|
||||
WSTClearAllCache();
|
||||
|
||||
Db::name('articles')->where(['catId'=>['in',$ids]])->update(['dataFlag'=>-1]);
|
||||
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
|
||||
return WSTReturn("删除成功", 1);
|
||||
|
||||
}catch (\Exception $e) {
|
||||
|
||||
Db::rollback();errLog($e);
|
||||
|
||||
return WSTReturn('删除失败',-1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
349
hyhproject/admin/model/Articles.php
Executable file
349
hyhproject/admin/model/Articles.php
Executable file
@ -0,0 +1,349 @@
|
||||
<?php
|
||||
|
||||
namespace wstmart\admin\model;
|
||||
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
|
||||
* ============================================================================
|
||||
|
||||
* 文章业务处理
|
||||
|
||||
*/
|
||||
|
||||
class Articles extends Base{
|
||||
|
||||
/**
|
||||
|
||||
* 分页
|
||||
|
||||
*/
|
||||
|
||||
public function pageQuery(){
|
||||
|
||||
$key = input('key');
|
||||
|
||||
$catId = (int)input('catId');
|
||||
|
||||
$sort = input('sort');
|
||||
|
||||
$catIds = [];
|
||||
|
||||
if($catId>0){
|
||||
|
||||
$catIds = model('ArticleCats')->getChild($catId);
|
||||
|
||||
}
|
||||
|
||||
$where = [];
|
||||
|
||||
$where['a.dataFlag'] = 1;
|
||||
|
||||
if(count($catIds)>0)$where['a.catId'] = ['in',$catIds];
|
||||
|
||||
if($key!='')$where['a.articleTitle'] = ['like','%'.$key.'%'];
|
||||
|
||||
$order = 'a.articleId desc';
|
||||
|
||||
if($sort){
|
||||
|
||||
$sort = str_replace('.',' ',$sort);
|
||||
|
||||
$order = $sort;
|
||||
|
||||
}
|
||||
|
||||
$page = Db::name('articles')->alias('a')
|
||||
|
||||
->join('__ARTICLE_CATS__ ac','a.catId= ac.catId','left')
|
||||
|
||||
->join('__STAFFS__ s','a.staffId= s.staffId','left')
|
||||
|
||||
->where($where)
|
||||
|
||||
->field('a.articleId,a.catId,a.articleTitle,a.isShow,a.articleContent,a.articleKey,a.createTime,ac.catName,s.staffName')
|
||||
|
||||
->order($order)
|
||||
|
||||
->paginate(input('post.limit/d'))->toArray();
|
||||
|
||||
if(count($page['Rows'])>0){
|
||||
|
||||
foreach ($page['Rows'] as $key => $v){
|
||||
|
||||
$page['Rows'][$key]['articleContent'] = strip_tags(htmlspecialchars_decode($v['articleContent']));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $page;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 显示是否显示/隐藏
|
||||
|
||||
*/
|
||||
|
||||
public function editiIsShow(){
|
||||
|
||||
$id = input('post.id/d');
|
||||
|
||||
$isShow = (input('post.isShow/d')==1)?1:0;
|
||||
|
||||
$result = $this->where(['articleId'=>$id])->update(['isShow' => $isShow]);
|
||||
|
||||
if(false !== $result){
|
||||
|
||||
WSTClearAllCache();
|
||||
|
||||
return WSTReturn("操作成功", 1);
|
||||
|
||||
}else{
|
||||
|
||||
return WSTReturn($this->getError(),-1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 获取指定对象
|
||||
|
||||
*/
|
||||
|
||||
public function getById($id){
|
||||
|
||||
$single = $this->where(['articleId'=>$id,'dataFlag'=>1])->find();
|
||||
|
||||
$singlec = Db::name('article_cats')->where(['catId'=>$single['catId'],'dataFlag'=>1])->field('catName')->find();
|
||||
|
||||
$single['catName']=$singlec['catName'];
|
||||
|
||||
$single['articleContent'] = htmlspecialchars_decode($single['articleContent']);
|
||||
|
||||
return $single;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 新增
|
||||
|
||||
*/
|
||||
|
||||
public function add(){
|
||||
|
||||
$data = input('post.');
|
||||
|
||||
WSTUnset($data,'articleId,dataFlag');
|
||||
|
||||
$data["staffId"] = (int)session('WST_STAFF.staffId');
|
||||
|
||||
$data['createTime'] = date('Y-m-d H:i:s');
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
try{
|
||||
|
||||
$result = $this->validate('Articles.add')->allowField(true)->save($data);
|
||||
|
||||
if(false !== $result){
|
||||
|
||||
WSTClearAllCache();
|
||||
|
||||
// 预览图
|
||||
|
||||
WSTUseImages(1, $this->articleId, $data['coverImg']);
|
||||
|
||||
//文章描述图片
|
||||
|
||||
WSTEditorImageRocord(1, $this->articleId, '',$data['articleContent']);
|
||||
|
||||
Db::commit();
|
||||
|
||||
return WSTReturn("新增成功", 1);
|
||||
|
||||
}
|
||||
|
||||
}catch(\Exception $e){
|
||||
|
||||
Db::rollback();errLog($e);
|
||||
|
||||
return WSTReturn($this->getError(),-1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 编辑
|
||||
|
||||
*/
|
||||
|
||||
public function edit(){
|
||||
|
||||
$articleId = input('post.id/d');
|
||||
|
||||
$data = input('post.');
|
||||
|
||||
WSTUnset($data,'articleId,dataFlag,createTime');
|
||||
|
||||
$data["staffId"] = (int)session('WST_STAFF.staffId');
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
try{
|
||||
|
||||
// 预览图
|
||||
|
||||
WSTUseImages(0, $articleId, $data['coverImg'],'articles','coverImg');
|
||||
|
||||
//文章描述图片
|
||||
|
||||
$oldArticleContent = $this->where('articleId',$articleId)->value('articleContent');// 旧描述
|
||||
|
||||
WSTEditorImageRocord(1, $articleId, $oldArticleContent,$data['articleContent']);
|
||||
|
||||
$result = $this->validate('Articles.edit')->allowField(true)->save($data,['articleId'=>$articleId]);
|
||||
|
||||
if(false !== $result){
|
||||
|
||||
WSTClearAllCache();
|
||||
|
||||
Db::commit();
|
||||
|
||||
return WSTReturn("修改成功", 1);
|
||||
|
||||
}
|
||||
|
||||
}catch(\Exception $e){
|
||||
|
||||
Db::rollback();errLog($e);
|
||||
|
||||
return WSTReturn($this->getError(),-1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 删除
|
||||
|
||||
*/
|
||||
|
||||
public function del(){
|
||||
|
||||
$id = input('post.id/d');
|
||||
|
||||
$data = [];
|
||||
|
||||
$data['dataFlag'] = -1;
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
try{
|
||||
|
||||
$result = $this->where(['articleId'=>$id])->update($data);
|
||||
|
||||
if(false !== $result){
|
||||
|
||||
WSTClearAllCache();
|
||||
|
||||
// 预览图
|
||||
|
||||
WSTUnuseImage('articles','coverImg',$id);
|
||||
|
||||
//文章描述图片
|
||||
|
||||
$oldArticleContent = $this->where('articleId',$id)->value('articleContent');// 旧描述
|
||||
|
||||
WSTEditorImageRocord(1, $id, $oldArticleContent,'');
|
||||
|
||||
Db::commit();
|
||||
|
||||
return WSTReturn("删除成功", 1);
|
||||
|
||||
}
|
||||
|
||||
}catch (\Exception $e) {
|
||||
|
||||
Db::rollback();errLog($e);
|
||||
|
||||
return WSTReturn('删除失败',-1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* 批量删除
|
||||
|
||||
*/
|
||||
|
||||
public function delByBatch(){
|
||||
|
||||
$ids = input('post.ids');
|
||||
|
||||
$data = [];
|
||||
|
||||
$data['dataFlag'] = -1;
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
try{
|
||||
|
||||
$result = $this->where(['articleId'=>['in',$ids]])->update($data);
|
||||
|
||||
if(false !== $result){
|
||||
|
||||
$oldArticleContent = $this->field('articleId,articleContent')->where(['articleId'=>['in',$ids]])->select();// 旧描述
|
||||
|
||||
foreach($oldArticleContent as $k=>$v){
|
||||
|
||||
// 预览图
|
||||
|
||||
WSTUnuseImage('articles','coverImg',$v['articleId']);
|
||||
|
||||
//文章描述图片
|
||||
|
||||
WSTEditorImageRocord(1, $v['articleId'], $v['articleContent'],'');
|
||||
|
||||
}
|
||||
|
||||
WSTClearAllCache();
|
||||
|
||||
Db::commit();
|
||||
|
||||
return WSTReturn("删除成功", 1);
|
||||
|
||||
}
|
||||
|
||||
}catch (\Exception $e) {
|
||||
|
||||
Db::rollback();errLog($e);
|
||||
|
||||
return WSTReturn('删除失败',-1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
132
hyhproject/admin/model/Attributes.php
Executable file
132
hyhproject/admin/model/Attributes.php
Executable file
@ -0,0 +1,132 @@
|
||||
<?php
|
||||
namespace wstmart\admin\model;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 规格业务处理
|
||||
*/
|
||||
class Attributes extends Base{
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$data = input('post.');
|
||||
WSTUnset($data, 'attrId,dataFlag');
|
||||
$data['createTime'] = date('Y-m-d H:i:s');
|
||||
$data['attrVal'] = str_replace(',',',',$data['attrVal']);
|
||||
$data["dataFlag"] = 1;
|
||||
$data["attrSort"] = (int)$data["attrSort"];
|
||||
$goodsCats = model('GoodsCats')->getParentIs($data['goodsCatId']);
|
||||
krsort($goodsCats);
|
||||
if(!empty($goodsCats))$data['goodsCatPath'] = implode('_',$goodsCats)."_";
|
||||
$result = $this->validate('Attributes.add')->allowField(true)->save($data);
|
||||
if(false !== $result){
|
||||
return WSTReturn("新增成功", 1);
|
||||
}else{
|
||||
return WSTReturn($this->getError(),-1);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit(){
|
||||
$attrId = input('post.attrId/d');
|
||||
$data = input('post.');
|
||||
$data["attrSort"] = (int)$data["attrSort"];
|
||||
WSTUnset($data, 'attrId,dataFlag,createTime');
|
||||
$data['attrVal'] = str_replace(',',',',$data['attrVal']);
|
||||
$goodsCats = model('GoodsCats')->getParentIs($data['goodsCatId']);
|
||||
krsort($goodsCats);
|
||||
if(!empty($goodsCats))$data['goodsCatPath'] = implode('_',$goodsCats)."_";
|
||||
$result = $this->validate('Attributes.edit')->allowField(true)->save($data,['attrId'=>$attrId]);
|
||||
if(false !== $result){
|
||||
return WSTReturn("编辑成功", 1);
|
||||
}else{
|
||||
return WSTReturn($this->getError(),-1);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$attrId = input('post.attrId/d');
|
||||
$data["dataFlag"] = -1;
|
||||
$result = $this->save($data,['attrId'=>$attrId]);
|
||||
if(false !== $result){
|
||||
return WSTReturn("删除成功", 1);
|
||||
}else{
|
||||
return WSTReturn($this->getError(),-1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 根据ID获取
|
||||
*/
|
||||
public function getById($attrId){
|
||||
$obj = null;
|
||||
if($attrId>0){
|
||||
$obj = $this->get(['attrId'=>$attrId,'dataFlag'=>1]);
|
||||
}else{
|
||||
$obj = self::getEModel("attributes");
|
||||
}
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示隐藏
|
||||
*/
|
||||
public function setToggle(){
|
||||
$attrId = input('post.attrId/d');
|
||||
$isShow = input('post.isShow/d');
|
||||
$result = $this->where(['attrId'=>$attrId,"dataFlag"=>1])->setField("isShow", $isShow);
|
||||
if(false !== $result){
|
||||
return WSTReturn("设置成功", 1);
|
||||
}else{
|
||||
return WSTReturn($this->getError(),-1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$keyName = input('keyName');
|
||||
$goodsCatPath = input('goodsCatPath');
|
||||
$dbo = $this->field(true);
|
||||
$map = array();
|
||||
$map['dataFlag'] = 1;
|
||||
if($keyName!="")$map['attrName'] = ["like","%".$keyName."%"];
|
||||
if($goodsCatPath!='')$map['goodsCatPath'] = ["like",$goodsCatPath."_%"];
|
||||
$page = $dbo->field(true)->where($map)->paginate(input('limit/d'))->toArray();
|
||||
if(count($page['Rows'])>0){
|
||||
$keyCats = model('GoodsCats')->listKeyAll();
|
||||
foreach ($page['Rows'] as $key => $v){
|
||||
$goodsCatPath = $page['Rows'][$key]['goodsCatPath'];
|
||||
$page['Rows'][$key]['goodsCatNames'] = self::getGoodsCatNames($goodsCatPath,$keyCats);
|
||||
$page['Rows'][$key]['children'] = [];
|
||||
$page['Rows'][$key]['isextend'] = false;
|
||||
}
|
||||
}
|
||||
return $page;
|
||||
}
|
||||
|
||||
public function getGoodsCatNames($goodsCatPath, $keyCats){
|
||||
$catIds = explode("_",$goodsCatPath);
|
||||
$catNames = array();
|
||||
for($i=0,$k=count($catIds);$i<$k;$i++){
|
||||
if($catIds[$i]=='')continue;
|
||||
if(isset($keyCats[$catIds[$i]]))$catNames[] = $keyCats[$catIds[$i]];
|
||||
}
|
||||
return implode("→",$catNames);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
public function listQuery(){
|
||||
$catId = input("post.catId/d");
|
||||
$rs = $this->field("attrId id, attrId, catId, attrName name, '' goodsCatNames")->where(["dataFlag"=>1,"catId"=>$catId])->sort('attrSort asc,attrId asc')->select();
|
||||
return $rs;
|
||||
}
|
||||
}
|
67
hyhproject/admin/model/Banks.php
Executable file
67
hyhproject/admin/model/Banks.php
Executable file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
namespace wstmart\admin\model;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 银行业务处理
|
||||
*/
|
||||
class Banks extends Base{
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
return $this->where('dataFlag',1)->field('bankId,bankName')->order('bankId desc')->paginate(input('limit/d'));
|
||||
}
|
||||
public function getById($id){
|
||||
return $this->get(['bankId'=>$id,'dataFlag'=>1]);
|
||||
}
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
public function listQuery(){
|
||||
return $this->where('dataFlag',1)->field('bankId,bankName')->select();
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$data = ['bankName'=>input('post.bankName'),
|
||||
'createTime'=>date('Y-m-d H:i:s'),];
|
||||
$result = $this->validate('Banks.add')->allowField(['bankName','createTime'])->save($data);
|
||||
if(false !== $result){
|
||||
cache('WST_BANKS',null);
|
||||
return WSTReturn("新增成功", 1);
|
||||
}else{
|
||||
return WSTReturn($this->getError(),-1);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit(){
|
||||
$bankId = input('post.bankId/d',0);
|
||||
$result = $this->validate('Banks.edit')->allowField(['bankName'])->save(['bankName'=>input('post.bankName')],['bankId'=>$bankId]);
|
||||
|
||||
if(false !== $result){
|
||||
cache('WST_BANKS',null);
|
||||
return WSTReturn("编辑成功", 1);
|
||||
}else{
|
||||
return WSTReturn($this->getError(),-1);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$id = input('post.id/d',0);
|
||||
$data = [];
|
||||
$data['dataFlag'] = -1;
|
||||
$result = $this->update($data,['bankId'=>$id]);
|
||||
if(false !== $result){
|
||||
cache('WST_BANKS',null);
|
||||
return WSTReturn("删除成功", 1);
|
||||
}else{
|
||||
return WSTReturn($this->getError(),-1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
24
hyhproject/admin/model/Base.php
Executable file
24
hyhproject/admin/model/Base.php
Executable file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace wstmart\admin\model;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 基础控业务处理
|
||||
*/
|
||||
use think\Model;
|
||||
use think\Db;
|
||||
class Base extends Model {
|
||||
/**
|
||||
* 获取空模型
|
||||
*/
|
||||
public function getEModel($tables){
|
||||
$rs = Db::query('show columns FROM `'.config('database.prefix').$tables."`");
|
||||
$obj = [];
|
||||
if($rs){
|
||||
foreach($rs as $key => $v) {
|
||||
$obj[$v['Field']] = $v['Default'];
|
||||
if($v['Key'] == 'PRI')$obj[$v['Field']] = 0;
|
||||
}
|
||||
}
|
||||
return $obj;
|
||||
}
|
||||
}
|
407
hyhproject/admin/model/Brands.php
Executable file
407
hyhproject/admin/model/Brands.php
Executable file
@ -0,0 +1,407 @@
|
||||
<?php
|
||||
|
||||
namespace wstmart\admin\model;
|
||||
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
|
||||
* ============================================================================
|
||||
|
||||
* 品牌业务处理
|
||||
|
||||
*/
|
||||
|
||||
class Brands extends Base{
|
||||
|
||||
/**
|
||||
|
||||
* 分页
|
||||
|
||||
*/
|
||||
|
||||
public function pageQuery(){
|
||||
|
||||
$key = input('key');
|
||||
|
||||
$id = input('id/d');
|
||||
|
||||
$where = [];
|
||||
|
||||
$where['b.dataFlag'] = 1;
|
||||
|
||||
if($key!='')$where['b.brandName'] = ['like','%'.$key.'%'];
|
||||
|
||||
if($id>0)$where['gcb.catId'] = $id;
|
||||
|
||||
$total = Db::name('brands')->alias('b');
|
||||
|
||||
if($id>0){
|
||||
|
||||
$total->join('__CAT_BRANDS__ gcb','b.brandId = gcb.brandId','left');
|
||||
|
||||
}
|
||||
|
||||
$page = $total->where($where)
|
||||
|
||||
->join('shops s','s.shopId=b.shopId','left')
|
||||
|
||||
->join('cat_brands cb','cb.brandId=b.brandId','left')
|
||||
|
||||
->join('goods_cats gc','gc.catId=cb.catId','left')
|
||||
|
||||
->where('b.dataFlag=1 and s.dataFlag=1 and s.shopStatus=1')
|
||||
|
||||
->field('b.brandId,b.brandName,b.brandImg,b.brandDesc,b.sortNo,s.shopName,gc.catName')
|
||||
|
||||
->order('b.brandId', 'desc')
|
||||
|
||||
->group('b.brandId')
|
||||
|
||||
->paginate(input('post.limit/d'))->toArray();
|
||||
|
||||
if(count($page['Rows'])>0){
|
||||
|
||||
foreach ($page['Rows'] as $key => $v){
|
||||
|
||||
$page['Rows'][$key]['brandDesc'] = strip_tags(htmlspecialchars_decode($v['brandDesc']));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $page;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 获取指定对象
|
||||
|
||||
*/
|
||||
|
||||
public function getById($id){
|
||||
|
||||
$result = $this->where(['brandId'=>$id])->find();
|
||||
|
||||
//获取关联的分类
|
||||
|
||||
$result['catIds'] = Db::name('cat_brands')->where(['brandId'=>$id])->column('catId');
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 新增
|
||||
|
||||
*/
|
||||
|
||||
public function add(){
|
||||
|
||||
$data = input('post.');
|
||||
|
||||
$shop=db('shops')->where(['shopId'=>$data['shopId'],'dataFlag'=>1,'shopStatus'=>1])->find();
|
||||
|
||||
if(!$shop) return WSTReturn('无效的店铺,请重新输入');
|
||||
|
||||
WSTUnset($data,'brandId,dataFlag');
|
||||
|
||||
$data['createTime'] = date('Y-m-d H:i:s');
|
||||
|
||||
$idsStr = explode(',',$data['catId']);
|
||||
|
||||
if($idsStr!=''){
|
||||
|
||||
foreach ($idsStr as $v){
|
||||
|
||||
if((int)$v>0)$ids[] = (int)$v;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
try{
|
||||
|
||||
$result = $this->validate('Brands.add')->allowField(true)->save($data);
|
||||
|
||||
if(false !== $result){
|
||||
|
||||
WSTClearAllCache();
|
||||
|
||||
//启用上传图片
|
||||
|
||||
WSTUseImages(1, $this->brandId, $data['brandImg']);
|
||||
|
||||
//商品描述图片
|
||||
|
||||
WSTEditorImageRocord(1, $this->brandId, '',$data['brandDesc']);
|
||||
|
||||
foreach ($ids as $key =>$v){
|
||||
|
||||
$d = array();
|
||||
|
||||
$d['catId'] = $v;
|
||||
|
||||
$d['brandId'] = $this->brandId;
|
||||
|
||||
Db::name('cat_brands')->insert($d);
|
||||
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
|
||||
return WSTReturn("新增成功", 1);
|
||||
|
||||
}
|
||||
|
||||
}catch (\Exception $e) {
|
||||
|
||||
Db::rollback();errLog($e);
|
||||
|
||||
}
|
||||
|
||||
return WSTReturn('新增失败',-1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 编辑
|
||||
|
||||
*/
|
||||
|
||||
public function edit(){
|
||||
|
||||
$brandId = input('post.id/d');
|
||||
|
||||
$data = input('post.');
|
||||
|
||||
$idsStr = explode(',',$data['catId']);
|
||||
|
||||
if($idsStr!=''){
|
||||
|
||||
foreach ($idsStr as $v){
|
||||
|
||||
if((int)$v>0)$ids[] = (int)$v;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$filter = array();
|
||||
|
||||
//获取品牌的关联分类
|
||||
|
||||
$catBrands = Db::name('cat_brands')->where(['brandId'=>$brandId])->select();
|
||||
|
||||
foreach ($catBrands as $key =>$v){
|
||||
|
||||
if(!in_array($v['catId'],$ids))$filter[] = $v['catId'];
|
||||
|
||||
}
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
try{
|
||||
|
||||
WSTUseImages(1, $brandId, $data['brandImg'], 'brands', 'brandImg');
|
||||
|
||||
// 品牌描述图片
|
||||
|
||||
$desc = $this->where('brandId',$brandId)->value('brandDesc');
|
||||
|
||||
WSTEditorImageRocord(1, $brandId, $desc, $data['brandDesc']);
|
||||
|
||||
$result = $this->validate('Brands.edit')->allowField(['brandName','brandImg','brandDesc','sortNo','shopId'])->save(input('post.'),['brandId'=>$brandId]);//添加shopId mark cheng 20180207
|
||||
|
||||
if(false !== $result){
|
||||
|
||||
WSTClearAllCache();
|
||||
|
||||
foreach ($catBrands as $key =>$v){
|
||||
|
||||
Db::name('cat_brands')->where('brandId',$brandId)->delete();
|
||||
|
||||
}
|
||||
|
||||
foreach ($ids as $key =>$v){
|
||||
|
||||
$d = array();
|
||||
|
||||
$d['catId'] = $v;
|
||||
|
||||
$d['brandId'] = $brandId;
|
||||
|
||||
Db::name('cat_brands')->insert($d);
|
||||
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
|
||||
return WSTReturn("修改成功", 1);
|
||||
|
||||
}
|
||||
|
||||
}catch (\Exception $e) {
|
||||
|
||||
Db::rollback();errLog($e);
|
||||
|
||||
}
|
||||
|
||||
return WSTReturn('修改失败',-1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 删除
|
||||
|
||||
*/
|
||||
|
||||
public function del(){
|
||||
|
||||
$id = input('post.id/d');
|
||||
|
||||
$data = [];
|
||||
|
||||
$data['dataFlag'] = -1;
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
try{
|
||||
|
||||
$result = $this->where(['brandId'=>$id])->update($data);
|
||||
|
||||
WSTUnuseImage('brands','brandImg',$id);
|
||||
|
||||
// 品牌描述图片
|
||||
|
||||
$desc = $this->where('brandId',$id)->value('brandDesc');
|
||||
|
||||
WSTEditorImageRocord(1, $id, $desc,'');
|
||||
|
||||
if(false !== $result){
|
||||
|
||||
WSTClearAllCache();
|
||||
|
||||
//删除推荐品牌
|
||||
|
||||
Db::name('recommends')->where(['dataSrc'=>2,'dataId'=>$id])->delete();
|
||||
|
||||
//删除品牌和分类的关系
|
||||
|
||||
Db::name('cat_brands')->where(['brandId'=>$id])->delete();
|
||||
|
||||
Db::commit();
|
||||
|
||||
return WSTReturn("删除成功", 1);
|
||||
|
||||
}
|
||||
|
||||
}catch (\Exception $e) {
|
||||
|
||||
Db::rollback();errLog($e);
|
||||
|
||||
}
|
||||
|
||||
return WSTReturn('删除失败',-1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 获取品牌
|
||||
|
||||
*/
|
||||
|
||||
public function searchBrands(){
|
||||
|
||||
$goodsCatatId = (int)input('post.goodsCatId');
|
||||
|
||||
if($goodsCatatId<=0)return [];
|
||||
|
||||
$key = input('post.key');
|
||||
|
||||
$where = [];
|
||||
|
||||
$where['dataFlag'] = 1;
|
||||
|
||||
$where['catId'] = $goodsCatatId;
|
||||
|
||||
if($key!='')$where['brandName'] = ['like','%'.$key.'%'];
|
||||
|
||||
return $this->alias('s')->join('__CAT_BRANDS__ cb','s.brandId=cb.brandId','inner')
|
||||
|
||||
->where($where)->field('brandName,s.brandId')->select();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* 排序字母
|
||||
|
||||
*/
|
||||
|
||||
public function letterObtain(){
|
||||
|
||||
$areaName = input('code');
|
||||
|
||||
if($areaName =='')return WSTReturn("", 1);
|
||||
|
||||
$areaName = WSTGetFirstCharter($areaName);
|
||||
|
||||
if($areaName){
|
||||
|
||||
return WSTReturn($areaName, 1);
|
||||
|
||||
}else{
|
||||
|
||||
return WSTReturn("", 1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 修改品牌排序
|
||||
|
||||
*/
|
||||
|
||||
public function changeSort(){
|
||||
|
||||
$id = (int)input('id');
|
||||
|
||||
$sortNo = (int)input('sortNo');
|
||||
|
||||
$result = $this->setField(['brandId'=>$id,'sortNo'=>$sortNo]);
|
||||
|
||||
if(false !== $result){
|
||||
|
||||
return WSTReturn("操作成功", 1);
|
||||
|
||||
}else{
|
||||
|
||||
return WSTReturn($this->getError(),-1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
158
hyhproject/admin/model/Carts.php
Executable file
158
hyhproject/admin/model/Carts.php
Executable file
@ -0,0 +1,158 @@
|
||||
<?php
|
||||
namespace wstmart\admin\model;
|
||||
use think\Db;
|
||||
use think\Loader;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 商品类
|
||||
*/
|
||||
class Carts extends Base{
|
||||
/**
|
||||
* 购物车列表
|
||||
*/
|
||||
public function cartsByPage(){
|
||||
$shopName=input('shopName');
|
||||
$loginName=input('loginName');
|
||||
$goodsName=input('goodsName');
|
||||
$where = [];
|
||||
$where['g.goodsStatus'] = 1;
|
||||
$where['g.dataFlag'] = 1;
|
||||
$where['g.isSale'] = 1;
|
||||
if($shopName!="")$where['shopName']=['like',"%$shopName%"];
|
||||
if($loginName!="")$where['loginName']=['like',"%$loginName%"];
|
||||
if($goodsName!="")$where['goodsName']=['like',"%$goodsName%"];
|
||||
$result=$this->alias('c')
|
||||
->join('__USERS__ u','u.userId=c.userId','left')
|
||||
->join('__GOODS__ g','g.goodsId=c.goodsId','left')
|
||||
->join('__SHOPS__ s','s.shopId=g.shopId','left')
|
||||
->where($where)
|
||||
->field('u.loginName,shopPrice,sum(cartNum)cartNum,goodsName,shopName,goodsImg,goodsCatIdPath,g.goodsId')
|
||||
->order('cartNum desc')
|
||||
->group('u.userId,g.goodsId')
|
||||
->paginate(input('limit/d'))->toArray();
|
||||
$keyCats = model('GoodsCats')->listKeyAll();
|
||||
foreach ($result['Rows'] as $key => $v){
|
||||
$result['Rows'][$key]['totalPrice']=$v['cartNum']*$v['shopPrice'];
|
||||
$result['Rows'][$key]['goodsCatName'] = self::getGoodsCatNames($v['goodsCatIdPath'],$keyCats);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
public function getGoodsCatNames($goodsCatPath, $keyCats){
|
||||
$catIds = explode("_",$goodsCatPath);
|
||||
$catNames = array();
|
||||
for($i=0,$k=count($catIds);$i<$k;$i++){
|
||||
if($catIds[$i]=='')continue;
|
||||
if(isset($keyCats[$catIds[$i]]))$catNames[] = $keyCats[$catIds[$i]];
|
||||
}
|
||||
return implode("→",$catNames);
|
||||
}
|
||||
//导出数据
|
||||
public function toExport(){
|
||||
$name='购物车数据';
|
||||
$shopName=input('shopName');
|
||||
$loginName=input('loginName');
|
||||
$goodsName=input('goodsName');
|
||||
$where = [];
|
||||
$where['g.goodsStatus'] = 1;
|
||||
$where['g.dataFlag'] = 1;
|
||||
$where['g.isSale'] = 1;
|
||||
if($shopName!="")$where['shopName']=['like',"%$shopName%"];
|
||||
if($loginName!="")$where['loginName']=['like',"%$loginName%"];
|
||||
if($goodsName!="")$where['goodsName']=['like',"%$goodsName%"];
|
||||
$page=$this->alias('c')
|
||||
->join('__USERS__ u','u.userId=c.userId','left')
|
||||
->join('__GOODS__ g','g.goodsId=c.goodsId','left')
|
||||
->join('__SHOPS__ s','s.shopId=g.shopId','left')
|
||||
->where($where)
|
||||
->field('u.loginName,shopPrice,sum(cartNum)cartNum,goodsName,shopName,goodsImg,goodsCatIdPath,g.goodsId')
|
||||
->order('cartNum desc')
|
||||
->group('u.userId,g.goodsId')
|
||||
->select();
|
||||
// dump($page);
|
||||
$keyCats = model('GoodsCats')->listKeyAll();
|
||||
foreach ($page as $key => $v){
|
||||
$page[$key]['totalPrice']=$v['cartNum']*$v['shopPrice'];
|
||||
$page[$key]['goodsCatName'] = self::getGoodsCatNames($v['goodsCatIdPath'],$keyCats);
|
||||
}
|
||||
Loader::import('phpexcel.PHPExcel.IOFactory');
|
||||
$objPHPExcel = new \PHPExcel();
|
||||
// 设置excel文档的属性
|
||||
$objPHPExcel->getProperties()->setCreator("heyuanhui")//创建人
|
||||
->setLastModifiedBy("heyuanhui")//最后修改人
|
||||
->setTitle($name)//标题
|
||||
->setSubject($name)//题目
|
||||
->setDescription($name)//描述
|
||||
->setKeywords("订单")//关键字
|
||||
->setCategory("Test result file");//种类
|
||||
|
||||
// 开始操作excel表
|
||||
$objPHPExcel->setActiveSheetIndex(0);
|
||||
// 设置工作薄名称
|
||||
$objPHPExcel->getActiveSheet()->setTitle(iconv('gbk', 'utf-8', 'Sheet'));
|
||||
// 设置默认字体和大小
|
||||
$objPHPExcel->getDefaultStyle()->getFont()->setName(iconv('gbk', 'utf-8', ''));
|
||||
$objPHPExcel->getDefaultStyle()->getFont()->setSize(11);
|
||||
$styleArray = array(
|
||||
'font' => array(
|
||||
'bold' => true,
|
||||
'color'=>array(
|
||||
'argb' => 'ffffffff',
|
||||
)
|
||||
),
|
||||
'borders' => array (
|
||||
'outline' => array (
|
||||
'style' => \PHPExcel_Style_Border::BORDER_THIN, //设置border样式
|
||||
'color' => array ('argb' => 'FF000000'), //设置border颜色
|
||||
)
|
||||
)
|
||||
);
|
||||
//设置宽
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(25);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(55);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(12);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(12);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(12);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(25);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(40);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth(25);
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A1:H1')->getFill()->setFillType(\PHPExcel_Style_Fill::FILL_SOLID);
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A1:H1')->getFill()->getStartColor()->setARGB('333399');
|
||||
|
||||
$objPHPExcel->getActiveSheet()
|
||||
->setCellValue('A1', '用户名称')
|
||||
->setCellValue('B1', '商品名称')
|
||||
->setCellValue('C1', '购物车数量')
|
||||
->setCellValue('D1', '单品价格')
|
||||
->setCellValue('E1', '总价')
|
||||
->setCellValue('F1', '所属店铺')
|
||||
->setCellValue('G1', '所属分类');
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A1:G1')->applyFromArray($styleArray);
|
||||
|
||||
for ($row = 0; $row < count($page); $row++){
|
||||
$i = $row+2;
|
||||
$objPHPExcel->getActiveSheet()
|
||||
->setCellValue('A'.$i, $page[$row]['loginName'])
|
||||
->setCellValue('B'.$i, $page[$row]['goodsName'])
|
||||
->setCellValue('C'.$i, $page[$row]['cartNum'])
|
||||
->setCellValue('D'.$i, $page[$row]['shopPrice'])
|
||||
->setCellValue('E'.$i, $page[$row]['totalPrice'])
|
||||
->setCellValue('F'.$i, $page[$row]['shopName'])
|
||||
->setCellValue('G'.$i, $page[$row]['goodsCatName']);
|
||||
|
||||
}
|
||||
//输出EXCEL格式
|
||||
$objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||
// 从浏览器直接输出$filename
|
||||
header('Content-Type:application/csv;charset=UTF-8');
|
||||
header("Pragma: public");
|
||||
header("Expires: 0");
|
||||
header("Cache-Control:must-revalidate, post-check=0, pre-check=0");
|
||||
header("Content-Type:application/force-download");
|
||||
header("Content-Type:application/vnd.ms-excel;");
|
||||
header("Content-Type:application/octet-stream");
|
||||
header("Content-Type:application/download");
|
||||
header('Content-Disposition: attachment;filename="'.$name.'.xls"');
|
||||
header("Content-Transfer-Encoding:binary");
|
||||
$objWriter->save('php://output');
|
||||
}
|
||||
}
|
771
hyhproject/admin/model/CashDraws.php
Executable file
771
hyhproject/admin/model/CashDraws.php
Executable file
@ -0,0 +1,771 @@
|
||||
<?php
|
||||
|
||||
namespace wstmart\admin\model;
|
||||
|
||||
use think\Db;
|
||||
|
||||
use think\Loader;
|
||||
|
||||
/**
|
||||
|
||||
* ============================================================================
|
||||
|
||||
* 提现分类业务处理
|
||||
|
||||
*/
|
||||
|
||||
class CashDraws extends Base{
|
||||
|
||||
/**
|
||||
|
||||
* 分页
|
||||
|
||||
*/
|
||||
|
||||
public function pageQuery(){
|
||||
|
||||
$targetType = input('targetType',-1);
|
||||
|
||||
$cashNo = input('cashNo');
|
||||
|
||||
$cashSatus = input('cashSatus',-1);
|
||||
|
||||
$where = [];
|
||||
|
||||
if(in_array($targetType,[0,1]))$where['targetType'] = $targetType;
|
||||
|
||||
if(in_array($cashSatus,[0,1]))$where['cashSatus'] = $cashSatus;
|
||||
|
||||
if($cashNo!='')$where['cashNo'] = ['like','%'.$cashNo.'%'];
|
||||
|
||||
|
||||
|
||||
$sort = input('sort');
|
||||
|
||||
$order = [];
|
||||
|
||||
if($sort!=''){
|
||||
|
||||
$sortArr = explode('.',$sort);
|
||||
|
||||
$order = $sortArr[0].' '.$sortArr[1];
|
||||
|
||||
if($sortArr[0]=='cashNo'){
|
||||
|
||||
$order = $sortArr[0].'+0 '.$sortArr[1];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//mark by cheng 只显示超过一天的提现数据
|
||||
|
||||
//$page = $this->where($where)->whereTime('createTime','<=', date('Y-m-d'))->order($order)->order('createTime desc')->paginate(input('limit/d'))->toArray();
|
||||
$page = $this->where($where)->order($order)->order('createTime desc')->paginate(input('limit/d'))->toArray();
|
||||
|
||||
if(count($page['Rows'])>0){
|
||||
|
||||
$userIds = [];
|
||||
|
||||
$shopIds = [];
|
||||
|
||||
foreach ($page['Rows'] as $key => $v) {
|
||||
|
||||
if($v['targetType']==0)$userIds[] = $v['targetId'];
|
||||
|
||||
if($v['targetType']==1)$shopIds[] = $v['targetId'];
|
||||
|
||||
}
|
||||
|
||||
$userMap = [];
|
||||
|
||||
if(count($userIds)>0){
|
||||
|
||||
$user = Db::name('users')->where(['userId'=>['in',$userIds]])->field('userId,loginName,userName')->select();
|
||||
|
||||
foreach ($user as $key => $v) {
|
||||
|
||||
$userMap["0_".$v['userId']] = $v;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(count($shopIds)>0){
|
||||
|
||||
$user = Db::name('shops')->alias('s')
|
||||
|
||||
->join('__USERS__ u','u.userId=s.userId')
|
||||
|
||||
->where(['shopId'=>['in',$shopIds]])
|
||||
|
||||
->field('s.shopId,u.loginName,s.shopName as userName')
|
||||
|
||||
->select();
|
||||
|
||||
foreach ($user as $key => $v) {
|
||||
|
||||
$userMap["1_".$v['shopId']] = $v;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
foreach ($page['Rows'] as $key => $v) {
|
||||
|
||||
$page['Rows'][$key]['loginName'] = $userMap[$v['targetType']."_".$v['targetId']]['loginName'];
|
||||
|
||||
$page['Rows'][$key]['userName'] = $userMap[$v['targetType']."_".$v['targetId']]['userName'];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $page;
|
||||
|
||||
}
|
||||
/**
|
||||
* 查看报表
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function viewReport($date,$isSave=0){
|
||||
|
||||
$orders['list'] = Db::name('orders')
|
||||
->where('orderStatus=2 AND dataFlag=1')
|
||||
->whereTime('receiveTime',[$date,date('Y-m-d',strtotime('+1 day',strtotime($date)))])
|
||||
->field('orderId,shopId,userId,productTaxFee,productHandlingFee,couponsHandlingFee,couponsTaxFee,realTotalMoney,receiveTime,payable')
|
||||
->select();
|
||||
//dump(Db::getlastsql());
|
||||
$discountMoney = 0;
|
||||
$m = Model('common/Table');
|
||||
$orders['allPaySum']=0;//消费总额
|
||||
$orders['coupousEarningsSum'] = 0;//优惠款总收益
|
||||
$orders['hasVouchersEearningsSum'] = 0;//已获券总收益
|
||||
$orders['taxFeeSum'] = 0;//税费总收益
|
||||
$orders['collectionPaySum']=0;//公司需付商家,即商家已获旺旺券总额
|
||||
$orders['collectionGatheringSum']=0;//商家需付公司总额
|
||||
$orders['collection']=[];
|
||||
$orders['yesterdayMoney']=0;
|
||||
$orders['todayMoney']=0;
|
||||
$m->setTable('log_day_money');
|
||||
$orders['yesterdayMoney'] = $m->getSum('setTime < '.strtotime($date),'money');
|
||||
foreach ($orders['list'] as &$v) {
|
||||
$orders['allPaySum'] += $v['realTotalMoney'];
|
||||
$m->setTable('order_goods');
|
||||
$orderGoodsList = $m->getList(['orderId'=>$v['orderId']],'goodsPrice,goodsNum,freight,discountRate');
|
||||
$discountMoney = 0;//优惠款
|
||||
foreach ($orderGoodsList as &$val) {
|
||||
$discountMoney += ($val['goodsPrice']*$val['goodsNum'] + $val['freight']) * ($val['discountRate']*0.01);//优惠款
|
||||
}
|
||||
$v['discountMoney'] = $discountMoney;
|
||||
$v['coupousEarnings'] = $discountMoney * 0.1;//优惠款收益
|
||||
$orders['coupousEarningsSum']+=$v['coupousEarnings'];
|
||||
|
||||
$v['hasVouchersEearnings'] = $v['productHandlingFee'] + $v['couponsHandlingFee'];//已获券收益
|
||||
$orders['hasVouchersEearningsSum']+=$v['hasVouchersEearnings'];
|
||||
|
||||
$v['taxFee'] = $v['productTaxFee']+$v['couponsTaxFee'];//税费
|
||||
$orders['taxFeeSum']+=$v['taxFee'];
|
||||
|
||||
$m->setTable('shops');
|
||||
$shopUserId = $m->getField(['shopId'=>$v['shopId']],'userId');
|
||||
$m->setTable('users');
|
||||
$v['loginName'] = $m->getField(['userId'=>$v['userId']],'loginName');
|
||||
$v['shopLoginName'] = $m->getField(['userId'=>$shopUserId],'loginName');
|
||||
if(!isset($orders['collection'][$shopUserId]['gathering'])) $orders['collection'][$shopUserId]['gathering']=0;
|
||||
if(!isset($orders['collection'][$shopUserId]['pay'])) $orders['collection'][$shopUserId]['pay']=0;
|
||||
$orders['collection'][$shopUserId]['shopLoginName'] = $v['shopLoginName'];
|
||||
|
||||
if($v['payable']>0){
|
||||
//公司需付商家,即提现
|
||||
$orders['collection'][$shopUserId]['pay']+=$v['payable'];//代付款
|
||||
$orders['collectionPaySum'] += $v['payable'];
|
||||
}else{
|
||||
//商家需付公司
|
||||
$orders['collection'][$shopUserId]['gathering'] += abs($v['payable']);//代收款
|
||||
$orders['collectionGatheringSum'] += abs($v['payable']);
|
||||
}
|
||||
}
|
||||
$allMoney = $orders['collectionGatheringSum']-($orders['coupousEarningsSum']+$orders['hasVouchersEearningsSum']+$orders['taxFeeSum']+$orders['collectionPaySum']);
|
||||
$orders['todayMoney'] = $orders['yesterdayMoney'] + $allMoney;
|
||||
if(1 == $isSave && $allMoney != 0){
|
||||
$data['money'] = $allMoney;//充值/扣除数量
|
||||
if($allMoney >= 0 ){
|
||||
$reTypeName = '充值';
|
||||
}else{
|
||||
$reTypeName = '扣除';
|
||||
}
|
||||
$data['adminId'] = 0;
|
||||
$data['logContent'] = '系统'.$reTypeName;
|
||||
$data['setTime'] = time();
|
||||
$data['createTime'] = time();
|
||||
$m->setTable('log_day_money');
|
||||
$m->insertInfo($data);
|
||||
echo $allMoney;
|
||||
return true;
|
||||
}
|
||||
//$orders['collection'] = Db::name('orders')->where();
|
||||
return $orders;
|
||||
}
|
||||
/**
|
||||
|
||||
* 获取提现详情
|
||||
|
||||
*/
|
||||
|
||||
public function getById(){
|
||||
|
||||
$id = (int)input('id');
|
||||
|
||||
$rs = $this->get($id);
|
||||
|
||||
$user = [];
|
||||
|
||||
if($rs['targetType']==1){
|
||||
|
||||
$user = Db::name('shops')->alias('s')
|
||||
|
||||
->join('__USERS__ u','u.userId=s.userId')
|
||||
|
||||
->where('shopId',$rs['targetId'])
|
||||
|
||||
->field('s.shopId,u.loginName,s.shopName as userName')
|
||||
|
||||
->find();
|
||||
|
||||
|
||||
|
||||
}else{
|
||||
|
||||
$user = Db::name('users')->where('userId',$rs['targetId'])->field('userId,loginName,userName')->find();
|
||||
|
||||
}
|
||||
|
||||
$rs['userName'] = $user['userName'];
|
||||
|
||||
$rs['loginName'] = $user['loginName'];
|
||||
|
||||
return $rs;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 处理提现成功
|
||||
|
||||
*/
|
||||
|
||||
public function handle(){
|
||||
|
||||
$id = (int)input('cashId');
|
||||
|
||||
$cash = $this->get($id);
|
||||
|
||||
if(empty($cash))return WSTReturn('无效的提现申请记录');
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
try{
|
||||
|
||||
|
||||
|
||||
if($cash->targetType==0){
|
||||
|
||||
$user = model('users')->get($cash->targetId);
|
||||
|
||||
// if($user->lockMoney<$cash->money)return WSTReturn('操作失败,被冻结的金额小于提现金额');
|
||||
|
||||
// $user->lockMoney = $user->lockMoney-$cash->money;
|
||||
|
||||
// $user->save();
|
||||
|
||||
$targetId = $user->userId;
|
||||
|
||||
}else{
|
||||
|
||||
$shop = model('shops')->get($cash->targetId);
|
||||
|
||||
// if($shop->lockMoney<$cash->money)return WSTReturn('操作失败,被冻结的金额小于提现金额');
|
||||
|
||||
// $shop->lockMoney = $shop->lockMoney-$cash->money;
|
||||
|
||||
// $shop->save();
|
||||
|
||||
$targetId = $shop->userId;
|
||||
|
||||
}
|
||||
|
||||
$cash->cashSatus = 1;
|
||||
|
||||
$cash->cashRemarks = input('cashRemarks');
|
||||
|
||||
$result = $cash->save();
|
||||
|
||||
|
||||
|
||||
if(false != $result){
|
||||
|
||||
//创建一条流水记录
|
||||
|
||||
$lm = [];
|
||||
|
||||
$lm['targetType'] = $cash->targetType;
|
||||
|
||||
$lm['targetId'] = $targetId;
|
||||
|
||||
$lm['dataId'] = $id;
|
||||
|
||||
$lm['dataSrc'] = 3;
|
||||
|
||||
$lm['remark'] = '提现申请单【'.$cash->cashNo.'】申请提现¥'.$cash->money.'。'.(($cash->cashRemarks!='')?"【操作备注】:".$cash->cashRemarks:'');
|
||||
|
||||
$lm['moneyType'] = 0;
|
||||
|
||||
$lm['money'] = $cash->money;
|
||||
|
||||
$lm['payType'] = 0;
|
||||
|
||||
$lm['createTime'] = date('Y-m-d H:i:s');
|
||||
|
||||
model('LogMoneys')->insert($lm);
|
||||
|
||||
//发送信息信息
|
||||
|
||||
$tpl = WSTMsgTemplates('CASH_DRAW_SUCCESS');
|
||||
|
||||
if( $tpl['tplContent']!='' && $tpl['status']=='1'){
|
||||
|
||||
$find = ['${CASH_NO}'];
|
||||
|
||||
$replace = [$cash->cashNo];
|
||||
|
||||
WSTSendMsg($targetId,str_replace($find,$replace,$tpl['tplContent']),['from'=>5,'dataId'=>$id]);
|
||||
|
||||
}
|
||||
|
||||
//微信消息
|
||||
|
||||
if((int)WSTConf('CONF.wxenabled')==1){
|
||||
|
||||
$params = [];
|
||||
|
||||
$params['CASH_NO'] = $cash->cashNo;
|
||||
|
||||
$params['MONEY'] = $cash->money;
|
||||
|
||||
$params['CASH_TYPE'] = '银行提现';
|
||||
|
||||
$params['CASH_TIME'] = $cash['createTime'];
|
||||
|
||||
$params['CASH_RESULT'] = "审核通过。【备注:".((input('cashRemarks')=='')?"无":input('cashRemarks'))."】";
|
||||
|
||||
$params['EXAMINE_TIME'] = date('Y-m-d H:i:s');
|
||||
|
||||
WSTWxMessage(['CODE'=>'WX_CASH_DRAW_SUCCESS','userId'=>$targetId,'params'=>$params]);
|
||||
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
|
||||
return WSTReturn('操作成功!',1);
|
||||
|
||||
}
|
||||
|
||||
}catch (\Exception $e) {
|
||||
|
||||
Db::rollback();errLog($e);
|
||||
|
||||
}
|
||||
|
||||
return WSTReturn('操作失败!',-1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 处理提现失败
|
||||
|
||||
*/
|
||||
|
||||
public function handleFail(){
|
||||
|
||||
$id = (int)input('cashId');
|
||||
|
||||
$cash = $this->get($id);
|
||||
|
||||
if(empty($cash))return WSTReturn('无效的提现申请记录');
|
||||
|
||||
if(input('cashRemarks')=='')return WSTReturn('请输入提现失败原因');
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
try{
|
||||
|
||||
|
||||
|
||||
if($cash->targetType==0){
|
||||
|
||||
$user = model('users')->get($cash->targetId);
|
||||
|
||||
if($user->lockMoney<$cash->money)return WSTReturn('操作失败,无效的冻结的金额');
|
||||
|
||||
$user->userMoney = $user->userMoney + $cash->money;
|
||||
|
||||
$user->lockMoney = $user->lockMoney-$cash->money;
|
||||
|
||||
$user->save();
|
||||
|
||||
$targetId = $user->userId;
|
||||
|
||||
}else{
|
||||
|
||||
$shop = model('shops')->get($cash->targetId);
|
||||
|
||||
if($shop->lockMoney<$cash->money)return WSTReturn('操作失败,无效的冻结的金额');
|
||||
|
||||
$shop->shopMoney = $shop->shopMoney + $cash->money;
|
||||
|
||||
$shop->lockMoney = $shop->lockMoney-$cash->money;
|
||||
|
||||
$shop->save();
|
||||
|
||||
$targetId = $shop->userId;
|
||||
|
||||
}
|
||||
|
||||
$cash->cashSatus = -1;
|
||||
|
||||
$cash->cashRemarks = input('cashRemarks');
|
||||
|
||||
$result = $cash->save();
|
||||
|
||||
|
||||
|
||||
if(false != $result){
|
||||
|
||||
//发送信息信息
|
||||
|
||||
$tpl = WSTMsgTemplates('CASH_DRAW_FAIL');
|
||||
|
||||
if( $tpl['tplContent']!='' && $tpl['status']=='1'){
|
||||
|
||||
$find = ['${CASH_NO}','${CASH_RESULT}'];
|
||||
|
||||
$replace = [$cash->cashNo,input('cashRemarks')];
|
||||
|
||||
WSTSendMsg($targetId,str_replace($find,$replace,$tpl['tplContent']),['from'=>5,'dataId'=>$id]);
|
||||
|
||||
}
|
||||
|
||||
//微信消息
|
||||
|
||||
if((int)WSTConf('CONF.wxenabled')==1){
|
||||
|
||||
$params = [];
|
||||
|
||||
$params['CASH_NO'] = $cash->cashNo;
|
||||
|
||||
$params['MONEY'] = $cash->money;
|
||||
|
||||
$params['CASH_TYPE'] = '银行提现';
|
||||
|
||||
$params['CASH_TIME'] = $cash['createTime'];
|
||||
|
||||
$params['CASH_RESULT'] = "审核不通过。【备注:".((input('cashRemarks')=='')?"无":input('cashRemarks'))."】";
|
||||
|
||||
$params['EXAMINE_TIME'] = date('Y-m-d H:i:s');
|
||||
|
||||
WSTWxMessage(['CODE'=>'WX_CASH_DRAW_FAIL','userId'=>$targetId,'params'=>$params]);
|
||||
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
|
||||
return WSTReturn('操作成功!',1);
|
||||
|
||||
}
|
||||
|
||||
}catch (\Exception $e) {
|
||||
|
||||
Db::rollback();errLog($e);
|
||||
|
||||
}
|
||||
|
||||
return WSTReturn('操作失败!',-1);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* 导出提现申请
|
||||
|
||||
*/
|
||||
|
||||
public function toExport(){
|
||||
|
||||
$name='提现申请表';
|
||||
|
||||
$targetType = input('targetType',-1);
|
||||
|
||||
$cashNo = input('cashNo');
|
||||
|
||||
$cashSatus = input('cashSatus',-1);
|
||||
|
||||
$where = [];
|
||||
|
||||
if(in_array($targetType,[0,1]))$where['targetType'] = $targetType;
|
||||
|
||||
if(in_array($cashSatus,[0,1]))$where['cashSatus'] = $cashSatus;
|
||||
|
||||
if($cashNo!='')$where['cashNo'] = ['like','%'.$cashNo.'%'];
|
||||
|
||||
// 排序
|
||||
|
||||
$sort = input('sort');
|
||||
|
||||
$order = [];
|
||||
|
||||
if($sort!=''){
|
||||
|
||||
$sortArr = explode('.',$sort);
|
||||
|
||||
$order = $sortArr[0].' '.$sortArr[1];
|
||||
|
||||
if($sortArr[0]=='cashNo'){
|
||||
|
||||
$order = $sortArr[0].'+0 '.$sortArr[1];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$page = $this->where($where)->order($order)->order('createTime desc')->select();
|
||||
|
||||
if(count($page)>0){
|
||||
|
||||
$userIds = [];
|
||||
|
||||
$shopIds = [];
|
||||
|
||||
foreach ($page as $key => $v) {
|
||||
|
||||
if($v['targetType']==0)$userIds[] = $v['targetId'];
|
||||
|
||||
if($v['targetType']==1)$shopIds[] = $v['targetId'];
|
||||
|
||||
}
|
||||
|
||||
$userMap = [];
|
||||
|
||||
if(count($userIds)>0){
|
||||
|
||||
$user = Db::name('users')->where(['userId'=>['in',$userIds]])->field('userId,loginName,userName')->select();
|
||||
|
||||
foreach ($user as $key => $v) {
|
||||
|
||||
$userMap["0_".$v['userId']] = $v;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(count($shopIds)>0){
|
||||
|
||||
$user = Db::name('shops')->alias('s')
|
||||
|
||||
->join('__USERS__ u','u.userId=s.userId')
|
||||
|
||||
->where(['shopId'=>['in',$shopIds]])
|
||||
|
||||
->field('s.shopId,u.loginName,s.shopName as userName')
|
||||
|
||||
->select();
|
||||
|
||||
foreach ($user as $key => $v) {
|
||||
|
||||
$userMap["1_".$v['shopId']] = $v;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
foreach ($page as $key => $v) {
|
||||
|
||||
$page[$key]['userType'] = ($v['targetType']==1)?"【商家】":"【会员】";
|
||||
|
||||
$page[$key]['loginName'] = $userMap[$v['targetType']."_".$v['targetId']]['loginName'];
|
||||
|
||||
$page[$key]['userName'] = $userMap[$v['targetType']."_".$v['targetId']]['userName'];
|
||||
|
||||
$page[$key]['cashSatus'] = ($page[$key]['cashSatus']==1)?'提现成功':(($page[$key]['cashSatus']==-1)?'提现失败':'待处理');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loader::import('phpexcel.PHPExcel.IOFactory');
|
||||
|
||||
$objPHPExcel = new \PHPExcel();
|
||||
|
||||
// 设置excel文档的属性
|
||||
|
||||
$objPHPExcel->getProperties()->setCreator("WSTMart")//创建人
|
||||
|
||||
->setLastModifiedBy("WSTMart")//最后修改人
|
||||
|
||||
->setTitle($name)//标题
|
||||
|
||||
->setSubject($name)//题目
|
||||
|
||||
->setDescription($name)//描述
|
||||
|
||||
->setKeywords("提现")//关键字
|
||||
|
||||
->setCategory("Test result file");//种类
|
||||
|
||||
|
||||
|
||||
// 开始操作excel表
|
||||
|
||||
$objPHPExcel->setActiveSheetIndex(0);
|
||||
|
||||
// 设置工作薄名称
|
||||
|
||||
$objPHPExcel->getActiveSheet()->setTitle(iconv('gbk', 'utf-8', 'Sheet'));
|
||||
|
||||
// 设置默认字体和大小
|
||||
|
||||
$objPHPExcel->getDefaultStyle()->getFont()->setName(iconv('gbk', 'utf-8', ''));
|
||||
|
||||
$objPHPExcel->getDefaultStyle()->getFont()->setSize(11);
|
||||
|
||||
$styleArray = array(
|
||||
|
||||
'font' => array(
|
||||
|
||||
'bold' => true,
|
||||
|
||||
'color'=>array(
|
||||
|
||||
'argb' => 'ffffffff',
|
||||
|
||||
)
|
||||
|
||||
),
|
||||
|
||||
'borders' => array (
|
||||
|
||||
'outline' => array (
|
||||
|
||||
'style' => \PHPExcel_Style_Border::BORDER_THIN, //设置border样式
|
||||
|
||||
'color' => array ('argb' => 'FF000000'), //设置border颜色
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
//设置宽
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(12);
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(12);
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(12);
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(25);
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(12);
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(12);
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(12);
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth(20);
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('I')->setWidth(12);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A1:I1')->getFill()->setFillType(\PHPExcel_Style_Fill::FILL_SOLID);
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A1:I1')->getFill()->getStartColor()->setARGB('333399');
|
||||
|
||||
|
||||
|
||||
$objPHPExcel->getActiveSheet()->setCellValue('A1', '提现单号')
|
||||
|
||||
->setCellValue('B1', '会员类型')->setCellValue('C1', '会员名称')
|
||||
|
||||
->setCellValue('D1', '提现银行')->setCellValue('E1', '银行卡号')
|
||||
|
||||
->setCellValue('F1', '持卡人')->setCellValue('G1', '提现金额')
|
||||
|
||||
->setCellValue('H1', '提现时间')->setCellValue('I1', '状态');
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A1:I1')->applyFromArray($styleArray);
|
||||
|
||||
|
||||
|
||||
for ($row = 0; $row < count($page); $row++){
|
||||
|
||||
$i = $row+2;
|
||||
|
||||
$objPHPExcel->getActiveSheet()->setCellValue('A'.$i, $page[$row]['cashNo'])
|
||||
|
||||
->setCellValue('B'.$i, $page[$row]['userType'])->setCellValue('C'.$i, $page[$row]['userName'].'('.$page[$row]['loginName'].')' )
|
||||
|
||||
->setCellValue('D'.$i, $page[$row]['accTargetName'])->setCellValue('E'.$i, $page[$row]['accNo'])
|
||||
|
||||
->setCellValue('F'.$i, $page[$row]['accUser'])->setCellValue('G'.$i, '¥'.$page[$row]['money'])
|
||||
|
||||
->setCellValue('H'.$i, $page[$row]['createTime'])->setCellValue('I'.$i, $page[$row]['cashSatus']);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//输出EXCEL格式
|
||||
|
||||
$objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||
|
||||
// 从浏览器直接输出$filename
|
||||
|
||||
header('Content-Type:application/csv;charset=UTF-8');
|
||||
|
||||
header("Pragma: public");
|
||||
|
||||
header("Expires: 0");
|
||||
|
||||
header("Cache-Control:must-revalidate, post-check=0, pre-check=0");
|
||||
|
||||
header("Content-Type:application/force-download");
|
||||
|
||||
header("Content-Type:application/vnd.ms-excel;");
|
||||
|
||||
header("Content-Type:application/octet-stream");
|
||||
|
||||
header("Content-Type:application/download");
|
||||
|
||||
header('Content-Disposition: attachment;filename="'.$name.'.xls"');
|
||||
|
||||
header("Content-Transfer-Encoding:binary");
|
||||
|
||||
$objWriter->save('php://output');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
60
hyhproject/admin/model/ChargeItems.php
Executable file
60
hyhproject/admin/model/ChargeItems.php
Executable file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
namespace wstmart\admin\model;
|
||||
use think\Db;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 充值项业务处理
|
||||
*/
|
||||
class ChargeItems extends Base{
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$where = [];
|
||||
$where['dataFlag'] = 1;
|
||||
return $this->where($where)->field(true)->order('itemSort asc,id asc')->paginate(input('limit/d'));
|
||||
}
|
||||
public function getById($id){
|
||||
return $this->get(['id'=>$id,'dataFlag'=>1]);
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$data = input('post.');
|
||||
$data["createTime"] = date("Y-m-d H:i:s");
|
||||
WSTUnset($data,'positionId');
|
||||
$result = $this->validate('ChargeItems.add')->allowField(true)->save($data);
|
||||
if(false !== $result){
|
||||
return WSTReturn("新增成功", 1);
|
||||
}else{
|
||||
return WSTReturn($this->getError(),-1);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit(){
|
||||
$Id = (int)input('post.id');
|
||||
$result = $this->validate('ChargeItems.edit')->allowField(true)->save(input('post.'),['id'=>$Id]);
|
||||
if(false !== $result){
|
||||
return WSTReturn("编辑成功", 1);
|
||||
}else{
|
||||
return WSTReturn($this->getError(),-1);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
$id = (int)input('post.id/d');
|
||||
$result = $this->setField(['id'=>$id,'dataFlag'=>-1]);
|
||||
if(false !== $result){
|
||||
return WSTReturn("删除成功", 1);
|
||||
}else{
|
||||
return WSTReturn($this->getError(),-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
1368
hyhproject/admin/model/CronJobs.php
Executable file
1368
hyhproject/admin/model/CronJobs.php
Executable file
File diff suppressed because it is too large
Load Diff
166
hyhproject/admin/model/DataCats.php
Executable file
166
hyhproject/admin/model/DataCats.php
Executable file
@ -0,0 +1,166 @@
|
||||
<?php
|
||||
|
||||
namespace wstmart\admin\model;
|
||||
|
||||
/**
|
||||
|
||||
* ============================================================================
|
||||
|
||||
* 系统数据分类业务处理
|
||||
|
||||
*/
|
||||
|
||||
use think\Db;
|
||||
|
||||
class DataCats extends Base{
|
||||
|
||||
protected $insert = ['dataFlag'=>1];
|
||||
|
||||
/**
|
||||
|
||||
* 获取数据分类列表
|
||||
|
||||
*/
|
||||
|
||||
public function listQuery($catId = -1){
|
||||
|
||||
if($catId==-1)return ['id'=>0,'name'=>'系统数据','isParent'=>true,'open'=>true];
|
||||
|
||||
$rs = Db::name('data_cats')->where(['dataFlag'=>1])->field('catId id,catName name')->select();
|
||||
|
||||
return $rs;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* 获取数据分类
|
||||
|
||||
*/
|
||||
|
||||
public function getById($id){
|
||||
|
||||
return $this->get(['dataFlag'=>1,'catId'=>$id]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 新增数据分类
|
||||
|
||||
*/
|
||||
|
||||
public function add(){
|
||||
|
||||
// 验证数据代码
|
||||
|
||||
$catCode = input('catCode');
|
||||
|
||||
$hasCode = $this->where(['catCode'=>$catCode,'dataFlag'=>1])->find();
|
||||
|
||||
if(!empty($hasCode))return WSTReturn('数据分类代码已存在');
|
||||
|
||||
// 执行新增
|
||||
|
||||
$result = $this->validate('DataCats.add')->save(input('post.'));
|
||||
|
||||
if(false !== $result){
|
||||
|
||||
return WSTReturn("新增成功", 1);
|
||||
|
||||
}else{
|
||||
|
||||
return WSTReturn($this->getError(),-1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* 编辑数据分类
|
||||
|
||||
*/
|
||||
|
||||
public function edit(){
|
||||
|
||||
$id = input('post.catId/d');
|
||||
|
||||
|
||||
|
||||
// 验证数据代码
|
||||
|
||||
$catCode = input('catCode');
|
||||
|
||||
$hasCode = $this->where(['catCode'=>$catCode,'dataFlag'=>1,'catId'=>['<>',$id]])->find();
|
||||
|
||||
if(!empty($hasCode))return WSTReturn('数据分类代码已存在');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$result = $this->validate('DataCats.edit')->allowField(['catName','catCode'])->save(input('post.'),['catId'=>$id]);
|
||||
|
||||
if(false !== $result){
|
||||
|
||||
return WSTReturn("编辑成功", 1);
|
||||
|
||||
}else{
|
||||
|
||||
return WSTReturn($this->getError(),-1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* 删除数据分类
|
||||
|
||||
*/
|
||||
|
||||
public function del(){
|
||||
|
||||
$id = input('post.id/d');
|
||||
|
||||
$data = [];
|
||||
|
||||
$data['dataFlag'] = -1;
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
try{
|
||||
|
||||
$result = $this->update($data,['catId'=>$id]);// 删除该数据分类
|
||||
|
||||
if(false !== $result){
|
||||
|
||||
// 删除该数据分类下所有子数据
|
||||
|
||||
Db::name('datas')->where(['catId'=>$id])->setField('dataFlag',-1);
|
||||
|
||||
Db::commit();
|
||||
|
||||
return WSTReturn("删除成功", 1);
|
||||
|
||||
}
|
||||
|
||||
}catch(\Exception $e){
|
||||
|
||||
Db::rollback();errLog($e);
|
||||
|
||||
return WSTReturn("删除失败",-1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
79
hyhproject/admin/model/Datas.php
Executable file
79
hyhproject/admin/model/Datas.php
Executable file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
namespace wstmart\admin\model;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 经营范围业务处理
|
||||
*/
|
||||
use think\Db;
|
||||
class Datas extends Base{
|
||||
protected $insert = ['dataFlag'=>1];
|
||||
/**
|
||||
* 获取指定分类的列表
|
||||
*/
|
||||
public function listQuery($catId){
|
||||
return Db::name('datas')->where('catId',$catId)->field('dataName,dataVal')->select();
|
||||
}
|
||||
/**
|
||||
* 根据catId获取子数据
|
||||
*/
|
||||
public function childQuery(){
|
||||
$catId = (int)input('post.id');
|
||||
return $this->where(['dataFlag'=>1,'catId'=>$catId])->paginate(input('limit/d'));
|
||||
}
|
||||
/**
|
||||
* 获取菜单列表
|
||||
*/
|
||||
public function dataQuery($catId = -1){
|
||||
if($catId==-1)return ['id'=>0,'name'=>'系统数据','isParent'=>true,'open'=>true];
|
||||
$rs = Db::name('data_cats')->where(['dataFlag'=>1])->field('catId id,catName name')->select();
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 获取菜单
|
||||
*/
|
||||
public function getById($id){
|
||||
return $this->get(['dataFlag'=>1,'id'=>$id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增菜单
|
||||
*/
|
||||
public function add(){
|
||||
$result = $this->validate('Datas.add')->save(input('post.'));
|
||||
if(false !== $result){
|
||||
cache('WST_DATAS',null);
|
||||
return WSTReturn("新增成功", 1);
|
||||
}else{
|
||||
return WSTReturn($this->getError(),-1);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 编辑菜单
|
||||
*/
|
||||
public function edit(){
|
||||
$id = input('post.id/d');
|
||||
$result = $this->validate('Datas.edit')->allowField(['dataName','dataVal','dataSort'])->save(input('post.'),['id'=>$id]);
|
||||
if(false !== $result){
|
||||
cache('WST_DATAS',null);
|
||||
return WSTReturn("编辑成功", 1);
|
||||
}else{
|
||||
return WSTReturn($this->getError(),-1);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 删除菜单
|
||||
*/
|
||||
public function del(){
|
||||
$id = input('post.id/d');
|
||||
$data = [];
|
||||
$data['dataFlag'] = -1;
|
||||
$result = $this->update($data,['id'=>$id]);
|
||||
if(false !== $result){
|
||||
cache('WST_DATAS',null);
|
||||
return WSTReturn("删除成功", 1);
|
||||
}else{
|
||||
return WSTReturn($this->getError(),-1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
163
hyhproject/admin/model/EctDay.php
Executable file
163
hyhproject/admin/model/EctDay.php
Executable file
@ -0,0 +1,163 @@
|
||||
<?php
|
||||
namespace wstmart\admin\model;
|
||||
use think\Db;
|
||||
use think\Loader;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 提现分类业务处理
|
||||
*/
|
||||
class EctDay extends Base{
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$startDate = input('startDate');
|
||||
$endDate = input('endDate');
|
||||
$loginName = input('loginName');
|
||||
$where = [];
|
||||
if($loginName!='')$where['b.loginName'] = ['like','%'.$loginName.'%'];
|
||||
if($startDate && $endDate){
|
||||
$where['a.giveTime'] =['between',[strtotime($startDate.' 00:00:00'),strtotime($endDate.' 23:59:59')]];
|
||||
}elseif($startDate){
|
||||
$where['a.giveTime'] = [">=",strtotime($startDate)];
|
||||
}elseif($endDate){
|
||||
$where['a.giveTime'] = ["<=",strtotime($endDate)];
|
||||
}
|
||||
//mark by cheng 只显示超过一天的提现数据
|
||||
$page = Db::name('user_everyday_ect_log')->alias('a')
|
||||
->join('users b','b.userId=a.userId','left')
|
||||
->where($where)
|
||||
->order('a.giveTime desc')
|
||||
->field('a.ectNum,giveTime,b.loginName')
|
||||
->paginate(input('limit/d'))->toArray();
|
||||
return $page;
|
||||
}
|
||||
/**
|
||||
* 获取提现详情
|
||||
*/
|
||||
public function getById(){
|
||||
$id = (int)input('id');
|
||||
$rs = $this->get($id);
|
||||
$user = [];
|
||||
if($rs['targetType']==1){
|
||||
$user = Db::name('shops')->alias('s')
|
||||
->join('__USERS__ u','u.userId=s.userId')
|
||||
->where('shopId',$rs['targetId'])
|
||||
->field('s.shopId,u.loginName,s.shopName as userName')
|
||||
->find();
|
||||
|
||||
}else{
|
||||
$user = Db::name('users')->where('userId',$rs['targetId'])->field('userId,loginName,userName')->find();
|
||||
}
|
||||
$rs['userName'] = $user['userName'];
|
||||
$rs['loginName'] = $user['loginName'];
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 导出提现申请
|
||||
*/
|
||||
public function toExport(){
|
||||
$name='ECT提现管理表';
|
||||
$startDate = input('startDate');
|
||||
$endDate = input('endDate');
|
||||
$ectNo = input('ectNo');
|
||||
$where = [];
|
||||
if($ectNo!='')$where['ectNum'] = ['like','%'.$ectNo.'%'];
|
||||
if($startDate && $endDate){
|
||||
$where['a.giveTime'] =['between',[strtotime($startDate.' 00:00:00'),strtotime($endDate.' 23:59:59')]];
|
||||
}elseif($startDate){
|
||||
$where['a.giveTime'] = [">=",strtotime($startDate)];
|
||||
}elseif($endDate){
|
||||
$where['a.giveTime'] = ["<=",strtotime($endDate)];
|
||||
}
|
||||
//mark by cheng 只显示超过一天的提现数据
|
||||
$page = Db::name('user_ect_cash_log')->alias('a')
|
||||
->join('users b','b.userId=a.userId','left')
|
||||
->where($where)
|
||||
->order('a.giveTime desc')
|
||||
->field('a.giveTime,ectNum,b.loginName')
|
||||
->select();
|
||||
|
||||
Loader::import('phpexcel.PHPExcel.IOFactory');
|
||||
$objPHPExcel = new \PHPExcel();
|
||||
// 设置excel文档的属性
|
||||
$objPHPExcel->getProperties()->setCreator("WSTMart")//创建人
|
||||
->setLastModifiedBy("WSTMart")//最后修改人
|
||||
->setTitle($name)//标题
|
||||
->setSubject($name)//题目
|
||||
->setDescription($name)//描述
|
||||
->setKeywords("提现")//关键字
|
||||
->setCategory("Test result file");//种类
|
||||
|
||||
// 开始操作excel表
|
||||
$objPHPExcel->setActiveSheetIndex(0);
|
||||
// 设置工作薄名称
|
||||
$objPHPExcel->getActiveSheet()->setTitle(iconv('gbk', 'utf-8', 'Sheet'));
|
||||
// 设置默认字体和大小
|
||||
$objPHPExcel->getDefaultStyle()->getFont()->setName(iconv('gbk', 'utf-8', ''));
|
||||
$objPHPExcel->getDefaultStyle()->getFont()->setSize(11);
|
||||
$styleArray = array(
|
||||
'font' => array(
|
||||
'bold' => true,
|
||||
'color'=>array(
|
||||
'argb' => 'ffffffff',
|
||||
)
|
||||
),
|
||||
'borders' => array (
|
||||
'outline' => array (
|
||||
'style' => \PHPExcel_Style_Border::BORDER_THIN, //设置border样式
|
||||
'color' => array ('argb' => 'FF000000'), //设置border颜色
|
||||
)
|
||||
)
|
||||
);
|
||||
//设置宽
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(25);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(25);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(25);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(25);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(25);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(12);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(25);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth(20);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('I')->setWidth(12);
|
||||
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A1:I1')->getFill()->setFillType(\PHPExcel_Style_Fill::FILL_SOLID);
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A1:I1')->getFill()->getStartColor()->setARGB('333399');
|
||||
|
||||
$objPHPExcel->getActiveSheet()->setCellValue('A1', 'ECT交易ID')
|
||||
->setCellValue('B1', '会员名称')
|
||||
->setCellValue('C1', 'ECT发送方')
|
||||
->setCellValue('D1', 'ECT接收方')
|
||||
->setCellValue('E1', '备注')
|
||||
->setCellValue('F1', 'ECT提现数量')
|
||||
->setCellValue('G1', '创建时间');
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A1:I1')->applyFromArray($styleArray);
|
||||
|
||||
for ($row = 0; $row < count($page); $row++){
|
||||
$i = $row+2;
|
||||
$objPHPExcel->getActiveSheet()->setCellValue('A'.$i, $page[$row]['transactionId'])
|
||||
->setCellValue('B'.$i, $page[$row]['loginName'])
|
||||
->setCellValue('C'.$i, $page[$row]['fromAccount'])
|
||||
->setCellValue('D'.$i, $page[$row]['toAccount'])
|
||||
->setCellValue('E'.$i, $page[$row]['dataRemarks'])
|
||||
->setCellValue('F'.$i, $page[$row]['ectNum'])
|
||||
->setCellValue('G'.$i, $page[$row]['createTime']);
|
||||
}
|
||||
|
||||
//输出EXCEL格式
|
||||
$objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||
// 从浏览器直接输出$filename
|
||||
header('Content-Type:application/csv;charset=UTF-8');
|
||||
header("Pragma: public");
|
||||
header("Expires: 0");
|
||||
header("Cache-Control:must-revalidate, post-check=0, pre-check=0");
|
||||
header("Content-Type:application/force-download");
|
||||
header("Content-Type:application/vnd.ms-excel;");
|
||||
header("Content-Type:application/octet-stream");
|
||||
header("Content-Type:application/download");
|
||||
header('Content-Disposition: attachment;filename="'.$name.'.xls"');
|
||||
header("Content-Transfer-Encoding:binary");
|
||||
$objWriter->save('php://output');
|
||||
}
|
||||
}
|
71
hyhproject/admin/model/EctDeal.php
Executable file
71
hyhproject/admin/model/EctDeal.php
Executable file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
namespace wstmart\admin\model;
|
||||
use think\Db;
|
||||
use think\Loader;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 提现分类业务处理
|
||||
*/
|
||||
class EctDeal extends Base{
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$startDate = input('startDate');
|
||||
$endDate = input('endDate');
|
||||
$loginName = trim(input('loginName'));
|
||||
$where = [];
|
||||
|
||||
if($loginName!=''){
|
||||
$userInfo = getUserByName($loginName);
|
||||
if(!$userInfo) return [];
|
||||
$where['b.userId'] = $userInfo['userId'];
|
||||
}
|
||||
$sort = input('sort');
|
||||
$order = [];
|
||||
if($sort!=''){
|
||||
$sortArr = explode('.',$sort);
|
||||
$order = $sortArr[0].' '.$sortArr[1];
|
||||
if($sortArr[0]=='ectNo'){
|
||||
$order = $sortArr[0].'+0 '.$sortArr[1];
|
||||
}
|
||||
}else{
|
||||
$order = ('ectId DESC');
|
||||
}
|
||||
if($startDate!='' && $endDate!=''){
|
||||
$startDate=strtotime($startDate.' 00:00:00');
|
||||
$endDate=strtotime($endDate.' 23:59:59');
|
||||
$where['a.createTime'] = ['between',[$startDate,$endDate]];
|
||||
}else if($startDate!=''){
|
||||
$startDate=strtotime($startDate.' 00:00:00');
|
||||
$where['a.createTime'] = ['>=',$startDate];
|
||||
}else if($endDate!=''){
|
||||
$endDate=strtotime($endDate.' 23:59:59');
|
||||
$where['a.createTime'] = ['<=',$endDate];
|
||||
}
|
||||
$page = Db::name('user_ect_log')->alias('a')->join('users b','b.userId=a.userId','inner')
|
||||
->where($where)
|
||||
->order($order)
|
||||
->field('a.ectId,dataSrc,dataRemarks,a.createTime,ectNum,b.loginName,a.userId')
|
||||
->paginate(input('limit/d'))->toArray();
|
||||
if($loginName!=''){
|
||||
foreach ($page['Rows'] as $key => $value) {
|
||||
$page['Rows'][$key]['sumEct']=db('user_ect_log')->where(['userId'=>$value['userId'],'dataSrc'=>12])->sum('ectNum');
|
||||
$page['Rows'][$key]['sumCashEct']=db('user_ect_cash_log')->where(['userId'=>$value['userId'],'status'=>1])->sum('ectNum');
|
||||
$page['Rows'][$key]['sumCashChong']=db('user_ect_log')->where(['userId'=>$value['userId'],'dataSrc'=>14])->sum('ectNum');
|
||||
}
|
||||
}
|
||||
if(count($page['Rows'])>0){
|
||||
$userIds = [];
|
||||
$shopIds = [];
|
||||
$userMap = [];
|
||||
if(count($userIds)>0){
|
||||
$user = Db::name('users')->where(['userId'=>['in',$userIds]])->field('userId,loginName,userName')->select();
|
||||
foreach ($user as $key => $v) {
|
||||
$userMap["0_".$v['userId']] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $page;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user