Browse Source

添加404和500错误页面提示,修改数据统计表前缀问题错误

sugar1569 7 years ago
parent
commit
d37077cb36

+ 15 - 1
application/admin/config.php

@@ -19,5 +19,19 @@ return [
         // 是否自动开启 SESSION
         'auto_start'     => true,
     ],
-    'system_wechat_tag' => '_system_wechat'
+    'app_debug'              => false,
+    // 应用Trace
+    'app_trace'              => false,
+
+    'exception_handle' =>\basic\AdminException::class,
+    'empty_controller' =>'Index',
+    // 视图输出字符串内容替换
+    'view_replace_str'       => [
+        '{__ADMIN_PATH}'   => PUBILC_PATH.'system/',//后台
+        '{__FRAME_PATH}'   => PUBILC_PATH.'system/frame/',//H+框架
+        '{__PLUG_PATH}'    => PUBILC_PATH.'static/plug/',//前后台通用
+        '{__MODULE_PATH}'  => PUBILC_PATH.'system/module/',//后台功能模块
+        '{__STATIC_PATH}'  => PUBILC_PATH.'static/',//全站通用
+        '{__PUBLIC_PATH}'  => PUBILC_PATH,//静态资源路径
+    ]
 ];

+ 396 - 0
application/admin/controller/ump/StoreCombination.php

