diff --git a/app/admin/controller/agent/AgentManage.php b/app/admin/controller/agent/AgentManage.php
index 7e5e05de..d506d170 100644
--- a/app/admin/controller/agent/AgentManage.php
+++ b/app/admin/controller/agent/AgentManage.php
@@ -26,7 +26,7 @@ class AgentManage extends AuthController
*/
public function index()
{
- $this->assign( 'year',getMonth('y'));
+ $this->assign( 'year',getMonth());
$this->assign('store_brokerage_statu',\crmeb\services\SystemConfigService::get('store_brokerage_statu'));
return $this->fetch();
}
@@ -64,7 +64,7 @@ class AgentManage extends AuthController
public function stair($uid = ''){
if($uid == '') return $this->failed('参数错误');
$this->assign('uid',$uid ? : 0);
- $this->assign( 'year',getMonth('y'));
+ $this->assign( 'year',getMonth());
return $this->fetch();
}
/*
@@ -75,7 +75,7 @@ class AgentManage extends AuthController
{
if($uid == '') return $this->failed('参数错误');
$this->assign('uid',$uid ? : 0);
- $this->assign( 'year',getMonth('y'));
+ $this->assign( 'year',getMonth());
return $this->fetch();
}
diff --git a/app/admin/controller/finance/UserRecharge.php b/app/admin/controller/finance/UserRecharge.php
index bfaf24a3..50b27ca1 100644
--- a/app/admin/controller/finance/UserRecharge.php
+++ b/app/admin/controller/finance/UserRecharge.php
@@ -26,7 +26,7 @@ class UserRecharge extends AuthController
* 显示操作记录
*/
public function index(){
- $this->assign( 'year',getMonth('y'));
+ $this->assign( 'year',getMonth());
return $this->fetch();
}
diff --git a/app/admin/controller/order/StoreOrder.php b/app/admin/controller/order/StoreOrder.php
index 236f4b6d..76d49946 100644
--- a/app/admin/controller/order/StoreOrder.php
+++ b/app/admin/controller/order/StoreOrder.php
@@ -11,6 +11,7 @@ use app\admin\model\system\Express;
use crmeb\repositories\OrderRepository;
use crmeb\services\ExpressService;
use crmeb\services\MiniProgramService;
+use crmeb\services\UtilService;
use crmeb\services\WechatService;
use crmeb\services\FormBuilder as Form;
use crmeb\services\HookService;
@@ -40,7 +41,7 @@ class StoreOrder extends AuthController
public function index()
{
$this->assign([
- 'year'=>getMonth('y'),
+ 'year'=>getMonth(),
'real_name'=>$this->request->get('real_name',''),
'status'=>$this->request->param('status',''),
'orderCount'=>StoreOrderModel::orderCount(),
@@ -205,8 +206,9 @@ class StoreOrder extends AuthController
/*
* 删除订单
* */
- public function del_order($ids=[])
+ public function del_order()
{
+ $ids = UtilService::postMore(['ids'])['ids'];
if(!count($ids)) return JsonService::fail('请选择需要删除的订单');
if(StoreOrderModel::where('is_del',0)->where('id','in',$ids)->count()) return JsonService::fail('您选择的的订单存在用户未删除的订单,无法删除用户未删除的订单');
$res=StoreOrderModel::where('id','in',$ids)->update(['is_system_del'=>1]);
@@ -261,7 +263,6 @@ class StoreOrder extends AuthController
StoreOrderModel::edit($data,$id);
event('StoreProductOrderDeliveryAfter',[$data,$id]);
StoreOrderStatus::setStatus($id,'delivery_fictitious','已虚拟发货');
- StoreOrderStatus::setStatus($id,'take_delivery','虚拟物品已收货');
break;
default:
return Json::fail('暂时不支持其他发货类型');
@@ -497,7 +498,7 @@ class StoreOrder extends AuthController
if($order['delivery_type'] != 'express' || !$order['delivery_id']) return $this->failed('该订单不存在快递单号!');
$cacheName = $order['order_id'].$order['delivery_id'];
$result = CacheService::get($cacheName,null);
- if($result === null || 1==1){
+ if($result === null){
$result = ExpressService::query($order['delivery_id']);
if(is_array($result) &&
isset($result['result']) &&
diff --git a/app/admin/controller/record/Record.php b/app/admin/controller/record/Record.php
index af51b33d..366fa4f1 100644
--- a/app/admin/controller/record/Record.php
+++ b/app/admin/controller/record/Record.php
@@ -41,7 +41,7 @@ class Record extends AuthController
public function chart_order(){
$this->assign([
'is_layui'=>true,
- 'year'=>getMonth('y')
+ 'year'=>getMonth()
]);
return $this->fetch();
}
@@ -59,7 +59,7 @@ class Record extends AuthController
public function chart_product(){
$this->assign([
'is_layui'=>true,
- 'year'=>getMonth('y')
+ 'year'=>getMonth()
]);
return $this->fetch();
}
@@ -129,7 +129,7 @@ class Record extends AuthController
public function chart_score(){
$this->assign([
'is_layui'=>true,
- 'year'=>getMonth('y')
+ 'year'=>getMonth()
]);
return $this->fetch();
}
@@ -151,7 +151,7 @@ class Record extends AuthController
public function chart_coupon(){
$this->assign([
'is_layui'=>true,
- 'year'=>getMonth('y')
+ 'year'=>getMonth()
]);
return $this->fetch();
}
@@ -173,7 +173,7 @@ class Record extends AuthController
public function chart_combination(){
$this->assign([
'is_layui'=>true,
- 'year'=>getMonth('y')
+ 'year'=>getMonth()
]);
return $this->fetch();
}
@@ -183,7 +183,7 @@ class Record extends AuthController
public function chart_bargain(){
$this->assign([
'is_layui'=>true,
- 'year'=>getMonth('y')
+ 'year'=>getMonth()
]);
return $this->fetch();
}
@@ -193,7 +193,7 @@ class Record extends AuthController
public function chart_seckill(){
$this->assign([
'is_layui'=>true,
- 'year'=>getMonth('y')
+ 'year'=>getMonth()
]);
return $this->fetch();
}
@@ -204,7 +204,7 @@ class Record extends AuthController
public function chart_rebate(){
$this->assign([
'is_layui'=>true,
- 'year'=>getMonth('y')
+ 'year'=>getMonth()
]);
return $this->fetch();
}
@@ -230,7 +230,7 @@ class Record extends AuthController
public function chart_recharge(){
$this->assign([
'is_layui'=>true,
- 'year'=>getMonth('y')
+ 'year'=>getMonth()
]);
return $this->fetch();
}
@@ -246,7 +246,7 @@ class Record extends AuthController
public function chart_cash(){
$this->assign([
'is_layui'=>true,
- 'year'=>getMonth('y')
+ 'year'=>getMonth()
]);
return $this->fetch();
}
@@ -261,7 +261,7 @@ class Record extends AuthController
public function user_chart(){
$this->assign([
'is_layui'=>true,
- 'year'=>getMonth('y')
+ 'year'=>getMonth()
]);
return $this->fetch();
}
@@ -297,7 +297,7 @@ class Record extends AuthController
$this->assign([
'is_layui'=>true,
'limit'=>$limit,
- 'year'=>getMonth('y'),
+ 'year'=>getMonth(),
'commissionList'=>$top10list['commission'],
'extractList'=>$top10list['extract'],
]);
@@ -328,7 +328,7 @@ class Record extends AuthController
$this->assign([
'is_layui'=>true,
'limit'=>$limit,
- 'year'=>getMonth('y'),
+ 'year'=>getMonth(),
'integralList'=>$top10list['integral'],
'moneyList'=>$top10list['now_money'],
'shopcountList'=>$top10list['shopcount'],
@@ -365,7 +365,7 @@ class Record extends AuthController
public function user_attr(){
$this->assign([
'is_layui'=>true,
- 'year'=>getMonth('y')
+ 'year'=>getMonth()
]);
return $this->fetch();
}
@@ -405,7 +405,7 @@ class Record extends AuthController
if(!StoreProduct::be(['id'=>$id])) return $this->failed('商品不存在!');
$this->assign([
'is_layui'=>true,
- 'year'=>getMonth('y'),
+ 'year'=>getMonth(),
'id'=>$id,
]);
return $this->fetch();
@@ -444,7 +444,7 @@ class Record extends AuthController
public function ranking_commission(){
$this->assign([
'is_layui'=>true,
- 'year'=>getMonth('y')
+ 'year'=>getMonth()
]);
return $this->fetch();
}
@@ -477,7 +477,7 @@ class Record extends AuthController
public function ranking_point(){
$this->assign([
'is_layui'=>true,
- 'year'=>getMonth('y')
+ 'year'=>getMonth()
]);
return $this->fetch();
}
diff --git a/app/admin/controller/setting/SystemAdmin.php b/app/admin/controller/setting/SystemAdmin.php
index 963c18e8..b1517ac9 100644
--- a/app/admin/controller/setting/SystemAdmin.php
+++ b/app/admin/controller/setting/SystemAdmin.php
@@ -87,8 +87,10 @@ class SystemAdmin extends AuthController
if($data['pwd'] != $data['conf_pwd']) return Json::fail('两次输入密码不想同');
if(AdminModel::be($data['account'],'account')) return Json::fail('管理员账号已存在');
$data['pwd'] = md5($data['pwd']);
+ $data['add_time'] = time();
unset($data['conf_pwd']);
$data['level'] = $this->adminInfo['level'] + 1;
+ $data['add_time'] =time();
if(!AdminModel::create($data)) return Json::fail('添加管理员失败');
return Json::successful('添加管理员成功!');
}
diff --git a/app/admin/controller/setting/SystemConfig.php b/app/admin/controller/setting/SystemConfig.php
index 6d85fed6..475e8c9b 100644
--- a/app/admin/controller/setting/SystemConfig.php
+++ b/app/admin/controller/setting/SystemConfig.php
@@ -83,11 +83,11 @@ class SystemConfig extends AuthController
switch ($data['upload_type']){
case 1:
$data['value'] = json_decode($data['value'],true)?:'';
- $formbuider[] = Form::frameImageOne($data['menu_name'],$data['info'],Url::buildUrl('admin/widget.images/index',array('fodder'=>$data['menu_name'])),$data['value'])->icon('image')->width('100%')->height('500px')->info($data['desc'])->col(13);
+ $formbuider[] = Form::frameImageOne($data['menu_name'],$data['info'],Url::buildUrl('admin/widget.images/index',array('fodder'=>$data['menu_name'])),$data['value'])->icon('image')->width('70%')->height('500px')->info($data['desc'])->col(13);
break;
case 2:
$data['value'] = json_decode($data['value'],true)?:[];
- $formbuider[] = Form::frameImages($data['menu_name'],$data['info'],Url::buildUrl('admin/widget.images/index',array('fodder'=>$data['menu_name'])),$data['value'])->maxLength(5)->icon('image')->width('100%')->height('500px')->info($data['desc'])->col(13);
+ $formbuider[] = Form::frameImages($data['menu_name'],$data['info'],Url::buildUrl('admin/widget.images/index',array('fodder'=>$data['menu_name'])),$data['value'])->maxLength(5)->icon('image')->width('70%')->height('500px')->info($data['desc'])->col(13);
break;
case 3:
$data['value'] = json_decode($data['value'],true);
diff --git a/app/admin/controller/sms/SmsAdmin.php b/app/admin/controller/sms/SmsAdmin.php
index d566ca1d..4cd178e6 100644
--- a/app/admin/controller/sms/SmsAdmin.php
+++ b/app/admin/controller/sms/SmsAdmin.php
@@ -1,8 +1,10 @@
assign('url', SMSService::code());
return $this->fetch();
}
+ public function captcha()
+ {
+ if (!request()->isPost()) return JsonService::fail('发生失败');
+ $phone = request()->param('phone');
+ if (!trim($phone)) return JsonService::fail('请填写手机号');
+
+ $res = json_decode(HttpService::getRequest(SMSService::code(), compact('phone')), true);
+ if (!isset($res['status']) && $res['status'] !== 200)
+ return JsonService::fail(isset($res['data']['message']) ? $res['data']['message'] : $res['msg']);
+ return JsonService::success(isset($res['data']['message']) ? $res['data']['message'] : $res['msg']);
+ }
+
/**
* 修改/注册短信平台账号
*/
- public function save(){
+ public function save()
+ {
list($account, $password, $phone, $code, $url, $sign) = UtilService::postMore([
['account', ''],
['password', ''],
@@ -34,17 +48,17 @@ class SmsAdmin extends AuthController
['code', ''],
['url', ''],
['sign', ''],
- ], null ,true);
- $signLen = strlen(trim($sign));
- if(!strlen(trim($account))) return JsonService::fail('请填写账号');
- if(!strlen(trim($password))) return JsonService::fail('请填写密码');
- if(!$signLen) return JsonService::fail('请填写短信签名');
- if($signLen > 8) return JsonService::fail('短信签名最长为8');
- if(!strlen(trim($code))) return JsonService::fail('请填写验证码');
- if(!strlen(trim($url))) return JsonService::fail('请填写域名');
+ ], null, true);
+ $signLen = mb_strlen(trim($sign));
+ if (!strlen(trim($account))) return JsonService::fail('请填写账号');
+ if (!strlen(trim($password))) return JsonService::fail('请填写密码');
+ if (!$signLen) return JsonService::fail('请填写短信签名');
+ if ($signLen > 8) return JsonService::fail('短信签名最长为8位');
+ if (!strlen(trim($code))) return JsonService::fail('请填写验证码');
+ if (!strlen(trim($url))) return JsonService::fail('请填写域名');
$status = SMSService::register($account, md5(trim($password)), $url, $phone, $code, $sign);
- if($status['status'] == 400) return JsonService::fail('短信平台:'.$status['msg']);
+ if ($status['status'] == 400) return JsonService::fail('短信平台:' . $status['msg']);
SystemConfig::setConfigSmsInfo($account, $password);
- return JsonService::success('短信平台:'.$status['msg']);
+ return JsonService::success('短信平台:' . $status['msg']);
}
}
\ No newline at end of file
diff --git a/app/admin/controller/system/SystemFile.php b/app/admin/controller/system/SystemFile.php
index 882d54dc..b91ba0bd 100644
--- a/app/admin/controller/system/SystemFile.php
+++ b/app/admin/controller/system/SystemFile.php
@@ -1,4 +1,5 @@
[],'file'=>[]);
- $request_dir = str_replace('../', '', app('request')->param('dir'));
-
- if(app('request')->param('superior') && !empty($request_dir)){
- $path = '..'.DS.app('request')->param('dir');
- $path = dirname($path);
- }else{
- $path = !empty($request_dir) ? $request_dir : '..';
- $path = $path.DS.app('request')->param('filedir');
+ public function opendir($filedir = '')
+ {
+ $fileAll = array('dir' => [], 'file' => []);
+ //根目录
+ $rootdir = app()->getRootPath();
+ //当前目录
+ $request_dir = app('request')->param('dir');
+ //防止查看站点以外的目录
+ if(strpos($request_dir,$rootdir) === false){
+ $request_dir = $rootdir;
}
- $list = scandir($path);
- foreach($list as $key=>$v) {
- if($v !='.' && $v !='..'){
- if (is_dir($path.'/'.$v)) {
- $fileAll['dir'][] = FileClass::list_info($path.'/'.$v);
+ //判断是否是返回上级
+ if (app('request')->param('superior') && !empty($request_dir)) {
+ if(strpos(dirname($request_dir),$rootdir) !== false){
+ $dir = dirname($request_dir);
+ }else{
+ $dir = $rootdir;
+ }
+
+ } else {
+ $dir = !empty($request_dir) ? $request_dir : $rootdir;
+ $dir = rtrim($dir,DS) .DS. app('request')->param('filedir');
+ }
+ $list = scandir($dir);
+ foreach ($list as $key => $v) {
+ if ($v != '.' && $v != '..') {
+ if (is_dir($dir . DS . $v)) {
+ $fileAll['dir'][] = FileClass::list_info($dir .DS. $v);
}
- if(is_file($path.'/'.$v)){
- $fileAll['file'][] = FileClass::list_info($path.'/'.$v);
+ if (is_file($dir . DS . $v)) {
+ $fileAll['file'][] = FileClass::list_info($dir .DS. $v);
}
}
}
-// var_dump($fileAll['file']);
+ //var_dump($fileAll['dir']);
//兼容windows
$uname = php_uname('s');
- if(strstr($uname,'Windows')!==false) $path = ltrim($path,'\\');
- $dir = ltrim($path,'./');
- $this->assign(compact('fileAll','dir'));
+ if (strstr($uname, 'Windows') !== false) $dir = ltrim($dir, '\\');
+ $this->assign(compact('fileAll', 'dir'));
return $this->fetch();
}
+
//读取文件
- public function openfile($file='')
+ public function openfile($file = '')
{
$file = $this->request->param('file');
- if(empty($file))return Json::fail('出现错误');
- $filepath = '.'.$file;
+ if (empty($file)) return Json::fail('出现错误');
+ $filepath = $file;
$content = FileClass::read_file($filepath);//防止页面内嵌textarea标签
$ext = FileClass::get_ext($filepath);
$extarray = [
- 'js'=>'text/javascript'
- ,'php'=>'text/x-php'
- ,'html'=>'text/html'
- ,'sql'=>'text/x-mysql'
- ,'css'=>'text/x-scss'];
- $mode = empty($extarray[$ext])?'':$extarray[$ext];
- $this->assign(compact('content','mode','filepath'));
+ 'js' => 'text/javascript'
+ , 'php' => 'text/x-php'
+ , 'html' => 'text/html'
+ , 'sql' => 'text/x-mysql'
+ , 'css' => 'text/x-scss'];
+ $mode = empty($extarray[$ext]) ? '' : $extarray[$ext];
+ $this->assign(compact('content', 'mode', 'filepath'));
return $this->fetch();
}
+
//保存文件
- public function savefile(){
+ public function savefile()
+ {
$comment = $this->request->post('comment');
$filepath = $this->request->post('filepath');
- if(!empty($comment) && !empty($filepath)){
+ if (!empty($comment) && !empty($filepath)) {
//兼容windows
$uname = php_uname('s');
- if(strstr($uname,'Windows')!==false)
- $filepath = ltrim(str_replace('/', DS, $filepath),'.');
- if(FileClass::isWritable($filepath)){
- $res = FileClass::write_file($filepath,$comment);
- if($res){
+ if (strstr($uname, 'Windows') !== false)
+ $filepath = ltrim(str_replace('/', DS, $filepath), '.');
+ if (FileClass::isWritable($filepath)) {
+ $res = FileClass::write_file($filepath, $comment);
+ if ($res) {
return Json::successful('保存成功!');
- }else{
+ } else {
return Json::fail('保存失败');
}
- }else{
+ } else {
return Json::fail('没有权限!');
}
- }else{
+ } else {
return Json::fail('出现错误');
}
}
- public function index(){
- $app = $this->getDir('./application');
- $extend = $this->getDir('./extend');
- $public = $this->getDir('./public');
- $arr = array();
- $arr = array_merge($app,$extend);
- $arr = array_merge($arr,$public);
- $fileAll = array();//本地文件
- $cha = array();//不同的文件
- foreach ($arr as $k=>$v) {
- $fp = fopen($v, 'r');
- if (filesize($v)) $ct = fread($fp, filesize($v));
- else $ct = null;
- fclose($fp);
- $cthash = md5($ct);
- $update_time = stat($v);
- $fileAll[$k]['cthash'] = $cthash;
- $fileAll[$k]['filename'] = $v;
- $fileAll[$k]['atime'] = $update_time['atime'];
- $fileAll[$k]['mtime'] = $update_time['mtime'];
- $fileAll[$k]['ctime'] = $update_time['ctime'];
- }
- $file = SystemFileModel::all(function($query){
- $query->order('atime', 'desc');
- })->toArray();//数据库中的文件
- if(empty($file)){
- $data_num = array_chunk($fileAll,10);
- SystemFileModel::beginTrans();
- $res = true;
- foreach ($data_num as $k=>$v){
- $res = $res && SystemFileModel::insertAll($v);
- }
- SystemFileModel::checkTrans($res);
- if($res){
- $cha = array();//不同的文件
- }else{
- $cha = $fileAll;
- }
- }else{
- $cha = array();//差异文件
- foreach ($file as $k=>$v){
- foreach ($fileAll as $ko=>$vo){
- if($v['filename'] == $vo['filename']){
- if($v['cthash'] != $vo['cthash']){
- $cha[$k]['filename'] = $v['filename'];
- $cha[$k]['cthash'] = $v['cthash'];
- $cha[$k]['atime'] = $v['atime'];
- $cha[$k]['mtime'] = $v['mtime'];
- $cha[$k]['ctime'] = $v['ctime'];
- $cha[$k]['type'] = '已修改';
- }
- unset($fileAll[$ko]);
- unset($file[$k]);
- }
- }
- }
- foreach ($file as $k=>$v){
- $cha[$k]['filename'] = $v['filename'];
- $cha[$k]['cthash'] = $v['cthash'];
- $cha[$k]['atime'] = $v['atime'];
- $cha[$k]['mtime'] = $v['mtime'];
- $cha[$k]['ctime'] = $v['ctime'];
- $cha[$k]['type'] = '已删除';
- }
- foreach ($fileAll as $k=>$v){
- $cha[$k]['filename'] = $v['filename'];
- $cha[$k]['cthash'] = $v['cthash'];
- $cha[$k]['atime'] = $v['atime'];
- $cha[$k]['mtime'] = $v['mtime'];
- $cha[$k]['ctime'] = $v['ctime'];
- $cha[$k]['type'] = '新增的';
- }
+ public function index()
+ {
+ $app = $this->getDir('./application');
+ $extend = $this->getDir('./extend');
+ $public = $this->getDir('./public');
+ $arr = array();
+ $arr = array_merge($app, $extend);
+ $arr = array_merge($arr, $public);
+ $fileAll = array();//本地文件
+ $cha = array();//不同的文件
+ foreach ($arr as $k => $v) {
+ $fp = fopen($v, 'r');
+ if (filesize($v)) $ct = fread($fp, filesize($v));
+ else $ct = null;
+ fclose($fp);
+ $cthash = md5($ct);
+ $update_time = stat($v);
+ $fileAll[$k]['cthash'] = $cthash;
+ $fileAll[$k]['filename'] = $v;
+ $fileAll[$k]['atime'] = $update_time['atime'];
+ $fileAll[$k]['mtime'] = $update_time['mtime'];
+ $fileAll[$k]['ctime'] = $update_time['ctime'];
+ }
+ $file = SystemFileModel::all(function ($query) {
+ $query->order('atime', 'desc');
+ })->toArray();//数据库中的文件
+ if (empty($file)) {
+ $data_num = array_chunk($fileAll, 10);
+ SystemFileModel::beginTrans();
+ $res = true;
+ foreach ($data_num as $k => $v) {
+ $res = $res && SystemFileModel::insertAll($v);
+ }
+ SystemFileModel::checkTrans($res);
+ if ($res) {
+ $cha = array();//不同的文件
+ } else {
+ $cha = $fileAll;
+ }
+ } else {
+ $cha = array();//差异文件
+ foreach ($file as $k => $v) {
+ foreach ($fileAll as $ko => $vo) {
+ if ($v['filename'] == $vo['filename']) {
+ if ($v['cthash'] != $vo['cthash']) {
+ $cha[$k]['filename'] = $v['filename'];
+ $cha[$k]['cthash'] = $v['cthash'];
+ $cha[$k]['atime'] = $v['atime'];
+ $cha[$k]['mtime'] = $v['mtime'];
+ $cha[$k]['ctime'] = $v['ctime'];
+ $cha[$k]['type'] = '已修改';
+ }
+ unset($fileAll[$ko]);
+ unset($file[$k]);
+ }
+ }
- }
+ }
+ foreach ($file as $k => $v) {
+ $cha[$k]['filename'] = $v['filename'];
+ $cha[$k]['cthash'] = $v['cthash'];
+ $cha[$k]['atime'] = $v['atime'];
+ $cha[$k]['mtime'] = $v['mtime'];
+ $cha[$k]['ctime'] = $v['ctime'];
+ $cha[$k]['type'] = '已删除';
+ }
+ foreach ($fileAll as $k => $v) {
+ $cha[$k]['filename'] = $v['filename'];
+ $cha[$k]['cthash'] = $v['cthash'];
+ $cha[$k]['atime'] = $v['atime'];
+ $cha[$k]['mtime'] = $v['mtime'];
+ $cha[$k]['ctime'] = $v['ctime'];
+ $cha[$k]['type'] = '新增的';
+ }
+
+ }
// dump($file);
// dump($fileAll);
- $this->assign('cha',$cha);
- return $this->fetch();
- }
+ $this->assign('cha', $cha);
+ return $this->fetch();
+ }
/**
@@ -176,41 +193,44 @@ class SystemFile extends AuthController
* @param $dir
* @return array
*/
- public function getNextDir(){
+ public function getNextDir()
+ {
$dir = './';
$list = scandir($dir);
$dirlist = array();
$filelist = array();
- foreach($list as $key=>$v) {
- if($v !='.' && $v !='..'){
- if (is_dir($dir.'/'.$v)) {
+ foreach ($list as $key => $v) {
+ if ($v != '.' && $v != '..') {
+ if (is_dir($dir . '/' . $v)) {
$dirlist['dir'][$key] = $v;
}
- if(is_file($dir.'/'.$v)){
+ if (is_file($dir . '/' . $v)) {
$filelist['file'][$key] = $v;
}
}
}
- $filesarr = array_merge($dirlist,$filelist);
+ $filesarr = array_merge($dirlist, $filelist);
print_r($filesarr);
}
+
/**
* 获取文件夹中的文件 包括子文件 不能直接用 直接使用 $this->getDir()方法 P156
* @param $path
* @param $data
*/
- public function searchDir($path,&$data){
- if(is_dir($path) && !strpos($path,'uploads')){
- $dp=dir($path);
- while($file=$dp->read()){
- if($file!='.'&& $file!='..'){
- $this->searchDir($path.'/'.$file,$data);
+ public function searchDir($path, &$data)
+ {
+ if (is_dir($path) && !strpos($path, 'uploads')) {
+ $dp = dir($path);
+ while ($file = $dp->read()) {
+ if ($file != '.' && $file != '..') {
+ $this->searchDir($path . '/' . $file, $data);
}
}
$dp->close();
}
- if(is_file($path)){
- $data[]=$path;
+ if (is_file($path)) {
+ $data[] = $path;
}
}
@@ -219,57 +239,59 @@ class SystemFile extends AuthController
* @param $dir
* @return array
*/
- public function getDir($dir){
- $data=array();
- $this->searchDir($dir,$data);
+ public function getDir($dir)
+ {
+ $data = array();
+ $this->searchDir($dir, $data);
return $data;
}
//测试
- public function ceshi(){
+ public function ceshi()
+ {
//创建form
- $form = Form::create('/save.php',[
- Form::input('goods_name','商品名称')
- ,Form::input('goods_name1','password')->type('password')
- ,Form::input('goods_name2','textarea')->type('textarea')
- ,Form::input('goods_name3','email')->type('email')
- ,Form::input('goods_name4','date')->type('date')
- ,Form::city('address','cityArea',
- '陕西省','西安市'
+ $form = Form::create('/save.php', [
+ Form::input('goods_name', '商品名称')
+ , Form::input('goods_name1', 'password')->type('password')
+ , Form::input('goods_name2', 'textarea')->type('textarea')
+ , Form::input('goods_name3', 'email')->type('email')
+ , Form::input('goods_name4', 'date')->type('date')
+ , Form::city('address', 'cityArea',
+ '陕西省', '西安市'
)
- ,Form::dateRange('limit_time','dateRange',
+ , Form::dateRange('limit_time', 'dateRange',
strtotime('- 10 day'),
time()
)
- ,Form::dateTime('add_time','dateTime')
- ,Form::color('color','color','#ff0000')
- ,Form::checkbox('checkbox','checkbox',[1])->options([['value'=>1,'label'=>'白色'],['value'=>2,'label'=>'红色'],['value'=>31,'label'=>'黑色']])
- ,Form::date('riqi','date','2018-03-1')
- ,Form::dateTimeRange('dateTimeRange','区间时间段')
- ,Form::year('year','year')
- ,Form::month('month','month')
- ,Form::frame('frame','frame','/admin/system.system_attachment/index.html?fodder=frame')
- ,Form::frameInputs('frameInputs','frameInputs','/admin/system.system_attachment/index.html?fodder=frameInputs')
- ,Form::frameFiles('month1','frameFiles','/admin/system.system_attachment/index.html?fodder=month1')
- ,Form::frameImages('fodder1','frameImages','/admin/system.system_attachment/index.html?fodder=fodder1')->maxLength(3)->width('800px')->height('400px')
- ,Form::frameImages('fodder11','frameImages','/admin/system.system_attachment/index.html?fodder=fodder11')->icon('images')
- ,Form::frameInputOne('month3','frameInputOne','/admin/system.system_attachment/index.html?fodder=month3')->icon('ionic')
- ,Form::frameFileOne('month4','frameFileOne','/admin/system.system_attachment/index.html?fodder=month4')
- ,Form::frameImageOne('month5','frameImageOne','/admin/system.system_attachment/index.html?fodder=month5')->icon('image')
- ,Form::hidden('month6','hidden')
- ,Form::number('month7','number')
+ , Form::dateTime('add_time', 'dateTime')
+ , Form::color('color', 'color', '#ff0000')
+ , Form::checkbox('checkbox', 'checkbox', [1])->options([['value' => 1, 'label' => '白色'], ['value' => 2, 'label' => '红色'], ['value' => 31, 'label' => '黑色']])
+ , Form::date('riqi', 'date', '2018-03-1')
+ , Form::dateTimeRange('dateTimeRange', '区间时间段')
+ , Form::year('year', 'year')
+ , Form::month('month', 'month')
+ , Form::frame('frame', 'frame', '/admin/system.system_attachment/index.html?fodder=frame')
+ , Form::frameInputs('frameInputs', 'frameInputs', '/admin/system.system_attachment/index.html?fodder=frameInputs')
+ , Form::frameFiles('month1', 'frameFiles', '/admin/system.system_attachment/index.html?fodder=month1')
+ , Form::frameImages('fodder1', 'frameImages', '/admin/system.system_attachment/index.html?fodder=fodder1')->maxLength(3)->width('800px')->height('400px')
+ , Form::frameImages('fodder11', 'frameImages', '/admin/system.system_attachment/index.html?fodder=fodder11')->icon('images')
+ , Form::frameInputOne('month3', 'frameInputOne', '/admin/system.system_attachment/index.html?fodder=month3')->icon('ionic')
+ , Form::frameFileOne('month4', 'frameFileOne', '/admin/system.system_attachment/index.html?fodder=month4')
+ , Form::frameImageOne('month5', 'frameImageOne', '/admin/system.system_attachment/index.html?fodder=month5')->icon('image')
+ , Form::hidden('month6', 'hidden')
+ , Form::number('month7', 'number')
// ,Form::input input输入框,其他type: text类型Form::text,password类型Form::password,textarea类型Form::textarea,url类型Form::url,email类型Form::email,date类型Form::idate
- ,Form::radio('month8','radio')->options([['value'=>1,'label'=>'白色'],['value'=>2,'label'=>'红色'],['value'=>31,'label'=>'黑色']])
- ,Form::rate('month9','rate')
- ,Form::select('month10','select')->options([['value'=>1,'label'=>'白色'],['value'=>2,'label'=>'红色'],['value'=>31,'label'=>'黑色']])
- ,Form::selectMultiple('month11','selectMultiple')
- ,Form::selectOne('month12','selectOne')
- ,Form::slider('month13','slider',2)
- ,Form::sliderRange('month23','sliderRange',2,13)
- ,Form::switches('month14','区间时间段')
- ,Form::timePicker('month15','区间时间段')
- ,Form::time('month16','区间时间段')
- ,Form::timeRange('month17','区间时间段')
+ , Form::radio('month8', 'radio')->options([['value' => 1, 'label' => '白色'], ['value' => 2, 'label' => '红色'], ['value' => 31, 'label' => '黑色']])
+ , Form::rate('month9', 'rate')
+ , Form::select('month10', 'select')->options([['value' => 1, 'label' => '白色'], ['value' => 2, 'label' => '红色'], ['value' => 31, 'label' => '黑色']])
+ , Form::selectMultiple('month11', 'selectMultiple')
+ , Form::selectOne('month12', 'selectOne')
+ , Form::slider('month13', 'slider', 2)
+ , Form::sliderRange('month23', 'sliderRange', 2, 13)
+ , Form::switches('month14', '区间时间段')
+ , Form::timePicker('month15', '区间时间段')
+ , Form::time('month16', '区间时间段')
+ , Form::timeRange('month17', '区间时间段')
// ,Form::upload('month','区间时间段')
// ,Form::uploadImages('month','区间时间段')
// ,Form::uploadFiles('month','区间时间段')
diff --git a/app/admin/controller/ump/StoreSeckill.php b/app/admin/controller/ump/StoreSeckill.php
index bd1072d0..3e9d26d5 100644
--- a/app/admin/controller/ump/StoreSeckill.php
+++ b/app/admin/controller/ump/StoreSeckill.php
@@ -216,7 +216,7 @@ class StoreSeckill extends AuthController
$f[] = Form::input('title','产品标题',$product->getData('title'));
$f[] = Form::input('info','秒杀活动简介',$product->getData('info'))->type('textarea');
$f[] = Form::input('unit_name','单位',$product->getData('unit_name'))->placeholder('个、位');
- $f[] = Form::dateTimeRange('section_time','活动时间',date('Y-m-d H:i:s', $product->getData('start_time')),date('Y-m-d H:i:s', $product->getData('stop_time')));
+ $f[] = Form::dateTimeRange('section_time','活动时间',date('Y-m-d H:i:s', (int)$product->getData('start_time')),date('Y-m-d H:i:s', (int)$product->getData('stop_time')));
$f[] = Form::frameImageOne('image','产品主图片(305*305px)',Url::buildUrl('admin/widget.images/index',array('fodder'=>'image')),$product->getData('image'))->icon('image')->width('100%')->height('500px');
$f[] = Form::frameImages('images','产品轮播图(640*640px)',Url::buildUrl('admin/widget.images/index',array('fodder'=>'images')),json_decode($product->getData('images')))->maxLength(5)->icon('images')->width('100%')->height('500px');
$f[] = Form::number('price','秒杀价',$product->getData('price'))->min(0)->col(12);
diff --git a/app/admin/controller/ump/UserPoint.php b/app/admin/controller/ump/UserPoint.php
index 307f8b5f..5afbd5f7 100644
--- a/app/admin/controller/ump/UserPoint.php
+++ b/app/admin/controller/ump/UserPoint.php
@@ -25,7 +25,7 @@ class UserPoint extends AuthController
// 'count'=>UserBill::where(['category'=>'integral','type'=>'sign'])->group('uid')->count(),
// 'song_point'=>UserBill::where(['category'=>'integral','type'=>'sign'])->group('uid')->sum('number'),
'is_layui'=>true,
- 'year'=>getMonth('y'),
+ 'year'=>getMonth(),
]);
return $this->fetch();
}
diff --git a/app/admin/controller/user/User.php b/app/admin/controller/user/User.php
index dac93255..b3bb0c73 100644
--- a/app/admin/controller/user/User.php
+++ b/app/admin/controller/user/User.php
@@ -198,7 +198,7 @@ class User extends AuthController
foreach ($taskIds as $id){
$inserValue[]=['uid'=>$uid,'task_id'=>$id,'status'=>1,'add_time'=>time()];
}
- $res=$res && Db::name('user_task_finish')->insertAll($inserValue);
+ $res=$res && Db::name('user_task_finish')->insertAll($inserValue) && UserModel::where('uid',$uid)->update(['level'=>$level_id]);
if($res){
UserModel::commitTrans();
return JsonService::successful('赠送成功');
diff --git a/app/admin/model/order/StoreOrder.php b/app/admin/model/order/StoreOrder.php
index 86870e43..fc3d39ae 100644
--- a/app/admin/model/order/StoreOrder.php
+++ b/app/admin/model/order/StoreOrder.php
@@ -150,11 +150,13 @@ class StoreOrder extends BaseModel
}else if($item['paid']==1 && $item['refund_status']==1){
$refundReasonTime = date('Y-m-d H:i', $item['refund_reason_time']);
$refundReasonWapImg = json_decode($item['refund_reason_wap_img'], true);
- $refundReasonWapImg = $refundReasonWapImg && is_array($refundReasonWapImg) ? $refundReasonWapImg : [];
+ $refundReasonWapImg = $refundReasonWapImg ? $refundReasonWapImg : [];
$img = '';
- foreach ($refundReasonWapImg as $itemImg){
- if(strlen(trim($itemImg)))
- $img .='';
+ if(count($refundReasonWapImg)){
+ foreach ($refundReasonWapImg as $itemImg){
+ if(strlen(trim($itemImg)))
+ $img .='
';
+ }
}
if(!strlen(trim($img))) $img = '无';
$item['status_name']=<<where('is_system_del',0);
if(isset($where['status']) && $where['status'] != '') {
$model = self::statusByWhere($where['status'],$model,$aler);
- }else{
- $model = $model->where('paid',1);
}
if(isset($where['is_del']) && $where['is_del'] != '' && $where['is_del'] != -1) $model = $model->where($aler.'is_del',$where['is_del']);
if(isset($where['combination_id'])){
diff --git a/app/admin/model/store/StoreProduct.php b/app/admin/model/store/StoreProduct.php
index f28855f0..3b2bef6a 100644
--- a/app/admin/model/store/StoreProduct.php
+++ b/app/admin/model/store/StoreProduct.php
@@ -245,6 +245,32 @@ class StoreProduct extends BaseModel
}
unset($stk,$sum_stock,$stock1);
+ //获取砍价缺货产品
+ $stock1 = self::getModelTime($where,new StoreBargain())->where('stock','<',$replenishment_num)->column('stock','id');
+ $sum_stock = StoreBargain::where('stock','<',$replenishment_num)->column('stock','id');
+ $stk = [];
+ foreach ($stock1 as $item){
+ $stk[] = $replenishment_num-$item;
+ }
+ $lack = bcadd($lack,array_sum($stk),0);
+ foreach ($sum_stock as $val){
+ $sum[] = $replenishment_num-$val;
+ }
+ unset($stk,$sum_stock,$stock1);
+
+ //获取拼团缺货产品
+ $stock1 = self::getModelTime($where,new StoreCombination())->where('stock','<',$replenishment_num)->column('stock','id');
+ $sum_stock = StoreCombination::where('stock','<',$replenishment_num)->column('stock','id');
+ $stk = [];
+ foreach ($stock1 as $item){
+ $stk[] = $replenishment_num - $item;
+ }
+ $lack = bcadd($lack,array_sum($stk),0);
+ foreach ($sum_stock as $val){
+ $sum[] = $replenishment_num - $val;
+ }
+ unset($stk,$sum_stock,$stock1);
+
return [
[
'name'=>'商品种类',
@@ -292,12 +318,15 @@ class StoreProduct extends BaseModel
public static function getActivityProductSum($where=false)
{
if($where){
+ $bargain=self::getModelTime($where,new StoreBargain())->sum('stock');
+ $pink=self::getModelTime($where,new StoreCombination())->sum('stock');
$seckill=self::getModelTime($where,new StoreSeckill())->sum('stock');
}else{
-
+ $bargain=StoreBargain::sum('stock');
+ $pink=StoreCombination::sum('stock');
$seckill=StoreSeckill::sum('stock');
}
- return $seckill;
+ return bcadd(bcadd($bargain,$pink,0),$seckill,0);
}
public static function setWhereType($model,$type){
@@ -355,7 +384,11 @@ class StoreProduct extends BaseModel
//获取利润
public static function ProfityTop10($where){
$classs=['layui-bg-red','layui-bg-orange','layui-bg-green','layui-bg-blue','layui-bg-cyan'];
- $model=StoreOrder::alias('a')->join('StoreOrderCartInfo c','a.id=c.oid')->join('__store_product__ b','b.id=c.product_id');
+ $model=StoreOrder::alias('a')
+ ->join('StoreOrderCartInfo c','a.id=c.oid')
+ ->join('__store_product__ b','b.id=c.product_id')
+ ->where('b.is_show',1)
+ ->where('b.is_del',0);
$list=self::getModelTime($where,$model,'a.add_time')->group('c.product_id')->order('profity desc')->limit(10)
->field(['count(c.product_id) as p_count','b.store_name','sum(b.price) as sum_price','(b.price-b.cost) as profity'])
->select();
diff --git a/app/admin/model/system/SystemGroup.php b/app/admin/model/system/SystemGroup.php
index b370350b..3163ad09 100644
--- a/app/admin/model/system/SystemGroup.php
+++ b/app/admin/model/system/SystemGroup.php
@@ -37,7 +37,7 @@ class SystemGroup extends BaseModel
* @return array
*/
public static function getField($id){
- $fields = json_decode(self::where('id',$id)->value("fields"),true);
+ $fields = json_decode(self::where('id',$id)->value("fields"),true)?:[];
return compact('fields');
}
}
\ No newline at end of file
diff --git a/app/admin/model/system/SystemLog.php b/app/admin/model/system/SystemLog.php
index c96c431c..207005fe 100644
--- a/app/admin/model/system/SystemLog.php
+++ b/app/admin/model/system/SystemLog.php
@@ -54,17 +54,31 @@ class SystemLog extends BaseModel
$controller = $request->controller();
$action = $request->action();
$route = $request->route();
- $data = [
- 'method'=>$request->app(),
- 'admin_id'=>$adminId,
- 'add_time'=>time(),
- 'admin_name'=>$adminName,
- 'path'=>SystemMenus::getAuthName($action,$controller,$module,$route),
- 'page'=>SystemMenus::getVisitName($action,$controller,$module,$route)?:'未知',
- 'ip'=>$request->ip(),
- 'type'=>$type
- ];
- return self::create($data);
+ self::startTrans();
+ try{
+ $data = [
+ 'method'=>$request->app(),
+ 'admin_id'=>$adminId,
+ 'add_time'=>time(),
+ 'admin_name'=>$adminName,
+ 'path'=>SystemMenus::getAuthName($action,$controller,$module,$route),
+ 'page'=>SystemMenus::getVisitName($action,$controller,$module,$route)?:'未知',
+ 'ip'=>$request->ip(),
+ 'type'=>$type
+ ];
+ $res = self::create($data);
+ if($res){
+ self::commit();
+ return true;
+ }else{
+ self::rollback();
+ return false;
+ }
+ }catch (\Exception $e){
+ self::rollback();
+ return self::setErrorInfo($e->getMessage());
+ }
+
}
/**
diff --git a/app/admin/model/user/User.php b/app/admin/model/user/User.php
index 5a3d0885..4065c25c 100644
--- a/app/admin/model/user/User.php
+++ b/app/admin/model/user/User.php
@@ -258,7 +258,7 @@ class User extends BaseModel
//自定义时间
if(strstr($where['date'],'-')!==FALSE){
list($startTime,$endTime)=explode('-',$where['date']);
- $model = $model->where('add_time','>',strtotime($startTime))->where('add_time','<',strtotime($endTime));
+ $model = $model->where('add_time','>',strtotime($startTime))->where('add_time','<',bcadd(strtotime($endTime),86400,0));
}else{
$model=$model->whereTime('add_time','month');
}
@@ -337,12 +337,12 @@ class User extends BaseModel
case 'quarter':
list($startTime,$endTime)=User::getMonth('n');
$model = $model->where('A.add_time','>',strtotime($startTime));
- $model = $model->where('A.add_time','<',strtotime($endTime));
+ $model = $model->where('A.add_time','<',bcadd(strtotime($endTime),86400,0));
break;
default:
list($startTime,$endTime)=explode('-',$date);
$model = $model->where('A.add_time','>',strtotime($startTime));
- $model = $model->where('A.add_time','<',strtotime($endTime));
+ $model = $model->where('A.add_time','<',bcadd(strtotime($endTime),86400,0));
break;
}
if($status===true){
diff --git a/app/admin/model/wechat/WechatMessage.php b/app/admin/model/wechat/WechatMessage.php
index 877b76fc..d54cfea3 100644
--- a/app/admin/model/wechat/WechatMessage.php
+++ b/app/admin/model/wechat/WechatMessage.php
@@ -64,7 +64,9 @@ class WechatMessage extends BaseModel
}
public static function setMessage($result,$openid,$type)
{
- $data = compact('result','openid','type');
+ if(is_object($result) || is_array($result)) $result = json_encode($result);
+ $add_time = time();
+ $data = compact('result','openid','type','add_time');
return self::create($data);
}
diff --git a/app/admin/model/wechat/WechatReply.php b/app/admin/model/wechat/WechatReply.php
index 6e05a3c5..6d8217ff 100644
--- a/app/admin/model/wechat/WechatReply.php
+++ b/app/admin/model/wechat/WechatReply.php
@@ -178,7 +178,7 @@ class WechatReply extends BaseModel
return self::setErrorInfo('请选择图文消息');
$siteUrl = SystemConfig::getConfigValue('site_url');
foreach ($data as $k=>$v){
- if(empty($v['url'])) $data[$k]['url'] = $siteUrl.Url::buildUrl('wap/article/visit',['id'=>$v['id']]);
+ if(empty($v['url'])) $data[$k]['url'] = $siteUrl.'/news_detail/'.$v['id'];
if($v['image']) $data[$k]['image'] = $v['image'];
}
return $data;
diff --git a/app/admin/model/wechat/WechatUser.php b/app/admin/model/wechat/WechatUser.php
index ec47e8cd..153fcf18 100644
--- a/app/admin/model/wechat/WechatUser.php
+++ b/app/admin/model/wechat/WechatUser.php
@@ -17,6 +17,7 @@ use crmeb\basic\BaseModel;
use crmeb\services\WechatService;
use crmeb\services\PHPExcelService;
use crmeb\services\SystemConfigService;
+use app\admin\model\order\StoreOrderStatus;
/**
* 微信用户 model
@@ -157,7 +158,9 @@ use crmeb\services\SystemConfigService;
->setExcelContent($export)
->ExcelSave();
}
- return self::page($model,$where);
+ return self::page($model,function($item){
+ $item['time'] = $item['add_time'] ? date('Y-m-d H:i',$item['add_time']) : '暂无';
+ },$where);
}
public static function setSpreadWhere($where=[],$alias='a',$model=null)
diff --git a/app/admin/view/article/article/create.php b/app/admin/view/article/article/create.php
index 7a98388f..ee1b3987 100644
--- a/app/admin/view/article/article/create.php
+++ b/app/admin/view/article/article/create.php
@@ -135,6 +135,7 @@
+
{/block}
{block name="script"}
{/block}
{block name="content"}
diff --git a/app/admin/view/sms/sms_admin/index.php b/app/admin/view/sms/sms_admin/index.php
index 72a1148f..f4499660 100644
--- a/app/admin/view/sms/sms_admin/index.php
+++ b/app/admin/view/sms/sms_admin/index.php
@@ -57,7 +57,7 @@