@@ -0,0 +1,396 @@
+<?php
+
+namespace app\admin\controller\ump;
+
+use app\admin\controller\AuthController;
+use service\FormBuilder as Form;
+use traits\CurdControllerTrait;
+use service\UtilService as Util;
+use service\JsonService as Json;
+use service\UploadService as Upload;
+use think\Request;
+use app\admin\model\store\StoreProduct as ProductModel;
+use app\admin\model\ump\StoreCombinationAttr;
+use app\admin\model\ump\StoreCombinationAttrResult;
+use app\admin\model\ump\StoreCombination as StoreCombinationModel;
+use think\Url;
+use app\admin\model\system\SystemAttachment;
+use app\wap\model\store\StorePink;
+
+/**
+ * 拼团管理
+ * Class StoreCombination
+ * @package app\admin\controller\store
+ */
+class StoreCombination extends AuthController
+{
+
+    use CurdControllerTrait;
+
+    protected $bindModel = StoreCombinationModel::class;
+
+    /**
+     * @return mixed
+     */
+    public function index()
+    {
+        $this->assign('countCombination',StoreCombinationModel::getCombinationCount());
+        $this->assign(StoreCombinationModel::getStatistics());
+        $this->assign('combinationId',StoreCombinationModel::getCombinationIdAll());
+        return $this->fetch();
+    }
+    public function save_excel(){
+        $where = Util::getMore([
+            ['is_show',''],
+            ['store_name',''],
+        ]);
+        StoreCombinationModel::SaveExcel($where);
+    }
+    /**
+     * 异步获取拼团数据
+     */
+    public function get_combination_list(Request $request){
+        $where=Util::getMore([
+            ['page',1],
+            ['limit',20],
+            ['export',0],
+            ['is_show',''],
+            ['is_host',''],
+            ['store_name','']
+        ],$request);
+        $combinationList = StoreCombinationModel::systemPage($where);
+        if(is_object($combinationList['list'])) $combinationList['list'] = $combinationList['list']->toArray();
+        $data = $combinationList['list']['data'];
+        foreach ($data as $k=>$v){
+            $data[$k]['_stop_time'] = date('Y/m/d H:i:s',$v['stop_time']);
+        }
+        return Json::successlayui(['count'=>$combinationList['list']['total'],'data'=>$data]);
+    }
+
+    public function combination($id = 0){
+        if(!$id) return $this->failed('数据不存在');
+        $product = ProductModel::get($id);
+        if(!$product) return Json::fail('数据不存在!');
+        $f = array();
+        $f[] = Form::hidden('product_id',$id);
+//        $f[] = Form::select('product_id','产品名称')->setOptions(function(){
+//            $list = ProductModel::getTierList();
+//            foreach ($list as $menu){
+//                $menus[] = ['value'=>$menu['id'],'label'=>$menu['store_name'].'/'.$menu['id']];
+//            }
+//            return $menus;
+//        })->filterable(1);
+        $f[] = Form::input('title','拼团名称',$product->getData('store_name'));
+        $f[] = Form::input('info','拼团简介',$product->getData('store_info'))->type('textarea');
+        $f[] = Form::input('unit_name','单位',$product->getData('unit_name'))->placeholder('个、位');
+        $f[] = Form::dateTimeRange('section_time','拼团时间');
+        $f[] = Form::frameImageOne('image','产品主图片(305*305px)',Url::build('admin/widget.images/index',array('fodder'=>'image')),$product->getData('image'))->icon('image');
+        $f[] = Form::frameImages('images','产品轮播图(640*640px)',Url::build('admin/widget.images/index',array('fodder'=>'images')),json_decode($product->getData('slider_image')))->maxLength(5)->icon('images');
+        $f[] = Form::number('price','拼团价')->min(0)->col(12);
+        $f[] = Form::number('people','拼团人数')->min(3)->col(12);
+        $f[] = Form::number('stock','库存',$product->getData('stock'))->min(0)->precision(0)->col(12);
+        $f[] = Form::number('sales','销量',$product->getData('sales'))->min(0)->precision(0)->col(12);
+        $f[] = Form::number('sort','排序')->col(12);
+        $f[] = Form::number('postage','邮费',$product->getData('postage'))->min(0)->col(12);
+        $f[] = Form::radio('is_postage','是否包邮',$product->getData('is_postage'))->options([['label'=>'是','value'=>1],['label'=>'否','value'=>0]])->col(12);
+        $f[] = Form::radio('is_host','热门推荐',1)->options([['label'=>'开启','value'=>1],['label'=>'关闭','value'=>0]])->col(12);
+        $f[] = Form::radio('is_show','活动状态',1)->options([['label'=>'开启','value'=>1],['label'=>'关闭','value'=>0]])->col(12);
+        $form = Form::make_post_form('添加用户通知',$f,Url::build('save'));
+        $this->assign(compact('form'));
+        return $this->fetch('public/form-builder');
+    }
+    
+    /**
+     * 显示创建资源表单页.
+     *
+     * @return \think\Response
+     */
+    public function create()
+    {
+        $f = array();
+        $f[] = Form::select('product_id','产品名称')->setOptions(function(){
+            $list = ProductModel::getTierList();
+            foreach ($list as $menu){
+                $menus[] = ['value'=>$menu['id'],'label'=>$menu['store_name'].'/'.$menu['id']];
+            }
+            return $menus;
+        })->filterable(1);
+        $f[] = Form::input('title','拼团名称');
+        $f[] = Form::input('info','拼团简介')->type('textarea');
+        $f[] = Form::input('unit_name','单位')->placeholder('个、位');
+        $f[] = Form::dateTimeRange('section_time','拼团时间');
+        $f[] = Form::frameImageOne('image','产品主图片(305*305px)',Url::build('admin/widget.images/index',array('fodder'=>'image')))->icon('image');
+        $f[] = Form::frameImages('images','产品轮播图(640*640px)',Url::build('admin/widget.images/index',array('fodder'=>'images')))->maxLength(5)->icon('images');
+        $f[] = Form::number('price','拼团价')->min(0)->col(12);
+        $f[] = Form::number('people','拼团人数')->min(3)->col(12);
+        $f[] = Form::number('stock','库存')->min(0)->precision(0)->col(12);
+        $f[] = Form::number('sales','销量')->min(0)->precision(0)->col(12);
+        $f[] = Form::number('sort','排序')->col(12);
+        $f[] = Form::number('postage','邮费')->min(0)->col(12);
+        $f[] = Form::radio('is_postage','是否包邮',1)->options([['label'=>'是','value'=>1],['label'=>'否','value'=>0]])->col(12);
+        $f[] = Form::radio('is_host','热门推荐',1)->options([['label'=>'开启','value'=>1],['label'=>'关闭','value'=>0]])->col(12);
+        $f[] = Form::radio('is_show','活动状态',1)->options([['label'=>'开启','value'=>1],['label'=>'关闭','value'=>0]])->col(12);
+        $form = Form::make_post_form('添加用户通知',$f,Url::build('save'));
+        $this->assign(compact('form'));
+        return $this->fetch('public/form-builder');
+    }
+
+    /**
+     * 保存新建的资源
+     *
+     * @param  \think\Request  $request
+     * @return \think\Response
+     */
+    public function save(Request $request,$id=0)
+    {
+        $data = Util::postMore([
+            'product_id',
+            'title',
+            'info',
+            ['image',''],
+            ['images',[]],
+            ['section_time',[]],
+            'postage',
+            'price',
+            'people',
+            'sort',
+            'stock',
+            'sales',
+            ['is_show',0],
+            ['is_host',0],
+            ['is_postage',0],
+        ],$request);
+        if(!$data['title']) return Json::fail('请输入拼团名称');
+        if(!$data['info']) return Json::fail('请输入拼团简介');
+        if(!$data['image']) return Json::fail('请上传产品图片');
+        if(count($data['images'])<1) return Json::fail('请上传产品轮播图');
+        if($data['price'] == '' || $data['price'] < 0) return Json::fail('请输入产品售价');
+        if($data['people'] == '' || $data['people'] < 1) return Json::fail('请输入拼团人数');
+        if(count($data['section_time'])<1) return Json::fail('请选择活动时间');
+        if($data['stock'] == '' || $data['stock'] < 0) return Json::fail('请输入库存');
+        $data['images'] = json_encode($data['images']);
+        $data['add_time'] = time();
+        $data['start_time'] = strtotime($data['section_time'][0]);
+        $data['stop_time'] = strtotime($data['section_time'][1]);
+        $data['description'] = '';
+        unset($data['section_time']);
+        if($id){
+            $product = StoreCombinationModel::get($id);
+            if(!$product) return Json::fail('数据不存在!');
+            $data['product_id']=$product['product_id'];
+            StoreCombinationModel::edit($data,$id);
+            return Json::successful('编辑成功!');
+        }else{
+            StoreCombinationModel::set($data);
+            return Json::successful('添加拼团成功!');
+        }
+
+    }
+
+    /**
+     * 显示编辑资源表单页.
+     *
+     * @param  int  $id
+     * @return \think\Response
+     */
+    public function edit($id)
+    {
+        if(!$id) return $this->failed('数据不存在');
+        $product = StoreCombinationModel::get($id);
+        if(!$product) return Json::fail('数据不存在!');
+        $f = array();
+        $f[] = Form::input('title','拼团名称',$product->getData('title'));
+        $f[] = Form::input('info','拼团简介',$product->getData('title'))->type('textarea');
+        $f[] = Form::input('unit_name','单位',$product->getData('title'))->placeholder('个、位');
+        $f[] = Form::dateTimeRange('section_time','拼团时间',$product->getData('start_time'),$product->getData('stop_time'));
+        $f[] = Form::frameImageOne('image','产品主图片(305*305px)',Url::build('admin/widget.images/index',array('fodder'=>'image')),$product->getData('image'))->icon('image');
+        $f[] = Form::frameImages('images','产品轮播图(640*640px)',Url::build('admin/widget.images/index',array('fodder'=>'images')),json_decode($product->getData('images')))->maxLength(5)->icon('images');
+        $f[] = Form::number('price','拼团价',$product->getData('price'))->min(0)->col(12);
+        $f[] = Form::number('people','拼团人数',$product->getData('people'))->min(2)->col(12);
+        $f[] = Form::number('stock','库存',$product->getData('stock'))->min(0)->precision(0)->col(12);
+        $f[] = Form::number('sales','销量',$product->getData('sales'))->min(0)->precision(0)->col(12);
+        $f[] = Form::number('sort','排序',$product->getData('sort'))->col(12);
+        $f[] = Form::number('postage','邮费',$product->getData('postage'))->min(0)->col(12);
+        $f[] = Form::radio('is_postage','是否包邮',$product->getData('is_postage'))->options([['label'=>'是','value'=>1],['label'=>'否','value'=>0]])->col(12);
+        $f[] = Form::radio('is_host','热门推荐',$product->getData('is_host'))->options([['label'=>'开启','value'=>1],['label'=>'关闭','value'=>0]])->col(12);
+        $f[] = Form::radio('is_show','活动状态',$product->getData('is_show'))->options([['label'=>'开启','value'=>1],['label'=>'关闭','value'=>0]])->col(12);
+        $form = Form::make_post_form('添加用户通知',$f,Url::build('save',compact('id')));
+        $this->assign(compact('form'));
+        return $this->fetch('public/form-builder');
+//        $this->assign([
+//            'title'=>'编辑产品','rules'=>$this->read($id)->getContent(),
+//            'action'=>Url::build('update',array('id'=>$id))
+//        ]);
+//        return $this->fetch('public/common_form');
+    }
+
+    /**
+     * 删除指定资源
+     *
+     * @param  int  $id
+     * @return \think\Response
+     */
+    public function delete($id)
+    {
+        if(!$id) return $this->failed('数据不存在');
+        $data['is_del'] = 1;
+        if(!StoreCombinationModel::edit($data,$id))
+            return Json::fail(StoreCombinationModel::getErrorInfo('删除失败,请稍候再试!'));
+        else
+            return Json::successful('删除成功!');
+    }
+
+    /**
+     * 属性页面
+     * @param $id
+     * @return mixed|void
+     */
+    public function attr($id)
+    {
+        if(!$id) return $this->failed('数据不存在!');
+        $result = StoreCombinationAttrResult::getResult($id);
+        $image = StoreCombinationModel::where('id',$id)->value('image');
+        $this->assign(compact('id','result','product','image'));
+        return $this->fetch();
+    }
+
+    /**
+     * 生成属性
+     * @param int $id
+     */
+    public function is_format_attr($id = 0){
+        if(!$id) return Json::fail('产品不存在');
+        list($attr,$detail) = Util::postMore([
+            ['items',[]],
+            ['attrs',[]]
+        ],$this->request,true);
+        $product = StoreCombinationModel::get($id);
+        if(!$product) return Json::fail('产品不存在');
+        $attrFormat = attrFormat($attr)[1];
+        if(count($detail)){
+            foreach ($attrFormat as $k=>$v){
+                foreach ($detail as $kk=>$vv){
+                    if($v['detail'] == $vv['detail']){
+                        $attrFormat[$k]['price'] = $vv['price'];
+                        $attrFormat[$k]['sales'] = $vv['sales'];
+                        $attrFormat[$k]['pic'] = $vv['pic'];
+                        $attrFormat[$k]['check'] = false;
+                        break;
+                    }else{
+                        $attrFormat[$k]['price'] = '';
+                        $attrFormat[$k]['sales'] = '';
+                        $attrFormat[$k]['pic'] = $product['image'];
+                        $attrFormat[$k]['check'] = true;
+                    }
+                }
+            }
+        }else{
+            foreach ($attrFormat as $k=>$v){
+                $attrFormat[$k]['price'] = $product['price'];
+                $attrFormat[$k]['sales'] = $product['stock'];
+                $attrFormat[$k]['pic'] = $product['image'];
+                $attrFormat[$k]['check'] = false;
+            }
+        }
+        return Json::successful($attrFormat);
+    }
+
+    /**
+     * 添加 修改属性
+     * @param $id
+     */
+    public function set_attr($id)
+    {
+        if(!$id) return $this->failed('产品不存在!');
+        list($attr,$detail) = Util::postMore([
+            ['items',[]],
+            ['attrs',[]]
+        ],$this->request,true);
+        $res = StoreCombinationAttr::createProductAttr($attr,$detail,$id);
+        if($res)
+            return $this->successful('编辑属性成功!');
+        else
+            return $this->failed(StoreCombinationAttr::getErrorInfo());
+    }
+
+    /**
+     * 清除属性
+     * @param $id
+     */
+    public function clear_attr($id)
+    {
+        if(!$id) return $this->failed('产品不存在!');
+        if(false !== StoreCombinationAttr::clearProductAttr($id) && false !== StoreCombinationAttrResult::clearResult($id))
+            return $this->successful('清空产品属性成功!');
+        else
+            return $this->failed(StoreCombinationAttr::getErrorInfo('清空产品属性失败!'));
+    }
+
+    public function edit_content($id){
+        if(!$id) return $this->failed('数据不存在');
+        $product = StoreCombinationModel::get($id);
+        if(!$product) return Json::fail('数据不存在!');
+        $this->assign([
+            'content'=>StoreCombinationModel::where('id',$id)->value('description'),
+            'field'=>'description',
+            'action'=>Url::build('change_field',['id'=>$id,'field'=>'description'])
+        ]);
+        return $this->fetch('public/edit_content');
+    }
+
+    /**
+     * 上传图片
+     * @return \think\response\Json
+     */
+    public function upload()
+    {
+        $res = Upload::image('file','store/product/'.date('Ymd'));
+        $thumbPath = Upload::thumb($res->dir);
+        //产品图片上传记录
+        $fileInfo = $res->fileInfo->getinfo();
+        SystemAttachment::attachmentAdd($res->fileInfo->getSaveName(),$fileInfo['size'],$fileInfo['type'],$res->dir,$thumbPath,2);
+        if($res->status == 200)
+            return Json::successful('图片上传成功!',['name'=>$res->fileInfo->getSaveName(),'url'=>Upload::pathToUrl($thumbPath)]);
+        else
+            return Json::fail($res->error);
+    }
+
+    /**拼团列表
+     * @return mixed
+     */
+    public function combina_list()
+    {
+        $where = Util::getMore([
+            ['status',''],
+            ['data',''],
+        ],$this->request);
+        $this->assign('where',$where);
+        $this->assign(StorePink::systemPage($where));
+
+        return $this->fetch();
+    }
+    /**拼团人列表
+     * @return mixed
+     */
+    public function order_pink($id){
+        if(!$id) return $this->failed('数据不存在');
+        $StorePink = StorePink::getPinkUserOne($id);
+        if(!$StorePink) return $this->failed('数据不存在!');
+        $list = StorePink::getPinkMember($id);
+        $list[] = $StorePink;
+        $this->assign('list',$list);
+        return $this->fetch();
+    }/**
+ * 修改拼团状态
+ * @param $status
+ * @param int $idd
+ */
+    public function set_combination_status($status,$id = 0){
+        if(!$id) return Json::fail('参数错误');
+        $res = StoreCombinationModel::edit(['is_show'=>$status],$id);
+        if($res) return Json::successful('修改成功');
+        else return Json::fail('修改失败');
+    }
+
+
+}

+ 28 - 4
application/admin/model/store/StoreProduct.php

@@ -15,6 +15,9 @@ use traits\ModelTrait;
 use basic\ModelBasic;
 use app\admin\model\store\StoreCategory as CategoryModel;
 use app\admin\model\order\StoreOrder;
+use app\admin\model\ump\StoreSeckill as StoreSeckillModel;
+use app\admin\model\ump\StoreCombination as StoreCombinationModel;
+use app\admin\model\ump\StoreBargain as StoreBargainModel;
 use app\admin\model\system\SystemConfig;
 
 /**
@@ -26,6 +29,27 @@ class StoreProduct extends ModelBasic
 {
     use ModelTrait;
 
+    /**删除产品
+     * @param $id
+     */
+    public static function proDelete($id){
+        //删除产品
+        //删除属性
+        //删除秒杀
+        //删除拼团
+        //删除砍价
+        //删除拼团
+        $model=new self();
+        self::beginTrans();
+        $res0 = $model::del($id);
+        $res1 = StoreSeckillModel::where(['product_id'=>$id])->delete();
+        $res2 = StoreCombinationModel::where(['product_id'=>$id])->delete();
+        $res3 = StoreBargainModel::where(['product_id'=>$id])->delete();
+        //。。。。
+        $res = $res0 && $res1 && $res2 && $res3;
+        self::checkTrans($res);
+        return $res;
+    }
     /**
      * 获取连表查询条件
      * @param $type
@@ -243,7 +267,7 @@ class StoreProduct extends ModelBasic
      */
     public static function getMaxList($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');
         $list=self::getModelTime($where,$model,'a.add_time')->group('c.product_id')->order('p_count desc')->limit(10)
             ->field(['count(c.product_id) as p_count','b.store_name','sum(b.price) as sum_price'])->select();
         if(count($list)) $list=$list->toArray();
@@ -268,7 +292,7 @@ class StoreProduct extends ModelBasic
     //获取利润
     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');
         $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();
@@ -360,7 +384,7 @@ class StoreProduct extends ModelBasic
         }else{
             $time['data']=isset($where['data'])? $where['data']:'';
         }
-        $model=self::getModelTime($time,db('store_cart')->alias('a')->join('store_product b','a.product_id=b.id'),'a.add_time');
+        $model=self::getModelTime($time,db('store_cart')->alias('a')->join('__STORE_PRODUCT__ b','a.product_id=b.id'),'a.add_time');
         if(isset($where['title']) && $where['title']!=''){
             $model=$model->where('b.store_name|b.id','like',"%$where[title]%");
         }
@@ -471,7 +495,7 @@ class StoreProduct extends ModelBasic
             [
                 'name'=>'点赞次数',
                 'field'=>'个',
-                'count'=>db('store_product_relation')->where('product_id',$id)->where('type','like')->count(),
+                'count'=>Db::name('store_product_relation')->where('product_id',$id)->where('type','like')->count(),
                 'background_color'=>'layui-bg-blue',
             ],
             [

File diff suppressed because it is too large
+ 1 - 1
application/admin/model/user/User.php


+ 4 - 4
application/admin/model/user/UserBill.php

@@ -5,7 +5,7 @@ namespace app\admin\model\user;
 use traits\ModelTrait;
 use basic\ModelBasic;
 use app\admin\model\wechat\WechatUser;
-
+use think\Db;
 /**
  * 用户消费新增金额明细 model
  * Class User
@@ -101,7 +101,7 @@ class UserBill extends ModelBasic
         $list=self::alias('a')->join('user r','a.uid=r.uid')
             ->where($datawhere)
             ->order('a.number desc')
-            ->join('store_order o','o.id=a.link_id')
+            ->join('__STORE_ORDER__ o','o.id=a.link_id')
             ->field(['o.order_id','FROM_UNIXTIME(a.add_time,"%Y-%c-%d") as add_time','a.uid','o.uid as down_uid','r.nickname','r.avatar','r.spread_uid','r.level','a.number'])
             ->page((int)$where['page'],(int)$where['limit'])
             ->select();
@@ -111,7 +111,7 @@ class UserBill extends ModelBasic
     //获取返佣用户总人数
     public static function getFanCount(){
         $datawhere=['a.category'=>'now_money','a.type'=>'brokerage','a.pm'=>1];
-        return self::alias('a')->join('user r','a.uid=r.uid')->join('store_order o','o.id=a.link_id')->where($datawhere)->count();
+        return self::alias('a')->join('user r','a.uid=r.uid')->join('__STORE_ORDER__ o','o.id=a.link_id')->where($datawhere)->count();
     }
     //获取用户充值数据
     public static function getEchartsRecharge($where,$limit=15){
@@ -145,7 +145,7 @@ class UserBill extends ModelBasic
         count($list) && $list=$list->toArray();
         $count=self::setOneWhere($where,$uid)->count();
         foreach ($list as &$value){
-            $value['order_id']=db('store_order')->where(['order_id'=>$value['link_id']])->value('order_id');
+            $value['order_id']=Db::name('store_order')->where(['order_id'=>$value['link_id']])->value('order_id');
         }
         return ['data'=>$list,'count'=>$count];
     }

+ 30 - 0
application/admin/view/public/404.php

@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title> 404 页面</title>
+    <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
+    <meta name="description" content="H+是一个完全响应式,基于Bootstrap3最新版本开发的扁平化主题,她采用了主流的左右两栏式布局,使用了Html5+CSS3等现代技术">
+
+    <link rel="shortcut icon" href="favicon.ico">
+    <link href="{__FRAME_PATH}css/bootstrap.min.css" rel="stylesheet">
+    <link href="{__FRAME_PATH}css/font-awesome.css?v=4.4.0" rel="stylesheet">
+    <link href="{__FRAME_PATH}css/style.min.css?v=4.1.0" rel="stylesheet">
+
+</head>
+
+<body class="gray-bg">
+<div class="middle-box text-center animated fadeInDown">
+    <h1>404</h1>
+    <h3 class="font-bold">页面未找到!</h3>
+
+    <div class="error-desc">
+        抱歉,页面好像去火星了~
+
+    </div>
+</div>
+
+</body>
+
+</html>

+ 30 - 0
application/admin/view/public/500.php

@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title> {$title}</title>
+    <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
+    <meta name="description" content="H+是一个完全响应式,基于Bootstrap3最新版本开发的扁平化主题,她采用了主流的左右两栏式布局,使用了Html5+CSS3等现代技术">
+
+    <link rel="shortcut icon" href="favicon.ico">
+    <link href="{__FRAME_PATH}css/bootstrap.min.css" rel="stylesheet">
+    <link href="{__FRAME_PATH}css/font-awesome.css?v=4.4.0" rel="stylesheet">
+    <link href="{__FRAME_PATH}css/style.min.css?v=4.1.0" rel="stylesheet">
+
+</head>
+
+<body class="gray-bg">
+<div class="middle-box text-center animated fadeInDown">
+    <h1>500</h1>
+    <h3 class="font-bold">服务器内部错误</h3>
+
+    <div class="error-desc">
+        服务器好像出错了...
+        <p>{$msg}</p>
+    </div>
+</div>
+
+</body>
+
+</html>

+ 1 - 1
application/config.php

@@ -17,7 +17,7 @@ return [
     // 应用命名空间
     'app_namespace'          => 'app',
     // 应用调试模式
-    'app_debug'              => true,
+    'app_debug'              => false,
     // 应用Trace
     'app_trace'              => false,
     // 应用模式状态

+ 3 - 4
application/wap/model/store/StoreOrder.php

@@ -58,8 +58,8 @@ class StoreOrder extends ModelBasic
 
     public static function getOrderPriceGroup($cartInfo)
     {
-        $storePostage = floatval(SystemConfigService::get('store_postage'))?:0;
-        $storeFreePostage =  floatval(SystemConfigService::get('store_free_postage'))?:0;
+        $storePostage = floatval(SystemConfigService::get('store_postage'))?:0;//基础邮费
+        $storeFreePostage =  floatval(SystemConfigService::get('store_free_postage'))?:0;//满*包邮
         $totalPrice = self::getOrderTotalPrice($cartInfo);
         $costPrice = self::getOrderCostPrice($cartInfo);
         if(!$storeFreePostage) {
@@ -196,7 +196,6 @@ class StoreOrder extends ModelBasic
             $couponPrice = 0;
         }
         if(!$res1) return self::setErrorInfo('使用优惠劵失败!');
-
         //是否包邮
         if((isset($other['offlinePostage'])  && $other['offlinePostage'] && $payType == 'offline')) $payPostage = 0;
         $payPrice = bcadd($payPrice,$payPostage,2);
@@ -572,7 +571,7 @@ class StoreOrder extends ModelBasic
             $status['_msg'] = '已为您退款,感谢您的支持';
             $status['_class'] = 'state-sqtk';
         }else if(!$order['status']){
-            if($order['pink_id']){
+            if(isset($order['pink_id'])){
                 if(StorePink::where('id',$order['pink_id'])->where('status',1)->count()){
                     $status['_type'] = 1;
                     $status['_title'] = '拼团中';

+ 53 - 0
extend/basic/AdminException.php

@@ -0,0 +1,53 @@
+<?php
+/**
+ *
+ * @author: xaboy<365615158@qq.com>
+ * @day: 2018/01/10
+ */
+
+namespace basic;
+
+
+use Exception;
+use service\JsonService;
+use think\exception\Handle;
+use think\exception\HttpException;
+use think\exception\ValidateException;
+use think\Log;
+use think\Request;
+use think\Url;
+
+class AdminException extends Handle
+{
+
+    public function render(Exception $e){
+        // 参数验证错误
+        if ($e instanceof ValidateException) {
+            return json($e->getError(), 422);
+        }
+        // 请求异常
+        if ($e instanceof HttpException && request()->isAjax()) {
+            return JsonService::fail('系统错误');
+        }else{
+            if(config("app_debug")==true){              //如是开启调试,就走原来的方法
+                return parent::render($e);
+            }else {
+                $title = '系统错误';
+                $msg = addslashes($e->getMessage());
+                $this->recordErrorLog($e);
+                exit(view('public/500', compact('title', 'msg'))->getContent());
+            }
+        }
+    }
+    /*
+    * 将异常写入日志
+    */
+    private function recordErrorLog(Exception $e) {
+        Log::init([
+            'type' => 'File',
+            'path' => LOG_PATH,
+            'level' => ['error'],
+        ]);
+        Log::record($e->getMessage(), 'error');
+    }
+}

+ 12 - 1
extend/basic/SystemBasic.php

@@ -94,10 +94,21 @@ class SystemBasic extends \think\Controller
             exit($this->fetch('public/success'));
         }
     }
-
+    /**异常抛出
+     * @param $name
+     */
     protected function exception($msg = '无法打开页面')
     {
         $this->assign(compact('msg'));
         exit($this->fetch('public/exception'));
     }
+    /**找不到页面
+     * @param $name
+     */
+    public function _empty($name)
+    {
+        exit($this->fetch('public/404'));
+    }
+
+
 }