Bladeren bron

Merge remote-tracking branch 'origin/master'

panqiuyao 1 jaar geleden
bovenliggende
commit
76ffab3ee1
100 gewijzigde bestanden met toevoegingen van 5683 en 5112 verwijderingen
  1. 1 8
      app/admin/controller/Account.php
  2. 84 77
      app/admin/controller/Activity.php
  3. 1 8
      app/admin/controller/Admin.php
  4. 1 8
      app/admin/controller/AdminControl.php
  5. 42 50
      app/admin/controller/Adminlog.php
  6. 69 60
      app/admin/controller/Adv.php
  7. 77 66
      app/admin/controller/Appadv.php
  8. 21 18
      app/admin/controller/Arrivalnotice.php
  9. 59 51
      app/admin/controller/Article.php
  10. 46 39
      app/admin/controller/Articleclass.php
  11. 91 87
      app/admin/controller/Bill.php
  12. 34 27
      app/admin/controller/Bonus.php
  13. 45 35
      app/admin/controller/Brand.php
  14. 14 16
      app/admin/controller/Chain.php
  15. 18 15
      app/admin/controller/Common.php
  16. 48 45
      app/admin/controller/Complain.php
  17. 165 159
      app/admin/controller/Config.php
  18. 42 34
      app/admin/controller/Consulting.php
  19. 165 142
      app/admin/controller/Dashboard.php
  20. 40 29
      app/admin/controller/Database.php
  21. 28 23
      app/admin/controller/Document.php
  22. 238 227
      app/admin/controller/EditablePage.php
  23. 40 36
      app/admin/controller/Evaluate.php
  24. 83 76
      app/admin/controller/Exppoints.php
  25. 34 28
      app/admin/controller/Express.php
  26. 21 17
      app/admin/controller/Feedback.php
  27. 31 29
      app/admin/controller/Flea.php
  28. 162 146
      app/admin/controller/Fleaclass.php
  29. 9 8
      app/admin/controller/Fleaclassindex.php
  30. 37 33
      app/admin/controller/Flearegion.php
  31. 34 31
      app/admin/controller/Fleaseo.php
  32. 47 40
      app/admin/controller/Goods.php
  33. 38 34
      app/admin/controller/Goodsalbum.php
  34. 52 43
      app/admin/controller/Goodsclass.php
  35. 22 20
      app/admin/controller/Goodsvideo.php
  36. 89 69
      app/admin/controller/Groupbuy.php
  37. 1 8
      app/admin/controller/Index.php
  38. 42 27
      app/admin/controller/Inform.php
  39. 33 29
      app/admin/controller/InstantMessage.php
  40. 206 194
      app/admin/controller/Inviter.php
  41. 30 24
      app/admin/controller/Link.php
  42. 65 63
      app/admin/controller/LiveApply.php
  43. 16 12
      app/admin/controller/LiveGoods.php
  44. 14 13
      app/admin/controller/LiveSetting.php
  45. 1 8
      app/admin/controller/Login.php
  46. 38 29
      app/admin/controller/Mallconsult.php
  47. 69 63
      app/admin/controller/Mallvouchertemplate.php
  48. 58 52
      app/admin/controller/Marketmanage.php
  49. 58 53
      app/admin/controller/Member.php
  50. 53 50
      app/admin/controller/MemberAuth.php
  51. 21 17
      app/admin/controller/Membergrade.php
  52. 124 96
      app/admin/controller/Message.php
  53. 35 29
      app/admin/controller/Navigation.php
  54. 18 16
      app/admin/controller/Notice.php
  55. 14 14
      app/admin/controller/Offpayarea.php
  56. 20 15
      app/admin/controller/Operation.php
  57. 71 63
      app/admin/controller/Order.php
  58. 69 52
      app/admin/controller/Ownshop.php
  59. 19 16
      app/admin/controller/Payment.php
  60. 30 23
      app/admin/controller/Pointorder.php
  61. 27 19
      app/admin/controller/Pointprod.php
  62. 46 38
      app/admin/controller/Points.php
  63. 139 120
      app/admin/controller/Predeposit.php
  64. 41 32
      app/admin/controller/Promotionbargain.php
  65. 26 20
      app/admin/controller/Promotionbooth.php
  66. 22 24
      app/admin/controller/Promotionbundling.php
  67. 25 25
      app/admin/controller/Promotionmansong.php
  68. 24 19
      app/admin/controller/Promotionmgdiscount.php
  69. 33 28
      app/admin/controller/Promotionpintuan.php
  70. 22 16
      app/admin/controller/Promotionpresell.php
  71. 28 31
      app/admin/controller/Promotionwholesale.php
  72. 26 29
      app/admin/controller/Promotionxianshi.php
  73. 30 33
      app/admin/controller/Rechargecard.php
  74. 61 65
      app/admin/controller/Refund.php
  75. 91 82
      app/admin/controller/Region.php
  76. 68 61
      app/admin/controller/Returnmanage.php
  77. 16 15
      app/admin/controller/Seo.php
  78. 44 44
      app/admin/controller/Snsmalbum.php
  79. 28 20
      app/admin/controller/Snsmember.php
  80. 39 34
      app/admin/controller/Spec.php
  81. 107 101
      app/admin/controller/Stataftersale.php
  82. 47 49
      app/admin/controller/Statgeneral.php
  83. 109 103
      app/admin/controller/Statgoods.php
  84. 174 166
      app/admin/controller/Statindustry.php
  85. 145 140
      app/admin/controller/Statmarketing.php
  86. 64 52
      app/admin/controller/Statmember.php
  87. 280 272
      app/admin/controller/Statstore.php
  88. 50 43
      app/admin/controller/Stattrade.php
  89. 121 92
      app/admin/controller/Store.php
  90. 35 30
      app/admin/controller/Storeclass.php
  91. 105 97
      app/admin/controller/Storedeposit.php
  92. 39 32
      app/admin/controller/Storegrade.php
  93. 34 22
      app/admin/controller/Storehelp.php
  94. 23 17
      app/admin/controller/Storejoin.php
  95. 89 81
      app/admin/controller/Storemoney.php
  96. 51 46
      app/admin/controller/Storesnstrace.php
  97. 122 111
      app/admin/controller/Type.php
  98. 14 13
      app/admin/controller/Upload.php
  99. 80 71
      app/admin/controller/Voucher.php
  100. 25 19
      app/admin/controller/Vrgroupbuy.php

+ 1 - 8
app/admin/controller/Account.php

@@ -5,14 +5,7 @@ use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
- * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
- * ----------------------------------------------------------------------------
- * 
- * ============================================================================
+
  * 控制器
  */
 class Account extends AdminControl {

+ 84 - 77
app/admin/controller/Activity.php

@@ -1,43 +1,46 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Activity extends AdminControl {
+class Activity extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/activity.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/activity.lang.php');
     }
 
     /**
      * 活动列表/删除活动
      */
-    public function index() {
+    public function index()
+    {
         $activity_model = model('activity');
         //条件
         $condition = array();
-        $condition[] = array('activity_type','=','1'); //只显示商品活动
+        $condition[] = array('activity_type', '=', '1'); //只显示商品活动
         //状态
         if ((input('param.searchstate'))) {
             $state = intval(input('param.searchstate')) - 1;
-            $condition[] = array('activity_state','=',"$state");
+            $condition[] = array('activity_state', '=', "$state");
         }
         //标题
         if ((input('param.searchtitle'))) {
-            $condition[]=array('activity_title','like', "%" . input('param.searchtitle') . "%");
+            $condition[] = array('activity_title', 'like', "%" . input('param.searchtitle') . "%");
         }
         //有效期范围
         if ((input('param.searchstartdate')) && (input('param.searchenddate'))) {
@@ -46,11 +49,11 @@ class Activity extends AdminControl {
             if ($enddate > 0) {
                 $enddate += 86400;
             }
-            $condition[]=array('activity_enddate','>=',$startdate);
-            $condition[]=array('activity_startdate','<=',$enddate);
+            $condition[] = array('activity_enddate', '>=', $startdate);
+            $condition[] = array('activity_startdate', '<=', $enddate);
         }
         //活动列表
-        $activity_list = $activity_model->getActivityList($condition, 10 , 'activity_sort asc');
+        $activity_list = $activity_model->getActivityList($condition, 10, 'activity_sort asc');
         //输出
         View::assign('show_page', $activity_model->page_info->render());
         View::assign('activity_list', $activity_list);
@@ -62,7 +65,8 @@ class Activity extends AdminControl {
     /**
      * 新建活动/保存新建活动
      */
-    public function add() {
+    public function add()
+    {
         if (request()->isPost()) {
             //提交表单
             $data = [
@@ -81,22 +85,22 @@ class Activity extends AdminControl {
 
             $file_name = '';
             if (!empty($_FILES['activity_banner']['name'])) {
-                $res=ds_upload_pic(ATTACH_ACTIVITY,'activity_banner');
-                if($res['code']){
-                    $file_name=$res['data']['file_name'];
-                }else{
+                $res = ds_upload_pic(ATTACH_ACTIVITY, 'activity_banner');
+                if ($res['code']) {
+                    $file_name = $res['data']['file_name'];
+                } else {
                     $this->error($res['msg']);
                 }
             }
             //保存
             $data['activity_banner'] = $file_name;
-            
+
             $file_name_mobile = '';
             if (!empty($_FILES['activity_banner_mobile']['name'])) {
-                $res=ds_upload_pic(ATTACH_ACTIVITY,'activity_banner_mobile');
-                if($res['code']){
-                    $file_name_mobile=$res['data']['file_name'];
-                }else{
+                $res = ds_upload_pic(ATTACH_ACTIVITY, 'activity_banner_mobile');
+                if ($res['code']) {
+                    $file_name_mobile = $res['data']['file_name'];
+                } else {
                     $this->error($res['msg']);
                 }
             }
@@ -133,21 +137,22 @@ class Activity extends AdminControl {
     /**
      * 异步修改
      */
-    public function ajax() {
+    public function ajax()
+    {
         if (in_array(input('param.branch'), array('activity_title', 'activity_sort'))) {
             $activity_model = model('activity');
             $update_array = array();
             switch (input('param.branch')) {
-                /**
+                    /**
                  * 活动主题
                  */
                 case 'activity_title':
                     if (trim(input('param.value')) == '')
                         exit;
                     break;
-                /**
-                 * 排序
-                 */
+                    /**
+                     * 排序
+                     */
                 case 'activity_sort':
                     if (preg_match('/^\d+$/', trim(input('param.value'))) <= 0 or intval(trim(input('param.value'))) < 0 or intval(trim(input('param.value'))) > 255)
                         exit;
@@ -158,11 +163,11 @@ class Activity extends AdminControl {
             $update_array[input('param.column')] = trim(input('param.value'));
             if ($activity_model->editActivity($update_array, intval(input('param.id'))))
                 echo 'true';
-        }elseif (in_array(input('param.branch'), array('activitydetail_sort'))) {
+        } elseif (in_array(input('param.branch'), array('activitydetail_sort'))) {
             $activitydetail_model = model('activitydetail');
             $update_array = array();
             switch (input('param.branch')) {
-                /**
+                    /**
                  * 排序
                  */
                 case 'activitydetail_sort':
@@ -173,7 +178,7 @@ class Activity extends AdminControl {
                     exit;
             }
             $update_array[input('param.column')] = trim(input('param.value'));
-            if ($activitydetail_model->editActivitydetail($update_array, array(array('activitydetail_id','=',intval(input('param.id'))))))
+            if ($activitydetail_model->editActivitydetail($update_array, array(array('activitydetail_id', '=', intval(input('param.id'))))))
                 echo 'true';
         }
     }
@@ -181,7 +186,8 @@ class Activity extends AdminControl {
     /**
      * 删除活动
      */
-    public function del() {
+    public function del()
+    {
         $id = intval(input('param.activity_id'));
         if ($id <= 0) {
             ds_json_encode(10001, lang('param_error'));
@@ -191,12 +197,12 @@ class Activity extends AdminControl {
         $activitydetail_model = model('activitydetail');
         //获取可以删除的数据
         $activity_info = $activity_model->getOneActivityById($id);
-        if (empty($activity_info) || ($activity_info['activity_state'] && $activity_info['activity_enddate']>TIMESTAMP)) {//没有符合条件的活动信息直接返回成功信息
+        if (empty($activity_info) || ($activity_info['activity_state'] && $activity_info['activity_enddate'] > TIMESTAMP)) { //没有符合条件的活动信息直接返回成功信息
             ds_json_encode(10001, lang('activity_index_help3'));
         }
         $id_arr = array($activity_info['activity_id']);
         $condition = array();
-        $condition[] = array('activity_id','in',$id_arr);
+        $condition[] = array('activity_id', 'in', $id_arr);
         //只有关闭或者过期的活动,能删除
         if ($activitydetail_model->getActivitydetailList($condition)) {
             if (!$activitydetail_model->delActivitydetail($condition)) {
@@ -221,9 +227,10 @@ class Activity extends AdminControl {
     /**
      * 编辑活动/保存编辑活动
      */
-    public function edit() {
+    public function edit()
+    {
         $activity_id = intval(input('param.activity_id'));
-        if ($activity_id<=0) {
+        if ($activity_id <= 0) {
             $this->error(lang('miss_argument'));
         }
         $activity_model = model('activity');
@@ -247,42 +254,40 @@ class Activity extends AdminControl {
             //构造更新内容
             $file_name = '';
             if ($_FILES['activity_banner']['name'] != '') {
-                $res=ds_upload_pic(ATTACH_ACTIVITY,'activity_banner');
-                if($res['code']){
-                    $file_name=$res['data']['file_name'];
-					$data['activity_banner'] = $file_name;
-                }else{
+                $res = ds_upload_pic(ATTACH_ACTIVITY, 'activity_banner');
+                if ($res['code']) {
+                    $file_name = $res['data']['file_name'];
+                    $data['activity_banner'] = $file_name;
+                } else {
                     $this->error($res['msg']);
                 }
-                
             }
             $file_name_mobile = '';
             if ($_FILES['activity_banner_mobile']['name'] != '') {
-                $res=ds_upload_pic(ATTACH_ACTIVITY,'activity_banner_mobile');
-                if($res['code']){
-                    $file_name_mobile=$res['data']['file_name'];
-					$data['activity_banner_mobile'] = $file_name_mobile;
-                }else{
+                $res = ds_upload_pic(ATTACH_ACTIVITY, 'activity_banner_mobile');
+                if ($res['code']) {
+                    $file_name_mobile = $res['data']['file_name'];
+                    $data['activity_banner_mobile'] = $file_name_mobile;
+                } else {
                     $this->error($res['msg']);
                 }
-                
             }
             $data['activity_desc'] = trim(input('post.activity_desc'));
             $data['activity_state'] = intval(input('post.activity_state'));
-            
+
             $result = $activity_model->editActivity($data, $activity_id);
             if ($result) {
                 //删除图片
-                @unlink($upload_file . DIRECTORY_SEPARATOR .$activity['activity_banner']);
-                @unlink($upload_file . DIRECTORY_SEPARATOR .$activity['activity_banner_mobile']);
+                @unlink($upload_file . DIRECTORY_SEPARATOR . $activity['activity_banner']);
+                @unlink($upload_file . DIRECTORY_SEPARATOR . $activity['activity_banner_mobile']);
                 $this->log(lang('ds_edit') . lang('activity_index') . '[ID:' . $activity_id . ']', null);
                 dsLayerOpenSuccess(lang('ds_common_save_succ'));
             } else {
                 if ($_FILES['activity_banner']['name'] != '') {
-                    @unlink($upload_file . DIRECTORY_SEPARATOR .$file_name);
+                    @unlink($upload_file . DIRECTORY_SEPARATOR . $file_name);
                 }
                 if ($_FILES['activity_banner_mobile']['name'] != '') {
-                    @unlink($upload_file . DIRECTORY_SEPARATOR .$file_name_mobile);
+                    @unlink($upload_file . DIRECTORY_SEPARATOR . $file_name_mobile);
                 }
                 $this->error(lang('ds_common_save_fail'));
             }
@@ -292,26 +297,27 @@ class Activity extends AdminControl {
     /**
      * 活动细节列表
      */
-    public function detail() {
+    public function detail()
+    {
         $activity_id = intval(input('param.id'));
         if ($activity_id <= 0) {
             $this->error(lang('miss_argument'));
         }
         //条件
         $condition_arr = array();
-        $condition_arr[] = array('activity_id','=',$activity_id);
+        $condition_arr[] = array('activity_id', '=', $activity_id);
         //审核状态
         if ((input('param.searchstate'))) {
             $state = intval(input('param.searchstate')) - 1;
-            $condition_arr[] = array('activitydetail_state','=',"$state");
+            $condition_arr[] = array('activitydetail_state', '=', "$state");
         }
         //店铺名称
         if ((input('param.searchstore'))) {
-            $condition_arr[] = array('store_name','like', "%" . input('param.searchstore') . "%");
+            $condition_arr[] = array('store_name', 'like', "%" . input('param.searchstore') . "%");
         }
         //商品名称
         if ((input('param.searchgoods'))) {
-            $condition_arr[] = array('item_name','like', "%" . input('param.searchgoods') . "%");
+            $condition_arr[] = array('item_name', 'like', "%" . input('param.searchgoods') . "%");
         }
 
         $activitydetail_model = model('activitydetail');
@@ -326,39 +332,39 @@ class Activity extends AdminControl {
     /**
      * 活动内容处理
      */
-    public function deal() {
+    public function deal()
+    {
         $activitydetail_id = input('param.activitydetail_id');
         $activitydetail_id_array = ds_delete_param($activitydetail_id);
         if ($activitydetail_id_array == FALSE) {
             ds_json_encode('10001', lang('param_error'));
         }
         $condition = array();
-        $condition[] = array('activitydetail_id','in',$activitydetail_id_array);
+        $condition[] = array('activitydetail_id', 'in', $activitydetail_id_array);
 
         //创建活动内容对象
         $activitydetail_state = intval(input('param.state'));
-        $result = model('activitydetail')->editActivitydetail(array('activitydetail_state' => $activitydetail_state),$condition);
-        if ($result>=0) {
+        $result = model('activitydetail')->editActivitydetail(array('activitydetail_state' => $activitydetail_state), $condition);
+        if ($result >= 0) {
             $this->log(lang('ds_edit') . lang('activity_index') . '[ID:' . $activitydetail_id . ']', null);
             if (input('param.ajax')) {
-                ds_json_encode(10000,lang('ds_common_op_succ'));
-            }else{
+                ds_json_encode(10000, lang('ds_common_op_succ'));
+            } else {
                 $this->success(lang('ds_common_op_succ'));
             }
-            
         } else {
             if (input('param.ajax')) {
-                ds_json_encode(10001,lang('ds_common_op_fail'));
-            }else{
+                ds_json_encode(10001, lang('ds_common_op_fail'));
+            } else {
                 $this->error(lang('ds_common_op_fail'));
             }
-            
         }
     }
     /**
      * 删除活动内容
      */
-    public function del_detail() {
+    public function del_detail()
+    {
         $activitydetail_id = input('param.activitydetail_id');
         $activitydetail_id_array = ds_delete_param($activitydetail_id);
         if ($activitydetail_id_array == FALSE) {
@@ -368,8 +374,8 @@ class Activity extends AdminControl {
         $activitydetail_model = model('activitydetail');
         //条件
         $condition_arr = array();
-        $condition_arr[] =array('activitydetail_id','in',$activitydetail_id_array);
-        $condition_arr[] = array('activitydetail_state','in',array('0','2'));//未审核和已拒绝
+        $condition_arr[] = array('activitydetail_id', 'in', $activitydetail_id_array);
+        $condition_arr[] = array('activitydetail_state', 'in', array('0', '2')); //未审核和已拒绝
         if ($activitydetail_model->delActivitydetail($condition_arr)) {
             $this->log(lang('ds_del') . lang('activity_index_content') . '[ID:' . implode(',', $activitydetail_id_array) . ']', null);
             ds_json_encode(10000, lang('ds_common_del_succ'));
@@ -383,7 +389,8 @@ class Activity extends AdminControl {
      *
      * @param int $id
      */
-    private function delBanner($id) {
+    private function delBanner($id)
+    {
         $activity_model = model('activity');
         $row = $activity_model->getOneActivityById($id);
         //删除图片文件
@@ -393,14 +400,15 @@ class Activity extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index', 'text' => lang('ds_manage'), 'url' => (string)url('Activity/index')
             ), array(
                 'name' => 'add',
                 'text' => lang('ds_new'),
-                'url' => "javascript:dsLayerOpen('".(string)url('Activity/add')."','".lang('ds_new')."')"
+                'url' => "javascript:dsLayerOpen('" . (string)url('Activity/add') . "','" . lang('ds_new') . "')"
             ),
         );
         if (request()->action() == 'detail') {
@@ -410,5 +418,4 @@ class Activity extends AdminControl {
         }
         return $menu_array;
     }
-
 }

+ 1 - 8
app/admin/controller/Admin.php

@@ -6,14 +6,7 @@ use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
- * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
- * ----------------------------------------------------------------------------
- * 
- * ============================================================================
+ 
  * 控制器
  */
 class Admin extends AdminControl

+ 1 - 8
app/admin/controller/AdminControl.php

@@ -6,14 +6,7 @@ use think\facade\View;
 use app\BaseController;
 
 /**
- * ============================================================================
- * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
- * ----------------------------------------------------------------------------
- * 
- * ============================================================================
+ 
  * 控制器
  */
 class AdminControl extends BaseController

+ 42 - 50
app/admin/controller/Adminlog.php

@@ -1,19 +1,19 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Db;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Adminlog extends AdminControl
@@ -22,7 +22,7 @@ class Adminlog extends AdminControl
     public function initialize()
     {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/adminlog.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/adminlog.lang.php');
     }
 
     /**
@@ -32,10 +32,10 @@ class Adminlog extends AdminControl
     public function loglist()
     {
         $condition = array();
-        $time1='';
-        $time2='';
+        $time1 = '';
+        $time2 = '';
         if (!empty(input('param.admin_name'))) {
-            $condition[]=array('admin_name','=',input('param.admin_name'));
+            $condition[] = array('admin_name', '=', input('param.admin_name'));
         }
         if (!empty(input('param.time_from'))) {
             $time1 = strtotime(input('param.time_from'));
@@ -46,22 +46,20 @@ class Adminlog extends AdminControl
                 $time2 = $time2 + 86400;
         }
         if ($time1 && $time2) {
-            $condition[] = array('adminlog_time','between', array($time1, $time2));
-        }
-        elseif ($time1) {
-            $condition[]=array('adminlog_time','>=', $time1);
-        }
-        elseif ($time2) {
-            $condition[]=array('adminlog_time','<=', $time2);
-        }
-        $adminlog_model= model('adminlog');
-        $order='adminlog_id desc';
-        $adminlog_list = $adminlog_model->getAdminlogList($condition,10,$order);
+            $condition[] = array('adminlog_time', 'between', array($time1, $time2));
+        } elseif ($time1) {
+            $condition[] = array('adminlog_time', '>=', $time1);
+        } elseif ($time2) {
+            $condition[] = array('adminlog_time', '<=', $time2);
+        }
+        $adminlog_model = model('adminlog');
+        $order = 'adminlog_id desc';
+        $adminlog_list = $adminlog_model->getAdminlogList($condition, 10, $order);
         View::assign('adminlog_list', $adminlog_list);
         View::assign('show_page', $adminlog_model->page_info->render());
-        
+
         View::assign('filtered', $condition ? 1 : 0); //是否有查询条件
-        
+
         $this->setAdminCurItem('loglist');
         return View::fetch();
     }
@@ -78,14 +76,13 @@ class Adminlog extends AdminControl
             ds_json_encode('10001', lang('param_error'));
         }
         $condition = array();
-        $condition[] = array('adminlog_id','in',$adminlog_id_array);
-        $adminlog_model=model('adminlog');
+        $condition[] = array('adminlog_id', 'in', $adminlog_id_array);
+        $adminlog_model = model('adminlog');
         if (!$adminlog_model->delAdminlog($condition)) {
-            $this->log(lang('ds_del').lang('admin_log'), 0);
+            $this->log(lang('ds_del') . lang('admin_log'), 0);
             ds_json_encode('10001', lang('ds_common_del_fail'));
-        }
-        else {
-            $this->log(lang('ds_del').lang('admin_log'), 1);
+        } else {
+            $this->log(lang('ds_del') . lang('admin_log'), 1);
             ds_json_encode('10000', lang('ds_common_del_succ'));
         }
     }
@@ -95,11 +92,11 @@ class Adminlog extends AdminControl
      */
     public function export_step1()
     {
-        $time1='';
-        $time2='';
+        $time1 = '';
+        $time2 = '';
         $condition = array();
         if (!empty(input('param.admin_name'))) {
-            $condition[]=array('admin_name','=',input('param.admin_name'));
+            $condition[] = array('admin_name', '=', input('param.admin_name'));
         }
         if (!empty(input('param.time_from'))) {
             $time1 = strtotime(input('param.time_from'));
@@ -110,16 +107,14 @@ class Adminlog extends AdminControl
                 $time2 = $time2 + 86400;
         }
         if ($time1 && $time2) {
-            $condition[] = array('createtime','between', array($time1, $time2));
-        }
-        elseif ($time1) {
-            $condition[]=array('createtime','>=', $time1);
-        }
-        elseif ($time2) {
-            $condition[]=array('createtime','<=', $time2);
+            $condition[] = array('createtime', 'between', array($time1, $time2));
+        } elseif ($time1) {
+            $condition[] = array('createtime', '>=', $time1);
+        } elseif ($time2) {
+            $condition[] = array('createtime', '<=', $time2);
         }
         if (!is_numeric(input('param.page'))) {
-            $adminlog_model=model('adminlog');
+            $adminlog_model = model('adminlog');
             $count = $adminlog_model->getAdminlogCount($condition);
             $export_list = array();
             if ($count > self::EXPORT_SIZE) {    //显示下载链接
@@ -131,16 +126,14 @@ class Adminlog extends AdminControl
                 }
                 View::assign('export_list', $export_list);
                 return View::fetch('/public/excel');
-            }
-            else {    //如果数量小,直接下载
+            } else {    //如果数量小,直接下载
                 $data = Db::name('adminlog')->where($condition)->order('adminlog_id desc')->limit(self::EXPORT_SIZE)->select()->toArray();
                 $this->createExcel($data);
             }
-        }
-        else {    //下载
+        } else {    //下载
             $limit1 = (input('param.page') - 1) * self::EXPORT_SIZE;
             $limit2 = self::EXPORT_SIZE;
-            $data = Db::name('adminlog')->where($condition)->order('adminlog_id desc')->limit($limit1,$limit2)->select()->toArray();
+            $data = Db::name('adminlog')->where($condition)->order('adminlog_id desc')->limit($limit1, $limit2)->select()->toArray();
             $this->createExcel($data);
         }
     }
@@ -152,13 +145,13 @@ class Adminlog extends AdminControl
      */
     private function createExcel($data = array())
     {
-        Lang::load(base_path() .'admin/lang/'.config('lang.default_lang').'/export.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/export.lang.php');
         $excel_obj = new \excel\Excel();
         $excel_data = array();
         //设置样式
         $excel_obj->setStyle(array(
-                                 'id' => 's_title', 'Font' => array('FontName' => lang('ds_song_typeface'), 'Size' => '12', 'Bold' => '1')
-                             ));
+            'id' => 's_title', 'Font' => array('FontName' => lang('ds_song_typeface'), 'Size' => '12', 'Bold' => '1')
+        ));
         //header
         $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('admin_log_man'));
         $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('admin_log_do'));
@@ -186,8 +179,7 @@ class Adminlog extends AdminControl
                 'text' => lang('admin_log'),
                 'url' => (string)url('Adminlog/loglist')
             )
-            );
+        );
         return $menu_array;
-
     }
-}
+}

+ 69 - 60
app/admin/controller/Adv.php

@@ -1,32 +1,35 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Adv extends AdminControl {
+class Adv extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/adv.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/adv.lang.php');
     }
 
     /**
      *
      * 管理广告位
      */
-    public function ap_manage() {
+    public function ap_manage()
+    {
         $adv_model = model('adv');
         /**
          * 多选删除广告位
@@ -39,16 +42,16 @@ class Adv extends AdminControl {
             $orderby = '';
             $search_name = trim(input('get.search_name'));
             if ($search_name != '') {
-                $condition[]=array('ap_name','like', "%" . $search_name . "%");
+                $condition[] = array('ap_name', 'like', "%" . $search_name . "%");
             }
             $ap_list = $adv_model->getAdvpositionList($condition, '10', $orderby);
             $adv_list = $adv_model->getAdvList();
             View::assign('ap_list', $ap_list);
             View::assign('adv_list', $adv_list);
             View::assign('showpage', $adv_model->page_info->render());
-            
+
             View::assign('filtered', $condition ? 1 : 0); //是否有查询条件
-            
+
             $this->setAdminCurItem('ap_manage');
             return View::fetch('ap_manage');
         }
@@ -58,12 +61,13 @@ class Adv extends AdminControl {
      *
      * 修改广告位
      */
-    public function ap_edit() {
+    public function ap_edit()
+    {
         $ap_id = intval(input('param.ap_id'));
         $adv_model = model('adv');
         if (!request()->isPost()) {
             $condition = array();
-            $condition[] = array('ap_id','=',$ap_id);
+            $condition[] = array('ap_id', '=', $ap_id);
             $ap = $adv_model->getOneAdvposition($condition);
             View::assign('ref_url', get_referer());
             View::assign('ap', $ap);
@@ -82,9 +86,9 @@ class Adv extends AdminControl {
                 $this->error($adv_validate->getError());
             }
 
-            $result = $adv_model->editAdvposition($ap_id,$param);
+            $result = $adv_model->editAdvposition($ap_id, $param);
 
-            if ($result>=0) {
+            if ($result >= 0) {
                 $this->log(lang('ap_change_succ') . '[' . input('post.ap_name') . ']', null);
                 dsLayerOpenSuccess(lang('ap_change_succ'));
             } else {
@@ -97,7 +101,8 @@ class Adv extends AdminControl {
      *
      * 新增广告位
      */
-    public function ap_add() {
+    public function ap_add()
+    {
         if (!request()->isPost()) {
             $ap['ap_isuse'] = 1;
             View::assign('ap', $ap);
@@ -121,7 +126,7 @@ class Adv extends AdminControl {
             if ($result) {
                 $this->log(lang('ap_add_succ') . '[' . input('post.ap_name') . ']', null);
                 dsLayerOpenSuccess(lang('ap_add_succ'));
-           } else {
+            } else {
                 $this->error(lang('ap_add_fail'));
             }
         }
@@ -131,7 +136,8 @@ class Adv extends AdminControl {
      *
      * 删除广告位
      */
-    public function ap_del() {
+    public function ap_del()
+    {
         $adv_model = model('adv');
         /**
          * 删除一个广告
@@ -151,21 +157,22 @@ class Adv extends AdminControl {
      *
      * 广告管理
      */
-    public function adv() {
+    public function adv()
+    {
         $adv_model = model('adv');
 
         $ap_id = intval(input('param.ap_id'));
         if (!request()->isPost()) {
             $condition = array();
             if ($ap_id) {
-                 $condition[] = array('ap_id','=',$ap_id);
+                $condition[] = array('ap_id', '=', $ap_id);
             }
             $adv_info = $adv_model->getAdvList($condition, 20, '', '');
             View::assign('adv_info', $adv_info);
             $ap_list = $adv_model->getAdvpositionList();
             View::assign('ap_list', $ap_list);
             if ($ap_id) {
-                $ap_condition=array();
+                $ap_condition = array();
                 $ap_condition['ap_id'] = $ap_id;
                 $ap = $adv_model->getOneAdvposition($ap_condition);
                 View::assign('ap_name', $ap['ap_name']);
@@ -174,7 +181,7 @@ class Adv extends AdminControl {
             }
 
             View::assign('show_page', $adv_model->page_info->render());
-            
+
             View::assign('filtered', $condition ? 1 : 0); //是否有查询条件
             $this->setAdminCurItem('adv');
             return View::fetch('adv_index');
@@ -184,7 +191,8 @@ class Adv extends AdminControl {
     /**
      * 管理员添加广告
      */
-    public function adv_add() {
+    public function adv_add()
+    {
         $adv_model = model('adv');
         if (!request()->isPost()) {
 
@@ -210,14 +218,13 @@ class Adv extends AdminControl {
 
             //上传文件保存路径
             if (!empty($_FILES['adv_code']['name'])) {
-                $res=ds_upload_pic(ATTACH_ADV,'adv_code');
-                if($res['code']){
-                    $file_name=$res['data']['file_name'];
+                $res = ds_upload_pic(ATTACH_ADV, 'adv_code');
+                if ($res['code']) {
+                    $file_name = $res['data']['file_name'];
                     $insert_array['adv_code'] = $file_name;
-                }else{
+                } else {
                     $this->error($res['msg']);
                 }
-
             }
 
             $adv_validate = ds_validate('adv');
@@ -231,7 +238,7 @@ class Adv extends AdminControl {
             if ($result) {
                 $this->log(lang('adv_add_succ') . '[' . input('post.adv_name') . ']', null);
                 dsLayerOpenSuccess(lang('adv_add_succ'));
-//                $this->success(lang('adv_add_succ'), (string)url('Adv/adv', ['ap_id' => input('post.ap_id')]));
+                //                $this->success(lang('adv_add_succ'), (string)url('Adv/adv', ['ap_id' => input('post.ap_id')]));
             } else {
                 $this->error(lang('adv_add_fail'));
             }
@@ -242,12 +249,13 @@ class Adv extends AdminControl {
      *
      * 修改广告
      */
-    public function adv_edit() {
+    public function adv_edit()
+    {
         $adv_id = intval(input('param.adv_id'));
         $adv_model = model('adv');
         //获取指定广告
         $condition = array();
-        $condition[] = array('adv_id','=',$adv_id);
+        $condition[] = array('adv_id', '=', $adv_id);
         $adv = $adv_model->getOneAdv($condition);
         if (!request()->isPost()) {
             //获取广告列表
@@ -268,21 +276,19 @@ class Adv extends AdminControl {
 
 
             if (!empty($_FILES['adv_code']['name'])) {
-		//上传文件保存路径
+                //上传文件保存路径
                 $upload_file = BASE_UPLOAD_PATH . DIRECTORY_SEPARATOR . ATTACH_ADV;
-                $res=ds_upload_pic(ATTACH_ADV,'adv_code');
-                if($res['code']){
-					//还需删除原来图片
+                $res = ds_upload_pic(ATTACH_ADV, 'adv_code');
+                if ($res['code']) {
+                    //还需删除原来图片
                     if (!empty($adv['adv_code'])) {
                         @unlink($upload_file . DIRECTORY_SEPARATOR . $adv['adv_code']);
                     }
-                    $file_name=$res['data']['file_name'];
+                    $file_name = $res['data']['file_name'];
                     $param['adv_code'] = $file_name;
-                }else{
+                } else {
                     $this->error($res['msg']);
                 }
-                
-
             }
 
             $adv_validate = ds_validate('adv');
@@ -290,12 +296,12 @@ class Adv extends AdminControl {
                 $this->error($adv_validate->getError());
             }
 
-            $result = $adv_model->editAdv($adv_id,$param);
+            $result = $adv_model->editAdv($adv_id, $param);
 
-            if ($result>=0) {
+            if ($result >= 0) {
                 $this->log(lang('adv_change_succ') . '[' . input('post.ap_name') . ']', null);
                 dsLayerOpenSuccess(lang('adv_change_succ'));
-//               $this->success(lang('adv_change_succ'), input('post.ref_url'));
+                //               $this->success(lang('adv_change_succ'), input('post.ref_url'));
             } else {
                 $this->error(lang('adv_change_fail'));
             }
@@ -306,7 +312,8 @@ class Adv extends AdminControl {
      *
      * 删除广告
      */
-    public function adv_del() {
+    public function adv_del()
+    {
         $adv_model = model('adv');
         /**
          * 删除一个广告
@@ -326,13 +333,15 @@ class Adv extends AdminControl {
      *
      * 获取UNIX时间戳
      */
-    public function getunixtime($time) {
+    public function getunixtime($time)
+    {
         $array = explode("-", $time);
         $unix_time = mktime(0, 0, 0, $array[1], $array[2], $array[0]);
         return $unix_time;
     }
 
-    public function ajax() {
+    public function ajax()
+    {
         $adv_model = model('adv');
         switch (input('get.branch')) {
             case 'ap_branch':
@@ -340,25 +349,26 @@ class Adv extends AdminControl {
                 $value = trim(input('param.value'));
                 $ap_id = intval(input('param.id'));
                 $param[$column] = trim($value);
-                $result = $adv_model->editAdvposition($ap_id,$param);
+                $result = $adv_model->editAdvposition($ap_id, $param);
                 break;
-            //ADV数据表更新
+                //ADV数据表更新
             case 'adv_branch':
                 $column = trim(input('param.column'));
                 $value = trim(input('param.value'));
                 $adv_id = intval(input('param.id'));
                 $param[$column] = trim($value);
-                $result = $adv_model->editAdv($adv_id,$param);
+                $result = $adv_model->editAdv($adv_id, $param);
                 break;
         }
-        if($result>=0){
+        if ($result >= 0) {
             echo 'true';
-        }else{
+        } else {
             echo false;
         }
     }
 
-    function adv_template() {
+    function adv_template()
+    {
         $pages = $this->_get_editable_pages();
         View::assign('pages', $pages);
         $this->setAdminCurItem('adv_template');
@@ -368,17 +378,19 @@ class Adv extends AdminControl {
     /**
      *    获取可以编辑的页面列表
      */
-    function _get_editable_pages() {
+    function _get_editable_pages()
+    {
         return array(
-            lang('homepage') => (string)url('home/Index/index',['edit_ad'=>1]),
-            lang('flea') => (string)url('home/Flea/index',['edit_ad'=>1]),
+            lang('homepage') => (string)url('home/Index/index', ['edit_ad' => 1]),
+            lang('flea') => (string)url('home/Flea/index', ['edit_ad' => 1]),
         );
     }
 
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'ap_manage',
@@ -394,13 +406,10 @@ class Adv extends AdminControl {
         $menu_array[] = array(
             'name' => 'adv_add',
             'text' => lang('adv_add'),
-            'url' => "javascript:dsLayerOpen('".(string)url('Adv/adv_add', ['ap_id' => input('param.ap_id')])."','".lang('adv_add')."')"
+            'url' => "javascript:dsLayerOpen('" . (string)url('Adv/adv_add', ['ap_id' => input('param.ap_id')]) . "','" . lang('adv_add') . "')"
         );
 
 
         return $menu_array;
     }
-
 }
-
-?>

+ 77 - 66
app/admin/controller/Appadv.php

@@ -1,26 +1,29 @@
 <?php
+
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Appadv extends AdminControl {
+class Appadv extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/adv.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/adv.lang.php');
     }
-    
+
     function index()
     {
         /**
@@ -29,18 +32,18 @@ class Appadv extends AdminControl {
         $condition = array();
         $search_name = trim(input('get.search_name'));
         if ($search_name != '') {
-            $condition[] = array('ap_name','=',$search_name);
+            $condition[] = array('ap_name', '=', $search_name);
         }
         $appadv_model = model('appadv');
-        $ap_list= $appadv_model->getAppadvpositionList($condition,'10');
+        $ap_list = $appadv_model->getAppadvpositionList($condition, '10');
         $adv_list = $appadv_model->getAppadvList();
-        
-        View::assign('ap_list',$ap_list);
-        View::assign('adv_list',$adv_list);
+
+        View::assign('ap_list', $ap_list);
+        View::assign('adv_list', $adv_list);
         View::assign('showpage', $appadv_model->page_info->render());
-        
+
         View::assign('filtered', $condition ? 1 : 0); //是否有查询条件
-        
+
         $this->setAdminCurItem('index');
         return View::fetch();
     }
@@ -49,10 +52,11 @@ class Appadv extends AdminControl {
      *
      * 新增广告位
      */
-    public function ap_add() {
+    public function ap_add()
+    {
         if (!request()->isPost()) {
-            $ap['ap_isuse']=1;
-            View::assign('ap',$ap);
+            $ap['ap_isuse'] = 1;
+            View::assign('ap', $ap);
             return View::fetch('ap_form');
         } else {
             $appadv_model = model('appadv');
@@ -71,7 +75,7 @@ class Appadv extends AdminControl {
 
             if ($result) {
                 $this->log(lang('ap_add_succ') . '[' . input('post.ap_name') . ']', null);
-                dsLayerOpenSuccess(lang('ap_add_succ'),(string)url('Appadv/index'));
+                dsLayerOpenSuccess(lang('ap_add_succ'), (string)url('Appadv/index'));
             } else {
                 $this->error(lang('ap_add_fail'));
             }
@@ -83,7 +87,8 @@ class Appadv extends AdminControl {
      *
      * 删除广告位
      */
-    public function ap_del() {
+    public function ap_del()
+    {
         $appadv_model = model('appadv');
         /**
          * 删除一个广告位
@@ -102,7 +107,8 @@ class Appadv extends AdminControl {
      *
      * 删除广告
      */
-    public function adv_del() {
+    public function adv_del()
+    {
         $appadv_model = model('appadv');
         /**
          * 删除一个广告
@@ -122,12 +128,13 @@ class Appadv extends AdminControl {
      *
      * 修改广告
      */
-    public function adv_edit() {
+    public function adv_edit()
+    {
         $adv_id = intval(input('param.adv_id'));
         $appadv_model = model('appadv');
         //获取指定广告
         $condition = array();
-        $condition[] = array('adv_id','=',$adv_id);
+        $condition[] = array('adv_id', '=', $adv_id);
         $adv = $appadv_model->getOneAppadv($condition);
         if (!request()->isPost()) {
             //获取广告列表
@@ -150,18 +157,17 @@ class Appadv extends AdminControl {
             if (!empty($_FILES['adv_code']['name'])) {
                 //上传文件保存路径
                 $upload_file = BASE_UPLOAD_PATH . '/' . ATTACH_APPADV;
-                $res=ds_upload_pic(ATTACH_APPADV,'adv_code');
-                if($res['code']){
+                $res = ds_upload_pic(ATTACH_APPADV, 'adv_code');
+                if ($res['code']) {
                     //还需删除原来图片
                     if (!empty($adv['adv_code'])) {
                         @unlink($upload_file . DIRECTORY_SEPARATOR . $adv['adv_code']);
                     }
-                    $file_name=$res['data']['file_name'];
+                    $file_name = $res['data']['file_name'];
                     $param['adv_code'] = $file_name;
-                }else{
+                } else {
                     $this->error($res['msg']);
                 }
-                
             }
 
             $adv_validate = ds_validate('adv');
@@ -169,18 +175,19 @@ class Appadv extends AdminControl {
                 $this->error($adv_validate->getError());
             }
 
-            $result = $appadv_model->editAppadv($adv_id,$param);
+            $result = $appadv_model->editAppadv($adv_id, $param);
 
-            if ($result>=0) {
+            if ($result >= 0) {
                 $this->log(lang('adv_change_succ') . '[' . input('post.ap_name') . ']', null);
-                dsLayerOpenSuccess(lang('adv_change_succ'),input('post.ref_url'));
+                dsLayerOpenSuccess(lang('adv_change_succ'), input('post.ref_url'));
             } else {
                 $this->error(lang('adv_change_fail'));
             }
         }
     }
-    
-    public function ajax() {
+
+    public function ajax()
+    {
         $appadv_model = model('appadv');
         switch (input('get.branch')) {
             case 'ap_branch':
@@ -188,54 +195,55 @@ class Appadv extends AdminControl {
                 $value = input('param.value');
                 $ap_id = intval(input('param.id'));
                 $param[$column] = trim($value);
-                $result = $appadv_model->editAppadvposition($ap_id,$param);
+                $result = $appadv_model->editAppadvposition($ap_id, $param);
                 break;
-            //ADV数据表更新
+                //ADV数据表更新
             case 'adv_branch':
                 $column = input('param.column');
                 $value = input('param.value');
                 $adv_id = intval(input('param.id'));
                 $param[$column] = trim($value);
-                $result = $appadv_model->editAppAdv($adv_id,$param);
+                $result = $appadv_model->editAppAdv($adv_id, $param);
                 break;
         }
-        if($result>=0){
+        if ($result >= 0) {
             echo 'true';
-        }else{
+        } else {
             echo false;
         }
     }
-    
-    
+
+
     /**
      *
      * 广告管理
      */
-    public function adv() {
+    public function adv()
+    {
         $appadv_model = model('appadv');
         $ap_id = intval(input('param.ap_id'));
         if (!request()->isPost()) {
             $condition = array();
             if ($ap_id) {
-                $condition[] = array('ap_id','=',$ap_id);
+                $condition[] = array('ap_id', '=', $ap_id);
             }
             $adv_info = $appadv_model->getAppadvList($condition, 20, '', '');
             View::assign('adv_info', $adv_info);
             $ap_list = $appadv_model->getAppadvpositionList();
             View::assign('ap_list', $ap_list);
             if ($ap_id) {
-                $ap_condition=array();
-                $ap_condition[] = array('ap_id','=',$ap_id);
-                $ap = $appadv_model->getOneAppadvposition($ap_condition); 
+                $ap_condition = array();
+                $ap_condition[] = array('ap_id', '=', $ap_id);
+                $ap = $appadv_model->getOneAppadvposition($ap_condition);
                 View::assign('ap_name', $ap['ap_name']);
             } else {
                 View::assign('ap_name', '');
             }
 
             View::assign('show_page', $appadv_model->page_info->render());
-            
+
             View::assign('filtered', $condition ? 1 : 0); //是否有查询条件
-            
+
             $this->setAdminCurItem('adv');
             return View::fetch('adv_index');
         }
@@ -244,7 +252,8 @@ class Appadv extends AdminControl {
     /**
      * 管理员添加广告
      */
-    public function appadv_add() {
+    public function appadv_add()
+    {
         $appadv_model = model('appadv');
         if (!request()->isPost()) {
 
@@ -255,7 +264,7 @@ class Appadv extends AdminControl {
                 'adv_enabled' => '1',
                 'adv_startdate' => TIMESTAMP,
                 'adv_enddate' => TIMESTAMP + 24 * 3600 * 365,
-                'adv_type'=>''
+                'adv_type' => ''
             );
             View::assign('adv', $adv);
             return View::fetch('adv_form');
@@ -272,15 +281,15 @@ class Appadv extends AdminControl {
             //上传文件保存路径
             $upload_file = BASE_UPLOAD_PATH . '/' . ATTACH_APPADV;
             if (!empty($_FILES['adv_code']['name'])) {
-                $res=ds_upload_pic(ATTACH_APPADV,'adv_code');
-                if($res['code']){
+                $res = ds_upload_pic(ATTACH_APPADV, 'adv_code');
+                if ($res['code']) {
                     //还需删除原来图片
                     if (!empty($adv['adv_code'])) {
                         @unlink($upload_file . DIRECTORY_SEPARATOR . $adv['adv_code']);
                     }
-                    $file_name=$res['data']['file_name'];
+                    $file_name = $res['data']['file_name'];
                     $insert_array['adv_code'] = $file_name;
-                }else{
+                } else {
                     $this->error($res['msg']);
                 }
             }
@@ -293,12 +302,12 @@ class Appadv extends AdminControl {
             //广告信息入库
             $result = $appadv_model->addAppadv($insert_array);
             //更新相应广告位所拥有的广告数量
-            $ap_condition=array();
-            $ap_condition['ap_id']=intval(input('post.ap_id'));
+            $ap_condition = array();
+            $ap_condition['ap_id'] = intval(input('post.ap_id'));
             $appadv_model->getOneAppadvposition($ap_condition);
             if ($result) {
                 $this->log(lang('adv_add_succ') . '[' . input('post.adv_name') . ']', null);
-                dsLayerOpenSuccess(lang('adv_add_succ'),(string)url('Appadv/adv', ['ap_id' => input('post.ap_id')]));
+                dsLayerOpenSuccess(lang('adv_add_succ'), (string)url('Appadv/adv', ['ap_id' => input('post.ap_id')]));
             } else {
                 $this->error(lang('adv_add_fail'));
             }
@@ -309,13 +318,14 @@ class Appadv extends AdminControl {
      *
      * 修改广告位
      */
-    public function ap_edit() {
+    public function ap_edit()
+    {
         $ap_id = intval(input('param.ap_id'));
 
         $appadv_model = model('appadv');
         if (!request()->isPost()) {
             $condition = array();
-            $condition[] = array('ap_id','=',$ap_id);
+            $condition[] = array('ap_id', '=', $ap_id);
             $ap = $appadv_model->getOneAppadvposition($condition);
             View::assign('ref_url', get_referer());
             View::assign('ap', $ap);
@@ -333,11 +343,11 @@ class Appadv extends AdminControl {
                 $this->error($adv_validate->getError());
             }
 
-            $result = $appadv_model->editAppadvposition($ap_id,$param);
+            $result = $appadv_model->editAppadvposition($ap_id, $param);
 
-            if ($result>=0) {
+            if ($result >= 0) {
                 $this->log(lang('ap_change_succ') . '[' . input('post.ap_name') . ']', null);
-                dsLayerOpenSuccess(lang('ap_change_succ'),input('post.ref_url'));
+                dsLayerOpenSuccess(lang('ap_change_succ'), input('post.ref_url'));
             } else {
                 $this->error(lang('ap_change_fail'));
             }
@@ -347,7 +357,8 @@ class Appadv extends AdminControl {
      *
      * 获取UNIX时间戳
      */
-    public function getunixtime($time) {
+    public function getunixtime($time)
+    {
         $array = explode("-", $time);
         $unix_time = mktime(0, 0, 0, $array[1], $array[2], $array[0]);
         return $unix_time;
@@ -355,7 +366,8 @@ class Appadv extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -371,9 +383,8 @@ class Appadv extends AdminControl {
         $menu_array[] = array(
             'name' => 'adv_add',
             'text' => lang('adv_add'),
-            'url' => "javascript:dsLayerOpen('".(string)url('Appadv/appadv_add', ['ap_id' => input('param.ap_id')])."','".lang('adv_add')."')"
+            'url' => "javascript:dsLayerOpen('" . (string)url('Appadv/appadv_add', ['ap_id' => input('param.ap_id')]) . "','" . lang('adv_add') . "')"
         );
         return $menu_array;
     }
-    
 }

+ 21 - 18
app/admin/controller/Arrivalnotice.php

@@ -1,43 +1,45 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Arrivalnotice extends AdminControl
 {
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/arrivalnotice.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/arrivalnotice.lang.php');
     }
 
     /**
      * 到货通知列表
      * @return mixed
      */
-    public function index() {
+    public function index()
+    {
         $arrivalnotice_model = model('arrivalnotice');
         $condition = array();
         if (!empty(input('param.search_goods'))) {
-            $condition[]=array('goods_name','like', '%' . input('param.search_goods') . '%');
+            $condition[] = array('goods_name', 'like', '%' . input('param.search_goods') . '%');
         }
         if (!empty(input('param.search_state'))) {
-            $condition[]=array('arrivalnotice_state','=',input('param.search_state'));
+            $condition[] = array('arrivalnotice_state', '=', input('param.search_state'));
         }
-        $arrivalnotice_list = $arrivalnotice_model->getArrivalNoticeList($condition,'','','',5);
-        foreach ($arrivalnotice_list as $key => $value){
-            $arrivalnotice_list[$key]['member_name'] = model('member')->getMemberInfo(['member_id'=>$value['member_id']],'member_name')['member_name'];
+        $arrivalnotice_list = $arrivalnotice_model->getArrivalNoticeList($condition, '', '', '', 5);
+        foreach ($arrivalnotice_list as $key => $value) {
+            $arrivalnotice_list[$key]['member_name'] = model('member')->getMemberInfo(['member_id' => $value['member_id']], 'member_name')['member_name'];
         }
 
         View::assign('arrivalnotice_list', $arrivalnotice_list);
@@ -50,21 +52,22 @@ class Arrivalnotice extends AdminControl
     /**
      * 到货通知删除
      */
-    public function arrivalnotice_del(){
+    public function arrivalnotice_del()
+    {
         $arrivalnotice_id = input('param.arrivalnotice_id');
         $arrivalnotice_id_array = ds_delete_param($arrivalnotice_id);
         if ($arrivalnotice_id_array == FALSE) {
             ds_json_encode('10001', lang('param_error'));
         }
         $condition = array();
-        $condition[] = array('arrivalnotice_id','in',$arrivalnotice_id_array);
+        $condition[] = array('arrivalnotice_id', 'in', $arrivalnotice_id_array);
         $arrivalnotice_model = model('arrivalnotice');
         //批量删除
         $result = $arrivalnotice_model->delArrivalNotice($condition);
-        if ($result){
+        if ($result) {
             ds_json_encode(10000, lang('ds_common_del_succ'));
-        }else{
+        } else {
             ds_json_encode(10001, lang('ds_common_del_fail'));
         }
     }
-}
+}

+ 59 - 51
app/admin/controller/Article.php

@@ -1,28 +1,31 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Article extends AdminControl {
+class Article extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/article.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/article.lang.php');
     }
 
-    public function index() {
+    public function index()
+    {
 
         /**
          * 检索条件
@@ -30,11 +33,11 @@ class Article extends AdminControl {
         $condition = array();
         $search_ac_id = intval(input('param.search_ac_id'));
         if ($search_ac_id) {
-            $condition[]=array('ac_id','=',$search_ac_id);
+            $condition[] = array('ac_id', '=', $search_ac_id);
         }
         $search_title = trim(input('param.search_title'));
         if ($search_title) {
-            $condition[]=array('article_title','like', "%" . $search_title . "%");
+            $condition[] = array('article_title', 'like', "%" . $search_title . "%");
         }
         $article_model = model('article');
         $article_list = $article_model->getArticleList($condition, 10);
@@ -84,14 +87,15 @@ class Article extends AdminControl {
         View::assign('search_title', $search_title);
         View::assign('search_ac_id', $search_ac_id);
         View::assign('parent_list', $parent_list);
-        
+
         View::assign('filtered', $condition ? 1 : 0); //是否有查询条件
-        
+
         $this->setAdminCurItem('index');
         return View::fetch();
     }
 
-    public function add() {
+    public function add()
+    {
         if (!(request()->isPost())) {
             $article = [
                 'article_id' => 0,
@@ -136,17 +140,17 @@ class Article extends AdminControl {
                     foreach ($file_id_array as $k => $v) {
                         $update_array = array();
                         $update_array['item_id'] = $article_id;
-                        $upload_model->editUpload($update_array,array(array('upload_id','=',intval($v))));
+                        $upload_model->editUpload($update_array, array(array('upload_id', '=', intval($v))));
                         unset($update_array);
                     }
                 }
                 //上传文章封面
                 if (!empty($_FILES['_pic']['name'])) {
-                    $res=ds_upload_pic(ATTACH_ARTICLE,'_pic');
-                    if($res['code']){
-                        $article_pic=$res['data']['file_name'];
+                    $res = ds_upload_pic(ATTACH_ARTICLE, '_pic');
+                    if ($res['code']) {
+                        $article_pic = $res['data']['file_name'];
                         model('article')->editArticle(array('article_pic' => $article_pic), $article_id);
-                    }else{
+                    } else {
                         $this->error($res['msg'], (string) url('Article/edit', ['article_id' => $article_id]));
                     }
                 }
@@ -157,24 +161,25 @@ class Article extends AdminControl {
         }
     }
 
-    public function edit() {
+    public function edit()
+    {
         $art_id = intval(input('param.article_id'));
-        if ($art_id<=0) {
+        if ($art_id <= 0) {
             $this->error(lang('param_error'));
         }
         $condition = array();
-        $condition[] = array('article_id','=',$art_id);
+        $condition[] = array('article_id', '=', $art_id);
         $article = model('article')->getOneArticle($condition);
-        if(!$article){
+        if (!$article) {
             $this->error(lang('ds_no_record'));
         }
         if (!request()->isPost()) {
             View::assign('article', $article);
             $articleclass_model = model('articleclass');
-            $cate_list=$articleclass_model->getTreeClassList(2);
+            $cate_list = $articleclass_model->getTreeClassList(2);
             View::assign('ac_list', $cate_list);
             //附属图片
-            $article_pic_list=model('upload')->getUploadList(array('upload_type'=>'1','item_id'=>$art_id));
+            $article_pic_list = model('upload')->getUploadList(array('upload_type' => '1', 'item_id' => $art_id));
             View::assign('file_upload', $article_pic_list);
             $this->setAdminCurItem('edit');
             return View::fetch('form');
@@ -195,15 +200,15 @@ class Article extends AdminControl {
 
             //上传文章封面
             if (!empty($_FILES['_pic']['name'])) {
-                $res=ds_upload_pic(ATTACH_ARTICLE,'_pic');
-                if($res['code']){
-                    $file_name=$res['data']['file_name'];
+                $res = ds_upload_pic(ATTACH_ARTICLE, '_pic');
+                if ($res['code']) {
+                    $file_name = $res['data']['file_name'];
                     //删除原图
-                    if($article['article_pic']){
+                    if ($article['article_pic']) {
                         @unlink(BASE_UPLOAD_PATH . DIRECTORY_SEPARATOR . ATTACH_ARTICLE . DIRECTORY_SEPARATOR . $article['article_pic']);
                     }
                     $data['article_pic'] = $file_name;
-                }else{
+                } else {
                     $this->error($res['msg'], (string)url('Article/edit', ['article_id' => $art_id]));
                 }
             }
@@ -217,23 +222,24 @@ class Article extends AdminControl {
         }
     }
 
-    public function drop() {
+    public function drop()
+    {
         $article_id = input('param.article_id');
         if (empty($article_id)) {
             ds_json_encode(10001, lang('param_error'));
         }
         $condition = array();
-        $condition[] = array('article_id','=',$article_id);
+        $condition[] = array('article_id', '=', $article_id);
         $article = model('article')->getOneArticle($condition);
-        if(!$article){
+        if (!$article) {
             ds_json_encode(10001, lang('ds_no_record'));
         }
         //删除图片
-        if($article['article_pic']){
+        if ($article['article_pic']) {
             @unlink(BASE_UPLOAD_PATH . DIRECTORY_SEPARATOR . ATTACH_ARTICLE . DIRECTORY_SEPARATOR . $article['article_pic']);
         }
-        $article_pic_list=model('upload')->getUploadList(array('upload_type'=>'1','item_id'=>$article_id));
-        foreach($article_pic_list as $article_pic){
+        $article_pic_list = model('upload')->getUploadList(array('upload_type' => '1', 'item_id' => $article_id));
+        foreach ($article_pic_list as $article_pic) {
             @unlink(BASE_UPLOAD_PATH . DIRECTORY_SEPARATOR . ATTACH_ARTICLE . DIRECTORY_SEPARATOR . $article_pic['file_name']);
         }
         $result = model('article')->delArticle($article_id);
@@ -247,17 +253,18 @@ class Article extends AdminControl {
     /**
      * 文章图片上传
      */
-    public function article_pic_upload() {
+    public function article_pic_upload()
+    {
         $file_name = '';
         $file_object = request()->file('fileupload');
         if ($file_object) {
-                $res=ds_upload_pic(ATTACH_ARTICLE,'fileupload');
-                if($res['code']){
-                    $file_name=$res['data']['file_name'];
-                }else{
-                    echo $res['msg'];
-                    exit;
-                }
+            $res = ds_upload_pic(ATTACH_ARTICLE, 'fileupload');
+            if ($res['code']) {
+                $file_name = $res['data']['file_name'];
+            } else {
+                echo $res['msg'];
+                exit;
+            }
         } else {
             echo 'error';
             exit;
@@ -281,7 +288,7 @@ class Article extends AdminControl {
             $data = array();
             $data['file_id'] = $result;
             $data['file_name'] = $file_name;
-            $data['file_path'] = ds_get_pic(ATTACH_ARTICLE , $file_name);
+            $data['file_path'] = ds_get_pic(ATTACH_ARTICLE, $file_name);
             /**
              * 整理为json格式
              */
@@ -293,9 +300,10 @@ class Article extends AdminControl {
     /**
      * ajax操作
      */
-    public function ajax() {
+    public function ajax()
+    {
         switch (input('param.branch')) {
-            /**
+                /**
              * 删除文章图片
              */
             case 'del_file_upload':
@@ -310,7 +318,7 @@ class Article extends AdminControl {
                      * 删除信息
                      */
                     $condition = array();
-                    $condition[] = array('upload_id','=',intval(input('param.file_id')));
+                    $condition[] = array('upload_id', '=', intval(input('param.file_id')));
                     $upload_model->delUpload($condition);
                     echo 'true';
                     exit;
@@ -324,7 +332,8 @@ class Article extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -349,5 +358,4 @@ class Article extends AdminControl {
         }
         return $menu_array;
     }
-
-}
+}

+ 46 - 39
app/admin/controller/Articleclass.php

@@ -1,31 +1,34 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Articleclass extends AdminControl {
+class Articleclass extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/articleclass.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/articleclass.lang.php');
     }
 
     /**
      * 文章管理
      */
-    public function index() {
+    public function index()
+    {
         $articleclass_model = model('articleclass');
         /**
          * 父ID
@@ -67,7 +70,8 @@ class Articleclass extends AdminControl {
     /**
      * 文章分类 新增
      */
-    public function article_class_add() {
+    public function article_class_add()
+    {
         $articleclass_model = model('articleclass');
         if (request()->isPost()) {
             /**
@@ -114,11 +118,12 @@ class Articleclass extends AdminControl {
     /**
      * 文章分类编辑
      */
-    public function article_class_edit() {
+    public function article_class_edit()
+    {
         $articleclass_model = model('articleclass');
-        
+
         $ac_id = intval(input('param.ac_id'));
-        
+
         if (request()->isPost()) {
             /**
              * 验证
@@ -136,8 +141,8 @@ class Articleclass extends AdminControl {
                 $update_array['ac_name'] = trim(input('post.ac_name'));
                 $update_array['ac_sort'] = trim(input('post.ac_sort'));
 
-                $result = $articleclass_model->editArticleclass($update_array,$ac_id);
-                if ($result>=0) {
+                $result = $articleclass_model->editArticleclass($update_array, $ac_id);
+                if ($result >= 0) {
                     $this->log(lang('ds_edit') . lang('article_class_index_class') . '[' . input('post.ac_name') . ']', 1);
                     dsLayerOpenSuccess(lang('ds_common_op_succ'));
                 } else {
@@ -158,17 +163,18 @@ class Articleclass extends AdminControl {
     /**
      * 删除分类
      */
-    public function article_class_del() {
+    public function article_class_del()
+    {
         $articleclass_model = model('articleclass');
-        
+
         $ac_id = input('param.ac_id');
         $ac_id_array = ds_delete_param($ac_id);
         if ($ac_id_array === FALSE) {
             ds_json_encode('10001', lang('param_error'));
         }
-        
 
-            $del_array = $articleclass_model->getChildClass($ac_id_array);
+
+        $del_array = $articleclass_model->getChildClass($ac_id_array);
         if (is_array($del_array)) {
             foreach ($del_array as $k => $v) {
                 $articleclass_model->delArticleclass($v['ac_id']);
@@ -181,23 +187,24 @@ class Articleclass extends AdminControl {
     /**
      * ajax操作
      */
-    public function ajax() {
+    public function ajax()
+    {
         switch (input('param.branch')) {
-            /**
+                /**
              * 分类:验证是否有重复的名称
              */
             case 'article_class_name':
                 $articleclass_model = model('articleclass');
                 $class_array = $articleclass_model->getOneArticleclass(intval(input('param.id')));
 
-                $condition[]=array('ac_name','=',trim(input('param.value')));
-                $condition[]=array('ac_parent_id','=',$class_array['ac_parent_id']);
-                $condition[]=array('ac_id','<>',intval(input('param.id')));
+                $condition[] = array('ac_name', '=', trim(input('param.value')));
+                $condition[] = array('ac_parent_id', '=', $class_array['ac_parent_id']);
+                $condition[] = array('ac_id', '<>', intval(input('param.id')));
                 $class_list = $articleclass_model->getArticleclassList($condition);
                 if (empty($class_list)) {
                     $update_array = array();
                     $update_array['ac_name'] = trim(input('param.value'));
-                    $articleclass_model->editArticleclass($update_array,input('param.id'));
+                    $articleclass_model->editArticleclass($update_array, input('param.id'));
                     echo 'true';
                     exit;
                 } else {
@@ -205,25 +212,25 @@ class Articleclass extends AdminControl {
                     exit;
                 }
                 break;
-            /**
-             * 分类: 排序 显示 设置
-             */
+                /**
+                 * 分类: 排序 显示 设置
+                 */
             case 'article_class_sort':
                 $articleclass_model = model('articleclass');
                 $update_array = array();
                 $update_array[input('param.column')] = trim(input('param.value'));
-                $result = $articleclass_model->editArticleclass($update_array,intval(input('param.id')));
+                $result = $articleclass_model->editArticleclass($update_array, intval(input('param.id')));
                 echo 'true';
                 exit;
                 break;
-            /**
-             * 分类:添加、修改操作中 检测类别名称是否有重复
-             */
+                /**
+                 * 分类:添加、修改操作中 检测类别名称是否有重复
+                 */
             case 'check_class_name':
                 $articleclass_model = model('articleclass');
-                $condition[]=array('ac_name','=',trim(input('param.ac_name')));
-//                $condition[] = array('ac_parent_id','=',intval(input('param.ac_parent_id')));
-                $condition[]=array('ac_id','<>',intval(input('param.ac_id')));
+                $condition[] = array('ac_name', '=', trim(input('param.ac_name')));
+                //                $condition[] = array('ac_parent_id','=',intval(input('param.ac_parent_id')));
+                $condition[] = array('ac_id', '<>', intval(input('param.ac_id')));
                 $class_list = $articleclass_model->getArticleclassList($condition);
                 if (empty($class_list)) {
                     echo 'true';
@@ -236,20 +243,20 @@ class Articleclass extends AdminControl {
         }
     }
 
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
-                'text' =>lang('ds_manage'),
+                'text' => lang('ds_manage'),
                 'url' => (string)url('Articleclass/index')
             ),
             array(
                 'name' => 'add',
                 'text' => lang('ds_new'),
-                'url' =>"javascript:dsLayerOpen('".(string)url('Articleclass/article_class_add')."','".lang('article_class_add')."')",
+                'url' => "javascript:dsLayerOpen('" . (string)url('Articleclass/article_class_add') . "','" . lang('article_class_add') . "')",
             )
         );
         return $menu_array;
     }
-
 }

+ 91 - 87
app/admin/controller/Bill.php

@@ -1,19 +1,20 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Db;
 use think\facade\Lang;
 use app\common\model\Storemoneylog;
+
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Bill extends AdminControl
@@ -22,7 +23,7 @@ class Bill extends AdminControl
     public function initialize()
     {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/bill.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/bill.lang.php');
     }
 
     /**
@@ -35,7 +36,7 @@ class Bill extends AdminControl
         $condition = array();
         $query_year = input('get.query_year');
         if (preg_match('/^\d{4}$/', $query_year, $match)) {
-            $condition[]=array('os_month','like',$query_year.'%');
+            $condition[] = array('os_month', 'like', $query_year . '%');
         }
         $bill_model = model('bill');
         $bill_list = $bill_model->getOrderstatisList($condition, '*', 12, 'os_month desc');
@@ -60,18 +61,18 @@ class Bill extends AdminControl
 
         $bill_state = input('get.bill_state');
         if (is_numeric($bill_state)) {
-            $condition[] = array('ob_state','=',intval($bill_state));
+            $condition[] = array('ob_state', '=', intval($bill_state));
         }
         $query_store = input('get.query_store');
         if (preg_match('/^\d{1,8}$/', $query_store)) {
-            $condition[] = array('ob_store_id','=',$query_store);
+            $condition[] = array('ob_store_id', '=', $query_store);
         } elseif ($query_store != '') {
-            $condition[] = array('ob_store_name','=',$query_store);
+            $condition[] = array('ob_store_name', '=', $query_store);
         }
         $os_month = input('get.os_month');
-        if($os_month){
-            $condition[]=array('ob_startdate','>=',strtotime($os_month.'01 0:0:0'));
-            $condition[]=array('ob_enddate','<',strtotime($os_month.'01 23:59:59 +1 month -1 day'));
+        if ($os_month) {
+            $condition[] = array('ob_startdate', '>=', strtotime($os_month . '01 0:0:0'));
+            $condition[] = array('ob_enddate', '<', strtotime($os_month . '01 23:59:59 +1 month -1 day'));
         }
         $bill_list = $bill_model->getOrderbillList($condition, '*', 30, 'ob_no desc');
         View::assign('bill_list', $bill_list);
@@ -98,9 +99,9 @@ class Bill extends AdminControl
         }
 
         $order_condition = array();
-        $order_condition[] = array('ob_no','=',$ob_no);
-        $order_condition[] = array('order_state','=',ORDER_STATE_SUCCESS);
-        $order_condition[] = array('store_id','=',$bill_info['ob_store_id']);
+        $order_condition[] = array('ob_no', '=', $ob_no);
+        $order_condition[] = array('order_state', '=', ORDER_STATE_SUCCESS);
+        $order_condition[] = array('store_id', '=', $bill_info['ob_store_id']);
 
         $query_start_date = input('get.query_start_date');
         $query_end_date = input('get.query_end_date');
@@ -111,11 +112,11 @@ class Bill extends AdminControl
 
         $end_unixtime = $if_end_date ? $end_unixtime + 86400 - 1 : null;
         if ($if_start_date || $if_end_date) {
-            if($if_start_date){
-                $order_condition[]=array('finnshed_time','>=', $start_unixtime);
+            if ($if_start_date) {
+                $order_condition[] = array('finnshed_time', '>=', $start_unixtime);
             }
-            if($if_end_date){
-                $order_condition[]=array('finnshed_time','<=', $end_unixtime);
+            if ($if_end_date) {
+                $order_condition[] = array('finnshed_time', '<=', $end_unixtime);
             }
         }
 
@@ -125,8 +126,8 @@ class Bill extends AdminControl
             //店铺费用
             $storecost_model = model('storecost');
             $cost_condition = array();
-            $cost_condition[] = array('storecost_store_id','=',$bill_info['ob_store_id']);
-            $cost_condition[] = array('storecost_time','between',[$bill_info['ob_startdate'],$bill_info['ob_enddate']]);
+            $cost_condition[] = array('storecost_store_id', '=', $bill_info['ob_store_id']);
+            $cost_condition[] = array('storecost_time', 'between', [$bill_info['ob_startdate'], $bill_info['ob_enddate']]);
             $store_cost_list = $storecost_model->getStorecostList($cost_condition, 20);
             //取得店铺名字
             $store_info = model('store')->getStoreInfoByID($bill_info['ob_store_id']);
@@ -134,19 +135,19 @@ class Bill extends AdminControl
             View::assign('store_info', $store_info);
             View::assign('show_page', $storecost_model->page_info->render());
             $sub_tpl_name = 'show_cost_list';
-        }elseif ($query_type == 'vrorder') {
+        } elseif ($query_type == 'vrorder') {
 
             //店铺费用
             $vrorder_model = model('vrorder');
-            $order_list = $vrorder_model->getVrorderList($order_condition, 20,'(ROUND(order_amount*commis_rate/100,2)) AS commis_amount,(ROUND(refund_amount*commis_rate/100,2)) AS return_commis_amount,order_amount,refund_amount,order_sn,buyer_name,add_time,finnshed_time,order_id');
-            foreach($order_list as $key => $val){
-                if(!$val['order_id']){
-                    $order_list=array();
+            $order_list = $vrorder_model->getVrorderList($order_condition, 20, '(ROUND(order_amount*commis_rate/100,2)) AS commis_amount,(ROUND(refund_amount*commis_rate/100,2)) AS return_commis_amount,order_amount,refund_amount,order_sn,buyer_name,add_time,finnshed_time,order_id');
+            foreach ($order_list as $key => $val) {
+                if (!$val['order_id']) {
+                    $order_list = array();
                     break;
                 }
                 //分销佣金
-                $inviter_info=Db::name('orderinviter')->where(array('orderinviter_order_id' => $key, 'orderinviter_valid' => 1, 'orderinviter_order_type' => 1))->field('SUM(orderinviter_money) AS ob_inviter_totals')->find();
-                $order_list[$key]['inviter_amount']= ds_price_format($inviter_info['ob_inviter_totals']);
+                $inviter_info = Db::name('orderinviter')->where(array('orderinviter_order_id' => $key, 'orderinviter_valid' => 1, 'orderinviter_order_type' => 1))->field('SUM(orderinviter_money) AS ob_inviter_totals')->find();
+                $order_list[$key]['inviter_amount'] = ds_price_format($inviter_info['ob_inviter_totals']);
             }
             View::assign('order_list', $order_list);
             View::assign('show_page', $vrorder_model->page_info->render());
@@ -165,20 +166,20 @@ class Bill extends AdminControl
                 }
             }
             $order_goods_condition = array();
-            $order_goods_condition[] = array('order_id','in',$order_id_array);
+            $order_goods_condition[] = array('order_id', 'in', $order_id_array);
             $field = 'SUM(ROUND(goods_pay_price*commis_rate/100,2)) as commis_amount,order_id';
             $commis_list = $order_model->getOrdergoodsList($order_goods_condition, $field, 0, null, '', 'order_id', 'order_id');
-            foreach($commis_list as $key => $val){
-                $return_commis_amount=0;
-                $refund_info=Db::name('refundreturn')->alias('refundreturn')->join('ordergoods ordergoods', 'refundreturn.order_goods_id = ordergoods.rec_id')->where(array(array('refundreturn.order_id' ,'=', $key), array('refundreturn.refund_state' ,'=', 3), array('refundreturn.order_goods_id','>', 0)))->field('SUM(ROUND(refundreturn.refund_amount*ordergoods.commis_rate/100,2)) AS ob_commis_return_totals')->find();
-                $return_commis_amount=$refund_info['ob_commis_return_totals'];
-                $commis_list[$key]['return_commis_amount']=$return_commis_amount;
+            foreach ($commis_list as $key => $val) {
+                $return_commis_amount = 0;
+                $refund_info = Db::name('refundreturn')->alias('refundreturn')->join('ordergoods ordergoods', 'refundreturn.order_goods_id = ordergoods.rec_id')->where(array(array('refundreturn.order_id', '=', $key), array('refundreturn.refund_state', '=', 3), array('refundreturn.order_goods_id', '>', 0)))->field('SUM(ROUND(refundreturn.refund_amount*ordergoods.commis_rate/100,2)) AS ob_commis_return_totals')->find();
+                $return_commis_amount = $refund_info['ob_commis_return_totals'];
+                $commis_list[$key]['return_commis_amount'] = $return_commis_amount;
                 //分销佣金
-                $inviter_info=Db::name('orderinviter')->where(array('orderinviter_order_id' => $key, 'orderinviter_valid' => 1, 'orderinviter_order_type' => 0))->field('SUM(orderinviter_money) AS ob_inviter_totals')->find();
-                $commis_list[$key]['inviter_amount']=$inviter_info['ob_inviter_totals'];
+                $inviter_info = Db::name('orderinviter')->where(array('orderinviter_order_id' => $key, 'orderinviter_valid' => 1, 'orderinviter_order_type' => 0))->field('SUM(orderinviter_money) AS ob_inviter_totals')->find();
+                $commis_list[$key]['inviter_amount'] = $inviter_info['ob_inviter_totals'];
                 //平台代金券
-                $mallvoucher_info=Db::name('ordercommon')->where(array('order_id' => $key))->field('mallvoucher_price')->find();
-                $commis_list[$key]['mall_voucher_totals']=number_format($mallvoucher_info['mallvoucher_price'], 2);
+                $mallvoucher_info = Db::name('ordercommon')->where(array('order_id' => $key))->field('mallvoucher_price')->find();
+                $commis_list[$key]['mall_voucher_totals'] = number_format($mallvoucher_info['mallvoucher_price'], 2);
             }
             View::assign('commis_list', $commis_list);
             View::assign('order_list', $order_list);
@@ -189,37 +190,38 @@ class Bill extends AdminControl
         return View::fetch($sub_tpl_name);
     }
 
-    public function bill_check() {
+    public function bill_check()
+    {
         $ob_no = input('param.ob_no');
         if (!$ob_no) {
             $this->error(lang('param_error'));
         }
         $bill_model = model('bill');
         $condition = array();
-        $condition[] = array('ob_no','=',$ob_no);
-        $condition[] = array('ob_state','=',BILL_STATE_STORE_COFIRM);
+        $condition[] = array('ob_no', '=', $ob_no);
+        $condition[] = array('ob_state', '=', BILL_STATE_STORE_COFIRM);
         $bill_info = $bill_model->getOrderbillInfo($condition);
         if (!$bill_info) {
             $this->error(lang('bill_is_not_exist'));
         }
         if (request()->isPost()) {
-            
+
             Db::startTrans();
             try {
-                if($bill_info['ob_result_totals']!=0){
-                    $storemoneylog_model=model('storemoneylog');
-                    $data=array(
-                        'store_id'=>$bill_info['ob_store_id'],
-                        'storemoneylog_type'=>Storemoneylog::TYPE_BILL,
-                        'storemoneylog_state'=>Storemoneylog::STATE_VALID,
-                        'storemoneylog_add_time'=>TIMESTAMP,
-                        'store_avaliable_money'=>$bill_info['ob_result_totals'],//如果是欠账则从店铺余额里扣除,否则增加
-                        'storemoneylog_desc'=>$ob_no.lang('bill_phase_numbers').lang('bill_state_success'),
+                if ($bill_info['ob_result_totals'] != 0) {
+                    $storemoneylog_model = model('storemoneylog');
+                    $data = array(
+                        'store_id' => $bill_info['ob_store_id'],
+                        'storemoneylog_type' => Storemoneylog::TYPE_BILL,
+                        'storemoneylog_state' => Storemoneylog::STATE_VALID,
+                        'storemoneylog_add_time' => TIMESTAMP,
+                        'store_avaliable_money' => $bill_info['ob_result_totals'], //如果是欠账则从店铺余额里扣除,否则增加
+                        'storemoneylog_desc' => $ob_no . lang('bill_phase_numbers') . lang('bill_state_success'),
                     );
 
                     $storemoneylog_model->changeStoremoney($data);
                 }
-                $update = $bill_model->editOrderbill(array('ob_state' => BILL_STATE_SUCCESS,'ob_admin_content'=>input('post.ob_admin_content')), $condition);
+                $update = $bill_model->editOrderbill(array('ob_state' => BILL_STATE_SUCCESS, 'ob_admin_content' => input('post.ob_admin_content')), $condition);
                 if (!$update) {
                     throw new \think\Exception(lang('bill_audit_fail'), 10006);
                 }
@@ -230,7 +232,7 @@ class Bill extends AdminControl
             }
             Db::commit();
             $this->log(lang('bill_audit_bill') . $ob_no, 1);
-            $this->success(lang('bill_audit_succ'),(string)url('Bill/show_bill',['ob_no'=>$ob_no]));
+            $this->success(lang('bill_audit_succ'), (string)url('Bill/show_bill', ['ob_no' => $ob_no]));
         } else {
             return View::fetch('bill_check');
         }
@@ -248,8 +250,8 @@ class Bill extends AdminControl
         }
         $bill_model = model('bill');
         $condition = array();
-        $condition[] = array('ob_no','=',$ob_no);
-        $condition[] = array('ob_state','=',BILL_STATE_SYSTEM_CHECK);
+        $condition[] = array('ob_no', '=', $ob_no);
+        $condition[] = array('ob_state', '=', BILL_STATE_SYSTEM_CHECK);
         $bill_info = $bill_model->getOrderbillInfo($condition);
         if (!$bill_info) {
             $this->error(lang('param_error'));
@@ -266,9 +268,9 @@ class Bill extends AdminControl
             if ($update) {
                 $storecost_model = model('storecost');
                 $cost_condition = array();
-                $cost_condition[] = array('storecost_store_id','=',$bill_info['ob_store_id']);
-                $cost_condition[] = array('storecost_state','=',0);
-                $cost_condition[] = array('storecost_time','between', "{$bill_info['ob_startdate']},{$bill_info['ob_enddate']}");
+                $cost_condition[] = array('storecost_store_id', '=', $bill_info['ob_store_id']);
+                $cost_condition[] = array('storecost_state', '=', 0);
+                $cost_condition[] = array('storecost_time', 'between', "{$bill_info['ob_startdate']},{$bill_info['ob_enddate']}");
                 $storecost_model->editStorecost(array('storecost_state' => 1), $cost_condition);
 
                 // 发送店铺消息
@@ -284,10 +286,10 @@ class Bill extends AdminControl
                 $param['param'] = $param['ali_param'];
                 //微信模板消息
                 $param['weixin_param'] = array(
-                    'url' => config('ds_config.h5_store_site_url').'/pages/seller/bill/BillList',
-                    'data'=>array(
+                    'url' => config('ds_config.h5_store_site_url') . '/pages/seller/bill/BillList',
+                    'data' => array(
                         "keyword1" => array(
-                            "value" => date('Y-m-d', $bill_info['ob_startdate']).'~'.date('Y-m-d', $bill_info['ob_enddate']),
+                            "value" => date('Y-m-d', $bill_info['ob_startdate']) . '~' . date('Y-m-d', $bill_info['ob_enddate']),
                             "color" => "#333"
                         ),
                         "keyword2" => array(
@@ -300,7 +302,7 @@ class Bill extends AdminControl
                         )
                     ),
                 );
-                model('cron')->addCron(array('cron_exetime'=>TIMESTAMP,'cron_type'=>'sendStoremsg','cron_value'=>serialize($param)));
+                model('cron')->addCron(array('cron_exetime' => TIMESTAMP, 'cron_type' => 'sendStoremsg', 'cron_value' => serialize($param)));
 
                 $this->log(lang('bill_payment_audit_fail') . $ob_no, 1);
                 $this->success(lang('ds_common_save_succ'), 'bill/show_statis?os_month=' . $bill_info['os_month']);
@@ -326,8 +328,8 @@ class Bill extends AdminControl
         }
         $bill_model = model('bill');
         $condition = array();
-        $condition[] = array('ob_no','=',$ob_no);
-        $condition[] = array('ob_state','=',BILL_STATE_SUCCESS);
+        $condition[] = array('ob_no', '=', $ob_no);
+        $condition[] = array('ob_state', '=', BILL_STATE_SUCCESS);
         $bill_info = $bill_model->getOrderbillInfo($condition);
         if (!$bill_info) {
             $this->error(lang('param_error'));
@@ -342,12 +344,13 @@ class Bill extends AdminControl
      * 导出 结算管理
      *
      */
-    public function export_js_step1() {
+    public function export_js_step1()
+    {
         $bill_model = model('bill');
         $condition = array();
         $query_year = input('get.query_year');
         if (preg_match('/^\d{4}$/', $query_year, $match)) {
-            $condition[]=array('os_month','like',$query_year.'%');
+            $condition[] = array('os_month', 'like', $query_year . '%');
         }
         if (!is_numeric(input('param.page'))) {
             $count = $bill_model->getOrderstatisCount($condition);
@@ -378,8 +381,9 @@ class Bill extends AdminControl
      *
      * @param array $data
      */
-    private function createJsExcel($data = array()) {
-        Lang::load(base_path() .'admin/lang/'.config('lang.default_lang').'/export.lang.php');
+    private function createJsExcel($data = array())
+    {
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/export.lang.php');
         $excel_obj = new \excel\Excel();
         $excel_data = array();
         //设置样式
@@ -398,7 +402,7 @@ class Bill extends AdminControl
         //data
         foreach ((array) $data as $k => $v) {
             $tmp = array();
-            $tmp[] = array('data' => substr($v['os_month'],0,4).'-'.substr($v['os_month'],4));
+            $tmp[] = array('data' => substr($v['os_month'], 0, 4) . '-' . substr($v['os_month'], 4));
             $tmp[] = array('format' => 'Number', 'data' => ds_price_format($v['os_order_totals']));
             $tmp[] = array('format' => 'Number', 'data' => ds_price_format($v['os_shipping_totals']));
             $tmp[] = array('format' => 'Number', 'data' => ds_price_format($v['os_commis_totals']));
@@ -421,25 +425,26 @@ class Bill extends AdminControl
      * 商家账单列表 管理
      *
      */
-    public function export_zd_step1() {
+    public function export_zd_step1()
+    {
 
         $bill_model = model('bill');
         $condition = array();
 
         $bill_state = input('get.bill_state');
         if (is_numeric($bill_state)) {
-            $condition[] = array('ob_state','=',intval($bill_state));
+            $condition[] = array('ob_state', '=', intval($bill_state));
         }
         $query_store = input('get.query_store');
         if (preg_match('/^\d{1,8}$/', $query_store)) {
-            $condition[] = array('ob_store_id','=',$query_store);
+            $condition[] = array('ob_store_id', '=', $query_store);
         } elseif ($query_store != '') {
-            $condition[] = array('ob_store_name','=',$query_store);
+            $condition[] = array('ob_store_name', '=', $query_store);
         }
         $os_month = input('get.os_month');
-        if($os_month){
-            $condition[]=array('ob_startdate','>=',strtotime($os_month.'01 0:0:0'));
-            $condition[]=array('ob_enddate','<',strtotime($os_month.'01 23:59:59 +1 month -1 day'));
+        if ($os_month) {
+            $condition[] = array('ob_startdate', '>=', strtotime($os_month . '01 0:0:0'));
+            $condition[] = array('ob_enddate', '<', strtotime($os_month . '01 23:59:59 +1 month -1 day'));
         }
         if (!is_numeric(input('param.page'))) {
             $count = $bill_model->getOrderbillCount($condition);
@@ -470,8 +475,9 @@ class Bill extends AdminControl
      *
      * @param array $data
      */
-    private function createZdExcel($data = array()) {
-        Lang::load(base_path() .'admin/lang/'.config('lang.default_lang').'/export.lang.php');
+    private function createZdExcel($data = array())
+    {
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/export.lang.php');
         $excel_obj = new \excel\Excel();
         $excel_data = array();
         //设置样式
@@ -538,14 +544,12 @@ class Bill extends AdminControl
                 'url' => (string)url('Bill/index')
             ),
         );
-            $title = !empty(input('param.os_month')) ? input('param.os_month') . lang('bill_period') : '';
-            $menu_array[] = array(
-                'name' => 'show_statis',
-                'text' => $title . lang('bill_billing_list'),
-                'url' => !empty($title) ? (string)url('Bill/show_statis', ['os_month' => input('param.os_month')]) : (string)url('Bill/show_statis'),
-            );
+        $title = !empty(input('param.os_month')) ? input('param.os_month') . lang('bill_period') : '';
+        $menu_array[] = array(
+            'name' => 'show_statis',
+            'text' => $title . lang('bill_billing_list'),
+            'url' => !empty($title) ? (string)url('Bill/show_statis', ['os_month' => input('param.os_month')]) : (string)url('Bill/show_statis'),
+        );
         return $menu_array;
     }
 }
-
-?>

+ 34 - 27
app/admin/controller/Bonus.php

@@ -1,43 +1,46 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Db;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 平台红包 控制器
  */
-class Bonus extends AdminControl {
+class Bonus extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/bonus.lang.php');
     }
 
-    public function index() {
+    public function index()
+    {
         $condition = array();
         $bonus_name = input('param.bonus_name');
         if (!empty($bonus_name)) {
-            $condition[]=array('bonus_name','like', '%' . $bonus_name . '%');
+            $condition[] = array('bonus_name', 'like', '%' . $bonus_name . '%');
         }
         //红包是否有效
         $bonus_state = intval(input('get.bonus_state'));
         if ($bonus_state) {
-            $condition[]=array('bonus_state','=',$bonus_state);
+            $condition[] = array('bonus_state', '=', $bonus_state);
         }
         //红包类型
         $bonus_type = intval(input('get.bonus_type'));
         if ($bonus_type) {
-            $condition[]=array('bonus_type','=',$bonus_type);
+            $condition[] = array('bonus_type', '=', $bonus_type);
         }
         $bonus_model = model('bonus');
         $bonus_list = $bonus_model->getBonusList($condition, 10);
@@ -56,13 +59,14 @@ class Bonus extends AdminControl {
     /**
      * 添加吸粉红包
      */
-    public function add() {
+    public function add()
+    {
         $bonus_model = model('bonus');
         if (!request()->isPost()) {
             $bonus = array(
                 'bonus_type' => 1,
                 'bonus_begintime' => TIMESTAMP,
-                'bonus_endtime' => TIMESTAMP+3600*24*7,
+                'bonus_endtime' => TIMESTAMP + 3600 * 24 * 7,
             );
             //红包类型
             View::assign('bonus_type_list', $bonus_model->bonus_type_list());
@@ -82,7 +86,7 @@ class Bonus extends AdminControl {
                 if ($bonus_fixedprice == 0 || $bonus_fixedprice > $bonus_totalprice) {
                     $this->error(lang('bonus_fixedprice_error'));
                 }
-                if (($bonus_totalprice*100) % ($bonus_fixedprice*100) != 0) {
+                if (($bonus_totalprice * 100) % ($bonus_fixedprice * 100) != 0) {
                     $this->error(lang('bonus_fixedprice_error'));
                 }
                 //生成红包领取记录-固定金额
@@ -148,14 +152,15 @@ class Bonus extends AdminControl {
     /**
      * 编辑吸粉红包  不可以对金额以及红包类型进行编辑。
      */
-    public function edit() {
+    public function edit()
+    {
         $bonus_id = intval(input('param.bonus_id'));
         if ($bonus_id < 0) {
             ds_json_encode(10000, lang('param_error'));
         }
         $bonus_model = model('bonus');
         $condition = array();
-        $condition[] = array('bonus_id','=',$bonus_id);
+        $condition[] = array('bonus_id', '=', $bonus_id);
         if (!request()->isPost()) {
             $bonus = $bonus_model->getOneBonus($condition);
             View::assign('bonus', $bonus);
@@ -179,14 +184,15 @@ class Bonus extends AdminControl {
     /**
      * 设置红包失效    1正在进行  2过期  3失效
      */
-    public function invalid() {
+    public function invalid()
+    {
         $bonus_id = intval(input('param.bonus_id'));
         if ($bonus_id < 0) {
             ds_json_encode(10000, lang('param_error'));
         }
         $bonus_model = model('bonus');
         $condition = array();
-        $condition[] = array('bonus_id','=',$bonus_id);
+        $condition[] = array('bonus_id', '=', $bonus_id);
         $data['bonus_state'] = 3;
         $bonus_model->editBonus($condition, $data);
         $this->log(lang('ds_edit') . lang('ds_bonus') . '[ID' . $bonus_id . ']', 1);
@@ -196,20 +202,21 @@ class Bonus extends AdminControl {
     /**
      * 领取列表
      */
-    public function receive() {
+    public function receive()
+    {
         $bonus_id = intval(input('param.bonus_id'));
         if ($bonus_id < 0) {
             $this->error(lang('param_error'));
         }
         $condition = array();
-        $condition[] = array('bonus_id','=',$bonus_id);
+        $condition[] = array('bonus_id', '=', $bonus_id);
         $bonus_model = model('bonus');
         $bonusreceive_list = $bonus_model->getBonusreceiveList($condition, 10);
         View::assign('bonusreceive_list', $bonusreceive_list);
         View::assign('show_page', $bonus_model->page_info->render());
         return View::fetch();
     }
-    
+
     //链接信息
     public function link()
     {
@@ -218,17 +225,18 @@ class Bonus extends AdminControl {
             $this->error(lang('param_error'));
         }
         $condition = array();
-        $condition[] = array('bonus_id','=',$bonus_id);
+        $condition[] = array('bonus_id', '=', $bonus_id);
         $bonus_model = model('bonus');
         $bonus = $bonus_model->getOneBonus($condition);
         View::assign('bonus', $bonus);
-        $bonus_url = config('ds_config.h5_site_url')."/pages/home/bonus/Detail?bonus_id=".$bonus['bonus_id'];
+        $bonus_url = config('ds_config.h5_site_url') . "/pages/home/bonus/Detail?bonus_id=" . $bonus['bonus_id'];
         View::assign('bonus_url', $bonus_url);
         return View::fetch();
     }
-    
 
-    protected function getAdminItemList() {
+
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -238,10 +246,9 @@ class Bonus extends AdminControl {
             array(
                 'name' => 'add',
                 'text' => lang('ds_add'),
-                'url' => "javascript:dsLayerOpen('" . (string)url('Bonus/add') . "','".lang('ds_add')."')"
+                'url' => "javascript:dsLayerOpen('" . (string)url('Bonus/add') . "','" . lang('ds_add') . "')"
             ),
         );
         return $menu_array;
     }
-
 }

+ 45 - 35
app/admin/controller/Brand.php

@@ -6,21 +6,22 @@ use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Brand extends AdminControl {
+class Brand extends AdminControl
+{
 
     const EXPORT_SIZE = 1000;
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/brand.lang.php');
     }
@@ -28,7 +29,8 @@ class Brand extends AdminControl {
     /**
      * 品牌列表
      */
-    public function index() {
+    public function index()
+    {
         $brand_model = model('brand');
         /**
          * 检索条件
@@ -52,7 +54,8 @@ class Brand extends AdminControl {
     /**
      * 增加品牌
      */
-    public function brand_add() {
+    public function brand_add()
+    {
 
         $brand_model = model('brand');
         if (request()->isPost()) {
@@ -67,10 +70,10 @@ class Brand extends AdminControl {
             } else {
                 $insert_array = array();
                 if (!empty($_FILES['_pic']['name'])) {
-                    $res=ds_upload_pic(ATTACH_BRAND,'_pic');
-                    if($res['code']){
-                        $brand_pic=$res['data']['file_name'];
-                    }else{
+                    $res = ds_upload_pic(ATTACH_BRAND, '_pic');
+                    if ($res['code']) {
+                        $brand_pic = $res['data']['file_name'];
+                    } else {
                         $this->error($res['msg']);
                     }
                 }
@@ -116,7 +119,8 @@ class Brand extends AdminControl {
     /**
      * 品牌编辑
      */
-    public function brand_edit() {
+    public function brand_edit()
+    {
         $brand_model = model('brand');
 
         if (request()->isPost()) {
@@ -129,10 +133,10 @@ class Brand extends AdminControl {
                 $this->error($brand_validate->getError());
             } else {
                 if (!empty($_FILES['_pic']['name'])) {
-                    $res=ds_upload_pic(ATTACH_BRAND,'_pic');
-                    if($res['code']){
-                        $brand_pic=$res['data']['file_name'];
-                    }else{
+                    $res = ds_upload_pic(ATTACH_BRAND, '_pic');
+                    if ($res['code']) {
+                        $brand_pic = $res['data']['file_name'];
+                    } else {
                         $this->error($res['msg']);
                     }
                 }
@@ -178,7 +182,8 @@ class Brand extends AdminControl {
     /**
      * 删除品牌
      */
-    public function brand_del() {
+    public function brand_del()
+    {
         $brand_id = input('param.brand_id');
         $brand_id_array = ds_delete_param($brand_id);
         if ($brand_id_array == FALSE) {
@@ -196,7 +201,8 @@ class Brand extends AdminControl {
     /**
      * 品牌申请
      */
-    public function brand_apply() {
+    public function brand_apply()
+    {
         $brand_model = model('brand');
         /**
          * 对申请品牌进行操作 通过,拒绝
@@ -264,7 +270,8 @@ class Brand extends AdminControl {
     /**
      * 审核 申请品牌操作
      */
-    public function brand_apply_set() {
+    public function brand_apply_set()
+    {
         $brand_model = model('brand');
 
         if (intval(input('param.brand_id')) > 0) {
@@ -302,10 +309,11 @@ class Brand extends AdminControl {
     /**
      * ajax操作
      */
-    public function ajax() {
+    public function ajax()
+    {
         $brand_model = model('brand');
         switch (input('param.branch')) {
-            /**
+                /**
              * 品牌名称
              */
             case 'brand_name':
@@ -325,25 +333,25 @@ class Brand extends AdminControl {
                     exit;
                 }
                 break;
-            /**
-             * 品牌类别,品牌排序,推荐
-             */
+                /**
+                 * 品牌类别,品牌排序,推荐
+                 */
             case 'brand_class':
             case 'brand_sort':
             case 'brand_recommend':
                 $brand_model->editBrand(array('brand_id' => intval(input('param.id'))), array(input('param.column') => trim(input('param.value'))));
                 $detail_log = str_replace(array(
                     'brand_class', 'brand_sort', 'brand_recommend'
-                        ), array(
+                ), array(
                     lang('brand_index_class'), lang('ds_sort'), lang('ds_recommend')
-                        ), input('param.branch'));
+                ), input('param.branch'));
                 $this->log(lang('ds_edit') . lang('brand_index_brand') . $detail_log . '[ID:' . intval(input('param.id')) . ')', 1);
                 echo 'true';
                 exit;
                 break;
-            /**
-             * 验证品牌名称是否有重复
-             */
+                /**
+                 * 验证品牌名称是否有重复
+                 */
             case 'check_brand_name':
                 $condition[] = array('brand_name', '=', trim(input('param.brand_name')));
                 $condition[] = array('brand_id', '<>', intval(input('param.id')));
@@ -362,7 +370,8 @@ class Brand extends AdminControl {
     /**
      * 品牌导出第一步
      */
-    public function export_step1() {
+    public function export_step1()
+    {
         $brand_model = model('brand');
         $condition = array();
         if ((input('param.search_brand_name'))) {
@@ -402,7 +411,8 @@ class Brand extends AdminControl {
      *
      * @param array $data
      */
-    private function createExcel($data = array()) {
+    private function createExcel($data = array())
+    {
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/export.lang.php');
         $excel_obj = new \excel\Excel();
         $excel_data = array();
@@ -432,7 +442,8 @@ class Brand extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -452,5 +463,4 @@ class Brand extends AdminControl {
         );
         return $menu_array;
     }
-
 }

+ 14 - 16
app/admin/controller/Chain.php

@@ -1,18 +1,18 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Chain extends AdminControl
@@ -20,7 +20,7 @@ class Chain extends AdminControl
     public function initialize()
     {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/chain.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/chain.lang.php');
     }
 
     /**
@@ -31,15 +31,14 @@ class Chain extends AdminControl
         $chain_model = model('chain');
         $where = array();
         if (input('param.search_name') != '') {
-            $where[]=array('chain_truename','like', '%' . input('param.search_name') . '%');
+            $where[] = array('chain_truename', 'like', '%' . input('param.search_name') . '%');
             View::assign('search_name', input('param.search_name'));
         }
         if (input('param.sign') == 'verify') {
             View::assign('sign', 'verify');
             $dp_list = $chain_model->getChainWaitVerifyList($where, 10);
             $this->setAdminCurItem('verify');
-        }
-        else {
+        } else {
             $dp_list = $chain_model->getChainList($where, 10);
             $this->setAdminCurItem('index');
         }
@@ -68,7 +67,7 @@ class Chain extends AdminControl
                 if ($update_array['chain_isuse'] == 0) {
                     $log = lang('ds_close');
                     // 删除相关联的收货地址
-                    model('address')->delAddress(array(array('chain_id','<>', 0)));
+                    model('address')->delAddress(array(array('chain_id', '<>', 0)));
                 }
                 $this->log($log . lang('chain_function'), 1);
                 dsLayerOpenSuccess(lang('ds_common_save_succ'));
@@ -112,7 +111,7 @@ class Chain extends AdminControl
         $update['chain_telephony'] = input('post.dtelephony');
         $update['chain_addressname'] = input('post.daddressname');
         $update['chain_address'] = input('post.daddress');
-        
+
         $chain_passwd = input('post.dpasswd');
         if (!empty($chain_passwd)) {
             $update['chain_passwd'] = md5($chain_passwd);
@@ -123,11 +122,10 @@ class Chain extends AdminControl
         if ($result) {
             // 删除相关联的收货地址
             model('address')->delAddress(array('chain_id' => $chain_id));
-            $this->log(lang('ds_edit').lang('chain_function').',ID:' . $chain_id, 1);
+            $this->log(lang('ds_edit') . lang('chain_function') . ',ID:' . $chain_id, 1);
             $this->success(lang('ds_common_op_succ'), (string)url('Chain/index'));
-        }
-        else {
-            $this->log(lang('ds_edit').lang('chain_function').',ID:' . $chain_id, 0);
+        } else {
+            $this->log(lang('ds_edit') . lang('chain_function') . ',ID:' . $chain_id, 0);
             $this->error(lang('ds_common_op_fail'));
         }
     }
@@ -154,4 +152,4 @@ class Chain extends AdminControl
         }
         return $menu_array;
     }
-}
+}

+ 18 - 15
app/admin/controller/Common.php

@@ -1,28 +1,31 @@
 <?php
 
 namespace app\admin\controller;
+
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Common extends AdminControl {
+class Common extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize(); // TODO: Change the autogenerated stub
     }
 
     /**
      * 查询每月的周数组
      */
-    public function getweekofmonth() {
-        include_once root_path(). 'extend/mall/datehelper.php';
+    public function getweekofmonth()
+    {
+        include_once root_path() . 'extend/mall/datehelper.php';
         $year = input('param.y');
         $month = input('param.m');
         $week_arr = getMonthWeekArr($year, $month);
@@ -30,7 +33,8 @@ class Common extends AdminControl {
         die;
     }
 
-    public function ajax_get_brand() {
+    public function ajax_get_brand()
+    {
         $initial = trim(input('param.letter'));
         $keyword = trim(input('param.keyword'));
         $type = trim(input('param.type'));
@@ -47,18 +51,17 @@ class Common extends AdminControl {
                 case 'all':
                     break;
                 case '0-9':
-                    $where[]=array('brand_initial','in', array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9));
+                    $where[] = array('brand_initial', 'in', array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9));
                     break;
                 default:
-                    $where[]=array('brand_initial','=',$initial);
+                    $where[] = array('brand_initial', '=', $initial);
                     break;
             }
         } else {
-            $where[]=array('brand_name|brand_initial','like', '%' . $keyword . '%');
+            $where[] = array('brand_name|brand_initial', 'like', '%' . $keyword . '%');
         }
         $brand_array = model('brand')->getBrandPassedList($where, 'brand_id,brand_name,brand_initial', 0, 'brand_initial asc, brand_sort asc');
         echo json_encode($brand_array);
         die();
     }
-
-}
+}

+ 48 - 45
app/admin/controller/Complain.php

@@ -1,18 +1,18 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Complain extends AdminControl
@@ -29,7 +29,7 @@ class Complain extends AdminControl
     public function initialize()
     {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/complain.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/complain.lang.php');
     }
 
 
@@ -86,24 +86,24 @@ class Complain extends AdminControl
         $complain_model = model('complain');
         //搜索条件
         $condition = array();
-        $condition[]=array('accuser_name','like', "%" . input('param.input_complain_accuser') . "%");
-        $condition[]=array('accused_name','like', "%" . input('param.input_complain_accused') . "%");
-        $condition[]=array('complain_subject_content','like', "%" . input('param.input_complain_subject_content') . "%");
-        if(input('param.input_complain_datetime_end')) {
+        $condition[] = array('accuser_name', 'like', "%" . input('param.input_complain_accuser') . "%");
+        $condition[] = array('accused_name', 'like', "%" . input('param.input_complain_accused') . "%");
+        $condition[] = array('complain_subject_content', 'like', "%" . input('param.input_complain_subject_content') . "%");
+        if (input('param.input_complain_datetime_end')) {
             $stime = strtotime(input('param.input_complain_datetime_start'));
-            $condition[]=array('complain_datetime','>=', $stime);
+            $condition[] = array('complain_datetime', '>=', $stime);
         }
-        if(input('param.input_complain_datetime_end')){
-            $etime = strtotime(input('param.input_complain_datetime_end'))+86399;
-            $condition[]=array('complain_datetime','<=', $etime);
+        if (input('param.input_complain_datetime_end')) {
+            $etime = strtotime(input('param.input_complain_datetime_end')) + 86399;
+            $condition[] = array('complain_datetime', '<=', $etime);
         }
         if ($action === 'complain_finish_list') {
-            $order= 'complain_id desc';
+            $order = 'complain_id desc';
         } else {
             $order = 'complain_id asc';
         }
-        $condition[]=array('complain_state','=',$complain_state);
-        $complain_list = $complain_model->getComplainList($condition, 10 ,$order);
+        $condition[] = array('complain_state', '=', $complain_state);
+        $complain_list = $complain_model->getComplainList($condition, 10, $order);
         $this->setAdminCurItem($action);
         View::assign('complain_list', $complain_list);
         View::assign('show_page', $complain_model->page_info->render());
@@ -122,12 +122,12 @@ class Complain extends AdminControl
         //获取投诉的商品列表
         $complain_goods_list = $this->get_complain_goods_list($complain_info['order_goods_id']);
         View::assign('complain_goods_list', $complain_goods_list);
-        if (intval($complain_info['complain_subject_id']) == 1) {//退款信息
+        if (intval($complain_info['complain_subject_id']) == 1) { //退款信息
             $refundreturn_model = model('refundreturn');
-            $this->getRefundStateArray();//向模板页面输出退款退货状态
+            $this->getRefundStateArray(); //向模板页面输出退款退货状态
             $list = $refundreturn_model->getComplainRefundList($order_info, $complain_info['order_goods_id']);
-            View::assign('refund_list', $list['refund']);//已退或处理中商品
-            View::assign('refund_goods', $list['goods']);//可退商品
+            View::assign('refund_list', $list['refund']); //已退或处理中商品
+            View::assign('refund_goods', $list['goods']); //可退商品
         }
         $this->setAdminCurItem('complain_progress');
         View::assign('order_info', $order_info);
@@ -135,7 +135,8 @@ class Complain extends AdminControl
         return View::fetch('complain_info');
     }
 
-    function getRefundStateArray($type = 'all') {
+    function getRefundStateArray($type = 'all')
+    {
         $state_array = array(
             '1' => lang('refund_state_confirm'),
             '2' => lang('refund_state_yes'),
@@ -174,7 +175,7 @@ class Complain extends AdminControl
             $update_array['complain_handle_member_id'] = $this->get_admin_id();
             $update_array['complain_active'] = self::STATE_ACTIVE;
             $condition = array();
-            $condition[] = array('complain_id','=',$complain_id);
+            $condition[] = array('complain_id', '=', $complain_id);
             if ($complain_model->editComplain($update_array, $condition)) {
                 $this->log(lang('complain_verify_success') . '[' . $complain_id . ']', 1);
 
@@ -191,8 +192,8 @@ class Complain extends AdminControl
                 $param['param'] = $param['ali_param'];
                 //微信模板消息
                 $param['weixin_param'] = array(
-                    'url' => config('ds_config.h5_store_site_url').'/pages/seller/complaint/ComplaintForm?complain_id='.$complain_id,
-                    'data'=>array(
+                    'url' => config('ds_config.h5_store_site_url') . '/pages/seller/complaint/ComplaintForm?complain_id=' . $complain_id,
+                    'data' => array(
                         "keyword1" => array(
                             "value" => $complain_info['accuser_name'],
                             "color" => "#333"
@@ -203,7 +204,7 @@ class Complain extends AdminControl
                         )
                     ),
                 );
-                model('cron')->addCron(array('cron_exetime'=>TIMESTAMP,'cron_type'=>'sendStoremsg','cron_value'=>serialize($param)));
+                model('cron')->addCron(array('cron_exetime' => TIMESTAMP, 'cron_type' => 'sendStoremsg', 'cron_value' => serialize($param)));
 
                 $this->success(lang('complain_verify_success'), (string)url('Complain/complain_new_list'));
             } else {
@@ -222,8 +223,8 @@ class Complain extends AdminControl
         //获取输入的数据
         $complain_id = intval(input('post.complain_id'));
         $final_handle_message = trim(input('post.final_handle_message'));
-        $data=[
-            'final_handle_message'=>$final_handle_message
+        $data = [
+            'final_handle_message' => $final_handle_message
         ];
         $complain_validate = ds_validate('complain');
         if (!$complain_validate->scene('complain_close')->check($data)) {
@@ -240,23 +241,23 @@ class Complain extends AdminControl
             $update_array['final_handle_datetime'] = TIMESTAMP;
             $update_array['final_handle_member_id'] = $this->get_admin_id();
             $condition = array();
-            $condition[] = array('complain_id','=',$complain_id);
+            $condition[] = array('complain_id', '=', $complain_id);
             if ($complain_model->editComplain($update_array, $condition)) {
-                if (intval($complain_info['complain_subject_id']) == 1) {//退款信息
+                if (intval($complain_info['complain_subject_id']) == 1) { //退款信息
                     $order = $this->get_order_info($complain_info['order_id']);
                     $refundreturn_model = model('refundreturn');
                     $list = $refundreturn_model->getComplainRefundList($order, $complain_info['order_goods_id']);
-                    $refund_goods = $list['goods'];//可退商品
+                    $refund_goods = $list['goods']; //可退商品
                     if (!empty($refund_goods) && is_array($refund_goods)) {
-                        $checked_goods = input('post.checked_goods/a');#获取数组
+                        $checked_goods = input('post.checked_goods/a'); #获取数组
                         foreach ($refund_goods as $key => $value) {
-                            $goods_id = $value['rec_id'];//订单商品表编号
-                            if (!empty($checked_goods) && array_key_exists($goods_id, $checked_goods)) {//验证提交的商品属于订单
+                            $goods_id = $value['rec_id']; //订单商品表编号
+                            if (!empty($checked_goods) && array_key_exists($goods_id, $checked_goods)) { //验证提交的商品属于订单
                                 $refund_array = array();
-                                $refund_array['refund_type'] = '1';//类型:1为退款,2为退货
-                                $refund_array['seller_state'] = '2';//卖家处理状态:1为待审核,2为同意,3为不同意
-                                $refund_array['refund_state'] = '2';//状态:1为处理中,2为待管理员处理,3为已完成
-                                $refund_array['order_lock'] = '1';//锁定类型:1为不用锁定,2为需要锁定
+                                $refund_array['refund_type'] = '1'; //类型:1为退款,2为退货
+                                $refund_array['seller_state'] = '2'; //卖家处理状态:1为待审核,2为同意,3为不同意
+                                $refund_array['refund_state'] = '2'; //状态:1为处理中,2为待管理员处理,3为已完成
+                                $refund_array['order_lock'] = '1'; //锁定类型:1为不用锁定,2为需要锁定
                                 $refund_array['refund_amount'] = ds_price_format($value['goods_refund']);
                                 $refund_array['reason_id'] = '0';
                                 $refund_array['reason_info'] = lang('complaints_success');
@@ -290,7 +291,7 @@ class Complain extends AdminControl
         $complainsubject_model = model('complainsubject');
         //搜索条件
         $condition = array();
-        $condition[] = array('complainsubject_state','=',1);
+        $condition[] = array('complainsubject_state', '=', 1);
         $complainsubject_list = $complainsubject_model->getComplainsubject($condition, 10);
         $this->setAdminCurItem('complain_subject_list');
         View::assign('complainsubject_list', $complainsubject_list);
@@ -301,7 +302,8 @@ class Complain extends AdminControl
     /*
      * 添加投诉主题页面
      */
-    public function complain_subject_add() {
+    public function complain_subject_add()
+    {
         if (!request()->isPost()) {
             $this->setAdminCurItem('complain_subject_add');
             return View::fetch();
@@ -342,12 +344,12 @@ class Complain extends AdminControl
             $this->error(lang('param_error'));
         }
         $condition = array();
-        $condition[]=array('complainsubject_id','in',$complain_subject_id_array);
-        
+        $condition[] = array('complainsubject_id', 'in', $complain_subject_id_array);
+
         $complainsubject_model = model('complainsubject');
         $update_array = array();
         $update_array['complainsubject_state'] = 2;
-        
+
         if ($complainsubject_model->editComplainsubject($update_array, $condition)) {
             $this->log(lang('complain_subject_delete_success') . '[ID:' . input('post.complain_subject_id') . ']', 1);
             ds_json_encode(10000, lang('complain_subject_delete_success'));
@@ -438,7 +440,7 @@ class Complain extends AdminControl
             $update_array['talk_state'] = 2;
             $update_array['talk_admin'] = $this->get_admin_id();
             $condition = array();
-            $condition[] = array('talk_id','=',$talk_id);
+            $condition[] = array('talk_id', '=', $talk_id);
             if ($complaintalk_model->editComplaintalk($update_array, $condition)) {
                 echo json_encode('success');
             } else {
@@ -452,7 +454,8 @@ class Complain extends AdminControl
     /**
      * 投诉设置
      **/
-   public function complain_setting() {
+    public function complain_setting()
+    {
         if (!request()->isPost()) {
             //读取设置内容 $list_setting
             $list_setting = rkcache('config', true);

+ 165 - 159
app/admin/controller/Config.php

@@ -6,24 +6,26 @@ use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Config extends AdminControl {
+class Config extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/config.lang.php');
     }
 
-    public function base() {
+    public function base()
+    {
         $config_model = model('config');
         if (!request()->isPost()) {
             $list_config = rkcache('config', true);
@@ -32,27 +34,27 @@ class Config extends AdminControl {
             $this->setAdminCurItem('base');
             return View::fetch();
         } else {
-			$update_array = array();
+            $update_array = array();
             //首页首次访问悬浮图片
             if (!empty($_FILES['fixed_suspension_img']['name'])) {
-                $res=ds_upload_pic(ATTACH_COMMON,'fixed_suspension_img', 'fixed_suspension_img.png');
-                if($res['code']){
-                    $file_name=$res['data']['file_name'];
+                $res = ds_upload_pic(ATTACH_COMMON, 'fixed_suspension_img', 'fixed_suspension_img.png');
+                if ($res['code']) {
+                    $file_name = $res['data']['file_name'];
                     $upload['fixed_suspension_img'] = $file_name;
-                }else{
+                } else {
                     $this->error($res['msg']);
                 }
             }
             if (!empty($upload['fixed_suspension_img'])) {
                 $update_array['fixed_suspension_img'] = $upload['fixed_suspension_img'];
             }
-			$update_array['goods_verify'] = intval(input('post.goods_verify')) ;//店铺商品审核
-			$update_array['goods_all_verify'] = intval(input('post.goods_all_verify')) ;//店铺所有商品是否通过审核
+            $update_array['goods_verify'] = intval(input('post.goods_verify')); //店铺商品审核
+            $update_array['goods_all_verify'] = intval(input('post.goods_all_verify')); //店铺所有商品是否通过审核
             $update_array['baidu_ak'] = input('post.baidu_ak');
-			$update_array['baiduservice_ak'] = input('post.baiduservice_ak');
-			$update_array['mapak_type'] = input('post.mapak_type');
-			$update_array['gaode_ak'] = input('post.gaode_ak');
-			$update_array['gaode_jscode'] = input('post.gaode_jscode');
+            $update_array['baiduservice_ak'] = input('post.baiduservice_ak');
+            $update_array['mapak_type'] = input('post.mapak_type');
+            $update_array['gaode_ak'] = input('post.gaode_ak');
+            $update_array['gaode_jscode'] = input('post.gaode_jscode');
             $update_array['site_name'] = input('post.site_name');
             $update_array['icp_number'] = input('post.icp_number');
             $update_array['wab_number'] = input('post.wab_number');
@@ -70,18 +72,18 @@ class Config extends AdminControl {
             $update_array['h5_force_redirect'] = input('post.h5_force_redirect');
             $update_array['fixed_suspension_state'] = input('post.fixed_suspension_state'); //首页首次访问悬浮状态
             $update_array['fixed_suspension_url'] = input('post.fixed_suspension_url');
-			$update_array['member_auth'] = input('post.member_auth');//会员实名认证
+            $update_array['member_auth'] = input('post.member_auth'); //会员实名认证
             $result = $config_model->editConfig($update_array);
             if ($result) {
-				if($update_array['goods_verify']==0 && $update_array['goods_all_verify']==1){
-				    $goods_model = model('goods');
-				    $update = array();
-				    $update['goods_verify'] = 1;
-				
-				    $where = array();
-				    $where[]=array('goods_commonid','>', 0);
-				    $goods_model->editProduces($where, $update);
-				}
+                if ($update_array['goods_verify'] == 0 && $update_array['goods_all_verify'] == 1) {
+                    $goods_model = model('goods');
+                    $update = array();
+                    $update['goods_verify'] = 1;
+
+                    $where = array();
+                    $where[] = array('goods_commonid', '>', 0);
+                    $goods_model->editProduces($where, $update);
+                }
                 $this->log(lang('ds_edit') . lang('web_set'), 1);
                 $this->success(lang('ds_common_save_succ'), 'Config/base');
             } else {
@@ -90,130 +92,132 @@ class Config extends AdminControl {
         }
     }
 
-	public function logo() {
-		$config_model = model('config');
-		if (!request()->isPost()) {
-		    $list_config = rkcache('config', true);
-		    View::assign('list_config', $list_config);
-		    /* 设置卖家当前栏目 */
-		    $this->setAdminCurItem('logo');
-		    return View::fetch();
-		} else {
-			//上传文件保存路径
-			if (!empty($_FILES['site_logo']['name'])) {
-			    $res=ds_upload_pic(ATTACH_COMMON,'site_logo', 'site_logo.png');
-			    if($res['code']){
-			        $file_name=$res['data']['file_name'];
-			        $upload['site_logo'] = $file_name;
-			    }else{
-			        $this->error($res['msg']);
-			    }
-			}
-			if (!empty($upload['site_logo'])) {
-			    $update_array['site_logo'] = $upload['site_logo'];
-			}
-			if (!empty($_FILES['member_logo']['name'])) {
-			    $res=ds_upload_pic(ATTACH_COMMON,'member_logo', 'member_logo.png');
-			    if($res['code']){
-			        $file_name=$res['data']['file_name'];
-			        $upload['member_logo'] = $file_name;
-			    }else{
-			        $this->error($res['msg']);
-			    }
-			}
-			if (!empty($upload['member_logo'])) {
-			    $update_array['member_logo'] = $upload['member_logo'];
-			}
-			if (!empty($_FILES['seller_center_logo']['name'])) {
-			    $res=ds_upload_pic(ATTACH_COMMON,'seller_center_logo', 'seller_center_logo.png');
-			    if($res['code']){
-			        $file_name=$res['data']['file_name'];
-			        $upload['seller_center_logo'] = $file_name;
-			    }else{
-			        $this->error($res['msg']);
-			    }
-			}
-			if (!empty($upload['seller_center_logo'])) {
-			    $update_array['seller_center_logo'] = $upload['seller_center_logo'];
-			}
-			if (!empty($_FILES['admin_backlogo']['name'])) {
-			    $res=ds_upload_pic('admin/common','admin_backlogo', 'backlogo.png');
-			    if($res['code']){
-			        $file_name=$res['data']['file_name'];
-			        $upload['admin_backlogo'] = $file_name;
-			    }else{
-			        $this->error($res['msg']);
-			    }
-			}
-			if (!empty($upload['admin_backlogo'])) {
-			    $update_array['admin_backlogo'] = $upload['admin_backlogo'];
-			}
-			
-			if (!empty($_FILES['admin_logo']['name'])) {
-			    $res=ds_upload_pic('admin/common','admin_logo', 'logo.png');
-			    if($res['code']){
-			        $file_name=$res['data']['file_name'];
-			        $upload['admin_logo'] = $file_name;
-			    }else{
-			        $this->error($res['msg']);
-			    }
-			}
-			if (!empty($upload['admin_logo'])) {
-			    $update_array['admin_logo'] = $upload['admin_logo'];
-			}
-			
-			
-			if (!empty($_FILES['site_mobile_logo']['name'])) {
-			    $res=ds_upload_pic(ATTACH_COMMON,'site_mobile_logo', 'site_mobile_logo.png');
-			    if($res['code']){
-			        $file_name=$res['data']['file_name'];
-			        $upload['site_mobile_logo'] = $file_name;
-			    }else{
-			        $this->error($res['msg']);
-			    }
-			}
-			if (!empty($upload['site_mobile_logo'])) {
-			    $update_array['site_mobile_logo'] = $upload['site_mobile_logo'];
-			}
-			
-			if (!empty($_FILES['site_logowx']['name'])) {
-			    $res=ds_upload_pic(ATTACH_COMMON,'site_logowx', 'site_logowx.png');
-			    if($res['code']){
-			        $file_name=$res['data']['file_name'];
-			        $upload['site_logowx'] = $file_name;
-			    }else{
-			        $this->error($res['msg']);
-			    }
-			}
-			if (!empty($upload['site_logowx'])) {
-			    $update_array['site_logowx'] = $upload['site_logowx'];
-			}
-			if (!empty($_FILES['business_licence']['name'])) {
-			    $res=ds_upload_pic(ATTACH_COMMON,'business_licence', 'business_licence.png');
-			    if($res['code']){
-			        $file_name=$res['data']['file_name'];
-			        $upload['business_licence'] = $file_name;
-			    }else{
-			        $this->error($res['msg']);
-			    }
-			}
-			if (!empty($upload['business_licence'])) {
-			    $update_array['business_licence'] = $upload['business_licence'];
-			}
-			$result = $config_model->editConfig($update_array);
-			if ($result) {
-			    $this->log(lang('ds_edit') . lang('web_set'), 1);
-			    $this->success(lang('ds_common_save_succ'), 'Config/logo');
-			} else {
-			    $this->log(lang('ds_edit') . lang('web_set'), 0);
-			}
-		}
-	}
+    public function logo()
+    {
+        $config_model = model('config');
+        if (!request()->isPost()) {
+            $list_config = rkcache('config', true);
+            View::assign('list_config', $list_config);
+            /* 设置卖家当前栏目 */
+            $this->setAdminCurItem('logo');
+            return View::fetch();
+        } else {
+            //上传文件保存路径
+            if (!empty($_FILES['site_logo']['name'])) {
+                $res = ds_upload_pic(ATTACH_COMMON, 'site_logo', 'site_logo.png');
+                if ($res['code']) {
+                    $file_name = $res['data']['file_name'];
+                    $upload['site_logo'] = $file_name;
+                } else {
+                    $this->error($res['msg']);
+                }
+            }
+            if (!empty($upload['site_logo'])) {
+                $update_array['site_logo'] = $upload['site_logo'];
+            }
+            if (!empty($_FILES['member_logo']['name'])) {
+                $res = ds_upload_pic(ATTACH_COMMON, 'member_logo', 'member_logo.png');
+                if ($res['code']) {
+                    $file_name = $res['data']['file_name'];
+                    $upload['member_logo'] = $file_name;
+                } else {
+                    $this->error($res['msg']);
+                }
+            }
+            if (!empty($upload['member_logo'])) {
+                $update_array['member_logo'] = $upload['member_logo'];
+            }
+            if (!empty($_FILES['seller_center_logo']['name'])) {
+                $res = ds_upload_pic(ATTACH_COMMON, 'seller_center_logo', 'seller_center_logo.png');
+                if ($res['code']) {
+                    $file_name = $res['data']['file_name'];
+                    $upload['seller_center_logo'] = $file_name;
+                } else {
+                    $this->error($res['msg']);
+                }
+            }
+            if (!empty($upload['seller_center_logo'])) {
+                $update_array['seller_center_logo'] = $upload['seller_center_logo'];
+            }
+            if (!empty($_FILES['admin_backlogo']['name'])) {
+                $res = ds_upload_pic('admin/common', 'admin_backlogo', 'backlogo.png');
+                if ($res['code']) {
+                    $file_name = $res['data']['file_name'];
+                    $upload['admin_backlogo'] = $file_name;
+                } else {
+                    $this->error($res['msg']);
+                }
+            }
+            if (!empty($upload['admin_backlogo'])) {
+                $update_array['admin_backlogo'] = $upload['admin_backlogo'];
+            }
+
+            if (!empty($_FILES['admin_logo']['name'])) {
+                $res = ds_upload_pic('admin/common', 'admin_logo', 'logo.png');
+                if ($res['code']) {
+                    $file_name = $res['data']['file_name'];
+                    $upload['admin_logo'] = $file_name;
+                } else {
+                    $this->error($res['msg']);
+                }
+            }
+            if (!empty($upload['admin_logo'])) {
+                $update_array['admin_logo'] = $upload['admin_logo'];
+            }
+
+
+            if (!empty($_FILES['site_mobile_logo']['name'])) {
+                $res = ds_upload_pic(ATTACH_COMMON, 'site_mobile_logo', 'site_mobile_logo.png');
+                if ($res['code']) {
+                    $file_name = $res['data']['file_name'];
+                    $upload['site_mobile_logo'] = $file_name;
+                } else {
+                    $this->error($res['msg']);
+                }
+            }
+            if (!empty($upload['site_mobile_logo'])) {
+                $update_array['site_mobile_logo'] = $upload['site_mobile_logo'];
+            }
+
+            if (!empty($_FILES['site_logowx']['name'])) {
+                $res = ds_upload_pic(ATTACH_COMMON, 'site_logowx', 'site_logowx.png');
+                if ($res['code']) {
+                    $file_name = $res['data']['file_name'];
+                    $upload['site_logowx'] = $file_name;
+                } else {
+                    $this->error($res['msg']);
+                }
+            }
+            if (!empty($upload['site_logowx'])) {
+                $update_array['site_logowx'] = $upload['site_logowx'];
+            }
+            if (!empty($_FILES['business_licence']['name'])) {
+                $res = ds_upload_pic(ATTACH_COMMON, 'business_licence', 'business_licence.png');
+                if ($res['code']) {
+                    $file_name = $res['data']['file_name'];
+                    $upload['business_licence'] = $file_name;
+                } else {
+                    $this->error($res['msg']);
+                }
+            }
+            if (!empty($upload['business_licence'])) {
+                $update_array['business_licence'] = $upload['business_licence'];
+            }
+            $result = $config_model->editConfig($update_array);
+            if ($result) {
+                $this->log(lang('ds_edit') . lang('web_set'), 1);
+                $this->success(lang('ds_common_save_succ'), 'Config/logo');
+            } else {
+                $this->log(lang('ds_edit') . lang('web_set'), 0);
+            }
+        }
+    }
 
     /**
      * 敏感词过滤设置
      */
-    public function word_filter() {
+    public function word_filter()
+    {
         $config_model = model('config');
         if (!request()->isPost()) {
             $list_config = rkcache('config', true);
@@ -239,7 +243,8 @@ class Config extends AdminControl {
     /**
      * 防灌水设置
      */
-    public function dump() {
+    public function dump()
+    {
         $config_model = model('config');
         if (!request()->isPost()) {
             $list_config = rkcache('config', true);
@@ -266,13 +271,14 @@ class Config extends AdminControl {
         }
     }
 
- 
+
 
     /*
      * 设置自动收货时间
      */
 
-    public function auto() {
+    public function auto()
+    {
         $config_model = model('config');
         if (!request()->isPost()) {
             $list_config = rkcache('config', true);
@@ -315,18 +321,19 @@ class Config extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'base',
                 'text' => lang('ds_base'),
                 'url' => (string) url('Config/base')
             ),
-			array(
-			    'name' => 'logo',
-			    'text' => lang('ds_logo'),
-			    'url' => (string) url('Config/logo')
-			),
+            array(
+                'name' => 'logo',
+                'text' => lang('ds_logo'),
+                'url' => (string) url('Config/logo')
+            ),
             array(
                 'name' => 'dump',
                 'text' => lang('dis_dump'),
@@ -345,5 +352,4 @@ class Config extends AdminControl {
         );
         return $menu_array;
     }
-
 }

+ 42 - 34
app/admin/controller/Consulting.php

@@ -1,52 +1,55 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Consulting extends AdminControl {
+class Consulting extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/consulting.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/consulting.lang.php');
     }
 
     /**
      * 咨询管理
      */
-    public function consulting() {
+    public function consulting()
+    {
         $condition = array();
         $member_name = trim(input('param.member_name'));
         if ($member_name != '') {
-            $condition[]=array('member_name','like', '%' . $member_name . '%');
+            $condition[] = array('member_name', 'like', '%' . $member_name . '%');
             View::assign('member_name', $member_name);
         }
         $consult_content = trim(input('param.consult_content'));
         if ($consult_content != '') {
-            $condition[]=array('consult_content','like', '%' . $consult_content . '%');
+            $condition[] = array('consult_content', 'like', '%' . $consult_content . '%');
             View::assign('consult_content', $consult_content);
         }
         $ctid = intval(input('param.ctid'));
         if ($ctid > 0) {
-            $condition[]=array('consulttype_id','=',$ctid);
+            $condition[] = array('consulttype_id', '=', $ctid);
             View::assign('ctid', $ctid);
         }
         $consult_model = model('consult');
         $consult_list = $consult_model->getConsultList($condition, '*');
-        
+
         View::assign('filtered', $condition ? 1 : 0); //是否有查询条件
-        
+
         View::assign('show_page', $consult_model->page_info->render());
         View::assign('consult_list', $consult_list);
 
@@ -58,14 +61,15 @@ class Consulting extends AdminControl {
         return View::fetch();
     }
 
-    public function delete() {
+    public function delete()
+    {
         $consult_id = input('param.consult_id');
         $consult_id_array = ds_delete_param($consult_id);
-        if($consult_id_array === FALSE){
+        if ($consult_id_array === FALSE) {
             $this->error(lang('param_error'));
         }
-        $condition=array();
-        $condition[] = array('consult_id','in', $consult_id_array);
+        $condition = array();
+        $condition[] = array('consult_id', 'in', $consult_id_array);
         $consult = model('consult');
         if ($consult->delConsult($condition)) {
             $this->log(lang('delete_consulting') . '[ID:' . $consult_id . ']', null);
@@ -79,7 +83,8 @@ class Consulting extends AdminControl {
     /**
      * 咨询类型列表
      */
-    public function type_list() {
+    public function type_list()
+    {
         $consulttype_model = model('consulttype');
         $type_list = $consulttype_model->getConsulttypeList(array(), 'consulttype_id,consulttype_name,consulttype_sort');
         View::assign('type_list', $type_list);
@@ -90,7 +95,8 @@ class Consulting extends AdminControl {
     /**
      * 新增咨询类型
      */
-    public function type_add() {
+    public function type_add()
+    {
         if (request()->isPost()) {
             // 验证
             $data = [
@@ -131,7 +137,8 @@ class Consulting extends AdminControl {
     /**
      * 编辑咨询类型
      */
-    public function type_edit() {
+    public function type_edit()
+    {
         $consulttype_model = model('consulttype');
         $consulttype_id = intval(input('param.consulttype_id'));
         if ($consulttype_id <= 0) {
@@ -149,20 +156,20 @@ class Consulting extends AdminControl {
             }
 
             $condition = array();
-            $condition[] = array('consulttype_id','=',$consulttype_id);
+            $condition[] = array('consulttype_id', '=', $consulttype_id);
             $update = array();
             $update['consulttype_name'] = trim(input('post.consulttype_name'));
             $update['consulttype_sort'] = intval(input('post.consulttype_sort'));
             $update['consulttype_introduce'] = input('post.consulttype_introduce');
             $result = $consulttype_model->editConsulttype($condition, $update);
             if ($result) {
-                $this->log(lang('edit_consulttype').' ID:' . $consulttype_id, 1);
+                $this->log(lang('edit_consulttype') . ' ID:' . $consulttype_id, 1);
                 dsLayerOpenSuccess(lang('ds_common_op_succ'));
             } else {
-                $this->log(lang('edit_consulttype').' ID:' . $consulttype_id, 0);
+                $this->log(lang('edit_consulttype') . ' ID:' . $consulttype_id, 0);
                 $this->error(lang('ds_common_op_fail'));
             }
-        }else {
+        } else {
             $consulttype_info = $consulttype_model->getConsulttypeInfo(array('consulttype_id' => $consulttype_id));
             View::assign('build_editor', build_editor(array(
                 'name' => 'consulttype_introduce',
@@ -177,20 +184,21 @@ class Consulting extends AdminControl {
     /**
      * 删除咨询类型
      */
-    public function type_del() {
+    public function type_del()
+    {
         $consulttype_id = input('param.consulttype_id');
         $consulttype_id_array = ds_delete_param($consulttype_id);
         if ($consulttype_id_array === FALSE) {
             ds_json_encode('10001', lang('param_error'));
         }
-        $condition=array();
-        $condition[]=array('consulttype_id','in',$consulttype_id_array);
+        $condition = array();
+        $condition[] = array('consulttype_id', 'in', $consulttype_id_array);
         $result = model('consulttype')->delConsulttype($condition);
         if ($result) {
-            $this->log(lang('del_consulttype').' ID:' . $consulttype_id, 1);
+            $this->log(lang('del_consulttype') . ' ID:' . $consulttype_id, 1);
             ds_json_encode('10000', lang('ds_common_op_succ'));
         } else {
-            $this->log(lang('del_consulttype').' ID:' . $consulttype_id, 0);
+            $this->log(lang('del_consulttype') . ' ID:' . $consulttype_id, 0);
             ds_json_encode('10001', lang('ds_common_op_fail'));
         }
     }
@@ -198,7 +206,8 @@ class Consulting extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -213,11 +222,10 @@ class Consulting extends AdminControl {
             array(
                 'name' => 'type_add',
                 'text' => lang('add_consulttype'),
-                'url' =>"javascript:dsLayerOpen('".(string)url('Consulting/type_add')."','".lang('add_consulttype')."')"
+                'url' => "javascript:dsLayerOpen('" . (string)url('Consulting/type_add') . "','" . lang('add_consulttype') . "')"
 
             )
         );
         return $menu_array;
     }
-
-}
+}

+ 165 - 142
app/admin/controller/Dashboard.php

@@ -1,30 +1,34 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Db;
 use think\facade\Lang;
+
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Dashboard extends AdminControl {
+class Dashboard extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/dashboard.lang.php');
-        include_once root_path(). 'extend/mall/statistics.php';
-        include_once root_path(). 'extend/mall/datehelper.php';
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/dashboard.lang.php');
+        include_once root_path() . 'extend/mall/statistics.php';
+        include_once root_path() . 'extend/mall/datehelper.php';
     }
 
-    function index() {
+    function index()
+    {
         $this->welcome();
     }
 
@@ -32,15 +36,16 @@ class Dashboard extends AdminControl {
      * 检查是否为最新版本
      */
 
-    function version() {
+    function version()
+    {
         //当前版本
         $curent_version = file_get_contents(base_path() . 'version.php');
         //获取最新版本信息
         $vaules = array(
-            'domain'=>$_SERVER['HTTP_HOST'], 
-            'version'=>$curent_version, 
+            'domain' => $_SERVER['HTTP_HOST'],
+            'version' => $curent_version,
         );
-        $service_url = "http://service.csdeshang.com/index.php/home/Version/checkDsmall.html?".http_build_query($vaules);
+        $service_url = "http://service.csdeshang.com/index.php/home/Version/checkDsmall.html?" . http_build_query($vaules);
         //设置超时时间
         $opts = array(
             'http' =>
@@ -49,12 +54,13 @@ class Dashboard extends AdminControl {
             )
         );
         $context = stream_context_create($opts);
-        $service_info = @file_get_contents($service_url,FALSE,$context);
+        $service_info = @file_get_contents($service_url, FALSE, $context);
         $version_message = json_decode($service_info);
         View::assign('version_message', $version_message);
     }
 
-    function welcome() {
+    function welcome()
+    {
         $this->version();
         /**
          * 管理员信息
@@ -62,7 +68,7 @@ class Dashboard extends AdminControl {
         $admin_model = model('admin');
         $tmp = $this->getAdminInfo();
         $condition = array();
-        $condition[] = array('admin_id','=',$tmp['admin_id']);
+        $condition[] = array('admin_id', '=', $tmp['admin_id']);
         $admin_info = $admin_model->infoAdmin($condition);
         $admin_info['admin_login_time'] = date('Y-m-d H:i:s', ($admin_info['admin_login_time'] == '' ? TIMESTAMP : $admin_info['admin_login_time']));
         /**
@@ -80,7 +86,7 @@ class Dashboard extends AdminControl {
         $statistics['domain'] = $_SERVER['HTTP_HOST'];
         $statistics['ip'] = GetHostByName($_SERVER['SERVER_NAME']);
         $statistics['zlib'] = function_exists('gzclose') ? 'YES' : 'NO'; //zlib
-        $statistics['safe_mode'] = (boolean) ini_get('safe_mode') ? 'YES' : 'NO'; //safe_mode = Off
+        $statistics['safe_mode'] = (bool) ini_get('safe_mode') ? 'YES' : 'NO'; //safe_mode = Off
         $statistics['timezone'] = function_exists("date_default_timezone_get") ? date_default_timezone_get() : "no_timezone";
         $statistics['curl'] = function_exists('curl_init') ? 'YES' : 'NO';
         $statistics['fileupload'] = @ini_get('file_uploads') ? ini_get('upload_max_filesize') : 'unknown';
@@ -109,7 +115,7 @@ class Dashboard extends AdminControl {
         $this->_get_week_store();
         $this->_get_week_order();
     }
-     /**
+    /**
      * 获取本周新增订单数量
      */
     private function _get_week_order()
@@ -142,9 +148,9 @@ class Dashboard extends AdminControl {
             unset($tmp_weekarr);
         }
         $where = array();
-        $where[] = array('add_time','between', array($stime, $etime));
+        $where[] = array('add_time', 'between', array($stime, $etime));
         $field .= ',WEEKOFYEAR(FROM_UNIXTIME(add_time)) as weekval,WEEKDAY(FROM_UNIXTIME(add_time))+1 as dayofweekval ';
-        
+
         $orderlist = Db::name('order')->field($field)->where($where)->group('weekval,dayofweekval')->select()->toArray();
 
         if ($orderlist) {
@@ -152,18 +158,18 @@ class Dashboard extends AdminControl {
                 if ($up_week == intval($v['weekval'])) {
                     $up_arr[$v['dayofweekval']] = intval($v['allnum']);
                     $uplist_arr[$v['dayofweekval']]['val'] = intval($v['allnum']);
-                    if(isset($count_arr['up'])){
+                    if (isset($count_arr['up'])) {
                         $count_arr['up'] += intval($v['allnum']);
-                    }else{
+                    } else {
                         $count_arr['up'] = 0;
                     }
                 }
                 if ($curr_week == $v['weekval']) {
                     $curr_arr[$v['dayofweekval']] = intval($v['allnum']);
                     $currlist_arr[$v['dayofweekval']]['val'] = intval($v['allnum']);
-                    if(isset($count_arr['curr'])){
+                    if (isset($count_arr['curr'])) {
                         $count_arr['curr'] += intval($v['allnum']);
-                    }else{
+                    } else {
                         $count_arr['curr'] = 0;
                     }
                 }
@@ -181,7 +187,7 @@ class Dashboard extends AdminControl {
         $stat_json = getStatData_LineLabels($stat_arr);
         View::assign('stat_json_week_order', $stat_json);
     }
-        /**
+    /**
      * 获取本周新增店铺数量
      */
     private function _get_week_store()
@@ -214,9 +220,9 @@ class Dashboard extends AdminControl {
             unset($tmp_weekarr);
         }
         $where = array();
-        $where[] = array('store_addtime','between', array($stime, $etime));
+        $where[] = array('store_addtime', 'between', array($stime, $etime));
         $field .= ',WEEKOFYEAR(FROM_UNIXTIME(store_addtime)) as weekval,WEEKDAY(FROM_UNIXTIME(store_addtime))+1 as dayofweekval ';
-        
+
         $storelist = Db::name('store')->field($field)->where($where)->group('weekval,dayofweekval')->select()->toArray();
 
         if ($storelist) {
@@ -224,18 +230,18 @@ class Dashboard extends AdminControl {
                 if ($up_week == intval($v['weekval'])) {
                     $up_arr[$v['dayofweekval']] = intval($v['allnum']);
                     $uplist_arr[$v['dayofweekval']]['val'] = intval($v['allnum']);
-                    if(isset($count_arr['up'])){
+                    if (isset($count_arr['up'])) {
                         $count_arr['up'] += intval($v['allnum']);
-                    }else{
+                    } else {
                         $count_arr['up'] = 0;
                     }
                 }
                 if ($curr_week == $v['weekval']) {
                     $curr_arr[$v['dayofweekval']] = intval($v['allnum']);
                     $currlist_arr[$v['dayofweekval']]['val'] = intval($v['allnum']);
-                    if(isset($count_arr['curr'])){
+                    if (isset($count_arr['curr'])) {
                         $count_arr['curr'] += intval($v['allnum']);
-                    }else{
+                    } else {
                         $count_arr['curr'] = 0;
                     }
                 }
@@ -257,7 +263,8 @@ class Dashboard extends AdminControl {
     /**
      * 获取本周新增商品数量
      */
-    private function _get_week_goods() {
+    private function _get_week_goods()
+    {
         $field = ' COUNT(*) as allnum ';
         $current_weekarr = getWeek_SdateAndEdate(TIMESTAMP);
         $stime = strtotime($current_weekarr['sdate']) - 86400 * 7;
@@ -286,9 +293,9 @@ class Dashboard extends AdminControl {
             unset($tmp_weekarr);
         }
         $where = array();
-        $where[] = array('goods_addtime','between', array($stime, $etime));
+        $where[] = array('goods_addtime', 'between', array($stime, $etime));
         $field .= ',WEEKOFYEAR(FROM_UNIXTIME(goods_addtime)) as weekval,WEEKDAY(FROM_UNIXTIME(goods_addtime))+1 as dayofweekval ';
-        
+
         $goodslist = Db::name('goodscommon')->field($field)->where($where)->group('weekval,dayofweekval')->select()->toArray();
 
         if ($goodslist) {
@@ -296,25 +303,25 @@ class Dashboard extends AdminControl {
                 if ($up_week == intval($v['weekval'])) {
                     $up_arr[$v['dayofweekval']] = intval($v['allnum']);
                     $uplist_arr[$v['dayofweekval']]['val'] = intval($v['allnum']);
-                    if(isset($count_arr['up'])){
+                    if (isset($count_arr['up'])) {
                         $count_arr['up'] += intval($v['allnum']);
-                    }else{
+                    } else {
                         $count_arr['up'] = 0;
                     }
                 }
                 if ($curr_week == $v['weekval']) {
                     $curr_arr[$v['dayofweekval']] = intval($v['allnum']);
                     $currlist_arr[$v['dayofweekval']]['val'] = intval($v['allnum']);
-                    if(isset($count_arr['curr'])){
+                    if (isset($count_arr['curr'])) {
                         $count_arr['curr'] += intval($v['allnum']);
-                    }else{
+                    } else {
                         $count_arr['curr'] = 0;
                     }
                 }
             }
         }
-        
-        
+
+
 
         $stat_arr['series'][0]['name'] = lang('last_week');
         $stat_arr['series'][0]['data'] = array_values($up_arr);
@@ -327,11 +334,12 @@ class Dashboard extends AdminControl {
         $stat_json = getStatData_LineLabels($stat_arr);
         View::assign('stat_json_week_goods', $stat_json);
     }
-    
-     /**
+
+    /**
      * 获取本周新增会员数量
      */
-    private function _get_week_member() {
+    private function _get_week_member()
+    {
         $field = ' COUNT(*) as allnum ';
         $current_weekarr = getWeek_SdateAndEdate(TIMESTAMP);
         $stime = strtotime($current_weekarr['sdate']) - 86400 * 7;
@@ -360,7 +368,7 @@ class Dashboard extends AdminControl {
             unset($tmp_weekarr);
         }
         $where = array();
-        $where[] = array('member_addtime','between', array($stime, $etime));
+        $where[] = array('member_addtime', 'between', array($stime, $etime));
         $field .= ',WEEKOFYEAR(FROM_UNIXTIME(member_addtime)) as weekval,WEEKDAY(FROM_UNIXTIME(member_addtime))+1 as dayofweekval ';
         $memberlist = Db::name('member')->field($field)->where($where)->group('weekval,dayofweekval')->select()->toArray();
 
@@ -369,24 +377,24 @@ class Dashboard extends AdminControl {
                 if ($up_week == intval($v['weekval'])) {
                     $up_arr[$v['dayofweekval']] = intval($v['allnum']);
                     $uplist_arr[$v['dayofweekval']]['val'] = intval($v['allnum']);
-                    if(isset($count_arr['up'])){
+                    if (isset($count_arr['up'])) {
                         $count_arr['up'] += intval($v['allnum']);
-                    }else{
+                    } else {
                         $count_arr['up'] = 0;
                     }
                 }
                 if ($curr_week == $v['weekval']) {
                     $curr_arr[$v['dayofweekval']] = intval($v['allnum']);
                     $currlist_arr[$v['dayofweekval']]['val'] = intval($v['allnum']);
-                    if(isset($count_arr['curr'])){
+                    if (isset($count_arr['curr'])) {
                         $count_arr['curr'] += intval($v['allnum']);
-                    }else{
+                    } else {
                         $count_arr['curr'] = 0;
                     }
                 }
             }
         }
-        
+
         $stat_arr['series'][0]['name'] = lang('last_week');
         $stat_arr['series'][0]['data'] = array_values($up_arr);
         $stat_arr['series'][1]['name'] = lang('this_week');
@@ -402,12 +410,14 @@ class Dashboard extends AdminControl {
     /**
      * 获取当前数据库版本
      */
-    private function _mysql_version() {
+    private function _mysql_version()
+    {
         $version = Db::query("select version() as ver");
         return $version[0]['ver'];
     }
 
-    function aboutus() {
+    function aboutus()
+    {
         $this->setAdminCurItem('aboutus');
         return View::fetch();
     }
@@ -415,7 +425,8 @@ class Dashboard extends AdminControl {
     /**
      * 统计
      */
-    public function statistics() {
+    public function statistics()
+    {
         $statistics = array();
         // 本周开始时间点
         $tmp_time = mktime(0, 0, 0, date('m'), date('d'), date('Y')) - (date('w') == 0 ? 7 : date('w') - 1) * 24 * 60 * 60;
@@ -426,11 +437,11 @@ class Dashboard extends AdminControl {
         // 会员总数
         $statistics['member'] = $member_model->getMemberCount(array());
         // 新增会员数
-        $statistics['week_add_member'] = $member_model->getMemberCount(array(array('member_addtime','>=', $tmp_time)));
+        $statistics['week_add_member'] = $member_model->getMemberCount(array(array('member_addtime', '>=', $tmp_time)));
         // 预存款提现
         $statistics['cashlist'] = model('predeposit')->getPdcashCount(array('pdc_payment_state' => 0));
         // 会员认证
-        $statistics['member_auth'] = $member_model->getMemberCount(array(array('member_auth_state' ,'=', 1)));
+        $statistics['member_auth'] = $member_model->getMemberCount(array(array('member_auth_state', '=', 1)));
 
         /**
          * 店铺
@@ -439,15 +450,15 @@ class Dashboard extends AdminControl {
         // 店铺总数
         $statistics['store'] = model('store')->getStoreCount(array());
         // 店铺申请数
-        $statistics['store_joinin'] = model('storejoinin')->getStorejoininCount(array(array('joinin_state','in', array(10, 11))));
+        $statistics['store_joinin'] = model('storejoinin')->getStorejoininCount(array(array('joinin_state', 'in', array(10, 11))));
         //经营类目申请
         $statistics['store_bind_class_applay'] = model('storebindclass')->getStorebindclassCount(array('storebindclass_state' => 0));
         //店铺续签申请
         $statistics['store_reopen_applay'] = model('storereopen')->getStorereopenCount(array('storereopen_state' => 1));
         // 即将到期
-        $statistics['store_expire'] = $store_model->getStoreCount(array(array('store_state','=',1),array('store_endtime','between',array(TIMESTAMP, TIMESTAMP + 864000))));
+        $statistics['store_expire'] = $store_model->getStoreCount(array(array('store_state', '=', 1), array('store_endtime', 'between', array(TIMESTAMP, TIMESTAMP + 864000))));
         // 已经到期
-        $statistics['store_expired'] = $store_model->getStoreCount(array(array('store_state','=',1),array('store_endtime','between',array(1, TIMESTAMP))));
+        $statistics['store_expired'] = $store_model->getStoreCount(array(array('store_state', '=', 1), array('store_endtime', 'between', array(1, TIMESTAMP))));
 
         /**
          * 商品
@@ -456,7 +467,7 @@ class Dashboard extends AdminControl {
         // 商品总数
         $statistics['goods'] = $goods_model->getGoodsCommonCount(array());
         // 新增商品数
-        $statistics['week_add_product'] = $goods_model->getGoodsCommonCount(array(array('goods_addtime','>=', $tmp_time)));
+        $statistics['week_add_product'] = $goods_model->getGoodsCommonCount(array(array('goods_addtime', '>=', $tmp_time)));
         // 等待审核
         $statistics['product_verify'] = $goods_model->getGoodsCommonWaitVerifyCount(array());
         // 举报
@@ -491,14 +502,14 @@ class Dashboard extends AdminControl {
         $statistics['groupbuy_verify_list'] = model('groupbuy')->getGroupbuyCount(array('groupbuy_state' => 10));
         // 积分订单
         $pointsorder_model = model('pointorder');
-        $condition =array();
-        $condition =array(array('point_orderstate','in', array(11, 20)));
+        $condition = array();
+        $condition = array(array('point_orderstate', 'in', array(11, 20)));
         $statistics['points_order'] = $pointsorder_model->getPointorderCount($condition);
         //待审核账单
         $bill_model = model('bill');
-        $statistics['check_billno'] = $bill_model->getOrderbillCount(array('ob_state'=>BILL_STATE_STORE_COFIRM));
+        $statistics['check_billno'] = $bill_model->getOrderbillCount(array('ob_state' => BILL_STATE_STORE_COFIRM));
         //待支付账单
-        $statistics['pay_billno'] = $bill_model->getOrderbillCount(array('ob_state'=>BILL_STATE_STORE_COFIRM));
+        $statistics['pay_billno'] = $bill_model->getOrderbillCount(array('ob_state' => BILL_STATE_STORE_COFIRM));
         // 平台客服
         $statistics['mall_consult'] = model('mallconsult')->getMallconsultCount(array('mallconsult_isreply' => 0));
         // 服务站
@@ -510,31 +521,34 @@ class Dashboard extends AdminControl {
     /**
      * h5链接
      */
-    public function h5_link(){
+    public function h5_link()
+    {
         return View::fetch();
     }
-    public function h5_activity(){
+    public function h5_activity()
+    {
         $activity_model = model('activity');
-        $keyword=input('param.keyword');
+        $keyword = input('param.keyword');
         $condition = array();
-        $condition[] = array('activity_type','=',1); //只显示商品活动
-        $condition[] = array('activity_state','=',1);
-        if($keyword){
-            $condition[] = array('activity_title','like','%'.$keyword.'%');
+        $condition[] = array('activity_type', '=', 1); //只显示商品活动
+        $condition[] = array('activity_state', '=', 1);
+        if ($keyword) {
+            $condition[] = array('activity_title', 'like', '%' . $keyword . '%');
         }
-        $activity_list = $activity_model->getActivityList($condition, 10 , 'activity_sort asc');
+        $activity_list = $activity_model->getActivityList($condition, 10, 'activity_sort asc');
         View::assign('show_page', $activity_model->page_info->render());
         View::assign('activity_list', $activity_list);
         return View::fetch();
     }
-    public function h5_live(){
+    public function h5_live()
+    {
         $condition = array();
         $store_model = model('store');
-        $keyword=input('param.keyword');
+        $keyword = input('param.keyword');
         if (config('ds_config.live_type') == 1) {
             $minipro_live_model = model('minipro_live');
-            if($keyword){
-                $condition[] = array('minipro_live_name','like','%'.$keyword.'%');
+            if ($keyword) {
+                $condition[] = array('minipro_live_name', 'like', '%' . $keyword . '%');
             }
             $minipro_live_list = $minipro_live_model->getMiniproLiveList($condition);
             $store_list = array();
@@ -549,10 +563,10 @@ class Dashboard extends AdminControl {
         } else {
             $live_apply_model = model('live_apply');
             $condition[] = array('live_apply_state', '=', 1);
-            if($keyword){
-                $condition[] = array('live_apply_name','like','%'.$keyword.'%');
+            if ($keyword) {
+                $condition[] = array('live_apply_name', 'like', '%' . $keyword . '%');
             }
-            
+
 
             $live_apply_list = $live_apply_model->getLiveApplyList($condition, '*', 10, 'live_apply_state asc,live_apply_id desc');
 
@@ -573,13 +587,14 @@ class Dashboard extends AdminControl {
         }
         return View::fetch();
     }
-    public function h5_market(){
+    public function h5_market()
+    {
         $condition = array();
-        $keyword=input('param.keyword');
-        $marketmanage_type=intval(input('param.type'));
-        $condition[]=array('marketmanage_type','=',$marketmanage_type);
-        if($keyword){
-            $condition[] = array('marketmanage_name','like','%'.$keyword.'%');
+        $keyword = input('param.keyword');
+        $marketmanage_type = intval(input('param.type'));
+        $condition[] = array('marketmanage_type', '=', $marketmanage_type);
+        if ($keyword) {
+            $condition[] = array('marketmanage_name', 'like', '%' . $keyword . '%');
         }
         $marketmanage_model = model('marketmanage');
         $marketmanage_list = $marketmanage_model->getMarketmanageList($condition, 10);
@@ -587,13 +602,14 @@ class Dashboard extends AdminControl {
         View::assign('show_page', $marketmanage_model->page_info->render());
         return View::fetch();
     }
-    public function h5_bonus(){
-        $keyword=input('param.keyword');
+    public function h5_bonus()
+    {
+        $keyword = input('param.keyword');
         $condition = array();
-        $condition[]=array('bonus_state','=',1);
-        $condition[]=array('bonus_type','=',1);
-        if($keyword){
-            $condition[] = array('bonus_name','like','%'.$keyword.'%');
+        $condition[] = array('bonus_state', '=', 1);
+        $condition[] = array('bonus_type', '=', 1);
+        if ($keyword) {
+            $condition[] = array('bonus_name', 'like', '%' . $keyword . '%');
         }
         $bonus_model = model('bonus');
         $bonus_list = $bonus_model->getBonusList($condition, 10);
@@ -601,28 +617,30 @@ class Dashboard extends AdminControl {
         View::assign('show_page', $bonus_model->page_info->render());
         return View::fetch();
     }
-    public function h5_special(){
-        $keyword=input('param.keyword');
+    public function h5_special()
+    {
+        $keyword = input('param.keyword');
         $editable_page_model = model('editable_page');
-        $store_id=intval(input('param.store_id'));
+        $store_id = intval(input('param.store_id'));
         $condition = array();
-        $condition[]=array('store_id','=',$store_id);
-        $condition[]=array('editable_page_client','=','h5');
-        if($keyword){
-            $condition[] = array('editable_page_name','like','%'.$keyword.'%');
+        $condition[] = array('store_id', '=', $store_id);
+        $condition[] = array('editable_page_client', '=', 'h5');
+        if ($keyword) {
+            $condition[] = array('editable_page_name', 'like', '%' . $keyword . '%');
         }
         $editable_page_list = $editable_page_model->getEditablePageList($condition, 10);
         View::assign('show_page', $editable_page_model->page_info->render());
         View::assign('editable_page_list', $editable_page_list);
         return View::fetch();
     }
-    public function h5_point_prod(){
-        $keyword=input('param.keyword');
+    public function h5_point_prod()
+    {
+        $keyword = input('param.keyword');
         $pointprod_model = model('pointprod');
         $condition = array();
         $condition[] = array('pgoods_show', '=', 1);
-        if($keyword){
-            $condition[] = array('pgoods_name','like','%'.$keyword.'%');
+        if ($keyword) {
+            $condition[] = array('pgoods_name', 'like', '%' . $keyword . '%');
         }
         $prod_list = $pointprod_model->getPointProdList($condition, '*', 'pgoods_sort asc,pgoods_id desc', 0, 10);
         //信息输出
@@ -630,79 +648,86 @@ class Dashboard extends AdminControl {
         View::assign('show_page', $pointprod_model->page_info->render());
         return View::fetch();
     }
-    public function h5_article_class(){
-        if(input('param.ajax')==1){
+    public function h5_article_class()
+    {
+        if (input('param.ajax') == 1) {
             $articleclass_model = model('articleclass');
-            $parent_id=intval(input('param.parent_id'));
-            $condition=array();
-            $condition[]=array('ac_parent_id','=',$parent_id);
-            $data=$articleclass_model->getArticleclassList($condition);
+            $parent_id = intval(input('param.parent_id'));
+            $condition = array();
+            $condition[] = array('ac_parent_id', '=', $parent_id);
+            $data = $articleclass_model->getArticleclassList($condition);
             ds_json_encode(10000, '', $data);
-        }else{
+        } else {
             return View::fetch();
         }
     }
-    public function h5_article(){
-        $keyword=input('param.keyword');
+    public function h5_article()
+    {
+        $keyword = input('param.keyword');
         $article_model = model('article');
-        $condition=array();
-        $condition[]=array('article_show','=',1);
-        if($keyword){
-            $condition[] = array('article_title','like','%'.$keyword.'%');
+        $condition = array();
+        $condition[] = array('article_show', '=', 1);
+        if ($keyword) {
+            $condition[] = array('article_title', 'like', '%' . $keyword . '%');
         }
         $article_list = $article_model->getArticleList($condition, 10);
         return View::fetch();
     }
-    public function h5_document(){
-        $condition=array();
-        $keyword=input('param.keyword');
+    public function h5_document()
+    {
+        $condition = array();
+        $keyword = input('param.keyword');
         $document_model = model('document');
-        if($keyword){
-            $condition[] = array('document_title','like','%'.$keyword.'%');
+        if ($keyword) {
+            $condition[] = array('document_title', 'like', '%' . $keyword . '%');
         }
         $doc_list = $document_model->getDocumentList($condition);
         View::assign('doc_list', $doc_list);
         return View::fetch();
     }
-    public function h5_store_class(){
+    public function h5_store_class()
+    {
         $storeclass_model = model('storeclass');
-        $keyword=input('param.keyword');
+        $keyword = input('param.keyword');
         $store_class_list = $storeclass_model->getStoreclassList(array(), 10);
         View::assign('class_list', $store_class_list);
         View::assign('show_page', $storeclass_model->page_info->render());
         return View::fetch();
     }
-    public function h5_store(){
-        $keyword=input('param.keyword');
-        $store_model=model('store');
-        $condition=array();
+    public function h5_store()
+    {
+        $keyword = input('param.keyword');
+        $store_model = model('store');
+        $condition = array();
         $condition[] = array('store_state', '=', 1);
-        if($keyword){
-            $condition[] = array('store_name','like','%'.$keyword.'%');
+        if ($keyword) {
+            $condition[] = array('store_name', 'like', '%' . $keyword . '%');
         }
         $store_list = $store_model->getStoreList($condition, 10, 'store_id desc');
         View::assign('store_list', $store_list);
         View::assign('show_page', $store_model->page_info->render());
         return View::fetch();
     }
-    public function h5_goods_class(){
-        if(input('param.ajax')==1){
+    public function h5_goods_class()
+    {
+        if (input('param.ajax') == 1) {
             $goodsclass_model = model('goodsclass');
-            $parent_id=intval(input('param.parent_id'));
-            $data=$goodsclass_model->getGoodsclassListByParentId($parent_id);
+            $parent_id = intval(input('param.parent_id'));
+            $data = $goodsclass_model->getGoodsclassListByParentId($parent_id);
             ds_json_encode(10000, '', $data);
-        }else{
+        } else {
             return View::fetch();
         }
     }
-    public function h5_goods(){
-        $keyword=input('param.keyword');
+    public function h5_goods()
+    {
+        $keyword = input('param.keyword');
         $goods_model = model('goods');
-        $condition=array();
-        $condition[]=array('goods_state','=',1);
-        $condition[]=array('goods_verify','=',1);
-        if($keyword){
-            $condition[] = array('goods_name','like','%'.$keyword.'%');
+        $condition = array();
+        $condition[] = array('goods_state', '=', 1);
+        $condition[] = array('goods_verify', '=', 1);
+        if ($keyword) {
+            $condition[] = array('goods_name', 'like', '%' . $keyword . '%');
         }
         $goods_list = $goods_model->getGoodsList($condition, '*', '', '', 0, 10);
         View::assign('goods_list', $goods_list);
@@ -710,5 +735,3 @@ class Dashboard extends AdminControl {
         return View::fetch();
     }
 }
-
-?>

+ 40 - 29
app/admin/controller/Database.php

@@ -1,6 +1,7 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Db;
 use think\facade\Lang;
@@ -9,31 +10,33 @@ use think\facade\Lang;
 define('DATA_BACKUP_PATH', 'uploads/sqldata/');
 //数据库备份卷大小  20971520表示为 20M
 //define('DATA_BACKUP_PART_SIZE', 20971520);
-define('DATA_BACKUP_PART_SIZE', 1024*1024*10);
+define('DATA_BACKUP_PART_SIZE', 1024 * 1024 * 10);
 //数据库备份文件是否启用压缩
 define('DATA_BACKUP_COMPRESS', 0);
 //数据库备份文件压缩级别
 define('DATA_BACKUP_COMPRESS_LEVEL', 9);
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Database extends AdminControl {
+class Database extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/db.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/db.lang.php');
     }
 
-    public function db() {
+    public function db()
+    {
         $dbtable_list = Db::query('SHOW TABLE STATUS');
         $total = 0;
         foreach ($dbtable_list as $k => $v) {
@@ -47,7 +50,8 @@ class Database extends AdminControl {
         return View::fetch();
     }
 
-    public function export($tables = null, $id = null, $start = null) {
+    public function export($tables = null, $id = null, $start = null)
+    {
         //防止备份数据过程超时
         function_exists('set_time_limit') && set_time_limit(0);
         if (request()->isPost() && !empty($tables) && is_array($tables)) { //初始化
@@ -114,7 +118,7 @@ class Database extends AdminControl {
             } else {
                 $tab = array('id' => $id, 'start' => $start[0]);
                 $rate = floor(100 * ($start[0] / $start[1]));
-                return json(array('tab' => $tab, 'info' => lang('backup_in_progress')."...({$rate}%)", 'status' => 1, 'url' => ''));
+                return json(array('tab' => $tab, 'info' => lang('backup_in_progress') . "...({$rate}%)", 'status' => 1, 'url' => ''));
             }
         } else {
             //出错
@@ -122,7 +126,8 @@ class Database extends AdminControl {
         }
     }
 
-    public function restore() {
+    public function restore()
+    {
         $path = DATA_BACKUP_PATH;
         if (!is_dir($path)) {
             mkdir($path, 0755, true);
@@ -167,7 +172,8 @@ class Database extends AdminControl {
      * @param null $part
      * @param null $start
      */
-    public function import($time = 0, $part = null, $start = null) {
+    public function import($time = 0, $part = null, $start = null)
+    {
         function_exists('set_time_limit') && set_time_limit(0);
 
         if (is_numeric($time) && is_null($part) && is_null($start)) { //初始化
@@ -188,15 +194,18 @@ class Database extends AdminControl {
             $last = end($list);
             if (count($list) === $last[0]) {
                 session('backup_list', $list); //缓存备份列表
-                $this->success(lang('init_success'), NULL ,['part'=>1,'start'=>0]);
+                $this->success(lang('init_success'), NULL, ['part' => 1, 'start' => 0]);
             } else {
                 $this->error(lang('file_break_please_check'));
             }
         } elseif (is_numeric($part) && is_numeric($start)) {
             $list = session('backup_list');
-            $db = new \mall\Backup($list[$part], array(
-                'path' => realpath(DATA_BACKUP_PATH) . DIRECTORY_SEPARATOR,
-                'compress' => $list[$part][2])
+            $db = new \mall\Backup(
+                $list[$part],
+                array(
+                    'path' => realpath(DATA_BACKUP_PATH) . DIRECTORY_SEPARATOR,
+                    'compress' => $list[$part][2]
+                )
             );
             $start = $db->import($start);
             if (false === $start) {
@@ -204,7 +213,7 @@ class Database extends AdminControl {
             } elseif (0 === $start) { //下一卷
                 if (isset($list[++$part])) {
                     $data = array('part' => $part, 'start' => 0);
-                    $this->success(lang('restoring')."...#{$part}", null, $data);
+                    $this->success(lang('restoring') . "...#{$part}", null, $data);
                 } else {
                     session('backup_list', null);
                     $this->success(lang('recover_success'));
@@ -213,10 +222,10 @@ class Database extends AdminControl {
                 $data = array('part' => $part, 'start' => $start[0]);
                 if ($start[1]) {
                     $rate = floor(100 * ($start[0] / $start[1]));
-                    $this->success(lang('restoring')."...#{$part} ({$rate}%)", null, $data);
+                    $this->success(lang('restoring') . "...#{$part} ({$rate}%)", null, $data);
                 } else {
                     $data['gz'] = 1;
-                    $this->success(lang('restoring')."...#{$part}", null, $data);
+                    $this->success(lang('restoring') . "...#{$part}", null, $data);
                 }
             }
         } else {
@@ -227,7 +236,8 @@ class Database extends AdminControl {
     /**
      * 优化
      */
-    public function optimize() {
+    public function optimize()
+    {
         $batchFlag = intval(input('param.batchFlag'));
         //批量删除
         if ($batchFlag) {
@@ -250,7 +260,8 @@ class Database extends AdminControl {
     /**
      * 修复
      */
-    public function repair() {
+    public function repair()
+    {
         $batchFlag = intval(input('param.batchFlag'));
         //批量删除
         if ($batchFlag) {
@@ -275,7 +286,8 @@ class Database extends AdminControl {
      * 下载
      * @param int $time
      */
-    public function downFile($time = 0) {
+    public function downFile($time = 0)
+    {
         $name = date('Ymd-His', $time) . '-*.sql*';
         $path = realpath(DATA_BACKUP_PATH) . DIRECTORY_SEPARATOR . $name;
         $files = glob($path);
@@ -298,7 +310,8 @@ class Database extends AdminControl {
      * 删除备份文件
      * @param  Integer $time 备份时间
      */
-    public function del($time = 0) {
+    public function del($time = 0)
+    {
         if ($time) {
             $name = date('Ymd-His', $time) . '-*.sql*';
             $path = realpath(DATA_BACKUP_PATH) . DIRECTORY_SEPARATOR . $name;
@@ -316,7 +329,8 @@ class Database extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'db',
@@ -332,7 +346,4 @@ class Database extends AdminControl {
 
         return $menu_array;
     }
-
 }
-
-?>

+ 28 - 23
app/admin/controller/Document.php

@@ -10,19 +10,20 @@ use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Document extends AdminControl {
+class Document extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize(); // TODO: Change the autogenerated stub
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/document.lang.php');
     }
@@ -30,7 +31,8 @@ class Document extends AdminControl {
     /**
      * 系统文章管理首页
      */
-    public function index() {
+    public function index()
+    {
         $document_model = model('document');
         $doc_list = $document_model->getDocumentList();
         View::assign('doc_list', $doc_list);
@@ -41,7 +43,8 @@ class Document extends AdminControl {
     /**
      * 系统文章编辑
      */
-    public function edit() {
+    public function edit()
+    {
         if (request()->isPost()) {
             /**
              * 验证
@@ -74,7 +77,7 @@ class Document extends AdminControl {
                             $v = intval($v);
                             $update_array = array();
                             $update_array['item_id'] = intval(input('document_id'));
-                            $upload_model->editUpload($update_array,array(array('upload_id','=',intval($v))));
+                            $upload_model->editUpload($update_array, array(array('upload_id', '=', intval($v))));
                             unset($update_array);
                         }
                     }
@@ -117,20 +120,21 @@ class Document extends AdminControl {
     /**
      * 系统文章图片上传
      */
-    public function document_pic_upload() {
+    public function document_pic_upload()
+    {
         /**
          * 上传图片
          */
         $file_name = '';
         $file_object = request()->file('fileupload');
         if ($file_object) {
-                $res=ds_upload_pic(ATTACH_ARTICLE,'fileupload');
-                if($res['code']){
-                    $file_name=$res['data']['file_name'];
-                }else{
-                    echo $res['msg'];
-                    exit;
-                }
+            $res = ds_upload_pic(ATTACH_ARTICLE, 'fileupload');
+            if ($res['code']) {
+                $file_name = $res['data']['file_name'];
+            } else {
+                echo $res['msg'];
+                exit;
+            }
         } else {
             echo 'error';
             exit;
@@ -154,7 +158,7 @@ class Document extends AdminControl {
             $data = array();
             $data['file_id'] = $result;
             $data['file_name'] = $file_name;
-            $data['file_path'] = ds_get_pic(ATTACH_ARTICLE , $file_name);
+            $data['file_path'] = ds_get_pic(ATTACH_ARTICLE, $file_name);
             /**
              * 整理为json格式
              */
@@ -166,9 +170,10 @@ class Document extends AdminControl {
     /**
      * ajax操作
      */
-    public function ajax() {
+    public function ajax()
+    {
         switch (input('param.branch')) {
-            /**
+                /**
              * 删除文章图片
              */
             case 'del_file_upload':
@@ -198,7 +203,8 @@ class Document extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index', 'text' => lang('ds_manage'), 'url' => (string) url('Document/index')
@@ -211,5 +217,4 @@ class Document extends AdminControl {
         }
         return $menu_array;
     }
-
 }

+ 238 - 227
app/admin/controller/EditablePage.php

@@ -1,27 +1,29 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 use think\facade\Db;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class EditablePage extends AdminControl {
+class EditablePage extends AdminControl
+{
 
     var $type = 'pc';
     var $model_dir = 'home@default/base/editable_page_model/';
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/editable_page.lang.php');
         Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '.php');
@@ -30,13 +32,14 @@ class EditablePage extends AdminControl {
     /**
      * 页面列表
      */
-    public function page_list($type = 'pc') {
+    public function page_list($type = 'pc')
+    {
         $this->type = $type;
         $keyword = input('param.editable_page_name');
 
         $condition = array();
         if ($keyword) {
-            $condition[]=array('editable_page_name','like', '%' . $keyword . '%');
+            $condition[] = array('editable_page_name', 'like', '%' . $keyword . '%');
         }
         View::assign('filtered', empty($condition) ? 0 : 1);
         if (!in_array($type, array('pc', 'h5'))) {
@@ -64,15 +67,17 @@ class EditablePage extends AdminControl {
         return View::fetch('page_list');
     }
 
-    public function h5_page_list() {
+    public function h5_page_list()
+    {
         return $this->page_list('h5');
     }
 
-    
+
     /**
      * 新增页面
      */
-    public function page_add() {
+    public function page_add()
+    {
         $editable_page_path = input('param.editable_page_path');
         $editable_page_item_id = intval(input('param.editable_page_item_id'));
         $editable_page_model = model('editable_page');
@@ -92,12 +97,12 @@ class EditablePage extends AdminControl {
             );
             $result = $editable_page_model->addEditablePage($data);
             $condition = array();
-            $condition[] = array('store_id','=',0);
-            $condition[] = array('editable_page_id','<>',$result);
-            $condition[] = array('editable_page_path','=',$data['editable_page_path']);
-            $condition[] = array('editable_page_client','=',$data['editable_page_client']);
+            $condition[] = array('store_id', '=', 0);
+            $condition[] = array('editable_page_id', '<>', $result);
+            $condition[] = array('editable_page_path', '=', $data['editable_page_path']);
+            $condition[] = array('editable_page_client', '=', $data['editable_page_client']);
             if (!in_array($data['editable_page_path'], array('index/index'))) {
-                $condition[] = array('editable_page_item_id','=',$data['editable_page_item_id']);
+                $condition[] = array('editable_page_item_id', '=', $data['editable_page_item_id']);
             }
             $editable_page_model->editEditablePage($condition, array('editable_page_path' => '', 'editable_page_item_id' => 0));
             if ($result) {
@@ -109,7 +114,8 @@ class EditablePage extends AdminControl {
         }
     }
 
-    public function page_setting(){
+    public function page_setting()
+    {
         $editable_page_id = intval(input('param.editable_page_id'));
 
         $editable_page_model = model('editable_page');
@@ -120,33 +126,32 @@ class EditablePage extends AdminControl {
         $editable_page_info['editable_page_theme_config'] = json_decode($editable_page_info['editable_page_theme_config'], true);
         View::assign('editable_page', $editable_page_info);
         $editable_page_config_model = model('editable_page_config');
-        $editable_page_config_list=$editable_page_config_model->getEditablePageConfigList(array(array('editable_page_id', '=', $editable_page_id)));
-        $config_list=array();
-        foreach($editable_page_config_list as $key => $val){
-            $config_info=json_decode($val['editable_page_config_content'], true);
-            $model_id=$val['editable_page_model_id'];
-            $var_html=array();
-        $var_config=array();
-        if(!empty($config_info)){
-            require_once PLUGINS_PATH.'/editable_page_model/'.$model_id.'/config.php';
-            $model_name='Model'.$model_id;
-            $model=new $model_name();
-            $res=$model->filterData($config_info);
-            if($res['code']){
-                $var_config['config_info']=$res['data'];
-                $res=$model->formatData(json_encode($res['data']));
-                if($res['code']){
-                    $var_html['config_info']=$res['data'];
+        $editable_page_config_list = $editable_page_config_model->getEditablePageConfigList(array(array('editable_page_id', '=', $editable_page_id)));
+        $config_list = array();
+        foreach ($editable_page_config_list as $key => $val) {
+            $config_info = json_decode($val['editable_page_config_content'], true);
+            $model_id = $val['editable_page_model_id'];
+            $var_html = array();
+            $var_config = array();
+            if (!empty($config_info)) {
+                require_once PLUGINS_PATH . '/editable_page_model/' . $model_id . '/config.php';
+                $model_name = 'Model' . $model_id;
+                $model = new $model_name();
+                $res = $model->filterData($config_info);
+                if ($res['code']) {
+                    $var_config['config_info'] = $res['data'];
+                    $res = $model->formatData(json_encode($res['data']));
+                    if ($res['code']) {
+                        $var_html['config_info'] = $res['data'];
+                    }
                 }
             }
-            
-        }
-        $html=View::fetch('../../../plugins/editable_page_model/'.$model_id.'/index',$var_html);
-        $config=View::fetch('../../../plugins/editable_page_model/'.$model_id.'/config',$var_config);
-            $config_list[]=array(
-                'val'=>$val,
-                'html'=>$html,
-                'config'=>$config
+            $html = View::fetch('../../../plugins/editable_page_model/' . $model_id . '/index', $var_html);
+            $config = View::fetch('../../../plugins/editable_page_model/' . $model_id . '/config', $var_config);
+            $config_list[] = array(
+                'val' => $val,
+                'html' => $html,
+                'config' => $config
             );
         }
         View::assign('config_list', $config_list);
@@ -156,7 +161,8 @@ class EditablePage extends AdminControl {
     /**
      * 设置手机端页面
      */
-    public function mobile_page_setting() {
+    public function mobile_page_setting()
+    {
         $this->type = 'h5';
         $editable_page_id = intval(input('param.editable_page_id'));
 
@@ -168,33 +174,32 @@ class EditablePage extends AdminControl {
         $editable_page_info['editable_page_theme_config'] = json_decode($editable_page_info['editable_page_theme_config'], true);
         View::assign('editable_page', $editable_page_info);
         $editable_page_config_model = model('editable_page_config');
-        $editable_page_config_list=$editable_page_config_model->getEditablePageConfigList(array(array('editable_page_id', '=', $editable_page_id)));
-        $config_list=array();
-        foreach($editable_page_config_list as $key => $val){
-            $config_info=json_decode($val['editable_page_config_content'], true);
-            $model_id=$val['editable_page_model_id'];
-            $var_html=array();
-        $var_config=array();
-        if(!empty($config_info)){
-            require_once PLUGINS_PATH.'/editable_page_model/h5_'.$model_id.'/config.php';
-            $model_name='Model'.$model_id;
-            $model=new $model_name();
-            $res=$model->filterData($config_info);
-            if($res['code']){
-                $var_config['config_info']=$res['data'];
-                $res=$model->formatData(json_encode($res['data']));
-                if($res['code']){
-                    $var_html['config_info']=$res['data'];
+        $editable_page_config_list = $editable_page_config_model->getEditablePageConfigList(array(array('editable_page_id', '=', $editable_page_id)));
+        $config_list = array();
+        foreach ($editable_page_config_list as $key => $val) {
+            $config_info = json_decode($val['editable_page_config_content'], true);
+            $model_id = $val['editable_page_model_id'];
+            $var_html = array();
+            $var_config = array();
+            if (!empty($config_info)) {
+                require_once PLUGINS_PATH . '/editable_page_model/h5_' . $model_id . '/config.php';
+                $model_name = 'Model' . $model_id;
+                $model = new $model_name();
+                $res = $model->filterData($config_info);
+                if ($res['code']) {
+                    $var_config['config_info'] = $res['data'];
+                    $res = $model->formatData(json_encode($res['data']));
+                    if ($res['code']) {
+                        $var_html['config_info'] = $res['data'];
+                    }
                 }
             }
-            
-        }
-        $html=View::fetch('../../../plugins/editable_page_model/h5_'.$model_id.'/index',$var_html);
-        $config=View::fetch('../../../plugins/editable_page_model/h5_'.$model_id.'/config',$var_config);
-            $config_list[]=array(
-                'val'=>$val,
-                'html'=>$html,
-                'config'=>$config
+            $html = View::fetch('../../../plugins/editable_page_model/h5_' . $model_id . '/index', $var_html);
+            $config = View::fetch('../../../plugins/editable_page_model/h5_' . $model_id . '/config', $var_config);
+            $config_list[] = array(
+                'val' => $val,
+                'html' => $html,
+                'config' => $config
             );
         }
         View::assign('config_list', $config_list);
@@ -206,7 +211,8 @@ class EditablePage extends AdminControl {
     /**
      * 编辑页面
      */
-    public function page_edit() {
+    public function page_edit()
+    {
         $editable_page_id = intval(input('param.editable_page_id'));
 
         $editable_page_model = model('editable_page');
@@ -228,14 +234,14 @@ class EditablePage extends AdminControl {
                 ))
             );
             $result = $editable_page_model->editEditablePage(array('editable_page_id' => $editable_page_id), $data);
-            
+
             $condition = array();
-            $condition[] = array('store_id','=',0);
-            $condition[] = array('editable_page_id','<>',$editable_page_id);
-            $condition[] = array('editable_page_path','=',$data['editable_page_path']);
-            $condition[] = array('editable_page_client','=',$editable_page_info['editable_page_client']);
+            $condition[] = array('store_id', '=', 0);
+            $condition[] = array('editable_page_id', '<>', $editable_page_id);
+            $condition[] = array('editable_page_path', '=', $data['editable_page_path']);
+            $condition[] = array('editable_page_client', '=', $editable_page_info['editable_page_client']);
             if (!in_array($data['editable_page_path'], array('index/index'))) {
-                $condition[] = array('editable_page_item_id','=',$data['editable_page_item_id']);
+                $condition[] = array('editable_page_item_id', '=', $data['editable_page_item_id']);
             }
             $editable_page_model->editEditablePage($condition, array('editable_page_path' => '', 'editable_page_item_id' => 0));
             if ($result) {
@@ -250,7 +256,8 @@ class EditablePage extends AdminControl {
     /**
      * 删除页面
      */
-    public function page_del() {
+    public function page_del()
+    {
         $editable_page_id = intval(input('param.editable_page_id'));
 
         $editable_page_model = model('editable_page');
@@ -271,7 +278,8 @@ class EditablePage extends AdminControl {
     /**
      * 搜索商品
      */
-    public function search_goods() {
+    public function search_goods()
+    {
         $goods_model = model('goods');
 
         /**
@@ -281,66 +289,66 @@ class EditablePage extends AdminControl {
         $search_goods_name = trim(input('param.keyword'));
         $type = trim(input('param.type'));
         if ($search_goods_name != '') {
-            $where[]=array('goods_name|store_name','like', '%' . $search_goods_name . '%');
+            $where[] = array('goods_name|store_name', 'like', '%' . $search_goods_name . '%');
         }
-        switch($type){
+        switch ($type) {
             case 'bargain':
-                $condition=array();
-                $condition[] = array('bargain_state','=',\app\common\model\Pbargain::PINTUAN_STATE_NORMAL);
-                $condition[] = array('bargain_endtime','>',TIMESTAMP);
-                $condition[] = array('bargain_begintime','<',TIMESTAMP);
-                $subQuery=Db::name('pbargain')->field('bargain_goods_id')->where($condition)->buildSql();
-                $where[]=array('goods_id','exp',Db::raw('in '.$subQuery));
+                $condition = array();
+                $condition[] = array('bargain_state', '=', \app\common\model\Pbargain::PINTUAN_STATE_NORMAL);
+                $condition[] = array('bargain_endtime', '>', TIMESTAMP);
+                $condition[] = array('bargain_begintime', '<', TIMESTAMP);
+                $subQuery = Db::name('pbargain')->field('bargain_goods_id')->where($condition)->buildSql();
+                $where[] = array('goods_id', 'exp', Db::raw('in ' . $subQuery));
                 break;
             case 'groupbuy':
-                $condition=array();
-                $condition[] = array('groupbuy_state','=',\app\common\model\Groupbuy::GROUPBUY_STATE_NORMAL);
-                $condition[] = array('groupbuy_endtime','>',TIMESTAMP);
-                $condition[] = array('groupbuy_starttime','<',TIMESTAMP);
-                $subQuery=Db::name('groupbuy')->field('goods_commonid')->where($condition)->buildSql();
-                $where[]=array('goods_commonid','exp',Db::raw('in '.$subQuery));
+                $condition = array();
+                $condition[] = array('groupbuy_state', '=', \app\common\model\Groupbuy::GROUPBUY_STATE_NORMAL);
+                $condition[] = array('groupbuy_endtime', '>', TIMESTAMP);
+                $condition[] = array('groupbuy_starttime', '<', TIMESTAMP);
+                $subQuery = Db::name('groupbuy')->field('goods_commonid')->where($condition)->buildSql();
+                $where[] = array('goods_commonid', 'exp', Db::raw('in ' . $subQuery));
                 break;
             case 'pintuan':
-                $condition=array();
+                $condition = array();
                 $condition[] = array('pintuan_state', '=', \app\common\model\Ppintuan::PINTUAN_STATE_NORMAL);
                 $condition[] = array('pintuan_end_time', '>', TIMESTAMP);
-                $condition[] = array('pintuan_starttime','<',TIMESTAMP);
-                $subQuery=Db::name('ppintuan')->field('pintuan_goods_commonid')->where($condition)->buildSql();
-                $where[]=array('goods_commonid','exp',Db::raw('in '.$subQuery));
+                $condition[] = array('pintuan_starttime', '<', TIMESTAMP);
+                $subQuery = Db::name('ppintuan')->field('pintuan_goods_commonid')->where($condition)->buildSql();
+                $where[] = array('goods_commonid', 'exp', Db::raw('in ' . $subQuery));
                 break;
             case 'presell':
-                $condition=array();
-                $condition[] = array('presell_state','=',\app\common\model\Presell::PRESELL_STATE_NORMAL);
-                $condition[] = array('presell_end_time','>',TIMESTAMP);
-                $condition[] = array('presell_start_time','<',TIMESTAMP);
-                $subQuery=Db::name('presell')->field('goods_id')->where($condition)->buildSql();
-                $where[]=array('goods_id','exp',Db::raw('in '.$subQuery));
+                $condition = array();
+                $condition[] = array('presell_state', '=', \app\common\model\Presell::PRESELL_STATE_NORMAL);
+                $condition[] = array('presell_end_time', '>', TIMESTAMP);
+                $condition[] = array('presell_start_time', '<', TIMESTAMP);
+                $subQuery = Db::name('presell')->field('goods_id')->where($condition)->buildSql();
+                $where[] = array('goods_id', 'exp', Db::raw('in ' . $subQuery));
                 break;
             case 'xianshi':
-                $condition=array();
-                $condition[] = array('xianshigoods_state','=',\app\common\model\Pxianshigoods::XIANSHI_GOODS_STATE_NORMAL);
-                $condition[] = array('xianshigoods_end_time','>',TIMESTAMP);
-                $condition[] = array('xianshigoods_starttime','<',TIMESTAMP);
-                $subQuery=Db::name('pxianshigoods')->field('goods_id')->where($condition)->buildSql();
-                $where[]=array('goods_id','exp',Db::raw('in '.$subQuery));
+                $condition = array();
+                $condition[] = array('xianshigoods_state', '=', \app\common\model\Pxianshigoods::XIANSHI_GOODS_STATE_NORMAL);
+                $condition[] = array('xianshigoods_end_time', '>', TIMESTAMP);
+                $condition[] = array('xianshigoods_starttime', '<', TIMESTAMP);
+                $subQuery = Db::name('pxianshigoods')->field('goods_id')->where($condition)->buildSql();
+                $where[] = array('goods_id', 'exp', Db::raw('in ' . $subQuery));
                 break;
         }
 
         $goods_list = $goods_model->getGoodsOnlineList($where, '*', 12);
         View::assign('goods_list', $goods_list);
         View::assign('show_page', $goods_model->page_info->render());
-        $goods_id=input('param.goods_id/a');
-        if(!empty($goods_id)){
+        $goods_id = input('param.goods_id/a');
+        if (!empty($goods_id)) {
             $where = array();
-            $where[]=array('goods_id','in', array_keys($goods_id));
+            $where[] = array('goods_id', 'in', array_keys($goods_id));
             $goods_list = $goods_model->getGoodsOnlineList($where);
-            $selected_goods=array();
-            foreach($goods_list as $v){
-                $selected_goods[$v['goods_id']]=array_merge($v,array('sort'=>$goods_id[$v['goods_id']]['sort']));
+            $selected_goods = array();
+            foreach ($goods_list as $v) {
+                $selected_goods[$v['goods_id']] = array_merge($v, array('sort' => $goods_id[$v['goods_id']]['sort']));
             }
             View::assign('goods_id', $selected_goods);
         }
-        
+
         echo View::fetch('search_goods');
         exit;
     }
@@ -349,7 +357,8 @@ class EditablePage extends AdminControl {
     /**
      * 搜索品牌
      */
-    public function search_brand() {
+    public function search_brand()
+    {
         $brand_model = model('brand');
         /**
          * 查询条件
@@ -358,20 +367,20 @@ class EditablePage extends AdminControl {
         $where[] = array('brand_apply', '=', 1);
         $search_brand_name = trim(input('param.keyword'));
         if ($search_brand_name != '') {
-            $where[]=array('brand_name','like', '%' . $search_brand_name . '%');
+            $where[] = array('brand_name', 'like', '%' . $search_brand_name . '%');
         }
 
         $brand_list = $brand_model->getBrandList($where, '*', 12);
         View::assign('brand_list', $brand_list);
         View::assign('show_page', $brand_model->page_info->render());
-        $brand_id=input('param.brand_id/a');
-        if(!empty($brand_id)){
+        $brand_id = input('param.brand_id/a');
+        if (!empty($brand_id)) {
             $where = array();
-            $where[]=array('brand_id','in', array_keys($brand_id));
+            $where[] = array('brand_id', 'in', array_keys($brand_id));
             $brand_list = $brand_model->getBrandList($where);
-            $selected_brand=array();
-            foreach($brand_list as $v){
-                $selected_brand[$v['brand_id']]=array_merge($v,array('sort'=>$brand_id[$v['brand_id']]['sort']));
+            $selected_brand = array();
+            foreach ($brand_list as $v) {
+                $selected_brand[$v['brand_id']] = array_merge($v, array('sort' => $brand_id[$v['brand_id']]['sort']));
             }
             View::assign('brand_id', $selected_brand);
         }
@@ -380,7 +389,8 @@ class EditablePage extends AdminControl {
     }
 
 
-    public function image_del() {
+    public function image_del()
+    {
         $file_id = intval(input('param.upload_id'));
         $res = model('editable_page_model', 'logic')->imageDel($file_id);
         if (!$res['code']) {
@@ -393,7 +403,8 @@ class EditablePage extends AdminControl {
     /**
      * 图片上传
      */
-    public function image_upload() {
+    public function image_upload()
+    {
         $res = model('editable_page_model', 'logic')->imageUpload(input('param.name'), input('param.config_id'));
         if (!$res['code']) {
             ds_json_encode(10001, $res['msg']);
@@ -402,136 +413,139 @@ class EditablePage extends AdminControl {
         ds_json_encode(10000, '', $data);
     }
 
-    public function goods_class(){
-        $id=intval(input('param.id'));
-        $parent_id=intval(input('param.parent_id'));
-        $goodsclass_model=model('goodsclass');
-        if($id){
-            $data=array('id'=>array(),'list'=>array());
-            $goodsclass_info=$goodsclass_model->getGoodsclassInfoById($id);
-            if($goodsclass_info){
-                $data['id'][]=$goodsclass_info['gc_id'];
-                $data['list'][]=$goodsclass_model->getGoodsclassListByParentId($goodsclass_info['gc_parent_id']);
-                if($goodsclass_info['gc_parent_id']){
-                    $goodsclass_info=$goodsclass_model->getGoodsclassInfoById($goodsclass_info['gc_parent_id']);
-                    if($goodsclass_info){
-                        $data['id'][]=$goodsclass_info['gc_id'];
-                        $data['list'][]=$goodsclass_model->getGoodsclassListByParentId($goodsclass_info['gc_parent_id']);
-                        if($goodsclass_info['gc_parent_id']){
-                            $goodsclass_info=$goodsclass_model->getGoodsclassInfoById($goodsclass_info['gc_parent_id']);
-                            if($goodsclass_info){
-                                $data['id'][]=$goodsclass_info['gc_id'];
-                                $data['list'][]=$goodsclass_model->getGoodsclassListByParentId($goodsclass_info['gc_parent_id']);
+    public function goods_class()
+    {
+        $id = intval(input('param.id'));
+        $parent_id = intval(input('param.parent_id'));
+        $goodsclass_model = model('goodsclass');
+        if ($id) {
+            $data = array('id' => array(), 'list' => array());
+            $goodsclass_info = $goodsclass_model->getGoodsclassInfoById($id);
+            if ($goodsclass_info) {
+                $data['id'][] = $goodsclass_info['gc_id'];
+                $data['list'][] = $goodsclass_model->getGoodsclassListByParentId($goodsclass_info['gc_parent_id']);
+                if ($goodsclass_info['gc_parent_id']) {
+                    $goodsclass_info = $goodsclass_model->getGoodsclassInfoById($goodsclass_info['gc_parent_id']);
+                    if ($goodsclass_info) {
+                        $data['id'][] = $goodsclass_info['gc_id'];
+                        $data['list'][] = $goodsclass_model->getGoodsclassListByParentId($goodsclass_info['gc_parent_id']);
+                        if ($goodsclass_info['gc_parent_id']) {
+                            $goodsclass_info = $goodsclass_model->getGoodsclassInfoById($goodsclass_info['gc_parent_id']);
+                            if ($goodsclass_info) {
+                                $data['id'][] = $goodsclass_info['gc_id'];
+                                $data['list'][] = $goodsclass_model->getGoodsclassListByParentId($goodsclass_info['gc_parent_id']);
                             }
                         }
                     }
                 }
             }
-            $data['id']=array_reverse($data['id']);
-            $data['list']=array_reverse($data['list']);
-        }else{
-            $data=$goodsclass_model->getGoodsclassListByParentId($parent_id);
+            $data['id'] = array_reverse($data['id']);
+            $data['list'] = array_reverse($data['list']);
+        } else {
+            $data = $goodsclass_model->getGoodsclassListByParentId($parent_id);
         }
-        
+
         ds_json_encode(10000, '', $data);
     }
 
-    public function config_load(){
-        $if_h5=intval(input('param.if_h5'));
-        $model_id=intval(input('param.model_id'));
-        $config_info=input('param.config_info/a');
-        if(!$model_id){
+    public function config_load()
+    {
+        $if_h5 = intval(input('param.if_h5'));
+        $model_id = intval(input('param.model_id'));
+        $config_info = input('param.config_info/a');
+        if (!$model_id) {
             ds_json_encode(10001, lang('param_error'));
         }
-        $var_html=array();
-        $var_config=array();
-        if(!empty($config_info)){
-            require_once PLUGINS_PATH.'/editable_page_model/'.($if_h5?'h5_':'').$model_id.'/config.php';
-            $model_name='Model'.$model_id;
-            $model=new $model_name();
-            $res=$model->filterData($config_info);
-            if($res['code']){
-                $res=$model->formatData(json_encode($res['data']));
-                if($res['code']){
-                    $var_html['config_info']=$res['data'];
-                }else{
+        $var_html = array();
+        $var_config = array();
+        if (!empty($config_info)) {
+            require_once PLUGINS_PATH . '/editable_page_model/' . ($if_h5 ? 'h5_' : '') . $model_id . '/config.php';
+            $model_name = 'Model' . $model_id;
+            $model = new $model_name();
+            $res = $model->filterData($config_info);
+            if ($res['code']) {
+                $res = $model->formatData(json_encode($res['data']));
+                if ($res['code']) {
+                    $var_html['config_info'] = $res['data'];
+                } else {
                     ds_json_encode(10001, $res['msg']);
                 }
-            }else{
+            } else {
                 ds_json_encode(10001, $res['msg']);
             }
-            
         }
-        $html=View::fetch('../../../plugins/editable_page_model/'.($if_h5?'h5_':'').$model_id.'/index',$var_html);
-        $config=View::fetch('../../../plugins/editable_page_model/'.($if_h5?'h5_':'').$model_id.'/config',$var_config);
-        ds_json_encode(10000, '', array('html'=>$html,'config'=>$config));
+        $html = View::fetch('../../../plugins/editable_page_model/' . ($if_h5 ? 'h5_' : '') . $model_id . '/index', $var_html);
+        $config = View::fetch('../../../plugins/editable_page_model/' . ($if_h5 ? 'h5_' : '') . $model_id . '/config', $var_config);
+        ds_json_encode(10000, '', array('html' => $html, 'config' => $config));
     }
 
-    public function config_edit(){
-        $if_h5=intval(input('param.if_h5'));
-        $config_list=input('param.config_list/a');
-        $editable_page_id=intval(input('param.page_id'));
+    public function config_edit()
+    {
+        $if_h5 = intval(input('param.if_h5'));
+        $config_list = input('param.config_list/a');
+        $editable_page_id = intval(input('param.page_id'));
 
         $editable_page_model = model('editable_page');
         $editable_page_info = $editable_page_model->getOneEditablePage(array('editable_page_id' => $editable_page_id));
         if (!$editable_page_info) {
             ds_json_encode(10001, lang('param_error'));
         }
-        try{
-        $data=array();
-        $new_data=array();
-        $editable_page_theme_config=array();
-        foreach($config_list as $sort_order => $config_info){
-            $model_id=$config_info['model_id'];
-            switch($model_id){
-                case 'page':
-                case 'jump':
-                case 'button':
-                    if($model_id=='page'){
-                        $data['editable_page_name']=$config_info['page_title'];
-                    }
-                    $editable_page_theme_config=array_merge($editable_page_theme_config,$config_info);
-                    
-                    break;
-                default:
-                    require_once PLUGINS_PATH.'/editable_page_model/'.($if_h5?'h5_':'').$model_id.'/config.php';
-                    $model_name='Model'.$model_id;
-                    $model=new $model_name();
-                    $res=$model->filterData($config_info);
-                    if($res['code']){
-                        $new_data[]=array(
-                            'editable_page_id'=>$editable_page_id,
-                            'editable_page_model_id'=>$model_id,
-                            'editable_page_config_sort_order'=>$sort_order,
-                            'editable_page_config_content'=>json_encode($res['data'])
-                        );
-                    }else{
-                        throw new \think\Exception($res['msg'], 10006);
-                    }
+        try {
+            $data = array();
+            $new_data = array();
+            $editable_page_theme_config = array();
+            foreach ($config_list as $sort_order => $config_info) {
+                $model_id = $config_info['model_id'];
+                switch ($model_id) {
+                    case 'page':
+                    case 'jump':
+                    case 'button':
+                        if ($model_id == 'page') {
+                            $data['editable_page_name'] = $config_info['page_title'];
+                        }
+                        $editable_page_theme_config = array_merge($editable_page_theme_config, $config_info);
+
+                        break;
+                    default:
+                        require_once PLUGINS_PATH . '/editable_page_model/' . ($if_h5 ? 'h5_' : '') . $model_id . '/config.php';
+                        $model_name = 'Model' . $model_id;
+                        $model = new $model_name();
+                        $res = $model->filterData($config_info);
+                        if ($res['code']) {
+                            $new_data[] = array(
+                                'editable_page_id' => $editable_page_id,
+                                'editable_page_model_id' => $model_id,
+                                'editable_page_config_sort_order' => $sort_order,
+                                'editable_page_config_content' => json_encode($res['data'])
+                            );
+                        } else {
+                            throw new \think\Exception($res['msg'], 10006);
+                        }
+                }
             }
+            $data['editable_page_theme_config'] = json_encode($editable_page_theme_config);
+            $data['editable_page_edit_time'] = TIMESTAMP;
+            $editable_page_config_model = model('editable_page_config');
+            $editable_page_config_model->delEditablePageConfig(array(array('editable_page_id', '=', $editable_page_id)));
+            if (!empty($new_data)) {
+                $editable_page_config_model->addEditablePageConfigAll($new_data);
+            }
+            $result = $editable_page_model->editEditablePage(array('editable_page_id' => $editable_page_id), $data);
+            if (!$result) {
+                throw new \think\Exception(lang('ds_common_op_fail'), 10006);
+            }
+        } catch (\Exception $e) {
+            ds_json_encode(10001, $e->getMessage());
         }
-        $data['editable_page_theme_config']=json_encode($editable_page_theme_config);
-        $data['editable_page_edit_time']=TIMESTAMP;
-        $editable_page_config_model = model('editable_page_config');
-        $editable_page_config_model->delEditablePageConfig(array(array('editable_page_id', '=', $editable_page_id)));
-        if(!empty($new_data)){
-            $editable_page_config_model->addEditablePageConfigAll($new_data);
-        }
-        $result = $editable_page_model->editEditablePage(array('editable_page_id' => $editable_page_id), $data);
-                if (!$result) {
-                    throw new \think\Exception(lang('ds_common_op_fail'), 10006);
-                }
-            }catch(\Exception $e){
-                ds_json_encode(10001, $e->getMessage());
-              }       
-              $this->log(lang('ds_edit') . ($editable_page_info['editable_page_client'] == 'h5' ? lang('editable_page_h5') : lang('editable_page_pc')) . '[' . $editable_page_info['editable_page_name'] . ']', null);
-                    ds_json_encode(10000, lang('ds_common_op_succ')); 
+        $this->log(lang('ds_edit') . ($editable_page_info['editable_page_client'] == 'h5' ? lang('editable_page_h5') : lang('editable_page_pc')) . '[' . $editable_page_info['editable_page_name'] . ']', null);
+        ds_json_encode(10000, lang('ds_common_op_succ'));
     }
 
     /**
      * 菜单列表
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         if ($this->type == 'pc') {
             $menu_array = array(
                 array(
@@ -561,7 +575,4 @@ class EditablePage extends AdminControl {
         }
         return $menu_array;
     }
-
 }
-
-?>

+ 40 - 36
app/admin/controller/Evaluate.php

@@ -1,18 +1,18 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Evaluate extends AdminControl
@@ -20,39 +20,40 @@ class Evaluate extends AdminControl
     public function initialize()
     {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path().'admin/lang/'.config('lang.default_lang').'/evaluate.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/evaluate.lang.php');
     }
 
     /**
      * 商品来自买家的评价列表
      */
-    public function evalgoods_list() {
+    public function evalgoods_list()
+    {
         $evaluategoods_model = model('evaluategoods');
 
         $condition = array();
         //商品名称
         if (input('param.goods_name')) {
-            $condition[]=array('geval_goodsname','like', '%'.input('param.goods_name').'%');
+            $condition[] = array('geval_goodsname', 'like', '%' . input('param.goods_name') . '%');
         }
         //店铺名称
         if (input('param.store_name')) {
-            $condition[]=array('geval_storename','like', '%'.input('param.store_name').'%');
+            $condition[] = array('geval_storename', 'like', '%' . input('param.store_name') . '%');
         }
-        if(input('param.stime')) {
+        if (input('param.stime')) {
             $stime = strtotime(input('param.stime'));
-            $condition[]=array('geval_addtime','>=', $stime);
+            $condition[] = array('geval_addtime', '>=', $stime);
         }
-        if(input('param.etime')) {
-            $etime = strtotime(input('param.etime'))+86399;
-            $condition[]=array('geval_addtime','<=', $etime);
+        if (input('param.etime')) {
+            $etime = strtotime(input('param.etime')) + 86399;
+            $condition[] = array('geval_addtime', '<=', $etime);
         }
-        $evalgoods_list	= $evaluategoods_model->getEvaluategoodsList($condition, 10);
+        $evalgoods_list    = $evaluategoods_model->getEvaluategoodsList($condition, 10);
+
+        View::assign('show_page', $evaluategoods_model->page_info->render());
+        View::assign('evalgoods_list', $evalgoods_list);
 
-        View::assign('show_page',$evaluategoods_model->page_info->render());
-        View::assign('evalgoods_list',$evalgoods_list);
-        
         View::assign('filtered', $condition ? 1 : 0); //是否有查询条件
-        
+
         $this->setAdminCurItem('evalgoods_list');
         return View::fetch('index');
     }
@@ -60,15 +61,16 @@ class Evaluate extends AdminControl
     /**
      * 删除商品评价
      */
-    public function evalgoods_del() {
+    public function evalgoods_del()
+    {
         $geval_id = intval(input('param.geval_id'));
         if ($geval_id <= 0) {
             ds_json_encode(10001, lang('param_error'));
         }
         $evaluategoods_model = model('evaluategoods');
-        $result = $evaluategoods_model->delEvaluategoods(array('geval_id'=>$geval_id));
+        $result = $evaluategoods_model->delEvaluategoods(array('geval_id' => $geval_id));
         if ($result) {
-            $this->log(lang('del_evaluategoods').$geval_id);
+            $this->log(lang('del_evaluategoods') . $geval_id);
             ds_json_encode(10000, lang('ds_common_del_succ'));
         } else {
             ds_json_encode(10001, lang('ds_common_del_fail'));
@@ -78,30 +80,31 @@ class Evaluate extends AdminControl
     /**
      * 店铺动态评价列表
      */
-    public function evalstore_list() {
+    public function evalstore_list()
+    {
         $evaluatestore_model = model('evaluatestore');
 
         $condition = array();
         //评价人
         if (input('param.from_name')) {
-            $condition[]=array('seval_membername','like', '%'.input('param.from_name').'%');
+            $condition[] = array('seval_membername', 'like', '%' . input('param.from_name') . '%');
         }
         //店铺名称
         if (input('param.store_name')) {
-            $condition[]=array('seval_storename','like', '%'.input('param.store_name').'%');
+            $condition[] = array('seval_storename', 'like', '%' . input('param.store_name') . '%');
         }
-        if(input('param.stime')) {
+        if (input('param.stime')) {
             $stime = strtotime(input('param.stime'));
-            $condition[]=array('seval_addtime','>=', $stime);
+            $condition[] = array('seval_addtime', '>=', $stime);
         }
-        if(input('param.etime')) {
+        if (input('param.etime')) {
             $etime = strtotime(input('param.etime'));
-            $condition[]=array('seval_addtime','<=', $etime);
+            $condition[] = array('seval_addtime', '<=', $etime);
         }
 
-        $evalstore_list	= $evaluatestore_model->getEvaluatestoreList($condition, 10);
-        View::assign('show_page',$evaluatestore_model->page_info->render());
-        View::assign('evalstore_list',$evalstore_list);
+        $evalstore_list    = $evaluatestore_model->getEvaluatestoreList($condition, 10);
+        View::assign('show_page', $evaluatestore_model->page_info->render());
+        View::assign('evalstore_list', $evalstore_list);
         $this->setAdminCurItem('evalstore_list');
         return View::fetch();
     }
@@ -109,15 +112,16 @@ class Evaluate extends AdminControl
     /**
      * 删除店铺评价
      */
-    public function evalstore_del() {
+    public function evalstore_del()
+    {
         $seval_id = intval(input('param.seval_id'));
         if ($seval_id <= 0) {
             ds_json_encode(10001, lang('param_error'));
         }
         $evaluatestore_model = model('evaluatestore');
-        $result = $evaluatestore_model->delEvaluatestore(array('seval_id'=>$seval_id));
+        $result = $evaluatestore_model->delEvaluatestore(array('seval_id' => $seval_id));
         if ($result) {
-            $this->log(lang('del_evaluatestore').$seval_id);
+            $this->log(lang('del_evaluatestore') . $seval_id);
             ds_json_encode(10000, lang('ds_common_del_succ'));
         } else {
             ds_json_encode(10001, lang('ds_common_del_fail'));
@@ -139,4 +143,4 @@ class Evaluate extends AdminControl
         );
         return $menu_array;
     }
-}
+}

+ 83 - 76
app/admin/controller/Exppoints.php

@@ -1,17 +1,18 @@
 <?php
+
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  *  经验值管理 控制器
  */
 class Exppoints extends AdminControl
@@ -20,12 +21,13 @@ class Exppoints extends AdminControl
     public function initialize()
     {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/membergrade.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/membergrade.lang.php');
     }
     /**
      * 设置经验值获取规则
      */
-    public function expsetting() {
+    public function expsetting()
+    {
         $config_model = model('config');
         if (request()->isPost()) {
             $exp_arr = array();
@@ -51,48 +53,49 @@ class Exppoints extends AdminControl
     /**
      * 经验值日志列表
      */
-    public function index(){
+    public function index()
+    {
         $where = array();
         $search_mname = trim(input('param.mname'));
-        if(!empty($search_mname)){
-            $where[]=array('explog_membername','like',"%{$search_mname}%");
+        if (!empty($search_mname)) {
+            $where[] = array('explog_membername', 'like', "%{$search_mname}%");
         }
-        if (input('param.stage')){
-            $where[]=array('explog_stage','=',trim(input('param.stage')));
+        if (input('param.stage')) {
+            $where[] = array('explog_stage', '=', trim(input('param.stage')));
         }
-        $stime = input('param.stime')?strtotime(input('param.stime')):0;
-        $etime = input('param.etime')?strtotime(input('param.etime')):0;
-        if ($stime > 0){
-            $where[]=array('explog_addtime','>=',$stime);
+        $stime = input('param.stime') ? strtotime(input('param.stime')) : 0;
+        $etime = input('param.etime') ? strtotime(input('param.etime')) : 0;
+        if ($stime > 0) {
+            $where[] = array('explog_addtime', '>=', $stime);
         }
-        if ($etime > 0){
-            $etime=$etime+86399;
-            $where[]=array('explog_addtime','<=',$etime);
+        if ($etime > 0) {
+            $etime = $etime + 86399;
+            $where[] = array('explog_addtime', '<=', $etime);
         }
         $search_desc = trim(input('param.description'));
-        if(!empty($search_desc)){
-            $where[]=array('explog_desc','like',"%".$search_desc."%");
+        if (!empty($search_desc)) {
+            $where[] = array('explog_desc', 'like', "%" . $search_desc . "%");
         }
-        
+
 
         //查询经验值日志列表
         $exppoints_model = model('exppoints');
         $list_log = $exppoints_model->getExppointslogList($where, '*', 20, 'explog_id desc');
         //信息输出
-        
-        View::assign('stage_arr',$exppoints_model->getExppointsStage());
-        View::assign('show_page',$exppoints_model->page_info->render());
-        View::assign('list_log',$list_log);
+
+        View::assign('stage_arr', $exppoints_model->getExppointsStage());
+        View::assign('show_page', $exppoints_model->page_info->render());
+        View::assign('list_log', $list_log);
         $this->setAdminCurItem('explog');
         return View::fetch();
     }
-    
+
     /**
      * 经验值调整
      */
     public function edit()
     {
-         if (!request()->isPost()) {
+        if (!request()->isPost()) {
             return View::fetch();
         } else {
             $data = [
@@ -101,11 +104,11 @@ class Exppoints extends AdminControl
                 'exppoints_num' => intval(input('post.exppoints_num')),
                 'exppoints_desc' => input('post.exppoints_desc'),
             ];
-            
-            if(empty($data['member_name']) || intval($data['exppoints_type'])<=0){
+
+            if (empty($data['member_name']) || intval($data['exppoints_type']) <= 0) {
                 $this->error(lang('param_error'));
             }
-            
+
 
             $member_name = $data['member_name'];
             $member_info = model('member')->getMemberInfo(array('member_name' => $member_name));
@@ -134,7 +137,8 @@ class Exppoints extends AdminControl
         }
     }
 
-    public function checkmember() {
+    public function checkmember()
+    {
         $member_name = trim(input('param.member_name'));
         if (!$member_name) {
             exit(json_encode(array('member_id' => 0)));
@@ -152,44 +156,45 @@ class Exppoints extends AdminControl
     /**
      * 经验值日志列表导出
      */
-    public function export_step1(){
+    public function export_step1()
+    {
         $where = array();
         $search_mname = trim(input('param.mname'));
-        $where[]=array('explog_membername','like',"%{$search_mname}%");
-        if (input('param.stage')){
-            $where[]=array('explog_stage','=',trim(input('param.stage')));
+        $where[] = array('explog_membername', 'like', "%{$search_mname}%");
+        if (input('param.stage')) {
+            $where[] = array('explog_stage', '=', trim(input('param.stage')));
         }
-        $stime = input('param.stime')?strtotime(input('param.stime')):0;
-        $etime = input('param.etime')?strtotime(input('param.etime')):0;
-        if ($stime > 0 && $etime>0){
-            $where[]=array('explog_addtime','between',array($stime,$etime));
-        }elseif ($stime > 0){
-            $where[]=array('explog_addtime','>=',$stime);
-        }elseif ($etime > 0){
-            $where[]=array('explog_addtime','<=',$etime);
+        $stime = input('param.stime') ? strtotime(input('param.stime')) : 0;
+        $etime = input('param.etime') ? strtotime(input('param.etime')) : 0;
+        if ($stime > 0 && $etime > 0) {
+            $where[] = array('explog_addtime', 'between', array($stime, $etime));
+        } elseif ($stime > 0) {
+            $where[] = array('explog_addtime', '>=', $stime);
+        } elseif ($etime > 0) {
+            $where[] = array('explog_addtime', '<=', $etime);
         }
         $search_desc = trim(input('param.description'));
-        $where[]=array('explog_desc','like',"%$search_desc%");
+        $where[] = array('explog_desc', 'like', "%$search_desc%");
 
         //查询经验值日志列表
         $exppoints_model = model('exppoints');
         $list_log = $exppoints_model->getExppointslogList($where, '*', self::EXPORT_SIZE,  'explog_id desc');
-        if (!is_numeric(input('param.page'))){
+        if (!is_numeric(input('param.page'))) {
             $count = $exppoints_model->getExppointslogCount($where);
             $export_list = array();
-            if ($count > self::EXPORT_SIZE ){	//显示下载链接
-                $page = ceil($count/self::EXPORT_SIZE);
-                for ($i=1;$i<=$page;$i++){
-                    $limit1 = ($i-1)*self::EXPORT_SIZE + 1;
-                    $limit2 = $i*self::EXPORT_SIZE > $count ? $count : $i*self::EXPORT_SIZE;
-                    $export_list[$i] = $limit1.' ~ '.$limit2 ;
+            if ($count > self::EXPORT_SIZE) {    //显示下载链接
+                $page = ceil($count / self::EXPORT_SIZE);
+                for ($i = 1; $i <= $page; $i++) {
+                    $limit1 = ($i - 1) * self::EXPORT_SIZE + 1;
+                    $limit2 = $i * self::EXPORT_SIZE > $count ? $count : $i * self::EXPORT_SIZE;
+                    $export_list[$i] = $limit1 . ' ~ ' . $limit2;
                 }
-                View::assign('export_list',$export_list);
+                View::assign('export_list', $export_list);
                 return View::fetch('/public/excel');
-            }else{	//如果数量小,直接下载
+            } else {    //如果数量小,直接下载
                 $this->createExcel($list_log);
             }
-        }else{	//下载
+        } else {    //下载
             $this->createExcel($list_log);
         }
     }
@@ -199,38 +204,40 @@ class Exppoints extends AdminControl
      *
      * @param array $data
      */
-    private function createExcel($data = array()){
-        Lang::load(base_path() .'admin/lang/'.config('lang.default_lang').'/export.lang.php');
+    private function createExcel($data = array())
+    {
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/export.lang.php');
         $excel_obj = new \excel\Excel();
         $excel_data = array();
         //设置样式
-        $excel_obj->setStyle(array('id'=>'s_title','Font'=>array('FontName'=>'宋体','Size'=>'12','Bold'=>'1')));
+        $excel_obj->setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
         //header
-        $excel_data[0][] = array('styleid'=>'s_title','data'=>lang('ds_member_name'));
-        $excel_data[0][] = array('styleid'=>'s_title','data'=>lang('exp_value'));
-        $excel_data[0][] = array('styleid'=>'s_title','data'=>lang('explog_addtime'));
-        $excel_data[0][] = array('styleid'=>'s_title','data'=>lang('explog_stage'));
-        $excel_data[0][] = array('styleid'=>'s_title','data'=>lang('explog_desc'));
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('ds_member_name'));
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('exp_value'));
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('explog_addtime'));
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('explog_stage'));
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('explog_desc'));
         $stage_arr = model('exppoints')->getExppointsStage();
-        foreach ((array)$data as $k=>$v){
+        foreach ((array)$data as $k => $v) {
             $tmp = array();
-            $tmp[] = array('data'=>$v['explog_membername']);
-            $tmp[] = array('format'=>'Number','data'=>ds_price_format($v['explog_points']));
-            $tmp[] = array('data'=>date('Y-m-d H:i:s',$v['explog_addtime']));
-            $tmp[] = array('data'=>$stage_arr[$v['explog_stage']]);
-            $tmp[] = array('data'=>$v['explog_desc']);
+            $tmp[] = array('data' => $v['explog_membername']);
+            $tmp[] = array('format' => 'Number', 'data' => ds_price_format($v['explog_points']));
+            $tmp[] = array('data' => date('Y-m-d H:i:s', $v['explog_addtime']));
+            $tmp[] = array('data' => $stage_arr[$v['explog_stage']]);
+            $tmp[] = array('data' => $v['explog_desc']);
             $excel_data[] = $tmp;
         }
-        $excel_data = $excel_obj->charset($excel_data,CHARSET);
+        $excel_data = $excel_obj->charset($excel_data, CHARSET);
         $excel_obj->addArray($excel_data);
-        $excel_obj->addWorksheet($excel_obj->charset(lang('membergrade_exppoints_list'),CHARSET));
-        $excel_obj->generateXML($excel_obj->charset(lang('membergrade_exppoints_list'),CHARSET).input('param.page').'-'.date('Y-m-d-H',TIMESTAMP));
+        $excel_obj->addWorksheet($excel_obj->charset(lang('membergrade_exppoints_list'), CHARSET));
+        $excel_obj->generateXML($excel_obj->charset(lang('membergrade_exppoints_list'), CHARSET) . input('param.page') . '-' . date('Y-m-d-H', TIMESTAMP));
     }
 
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'explog',
@@ -240,14 +247,14 @@ class Exppoints extends AdminControl
             array(
                 'name' => 'expset',
                 'text' => lang('ds_exppoints_setting'),
-                'url' =>  "javascript:dsLayerOpen('".(string)url('Exppoints/expsetting')."','".lang('ds_exppoints_setting')."')"
+                'url' =>  "javascript:dsLayerOpen('" . (string)url('Exppoints/expsetting') . "','" . lang('ds_exppoints_setting') . "')"
             ),
             array(
                 'name' => 'edit',
                 'text' => lang('ds_exppoints_edit'),
-                'url' =>  "javascript:dsLayerOpen('".(string)url('Exppoints/edit')."','".lang('ds_exppoints_edit')."')"
+                'url' =>  "javascript:dsLayerOpen('" . (string)url('Exppoints/edit') . "','" . lang('ds_exppoints_edit') . "')"
             ),
         );
         return $menu_array;
     }
-}
+}

+ 34 - 28
app/admin/controller/Express.php

@@ -1,39 +1,42 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Express extends AdminControl {
+class Express extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/express.lang.php');
     }
 
-    public function index() {
+    public function index()
+    {
         $express_letter = input('get.express_letter');
         $condition = array();
         if (preg_match('/^[A-Z]$/', $express_letter)) {
-            $condition[]=array('express_letter','=',$express_letter);
+            $condition[] = array('express_letter', '=', $express_letter);
         }
-        
+
         $express_name = input('get.express_name');
-        if(!empty($express_name)){
-            $condition[]=array('express_name','like', "%" . $express_name . "%");
+        if (!empty($express_name)) {
+            $condition[] = array('express_name', 'like', "%" . $express_name . "%");
         }
-        
+
         $express_model = model('express');
         $express_list = $express_model->getAllExpresslist($condition, 10);
         View::assign('show_page', $express_model->page_info->render());
@@ -45,7 +48,8 @@ class Express extends AdminControl {
     /**
      * 添加品牌
      */
-    public function add() {
+    public function add()
+    {
         $express_mod = model('express');
         if (request()->isPost()) {
             $insert_array['express_name'] = trim(input('post.express_name'));
@@ -72,12 +76,13 @@ class Express extends AdminControl {
         }
     }
 
-    public function edit() {
+    public function edit()
+    {
         $express_model = model('express');
         $express_id = input('param.express_id');
         $condition = array();
         if (request()->isPost()) {
-            $condition[] = array('express_id','=',$express_id);
+            $condition[] = array('express_id', '=', $express_id);
 
             $data['express_name'] = trim(input('post.express_name'));
             $data['express_code'] = input('post.express_code');
@@ -95,7 +100,7 @@ class Express extends AdminControl {
                 $this->error(lang('ds_common_save_fail'));
             }
         } else {
-            $condition[] = array('express_id','=',$express_id);
+            $condition[] = array('express_id', '=', $express_id);
             $express = $express_model->getOneExpress($condition);
             if (empty($express)) {
                 $this->error(lang('param_error'));
@@ -108,7 +113,8 @@ class Express extends AdminControl {
     /**
      * 删除品牌
      */
-    public function del() {
+    public function del()
+    {
         $express_id = input('param.express_id');
         $express_id_array = ds_delete_param($express_id);
         if ($express_id_array == FALSE) {
@@ -116,7 +122,7 @@ class Express extends AdminControl {
             ds_json_encode(10001, lang('param_error'));
         }
         $express_mod = model('express');
-        $express_mod->delExpress(array(array('express_id','in', implode(',', $express_id_array))));
+        $express_mod->delExpress(array(array('express_id', 'in', implode(',', $express_id_array))));
         $this->log(lang('ds_del') . lang('express') . '[ID:' . $express_id . ']', 1);
         ds_json_encode(10000, lang('ds_common_del_succ'));
     }
@@ -124,7 +130,8 @@ class Express extends AdminControl {
     /**
      * ajax操作
      */
-    public function ajax() {
+    public function ajax()
+    {
         $branch = input('get.branch');
         $column = input('get.column');
         $value = trim(input('get.value'));
@@ -134,7 +141,7 @@ class Express extends AdminControl {
             case 'state':
                 $express_model = model('express');
                 $update_array = array();
-                $condition[] = array('express_id','=',$id);
+                $condition[] = array('express_id', '=', $id);
                 $update_array[$column] = $value;
                 $express_model->editExpress($condition, $update_array);
                 $this->log(lang('ds_edit') . lang('express_name') . lang('ds_state') . '[ID:' . $id . ']', 1);
@@ -144,7 +151,7 @@ class Express extends AdminControl {
             case 'order':
                 $express_model = model('express');
                 $update_array = array();
-                $condition[] = array('express_id','=',$id);
+                $condition[] = array('express_id', '=', $id);
                 $update_array[$column] = $value;
                 $express_model->editExpress($condition, $update_array);
                 $this->log(lang('ds_edit') . lang('express_name') . lang('ds_state') . '[ID:' . $id . ']', 1);
@@ -154,7 +161,8 @@ class Express extends AdminControl {
         }
     }
 
-    public function config(){
+    public function config()
+    {
         $config_model = model('config');
         if (!request()->isPost()) {
             $list_config = rkcache('config', true);
@@ -179,7 +187,8 @@ class Express extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -194,12 +203,9 @@ class Express extends AdminControl {
             array(
                 'name' => 'express_add',
                 'text' => lang('ds_add'),
-                'url' => "javascript:dsLayerOpen('" . (string)url('Express/add') . "','".lang('ds_add')."')"
+                'url' => "javascript:dsLayerOpen('" . (string)url('Express/add') . "','" . lang('ds_add') . "')"
             ),
         );
         return $menu_array;
     }
-
 }
-
-?>

+ 21 - 17
app/admin/controller/Feedback.php

@@ -1,17 +1,18 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
+
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Feedback extends AdminControl
@@ -19,37 +20,40 @@ class Feedback extends AdminControl
     public function initialize()
     {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/feedback.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/feedback.lang.php');
     }
     /**
      * 意见反馈
      */
-    public function flist(){
+    public function flist()
+    {
         $feedback_model = model('feedback');
         $feedback_list = $feedback_model->getFeedbackList(array(), 10);
 
-       View::assign('feedback_list', $feedback_list);
-       View::assign('show_page', $feedback_model->page_info->render());
-       $this->setAdminCurItem('index');
-       return View::fetch('index');
+        View::assign('feedback_list', $feedback_list);
+        View::assign('show_page', $feedback_model->page_info->render());
+        $this->setAdminCurItem('index');
+        return View::fetch('index');
     }
 
     /**
      * 删除
      */
-    public function del(){
+    public function del()
+    {
         $feedback_model = model('feedback');
         $feedback_id = input('param.feedback_id');
         $feedback_id_array = ds_delete_param($feedback_id);
-        $condition = array(array('fb_id' ,'in', $feedback_id_array));
+        $condition = array(array('fb_id', 'in', $feedback_id_array));
         $result = $feedback_model->delFeedback($condition);
-        if ($result){
+        if ($result) {
             ds_json_encode(10000, lang('ds_common_op_succ'));
-        }else {
+        } else {
             ds_json_encode(10001, lang('ds_common_op_fail'));
         }
     }
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu = array(
             array(
                 'text' => lang('ds_feedback'), 'name' => 'index', 'url' => ''
@@ -57,4 +61,4 @@ class Feedback extends AdminControl
         );
         return $menu;
     }
-}
+}

+ 31 - 29
app/admin/controller/Flea.php

@@ -1,18 +1,18 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Flea extends AdminControl
@@ -20,44 +20,45 @@ class Flea extends AdminControl
     public function initialize()
     {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/flea.lang.php');
-        if (config('ds_config.flea_isuse') != 1 ){
-            $this->error(lang('flea_index_unable'),'dashboard/welcome');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/flea.lang.php');
+        if (config('ds_config.flea_isuse') != 1) {
+            $this->error(lang('flea_index_unable'), 'dashboard/welcome');
         }
     }
     /**
      * 商品管理
      */
-    public function flea(){
+    public function flea()
+    {
         $flea_model = model('flea');
         /**
          * 排序
          */
         $special_condition = array();
         $keyword = trim(input('param.search_goods_name'));
-        if($keyword){
+        if ($keyword) {
             $special_condition['keyword'] = $keyword;
         }
         $like_member_name = trim(input('param.search_store_name'));
-        if($like_member_name){
-            $special_condition['like_member_name'] = $like_member_name;//店铺名称
+        if ($like_member_name) {
+            $special_condition['like_member_name'] = $like_member_name; //店铺名称
         }
         $search_brand_id = intval(input('param.search_brand_id'));
-        if($search_brand_id){
+        if ($search_brand_id) {
             $special_condition['brand_id'] = $search_brand_id;
         }
         $cate_id = intval(input('param.cate_id'));
-        if($cate_id){
+        if ($cate_id) {
             $special_condition['fleaclass_id'] = $cate_id;
         }
 
         /**
          * 分页
          */
-        $goods_list = $flea_model->getFleaList($special_condition,10);
+        $goods_list = $flea_model->getFleaList($special_condition, 10);
         if (is_array($goods_list) and !empty($goods_list)) {
             foreach ($goods_list as $key => $val) {
-                $goods_list[$key]['goods_image'] = $goods_list[$key]['goods_image'] == '' ? '' : ds_get_pic(ATTACH_MFLEA . '/' . $val['member_id'] , str_replace('_1024', '_240', $val['goods_image']));
+                $goods_list[$key]['goods_image'] = $goods_list[$key]['goods_image'] == '' ? '' : ds_get_pic(ATTACH_MFLEA . '/' . $val['member_id'], str_replace('_1024', '_240', $val['goods_image']));
             }
         }
         /**
@@ -69,16 +70,16 @@ class Flea extends AdminControl
         $fleaclass_model = model('fleaclass');
         $goods_class = $fleaclass_model->getTreeClassList(1);
 
-        View::assign('goods_class',$goods_class);
-        View::assign('goods_list',$goods_list);
-        View::assign('show_page',$flea_model->page_info->render());
-        
+        View::assign('goods_class', $goods_class);
+        View::assign('goods_list', $goods_list);
+        View::assign('show_page', $flea_model->page_info->render());
+
         View::assign('filtered', $special_condition ? 1 : 0); //是否有查询条件
-        
+
         $this->setAdminCurItem('index');
         return View::fetch('index');
     }
-    
+
     /**
      * 闲置商品删除
      */
@@ -91,10 +92,10 @@ class Flea extends AdminControl
         }
         $flea_model = model('flea');
         $result  = $flea_model->delFlea($del_id_array);
-        
-        if($result){
+
+        if ($result) {
             ds_json_encode('10000', lang('goods_index_del_succ'));
-        }else{
+        } else {
             ds_json_encode('10001', lang('goods_index_choose_del'));
         }
     }
@@ -105,20 +106,21 @@ class Flea extends AdminControl
     /**
      * ajax操作
      */
-    public function ajax() {
+    public function ajax()
+    {
         $branch = input('get.branch');
         $column = input('get.column');
         $value = trim(input('get.value'));
         $id = intval(input('get.id'));
         switch ($branch) {
-            /**
+                /**
              * 商品名称
              */
             case 'goods_name':
                 $flea_model = model('flea');
                 $update_array = array();
                 $update_array[$column] = $value;
-                $flea_model->editFlea($update_array, array('goods_id'=>$id));
+                $flea_model->editFlea($update_array, array('goods_id' => $id));
                 echo 'true';
                 exit;
                 break;
@@ -134,4 +136,4 @@ class Flea extends AdminControl
         );
         return $menu_array;
     }
-}
+}

+ 162 - 146
app/admin/controller/Fleaclass.php

@@ -1,16 +1,18 @@
 <?php
+
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
+
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Fleaclass extends AdminControl
@@ -18,100 +20,102 @@ class Fleaclass extends AdminControl
     public function initialize()
     {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/flea.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/flea.lang.php');
     }
-    
-    public function goods_class(){
+
+    public function goods_class()
+    {
         $this->flea_class();
     }
     /**
      * 分类管理
      */
-    public function flea_class(){
+    public function flea_class()
+    {
         $fleaclass_model = model('fleaclass');
         /**
          * 删除,编辑
          */
-        if (request()->isPost()){
+        if (request()->isPost()) {
             /**
              * 删除
              */
-            $check_fleaclass_id_array = input('post.check_fleaclass_id/a');#获取数组
-            if (input('post.submit_type') == 'del'){
-                if (!empty($check_fleaclass_id_array)){
-                    if (is_array($check_fleaclass_id_array)){
+            $check_fleaclass_id_array = input('post.check_fleaclass_id/a'); #获取数组
+            if (input('post.submit_type') == 'del') {
+                if (!empty($check_fleaclass_id_array)) {
+                    if (is_array($check_fleaclass_id_array)) {
                         $del_array = $fleaclass_model->getChildClass($check_fleaclass_id_array);
-                        if (is_array($del_array)){
-                            foreach ($del_array as $k => $v){
+                        if (is_array($del_array)) {
+                            foreach ($del_array as $k => $v) {
                                 $fleaclass_model->delFleaclass($v['fleaclass_id']);
                             }
                         }
                     }
                     $this->success(lang('goods_class_index_del_succ'));
-                }else {
-                   $this->error(lang('goods_class_index_choose_del'));
+                } else {
+                    $this->error(lang('goods_class_index_choose_del'));
                 }
             }
             /**
              * 编辑
              */
-            if (input('post.submit_type') == 'brach_edit'){
-                if (!empty($check_fleaclass_id_array)){
-                    View::assign('id',implode(',',$check_fleaclass_id_array));
+            if (input('post.submit_type') == 'brach_edit') {
+                if (!empty($check_fleaclass_id_array)) {
+                    View::assign('id', implode(',', $check_fleaclass_id_array));
                     $this->setAdminCurItem('brach_edit');
                     return View::fetch('brach_edit');
-                }else {
-                   $this->error(lang('goods_class_index_choose_edit'));
+                } else {
+                    $this->error(lang('goods_class_index_choose_edit'));
                 }
             }
             /**
              * 首页显示
              */
-            if(input('post.submit_type') == 'index_show' or input('post.submit_type') == 'index_hide'){
-                if (!empty($check_fleaclass_id_array)){
-                    if (is_array($check_fleaclass_id_array)){
-                        $param	= array();
-                        $param['fleaclass_index_show']	= input('post.submit_type') == 'index_show'?'1':'0';
-                        foreach ($check_fleaclass_id_array as $k=>$v){
-                            $fleaclass_model->editFleaclass(array('fleaclass_id'=>$v),$param);
+            if (input('post.submit_type') == 'index_show' or input('post.submit_type') == 'index_hide') {
+                if (!empty($check_fleaclass_id_array)) {
+                    if (is_array($check_fleaclass_id_array)) {
+                        $param    = array();
+                        $param['fleaclass_index_show']    = input('post.submit_type') == 'index_show' ? '1' : '0';
+                        foreach ($check_fleaclass_id_array as $k => $v) {
+                            $fleaclass_model->editFleaclass(array('fleaclass_id' => $v), $param);
                         }
                     }
-                    $this->success(lang('goods_class_index_in_homepage').(input('post.submit_type') == 'index_show'?lang('goods_class_index_display'):lang('goods_class_index_hide')).lang('goods_class_index_succ'));
-                }else {
-                    $this->error(lang('goods_class_index_choose_in_homepage').(input('post.submit_type') == 'index_show'?lang('goods_class_index_display'):lang('goods_class_index_hide')).lang('goods_class_index_content'));
+                    $this->success(lang('goods_class_index_in_homepage') . (input('post.submit_type') == 'index_show' ? lang('goods_class_index_display') : lang('goods_class_index_hide')) . lang('goods_class_index_succ'));
+                } else {
+                    $this->error(lang('goods_class_index_choose_in_homepage') . (input('post.submit_type') == 'index_show' ? lang('goods_class_index_display') : lang('goods_class_index_hide')) . lang('goods_class_index_content'));
                 }
             }
         }
         /**
          * 父ID
          */
-        $parent_id = input('fleaclass_parent_id')?input('fleaclass_parent_id'):0;
+        $parent_id = input('fleaclass_parent_id') ? input('fleaclass_parent_id') : 0;
         /**
          * 列表
          */
         $tmp_list = $fleaclass_model->getTreeClassList(4);
-        $class_list=array();
-        if (is_array($tmp_list)){
-            foreach ($tmp_list as $k => $v){
-                if ($v['fleaclass_parent_id'] == $parent_id){
+        $class_list = array();
+        if (is_array($tmp_list)) {
+            foreach ($tmp_list as $k => $v) {
+                if ($v['fleaclass_parent_id'] == $parent_id) {
                     /**
                      * 判断是否有子类
                      */
-                    if (isset($tmp_list[$k+1]) && ($tmp_list[$k+1]['deep'] > $v['deep'])){
+                    if (isset($tmp_list[$k + 1]) && ($tmp_list[$k + 1]['deep'] > $v['deep'])) {
                         $v['have_child'] = 1;
-                    }else{
+                    } else {
                         $v['have_child'] = 0;
                     }
                     $class_list[] = $v;
                 }
             }
         }
-        if (input('ajax') == '1'){
+        if (input('ajax') == '1') {
             $output = json_encode($class_list);
             print_r($output);
             exit;
-        }else {
-            View::assign('class_list',$class_list);
+        } else {
+            View::assign('class_list', $class_list);
             $this->setAdminCurItem('index');
             return View::fetch('index');
         }
@@ -120,45 +124,47 @@ class Fleaclass extends AdminControl
     /**
      * 保存批量修改分类
      */
-    public function brach_edit_save(){
-        if (input('post.fleaclass_show') == '-1'){
-            $this->success(lang('goods_class_batch_edit_succ'),'fleaclass/flea_class');
+    public function brach_edit_save()
+    {
+        if (input('post.fleaclass_show') == '-1') {
+            $this->success(lang('goods_class_batch_edit_succ'), 'fleaclass/flea_class');
         }
-        if (request()->isPost()){
+        if (request()->isPost()) {
             $fleaclass_model = model('fleaclass');
 
-            $array = explode(',',input('post.id'));
-            if (is_array($array)){
-                foreach ($array as $k => $v){
+            $array = explode(',', input('post.id'));
+            if (is_array($array)) {
+                foreach ($array as $k => $v) {
                     $update_array = array();
                     $update_array['fleaclass_show'] = input('post.fleaclass_show');
-                    $fleaclass_model->editFleaclass(array('fleaclass_id'=>$v),$update_array);
+                    $fleaclass_model->editFleaclass(array('fleaclass_id' => $v), $update_array);
                 }
                 $this->success(lang('goods_class_batch_edit_succ'));
-            }else {
+            } else {
                 $this->success(lang('goods_class_batch_edit_wrong_content'));
             }
-        }else {
+        } else {
             $this->success(lang('goods_class_batch_edit_wrong_content'));
         }
     }
     /**
      * 商品分类添加
      */
-    public function goods_class_add(){
+    public function goods_class_add()
+    {
         $fleaclass_model = model('fleaclass');
-        if (request()->isPost()){
+        if (request()->isPost()) {
             /**
              * 验证
              */
-            $data=[
-                'fleaclass_name' =>input('post.fleaclass_name'),
-                'fleaclass_sort'  =>input('post.fleaclass_sort')
+            $data = [
+                'fleaclass_name' => input('post.fleaclass_name'),
+                'fleaclass_sort'  => input('post.fleaclass_sort')
             ];
             $fleaclass_validate = ds_validate('fleaclass');
-            if (!$fleaclass_validate->scene('goods_class_add')->check($data)){
+            if (!$fleaclass_validate->scene('goods_class_add')->check($data)) {
                 $this->error($fleaclass_validate->getError());
-            }else {
+            } else {
 
                 $insert_array = array();
                 $insert_array['fleaclass_name'] = input('post.fleaclass_name');
@@ -168,10 +174,10 @@ class Fleaclass extends AdminControl
                 $insert_array['fleaclass_index_show'] = input('post.fleaclass_index_show');
 
                 $result = $fleaclass_model->addFleaclass($insert_array);
-                if ($result){
+                if ($result) {
                     dsLayerOpenSuccess(lang('goods_class_add_succ'));
-                }else {
-                   $this->error(lang('goods_class_add_fail'));
+                } else {
+                    $this->error(lang('goods_class_add_fail'));
                 }
             }
         }
@@ -179,14 +185,14 @@ class Fleaclass extends AdminControl
          * 父类列表,只取到第三级
          */
         $parent_list = $fleaclass_model->getTreeClassList(3);
-        if (is_array($parent_list)){
-            foreach ($parent_list as $k => $v){
-                $parent_list[$k]['fleaclass_name'] = str_repeat("&nbsp;",$v['deep']*2).$v['fleaclass_name'];
+        if (is_array($parent_list)) {
+            foreach ($parent_list as $k => $v) {
+                $parent_list[$k]['fleaclass_name'] = str_repeat("&nbsp;", $v['deep'] * 2) . $v['fleaclass_name'];
             }
         }
 
-        View::assign('fleaclass_parent_id',input('fleaclass_parent_id'));
-        View::assign('parent_list',$parent_list);
+        View::assign('fleaclass_parent_id', input('fleaclass_parent_id'));
+        View::assign('parent_list', $parent_list);
         $this->setAdminCurItem('add');
         return View::fetch('add');
     }
@@ -194,41 +200,42 @@ class Fleaclass extends AdminControl
     /**
      * 编辑
      */
-    public function goods_class_edit() {
+    public function goods_class_edit()
+    {
 
         $fleaclass_model = model('fleaclass');
         if (request()->isPost()) {
-                /**
-                 * 验证
-                 */
-                $data = [
-                    'fleaclass_name' => input('post.fleaclass_name'),
-                    'fleaclass_sort' => input('post.fleaclass_sort')
-                ];
+            /**
+             * 验证
+             */
+            $data = [
+                'fleaclass_name' => input('post.fleaclass_name'),
+                'fleaclass_sort' => input('post.fleaclass_sort')
+            ];
 
-                $fleaclass_validate = ds_validate('fleaclass');
-                 if (!$fleaclass_validate->scene('goods_class_edit')->check($data)){
-                    $this->error($fleaclass_validate->getError());
-                } else {
+            $fleaclass_validate = ds_validate('fleaclass');
+            if (!$fleaclass_validate->scene('goods_class_edit')->check($data)) {
+                $this->error($fleaclass_validate->getError());
+            } else {
 
-                    $update_array = array();
-                    $update_array['fleaclass_name'] = input('post.fleaclass_name');
+                $update_array = array();
+                $update_array['fleaclass_name'] = input('post.fleaclass_name');
 
-                    $fleaclass_parent_id = intval(input('post.fleaclass_parent_id'));
-                    if ($fleaclass_parent_id) {
-                        $update_array['fleaclass_parent_id'] = $fleaclass_parent_id;
-                    }
-                    $update_array['fleaclass_sort'] = input('post.fleaclass_sort');
-                    $update_array['fleaclass_show'] = input('post.fleaclass_show');
-                    $update_array['fleaclass_index_show'] = input('post.fleaclass_index_show');
+                $fleaclass_parent_id = intval(input('post.fleaclass_parent_id'));
+                if ($fleaclass_parent_id) {
+                    $update_array['fleaclass_parent_id'] = $fleaclass_parent_id;
+                }
+                $update_array['fleaclass_sort'] = input('post.fleaclass_sort');
+                $update_array['fleaclass_show'] = input('post.fleaclass_show');
+                $update_array['fleaclass_index_show'] = input('post.fleaclass_index_show');
 
-                    $result = $fleaclass_model->editFleaclass(array('fleaclass_id'=>input('post.fleaclass_id')),$update_array);
-                    if ($result) {
-                        dsLayerOpenSuccess(lang('goods_class_batch_edit_ok'));
-                    } else {
-                        $this->error(lang('goods_class_batch_edit_fail'));
-                    }
+                $result = $fleaclass_model->editFleaclass(array('fleaclass_id' => input('post.fleaclass_id')), $update_array);
+                if ($result) {
+                    dsLayerOpenSuccess(lang('goods_class_batch_edit_ok'));
+                } else {
+                    $this->error(lang('goods_class_batch_edit_fail'));
                 }
+            }
         } else {
             $class_array = $fleaclass_model->getOneFleaclass(input('param.fleaclass_id'));
             if (empty($class_array)) {
@@ -269,7 +276,8 @@ class Fleaclass extends AdminControl
     /**
      * 分类导入
      */
-    public function goods_class_import(){
+    public function goods_class_import()
+    {
         /**
          * 实例化模型
          */
@@ -277,14 +285,14 @@ class Fleaclass extends AdminControl
         /**
          * 导入
          */
-        if (request()->isPost()){
+        if (request()->isPost()) {
             /**
              * 得到导入文件后缀名
              */
-            $csv_name=explode('.',$_FILES['csv']['name']);
+            $csv_name = explode('.', $_FILES['csv']['name']);
             $file_type = end($csv_name);
-            if (!empty($_FILES['csv']) && !empty($_FILES['csv']['name']) && $file_type == 'csv'){
-                $fp = @fopen($_FILES['csv']['tmp_name'],'rb');
+            if (!empty($_FILES['csv']) && !empty($_FILES['csv']['name']) && $file_type == 'csv') {
+                $fp = @fopen($_FILES['csv']['tmp_name'], 'rb');
                 /**
                  * 父ID
                  */
@@ -292,49 +300,49 @@ class Fleaclass extends AdminControl
 
                 while (!feof($fp)) {
                     $data = fgets($fp, 4096);
-                    switch (strtoupper(input('post.charset'))){
+                    switch (strtoupper(input('post.charset'))) {
                         case 'UTF-8':
-                            if (strtoupper(CHARSET) !== 'UTF-8'){
-                                $data = iconv('UTF-8',strtoupper(CHARSET),$data);
+                            if (strtoupper(CHARSET) !== 'UTF-8') {
+                                $data = iconv('UTF-8', strtoupper(CHARSET), $data);
                             }
                             break;
                         case 'GBK':
-                            if (strtoupper(CHARSET) !== 'GBK'){
-                                $data = iconv('GBK',strtoupper(CHARSET),$data);
+                            if (strtoupper(CHARSET) !== 'GBK') {
+                                $data = iconv('GBK', strtoupper(CHARSET), $data);
                             }
                             break;
                     }
 
-                    if (!empty($data)){
-                        $data	= str_replace('"','',$data);
+                    if (!empty($data)) {
+                        $data    = str_replace('"', '', $data);
                         /**
                          * 逗号去除
                          */
                         $tmp_array = array();
-                        $tmp_array = explode(',',$data);
-                        if($tmp_array[0] == 'sort_order')continue;
+                        $tmp_array = explode(',', $data);
+                        if ($tmp_array[0] == 'sort_order') continue;
                         /**
                          * 第一位是序号,后面的是内容,最后一位名称
                          */
-                        $tmp_deep = 'parent_id_'.(count($tmp_array)-1);
+                        $tmp_deep = 'parent_id_' . (count($tmp_array) - 1);
 
                         $insert_array = array();
                         $insert_array['fleaclass_sort'] = $tmp_array[0];
                         $insert_array['fleaclass_parent_id'] = $$tmp_deep;
-                        $insert_array['fleaclass_name'] = $tmp_array[count($tmp_array)-1];
+                        $insert_array['fleaclass_name'] = $tmp_array[count($tmp_array) - 1];
                         $fleaclass_id = $fleaclass_model->addFleaclass($insert_array);
                         /**
                          * 赋值这个深度父ID
                          */
-                        $tmp = 'parent_id_'.count($tmp_array);
+                        $tmp = 'parent_id_' . count($tmp_array);
                         $$tmp = $fleaclass_id;
                     }
                 }
                 /**
                  * 重新生成缓存
                  */
-                $this->success(lang('goods_class_import_succ'),'fleaclass/flea_class');
-            }else {
+                $this->success(lang('goods_class_import_succ'), 'fleaclass/flea_class');
+            } else {
                 $this->error(lang('goods_class_import_csv_null'));
             }
         }
@@ -345,7 +353,8 @@ class Fleaclass extends AdminControl
     /**
      * 分类导出
      */
-    public function goods_class_export() {
+    public function goods_class_export()
+    {
         /**
          * 导出
          */
@@ -407,68 +416,75 @@ class Fleaclass extends AdminControl
     /**
      * 删除分类
      */
-    public function goods_class_del(){
+    public function goods_class_del()
+    {
         $fleaclass_model = model('fleaclass');
         $fleaclass_id = input('get.fleaclass_id');
-        if ($fleaclass_id > 0){
+        if ($fleaclass_id > 0) {
             /* 删除分类 */
             $fleaclass_model->delFleaclass($fleaclass_id);
             ds_json_encode(10000, lang('goods_class_index_del_succ'));
-        }else {
+        } else {
             ds_json_encode(10001, lang('goods_class_index_choose_del'));
         }
     }
     /**
      * ajax操作
      */
-    public function ajax(){
-        switch (input('branch')){
-            /**
+    public function ajax()
+    {
+        switch (input('branch')) {
+                /**
              * 验证是否有重复的名称
              */
             case 'goods_class_name':
                 $fleaclass_model = model('fleaclass');
                 $class_array = $fleaclass_model->getOneFleaclass(input('id'));
                 $condition = array();
-                $condition[] = array('fleaclass_name','=',input('param.value'));
-                $condition[] = array('fleaclass_parent_id','=',$class_array['fleaclass_parent_id']);
-                $condition[] = array('fleaclass_id','not in',input('param.id'));
+                $condition[] = array('fleaclass_name', '=', input('param.value'));
+                $condition[] = array('fleaclass_parent_id', '=', $class_array['fleaclass_parent_id']);
+                $condition[] = array('fleaclass_id', 'not in', input('param.id'));
                 $class_list = $fleaclass_model->getFleaclassList($condition);
-                if (empty($class_list)){
+                if (empty($class_list)) {
                     $update_array = array();
                     $update_array['fleaclass_name'] = input('value');
-                    $fleaclass_model->editFleaclass(array('fleaclass_id'=> intval(input('param.id'))),$update_array);
-                    echo 'true';exit;
-                }else {
-                    echo 'false';exit;
+                    $fleaclass_model->editFleaclass(array('fleaclass_id' => intval(input('param.id'))), $update_array);
+                    echo 'true';
+                    exit;
+                } else {
+                    echo 'false';
+                    exit;
                 }
                 break;
-            /**
-             * 分类 排序 显示 设置
-             */
+                /**
+                 * 分类 排序 显示 设置
+                 */
             case 'goods_class_sort':
             case 'goods_class_show':
             case 'goods_class_index_show':
                 $fleaclass_model = model('fleaclass');
                 $update_array = array();
                 $update_array[input('column')] = input('value');
-                $fleaclass_model->editFleaclass(array('fleaclass_id'=>intval(input('param.id'))),$update_array);
-                echo 'true';exit;
+                $fleaclass_model->editFleaclass(array('fleaclass_id' => intval(input('param.id'))), $update_array);
+                echo 'true';
+                exit;
                 break;
-            /**
-             * 添加、修改操作中 检测类别名称是否有重复
-             */
+                /**
+                 * 添加、修改操作中 检测类别名称是否有重复
+                 */
             case 'check_class_name':
                 $fleaclass_model = model('fleaclass');
                 $condition = array();
-                $condition[] = array('fleaclass_name','=',input('param.fleaclass_name'));
-                $condition[] = array('fleaclass_parent_id','=',input('param.fleaclass_parent_id'));
-                $condition[] = array('fleaclass_id','not in',input('param.fleaclass_id'));
+                $condition[] = array('fleaclass_name', '=', input('param.fleaclass_name'));
+                $condition[] = array('fleaclass_parent_id', '=', input('param.fleaclass_parent_id'));
+                $condition[] = array('fleaclass_id', 'not in', input('param.fleaclass_id'));
                 $class_list = $fleaclass_model->getFleaclassList($condition);
-                if (empty($class_list)){
-                    echo 'true';exit;
-                }else {
-                    echo 'false';exit;
+                if (empty($class_list)) {
+                    echo 'true';
+                    exit;
+                } else {
+                    echo 'false';
+                    exit;
                 }
                 break;
         }
@@ -480,7 +496,7 @@ class Fleaclass extends AdminControl
                 'name' => 'index', 'text' => lang('ds_manage'), 'url' => (string)url('Fleaclass/flea_class')
             ),
             array(
-                'name' => 'add', 'text' => lang('ds_add'), 'url' => "javascript:dsLayerOpen('".(string)url('Fleaclass/goods_class_add')."','".lang('ds_add')."')"
+                'name' => 'add', 'text' => lang('ds_add'), 'url' => "javascript:dsLayerOpen('" . (string)url('Fleaclass/goods_class_add') . "','" . lang('ds_add') . "')"
             ),
             array(
                 'name' => 'export', 'text' => lang('ds_export'), 'url' => (string)url('Fleaclass/goods_class_export')
@@ -491,4 +507,4 @@ class Fleaclass extends AdminControl
         );
         return $menu_array;
     }
-}
+}

+ 9 - 8
app/admin/controller/Fleaclassindex.php

@@ -1,18 +1,18 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Fleaclassindex extends AdminControl
@@ -20,12 +20,13 @@ class Fleaclassindex extends AdminControl
     public function initialize()
     {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/flea.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/flea.lang.php');
     }
     /**
      * 设置
      */
-    public function flea_class_index() {
+    public function flea_class_index()
+    {
 
 
         /**
@@ -76,4 +77,4 @@ class Fleaclassindex extends AdminControl
         );
         return $menu_array;
     }
-}
+}

+ 37 - 33
app/admin/controller/Flearegion.php

@@ -1,17 +1,19 @@
 <?php
+
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 use think\facade\Db;
+
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Flearegion extends AdminControl
@@ -19,8 +21,8 @@ class Flearegion extends AdminControl
     public function initialize()
     {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/region.lang.php');
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/flea.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/region.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/flea.lang.php');
     }
     /**
      * 地区列表
@@ -28,7 +30,8 @@ class Flearegion extends AdminControl
      * @param
      * @return
      */
-    public function flea_region() {
+    public function flea_region()
+    {
         /**
          * 实例化模型
          */
@@ -44,7 +47,7 @@ class Flearegion extends AdminControl
             /**
              * 新增地区
              */
-            $new_area_name_array = input('post.new_area_name/a');#获取数组
+            $new_area_name_array = input('post.new_area_name/a'); #获取数组
             if (is_array($new_area_name_array) && !empty($new_area_name_array)) {
                 foreach ($new_area_name_array as $k => $v) {
                     if (!empty($v)) {
@@ -61,14 +64,14 @@ class Flearegion extends AdminControl
             /**
              * 修改地区
              */
-            $area_name_array = input('post.area_name/a');#获取数组
+            $area_name_array = input('post.area_name/a'); #获取数组
             if (is_array($area_name_array) && !empty($area_name_array)) {
                 foreach ($area_name_array as $k => $v) {
                     if (!empty($v)) {
                         $insert_array = array();
                         $insert_array['fleaarea_name'] = $v;
                         $insert_array['fleaarea_sort'] = intval($area_name_array[$k]);
-                        $fleaarea_model->editFleaarea(array('fleaarea_id'=>$k),$insert_array);
+                        $fleaarea_model->editFleaarea(array('fleaarea_id' => $k), $insert_array);
                         $new_cache = true;
                     }
                 }
@@ -146,7 +149,7 @@ class Flearegion extends AdminControl
              */
             $condition = array();
             $fleaarea_parent_id = input('param.fleaarea_parent_id') ? input('param.fleaarea_parent_id') : '0';
-            $condition[] = array('fleaarea_parent_id','=',$fleaarea_parent_id);
+            $condition[] = array('fleaarea_parent_id', '=', $fleaarea_parent_id);
             $area_list = $fleaarea_model->getFleaareaList($condition);
             View::assign('province', input('param.province') ? input('param.province') : '');
             View::assign('city', input('param.city'));
@@ -170,9 +173,10 @@ class Flearegion extends AdminControl
      * @param
      * @return
      */
-    public function flea_import_default_area() {
-        $file = PUBLIC_PATH.'/examples/flea_area.sql';
-        if (!is_file($file)){
+    public function flea_import_default_area()
+    {
+        $file = PUBLIC_PATH . '/examples/flea_area.sql';
+        if (!is_file($file)) {
             ds_json_encode(10001, lang('region_import_csv_null'));
         }
 
@@ -180,24 +184,24 @@ class Flearegion extends AdminControl
         $tmp_sql = '';
         if ($handle) {
 
-            Db::query("TRUNCATE TABLE `".config('database.connections.mysql.prefix')."fleaarea`");
+            Db::query("TRUNCATE TABLE `" . config('database.connections.mysql.prefix') . "fleaarea`");
             while (!feof($handle)) {
 
                 $buffer = fgets($handle);
-                if (trim($buffer) != ''){
+                if (trim($buffer) != '') {
                     $tmp_sql .= $buffer;
-                    if (substr(rtrim($buffer),-1) == ';'){
-                        if (preg_match('/^(INSERT)\s+(INTO)\s+/i', ltrim($tmp_sql)) && substr(rtrim($buffer),-2) == ');'){
+                    if (substr(rtrim($buffer), -1) == ';') {
+                        if (preg_match('/^(INSERT)\s+(INTO)\s+/i', ltrim($tmp_sql)) && substr(rtrim($buffer), -2) == ');') {
                             //标准的SQL语句,将被执行
-                        }else{
+                        } else {
                             //不能组成标准的SQL语句,继续向下一行取内容,直到组成合法的SQL为止
                             continue;
                         }
-                        if (!empty($tmp_sql)){
-                            if (strtoupper(CHARSET) == 'GBK'){
-                                $tmp_sql = iconv('UTF-8',strtoupper(CHARSET),$tmp_sql);
+                        if (!empty($tmp_sql)) {
+                            if (strtoupper(CHARSET) == 'GBK') {
+                                $tmp_sql = iconv('UTF-8', strtoupper(CHARSET), $tmp_sql);
                             }
-                            $tmp_sql = str_replace("`#__fleaarea`","`".config('database.connections.mysql.prefix')."fleaarea`",$tmp_sql);
+                            $tmp_sql = str_replace("`#__fleaarea`", "`" . config('database.connections.mysql.prefix') . "fleaarea`", $tmp_sql);
                             Db::query($tmp_sql);
                             $tmp_sql = '';
                         }
@@ -208,19 +212,19 @@ class Flearegion extends AdminControl
             /**
              * 重新生成缓存
              */
-            for ($i=1;$i<=4;$i++){
-                $tmp = 'flea_area_parent_id_'.$i;
-                if (isset($$tmp) && intval($$tmp) >= 0){
-                    \fleacache::getCache('flea_area',array('deep'=>intval($i),'new'=>'1'));
+            for ($i = 1; $i <= 4; $i++) {
+                $tmp = 'flea_area_parent_id_' . $i;
+                if (isset($$tmp) && intval($$tmp) >= 0) {
+                    \fleacache::getCache('flea_area', array('deep' => intval($i), 'new' => '1'));
                 }
             }
             ds_json_encode(10000, lang('region_import_succ'));
-        }else {
+        } else {
             ds_json_encode(10001, lang('region_import_csv_null'));
         }
     }
-    
-    
+
+
     protected function getAdminItemList()
     {
         $menu_array = array(
@@ -228,9 +232,9 @@ class Flearegion extends AdminControl
                 'name' => 'index', 'text' => lang('ds_manage'), 'url' => (string)url('Flearegion/flea_region')
             ),
             array(
-                'name' => 'import', 'text' => lang('flea_region_import'), 'url' => "javascript:dsLayerConfirm('".(string)url('Flearegion/flea_import_default_area')."','".lang('import_confirm')."')"
+                'name' => 'import', 'text' => lang('flea_region_import'), 'url' => "javascript:dsLayerConfirm('" . (string)url('Flearegion/flea_import_default_area') . "','" . lang('import_confirm') . "')"
             ),
         );
         return $menu_array;
     }
-}
+}

+ 34 - 31
app/admin/controller/Fleaseo.php

@@ -6,19 +6,20 @@ use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Fleaseo extends AdminControl {
+class Fleaseo extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize(); // TODO: Change the autogenerated stub
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/flea.lang.php');
         if (config('ds_config.flea_isuse') != '1') {
@@ -26,7 +27,8 @@ class Fleaseo extends AdminControl {
         }
     }
 
-    function index() {
+    function index()
+    {
         /**
          * 实例化模型
          */
@@ -63,19 +65,20 @@ class Fleaseo extends AdminControl {
     /**
      * 闲置首页广告
      */
-    public function adv_manage() {
+    public function adv_manage()
+    {
         $config_model = model('config');
         if (request()->isPost()) {
             $input = array();
             //上传图片
             $file_name = 'flea_1.jpg';
             if (!empty($_FILES['adv_pic1']['name'])) {
-                $res=ds_upload_pic(ATTACH_PATH,'adv_pic1',$file_name);
-                if($res['code']){
-                    $file_name=$res['data']['file_name'];
+                $res = ds_upload_pic(ATTACH_PATH, 'adv_pic1', $file_name);
+                if ($res['code']) {
+                    $file_name = $res['data']['file_name'];
                     $input[1]['pic'] = $file_name;
                     $input[1]['url'] = input('post.adv_url1');
-                }else{
+                } else {
                     $this->error($res['msg']);
                 }
             } elseif (input('post.old_adv_pic1') != '') {
@@ -84,12 +87,12 @@ class Fleaseo extends AdminControl {
             }
             if (!empty($_FILES['adv_pic2']['name'])) {
                 $file_name = 'flea_2.jpg';
-                $res=ds_upload_pic(ATTACH_PATH,'adv_pic2',$file_name);
-                if($res['code']){
-                    $file_name=$res['data']['file_name'];
+                $res = ds_upload_pic(ATTACH_PATH, 'adv_pic2', $file_name);
+                if ($res['code']) {
+                    $file_name = $res['data']['file_name'];
                     $input[2]['pic'] = $file_name;
                     $input[2]['url'] = input('post.adv_url2');
-                }else{
+                } else {
                     $this->error($res['msg']);
                 }
             } elseif (input('post.old_adv_pic2') != '') {
@@ -99,12 +102,12 @@ class Fleaseo extends AdminControl {
             if (!empty($_FILES['adv_pic3']['name'])) {
                 $file_name = 'flea_3.jpg';
 
-                $res=ds_upload_pic(ATTACH_PATH,'adv_pic3',$file_name);
-                if($res['code']){
-                    $file_name=$res['data']['file_name'];
+                $res = ds_upload_pic(ATTACH_PATH, 'adv_pic3', $file_name);
+                if ($res['code']) {
+                    $file_name = $res['data']['file_name'];
                     $input[3]['pic'] = $file_name;
                     $input[3]['url'] = input('post.adv_url3');
-                }else{
+                } else {
                     $this->error($res['msg']);
                 }
             } elseif (input('post.old_adv_pic3') != '') {
@@ -114,12 +117,12 @@ class Fleaseo extends AdminControl {
 
             if (!empty($_FILES['adv_pic4']['name'])) {
                 $file_name = 'flea_4.jpg';
-                $res=ds_upload_pic(ATTACH_PATH,'adv_pic4',$file_name);
-                if($res['code']){
-                    $file_name=$res['data']['file_name'];
+                $res = ds_upload_pic(ATTACH_PATH, 'adv_pic4', $file_name);
+                if ($res['code']) {
+                    $file_name = $res['data']['file_name'];
                     $input[4]['pic'] = $file_name;
                     $input[4]['url'] = input('post.adv_url4');
-                }else{
+                } else {
                     $this->error($res['msg']);
                 }
             } elseif (input('post.old_adv_pic4') != '') {
@@ -129,12 +132,12 @@ class Fleaseo extends AdminControl {
 
             if (!empty($_FILES['adv_pic5']['name'])) {
                 $file_name = 'flea_5.jpg';
-                $res=ds_upload_pic(ATTACH_PATH,'adv_pic5',$file_name);
-                if($res['code']){
-                    $file_name=$res['data']['file_name'];
+                $res = ds_upload_pic(ATTACH_PATH, 'adv_pic5', $file_name);
+                if ($res['code']) {
+                    $file_name = $res['data']['file_name'];
                     $input[5]['pic'] = $file_name;
                     $input[5]['url'] = input('post.adv_url5');
-                }else{
+                } else {
                     $this->error($res['msg']);
                 }
             } elseif (input('post.old_adv_pic4') != '') {
@@ -165,7 +168,8 @@ class Fleaseo extends AdminControl {
         }
     }
 
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index', 'text' => lang('flea_seo'), 'url' => (string) url('Fleaseo/index')
@@ -173,5 +177,4 @@ class Fleaseo extends AdminControl {
         );
         return $menu_array;
     }
-
 }

+ 47 - 40
app/admin/controller/Goods.php

@@ -5,31 +5,34 @@
  */
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Goods extends AdminControl {
+class Goods extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/goods.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/goods.lang.php');
     }
 
     /**
      * 商品管理
      */
-    public function index() {
+    public function index()
+    {
         $goods_model = model('goods');
         /**
          * 处理商品分类
@@ -45,44 +48,44 @@ class Goods extends AdminControl {
         $where = array();
         $search_goods_name = trim(input('param.search_goods_name'));
         if ($search_goods_name != '') {
-            $where[]=array('goods_name','like', '%' . $search_goods_name . '%');
+            $where[] = array('goods_name', 'like', '%' . $search_goods_name . '%');
         }
         $search_commonid = intval(input('param.search_commonid'));
         if ($search_commonid > 0) {
-            $where[]=array('goods_commonid','=',$search_commonid);
+            $where[] = array('goods_commonid', '=', $search_commonid);
         }
         $search_store_name = trim(input('param.search_store_name'));
         if ($search_store_name != '') {
-            $where[]=array('store_name','like', '%' .$search_store_name . '%');
+            $where[] = array('store_name', 'like', '%' . $search_store_name . '%');
         }
         $b_id = intval(input('param.b_id'));
         if ($b_id > 0) {
-            $where[]=array('brand_id','=',$b_id);
+            $where[] = array('brand_id', '=', $b_id);
         }
         if ($choose_gcid > 0) {
-            $where[] = array('gc_id_' . ($gccache_arr['showclass'][$choose_gcid]['depth']),'=',$choose_gcid);
+            $where[] = array('gc_id_' . ($gccache_arr['showclass'][$choose_gcid]['depth']), '=', $choose_gcid);
         }
 
         $type = input('param.type');
         switch ($type) {
-            // 禁售
+                // 禁售
             case 'lockup':
                 $goods_list = $goods_model->getGoodsCommonLockUpList($where);
                 break;
-            // 等待审核
+                // 等待审核
             case 'waitverify':
                 $goods_list = $goods_model->getGoodsCommonWaitVerifyList($where, '*', 10, 'goods_verify desc, goods_commonid desc');
                 break;
-            // 全部商品
+                // 全部商品
             default:
                 //默认所有商品才有此参数
                 $goods_state = input('param.goods_state');
                 if (in_array($goods_state, array('0', '1', '10'))) {
-                    $where[]=array('goods_state','=',$goods_state);
+                    $where[] = array('goods_state', '=', $goods_state);
                 }
                 $goods_verify = input('param.goods_verify');
                 if (in_array($goods_verify, array('0', '1', '10'))) {
-                    $where[]=array('goods_verify','=',$goods_verify);
+                    $where[] = array('goods_verify', '=', $goods_verify);
                 }
                 $goods_list = $goods_model->getGoodsCommonList($where, '*', 10, 'mall_goods_commend desc,mall_goods_sort asc');
                 break;
@@ -107,10 +110,10 @@ class Goods extends AdminControl {
         View::assign('ownShopIds', array_fill_keys(model('store')->getOwnShopIds(), true));
 
         $type = input('param.type');
-        if(!in_array($type, array('lockup','waitverify','allgoods'))){
+        if (!in_array($type, array('lockup', 'waitverify', 'allgoods'))) {
             $type = 'allgoods';
         }
-        
+
         View::assign('type', $type);
         $this->setAdminCurItem($type);
         return View::fetch();
@@ -120,14 +123,15 @@ class Goods extends AdminControl {
     /**
      * 计算商品库存
      */
-    public function goods_storage($goods_list) {
+    public function goods_storage($goods_list)
+    {
         $goods_model = model('goods');
         // 计算库存
         $storage_array = array();
         if (!empty($goods_list)) {
             foreach ($goods_list as $value) {
-                $storage_array[$value['goods_commonid']]['goods_storage'] = $goods_model->getGoodsSum(array('goods_commonid'=>$value['goods_commonid']),'goods_storage');
-                $storage_array[$value['goods_commonid']][] = $goods_model->getGoodsInfo(array('goods_commonid'=>$value['goods_commonid']),'goods_id');
+                $storage_array[$value['goods_commonid']]['goods_storage'] = $goods_model->getGoodsSum(array('goods_commonid' => $value['goods_commonid']), 'goods_storage');
+                $storage_array[$value['goods_commonid']][] = $goods_model->getGoodsInfo(array('goods_commonid' => $value['goods_commonid']), 'goods_id');
             }
             return $storage_array;
         } else {
@@ -138,19 +142,20 @@ class Goods extends AdminControl {
     /**
      * 违规下架
      */
-    public function goods_lockup() {
+    public function goods_lockup()
+    {
         if (request()->isPost()) {
             $commonids = input('param.commonids');
             $commonid_array = ds_delete_param($commonids);
             if ($commonid_array == FALSE) {
                 $this->error(lang('ds_common_op_fail'));
             }
-            
+
             $update = array();
             $update['goods_stateremark'] = trim(input('post.close_reason'));
 
             $where = array();
-            $where[]=array('goods_commonid','in', $commonid_array);
+            $where[] = array('goods_commonid', 'in', $commonid_array);
 
             model('goods')->editProducesLockUp($update, $where);
             dsLayerOpenSuccess(lang('ds_common_op_succ'));
@@ -163,14 +168,15 @@ class Goods extends AdminControl {
     /**
      * 删除商品
      */
-    public function goods_del() {
+    public function goods_del()
+    {
         $common_id = input('param.common_id');
         $common_id_array = ds_delete_param($common_id);
         if ($common_id_array == FALSE) {
             ds_json_encode('10001', lang('ds_common_op_fail'));
         }
         $condition = array();
-        $condition[]=array('goods_commonid','in',$common_id_array);
+        $condition[] = array('goods_commonid', 'in', $common_id_array);
         model('goods')->delGoodsAll($condition);
         ds_json_encode('10000', lang('ds_common_op_succ'));
     }
@@ -178,7 +184,8 @@ class Goods extends AdminControl {
     /**
      * 审核商品
      */
-    public function goods_verify() {
+    public function goods_verify()
+    {
         if (request()->isPost()) {
             $commonids = input('param.commonids');
             $commonid_array = ds_delete_param($commonids);
@@ -193,7 +200,7 @@ class Goods extends AdminControl {
             $update1['goods_verifyremark'] = trim(input('param.verify_reason'));
             $update1 = array_merge($update1, $update2);
             $where = array();
-            $where[]=array('goods_commonid','in', $commonid_array);
+            $where[] = array('goods_commonid', 'in', $commonid_array);
 
             $goods_model = model('goods');
             if (intval(input('param.verify_state')) == 0) {
@@ -209,14 +216,15 @@ class Goods extends AdminControl {
     }
 
     //ajax获取同一个commonid下面的商品信息
-    public function get_goods_list_ajax() {
+    public function get_goods_list_ajax()
+    {
         $common_id = input('param.commonid');
         if (empty($common_id)) {
             $this->error(lang('param_error'));
         }
         $map['goods_commonid'] = $common_id;
         $goods_model = model('goods');
-        $common_info = $goods_model->getGoodsCommonInfo($map,'spec_name');
+        $common_info = $goods_model->getGoodsCommonInfo($map, 'spec_name');
         $goods_list = $goods_model->getGoodsList($map);
         //halt($goods_list);
         $spec_name = array_values((array) unserialize($common_info['spec_name']));
@@ -232,17 +240,18 @@ class Goods extends AdminControl {
         }
         return json_encode($goods_list);
     }
-    
+
     /**
      * ajax操作
      */
-    public function ajax() {
+    public function ajax()
+    {
         $goods_model = model('goods');
         switch (input('param.branch')) {
             case 'mall_goods_commend':
             case 'mall_goods_sort':
                 if (empty($result)) {
-                    $goods_model->editGoodsCommonById(array(trim(input('param.branch')) => trim(input('param.value'))),array(intval(input('param.id'))));
+                    $goods_model->editGoodsCommonById(array(trim(input('param.branch')) => trim(input('param.value'))), array(intval(input('param.id'))));
                     echo 'true';
                     exit;
                 } else {
@@ -256,7 +265,8 @@ class Goods extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'allgoods',
@@ -276,7 +286,4 @@ class Goods extends AdminControl {
         );
         return $menu_array;
     }
-
 }
-
-?>

+ 38 - 34
app/admin/controller/Goodsalbum.php

@@ -5,60 +5,63 @@
  */
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Goodsalbum extends AdminControl {
+class Goodsalbum extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/goodsalbum.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/goodsalbum.lang.php');
     }
 
     /**
      * 相册列表
      */
-    public function index() {
+    public function index()
+    {
         $condition = array();
         $store_name = '';
         if (is_numeric(input('param.keyword'))) {
             $store_id = intval(input('param.keyword'));
-            $condition[] = array('s.store_id','=',$store_id);
+            $condition[] = array('s.store_id', '=', $store_id);
             $store_name = ds_getvalue_byname('store', 'store_id', $store_id, 'store_name');
         } elseif (!empty(input('param.keyword'))) {
             $store_name = input('param.keyword');
             $store_id = ds_getvalue_byname('store', 'store_name', $store_name, 'store_id');
             if (is_numeric($store_id)) {
-                $condition[] = array('s.store_id','=',$store_id);
+                $condition[] = array('s.store_id', '=', $store_id);
             } else {
-                $condition[] = array('s.store_id','=',0);
+                $condition[] = array('s.store_id', '=', 0);
             }
         }
         $goodsalbum_model = model('album');
-        $albumclass_list = $goodsalbum_model->getGoodsalbumList($condition,10,'a.*,s.store_name');
+        $albumclass_list = $goodsalbum_model->getGoodsalbumList($condition, 10, 'a.*,s.store_name');
         View::assign('show_page', $goodsalbum_model->page_info->render());
 
         if (is_array($albumclass_list) && !empty($albumclass_list)) {
             foreach ($albumclass_list as $v) {
                 $class[] = $v['aclass_id'];
             }
-            $where=array();
-            $where[]=array('aclass_id','in',$class);
+            $where = array();
+            $where[] = array('aclass_id', 'in', $class);
         } else {
             $where = '1=1';
         }
-        $count = $goodsalbum_model->getAlbumpicCountlist($where,'aclass_id,count(*) as pcount','aclass_id');
+        $count = $goodsalbum_model->getAlbumpicCountlist($where, 'aclass_id,count(*) as pcount', 'aclass_id');
 
         $pic_count = array();
         if (is_array($count)) {
@@ -79,26 +82,27 @@ class Goodsalbum extends AdminControl {
     /**
      * 图片列表
      */
-    public function pic_list() {
+    public function pic_list()
+    {
         $condition = array();
         $store_name = '';
         if (is_numeric(input('param.keyword'))) {
             $store_id = intval(input('param.keyword'));
-            $condition[] = array('store_id','=',$store_id);
-            $store_name = ds_getvalue_byname('store','store_id',$store_id,'store_name');
+            $condition[] = array('store_id', '=', $store_id);
+            $store_name = ds_getvalue_byname('store', 'store_id', $store_id, 'store_name');
         } elseif ((input('param.keyword'))) {
             $store_name = input('param.keyword');
-            $store_id = ds_getvalue_byname('store','store_name',$store_name,'store_id');
+            $store_id = ds_getvalue_byname('store', 'store_name', $store_name, 'store_id');
             if (is_numeric($store_id)) {
-                $condition[] = array('store_id','=',$store_id);
+                $condition[] = array('store_id', '=', $store_id);
             } else {
-                $condition[] = array('store_id','=',0);
+                $condition[] = array('store_id', '=', 0);
             }
         } elseif (is_numeric(input('param.aclass_id'))) {
-            $condition[] = array('aclass_id','=',input('param.aclass_id'));
+            $condition[] = array('aclass_id', '=', input('param.aclass_id'));
         }
         $albumpic_model = model('album');
-        $albumpic_list = $albumpic_model->getAlbumpicList($condition,34,'','apic_id desc');
+        $albumpic_list = $albumpic_model->getAlbumpicList($condition, 34, '', 'apic_id desc');
         //halt($albumpic_list);
         $show_page = $albumpic_model->page_info->render();
         View::assign('show_page', $show_page);
@@ -111,14 +115,15 @@ class Goodsalbum extends AdminControl {
     /**
      * 删除相册
      */
-    public function aclass_del() {
+    public function aclass_del()
+    {
         $aclass_id = input('param.aclass_id');
         $aclass_id_array = ds_delete_param($aclass_id);
         if ($aclass_id_array == FALSE) {
             ds_json_encode('10001', lang('param_error'));
         }
-        $condition=array();
-        $condition[]=array('aclass_id','in',$aclass_id_array);
+        $condition = array();
+        $condition[] = array('aclass_id', 'in', $aclass_id_array);
         $albumpic_model = model('album');
         //批量删除相册图片
         $albumpic_model->delAlbumpic($condition);
@@ -131,14 +136,15 @@ class Goodsalbum extends AdminControl {
      * 删除一张图片及其对应记录
      *
      */
-    public function del_album_pic() {
+    public function del_album_pic()
+    {
         $apic_id = input('param.apic_id');
         $apic_id_array = ds_delete_param($apic_id);
         if ($apic_id_array === FALSE) {
             ds_json_encode('10001', lang('param_error'));
         }
-        $condition=array();
-        $condition[]=array('apic_id','in',$apic_id_array);
+        $condition = array();
+        $condition[] = array('apic_id', 'in', $apic_id_array);
         $albumpic_model = model('album');
         //批量删除相册图片
         $albumpic_model->delAlbumpic($condition);
@@ -147,7 +153,8 @@ class Goodsalbum extends AdminControl {
     }
 
 
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -162,7 +169,4 @@ class Goodsalbum extends AdminControl {
         );
         return $menu_array;
     }
-
 }
-
-?>

+ 52 - 43
app/admin/controller/Goodsclass.php

@@ -6,19 +6,20 @@ use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Goodsclass extends AdminControl {
+class Goodsclass extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/goodsclass.lang.php');
     }
@@ -26,7 +27,8 @@ class Goodsclass extends AdminControl {
     /**
      * 分类管理
      */
-    public function goods_class() {
+    public function goods_class()
+    {
         $goodsclass_model = model('goodsclass');
         //父ID
         $parent_id = input('param.gc_parent_id') ? intval(input('param.gc_parent_id')) : 0;
@@ -60,7 +62,8 @@ class Goodsclass extends AdminControl {
     /**
      * 商品分类添加
      */
-    public function goods_class_add() {
+    public function goods_class_add()
+    {
         $goodsclass_model = model('goodsclass');
         if (!request()->isPost()) {
             //父类列表,只取到第二级
@@ -102,7 +105,7 @@ class Goodsclass extends AdminControl {
             $insert_array['commis_rate'] = intval(input('post.commis_rate'));
             $insert_array['gc_sort'] = intval(input('post.gc_sort'));
             $insert_array['gc_virtual'] = intval(input('post.gc_virtual'));
-            if (!empty($_FILES['pic']['name'])) {//上传图片
+            if (!empty($_FILES['pic']['name'])) { //上传图片
                 $res = ds_upload_pic(ATTACH_COMMON, 'pic');
                 if ($res['code']) {
                     $file_name = $res['data']['file_name'];
@@ -130,7 +133,8 @@ class Goodsclass extends AdminControl {
     /**
      * 编辑
      */
-    public function goods_class_edit() {
+    public function goods_class_edit()
+    {
         $goodsclass_model = model('goodsclass');
         $gc_id = intval(input('param.gc_id'));
 
@@ -184,7 +188,7 @@ class Goodsclass extends AdminControl {
             $update_array['gc_virtual'] = intval(input('post.gc_virtual'));
             $update_array['gc_parent_id'] = intval(input('post.gc_parent_id'));
 
-            if (!empty($_FILES['pic']['name'])) {//上传图片
+            if (!empty($_FILES['pic']['name'])) { //上传图片
                 $res = ds_upload_pic(ATTACH_COMMON, 'pic');
                 if ($res['code']) {
                     $file_name = $res['data']['file_name'];
@@ -259,7 +263,8 @@ class Goodsclass extends AdminControl {
     /**
      * 删除分类
      */
-    public function goods_class_del() {
+    public function goods_class_del()
+    {
         $gc_id = input('param.gc_id');
         $gc_id_array = ds_delete_param($gc_id);
         if ($gc_id_array === FALSE) {
@@ -276,7 +281,8 @@ class Goodsclass extends AdminControl {
     /**
      * tag列表
      */
-    public function tag() {
+    public function tag()
+    {
 
         /**
          * 处理商品分类
@@ -318,7 +324,8 @@ class Goodsclass extends AdminControl {
     /**
      * 重置TAG
      */
-    public function tag_reset() {
+    public function tag_reset()
+    {
         //实例化模型
         $goodsclass_model = model('goodsclass');
         $classtag_model = model('goodsclasstag');
@@ -331,7 +338,7 @@ class Goodsclass extends AdminControl {
         //商品分类
         $goods_class = $goodsclass_model->getTreeClassList(3);
         //格式化分类。组成三维数组
-        if (is_array($goods_class) and ! empty($goods_class)) {
+        if (is_array($goods_class) and !empty($goods_class)) {
             $goods_class_array = array();
             foreach ($goods_class as $val) {
                 //一级分类
@@ -377,7 +384,8 @@ class Goodsclass extends AdminControl {
     /**
      * 更新TAG名称
      */
-    public function tag_update() {
+    public function tag_update()
+    {
         $goodsclass_model = model('goodsclass');
         $classtag_model = model('goodsclasstag');
 
@@ -439,7 +447,8 @@ class Goodsclass extends AdminControl {
     /**
      * 删除TAG
      */
-    public function tag_del() {
+    public function tag_del()
+    {
         $id = intval(input('get.tag_id'));
         $classtag_model = model('goodsclasstag');
         if ($id > 0) {
@@ -456,7 +465,8 @@ class Goodsclass extends AdminControl {
     /**
      * 分类导航
      */
-    public function nav_edit() {
+    public function nav_edit()
+    {
         $gc_id = input('param.gc_id');
         $goodsclass_model = model('goodsclass');
         $class_info = $goodsclass_model->getGoodsclassInfoById($gc_id);
@@ -468,20 +478,20 @@ class Goodsclass extends AdminControl {
             $update['gc_id'] = $gc_id;
             $update['goodscn_alias'] = input('post.goodscn_alias');
             $class_id_array = input('post.class_id/a');
-            if(empty($class_id_array)){
-            	$update['goodscn_classids'] = '';
-            }else if (is_array($class_id_array) && !empty($class_id_array)) {
+            if (empty($class_id_array)) {
+                $update['goodscn_classids'] = '';
+            } else if (is_array($class_id_array) && !empty($class_id_array)) {
                 $update['goodscn_classids'] = implode(',', $class_id_array);
             }
             $brand_id_array = input('post.brand_id/a');
-            if(empty($brand_id_array)){
-            	$update['goodscn_brandids'] = '';
-            }else if (is_array($brand_id_array) && !empty($brand_id_array)) {
+            if (empty($brand_id_array)) {
+                $update['goodscn_brandids'] = '';
+            } else if (is_array($brand_id_array) && !empty($brand_id_array)) {
                 $update['goodscn_brandids'] = implode(',', $brand_id_array);
             }
             $update['goodscn_adv1_link'] = input('post.goodscn_adv1_link');
             $update['goodscn_adv2_link'] = input('post.goodscn_adv2_link');
-            if (!empty($_FILES['pic']['name'])) {//上传图片
+            if (!empty($_FILES['pic']['name'])) { //上传图片
                 @unlink(BASE_UPLOAD_PATH . '/' . ATTACH_GOODS_CLASS . '/' . $nav_info['goodscn_pic']);
                 $file_name = date('YmdHis') . rand(10000, 99999) . '.png';
 
@@ -493,7 +503,7 @@ class Goodsclass extends AdminControl {
                     $this->error($res['msg']);
                 }
             }
-            if (!empty($_FILES['adv1']['name'])) {//上传广告图片
+            if (!empty($_FILES['adv1']['name'])) { //上传广告图片
                 @unlink(BASE_UPLOAD_PATH . '/' . ATTACH_GOODS_CLASS . '/' . $nav_info['goodscn_adv1']);
                 $file_name = date('YmdHis') . rand(10000, 99999) . '.png';
 
@@ -505,7 +515,7 @@ class Goodsclass extends AdminControl {
                     $this->error($res['msg']);
                 }
             }
-            if (!empty($_FILES['adv2']['name'])) {//上传广告图片
+            if (!empty($_FILES['adv2']['name'])) { //上传广告图片
                 @unlink(BASE_UPLOAD_PATH . '/' . ATTACH_GOODS_CLASS . '/' . $nav_info['goodscn_adv2']);
                 $file_name = date('YmdHis') . rand(10000, 99999) . '.png';
 
@@ -570,11 +580,12 @@ class Goodsclass extends AdminControl {
     /**
      * ajax操作
      */
-    public function ajax() {
+    public function ajax()
+    {
         $branch = input('param.branch');
         $condition = array();
         switch ($branch) {
-            /**
+                /**
              * 更新分类
              */
             case 'goods_class_name':
@@ -599,9 +610,9 @@ class Goodsclass extends AdminControl {
                     exit;
                 }
                 break;
-            /**
-             * 分类 排序 显示 设置
-             */
+                /**
+                 * 分类 排序 显示 设置
+                 */
             case 'goods_class_sort':
             case 'goods_class_show':
             case 'goods_class_index_show':
@@ -614,9 +625,9 @@ class Goodsclass extends AdminControl {
                 echo 'true';
                 exit;
                 break;
-            /**
-             * 添加、修改操作中 检测类别名称是否有重复
-             */
+                /**
+                 * 添加、修改操作中 检测类别名称是否有重复
+                 */
             case 'check_class_name':
                 $goodsclass_model = model('goodsclass');
                 $condition[] = array('gc_name', '=', trim(input('get.gc_name')));
@@ -631,9 +642,9 @@ class Goodsclass extends AdminControl {
                     exit;
                 }
                 break;
-            /**
-             * TAG值编辑
-             */
+                /**
+                 * TAG值编辑
+                 */
             case 'goods_class_tag_value':
                 $classtag_model = model('goodsclasstag');
                 $update_array = array();
@@ -652,7 +663,8 @@ class Goodsclass extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'goods_class',
@@ -681,7 +693,4 @@ class Goodsclass extends AdminControl {
         );
         return $menu_array;
     }
-
 }
-
-?>

+ 22 - 20
app/admin/controller/Goodsvideo.php

@@ -5,35 +5,38 @@
  */
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Goodsvideo extends AdminControl {
+class Goodsvideo extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/goodsvideo.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/goodsvideo.lang.php');
     }
 
     /**
      * 视频列表
      */
-    public function index() {
-        $goods_model=model('goods');
-        $video_list=$goods_model->getGoodsVideoList(array(),'*','goodsvideo_id desc',0,16);
-        foreach($video_list as $key => $val){
-            $video_list[$key]['goodsvideo_url']=goods_video($val['goodsvideo_name']);
+    public function index()
+    {
+        $goods_model = model('goods');
+        $video_list = $goods_model->getGoodsVideoList(array(), '*', 'goodsvideo_id desc', 0, 16);
+        foreach ($video_list as $key => $val) {
+            $video_list[$key]['goodsvideo_url'] = goods_video($val['goodsvideo_name']);
         }
         View::assign('video_list', $video_list);
         View::assign('show_page', $goods_model->page_info->render());
@@ -45,14 +48,15 @@ class Goodsvideo extends AdminControl {
      * 删除视频
      *
      */
-    public function del_video() {
+    public function del_video()
+    {
         $goodsvideo_id = input('param.goodsvideo_id');
         $goodsvideo_id_array = ds_delete_param($goodsvideo_id);
         if ($goodsvideo_id_array === FALSE) {
             ds_json_encode('10001', lang('param_error'));
         }
-        $condition=array();
-        $condition[]=array('goodsvideo_id','in',$goodsvideo_id_array);
+        $condition = array();
+        $condition[] = array('goodsvideo_id', 'in', $goodsvideo_id_array);
         $goods_model = model('goods');
         //批量删除视频
         $goods_model->delGoodsVideo($condition);
@@ -61,7 +65,8 @@ class Goodsvideo extends AdminControl {
     }
 
 
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -71,7 +76,4 @@ class Goodsvideo extends AdminControl {
         );
         return $menu_array;
     }
-
 }
-
-?>

+ 89 - 69
app/admin/controller/Groupbuy.php

@@ -5,43 +5,46 @@
  */
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Groupbuy extends AdminControl {
+class Groupbuy extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/groupbuy.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/groupbuy.lang.php');
     }
 
     /**
      * 进行中抢购列表,只可推荐
      *
      */
-    public function index() {
+    public function index()
+    {
         $groupbuy_model = model('groupbuy');
 
         $condition = array();
         if (!empty(input('param.groupbuy_name'))) {
-            $condition[]=array('groupbuy_name','like', '%' . input('param.groupbuy_name') . '%');
+            $condition[] = array('groupbuy_name', 'like', '%' . input('param.groupbuy_name') . '%');
         }
         if ((input('param.store_name'))) {
-            $condition[]=array('store_name','like', '%' . input('param.store_name') . '%');
+            $condition[] = array('store_name', 'like', '%' . input('param.store_name') . '%');
         }
         if ((input('param.groupbuy_state'))) {
-            $condition[]=array('groupbuy_state','=',input('param.groupbuy_state'));
+            $condition[] = array('groupbuy_state', '=', input('param.groupbuy_state'));
         }
         $groupbuy_list = $groupbuy_model->getGroupbuyExtendList($condition, 10);
         View::assign('groupbuy_list', $groupbuy_list);
@@ -52,7 +55,7 @@ class Groupbuy extends AdminControl {
 
         // 输出自营店铺IDS
         View::assign('flippedOwnShopIds', array_flip(model('store')->getOwnShopIds()));
-        
+
         View::assign('filtered', $condition ? 1 : 0); //是否有查询条件
         View::assign('flippedOwnShopIds', '');
         return View::fetch();
@@ -61,13 +64,14 @@ class Groupbuy extends AdminControl {
     /**
      * 审核通过
      */
-    public function groupbuy_review_pass() {
+    public function groupbuy_review_pass()
+    {
         $groupbuy_id = intval(input('post.groupbuy_id'));
 
-        if($groupbuy_id<=0){
+        if ($groupbuy_id <= 0) {
             $this->error(lang('param_error'));
         }
-        
+
         $groupbuy_model = model('groupbuy');
         $result = $groupbuy_model->reviewPassGroupbuy($groupbuy_id);
         if ($result) {
@@ -91,7 +95,8 @@ class Groupbuy extends AdminControl {
     /**
      * 审核失败
      */
-    public function groupbuy_review_fail() {
+    public function groupbuy_review_fail()
+    {
         $groupbuy_id = intval(input('post.groupbuy_id'));
 
         $groupbuy_model = model('groupbuy');
@@ -107,7 +112,8 @@ class Groupbuy extends AdminControl {
     /**
      * 取消
      */
-    public function groupbuy_cancel() {
+    public function groupbuy_cancel()
+    {
         $groupbuy_id = intval(input('post.groupbuy_id'));
 
         $groupbuy_model = model('groupbuy');
@@ -123,7 +129,8 @@ class Groupbuy extends AdminControl {
     /**
      * 删除
      */
-    public function groupbuy_del() {
+    public function groupbuy_del()
+    {
         $groupbuy_id = intval(input('param.groupbuy_id'));
         $groupbuy_model = model('groupbuy');
         $result = $groupbuy_model->delGroupbuy(array('groupbuy_id' => $groupbuy_id));
@@ -138,7 +145,8 @@ class Groupbuy extends AdminControl {
     /**
      * ajax修改抢购信息
      */
-    public function ajax() {
+    public function ajax()
+    {
 
         $result = true;
         $update_array = array();
@@ -148,7 +156,7 @@ class Groupbuy extends AdminControl {
             case 'gclass_sort':
                 $groupbuyclass_model = model('groupbuyclass');
                 $update_array['gclass_sort'] = input('param.value');
-                $condition[] = array('gclass_id','=',input('param.id'));
+                $condition[] = array('gclass_id', '=', input('param.id'));
                 $result = $groupbuyclass_model->editGroupbuyclass($update_array, $condition);
                 // 删除抢购分类缓存
                 model('groupbuy')->dropCachedData('groupbuy_classes');
@@ -156,7 +164,7 @@ class Groupbuy extends AdminControl {
             case 'gclass_name':
                 $groupbuyclass_model = model('groupbuyclass');
                 $update_array['gclass_name'] = input('param.value');
-                $condition[] = array('gclass_id','=',input('param.id'));
+                $condition[] = array('gclass_id', '=', input('param.id'));
                 $result = $groupbuyclass_model->editGroupbuyclass($update_array, $condition);
                 // 删除抢购分类缓存
                 model('groupbuy')->dropCachedData('groupbuy_classes');
@@ -165,23 +173,23 @@ class Groupbuy extends AdminControl {
             case 'recommended':
                 $groupbuy_model = model('groupbuy');
                 $update_array['groupbuy_recommended'] = input('param.value');
-                $condition[] = array('groupbuy_id','=',input('param.id'));
+                $condition[] = array('groupbuy_id', '=', input('param.id'));
                 $result = $groupbuy_model->editGroupbuy($update_array, $condition);
                 break;
         }
-		echo 'true';
-		exit;
-
+        echo 'true';
+        exit;
     }
 
     /**
      * 套餐管理
      * */
-    public function groupbuy_quota() {
+    public function groupbuy_quota()
+    {
         $groupbuyquota_model = model('groupbuyquota');
 
         $condition = array();
-        $condition[]=array('store_name','like', '%' . input('param.store_name') . '%');
+        $condition[] = array('store_name', 'like', '%' . input('param.store_name') . '%');
         $groupbuyquota_list = $groupbuyquota_model->getGroupbuyquotaList($condition, 10, 'groupbuyquota_endtime desc');
         View::assign('groupbuyquota_list', $groupbuyquota_list);
         View::assign('show_page', $groupbuyquota_model->page_info->render());
@@ -193,7 +201,8 @@ class Groupbuy extends AdminControl {
     /**
      * 抢购类别列表
      */
-    public function class_list() {
+    public function class_list()
+    {
 
         $groupbuyclass_model = model('groupbuyclass');
         $groupbuyclass_list = $groupbuyclass_model->getTreeList();
@@ -205,7 +214,8 @@ class Groupbuy extends AdminControl {
     /**
      * 添加抢购分类页面
      */
-    public function class_add() {
+    public function class_add()
+    {
 
         $groupbuyclass_model = model('groupbuyclass');
         $param = array();
@@ -221,7 +231,8 @@ class Groupbuy extends AdminControl {
     /**
      * 保存添加的抢购类别
      */
-    public function class_save() {
+    public function class_save()
+    {
 
         $gclass_id = intval(input('post.gclass_id'));
         $param = array();
@@ -259,7 +270,8 @@ class Groupbuy extends AdminControl {
     /**
      * 删除抢购类别
      */
-    public function class_drop() {
+    public function class_drop()
+    {
 
         $gclass_id = trim(input('param.gclass_id'));
         if (empty($gclass_id)) {
@@ -270,7 +282,7 @@ class Groupbuy extends AdminControl {
         //获得所有下级类别编号
         $all_gclass_id = $groupbuyclass_model->getAllClassId(explode(',', $gclass_id));
         $condition = array();
-        $condition[]=array('gclass_id','in',implode(',', $all_gclass_id));
+        $condition[] = array('gclass_id', 'in', implode(',', $all_gclass_id));
         if ($groupbuyclass_model->delGroupbuyclass($condition)) {
             // 删除抢购分类缓存
             model('groupbuy')->dropCachedData('groupbuy_classes');
@@ -284,7 +296,8 @@ class Groupbuy extends AdminControl {
     /**
      * 抢购价格区间列表
      */
-    public function price_list() {
+    public function price_list()
+    {
 
         $groupbuypricerange_model = model('groupbuypricerange');
         $groupbuypricerange_list = $groupbuypricerange_model->getGroupbuypricerangeList();
@@ -297,7 +310,8 @@ class Groupbuy extends AdminControl {
     /**
      * 添加抢购价格区间页面
      */
-    public function price_add() {
+    public function price_add()
+    {
         $price_info = [
             'gprange_id' => '', 'gprange_name' => '', 'gprange_start' => '', 'gprange_end' => '',
         ];
@@ -309,7 +323,8 @@ class Groupbuy extends AdminControl {
     /**
      * 编辑抢购价格区间页面
      */
-    public function price_edit() {
+    public function price_edit()
+    {
 
         $gprange_id = intval(input('param.gprange_id'));
         if (empty($gprange_id)) {
@@ -331,7 +346,8 @@ class Groupbuy extends AdminControl {
     /**
      * 保存添加的抢购价格区间
      */
-    public function price_save() {
+    public function price_save()
+    {
 
         $gprange_id = intval(input('post.gprange_id'));
         $param = array();
@@ -360,7 +376,7 @@ class Groupbuy extends AdminControl {
                 $this->log(lang('groupbuy_price_range_edit_success') . '[' . input('post.gprange_name') . ']', null);
                 dsLayerOpenSuccess(lang('groupbuy_price_range_edit_success'));
             } else {
-//                $this->error(lang('groupbuy_price_range_edit_fail'), (string)url('Groupbuy/price_list'));
+                //                $this->error(lang('groupbuy_price_range_edit_fail'), (string)url('Groupbuy/price_list'));
                 $this->error(lang('groupbuy_price_range_edit_fail'));
             }
         }
@@ -369,17 +385,18 @@ class Groupbuy extends AdminControl {
     /**
      * 删除抢购价格区间
      */
-    public function price_drop() {
-        
-        
+    public function price_drop()
+    {
+
+
         $gprange_id = input('param.gprange_id');
         $gprange_id_array = ds_delete_param($gprange_id);
         if ($gprange_id_array === FALSE) {
             $this->error(lang('param_error'));
         }
-        
+
         $condition = array();
-        $condition[]=array('gprange_id','in',$gprange_id_array);
+        $condition[] = array('gprange_id', 'in', $gprange_id_array);
         $groupbuypricerange_model = model('groupbuypricerange');
         if ($groupbuypricerange_model->delGroupbuypricerange($condition)) {
             dkcache('groupbuy_price');
@@ -393,7 +410,8 @@ class Groupbuy extends AdminControl {
     /**
      * 设置
      * */
-    public function groupbuy_setting() {
+    public function groupbuy_setting()
+    {
         if (!(request()->isPost())) {
             $setting = rkcache('config', true);
             View::assign('setting', $setting);
@@ -426,18 +444,19 @@ class Groupbuy extends AdminControl {
     /**
      * 幻灯片设置
      */
-    public function slider() {
+    public function slider()
+    {
         $config_model = model('config');
         if (request()->isPost()) {
             $update = array();
             $fprefix = 'home/groupbuy/slider';
             $upload_file = BASE_UPLOAD_PATH . DIRECTORY_SEPARATOR . $fprefix;
             if (!empty($_FILES['live_pic1']['name'])) {
-                $res=ds_upload_pic($fprefix,'live_pic1');
-                if($res['code']){
-                    $file_name=$res['data']['file_name'];
+                $res = ds_upload_pic($fprefix, 'live_pic1');
+                if ($res['code']) {
+                    $file_name = $res['data']['file_name'];
                     $update['live_pic1'] = $file_name;
-                }else{
+                } else {
                     $this->error($res['msg']);
                 }
             }
@@ -447,11 +466,11 @@ class Groupbuy extends AdminControl {
             }
 
             if (!empty($_FILES['live_pic2']['name'])) {
-                $res=ds_upload_pic($fprefix,'live_pic2');
-                if($res['code']){
-                    $file_name=$res['data']['file_name'];
+                $res = ds_upload_pic($fprefix, 'live_pic2');
+                if ($res['code']) {
+                    $file_name = $res['data']['file_name'];
                     $update['live_pic2'] = $file_name;
-                }else{
+                } else {
                     $this->error($res['msg']);
                 }
             }
@@ -461,11 +480,11 @@ class Groupbuy extends AdminControl {
             }
 
             if (!empty($_FILES['live_pic3']['name'])) {
-                $res=ds_upload_pic($fprefix,'live_pic3');
-                if($res['code']){
-                    $file_name=$res['data']['file_name'];
+                $res = ds_upload_pic($fprefix, 'live_pic3');
+                if ($res['code']) {
+                    $file_name = $res['data']['file_name'];
                     $update['live_pic3'] = $file_name;
-                }else{
+                } else {
                     $this->error($res['msg']);
                 }
             }
@@ -475,11 +494,11 @@ class Groupbuy extends AdminControl {
             }
 
             if (!empty($_FILES['live_pic4']['name'])) {
-                $res=ds_upload_pic($fprefix,'live_pic4');
-                if($res['code']){
-                    $file_name=$res['data']['file_name'];
+                $res = ds_upload_pic($fprefix, 'live_pic4');
+                if ($res['code']) {
+                    $file_name = $res['data']['file_name'];
                     $update['live_pic4'] = $file_name;
-                }else{
+                } else {
                     $this->error($res['msg']);
                 }
             }
@@ -524,7 +543,8 @@ class Groupbuy extends AdminControl {
     /**
      * 幻灯片清空
      */
-    public function slider_clear() {
+    public function slider_clear()
+    {
         $config_model = model('config');
         $update = array();
         $update['live_pic1'] = '';
@@ -552,29 +572,30 @@ class Groupbuy extends AdminControl {
      * @param array $array 附加菜单
      * @return
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
 
         $menu_array = array(
             array(
-                'name' => 'index', 
+                'name' => 'index',
                 'text' => lang('ds_groupbuy'),
                 'url' => (string)url('Groupbuy/index')
             ), array(
-                'name' => 'groupbuy_quota', 
-                'text' => lang('groupbuy_quota'), 
+                'name' => 'groupbuy_quota',
+                'text' => lang('groupbuy_quota'),
                 'url' => (string)url('Groupbuy/groupbuy_quota')
             ), array(
                 'name' => 'class_list',
                 'text' => lang('groupbuy_class_list'),
                 'url' => (string)url('Groupbuy/class_list')
             ), array(
-                'name' => 'price_list', 
+                'name' => 'price_list',
                 'text' => lang('groupbuy_price_list'),
                 'url' => (string)url('Groupbuy/price_list')
             ), array(
                 'name' => 'groupbuy_setting',
                 'text' => lang('ds_set'),
-                'url' => "javascript:dsLayerOpen('".(string)url('Groupbuy/groupbuy_setting')."','".lang('ds_set')."')"
+                'url' => "javascript:dsLayerOpen('" . (string)url('Groupbuy/groupbuy_setting') . "','" . lang('ds_set') . "')"
             ), array(
                 'name' => 'slider',
                 'text' => lang('groupbuy_slider'),
@@ -583,5 +604,4 @@ class Groupbuy extends AdminControl {
         );
         return $menu_array;
     }
-
 }

+ 1 - 8
app/admin/controller/Index.php

@@ -7,14 +7,7 @@ use think\facade\Lang;
 use think\facade\Cache;
 
 /**
- * ============================================================================
- * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
- * ----------------------------------------------------------------------------
- * 
- * ============================================================================
+ 
  * 控制器
  */
 class Index extends AdminControl

+ 42 - 27
app/admin/controller/Inform.php

@@ -6,19 +6,20 @@ use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Inform extends AdminControl {
+class Inform extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize(); // TODO: Change the autogenerated stub
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/inform.lang.php');
     }
@@ -27,7 +28,8 @@ class Inform extends AdminControl {
      * 未处理的举报列表
      */
 
-    public function inform_list() {
+    public function inform_list()
+    {
 
         $this->get_inform_list(1, 'inform_list');
         return View::fetch();
@@ -37,7 +39,8 @@ class Inform extends AdminControl {
      * 已处理的举报列表
      */
 
-    public function inform_handled_list() {
+    public function inform_handled_list()
+    {
 
         $this->get_inform_list(2, 'inform_handled_list');
         return View::fetch();
@@ -47,7 +50,8 @@ class Inform extends AdminControl {
      * 获取举报列表
      */
 
-    private function get_inform_list($type, $action) {
+    private function get_inform_list($type, $action)
+    {
 
         //获得举报列表
         $inform_model = model('inform');
@@ -71,7 +75,7 @@ class Inform extends AdminControl {
             $condition[] = array('inform.inform_datetime', '>=', $stime);
         }
         if ($etime > 0) {
-            $etime=$etime+86399;
+            $etime = $etime + 86399;
             $condition[] = array('inform.inform_datetime', '<=', $etime);
         }
         if ($type === 1) {
@@ -91,7 +95,8 @@ class Inform extends AdminControl {
      * 举报类型列表
      */
 
-    public function inform_subject_type_list() {
+    public function inform_subject_type_list()
+    {
 
         //获得有效举报类型列表
         $informsubjecttype_model = model('informsubjecttype');
@@ -107,7 +112,8 @@ class Inform extends AdminControl {
      * 举报主题列表
      */
 
-    public function inform_subject_list() {
+    public function inform_subject_list()
+    {
 
         //获得举报主题列表
         $informsubject_model = model('informsubject');
@@ -136,7 +142,8 @@ class Inform extends AdminControl {
      * 添加举报类型页面
      */
 
-    public function inform_subject_type_add() {
+    public function inform_subject_type_add()
+    {
         if (!request()->isPost()) {
             return View::fetch();
         } else {
@@ -168,12 +175,13 @@ class Inform extends AdminControl {
      * 添加举报类型页面
      */
 
-    public function inform_subject_type_edit() {
+    public function inform_subject_type_edit()
+    {
         $informtype_id = input('param.informtype_id');
         if (!request()->isPost()) {
             $informsubjecttype_model = model('informsubjecttype');
             $condition = array();
-            $condition[] = ['informtype_id','=',$informtype_id];
+            $condition[] = ['informtype_id', '=', $informtype_id];
             $informsubjecttype_info = $informsubjecttype_model->getInformsubjecttypeInfo($condition);
             View::assign('informsubjecttype_info', $informsubjecttype_info);
             return View::fetch();
@@ -181,7 +189,7 @@ class Inform extends AdminControl {
 
             //获取提交的内容
             $condition = array();
-            $condition[] = ['informtype_id','=',$informtype_id];
+            $condition[] = ['informtype_id', '=', $informtype_id];
             $input['informtype_name'] = trim(input('post.informtype_name'));
             $input['informtype_desc'] = trim(input('post.informtype_desc'));
 
@@ -197,7 +205,7 @@ class Inform extends AdminControl {
                 //验证成功保存
                 $input['informtype_state'] = 1;
                 $informsubjecttype_model = model('informsubjecttype');
-                $informsubjecttype_model->editInformsubjecttype($input,$condition);
+                $informsubjecttype_model->editInformsubjecttype($input, $condition);
                 dsLayerOpenSuccess(lang('ds_common_save_succ'));
             }
         }
@@ -207,7 +215,8 @@ class Inform extends AdminControl {
      * 删除举报类型,伪删除只是修改标记
      */
 
-    public function inform_subject_type_drop() {
+    public function inform_subject_type_drop()
+    {
 
         $informtype_id = trim(input('param.informtype_id'));
         $informrtype_id_array = ds_delete_param($informtype_id);
@@ -238,7 +247,8 @@ class Inform extends AdminControl {
      * 添加举报主题页面
      */
 
-    public function inform_subject_add() {
+    public function inform_subject_add()
+    {
         if (!request()->isPost()) {
             //获得可用举报类型列表
             $informsubjecttype_model = model('informsubjecttype');
@@ -278,7 +288,8 @@ class Inform extends AdminControl {
      * 删除举报主题,伪删除只是修改标记
      */
 
-    public function inform_subject_drop() {
+    public function inform_subject_drop()
+    {
         $informsubject_id = trim(input('param.informsubject_id'));
 
         $informsubject_id_array = ds_delete_param($informsubject_id);
@@ -299,7 +310,8 @@ class Inform extends AdminControl {
      * 显示处理举报
      */
 
-    public function show_handle_page() {
+    public function show_handle_page()
+    {
         $inform_id = intval(input('param.inform_id'));
         $inform_goods_name = urldecode(input('param.inform_goods_name'));
 
@@ -312,7 +324,8 @@ class Inform extends AdminControl {
      * 处理举报
      */
 
-    public function inform_handle() {
+    public function inform_handle()
+    {
 
         $inform_id = intval(input('post.inform_id'));
         $inform_handle_type = intval(input('post.inform_handle_type'));
@@ -381,7 +394,8 @@ class Inform extends AdminControl {
      * 禁止该用户举报
      */
 
-    private function denyMemberInform($member_id) {
+    private function denyMemberInform($member_id)
+    {
 
         $member_model = model('member');
         $param = array();
@@ -393,7 +407,8 @@ class Inform extends AdminControl {
      * 禁止商品销售
      */
 
-    private function denyGoods($goods_id) {
+    private function denyGoods($goods_id)
+    {
         //修改商品状态
         $goods_model = model('goods');
         $goods_info = $goods_model->getGoodsInfoByID($goods_id);
@@ -406,7 +421,8 @@ class Inform extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'inform_list',
@@ -441,5 +457,4 @@ class Inform extends AdminControl {
         );
         return $menu_array;
     }
-
 }

+ 33 - 29
app/admin/controller/InstantMessage.php

@@ -5,24 +5,27 @@
  */
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Db;
 use think\facade\Lang;
 use GatewayClient\Gateway;
+
 /**
- * ============================================================================
+ 
  * DSKMS多用户商城
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
+ 
+ * 
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class InstantMessage extends AdminControl {
+class InstantMessage extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/instant_message.lang.php');
     }
@@ -30,36 +33,37 @@ class InstantMessage extends AdminControl {
     /**
      * 商品管理
      */
-    public function index() {
+    public function index()
+    {
         $instant_message_model = model('instant_message');
         $f_name = trim(input('param.f_name'));
         $t_name = trim(input('param.t_name'));
-        $time_add_from = input('param.add_time_from')?strtotime(input('param.add_time_from')):'';
-        $time_add_to = input('param.add_time_to')?strtotime(input('param.add_time_to')):'';
+        $time_add_from = input('param.add_time_from') ? strtotime(input('param.add_time_from')) : '';
+        $time_add_to = input('param.add_time_to') ? strtotime(input('param.add_time_to')) : '';
         /**
          * 查询条件
          */
         $condition = array();
-        if($f_name){
-            $condition[]=array('instant_message_from_name','like','%'.$f_name.'%');
+        if ($f_name) {
+            $condition[] = array('instant_message_from_name', 'like', '%' . $f_name . '%');
         }
-        if($t_name){
-            $condition[]=array('instant_message_to_name','like','%'.$t_name.'%');
+        if ($t_name) {
+            $condition[] = array('instant_message_to_name', 'like', '%' . $t_name . '%');
         }
-        if($time_add_from){
-            $condition[]=array('instant_message_add_time','>=',$time_add_from);
+        if ($time_add_from) {
+            $condition[] = array('instant_message_add_time', '>=', $time_add_from);
         }
-        if($time_add_to){
-            $condition[]=array('instant_message_add_time','>=',$time_add_to);
+        if ($time_add_to) {
+            $condition[] = array('instant_message_add_time', '>=', $time_add_to);
         }
         $instant_message_open = input('param.instant_message_open');
         if (in_array($instant_message_open, array('0', '1', '2'))) {
-            $condition[]=array('instant_message_open','=',$instant_message_open);
+            $condition[] = array('instant_message_open', '=', $instant_message_open);
         }
 
         $instant_message_list = $instant_message_model->getInstantMessageList($condition, 10);
-        foreach($instant_message_list as $key => $val){
-            $instant_message_list[$key]=$instant_message_model->formatInstantMessage($val);
+        foreach ($instant_message_list as $key => $val) {
+            $instant_message_list[$key] = $instant_message_model->formatInstantMessage($val);
         }
         View::assign('instant_message_list', $instant_message_list);
         View::assign('show_page', $instant_message_model->page_info->render());
@@ -75,14 +79,15 @@ class InstantMessage extends AdminControl {
     /**
      * 删除商品
      */
-    public function del() {
+    public function del()
+    {
         $instant_message_id = input('param.instant_message_id');
         $instant_message_id_array = ds_delete_param($instant_message_id);
         if ($instant_message_id_array == FALSE) {
             ds_json_encode('10001', lang('ds_common_op_fail'));
         }
         $condition = array();
-        $condition[] = array('instant_message_id','in', $instant_message_id_array);
+        $condition[] = array('instant_message_id', 'in', $instant_message_id_array);
         model('instant_message')->delInstantMessage($condition);
         $this->log(lang('ds_del') . lang('instant_message') . ' ID:' . implode('、', $instant_message_id_array), 1);
         ds_json_encode('10000', lang('ds_common_op_succ'));
@@ -91,7 +96,8 @@ class InstantMessage extends AdminControl {
     /*
      * 直播设置
      */
-    public function setting() {
+    public function setting()
+    {
         $config_model = model('config');
         if (!request()->isPost()) {
             $list_config = rkcache('config', true);
@@ -99,7 +105,7 @@ class InstantMessage extends AdminControl {
             $this->setAdminCurItem('setting');
             return View::fetch();
         } else {
-            $update_array=array();
+            $update_array = array();
             $update_array['instant_message_gateway_url'] = input('param.instant_message_gateway_url');
             $update_array['instant_message_register_url'] = input('param.instant_message_register_url');
             $update_array['instant_message_open'] = input('param.instant_message_open');
@@ -116,7 +122,8 @@ class InstantMessage extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -131,7 +138,4 @@ class InstantMessage extends AdminControl {
         );
         return $menu_array;
     }
-
 }
-
-?>

+ 206 - 194
app/admin/controller/Inviter.php

@@ -1,77 +1,80 @@
 <?php
+
 /**
  * 推荐人设置
  */
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Db;
 use think\facade\Lang;
+
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Inviter extends AdminControl
 {
-public function initialize()
-{
-    parent::initialize(); // TODO: Change the autogenerated stub
-    Lang::load(base_path().'admin/lang/'.config('lang.default_lang').'/inviter.lang.php');
-}
+    public function initialize()
+    {
+        parent::initialize(); // TODO: Change the autogenerated stub
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/inviter.lang.php');
+    }
 
     /**
      * 基本设置
      */
-    public function setting(){
+    public function setting()
+    {
         $config_model = model('config');
-        if (request()->isPost()){
+        if (request()->isPost()) {
             $upload_file = BASE_UPLOAD_PATH . DIRECTORY_SEPARATOR . ATTACH_COMMON;
             if (!empty($_FILES['inviter_back']['name'])) {
-                $res=ds_upload_pic(ATTACH_COMMON,'inviter_back', 'inviter_back.png');
-                if($res['code']){
-                    $file_name=$res['data']['file_name'];
+                $res = ds_upload_pic(ATTACH_COMMON, 'inviter_back', 'inviter_back.png');
+                if ($res['code']) {
+                    $file_name = $res['data']['file_name'];
                     $upload['inviter_back'] = $file_name;
-                }else{
+                } else {
                     $this->error($res['msg']);
                 }
             }
             if (!empty($upload['inviter_back'])) {
                 $update_array['inviter_back'] = $upload['inviter_back'];
             }
-            $update_array['inviter_ratio_1']=floatval(input('post.inviter_ratio_1'));
-            $update_array['inviter_ratio_2']=floatval(input('post.inviter_ratio_2'));
-            $update_array['inviter_ratio_3']=floatval(input('post.inviter_ratio_3'));
-            
-            $update_array['inviter_open']=intval(input('post.inviter_open'));
-            $update_array['inviter_level']=intval(input('post.inviter_level'));
-            $update_array['inviter_show']=floatval(input('post.inviter_show'));
-            $update_array['inviter_return']=floatval(input('post.inviter_return'));
-            $update_array['inviter_view']=floatval(input('post.inviter_view'));
-            $update_array['inviter_condition']=floatval(input('post.inviter_condition'));
-            $update_array['inviter_condition_amount']=floatval(input('post.inviter_condition_amount'));
-            
-            if($update_array['inviter_return']){
-                if(($update_array['inviter_ratio_1']*2+$update_array['inviter_ratio_2']+$update_array['inviter_ratio_3'])>100){
+            $update_array['inviter_ratio_1'] = floatval(input('post.inviter_ratio_1'));
+            $update_array['inviter_ratio_2'] = floatval(input('post.inviter_ratio_2'));
+            $update_array['inviter_ratio_3'] = floatval(input('post.inviter_ratio_3'));
+
+            $update_array['inviter_open'] = intval(input('post.inviter_open'));
+            $update_array['inviter_level'] = intval(input('post.inviter_level'));
+            $update_array['inviter_show'] = floatval(input('post.inviter_show'));
+            $update_array['inviter_return'] = floatval(input('post.inviter_return'));
+            $update_array['inviter_view'] = floatval(input('post.inviter_view'));
+            $update_array['inviter_condition'] = floatval(input('post.inviter_condition'));
+            $update_array['inviter_condition_amount'] = floatval(input('post.inviter_condition_amount'));
+
+            if ($update_array['inviter_return']) {
+                if (($update_array['inviter_ratio_1'] * 2 + $update_array['inviter_ratio_2'] + $update_array['inviter_ratio_3']) > 100) {
                     $this->error(lang('inviter_ratio_error'));
                 }
-            }else{
-                if(($update_array['inviter_ratio_1']+$update_array['inviter_ratio_2']+$update_array['inviter_ratio_3'])>100){
+            } else {
+                if (($update_array['inviter_ratio_1'] + $update_array['inviter_ratio_2'] + $update_array['inviter_ratio_3']) > 100) {
                     $this->error(lang('inviter_ratio_error'));
                 }
             }
             $result = $config_model->editConfig($update_array);
             if ($result) {
-                $this->log(lang('ds_inviter_set'),1);
+                $this->log(lang('ds_inviter_set'), 1);
                 $this->success(lang('ds_common_op_succ'), 'Inviter/setting');
-            }else{
-                $this->log(lang('ds_inviter_set'),0);
+            } else {
+                $this->log(lang('ds_inviter_set'), 0);
             }
         } else {
             $list_setting = rkcache('config', true);
@@ -80,45 +83,47 @@ public function initialize()
             return View::fetch('index');
         }
     }
-    
-    public function goods(){
-        $goods_model=model('goods');
+
+    public function goods()
+    {
+        $goods_model = model('goods');
         $condition = array();
-        $condition[]=array('inviter_open','=',1);
+        $condition[] = array('inviter_open', '=', 1);
         if ((input('param.goods_name'))) {
-            $condition[]=array('goods_name','like', '%' . input('param.goods_name') . '%');
+            $condition[] = array('goods_name', 'like', '%' . input('param.goods_name') . '%');
         }
-  
+
         $goods_list = $goods_model->getGoodsCommonList($condition, '*', 10);
         View::assign('goods_list', $goods_list);
         View::assign('show_page', $goods_model->page_info->render());
-        
+
         $this->setAdminCurItem('goods');
         return View::fetch('goods');
     }
-    
-    public function order(){
+
+    public function order()
+    {
         $search_field_value = input('param.search_field_value');
         $search_field_name = input('param.search_field_name');
         $condition = array();
         if ($search_field_value != '') {
             switch ($search_field_name) {
                 case 'orderinviter_member_name':
-                    $condition[] = array('orderinviter_member_name','=',$search_field_value);
+                    $condition[] = array('orderinviter_member_name', '=', $search_field_value);
                     break;
                 case 'orderinviter_order_sn':
-                    $condition[] = array('orderinviter_order_sn','=',$search_field_value);
+                    $condition[] = array('orderinviter_order_sn', '=', $search_field_value);
                     break;
                 case 'orderinviter_store_name':
-                    $condition[] = array('orderinviter_store_name','=',$search_field_value);
+                    $condition[] = array('orderinviter_store_name', '=', $search_field_value);
                     break;
             }
         }
-  
-        $orderinviter_list=Db::name('orderinviter')->where($condition)->order('orderinviter_addtime desc')->paginate(['list_rows'=>10,'query' => request()->param()],false);
-        $order_list=$orderinviter_list->items();
-        foreach($order_list as $key => $val){
-            $order_list[$key]['orderinviter_valid_text']=lang('orderinviter_valid_array')[$val['orderinviter_valid']];
+
+        $orderinviter_list = Db::name('orderinviter')->where($condition)->order('orderinviter_addtime desc')->paginate(['list_rows' => 10, 'query' => request()->param()], false);
+        $order_list = $orderinviter_list->items();
+        foreach ($order_list as $key => $val) {
+            $order_list[$key]['orderinviter_valid_text'] = lang('orderinviter_valid_array')[$val['orderinviter_valid']];
         }
         View::assign('orderinviter_list', $order_list);
         View::assign('show_page', $orderinviter_list->render());
@@ -128,37 +133,38 @@ public function initialize()
         $this->setAdminCurItem('order');
         return View::fetch();
     }
-    
-    public function member(){
-        $inviter_model=model('inviter');
+
+    public function member()
+    {
+        $inviter_model = model('inviter');
         $search_field_value = input('search_field_value');
         $search_field_name = input('search_field_name');
         $condition = array();
         if ($search_field_value != '') {
             switch ($search_field_name) {
                 case 'member_name':
-                    $condition[]=array('member_name','like', '%' . trim($search_field_value) . '%');
+                    $condition[] = array('member_name', 'like', '%' . trim($search_field_value) . '%');
                     break;
                 case 'member_email':
-                    $condition[]=array('member_email','like', '%' . trim($search_field_value) . '%');
+                    $condition[] = array('member_email', 'like', '%' . trim($search_field_value) . '%');
                     break;
                 case 'member_mobile':
-                    $condition[]=array('member_mobile','like', '%' . trim($search_field_value) . '%');
+                    $condition[] = array('member_mobile', 'like', '%' . trim($search_field_value) . '%');
                     break;
                 case 'member_truename':
-                    $condition[]=array('member_truename','like', '%' . trim($search_field_value) . '%');
+                    $condition[] = array('member_truename', 'like', '%' . trim($search_field_value) . '%');
                     break;
             }
         }
-  
-        $member_list = $inviter_model->getInviterList($condition, 10,'','i.*,m.inviter_id as inviter_parent_id,m.member_id,m.member_ww,m.member_qq,m.member_addtime,m.member_name,m.member_avatar,m.member_email,m.member_mobile,m.member_truename');
-        $inviterclass_model=model('inviterclass');
-        foreach($member_list as $key => $item){
-            $member_list[$key]['inviter_parent_name']='';
-            $member_list[$key]['inviter_class']='';
-            $member_list[$key]['inviter_class']=$inviterclass_model->getInviterclass($item['inviter_total_amount']);
-            if($item['inviter_parent_id']){
-                $member_list[$key]['inviter_parent_name'] = Db::name('member')->where('member_id='.$item['inviter_parent_id'])->value('member_name');
+
+        $member_list = $inviter_model->getInviterList($condition, 10, '', 'i.*,m.inviter_id as inviter_parent_id,m.member_id,m.member_ww,m.member_qq,m.member_addtime,m.member_name,m.member_avatar,m.member_email,m.member_mobile,m.member_truename');
+        $inviterclass_model = model('inviterclass');
+        foreach ($member_list as $key => $item) {
+            $member_list[$key]['inviter_parent_name'] = '';
+            $member_list[$key]['inviter_class'] = '';
+            $member_list[$key]['inviter_class'] = $inviterclass_model->getInviterclass($item['inviter_total_amount']);
+            if ($item['inviter_parent_id']) {
+                $member_list[$key]['inviter_parent_name'] = Db::name('member')->where('member_id=' . $item['inviter_parent_id'])->value('member_name');
             }
         }
         View::assign('member_list', $member_list);
@@ -169,110 +175,113 @@ public function initialize()
         $this->setAdminCurItem('member');
         return View::fetch('member');
     }
-    public function memberclass(){
-        $memberclass_list=Db::name('inviterclass')->order('inviterclass_amount asc')->select()->toArray();
-        View::assign('memberclass_list',$memberclass_list);
+    public function memberclass()
+    {
+        $memberclass_list = Db::name('inviterclass')->order('inviterclass_amount asc')->select()->toArray();
+        View::assign('memberclass_list', $memberclass_list);
         $this->setAdminCurItem('memberclass');
         return View::fetch('memberclass');
     }
-    
-    public function member_adjust(){
-        $member_id=intval(input('param.member_id'));
-        if(!$member_id){
+
+    public function member_adjust()
+    {
+        $member_id = intval(input('param.member_id'));
+        if (!$member_id) {
             $this->error(lang('param_error'));
         }
-        $inviter_model=model('inviter');
-        $inviter_info=$inviter_model->getInviterInfo(array('m.member_id'=>$member_id),'m.member_id,m.inviter_id as inviter_parent_id,i.inviter_1_quantity,i.inviter_2_quantity,i.inviter_3_quantity');
-        if(!$inviter_info){
+        $inviter_model = model('inviter');
+        $inviter_info = $inviter_model->getInviterInfo(array('m.member_id' => $member_id), 'm.member_id,m.inviter_id as inviter_parent_id,i.inviter_1_quantity,i.inviter_2_quantity,i.inviter_3_quantity');
+        if (!$inviter_info) {
             $this->error(lang('inviter_member_empty'));
         }
         if (request()->isPost()) {
-            $member_name=trim(input('param.member_name'));
-            if($member_name){
-                $inviter=$inviter_model->getInviterInfo(array('m.member_name'=>$member_name),'m.member_id');
-                $inviter_id=$inviter['member_id'];
-                if(!$inviter_id){
+            $member_name = trim(input('param.member_name'));
+            if ($member_name) {
+                $inviter = $inviter_model->getInviterInfo(array('m.member_name' => $member_name), 'm.member_id');
+                $inviter_id = $inviter['member_id'];
+                if (!$inviter_id) {
                     $this->error(lang('inviter_member_empty'));
                 }
                 //上级不能是自己
-                if($inviter_id==$member_id){
+                if ($inviter_id == $member_id) {
                     $this->error(lang('inviter_parent_error'));
                 }
                 //上级不能是自己下级中(3级内)的成员
-                if(Db::name('member')->where('inviter_id='.$member_id.' AND member_id='.$inviter_id)->value('member_id')){
+                if (Db::name('member')->where('inviter_id=' . $member_id . ' AND member_id=' . $inviter_id)->value('member_id')) {
                     $this->error(lang('inviter_parent_error2'));
                 }
-                $subQuery=Db::name('member')->field('member_id')->where('inviter_id='.$member_id)->buildSql();
-                
-                if(Db::name('member')->where('member_id='.$inviter_id.' AND inviter_id IN'.$subQuery)->value('member_id')){
+                $subQuery = Db::name('member')->field('member_id')->where('inviter_id=' . $member_id)->buildSql();
+
+                if (Db::name('member')->where('member_id=' . $inviter_id . ' AND inviter_id IN' . $subQuery)->value('member_id')) {
                     $this->error(lang('inviter_parent_error2'));
                 }
-                $subQuery=Db::name('member')->field('member_id')->where('inviter_id IN'.$subQuery)->buildSql();
-                if(Db::name('member')->where('member_id='.$inviter_id.' AND inviter_id IN'.$subQuery)->value('member_id')){
+                $subQuery = Db::name('member')->field('member_id')->where('inviter_id IN' . $subQuery)->buildSql();
+                if (Db::name('member')->where('member_id=' . $inviter_id . ' AND inviter_id IN' . $subQuery)->value('member_id')) {
                     $this->error(lang('inviter_parent_error2'));
                 }
-            }else{
-                $inviter_id=0;
+            } else {
+                $inviter_id = 0;
             }
-            Db::name('member')->where('member_id='.$member_id)->update(array(
-                'inviter_id'=>$inviter_id
+            Db::name('member')->where('member_id=' . $member_id)->update(array(
+                'inviter_id' => $inviter_id
             ));
             //给旧的父级减去下线成员
-            if($inviter_info['inviter_parent_id']){
-                Db::name('inviter')->where('inviter_id='.$inviter_info['inviter_parent_id'].' AND inviter_1_quantity>=1')->dec('inviter_1_quantity')->update();
-                Db::name('inviter')->where('inviter_id='.$inviter_info['inviter_parent_id'].' AND inviter_2_quantity>='.$inviter_info['inviter_1_quantity'])->dec('inviter_2_quantity',$inviter_info['inviter_1_quantity'])->update();
-                Db::name('inviter')->where('inviter_id='.$inviter_info['inviter_parent_id'].' AND inviter_3_quantity>='.$inviter_info['inviter_2_quantity'])->dec('inviter_3_quantity',$inviter_info['inviter_2_quantity'])->update();
+            if ($inviter_info['inviter_parent_id']) {
+                Db::name('inviter')->where('inviter_id=' . $inviter_info['inviter_parent_id'] . ' AND inviter_1_quantity>=1')->dec('inviter_1_quantity')->update();
+                Db::name('inviter')->where('inviter_id=' . $inviter_info['inviter_parent_id'] . ' AND inviter_2_quantity>=' . $inviter_info['inviter_1_quantity'])->dec('inviter_2_quantity', $inviter_info['inviter_1_quantity'])->update();
+                Db::name('inviter')->where('inviter_id=' . $inviter_info['inviter_parent_id'] . ' AND inviter_3_quantity>=' . $inviter_info['inviter_2_quantity'])->dec('inviter_3_quantity', $inviter_info['inviter_2_quantity'])->update();
                 //父级的父级
-                $temp=$inviter_model->getInviterInfo(array('m.member_id'=>$inviter_info['inviter_parent_id']),'m.inviter_id as inviter_parent_id');
-                if($temp['inviter_parent_id']){
-                    Db::name('inviter')->where('inviter_id='.$temp['inviter_parent_id'].' AND inviter_2_quantity>=1')->dec('inviter_2_quantity')->update();
-                    Db::name('inviter')->where('inviter_id='.$temp['inviter_parent_id'].' AND inviter_3_quantity>='.$inviter_info['inviter_1_quantity'])->dec('inviter_3_quantity',$inviter_info['inviter_1_quantity'])->update();
+                $temp = $inviter_model->getInviterInfo(array('m.member_id' => $inviter_info['inviter_parent_id']), 'm.inviter_id as inviter_parent_id');
+                if ($temp['inviter_parent_id']) {
+                    Db::name('inviter')->where('inviter_id=' . $temp['inviter_parent_id'] . ' AND inviter_2_quantity>=1')->dec('inviter_2_quantity')->update();
+                    Db::name('inviter')->where('inviter_id=' . $temp['inviter_parent_id'] . ' AND inviter_3_quantity>=' . $inviter_info['inviter_1_quantity'])->dec('inviter_3_quantity', $inviter_info['inviter_1_quantity'])->update();
                     //父级的父级的父级
-                    $temp=$inviter_model->getInviterInfo(array('m.member_id'=>$temp['inviter_parent_id']),'m.inviter_id as inviter_parent_id');
-                    if($temp['inviter_parent_id']){
-                        Db::name('inviter')->where('inviter_id='.$temp['inviter_parent_id'].' AND inviter_3_quantity>=1')->dec('inviter_3_quantity')->update();
+                    $temp = $inviter_model->getInviterInfo(array('m.member_id' => $temp['inviter_parent_id']), 'm.inviter_id as inviter_parent_id');
+                    if ($temp['inviter_parent_id']) {
+                        Db::name('inviter')->where('inviter_id=' . $temp['inviter_parent_id'] . ' AND inviter_3_quantity>=1')->dec('inviter_3_quantity')->update();
                     }
                 }
             }
             //给新的父级增加下线成员
-            if($inviter_id){
-                Db::name('inviter')->where('inviter_id='.$inviter_id)->inc('inviter_1_quantity')->update();
-                Db::name('inviter')->where('inviter_id='.$inviter_id)->inc('inviter_2_quantity',$inviter_info['inviter_1_quantity'])->update();
-                Db::name('inviter')->where('inviter_id='.$inviter_id)->inc('inviter_3_quantity',$inviter_info['inviter_2_quantity'])->update();
+            if ($inviter_id) {
+                Db::name('inviter')->where('inviter_id=' . $inviter_id)->inc('inviter_1_quantity')->update();
+                Db::name('inviter')->where('inviter_id=' . $inviter_id)->inc('inviter_2_quantity', $inviter_info['inviter_1_quantity'])->update();
+                Db::name('inviter')->where('inviter_id=' . $inviter_id)->inc('inviter_3_quantity', $inviter_info['inviter_2_quantity'])->update();
                 //父级的父级
-                $temp=$inviter_model->getInviterInfo(array('m.member_id'=>$inviter_id),'m.inviter_id as inviter_parent_id');
-                if($temp['inviter_parent_id']){
-                    Db::name('inviter')->where('inviter_id='.$temp['inviter_parent_id'])->inc('inviter_2_quantity')->update();
-                    Db::name('inviter')->where('inviter_id='.$temp['inviter_parent_id'])->inc('inviter_3_quantity',$inviter_info['inviter_1_quantity'])->update();
+                $temp = $inviter_model->getInviterInfo(array('m.member_id' => $inviter_id), 'm.inviter_id as inviter_parent_id');
+                if ($temp['inviter_parent_id']) {
+                    Db::name('inviter')->where('inviter_id=' . $temp['inviter_parent_id'])->inc('inviter_2_quantity')->update();
+                    Db::name('inviter')->where('inviter_id=' . $temp['inviter_parent_id'])->inc('inviter_3_quantity', $inviter_info['inviter_1_quantity'])->update();
                     //父级的父级的父级
-                    $temp=$inviter_model->getInviterInfo(array('m.member_id'=>$temp['inviter_parent_id']),'m.inviter_id as inviter_parent_id');
-                    if($temp['inviter_parent_id']){
-                        Db::name('inviter')->where('inviter_id='.$temp['inviter_parent_id'])->inc('inviter_3_quantity')->update();
+                    $temp = $inviter_model->getInviterInfo(array('m.member_id' => $temp['inviter_parent_id']), 'm.inviter_id as inviter_parent_id');
+                    if ($temp['inviter_parent_id']) {
+                        Db::name('inviter')->where('inviter_id=' . $temp['inviter_parent_id'])->inc('inviter_3_quantity')->update();
                     }
                 }
             }
             $this->log(lang('adjust_superior') .  '[ID:' . $member_id . ']', 1);
             dsLayerOpenSuccess(lang('ds_common_op_succ'));
-        }else{
+        } else {
             return View::fetch();
         }
     }
-    
+
     /**
      * 添加标签
      */
-    public function memberclass_add(){
+    public function memberclass_add()
+    {
         if (request()->isPost()) {
-            $data=array(
-                'inviterclass_name'=>trim(input('post.inviterclass_name')),
-                'inviterclass_amount'=>abs(floatval(input('post.inviterclass_amount'))),
+            $data = array(
+                'inviterclass_name' => trim(input('post.inviterclass_name')),
+                'inviterclass_amount' => abs(floatval(input('post.inviterclass_amount'))),
             );
-            if(!$data['inviterclass_name']){
+            if (!$data['inviterclass_name']) {
                 $this->error(lang('param_error'));
             }
             Db::name('inviterclass')->insert($data);
             dsLayerOpenSuccess(lang('ds_common_op_succ'));
-        }else{
+        } else {
             return View::fetch('memberclass_form');
         }
     }
@@ -282,26 +291,26 @@ public function initialize()
      */
     public function memberclass_edit()
     {
-        $id=intval(input('param.id'));
-        if(!$id){
+        $id = intval(input('param.id'));
+        if (!$id) {
             $this->error(lang('param_error'));
         }
-        $inviterclass_info=Db::name('inviterclass')->where('inviterclass_id',$id)->find();
-        if(!$inviterclass_info){
+        $inviterclass_info = Db::name('inviterclass')->where('inviterclass_id', $id)->find();
+        if (!$inviterclass_info) {
             $this->error(lang('inviterclass_empty'));
         }
         // 实例化模型
         if (request()->isPost()) {
-            $data=array(
-                'inviterclass_name'=>trim(input('post.inviterclass_name')),
-                'inviterclass_amount'=>abs(floatval(input('post.inviterclass_amount'))),
+            $data = array(
+                'inviterclass_name' => trim(input('post.inviterclass_name')),
+                'inviterclass_amount' => abs(floatval(input('post.inviterclass_amount'))),
             );
-            if(!$data['inviterclass_name']){
+            if (!$data['inviterclass_name']) {
                 $this->error(lang('param_error'));
             }
-            Db::name('inviterclass')->where('inviterclass_id',$id)->update($data);
+            Db::name('inviterclass')->where('inviterclass_id', $id)->update($data);
             dsLayerOpenSuccess(lang('ds_common_op_succ'));
-        }  else {
+        } else {
 
             View::assign('inviterclass_info', $inviterclass_info);
             return View::fetch('memberclass_form');
@@ -318,97 +327,100 @@ public function initialize()
         if ($inviterclass_id_array == FALSE) {
             ds_json_encode('10001', lang('param_error'));
         }
- 
-        $result=Db::name('inviterclass')->where(array(array('inviterclass_id','in',$inviterclass_id_array)))->delete();
+
+        $result = Db::name('inviterclass')->where(array(array('inviterclass_id', 'in', $inviterclass_id_array)))->delete();
         if ($result) {
             ds_json_encode('10000', lang('ds_common_del_succ'));
-        }
-        else {
+        } else {
             ds_json_encode('10001', lang('ds_common_del_fail'));
         }
     }
 
-    
-    
-    public function memberstate(){
-        $member_id=input('param.member_id');
+
+
+    public function memberstate()
+    {
+        $member_id = input('param.member_id');
         $member_id_array = ds_delete_param($member_id);
-        $member_state=input('param.member_state');
-        if(!$member_id_array || !in_array($member_state, array(1,2))){
+        $member_state = input('param.member_state');
+        if (!$member_id_array || !in_array($member_state, array(1, 2))) {
             ds_json_encode('10001', lang('param_error'));
         }
-        $inviter_model=model('inviter');
-        $inviter_info=$inviter_model->getInviterInfo(array(array('i.inviter_id','in',$member_id_array)));
-        if(!$inviter_info){
+        $inviter_model = model('inviter');
+        $inviter_info = $inviter_model->getInviterInfo(array(array('i.inviter_id', 'in', $member_id_array)));
+        if (!$inviter_info) {
             ds_json_encode('10001', lang('inviter_member_empty'));
         }
-        $inviter_model->editInviter(array(array('inviter_id','in',$member_id_array)),array('inviter_state'=>$member_state));
-        $this->log(($member_state==1?lang('ds_enable'):lang('ds_disable')) .  '[ID:' . implode(',', $member_id_array) . ']', 1);
-        ds_json_encode('10000', ($member_state==1?lang('ds_enable'):lang('ds_disable')).lang('ds_succ'));
+        $inviter_model->editInviter(array(array('inviter_id', 'in', $member_id_array)), array('inviter_state' => $member_state));
+        $this->log(($member_state == 1 ? lang('ds_enable') : lang('ds_disable')) .  '[ID:' . implode(',', $member_id_array) . ']', 1);
+        ds_json_encode('10000', ($member_state == 1 ? lang('ds_enable') : lang('ds_disable')) . lang('ds_succ'));
     }
 
-    public function memberinfo(){
-        $member_id=input('param.member_id');
-        if(!$member_id){
+    public function memberinfo()
+    {
+        $member_id = input('param.member_id');
+        if (!$member_id) {
             ds_json_encode('10001', lang('param_error'));
         }
-        $inviter_model=model('inviter');
-        $inviter_info=$inviter_model->getInviterInfo(array('i.inviter_id'=>$member_id),'i.*,m.inviter_id as inviter_parent_id,m.member_id,m.member_ww,m.member_qq,m.member_addtime,m.member_name,m.member_avatar,m.member_email,m.member_mobile,m.member_truename');
-        if(!$inviter_info){
+        $inviter_model = model('inviter');
+        $inviter_info = $inviter_model->getInviterInfo(array('i.inviter_id' => $member_id), 'i.*,m.inviter_id as inviter_parent_id,m.member_id,m.member_ww,m.member_qq,m.member_addtime,m.member_name,m.member_avatar,m.member_email,m.member_mobile,m.member_truename');
+        if (!$inviter_info) {
             ds_json_encode('10001', lang('inviter_member_empty'));
         }
-        $inviter_info['inviter_parent_name']='';
-        if($inviter_info['inviter_parent_id']){
-            $inviter_info['inviter_parent_name']= Db::name('member')->where('member_id='.$inviter_info['inviter_parent_id'])->value('member_name');
+        $inviter_info['inviter_parent_name'] = '';
+        if ($inviter_info['inviter_parent_id']) {
+            $inviter_info['inviter_parent_name'] = Db::name('member')->where('member_id=' . $inviter_info['inviter_parent_id'])->value('member_name');
         }
-        $inviterclass_model=model('inviterclass');
-        $inviter_info['inviter_class']=$inviterclass_model->getInviterclass($inviter_info['inviter_total_amount']);
-        View::assign('inviter_info',$inviter_info);
+        $inviterclass_model = model('inviterclass');
+        $inviter_info['inviter_class'] = $inviterclass_model->getInviterclass($inviter_info['inviter_total_amount']);
+        View::assign('inviter_info', $inviter_info);
         $this->setAdminCurItem('member');
         return View::fetch('memberinfo');
     }
-    
-    public function memberlist(){
-        $member_id=intval(input('param.member_id'));
-        $type=input('param.type');
-        if(!$member_id || !in_array($type, array(1,2,3))){
+
+    public function memberlist()
+    {
+        $member_id = intval(input('param.member_id'));
+        $type = input('param.type');
+        if (!$member_id || !in_array($type, array(1, 2, 3))) {
             return;
         }
-        $inviter_model=model('inviter');
-        if($type==1){
-            $res=Db::name('member')->alias('m')->join('inviter i', 'i.inviter_id=m.member_id','LEFT')->field('i.*,m.inviter_id as inviter_parent_id,m.member_id,m.member_ww,m.member_qq,m.member_addtime,m.member_name,m.member_avatar,m.member_email,m.member_mobile,m.member_truename')->where('m.inviter_id='.$member_id)->order('inviter_applytime desc')->paginate(['list_rows'=>10,'query' => request()->param()],false);
-            $page_info=$res;
-            $member_list=$res->items();
-        }elseif($type==2){
-    
-            $subQuery=Db::name('member')->alias('m')->join('inviter i', 'i.inviter_id=m.member_id','LEFT')->field('m.member_id')->where('m.inviter_id='.$member_id)->order('inviter_applytime desc')->buildSql();
-            $res=Db::name('member')->alias('m')->join('inviter i', 'i.inviter_id=m.member_id','LEFT')->field('i.*,m.inviter_id as inviter_parent_id,m.member_id,m.member_ww,m.member_qq,m.member_addtime,m.member_name,m.member_avatar,m.member_email,m.member_mobile,m.member_truename')->where('m.inviter_id IN'.$subQuery)->order('inviter_applytime desc')->paginate(['list_rows'=>10,'query' => request()->param()],false);
-            $page_info=$res;
-            $member_list=$res->items();
-        }elseif($type==3){
-            $subQuery=Db::name('member')->alias('m')->join('inviter i', 'i.inviter_id=m.member_id','LEFT')->field('m.member_id')->where('m.inviter_id='.$member_id)->order('inviter_applytime desc')->buildSql();
-            $subQuery=Db::name('member')->alias('m')->join('inviter i', 'i.inviter_id=m.member_id','LEFT')->field('m.member_id')->where('m.inviter_id IN'.$subQuery)->order('inviter_applytime desc')->buildSql();
-            $res=Db::name('member')->alias('m')->join('inviter i', 'i.inviter_id=m.member_id','LEFT')->field('i.*,m.inviter_id as inviter_parent_id,m.member_id,m.member_ww,m.member_qq,m.member_addtime,m.member_name,m.member_avatar,m.member_email,m.member_mobile,m.member_truename')->where('m.inviter_id IN'.$subQuery)->order('inviter_applytime desc')->paginate(['list_rows'=>10,'query' => request()->param()],false);
-            $page_info=$res;
-            $member_list=$res->items();
+        $inviter_model = model('inviter');
+        if ($type == 1) {
+            $res = Db::name('member')->alias('m')->join('inviter i', 'i.inviter_id=m.member_id', 'LEFT')->field('i.*,m.inviter_id as inviter_parent_id,m.member_id,m.member_ww,m.member_qq,m.member_addtime,m.member_name,m.member_avatar,m.member_email,m.member_mobile,m.member_truename')->where('m.inviter_id=' . $member_id)->order('inviter_applytime desc')->paginate(['list_rows' => 10, 'query' => request()->param()], false);
+            $page_info = $res;
+            $member_list = $res->items();
+        } elseif ($type == 2) {
+
+            $subQuery = Db::name('member')->alias('m')->join('inviter i', 'i.inviter_id=m.member_id', 'LEFT')->field('m.member_id')->where('m.inviter_id=' . $member_id)->order('inviter_applytime desc')->buildSql();
+            $res = Db::name('member')->alias('m')->join('inviter i', 'i.inviter_id=m.member_id', 'LEFT')->field('i.*,m.inviter_id as inviter_parent_id,m.member_id,m.member_ww,m.member_qq,m.member_addtime,m.member_name,m.member_avatar,m.member_email,m.member_mobile,m.member_truename')->where('m.inviter_id IN' . $subQuery)->order('inviter_applytime desc')->paginate(['list_rows' => 10, 'query' => request()->param()], false);
+            $page_info = $res;
+            $member_list = $res->items();
+        } elseif ($type == 3) {
+            $subQuery = Db::name('member')->alias('m')->join('inviter i', 'i.inviter_id=m.member_id', 'LEFT')->field('m.member_id')->where('m.inviter_id=' . $member_id)->order('inviter_applytime desc')->buildSql();
+            $subQuery = Db::name('member')->alias('m')->join('inviter i', 'i.inviter_id=m.member_id', 'LEFT')->field('m.member_id')->where('m.inviter_id IN' . $subQuery)->order('inviter_applytime desc')->buildSql();
+            $res = Db::name('member')->alias('m')->join('inviter i', 'i.inviter_id=m.member_id', 'LEFT')->field('i.*,m.inviter_id as inviter_parent_id,m.member_id,m.member_ww,m.member_qq,m.member_addtime,m.member_name,m.member_avatar,m.member_email,m.member_mobile,m.member_truename')->where('m.inviter_id IN' . $subQuery)->order('inviter_applytime desc')->paginate(['list_rows' => 10, 'query' => request()->param()], false);
+            $page_info = $res;
+            $member_list = $res->items();
         }
-        $inviterclass_model=model('inviterclass');
-        foreach($member_list as $key => $item){
-            $member_list[$key]['inviter_parent_name']='';
-            $member_list[$key]['inviter_class']='';
-            $member_list[$key]['inviter_class']=$inviterclass_model->getInviterclass(floatval($item['inviter_total_amount']));
-            if($item['inviter_parent_id']){
-                $member_list[$key]['inviter_parent_name'] = Db::name('member')->where('member_id='.$item['inviter_parent_id'])->value('member_name');
+        $inviterclass_model = model('inviterclass');
+        foreach ($member_list as $key => $item) {
+            $member_list[$key]['inviter_parent_name'] = '';
+            $member_list[$key]['inviter_class'] = '';
+            $member_list[$key]['inviter_class'] = $inviterclass_model->getInviterclass(floatval($item['inviter_total_amount']));
+            if ($item['inviter_parent_id']) {
+                $member_list[$key]['inviter_parent_name'] = Db::name('member')->where('member_id=' . $item['inviter_parent_id'])->value('member_name');
             }
         }
-        View::assign('member_list',$member_list);
+        View::assign('member_list', $member_list);
         View::assign('show_page', $page_info->render());
         echo View::fetch('memberlist');
     }
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -438,4 +450,4 @@ public function initialize()
         );
         return $menu_array;
     }
-}
+}

+ 30 - 24
app/admin/controller/Link.php

@@ -6,24 +6,26 @@ use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Link extends AdminControl {
+class Link extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/link.lang.php');
     }
 
-    public function index() {
+    public function index()
+    {
         $condition = array();
         $link_title = input('get.link_title');
         if ($link_title) {
@@ -43,7 +45,8 @@ class Link extends AdminControl {
     /**
      * 新增友情链接
      * */
-    public function add() {
+    public function add()
+    {
         if (!(request()->isPost())) {
             $link = [
                 'link_id' => '',
@@ -58,11 +61,11 @@ class Link extends AdminControl {
             //上传图片
             $link_pic = '';
             if ($_FILES['link_pic']['name'] != '') {
-                $file_name = date('YmdHis') . rand(10000, 99999).'.png';
-                $res=ds_upload_pic(DIR_ADMIN . DIRECTORY_SEPARATOR . 'link','link_pic',$file_name);
-                if($res['code']){
-                    $link_pic=$res['data']['file_name'];
-                }else{
+                $file_name = date('YmdHis') . rand(10000, 99999) . '.png';
+                $res = ds_upload_pic(DIR_ADMIN . DIRECTORY_SEPARATOR . 'link', 'link_pic', $file_name);
+                if ($res['code']) {
+                    $link_pic = $res['data']['file_name'];
+                } else {
                     $this->error($res['msg']);
                 }
             }
@@ -90,7 +93,8 @@ class Link extends AdminControl {
     /**
      * 编辑友情链接
      * */
-    public function edit() {
+    public function edit()
+    {
         $link_id = input('param.link_id');
         if (empty($link_id)) {
             $this->error(lang('param_error'));
@@ -108,14 +112,14 @@ class Link extends AdminControl {
             //上传图片
             if ($_FILES['link_pic']['name'] != '') {
                 $upload_file = BASE_UPLOAD_PATH . DIRECTORY_SEPARATOR . DIR_ADMIN . DIRECTORY_SEPARATOR . 'link';
-                $file_name = date('YmdHis') . rand(10000, 99999).'.png';
-                $res=ds_upload_pic(DIR_ADMIN . DIRECTORY_SEPARATOR . 'link','link_pic',$file_name);
-                if($res['code']){
-                    $file_name=$res['data']['file_name'];
+                $file_name = date('YmdHis') . rand(10000, 99999) . '.png';
+                $res = ds_upload_pic(DIR_ADMIN . DIRECTORY_SEPARATOR . 'link', 'link_pic', $file_name);
+                if ($res['code']) {
+                    $file_name = $res['data']['file_name'];
                     $data['link_pic'] = $file_name;
                     //删除原有友情链接图片
                     @unlink($upload_file . DIRECTORY_SEPARATOR . $link['link_pic']);
-                }else{
+                } else {
                     $this->error($res['msg']);
                 }
             }
@@ -134,7 +138,8 @@ class Link extends AdminControl {
         }
     }
 
-    public function drop() {
+    public function drop()
+    {
         $link_id = intval(input('param.link_id'));
         if (empty($link_id)) {
             $this->error(lang('param_error'));
@@ -150,7 +155,8 @@ class Link extends AdminControl {
     /**
      * ajax操作
      */
-    public function ajax() {
+    public function ajax()
+    {
         $result = -1;
         switch (input('get.branch')) {
             case 'link':
@@ -169,7 +175,8 @@ class Link extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -184,5 +191,4 @@ class Link extends AdminControl {
         );
         return $menu_array;
     }
-
 }

+ 65 - 63
app/admin/controller/LiveApply.php

@@ -19,19 +19,20 @@ use TencentCloud\Live\V20180801\Models\DescribeLiveStreamStateRequest;
 use AlibabaCloud\Client\AlibabaCloud;
 
 /**
- * ============================================================================
+ 
  * DSKMS多用户商城
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
+ 
+ * 
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class LiveApply extends AdminControl {
+class LiveApply extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/live_apply.lang.php');
     }
@@ -39,7 +40,8 @@ class LiveApply extends AdminControl {
     /**
      * 商品管理
      */
-    public function index() {
+    public function index()
+    {
         /**
          * 查询条件
          */
@@ -50,7 +52,7 @@ class LiveApply extends AdminControl {
             $minipro_live_list = $minipro_live_model->getMiniproLiveList($condition);
             $store_list = array();
             foreach ($minipro_live_list as $key => $val) {
-                $minipro_live_list[$key]['minipro_live_image_url'] = ds_get_pic( ATTACH_MINIPRO_LIVE , $val['minipro_live_image']);
+                $minipro_live_list[$key]['minipro_live_image_url'] = ds_get_pic(ATTACH_MINIPRO_LIVE, $val['minipro_live_image']);
                 if (!isset($store_list[$val['store_id']])) {
                     $store_list[$val['store_id']] = $store_model->getStoreInfo(array('store_id' => $val['store_id']));
                 }
@@ -70,11 +72,11 @@ class LiveApply extends AdminControl {
             $store_list = array();
             foreach ($live_apply_list as $key => $val) {
                 if ($val['live_apply_cover_video']) {
-                    $live_apply_list[$key]['live_apply_cover_video_url'] = ds_get_pic( ATTACH_LIVE_APPLY . '/' . $val['live_apply_user_id'] , $val['live_apply_cover_video']);
+                    $live_apply_list[$key]['live_apply_cover_video_url'] = ds_get_pic(ATTACH_LIVE_APPLY . '/' . $val['live_apply_user_id'], $val['live_apply_cover_video']);
                 } elseif ($val['live_apply_cover_image']) {
-                    $live_apply_list[$key]['live_apply_cover_image_url'] = ds_get_pic( ATTACH_LIVE_APPLY . '/' . $val['live_apply_user_id'] , $val['live_apply_cover_image']);
+                    $live_apply_list[$key]['live_apply_cover_image_url'] = ds_get_pic(ATTACH_LIVE_APPLY . '/' . $val['live_apply_user_id'], $val['live_apply_cover_image']);
                 } else {
-                    $live_apply_list[$key]['live_apply_cover_image_url'] = ds_get_pic(ATTACH_COMMON,config('ds_config.default_goods_image'));
+                    $live_apply_list[$key]['live_apply_cover_image_url'] = ds_get_pic(ATTACH_COMMON, config('ds_config.default_goods_image'));
                 }
                 $live_apply_list[$key]['live_apply_user_name'] = '';
                 switch ($val['live_apply_user_type']) {
@@ -100,7 +102,8 @@ class LiveApply extends AdminControl {
     /**
      * 删除商品
      */
-    public function del() {
+    public function del()
+    {
         $live_apply_id = input('param.live_apply_id');
         $live_apply_id_array = ds_delete_param($live_apply_id);
         if ($live_apply_id_array == FALSE) {
@@ -116,7 +119,8 @@ class LiveApply extends AdminControl {
     /**
      * 审核商品
      */
-    public function view() {
+    public function view()
+    {
         if (config('ds_config.live_type') == 1) {
             $minipro_live_id = input('param.minipro_live_id');
             $minipro_live_model = model('minipro_live');
@@ -124,7 +128,7 @@ class LiveApply extends AdminControl {
             if (!$minipro_live_info) {
                 $this->error(lang('live_not_exist'));
             }
-            $minipro_live_info['minipro_live_image_url'] = ds_get_pic( ATTACH_MINIPRO_LIVE , $minipro_live_info['minipro_live_image']);
+            $minipro_live_info['minipro_live_image_url'] = ds_get_pic(ATTACH_MINIPRO_LIVE, $minipro_live_info['minipro_live_image']);
             $minipro_live_room_goods_model = model('minipro_live_room_goods');
             $goods_list = $minipro_live_room_goods_model->getMiniproLiveRoomGoodsList(array(array('minipro_live_id', '=', $minipro_live_id)));
             foreach ($goods_list as $k => $v) {
@@ -187,7 +191,7 @@ class LiveApply extends AdminControl {
                                                 )
                                             ),
                                         );
-                                        model('cron')->addCron(array('cron_exetime'=>TIMESTAMP,'cron_type'=>'sendStoremsg','cron_value'=>serialize($param)));
+                                        model('cron')->addCron(array('cron_exetime' => TIMESTAMP, 'cron_type' => 'sendStoremsg', 'cron_value' => serialize($param)));
                                     }
                                 }
                             }
@@ -233,36 +237,35 @@ class LiveApply extends AdminControl {
                         }
                         $regionId = 'cn-shanghai';
                         AlibabaCloud::accessKeyClient(config('ds_config.aliyun_access_key_id'), config('ds_config.aliyun_access_key_secret'))
-                                ->regionId($regionId)
-                                ->asDefaultClient();
+                            ->regionId($regionId)
+                            ->asDefaultClient();
 
                         try {
                             $result = AlibabaCloud::rpc()
-                                    ->product('live')
-                                    // ->scheme('https') // https | http
-                                    ->version('2016-11-01')
-                                    ->action('DescribeLiveStreamsOnlineList')
-                                    ->method('POST')
-                                    ->host('live.aliyuncs.com')
-                                    ->options([
-                                        'query' => [
-                                            'RegionId' => $regionId,
-                                            'DomainName' => config('ds_config.aliyun_live_push_domain'),
-                                            'AppName' => "live",
-                                            'StreamName' => 'live_apply_' . $live_apply_info['live_apply_id'],
-                                            'PageSize' => "1",
-                                            'PageNum' => "1",
-                                            'QueryType' => "strict",
-                                        ],
-                                    ])
-                                    ->request();
+                                ->product('live')
+                                // ->scheme('https') // https | http
+                                ->version('2016-11-01')
+                                ->action('DescribeLiveStreamsOnlineList')
+                                ->method('POST')
+                                ->host('live.aliyuncs.com')
+                                ->options([
+                                    'query' => [
+                                        'RegionId' => $regionId,
+                                        'DomainName' => config('ds_config.aliyun_live_push_domain'),
+                                        'AppName' => "live",
+                                        'StreamName' => 'live_apply_' . $live_apply_info['live_apply_id'],
+                                        'PageSize' => "1",
+                                        'PageNum' => "1",
+                                        'QueryType' => "strict",
+                                    ],
+                                ])
+                                ->request();
                             if ($result->TotalNum) {
                                 $live_apply_info['active'] = true;
                                 //生成播放地址
                                 $live_apply_info['live_apply_play_url'] = model('live_apply')->getPlayUrl('live_apply_' . $live_apply_info['live_apply_id'], $live_apply_info['live_apply_end_time']);
                             }
                         } catch (\Exception $e) {
-                            
                         }
                     } else {
                         if (!config('ds_config.live_push_domain')) {
@@ -303,11 +306,11 @@ class LiveApply extends AdminControl {
                     }
                 }
                 if ($live_apply_info['live_apply_cover_video']) {
-                    $live_apply_info['live_apply_cover_video_url'] = ds_get_pic( ATTACH_LIVE_APPLY . '/' . $live_apply_info['live_apply_user_id'] , $live_apply_info['live_apply_cover_video']);
+                    $live_apply_info['live_apply_cover_video_url'] = ds_get_pic(ATTACH_LIVE_APPLY . '/' . $live_apply_info['live_apply_user_id'], $live_apply_info['live_apply_cover_video']);
                 } elseif ($live_apply_info['live_apply_cover_image']) {
-                    $live_apply_info['live_apply_cover_image_url'] = ds_get_pic( ATTACH_LIVE_APPLY . '/' . $live_apply_info['live_apply_user_id'] , $live_apply_info['live_apply_cover_image']);
+                    $live_apply_info['live_apply_cover_image_url'] = ds_get_pic(ATTACH_LIVE_APPLY . '/' . $live_apply_info['live_apply_user_id'], $live_apply_info['live_apply_cover_image']);
                 } else {
-                    $live_apply_info['live_apply_cover_image_url'] = ds_get_pic(ATTACH_COMMON,config('ds_config.default_goods_image'));
+                    $live_apply_info['live_apply_cover_image_url'] = ds_get_pic(ATTACH_COMMON, config('ds_config.default_goods_image'));
                 }
                 $goods_commonid = Db::name('live_apply_goods')->where('live_apply_id', $live_apply_info['live_apply_id'])->column('goods_commonid');
                 $goods_model = model('goods');
@@ -326,7 +329,8 @@ class LiveApply extends AdminControl {
         }
     }
 
-    public function close() {
+    public function close()
+    {
         $live_apply_id = input('param.live_apply_id');
         $live_apply_model = model('live_apply');
         $live_apply = $live_apply_model->getLiveApplyInfo(array('live_apply_id' => $live_apply_id));
@@ -336,27 +340,27 @@ class LiveApply extends AdminControl {
         if (config('ds_config.video_type') == 'aliyun') {
             $regionId = 'cn-shanghai';
             AlibabaCloud::accessKeyClient(config('ds_config.aliyun_access_key_id'), config('ds_config.aliyun_access_key_secret'))
-                    ->regionId($regionId)
-                    ->asDefaultClient();
+                ->regionId($regionId)
+                ->asDefaultClient();
 
             try {
                 $result = AlibabaCloud::rpc()
-                        ->product('live')
-                        // ->scheme('https') // https | http
-                        ->version('2016-11-01')
-                        ->action('ForbidLiveStream')
-                        ->method('POST')
-                        ->host('live.aliyuncs.com')
-                        ->options([
-                            'query' => [
-                                'RegionId' => $regionId,
-                                'AppName' => "live",
-                                'StreamName' => 'live_apply_' . $live_apply['live_apply_id'],
-                                'LiveStreamType' => "publisher",
-                                'DomainName' => config('ds_config.aliyun_live_push_domain'),
-                            ],
-                        ])
-                        ->request();
+                    ->product('live')
+                    // ->scheme('https') // https | http
+                    ->version('2016-11-01')
+                    ->action('ForbidLiveStream')
+                    ->method('POST')
+                    ->host('live.aliyuncs.com')
+                    ->options([
+                        'query' => [
+                            'RegionId' => $regionId,
+                            'AppName' => "live",
+                            'StreamName' => 'live_apply_' . $live_apply['live_apply_id'],
+                            'LiveStreamType' => "publisher",
+                            'DomainName' => config('ds_config.aliyun_live_push_domain'),
+                        ],
+                    ])
+                    ->request();
             } catch (\Exception $e) {
                 ds_json_encode(10001, $e->getMessage());
             }
@@ -389,7 +393,8 @@ class LiveApply extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -399,7 +404,4 @@ class LiveApply extends AdminControl {
         );
         return $menu_array;
     }
-
 }
-
-?>

+ 16 - 12
app/admin/controller/LiveGoods.php

@@ -11,24 +11,26 @@ use think\facade\Db;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class LiveGoods extends AdminControl {
+class LiveGoods extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize(); // TODO: Change the autogenerated stub
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/live_goods.lang.php');
     }
 
-    public function index() {
+    public function index()
+    {
         $condition = array();
         if ((input('param.goods_name'))) {
             $condition[] = array('goodscommon.goods_name', 'like', '%' . input('param.goods_name') . '%');
@@ -52,7 +54,8 @@ class LiveGoods extends AdminControl {
         return View::fetch();
     }
 
-    public function open() {
+    public function open()
+    {
         $goods_commonid = input('param.goods_commonid');
         $minipro_live_goods_model = model('minipro_live_goods');
         //删掉后会在定时任务中重新申请
@@ -60,7 +63,8 @@ class LiveGoods extends AdminControl {
         ds_json_encode('10000', lang('ds_common_op_succ'));
     }
 
-    public function close() {
+    public function close()
+    {
         $goods_commonid = input('param.goods_commonid');
         $minipro_live_goods_model = model('minipro_live_goods');
         $minipro_live_goods_info = $minipro_live_goods_model->getMiniproLiveGoodsInfo(array(array('goods_commonid', '=', $goods_commonid)));
@@ -110,7 +114,8 @@ class LiveGoods extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -120,5 +125,4 @@ class LiveGoods extends AdminControl {
         );
         return $menu_array;
     }
-
 }

+ 14 - 13
app/admin/controller/LiveSetting.php

@@ -5,28 +5,31 @@
  */
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
  * DSKMS多用户商城
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
+ 
+ * 
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class LiveSetting extends AdminControl {
+class LiveSetting extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/live_setting.lang.php');
     }
 
-    public function index() {
+    public function index()
+    {
         $config_model = model('config');
         if (!request()->isPost()) {
             $list_config = rkcache('config', true);
@@ -34,7 +37,7 @@ class LiveSetting extends AdminControl {
             $this->setAdminCurItem('index');
             return View::fetch();
         } else {
-            $update_array=array();
+            $update_array = array();
             $update_array['live_type'] = input('post.live_type');
             $update_array['vod_tencent_play_key'] = input('post.vod_tencent_play_key');
             $update_array['vod_tencent_appid'] = input('post.vod_tencent_appid');
@@ -65,7 +68,8 @@ class LiveSetting extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -75,7 +79,4 @@ class LiveSetting extends AdminControl {
         );
         return $menu_array;
     }
-
 }
-
-?>

+ 1 - 8
app/admin/controller/Login.php

@@ -7,14 +7,7 @@ use think\facade\Lang;
 use think\captcha\facade\Captcha;
 
 /**
- * ============================================================================
- * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
- * ----------------------------------------------------------------------------
- * 
- * ============================================================================
+ 
  * 控制器
  */
 class Login extends AdminControl

+ 38 - 29
app/admin/controller/Mallconsult.php

@@ -1,40 +1,43 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Mallconsult extends AdminControl {
+class Mallconsult extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/mallconsult.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/mallconsult.lang.php');
     }
 
     /**
      * 咨询管理
      */
-    public function index() {
+    public function index()
+    {
         $condition = array();
         $member_name = trim(input('param.member_name'));
         if ($member_name != '') {
-            $condition[]=array('member_name','like', '%' . $member_name . '%');
+            $condition[] = array('member_name', 'like', '%' . $member_name . '%');
             View::assign('member_name', $member_name);
         }
         $mallconsulttype_id = intval(input('param.mctid'));
         if ($mallconsulttype_id > 0) {
-            $condition[]=array('mallconsulttype_id','=',$mallconsulttype_id);
+            $condition[] = array('mallconsulttype_id', '=', $mallconsulttype_id);
             View::assign('mctid', $mallconsulttype_id);
         }
         $mallconsult_model = model('mallconsult');
@@ -57,7 +60,8 @@ class Mallconsult extends AdminControl {
     /**
      * 回复咨询
      */
-    public function consult_reply() {
+    public function consult_reply()
+    {
         $mallconsult_model = model('mallconsult');
         if (request()->isPost()) {
             $mallconsult_id = intval(input('post.mallconsult_id'));
@@ -81,11 +85,11 @@ class Mallconsult extends AdminControl {
                 $param['ali_param'] = array();
                 $param['ten_param'] = array();
                 $param['param'] = array(
-                    'consult_url' => HOME_SITE_URL .'/Membermallconsult/mallconsult_info?id='.$mallconsult_id
+                    'consult_url' => HOME_SITE_URL . '/Membermallconsult/mallconsult_info?id=' . $mallconsult_id
                 );
                 //微信模板消息
                 $param['weixin_param'] = array(
-                    'data'=>array(
+                    'data' => array(
                         "keyword1" => array(
                             "value" => date('Y-m-d', $consult_info['mallconsult_addtime']),
                             "color" => "#333"
@@ -100,7 +104,7 @@ class Mallconsult extends AdminControl {
                         )
                     ),
                 );
-                model('cron')->addCron(array('cron_exetime'=>TIMESTAMP,'cron_type'=>'sendMemberMsg','cron_value'=>serialize($param)));
+                model('cron')->addCron(array('cron_exetime' => TIMESTAMP, 'cron_type' => 'sendMemberMsg', 'cron_value' => serialize($param)));
 
                 dsLayerOpenSuccess(lang('ds_common_op_succ'));
             } else {
@@ -121,15 +125,16 @@ class Mallconsult extends AdminControl {
     /**
      * 删除平台客服咨询
      */
-    public function del_consult() {
+    public function del_consult()
+    {
         $mallconsult_id = input('param.mallconsult_id');
         $mallconsult_id_array = ds_delete_param($mallconsult_id);
         if ($mallconsult_id_array == FALSE) {
             ds_json_encode('10001', lang('param_error'));
         }
         $condition = array();
-        $condition[]=array('mallconsult_id','in',$mallconsult_id_array);
-        
+        $condition[] = array('mallconsult_id', 'in', $mallconsult_id_array);
+
         $result = model('mallconsult')->delMallconsult($condition);
         if ($result) {
             $this->log('删除平台客服咨询' . '[ID:' . $mallconsult_id . ']');
@@ -143,7 +148,8 @@ class Mallconsult extends AdminControl {
     /**
      * 咨询类型列表
      */
-    public function type_list() {
+    public function type_list()
+    {
         $mallconsulttype_model = model('mallconsulttype');
         $type_list = $mallconsulttype_model->getMallconsulttypeList(array(), 'mallconsulttype_id,mallconsulttype_name,mallconsulttype_sort');
         View::assign('type_list', $type_list);
@@ -154,7 +160,8 @@ class Mallconsult extends AdminControl {
     /**
      * 新增咨询类型
      */
-    public function type_add() {
+    public function type_add()
+    {
         if (request()->isPost()) {
             // 验证
             $data = [
@@ -185,7 +192,8 @@ class Mallconsult extends AdminControl {
     /**
      * 编辑咨询类型
      */
-    public function type_edit() {
+    public function type_edit()
+    {
         $mallconsulttype_id = intval(input('param.mallconsulttype_id'));
         if ($mallconsulttype_id <= 0) {
             $this->error(lang('param_error'));
@@ -202,13 +210,13 @@ class Mallconsult extends AdminControl {
                 $this->error(lang('ds_common_op_fail') . $mallconsult_validate->getError());
             }
             $condition = array();
-            $condition[] = array('mallconsulttype_id','=',$mallconsulttype_id);
+            $condition[] = array('mallconsulttype_id', '=', $mallconsulttype_id);
             $update = array();
             $update['mallconsulttype_name'] = trim(input('post.mallconsulttype_name'));
             $update['mallconsulttype_introduce'] = input('post.mallconsulttype_introduce');
             $update['mallconsulttype_sort'] = intval(input('post.mallconsulttype_sort'));
             $result = $mallconsulttype_model->editMallconsulttype($condition, $update);
-            if ($result>=0) {
+            if ($result >= 0) {
                 $this->log('编辑平台客服咨询类型 ID:' . $mallconsulttype_id, 1);
                 dsLayerOpenSuccess(lang('ds_common_op_succ'));
             } else {
@@ -225,14 +233,15 @@ class Mallconsult extends AdminControl {
     /**
      * 删除咨询类型
      */
-    public function type_del() {
+    public function type_del()
+    {
         $mallconsulttype_id = input('param.mallconsulttype_id');
         $mallconsulttype_id_array = ds_delete_param($mallconsulttype_id);
         if ($mallconsulttype_id_array == FALSE) {
             ds_json_encode('10001', lang('param_error'));
         }
         $condition = array();
-        $condition[]=array('mallconsulttype_id','in',$mallconsulttype_id_array);
+        $condition[] = array('mallconsulttype_id', 'in', $mallconsulttype_id_array);
         $result = model('mallconsulttype')->delMallconsulttype($condition);
         if ($result) {
             $this->log('删除平台客服咨询类型 ID:' . $mallconsulttype_id, 1);
@@ -243,14 +252,15 @@ class Mallconsult extends AdminControl {
         }
     }
 
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index', 'text' => lang('mallconsult_index'), 'url' => (string)url('Mallconsult/index')
             ), array(
                 'name' => 'type_list', 'text' => lang('mallconsult_type_list'), 'url' => (string)url('Mallconsult/type_list')
             ), array(
-                'name' => 'type_add', 'text' => lang('mallconsult_type_add'), 'url' =>"javascript:dsLayerOpen('".(string)url('Mallconsult/type_add')."','".lang('mallconsult_type_add')."')"
+                'name' => 'type_add', 'text' => lang('mallconsult_type_add'), 'url' => "javascript:dsLayerOpen('" . (string)url('Mallconsult/type_add') . "','" . lang('mallconsult_type_add') . "')"
             ),
         );
         if (request()->action() == 'type_edit')
@@ -259,5 +269,4 @@ class Mallconsult extends AdminControl {
             );
         return $menu_array;
     }
-
-}
+}

+ 69 - 63
app/admin/controller/Mallvouchertemplate.php

@@ -1,28 +1,30 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Mallvouchertemplate extends AdminControl {
+class Mallvouchertemplate extends AdminControl
+{
 
     private $quotastate_arr;
     private $templatestate_arr;
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/mallvouchertemplate.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/mallvouchertemplate.lang.php');
         if (config('ds_config.voucher_allow') != 1 || config('ds_config.points_isuse') != 1) {
             $this->error(lang('admin_voucher_unavailable'), 'operation/setting');
         }
@@ -31,40 +33,42 @@ class Mallvouchertemplate extends AdminControl {
      * 代金券面额列表
      */
 
-    public function mallvouchertemplatelist() {
+    public function mallvouchertemplatelist()
+    {
         //获得代金券金额列表
         $mallvouchertemplate_model = model('mallvouchertemplate');
         $condition = array();
-        $mallvouchertemplate_list = $mallvouchertemplate_model->getMallvouchertemplateList($condition,10);
+        $mallvouchertemplate_list = $mallvouchertemplate_model->getMallvouchertemplateList($condition, 10);
         View::assign('mallvouchertemplate_list', $mallvouchertemplate_list);
         View::assign('show_page', $mallvouchertemplate_model->page_info->render());
         $this->setAdminCurItem('mallvouchertemplatelist');
         return View::fetch();
     }
-    
+
 
     /*
      * 添加代金券页面
      */
 
-    public function mallvouchertemplateadd() {
+    public function mallvouchertemplateadd()
+    {
         if (request()->isPost()) {
             $mallvouchertemplate_model = model('mallvouchertemplate');
             $goodsclass_model = model('goodsclass');
-            
+
             //获取代金券所属分类ID集
             $gc_id = intval(input('post.mallvouchertemplate_gcid'));
-            if($gc_id == 0){
+            if ($gc_id == 0) {
                 $this->error(lang('admin_mallvouchertemplate_gc_error'));
             }
-            
+
             $gc_ids = ',';
             $goodsclasslist = $goodsclass_model->getChildClass($gc_id);
-            foreach($goodsclasslist as $key => $val){
-               $gc_ids .= $val['gc_id'].',';
-            } 
-            
-            
+            foreach ($goodsclasslist as $key => $val) {
+                $gc_ids .= $val['gc_id'] . ',';
+            }
+
+
             $limit = intval(input('post.mallvouchertemplate_limit')) > 0 ? intval(input('post.mallvouchertemplate_limit')) : 0;
             $price = intval(input('post.mallvouchertemplate_price')) > 0 ? intval(input('post.mallvouchertemplate_price')) : 0;
 
@@ -84,22 +88,21 @@ class Mallvouchertemplate extends AdminControl {
             if ($price >= $limit) {
                 $this->error(lang('admin_mallvouchertemplate_limit_error'));
             }
-                $rs = $mallvouchertemplate_model->addmallvouchertemplate($data);
-                if ($rs) {
-                    $this->log(lang('ds_add') . lang('admin_mallvouchertemplate_add') . '[' . $data['mallvouchertemplate_title'] . ']');
-                    $this->success(lang('ds_common_save_succ'), (string) url('mallvouchertemplate/mallvouchertemplatelist'));
-                } else {
-                    $this->error(lang('ds_common_save_fail'), 'mallvouchertemplate/mallvouchertemplatelist');
-                }
+            $rs = $mallvouchertemplate_model->addmallvouchertemplate($data);
+            if ($rs) {
+                $this->log(lang('ds_add') . lang('admin_mallvouchertemplate_add') . '[' . $data['mallvouchertemplate_title'] . ']');
+                $this->success(lang('ds_common_save_succ'), (string) url('mallvouchertemplate/mallvouchertemplatelist'));
+            } else {
+                $this->error(lang('ds_common_save_fail'), 'mallvouchertemplate/mallvouchertemplatelist');
             }
-         else {
+        } else {
             $mallvouchertemplate_info = array(
                 'mallvouchertemplate_startdate' => TIMESTAMP,
-                'mallvouchertemplate_enddate' => TIMESTAMP+3600*24*7,
+                'mallvouchertemplate_enddate' => TIMESTAMP + 3600 * 24 * 7,
                 'mallvouchertemplate_gcid' => '',
                 'mallvouchertemplate_quantity' => '',
-                'mallvouchertemplate_eachlimit'=>''
-            ); 
+                'mallvouchertemplate_eachlimit' => ''
+            );
             $gc_list = model('goodsclass')->getGoodsclassListByParentId(0);
             View::assign('gc_list', $gc_list);
             View::assign('info', $mallvouchertemplate_info);
@@ -108,40 +111,41 @@ class Mallvouchertemplate extends AdminControl {
             return View::fetch();
         }
     }
-    
+
     /*
      * 添加代金券页面
      */
-    
-    public function mallvouchertemplateedit() {
+
+    public function mallvouchertemplateedit()
+    {
         $id = intval(input('param.mallvouchertemplate_id'));
         if ($id <= 0) {
             $this->error(lang('param_error'), 'Mallvouchertemplate/mallvouchertemplatelist');
         }
-        
+
         if (request()->isPost()) {
             $mallvouchertemplate_model = model('mallvouchertemplate');
             $goodsclass_model = model('goodsclass');
-            
+
             //获取代金券所属分类ID集
             $gc_id = intval(input('post.mallvouchertemplate_gcid'));
-            if($gc_id == 0){
+            if ($gc_id == 0) {
                 $this->error(lang('admin_mallvouchertemplate_gc_error'));
             }
-            
-            
+
+
             $gc_ids = ',';
-            
-            if($gc_id > 0){
-               $goodsclasslist = $goodsclass_model->getChildClass($gc_id);
-               foreach($goodsclasslist as $key => $val){
-                   $gc_ids .= $val['gc_id'].',';
-               } 
+
+            if ($gc_id > 0) {
+                $goodsclasslist = $goodsclass_model->getChildClass($gc_id);
+                foreach ($goodsclasslist as $key => $val) {
+                    $gc_ids .= $val['gc_id'] . ',';
+                }
             }
-            
+
             $limit = intval(input('post.mallvouchertemplate_limit')) > 0 ? intval(input('post.mallvouchertemplate_limit')) : 0;
             $price = intval(input('post.mallvouchertemplate_price')) > 0 ? intval(input('post.mallvouchertemplate_price')) : 0;
-    
+
             $updata = [
                 'mallvouchertemplate_price' => $price,
                 'mallvouchertemplate_title' => input('post.mallvouchertemplate_title'),
@@ -158,25 +162,25 @@ class Mallvouchertemplate extends AdminControl {
             if ($price >= $limit) {
                 $this->error(lang('admin_mallvouchertemplate_limit_error'));
             }
-            
+
             $condition   = array();
-            $condition[] = array('mallvouchertemplate_id','=',$id);
-            $rs = $mallvouchertemplate_model->editMallvouchertemplate($condition,$updata);
-            
+            $condition[] = array('mallvouchertemplate_id', '=', $id);
+            $rs = $mallvouchertemplate_model->editMallvouchertemplate($condition, $updata);
+
             if ($rs) {
                 $this->log(lang('ds_edit') . lang('admin_mallvouchertemplate_edit') . '[' . $updata['mallvouchertemplate_title'] . ']');
                 $this->success(lang('ds_common_save_succ'), (string) url('mallvouchertemplate/mallvouchertemplatelist'));
             } else {
                 $this->error(lang('ds_common_save_fail'), 'mallvouchertemplate/mallvouchertemplatelist');
             }
-        }else {
-             
+        } else {
+
             $mallvouchertemplate_model = model('mallvouchertemplate');
             $mallvouchertemplate_info = $mallvouchertemplate_model->getOneMallvouchertemplate(array('mallvouchertemplate_id' => $id));
             if (empty($mallvouchertemplate_info)) {
                 $this->error(lang('param_error'), 'Mallvouchertemplate/mallvouchertemplatelist');
             }
-            
+
             $gc_list = model('goodsclass')->getGoodsclassListByParentId(0);
             View::assign('gc_list', $gc_list);
             View::assign('info', $mallvouchertemplate_info);
@@ -185,13 +189,14 @@ class Mallvouchertemplate extends AdminControl {
             return View::fetch();
         }
     }
-    
+
 
     /*
      * 查看代金券面额
      */
 
-    public function mallvouchertemplateview() {
+    public function mallvouchertemplateview()
+    {
         $id = intval(input('param.mallvouchertemplate_id'));
         if ($id <= 0) {
             $this->error(lang('param_error'), 'Mallvouchertemplate/mallvouchertemplatelist');
@@ -201,7 +206,7 @@ class Mallvouchertemplate extends AdminControl {
         if (empty($mallvouchertemplate_info)) {
             $this->error(lang('param_error'), 'Mallvouchertemplate/mallvouchertemplatelist');
         }
-        
+
         $gc_list = model('goodsclass')->getGoodsclassListByParentId(0);
         View::assign('gc_list', $gc_list);
         View::assign('info', $mallvouchertemplate_info);
@@ -214,14 +219,15 @@ class Mallvouchertemplate extends AdminControl {
      * 删除代金券面额
      */
 
-    public function drop() {
+    public function drop()
+    {
         $mallvouchertemplate_id = trim(input('param.mallvouchertemplate_id'));
         if (empty($mallvouchertemplate_id)) {
             $this->error(lang('param_error'), 'Mallvouchertemplate/mallvouchertemplatelist');
         }
         $mallvouchertemplate_model = model('mallvouchertemplate');
         $condition = array();
-        $condition[] = array('mallvouchertemplate_id','in', $mallvouchertemplate_id);
+        $condition[] = array('mallvouchertemplate_id', 'in', $mallvouchertemplate_id);
         $rs = $mallvouchertemplate_model->delMallvouchertemplate($condition);
         if ($rs) {
             $this->log(lang('ds_del') . lang('admin_mallvouchertemplate_drop') . '[ID:' . $mallvouchertemplate_id . ']');
@@ -230,9 +236,9 @@ class Mallvouchertemplate extends AdminControl {
             ds_json_encode(10001, lang('ds_common_del_fail'));
         }
     }
- 
 
-  
+
+
 
     /**
      * 页面内导航菜单
@@ -240,7 +246,8 @@ class Mallvouchertemplate extends AdminControl {
      * @param array $array 附加菜单
      * @return
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'mallvouchertemplatelist',
@@ -271,5 +278,4 @@ class Mallvouchertemplate extends AdminControl {
         }
         return $menu_array;
     }
-
 }

+ 58 - 52
app/admin/controller/Marketmanage.php

@@ -1,24 +1,26 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Db;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 营销活动管理  包含刮刮卡\大转盘\砸金蛋\生肖翻翻看
  */
-class Marketmanage extends AdminControl {
+class Marketmanage extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/marketmanage.lang.php');
         //营销活动类型
@@ -31,13 +33,14 @@ class Marketmanage extends AdminControl {
         View::assign('marketmanage_type', $this->marketmanage_type);
     }
 
-    public function index() {
+    public function index()
+    {
         $condition = array();
         $marketmanage_name = input('param.marketmanage_name');
         if (!empty($marketmanage_name)) {
-            $condition[]=array('marketmanage_name','like', '%' . $marketmanage_name . '%');
+            $condition[] = array('marketmanage_name', 'like', '%' . $marketmanage_name . '%');
         }
-        $condition[]=array('marketmanage_type','=',$this->marketmanage_type);
+        $condition[] = array('marketmanage_type', '=', $this->marketmanage_type);
         $marketmanage_model = model('marketmanage');
         $marketmanage_list = $marketmanage_model->getMarketmanageList($condition, 10);
         View::assign('marketmanage_list', $marketmanage_list);
@@ -46,13 +49,14 @@ class Marketmanage extends AdminControl {
         return View::fetch();
     }
 
-    public function add() {
+    public function add()
+    {
         if (!request()->isPost()) {
             $marketmanage = array(
-                'marketmanage_jointype'=>0,
-                'marketmanage_point'=>0,
+                'marketmanage_jointype' => 0,
+                'marketmanage_point' => 0,
                 'marketmanage_begintime' => TIMESTAMP,
-                'marketmanage_endtime' => TIMESTAMP+3600*24*7,
+                'marketmanage_endtime' => TIMESTAMP + 3600 * 24 * 7,
             );
             View::assign('marketmanage', $marketmanage);
 
@@ -72,15 +76,15 @@ class Marketmanage extends AdminControl {
 
             //获取正在进行中的奖品红包活动
             $condition = array();
-            $condition[] = array('bonus_type','=',3);
-            $condition[] = array('bonus_state','=',1);
+            $condition[] = array('bonus_type', '=', 3);
+            $condition[] = array('bonus_state', '=', 1);
             $bonus_model = model('bonus');
             $bonus_list = $bonus_model->getBonusList($condition, '');
             View::assign('bonus_list', $bonus_list);
             //获取店铺的优惠券列表
             $condition = array();
-            $condition[]=array('vouchertemplate_state','=',1);
-            $condition[]=array('vouchertemplate_enddate','>', TIMESTAMP);
+            $condition[] = array('vouchertemplate_state', '=', 1);
+            $condition[] = array('vouchertemplate_enddate', '>', TIMESTAMP);
             $vouchertemplate_list = Db::name('vouchertemplate')->field('*')->where($condition)->limit(10)->select()->toArray();
             View::assign('vouchertemplate_list', $vouchertemplate_list);
             return View::fetch('form');
@@ -89,22 +93,22 @@ class Marketmanage extends AdminControl {
             $total_marketmanageaward_probability = 0;
             for ($i = 1; $i <= 4; $i++) {
                 $marketmanageaward_probability = intval($_POST['probability_' . $i]);
-                $total_marketmanageaward_probability +=$marketmanageaward_probability;
+                $total_marketmanageaward_probability += $marketmanageaward_probability;
                 $data_marketmanageaward[] = array(
                     'marketmanageaward_level' => $i,
                     'marketmanageaward_type' => intval($_POST['type_' . $i]),
                     'marketmanageaward_count' => intval($_POST['count_' . $i]),
-                    'marketmanageaward_probability' => $marketmanageaward_probability,//中奖概率
-                    'marketmanageaward_point'=>intval($_POST['point_' . $i]),
-                    'bonus_id'=>isset($_POST['bonus_id_' . $i]) ? intval($_POST['bonus_id_' . $i]) : 0,
-                    'vouchertemplate_id'=> isset($_POST['vouchertemplate_id_' . $i]) ? intval($_POST['vouchertemplate_id_' . $i]) : 0,
+                    'marketmanageaward_probability' => $marketmanageaward_probability, //中奖概率
+                    'marketmanageaward_point' => intval($_POST['point_' . $i]),
+                    'bonus_id' => isset($_POST['bonus_id_' . $i]) ? intval($_POST['bonus_id_' . $i]) : 0,
+                    'vouchertemplate_id' => isset($_POST['vouchertemplate_id_' . $i]) ? intval($_POST['vouchertemplate_id_' . $i]) : 0,
                 );
             }
             //中奖概率之和应小于 400%
-            if($total_marketmanageaward_probability>400){
+            if ($total_marketmanageaward_probability > 400) {
                 $this->error(lang('marketmanageaward_probability_error'));
             }
-            
+
 
             $data_marketmanage = array(
                 'marketmanage_name' => input('param.marketmanage_name'),
@@ -134,14 +138,15 @@ class Marketmanage extends AdminControl {
         }
     }
 
-    public function edit() {
+    public function edit()
+    {
         $marketmanage_model = model('marketmanage');
         $condition = array();
         $marketmanage_id = intval(input('param.marketmanage_id'));
         if ($marketmanage_id <= 0) {
             $this->error(lang('param_error'));
         }
-        $condition[] = array('marketmanage_id','=',$marketmanage_id);
+        $condition[] = array('marketmanage_id', '=', $marketmanage_id);
         if (!request()->isPost()) {
             $marketmanage = $marketmanage_model->getOneMarketmanage($condition);
             View::assign('marketmanage', $marketmanage);
@@ -149,15 +154,15 @@ class Marketmanage extends AdminControl {
 
             //获取正在进行中的奖品红包活动
             $condition = array();
-            $condition[] = array('bonus_type','=',3);
-            $condition[] = array('bonus_state','=',1);
+            $condition[] = array('bonus_type', '=', 3);
+            $condition[] = array('bonus_state', '=', 1);
             $bonus_model = model('bonus');
             $bonus_list = $bonus_model->getBonusList($condition, '');
             View::assign('bonus_list', $bonus_list);
             //获取店铺的优惠券列表
             $condition = array();
-            $condition[] = array('vouchertemplate_state','=',1);
-            $condition[]=array('vouchertemplate_enddate','>', TIMESTAMP);
+            $condition[] = array('vouchertemplate_state', '=', 1);
+            $condition[] = array('vouchertemplate_enddate', '>', TIMESTAMP);
             $vouchertemplate_list = Db::name('vouchertemplate')->field('*')->where($condition)->limit(10)->select()->toArray();
             View::assign('vouchertemplate_list', $vouchertemplate_list);
             return View::fetch('form');
@@ -166,20 +171,20 @@ class Marketmanage extends AdminControl {
             $total_marketmanageaward_probability = 0;
             for ($i = 1; $i <= 4; $i++) {
                 $marketmanageaward_probability = intval($_POST['probability_' . $i]);
-                $total_marketmanageaward_probability +=$marketmanageaward_probability;
+                $total_marketmanageaward_probability += $marketmanageaward_probability;
                 $data_marketmanageaward[] = array(
                     'marketmanageaward_id' => intval($_POST['id_' . $i]), //主键ID 稍后用于修改数据
                     'marketmanageaward_level' => $i,
                     'marketmanageaward_type' => intval($_POST['type_' . $i]),
                     'marketmanageaward_count' => intval($_POST['count_' . $i]),
-                    'marketmanageaward_probability' => $marketmanageaward_probability,//中奖概率
+                    'marketmanageaward_probability' => $marketmanageaward_probability, //中奖概率
                     'marketmanageaward_point' => intval($_POST['point_' . $i]),
                     'bonus_id' => isset($_POST['bonus_id_' . $i]) ? intval($_POST['bonus_id_' . $i]) : 0,
                     'vouchertemplate_id' => isset($_POST['vouchertemplate_id_' . $i]) ? intval($_POST['vouchertemplate_id_' . $i]) : 0,
                 );
             }
             //中奖概率应小于 400%
-            if($total_marketmanageaward_probability>400){
+            if ($total_marketmanageaward_probability > 400) {
                 $this->error(lang('marketmanageaward_probability_error'));
             }
             $data_marketmanage = array(
@@ -197,15 +202,15 @@ class Marketmanage extends AdminControl {
             //编辑营销活动奖品记录
             foreach ($data_marketmanageaward as $key => $marketmanageaward) {
                 $condition = array();
-                $condition[]=array('marketmanageaward_id','=',$marketmanageaward['marketmanageaward_id']);
-                $condition[]=array('marketmanage_id','=',$marketmanage_id);
+                $condition[] = array('marketmanageaward_id', '=', $marketmanageaward['marketmanageaward_id']);
+                $condition[] = array('marketmanage_id', '=', $marketmanage_id);
                 Db::name('marketmanageaward')->where($condition)->update($marketmanageaward);
             }
             $this->log(lang('ds_edit') . $this->marketmanage_type_list[$this->marketmanage_type] . '[ID' . $marketmanage_id . ']', 1);
             dsLayerOpenSuccess(lang('ds_common_save_succ'));
         }
     }
-    
+
     //删除活动
     public function del()
     {
@@ -218,8 +223,8 @@ class Marketmanage extends AdminControl {
         $this->log(lang('ds_edit') . $this->marketmanage_type_list[$this->marketmanage_type] . '[ID' . $marketmanage_id . ']', 1);
         ds_json_encode(10000, lang('ds_common_op_succ'));
     }
-    
-    
+
+
     //链接信息
     public function link()
     {
@@ -228,42 +233,43 @@ class Marketmanage extends AdminControl {
         if ($marketmanage_id <= 0) {
             $this->error(lang('param_error'));
         }
-        $condition[] = array('marketmanage_id','=',$marketmanage_id);
+        $condition[] = array('marketmanage_id', '=', $marketmanage_id);
         $marketmanage_model = model('marketmanage');
         $marketmanage = $marketmanage_model->getOneMarketmanage($condition);
         View::assign('marketmanage', $marketmanage);
-        
+
         $market_url = '';
         //1刮刮卡2大转盘3砸金蛋4生肖翻翻看
         switch ($marketmanage['marketmanage_type']) {
             case 1:
-                $market_url = config('ds_config.h5_site_url')."/pages/home/marketmanage/Marketcard?marketmanage_id=".$marketmanage['marketmanage_id'];
+                $market_url = config('ds_config.h5_site_url') . "/pages/home/marketmanage/Marketcard?marketmanage_id=" . $marketmanage['marketmanage_id'];
                 break;
             case 2:
-                $market_url = config('ds_config.h5_site_url')."/pages/home/marketmanage/Marketwheel?marketmanage_id=".$marketmanage['marketmanage_id'];
+                $market_url = config('ds_config.h5_site_url') . "/pages/home/marketmanage/Marketwheel?marketmanage_id=" . $marketmanage['marketmanage_id'];
                 break;
             case 3:
-                $market_url = config('ds_config.h5_site_url')."/pages/home/marketmanage/Marketegg?marketmanage_id=".$marketmanage['marketmanage_id'];
+                $market_url = config('ds_config.h5_site_url') . "/pages/home/marketmanage/Marketegg?marketmanage_id=" . $marketmanage['marketmanage_id'];
                 break;
             case 4:
-                $market_url = config('ds_config.h5_site_url')."/pages/home/marketmanage/Marketzodiac?marketmanage_id=".$marketmanage['marketmanage_id'];
+                $market_url = config('ds_config.h5_site_url') . "/pages/home/marketmanage/Marketzodiac?marketmanage_id=" . $marketmanage['marketmanage_id'];
                 break;
             default:
                 break;
         }
         View::assign('market_url', $market_url);
-        
+
         return View::fetch();
     }
 
-        //活动参与记录
-    public function detail() {
+    //活动参与记录
+    public function detail()
+    {
         $condition = array();
         $marketmanage_id = intval(input('param.marketmanage_id'));
         if ($marketmanage_id <= 0) {
             $this->error(lang('param_error'));
         }
-        $condition[] = array('marketmanage_id','=',$marketmanage_id);
+        $condition[] = array('marketmanage_id', '=', $marketmanage_id);
         $marketmanage_model = model('marketmanage');
         $marketmanagelog_list = $marketmanage_model->getMarketmanageLogList($condition, 10);
         View::assign('marketmanagelog_list', $marketmanagelog_list);
@@ -271,7 +277,8 @@ class Marketmanage extends AdminControl {
         return View::fetch();
     }
 
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -281,10 +288,9 @@ class Marketmanage extends AdminControl {
             array(
                 'name' => 'add',
                 'text' => lang('ds_add'),
-                'url' => "javascript:dsLayerOpen('" . (string)url('Marketmanage/add', ['type' => input('param.type')]) . "','".lang('ds_add')."')"
+                'url' => "javascript:dsLayerOpen('" . (string)url('Marketmanage/add', ['type' => input('param.type')]) . "','" . lang('ds_add') . "')"
             ),
         );
         return $menu_array;
     }
-
 }

+ 58 - 53
app/admin/controller/Member.php

@@ -1,29 +1,32 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Db;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Member extends AdminControl {
+class Member extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/member.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/member.lang.php');
     }
 
-    public function member() {
+    public function member()
+    {
         $member_model = model('member');
 
 
@@ -35,47 +38,47 @@ class Member extends AdminControl {
         if ($search_field_value != '') {
             switch ($search_field_name) {
                 case 'member_name':
-                    $condition[]=array('member_name','like', '%' . trim($search_field_value) . '%');
+                    $condition[] = array('member_name', 'like', '%' . trim($search_field_value) . '%');
                     break;
                 case 'member_email':
-                    $condition[]=array('member_email','like', '%' . trim($search_field_value) . '%');
+                    $condition[] = array('member_email', 'like', '%' . trim($search_field_value) . '%');
                     break;
                 case 'member_mobile':
-                    $condition[]=array('member_mobile','like', '%' . trim($search_field_value) . '%');
+                    $condition[] = array('member_mobile', 'like', '%' . trim($search_field_value) . '%');
                     break;
                 case 'member_truename':
-                    $condition[]=array('member_truename','like', '%' . trim($search_field_value) . '%');
+                    $condition[] = array('member_truename', 'like', '%' . trim($search_field_value) . '%');
                     break;
             }
         }
         $search_state = input('search_state');
         switch ($search_state) {
             case 'no_informallow':
-                $condition[]=array('inform_allow','=','2');
+                $condition[] = array('inform_allow', '=', '2');
                 break;
             case 'no_isbuy':
-                $condition[]=array('is_buylimit','=','0');
+                $condition[] = array('is_buylimit', '=', '0');
                 break;
             case 'no_isallowtalk':
-                $condition[]=array('is_allowtalk','=','0');
+                $condition[] = array('is_allowtalk', '=', '0');
                 break;
             case 'no_memberstate':
-                $condition[]=array('member_state','=','0');
+                $condition[] = array('member_state', '=', '0');
                 break;
         }
         //会员等级
         $search_grade = intval(input('get.search_grade'));
-        if ($search_grade>0 && $member_grade) {
+        if ($search_grade > 0 && $member_grade) {
             if (isset($member_grade[$search_grade + 1]['exppoints'])) {
-                $condition[] = array('member_exppoints','between',array($member_grade[$search_grade]['exppoints'],$member_grade[$search_grade + 1]['exppoints']));
-            }else{
-                $condition[]=array('member_exppoints','>=', $member_grade[$search_grade]['exppoints']);
+                $condition[] = array('member_exppoints', 'between', array($member_grade[$search_grade]['exppoints'], $member_grade[$search_grade + 1]['exppoints']));
+            } else {
+                $condition[] = array('member_exppoints', '>=', $member_grade[$search_grade]['exppoints']);
             }
         }
 
         //排序
         $order = trim(input('get.search_sort'));
-        if (!in_array($order,array('member_logintime desc','member_loginnum desc'))) {
+        if (!in_array($order, array('member_logintime desc', 'member_loginnum desc'))) {
             $order = 'member_id desc';
         }
         $member_list = $member_model->getMemberList($condition, '*', 10, $order);
@@ -100,7 +103,8 @@ class Member extends AdminControl {
         return View::fetch();
     }
 
-    public function add() {
+    public function add()
+    {
         if (!request()->isPost()) {
             return View::fetch();
         } else {
@@ -119,7 +123,7 @@ class Member extends AdminControl {
                 'inform_allow' => 1, //默认允许举报商品
             );
             $member_validate = ds_validate('member');
-            if (!$member_validate->scene('add')->check($data)){
+            if (!$member_validate->scene('add')->check($data)) {
                 $this->error($member_validate->getError());
             }
             $result = $member_model->addMember($data);
@@ -131,23 +135,24 @@ class Member extends AdminControl {
         }
     }
 
-    public function edit() {
+    public function edit()
+    {
         //注:pathinfo地址参数不能通过get方法获取,查看“获取PARAM变量”
         $member_id = intval(input('param.member_id'));
         if (empty($member_id)) {
             $this->error(lang('param_error'));
         }
         $member_model = model('member');
-            $condition = array();
-            $condition[] = array('member_id','=',$member_id);
-            $member_array = $member_model->getMemberInfo($condition);
+        $condition = array();
+        $condition[] = array('member_id', '=', $member_id);
+        $member_array = $member_model->getMemberInfo($condition);
         if (!request()->isPost()) {
             View::assign('member_array', $member_array);
             return View::fetch();
         } else {
-            $member_mobile=input('post.member_mobile');
-            if($member_mobile==encrypt_show($member_array['member_mobile'],4,4)){
-                $member_mobile=$member_array['member_mobile'];
+            $member_mobile = input('post.member_mobile');
+            if ($member_mobile == encrypt_show($member_array['member_mobile'], 4, 4)) {
+                $member_mobile = $member_array['member_mobile'];
             }
             $data = array(
                 'member_email' => input('post.member_email'),
@@ -177,12 +182,12 @@ class Member extends AdminControl {
             }
 
             $member_validate = ds_validate('member');
-            if (!$member_validate->scene('edit')->check($data)){
+            if (!$member_validate->scene('edit')->check($data)) {
                 $this->error($member_validate->getError());
             }
 
-            $result = $member_model->editMember(array('member_id'=>$member_id),$data,$member_id);
-            if ($result>=0) {
+            $result = $member_model->editMember(array('member_id' => $member_id), $data, $member_id);
+            if ($result >= 0) {
                 dsLayerOpenSuccess(lang('ds_common_op_succ'));
             } else {
                 $this->error(lang('ds_common_op_fail'));
@@ -193,17 +198,18 @@ class Member extends AdminControl {
     /**
      * ajax操作
      */
-    public function ajax() {
+    public function ajax()
+    {
         $branch = input('param.branch');
-        $condition=array();
+        $condition = array();
         switch ($branch) {
-            /**
+                /**
              * 验证会员是否重复
              */
             case 'check_user_name':
                 $member_model = model('member');
-                $condition[]=array('member_name','=',input('param.member_name'));
-                $condition[]=array('member_id','<>', intval(input('get.member_id')));
+                $condition[] = array('member_name', '=', input('param.member_name'));
+                $condition[] = array('member_id', '<>', intval(input('get.member_id')));
                 $list = $member_model->getMemberInfo($condition);
                 if (empty($list)) {
                     echo 'true';
@@ -213,13 +219,13 @@ class Member extends AdminControl {
                     exit;
                 }
                 break;
-            /**
-             * 验证邮件是否重复
-             */
+                /**
+                 * 验证邮件是否重复
+                 */
             case 'check_email':
                 $member_model = model('member');
-                $condition[]=array('member_email','=',input('param.member_email'));
-                $condition[]=array('member_id','<>', intval(input('param.member_id')));
+                $condition[] = array('member_email', '=', input('param.member_email'));
+                $condition[] = array('member_id', '<>', intval(input('param.member_id')));
                 $list = $member_model->getMemberInfo($condition);
                 if (empty($list)) {
                     echo 'true';
@@ -235,7 +241,8 @@ class Member extends AdminControl {
     /**
      * 设置会员状态
      */
-    public function memberstate() {
+    public function memberstate()
+    {
         $member_id = input('param.member_id');
         $member_id_array = ds_delete_param($member_id);
         if ($member_id_array == FALSE) {
@@ -244,15 +251,15 @@ class Member extends AdminControl {
         $data['member_state'] = input('param.member_state') ? input('param.member_state') : 0;
 
         $condition = array();
-        $condition[]=array('member_id','in', $member_id_array);
+        $condition[] = array('member_id', 'in', $member_id_array);
         $result = Db::name('member')->where($condition)->update($data);
-        if ($result>=0) {
+        if ($result >= 0) {
             foreach ($member_id_array as $key => $member_id) {
                 dcache($member_id, 'member');
             }
             $this->log(lang('ds_edit') .  '[ID:' . implode(',', $member_id_array) . ']', 1);
             ds_json_encode('10000', lang('ds_common_op_succ'));
-        }else{
+        } else {
             ds_json_encode('10001', lang('ds_common_op_fail'));
         }
     }
@@ -260,7 +267,8 @@ class Member extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'member',
@@ -272,12 +280,9 @@ class Member extends AdminControl {
             $menu_array[] = array(
                 'name' => 'add',
                 'text' => lang('ds_add'),
-                'url' => "javascript:dsLayerOpen('".(string)url('Member/add')."','".lang('ds_add')."')"
+                'url' => "javascript:dsLayerOpen('" . (string)url('Member/add') . "','" . lang('ds_add') . "')"
             );
         }
         return $menu_array;
     }
-
 }
-
-?>

+ 53 - 50
app/admin/controller/MemberAuth.php

@@ -1,74 +1,78 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 use PHPExcel;
+
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class MemberAuth extends AdminControl {
+class MemberAuth extends AdminControl
+{
 
     const EXPORT_SIZE = 1000;
-    
-    public function initialize() {
+
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/member.lang.php');
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/member_auth.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/member.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/member_auth.lang.php');
     }
 
-    public function index() {
+    public function index()
+    {
         $member_model = model('member');
-        
+
         $search_field_value = input('search_field_value');
         $search_field_name = input('search_field_name');
         $condition = '1=1';
-        $filtered=0;
+        $filtered = 0;
         $default_condition = array();
         if ($search_field_value != '') {
             switch ($search_field_name) {
                 case 'member_name':
-                    $condition.=' AND member_name LIKE "%' . trim($search_field_value) . '%"';
-                    $filtered=1;
+                    $condition .= ' AND member_name LIKE "%' . trim($search_field_value) . '%"';
+                    $filtered = 1;
                     break;
                 case 'member_email':
-                    $condition.=' AND member_email LIKE "%' . trim($search_field_value) . '%"';
-                    $filtered=1;
+                    $condition .= ' AND member_email LIKE "%' . trim($search_field_value) . '%"';
+                    $filtered = 1;
                     break;
                 case 'member_mobile':
-                    $condition.=' AND member_mobile LIKE "%' . trim($search_field_value) . '%"';
-                    $filtered=1;
+                    $condition .= ' AND member_mobile LIKE "%' . trim($search_field_value) . '%"';
+                    $filtered = 1;
                     break;
                 case 'member_truename':
-                    $condition.=' AND member_truename LIKE "%' . trim($search_field_value) . '%"';
-                    $filtered=1;
+                    $condition .= ' AND member_truename LIKE "%' . trim($search_field_value) . '%"';
+                    $filtered = 1;
                     break;
             }
         }
         $search_state = input('search_state');
         switch ($search_state) {
             case 'check':
-                $condition.=' AND member_auth_state=1';
-                $filtered=1;
+                $condition .= ' AND member_auth_state=1';
+                $filtered = 1;
                 break;
             case 'pass':
-                $condition.=' AND member_auth_state=3';
-                $filtered=1;
+                $condition .= ' AND member_auth_state=3';
+                $filtered = 1;
                 break;
             case 'fail':
-                $condition.=' AND member_auth_state=2';
-                $filtered=1;
+                $condition .= ' AND member_auth_state=2';
+                $filtered = 1;
                 break;
             default:
-                $condition.=' AND member_auth_state IN (1,2,3)';
+                $condition .= ' AND member_auth_state IN (1,2,3)';
         }
         $member_list = $member_model->getMemberList($condition, '*', 10, 'member_id desc');
         //整理会员信息
@@ -87,34 +91,35 @@ class MemberAuth extends AdminControl {
         $this->setAdminCurItem('index');
         return View::fetch();
     }
-    
-    public function verify(){
+
+    public function verify()
+    {
         $member_id = input('param.member_id');
         $state = input('param.state');
         $message = input('param.message');
         $member_id_array = ds_delete_param($member_id);
-        if ($member_id_array == FALSE || !in_array($state, array(1,2))) {
+        if ($member_id_array == FALSE || !in_array($state, array(1, 2))) {
             ds_json_encode(10001, lang('param_error'));
         }
-        
-        if($state==1){
-            $update=array('member_auth_state'=>3);
-        }else{
-            $update=array('member_auth_state'=>2);
+
+        if ($state == 1) {
+            $update = array('member_auth_state' => 3);
+        } else {
+            $update = array('member_auth_state' => 2);
         }
-        if(!model('member')->editMember(array(array('member_auth_state','=',1),array('member_id','in',$member_id_array)),$update)){
+        if (!model('member')->editMember(array(array('member_auth_state', '=', 1), array('member_id', 'in', $member_id_array)), $update)) {
             ds_json_encode(10001, lang('ds_common_op_fail'));
         }
-        if($message){
+        if ($message) {
             //添加短消息
-                $message_model = model('message');
-                $insert_arr = array();
-                $insert_arr['from_member_id'] = 0;
-                $insert_arr['member_id'] = "," . implode(',', $member_id_array) . ",";
-                $insert_arr['msg_content'] = lang('member_auth_fail').':'.$message;
-                $insert_arr['message_type'] = 1;
-                $insert_arr['message_ismore'] = 1;
-                $message_model->addMessage($insert_arr);
+            $message_model = model('message');
+            $insert_arr = array();
+            $insert_arr['from_member_id'] = 0;
+            $insert_arr['member_id'] = "," . implode(',', $member_id_array) . ",";
+            $insert_arr['msg_content'] = lang('member_auth_fail') . ':' . $message;
+            $insert_arr['message_type'] = 1;
+            $insert_arr['message_ismore'] = 1;
+            $message_model->addMessage($insert_arr);
         }
         ds_json_encode(10000, lang('ds_common_op_succ'));
     }
@@ -122,7 +127,8 @@ class MemberAuth extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -133,7 +139,4 @@ class MemberAuth extends AdminControl {
 
         return $menu_array;
     }
-
 }
-
-?>

+ 21 - 17
app/admin/controller/Membergrade.php

@@ -1,16 +1,18 @@
 <?php
+
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
+
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Membergrade extends AdminControl
@@ -18,27 +20,28 @@ class Membergrade extends AdminControl
     public function initialize()
     {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/membergrade.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/membergrade.lang.php');
     }
-    public function index() {
+    public function index()
+    {
         if (request()->isPost()) {
             $update_arr = array();
             if (!empty(input('post.mg/a'))) {
                 $mg_arr = array();
                 $i = 1;
-                $max_exppoints = '-1';#用户判断 下级会员等级积分应大于上级等级积分
+                $max_exppoints = '-1'; #用户判断 下级会员等级积分应大于上级等级积分
                 foreach (input('post.mg/a') as $k => $v) {
                     $mg_arr[$i]['level'] = $i;
                     $level_name = $v['level_name'];
                     $exppoints  = intval($v['exppoints']);
-                    if(empty($level_name)){
+                    if (empty($level_name)) {
                         $this->error(lang('param_error'));
                     }
                     $mg_arr[$i]['level_name'] = $level_name;
                     //所需经验值
-                    if($max_exppoints>=$exppoints){
-                        $this->error($level_name.lang('exppoints_greater_than').$max_exppoints);
-                    }else{
+                    if ($max_exppoints >= $exppoints) {
+                        $this->error($level_name . lang('exppoints_greater_than') . $max_exppoints);
+                    } else {
                         $mg_arr[$i]['exppoints'] = $exppoints;
                     }
                     $max_exppoints = $exppoints;
@@ -64,19 +67,20 @@ class Membergrade extends AdminControl
             $list_config = rkcache('config', true);
             $membergrade_list = $list_config['member_grade'] ? unserialize($list_config['member_grade']) : array();
             foreach ($membergrade_list as $key => $value) {
-                $maxlevel[]=$value['level'];
+                $maxlevel[] = $value['level'];
             }
-            View::assign('maxlevel', max($maxlevel)+1);
+            View::assign('maxlevel', max($maxlevel) + 1);
             View::assign('membergrade_list', $membergrade_list);
             $this->setAdminCurItem('index');
             return View::fetch();
         }
     }
-    
+
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -86,4 +90,4 @@ class Membergrade extends AdminControl
         );
         return $menu_array;
     }
-}
+}

+ 124 - 96
app/admin/controller/Message.php

@@ -1,32 +1,36 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 use AlibabaCloud\Client\AlibabaCloud;
+
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Message extends AdminControl {
+class Message extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
 
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/message.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/message.lang.php');
     }
 
     /**
      * 邮件设置
      */
-    public function email() {
+    public function email()
+    {
         $config_model = model('config');
         if (!(request()->isPost())) {
             $list_config = rkcache('config', true);
@@ -57,15 +61,16 @@ class Message extends AdminControl {
     /**
      * 短信平台设置
      */
-    public function mobile() {
+    public function mobile()
+    {
         $config_model = model('config');
         if (!(request()->isPost())) {
             $list_config = rkcache('config', true);
 
             $smscf_num = '';
-            if($list_config['smscf_type']=='wj' && !empty($list_config['smscf_wj_username'])&&!empty($list_config['smscf_wj_key'])){
+            if ($list_config['smscf_type'] == 'wj' && !empty($list_config['smscf_wj_username']) && !empty($list_config['smscf_wj_key'])) {
                 //如果配置了信息,可以查看具体可用短信条数
-                $smscf_num = http_request('http://www.smschinese.cn/web_api/SMS/?Action=SMS_Num&Uid='.$list_config['smscf_wj_username'].'&Key='.$list_config['smscf_wj_key'],'get');
+                $smscf_num = http_request('http://www.smschinese.cn/web_api/SMS/?Action=SMS_Num&Uid=' . $list_config['smscf_wj_username'] . '&Key=' . $list_config['smscf_wj_key'], 'get');
             }
             View::assign('smscf_num', $smscf_num);
             View::assign('list_config', $list_config);
@@ -108,32 +113,32 @@ class Message extends AdminControl {
         if (trim($add_time_from) != '') {
             $add_time_from = strtotime(trim($add_time_from));
             if ($add_time_from !== false) {
-                $condition[]=array('smslog_smstime','>=', $add_time_from);
+                $condition[] = array('smslog_smstime', '>=', $add_time_from);
             }
         }
         if (trim($add_time_to) != '') {
             $add_time_to = strtotime(trim($add_time_to));
             if ($add_time_to !== false) {
-                $add_time_to=$add_time_to+86399;
-                $condition[]=array('smslog_smstime','<=', $add_time_to);
+                $add_time_to = $add_time_to + 86399;
+                $condition[] = array('smslog_smstime', '<=', $add_time_to);
             }
         }
         $member_name = input('get.member_name');
-        if(!empty($member_name)){
-            $condition[]=array('member_name','like',"%" . $member_name . "%");
+        if (!empty($member_name)) {
+            $condition[] = array('member_name', 'like', "%" . $member_name . "%");
         }
         $smslog_phone = input('get.smslog_phone');
-        if(!empty($smslog_phone)){
-            $condition[]=array('smslog_phone','like',"%" . $smslog_phone . "%");
+        if (!empty($smslog_phone)) {
+            $condition[] = array('smslog_phone', 'like', "%" . $smslog_phone . "%");
         }
         View::assign('filtered', $condition ? 1 : 0); //是否有查询条件
-        $condition[]=array('smslog_state','<>',0);
+        $condition[] = array('smslog_state', '<>', 0);
         $smslog_model = model('smslog');
-        $smslog_list = $smslog_model->getSmsList($condition,10);
+        $smslog_list = $smslog_model->getSmsList($condition, 10);
         View::assign('smslog_list', $smslog_list);
         View::assign('show_page', $smslog_model->page_info->render());
 
-        
+
 
         $this->setAdminCurItem('smslog');
         return View::fetch();
@@ -142,7 +147,8 @@ class Message extends AdminControl {
     /**
      * 短信日志删除
      */
-    public function smslog_del(){
+    public function smslog_del()
+    {
         $smslog_id = input('param.smslog_id');
         $smslog_id_array = ds_delete_param($smslog_id);
         if ($smslog_id_array === FALSE) {
@@ -150,7 +156,7 @@ class Message extends AdminControl {
         }
         $condition = array();
         $smslog_model = model('smslog');
-        $condition[]=array('smslog_id','in', $smslog_id_array);
+        $condition[] = array('smslog_id', 'in', $smslog_id_array);
         $smslog_list = $smslog_model->delSmsLog($condition);
         if ($smslog_list) {
             ds_json_encode(10000, lang('ds_common_del_succ'));
@@ -162,7 +168,8 @@ class Message extends AdminControl {
     /**
      * 邮件模板列表
      */
-    public function email_tpl() {
+    public function email_tpl()
+    {
         $mailtemplates_model = model('mailtemplates');
         $templates_list = $mailtemplates_model->getTplList();
         View::assign('templates_list', $templates_list);
@@ -173,7 +180,8 @@ class Message extends AdminControl {
     /**
      * 编辑邮件模板
      */
-    public function email_tpl_edit() {
+    public function email_tpl_edit()
+    {
         $mailtemplates_model = model('mailtemplates');
         if (!request()->isPost()) {
             if (!(input('param.code'))) {
@@ -198,7 +206,7 @@ class Message extends AdminControl {
                 $update_array['mailmt_title'] = input('post.title');
                 $update_array['mailmt_content'] = input('post.content');
                 $result = $mailtemplates_model->editTpl($update_array, array('mailmt_code' => input('post.code')));
-                if ($result>=0) {
+                if ($result >= 0) {
                     $this->log(lang('ds_edit') . lang('email_tpl'), 1);
                     $this->success(lang('mailtemplates_edit_succ'), 'admin/Message/email_tpl');
                 } else {
@@ -215,7 +223,8 @@ class Message extends AdminControl {
      * @param
      * @return
      */
-    public function email_testing() {
+    public function email_testing()
+    {
         /**
          * 读取语言包
          */
@@ -238,7 +247,7 @@ class Message extends AdminControl {
         $email_id = '';
         $email_pass = '';
         $email_test = '181814630@qq.com';
-        */
+         */
 
         $site_name = config('ds_config.site_name');
         $message = '<p>' . lang('this_is_to') . "<a href='" . $site_url . "' target='_blank'>" . $site_name . '</a>' . lang('test_email_set_ok') . '</p>';
@@ -254,10 +263,12 @@ class Message extends AdminControl {
         $result = $obj_email->send($email_test, $subject, $message);
         if ($result === false) {
             $data['msg'] = lang('test_email_send_fail');
-            echo json_encode($data);exit;
+            echo json_encode($data);
+            exit;
         } else {
             $data['msg'] = lang('test_email_send_ok');
-            echo json_encode($data);exit;
+            echo json_encode($data);
+            exit;
         }
     }
 
@@ -267,7 +278,8 @@ class Message extends AdminControl {
      * @param
      * @return
      */
-    public function mobile_testing() {
+    public function mobile_testing()
+    {
         $mobile = input('param.mobile_test');
         $content = input('param.mobile_test_content');
         $smscf_type = input('param.smscf_type');
@@ -346,14 +358,15 @@ class Message extends AdminControl {
     /**
      * 商家消息模板编辑
      */
-    public function seller_tpl_edit() {
+    public function seller_tpl_edit()
+    {
         if (!request()->isPost()) {
             $code = trim(input('param.code'));
             if (empty($code)) {
                 $this->error(lang('param_error'));
             }
             $condition = array();
-            $condition[] = array('storemt_code','=',$code);
+            $condition[] = array('storemt_code', '=', $code);
             $smtpl_info = model('storemsgtpl')->getStoremsgtplInfo($condition);
             View::assign('smtpl_info', $smtpl_info);
             $this->setAdminCurItem('seller_tpl_edit');
@@ -384,14 +397,15 @@ class Message extends AdminControl {
     /**
      * 商家消息模板更新站内信
      */
-    private function seller_tpl_update_message() {
+    private function seller_tpl_update_message()
+    {
         $message_content = trim(input('post.message_content'));
         if (empty($message_content)) {
             $this->error(lang('param_error'));
         }
         // 条件
         $condition = array();
-        $condition[] = array('storemt_code','=',trim(input('post.code')));
+        $condition[] = array('storemt_code', '=', trim(input('post.code')));
         // 数据
         $update = array();
         $update['storemt_message_switch'] = intval(input('post.message_switch'));
@@ -404,14 +418,15 @@ class Message extends AdminControl {
     /**
      * 商家消息模板更新短消息
      */
-    private function seller_tpl_update_short() {
+    private function seller_tpl_update_short()
+    {
         $short_content = trim(input('post.short_content'));
         if (empty($short_content)) {
             $this->error(lang('param_error'));
         }
         // 条件
         $condition = array();
-        $condition[] = array('storemt_code','=',trim(input('post.code')));
+        $condition[] = array('storemt_code', '=', trim(input('post.code')));
         // 数据
         $update = array();
         $update['storemt_short_switch'] = intval(input('post.short_switch'));
@@ -424,7 +439,8 @@ class Message extends AdminControl {
     /**
      * 商家消息模板更新邮件
      */
-    private function seller_tpl_update_mail() {
+    private function seller_tpl_update_mail()
+    {
         $mail_subject = trim(input('post.mail_subject'));
         $mail_content = trim(input('post.mail_content'));
         if ((empty($mail_subject) || empty($mail_content))) {
@@ -432,7 +448,7 @@ class Message extends AdminControl {
         }
         // 条件
         $condition = array();
-        $condition[] = array('storemt_code','=',trim(input('post.code')));
+        $condition[] = array('storemt_code', '=', trim(input('post.code')));
         // 数据
         $update = array();
         $update['storemt_mail_switch'] = intval(input('post.mail_switch'));
@@ -446,14 +462,15 @@ class Message extends AdminControl {
     /**
      * 商家消息模板更新邮件
      */
-    private function seller_tpl_update_weixin() {
+    private function seller_tpl_update_weixin()
+    {
         $weixin_code = trim(input('post.weixin_code'));
         if (empty($weixin_code)) {
             $this->error(lang('param_error'));
         }
         // 条件
         $condition = array();
-        $condition[] = array('storemt_code','=',trim(input('post.code')));
+        $condition[] = array('storemt_code', '=', trim(input('post.code')));
         // 数据
         $update = array();
         $update['storemt_weixin_switch'] = intval(input('post.weixin_switch'));
@@ -463,8 +480,9 @@ class Message extends AdminControl {
         $this->seller_tpl_update_showmessage($result);
     }
 
-    private function seller_tpl_update_showmessage($result) {
-        if ($result>=0) {
+    private function seller_tpl_update_showmessage($result)
+    {
+        if ($result >= 0) {
             $this->success(lang('ds_common_op_succ'), (string)url('Message/seller_tpl'));
         } else {
             $this->error(lang('ds_common_op_fail'));
@@ -474,7 +492,8 @@ class Message extends AdminControl {
     /**
      * 用户消息模板
      */
-    public function member_tpl() {
+    public function member_tpl()
+    {
         $mmtpl_list = model('membermsgtpl')->getMembermsgtplList(array());
         View::assign('mmtpl_list', $mmtpl_list);
         $this->setAdminCurItem('member_tpl');
@@ -484,14 +503,15 @@ class Message extends AdminControl {
     /**
      * 用户消息模板编辑
      */
-    public function member_tpl_edit() {
+    public function member_tpl_edit()
+    {
         if (!request()->isPost()) {
             $code = trim(input('param.code'));
             if (empty($code)) {
                 $this->error(lang('param_error'));
             }
             $condition = array();
-            $condition[] = array('membermt_code','=',$code);
+            $condition[] = array('membermt_code', '=', $code);
             $mmtpl_info = model('membermsgtpl')->getMembermsgtplInfo($condition);
             View::assign('mmtpl_info', $mmtpl_info);
             $this->setAdminCurItem('member_tpl_edit');
@@ -519,23 +539,25 @@ class Message extends AdminControl {
         }
     }
 
-    public function ali_tpl(){
+    public function ali_tpl()
+    {
         $mstpl_list = model('storemsgtpl')->getStoremsgtplList(array());
         $mmtpl_list = model('membermsgtpl')->getMembermsgtplList(array());
         $mailtemplates_model = model('mailtemplates');
-        $templates_list = $mailtemplates_model->getTplList(array(array('mailmt_code','<>','bind_email')));
-        View::assign('mstpl_list',$mstpl_list);
-        View::assign('mmtpl_list',$mmtpl_list);
-        View::assign('templates_list',$templates_list);
+        $templates_list = $mailtemplates_model->getTplList(array(array('mailmt_code', '<>', 'bind_email')));
+        View::assign('mstpl_list', $mstpl_list);
+        View::assign('mmtpl_list', $mmtpl_list);
+        View::assign('templates_list', $templates_list);
         $this->setAdminCurItem('message_ali_tpl');
         return View::fetch();
     }
 
-    public function ali_tpl_edit(){
-        $type=input('param.type');
-        $code=input('param.code');
-        $name=input('param.name');
-        switch($type){
+    public function ali_tpl_edit()
+    {
+        $type = input('param.type');
+        $code = input('param.code');
+        $name = input('param.name');
+        switch ($type) {
             case 'membermsgtpl':
                 if (!model('membermsgtpl')->editMembermsgtpl(array('membermt_code' => $name), array('ali_template_code' => $code))) {
                     ds_json_encode(10001, lang('ds_common_op_fail'));
@@ -562,40 +584,41 @@ class Message extends AdminControl {
         }
     }
 
-    public function ali_tpl_query() {
+    public function ali_tpl_query()
+    {
         $code = input('param.code');
 
         AlibabaCloud::accessKeyClient(config('ds_config.smscf_ali_id'), config('ds_config.smscf_ali_secret'))
-                ->regionId('cn-hangzhou')
-                ->asDefaultClient();
+            ->regionId('cn-hangzhou')
+            ->asDefaultClient();
 
         try {
             $result = AlibabaCloud::rpc()
-                    ->product('Dysmsapi')
-                    // ->scheme('https') // https | http
-                    ->version('2017-05-25')
-                    ->action('QuerySmsTemplate')
-                    ->method('POST')
-                    ->host('dysmsapi.aliyuncs.com')
-                    ->options([
-                        'query' => [
-                            'RegionId' => "cn-hangzhou",
-                            'TemplateCode' => $code,
-                        ],
-                    ])
-                    ->request();
-
+                ->product('Dysmsapi')
+                // ->scheme('https') // https | http
+                ->version('2017-05-25')
+                ->action('QuerySmsTemplate')
+                ->method('POST')
+                ->host('dysmsapi.aliyuncs.com')
+                ->options([
+                    'query' => [
+                        'RegionId' => "cn-hangzhou",
+                        'TemplateCode' => $code,
+                    ],
+                ])
+                ->request();
         } catch (\Exception $e) {
             ds_json_encode(10001, $e->getErrorMessage());
         }
-        ds_json_encode(10000, lang('ds_common_op_succ'),$result->toArray());
+        ds_json_encode(10000, lang('ds_common_op_succ'), $result->toArray());
     }
 
-    public function ten_tpl() {
+    public function ten_tpl()
+    {
         $mstpl_list = model('storemsgtpl')->getStoremsgtplList(array());
         $mmtpl_list = model('membermsgtpl')->getMembermsgtplList(array());
         $mailtemplates_model = model('mailtemplates');
-        $templates_list = $mailtemplates_model->getTplList(array(array('mailmt_code','<>', 'bind_email')));
+        $templates_list = $mailtemplates_model->getTplList(array(array('mailmt_code', '<>', 'bind_email')));
         View::assign('mstpl_list', $mstpl_list);
         View::assign('mmtpl_list', $mmtpl_list);
         View::assign('templates_list', $templates_list);
@@ -603,7 +626,8 @@ class Message extends AdminControl {
         return View::fetch();
     }
 
-    public function ten_tpl_edit() {
+    public function ten_tpl_edit()
+    {
         $type = input('param.type');
         $code = input('param.code');
         $name = input('param.name');
@@ -635,20 +659,21 @@ class Message extends AdminControl {
     }
 
     //接口
-    public function ten_tpl_query() {
+    public function ten_tpl_query()
+    {
         $code = input('param.code');
         // 短信应用 SDK AppID
         $appid = config('ds_config.smscf_ten_id'); // SDK AppID 以1400开头
         // 短信应用 SDK AppKey
         $appkey = config('ds_config.smscf_ten_secret');
         try {
-            $cred = new Credential($appid,$appkey);
+            $cred = new Credential($appid, $appkey);
             $httpProfile = new HttpProfile();
             $httpProfile->setEndpoint("sms.tencentcloudapi.com");
 
             $clientProfile = new ClientProfile();
             $clientProfile->setHttpProfile($httpProfile);
-            $client = new SmsClient($cred,"",$clientProfile);
+            $client = new SmsClient($cred, "", $clientProfile);
 
             $req = new DescribeSmsTemplateListRequest();
 
@@ -667,14 +692,15 @@ class Message extends AdminControl {
     /**
      * 商家消息模板更新站内信
      */
-    private function member_tpl_update_message() {
+    private function member_tpl_update_message()
+    {
         $message_content = trim(input('post.message_content'));
         if (empty($message_content)) {
             $this->error(lang('param_error'));
         }
         // 条件
         $condition = array();
-        $condition[] = array('membermt_code','=',trim(input('post.code')));
+        $condition[] = array('membermt_code', '=', trim(input('post.code')));
         // 数据
         $update = array();
         $update['membermt_message_switch'] = intval(input('post.message_switch'));
@@ -686,14 +712,15 @@ class Message extends AdminControl {
     /**
      * 商家消息模板更新短消息
      */
-    private function member_tpl_update_short() {
+    private function member_tpl_update_short()
+    {
         $short_content = trim(input('post.short_content'));
         if (empty($short_content)) {
             $this->error(lang('param_error'));
         }
         // 条件
         $condition = array();
-        $condition[] = array('membermt_code','=',trim(input('post.code')));
+        $condition[] = array('membermt_code', '=', trim(input('post.code')));
         // 数据
         $update = array();
         $update['membermt_short_switch'] = intval(input('post.short_switch'));
@@ -705,14 +732,15 @@ class Message extends AdminControl {
     /**
      * 商家消息模板更新邮件
      */
-    private function member_tpl_update_weixin() {
+    private function member_tpl_update_weixin()
+    {
         $weixin_code = trim(input('post.weixin_code'));
         if (empty($weixin_code)) {
             $this->error(lang('param_error'));
         }
         // 条件
         $condition = array();
-        $condition[] = array('membermt_code','=',trim(input('post.code')));
+        $condition[] = array('membermt_code', '=', trim(input('post.code')));
         // 数据
         $update = array();
         $update['membermt_weixin_switch'] = intval(input('post.weixin_switch'));
@@ -724,7 +752,8 @@ class Message extends AdminControl {
     /**
      * 商家消息模板更新邮件
      */
-    private function member_tpl_update_mail() {
+    private function member_tpl_update_mail()
+    {
         $mail_subject = trim(input('post.mail_subject'));
         $mail_content = trim(input('post.mail_content'));
         if ((empty($mail_subject) || empty($mail_content))) {
@@ -732,7 +761,7 @@ class Message extends AdminControl {
         }
         // 条件
         $condition = array();
-        $condition[] = array('membermt_code','=',trim(input('post.code')));
+        $condition[] = array('membermt_code', '=', trim(input('post.code')));
         // 数据
         $update = array();
         $update['membermt_mail_switch'] = intval(input('post.mail_switch'));
@@ -742,8 +771,9 @@ class Message extends AdminControl {
         $this->member_tpl_update_showmessage($result);
     }
 
-    private function member_tpl_update_showmessage($result) {
-        if ($result>=0) {
+    private function member_tpl_update_showmessage($result)
+    {
+        if ($result >= 0) {
             $this->success(lang('ds_common_op_succ'), (string)url('Message/member_tpl'));
         } else {
             $this->error(lang('ds_common_op_fail'));
@@ -753,7 +783,8 @@ class Message extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'email',
@@ -786,7 +817,7 @@ class Message extends AdminControl {
                 'url' => (string)url('Message/email_tpl')
             ),
         );
-        if(config('ds_config.smscf_type')=='ali'){
+        if (config('ds_config.smscf_type') == 'ali') {
             array_splice($menu_array, 2, 0, array(array(
                 'name' => 'message_ali_tpl',
                 'text' => lang('message_ali_tpl'),
@@ -825,7 +856,4 @@ class Message extends AdminControl {
 
         return $menu_array;
     }
-
 }
-
-?>

+ 35 - 29
app/admin/controller/Navigation.php

@@ -1,37 +1,40 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Navigation extends AdminControl {
+class Navigation extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/navigation.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/navigation.lang.php');
     }
 
-    public function index() {
+    public function index()
+    {
         $navigation_model = model('navigation');
         $condition = array();
         $nav_title = input('param.nav_title');
         if (!empty($nav_title)) {
-            $condition[]=array('nav_title','like', "%" . $nav_title . "%");
+            $condition[] = array('nav_title', 'like', "%" . $nav_title . "%");
         }
         $nav_location = input('param.nav_location');
         if (!empty($nav_location)) {
-            $condition[]=array('nav_location','=',$nav_location);
+            $condition[] = array('nav_location', '=', $nav_location);
         }
         $nav_list = $navigation_model->getNavigationList($condition, 10);
         View::assign('nav_list', $nav_list);
@@ -40,7 +43,8 @@ class Navigation extends AdminControl {
         return View::fetch();
     }
 
-    public function add() {
+    public function add()
+    {
         if (!(request()->isPost())) {
             $nav = [
                 'nav_location' => 'header',
@@ -59,8 +63,8 @@ class Navigation extends AdminControl {
                 $this->error($navigation_validate->getError());
             }
 
-            $navigation_model= model('navigation');
-            $result=$navigation_model->addNavigation($data);
+            $navigation_model = model('navigation');
+            $result = $navigation_model->addNavigation($data);
             if ($result) {
                 dsLayerOpenSuccess(lang('ds_common_op_succ'));
             } else {
@@ -69,16 +73,17 @@ class Navigation extends AdminControl {
         }
     }
 
-    public function edit() {
-        $navigation_model= model('navigation');
+    public function edit()
+    {
+        $navigation_model = model('navigation');
         $nav_id = input('param.nav_id');
         if (empty($nav_id)) {
             $this->error(lang('param_error'));
         }
         if (!request()->isPost()) {
             $condition = array();
-            $condition[] = array('nav_id','=',$nav_id);
-            $nav=$navigation_model->getOneNavigation($condition);
+            $condition[] = array('nav_id', '=', $nav_id);
+            $nav = $navigation_model->getOneNavigation($condition);
             View::assign('nav', $nav);
             return View::fetch('form');
         } else {
@@ -92,9 +97,9 @@ class Navigation extends AdminControl {
                 $this->error($navigation_validate->getError());
             }
             $condition = array();
-            $condition[] = array('nav_id','=',$nav_id);
-            $result = $navigation_model->eidtNavigation($data,$condition);
-            if ($result>=0) {
+            $condition[] = array('nav_id', '=', $nav_id);
+            $result = $navigation_model->eidtNavigation($data, $condition);
+            if ($result >= 0) {
                 dsLayerOpenSuccess(lang('ds_common_op_succ'));
             } else {
                 $this->error(lang('error'));
@@ -102,15 +107,16 @@ class Navigation extends AdminControl {
         }
     }
 
-    public function drop() {
-        $navigation_model= model('navigation');
+    public function drop()
+    {
+        $navigation_model = model('navigation');
         $nav_id = input('param.nav_id');
         $nav_id_array = ds_delete_param($nav_id);
-        if($nav_id_array === FALSE){
+        if ($nav_id_array === FALSE) {
             ds_json_encode('10001', lang('param_error'));
         }
         $condition = array(array('nav_id', 'in', $nav_id_array));
-        $result =$navigation_model->delNavigation($condition);
+        $result = $navigation_model->delNavigation($condition);
         if ($result) {
             ds_json_encode('10000', lang('ds_common_del_succ'));
         } else {
@@ -121,7 +127,8 @@ class Navigation extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -131,10 +138,9 @@ class Navigation extends AdminControl {
             array(
                 'name' => 'add',
                 'text' => lang('ds_add'),
-                'url' => "javascript:dsLayerOpen('".(string)url('Navigation/add')."','".lang('ds_add')."')"
+                'url' => "javascript:dsLayerOpen('" . (string)url('Navigation/add') . "','" . lang('ds_add') . "')"
             ),
         );
         return $menu_array;
     }
-
-}
+}

+ 18 - 16
app/admin/controller/Notice.php

@@ -1,17 +1,18 @@
 <?php
+
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Notice extends AdminControl
@@ -19,7 +20,7 @@ class Notice extends AdminControl
     public function initialize()
     {
         parent::initialize();
-        Lang::load(base_path().'admin/lang/'.config('lang.default_lang').'/notice.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/notice.lang.php');
     }
 
     /**
@@ -30,7 +31,7 @@ class Notice extends AdminControl
         $special_condition = array();
         $special_condition['message_type'] = 1;
         $message_model = model('message');
-        $message_list = $message_model->getMessageList($special_condition,10);
+        $message_list = $message_model->getMessageList($special_condition, 10);
         View::assign('message_list', $message_list);
         View::assign('show_page', $message_model->page_info->render());
         $this->setAdminCurItem('index');
@@ -39,7 +40,8 @@ class Notice extends AdminControl
     /**
      * 会员通知
      */
-    public function notice(){
+    public function notice()
+    {
         //提交
         if (request()->isPost()) {
             $notice_validate = ds_validate('notice');
@@ -47,7 +49,7 @@ class Notice extends AdminControl
             $send_type = intval(input('param.send_type'));
             //验证
             switch ($send_type) {
-                //指定会员
+                    //指定会员
                 case 1:
                     $data = [
                         "user_name" => input("param.user_name")
@@ -56,7 +58,7 @@ class Notice extends AdminControl
                         $this->error($notice_validate->getError());
                     }
                     break;
-                //全部会员
+                    //全部会员
                 case 2:
                     break;
             }
@@ -78,7 +80,7 @@ class Notice extends AdminControl
                             $tmp[$k] = trim($v);
                         }
                         //查询会员列表
-                        $member_list = $member_model->getMemberList(array(array('member_name' ,'in', $tmp)));
+                        $member_list = $member_model->getMemberList(array(array('member_name', 'in', $tmp)));
                         unset($membername_str);
                         if (!empty($member_list)) {
                             foreach ($member_list as $k => $v) {
@@ -113,7 +115,7 @@ class Notice extends AdminControl
                 //跳转
                 $this->log(lang('notice_index_send'), 1);
                 dsLayerOpenSuccess(lang('notice_index_send_succ'));
-//                $this->success(lang('notice_index_send_succ'), 'notice/notice');
+                //                $this->success(lang('notice_index_send_succ'), 'notice/notice');
             }
         } else {
             return View::fetch('notice_add');
@@ -121,14 +123,14 @@ class Notice extends AdminControl
     }
     protected function getAdminItemList()
     {
-        $menu_array=array(
+        $menu_array = array(
             array(
-                'name'=>'index','text'=>lang('notice_index_member_notice'),'url'=>(string)url('Notice/index')
+                'name' => 'index', 'text' => lang('notice_index_member_notice'), 'url' => (string)url('Notice/index')
             ),
             array(
-                'name'=>'notice','text'=>lang('notice_index_send'),'url'=>"javascript:dsLayerOpen('".(string)url('Notice/notice')."','".lang('notice_index_send')."')"
+                'name' => 'notice', 'text' => lang('notice_index_send'), 'url' => "javascript:dsLayerOpen('" . (string)url('Notice/notice') . "','" . lang('notice_index_send') . "')"
             )
         );
         return $menu_array;
     }
-}
+}

+ 14 - 14
app/admin/controller/Offpayarea.php

@@ -1,18 +1,18 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Offpayarea extends AdminControl
@@ -20,8 +20,7 @@ class Offpayarea extends AdminControl
     public function initialize()
     {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/offpayarea.lang.php');
-        
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/offpayarea.lang.php');
     }
 
     public function index()
@@ -32,11 +31,11 @@ class Offpayarea extends AdminControl
         \areacache::updateAreaPhp();
         $offpayarea_model = model('offpayarea');
         $area_model = model('area');
-        
+
         //默认平台店铺id
         $store_id = 1;
         if (request()->isPost()) {
-            
+
             $county_array = input('post.county');
             if (!preg_match('/^[\d,]+$/', $county_array)) {
                 $county_array = '';
@@ -65,9 +64,9 @@ class Offpayarea extends AdminControl
             }
 
 
-            if(is_array($county_array)) {
+            if (is_array($county_array)) {
                 foreach ($county_array as $pid) {
-                    if($pid=='') continue;
+                    if ($pid == '') continue;
                     $all_array[$pid] = $pid;
                     $temp = $area_model->getChildsByPid($pid);
                     if (!empty($temp) && is_array($temp)) {
@@ -100,7 +99,7 @@ class Offpayarea extends AdminControl
         if (empty($parea_ids)) {
             $parea_ids = array();
         }
-        View::assign('parea_ids',$parea_ids);
+        View::assign('parea_ids', $parea_ids);
         //取出支持货到付款县ID的上级市ID
         $city_checked_child_array = array();
         //地区修改
@@ -169,7 +168,8 @@ class Offpayarea extends AdminControl
         return View::fetch();
     }
 
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -179,4 +179,4 @@ class Offpayarea extends AdminControl
         );
         return $menu_array;
     }
-}
+}

+ 20 - 15
app/admin/controller/Operation.php

@@ -1,20 +1,22 @@
 <?php
+
 /**
  * 营销设置
  */
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
+
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Operation extends AdminControl
@@ -22,10 +24,11 @@ class Operation extends AdminControl
     public function initialize()
     {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path().'admin/lang/'.config('lang.default_lang').'/config.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/config.lang.php');
     }
 
-    public function index(){
+    public function index()
+    {
         $this->setAdminCurItem('index');
         return View::fetch('index');
     }
@@ -33,7 +36,8 @@ class Operation extends AdminControl
     /**
      * 基本设置
      */
-    public function setting(){
+    public function setting()
+    {
         $config_model = model('config');
         if (request()->isPost()) {
             $update_array = array();
@@ -58,16 +62,16 @@ class Operation extends AdminControl
             $this->setAdminCurItem('setting');
             return View::fetch('setting');
         }
-
     }
 
-    public function point_signin(){
+    public function point_signin()
+    {
         $config_model = model('config');
-        if(!request()->isPost()){
+        if (!request()->isPost()) {
             $list_setting = rkcache('config', true);
             View::assign('list_setting', $list_setting);
             return View::fetch('point_signin');
-        }else{
+        } else {
             $update_array = array();
             $update_array['points_signin_isuse'] = input('post.points_signin_isuse');
             $update_array['points_signin'] = intval(input('post.points_signin'));
@@ -82,11 +86,12 @@ class Operation extends AdminControl
             }
         }
     }
-    
+
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -101,4 +106,4 @@ class Operation extends AdminControl
         );
         return $menu_array;
     }
-}
+}

+ 71 - 63
app/admin/controller/Order.php

@@ -1,52 +1,56 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 use think\facade\Db;
+
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Order extends AdminControl {
+class Order extends AdminControl
+{
 
     const EXPORT_SIZE = 1000;
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/vrorder.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/vrorder.lang.php');
     }
 
-    public function index() {
+    public function index()
+    {
         $order_model = model('order');
         $condition = array();
 
         $order_sn = input('param.order_sn');
         if ($order_sn) {
-            $condition[] = array('order_sn','=',$order_sn);
+            $condition[] = array('order_sn', '=', $order_sn);
         }
         $store_name = input('param.store_name');
         if ($store_name) {
-            $condition[] = array('store_name','=',$store_name);
+            $condition[] = array('store_name', '=', $store_name);
         }
         $order_state = input('param.order_state');
         if (in_array($order_state, array('0', '10', '20', '30', '40'))) {
-            $condition[] = array('order_state','=',$order_state);
+            $condition[] = array('order_state', '=', $order_state);
         }
         $payment_code = input('param.payment_code');
         if ($payment_code) {
-            $condition[] = array('payment_code','=',$payment_code);
+            $condition[] = array('payment_code', '=', $payment_code);
         }
         $buyer_name = input('param.buyer_name');
         if ($buyer_name) {
-            $condition[] = array('buyer_name','=',$buyer_name);
+            $condition[] = array('buyer_name', '=', $buyer_name);
         }
         $query_start_time = input('param.query_start_time');
         $query_end_time = input('param.query_end_time');
@@ -55,26 +59,26 @@ class Order extends AdminControl {
         $start_unixtime = $if_start_time ? strtotime($query_start_time) : null;
         $end_unixtime = $if_end_time ? strtotime($query_end_time) : null;
         if ($start_unixtime) {
-            $condition[] = array('add_time','>=',$start_unixtime);
+            $condition[] = array('add_time', '>=', $start_unixtime);
         }
         if ($end_unixtime) {
-            $condition[] = array('add_time','<=',$end_unixtime);
+            $condition[] = array('add_time', '<=', $end_unixtime);
         }
         $order_list = $order_model->getOrderList($condition, 10);
         View::assign('show_page', $order_model->page_info->render());
-        $order_group_list=array();
+        $order_group_list = array();
         foreach ($order_list as $order_id => $order_info) {
             //显示取消订单
             $order_list[$order_id]['if_cancel'] = $order_model->getOrderOperateState('system_cancel', $order_info);
             //显示收到货款
             $order_list[$order_id]['if_system_receive_pay'] = $order_model->getOrderOperateState('system_receive_pay', $order_info);
-            $order_group_list[$order_info['pay_sn']]['order_list'][]=$order_list[$order_id];
+            $order_group_list[$order_info['pay_sn']]['order_list'][] = $order_list[$order_id];
             //如果有在线支付且未付款的订单则显示合并付款链接
             if (!isset($order_group_list[$order_info['pay_sn']]['pay_amount'])) {
                 $order_group_list[$order_info['pay_sn']]['pay_amount'] = 0;
             }
             if ($order_info['order_state'] == ORDER_STATE_NEW || $order_info['order_state'] == ORDER_STATE_DEPOSIT || $order_info['order_state'] == ORDER_STATE_REST) {
-                $order_group_list[$order_info['pay_sn']]['pay_amount'] += ($order_info['order_state'] == ORDER_STATE_DEPOSIT?$order_info['presell_deposit_amount']:($order_info['order_amount']-$order_info['presell_deposit_amount'] + $order_info['presell_pd_amount'] + $order_info['presell_rcb_amount'])) - $order_info['pd_amount'] - $order_info['rcb_amount'];
+                $order_group_list[$order_info['pay_sn']]['pay_amount'] += ($order_info['order_state'] == ORDER_STATE_DEPOSIT ? $order_info['presell_deposit_amount'] : ($order_info['order_amount'] - $order_info['presell_deposit_amount'] + $order_info['presell_pd_amount'] + $order_info['presell_rcb_amount'])) - $order_info['pd_amount'] - $order_info['rcb_amount'];
             }
         }
         //显示支付接口列表(搜索)
@@ -90,22 +94,23 @@ class Order extends AdminControl {
      * 平台订单状态操作
      *
      */
-    public function change_state() {
+    public function change_state()
+    {
         $state_type = input('param.state_type');
         if ($state_type == 'cancel') {
-        $order_id = intval(input('param.order_id'));
-        if ($order_id <= 0) {
-            $this->error(lang('miss_order_number'));
-        }
-        $order_model = model('order');
+            $order_id = intval(input('param.order_id'));
+            if ($order_id <= 0) {
+                $this->error(lang('miss_order_number'));
+            }
+            $order_model = model('order');
+
+            //获取订单详细
+            $condition = array();
+            $condition[] = array('order_id', '=', $order_id);
+            $order_info = $order_model->getOrderInfo($condition);
+
 
-        //获取订单详细
-        $condition = array();
-        $condition[] = array('order_id','=',$order_id);
-        $order_info = $order_model->getOrderInfo($condition);
 
-        
-        
             $result = $this->_order_cancel($order_info);
             if (!$result['code']) {
                 $this->error($result['msg']);
@@ -117,7 +122,7 @@ class Order extends AdminControl {
             if (!$result['code']) {
                 $this->error($result['msg']);
             } else {
-                dsLayerOpenSuccess($result['msg'],'Order/index');
+                dsLayerOpenSuccess($result['msg'], 'Order/index');
             }
         }
     }
@@ -125,15 +130,16 @@ class Order extends AdminControl {
     /**
      * 系统取消订单
      */
-    private function _order_cancel($order_info) {
+    private function _order_cancel($order_info)
+    {
         $order_id = $order_info['order_id'];
         $order_model = model('order');
-        $logic_order = model('order','logic');
+        $logic_order = model('order', 'logic');
         $if_allow = $order_model->getOrderOperateState('system_cancel', $order_info);
         if (!$if_allow) {
             return ds_callback(false, lang('no_right_operate'));
         }
-        try{
+        try {
             Db::startTrans();
             $logic_order->changeOrderStateCancel($order_info, 'system', $this->admin_info['admin_name']);
         } catch (\Exception $e) {
@@ -149,19 +155,20 @@ class Order extends AdminControl {
      * 系统收到货款
      * @throws Exception
      */
-    private function _order_receive_pay($post) {
+    private function _order_receive_pay($post)
+    {
         $order_model = model('order');
-        $logic_order = model('order','logic');
-        $pay_sn=$post['pay_sn'];
+        $logic_order = model('order', 'logic');
+        $pay_sn = $post['pay_sn'];
         $pay_info = $order_model->getOrderpayInfo(array('pay_sn' => $pay_sn));
         if (empty($pay_info)) {
             return ds_callback(false, lang('no_right_operate'));
         }
-        
+
         //取子订单列表
         $condition = array();
-        $condition[] = array('pay_sn','=',$pay_sn);
-        $condition[]=array('order_state','in', array_values(array(ORDER_STATE_NEW, ORDER_STATE_PAY, ORDER_STATE_DEPOSIT, ORDER_STATE_REST)));
+        $condition[] = array('pay_sn', '=', $pay_sn);
+        $condition[] = array('order_state', 'in', array_values(array(ORDER_STATE_NEW, ORDER_STATE_PAY, ORDER_STATE_DEPOSIT, ORDER_STATE_REST)));
         $order_list = $order_model->getOrderList($condition, 0, 'order_id,order_state,payment_code,order_amount,rcb_amount,pd_amount,order_sn,presell_deposit_amount,presell_rcb_amount,presell_pd_amount');
         if (empty($order_list)) {
             return ds_callback(false, lang('no_right_operate'));
@@ -171,7 +178,7 @@ class Order extends AdminControl {
         //订单总支付金额(不包含货到付款)
         $pay_amount = 0;
         $order_sn_list = array();
-        foreach($order_list as $order_info){
+        foreach ($order_list as $order_info) {
             $if_allow = $order_model->getOrderOperateState('system_receive_pay', $order_info);
             if (!$if_allow) {
                 return ds_callback(false, lang('no_right_operate'));
@@ -181,12 +188,12 @@ class Order extends AdminControl {
             if ($order_info['payment_code'] != 'offline') {
                 if ($order_info['order_state'] == ORDER_STATE_NEW || $order_info['order_state'] == ORDER_STATE_REST) {
                     $pay_amount_online += ds_price_format(floatval($order_info['order_amount']) - floatval($order_info['presell_deposit_amount']) + floatval($order_info['presell_rcb_amount']) + floatval($order_info['presell_pd_amount']) - $payed_amount);
-                }else if($order_info['order_state'] == ORDER_STATE_DEPOSIT){
+                } else if ($order_info['order_state'] == ORDER_STATE_DEPOSIT) {
                     $pay_amount_online += ds_price_format(floatval($order_info['presell_deposit_amount']) - $payed_amount);
                 }
                 $pay_amount += floatval($order_info['order_amount']);
             }
-            $order_sn_list[]=$order_info['order_sn'];
+            $order_sn_list[] = $order_info['order_sn'];
         }
 
 
@@ -206,18 +213,17 @@ class Order extends AdminControl {
             echo View::fetch('receive_pay');
             exit;
         } else {
-            $order_list = $order_model->getOrderList(array(array('pay_sn' ,'=', $pay_sn), array('order_state' ,'in', [ORDER_STATE_NEW,ORDER_STATE_DEPOSIT,ORDER_STATE_REST])));
-            try{
+            $order_list = $order_model->getOrderList(array(array('pay_sn', '=', $pay_sn), array('order_state', 'in', [ORDER_STATE_NEW, ORDER_STATE_DEPOSIT, ORDER_STATE_REST])));
+            try {
                 Db::startTrans();
                 $logic_order->changeOrderReceivePay($order_list, 'system', $this->admin_info['admin_name'], $post);
             } catch (\Exception $e) {
                 Db::rollback();
                 return ds_callback(false, $e->getMessage());
             }
-            Db::commit();    
+            Db::commit();
             $this->log('将订单改为已收款状态,' . lang('ds_order_sn') . ':' . implode('`', $order_sn_list), 1);
             return ds_callback(true, lang('ds_common_op_succ'));
-
         }
     }
 
@@ -225,7 +231,8 @@ class Order extends AdminControl {
      * 查看订单
      *
      */
-    public function show_order() {
+    public function show_order()
+    {
         $order_id = intval(input('param.order_id'));
         if ($order_id <= 0) {
             $this->error(lang('miss_order_number'));
@@ -240,14 +247,14 @@ class Order extends AdminControl {
         //退款退货信息
         $refundreturn_model = model('refundreturn');
         $condition = array();
-        $condition[]=array('order_id','=',$order_info['order_id']);
-        $condition[]=array('seller_state','=',2);
-        $condition[]=array('admin_time','>', 0);
+        $condition[] = array('order_id', '=', $order_info['order_id']);
+        $condition[] = array('seller_state', '=', 2);
+        $condition[] = array('admin_time', '>', 0);
         $return_list = $refundreturn_model->getReturnList($condition);
         View::assign('return_list', $return_list);
 
         //退款信息
-        $refund_list = $refundreturn_model->getRefundList(array_merge($condition,array(array('refund_type','=',1))));
+        $refund_list = $refundreturn_model->getRefundList(array_merge($condition, array(array('refund_type', '=', 1))));
         View::assign('refund_list', $refund_list);
 
         //卖家发货信息
@@ -263,29 +270,30 @@ class Order extends AdminControl {
      * 导出
      *
      */
-    public function export_step1() {
+    public function export_step1()
+    {
 
         $order_model = model('order');
         $condition = array();
         $order_sn = input('param.order_sn');
         if ($order_sn) {
-            $condition[] = array('order_sn','=',$order_sn);
+            $condition[] = array('order_sn', '=', $order_sn);
         }
         $store_name = input('param.store_name');
         if ($store_name) {
-            $condition[] = array('store_name','=',$store_name);
+            $condition[] = array('store_name', '=', $store_name);
         }
         $order_state = input('param.order_state');
         if (in_array($order_state, array('0', '10', '20', '30', '40'))) {
-            $condition[] = array('order_state','=',$order_state);
+            $condition[] = array('order_state', '=', $order_state);
         }
         $payment_code = input('param.payment_code');
         if ($payment_code) {
-            $condition[] = array('payment_code','=',$payment_code);
+            $condition[] = array('payment_code', '=', $payment_code);
         }
         $buyer_name = input('param.buyer_name');
         if ($buyer_name) {
-            $condition[] = array('buyer_name','=',$buyer_name);
+            $condition[] = array('buyer_name', '=', $buyer_name);
         }
         $query_start_time = input('param.query_start_time');
         $query_end_time = input('param.query_end_time');
@@ -294,7 +302,7 @@ class Order extends AdminControl {
         $start_unixtime = $if_start_time ? strtotime($query_start_time) : null;
         $end_unixtime = $if_end_time ? strtotime($query_end_time) : null;
         if ($start_unixtime || $end_unixtime) {
-            $condition[] = array('add_time','between',array($start_unixtime, $end_unixtime));
+            $condition[] = array('add_time', 'between', array($start_unixtime, $end_unixtime));
         }
 
         if (!is_numeric(input('param.page'))) {
@@ -326,8 +334,9 @@ class Order extends AdminControl {
      *
      * @param array $data
      */
-    private function createExcel($data = array()) {
-        Lang::load(base_path() .'admin/lang/'.config('lang.default_lang').'/export.lang.php');
+    private function createExcel($data = array())
+    {
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/export.lang.php');
         $excel_obj = new \excel\Excel();
         $excel_data = array();
         //设置样式
@@ -365,5 +374,4 @@ class Order extends AdminControl {
         $excel_obj->addWorksheet($excel_obj->charset(lang('exp_od_order'), CHARSET));
         $excel_obj->generateXML($excel_obj->charset(lang('exp_od_order'), CHARSET) . input('param.page') . '-' . date('Y-m-d-H', TIMESTAMP));
     }
-
 }

+ 69 - 52
app/admin/controller/Ownshop.php

@@ -1,44 +1,49 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
+
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Ownshop extends AdminControl {
-    
-    public function initialize() {
+class Ownshop extends AdminControl
+{
+
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/ownshop.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/ownshop.lang.php');
     }
 
-    public function index() {
+    public function index()
+    {
         $condition = array();
-        $condition[]=array('is_platform_store' ,'=', 1);
-        
+        $condition[] = array('is_platform_store', '=', 1);
+
         $store_name = trim(input('get.store_name'));
         if (strlen($store_name) > 0) {
-            $condition[]=array('store_name','like', "%$store_name%");
+            $condition[] = array('store_name', 'like', "%$store_name%");
             View::assign('store_name', $store_name);
         }
         $ownshop_model = model('store');
-        $storeList = $ownshop_model->getStoreList($condition,10);
+        $storeList = $ownshop_model->getStoreList($condition, 10);
         View::assign('store_list', $storeList);
         View::assign('show_page', $ownshop_model->page_info->render());
         $this->setAdminCurItem('index');
         return View::fetch('ownshop_list');
     }
 
-    public function add() {
+    public function add()
+    {
         if (!request()->isPost()) {
             return View::fetch('ownshop_add');
         } else {
@@ -116,8 +121,8 @@ class Ownshop extends AdminControl {
             // 删除自营店id缓存
             model('store')->dropCachedOwnShopIds();
 
-            $this->log(lang('add_ownshop').": {$saveArray['store_name']}");
-            dsLayerOpenSuccess(lang('ds_common_op_succ'),(string)url('Ownshop/index'));
+            $this->log(lang('add_ownshop') . ": {$saveArray['store_name']}");
+            dsLayerOpenSuccess(lang('ds_common_op_succ'), (string)url('Ownshop/index'));
         }
     }
 
@@ -148,7 +153,8 @@ class Ownshop extends AdminControl {
     }
      */
 
-    public function edit() {
+    public function edit()
+    {
         $store_model = model('store');
         $store_id = intval(input('param.id'));
         $storeArray = $store_model->getStoreInfoByID($store_id);
@@ -167,7 +173,7 @@ class Ownshop extends AdminControl {
 
             View::assign('class_list', $parent_list);
             return View::fetch('ownshop_edit');
-        }else {
+        } else {
 
             $saveArray = array();
             $saveArray['storeclass_id'] = intval(input('post.storeclass_id'));
@@ -178,26 +184,27 @@ class Ownshop extends AdminControl {
 
             $goods_model = model('goods');
             $condition = array();
-            $condition[] = array('store_id','=',$store_id);
+            $condition[] = array('store_id', '=', $store_id);
             $goods_model->editProducesOffline($condition);
             $store_model->editStore($saveArray, $condition);
-            if($storeArray['store_name']!=$saveArray['store_name']){
+            if ($storeArray['store_name'] != $saveArray['store_name']) {
                 $goods_model = model('goods');
-                $goods_model->editGoodsCommon(array('store_name'=>$saveArray['store_name']), array('store_id'=>$store_id));
-                $goods_model->editGoods(array('store_name'=>$saveArray['store_name']), array('store_id'=>$store_id));
+                $goods_model->editGoodsCommon(array('store_name' => $saveArray['store_name']), array('store_id' => $store_id));
+                $goods_model->editGoods(array('store_name' => $saveArray['store_name']), array('store_id' => $store_id));
             }
             // 删除自营店id缓存
             model('store')->dropCachedOwnShopIds();
 
-            $this->log(lang('edit_ownshop').": {$saveArray['store_name']}");
-            dsLayerOpenSuccess(lang('ds_common_op_succ'),(string)url('Ownshop/index'));
+            $this->log(lang('edit_ownshop') . ": {$saveArray['store_name']}");
+            dsLayerOpenSuccess(lang('ds_common_op_succ'), (string)url('Ownshop/index'));
         }
     }
 
     /**
      * 编辑保存注册信息
      */
-    public function storejoinin_edit() {
+    public function storejoinin_edit()
+    {
         if (request()->isPost()) {
             $member_id = input('post.member_id');
             if ($member_id <= 0) {
@@ -249,7 +256,7 @@ class Ownshop extends AdminControl {
             } else {
                 $this->error(lang('ds_common_op_fail'));
             }
-        }else{
+        } else {
             $store_model = model('store');
             $store_id = intval(input('param.id'));
             $storeArray = $store_model->getStoreInfoByID($store_id);
@@ -259,16 +266,18 @@ class Ownshop extends AdminControl {
             return View::fetch('storejoinin_edit');
         }
     }
-    public function check_seller_name() {
+    public function check_seller_name()
+    {
         $seller_name = input('get.seller_name');
         echo json_encode($this->checkSellerName($seller_name));
         exit;
     }
 
-    private function checkSellerName($sellerName) {
+    private function checkSellerName($sellerName)
+    {
         // 判断store_joinin是否存在记录
         $count = (int) model('storejoinin')->getStorejoininCount(array(
-                    'seller_name' => $sellerName,
+            'seller_name' => $sellerName,
         ));
         if ($count > 0) {
             return FALSE;
@@ -282,26 +291,29 @@ class Ownshop extends AdminControl {
         return TRUE;
     }
 
-    public function check_member_name() {
+    public function check_member_name()
+    {
         $member_name = input('get.member_name');
         echo json_encode($this->checkMemberName($member_name));
         exit;
     }
 
-    private function checkMemberName($member_name) {
+    private function checkMemberName($member_name)
+    {
         // 判断store_joinin是否存在记录
         $count = (int) model('storejoinin')->getStorejoininCount(array(
-                    'member_name' => $member_name,
+            'member_name' => $member_name,
         ));
         if ($count > 0)
             return false;
 
         return !model('member')->getMemberCount(array(
-                    'member_name' => $member_name,
+            'member_name' => $member_name,
         ));
     }
 
-    public function bind_class() {
+    public function bind_class()
+    {
         $store_id = intval(input('param.id'));
 
         $store_model = model('store');
@@ -335,7 +347,8 @@ class Ownshop extends AdminControl {
     /**
      * 添加经营类目
      */
-    public function bind_class_add() {
+    public function bind_class_add()
+    {
         $store_id = intval(input('post.store_id'));
         $commis_rate = intval(input('post.commis_rate'));
         if ($commis_rate < 0 || $commis_rate > 100) {
@@ -405,7 +418,8 @@ class Ownshop extends AdminControl {
         }
     }
 
-    private function _add_bind_class($param) {
+    private function _add_bind_class($param)
+    {
         $storebindclass_model = model('storebindclass');
         // 检查类目是否已经存在
         $store_bind_class_info = $storebindclass_model->getStorebindclassInfo($param);
@@ -417,14 +431,15 @@ class Ownshop extends AdminControl {
     /**
      * 删除经营类目
      */
-    public function bind_class_del() {
+    public function bind_class_del()
+    {
         $bid = input('param.bid');
         $bid_array = ds_delete_param($bid);
         if ($bid_array == FALSE) {
             ds_json_encode('10001', lang('param_error'));
         }
         $storebindclass_model = model('storebindclass');
-        
+
         foreach ($bid_array as $key => $bid) {
             $store_bind_class_info = $storebindclass_model->getStorebindclassInfo(array('storebindclass_id' => $bid));
             if (empty($store_bind_class_info)) {
@@ -453,11 +468,11 @@ class Ownshop extends AdminControl {
             $this->log('删除自营店铺经营类目,类目编号:' . $bid . ',店铺编号:' . $store_bind_class_info['store_id']);
         }
         ds_json_encode('10000', lang('ds_common_del_succ'));
-        
     }
 
 
-    public function bind_class_update() {
+    public function bind_class_update()
+    {
         $bid = intval(input('param.id'));
         if ($bid <= 0) {
             echo json_encode(array('result' => FALSE, 'message' => lang('param_error')));
@@ -489,17 +504,18 @@ class Ownshop extends AdminControl {
     /**
      * 验证店铺名称是否存在
      */
-    public function ckeck_store_name() {
+    public function ckeck_store_name()
+    {
         $store_name = trim(input('get.store_name'));
         if (empty($store_name)) {
             echo 'false';
             exit;
         }
         $where = array();
-        $where[]=array('store_name','=',$store_name);
+        $where[] = array('store_name', '=', $store_name);
         $store_id = input('get.store_id');
         if (isset($store_id)) {
-            $where[]=array('store_id','<>', $store_id);
+            $where[] = array('store_id', '<>', $store_id);
         }
         $store_info = model('store')->getStoreInfo($where);
         if (!empty($store_info['store_name'])) {
@@ -509,17 +525,18 @@ class Ownshop extends AdminControl {
         }
     }
     //ajax操作
-    public function ajax() {
+    public function ajax()
+    {
         $store_model = model('store');
         switch (input('param.branch')) {
-            /**
+                /**
              * 品牌名称
              */
             case 'store_sort':
                 $id = intval(input('param.id'));
-                $result = $store_model->editStore(array('store_sort'=>trim(input('param.value'))), array('store_id' => $id));
-                if($result){
-                    $this->log(lang('ds_edit').'自营店铺' . '[' . $id . ']', 1);
+                $result = $store_model->editStore(array('store_sort' => trim(input('param.value'))), array('store_id' => $id));
+                if ($result) {
+                    $this->log(lang('ds_edit') . '自营店铺' . '[' . $id . ']', 1);
                 }
                 echo 'true';
                 exit;
@@ -529,7 +546,8 @@ class Ownshop extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -538,7 +556,7 @@ class Ownshop extends AdminControl {
             ), array(
                 'name' => 'add',
                 'text' => lang('ds_new'),
-                'url' => "javascript:dsLayerOpen('".(string)url('Ownshop/add')."','".lang('ds_new')."')"
+                'url' => "javascript:dsLayerOpen('" . (string)url('Ownshop/add') . "','" . lang('ds_new') . "')"
             )
         );
         if (request()->action() == 'bind_class') {
@@ -550,5 +568,4 @@ class Ownshop extends AdminControl {
         }
         return $menu_array;
     }
-
 }

+ 19 - 16
app/admin/controller/Payment.php

@@ -6,19 +6,20 @@ use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Payment extends AdminControl {
+class Payment extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/payment.lang.php');
     }
@@ -26,7 +27,8 @@ class Payment extends AdminControl {
     /**
      * 支付方式
      */
-    public function index() {
+    public function index()
+    {
         $payment_model = model('payment');
         //获取数据库中已安装的支付方式
         $install_payment_list = $payment_model->getPaymentList(array(array('payment_code', '<>', 'predeposit')));
@@ -63,7 +65,8 @@ class Payment extends AdminControl {
     /**
      * 安装支付方式
      */
-    function install() {
+    function install()
+    {
         $payment_code = input('param.payment_code');
         $payment_mod = model('payment');
         //如果是小程序支付、微信JS支付、微信H5支付、微信APP支付则必须先开启微信扫码支付
@@ -104,7 +107,8 @@ class Payment extends AdminControl {
     /**
      * 编辑
      */
-    public function edit() {
+    public function edit()
+    {
         $payment_model = model('payment');
         $payment_code = trim(input('param.payment_code'));
         $install_payment = $payment_model->getPaymentInfo(array('payment_code' => $payment_code));
@@ -161,7 +165,7 @@ class Payment extends AdminControl {
                         config($file_config, 'filesystem');
                         try {
                             validate(['image' => 'fileSize:' . ALLOW_IMG_SIZE . '|fileExt:pfx'])
-                                    ->check(['image' => $file]);
+                                ->check(['image' => $file]);
                             $file_name = \think\facade\Filesystem::putFile('', $file);
                             $cfg_value2 = $file_name;
                         } catch (\Exception $e) {
@@ -180,7 +184,8 @@ class Payment extends AdminControl {
     /**
      * 删除支付方式,卸载
      */
-    public function del() {
+    public function del()
+    {
         $payment_model = model('payment');
         $payment_code = trim(input('param.payment_code'));
         $condition = array();
@@ -196,7 +201,8 @@ class Payment extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index_pc',
@@ -216,7 +222,4 @@ class Payment extends AdminControl {
         );
         return $menu_array;
     }
-
 }
-
-?>

+ 30 - 23
app/admin/controller/Pointorder.php

@@ -1,31 +1,34 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Pointorder extends AdminControl {
+class Pointorder extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/pointorder.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/pointorder.lang.php');
     }
 
     /**
      * 积分兑换列表
      */
-    public function pointorder_list() {
+    public function pointorder_list()
+    {
         $pointorder_model = model('pointorder');
         //获取兑换订单状态
         $pointorderstate_arr = $pointorder_model->getPointorderStateBySign();
@@ -33,16 +36,16 @@ class Pointorder extends AdminControl {
         //兑换单号
         $pordersn = trim(input('param.pordersn'));
         if ($pordersn) {
-            $where[]=array('point_ordersn','like', "%{$pordersn}%");
+            $where[] = array('point_ordersn', 'like', "%{$pordersn}%");
         }
         //兑换会员名称
         $pbuyname = trim(input('param.pbuyname'));
         if (trim(input('param.pbuyname'))) {
-            $where[]=array('point_buyername','like', "%{$pbuyname}%");
+            $where[] = array('point_buyername', 'like', "%{$pbuyname}%");
         }
         //订单状态
         if (trim(input('param.porderstate'))) {
-            $where[]=array('point_orderstate','=',$pointorderstate_arr[input('param.porderstate')][0]);
+            $where[] = array('point_orderstate', '=', $pointorderstate_arr[input('param.porderstate')][0]);
         }
         //查询兑换订单列表
         $order_list = $pointorder_model->getPointorderList($where, '*', 10, 0, 'point_orderid desc');
@@ -58,7 +61,8 @@ class Pointorder extends AdminControl {
     /**
      * 删除兑换订单信息
      */
-    public function order_drop() {
+    public function order_drop()
+    {
         $data = model('pointorder')->delPointorderByOrderID(input('param.order_id'));
         if ($data['state']) {
             ds_json_encode(10000, lang('admin_pointorder_del_success'));
@@ -70,7 +74,8 @@ class Pointorder extends AdminControl {
     /**
      * 取消兑换
      */
-    public function order_cancel() {
+    public function order_cancel()
+    {
         $pointorder_model = model('pointorder');
         //取消订单
         $data = $pointorder_model->cancelPointorder(input('param.id'));
@@ -84,10 +89,11 @@ class Pointorder extends AdminControl {
     /**
      * 发货
      */
-    public function order_ship() {
+    public function order_ship()
+    {
         $order_id = intval(input('param.id'));
         if ($order_id <= 0) {
-            $this->error(lang('admin_pointorder_parameter_error'),(string)url('Pointorder/pointorder_list'));
+            $this->error(lang('admin_pointorder_parameter_error'), (string)url('Pointorder/pointorder_list'));
         }
         $pointorder_model = model('pointorder');
         //获取订单状态
@@ -95,11 +101,11 @@ class Pointorder extends AdminControl {
 
         //查询订单信息
         $where = array();
-        $where[]=array('point_orderid','=',$order_id);
-        $where[]=array('point_orderstate','in', array($pointorderstate_arr['waitship'][0], $pointorderstate_arr['waitreceiving'][0])); //待发货和已经发货状态
+        $where[] = array('point_orderid', '=', $order_id);
+        $where[] = array('point_orderstate', 'in', array($pointorderstate_arr['waitship'][0], $pointorderstate_arr['waitreceiving'][0])); //待发货和已经发货状态
         $order_info = $pointorder_model->getPointorderInfo($where);
         if (!$order_info) {
-            $this->error(lang('admin_pointorderd_record_error'),(string)url('Pointorder/pointorder_list'));
+            $this->error(lang('admin_pointorderd_record_error'), (string)url('Pointorder/pointorder_list'));
         }
         if (request()->isPost()) {
             $data = [
@@ -115,7 +121,7 @@ class Pointorder extends AdminControl {
             if ($data['state']) {
                 dsLayerOpenSuccess(lang('ds_common_op_succ'));
             } else {
-                $this->error($data['msg'],(string)url('Pointorder/pointorder_list'));
+                $this->error($data['msg'], (string)url('Pointorder/pointorder_list'));
             }
         } else {
             $express_list = model('express')->getExpressList();
@@ -128,7 +134,8 @@ class Pointorder extends AdminControl {
     /**
      * 兑换信息详细
      */
-    public function order_info() {
+    public function order_info()
+    {
         $order_id = intval(input('param.order_id'));
         if ($order_id <= 0) {
             $this->error(lang('admin_pointorder_parameter_error'));
@@ -163,7 +170,8 @@ class Pointorder extends AdminControl {
         return View::fetch();
     }
 
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'pointorder_list', 'text' => lang('admin_pointorder_list_title'), 'url' => (string)url('Pointorder/pointorder_list')
@@ -171,5 +179,4 @@ class Pointorder extends AdminControl {
         );
         return $menu_array;
     }
-
 }

+ 27 - 19
app/admin/controller/Pointprod.php

@@ -6,19 +6,20 @@ use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Pointprod extends AdminControl {
+class Pointprod extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize(); // TODO: Change the autogenerated stub
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/pointprod.lang.php');
     }
@@ -26,7 +27,8 @@ class Pointprod extends AdminControl {
     /**
      * 积分礼品列表
      */
-    public function index() {
+    public function index()
+    {
         $pointprod_model = model('pointprod');
 
         //获得兑换商品的上下架状态
@@ -62,7 +64,8 @@ class Pointprod extends AdminControl {
     /**
      * 积分礼品添加
      */
-    public function prod_add() {
+    public function prod_add()
+    {
         $hourarr = array(
             '00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17',
             '18', '19', '20', '21', '22', '23'
@@ -162,7 +165,7 @@ class Pointprod extends AdminControl {
                     $insert_array = array();
                     $insert_array['file_name'] = $file_name;
                     $insert_array['upload_type'] = 5;
-                    $insert_array['file_size'] = (config('ds_config.upload_type')=='alioss')?0:filesize($upload_file . DIRECTORY_SEPARATOR . $file_name);
+                    $insert_array['file_size'] = (config('ds_config.upload_type') == 'alioss') ? 0 : filesize($upload_file . DIRECTORY_SEPARATOR . $file_name);
                     $insert_array['item_id'] = $state;
                     $insert_array['upload_time'] = TIMESTAMP;
                     $upload_model->addUpload($insert_array);
@@ -206,7 +209,8 @@ class Pointprod extends AdminControl {
     /**
      * 积分礼品编辑
      */
-    public function prod_edit() {
+    public function prod_edit()
+    {
         $hourarr = array(
             '00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17',
             '18', '19', '20', '21', '22', '23'
@@ -331,7 +335,7 @@ class Pointprod extends AdminControl {
                     $insert_array = array();
                     $insert_array['file_name'] = $file_name;
                     $insert_array['upload_type'] = 5;
-                    $insert_array['file_size'] = (config('ds_config.upload_type')=='alioss')?0:filesize($upload_file . DIRECTORY_SEPARATOR . $file_name);
+                    $insert_array['file_size'] = (config('ds_config.upload_type') == 'alioss') ? 0 : filesize($upload_file . DIRECTORY_SEPARATOR . $file_name);
                     $insert_array['item_id'] = $prod_info['pgoods_id'];
                     $insert_array['upload_time'] = TIMESTAMP;
                     $upload_model->addUpload($insert_array);
@@ -374,7 +378,8 @@ class Pointprod extends AdminControl {
     /**
      * 删除积分礼品
      */
-    public function prod_drop() {
+    public function prod_drop()
+    {
         $pg_id = input('param.pg_id');
         $pg_id_array = ds_delete_param($pg_id);
         if ($pg_id_array === FALSE) {
@@ -393,7 +398,8 @@ class Pointprod extends AdminControl {
     /**
      * 积分礼品异步状态修改
      */
-    public function ajax() {
+    public function ajax()
+    {
         //礼品上架,礼品推荐,礼品禁售
         $id = intval(input('param.id'));
         if ($id <= 0) {
@@ -411,7 +417,8 @@ class Pointprod extends AdminControl {
     /**
      * 积分礼品上传
      */
-    public function pointprod_pic_upload() {
+    public function pointprod_pic_upload()
+    {
         /**
          * 上传图片
          */
@@ -448,7 +455,7 @@ class Pointprod extends AdminControl {
             $data = array();
             $data['file_id'] = $result;
             $data['file_name'] = $file_name;
-            $data['file_path'] = ds_get_pic( ATTACH_POINTPROD , $file_name);
+            $data['file_path'] = ds_get_pic(ATTACH_POINTPROD, $file_name);
             /**
              * 整理为json格式
              */
@@ -460,7 +467,8 @@ class Pointprod extends AdminControl {
     /**
      * ajax操作删除已上传图片
      */
-    public function ajaxdelupload() {
+    public function ajaxdelupload()
+    {
         //删除文章图片
         if (intval(input('param.file_id')) > 0) {
             $upload_model = model('upload');
@@ -483,7 +491,8 @@ class Pointprod extends AdminControl {
         }
     }
 
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index', 'text' => lang('admin_pointprod_list_title'), 'url' => (string) url('Pointprod/index')
@@ -499,5 +508,4 @@ class Pointprod extends AdminControl {
 
         return $menu_array;
     }
-
 }

+ 46 - 38
app/admin/controller/Points.php

@@ -5,41 +5,44 @@
  */
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Points extends AdminControl {
+class Points extends AdminControl
+{
     const EXPORT_SIZE = 5000;
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/points.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/points.lang.php');
     }
 
-    public function index() {
+    public function index()
+    {
         if (!request()->isPost()) {
             $condition_arr = array();
             $mname = input('param.mname');
             if (!empty($mname)) {
-                $condition_arr[] = array('pl_membername','like', '%' . $mname . '%');
+                $condition_arr[] = array('pl_membername', 'like', '%' . $mname . '%');
             }
             $aname = input('param.aname');
             if (!empty($aname)) {
-                $condition_arr[] = array('pl_adminname','like', '%' . $aname . '%');
+                $condition_arr[] = array('pl_adminname', 'like', '%' . $aname . '%');
             }
             $stage = input('get.stage');
             if ($stage) {
-                $condition_arr[]=array('pl_stage','=',trim($stage));
+                $condition_arr[] = array('pl_stage', '=', trim($stage));
             }
             $stime = input('get.stime');
             $etime = input('get.etime');
@@ -48,16 +51,16 @@ class Points extends AdminControl {
             $start_unixtime = $if_start_time ? strtotime($stime) : null;
             $end_unixtime = $if_end_time ? strtotime($etime) : null;
             if ($start_unixtime) {
-                $condition_arr[] = array('pl_addtime','>=', $start_unixtime);
+                $condition_arr[] = array('pl_addtime', '>=', $start_unixtime);
             }
             if ($end_unixtime) {
-                $end_unixtime=$end_unixtime+86399;
-                $condition_arr[] = array('pl_addtime','<=', $end_unixtime);
+                $end_unixtime = $end_unixtime + 86399;
+                $condition_arr[] = array('pl_addtime', '<=', $end_unixtime);
             }
-            
+
             $search_desc = trim(input('param.description'));
             if (!empty($search_desc)) {
-                $condition_arr[] = array('pl_desc','like', "%" . $search_desc . "%");
+                $condition_arr[] = array('pl_desc', 'like', "%" . $search_desc . "%");
             }
 
 
@@ -72,7 +75,8 @@ class Points extends AdminControl {
     }
 
     //积分规则设置
-    function setting(){
+    function setting()
+    {
         $config_model = model('config');
         if (request()->isPost()) {
             $update_array = array();
@@ -97,9 +101,10 @@ class Points extends AdminControl {
             return View::fetch('setting');
         }
     }
-    
+
     //积分明细查询
-    function pointslog() {
+    function pointslog()
+    {
         if (!request()->isPost()) {
             return View::fetch();
         } else {
@@ -142,7 +147,8 @@ class Points extends AdminControl {
         }
     }
 
-    public function checkmember() {
+    public function checkmember()
+    {
         $name = trim(input('param.name'));
         if (!$name) {
             exit(json_encode(array('id' => 0)));
@@ -157,24 +163,25 @@ class Points extends AdminControl {
     }
 
 
-	/**
+    /**
      * 积分日志列表导出
      */
-    public function export_step1() {
+    public function export_step1()
+    {
         $condition_arr = array();
-        
+
         $mname = input('param.mname');
         if (!empty($mname)) {
-            $condition_arr[] = array('pl_membername','like', '%' . $mname . '%');
+            $condition_arr[] = array('pl_membername', 'like', '%' . $mname . '%');
         }
         $aname = input('param.aname');
         if (!empty($aname)) {
-            $condition_arr[] = array('pl_adminname','like', '%' . $aname . '%');
+            $condition_arr[] = array('pl_adminname', 'like', '%' . $aname . '%');
         }
-        
+
         $stage = input('get.stage');
         if ($stage) {
-            $condition_arr[]=array('pl_stage','=',trim($stage));
+            $condition_arr[] = array('pl_stage', '=', trim($stage));
         }
         $stime = input('get.stime');
         $etime = input('get.etime');
@@ -183,16 +190,16 @@ class Points extends AdminControl {
         $start_unixtime = $if_start_time ? strtotime($stime) : null;
         $end_unixtime = $if_end_time ? strtotime($etime) : null;
         if ($start_unixtime || $end_unixtime) {
-            $condition_arr[] = array('pl_addtime','between', array($start_unixtime, $end_unixtime));
+            $condition_arr[] = array('pl_addtime', 'between', array($start_unixtime, $end_unixtime));
         }
         $search_desc = trim(input('param.description'));
         if (!empty($search_desc)) {
-            $condition_arr[] = array('pl_desc','like', "%" . $search_desc . "%");
+            $condition_arr[] = array('pl_desc', 'like', "%" . $search_desc . "%");
         }
-        
-        
+
+
         $points_model = model('points');
-        
+
         if (!is_numeric(input('param.page'))) {
             $count = $points_model->getPointsCount($condition_arr);
             $array = array();
@@ -222,8 +229,9 @@ class Points extends AdminControl {
      *
      * @param array $data
      */
-    private function createExcel($data = array()) {
-        Lang::load(base_path() .'admin/lang/'.config('lang.default_lang').'/export.lang.php');
+    private function createExcel($data = array())
+    {
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/export.lang.php');
         $excel_obj = new \excel\Excel();
         $excel_data = array();
         //设置样式
@@ -253,7 +261,8 @@ class Points extends AdminControl {
         $excel_obj->generateXML($excel_obj->charset(lang('exp_pi_jfmx'), CHARSET) . input('param.page') . '-' . date('Y-m-d-H', TIMESTAMP));
     }
 
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -263,7 +272,7 @@ class Points extends AdminControl {
             array(
                 'name' => 'pointslog',
                 'text' => lang('pointslog'),
-                'url' => "javascript:dsLayerOpen('".(string)url('Points/pointslog')."','".lang('pointslog')."')"
+                'url' => "javascript:dsLayerOpen('" . (string)url('Points/pointslog') . "','" . lang('pointslog') . "')"
             ),
             array(
                 'name' => 'setting',
@@ -273,5 +282,4 @@ class Points extends AdminControl {
         );
         return $menu_array;
     }
-
 }

+ 139 - 120
app/admin/controller/Predeposit.php

@@ -1,58 +1,61 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 use think\facade\Db;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Predeposit extends AdminControl {
+class Predeposit extends AdminControl
+{
     const EXPORT_SIZE = 1000;
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/predeposit.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/predeposit.lang.php');
     }
 
     /*
      * 充值明细
      */
 
-    public function pdrecharge_list() {
+    public function pdrecharge_list()
+    {
         $condition = array();
         $if_start_date = preg_match('/^20\d{2}-\d{2}-\d{2}$/', input('param.query_start_date'));
         $if_end_date = preg_match('/^20\d{2}-\d{2}-\d{2}$/', input('param.query_end_date'));
         $start_unixtime = $if_start_date ? strtotime(input('param.query_start_date')) : null;
         $end_unixtime = $if_end_date ? strtotime(input('param.query_end_date')) : null;
         if ($start_unixtime) {
-            $condition[]=array('pdr_addtime','>=', $start_unixtime);
+            $condition[] = array('pdr_addtime', '>=', $start_unixtime);
         }
         if ($end_unixtime) {
-            $end_unixtime=$end_unixtime+86399;
-            $condition[]=array('pdr_addtime','<=', $end_unixtime);
+            $end_unixtime = $end_unixtime + 86399;
+            $condition[] = array('pdr_addtime', '<=', $end_unixtime);
         }
         if (input('param.mname') != '') {
-            $condition[]=array('pdr_member_name','like', "%" . input('param.mname') . "%");
+            $condition[] = array('pdr_member_name', 'like', "%" . input('param.mname') . "%");
         }
         if (input('param.paystate_search') != '') {
-            $condition[]=array('pdr_payment_state','=',input('param.paystate_search'));
+            $condition[] = array('pdr_payment_state', '=', input('param.paystate_search'));
         }
         $predeposit_model = model('predeposit');
         $recharge_list = $predeposit_model->getPdRechargeList($condition, 20, '*', 'pdr_id desc');
         View::assign('recharge_list', $recharge_list);
         View::assign('show_page', $predeposit_model->page_info->render());
-        
+
         View::assign('filtered', $condition ? 1 : 0); //是否有查询条件
-        
+
         $this->setAdminCurItem('pdrecharge_list');
         return View::fetch();
     }
@@ -60,7 +63,8 @@ class Predeposit extends AdminControl {
     /**
      * 充值编辑(更改成收到款)
      */
-    public function recharge_edit() {
+    public function recharge_edit()
+    {
         $id = intval(input('param.id'));
         if ($id <= 0) {
             $this->error(lang('admin_predeposit_parameter_error'), 'Predeposit/pdrecharge_list');
@@ -68,8 +72,8 @@ class Predeposit extends AdminControl {
         //查询充值信息
         $predeposit_model = model('predeposit');
         $condition = array();
-        $condition[] = array('pdr_id','=',$id);
-        $condition[] = array('pdr_payment_state','=',0);
+        $condition[] = array('pdr_id', '=', $id);
+        $condition[] = array('pdr_payment_state', '=', 0);
         $info = $predeposit_model->getPdRechargeInfo($condition);
         if (empty($info)) {
             $this->error(lang('admin_predeposit_record_error'), 'Predeposit/pdrecharge_list');
@@ -91,15 +95,15 @@ class Predeposit extends AdminControl {
         //取支付方式信息
         $payment_model = model('payment');
         $condition = array();
-        $condition[]=array('payment_code','=',input('post.payment_code'));
+        $condition[] = array('payment_code', '=', input('post.payment_code'));
         $payment_info = $payment_model->getPaymentOpenInfo($condition);
         if (!$payment_info || $payment_info['payment_code'] == 'offline' || $payment_info['payment_code'] == 'offline') {
             $this->error(lang('payment_index_sys_not_support'));
         }
 
         $condition = array();
-        $condition[] = array('pdr_sn','=',$info['pdr_sn']);
-        $condition[] = array('pdr_payment_state','=',0);
+        $condition[] = array('pdr_sn', '=', $info['pdr_sn']);
+        $condition[] = array('pdr_payment_state', '=', 0);
         $update = array();
         $update['pdr_payment_state'] = 1;
         $update['pdr_paymenttime'] = strtotime(input('post.payment_time'));
@@ -136,7 +140,8 @@ class Predeposit extends AdminControl {
     /**
      * 充值查看
      */
-    public function recharge_info() {
+    public function recharge_info()
+    {
         $id = intval(input('param.id'));
         if ($id <= 0) {
             $this->error(lang('admin_predeposit_parameter_error'), 'Predeposit/pdrecharge_list');
@@ -144,7 +149,7 @@ class Predeposit extends AdminControl {
         //查询充值信息
         $predeposit_model = model('predeposit');
         $condition = array();
-        $condition[] = array('pdr_id','=',$id);
+        $condition[] = array('pdr_id', '=', $id);
         $info = $predeposit_model->getPdRechargeInfo($condition);
         if (empty($info)) {
             $this->error(lang('admin_predeposit_record_error'), 'Predeposit/pdrecharge_list');
@@ -156,16 +161,17 @@ class Predeposit extends AdminControl {
     /**
      * 充值删除
      */
-    public function recharge_del() {
+    public function recharge_del()
+    {
         $pdr_id = input('param.pdr_id');
         $pdr_id_array = ds_delete_param($pdr_id);
-        if($pdr_id_array === FALSE){
+        if ($pdr_id_array === FALSE) {
             ds_json_encode('10001', lang('param_error'));
         }
         $predeposit_model = model('predeposit');
         $condition = array();
-        $condition[] = array('pdr_id','in', $pdr_id_array);
-        $condition[] = array('pdr_payment_state','=',0);
+        $condition[] = array('pdr_id', 'in', $pdr_id_array);
+        $condition[] = array('pdr_payment_state', '=', 0);
         $result = $predeposit_model->delPdRecharge($condition);
         if ($result) {
             ds_json_encode('10000', lang('ds_common_del_succ'));
@@ -180,7 +186,8 @@ class Predeposit extends AdminControl {
      * 预存款明细
      */
 
-    public function pdlog_list() {
+    public function pdlog_list()
+    {
         $condition = array();
         $stime = input('get.stime');
         $etime = input('get.etime');
@@ -189,27 +196,27 @@ class Predeposit extends AdminControl {
         $start_unixtime = $if_start_date ? strtotime($stime) : null;
         $end_unixtime = $if_end_date ? strtotime($etime) : null;
         if ($start_unixtime) {
-            $condition[]=array('lg_addtime','>=', $start_unixtime);
+            $condition[] = array('lg_addtime', '>=', $start_unixtime);
         }
         if ($end_unixtime) {
-            $end_unixtime=$end_unixtime+86399;
-            $condition[]=array('lg_addtime','<=', $end_unixtime);
+            $end_unixtime = $end_unixtime + 86399;
+            $condition[] = array('lg_addtime', '<=', $end_unixtime);
         }
         $mname = input('get.mname');
         if (!empty($mname)) {
-            $condition[] = array('lg_member_name','=',$mname);
+            $condition[] = array('lg_member_name', '=', $mname);
         }
         $aname = input('get.aname');
         if (!empty($aname)) {
-            $condition[] = array('lg_admin_name','=',$aname);
+            $condition[] = array('lg_admin_name', '=', $aname);
         }
         $predeposit_model = model('predeposit');
         $list_log = $predeposit_model->getPdLogList($condition, 10, '*', 'lg_id desc');
         View::assign('show_page', $predeposit_model->page_info->render());
         View::assign('list_log', $list_log);
-        
+
         View::assign('filtered', $condition ? 1 : 0); //是否有查询条件
-        
+
         $this->setAdminCurItem('pdlog_list');
         return View::fetch();
     }
@@ -217,32 +224,34 @@ class Predeposit extends AdminControl {
     /*
      * 提现设置
      */
-    public function pdcash_set(){
+    public function pdcash_set()
+    {
         $config_model = model('config');
-        if(!request()->isPost()){
+        if (!request()->isPost()) {
             $list_setting = rkcache('config', true);
-            View::assign('list_setting',$list_setting);
+            View::assign('list_setting', $list_setting);
             $this->setAdminCurItem('pdcash_set');
             return View::fetch();
-        }else{
-            $update_array=array(
-                'member_withdraw_min'=>abs(round(input('post.member_withdraw_min'),2)),
-                'member_withdraw_max'=>abs(round(input('post.member_withdraw_max'),2)),
-                'member_withdraw_cycle'=>abs(intval(input('post.member_withdraw_cycle'))),
+        } else {
+            $update_array = array(
+                'member_withdraw_min' => abs(round(input('post.member_withdraw_min'), 2)),
+                'member_withdraw_max' => abs(round(input('post.member_withdraw_max'), 2)),
+                'member_withdraw_cycle' => abs(intval(input('post.member_withdraw_cycle'))),
             );
             $result = $config_model->editConfig($update_array);
             if ($result) {
-                $this->log(lang('ds_update').lang('admin_predeposit_cashset'),1);
+                $this->log(lang('ds_update') . lang('admin_predeposit_cashset'), 1);
                 $this->success(lang('ds_common_op_succ'), 'Predeposit/pdcash_set');
-            }else{
-                $this->log(lang('ds_update').lang('admin_predeposit_cashset'),0);
+            } else {
+                $this->log(lang('ds_update') . lang('admin_predeposit_cashset'), 0);
             }
         }
     }
     /*
      * 提现列表
      */
-    public function pdcash_list() {
+    public function pdcash_list()
+    {
         $condition = array();
         $stime = input('get.stime');
         $etime = input('get.etime');
@@ -251,31 +260,31 @@ class Predeposit extends AdminControl {
         $start_unixtime = $if_start_date ? strtotime($stime) : null;
         $end_unixtime = $if_end_date ? strtotime($etime) : null;
         if ($start_unixtime) {
-            $condition[]=array('pdc_addtime','>=', $start_unixtime);
+            $condition[] = array('pdc_addtime', '>=', $start_unixtime);
         }
         if ($end_unixtime) {
-            $end_unixtime=$end_unixtime+86399;
-            $condition[]=array('pdc_addtime','<=', $end_unixtime);
+            $end_unixtime = $end_unixtime + 86399;
+            $condition[] = array('pdc_addtime', '<=', $end_unixtime);
         }
         $mname = input('get.mname');
         if (!empty($mname)) {
-            $condition[]=array('pdc_member_name','like', "%" . $mname . "%");
+            $condition[] = array('pdc_member_name', 'like', "%" . $mname . "%");
         }
         $pdc_bank_user = input('get.pdc_bank_user');
         if (!empty($pdc_bank_user)) {
-            $condition[]=array('pdc_bank_user','like', "%" . $pdc_bank_user . "%");
+            $condition[] = array('pdc_bank_user', 'like', "%" . $pdc_bank_user . "%");
         }
         $paystate_search = input('get.paystate_search');
         if ($paystate_search != '') {
-            $condition[]=array('pdc_payment_state','=',$paystate_search);
+            $condition[] = array('pdc_payment_state', '=', $paystate_search);
         }
         $predeposit_model = model('predeposit');
         $predeposit_list = $predeposit_model->getPdcashList($condition, 20, '*', 'pdc_payment_state asc,pdc_id asc');
         View::assign('predeposit_list', $predeposit_list);
         View::assign('show_page', $predeposit_model->page_info->render());
-        
+
         View::assign('filtered', $condition ? 1 : 0); //是否有查询条件
-        
+
         $this->setAdminCurItem('pdcash_list');
         return View::fetch('pdcash_list');
     }
@@ -283,15 +292,16 @@ class Predeposit extends AdminControl {
     /**
      * 删除提现记录
      */
-    public function pdcash_del() {
+    public function pdcash_del()
+    {
         $pdc_id = intval(input('param.pdc_id'));
         if ($pdc_id <= 0) {
-             ds_json_encode(10001, lang('param_error'));
+            ds_json_encode(10001, lang('param_error'));
         }
         $predeposit_model = model('predeposit');
         $condition = array();
-        $condition[] = array('pdc_id','=',$pdc_id);
-        $condition[] = array('pdc_payment_state','=',0);
+        $condition[] = array('pdc_id', '=', $pdc_id);
+        $condition[] = array('pdc_payment_state', '=', 0);
         $info = $predeposit_model->getPdcashInfo($condition);
         if (!$info) {
             ds_json_encode(10001, lang('admin_predeposit_parameter_error'));
@@ -324,15 +334,16 @@ class Predeposit extends AdminControl {
     /**
      * 更改提现为支付状态
      */
-    public function pdcash_pay() {
+    public function pdcash_pay()
+    {
         $id = intval(input('param.id'));
         if ($id <= 0) {
-            $this->error(lang('admin_predeposit_parameter_error'),'Predeposit/pdcash_list');
+            $this->error(lang('admin_predeposit_parameter_error'), 'Predeposit/pdcash_list');
         }
         $predeposit_model = model('predeposit');
         $condition = array();
-        $condition[] = array('pdc_id','=',$id);
-        $condition[] = array('pdc_payment_state','=',0);
+        $condition[] = array('pdc_id', '=', $id);
+        $condition[] = array('pdc_payment_state', '=', 0);
         $info = $predeposit_model->getPdcashInfo($condition);
         if (!is_array($info) || count($info) < 0) {
             $this->error(lang('admin_predeposit_record_error'), 'Predeposit/pdcash_list');
@@ -362,44 +373,44 @@ class Predeposit extends AdminControl {
             $data['order_sn'] = $info['pdc_sn'];
             $data['admin_name'] = $admininfo['admin_name'];
             $predeposit_model->changePd('cash_pay', $data);
-            if($info['pdc_bank_type']=='alipay'){//如果是支付宝且开启了支付宝提现
+            if ($info['pdc_bank_type'] == 'alipay') { //如果是支付宝且开启了支付宝提现
                 $logic_payment = model('payment', 'logic');
-                $payment_code='alipay';
+                $payment_code = 'alipay';
                 $result = $logic_payment->getPaymentInfo($payment_code);
                 if ($result['code']) {
                     $payment_info = $result['data'];
-                    if($payment_info['payment_config']['alipay_trade_transfer_state'] == 1){
+                    if ($payment_info['payment_config']['alipay_trade_transfer_state'] == 1) {
                         $payment_api = new $payment_code($payment_info);
                         $result = $payment_api->fund_transfer($info);
                         if (!$result['code']) {
                             throw new \think\Exception($result['msg'], 10006);
                         }
-                        $result = $predeposit_model->editPdcash(array('pdc_payment_code'=>$payment_code,'pdc_trade_sn'=>$result['data']['pdc_trade_sn']), array('pdc_id'=>$id));
+                        $result = $predeposit_model->editPdcash(array('pdc_payment_code' => $payment_code, 'pdc_trade_sn' => $result['data']['pdc_trade_sn']), array('pdc_id' => $id));
                         if (!$result) {
                             throw new \think\Exception(lang('admin_predeposit_cash_edit_fail'), 10006);
                         }
                     }
                 }
-            }elseif($info['pdc_bank_type']=='weixin'){//如果是微信且开启了微信提现
+            } elseif ($info['pdc_bank_type'] == 'weixin') { //如果是微信且开启了微信提现
                 $logic_payment = model('payment', 'logic');
-                $payment_code='wxpay_native';
+                $payment_code = 'wxpay_native';
                 $result = $logic_payment->getPaymentInfo($payment_code);
                 if ($result['code']) {
                     $payment_info = $result['data'];
-                    if($payment_info['payment_config']['wx_trade_transfer_state'] == 1){
+                    if ($payment_info['payment_config']['wx_trade_transfer_state'] == 1) {
                         $payment_api = new $payment_code($payment_info);
                         $result = $payment_api->fund_transfer($info);
                         if (!$result['code']) {
                             throw new \think\Exception($result['msg'], 10006);
                         }
-                        $result = $predeposit_model->editPdcash(array('pdc_payment_code'=>$payment_code,'pdc_trade_sn'=>$result['data']['pdc_trade_sn']), array('pdc_id'=>$id));
+                        $result = $predeposit_model->editPdcash(array('pdc_payment_code' => $payment_code, 'pdc_trade_sn' => $result['data']['pdc_trade_sn']), array('pdc_id' => $id));
                         if (!$result) {
                             throw new \think\Exception(lang('admin_predeposit_cash_edit_fail'), 10006);
                         }
                     }
                 }
             }
-            
+
             Db::commit();
             $this->log($log_msg, 1);
             dsLayerOpenSuccess(lang('admin_predeposit_cash_edit_success'));
@@ -413,14 +424,15 @@ class Predeposit extends AdminControl {
     /**
      * 查看提现信息
      */
-    public function pdcash_view() {
+    public function pdcash_view()
+    {
         $id = intval(input('param.id'));
         if ($id <= 0) {
             $this->error(lang('admin_predeposit_parameter_error'), 'Predeposit/pdcash_list');
         }
         $predeposit_model = model('predeposit');
         $condition = array();
-        $condition[] = array('pdc_id','=',$id);
+        $condition[] = array('pdc_id', '=', $id);
         $info = $predeposit_model->getPdcashInfo($condition);
         if (!is_array($info) || count($info) < 0) {
             $this->error(lang('admin_predeposit_record_error'), 'Predeposit/pdcash_list');
@@ -433,15 +445,16 @@ class Predeposit extends AdminControl {
      * 调节预存款
      */
 
-    public function pd_add() {
+    public function pd_add()
+    {
         if (!(request()->isPost())) {
             $member_id = intval(input('get.member_id'));
-            if($member_id>0){
+            if ($member_id > 0) {
                 $condition = array();
-                $condition[] = array('member_id','=',$member_id);
+                $condition[] = array('member_id', '=', $member_id);
                 $member = model('member')->getMemberInfo($condition);
-                if(!empty($member)){
-                    View::assign('member_info',$member);
+                if (!empty($member)) {
+                    View::assign('member_info', $member);
                 }
             }
             return View::fetch();
@@ -533,7 +546,8 @@ class Predeposit extends AdminControl {
     }
 
     //取得会员信息
-    public function checkmember() {
+    public function checkmember()
+    {
         $name = input('post.name');
         if (!$name) {
             exit(json_encode(array('id' => 0)));
@@ -547,35 +561,36 @@ class Predeposit extends AdminControl {
             exit(json_encode(array('id' => 0)));
         }
     }
-    
-    
-    
+
+
+
 
     /**
      * 导出预存款充值记录
      *
      */
-    public function export_step1() {
+    public function export_step1()
+    {
         $condition = array();
         $if_start_date = preg_match('/^20\d{2}-\d{2}-\d{2}$/', input('param.query_start_date'));
         $if_end_date = preg_match('/^20\d{2}-\d{2}-\d{2}$/', input('param.query_end_date'));
         $start_unixtime = $if_start_date ? strtotime(input('param.query_start_date')) : null;
         $end_unixtime = $if_end_date ? strtotime(input('param.query_end_date')) : null;
         if ($start_unixtime) {
-            $condition[] = array('pdr_addtime','>=', $start_unixtime);
+            $condition[] = array('pdr_addtime', '>=', $start_unixtime);
         }
         if ($end_unixtime) {
-            $end_unixtime=$end_unixtime+86399;
-            $condition[] = array('pdr_addtime','<=', $end_unixtime);
+            $end_unixtime = $end_unixtime + 86399;
+            $condition[] = array('pdr_addtime', '<=', $end_unixtime);
         }
         if (input('param.mname') != '') {
-            $condition[]=array('pdr_member_name','like', "%" . input('param.mname') . "%");
+            $condition[] = array('pdr_member_name', 'like', "%" . input('param.mname') . "%");
         }
         if (input('param.paystate_search') != '') {
-            $condition[]=array('pdr_payment_state','=',input('param.paystate_search'));
+            $condition[] = array('pdr_payment_state', '=', input('param.paystate_search'));
         }
-        
-        
+
+
         $predeposit_model = model('predeposit');
         if (!is_numeric(input('param.page'))) {
             $count = $predeposit_model->getPdRechargeCount($condition);
@@ -614,8 +629,9 @@ class Predeposit extends AdminControl {
      *
      * @param array $data
      */
-    private function createExcel($data = array()) {
-        Lang::load(base_path() .'admin/lang/'.config('lang.default_lang').'/export.lang.php');
+    private function createExcel($data = array())
+    {
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/export.lang.php');
         $excel_obj = new \excel\Excel();
         $excel_data = array();
         //设置样式
@@ -655,12 +671,13 @@ class Predeposit extends AdminControl {
         $excel_obj->generateXML($excel_obj->charset(lang('exp_yc_yckcz'), CHARSET) . input('param.page') . '-' . date('Y-m-d-H', TIMESTAMP));
     }
 
-    
+
     /**
      * 导出预存款提现记录
      *
      */
-    public function export_cash_step1() {
+    public function export_cash_step1()
+    {
         $condition = array();
         $stime = input('get.stime');
         $etime = input('get.etime');
@@ -669,23 +686,23 @@ class Predeposit extends AdminControl {
         $start_unixtime = $if_start_date ? strtotime($stime) : null;
         $end_unixtime = $if_end_date ? strtotime($etime) : null;
         if ($start_unixtime) {
-            $condition[] = array('pdc_addtime','>=', $start_unixtime);
+            $condition[] = array('pdc_addtime', '>=', $start_unixtime);
         }
         if ($end_unixtime) {
-            $end_unixtime=$end_unixtime+86399;
-            $condition[] = array('pdc_addtime','<=', $end_unixtime);
+            $end_unixtime = $end_unixtime + 86399;
+            $condition[] = array('pdc_addtime', '<=', $end_unixtime);
         }
         $mname = input('get.mname');
         if (!empty($mname)) {
-            $condition[]=array('pdc_member_name','like', "%" . $mname . "%");
+            $condition[] = array('pdc_member_name', 'like', "%" . $mname . "%");
         }
         $pdc_bank_user = input('get.pdc_bank_user');
         if (!empty($pdc_bank_user)) {
-            $condition[]=array('pdc_bank_user','like', "%" . $pdc_bank_user . "%");
+            $condition[] = array('pdc_bank_user', 'like', "%" . $pdc_bank_user . "%");
         }
         $paystate_search = input('get.paystate_search');
         if ($paystate_search != '') {
-            $condition[]=array('pdc_payment_state','=',$paystate_search);
+            $condition[] = array('pdc_payment_state', '=', $paystate_search);
         }
 
         $predeposit_model = Model('predeposit');
@@ -727,8 +744,9 @@ class Predeposit extends AdminControl {
      *
      * @param array $data
      */
-    private function createCashExcel($data = array()) {
-        Lang::load(base_path() .'admin/lang/'.config('lang.default_lang').'/export.lang.php');
+    private function createCashExcel($data = array())
+    {
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/export.lang.php');
         $excel_obj = new \excel\Excel();
         $excel_data = array();
         //设置样式
@@ -759,7 +777,8 @@ class Predeposit extends AdminControl {
     /**
      * 预存款明细信息导出
      */
-    public function export_mx_step1() {
+    public function export_mx_step1()
+    {
         $condition = array();
         $stime = input('get.stime');
         $etime = input('get.etime');
@@ -768,22 +787,22 @@ class Predeposit extends AdminControl {
         $start_unixtime = $if_start_date ? strtotime($stime) : null;
         $end_unixtime = $if_end_date ? strtotime($etime) : null;
         if ($start_unixtime) {
-            $condition[] = array('lg_addtime','>=',$start_unixtime);
+            $condition[] = array('lg_addtime', '>=', $start_unixtime);
         }
         if ($end_unixtime) {
-            $end_unixtime=$end_unixtime+86399;
-            $condition[] = array('lg_addtime','<=',$end_unixtime);
+            $end_unixtime = $end_unixtime + 86399;
+            $condition[] = array('lg_addtime', '<=', $end_unixtime);
         }
         $mname = input('get.mname');
         if (!empty($mname)) {
-            $condition[] = array('lg_member_name','=',$mname);
+            $condition[] = array('lg_member_name', '=', $mname);
         }
         $aname = input('get.aname');
         if (!empty($aname)) {
-            $condition[] = array('lg_admin_name','=',$aname);
+            $condition[] = array('lg_admin_name', '=', $aname);
         }
-        
-        
+
+
         $predeposit_model = model('predeposit');
         if (!is_numeric(input('param.page'))) {
             $count = $predeposit_model->getPdLogCount($condition);
@@ -814,8 +833,9 @@ class Predeposit extends AdminControl {
      *
      * @param array $data
      */
-    private function createmxExcel($data = array()) {
-        Lang::load(base_path() .'admin/lang/'.config('lang.default_lang').'/export.lang.php');
+    private function createmxExcel($data = array())
+    {
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/export.lang.php');
         $excel_obj = new \excel\Excel();
         $excel_data = array();
         //设置样式
@@ -850,12 +870,13 @@ class Predeposit extends AdminControl {
         $excel_obj->addWorksheet($excel_obj->charset(lang('exp_mx_rz'), CHARSET));
         $excel_obj->generateXML($excel_obj->charset(lang('exp_mx_rz'), CHARSET) . input('param.page') . '-' . date('Y-m-d-H', TIMESTAMP));
     }
-    
-    
+
+
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'pdrecharge_list',
@@ -880,11 +901,9 @@ class Predeposit extends AdminControl {
             array(
                 'name' => 'pd_add',
                 'text' => lang('pd_add'),
-                'url' => "javascript:dsLayerOpen('".(string)url('Predeposit/pd_add')."','".lang('pd_add')."')"
+                'url' => "javascript:dsLayerOpen('" . (string)url('Predeposit/pd_add') . "','" . lang('pd_add') . "')"
             ),
         );
         return $menu_array;
     }
 }
-
-?>

+ 41 - 32
app/admin/controller/Promotionbargain.php

@@ -5,26 +5,28 @@
  */
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Db;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 
 
-class Promotionbargain extends AdminControl {
+class Promotionbargain extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/promotionbargain.lang.php');
     }
@@ -32,17 +34,18 @@ class Promotionbargain extends AdminControl {
     /**
      * 砍价列表
      */
-    public function index() {
+    public function index()
+    {
         $bargain_model = model('pbargain');
         $condition = array();
         if (!empty(input('param.bargain_name'))) {
-            $condition[]=array('bargain_name','like', '%' . input('param.bargain_name') . '%');
+            $condition[] = array('bargain_name', 'like', '%' . input('param.bargain_name') . '%');
         }
         if (!empty(input('param.store_name'))) {
-            $condition[]=array('store_name','like', '%' . input('param.store_name') . '%');
+            $condition[] = array('store_name', 'like', '%' . input('param.store_name') . '%');
         }
         if (input('param.state') != '' && in_array(input('param.state'), array(0, 1, 2, 3))) {
-            $condition[]=array('bargain_state','=',intval(input('param.state')));
+            $condition[] = array('bargain_state', '=', intval(input('param.state')));
         }
         $bargain_list = $bargain_model->getBargainList($condition, 10, 'bargain_id desc');
         foreach ($bargain_list as $key => $val) {
@@ -62,13 +65,14 @@ class Promotionbargain extends AdminControl {
     /**
      * 商品砍价订单列表
      */
-    public function bargain_order() {
+    public function bargain_order()
+    {
         $pbargainorder_model = model('pbargainorder');
         $bargain_id = intval(input('param.bargain_id'));
         $condition = array();
-        $condition[] = array('bargain_id','=',$bargain_id);
-        if(input('param.bargainorder_state')!=''){
-            $condition[] = array('bargainorder_state','=',intval(input('param.bargainorder_state')));
+        $condition[] = array('bargain_id', '=', $bargain_id);
+        if (input('param.bargainorder_state') != '') {
+            $condition[] = array('bargainorder_state', '=', intval(input('param.bargainorder_state')));
         }
 
         $pbargainorder_list = $pbargainorder_model->getPbargainorderList($condition, 10); #获取开团信息
@@ -82,23 +86,25 @@ class Promotionbargain extends AdminControl {
     /**
      * 商品砍价记录列表
      */
-    public function bargain_log() {
+    public function bargain_log()
+    {
         $pbargainlog_model = model('pbargainlog');
         $bargainorder_id = intval(input('param.bargainorder_id'));
-        
+
         $condition = array();
-        $condition[] = array('bargainorder_id','=',$bargainorder_id);
+        $condition[] = array('bargainorder_id', '=', $bargainorder_id);
         $pbargainlog_list = $pbargainlog_model->getPbargainlogList($condition, 10); #获取砍价记录信息
         View::assign('show_page', $pbargainlog_model->page_info->render());
         View::assign('pbargainlog_list', $pbargainlog_list);
         return View::fetch();
     }
-    
+
 
     /**
      * 砍价活动 取消
      */
-    public function bargain_end() {
+    public function bargain_end()
+    {
         $bargain_id = intval(input('param.bargain_id'));
         $pbargain_model = model('pbargain');
 
@@ -106,7 +112,7 @@ class Promotionbargain extends AdminControl {
         if (!$bargain_info) {
             ds_json_encode(10001, lang('param_error'));
         }
-        if(!in_array($bargain_info['bargain_state'],array(1,2))){//只有未开始、进行中的活动可以取消
+        if (!in_array($bargain_info['bargain_state'], array(1, 2))) { //只有未开始、进行中的活动可以取消
             ds_json_encode(10001, lang('bargain_cant_cancel'));
         }
         Db::startTrans();
@@ -114,15 +120,15 @@ class Promotionbargain extends AdminControl {
             /**
              * 指定砍价活动结束
              */
-            if(!$pbargain_model->cancelBargain(array('bargain_id' => $bargain_id))){
+            if (!$pbargain_model->cancelBargain(array('bargain_id' => $bargain_id))) {
                 throw new \think\Exception(lang('bargain_edit_fail'), 10006);
             }
-            if($bargain_info['bargain_state']){
+            if ($bargain_info['bargain_state']) {
                 //取消用户发起的活动
                 $pbargainorder_model = model('pbargainorder');
-                $pbargainorder_model->lock=true;
-                $pbargainorder_list=$pbargainorder_model->getPbargainorderList(array('bargainorder_state'=>1,'bargain_id'=>$bargain_id));
-                if(!empty($pbargainorder_list) && !$pbargainorder_model->editPbargainorder(array('bargainorder_state'=>1,'bargain_id'=>$bargain_id), array('bargainorder_state'=>0))){
+                $pbargainorder_model->lock = true;
+                $pbargainorder_list = $pbargainorder_model->getPbargainorderList(array('bargainorder_state' => 1, 'bargain_id' => $bargain_id));
+                if (!empty($pbargainorder_list) && !$pbargainorder_model->editPbargainorder(array('bargainorder_state' => 1, 'bargain_id' => $bargain_id), array('bargainorder_state' => 0))) {
                     throw new \think\Exception(lang('user_bargain_edit_fail'), 10006);
                 }
             }
@@ -137,7 +143,8 @@ class Promotionbargain extends AdminControl {
     /**
      * 拼团活动 删除
      */
-    public function bargain_del() {
+    public function bargain_del()
+    {
         $bargain_id = intval(input('param.bargain_id'));
         $pbargain_model = model('pbargain');
         $bargain_info = $pbargain_model->getBargainInfoByID($bargain_id);
@@ -159,11 +166,12 @@ class Promotionbargain extends AdminControl {
     /**
      * 砍价套餐管理
      */
-    public function bargain_quota() {
+    public function bargain_quota()
+    {
         $bargainquota_model = model('pbargainquota');
 
         $condition = array();
-        $condition[]=array('store_name','like', '%' . input('param.store_name') . '%');
+        $condition[] = array('store_name', 'like', '%' . input('param.store_name') . '%');
         $bargainquota_list = $bargainquota_model->getBargainquotaList($condition, 10, 'bargainquota_endtime desc');
         View::assign('bargainquota_list', $bargainquota_list);
         View::assign('show_page', $bargainquota_model->page_info->render());
@@ -175,7 +183,8 @@ class Promotionbargain extends AdminControl {
     /**
      * 砍价设置
      */
-    public function bargain_setting() {
+    public function bargain_setting()
+    {
         if (!(request()->isPost())) {
             $setting = rkcache('config', true);
             View::assign('setting', $setting);
@@ -200,7 +209,8 @@ class Promotionbargain extends AdminControl {
         }
     }
 
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'bargain_list', 'text' => lang('bargain_list'), 'url' => (string)url('Promotionbargain/index')
@@ -222,5 +232,4 @@ class Promotionbargain extends AdminControl {
 
         return $menu_array;
     }
-
 }

+ 26 - 20
app/admin/controller/Promotionbooth.php

@@ -1,28 +1,31 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Promotionbooth extends AdminControl {
+class Promotionbooth extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/promotionbooth.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/promotionbooth.lang.php');
     }
 
-    public function index() {
+    public function index()
+    {
 
         //自动开启优惠套装
         if (intval(input('param.promotion_allow')) === 1) {
@@ -43,7 +46,7 @@ class Promotionbooth extends AdminControl {
         $pbooth_model = model('pbooth');
         $where = array();
         if (intval(input('param.choose_gcid')) > 0) {
-            $where=$pbooth_model->_getRecursiveClass($where,intval(input('param.choose_gcid')));
+            $where = $pbooth_model->_getRecursiveClass($where, intval(input('param.choose_gcid')));
         }
         $goods_list = $pbooth_model->getBoothgoodsList($where, 'goods_id', 10);
         if (!empty($goods_list)) {
@@ -51,7 +54,7 @@ class Promotionbooth extends AdminControl {
             foreach ($goods_list as $val) {
                 $goodsid_array[] = $val['goods_id'];
             }
-            $goods_list = model('goods')->getGoodsList(array(array('goods_id','in', $goodsid_array)));
+            $goods_list = model('goods')->getGoodsList(array(array('goods_id', 'in', $goodsid_array)));
         }
         View::assign('gc_list', model('goodsclass')->getGoodsclassForCacheModel());
         View::assign('goods_list', $goods_list);
@@ -66,11 +69,12 @@ class Promotionbooth extends AdminControl {
     /**
      * 套餐列表
      */
-    public function booth_quota() {
+    public function booth_quota()
+    {
         $pbooth_model = model('pbooth');
         $where = array();
         if (input('param.store_name') != '') {
-            $where[]=array('store_name','like', '%' . trim(input('param.store_name')) . '%');
+            $where[] = array('store_name', 'like', '%' . trim(input('param.store_name')) . '%');
         }
         $booth_list = $pbooth_model->getBoothquotaList($where, '*', 10);
 
@@ -87,14 +91,15 @@ class Promotionbooth extends AdminControl {
     /**
      * 删除推荐商品
      */
-    public function del_goods() {
+    public function del_goods()
+    {
         $where = array();
         $goods_id = input('param.goods_id');
         $goods_id_array = ds_delete_param($goods_id);
         if ($goods_id_array == FALSE) {
             ds_json_encode('10001', lang('param_error'));
         }
-        $where[]=array('goods_id','in', $goods_id_array);
+        $where[] = array('goods_id', 'in', $goods_id_array);
         $rs = model('pbooth')->delBoothgoods($where);
         if ($rs) {
             ds_json_encode(10000, lang('ds_common_del_succ'));
@@ -106,7 +111,8 @@ class Promotionbooth extends AdminControl {
     /**
      * 设置
      */
-    public function booth_setting() {
+    public function booth_setting()
+    {
         // 实例化模型
         $config_model = model('config');
 
@@ -117,7 +123,7 @@ class Promotionbooth extends AdminControl {
                 'promotion_booth_goods_sum' => input('post.promotion_booth_goods_sum'),
             ];
             $promotionbooth_validate = ds_validate('promotionbooth');
-            if (!$promotionbooth_validate->scene('booth_setting')->check($data)){
+            if (!$promotionbooth_validate->scene('booth_setting')->check($data)) {
                 $this->error($promotionbooth_validate->getError());
             }
 
@@ -139,7 +145,8 @@ class Promotionbooth extends AdminControl {
         }
     }
 
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -152,10 +159,9 @@ class Promotionbooth extends AdminControl {
             ), array(
                 'name' => 'booth_setting',
                 'text' => lang('ds_setting'),
-                'url' => "javascript:dsLayerOpen('" . (string)url('Promotionbooth/booth_setting') . "','".lang('ds_setting')."')"
+                'url' => "javascript:dsLayerOpen('" . (string)url('Promotionbooth/booth_setting') . "','" . lang('ds_setting') . "')"
             ),
         );
         return $menu_array;
     }
-
 }

+ 22 - 24
app/admin/controller/Promotionbundling.php

@@ -1,18 +1,18 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Promotionbundling extends AdminControl
@@ -20,7 +20,7 @@ class Promotionbundling extends AdminControl
     public function initialize()
     {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/promotionbundling.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/promotionbundling.lang.php');
     }
 
 
@@ -42,13 +42,13 @@ class Promotionbundling extends AdminControl
         // 查询添加
         $where = array();
         if (input('param.store_name') != '') {
-            $where[]=array('store_name','like', '%' . trim(input('param.store_name')) . '%');
+            $where[] = array('store_name', 'like', '%' . trim(input('param.store_name')) . '%');
         }
         if (is_numeric(input('param.state'))) {
-            $where[]=array('blquota_state','=',intval(input('param.state')));
+            $where[] = array('blquota_state', '=', intval(input('param.state')));
         }
 
-        $bundlingquota_list = $pbundling_model->getBundlingQuotaList($where,10);
+        $bundlingquota_list = $pbundling_model->getBundlingQuotaList($where, 10);
         View::assign('show_page', $pbundling_model->page_info->render());
 
         // 状态数组
@@ -70,24 +70,24 @@ class Promotionbundling extends AdminControl
         // 查询添加
         $where = '';
         if (input('param.bundling_name') != '') {
-            $where[]=array('bl_name','like', '%' . trim(input('param.bundling_name')) . '%');
+            $where[] = array('bl_name', 'like', '%' . trim(input('param.bundling_name')) . '%');
         }
         if (input('param.store_name') != '') {
-            $where[]=array('store_name','like', '%' . trim(input('param.store_name')) . '%');
+            $where[] = array('store_name', 'like', '%' . trim(input('param.store_name')) . '%');
         }
         if (is_numeric(input('param.state'))) {
-            $where[]=array('bl_state','=',input('param.state'));
+            $where[] = array('bl_state', '=', input('param.state'));
         }
-        $pbundling_list = $pbundling_model->getBundlingList($where,'*','bl_id desc',10);
+        $pbundling_list = $pbundling_model->getBundlingList($where, '*', 'bl_id desc', 10);
         $pbundling_list = array_under_reset($pbundling_list, 'bl_id');
         View::assign('show_page', $pbundling_model->page_info->render());
         if (!empty($pbundling_list)) {
             $blid_array = array_keys($pbundling_list);
-            $bgoods_array = $pbundling_model->getBundlingGoodsList(array( array('bl_id','in', $blid_array)), 'bl_id,goods_id,count(*) as count', 'blgoods_appoint desc', 'bl_id');
+            $bgoods_array = $pbundling_model->getBundlingGoodsList(array(array('bl_id', 'in', $blid_array)), 'bl_id,goods_id,count(*) as count', 'blgoods_appoint desc', 'bl_id');
             $bgoods_array = array_under_reset($bgoods_array, 'bl_id');
             foreach ($pbundling_list as $key => $val) {
-                $pbundling_list[$key]['goods_id'] = isset($bgoods_array[$val['bl_id']]['goods_id'])?$bgoods_array[$val['bl_id']]['goods_id']:'';
-                $pbundling_list[$key]['count'] = isset($bgoods_array[$val['bl_id']]['count'])?$bgoods_array[$val['bl_id']]['count']:'';
+                $pbundling_list[$key]['goods_id'] = isset($bgoods_array[$val['bl_id']]['goods_id']) ? $bgoods_array[$val['bl_id']]['goods_id'] : '';
+                $pbundling_list[$key]['count'] = isset($bgoods_array[$val['bl_id']]['count']) ? $bgoods_array[$val['bl_id']]['count'] : '';
             }
         }
         View::assign('pbundling_list', $pbundling_list);
@@ -120,7 +120,7 @@ class Promotionbundling extends AdminControl
                 'promotion_bundling_goods_sum' => input('post.promotion_bundling_goods_sum')
             ];
             $promotionbundling_validate = ds_validate('promotionbundling');
-            if (!$promotionbundling_validate->scene('bundling_setting')->check($data)){
+            if (!$promotionbundling_validate->scene('bundling_setting')->check($data)) {
                 $this->error($promotionbundling_validate->getError());
             }
 
@@ -132,8 +132,7 @@ class Promotionbundling extends AdminControl
             if ($return) {
                 $this->log(lang('ds_set') . lang('ds_promotion_bundling'));
                 dsLayerOpenSuccess(lang('ds_common_op_succ'));
-            }
-            else {
+            } else {
                 $this->error(lang('ds_common_op_fail'));
             }
         } else {
@@ -157,8 +156,7 @@ class Promotionbundling extends AdminControl
         $rs = model('pbundling')->delBundlingForAdmin(array('bl_id' => $bl_id));
         if ($rs) {
             ds_json_encode(10000, lang('ds_common_op_succ'));
-        }
-        else {
+        } else {
             ds_json_encode(10001, lang('ds_common_op_fail'));
         }
     }
@@ -168,7 +166,7 @@ class Promotionbundling extends AdminControl
         $menu_array = array(
             array(
                 'name' => 'index',
-                'text' => lang('bundling_list'), 
+                'text' => lang('bundling_list'),
                 'url' => (string)url('Promotionbundling/index')
             ), array(
                 'name' => 'bundling_quota',
@@ -177,9 +175,9 @@ class Promotionbundling extends AdminControl
             ), array(
                 'name' => 'bundling_setting',
                 'text' => lang('bundling_setting'),
-                'url' => "javascript:dsLayerOpen('".(string)url('Promotionbundling/bundling_setting')."','".lang('bundling_setting')."')"
+                'url' => "javascript:dsLayerOpen('" . (string)url('Promotionbundling/bundling_setting') . "','" . lang('bundling_setting') . "')"
             ),
         );
         return $menu_array;
     }
-}
+}

+ 25 - 25
app/admin/controller/Promotionmansong.php

@@ -1,17 +1,18 @@
 <?php
+
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Promotionmansong extends AdminControl
@@ -19,7 +20,7 @@ class Promotionmansong extends AdminControl
     public function initialize()
     {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/promotionmansong.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/promotionmansong.lang.php');
     }
 
 
@@ -39,13 +40,13 @@ class Promotionmansong extends AdminControl
 
         $param = array();
         if (!empty(input('param.mansong_name'))) {
-            $param[] = array('mansong_name','like', '%' . input('param.mansong_name') . '%');
+            $param[] = array('mansong_name', 'like', '%' . input('param.mansong_name') . '%');
         }
         if (!empty(input('param.store_name'))) {
-            $param[] = array('store_name','like', '%' . input('param.store_name') . '%');
+            $param[] = array('store_name', 'like', '%' . input('param.store_name') . '%');
         }
         if (!empty(input('param.state'))) {
-            $param[]=array('mansong_state','=',input('param.state'));
+            $param[] = array('mansong_state', '=', input('param.state'));
         }
         $mansong_list = $mansong_model->getMansongList($param, 10);
         View::assign('mansong_list', $mansong_list);
@@ -91,18 +92,17 @@ class Promotionmansong extends AdminControl
     public function mansong_cancel()
     {
         $mansong_id = intval(input('param.mansong_id'));
-        
-        if ($mansong_id<=0) {
+
+        if ($mansong_id <= 0) {
             ds_json_encode(10001, lang('param_error'));
         }
-        
+
         $mansong_model = model('pmansong');
         $result = $mansong_model->cancelMansong(array('mansong_id' => $mansong_id));
         if ($result) {
             $this->log('取消满即送活动,活动编号' . $mansong_id);
             ds_json_encode(10000, lang('ds_common_del_succ'));
-        }
-        else {
+        } else {
             ds_json_encode(10001, lang('ds_common_del_fail'));
         }
     }
@@ -110,15 +110,16 @@ class Promotionmansong extends AdminControl
     /**
      * 满即送活动删除
      **/
-    public function mansong_del() {
+    public function mansong_del()
+    {
         $mansong_model = model('pmansong');
         $mansong_id = input('param.mansong_id');
         $mansong_id_array = ds_delete_param($mansong_id);
-        if($mansong_id_array === FALSE){
+        if ($mansong_id_array === FALSE) {
             ds_json_encode(10001, lang('param_error'));
         }
-        $condition = array(array('mansong_id','in', $mansong_id_array));
-        $result =$mansong_model->delMansong($condition);
+        $condition = array(array('mansong_id', 'in', $mansong_id_array));
+        $result = $mansong_model->delMansong($condition);
         if ($result) {
             $this->log('删除满即送活动,活动编号' . implode(',', $mansong_id_array));
             ds_json_encode(10000, lang('ds_common_del_succ'));
@@ -126,7 +127,7 @@ class Promotionmansong extends AdminControl
             ds_json_encode(10001, lang('ds_common_del_fail'));
         }
     }
-    
+
 
     /**
      * 套餐管理
@@ -137,7 +138,7 @@ class Promotionmansong extends AdminControl
 
         $param = array();
         if (!empty(input('param.store_name'))) {
-            $param[] = array('store_name','like', '%' . input('param.store_name') . '%');
+            $param[] = array('store_name', 'like', '%' . input('param.store_name') . '%');
         }
         $mansongquota_list = $mansongquota_model->getMansongquotaList($param, 10, 'mansongquota_id desc');
         View::assign('mansongquota_list', $mansongquota_list);
@@ -145,7 +146,6 @@ class Promotionmansong extends AdminControl
         $this->setAdminCurItem('mansong_quota');
 
         return View::fetch();
-
     }
 
     /**
@@ -189,8 +189,8 @@ class Promotionmansong extends AdminControl
     {
         $menu_array = array(
             array(
-                'name' => 'index', 
-                'text' => lang('mansong_list'), 
+                'name' => 'index',
+                'text' => lang('mansong_list'),
                 'url' => (string)url('Promotionmansong/index')
             ), array(
                 'name' => 'mansong_quota',
@@ -199,7 +199,7 @@ class Promotionmansong extends AdminControl
             ), array(
                 'name' => 'mansong_setting',
                 'text' => lang('mansong_setting'),
-                'url' => "javascript:dsLayerOpen('".(string)url('Promotionmansong/mansong_setting')."','".lang('mansong_setting')."')"
+                'url' => "javascript:dsLayerOpen('" . (string)url('Promotionmansong/mansong_setting') . "','" . lang('mansong_setting') . "')"
             ),
         );
         if (request()->action() == 'mansong_detail') {
@@ -210,4 +210,4 @@ class Promotionmansong extends AdminControl
         }
         return $menu_array;
     }
-}
+}

+ 24 - 19
app/admin/controller/Promotionmgdiscount.php

@@ -1,25 +1,27 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Promotionmgdiscount extends AdminControl {
+class Promotionmgdiscount extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/promotionmgdiscount.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/promotionmgdiscount.lang.php');
         //自动开启会员等级折扣
         if (intval(input('param.mgdiscount_allow')) === 1) {
             $config_model = model('config');
@@ -32,15 +34,16 @@ class Promotionmgdiscount extends AdminControl {
     /**
      * 显示店铺统一设置的 会员等级折扣
      */
-    public function mgdiscount_store() {
+    public function mgdiscount_store()
+    {
         $store_model = model('store');
         $condition = array();
-        $condition[]=array('store_name','like', '%' . input('param.store_name') . '%');
+        $condition[] = array('store_name', 'like', '%' . input('param.store_name') . '%');
         $store_list = $store_model->getStoreList($condition, 10, 'store_id desc');
-        foreach($store_list as $key=>$store){
+        foreach ($store_list as $key => $store) {
             $store_list[$key]['store_mgdiscount_arr'] = $this->_get_mgdiscount_arr($store['store_mgdiscount']);
         }
-        
+
         View::assign('store_list', $store_list);
         View::assign('show_page', $store_model->page_info->render());
 
@@ -51,9 +54,10 @@ class Promotionmgdiscount extends AdminControl {
     /**
      * 显示店铺针对单个商品设置的 会员等级折扣
      */
-    public function mgdiscount_goods() {
+    public function mgdiscount_goods()
+    {
         $goods_model = model('goods');
-        $condition[]=array('goods_mgdiscount','<>', '');
+        $condition[] = array('goods_mgdiscount', '<>', '');
         $goods_list = $goods_model->getGoodsCommonOnlineList($condition);
         foreach ($goods_list as $key => $goods) {
             $goods_list[$key]['goods_mgdiscount_arr'] = $this->_get_mgdiscount_arr($goods['goods_mgdiscount']);
@@ -63,7 +67,7 @@ class Promotionmgdiscount extends AdminControl {
         $this->setAdminCurItem('mgdiscount_goods');
         return View::fetch();
     }
-    
+
 
     /**
      * 通过系统会员等级和现有数据比对得出数值
@@ -81,7 +85,7 @@ class Promotionmgdiscount extends AdminControl {
         $mgdiscount_arr = array();
         foreach ($membergrade_arr as $key => $value) {
             $mgdiscount_arr[$key] = $value;
-            $mgdiscount_arr[$key]['level_discount'] = isset($mgdiscount_arr_temp[$key]['level_discount'])?$mgdiscount_arr_temp[$key]['level_discount']:10;
+            $mgdiscount_arr[$key]['level_discount'] = isset($mgdiscount_arr_temp[$key]['level_discount']) ? $mgdiscount_arr_temp[$key]['level_discount'] : 10;
         }
         return $mgdiscount_arr;
     }
@@ -89,7 +93,8 @@ class Promotionmgdiscount extends AdminControl {
     /**
      * 会员等级设置
      */
-    public function mgdiscount_setting() {
+    public function mgdiscount_setting()
+    {
         if (!(request()->isPost())) {
             $setting = rkcache('config', true);
             View::assign('setting', $setting);
@@ -119,7 +124,8 @@ class Promotionmgdiscount extends AdminControl {
      * @param array $array 附加菜单
      * @return
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'mgdiscount_store',
@@ -137,5 +143,4 @@ class Promotionmgdiscount extends AdminControl {
         );
         return $menu_array;
     }
-
 }

+ 33 - 28
app/admin/controller/Promotionpintuan.php

@@ -1,19 +1,22 @@
 <?php
+
 /**
  * 拼团管理
  */
+
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
+
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Promotionpintuan extends AdminControl
@@ -21,7 +24,7 @@ class Promotionpintuan extends AdminControl
     public function initialize()
     {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/promotionpintuan.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/promotionpintuan.lang.php');
     }
     /**
      * 拼团列表
@@ -31,21 +34,21 @@ class Promotionpintuan extends AdminControl
         $pintuan_model = model('ppintuan');
         $condition = array();
         if (!empty(input('param.pintuan_name'))) {
-            $condition[]=array('pintuan_name','like', '%' . input('param.pintuan_name') . '%');
+            $condition[] = array('pintuan_name', 'like', '%' . input('param.pintuan_name') . '%');
         }
         if (!empty(input('param.store_name'))) {
-            $condition[]=array('store_name','like', '%' . input('param.store_name') . '%');
+            $condition[] = array('store_name', 'like', '%' . input('param.store_name') . '%');
         }
         if (input('param.state') != '') {
-            $condition[]=array('pintuan_state','=',intval(input('param.state')));
+            $condition[] = array('pintuan_state', '=', intval(input('param.state')));
         }
         $pintuan_list = $pintuan_model->getPintuanList($condition, 10, 'pintuan_state desc, pintuan_end_time desc');
         View::assign('pintuan_list', $pintuan_list);
         View::assign('show_page', $pintuan_model->page_info->render());
         View::assign('pintuan_state_array', $pintuan_model->getPintuanStateArray());
-        
+
         View::assign('filtered', $condition ? 1 : 0); //是否有查询条件
-        
+
         $this->setAdminCurItem('pintuan_list');
         return View::fetch();
     }
@@ -58,23 +61,23 @@ class Promotionpintuan extends AdminControl
         $ppintuanorder_model = model('ppintuanorder');
         $pintuan_id = intval(input('param.pintuan_id'));
         $condition = array();
-        $condition[] = array('pintuan_id','=',$pintuan_id);
-        if (input('param.pintuangroup_state')){
-            $condition[] = array('pintuangroup_state','=',intval(input('param.pintuangroup_state')));
+        $condition[] = array('pintuan_id', '=', $pintuan_id);
+        if (input('param.pintuangroup_state')) {
+            $condition[] = array('pintuangroup_state', '=', intval(input('param.pintuangroup_state')));
         }
-        
+
         $ppintuangroup_list = $ppintuangroup_model->getPpintuangroupList($condition, 10); #获取开团信息
         foreach ($ppintuangroup_list as $key => $ppintuangroup) {
             //获取开团订单下的参团订单
             $condition = array();
-            $condition[] = array('pintuangroup_id','=',$ppintuangroup['pintuangroup_id']);
-            if($ppintuangroup['pintuangroup_is_virtual']){
+            $condition[] = array('pintuangroup_id', '=', $ppintuangroup['pintuangroup_id']);
+            if ($ppintuangroup['pintuangroup_is_virtual']) {
                 $ppintuangroup_list[$key]['order_list'] = $ppintuanorder_model->getPpintuanvrorderList($condition);
-            }else{
+            } else {
                 $ppintuangroup_list[$key]['order_list'] = $ppintuanorder_model->getPpintuanorderList($condition);
             }
         }
-        $ppintuan_info = model('ppintuan')->getPintuanInfo(['pintuan_id'=>$pintuan_id]);
+        $ppintuan_info = model('ppintuan')->getPintuanInfo(['pintuan_id' => $pintuan_id]);
         View::assign('pintuan_info', $ppintuan_info);
         View::assign('show_page', $ppintuangroup_model->page_info->render());
         View::assign('pintuangroup_list', $ppintuangroup_list);
@@ -83,11 +86,12 @@ class Promotionpintuan extends AdminControl
         $this->setAdminCurItem('pintuan_manage');
         return View::fetch();
     }
-    
+
     /**
      * 拼团活动 提前结束
      */
-    public function pintuan_end() {
+    public function pintuan_end()
+    {
         $pintuan_id = intval(input('param.pintuan_id'));
         $ppintuan_model = model('ppintuan');
 
@@ -111,7 +115,8 @@ class Promotionpintuan extends AdminControl
     /**
      * 拼团活动 删除
      */
-    public function pintuan_del() {
+    public function pintuan_del()
+    {
         $pintuan_id = intval(input('param.pintuan_id'));
         $ppintuan_model = model('ppintuan');
         $pintuan_info = $ppintuan_model->getPintuanInfoByID($pintuan_id);
@@ -138,7 +143,7 @@ class Promotionpintuan extends AdminControl
         $pintuanquota_model = model('ppintuanquota');
 
         $condition = array();
-        $condition[]=array('store_name','like', '%' . input('param.store_name') . '%');
+        $condition[] = array('store_name', 'like', '%' . input('param.store_name') . '%');
         $pintuanquota_list = $pintuanquota_model->getPintuanquotaList($condition, 10, 'pintuanquota_endtime desc');
         View::assign('pintuanquota_list', $pintuanquota_list);
         View::assign('show_page', $pintuanquota_model->page_info->render());
@@ -149,7 +154,8 @@ class Promotionpintuan extends AdminControl
     /**
      * 拼团设置
      */
-    public function pintuan_setting() {
+    public function pintuan_setting()
+    {
         if (!(request()->isPost())) {
             $setting = rkcache('config', true);
             View::assign('setting', $setting);
@@ -185,17 +191,16 @@ class Promotionpintuan extends AdminControl
             ), array(
                 'name' => 'pintuan_setting',
                 'text' => lang('pintuan_setting'),
-                'url' => "javascript:dsLayerOpen('".(string)url('Promotionpintuan/pintuan_setting')."','".lang('pintuan_setting')."')"
+                'url' => "javascript:dsLayerOpen('" . (string)url('Promotionpintuan/pintuan_setting') . "','" . lang('pintuan_setting') . "')"
             ),
         );
-        if (request()->action() == 'pintuan_detail'){
+        if (request()->action() == 'pintuan_detail') {
             $menu_array[] = array(
                 'name' => 'pintuan_detail', 'text' => lang('pintuan_detail'),
                 'url' => (string)url('Promotionpintuan/pintuan_detail')
             );
         }
-            
+
         return $menu_array;
     }
 }
-

+ 22 - 16
app/admin/controller/Promotionpresell.php

@@ -11,19 +11,20 @@ use think\facade\Db;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Promotionpresell extends AdminControl {
+class Promotionpresell extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/promotionpresell.lang.php');
     }
@@ -31,7 +32,8 @@ class Promotionpresell extends AdminControl {
     /**
      * 预售列表
      */
-    public function index() {
+    public function index()
+    {
         $presell_model = model('presell');
         $condition = array();
         if (!empty(input('param.goods_name'))) {
@@ -61,7 +63,8 @@ class Promotionpresell extends AdminControl {
     /**
      * 预售活动 取消
      */
-    public function presell_end() {
+    public function presell_end()
+    {
         $presell_id = intval(input('param.presell_id'));
         $presell_model = model('presell');
 
@@ -69,7 +72,7 @@ class Promotionpresell extends AdminControl {
         if (!$presell_info) {
             ds_json_encode(10001, lang('param_error'));
         }
-        if (!in_array($presell_info['presell_state'], array(1, 2))) {//只有未开始、进行中的活动可以取消
+        if (!in_array($presell_info['presell_state'], array(1, 2))) { //只有未开始、进行中的活动可以取消
             ds_json_encode(10001, lang('presell_cant_cancel'));
         }
         try {
@@ -84,7 +87,7 @@ class Promotionpresell extends AdminControl {
                 $logic_order = model('order', 'logic');
                 $condition = array();
                 $condition[] = array('order_id', 'in', $order_ids);
-                $condition[] = array('order_state', 'in', [ORDER_STATE_NEW,ORDER_STATE_DEPOSIT, ORDER_STATE_REST,ORDER_STATE_PAY]);
+                $condition[] = array('order_state', 'in', [ORDER_STATE_NEW, ORDER_STATE_DEPOSIT, ORDER_STATE_REST, ORDER_STATE_PAY]);
                 $order_list = $order_model->getOrderList($condition);
                 if (!empty($order_list)) {
                     foreach ($order_list as $order_info) {
@@ -107,7 +110,8 @@ class Promotionpresell extends AdminControl {
     /**
      * 拼团活动 删除
      */
-    public function presell_del() {
+    public function presell_del()
+    {
         $presell_id = intval(input('param.presell_id'));
         $presell_model = model('presell');
         $presell_info = $presell_model->getPresellInfoByID($presell_id);
@@ -129,7 +133,8 @@ class Promotionpresell extends AdminControl {
     /**
      * 预售套餐管理
      */
-    public function presell_quota() {
+    public function presell_quota()
+    {
         $presellquota_model = model('presellquota');
 
         $condition = array();
@@ -145,7 +150,8 @@ class Promotionpresell extends AdminControl {
     /**
      * 预售设置
      */
-    public function presell_setting() {
+    public function presell_setting()
+    {
         if (!(request()->isPost())) {
             $setting = rkcache('config', true);
             View::assign('setting', $setting);
@@ -170,7 +176,8 @@ class Promotionpresell extends AdminControl {
         }
     }
 
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'presell_list', 'text' => lang('presell_list'), 'url' => (string) url('Promotionpresell/index')
@@ -186,5 +193,4 @@ class Promotionpresell extends AdminControl {
 
         return $menu_array;
     }
-
 }

+ 28 - 31
app/admin/controller/Promotionwholesale.php

@@ -1,21 +1,22 @@
 <?php
+
 /**
  * 批发
  */
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Promotionwholesale extends AdminControl
@@ -23,7 +24,7 @@ class Promotionwholesale extends AdminControl
     public function initialize()
     {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/promotionwholesale.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/promotionwholesale.lang.php');
     }
 
 
@@ -43,13 +44,13 @@ class Promotionwholesale extends AdminControl
         $wholesale_model = model('wholesale');
         $condition = array();
         if (!empty(input('param.goods_name'))) {
-            $condition[]=array('goods_name','like', '%' . input('param.goods_name') . '%');
+            $condition[] = array('goods_name', 'like', '%' . input('param.goods_name') . '%');
         }
         if (!empty(input('param.store_name'))) {
-            $condition[]=array('store_name','like', '%' . input('param.store_name') . '%');
+            $condition[] = array('store_name', 'like', '%' . input('param.store_name') . '%');
         }
         if (!empty(input('param.state'))) {
-            $condition[]=array('wholesale_state','=',intval(input('param.state')));
+            $condition[] = array('wholesale_state', '=', intval(input('param.state')));
         }
         $wholesale_list = $wholesale_model->getWholesaleList($condition, 10, 'wholesale_state desc, wholesale_end_time desc');
         View::assign('wholesale_list', $wholesale_list);
@@ -58,7 +59,7 @@ class Promotionwholesale extends AdminControl
 
         $this->setAdminCurItem('wholesale_list');
         // 输出自营店铺IDS
-        
+
         View::assign('filtered', $condition ? 1 : 0); //是否有查询条件
         View::assign('flippedOwnShopIds', array_flip(model('store')->getOwnShopIds()));
         return View::fetch();
@@ -73,10 +74,9 @@ class Promotionwholesale extends AdminControl
         $wholesale_model = model('wholesale');
         $result = $wholesale_model->cancelWholesale(array('wholesale_id' => $wholesale_id));
         if ($result) {
-            $this->log(lang('ds_cancel').lang('ds_promotion_wholesale').'ID:' . $wholesale_id);
+            $this->log(lang('ds_cancel') . lang('ds_promotion_wholesale') . 'ID:' . $wholesale_id);
             ds_json_encode(10000, lang('ds_common_op_succ'));
-        }
-        else {
+        } else {
             ds_json_encode(10001, lang('ds_common_op_fail'));
         }
     }
@@ -89,16 +89,15 @@ class Promotionwholesale extends AdminControl
         $wholesale_model = model('wholesale');
         $wholesale_id = input('param.wholesale_id');
         $wholesale_id_array = ds_delete_param($wholesale_id);
-        if($wholesale_id_array === FALSE){
+        if ($wholesale_id_array === FALSE) {
             ds_json_encode(10001, lang('param_error'));
         }
-        $condition = array(array('wholesale_id' ,'in', $wholesale_id_array));
+        $condition = array(array('wholesale_id', 'in', $wholesale_id_array));
         $result = $wholesale_model->delWholesale($condition);
         if ($result) {
-            $this->log(lang('ds_del').lang('ds_promotion_wholesale').'ID:' . $wholesale_id);
+            $this->log(lang('ds_del') . lang('ds_promotion_wholesale') . 'ID:' . $wholesale_id);
             ds_json_encode(10000, lang('ds_common_op_succ'));
-        }
-        else {
+        } else {
             ds_json_encode(10001, lang('ds_common_op_fail'));
         }
     }
@@ -121,10 +120,10 @@ class Promotionwholesale extends AdminControl
 
         //获取批发商品列表
         $condition = array();
-        $condition[] = array('wholesale_id','=',$wholesale_id);
-        $wholesalegoods_list = $wholesalegoods_model->getWholesalegoodsExtendList($condition,5);
+        $condition[] = array('wholesale_id', '=', $wholesale_id);
+        $wholesalegoods_list = $wholesalegoods_model->getWholesalegoodsExtendList($condition, 5);
         View::assign('wholesalegoods_list', $wholesalegoods_list);
-        View::assign('show_page',$wholesalegoods_model->page_info->render());
+        View::assign('show_page', $wholesalegoods_model->page_info->render());
         return View::fetch();
     }
 
@@ -136,20 +135,20 @@ class Promotionwholesale extends AdminControl
         $wholesalequota_model = model('wholesalequota');
 
         $condition = array();
-        $condition[]=array('store_name','like', '%' . input('param.store_name') . '%');
+        $condition[] = array('store_name', 'like', '%' . input('param.store_name') . '%');
         $wholesalequota_list = $wholesalequota_model->getWholesalequotaList($condition, 10, 'wholesalequota_endtime desc');
         View::assign('wholesalequota_list', $wholesalequota_list);
         View::assign('show_page', $wholesalequota_model->page_info->render());
 
         $this->setAdminCurItem('wholesale_quota');
         return View::fetch();
-
     }
 
     /**
      * 设置
      **/
-   public function wholesale_setting() {
+    public function wholesale_setting()
+    {
         if (!(request()->isPost())) {
             $setting = rkcache('config', true);
             View::assign('setting', $setting);
@@ -187,7 +186,7 @@ class Promotionwholesale extends AdminControl
             case 'recommend':
                 $wholesalegoods_model = model('wholesalegoods');
                 $update_array['wholesalegoods_recommend'] = input('param.value');
-                $condition[] = array('wholesalegoods_id','=',input('param.id'));
+                $condition[] = array('wholesalegoods_id', '=', input('param.id'));
                 $result = $wholesalegoods_model->editWholesalegoods($update_array, $condition);
                 break;
         }
@@ -195,12 +194,10 @@ class Promotionwholesale extends AdminControl
         if ($result) {
             echo 'true';
             exit;
-        }
-        else {
+        } else {
             echo 'false';
             exit;
         }
-
     }
 
 
@@ -213,7 +210,7 @@ class Promotionwholesale extends AdminControl
         $param['from_member_id'] = 0;
         $param['member_id'] = $member_id;
         $param['to_member_name'] = $member_name;
-        $param['message_type'] = '1';//表示为系统消息
+        $param['message_type'] = '1'; //表示为系统消息
         $param['msg_content'] = $message;
         $message_model = model('message');
         return $message_model->addMessage($param);
@@ -237,7 +234,7 @@ class Promotionwholesale extends AdminControl
             ), array(
                 'name' => 'wholesale_setting',
                 'text' => lang('wholesale_setting'),
-                'url' => "javascript:dsLayerOpen('".(string)url('Promotionwholesale/wholesale_setting')."','".lang('wholesale_setting')."')"
+                'url' => "javascript:dsLayerOpen('" . (string)url('Promotionwholesale/wholesale_setting') . "','" . lang('wholesale_setting') . "')"
             ),
         );
         if (request()->action() == 'wholesale_detail')
@@ -247,4 +244,4 @@ class Promotionwholesale extends AdminControl
             );
         return $menu_array;
     }
-}
+}

+ 26 - 29
app/admin/controller/Promotionxianshi.php

@@ -1,22 +1,23 @@
 <?php
+
 /**
  * 秒杀
  */
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 use think\facade\Db;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Promotionxianshi extends AdminControl
@@ -24,7 +25,7 @@ class Promotionxianshi extends AdminControl
     public function initialize()
     {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/promotionxianshi.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/promotionxianshi.lang.php');
     }
 
 
@@ -44,13 +45,13 @@ class Promotionxianshi extends AdminControl
         $xianshi_model = model('pxianshi');
         $condition = array();
         if (!empty(input('param.xianshi_name'))) {
-            $condition[]=array('xianshi_name','like', '%' . input('param.xianshi_name') . '%');
+            $condition[] = array('xianshi_name', 'like', '%' . input('param.xianshi_name') . '%');
         }
         if (!empty(input('param.store_name'))) {
-            $condition[]=array('store_name','like', '%' . input('param.store_name') . '%');
+            $condition[] = array('store_name', 'like', '%' . input('param.store_name') . '%');
         }
         if (!empty(input('param.state'))) {
-            $condition[]=array('xianshi_state','=',intval(input('param.state')));
+            $condition[] = array('xianshi_state', '=', intval(input('param.state')));
         }
         $xianshi_list = $xianshi_model->getXianshiList($condition, 10, Db::raw('FIELD(xianshi_state, 1,0,2,3), xianshi_end_time desc'));
         View::assign('xianshi_list', $xianshi_list);
@@ -59,7 +60,7 @@ class Promotionxianshi extends AdminControl
 
         $this->setAdminCurItem('xianshi_list');
         // 输出自营店铺IDS
-        
+
         View::assign('filtered', $condition ? 1 : 0); //是否有查询条件
         View::assign('flippedOwnShopIds', array_flip(model('store')->getOwnShopIds()));
         return View::fetch();
@@ -76,8 +77,7 @@ class Promotionxianshi extends AdminControl
         if ($result) {
             $this->log('取消秒杀活动,活动编号' . $xianshi_id);
             ds_json_encode(10000, lang('ds_common_op_succ'));
-        }
-        else {
+        } else {
             ds_json_encode(10001, lang('ds_common_op_fail'));
         }
     }
@@ -90,16 +90,15 @@ class Promotionxianshi extends AdminControl
         $xianshi_model = model('pxianshi');
         $xianshi_id = input('param.xianshi_id');
         $xianshi_id_array = ds_delete_param($xianshi_id);
-        if($xianshi_id_array === FALSE){
+        if ($xianshi_id_array === FALSE) {
             ds_json_encode(10001, lang('param_error'));
         }
-        $condition = array(array('xianshi_id' ,'in', $xianshi_id_array));
+        $condition = array(array('xianshi_id', 'in', $xianshi_id_array));
         $result = $xianshi_model->delXianshi($condition);
         if ($result) {
             $this->log('删除秒杀活动,活动编号' . $xianshi_id);
             ds_json_encode(10000, lang('ds_common_op_succ'));
-        }
-        else {
+        } else {
             ds_json_encode(10001, lang('ds_common_op_fail'));
         }
     }
@@ -122,10 +121,10 @@ class Promotionxianshi extends AdminControl
 
         //获取秒杀商品列表
         $condition = array();
-        $condition[] = array('xianshi_id','=',$xianshi_id);
-        $xianshigoods_list = $xianshigoods_model->getXianshigoodsExtendList($condition,5);
+        $condition[] = array('xianshi_id', '=', $xianshi_id);
+        $xianshigoods_list = $xianshigoods_model->getXianshigoodsExtendList($condition, 5);
         View::assign('xianshigoods_list', $xianshigoods_list);
-        View::assign('show_page',$xianshigoods_model->page_info->render());
+        View::assign('show_page', $xianshigoods_model->page_info->render());
         return View::fetch();
     }
 
@@ -137,20 +136,20 @@ class Promotionxianshi extends AdminControl
         $xianshiquota_model = model('pxianshiquota');
 
         $condition = array();
-        $condition[]=array('store_name','like', '%' . input('param.store_name') . '%');
+        $condition[] = array('store_name', 'like', '%' . input('param.store_name') . '%');
         $xianshiquota_list = $xianshiquota_model->getXianshiquotaList($condition, 10, 'xianshiquota_endtime desc');
         View::assign('xianshiquota_list', $xianshiquota_list);
         View::assign('show_page', $xianshiquota_model->page_info->render());
 
         $this->setAdminCurItem('xianshi_quota');
         return View::fetch();
-
     }
 
     /**
      * 设置
      **/
-   public function xianshi_setting() {
+    public function xianshi_setting()
+    {
         if (!(request()->isPost())) {
             $setting = rkcache('config', true);
             View::assign('setting', $setting);
@@ -188,7 +187,7 @@ class Promotionxianshi extends AdminControl
             case 'recommend':
                 $pxianshigoods_model = model('pxianshigoods');
                 $update_array['xianshigoods_recommend'] = input('param.value');
-                $condition[] = array('xianshigoods_id','=',input('param.id'));
+                $condition[] = array('xianshigoods_id', '=', input('param.id'));
                 $result = $pxianshigoods_model->editXianshigoods($update_array, $condition);
                 break;
         }
@@ -196,12 +195,10 @@ class Promotionxianshi extends AdminControl
         if ($result) {
             echo 'true';
             exit;
-        }
-        else {
+        } else {
             echo 'false';
             exit;
         }
-
     }
 
 
@@ -214,7 +211,7 @@ class Promotionxianshi extends AdminControl
         $param['from_member_id'] = 0;
         $param['member_id'] = $member_id;
         $param['to_member_name'] = $member_name;
-        $param['message_type'] = '1';//表示为系统消息
+        $param['message_type'] = '1'; //表示为系统消息
         $param['msg_content'] = $message;
         $message_model = model('message');
         return $message_model->addMessage($param);
@@ -238,7 +235,7 @@ class Promotionxianshi extends AdminControl
             ), array(
                 'name' => 'xianshi_setting',
                 'text' => lang('xianshi_setting'),
-                'url' => "javascript:dsLayerOpen('".(string)url('Promotionxianshi/xianshi_setting')."','".lang('xianshi_setting')."')"
+                'url' => "javascript:dsLayerOpen('" . (string)url('Promotionxianshi/xianshi_setting') . "','" . lang('xianshi_setting') . "')"
             ),
         );
         if (request()->action() == 'xianshi_detail')
@@ -248,4 +245,4 @@ class Promotionxianshi extends AdminControl
             );
         return $menu_array;
     }
-}
+}

+ 30 - 33
app/admin/controller/Rechargecard.php

@@ -1,18 +1,18 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Rechargecard extends AdminControl
@@ -21,7 +21,7 @@ class Rechargecard extends AdminControl
     public function initialize()
     {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/rechargecard.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/rechargecard.lang.php');
     }
 
     public function index()
@@ -34,15 +34,15 @@ class Rechargecard extends AdminControl
             $batchflag = trim((string)input('param.batchflag'));
             $state = input('param.state');
             if (strlen($sn) > 0) {
-                $condition[]=array('rc_sn','like', "%{$sn}%");
+                $condition[] = array('rc_sn', 'like', "%{$sn}%");
             }
 
             if (strlen($batchflag) > 0) {
-                $condition[]=array('rc_batchflag','like', "%{$batchflag}%");
+                $condition[] = array('rc_batchflag', 'like', "%{$batchflag}%");
             }
 
             if ($state == '0' || $state == '1') {
-                $condition[]=array('rc_state','=',$state);
+                $condition[] = array('rc_state', '=', $state);
             }
         }
 
@@ -58,8 +58,7 @@ class Rechargecard extends AdminControl
     {
         if (!request()->isPost()) {
             return View::fetch();
-        }
-        else {
+        } else {
             $denomination = (float)input('post.denomination');
             if ($denomination < 0.01) {
                 $this->error(lang('rechargecard_denomination_min'));
@@ -158,7 +157,7 @@ class Rechargecard extends AdminControl
 
             $msg = lang('ds_common_op_succ');
             if ($snOccupied > 0)
-                $msg .= sprintf(lang('rechargecard_number_exist_error'),$snOccupied);
+                $msg .= sprintf(lang('rechargecard_number_exist_error'), $snOccupied);
 
             dsLayerOpenSuccess($msg);
         }
@@ -168,16 +167,17 @@ class Rechargecard extends AdminControl
     /**
      * 删除平台充值卡
      */
-    public function del_card() {
-        $rechargecard_model= model('rechargecard');
+    public function del_card()
+    {
+        $rechargecard_model = model('rechargecard');
         $rc_id = input('param.rc_id');
         $rc_id_array = ds_delete_param($rc_id);
-        if($rc_id_array === FALSE){
+        if ($rc_id_array === FALSE) {
             ds_json_encode(10001, lang('param_error'));
         }
-        $condition = array(array('rc_id','in', $rc_id_array));
-        $condition[]=array('rc_state','=',0);
-        $result =$rechargecard_model->delRechargecard($condition);
+        $condition = array(array('rc_id', 'in', $rc_id_array));
+        $condition[] = array('rc_state', '=', 0);
+        $result = $rechargecard_model->delRechargecard($condition);
         if ($result) {
             ds_json_encode(10000, lang('ds_common_del_succ'));
         } else {
@@ -200,17 +200,17 @@ class Rechargecard extends AdminControl
             $state = trim((string)input('param.state'));
 
             if (strlen($sn) > 0) {
-                $condition[]=array('rc_sn','like', "%{$sn}%");
+                $condition[] = array('rc_sn', 'like', "%{$sn}%");
                 View::assign('sn', $sn);
             }
 
             if (strlen($batchflag) > 0) {
-                $condition[]=array('rc_batchflag','like', "%{$batchflag}%");
+                $condition[] = array('rc_batchflag', 'like', "%{$batchflag}%");
                 View::assign('batchflag', $batchflag);
             }
 
             if ($state === '0' || $state === '1') {
-                $condition[]=array('rc_state','=',$state);
+                $condition[] = array('rc_state', '=', $state);
                 View::assign('state', $state);
             }
         }
@@ -223,18 +223,16 @@ class Rechargecard extends AdminControl
                 for ($i = 1; $i <= $page; $i++) {
                     $limit1 = ($i - 1) * self::EXPORT_SIZE + 1;
                     $limit2 = $i * self::EXPORT_SIZE > $count ? $count : $i * self::EXPORT_SIZE;
-                    $export_list[]=array($i,'=',$limit1 . ' ~ ' . $limit2);
+                    $export_list[] = array($i, '=', $limit1 . ' ~ ' . $limit2);
                 }
                 View::assign('export_list', $export_list);
                 return View::fetch('/public/excel');
-            }
-            else {    //如果数量小,直接下载
-                $data = $rechargecard_model->getRechargecardList($condition, 0,self::EXPORT_SIZE);
+            } else {    //如果数量小,直接下载
+                $data = $rechargecard_model->getRechargecardList($condition, 0, self::EXPORT_SIZE);
 
                 $this->createExcel($data);
             }
-        }
-        else {    //下载
+        } else {    //下载
             $limit1 = (input('param.page') - 1) * self::EXPORT_SIZE;
             $limit2 = self::EXPORT_SIZE;
 
@@ -255,8 +253,8 @@ class Rechargecard extends AdminControl
         $excel_data = array();
         //设置样式
         $excel_obj->setStyle(array(
-                                 'id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')
-                             ));
+            'id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')
+        ));
         //header
         $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('rc_sn'));
         $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('rc_batchflag'));
@@ -275,8 +273,7 @@ class Rechargecard extends AdminControl
             $tmp[] = array('data' => "\t" . date('Y-m-d H:i:s', $v['rc_tscreated']));
             if ($v['rc_state'] == 1 && $v['member_id'] > 0 && $v['rc_tsused'] > 0) {
                 $tmp[] = array('data' => "\t" . $v['member_name']);
-            }
-            else {
+            } else {
                 $tmp[] = array('data' => "\t-");
             }
             $excel_data[] = $tmp;
@@ -294,9 +291,9 @@ class Rechargecard extends AdminControl
             array(
                 'name' => 'index', 'text' => lang('ds_list'), 'url' => (string)url('Rechargecard/index')
             ), array(
-                'name' => 'add_card', 'text' => lang('ds_new'),'url' => "javascript:dsLayerOpen('" . (string)url('Rechargecard/add_card') . "','".lang('ds_new')."')"
+                'name' => 'add_card', 'text' => lang('ds_new'), 'url' => "javascript:dsLayerOpen('" . (string)url('Rechargecard/add_card') . "','" . lang('ds_new') . "')"
             ),
         );
         return $menu_array;
     }
-}
+}

+ 61 - 65
app/admin/controller/Refund.php

@@ -1,18 +1,18 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Refund extends AdminControl
@@ -21,7 +21,7 @@ class Refund extends AdminControl
     public function initialize()
     {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/refund.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/refund.lang.php');
         //向模板页面输出退款退货状态
         $this->getRefundStateArray();
     }
@@ -54,27 +54,27 @@ class Refund extends AdminControl
     {
         $refundreturn_model = model('refundreturn');
         $condition = array();
-        $condition[]=array('refund_type','=',1);
-        $condition[]=array('refund_state','=','2'); //状态:1为处理中,2为待管理员处理,3为已完成
+        $condition[] = array('refund_type', '=', 1);
+        $condition[] = array('refund_state', '=', '2'); //状态:1为处理中,2为待管理员处理,3为已完成
 
         $keyword_type = array('order_sn', 'refund_sn', 'store_name', 'buyer_name', 'goods_name');
         $key = input('get.key');
         $type = input('get.type');
         if (trim($key) != '' && in_array($type, $keyword_type)) {
-            $condition[]=array($type,'like', '%' . $key . '%');
+            $condition[] = array($type, 'like', '%' . $key . '%');
         }
         $add_time_from = input('get.add_time_from');
         $add_time_to = input('get.add_time_to');
         if (trim($add_time_from) != '') {
             $add_time_from = strtotime(trim($add_time_from));
             if ($add_time_from !== false) {
-                $condition[] = array('add_time','>=', $add_time_from);
+                $condition[] = array('add_time', '>=', $add_time_from);
             }
         }
         if (trim($add_time_to) != '') {
-            $add_time_to = strtotime(trim($add_time_to))+86399;
+            $add_time_to = strtotime(trim($add_time_to)) + 86399;
             if ($add_time_to !== false) {
-                $condition[] = array('add_time','<=', $add_time_to);
+                $condition[] = array('add_time', '<=', $add_time_to);
             }
         }
         $refund_list = $refundreturn_model->getRefundList($condition, 10);
@@ -91,25 +91,25 @@ class Refund extends AdminControl
     {
         $refundreturn_model = model('refundreturn');
         $condition = array();
-        $condition[]=array('refund_type','=',1);
+        $condition[] = array('refund_type', '=', 1);
         $keyword_type = array('order_sn', 'refund_sn', 'store_name', 'buyer_name', 'goods_name');
         $key = input('get.key');
         $type = input('get.type');
         if (trim($key) != '' && in_array($type, $keyword_type)) {
-            $condition[]=array($type,'like', '%' . $key . '%');
+            $condition[] = array($type, 'like', '%' . $key . '%');
         }
         $add_time_from = input('get.add_time_from');
         $add_time_to = input('get.add_time_to');
         if (trim($add_time_from) != '') {
             $add_time_from = strtotime(trim($add_time_from));
             if ($add_time_from !== false) {
-                $condition[] = array('add_time','>=', $add_time_from);
+                $condition[] = array('add_time', '>=', $add_time_from);
             }
         }
         if (trim($add_time_to) != '') {
-            $add_time_to = strtotime(trim($add_time_to))+86399;
+            $add_time_to = strtotime(trim($add_time_to)) + 86399;
             if ($add_time_to !== false) {
-                $condition[] = array('add_time','<=', $add_time_to);
+                $condition[] = array('add_time', '<=', $add_time_to);
             }
         }
         $refund_list = $refundreturn_model->getRefundList($condition, 10);
@@ -127,21 +127,21 @@ class Refund extends AdminControl
     {
         $refundreturn_model = model('refundreturn');
         $condition = array();
-        $condition[] = array('refund_id','=',intval(input('param.refund_id')));
-        $refund_list = $refundreturn_model->getRefundList(array_merge($condition,array(array('refund_type','=',1))));
+        $condition[] = array('refund_id', '=', intval(input('param.refund_id')));
+        $refund_list = $refundreturn_model->getRefundList(array_merge($condition, array(array('refund_type', '=', 1))));
         $refund = $refund_list[0];
         //查询交易凭证
         $order_model = model('order');
         $order = $order_model->getOrderInfo(array('order_id' => $refund['order_id']));
         if (request()->isPost()) {
-            if(!in_array(input('post.refund_state'),[3,4])){
-              $this->error(lang('refund_state_null'));
+            if (!in_array(input('post.refund_state'), [3, 4])) {
+                $this->error(lang('refund_state_null'));
             }
             $check = request()->checkToken('__token__');
-            if(false === $check) {
+            if (false === $check) {
                 $this->error('invalid token');
             }
-            if ($refund['refund_state'] != '2') {//检查状态,防止页面刷新不及时造成数据错误
+            if ($refund['refund_state'] != '2') { //检查状态,防止页面刷新不及时造成数据错误
                 $this->error(lang('ds_common_save_fail'));
             }
             $order_id = $refund['order_id'];
@@ -150,10 +150,10 @@ class Refund extends AdminControl
             $refund_array['refund_state'] = '4'; //状态:1为处理中,2为待管理员处理,3为已完成
             $refund_array['admin_message'] = input('post.admin_message');
             if (input('post.refund_state') == '3') {
-                $trade_no=input('param.trade_no');
-                if($trade_no && $trade_no!=$order['trade_no']){
-                    $order_model->editOrder(array('trade_no'=>$trade_no), array(
-                    'order_id' => $order['order_id']
+                $trade_no = input('param.trade_no');
+                if ($trade_no && $trade_no != $order['trade_no']) {
+                    $order_model->editOrder(array('trade_no' => $trade_no), array(
+                        'order_id' => $order['order_id']
                     ));
                     //添加订单日志
                     $data = array();
@@ -166,21 +166,21 @@ class Refund extends AdminControl
                 }
                 $refund_array['refund_state'] = '3';
                 $res = $refundreturn_model->editOrderRefund($refund);
-                $state=$res['code'];
-                if(!$state){
+                $state = $res['code'];
+                if (!$state) {
                     $this->error($res['msg']);
                 }
-            }else{
-                if($refund['order_lock'] == '2'){
+            } else {
+                if ($refund['order_lock'] == '2') {
                     $state = $refundreturn_model->editOrderUnlock($order_id); //订单解锁
-                }else{
+                } else {
                     $state = true;
                 }
                 //自提点订单解锁
-                $chain_order_model=model('chain_order');
+                $chain_order_model = model('chain_order');
                 $chain_order_model->editChainOrderUnlock($order_id);
             }
-            
+
             if ($state) {
                 $refundreturn_model->editRefundreturn($condition, $refund_array);
 
@@ -195,13 +195,13 @@ class Refund extends AdminControl
                 $param['ten_param'] = array(
                     $refund['refund_sn']
                 );
-                $param['param'] = array_merge($param['ali_param'],array(
-                    'refund_url' => HOME_SITE_URL .'/memberrefund/view?refund_id='.$refund['refund_id'],
+                $param['param'] = array_merge($param['ali_param'], array(
+                    'refund_url' => HOME_SITE_URL . '/memberrefund/view?refund_id=' . $refund['refund_id'],
                 ));
                 //微信模板消息
                 $param['weixin_param'] = array(
-                    'url' => config('ds_config.h5_site_url').'/pages/member/refund/RefundView?refund_id='.$refund['refund_id'],
-                    'data'=>array(
+                    'url' => config('ds_config.h5_site_url') . '/pages/member/refund/RefundView?refund_id=' . $refund['refund_id'],
+                    'data' => array(
                         "keyword1" => array(
                             "value" => $refund['order_sn'],
                             "color" => "#333"
@@ -212,12 +212,11 @@ class Refund extends AdminControl
                         )
                     ),
                 );
-                model('cron')->addCron(array('cron_exetime'=>TIMESTAMP,'cron_type'=>'sendMemberMsg','cron_value'=>serialize($param)));
-              
+                model('cron')->addCron(array('cron_exetime' => TIMESTAMP, 'cron_type' => 'sendMemberMsg', 'cron_value' => serialize($param)));
+
                 $this->log('退款确认,退款编号' . $refund['refund_sn']);
                 dsLayerOpenSuccess(lang('ds_common_save_succ'));
-            }
-            else {
+            } else {
                 $this->error(lang('ds_common_save_fail'));
             }
         }
@@ -239,8 +238,8 @@ class Refund extends AdminControl
     {
         $refundreturn_model = model('refundreturn');
         $condition = array();
-        $condition[]=array('refund_id','=',intval(input('param.refund_id')));
-        $condition[] =array('refund_type','=',1);
+        $condition[] = array('refund_id', '=', intval(input('param.refund_id')));
+        $condition[] = array('refund_type', '=', 1);
         $refund_list = $refundreturn_model->getRefundList($condition);
         $refund = $refund_list[0];
         View::assign('refund', $refund);
@@ -283,8 +282,7 @@ class Refund extends AdminControl
             if ($state) {
                 $this->log('新增退款退货原因,编号' . $state);
                 dsLayerOpenSuccess(lang('ds_common_save_succ'));
-            }
-            else {
+            } else {
                 $this->error(lang('ds_common_save_fail'));
             }
         }
@@ -300,7 +298,7 @@ class Refund extends AdminControl
         $refundreturn_model = model('refundreturn');
         $condition = array();
         $reason_id = intval(input('param.reason_id'));
-        $condition[] = array('reason_id','=',$reason_id);
+        $condition[] = array('reason_id', '=', $reason_id);
         $reason_list = $refundreturn_model->getReasonList($condition);
         $reason = $reason_list[$reason_id];
         if (request()->post()) {
@@ -312,8 +310,7 @@ class Refund extends AdminControl
             if ($state) {
                 $this->log('编辑退款退货原因,编号' . $reason_id);
                 dsLayerOpenSuccess(lang('ds_common_save_succ'));
-            }
-            else {
+            } else {
                 $this->error(lang('ds_common_save_fail'));
             }
         }
@@ -330,16 +327,15 @@ class Refund extends AdminControl
         $refundreturn_model = model('refundreturn');
         $reason_id = input('param.reason_id');
         $reason_id_array = ds_delete_param($reason_id);
-        if($reason_id_array === FALSE){
+        if ($reason_id_array === FALSE) {
             ds_json_encode('10001', lang('param_error'));
         }
-        $condition = array(array('reason_id','in', $reason_id_array));
+        $condition = array(array('reason_id', 'in', $reason_id_array));
         $state = $refundreturn_model->delReason($condition);
         if ($state) {
             $this->log('删除退款退货原因,编号' . $reason_id);
             ds_json_encode('10000', lang('ds_common_del_succ'));
-        }
-        else {
+        } else {
             ds_json_encode('10001', lang('ds_common_del_fail'));
         }
     }
@@ -348,7 +344,8 @@ class Refund extends AdminControl
      * 导出
      *
      */
-    public function export_step1() {
+    public function export_step1()
+    {
 
         $refundreturn_model = model('refundreturn');
         $condition = array();
@@ -357,20 +354,20 @@ class Refund extends AdminControl
         $key = input('get.key');
         $type = input('get.type');
         if (trim($key) != '' && in_array($type, $keyword_type)) {
-            $condition[]=array($type,'like', '%' . $key . '%');
+            $condition[] = array($type, 'like', '%' . $key . '%');
         }
         $add_time_from = input('get.add_time_from');
         $add_time_to = input('get.add_time_to');
         if (trim($add_time_from) != '') {
             $add_time_from = strtotime(trim($add_time_from));
             if ($add_time_from !== false) {
-                $condition[] = array('add_time','>=', $add_time_from);
+                $condition[] = array('add_time', '>=', $add_time_from);
             }
         }
         if (trim($add_time_to) != '') {
-            $add_time_to = strtotime(trim($add_time_to))+86399;
+            $add_time_to = strtotime(trim($add_time_to)) + 86399;
             if ($add_time_to !== false) {
-                $condition[] = array('add_time','<=', $add_time_to);
+                $condition[] = array('add_time', '<=', $add_time_to);
             }
         }
         if (!is_numeric(input('param.page'))) {
@@ -386,13 +383,13 @@ class Refund extends AdminControl
                 View::assign('export_list', $export_list);
                 return View::fetch('/public/excel');
             } else { //如果数量小,直接下载
-                $data = $refundreturn_model->getRefundList(array_merge($condition,array(array('refund_type','=',1))), '', '*', 'refund_id desc', self::EXPORT_SIZE);
+                $data = $refundreturn_model->getRefundList(array_merge($condition, array(array('refund_type', '=', 1))), '', '*', 'refund_id desc', self::EXPORT_SIZE);
                 $this->createExcel($data);
             }
         } else { //下载
             $limit1 = (input('param.page') - 1) * self::EXPORT_SIZE;
             $limit2 = self::EXPORT_SIZE;
-            $data = $refundreturn_model->getRefundList(array_merge($condition,array(array('refund_type','=',1))), $limit2, '*', 'refund_id desc');
+            $data = $refundreturn_model->getRefundList(array_merge($condition, array(array('refund_type', '=', 1))), $limit2, '*', 'refund_id desc');
             $this->createExcel($data);
         }
     }
@@ -402,8 +399,9 @@ class Refund extends AdminControl
      *
      * @param array $data
      */
-    private function createExcel($data = array()) {
-        Lang::load(base_path() .'admin/lang/'.config('lang.default_lang').'/export.lang.php');
+    private function createExcel($data = array())
+    {
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/export.lang.php');
         $excel_obj = new \excel\Excel();
         $excel_data = array();
         //设置样式
@@ -450,11 +448,9 @@ class Refund extends AdminControl
         );
         if (request()->action() == 'reason') {
             $menu_array[] = [
-                'name' => 'add_reason', 'text' => lang('add_reason'), 'url' =>"javascript:dsLayerOpen('".(string)url('Refund/add_reason')."','".lang('add_reason')."')"
+                'name' => 'add_reason', 'text' => lang('add_reason'), 'url' => "javascript:dsLayerOpen('" . (string)url('Refund/add_reason') . "','" . lang('add_reason') . "')"
             ];
         }
         return $menu_array;
     }
 }
-
-?>

+ 91 - 82
app/admin/controller/Region.php

@@ -5,31 +5,34 @@
  */
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Db;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Region extends AdminControl {
+class Region extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/region.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/region.lang.php');
         $this->_area_model = model('Area');
         define('MAX_LAYER', 3);
     }
 
-    public function index() {
+    public function index()
+    {
         $region_list = $this->_area_model->getAreaChild(0);
         /* 先根排序 */
         foreach ($region_list as $key => $val) {
@@ -43,7 +46,8 @@ class Region extends AdminControl {
         return View::fetch();
     }
 
-    function ajax_cate() {
+    function ajax_cate()
+    {
         $cate_id = input('param.id');
         if (empty($cate_id)) {
             return;
@@ -70,15 +74,16 @@ class Region extends AdminControl {
     /**
      * ajax操作
      */
-    public function ajax() {
+    public function ajax()
+    {
         $condition = array();
         switch (input('param.branch')) {
-            /**
+                /**
              * 更新地区
              */
             case 'area_name':
                 $area_model = model('area');
-                $condition[] = array('area_id','=',intval(input('get.id')));
+                $condition[] = array('area_id', '=', intval(input('get.id')));
                 $update_array = array();
                 $update_array['area_name'] = addslashes(trim(input('get.value')));
                 $area_model->editArea($update_array, $condition);
@@ -90,12 +95,12 @@ class Region extends AdminControl {
                 exit;
 
                 break;
-            /**
-             * 地区 排序 显示 设置
-             */
+                /**
+                 * 地区 排序 显示 设置
+                 */
             case 'area_sort':
                 $area_model = model('area');
-                $condition[] = array('area_id','=',intval(input('get.id')));
+                $condition[] = array('area_id', '=', intval(input('get.id')));
                 $update_array = array();
                 $update_array['area_sort'] = trim(input('get.value'));
                 $area_model->editArea($update_array, $condition);
@@ -108,11 +113,11 @@ class Region extends AdminControl {
 
             case 'area_region':
                 $area_model = model('area');
-                $condition[] = array('area_id','=',intval(input('get.id')));
+                $condition[] = array('area_id', '=', intval(input('get.id')));
                 $update_array = array();
                 $update_array['area_region'] = trim(input('get.value'));
                 $area_model->editArea($update_array, $condition);
-                
+
                 \areacache::deleteCacheFile();
                 \areacache::updateAreaArrayJs();
                 \areacache::updateAreaPhp();
@@ -121,7 +126,7 @@ class Region extends AdminControl {
 
             case 'area_index_show':
                 $area_model = model('area');
-                $condition[] = array('area_id','=',intval(input('get.id')));
+                $condition[] = array('area_id', '=', intval(input('get.id')));
                 $update_array = array();
                 $update_array[input('get.column')] = input('get.value');
                 $area_model->editArea($update_array, $condition);
@@ -132,14 +137,14 @@ class Region extends AdminControl {
                 echo 'true';
                 exit;
                 break;
-            /**
-             * 添加、修改操作中 检测类别名称是否有重复
-             */
+                /**
+                 * 添加、修改操作中 检测类别名称是否有重复
+                 */
             case 'check_class_name':
                 $area_model = model('area');
-                $condition[]=array('area_name','=',trim(input('param.area_name')));
-                $condition[]=array('area_parent_id','=',intval(input('param.area_parent_id')));
-                $condition[]=array('area_id','<>', intval(input('param.area_id')));
+                $condition[] = array('area_name', '=', trim(input('param.area_name')));
+                $condition[] = array('area_parent_id', '=', intval(input('param.area_parent_id')));
+                $condition[] = array('area_id', '<>', intval(input('param.area_id')));
                 $class_list = $area_model->getAreaList($condition);
                 if (empty($class_list)) {
                     echo 'true';
@@ -152,7 +157,8 @@ class Region extends AdminControl {
         }
     }
 
-    public function add() {
+    public function add()
+    {
         if (!request()->isPost()) {
             $area = array(
                 'area_parent_id' => input('param.area_id'),
@@ -161,20 +167,20 @@ class Region extends AdminControl {
             View::assign('parents', $this->_get_options());
             return View::fetch('form');
         } else {
-            $area_mod=model('area');
+            $area_mod = model('area');
             $area_parent_id = intval(input('param.area_parentid'));
-            
-            $area = $area_mod->getAreaInfo(array('area_id'=>$area_parent_id));
-            $area_deep=intval($area['area_deep'])+1;
-            if($area_deep>MAX_LAYER){
+
+            $area = $area_mod->getAreaInfo(array('area_id' => $area_parent_id));
+            $area_deep = intval($area['area_deep']) + 1;
+            if ($area_deep > MAX_LAYER) {
                 $this->error(sprintf(lang('area_deep_error'), MAX_LAYER));
             }
             $data = array(
                 'area_name' => input('post.area_name'),
-				'area_initial' => input('post.area_initial'),
+                'area_initial' => input('post.area_initial'),
                 'area_region' => input('post.area_region'),
                 'area_parent_id' => $area_parent_id,
-                'area_deep'=> $area_deep,
+                'area_deep' => $area_deep,
                 'area_sort' => input('post.area_sort'),
             );
             $region_validate = ds_validate('region');
@@ -194,18 +200,19 @@ class Region extends AdminControl {
         }
     }
 
-    public function edit() {
+    public function edit()
+    {
         $area_id = intval(input('param.area_id'));
-        if ($area_id<=0) {
+        if ($area_id <= 0) {
             $this->error(lang('param_error'));
         }
-        $area_mod=model('area');
-        $area = $area_mod->getAreaInfo(array('area_id'=>$area_id));
-        if(!$area){
+        $area_mod = model('area');
+        $area = $area_mod->getAreaInfo(array('area_id' => $area_id));
+        if (!$area) {
             $this->error(lang('area_empty'));
         }
         if (!request()->isPost()) {
-            
+
             View::assign('area', $area);
             View::assign('parents', $this->_get_options());
             return View::fetch('form');
@@ -213,7 +220,7 @@ class Region extends AdminControl {
             $area_parent_id = intval(input('param.area_parentid'));
             $data = array(
                 'area_name' => input('post.area_name'),
-				'area_initial' => input('post.area_initial'),
+                'area_initial' => input('post.area_initial'),
                 'area_region' => input('post.area_region'),
                 'area_parent_id' => $area_parent_id,
                 'area_sort' => input('post.area_sort'),
@@ -223,48 +230,48 @@ class Region extends AdminControl {
                 $this->error($region_validate->getError());
             }
 
-            if($data['area_parent_id']==$area_id){
+            if ($data['area_parent_id'] == $area_id) {
                 $this->error(lang('area_parent_error'));
             }
             try {
                 Db::startTrans();
-            if($data['area_parent_id']!=$area['area_parent_id']){
-                //如果不同级
-                $now_deep=intval(Db::name('area')->where('area_id='.$data['area_parent_id'])->value('area_deep'))+1;
-                $old_deep=intval(Db::name('area')->where('area_id='.$area['area_parent_id'])->value('area_deep'))+1;
-                if($now_deep!=$old_deep){
-                    if($now_deep>MAX_LAYER){
-                        $this->error(sprintf(lang('area_deep_error'), MAX_LAYER));
-                    }
-                    $data['area_deep']=$now_deep;
-                    $j=$old_deep;
-                    $subQuery='('.$area_id.')';
-                    while($j<=MAX_LAYER){
-                        //如果自己的上级是自己的下级则报错
-                        if(Db::name('area')->where('area_id='.$data['area_parent_id'].' AND area_parent_id IN '.$subQuery)->value('area_id')){
-                            Db::rollback();
-                            $this->error(lang('area_parent_error'));
+                if ($data['area_parent_id'] != $area['area_parent_id']) {
+                    //如果不同级
+                    $now_deep = intval(Db::name('area')->where('area_id=' . $data['area_parent_id'])->value('area_deep')) + 1;
+                    $old_deep = intval(Db::name('area')->where('area_id=' . $area['area_parent_id'])->value('area_deep')) + 1;
+                    if ($now_deep != $old_deep) {
+                        if ($now_deep > MAX_LAYER) {
+                            $this->error(sprintf(lang('area_deep_error'), MAX_LAYER));
                         }
-                        $subQuery=Db::name('area')->field('area_id')->where('area_parent_id IN '.$subQuery)->buildSql();
-                        $j++;
-                    }
-                    //给他的下级修改深度
-                    $i=$now_deep+1;
-                    $subQuery='('.$area_id.')';
-                    while($i<=MAX_LAYER){
+                        $data['area_deep'] = $now_deep;
+                        $j = $old_deep;
+                        $subQuery = '(' . $area_id . ')';
+                        while ($j <= MAX_LAYER) {
+                            //如果自己的上级是自己的下级则报错
+                            if (Db::name('area')->where('area_id=' . $data['area_parent_id'] . ' AND area_parent_id IN ' . $subQuery)->value('area_id')) {
+                                Db::rollback();
+                                $this->error(lang('area_parent_error'));
+                            }
+                            $subQuery = Db::name('area')->field('area_id')->where('area_parent_id IN ' . $subQuery)->buildSql();
+                            $j++;
+                        }
+                        //给他的下级修改深度
+                        $i = $now_deep + 1;
+                        $subQuery = '(' . $area_id . ')';
+                        while ($i <= MAX_LAYER) {
 
-                        Db::name('area')->where('area_parent_id IN '.$subQuery)->update(array('area_deep'=>$i));
-                        $subQuery='(SELECT area_id FROM '.Db::name('area')->field('area_id')->where('area_parent_id IN '.$subQuery)->buildSql().' a)';
-                        $i++;
+                            Db::name('area')->where('area_parent_id IN ' . $subQuery)->update(array('area_deep' => $i));
+                            $subQuery = '(SELECT area_id FROM ' . Db::name('area')->field('area_id')->where('area_parent_id IN ' . $subQuery)->buildSql() . ' a)';
+                            $i++;
+                        }
                     }
                 }
+                $result = $area_mod->editArea($data, array('area_id' => $area_id));
+            } catch (Exception $e) {
+                Db::rollback();
+                $this->error($e->getMessage());
             }
-            $result = $area_mod->editArea($data,array('area_id'=>$area_id));
-        } catch (Exception $e) {
-            Db::rollback();
-            $this->error($e->getMessage());
-        }
-        Db::commit();
+            Db::commit();
             if ($result >= 0) {
                 \areacache::deleteCacheFile();
                 \areacache::updateAreaArrayJs();
@@ -276,18 +283,19 @@ class Region extends AdminControl {
         }
     }
 
-    public function drop() {
+    public function drop()
+    {
         $area_id = input('param.area_id');
         if (empty($area_id)) {
             $this->error(lang('param_error'));
         }
         //判断此分类下是否有子分类
-        $area_mod=model('area');
-        $result = $area_mod->getAreaInfo(array('area_parent_id'=>$area_id));
+        $area_mod = model('area');
+        $result = $area_mod->getAreaInfo(array('area_parent_id' => $area_id));
         if ($result) {
             ds_json_encode(10001, lang('please_drop_child_region'));
         }
-        $result = $area_mod->delArea(array('area_id'=>$area_id));
+        $result = $area_mod->delArea(array('area_id' => $area_id));
         if ($result) {
             \areacache::deleteCacheFile();
             \areacache::updateAreaArrayJs();
@@ -300,7 +308,8 @@ class Region extends AdminControl {
 
     /* 取得可以作为上级的地区分类数据 */
 
-    function _get_options($except = NULL) {
+    function _get_options($except = NULL)
+    {
         $area = $this->_area_model->getAreaChild();
         if (empty($area)) {
             return;
@@ -310,7 +319,8 @@ class Region extends AdminControl {
         return $tree->getOptions(MAX_LAYER - 1, 0, $except);
     }
 
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -323,7 +333,7 @@ class Region extends AdminControl {
             $menu_array[] = array(
                 'name' => 'add',
                 'text' => lang('ds_new'),
-                'url' =>"javascript:dsLayerOpen('".(string)url('Region/add')."','".lang('ds_add')."')",
+                'url' => "javascript:dsLayerOpen('" . (string)url('Region/add') . "','" . lang('ds_add') . "')",
             );
         }
         if (request()->action() == 'edit') {
@@ -335,5 +345,4 @@ class Region extends AdminControl {
         }
         return $menu_array;
     }
-
 }

+ 68 - 61
app/admin/controller/Returnmanage.php

@@ -1,31 +1,34 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Returnmanage extends AdminControl {
+class Returnmanage extends AdminControl
+{
 
     const EXPORT_SIZE = 1000;
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/returnmanage.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/returnmanage.lang.php');
         //向模板页面输出退款退货状态
         $this->getRefundStateArray();
     }
 
-    function getRefundStateArray($type = 'all') {
+    function getRefundStateArray($type = 'all')
+    {
         $state_array = array(
             '1' => lang('refund_state_confirm'),
             '2' => lang('refund_state_yes'),
@@ -36,7 +39,7 @@ class Returnmanage extends AdminControl {
         $admin_array = array(
             '1' => lang('admin_state_1'),
             '2' => lang('admin_state_2'),
-            '3' => lang('admin_state_3'), 
+            '3' => lang('admin_state_3'),
             '4' => lang('refund_state_no')
         ); //确认状态:1为买家或卖家处理中,2为待平台管理员处理,3为退款退货已完成
         View::assign('admin_array', $admin_array);
@@ -54,38 +57,39 @@ class Returnmanage extends AdminControl {
     /**
      * 待处理列表
      */
-    public function return_manage() {
+    public function return_manage()
+    {
         $refundreturn_model = model('refundreturn');
         $condition = array();
-        $condition[]=array('refund_state','=','2'); //状态:1为处理中,2为待管理员处理,3为已完成
+        $condition[] = array('refund_state', '=', '2'); //状态:1为处理中,2为待管理员处理,3为已完成
         $keyword_type = array('order_sn', 'refund_sn', 'store_name', 'buyer_name', 'goods_name');
 
         $key = input('get.key');
         $type = input('get.type');
         if (trim($key) != '' && in_array($type, $keyword_type)) {
-            $condition[]=array($type,'like', '%' . $key . '%');
+            $condition[] = array($type, 'like', '%' . $key . '%');
         }
         $add_time_from = input('get.add_time_from');
         $add_time_to = input('get.add_time_to');
         if (trim($add_time_from) != '') {
             $add_time_from = strtotime(trim($add_time_from));
             if ($add_time_from !== false) {
-                $condition[] = array('add_time','>=', $add_time_from);
+                $condition[] = array('add_time', '>=', $add_time_from);
             }
         }
         if (trim($add_time_to) != '') {
-            $add_time_to = strtotime(trim($add_time_to))+86399;
+            $add_time_to = strtotime(trim($add_time_to)) + 86399;
             if ($add_time_to !== false) {
-                $condition[] = array('add_time','<=', $add_time_to);
+                $condition[] = array('add_time', '<=', $add_time_to);
             }
         }
         $return_list = $refundreturn_model->getReturnList($condition, 10);
 
         View::assign('return_list', $return_list);
         View::assign('show_page', $refundreturn_model->page_info->render());
-        
+
         View::assign('filtered', $condition ? 1 : 0); //是否有查询条件
-        
+
         $this->setAdminCurItem('return_manage');
         return View::fetch('return_manage');
     }
@@ -93,7 +97,8 @@ class Returnmanage extends AdminControl {
     /**
      * 所有记录
      */
-    public function return_all() {
+    public function return_all()
+    {
         $refundreturn_model = model('refundreturn');
         $condition = array();
 
@@ -101,26 +106,26 @@ class Returnmanage extends AdminControl {
         $key = input('get.key');
         $type = input('get.type');
         if (trim($key) != '' && in_array($type, $keyword_type)) {
-            $condition[]=array($type,'like', '%' . $key . '%');
+            $condition[] = array($type, 'like', '%' . $key . '%');
         }
         $add_time_from = input('get.add_time_from');
         $add_time_to = input('get.add_time_to');
         if (trim($add_time_from) != '') {
             $add_time_from = strtotime(trim($add_time_from));
             if ($add_time_from !== false) {
-                $condition[] = array('add_time','>=', $add_time_from);
+                $condition[] = array('add_time', '>=', $add_time_from);
             }
         }
         if (trim($add_time_to) != '') {
-            $add_time_to = strtotime(trim($add_time_to))+86399;
+            $add_time_to = strtotime(trim($add_time_to)) + 86399;
             if ($add_time_to !== false) {
-                $condition[] = array('add_time','<=', $add_time_to);
+                $condition[] = array('add_time', '<=', $add_time_to);
             }
         }
         $return_list = $refundreturn_model->getReturnList($condition, 10);
         View::assign('return_list', $return_list);
         View::assign('show_page', $refundreturn_model->page_info->render());
-        
+
         View::assign('filtered', $condition ? 1 : 0); //是否有查询条件
         $this->setAdminCurItem('return_all');
         return View::fetch('return_all');
@@ -130,26 +135,27 @@ class Returnmanage extends AdminControl {
      * 退货处理页
      *
      */
-    public function edit() {
+    public function edit()
+    {
         $refundreturn_model = model('refundreturn');
         $condition = array();
-        $condition[] = array('refund_id','=',intval(input('param.refund_id')));
+        $condition[] = array('refund_id', '=', intval(input('param.refund_id')));
         $return = $refundreturn_model->getRefundreturnInfo($condition);
-        if(empty($return)){
+        if (empty($return)) {
             $this->error(lang('param_error'));
         }
         //查询交易凭证
         $order_model = model('order');
         $order = $order_model->getOrderInfo(array('order_id' => $return['order_id']));
         if (request()->isPost()) {
-            if(!in_array(input('post.refund_state'),[3,4])){
-              $this->error(lang('refund_state_null'));
+            if (!in_array(input('post.refund_state'), [3, 4])) {
+                $this->error(lang('refund_state_null'));
             }
             $check = request()->checkToken('__token__');
-            if(false === $check) {
+            if (false === $check) {
                 $this->error('invalid token');
             }
-            if ($return['refund_state'] != '2') {//检查状态,防止页面刷新不及时造成数据错误
+            if ($return['refund_state'] != '2') { //检查状态,防止页面刷新不及时造成数据错误
                 $this->error(lang('ds_common_save_fail'));
             }
             $order_id = $return['order_id'];
@@ -158,10 +164,10 @@ class Returnmanage extends AdminControl {
             $refund_array['refund_state'] = '4'; //状态:1为处理中,2为待管理员处理,3为已完成
             $refund_array['admin_message'] = input('post.admin_message');
             if (input('post.refund_state') == '3') {
-                $trade_no=input('param.trade_no');
-                if($trade_no && $trade_no!=$order['trade_no']){
-                    $order_model->editOrder(array('trade_no'=>$trade_no), array(
-                    'order_id' => $order['order_id']
+                $trade_no = input('param.trade_no');
+                if ($trade_no && $trade_no != $order['trade_no']) {
+                    $order_model->editOrder(array('trade_no' => $trade_no), array(
+                        'order_id' => $order['order_id']
                     ));
                     //添加订单日志
                     $data = array();
@@ -174,18 +180,18 @@ class Returnmanage extends AdminControl {
                 }
                 $refund_array['refund_state'] = '3';
                 $res = $refundreturn_model->editOrderRefund($return);
-                $state=$res['code'];
-                if(!$state){
+                $state = $res['code'];
+                if (!$state) {
                     $this->error($res['msg']);
                 }
-            }else{
-                if($return['order_lock'] == '2'){
+            } else {
+                if ($return['order_lock'] == '2') {
                     $state = $refundreturn_model->editOrderUnlock($order_id); //订单解锁
-                }else{
+                } else {
                     $state = true;
                 }
             }
-            
+
             if ($state) {
                 $refundreturn_model->editRefundreturn($condition, $refund_array);
                 $this->log('退货确认,退货编号' . $return['refund_sn']);
@@ -201,13 +207,13 @@ class Returnmanage extends AdminControl {
                 $param['ten_param'] = array(
                     $return['refund_sn']
                 );
-                $param['param'] = array_merge($param['ali_param'],array(
-                    'refund_url' => HOME_SITE_URL .'/memberreturn/view?return_id='.$return['refund_id'],
+                $param['param'] = array_merge($param['ali_param'], array(
+                    'refund_url' => HOME_SITE_URL . '/memberreturn/view?return_id=' . $return['refund_id'],
                 ));
                 //微信模板消息
                 $param['weixin_param'] = array(
-                    'url' => config('ds_config.h5_site_url').'/pages/member/return/ReturnView?refund_id='.$return['refund_id'],
-                    'data'=>array(
+                    'url' => config('ds_config.h5_site_url') . '/pages/member/return/ReturnView?refund_id=' . $return['refund_id'],
+                    'data' => array(
                         "keyword1" => array(
                             "value" => $return['order_sn'],
                             "color" => "#333"
@@ -218,7 +224,7 @@ class Returnmanage extends AdminControl {
                         )
                     ),
                 );
-                model('cron')->addCron(array('cron_exetime'=>TIMESTAMP,'cron_type'=>'sendMemberMsg','cron_value'=>serialize($param)));
+                model('cron')->addCron(array('cron_exetime' => TIMESTAMP, 'cron_type' => 'sendMemberMsg', 'cron_value' => serialize($param)));
 
                 dsLayerOpenSuccess(lang('ds_common_save_succ'));
             } else {
@@ -239,12 +245,13 @@ class Returnmanage extends AdminControl {
      * 退货记录查看页
      *
      */
-    public function view() {
+    public function view()
+    {
         $refundreturn_model = model('refundreturn');
         $condition = array();
-        $condition[] = array('refund_id','=',intval(input('param.refund_id')));
+        $condition[] = array('refund_id', '=', intval(input('param.refund_id')));
         $return = $refundreturn_model->getRefundreturnInfo($condition);
-        if(empty($return)){
+        if (empty($return)) {
             $this->error(lang('param_error'));
         }
         View::assign('return', $return);
@@ -261,7 +268,8 @@ class Returnmanage extends AdminControl {
      * 导出
      *
      */
-    public function export_step1() {
+    public function export_step1()
+    {
 
         $refundreturn_model = model('refundreturn');
         $condition = array();
@@ -270,20 +278,20 @@ class Returnmanage extends AdminControl {
         $key = input('get.key');
         $type = input('get.type');
         if (trim($key) != '' && in_array($type, $keyword_type)) {
-            $condition[]=array($type,'like', '%' . $key . '%');
+            $condition[] = array($type, 'like', '%' . $key . '%');
         }
         $add_time_from = input('get.add_time_from');
         $add_time_to = input('get.add_time_to');
         if (trim($add_time_from) != '') {
             $add_time_from = strtotime(trim($add_time_from));
             if ($add_time_from !== false) {
-                $condition[] = array('add_time','>=', $add_time_from);
+                $condition[] = array('add_time', '>=', $add_time_from);
             }
         }
         if (trim($add_time_to) != '') {
-            $add_time_to = strtotime(trim($add_time_to))+86399;
+            $add_time_to = strtotime(trim($add_time_to)) + 86399;
             if ($add_time_to !== false) {
-                $condition[] = array('add_time','<=', $add_time_to);
+                $condition[] = array('add_time', '<=', $add_time_to);
             }
         }
         if (!is_numeric(input('param.page'))) {
@@ -315,8 +323,9 @@ class Returnmanage extends AdminControl {
      *
      * @param array $data
      */
-    private function createExcel($data = array()) {
-        Lang::load(base_path() .'admin/lang/'.config('lang.default_lang').'/export.lang.php');
+    private function createExcel($data = array())
+    {
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/export.lang.php');
         $excel_obj = new \excel\Excel();
         $excel_data = array();
         //设置样式
@@ -352,7 +361,8 @@ class Returnmanage extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'return_manage',
@@ -365,14 +375,11 @@ class Returnmanage extends AdminControl {
                 'url' => (string)url('Returnmanage/return_all')
             ),
         );
-        if(request()->action() == 'edit') {
+        if (request()->action() == 'edit') {
             $menu_array[] = array(
                 'name' => 'edit', 'text' => lang('ds_verify'), 'url' => 'javascript:void(0)',
             );
         }
         return $menu_array;
     }
-
 }
-
-?>

+ 16 - 15
app/admin/controller/Seo.php

@@ -1,28 +1,32 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 use think\facade\Db;
+
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Seo extends AdminControl {
+class Seo extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/seo.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/seo.lang.php');
     }
 
-    function index() {
+    function index()
+    {
         if (!request()->isPost()) {
             //读取SEO信息
             $list = Db::name('seo')->select()->toArray();
@@ -31,12 +35,12 @@ class Seo extends AdminControl {
                 $seo[$value['seo_type']] = $value;
             }
             View::assign('seo', $seo);
-//            $category = model('goodsclass')->getGoodsclassForCacheModel();
-//            View::assign('category', $category);
+            //            $category = model('goodsclass')->getGoodsclassForCacheModel();
+            //            View::assign('category', $category);
             return View::fetch('index');
         } else {
             $update = array();
-            $seo = input('post.SEO/a');#获取数组
+            $seo = input('post.SEO/a'); #获取数组
             if (is_array($seo)) {
                 foreach ($seo as $key => $value) {
                     Db::name('seo')->where(array('seo_type' => $key))->update($value);
@@ -46,7 +50,4 @@ class Seo extends AdminControl {
             }
         }
     }
-
 }
-
-?>

+ 44 - 44
app/admin/controller/Snsmalbum.php

@@ -1,19 +1,19 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Snsmalbum extends AdminControl
@@ -21,13 +21,14 @@ class Snsmalbum extends AdminControl
     public function initialize()
     {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/snsmalbum.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/snsmalbum.lang.php');
     }
 
     /**
      * 相册设置
      */
-    public function setting() {
+    public function setting()
+    {
         $config_model = model('config');
         if (request()->isPost()) {
             //构造更新数据数组
@@ -55,26 +56,25 @@ class Snsmalbum extends AdminControl
         // 相册总数量
         $where = array();
         if (input('param.class_name') != '') {
-            $where[]=array('ac_name','like', '%' . trim(input('param.class_name')) . '%');
+            $where[] = array('ac_name', 'like', '%' . trim(input('param.class_name')) . '%');
         }
         if (input('param.user_name') != '') {
-            $where[]=array('member_name','like', '%' . trim(input('param.user_name')) . '%');
+            $where[] = array('member_name', 'like', '%' . trim(input('param.user_name')) . '%');
         }
-        $ac_lists = $snsmalbum_model->getSnsalbumclassList($where,10,'a.*,m.member_name');
+        $ac_lists = $snsmalbum_model->getSnsalbumclassList($where, 10, 'a.*,m.member_name');
         if (!empty($ac_lists)) {
-            $ac_list= $ac_lists;
+            $ac_list = $ac_lists;
             $acid_array = array();
             foreach ($ac_list as $val) {
                 $acid_array[] = $val['ac_id'];
             }
             // 相册中商品数量
-            $ap_count = $snsmalbum_model->getSnsalbumpicCountList(array(array('ac_id','in', $acid_array)),'count(ap_id) as count,ac_id','ac_id');
+            $ap_count = $snsmalbum_model->getSnsalbumpicCountList(array(array('ac_id', 'in', $acid_array)), 'count(ap_id) as count,ac_id', 'ac_id');
             $ap_count = array_under_reset($ap_count, 'ac_id', 1);
             foreach ($ac_list as $key => $val) {
                 if (isset($ap_count[$val['ac_id']])) {
                     $ac_list[$key]['count'] = $ap_count[$val['ac_id']]['count'];
-                }
-                else {
+                } else {
                     $ac_list[$key]['count'] = 0;
                 }
             }
@@ -88,16 +88,17 @@ class Snsmalbum extends AdminControl
     /**
      * 图片列表
      */
-    public function pic_list() {
+    public function pic_list()
+    {
         $snsmalbum_model = model('snsalbum');
         $id = intval(input('param.id'));
         if ($id <= 0) {
             $this->error(lang('param_error'));
         }
         $where = array();
-        $where[]=array('ac_id','=',$id);
+        $where[] = array('ac_id', '=', $id);
         if (input('param.pic_name') != '') {
-            $where[]=array('ap_name|ap_cover','like', '%' . input('param.pic_name') . '%');
+            $where[] = array('ap_name|ap_cover', 'like', '%' . input('param.pic_name') . '%');
         }
         $pic_list = $snsmalbum_model->getSnsalbumpicList($where, 10);
         View::assign('id', $id);
@@ -115,52 +116,51 @@ class Snsmalbum extends AdminControl
         $id = input('param.ap_id');
         if ($id <= 0) {
             ds_json_encode(10001, lang('param_error'));
-        }        
+        }
         $id_array = ds_delete_param($id);
-        if($id_array === FALSE){
+        if ($id_array === FALSE) {
             ds_json_encode(10001, lang('param_error'));
         }
-        $condition = array(array('ap_id' ,'in', $id_array));
+        $condition = array(array('ap_id', 'in', $id_array));
         $snsmalbum_model = model('snsalbum');
         $ap_list = $snsmalbum_model->getSnsalbumpicList($condition);
-            if (empty($ap_list)) {
-                ds_json_encode(10001, lang('snsalbum_choose_need_del_img'));
-            }
-            foreach ($ap_list as $val) {
-                @unlink(BASE_UPLOAD_PATH . DIRECTORY_SEPARATOR . ATTACH_MALBUM . DIRECTORY_SEPARATOR . $val['member_id'] . DIRECTORY_SEPARATOR . $val['ap_cover']);
-                @unlink(BASE_UPLOAD_PATH . DIRECTORY_SEPARATOR . ATTACH_MALBUM . DIRECTORY_SEPARATOR . $val['member_id'] . DIRECTORY_SEPARATOR . str_ireplace('.', '_240.', $val['ap_cover']));
-                @unlink(BASE_UPLOAD_PATH . DIRECTORY_SEPARATOR . ATTACH_MALBUM . DIRECTORY_SEPARATOR . $val['member_id'] . DIRECTORY_SEPARATOR . str_ireplace('.', '_1280.', $val['ap_cover']));
-            }
-            $result = $snsmalbum_model->delSnsalbumpic($condition);
-            if($result){
-                $this->log(lang('ds_del') . lang('ds_member_album_manage') . '[ID:' . $id . ']', 1);
-                ds_json_encode(10000, lang('ds_common_del_succ'));
-            } else {
-                ds_json_encode(10001, lang('ds_common_del_fail'));
-            }
-            
+        if (empty($ap_list)) {
+            ds_json_encode(10001, lang('snsalbum_choose_need_del_img'));
+        }
+        foreach ($ap_list as $val) {
+            @unlink(BASE_UPLOAD_PATH . DIRECTORY_SEPARATOR . ATTACH_MALBUM . DIRECTORY_SEPARATOR . $val['member_id'] . DIRECTORY_SEPARATOR . $val['ap_cover']);
+            @unlink(BASE_UPLOAD_PATH . DIRECTORY_SEPARATOR . ATTACH_MALBUM . DIRECTORY_SEPARATOR . $val['member_id'] . DIRECTORY_SEPARATOR . str_ireplace('.', '_240.', $val['ap_cover']));
+            @unlink(BASE_UPLOAD_PATH . DIRECTORY_SEPARATOR . ATTACH_MALBUM . DIRECTORY_SEPARATOR . $val['member_id'] . DIRECTORY_SEPARATOR . str_ireplace('.', '_1280.', $val['ap_cover']));
+        }
+        $result = $snsmalbum_model->delSnsalbumpic($condition);
+        if ($result) {
+            $this->log(lang('ds_del') . lang('ds_member_album_manage') . '[ID:' . $id . ']', 1);
+            ds_json_encode(10000, lang('ds_common_del_succ'));
+        } else {
+            ds_json_encode(10001, lang('ds_common_del_fail'));
+        }
     }
 
     protected function getAdminItemList($curitem = '')
     {
         $menu_array = array(
             array(
-                'name' => 'index', 
+                'name' => 'index',
                 'text' => lang('snsalbum_class_list'),
                 'url' => (string)url('Snsmalbum/index')
             ), array(
-                'name' => 'setting', 
+                'name' => 'setting',
                 'text' => lang('snsalbum_album_setting'),
-                'url' => "javascript:dsLayerOpen('".(string)url('Snsmalbum/setting')."','".lang('snsalbum_album_setting')."')"
+                'url' => "javascript:dsLayerOpen('" . (string)url('Snsmalbum/setting') . "','" . lang('snsalbum_album_setting') . "')"
             ),
         );
-        if(request()->action()=='pic_list'){
-            $menu_array[]=array(
-                'name' => 'pic_list', 
+        if (request()->action() == 'pic_list') {
+            $menu_array[] = array(
+                'name' => 'pic_list',
                 'text' => lang('snsalbum_pic_list'),
-                'url' => (string)url('Snsmalbum/pic_list',['id'=>input('param.id')])
+                'url' => (string)url('Snsmalbum/pic_list', ['id' => input('param.id')])
             );
         }
         return $menu_array;
     }
-}
+}

+ 28 - 20
app/admin/controller/Snsmember.php

@@ -6,19 +6,20 @@ use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Snsmember extends AdminControl {
+class Snsmember extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize(); // TODO: Change the autogenerated stub
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/snsmember.lang.php');
     }
@@ -26,7 +27,8 @@ class Snsmember extends AdminControl {
     /**
      * 标签列表
      */
-    public function index() {
+    public function index()
+    {
         // 实例化模型
         $snsmember_model = model('snsmember');
         $tag_list = $snsmember_model->getSnsmembertagList('mtag_sort asc', 10);
@@ -39,7 +41,8 @@ class Snsmember extends AdminControl {
     /**
      * 添加标签
      */
-    public function tag_add() {
+    public function tag_add()
+    {
         if (request()->isPost()) {
             /**
              * 验证
@@ -88,7 +91,8 @@ class Snsmember extends AdminControl {
     /**
      * 编辑标签
      */
-    public function tag_edit() {
+    public function tag_edit()
+    {
         // 实例化模型
         if (request()->isPost()) {
             /**
@@ -152,7 +156,8 @@ class Snsmember extends AdminControl {
     /**
      * 删除标签
      */
-    public function tag_del() {
+    public function tag_del()
+    {
         $mtag_id = input('param.id');
         $mtag_id_array = ds_delete_param($mtag_id);
         if ($mtag_id_array == FALSE) {
@@ -173,7 +178,8 @@ class Snsmember extends AdminControl {
     /**
      * 标签所属会员列表
      */
-    public function tag_member() {
+    public function tag_member()
+    {
         // 验证
         $mtag_id = intval(input('param.id'));
         if ($mtag_id <= 0) {
@@ -191,7 +197,8 @@ class Snsmember extends AdminControl {
     /**
      * 删除添加标签会员
      */
-    public function mtag_del() {
+    public function mtag_del()
+    {
         $snsmember_model = model('snsmember');
         $mtag_id = intval(input('param.id'));
         $member_id = intval(input('param.mid'));
@@ -214,11 +221,12 @@ class Snsmember extends AdminControl {
     /**
      * ajax修改
      */
-    public function ajax() {
+    public function ajax()
+    {
         // 实例化模型
         $snsmember_model = model('snsmember');
         switch (input('param.branch')) {
-            /**
+                /**
              * 更新名称、排序、推荐
              */
             case 'membertag_name':
@@ -230,9 +238,9 @@ class Snsmember extends AdminControl {
                 $snsmember_model->editSnsmembertag($update);
                 echo 'true';
                 break;
-            /**
-             * sns_mtagmember表推荐
-             */
+                /**
+                 * sns_mtagmember表推荐
+                 */
             case 'mtagmember_recommend':
                 list($where['mtag_id'], $where['member_id']) = explode(',', input('param.id'));
                 $update = array(
@@ -244,7 +252,8 @@ class Snsmember extends AdminControl {
         }
     }
 
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index', 'text' => lang('sns_member_tag_manage'), 'url' => (string) url('Snsmember/index')
@@ -261,5 +270,4 @@ class Snsmember extends AdminControl {
         }
         return $menu_array;
     }
-
 }

+ 39 - 34
app/admin/controller/Spec.php

@@ -5,52 +5,56 @@
  */
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Spec extends AdminControl {
+class Spec extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/spec.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/spec.lang.php');
     }
 
-    public function index() {
-        
-         /**
+    public function index()
+    {
+
+        /**
          * 查询条件
          */
         $where = array();
-        
+
         $sp_name = trim(input('param.sp_name'));
         if ($sp_name != '') {
-            $where[]=array('sp_name','like', '%' . $sp_name . '%');
+            $where[] = array('sp_name', 'like', '%' . $sp_name . '%');
         }
         $gc_name = trim(input('param.gc_name'));
         if ($gc_name != '') {
-            $where[]=array('gc_name','like', '%' . $gc_name . '%');
+            $where[] = array('gc_name', 'like', '%' . $gc_name . '%');
         }
-        
+
         $spec_model = model('spec');
-        $spec_list	= $spec_model->getSpecList($where, 10);
+        $spec_list    = $spec_model->getSpecList($where, 10);
         View::assign('spec_list', $spec_list);
         View::assign('show_page', $spec_model->page_info->render());
         $this->setAdminCurItem('index');
         return View::fetch();
     }
 
-    public function spec_add() {
+    public function spec_add()
+    {
         if (!(request()->isPost())) {
             $spec = [
                 'gc_id' => 0,
@@ -71,8 +75,8 @@ class Spec extends AdminControl {
                 $this->error($spec_validate->getError());
             }
 
-            $spec_model= model('spec');
-            $result=$spec_model->addSpec($data);
+            $spec_model = model('spec');
+            $result = $spec_model->addSpec($data);
             if ($result) {
                 dsLayerOpenSuccess(lang('ds_common_op_succ'));
             } else {
@@ -81,15 +85,16 @@ class Spec extends AdminControl {
         }
     }
 
-    public function spec_edit() {
+    public function spec_edit()
+    {
         //注:pathinfo地址参数不能通过get方法获取,查看“获取PARAM变量”
         $sp_id = input('param.sp_id');
         if (empty($sp_id)) {
             $this->error(lang('param_error'));
         }
         if (!request()->isPost()) {
-            $spec_model= model('spec');
-            $spec=$spec_model->getSpecInfo($sp_id);
+            $spec_model = model('spec');
+            $spec = $spec_model->getSpecInfo($sp_id);
             View::assign('spec', $spec);
             $gc_list = model('goodsclass')->getGoodsclassListByParentId(0);
             View::assign('gc_list', $gc_list);
@@ -106,11 +111,11 @@ class Spec extends AdminControl {
                 $this->error($spec_validate->getError());
             }
 
-            $spec_model= model('spec');
-            $condition=array();
-            $condition[] = array('sp_id','=',$sp_id);
-            $result=$spec_model->editSpec($data, $condition);
-            if ($result>=0) {
+            $spec_model = model('spec');
+            $condition = array();
+            $condition[] = array('sp_id', '=', $sp_id);
+            $result = $spec_model->editSpec($data, $condition);
+            if ($result >= 0) {
                 dsLayerOpenSuccess(lang('ds_common_op_succ'));
             } else {
                 $this->error(lang('ds_common_op_fail'));
@@ -118,15 +123,16 @@ class Spec extends AdminControl {
         }
     }
 
-    public function spec_drop() {
+    public function spec_drop()
+    {
         //注:pathinfo地址参数不能通过get方法获取,查看“获取PARAM变量”
         $sp_id = intval(input('param.sp_id'));
         // sp_id 值为1 不能删除,用于处理前台显示图片的规格
-        if ($sp_id<=1) {
+        if ($sp_id <= 1) {
             $this->error(lang('param_error'));
         }
         $spec_model = model('spec');
-        $result=$spec_model->delSpec(array('sp_id' => $sp_id));
+        $result = $spec_model->delSpec(array('sp_id' => $sp_id));
         if ($result) {
             ds_json_encode(10000, lang('ds_common_del_succ'));
         } else {
@@ -136,7 +142,8 @@ class Spec extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -146,11 +153,9 @@ class Spec extends AdminControl {
             array(
                 'name' => 'spec_add',
                 'text' => lang('ds_new'),
-                'url' => "javascript:dsLayerOpen('".(string)url('Spec/spec_add')."','".lang('ds_new')."')"
+                'url' => "javascript:dsLayerOpen('" . (string)url('Spec/spec_add') . "','" . lang('ds_new') . "')"
             ),
         );
         return $menu_array;
     }
 }
-
-?>

+ 107 - 101
app/admin/controller/Stataftersale.php

@@ -1,37 +1,39 @@
 <?php
+
 /**
  * 售后统计分析
  */
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
+
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Stataftersale extends AdminControl
 {
-    private $search_arr;//处理后的参数
+    private $search_arr; //处理后的参数
 
     public function initialize()
     {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path().'admin/lang/'.config('lang.default_lang').'/stat.lang.php');
-        include_once root_path(). 'extend/mall/statistics.php';
-        include_once root_path(). 'extend/mall/datehelper.php';
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/stat.lang.php');
+        include_once root_path() . 'extend/mall/statistics.php';
+        include_once root_path() . 'extend/mall/datehelper.php';
         $stat_model = model('stat');
         //存储参数
         $this->search_arr = input('param.');
         //处理搜索时间
-        if (in_array(request()->action(),array('refund'))){
+        if (in_array(request()->action(), array('refund'))) {
             $this->search_arr = $stat_model->dealwithSearchTime($this->search_arr);
             //获得系统年份
             $year_arr = getSystemYearArr();
@@ -49,9 +51,10 @@ class Stataftersale extends AdminControl
     /**
      * 退款统计
      */
-    public function refund(){
+    public function refund()
+    {
         $where = array();
-        if(!isset($this->search_arr['search_type'])){
+        if (!isset($this->search_arr['search_type'])) {
             $this->search_arr['search_type'] = 'day';
         }
         $stat_model = model('stat');
@@ -60,17 +63,17 @@ class Stataftersale extends AdminControl
         $searchtime_arr = $stat_model->getStarttimeAndEndtime($this->search_arr);
 
         $field = ' SUM(refund_amount) as amount ';
-        if($this->search_arr['search_type'] == 'day'){
+        if ($this->search_arr['search_type'] == 'day') {
             //构造横轴数据
-            for($i=0; $i<24; $i++){
+            for ($i = 0; $i < 24; $i++) {
                 $stat_arr['xAxis']['categories'][] = "$i";
                 $statlist[$i] = 0;
             }
             $field .= ' ,HOUR(FROM_UNIXTIME(add_time)) as timeval ';
         }
-        if($this->search_arr['search_type'] == 'week'){
+        if ($this->search_arr['search_type'] == 'week') {
             //构造横轴数据
-            for($i=1; $i<=7; $i++){
+            for ($i = 1; $i <= 7; $i++) {
                 $tmp_weekarr = getSystemWeekArr();
                 //横轴
                 $stat_arr['xAxis']['categories'][] = $tmp_weekarr[$i];
@@ -79,11 +82,11 @@ class Stataftersale extends AdminControl
             }
             $field .= ' ,WEEKDAY(FROM_UNIXTIME(add_time))+1 as timeval ';
         }
-        if($this->search_arr['search_type'] == 'month'){
+        if ($this->search_arr['search_type'] == 'month') {
             //计算横轴的最大量(由于每个月的天数不同)
-            $dayofmonth = date('t',$searchtime_arr[0]);
+            $dayofmonth = date('t', $searchtime_arr[0]);
             //构造横轴数据
-            for($i=1; $i<=$dayofmonth; $i++){
+            for ($i = 1; $i <= $dayofmonth; $i++) {
                 //横轴
                 $stat_arr['xAxis']['categories'][] = $i;
                 $statlist[$i] = 0;
@@ -91,10 +94,10 @@ class Stataftersale extends AdminControl
             $field .= ' ,day(FROM_UNIXTIME(add_time)) as timeval ';
         }
         $where = array();
-        $where[] = array('add_time','between',$searchtime_arr);
+        $where[] = array('add_time', 'between', $searchtime_arr);
         $statlist_tmp = $stat_model->statByRefundreturn($where, $field, 0, 0, 'timeval asc', 'timeval');
-        if ($statlist_tmp){
-            foreach((array)$statlist_tmp as $k=>$v){
+        if ($statlist_tmp) {
+            foreach ((array)$statlist_tmp as $k => $v) {
                 $statlist[$v['timeval']] = floatval($v['amount']);
             }
         }
@@ -105,161 +108,164 @@ class Stataftersale extends AdminControl
         $stat_arr['title'] = lang('refund_amount_statis');
         $stat_arr['yAxis'] = lang('stattrade_refund_total');
         $stat_json = getStatData_LineLabels($stat_arr);
-        View::assign('stat_json',$stat_json);
-        View::assign('searchtime',implode('|',$searchtime_arr));
+        View::assign('stat_json', $stat_json);
+        View::assign('searchtime', implode('|', $searchtime_arr));
         $this->setAdminCurItem('refund');
         return View::fetch('aftersale_refund');
     }
     /**
      * 退款统计
      */
-    public function refundlist(){
+    public function refundlist()
+    {
         $refundreturn_model = model('refundreturn');
         $refundstate_arr = $this->getRefundStateArray();
         $where = array();
-        $statlist= array();
-        $searchtime_arr_tmp = explode('|',$this->search_arr['t']);
-        foreach ((array)$searchtime_arr_tmp as $k=>$v){
+        $statlist = array();
+        $searchtime_arr_tmp = explode('|', $this->search_arr['t']);
+        foreach ((array)$searchtime_arr_tmp as $k => $v) {
             $searchtime_arr[] = intval($v);
         }
-        $where[] = array('add_time','between',$searchtime_arr);
-        if (isset($this->search_arr['exporttype']) && $this->search_arr['exporttype'] == 'excel'){
+        $where[] = array('add_time', 'between', $searchtime_arr);
+        if (isset($this->search_arr['exporttype']) && $this->search_arr['exporttype'] == 'excel') {
             $refundlist_tmp = $refundreturn_model->getRefundreturnList($where, 0);
         } else {
             $refundlist_tmp = $refundreturn_model->getRefundreturnList($where, 10);
         }
         $statheader = array();
-        $statheader[] = array('text'=>lang('ds_order_sn'),'key'=>'order_sn');
-        $statheader[] = array('text'=>lang('ds_refund_sn'),'key'=>'refund_sn');
-        $statheader[] = array('text'=>lang('ds_store_name'),'key'=>'store_name','class'=>'alignleft');
-        $statheader[] = array('text'=>lang('ds_goods_name'),'key'=>'goods_name','class'=>'alignleft');
-        $statheader[] = array('text'=>lang('ds_member_name'),'key'=>'buyer_name');
-        $statheader[] = array('text'=>lang('apply_time'),'key'=>'add_time');
-        $statheader[] = array('text'=>lang('stattrade_refund_total'),'key'=>'refund_amount');
-        $statheader[] = array('text'=>lang('seller_state'),'key'=>'seller_state');
-        $statheader[] = array('text'=>lang('admin_state'),'key'=>'refund_state');
-        foreach ((array)$refundlist_tmp as $k=>$v){
+        $statheader[] = array('text' => lang('ds_order_sn'), 'key' => 'order_sn');
+        $statheader[] = array('text' => lang('ds_refund_sn'), 'key' => 'refund_sn');
+        $statheader[] = array('text' => lang('ds_store_name'), 'key' => 'store_name', 'class' => 'alignleft');
+        $statheader[] = array('text' => lang('ds_goods_name'), 'key' => 'goods_name', 'class' => 'alignleft');
+        $statheader[] = array('text' => lang('ds_member_name'), 'key' => 'buyer_name');
+        $statheader[] = array('text' => lang('apply_time'), 'key' => 'add_time');
+        $statheader[] = array('text' => lang('stattrade_refund_total'), 'key' => 'refund_amount');
+        $statheader[] = array('text' => lang('seller_state'), 'key' => 'seller_state');
+        $statheader[] = array('text' => lang('admin_state'), 'key' => 'refund_state');
+        foreach ((array)$refundlist_tmp as $k => $v) {
             $tmp = $v;
-            foreach ((array)$statheader as $h_k=>$h_v){
+            foreach ((array)$statheader as $h_k => $h_v) {
                 $tmp[$h_v['key']] = $v[$h_v['key']];
-                if ($h_v['key'] == 'add_time'){
-                    $tmp[$h_v['key']] = @date('Y-m-d',$v['add_time']);
+                if ($h_v['key'] == 'add_time') {
+                    $tmp[$h_v['key']] = @date('Y-m-d', $v['add_time']);
                 }
-                if ($h_v['key'] == 'refund_state'){
-                    $tmp[$h_v['key']] = $v['seller_state']==2 ? $refundstate_arr['admin'][$v['refund_state']]:lang('none');
+                if ($h_v['key'] == 'refund_state') {
+                    $tmp[$h_v['key']] = $v['seller_state'] == 2 ? $refundstate_arr['admin'][$v['refund_state']] : lang('none');
                 }
-                if ($h_v['key'] == 'seller_state'){
+                if ($h_v['key'] == 'seller_state') {
                     $tmp[$h_v['key']] = $refundstate_arr['seller'][$v['seller_state']];
                 }
-                if ($h_v['key'] == 'goods_name'){
-                    $tmp[$h_v['key']] = '<a href="'.(string)url('Goods/index', array('goods_id' => $v['goods_id'])).'" target="_blank">'.$v['goods_name'].'</a>';
+                if ($h_v['key'] == 'goods_name') {
+                    $tmp[$h_v['key']] = '<a href="' . (string)url('Goods/index', array('goods_id' => $v['goods_id'])) . '" target="_blank">' . $v['goods_name'] . '</a>';
                 }
             }
             $statlist[] = $tmp;
         }
-        if (isset($this->search_arr['exporttype']) && $this->search_arr['exporttype'] == 'excel'){
+        if (isset($this->search_arr['exporttype']) && $this->search_arr['exporttype'] == 'excel') {
             //导出Excel
             $excel_obj = new \excel\Excel();
             $excel_data = array();
             //设置样式
-            $excel_obj->setStyle(array('id'=>'s_title','Font'=>array('FontName'=>'宋体','Size'=>'12','Bold'=>'1')));
+            $excel_obj->setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
             //header
-            foreach ((array)$statheader as $k=>$v){
-                $excel_data[0][] = array('styleid'=>'s_title','data'=>$v['text']);
+            foreach ((array)$statheader as $k => $v) {
+                $excel_data[0][] = array('styleid' => 's_title', 'data' => $v['text']);
             }
             //data
-            foreach ((array)$statlist as $k=>$v){
-                foreach ((array)$statheader as $h_k=>$h_v){
-                    $excel_data[$k+1][] = array('data'=>$v[$h_v['key']]);
+            foreach ((array)$statlist as $k => $v) {
+                foreach ((array)$statheader as $h_k => $h_v) {
+                    $excel_data[$k + 1][] = array('data' => $v[$h_v['key']]);
                 }
             }
-            $excel_data = $excel_obj->charset($excel_data,CHARSET);
+            $excel_data = $excel_obj->charset($excel_data, CHARSET);
             $excel_obj->addArray($excel_data);
-            $excel_obj->addWorksheet($excel_obj->charset(lang('refund_log'),CHARSET));
-            $excel_obj->generateXML($excel_obj->charset(lang('refund_log'),CHARSET).date('Y-m-d-H',TIMESTAMP));
+            $excel_obj->addWorksheet($excel_obj->charset(lang('refund_log'), CHARSET));
+            $excel_obj->generateXML($excel_obj->charset(lang('refund_log'), CHARSET) . date('Y-m-d-H', TIMESTAMP));
             exit();
         } else {
-            View::assign('statheader',$statheader);
-            View::assign('statlist',$statlist);
-            View::assign('show_page',$refundreturn_model->page_info->render());
-            View::assign('searchtime',input('param.t'));
-            View::assign('actionurl',(string)url('Stataftersale/refundlist',['t'=>$this->search_arr['t']]));
+            View::assign('statheader', $statheader);
+            View::assign('statlist', $statlist);
+            View::assign('show_page', $refundreturn_model->page_info->render());
+            View::assign('searchtime', input('param.t'));
+            View::assign('actionurl', (string)url('Stataftersale/refundlist', ['t' => $this->search_arr['t']]));
             echo View::fetch('stat_listandorder');
         }
     }
     /**
      * 店铺动态评分统计
      */
-    public function evalstore(){
+    public function evalstore()
+    {
         //店铺分类
         View::assign('class_list', rkcache('storeclass', true));
 
         $stat_model = model('stat');
         $where = array();
-        $statlist=array();
-        if(intval(input('param.store_class')) > 0){
-            $where[]=array('storeclass_id','=',intval(input('param.store_class')));
+        $statlist = array();
+        if (intval(input('param.store_class')) > 0) {
+            $where[] = array('storeclass_id', '=', intval(input('param.store_class')));
         }
-        if (isset($this->search_arr['storename'])){
-            $where[]=array('seval_storename','like',"%".trim($this->search_arr['storename'])."%");
+        if (isset($this->search_arr['storename'])) {
+            $where[] = array('seval_storename', 'like', "%" . trim($this->search_arr['storename']) . "%");
         }
         $field = ' seval_storeid, seval_storename';
         $field .= ' ,(SUM(seval_desccredit)/COUNT(*)) as avgdesccredit';
         $field .= ' ,(SUM(seval_servicecredit)/COUNT(*)) as avgservicecredit';
         $field .= ' ,(SUM(seval_deliverycredit)/COUNT(*)) as avgdeliverycredit';
 
-        $orderby_arr = array('avgdesccredit asc','avgdesccredit desc','avgservicecredit asc','avgservicecredit desc','avgdeliverycredit asc','avgdeliverycredit desc');
-        if (!isset($this->search_arr['orderby'])||!in_array(trim($this->search_arr['orderby']),$orderby_arr)){
+        $orderby_arr = array('avgdesccredit asc', 'avgdesccredit desc', 'avgservicecredit asc', 'avgservicecredit desc', 'avgdeliverycredit asc', 'avgdeliverycredit desc');
+        if (!isset($this->search_arr['orderby']) || !in_array(trim($this->search_arr['orderby']), $orderby_arr)) {
             $this->search_arr['orderby'] = 'avgdesccredit desc';
         }
-        $orderby = trim($this->search_arr['orderby']).',seval_storeid';
+        $orderby = trim($this->search_arr['orderby']) . ',seval_storeid';
         //查询评论的店铺总数
         $count_arr = $stat_model->statByStoreAndEvaluatestore($where, 'count(DISTINCT evaluatestore.seval_storeid) as countnum');
         $countnum = intval($count_arr[0]['countnum']);
-        if (isset($this->search_arr['exporttype']) && $this->search_arr['exporttype'] == 'excel'){
+        if (isset($this->search_arr['exporttype']) && $this->search_arr['exporttype'] == 'excel') {
             $statlist_tmp = $stat_model->statByStoreAndEvaluatestore($where, $field, 0, 0, $orderby, 'seval_storeid');
         } else {
             $statlist_tmp = $stat_model->statByStoreAndEvaluatestore($where, $field, 10, 0, $orderby, 'seval_storeid');
         }
-        foreach((array)$statlist_tmp as $k=>$v){
+        foreach ((array)$statlist_tmp as $k => $v) {
             $tmp = $v;
-            $tmp['avgdesccredit'] = round($v['avgdesccredit'],2);
-            $tmp['avgservicecredit'] = round($v['avgservicecredit'],2);
-            $tmp['avgdeliverycredit'] = round($v['avgdeliverycredit'],2);
+            $tmp['avgdesccredit'] = round($v['avgdesccredit'], 2);
+            $tmp['avgservicecredit'] = round($v['avgservicecredit'], 2);
+            $tmp['avgdeliverycredit'] = round($v['avgdeliverycredit'], 2);
             $statlist[] = $tmp;
         }
         //导出Excel
-        if (isset($this->search_arr['exporttype']) && $this->search_arr['exporttype'] == 'excel'){
+        if (isset($this->search_arr['exporttype']) && $this->search_arr['exporttype'] == 'excel') {
             //导出Excel
             $excel_obj = new \excel\Excel();
             $excel_data = array();
             //设置样式
-            $excel_obj->setStyle(array('id'=>'s_title','Font'=>array('FontName'=>'宋体','Size'=>'12','Bold'=>'1')));
+            $excel_obj->setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
             //header
-            $excel_data[0][] = array('styleid'=>'s_title','data'=>lang('ds_store_name'));
-            $excel_data[0][] = array('styleid'=>'s_title','data'=>lang('avgdesccredit'));
-            $excel_data[0][] = array('styleid'=>'s_title','data'=>lang('avgservicecredit'));
-            $excel_data[0][] = array('styleid'=>'s_title','data'=>lang('avgdeliverycredit'));
+            $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('ds_store_name'));
+            $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('avgdesccredit'));
+            $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('avgservicecredit'));
+            $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('avgdeliverycredit'));
             //data
-            foreach ((array)$statlist as $k=>$v){
-                $excel_data[$k+1][] = array('data'=>$v['seval_storename']);
-                $excel_data[$k+1][] = array('data'=>$v['avgdesccredit']);
-                $excel_data[$k+1][] = array('data'=>$v['avgservicecredit']);
-                $excel_data[$k+1][] = array('data'=>$v['avgdeliverycredit']);
+            foreach ((array)$statlist as $k => $v) {
+                $excel_data[$k + 1][] = array('data' => $v['seval_storename']);
+                $excel_data[$k + 1][] = array('data' => $v['avgdesccredit']);
+                $excel_data[$k + 1][] = array('data' => $v['avgservicecredit']);
+                $excel_data[$k + 1][] = array('data' => $v['avgdeliverycredit']);
             }
-            $excel_data = $excel_obj->charset($excel_data,CHARSET);
+            $excel_data = $excel_obj->charset($excel_data, CHARSET);
             $excel_obj->addArray($excel_data);
-            $excel_obj->addWorksheet($excel_obj->charset(lang('store_dynamic_score_statis'),CHARSET));
-            $excel_obj->generateXML($excel_obj->charset(lang('store_dynamic_score_statis'),CHARSET).date('Y-m-d-H',TIMESTAMP));
+            $excel_obj->addWorksheet($excel_obj->charset(lang('store_dynamic_score_statis'), CHARSET));
+            $excel_obj->generateXML($excel_obj->charset(lang('store_dynamic_score_statis'), CHARSET) . date('Y-m-d-H', TIMESTAMP));
             exit();
         }
-        View::assign('statlist',$statlist);
-        View::assign('orderby',$this->search_arr['orderby']);
-        View::assign('show_page',$stat_model->page_info->render());
+        View::assign('statlist', $statlist);
+        View::assign('orderby', $this->search_arr['orderby']);
+        View::assign('show_page', $stat_model->page_info->render());
         $this->setAdminCurItem('evalstore');
         return View::fetch('aftersale_evalstore');
     }
-    function getRefundStateArray($type = 'all') {
+    function getRefundStateArray($type = 'all')
+    {
         $state_array = array(
             '1' => lang('refund_state_confirm'),
             '2' => lang('refund_state_yes'),
@@ -286,10 +292,10 @@ class Stataftersale extends AdminControl
 
     protected function getAdminItemList()
     {
-       $menu_array=array(
-           array('name'=>'refund','text'=>lang('stat_refund'),'url'=>(string)url('Stataftersale/refund')),
-           array('name'=>'evalstore','text'=>lang('stat_evalstore'),'url'=>(string)url('Stataftersale/evalstore')),
-       );
-       return $menu_array;
+        $menu_array = array(
+            array('name' => 'refund', 'text' => lang('stat_refund'), 'url' => (string)url('Stataftersale/refund')),
+            array('name' => 'evalstore', 'text' => lang('stat_evalstore'), 'url' => (string)url('Stataftersale/evalstore')),
+        );
+        return $menu_array;
     }
-}
+}

+ 47 - 49
app/admin/controller/Statgeneral.php

@@ -1,18 +1,18 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Statgeneral extends AdminControl
@@ -20,8 +20,8 @@ class Statgeneral extends AdminControl
     public function initialize()
     {
         parent::initialize(); // TODO: Change the autogenerated stub
-        include_once root_path(). 'extend/mall/statistics.php';
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/stat.lang.php');
+        include_once root_path() . 'extend/mall/statistics.php';
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/stat.lang.php');
     }
 
     /**
@@ -42,8 +42,8 @@ class Statgeneral extends AdminControl
 
         //查询订单表下单量、下单金额、下单客户数、平均客单价
         $where = array();
-        $where[] = array('order_isvalid','=',1); //计入统计的有效订单
-        $where[] = array('order_add_time','between',array($stime, $etime));
+        $where[] = array('order_isvalid', '=', 1); //计入统计的有效订单
+        $where[] = array('order_add_time', 'between', array($stime, $etime));
         $field = ' COUNT(*) as ordernum, SUM(order_amount) as orderamount, COUNT(DISTINCT buyer_id) as ordermembernum, AVG(order_amount) as orderavg ';
         $stat_order = $stat_model->getoneByStatorder($where, $field);
         $statnew_arr['ordernum'] = ($t = $stat_order['ordernum']) ? $t : 0;
@@ -54,8 +54,8 @@ class Statgeneral extends AdminControl
 
         //查询订单商品表下单商品数
         $where = array();
-        $where[] = array('order_isvalid','=',1);//计入统计的有效订单
-        $where[] = array('order_add_time','between',array($stime, $etime));
+        $where[] = array('order_isvalid', '=', 1); //计入统计的有效订单
+        $where[] = array('order_add_time', 'between', array($stime, $etime));
         $field = ' SUM(goods_num) as ordergoodsnum,AVG(goods_pay_price/goods_num) as priceavg ';
         $stat_ordergoods = $stat_model->getoneByStatordergoods($where, $field);
         $statnew_arr['ordergoodsnum'] = ($t = $stat_ordergoods['ordergoodsnum']) ? $t : 0;
@@ -64,7 +64,7 @@ class Statgeneral extends AdminControl
 
         //新增会员数
         $where = array();
-        $where[] = array('member_addtime','between',array($stime, $etime));
+        $where[] = array('member_addtime', 'between', array($stime, $etime));
         $field = ' COUNT(*) as newmember ';
         $stat_member = $stat_model->getOneByMember($where, $field);
         $statnew_arr['newmember'] = ($t = $stat_member['newmember']) ? $t : 0;
@@ -79,7 +79,7 @@ class Statgeneral extends AdminControl
 
         //新增店铺
         $where = array();
-        $where[] = array('store_addtime','between',array($stime, $etime));
+        $where[] = array('store_addtime', 'between', array($stime, $etime));
         $field = ' COUNT(*) as newstore ';
         $stat_store = $stat_model->getOneByStore($where, $field);
         $statnew_arr['newstore'] = ($t = $stat_store['newstore']) ? $t : 0;
@@ -103,18 +103,18 @@ class Statgeneral extends AdminControl
         //构造横轴数据
         for ($i = 0; $i < 24; $i++) {
             //统计图数据
-            $curr_arr[$i] = 0;//今天
-            $up_arr[$i] = 0;//昨天
+            $curr_arr[$i] = 0; //今天
+            $up_arr[$i] = 0; //昨天
             //横轴
             $stat_arr['xAxis']['categories'][] = "$i";
         }
-        $stime = $stat_time - 86400;//昨天0点
-        $etime = $stat_time + 86400 - 1;//今天24点
-        $yesterday_day = @date('d', $stime);//昨天日期
-        $today_day = @date('d', $etime);//今天日期
+        $stime = $stat_time - 86400; //昨天0点
+        $etime = $stat_time + 86400 - 1; //今天24点
+        $yesterday_day = @date('d', $stime); //昨天日期
+        $today_day = @date('d', $etime); //今天日期
         $where = array();
-        $where[] = array('order_isvalid','=',1);//计入统计的有效订单
-        $where[] = array('order_add_time','between',array($stime, $etime));
+        $where[] = array('order_isvalid', '=', 1); //计入统计的有效订单
+        $where[] = array('order_add_time', 'between', array($stime, $etime));
         $field = ' SUM(order_amount) as orderamount,DAY(FROM_UNIXTIME(order_add_time)) as dayval,HOUR(FROM_UNIXTIME(order_add_time)) as hourval ';
         $stat_order = $stat_model->statByStatorder($where, $field, 0, 0, '', 'dayval,hourval');
         if ($stat_order) {
@@ -140,22 +140,22 @@ class Statgeneral extends AdminControl
         /*
          * 7日内店铺销售TOP30
          */
-        $stime = $stat_time - 86400 * 6;//7天前0点
-        $etime = $stat_time + 86400 - 1;//今天24点
+        $stime = $stat_time - 86400 * 6; //7天前0点
+        $etime = $stat_time + 86400 - 1; //今天24点
         $where = array();
-        $where[] = array('order_isvalid','=',1);//计入统计的有效订单
-        $where[] = array('order_add_time','between',array($stime, $etime));
+        $where[] = array('order_isvalid', '=', 1); //计入统计的有效订单
+        $where[] = array('order_add_time', 'between', array($stime, $etime));
         $field = ' SUM(order_amount) as orderamount, store_id, store_name ';
         $storetop30_arr = $stat_model->statByStatorder($where, $field, 0, 0, 'orderamount desc', 'store_id');
 
         /*
          * 7日内商品销售TOP30
          */
-        $stime = $stat_time - 86400 * 6;//7天前0点
-        $etime = $stat_time + 86400 - 1;//今天24点
+        $stime = $stat_time - 86400 * 6; //7天前0点
+        $etime = $stat_time + 86400 - 1; //今天24点
         $where = array();
-        $where[] = array('order_isvalid','=',1);//计入统计的有效订单
-        $where[] = array('order_add_time','between',array($stime, $etime));
+        $where[] = array('order_isvalid', '=', 1); //计入统计的有效订单
+        $where[] = array('order_add_time', 'between', array($stime, $etime));
         $field = ' sum(goods_num) as ordergoodsnum, goods_id, goods_name ';
         $goodstop30_arr = $stat_model->statByStatordergoods($where, $field, 0, 30, 'ordergoodsnum desc', 'goods_id');
         View::assign('goodstop30_arr', $goodstop30_arr);
@@ -175,18 +175,18 @@ class Statgeneral extends AdminControl
         $config_model = model('config');
         if (request()->isPost()) {
             $update_array = array();
-            
+
             $pricerange_temp_array = input('post.pricerange/a');
             if (is_array($pricerange_temp_array)) {
                 foreach ($pricerange_temp_array as $k => $v) {
-                    if(!is_numeric($v['s']) || !is_numeric($v['e'])){
-                      $this->error(lang('is_numeric_error'));
+                    if (!is_numeric($v['s']) || !is_numeric($v['e'])) {
+                        $this->error(lang('is_numeric_error'));
                     }
-                    if($v['s']<0 || $v['e']<0){
-                      $this->error(lang('is_zero_error'));
+                    if ($v['s'] < 0 || $v['e'] < 0) {
+                        $this->error(lang('is_zero_error'));
                     }
-                    if($v['s']>$v['e']){
-                      $this->error(lang('amount_set_error'));
+                    if ($v['s'] > $v['e']) {
+                        $this->error(lang('amount_set_error'));
                     }
                     $pricerange_arr[] = $v;
                 }
@@ -222,29 +222,27 @@ class Statgeneral extends AdminControl
             $pricerange_temp_array = input('post.pricerange/a');
             if (is_array($pricerange_temp_array)) {
                 foreach ($pricerange_temp_array as $k => $v) {
-                    if(!is_numeric($v['s']) || !is_numeric($v['e'])){
-                      $this->error(lang('is_numeric_error'));
+                    if (!is_numeric($v['s']) || !is_numeric($v['e'])) {
+                        $this->error(lang('is_numeric_error'));
                     }
-                    if($v['s']<0 || $v['e']<0){
-                      $this->error(lang('is_zero_error'));
+                    if ($v['s'] < 0 || $v['e'] < 0) {
+                        $this->error(lang('is_zero_error'));
                     }
-                    if($v['s']>$v['e']){
-                      $this->error(lang('amount_set_error'));
+                    if ($v['s'] > $v['e']) {
+                        $this->error(lang('amount_set_error'));
                     }
                     $pricerange_arr[] = $v;
                 }
                 $update_array['stat_orderpricerange'] = serialize($pricerange_arr);
-            }
-            else {
+            } else {
                 $update_array['stat_orderpricerange'] = '';
             }
             $result = $config_model->editConfig($update_array);
             if ($result === true) {
-                $this->log(lang('ds_edit').lang('stat_setting'), 1);
+                $this->log(lang('ds_edit') . lang('stat_setting'), 1);
                 $this->success(lang('ds_common_save_succ'));
-            }
-            else {
-                $this->log(lang('ds_edit').lang('stat_setting'), 0);
+            } else {
+                $this->log(lang('ds_edit') . lang('stat_setting'), 0);
                 $this->error(lang('ds_common_save_fail'));
             }
         } else {
@@ -269,4 +267,4 @@ class Statgeneral extends AdminControl
         );
         return $menu_array;
     }
-}
+}

+ 109 - 103
app/admin/controller/Statgoods.php

@@ -1,40 +1,42 @@
 <?php
+
 /**
  * 商品统计分析
  */
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 use think\facade\Db;
+
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Statgoods extends AdminControl
 {
-    private $search_arr;//处理后的参数
-    private $gc_arr;//分类数组
-    private $choose_gcid;//选择的分类ID
+    private $search_arr; //处理后的参数
+    private $gc_arr; //分类数组
+    private $choose_gcid; //选择的分类ID
 
     public function initialize()
     {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path().'admin/lang/'.config('lang.default_lang').'/stat.lang.php');
-        include_once root_path(). 'extend/mall/statistics.php';
-        include_once root_path(). 'extend/mall/datehelper.php';
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/stat.lang.php');
+        include_once root_path() . 'extend/mall/statistics.php';
+        include_once root_path() . 'extend/mall/datehelper.php';
         $stat_model = model('stat');
         //存储参数
         $this->search_arr = input('param.');
         //处理搜索时间
-        if (in_array(request()->action(),array('pricerange','hotgoods','goods_sale'))){
+        if (in_array(request()->action(), array('pricerange', 'hotgoods', 'goods_sale'))) {
             $this->search_arr = $stat_model->dealwithSearchTime($this->search_arr);
             //获得系统年份
             $year_arr = getSystemYearArr();
@@ -50,66 +52,67 @@ class Statgoods extends AdminControl
         /**
          * 处理商品分类
          */
-        $this->choose_gcid = ($t = intval(input('param.choose_gcid')))>0?$t:0;
-        $gccache_arr = model('goodsclass')->getGoodsclassCache($this->choose_gcid,3);
+        $this->choose_gcid = ($t = intval(input('param.choose_gcid'))) > 0 ? $t : 0;
+        $gccache_arr = model('goodsclass')->getGoodsclassCache($this->choose_gcid, 3);
         $this->gc_arr = $gccache_arr['showclass'];
-        View::assign('gc_json',json_encode($gccache_arr['showclass']));
-        View::assign('gc_choose_json',json_encode($gccache_arr['choose_gcid']));
+        View::assign('gc_json', json_encode($gccache_arr['showclass']));
+        View::assign('gc_choose_json', json_encode($gccache_arr['choose_gcid']));
     }
 
     /**
      * 价格区间统计
      */
-    public function pricerange(){
-        if(!isset($this->search_arr['search_type']) || !$this->search_arr['search_type']){
+    public function pricerange()
+    {
+        if (!isset($this->search_arr['search_type']) || !$this->search_arr['search_type']) {
             $this->search_arr['search_type'] = 'day';
         }
         $stat_model = model('stat');
         //获得搜索的开始时间和结束时间
         $searchtime_arr = $stat_model->getStarttimeAndEndtime($this->search_arr);
         $where = array();
-        $where[] = array('order_isvalid','=',1);//计入统计的有效订单
-        $where[] = array('order_add_time','between',$searchtime_arr);
+        $where[] = array('order_isvalid', '=', 1); //计入统计的有效订单
+        $where[] = array('order_add_time', 'between', $searchtime_arr);
         //商品分类
-        if ($this->choose_gcid > 0){
+        if ($this->choose_gcid > 0) {
             //获得分类深度
             $depth = $this->gc_arr[$this->choose_gcid]['depth'];
-            $where[] = array('gc_parentid_'.$depth,'=',$this->choose_gcid);
+            $where[] = array('gc_parentid_' . $depth, '=', $this->choose_gcid);
         }
         $field = '1';
-        $pricerange_arr = ($t = trim(cache('config')['stat_pricerange']))?unserialize($t):'';
-        if ($pricerange_arr){
+        $pricerange_arr = ($t = trim(cache('config')['stat_pricerange'])) ? unserialize($t) : '';
+        if ($pricerange_arr) {
             $stat_arr['series'][0]['name'] = lang('statstore_ordernum');
             //设置价格区间最后一项,最后一项只有开始值没有结束值
             $pricerange_count = count($pricerange_arr);
-            if ($pricerange_arr[$pricerange_count-1]['e']){
-                $pricerange_arr[$pricerange_count]['s'] = $pricerange_arr[$pricerange_count-1]['e'] + 1;
+            if ($pricerange_arr[$pricerange_count - 1]['e']) {
+                $pricerange_arr[$pricerange_count]['s'] = $pricerange_arr[$pricerange_count - 1]['e'] + 1;
                 $pricerange_arr[$pricerange_count]['e'] = '';
             }
-            foreach ((array)$pricerange_arr as $k=>$v){
+            foreach ((array)$pricerange_arr as $k => $v) {
                 $v['s'] = intval($v['s']);
                 $v['e'] = intval($v['e']);
                 //构造查询字段
-                if ($v['e']){
+                if ($v['e']) {
                     $field .= " ,SUM(IF(goods_pay_price/goods_num > {$v['s']} and goods_pay_price/goods_num <= {$v['e']},goods_num,0)) as goodsnum_{$k}";
                 } else {
                     $field .= " ,SUM(IF(goods_pay_price/goods_num > {$v['s']},goods_num,0)) as goodsnum_{$k}";
                 }
             }
 
-            $ordergooods_list = Db::query('SELECT '.$field.' FROM '.config('database.connections.mysql.prefix').'statordergoods WHERE order_isvalid=1 AND order_add_time BETWEEN '.$searchtime_arr[0].' AND '.$searchtime_arr[1].($this->choose_gcid > 0?(' AND gc_parentid_'.$depth.'='.$this->choose_gcid):''));
-            if($ordergooods_list){
-                $ordergooods_list= current($ordergooods_list);
-                foreach ((array)$pricerange_arr as $k=>$v){
+            $ordergooods_list = Db::query('SELECT ' . $field . ' FROM ' . config('database.connections.mysql.prefix') . 'statordergoods WHERE order_isvalid=1 AND order_add_time BETWEEN ' . $searchtime_arr[0] . ' AND ' . $searchtime_arr[1] . ($this->choose_gcid > 0 ? (' AND gc_parentid_' . $depth . '=' . $this->choose_gcid) : ''));
+            if ($ordergooods_list) {
+                $ordergooods_list = current($ordergooods_list);
+                foreach ((array)$pricerange_arr as $k => $v) {
                     //横轴
-                    if($v['e']){
-                        $stat_arr['xAxis']['categories'][] = $v['s'].'-'.$v['e'];
+                    if ($v['e']) {
+                        $stat_arr['xAxis']['categories'][] = $v['s'] . '-' . $v['e'];
                     } else {
-                        $stat_arr['xAxis']['categories'][] = $v['s'].lang('above');
+                        $stat_arr['xAxis']['categories'][] = $v['s'] . lang('above');
                     }
                     //统计图数据
-                    if (isset($ordergooods_list['goodsnum_'.$k])){
-                        $stat_arr['series'][0]['data'][] = intval($ordergooods_list['goodsnum_'.$k]);
+                    if (isset($ordergooods_list['goodsnum_' . $k])) {
+                        $stat_arr['series'][0]['data'][] = intval($ordergooods_list['goodsnum_' . $k]);
                     } else {
                         $stat_arr['series'][0]['data'][] = 0;
                     }
@@ -124,32 +127,34 @@ class Statgoods extends AdminControl
             $pricerange_statjson = '';
         }
 
-        View::assign('pricerange_statjson',$pricerange_statjson);
-        View::assign('searchtime',implode('|',$searchtime_arr));
+        View::assign('pricerange_statjson', $pricerange_statjson);
+        View::assign('searchtime', implode('|', $searchtime_arr));
         $this->setAdminCurItem('pricerange');
         return View::fetch('stat_goods_prange');
     }
     /**
      * 热卖商品
      */
-    public function hotgoods(){
-        if(!isset($this->search_arr['search_type']) || !$this->search_arr['search_type']){
+    public function hotgoods()
+    {
+        if (!isset($this->search_arr['search_type']) || !$this->search_arr['search_type']) {
             $this->search_arr['search_type'] = 'day';
         }
         $stat_model = model('stat');
         //获得搜索的开始时间和结束时间
         $searchtime_arr = $stat_model->getStarttimeAndEndtime($this->search_arr);
-        View::assign('searchtime',implode('|',$searchtime_arr));
+        View::assign('searchtime', implode('|', $searchtime_arr));
         $this->setAdminCurItem('hotgoods');
         return View::fetch('stat_goods_hotgoods');
     }
     /**
      * 热卖商品列表
      */
-    public function hotgoods_list(){
+    public function hotgoods_list()
+    {
         $stat_model = model('stat');
-        $type=input('param.type');
-        switch ($type){
+        $type = input('param.type');
+        switch ($type) {
             case 'goodsnum':
                 $sort_text = lang('statstore_ordernum');
                 break;
@@ -159,28 +164,28 @@ class Statgoods extends AdminControl
                 break;
         }
         //构造横轴数据
-        for($i=1; $i<=50; $i++){
+        for ($i = 1; $i <= 50; $i++) {
             //数据
-            $stat_arr['series'][0]['data'][] = array('name'=>'','y'=>0);
+            $stat_arr['series'][0]['data'][] = array('name' => '', 'y' => 0);
             //横轴
             $stat_arr['xAxis']['categories'][] = "$i";
         }
         $where = array();
-        $where[] = array('order_isvalid','=',1);//计入统计的有效订单
-        $searchtime_arr_tmp = explode('|',$this->search_arr['t']);
-        foreach ((array)$searchtime_arr_tmp as $k=>$v){
+        $where[] = array('order_isvalid', '=', 1); //计入统计的有效订单
+        $searchtime_arr_tmp = explode('|', $this->search_arr['t']);
+        foreach ((array)$searchtime_arr_tmp as $k => $v) {
             $searchtime_arr[] = intval($v);
         }
-        $where[] = array('order_add_time','between',$searchtime_arr);
+        $where[] = array('order_add_time', 'between', $searchtime_arr);
         //商品分类
-        if ($this->choose_gcid > 0){
+        if ($this->choose_gcid > 0) {
             //获得分类深度
             $depth = $this->gc_arr[$this->choose_gcid]['depth'];
-            $where[] = array('gc_parentid_'.$depth,'=',$this->choose_gcid);
+            $where[] = array('gc_parentid_' . $depth, '=', $this->choose_gcid);
         }
         //查询统计数据
         $field = ' goods_id,goods_name ';
-        switch ($type){
+        switch ($type) {
             case 'goodsnum':
                 $field .= ' ,SUM(goods_num) as goodsnum ';
                 $orderby = 'goodsnum desc';
@@ -193,16 +198,16 @@ class Statgoods extends AdminControl
         }
         $orderby .= ',goods_id';
         $statlist = $stat_model->statByStatordergoods($where, $field, 0, 50, $orderby, 'goods_id');
-        foreach ((array)$statlist as $k=>$v){
-            switch ($type){
+        foreach ((array)$statlist as $k => $v) {
+            switch ($type) {
                 case 'goodsnum':
-                    $stat_arr['series'][0]['data'][$k] = array('name'=>strval($v['goods_name']),'y'=>intval($v[input('get.type')]));
+                    $stat_arr['series'][0]['data'][$k] = array('name' => strval($v['goods_name']), 'y' => intval($v[input('get.type')]));
                     break;
                 case 'orderamount':
-                    $stat_arr['series'][0]['data'][$k] = array('name'=>strval($v['goods_name']),'y'=>floatval($v[input('get.type')]));
+                    $stat_arr['series'][0]['data'][$k] = array('name' => strval($v['goods_name']), 'y' => floatval($v[input('get.type')]));
                     break;
             }
-            $statlist[$k]['sort'] = $k+1;
+            $statlist[$k]['sort'] = $k + 1;
         }
         $stat_arr['series'][0]['name'] = $sort_text;
         $stat_arr['legend']['enabled'] = false;
@@ -210,18 +215,19 @@ class Statgoods extends AdminControl
         $stat_arr['title'] = lang('statgoods_hot_top_50');
         $stat_arr['yAxis'] = $sort_text;
         $stat_json = getStatData_Column2D($stat_arr);
-        View::assign('stat_json',$stat_json);
-        View::assign('statlist',$statlist);
-        View::assign('sort_text',$sort_text);
-        View::assign('stat_field',$type);
+        View::assign('stat_json', $stat_json);
+        View::assign('statlist', $statlist);
+        View::assign('sort_text', $sort_text);
+        View::assign('stat_field', $type);
         echo View::fetch('stat_hotgoods_list');
     }
 
     /**
      * 商品销售明细
      */
-    public function goods_sale(){
-        if(!isset($this->search_arr['search_type']) || !$this->search_arr['search_type']){
+    public function goods_sale()
+    {
+        if (!isset($this->search_arr['search_type']) || !$this->search_arr['search_type']) {
             $this->search_arr['search_type'] = 'day';
         }
         $stat_model = model('stat');
@@ -229,75 +235,75 @@ class Statgoods extends AdminControl
         $searchtime_arr = $stat_model->getStarttimeAndEndtime($this->search_arr);
         //获取相关数据
         $where = array();
-        $where[] = array('order_isvalid','=',1);//计入统计的有效订单
-        $where[] = array('order_add_time','between',$searchtime_arr);
+        $where[] = array('order_isvalid', '=', 1); //计入统计的有效订单
+        $where[] = array('order_add_time', 'between', $searchtime_arr);
         //品牌
         $brand_id = intval(input('param.b_id'));
-        if ($brand_id > 0){
-            $where[] = array('brand_id','=',$brand_id);
+        if ($brand_id > 0) {
+            $where[] = array('brand_id', '=', $brand_id);
         }
         //商品分类
-        if ($this->choose_gcid > 0){
+        if ($this->choose_gcid > 0) {
             //获得分类深度
             $depth = $this->gc_arr[$this->choose_gcid]['depth'];
-            $where[]=array('gc_parentid_'.$depth,'=',$this->choose_gcid);
+            $where[] = array('gc_parentid_' . $depth, '=', $this->choose_gcid);
         }
-        if(trim(input('param.goods_name'))){
-            $where[]=array('goods_name','like','%'.trim(input('param.goods_name')).'%');
+        if (trim(input('param.goods_name'))) {
+            $where[] = array('goods_name', 'like', '%' . trim(input('param.goods_name')) . '%');
         }
-        if(trim(input('param.store_name'))){
-            $where[]=array('store_name','like','%'.trim(input('param.store_name')).'%');
+        if (trim(input('param.store_name'))) {
+            $where[] = array('store_name', 'like', '%' . trim(input('param.store_name')) . '%');
         }
         $field = 'goods_id,goods_name,store_id,store_name,goods_commonid,SUM(goods_num) as goodsnum,COUNT(DISTINCT order_id) as ordernum,SUM(goods_pay_price) as goodsamount';
         //排序
-        $orderby_arr = array('goodsnum asc','goodsnum desc','ordernum asc','ordernum desc','goodsamount asc','goodsamount desc');
-        if (!isset($this->search_arr['orderby']) || !in_array(trim($this->search_arr['orderby']),$orderby_arr)){
+        $orderby_arr = array('goodsnum asc', 'goodsnum desc', 'ordernum asc', 'ordernum desc', 'goodsamount asc', 'goodsamount desc');
+        if (!isset($this->search_arr['orderby']) || !in_array(trim($this->search_arr['orderby']), $orderby_arr)) {
             $this->search_arr['orderby'] = 'goodsnum desc';
         }
-        $orderby = trim($this->search_arr['orderby']).',goods_id asc';
+        $orderby = trim($this->search_arr['orderby']) . ',goods_id asc';
         //查询记录总条数
         $count_arr = $stat_model->getoneByStatordergoods($where, 'COUNT(DISTINCT goods_id) as countnum');
         $countnum = intval($count_arr['countnum']);
-        if (input('param.exporttype') == 'excel'){
+        if (input('param.exporttype') == 'excel') {
             $goods_list = $stat_model->statByStatordergoods($where, $field, 0, 0, $orderby, 'goods_id');
         } else {
             $goods_list = $stat_model->statByStatordergoods($where, $field, 10, 0, $orderby, 'goods_id');
         }
         //导出Excel
-        if (input('param.exporttype') == 'excel'){
+        if (input('param.exporttype') == 'excel') {
             //导出Excel
             $excel_obj = new \excel\Excel();
             $excel_data = array();
             //设置样式
-            $excel_obj->setStyle(array('id'=>'s_title','Font'=>array('FontName'=>'宋体','Size'=>'12','Bold'=>'1')));
+            $excel_obj->setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
             //header
-            $excel_data[0][] = array('styleid'=>'s_title','data'=>lang('ds_goods_name'));
-            $excel_data[0][] = array('styleid'=>'s_title','data'=>lang('goods_commonid'));
-            $excel_data[0][] = array('styleid'=>'s_title','data'=>lang('ds_store_name'));
-            $excel_data[0][] = array('styleid'=>'s_title','data'=>lang('goodsnum'));
-            $excel_data[0][] = array('styleid'=>'s_title','data'=>lang('statstore_ordernum'));
-            $excel_data[0][] = array('styleid'=>'s_title','data'=>lang('statstore_orderamount'));
+            $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('ds_goods_name'));
+            $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('goods_commonid'));
+            $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('ds_store_name'));
+            $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('goodsnum'));
+            $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('statstore_ordernum'));
+            $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('statstore_orderamount'));
             //data
-            foreach ($goods_list as $k=>$v){
-                $excel_data[$k+1][] = array('data'=>$v['goods_name']);
-                $excel_data[$k+1][] = array('data'=>$v['goods_commonid']);
-                $excel_data[$k+1][] = array('data'=>$v['store_name']);
-                $excel_data[$k+1][] = array('data'=>$v['goodsnum']);
-                $excel_data[$k+1][] = array('data'=>$v['ordernum']);
-                $excel_data[$k+1][] = array('data'=>$v['goodsamount']);
+            foreach ($goods_list as $k => $v) {
+                $excel_data[$k + 1][] = array('data' => $v['goods_name']);
+                $excel_data[$k + 1][] = array('data' => $v['goods_commonid']);
+                $excel_data[$k + 1][] = array('data' => $v['store_name']);
+                $excel_data[$k + 1][] = array('data' => $v['goodsnum']);
+                $excel_data[$k + 1][] = array('data' => $v['ordernum']);
+                $excel_data[$k + 1][] = array('data' => $v['goodsamount']);
             }
-            $excel_data = $excel_obj->charset($excel_data,CHARSET);
+            $excel_data = $excel_obj->charset($excel_data, CHARSET);
             $excel_obj->addArray($excel_data);
-            $excel_obj->addWorksheet($excel_obj->charset(lang('stat_goods_sale'),CHARSET));
-            $excel_obj->generateXML($excel_obj->charset(lang('stat_goods_sale'),CHARSET).date('Y-m-d-H',TIMESTAMP));
+            $excel_obj->addWorksheet($excel_obj->charset(lang('stat_goods_sale'), CHARSET));
+            $excel_obj->generateXML($excel_obj->charset(lang('stat_goods_sale'), CHARSET) . date('Y-m-d-H', TIMESTAMP));
             exit();
         } else {
             //查询品牌
-            $brand_list = model('brand')->getBrandList(array('brand_apply'=>1));
-            View::assign('brand_list',$brand_list);
-            View::assign('goods_list',$goods_list);
-            View::assign('show_page',$stat_model->page_info->render());
-            View::assign('orderby',$this->search_arr['orderby']);
+            $brand_list = model('brand')->getBrandList(array('brand_apply' => 1));
+            View::assign('brand_list', $brand_list);
+            View::assign('goods_list', $goods_list);
+            View::assign('show_page', $stat_model->page_info->render());
+            View::assign('orderby', $this->search_arr['orderby']);
             $this->setAdminCurItem('goods_sale');
             return View::fetch('stat_goodssale');
         }
@@ -312,4 +318,4 @@ class Statgoods extends AdminControl
         );
         return $menu_array;
     }
-}
+}

+ 174 - 166
app/admin/controller/Statindustry.php

@@ -1,18 +1,19 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 use think\facade\Db;
+
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Statindustry extends AdminControl
@@ -20,15 +21,15 @@ class Statindustry extends AdminControl
     public function initialize()
     {
         parent::initialize(); // TODO: Change the autogenerated stub
-        include_once root_path(). 'extend/mall/statistics.php';
-        include_once root_path(). 'extend/mall/datehelper.php';
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/stat.lang.php');
+        include_once root_path() . 'extend/mall/statistics.php';
+        include_once root_path() . 'extend/mall/datehelper.php';
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/stat.lang.php');
 
         $stat_model = model('stat');
         //存储参数
         $this->search_arr = input('param.');
         //处理搜索时间
-        if (in_array(request()->action(),array('scale','rank','price'))){
+        if (in_array(request()->action(), array('scale', 'rank', 'price'))) {
             $this->search_arr = $stat_model->dealwithSearchTime($this->search_arr);
             //获得系统年份
             $year_arr = getSystemYearArr();
@@ -44,77 +45,79 @@ class Statindustry extends AdminControl
         /**
          * 处理商品分类
          */
-        $show_depth = 3;//select需要展示的深度
-        if (in_array(request()->action(),array('scale','general'))){//仅显示前两级分类
+        $show_depth = 3; //select需要展示的深度
+        if (in_array(request()->action(), array('scale', 'general'))) { //仅显示前两级分类
             $show_depth = 2;
         }
-        $gcid=input('param.choose_gcid');
-        $this->choose_gcid = $gcid >0 ? $gcid : 0;
-        $gccache_arr = model('goodsclass')->getGoodsclassCache($this->choose_gcid,$show_depth);
+        $gcid = input('param.choose_gcid');
+        $this->choose_gcid = $gcid > 0 ? $gcid : 0;
+        $gccache_arr = model('goodsclass')->getGoodsclassCache($this->choose_gcid, $show_depth);
         $this->gc_arr = $gccache_arr['showclass'];
-        View::assign('gc_json',json_encode($gccache_arr['showclass']));
-        View::assign('gc_choose_json',json_encode($gccache_arr['choose_gcid']));
+        View::assign('gc_json', json_encode($gccache_arr['showclass']));
+        View::assign('gc_choose_json', json_encode($gccache_arr['choose_gcid']));
     }
     /**
      * 行业规模
      */
-    public function scale(){
-        if(!isset($this->search_arr['search_type'])){
+    public function scale()
+    {
+        if (!isset($this->search_arr['search_type'])) {
             $this->search_arr['search_type'] = 'day';
         }
         $stat_model = model('stat');
         //获得搜索的开始时间和结束时间
         $searchtime_arr = $stat_model->getStarttimeAndEndtime($this->search_arr);
-        View::assign('searchtime',implode('|',$searchtime_arr));
+        View::assign('searchtime', implode('|', $searchtime_arr));
         $this->setAdminCurItem('scale');
         return View::fetch();
     }
     /**
      * 行业规模列表
      */
-    public function scale_list(){
+    public function scale_list()
+    {
         //获得子分类ID
         $gc_childid = $gc_childarr = array();
-        if (input('param.choose_gcid') > 0){//如果进行了分类搜索,则统计该分类下的子分类
+        if (input('param.choose_gcid') > 0) { //如果进行了分类搜索,则统计该分类下的子分类
             $gc_childdepth = $this->gc_arr[input('param.choose_gcid')]['depth'] + 1;
-            $gc_childid = explode(',',$this->gc_arr[input('param.choose_gcid')]['child']);
-            if ($gc_childid){
-                foreach ((array)$this->gc_arr as $k=>$v){
-                    if (in_array($v['gc_id'],$gc_childid)){
+            $gc_childid = explode(',', $this->gc_arr[input('param.choose_gcid')]['child']);
+            if ($gc_childid) {
+                foreach ((array)$this->gc_arr as $k => $v) {
+                    if (in_array($v['gc_id'], $gc_childid)) {
                         $gc_childarr[$v['gc_id']] = $v;
                     }
                 }
             }
-        } else {//如果没有搜索分类,则默认统计一级分类
+        } else { //如果没有搜索分类,则默认统计一级分类
             $gc_childdepth = 1;
-            foreach ((array)$this->gc_arr as $k=>$v){
-                if ($v['depth'] == 1){
+            foreach ((array)$this->gc_arr as $k => $v) {
+                if ($v['depth'] == 1) {
                     $gc_childarr[$v['gc_id']] = $v;
                 }
             }
         }
-        if($gc_childarr){
+        if ($gc_childarr) {
             $stat_model = model('stat');
             $stat_list = array();
             //构造横轴数据
-            foreach($gc_childarr as $k=>$v){
+            foreach ($gc_childarr as $k => $v) {
                 $stat_list[$k]['gc_name'] = $v['gc_name'];
                 $stat_list[$k]['y'] = 0;
             }
             $where = array();
-            $where[] = array('order_isvalid','=',1);//计入统计的有效订单
-            $searchtime_arr_tmp = explode('|',input('param.t'));
-            foreach ((array)$searchtime_arr_tmp as $k=>$v){
+            $where[] = array('order_isvalid', '=', 1); //计入统计的有效订单
+            $searchtime_arr_tmp = explode('|', input('param.t'));
+            foreach ((array)$searchtime_arr_tmp as $k => $v) {
                 $searchtime_arr[] = intval($v);
             }
-            $where[] = array('order_add_time','between',$searchtime_arr);
-            if ($this->choose_gcid > 0){
-                $where[] = array('gc_parentid_'.($gc_childdepth-1),'=',$this->choose_gcid);
+            $where[] = array('order_add_time', 'between', $searchtime_arr);
+            if ($this->choose_gcid > 0) {
+                $where[] = array('gc_parentid_' . ($gc_childdepth - 1), '=', $this->choose_gcid);
             }
-            $field = 'gc_parentid_'.$gc_childdepth.' as statgc_id';
+            $field = 'gc_parentid_' . $gc_childdepth . ' as statgc_id';
             $stattype = input('param.stattype');
-            
-            switch ($stattype){
+
+            switch ($stattype) {
                 case 'ordernum':
                     $caption = lang('statstore_ordernum');
                     $field .= ',COUNT(DISTINCT order_id) as ordernum';
@@ -135,14 +138,14 @@ class Statindustry extends AdminControl
             $orderby .= ',statgc_id asc';
 
             $goods_list = $stat_model->statByStatordergoods($where, $field, 0, 0, $orderby, 'statgc_id');
-            foreach ((array)$goods_list as $k=>$v){
+            foreach ((array)$goods_list as $k => $v) {
                 $statgc_id = intval($v['statgc_id']);
-                if (in_array($statgc_id,array_keys($gc_childarr))){
+                if (in_array($statgc_id, array_keys($gc_childarr))) {
                     $stat_list[$statgc_id]['gc_name'] = strval($gc_childarr[$v['statgc_id']]['gc_name']);
                 } else {
                     $stat_list[$statgc_id]['gc_name'] = lang('other');
                 }
-                switch ($stattype){
+                switch ($stattype) {
                     case 'orderamount':
                         $stat_list[$statgc_id]['y'] = floatval($v[$stattype]);
                         break;
@@ -152,56 +155,57 @@ class Statindustry extends AdminControl
                 }
             }
             //构造横轴数据
-            foreach($stat_list as $k=>$v){
+            foreach ($stat_list as $k => $v) {
                 //数据
-                $stat_arr['series'][0]['data'][] = array('name'=>strval($v['gc_name']),'y'=>$v['y']);
+                $stat_arr['series'][0]['data'][] = array('name' => strval($v['gc_name']), 'y' => $v['y']);
                 //横轴
                 $stat_arr['xAxis']['categories'][] = strval($v['gc_name']);
             }
             //得到统计图数据
             $stat_arr['series'][0]['name'] = $caption;
-            $stat_arr['title'] = sprintf(lang('industry_statis'),$caption);
+            $stat_arr['title'] = sprintf(lang('industry_statis'), $caption);
             $stat_arr['legend']['enabled'] = false;
             $stat_arr['yAxis']['title']['text'] = $caption;
             $stat_arr['yAxis']['title']['align'] = 'high';
             $statjson = getStatData_Basicbar($stat_arr);
-            View::assign('stat_json',$statjson);
-            View::assign('stattype',$stattype);
+            View::assign('stat_json', $statjson);
+            View::assign('stattype', $stattype);
             echo View::fetch('stat_linelabels');
         }
     }
     /**
      * 行业排行
      */
-    public function rank(){
-        if(!isset($this->search_arr['search_type'])){
+    public function rank()
+    {
+        if (!isset($this->search_arr['search_type'])) {
             $this->search_arr['search_type'] = 'day';
         }
         $stat_model = model('stat');
         //获得搜索的开始时间和结束时间
         $searchtime_arr = $stat_model->getStarttimeAndEndtime($this->search_arr);
         $where = array();
-        $where[] = array('order_isvalid','=',1);//计入统计的有效订单
-        $where[] = array('order_add_time','between',$searchtime_arr);
-        if ($this->choose_gcid > 0){
+        $where[] = array('order_isvalid', '=', 1); //计入统计的有效订单
+        $where[] = array('order_add_time', 'between', $searchtime_arr);
+        if ($this->choose_gcid > 0) {
             $gc_id_depth = $this->gc_arr[$this->choose_gcid]['depth'];
-            $where[] = array('gc_parentid_'.$gc_id_depth,'=',$this->choose_gcid);
+            $where[] = array('gc_parentid_' . $gc_id_depth, '=', $this->choose_gcid);
         }
         /**
          * 商品排行
          */
         $goods_stat_arr = array();
         //构造横轴数据
-        for($i=1; $i<=50; $i++){
+        for ($i = 1; $i <= 50; $i++) {
             //数据
-            $goods_stat_arr['series'][0]['data'][] = array('name'=>'','y'=>0);
+            $goods_stat_arr['series'][0]['data'][] = array('name' => '', 'y' => 0);
             //横轴
             $goods_stat_arr['xAxis']['categories'][] = "$i";
         }
         $field = 'goods_id,goods_name,SUM(goods_num) as goodsnum';
         $goods_list = $stat_model->statByStatordergoods($where, $field, 0, 50, 'goodsnum desc,goods_id asc', 'goods_id');
-        foreach ((array)$goods_list as $k=>$v){
-            $goods_stat_arr['series'][0]['data'][$k] = array('name'=>strval($v['goods_name']),'y'=>floatval($v['goodsnum']));
+        foreach ((array)$goods_list as $k => $v) {
+            $goods_stat_arr['series'][0]['data'][$k] = array('name' => strval($v['goods_name']), 'y' => floatval($v['goodsnum']));
         }
         //得到统计图数据
         $goods_stat_arr['series'][0]['name'] = lang('goodsnum');
@@ -214,16 +218,16 @@ class Statindustry extends AdminControl
          */
         $store_stat_arr = array();
         //构造横轴数据
-        for($i=1; $i<=30; $i++){
+        for ($i = 1; $i <= 30; $i++) {
             //数据
-            $store_stat_arr['series'][0]['data'][] = array('name'=>'','y'=>0);
+            $store_stat_arr['series'][0]['data'][] = array('name' => '', 'y' => 0);
             //横轴
             $store_stat_arr['xAxis']['categories'][] = "$i";
         }
         $field = 'store_id,store_name,COUNT(DISTINCT order_id) as ordernum';
         $store_list = $stat_model->statByStatordergoods($where, $field, 0, 30, 'ordernum desc,store_id asc', 'store_id');
-        foreach ((array)$store_list as $k=>$v){
-            $store_stat_arr['series'][0]['data'][$k] = array('name'=>strval($v['store_name']),'y'=>floatval($v['ordernum']));
+        foreach ((array)$store_list as $k => $v) {
+            $store_stat_arr['series'][0]['data'][$k] = array('name' => strval($v['store_name']), 'y' => floatval($v['ordernum']));
         }
         //得到统计图数据
         $store_stat_arr['series'][0]['name'] = lang('statstore_ordernum');
@@ -232,77 +236,78 @@ class Statindustry extends AdminControl
         $store_stat_arr['yAxis'] = lang('statstore_ordernum');
         $store_statjson = getStatData_Column2D($store_stat_arr);
 
-        View::assign('goods_statjson',$goods_statjson);
-        View::assign('goods_list',$goods_list);
-        View::assign('store_statjson',$store_statjson);
-        View::assign('store_list',$store_list);
+        View::assign('goods_statjson', $goods_statjson);
+        View::assign('goods_list', $goods_list);
+        View::assign('store_statjson', $store_statjson);
+        View::assign('store_list', $store_list);
         $this->setAdminCurItem('rank');
         return View::fetch();
     }
     /**
      * 价格分布
      */
-    public function price(){
-        if(!isset($this->search_arr['search_type'])){
+    public function price()
+    {
+        if (!isset($this->search_arr['search_type'])) {
             $this->search_arr['search_type'] = 'day';
         }
         $stat_model = model('stat');
         //获得搜索的开始时间和结束时间
         $searchtime_arr = $stat_model->getStarttimeAndEndtime($this->search_arr);
         $where = array();
-        $where[] = array('order_isvalid','=',1);//计入统计的有效订单
-        $where[] = array('order_add_time','between',$searchtime_arr);
-        if ($this->choose_gcid > 0){
+        $where[] = array('order_isvalid', '=', 1); //计入统计的有效订单
+        $where[] = array('order_add_time', 'between', $searchtime_arr);
+        if ($this->choose_gcid > 0) {
             $gc_id_depth = $this->gc_arr[$this->choose_gcid]['depth'];
-            $where[] = array('gc_parentid_'.$gc_id_depth,'=',$this->choose_gcid);
+            $where[] = array('gc_parentid_' . $gc_id_depth, '=', $this->choose_gcid);
         }
 
-$field='1';
-        $pricerange_arr = ($t = trim(config('ds_config.stat_orderpricerange')))?unserialize($t):'';
+        $field = '1';
+        $pricerange_arr = ($t = trim(config('ds_config.stat_orderpricerange'))) ? unserialize($t) : '';
 
-        if ($pricerange_arr){
+        if ($pricerange_arr) {
             $goodsnum_stat_arr['series'][0]['name'] = lang('goodsnum');
             $orderamount_stat_arr['series'][0]['name'] = lang('statstore_orderamount');
             //设置价格区间最后一项,最后一项只有开始值没有结束值
             $pricerange_count = count($pricerange_arr);
-            if ($pricerange_arr[$pricerange_count-1]['e']){
-                $pricerange_arr[$pricerange_count]['s'] = $pricerange_arr[$pricerange_count-1]['e'] + 1;
+            if ($pricerange_arr[$pricerange_count - 1]['e']) {
+                $pricerange_arr[$pricerange_count]['s'] = $pricerange_arr[$pricerange_count - 1]['e'] + 1;
                 $pricerange_arr[$pricerange_count]['e'] = '';
             }
-        
-            foreach ((array)$pricerange_arr as $k=>$v){
+
+            foreach ((array)$pricerange_arr as $k => $v) {
                 $v['s'] = intval($v['s']);
                 $v['e'] = intval($v['e']);
                 //构造查询字段
-               if ($v['e']){
+                if ($v['e']) {
                     $field .= ",SUM(IF(goods_pay_price/goods_num > {$v['s']} and goods_pay_price/goods_num <= {$v['e']},goods_num,0)) as goodsnum_{$k}";
                     $field .= " ,SUM(IF(goods_pay_price/goods_num > {$v['s']} and goods_pay_price/goods_num <= {$v['e']},goods_pay_price,0)) as orderamount_{$k}";
-                } else {//由于最后一个区间没有结束值,所以需要单独构造sql
+                } else { //由于最后一个区间没有结束值,所以需要单独构造sql
                     $field .= ",SUM(IF(goods_pay_price/goods_num > {$v['s']},goods_num,0)) as goodsnum_{$k}";
                     $field .= " ,SUM(IF(goods_pay_price/goods_num > {$v['s']},goods_pay_price,0)) as orderamount_{$k}";
                 }
             }
 
-            $ordergooods_list = Db::query('SELECT '.$field.' FROM '.config('database.connections.mysql.prefix').'statordergoods WHERE order_isvalid=1 AND order_add_time BETWEEN '.$searchtime_arr[0].' AND '.$searchtime_arr[1].($this->choose_gcid > 0?(' AND gc_parentid_'.$gc_id_depth.'='.$this->choose_gcid):''));
-            if($ordergooods_list){
-                $ordergooods_list= current($ordergooods_list);
-                foreach ((array)$pricerange_arr as $k=>$v){
+            $ordergooods_list = Db::query('SELECT ' . $field . ' FROM ' . config('database.connections.mysql.prefix') . 'statordergoods WHERE order_isvalid=1 AND order_add_time BETWEEN ' . $searchtime_arr[0] . ' AND ' . $searchtime_arr[1] . ($this->choose_gcid > 0 ? (' AND gc_parentid_' . $gc_id_depth . '=' . $this->choose_gcid) : ''));
+            if ($ordergooods_list) {
+                $ordergooods_list = current($ordergooods_list);
+                foreach ((array)$pricerange_arr as $k => $v) {
                     //横轴
-                    if($v['e']){
-                        $goodsnum_stat_arr['xAxis']['categories'][] = $v['s'].'-'.$v['e'];
-                        $orderamount_stat_arr['xAxis']['categories'][] = $v['s'].'-'.$v['e'];
+                    if ($v['e']) {
+                        $goodsnum_stat_arr['xAxis']['categories'][] = $v['s'] . '-' . $v['e'];
+                        $orderamount_stat_arr['xAxis']['categories'][] = $v['s'] . '-' . $v['e'];
                     } else {
-                        $goodsnum_stat_arr['xAxis']['categories'][] = $v['s'].lang('above');
-                        $orderamount_stat_arr['xAxis']['categories'][] = $v['s'].lang('above');
+                        $goodsnum_stat_arr['xAxis']['categories'][] = $v['s'] . lang('above');
+                        $orderamount_stat_arr['xAxis']['categories'][] = $v['s'] . lang('above');
                     }
                     //统计图数据
                     $goodsnum_stat_arr['series'][0]['data'][$k] = 0;
                     $orderamount_stat_arr['series'][0]['data'][$k] = 0;
-                    if (isset($ordergooods_list['goodsnum_'.$k])){
-                        $goodsnum_stat_arr['series'][0]['data'][$k] = intval($ordergooods_list['goodsnum_'.$k]);
+                    if (isset($ordergooods_list['goodsnum_' . $k])) {
+                        $goodsnum_stat_arr['series'][0]['data'][$k] = intval($ordergooods_list['goodsnum_' . $k]);
                     }
-                    if (isset($ordergooods_list['orderamount_'.$k])){
-                        $orderamount_stat_arr['series'][0]['data'][$k] = intval($ordergooods_list['orderamount_'.$k]);
+                    if (isset($ordergooods_list['orderamount_' . $k])) {
+                        $orderamount_stat_arr['series'][0]['data'][$k] = intval($ordergooods_list['orderamount_' . $k]);
                     }
                 }
             }
@@ -321,8 +326,8 @@ $field='1';
             $orderamount_stat_json = '';
         }
 
-        View::assign('goodsnum_stat_json',$goodsnum_stat_json);
-        View::assign('orderamount_stat_json',$orderamount_stat_json);
+        View::assign('goodsnum_stat_json', $goodsnum_stat_json);
+        View::assign('orderamount_stat_json', $orderamount_stat_json);
         $this->setAdminCurItem('price');
         return View::fetch();
     }
@@ -330,7 +335,8 @@ $field='1';
     /**
      * 销售统计
      */
-    public function general(){
+    public function general()
+    {
         $this->setAdminCurItem('general');
         return View::fetch();
     }
@@ -338,24 +344,25 @@ $field='1';
     /**
      * 概况总览
      */
-    public function general_list(){
-        $ordergoods_list=array();
+    public function general_list()
+    {
+        $ordergoods_list = array();
         //获得子分类ID
         $gc_childid = $gc_childarr = array();
-        if ($this->choose_gcid > 0){
+        if ($this->choose_gcid > 0) {
             $gc_childdepth = $this->gc_arr[$this->choose_gcid]['depth'] + 1;
-            $gc_childid = explode(',',$this->gc_arr[$this->choose_gcid]['child']);
-            if ($gc_childid){
-                foreach ((array)$this->gc_arr as $k=>$v){
-                    if (in_array($v['gc_id'],$gc_childid)){
+            $gc_childid = explode(',', $this->gc_arr[$this->choose_gcid]['child']);
+            if ($gc_childid) {
+                foreach ((array)$this->gc_arr as $k => $v) {
+                    if (in_array($v['gc_id'], $gc_childid)) {
                         $gc_childarr[$v['gc_id']] = $v;
                     }
                 }
             }
-        } else {//如果没有搜索分类,则默认统计一级分类
+        } else { //如果没有搜索分类,则默认统计一级分类
             $gc_childdepth = 1;
-            foreach ((array)$this->gc_arr as $k=>$v){
-                if ($v['depth'] == 1){
+            foreach ((array)$this->gc_arr as $k => $v) {
+                if ($v['depth'] == 1) {
                     $gc_childarr[$v['gc_id']] = $v;
                 }
             }
@@ -363,116 +370,117 @@ $field='1';
 
         $statlist = array();
 
-        if ($gc_childarr){
+        if ($gc_childarr) {
             $stat_model = model('stat');
             //查询订单商品信息
             $where = array();
-            $where[] = array('order_isvalid','=',1);//计入统计的有效订单
+            $where[] = array('order_isvalid', '=', 1); //计入统计的有效订单
             //计算开始时间和结束时间
-            $searchtime_arr[1] = strtotime(date('Y-m-d',TIMESTAMP)) - 1;//昨天23:59点
+            $searchtime_arr[1] = strtotime(date('Y-m-d', TIMESTAMP)) - 1; //昨天23:59点
             $searchtime_arr[0] = $searchtime_arr[1] - (86400 * 30) + 1; //从昨天开始30天前
-            $where[] = array('order_add_time','between',$searchtime_arr);
+            $where[] = array('order_add_time', 'between', $searchtime_arr);
             //halt($this->choose_gcid);
-            if ($this->choose_gcid > 0){
-                $where[] = array('gc_parentid_'.($gc_childdepth-1),'=',$this->choose_gcid);
+            if ($this->choose_gcid > 0) {
+                $where[] = array('gc_parentid_' . ($gc_childdepth - 1), '=', $this->choose_gcid);
             }
 
-            $field = 'gc_parentid_'.$gc_childdepth.' as statgc_id,COUNT(DISTINCT goods_id) as ordergcount,SUM(goods_num) as ordergnum,SUM(goods_pay_price) as orderamount';
-            
-            $ordergoods_list_tmp = $stat_model->statByStatordergoods($where, $field, 0, 0, '', 'gc_parentid_'.$gc_childdepth);
+            $field = 'gc_parentid_' . $gc_childdepth . ' as statgc_id,COUNT(DISTINCT goods_id) as ordergcount,SUM(goods_num) as ordergnum,SUM(goods_pay_price) as orderamount';
 
-            foreach ((array)$ordergoods_list_tmp as $k=>$v){
+            $ordergoods_list_tmp = $stat_model->statByStatordergoods($where, $field, 0, 0, '', 'gc_parentid_' . $gc_childdepth);
+
+            foreach ((array)$ordergoods_list_tmp as $k => $v) {
                 $ordergoods_list[$v['statgc_id']] = $v;
             }
-            
+
             //查询商品信息
-            $field = 'gc_id_'.$gc_childdepth.' as statgc_id,COUNT(*) as goodscount,AVG(goods_price) as priceavg';
-            $goods_list_tmp = $stat_model->statByGoods(array('is_virtual'=>0), $field, 0, 0, '', 'gc_id_'.$gc_childdepth);
+            $field = 'gc_id_' . $gc_childdepth . ' as statgc_id,COUNT(*) as goodscount,AVG(goods_price) as priceavg';
+            $goods_list_tmp = $stat_model->statByGoods(array('is_virtual' => 0), $field, 0, 0, '', 'gc_id_' . $gc_childdepth);
 
-            foreach ((array)$goods_list_tmp as $k=>$v){
+            foreach ((array)$goods_list_tmp as $k => $v) {
                 $goods_list[$v['statgc_id']] = $v;
             }
             //将订单和商品数组合并
             $statlist_tmp = array();
-            foreach ($gc_childarr as $k=>$v){
+            foreach ($gc_childarr as $k => $v) {
                 $tmp = array();
                 $tmp['statgc_id'] = $v['gc_id'];
                 $tmp['gc_name'] = $v['gc_name'];
-                $tmp['ordergcount'] = isset($ordergoods_list[$v['gc_id']]['ordergcount'])?$ordergoods_list[$v['gc_id']]['ordergcount']:0;
-                $tmp['ordergnum'] = isset($ordergoods_list[$v['gc_id']]['ordergnum'])?$ordergoods_list[$v['gc_id']]['ordergnum']:0;
-                $tmp['orderamount'] = isset($ordergoods_list[$v['gc_id']]['orderamount'])?$ordergoods_list[$v['gc_id']]['orderamount']:0;
-                $tmp['goodscount'] = isset($goods_list[$v['gc_id']]['goodscount'])?$goods_list[$v['gc_id']]['goodscount']:0;
-                $tmp['priceavg'] = ds_price_format(isset($goods_list[$v['gc_id']]['priceavg'])?$goods_list[$v['gc_id']]['priceavg']:0);
-                $tmp['unordergcount'] = intval($tmp['goodscount']) - intval($tmp['ordergcount']);//计算无销量商品数
-                $statlist_tmp[]= $tmp;
+                $tmp['ordergcount'] = isset($ordergoods_list[$v['gc_id']]['ordergcount']) ? $ordergoods_list[$v['gc_id']]['ordergcount'] : 0;
+                $tmp['ordergnum'] = isset($ordergoods_list[$v['gc_id']]['ordergnum']) ? $ordergoods_list[$v['gc_id']]['ordergnum'] : 0;
+                $tmp['orderamount'] = isset($ordergoods_list[$v['gc_id']]['orderamount']) ? $ordergoods_list[$v['gc_id']]['orderamount'] : 0;
+                $tmp['goodscount'] = isset($goods_list[$v['gc_id']]['goodscount']) ? $goods_list[$v['gc_id']]['goodscount'] : 0;
+                $tmp['priceavg'] = ds_price_format(isset($goods_list[$v['gc_id']]['priceavg']) ? $goods_list[$v['gc_id']]['priceavg'] : 0);
+                $tmp['unordergcount'] = intval($tmp['goodscount']) - intval($tmp['ordergcount']); //计算无销量商品数
+                $statlist_tmp[] = $tmp;
             }
             $statlist = array();
             //整理排序
-            $orderby = isset($this->search_arr['orderby'])?trim($this->search_arr['orderby']):'';
-            if (!$orderby){
+            $orderby = isset($this->search_arr['orderby']) ? trim($this->search_arr['orderby']) : '';
+            if (!$orderby) {
                 $orderby = 'orderamount desc';
             }
-            $orderkeys = explode(' ',$orderby);
+            $orderkeys = explode(' ', $orderby);
             $keysvalue = $new_array = array();
-            foreach ($statlist_tmp as $k=>$v){
+            foreach ($statlist_tmp as $k => $v) {
                 $keysvalue[$k] = $v[$orderkeys[0]];
             }
-            if($orderkeys[1] == 'asc'){
+            if ($orderkeys[1] == 'asc') {
                 asort($keysvalue);
-            }else{
+            } else {
                 arsort($keysvalue);
             }
             reset($keysvalue);
-            foreach ($keysvalue as $k=>$v){
+            foreach ($keysvalue as $k => $v) {
                 $statlist[$k] = $statlist_tmp[$k];
             }
             //导出Excel
-            if (isset($this->search_arr['exporttype']) && $this->search_arr['exporttype'] == 'excel'){
+            if (isset($this->search_arr['exporttype']) && $this->search_arr['exporttype'] == 'excel') {
                 //列表header
                 $statheader = array();
-                $statheader[] = array('text'=>lang('ds_goodsclass'),'key'=>'gc_name');
-                $statheader[] = array('text'=>lang('average_price').'('.lang('ds_yuan').')','key'=>'priceavg','isorder'=>1);
-                $statheader[] = array('text'=>lang('have_sale_goods_number'),'key'=>'ordergcount','isorder'=>1);
-                $statheader[] = array('text'=>lang('ds_order_sn'),'key'=>'ordergnum','isorder'=>1);
-                $statheader[] = array('text'=>lang('stattrade_order_amount').'('.lang('ds_yuan').')','key'=>'orderamount','isorder'=>1);
-                $statheader[] = array('text'=>lang('industry_goods_total'),'key'=>'goodscount','isorder'=>1);
-                $statheader[] = array('text'=>lang('no_sale_goods_number'),'key'=>'unordergcount','isorder'=>1);
+                $statheader[] = array('text' => lang('ds_goodsclass'), 'key' => 'gc_name');
+                $statheader[] = array('text' => lang('average_price') . '(' . lang('ds_yuan') . ')', 'key' => 'priceavg', 'isorder' => 1);
+                $statheader[] = array('text' => lang('have_sale_goods_number'), 'key' => 'ordergcount', 'isorder' => 1);
+                $statheader[] = array('text' => lang('ds_order_sn'), 'key' => 'ordergnum', 'isorder' => 1);
+                $statheader[] = array('text' => lang('stattrade_order_amount') . '(' . lang('ds_yuan') . ')', 'key' => 'orderamount', 'isorder' => 1);
+                $statheader[] = array('text' => lang('industry_goods_total'), 'key' => 'goodscount', 'isorder' => 1);
+                $statheader[] = array('text' => lang('no_sale_goods_number'), 'key' => 'unordergcount', 'isorder' => 1);
                 //导出Excel
                 $excel_obj = new \excel\Excel();
                 $excel_data = array();
                 //设置样式
-                $excel_obj->setStyle(array('id'=>'s_title','Font'=>array('FontName'=>'宋体','Size'=>'12','Bold'=>'1')));
+                $excel_obj->setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
                 //header
-                foreach ($statheader as $k=>$v){
-                    $excel_data[0][] = array('styleid'=>'s_title','data'=>$v['text']);
+                foreach ($statheader as $k => $v) {
+                    $excel_data[0][] = array('styleid' => 's_title', 'data' => $v['text']);
                 }
                 //data
-                foreach ($statlist as $k=>$v){
-                    foreach ($statheader as $h_k=>$h_v){
-                        $excel_data[$k+1][] = array('data'=>$v[$h_v['key']]);
+                foreach ($statlist as $k => $v) {
+                    foreach ($statheader as $h_k => $h_v) {
+                        $excel_data[$k + 1][] = array('data' => $v[$h_v['key']]);
                     }
                 }
-                $excel_data = $excel_obj->charset($excel_data,CHARSET);
+                $excel_data = $excel_obj->charset($excel_data, CHARSET);
                 $excel_obj->addArray($excel_data);
-                $excel_obj->addWorksheet($excel_obj->charset(lang('industry_state_view'),CHARSET));
-                $excel_obj->generateXML($excel_obj->charset(lang('industry_state_view'),CHARSET).date('Y-m-d-H',TIMESTAMP));
+                $excel_obj->addWorksheet($excel_obj->charset(lang('industry_state_view'), CHARSET));
+                $excel_obj->generateXML($excel_obj->charset(lang('industry_state_view'), CHARSET) . date('Y-m-d-H', TIMESTAMP));
                 exit();
             }
         }
         //列表header
         $statheader = array();
-        $statheader[] = array('text'=>lang('ds_goodsclass'),'key'=>'gc_name');
-        $statheader[] = array('text'=>'<span title="'.lang('goods_class_average_goods_price').'" class="tip iconfont">&#xe71c;</span>&nbsp;'.lang('average_price').'('.lang('ds_yuan').')','key'=>'priceavg','isorder'=>1);
-        $statheader[] = array('text'=>'<span title="'.lang('have_sale_goods_number_recent').'" class="tip iconfont">&#xe71c;</span>&nbsp;'.lang('have_sale_goods_number'),'key'=>'ordergcount','isorder'=>1);
-        $statheader[] = array('text'=>'<span title="'.lang('industry_goods_total_recent').'" class="tip iconfont">&#xe71c;</span>&nbsp;'.lang('ds_order_sn'),'key'=>'ordergnum','isorder'=>1);
-        $statheader[] = array('text'=>'<span title="'.lang('have_sale_goods_amount_recent').'" class="tip iconfont">&#xe71c;</span>&nbsp;'.lang('stattrade_order_amount').'('.lang('ds_yuan').')','key'=>'orderamount','isorder'=>1);
-        $statheader[] = array('text'=>'<span title="'.lang('goods_class_goods_number').'" class="tip iconfont">&#xe71c;</span>&nbsp;'.lang('industry_goods_total'),'key'=>'goodscount','isorder'=>1);
-        $statheader[] = array('text'=>'<span title="'.lang('have_sale_goods_number_recent').'" class="tip iconfont">&#xe71c;</span>&nbsp;'.lang('no_sale_goods_number'),'key'=>'unordergcount','isorder'=>1);
-        View::assign('statheader',$statheader);
-        View::assign('statlist',$statlist);
-        View::assign('orderby',$orderby);
-        View::assign('actionurl',(string)url('Statindustry'.'/'.request()->action(),['choose_gcid'=>$this->choose_gcid]));
-        echo View::fetch('listandorder');exit;
+        $statheader[] = array('text' => lang('ds_goodsclass'), 'key' => 'gc_name');
+        $statheader[] = array('text' => '<span title="' . lang('goods_class_average_goods_price') . '" class="tip iconfont">&#xe71c;</span>&nbsp;' . lang('average_price') . '(' . lang('ds_yuan') . ')', 'key' => 'priceavg', 'isorder' => 1);
+        $statheader[] = array('text' => '<span title="' . lang('have_sale_goods_number_recent') . '" class="tip iconfont">&#xe71c;</span>&nbsp;' . lang('have_sale_goods_number'), 'key' => 'ordergcount', 'isorder' => 1);
+        $statheader[] = array('text' => '<span title="' . lang('industry_goods_total_recent') . '" class="tip iconfont">&#xe71c;</span>&nbsp;' . lang('ds_order_sn'), 'key' => 'ordergnum', 'isorder' => 1);
+        $statheader[] = array('text' => '<span title="' . lang('have_sale_goods_amount_recent') . '" class="tip iconfont">&#xe71c;</span>&nbsp;' . lang('stattrade_order_amount') . '(' . lang('ds_yuan') . ')', 'key' => 'orderamount', 'isorder' => 1);
+        $statheader[] = array('text' => '<span title="' . lang('goods_class_goods_number') . '" class="tip iconfont">&#xe71c;</span>&nbsp;' . lang('industry_goods_total'), 'key' => 'goodscount', 'isorder' => 1);
+        $statheader[] = array('text' => '<span title="' . lang('have_sale_goods_number_recent') . '" class="tip iconfont">&#xe71c;</span>&nbsp;' . lang('no_sale_goods_number'), 'key' => 'unordergcount', 'isorder' => 1);
+        View::assign('statheader', $statheader);
+        View::assign('statlist', $statlist);
+        View::assign('orderby', $orderby);
+        View::assign('actionurl', (string)url('Statindustry' . '/' . request()->action(), ['choose_gcid' => $this->choose_gcid]));
+        echo View::fetch('listandorder');
+        exit;
     }
 
     protected function getAdminItemList()
@@ -484,10 +492,10 @@ $field='1';
                 'name' => 'rank', 'text' => lang('stat_industryrank'), 'url' => (string)url('Statindustry/rank')
             ), array(
                 'name' => 'price', 'text' => lang('stat_industryprice'), 'url' => (string)url('Statindustry/price')
-            ),array(
+            ), array(
                 'name' => 'general', 'text' => lang('stat_industrygeneral'), 'url' => (string)url('Statindustry/general')
             )
         );
         return $menu_array;
     }
-}
+}

+ 145 - 140
app/admin/controller/Statmarketing.php

@@ -1,21 +1,23 @@
 <?php
+
 /**
  * 市场统计分析
  */
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Db;
 use think\facade\Lang;
+
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
 class Statmarketing extends AdminControl
@@ -23,14 +25,14 @@ class Statmarketing extends AdminControl
     public function initialize()
     {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path().'admin/lang/'.config('lang.default_lang').'/stat.lang.php');
-        include_once root_path(). 'extend/mall/statistics.php';
-        include_once root_path(). 'extend/mall/datehelper.php';
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/stat.lang.php');
+        include_once root_path() . 'extend/mall/statistics.php';
+        include_once root_path() . 'extend/mall/datehelper.php';
         $stat_model = model('stat');
         //存储参数
         $this->search_arr = input('param.');
         //处理搜索时间
-        if (in_array(request()->action(),array('promotion','group'))){
+        if (in_array(request()->action(), array('promotion', 'group'))) {
             $this->search_arr = $stat_model->dealwithSearchTime($this->search_arr);
             //获得系统年份
             $year_arr = getSystemYearArr();
@@ -47,78 +49,80 @@ class Statmarketing extends AdminControl
     /**
      * 促销分析
      */
-    public function promotion(){
-        if(!isset($this->search_arr['search_type'])){
+    public function promotion()
+    {
+        if (!isset($this->search_arr['search_type'])) {
             $this->search_arr['search_type'] = 'day';
         }
         $stat_model = model('stat');
         //获得搜索的开始时间和结束时间
         $searchtime_arr = $stat_model->getStarttimeAndEndtime($this->search_arr);
         $where = array();
-        $where[]=array('order_isvalid','=',1);//计入统计的有效订单
-        $where[] = array('order_add_time','between',$searchtime_arr);
-        $where[]=array('goods_type','in',array(2,3,4));
+        $where[] = array('order_isvalid', '=', 1); //计入统计的有效订单
+        $where[] = array('order_add_time', 'between', $searchtime_arr);
+        $where[] = array('goods_type', 'in', array(2, 3, 4));
         //下单量
         $field = ' goods_type,count(DISTINCT order_id) as ordernum,SUM(goods_num) as goodsnum,SUM(goods_pay_price) as orderamount';
-        $statlist_tmp = $stat_model->statByStatordergoods($where, $field, 0, 0,'', 'goods_type');
+        $statlist_tmp = $stat_model->statByStatordergoods($where, $field, 0, 0, '', 'goods_type');
         //优惠类型数组
-        $goodstype_arr = array(2=>lang('goodstype_2'),3=>lang('goodstype_3'),4=>lang('goodstype_4'));
+        $goodstype_arr = array(2 => lang('goodstype_2'), 3 => lang('goodstype_3'), 4 => lang('goodstype_4'));
         $statlist = array();
-        $statcount = array('ordernum'=>0,'goodsnum'=>0,'orderamount'=>0.00);
+        $statcount = array('ordernum' => 0, 'goodsnum' => 0, 'orderamount' => 0.00);
         $stat_arr = array();
-        $stat_json = array('ordernum'=>'','goodsnum'=>'','orderamount'=>'');
-        if ($statlist_tmp){
-            foreach((array)$statlist_tmp as $k=>$v){
+        $stat_json = array('ordernum' => '', 'goodsnum' => '', 'orderamount' => '');
+        if ($statlist_tmp) {
+            foreach ((array)$statlist_tmp as $k => $v) {
                 $statcount['ordernum'] += intval($v['ordernum']);
                 $statcount['goodsnum'] += intval($v['goodsnum']);
                 $statcount['orderamount'] += floatval($v['orderamount']);
             }
-            foreach((array)$statlist_tmp as $k=>$v){
-                $v['ordernumratio'] = round($v['ordernum']/$statcount['ordernum'],4)*100;
-                $v['goodsnumratio'] = round($v['goodsnum']/$statcount['goodsnum'],4)*100;
-                $v['orderamountratio'] = round($v['orderamount']/$statcount['orderamount'],4)*100;
+            foreach ((array)$statlist_tmp as $k => $v) {
+                $v['ordernumratio'] = round($v['ordernum'] / $statcount['ordernum'], 4) * 100;
+                $v['goodsnumratio'] = round($v['goodsnum'] / $statcount['goodsnum'], 4) * 100;
+                $v['orderamountratio'] = round($v['orderamount'] / $statcount['orderamount'], 4) * 100;
                 $statlist_tmp2[$v['goods_type']] = $v;
-                $stat_arr['ordernum'][] = array('p_name'=>$goodstype_arr[$v['goods_type']],'allnum'=>$v['ordernumratio']);
-                $stat_arr['goodsnum'][] = array('p_name'=>$goodstype_arr[$v['goods_type']],'allnum'=>$v['goodsnumratio']);
-                $stat_arr['orderamount'][] = array('p_name'=>$goodstype_arr[$v['goods_type']],'allnum'=>$v['orderamountratio']);
+                $stat_arr['ordernum'][] = array('p_name' => $goodstype_arr[$v['goods_type']], 'allnum' => $v['ordernumratio']);
+                $stat_arr['goodsnum'][] = array('p_name' => $goodstype_arr[$v['goods_type']], 'allnum' => $v['goodsnumratio']);
+                $stat_arr['orderamount'][] = array('p_name' => $goodstype_arr[$v['goods_type']], 'allnum' => $v['orderamountratio']);
             }
-            foreach ($goodstype_arr as $k=>$v){
-                if (isset($statlist_tmp2[$k])){
+            foreach ($goodstype_arr as $k => $v) {
+                if (isset($statlist_tmp2[$k])) {
                     $statlist_tmp2[$k]['goodstype_text'] = $v;
                     $statlist[] = $statlist_tmp2[$k];
                 } else {
-                    $statlist[] = array('goodstype_text'=>$k,'goodstype_text'=>$v,'ordernum'=>0,'goodsnum'=>0,'orderamount'=>0.00);
+                    $statlist[] = array('goodstype_text' => $k, 'goodstype_text' => $v, 'ordernum' => 0, 'goodsnum' => 0, 'orderamount' => 0.00);
                 }
             }
-            $stat_json['ordernum'] = getStatData_Pie(array('title'=>lang('statstore_ordernum'),'name'=>lang('statstore_ordernum').'(%)','label_show'=>false,'series'=>$stat_arr['ordernum']));
-            $stat_json['goodsnum'] = getStatData_Pie(array('title'=>lang('goodsnum'),'name'=>lang('goodsnum').'(%)','label_show'=>false,'series'=>$stat_arr['goodsnum']));
-            $stat_json['orderamount'] = getStatData_Pie(array('title'=>lang('statstore_orderamount'),'name'=>lang('statstore_orderamount').'(%)','label_show'=>false,'series'=>$stat_arr['orderamount']));
+            $stat_json['ordernum'] = getStatData_Pie(array('title' => lang('statstore_ordernum'), 'name' => lang('statstore_ordernum') . '(%)', 'label_show' => false, 'series' => $stat_arr['ordernum']));
+            $stat_json['goodsnum'] = getStatData_Pie(array('title' => lang('goodsnum'), 'name' => lang('goodsnum') . '(%)', 'label_show' => false, 'series' => $stat_arr['goodsnum']));
+            $stat_json['orderamount'] = getStatData_Pie(array('title' => lang('statstore_orderamount'), 'name' => lang('statstore_orderamount') . '(%)', 'label_show' => false, 'series' => $stat_arr['orderamount']));
         }
-        View::assign('statcount',$statcount);
-        View::assign('statlist',$statlist);
-        View::assign('stat_json',$stat_json);
-        View::assign('searchtime',implode('|',$searchtime_arr));
+        View::assign('statcount', $statcount);
+        View::assign('statlist', $statlist);
+        View::assign('stat_json', $stat_json);
+        View::assign('searchtime', implode('|', $searchtime_arr));
         $this->setAdminCurItem('promotion');
         return View::fetch('marketing_promotion');
     }
     /**
      * 促销销售趋势分析
      */
-    public function promotiontrend(){
+    public function promotiontrend()
+    {
         //优惠类型数组
-        $goodstype_arr = array(2=>lang('goodstype_2'),3=>lang('goodstype_3'),4=>lang('goodstype_4'));
+        $goodstype_arr = array(2 => lang('goodstype_2'), 3 => lang('goodstype_3'), 4 => lang('goodstype_4'));
 
         $stat_model = model('stat');
         $where = array();
-        $searchtime_arr_tmp = explode('|',$this->search_arr['t']);
-        foreach ((array)$searchtime_arr_tmp as $k=>$v){
+        $searchtime_arr_tmp = explode('|', $this->search_arr['t']);
+        foreach ((array)$searchtime_arr_tmp as $k => $v) {
             $searchtime_arr[] = intval($v);
         }
-        $where[]=array('order_isvalid','=',1);//计入统计的有效订单
-        $where[] = array('order_add_time','between',$searchtime_arr);
-        $where[]=array('goods_type','in',array(2,3,4));
+        $where[] = array('order_isvalid', '=', 1); //计入统计的有效订单
+        $where[] = array('order_add_time', 'between', $searchtime_arr);
+        $where[] = array('goods_type', 'in', array(2, 3, 4));
         $field = ' goods_type';
-        switch ($this->search_arr['stattype']){
+        switch ($this->search_arr['stattype']) {
             case 'orderamount':
                 $field .= " ,SUM(goods_pay_price) as orderamount";
                 $caption = lang('statstore_orderamount');
@@ -132,54 +136,54 @@ class Statmarketing extends AdminControl
                 $caption = lang('statstore_ordernum');
                 break;
         }
-        if($this->search_arr['search_type'] == 'day'){
+        if ($this->search_arr['search_type'] == 'day') {
             //构造横轴数据
-            for($i=0; $i<24; $i++){
+            for ($i = 0; $i < 24; $i++) {
                 //横轴
                 $stat_arr['xAxis']['categories'][] = "$i";
-                foreach ($goodstype_arr as $k=>$v){
+                foreach ($goodstype_arr as $k => $v) {
                     $statlist[$k][$i] = 0;
                 }
             }
             $field .= ' ,HOUR(FROM_UNIXTIME(order_add_time)) as timeval ';
         }
-        if($this->search_arr['search_type'] == 'week'){
+        if ($this->search_arr['search_type'] == 'week') {
             //构造横轴数据
-            for($i=1; $i<=7; $i++){
+            for ($i = 1; $i <= 7; $i++) {
                 $tmp_weekarr = getSystemWeekArr();
                 //横轴
                 $stat_arr['xAxis']['categories'][] = $tmp_weekarr[$i];
                 unset($tmp_weekarr);
-                foreach ($goodstype_arr as $k=>$v){
+                foreach ($goodstype_arr as $k => $v) {
                     $statlist[$k][$i] = 0;
                 }
             }
             $field .= ' ,WEEKDAY(FROM_UNIXTIME(order_add_time))+1 as timeval ';
         }
-        if($this->search_arr['search_type'] == 'month'){
+        if ($this->search_arr['search_type'] == 'month') {
             //计算横轴的最大量(由于每个月的天数不同)
-            $dayofmonth = date('t',$searchtime_arr[0]);
+            $dayofmonth = date('t', $searchtime_arr[0]);
             //构造横轴数据
-            for($i=1; $i<=$dayofmonth; $i++){
+            for ($i = 1; $i <= $dayofmonth; $i++) {
                 //横轴
                 $stat_arr['xAxis']['categories'][] = $i;
-                foreach ($goodstype_arr as $k=>$v){
+                foreach ($goodstype_arr as $k => $v) {
                     $statlist[$k][$i] = 0;
                 }
             }
             $field .= ' ,day(FROM_UNIXTIME(order_add_time)) as timeval ';
         }
         //查询数据
-        $statlist_tmp = $stat_model->statByStatordergoods($where, $field, 0, 0, '','goods_type');
+        $statlist_tmp = $stat_model->statByStatordergoods($where, $field, 0, 0, '', 'goods_type');
         //整理统计数组
-        if($statlist_tmp){
-            foreach($statlist_tmp as $k => $v){
+        if ($statlist_tmp) {
+            foreach ($statlist_tmp as $k => $v) {
                 //将数据按照不同的促销方式分组
-                foreach ($goodstype_arr as $t_k=>$t_v){
-                    if ($t_k == $v['goods_type']){
-                        switch ($this->search_arr['stattype']){
+                foreach ($goodstype_arr as $t_k => $t_v) {
+                    if ($t_k == $v['goods_type']) {
+                        switch ($this->search_arr['stattype']) {
                             case 'orderamount':
-                                $statlist[$t_k][$v['timeval']] = round($v[$this->search_arr['stattype']],2);
+                                $statlist[$t_k][$v['timeval']] = round($v[$this->search_arr['stattype']], 2);
                                 break;
                             case 'goodsnum':
                                 $statlist[$t_k][$v['timeval']] = intval($v[$this->search_arr['stattype']]);
@@ -192,175 +196,176 @@ class Statmarketing extends AdminControl
                 }
             }
         }
-        foreach ($goodstype_arr as $k=>$v){
+        foreach ($goodstype_arr as $k => $v) {
             $tmp = array();
             $tmp['name'] = $v;
             $tmp['data'] = array_values($statlist[$k]);
             $stat_arr['series'][] = $tmp;
         }
         //得到统计图数据
-        $stat_arr['title'] = $caption.lang('ds_stat');
+        $stat_arr['title'] = $caption . lang('ds_stat');
         $stat_arr['yAxis'] = $caption;
         $stat_json = getStatData_LineLabels($stat_arr);
-        View::assign('stat_json',$stat_json);
-        View::assign('stattype',input('param.stattype'));
+        View::assign('stat_json', $stat_json);
+        View::assign('stattype', input('param.stattype'));
         echo View::fetch('stat_linelabels');
     }
 
     /**
      * 抢购统计
      */
-    public function group(){
-        if(!isset($this->search_arr['search_type'])){
+    public function group()
+    {
+        if (!isset($this->search_arr['search_type'])) {
             $this->search_arr['search_type'] = 'day';
         }
         $stat_model = model('stat');
         //获得搜索的开始时间和结束时间
         $searchtime_arr = $stat_model->getStarttimeAndEndtime($this->search_arr);
-        View::assign('searchtime',implode('|',$searchtime_arr));
+        View::assign('searchtime', implode('|', $searchtime_arr));
         $this->setAdminCurItem('group');
         return View::fetch('marketing_group');
     }
     /**
      * 抢购统计
      */
-    public function grouplist(){
+    public function grouplist()
+    {
         $groupbuy_model = model('groupbuy');
         $where = array();
-        $where[]=array('groupbuy_is_vr','=',0);//不统计虚拟抢购
-        $searchtime_arr_tmp = explode('|',$this->search_arr['t']);
-        foreach ((array)$searchtime_arr_tmp as $k=>$v){
+        $where[] = array('groupbuy_is_vr', '=', 0); //不统计虚拟抢购
+        $searchtime_arr_tmp = explode('|', $this->search_arr['t']);
+        foreach ((array)$searchtime_arr_tmp as $k => $v) {
             $searchtime_arr[] = intval($v);
         }
-       $where[] = array('groupbuy_starttime','between',"$searchtime_arr[0],$searchtime_arr[1]");
-        $where[]=array('groupbuy_state','in',array(10,20,30));
+        $where[] = array('groupbuy_starttime', 'between', "$searchtime_arr[0],$searchtime_arr[1]");
+        $where[] = array('groupbuy_state', 'in', array(10, 20, 30));
         $gname = trim(input('param.gname'));
-        if ($gname){
-            $where[]=array('groupbuy_name','like',"%{$gname}%");
+        if ($gname) {
+            $where[] = array('groupbuy_name', 'like', "%{$gname}%");
         }
-        $grouplist_tmp = $groupbuy_model->getGroupbuyExtendList($where,10,'groupbuy_starttime asc');
-        $grouplist=array();
-        if ($grouplist_tmp){
-            foreach ((array)$grouplist_tmp as $k=>$v){
+        $grouplist_tmp = $groupbuy_model->getGroupbuyExtendList($where, 10, 'groupbuy_starttime asc');
+        $grouplist = array();
+        if ($grouplist_tmp) {
+            foreach ((array)$grouplist_tmp as $k => $v) {
                 $v['goodsnum'] = 0;
                 $v['ordernum'] = 0;
-                $v['orderrate'] = round(0,2);
+                $v['orderrate'] = round(0, 2);
                 $v['goodsamount'] = ds_price_format(0);
                 $grouplist[$v['groupbuy_id']] = $v;
             }
             //查询抢购的订单
             $where = array();
-            $where[] = array('order_isvalid','=',1);//计入统计的有效订单
-            $where[]=array('goods_type','=',2);//抢购
-            $where[]=array('promotions_id','in',array_keys($grouplist));
+            $where[] = array('order_isvalid', '=', 1); //计入统计的有效订单
+            $where[] = array('goods_type', '=', 2); //抢购
+            $where[] = array('promotions_id', 'in', array_keys($grouplist));
             $field = 'promotions_id,SUM(goods_num) as goodsnum,COUNT(DISTINCT order_id) as ordernum,SUM(goods_pay_price) as goodsamount';
             $order_list = model('stat')->statByStatordergoods($where, $field, 0, 0, '', 'promotions_id');
-            foreach ((array)$order_list as $k=>$v){
+            foreach ((array)$order_list as $k => $v) {
                 $grouplist[$v['promotions_id']]['goodsnum'] = $v['goodsnum'];
                 $grouplist[$v['promotions_id']]['ordernum'] = $v['ordernum'];
-                if (intval($grouplist[$v['promotions_id']]['groupbuy_views']) > 0){
-                    $grouplist[$v['promotions_id']]['orderrate'] = round(($v['ordernum']/$grouplist[$v['promotions_id']]['views'])*100,2);
+                if (intval($grouplist[$v['promotions_id']]['groupbuy_views']) > 0) {
+                    $grouplist[$v['promotions_id']]['orderrate'] = round(($v['ordernum'] / $grouplist[$v['promotions_id']]['views']) * 100, 2);
                 }
                 $grouplist[$v['promotions_id']]['goodsamount'] = $v['goodsamount'];
             }
         }
-        View::assign('grouplist',$grouplist);
-        View::assign('show_page',$groupbuy_model->page_info->render());
-        View::assign('searchtime',input('param.t'));
+        View::assign('grouplist', $grouplist);
+        View::assign('show_page', $groupbuy_model->page_info->render());
+        View::assign('searchtime', input('param.t'));
         echo View::fetch('marketing_grouplist');
     }
     /**
      * 抢购商品统计
      */
-    public function groupgoods(){
+    public function groupgoods()
+    {
         $stat_model = model('stat');
         $where = array();
-        $statlist= array();
-        $searchtime_arr_tmp = explode('|',$this->search_arr['t']);
-        foreach ((array)$searchtime_arr_tmp as $k=>$v){
+        $statlist = array();
+        $searchtime_arr_tmp = explode('|', $this->search_arr['t']);
+        foreach ((array)$searchtime_arr_tmp as $k => $v) {
             $searchtime_arr[] = intval($v);
         }
-        $where[] = array('order_add_time','between',$searchtime_arr);
-        $where[] = array('goods_type','=',2);//抢购
+        $where[] = array('order_add_time', 'between', $searchtime_arr);
+        $where[] = array('goods_type', '=', 2); //抢购
         $field = " goods_id,goods_name";
         $field .= " ,SUM(goods_num) as goodsnum";
         $field .= " ,SUM(goods_pay_price) as goodsamount";
-        $field .= " ,SUM(IF(order_state='".ORDER_STATE_CANCEL."',goods_num,0)) as cancelgoodsnum";
-        $field .= " ,SUM(IF(order_state='".ORDER_STATE_CANCEL."',goods_pay_price,0)) as cancelgoodsamount";
-        $field .= " ,SUM(IF(order_state<>'".ORDER_STATE_CANCEL."' and order_state<>'".ORDER_STATE_NEW."',goods_num,0)) as finishgoodsnum";
-        $field .= " ,SUM(IF(order_state<>'".ORDER_STATE_CANCEL."' and order_state<>'".ORDER_STATE_NEW."',goods_pay_price,0)) as finishgoodsamount";
-        $orderby_arr = array('goodsnum asc','goodsnum desc','goodsamount asc','goodsamount desc','cancelgoodsnum asc','cancelgoodsnum desc','cancelgoodsamount asc','cancelgoodsamount desc','finishgoodsnum asc','finishgoodsnum desc','finishgoodsamount asc','finishgoodsamount desc');
-        if (!in_array(trim(@$this->search_arr['orderby']),$orderby_arr)){
+        $field .= " ,SUM(IF(order_state='" . ORDER_STATE_CANCEL . "',goods_num,0)) as cancelgoodsnum";
+        $field .= " ,SUM(IF(order_state='" . ORDER_STATE_CANCEL . "',goods_pay_price,0)) as cancelgoodsamount";
+        $field .= " ,SUM(IF(order_state<>'" . ORDER_STATE_CANCEL . "' and order_state<>'" . ORDER_STATE_NEW . "',goods_num,0)) as finishgoodsnum";
+        $field .= " ,SUM(IF(order_state<>'" . ORDER_STATE_CANCEL . "' and order_state<>'" . ORDER_STATE_NEW . "',goods_pay_price,0)) as finishgoodsamount";
+        $orderby_arr = array('goodsnum asc', 'goodsnum desc', 'goodsamount asc', 'goodsamount desc', 'cancelgoodsnum asc', 'cancelgoodsnum desc', 'cancelgoodsamount asc', 'cancelgoodsamount desc', 'finishgoodsnum asc', 'finishgoodsnum desc', 'finishgoodsamount asc', 'finishgoodsamount desc');
+        if (!in_array(trim(@$this->search_arr['orderby']), $orderby_arr)) {
             $this->search_arr['orderby'] = 'goodsnum desc';
         }
-        $orderby = trim($this->search_arr['orderby']).',goods_id desc';
+        $orderby = trim($this->search_arr['orderby']) . ',goods_id desc';
 
         //统计记录总条数
         $count_arr = $stat_model->getoneByStatordergoods($where, 'count(DISTINCT goods_id) as countnum');
         $countnum = intval($count_arr['countnum']);
-        if (@$this->search_arr['exporttype'] == 'excel'){
-            $statlist_tmp = Db::query('SELECT '.$field.' FROM '.config('database.connections.mysql.prefix').'statordergoods WHERE goods_type=2 AND order_add_time BETWEEN '.$searchtime_arr[0].' AND '.$searchtime_arr[1].' GROUP BY goods_id'.' ORDER BY '.$orderby);
- 
+        if (@$this->search_arr['exporttype'] == 'excel') {
+            $statlist_tmp = Db::query('SELECT ' . $field . ' FROM ' . config('database.connections.mysql.prefix') . 'statordergoods WHERE goods_type=2 AND order_add_time BETWEEN ' . $searchtime_arr[0] . ' AND ' . $searchtime_arr[1] . ' GROUP BY goods_id' . ' ORDER BY ' . $orderby);
         } else {
-            $statlist_tmp = Db::query('SELECT '.$field.' FROM '.config('database.connections.mysql.prefix').'statordergoods WHERE goods_type=2 AND order_add_time BETWEEN '.$searchtime_arr[0].' AND '.$searchtime_arr[1].' GROUP BY goods_id'.' ORDER BY '.$orderby.' LIMIT '.(input('param.page')?input('param.page'):0).',10');
-
+            $statlist_tmp = Db::query('SELECT ' . $field . ' FROM ' . config('database.connections.mysql.prefix') . 'statordergoods WHERE goods_type=2 AND order_add_time BETWEEN ' . $searchtime_arr[0] . ' AND ' . $searchtime_arr[1] . ' GROUP BY goods_id' . ' ORDER BY ' . $orderby . ' LIMIT ' . (input('param.page') ? input('param.page') : 0) . ',10');
         }
         $statheader = array();
-        $statheader[] = array('text'=>lang('ds_goods_name'),'key'=>'goods_name','class'=>'alignleft');
-        $statheader[] = array('text'=>lang('goodsnum'),'key'=>'goodsnum','isorder'=>1);
-        $statheader[] = array('text'=>lang('statstore_orderamount'),'key'=>'goodsamount','isorder'=>1);
-        $statheader[] = array('text'=>lang('cancel_goods_number'),'key'=>'cancelgoodsnum','isorder'=>1);
-        $statheader[] = array('text'=>lang('cancel_amount'),'key'=>'cancelgoodsamount','isorder'=>1);
-        $statheader[] = array('text'=>lang('finish_goods_number'),'key'=>'finishgoodsnum','isorder'=>1);
-        $statheader[] = array('text'=>lang('finish_amount'),'key'=>'finishgoodsamount','isorder'=>1);
-        foreach ((array)$statlist_tmp as $k=>$v){
+        $statheader[] = array('text' => lang('ds_goods_name'), 'key' => 'goods_name', 'class' => 'alignleft');
+        $statheader[] = array('text' => lang('goodsnum'), 'key' => 'goodsnum', 'isorder' => 1);
+        $statheader[] = array('text' => lang('statstore_orderamount'), 'key' => 'goodsamount', 'isorder' => 1);
+        $statheader[] = array('text' => lang('cancel_goods_number'), 'key' => 'cancelgoodsnum', 'isorder' => 1);
+        $statheader[] = array('text' => lang('cancel_amount'), 'key' => 'cancelgoodsamount', 'isorder' => 1);
+        $statheader[] = array('text' => lang('finish_goods_number'), 'key' => 'finishgoodsnum', 'isorder' => 1);
+        $statheader[] = array('text' => lang('finish_amount'), 'key' => 'finishgoodsamount', 'isorder' => 1);
+        foreach ((array)$statlist_tmp as $k => $v) {
             $tmp = $v;
-            foreach ($statheader as $h_k=>$h_v){
+            foreach ($statheader as $h_k => $h_v) {
                 $tmp[$h_v['key']] = $v[$h_v['key']];
-                if ($h_v['key'] == 'goods_name'){
-                    $tmp[$h_v['key']] = '<a href="'.(string)url('home/Goods/index', array('goods_id' => $v['goods_id'])).'" target="_blank">'.$v['goods_name'].'</a>';
+                if ($h_v['key'] == 'goods_name') {
+                    $tmp[$h_v['key']] = '<a href="' . (string)url('home/Goods/index', array('goods_id' => $v['goods_id'])) . '" target="_blank">' . $v['goods_name'] . '</a>';
                 }
             }
             $statlist[] = $tmp;
         }
-        if (@$this->search_arr['exporttype'] == 'excel'){
+        if (@$this->search_arr['exporttype'] == 'excel') {
             //导出Excel
             $excel_obj = new \excel\Excel();
             $excel_data = array();
             //设置样式
-            $excel_obj->setStyle(array('id'=>'s_title','Font'=>array('FontName'=>'宋体','Size'=>'12','Bold'=>'1')));
+            $excel_obj->setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
             //header
-            foreach ($statheader as $k=>$v){
-                $excel_data[0][] = array('styleid'=>'s_title','data'=>$v['text']);
+            foreach ($statheader as $k => $v) {
+                $excel_data[0][] = array('styleid' => 's_title', 'data' => $v['text']);
             }
             //data
-            foreach ((array)$statlist as $k=>$v){
-                foreach ($statheader as $h_k=>$h_v){
-                    $excel_data[$k+1][] = array('data'=>$v[$h_v['key']]);
+            foreach ((array)$statlist as $k => $v) {
+                foreach ($statheader as $h_k => $h_v) {
+                    $excel_data[$k + 1][] = array('data' => $v[$h_v['key']]);
                 }
             }
-            $excel_data = $excel_obj->charset($excel_data,CHARSET);
+            $excel_data = $excel_obj->charset($excel_data, CHARSET);
             $excel_obj->addArray($excel_data);
-            $excel_obj->addWorksheet($excel_obj->charset(lang('groupbuy_goods_statis'),CHARSET));
-            $excel_obj->generateXML($excel_obj->charset(lang('groupbuy_goods_statis'),CHARSET).date('Y-m-d-H',TIMESTAMP));
+            $excel_obj->addWorksheet($excel_obj->charset(lang('groupbuy_goods_statis'), CHARSET));
+            $excel_obj->generateXML($excel_obj->charset(lang('groupbuy_goods_statis'), CHARSET) . date('Y-m-d-H', TIMESTAMP));
             exit();
         } else {
-            View::assign('statheader',$statheader);
-            View::assign('statlist',$statlist);
-            View::assign('show_page',Db::name('statordergoods')->paginate(10,$countnum)->render());
-            View::assign('searchtime',input('param.t'));
-            View::assign('orderby',$this->search_arr['orderby']);
-            View::assign('actionurl',(string)url('Statmarketing/groupgoods',['t'=>$this->search_arr['t']]));
+            View::assign('statheader', $statheader);
+            View::assign('statlist', $statlist);
+            View::assign('show_page', Db::name('statordergoods')->paginate(10, $countnum)->render());
+            View::assign('searchtime', input('param.t'));
+            View::assign('orderby', $this->search_arr['orderby']);
+            View::assign('actionurl', (string)url('Statmarketing/groupgoods', ['t' => $this->search_arr['t']]));
             echo View::fetch('stat_listandorder');
         }
     }
 
     protected function getAdminItemList()
     {
-        $menu_array=array(
-            array('name'=>'promotion','text'=>lang('stat_promotion'),'url'=>(string)url('Statmarketing/promotion')),
-            array('name'=>'group','text'=>lang('stat_group'),'url'=>(string)url('Statmarketing/group'))
+        $menu_array = array(
+            array('name' => 'promotion', 'text' => lang('stat_promotion'), 'url' => (string)url('Statmarketing/promotion')),
+            array('name' => 'group', 'text' => lang('stat_group'), 'url' => (string)url('Statmarketing/group'))
         );
         return $menu_array;
     }
-}
+}

+ 64 - 52
app/admin/controller/Statmember.php

@@ -6,28 +6,31 @@
  */
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 use think\facade\Db;
+
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Statmember extends AdminControl {
+class Statmember extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize(); // TODO: Change the autogenerated stub
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/stat.lang.php');
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/member.lang.php');
-        include_once root_path(). 'extend/mall/statistics.php';
-        include_once root_path(). 'extend/mall/datehelper.php';
+        include_once root_path() . 'extend/mall/statistics.php';
+        include_once root_path() . 'extend/mall/datehelper.php';
         $stat_model = model('stat');
         //存储参数
         $this->search_arr = input('param.');
@@ -50,7 +53,8 @@ class Statmember extends AdminControl {
     /**
      * 新增会员
      */
-    public function newmember() {
+    public function newmember()
+    {
         if (!isset($this->search_arr['search_type'])) {
             $this->search_arr['search_type'] = 'day';
         }
@@ -86,7 +90,7 @@ class Statmember extends AdminControl {
             $today_day = @date('d', $this->search_arr['day']['search_time']); //今天日期
             $yesterday_day = @date('d', $stime); //昨天日期
 
-            $where[] = array('member_addtime','between',array($stime, $etime));
+            $where[] = array('member_addtime', 'between', array($stime, $etime));
             $field .= ' ,DAY(FROM_UNIXTIME(member_addtime)) as dayval,HOUR(FROM_UNIXTIME(member_addtime)) as hourval ';
             $memberlist = $stat_model->statByMember($where, $field, 0, '', 'dayval,hourval');
             if ($memberlist) {
@@ -140,7 +144,7 @@ class Statmember extends AdminControl {
                 $stat_arr['xAxis']['categories'][] = $tmp_weekarr[$i];
                 unset($tmp_weekarr);
             }
-            $where[] = array('member_addtime','between',array($stime, $etime));
+            $where[] = array('member_addtime', 'between', array($stime, $etime));
             $field .= ',WEEKOFYEAR(FROM_UNIXTIME(member_addtime)) as weekval,WEEKDAY(FROM_UNIXTIME(member_addtime))+1 as dayofweekval ';
             $memberlist = $stat_model->statByMember($where, $field, 0, '', 'weekval,dayofweekval');
 
@@ -198,7 +202,7 @@ class Statmember extends AdminControl {
                 $stat_arr['xAxis']['categories'][] = $i;
                 unset($tmp_montharr);
             }
-            $where[] = array('member_addtime','between',array($stime, $etime));
+            $where[] = array('member_addtime', 'between', array($stime, $etime));
             $field .= ',MONTH(FROM_UNIXTIME(member_addtime)) as monthval,day(FROM_UNIXTIME(member_addtime)) as dayval ';
             $memberlist = $stat_model->statByMember($where, $field, 0, '', 'monthval,dayval');
             if ($memberlist) {
@@ -281,7 +285,8 @@ class Statmember extends AdminControl {
     /**
      * 会员分析
      */
-    public function analyze() {
+    public function analyze()
+    {
         if (!isset($this->search_arr['search_type'])) {
             $this->search_arr['search_type'] = 'day';
         }
@@ -291,16 +296,16 @@ class Statmember extends AdminControl {
             //横轴
             $stat_arr['xAxis']['categories'][] = $i;
         }
-        $stat_arr['title'] = lang('buyer_rank').'Top15';
+        $stat_arr['title'] = lang('buyer_rank') . 'Top15';
         $stat_arr['legend']['enabled'] = false;
 
         //获得搜索的开始时间和结束时间
         $searchtime_arr = $stat_model->getStarttimeAndEndtime($this->search_arr);
 
         $where = array();
-        $where[] = array('statm_time','between', $searchtime_arr);
+        $where[] = array('statm_time', 'between', $searchtime_arr);
         //下单量
-        $where[]=array('statm_ordernum','>', 0);
+        $where[] = array('statm_ordernum', '>', 0);
         $field = ' statm_memberid, statm_membername, SUM(statm_ordernum) as ordernum ';
         $ordernum_listtop15 = $stat_model->statByStatmember($where, $field, 0, 15, 'ordernum desc,statm_memberid desc', 'statm_memberid');
         $stat_ordernum_arr = $stat_arr;
@@ -323,7 +328,7 @@ class Statmember extends AdminControl {
         View::assign('ordernum_listtop15', $ordernum_listtop15);
 
         //下单商品件数
-        $where[]=array('statm_goodsnum','>', 0);
+        $where[] = array('statm_goodsnum', '>', 0);
         $field = ' statm_memberid, statm_membername, SUM(statm_goodsnum) as goodsnum ';
         $goodsnum_listtop15 = $stat_model->statByStatmember($where, $field, 0, 15, 'goodsnum desc,statm_memberid desc', 'statm_memberid');
         $stat_goodsnum_arr = $stat_arr;
@@ -346,7 +351,7 @@ class Statmember extends AdminControl {
         View::assign('goodsnum_listtop15', $goodsnum_listtop15);
 
         //下单金额
-        $where[]=array('statm_orderamount','>', 0);
+        $where[] = array('statm_orderamount', '>', 0);
         $field = ' statm_memberid, statm_membername, SUM(statm_orderamount) as orderamount ';
         $orderamount_listtop15 = $stat_model->statByStatmember($where, $field, 0, 15, 'orderamount desc,statm_memberid desc', 'statm_memberid');
         $stat_orderamount_arr = $stat_arr;
@@ -375,40 +380,41 @@ class Statmember extends AdminControl {
     /**
      * 会员分析异步详细列表
      */
-    public function analyzeinfo() {
+    public function analyzeinfo()
+    {
         $stat_model = model('stat');
         $where = array();
         $searchtime_arr_tmp = explode('|', $this->search_arr['t']);
         foreach ((array) $searchtime_arr_tmp as $k => $v) {
             $searchtime_arr[] = intval($v);
         }
-        $where[] = array('statm_time','between', $searchtime_arr);
+        $where[] = array('statm_time', 'between', $searchtime_arr);
         $memberlist = array();
         //查询统计数据
         $field = ' statm_memberid, statm_membername ';
         $type = '';
         switch (input('param.type')) {
             case 'orderamount':
-                $where[]=array('statm_orderamount','>', 0);
+                $where[] = array('statm_orderamount', '>', 0);
                 $field .= ' ,SUM(statm_orderamount) as orderamount ';
                 $caption = lang('statstore_orderamount');
                 break;
             case 'goodsnum':
-                $where[]=array('statm_goodsnum','>', 0);
+                $where[] = array('statm_goodsnum', '>', 0);
                 $field .= ' ,SUM(statm_goodsnum) as goodsnum ';
                 $caption = lang('goodsnum');
                 break;
             default:
                 $type = 'ordernum';
-                $where[]=array('statm_ordernum','>', 0);
+                $where[] = array('statm_ordernum', '>', 0);
                 $field .= ' ,SUM(statm_ordernum) as ordernum ';
                 $caption = lang('statstore_ordernum');
                 break;
         }
         if (input('param.exporttype') == 'excel') {
-            $memberlist = $stat_model->statByStatmember($where, $field, 0, 0, input('param.type')." desc,statm_memberid desc", 'statm_memberid');
+            $memberlist = $stat_model->statByStatmember($where, $field, 0, 0, input('param.type') . " desc,statm_memberid desc", 'statm_memberid');
         } else {
-            $memberlist = $stat_model->statByStatmember($where, $field, 10, 0, input('param.type')." desc,statm_memberid desc", 'statm_memberid');
+            $memberlist = $stat_model->statByStatmember($where, $field, 10, 0, input('param.type') . " desc,statm_memberid desc", 'statm_memberid');
         }
         $curpage = ($t = intval(input('param.curpage'))) ? $t : 1;
         foreach ((array) $memberlist as $k => $v) {
@@ -449,7 +455,8 @@ class Statmember extends AdminControl {
     /**
      * 查看会员列表
      */
-    public function showmember() {
+    public function showmember()
+    {
         $stat_model = model('stat');
         $where = array();
         $actionurl = '';
@@ -459,7 +466,7 @@ class Statmember extends AdminControl {
             foreach ((array) $searchtime_arr_tmp as $k => $v) {
                 $searchtime_arr[] = intval($v);
             }
-            $where[] = array('member_addtime','between',$searchtime_arr);
+            $where[] = array('member_addtime', 'between', $searchtime_arr);
         }
         if (isset($this->search_arr['exporttype']) && $this->search_arr['exporttype'] == 'excel') {
             $member_list = $stat_model->getMemberList($where);
@@ -511,7 +518,8 @@ class Statmember extends AdminControl {
     /**
      * 会员规模
      */
-    public function scale() {
+    public function scale()
+    {
         if (!isset($this->search_arr['search_type'])) {
             $this->search_arr['search_type'] = 'day';
         }
@@ -520,9 +528,9 @@ class Statmember extends AdminControl {
         //获得搜索的开始时间和结束时间
         $searchtime_arr = $stat_model->getStarttimeAndEndtime($this->search_arr);
         $where = array();
-        $where[] = array('statm_time','between', $searchtime_arr);
+        $where[] = array('statm_time', 'between', $searchtime_arr);
         if (trim(isset($this->search_arr['membername']))) {
-            $where[]=array('statm_membername','like', "%" . trim($this->search_arr['membername']) . "%");
+            $where[] = array('statm_membername', 'like', "%" . trim($this->search_arr['membername']) . "%");
         }
         $field = ' statm_memberid, statm_membername, statm_time, SUM(statm_orderamount) as orderamount, SUM(statm_predincrease) as predincrease, -SUM(statm_predreduce) as predreduce, SUM(statm_pointsincrease) as pointsincrease, -SUM(statm_pointsreduce) as pointsreduce ';
         //排序
@@ -576,7 +584,8 @@ class Statmember extends AdminControl {
     /**
      * 区域分析
      */
-    public function area() {
+    public function area()
+    {
         if (!isset($this->search_arr['search_type'])) {
             $this->search_arr['search_type'] = 'day';
         }
@@ -591,15 +600,16 @@ class Statmember extends AdminControl {
     /**
      * 区域分析之详细列表
      */
-    public function area_list() {
+    public function area_list()
+    {
         $stat_model = model('stat');
         $where = array();
-        $where[] = array('order_isvalid','=',1); //计入统计的有效订单
+        $where[] = array('order_isvalid', '=', 1); //计入统计的有效订单
         $searchtime_arr_tmp = explode('|', $this->search_arr['t']);
         foreach ((array) $searchtime_arr_tmp as $k => $v) {
             $searchtime_arr[] = intval($v);
         }
-        $where[] = array('order_add_time','between',$searchtime_arr);
+        $where[] = array('order_add_time', 'between', $searchtime_arr);
         $field = ' reciver_province_id, COUNT(*) as ordernum,SUM(order_amount) as orderamount, COUNT(DISTINCT buyer_id) as membernum ';
 
         $orderby_arr = array('membernum asc', 'membernum desc', 'orderamount asc', 'orderamount desc', 'ordernum asc', 'ordernum desc');
@@ -665,15 +675,16 @@ class Statmember extends AdminControl {
     /**
      * 区域分析之地图数据
      */
-    public function area_map() {
+    public function area_map()
+    {
         $stat_model = model('stat');
         $where = array();
-        $where[] = array('order_isvalid','=',1); //计入统计的有效订单
+        $where[] = array('order_isvalid', '=', 1); //计入统计的有效订单
         $searchtime_arr_tmp = explode('|', $this->search_arr['t']);
         foreach ((array) $searchtime_arr_tmp as $k => $v) {
             $searchtime_arr[] = intval($v);
         }
-        $where[] = array('order_add_time','between',$searchtime_arr);
+        $where[] = array('order_add_time', 'between', $searchtime_arr);
         $memberlist = array();
         //查询统计数据
         $field = ' reciver_province_id ';
@@ -739,7 +750,8 @@ class Statmember extends AdminControl {
     /**
      * 购买分析
      */
-    public function buying() {
+    public function buying()
+    {
         if (!isset($this->search_arr['search_type'])) {
             $this->search_arr['search_type'] = 'day';
         }
@@ -750,8 +762,8 @@ class Statmember extends AdminControl {
          * 客单价分布
          */
         $where = array();
-        $where[] = array('order_isvalid','=',1); //计入统计的有效订单
-        $where[] = array('order_add_time','between',$searchtime_arr);
+        $where[] = array('order_isvalid', '=', 1); //计入统计的有效订单
+        $where[] = array('order_add_time', 'between', $searchtime_arr);
 
         $field = '1';
         $pricerange_arr = ($t = trim(config('ds_config.stat_orderpricerange'))) ? unserialize($t) : '';
@@ -806,16 +818,16 @@ class Statmember extends AdminControl {
          */
         //统计期间会员下单量
         $where = array();
-        $where[] = array('statm_time','between', $searchtime_arr);
-        $where[] = array('statm_ordernum','>', 0);
+        $where[] = array('statm_time', 'between', $searchtime_arr);
+        $where[] = array('statm_ordernum', '>', 0);
         $field = 'COUNT(*) as countnum';
         $countnum_arr = $stat_model->getOneStatmember($where, $field);
         $countnum = intval($countnum_arr['countnum']);
         $member_arr = array();
-        for ($i = 0; $i < $countnum; $i += 1000) {//由于数据库底层的限制,所以每次查询1000条
-            $statmember_list = Db::name('statmember')->field('statm_memberid,statm_ordernum')->where($where)->page($i,1000)->group('statm_id')->select()->toArray();
+        for ($i = 0; $i < $countnum; $i += 1000) { //由于数据库底层的限制,所以每次查询1000条
+            $statmember_list = Db::name('statmember')->field('statm_memberid,statm_ordernum')->where($where)->page($i, 1000)->group('statm_id')->select()->toArray();
             foreach ((array) $statmember_list as $k => $v) {
-                $member_arr[$v['statm_memberid']] = isset($member_arr[$v['statm_memberid']])?intval($member_arr[$v['statm_memberid']]):0 + intval($v['statm_ordernum']);
+                $member_arr[$v['statm_memberid']] = isset($member_arr[$v['statm_memberid']]) ? intval($member_arr[$v['statm_memberid']]) : 0 + intval($v['statm_ordernum']);
             }
         }
         $stattimes_arr = array();
@@ -824,9 +836,9 @@ class Statmember extends AdminControl {
             for ($i = 1; $i <= 10; $i++) {
                 $stattimes_arr[$i] = array('num' => 0, 'rate' => 0.00);
                 if ($i >= 10) {
-                    $stattimes_arr[$i]['text'] = sprintf(lang('buy_time_info'),10);
+                    $stattimes_arr[$i]['text'] = sprintf(lang('buy_time_info'), 10);
                 } else {
-                    $stattimes_arr[$i]['text'] = sprintf(lang('buy_time_info'),$i);
+                    $stattimes_arr[$i]['text'] = sprintf(lang('buy_time_info'), $i);
                 }
             }
             foreach ($member_arr as $k => $v) {
@@ -844,8 +856,8 @@ class Statmember extends AdminControl {
 
         //购买时段分布
         $where = array();
-        $where[] = array('order_isvalid','=',1); //计入统计的有效订单
-        $where[] = array('order_add_time','between',$searchtime_arr);
+        $where[] = array('order_isvalid', '=', 1); //计入统计的有效订单
+        $where[] = array('order_add_time', 'between', $searchtime_arr);
         $field = ' HOUR(FROM_UNIXTIME(order_add_time)) as hourval,COUNT(*) as ordernum ';
         $orderlist = $stat_model->statByStatorder($where, $field, 0, 0, '', 'hourval');
         $stat_arr = array();
@@ -873,7 +885,8 @@ class Statmember extends AdminControl {
         return View::fetch('stat_buying');
     }
 
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array('name' => 'newmember', 'text' => lang('stat_newmember'), 'url' => (string)url('Statmember/newmember')),
             array('name' => 'analyze', 'text' => lang('stat_memberanalyze'), 'url' => (string)url('Statmember/analyze')),
@@ -884,5 +897,4 @@ class Statmember extends AdminControl {
         );
         return $menu_array;
     }
-
 }

File diff suppressed because it is too large
+ 280 - 272
app/admin/controller/Statstore.php


+ 50 - 43
app/admin/controller/Stattrade.php

@@ -6,35 +6,38 @@
  */
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Stattrade extends AdminControl {
+class Stattrade extends AdminControl
+{
 
     private $search_arr; //处理后的参数
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/stat.lang.php');
-        include_once root_path(). 'extend/mall/statistics.php';
-        include_once root_path(). 'extend/mall/datehelper.php';
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/stat.lang.php');
+        include_once root_path() . 'extend/mall/statistics.php';
+        include_once root_path() . 'extend/mall/datehelper.php';
     }
 
     /**
      * 销售收入统计
      */
-    public function income() {
+    public function income()
+    {
         $stat_model = model('stat');
         $search_year = input('param.search_year');
         $search_month = input('param.search_month');
@@ -60,10 +63,10 @@ class Stattrade extends AdminControl {
             $search_month = $month;
         }
         $condition = array();
-        $condition[] = array('os_month','=',$year . $month);
+        $condition[] = array('os_month', '=', $year . $month);
         if (input('param.exporttype') == 'excel') {
             //获取全部店铺结账数据
-            $bill_list = $stat_model->getBillList(array(array('ob_startdate','>=',strtotime($year .'-'. $month.'-01 0:0:0')),array('ob_enddate','<',strtotime($year .'-'. $month.'-01 23:59:59 +1 month -1 day'))), 'ob', false);
+            $bill_list = $stat_model->getBillList(array(array('ob_startdate', '>=', strtotime($year . '-' . $month . '-01 0:0:0')), array('ob_enddate', '<', strtotime($year . '-' . $month . '-01 23:59:59 +1 month -1 day'))), 'ob', false);
             //导出Excel
             $excel_obj = new \excel\Excel();
             $excel_data = array();
@@ -99,8 +102,8 @@ class Stattrade extends AdminControl {
             $plat_data = $stat_model->getBillList($condition, 'os');
             View::assign('plat_data', $plat_data[0]);
             //店铺数据
-            View::assign('store_list', $stat_model->getBillList(array(array('ob_startdate','>=',strtotime($year .'-'. $month.'-01 0:0:0')),array('ob_enddate','<',strtotime($year .'-'. $month.'-01 23:59:59 +1 month -1 day'))), 'ob'));
-            View::assign('show_page',$stat_model->page_info->render());
+            View::assign('store_list', $stat_model->getBillList(array(array('ob_startdate', '>=', strtotime($year . '-' . $month . '-01 0:0:0')), array('ob_enddate', '<', strtotime($year . '-' . $month . '-01 23:59:59 +1 month -1 day'))), 'ob'));
+            View::assign('show_page', $stat_model->page_info->render());
             $this->setAdminCurItem('income');
             return View::fetch('stat_income');
         }
@@ -109,7 +112,8 @@ class Stattrade extends AdminControl {
     /**
      * 预存款统计
      */
-    public function predeposit() {
+    public function predeposit()
+    {
         $where = array();
         if (trim(input('param.pd_type')) == 'cash_pay') {
             $field = 'sum(lg_freeze_amount) as allnum';
@@ -121,7 +125,7 @@ class Stattrade extends AdminControl {
             $search_type = 'day';
         }
         $pd_type = trim(input('param.pd_type')) == '' ? 'recharge' : trim(input('param.pd_type'));
-        $where[] = array('lg_type','=',$pd_type);
+        $where[] = array('lg_type', '=', $pd_type);
         //初始化时间
         //天
         $search_time = input('param.search_time');
@@ -179,7 +183,7 @@ class Stattrade extends AdminControl {
             $today_day = @date('d', $search_time); //今天日期
             $yesterday_day = @date('d', $stime); //昨天日期
 
-            $where[] = array('lg_addtime','between',array($stime, $etime));
+            $where[] = array('lg_addtime', 'between', array($stime, $etime));
             $field .= ' ,DAY(FROM_UNIXTIME(lg_addtime)) as dayval,HOUR(FROM_UNIXTIME(lg_addtime)) as hourval ';
             $memberlist = $stat_model->getPredepositInfo($where, $field, 0, '', 0, 'dayval,hourval');
             if ($memberlist) {
@@ -225,9 +229,9 @@ class Stattrade extends AdminControl {
                 $stat_arr['xAxis']['categories'][] = $tmp_weekarr[$i];
                 unset($tmp_weekarr);
             }
-            $where[] = array('lg_addtime','between',array($stime, $etime));
+            $where[] = array('lg_addtime', 'between', array($stime, $etime));
             $field .= ',WEEKOFYEAR(FROM_UNIXTIME(lg_addtime)) as weekval,WEEKDAY(FROM_UNIXTIME(lg_addtime))+1 as dayofweekval ';
-            $memberlist = $stat_model->getPredepositInfo($where, $field, 0, '', 0,'weekval,dayofweekval');
+            $memberlist = $stat_model->getPredepositInfo($where, $field, 0, '', 0, 'weekval,dayofweekval');
             if ($memberlist) {
                 foreach ($memberlist as $k => $v) {
                     if ($up_week == $v['weekval']) {
@@ -273,7 +277,7 @@ class Stattrade extends AdminControl {
                 //横轴
                 $stat_arr['xAxis']['categories'][] = $i;
             }
-            $where[] = array('lg_addtime','between',array($stime, $etime));
+            $where[] = array('lg_addtime', 'between', array($stime, $etime));
             $field .= ',MONTH(FROM_UNIXTIME(lg_addtime)) as monthval,day(FROM_UNIXTIME(lg_addtime)) as dayval ';
             $memberlist = $stat_model->getPredepositInfo($where, $field, 0, '', 0, 'monthval,dayval');
             if ($memberlist) {
@@ -318,8 +322,8 @@ class Stattrade extends AdminControl {
             //header
             $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('ds_member_name'));
             $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('lg_addtime'));
-            $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('lg_av_amount').'('.lang('元').')');
-            $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('lg_freeze_amount').'('.lang('元').')');
+            $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('lg_av_amount') . '(' . lang('元') . ')');
+            $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('lg_freeze_amount') . '(' . lang('元') . ')');
             $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('lg_admin_name'));
             $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('operate_type'));
             $excel_data[0][] = array('styleid' => 's_title', 'data' => lang('ds_description'));
@@ -357,16 +361,16 @@ class Stattrade extends AdminControl {
             View::assign('show_page', $stat_model->page_info->render());
             //总数统计部分
             $condition = array();
-            $condition[] = array('lg_type','=','recharge');
-            $condition[] = array('lg_addtime','between',array($stime, $etime));
+            $condition[] = array('lg_type', '=', 'recharge');
+            $condition[] = array('lg_addtime', 'between', array($stime, $etime));
             $recharge_amount = $stat_model->getPredepositInfo($condition, 'sum(lg_av_amount) as allnum');
             $condition = array();
-            $condition[] = array('lg_type','=','order_pay');
-            $condition[] = array('lg_addtime','between',array($stime, $etime));
+            $condition[] = array('lg_type', '=', 'order_pay');
+            $condition[] = array('lg_addtime', 'between', array($stime, $etime));
             $order_amount = $stat_model->getPredepositInfo($condition, 'sum(lg_av_amount) as allnum');
             $condition = array();
-            $condition[] = array('lg_type','=','cash_pay');
-            $condition[] = array('lg_addtime','between',array($stime, $etime));
+            $condition[] = array('lg_type', '=', 'cash_pay');
+            $condition[] = array('lg_addtime', 'between', array($stime, $etime));
             $cash_amount = $stat_model->getPredepositInfo($condition, 'sum(lg_freeze_amount) as allnum');
             View::assign('stat_array', array('recharge_amount' => $recharge_amount[0]['allnum'], 'order_amount' => abs($order_amount[0]['allnum']), 'cash_amount' => abs($cash_amount[0]['allnum'])));
             $user_amount = $stat_model->getPredepositInfo(true, 'distinct lg_member_id');
@@ -387,7 +391,8 @@ class Stattrade extends AdminControl {
     /**
      * 订单统计
      */
-    public function sale() {
+    public function sale()
+    {
         $stat_model = model('stat');
         //存储参数
         $this->search_arr = input('param.');
@@ -426,12 +431,12 @@ class Stattrade extends AdminControl {
         }
 
         $where = array();
-        $where[] = array('order_add_time','between', array($curr_stime, $etime));
+        $where[] = array('order_add_time', 'between', array($curr_stime, $etime));
         if (trim(input('param.order_type')) != '') {
-            $where[]=array('order_state','=',trim(input('param.order_type')));
+            $where[] = array('order_state', '=', trim(input('param.order_type')));
         }
         if (trim(input('param.store_name')) != '') {
-            $where[]=array('store_name','like', '%' . trim(input('param.store_name')) . '%');
+            $where[] = array('store_name', 'like', '%' . trim(input('param.store_name')) . '%');
         }
         if (input('param.exporttype') == 'excel') {
             $order_list = $stat_model->statByStatorder($where, '', 0, 0, 'order_id desc', '');
@@ -502,7 +507,8 @@ class Stattrade extends AdminControl {
     /**
      * 订单走势
      */
-    public function sale_trend() {
+    public function sale_trend()
+    {
         $stat_model = model('stat');
         //存储参数
         $this->search_arr = input('param.');
@@ -513,11 +519,11 @@ class Stattrade extends AdminControl {
         $where = array();
         $order_state = input('param.order_state');
         if (trim($order_state) != '') {
-            $where[]=array('order_state','=',trim($order_state));
+            $where[] = array('order_state', '=', trim($order_state));
         }
         $store_name = input('param.store_name');
         if (trim($store_name) != '') {
-            $where[]=array('store_name','like', '%' . trim($store_name) . '%');
+            $where[] = array('store_name', 'like', '%' . trim($store_name) . '%');
         }
         $stattype = trim(input('param.type'));
         if ($stattype == 'ordernum') {
@@ -552,7 +558,7 @@ class Stattrade extends AdminControl {
             $today_day = @date('d', $searchtime_arr[1]); //今天日期
             $yesterday_day = @date('d', $searchtime_arr[0]); //昨天日期
 
-            $where[] = array('order_add_time','between',$searchtime_arr);
+            $where[] = array('order_add_time', 'between', $searchtime_arr);
             $field .= ' ,DAY(FROM_UNIXTIME(order_add_time)) as dayval,HOUR(FROM_UNIXTIME(order_add_time)) as hourval ';
             $orderlist = $stat_model->statByStatorder($where, $field, 0, 0, '', 'DAY(FROM_UNIXTIME(order_add_time)),HOUR(FROM_UNIXTIME(order_add_time))');
 
@@ -590,7 +596,7 @@ class Stattrade extends AdminControl {
                 $stat_arr['xAxis']['categories'][] = $tmp_weekarr[$i];
                 unset($tmp_weekarr);
             }
-            $where[] = array('order_add_time','between',$searchtime_arr);
+            $where[] = array('order_add_time', 'between', $searchtime_arr);
             $field .= ',WEEKOFYEAR(FROM_UNIXTIME(order_add_time)) as weekval,WEEKDAY(FROM_UNIXTIME(order_add_time))+1 as dayofweekval ';
             $orderlist = $stat_model->statByStatorder($where, $field, 0, 0, '', 'weekval,dayofweekval');
             foreach ((array) $orderlist as $k => $v) {
@@ -629,7 +635,7 @@ class Stattrade extends AdminControl {
                 //横轴
                 $stat_arr['xAxis']['categories'][] = $i;
             }
-            $where[] = array('order_add_time','between',array($searchtime_arr[0], $searchtime_arr[1]));
+            $where[] = array('order_add_time', 'between', array($searchtime_arr[0], $searchtime_arr[1]));
             $field .= ',MONTH(FROM_UNIXTIME(order_add_time)) as monthval,day(FROM_UNIXTIME(order_add_time)) as dayval ';
             $orderlist = $stat_model->statByStatorder($where, $field, 0, 0, '', 'monthval,dayval');
             foreach ($orderlist as $k => $v) {
@@ -650,10 +656,12 @@ class Stattrade extends AdminControl {
         $stat_json = getStatData_LineLabels($stat_arr);
         View::assign('stat_json', $stat_json);
         View::assign('stattype', $stattype);
-        echo View::fetch('stat_linelabels');exit;
+        echo View::fetch('stat_linelabels');
+        exit;
     }
 
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array('name' => 'income', 'text' => lang('stat_sale_income'), 'url' => (string)url('Stattrade/income')),
             array('name' => 'predeposit', 'text' => lang('stat_predeposit'), 'url' => (string)url('Stattrade/predeposit')),
@@ -661,5 +669,4 @@ class Stattrade extends AdminControl {
         );
         return $menu_array;
     }
-
-}
+}

+ 121 - 92
app/admin/controller/Store.php

@@ -7,19 +7,20 @@ use think\facade\Lang;
 use think\facade\Db;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Store extends AdminControl {
+class Store extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/store.lang.php');
     }
@@ -27,7 +28,8 @@ class Store extends AdminControl {
     /**
      * 店铺
      */
-    public function store() {
+    public function store()
+    {
         $store_model = model('store');
 
         $owner_and_name = input('get.owner_and_name');
@@ -85,7 +87,8 @@ class Store extends AdminControl {
         return View::fetch('store');
     }
 
-    private function _get_store_state_array() {
+    private function _get_store_state_array()
+    {
         return array(
             'open' => lang('ds_open'),
             'close' => lang('ds_close'),
@@ -97,7 +100,8 @@ class Store extends AdminControl {
     /**
      * 店铺编辑
      */
-    public function store_edit() {
+    public function store_edit()
+    {
         $store_id = input('param.store_id');
         $store_model = model('store');
         //取店铺信息
@@ -197,7 +201,8 @@ class Store extends AdminControl {
     /**
      * 编辑保存注册信息
      */
-    public function edit_save_joinin() {
+    public function edit_save_joinin()
+    {
         if (request()->isPost()) {
             $member_id = input('post.member_id');
             if ($member_id <= 0) {
@@ -252,7 +257,8 @@ class Store extends AdminControl {
         }
     }
 
-    private function upload_image($file) {
+    private function upload_image($file)
+    {
 
         //上传文件保存路径
         $pic_name = '';
@@ -275,7 +281,8 @@ class Store extends AdminControl {
     /**
      * 店铺经营类目管理
      */
-    public function store_bind_class() {
+    public function store_bind_class()
+    {
 
         $store_id = intval(input('param.store_id'));
 
@@ -307,7 +314,8 @@ class Store extends AdminControl {
     /**
      * 添加经营类目
      */
-    public function store_bind_class_add() {
+    public function store_bind_class_add()
+    {
         $store_id = intval(input('post.store_id'));
         $commis_rate = intval(input('post.commis_rate'));
         if ($commis_rate < 0 || $commis_rate > 100) {
@@ -348,7 +356,8 @@ class Store extends AdminControl {
     /**
      * 删除经营类目
      */
-    public function store_bind_class_del() {
+    public function store_bind_class_del()
+    {
         $bid = intval(input('param.bid'));
 
 
@@ -379,7 +388,8 @@ class Store extends AdminControl {
         }
     }
 
-    public function store_bind_class_update() {
+    public function store_bind_class_update()
+    {
         $bid = intval(input('param.id'));
         if ($bid <= 0) {
             echo json_encode(array('result' => FALSE, 'message' => lang('param_error')));
@@ -408,7 +418,8 @@ class Store extends AdminControl {
     /**
      * 店铺 待审核列表
      */
-    public function store_joinin() {
+    public function store_joinin()
+    {
         $condition = array();
         //店铺列表
         if (input('param.owner_and_name')) {
@@ -446,7 +457,8 @@ class Store extends AdminControl {
     /**
      * 经营类目申请列表
      */
-    public function store_bind_class_applay_list() {
+    public function store_bind_class_applay_list()
+    {
         $condition = array();
         // 不显示自营店铺绑定的类目
         $state = input('param.state');
@@ -499,7 +511,8 @@ class Store extends AdminControl {
     /**
      * 审核经营类目申请
      */
-    public function store_bind_class_applay_check() {
+    public function store_bind_class_applay_check()
+    {
         $storebindclass_model = model('storebindclass');
         $condition = array();
         $condition[] = array('storebindclass_id', '=', intval(input('param.bid')));
@@ -516,7 +529,8 @@ class Store extends AdminControl {
     /**
      * 删除经营类目申请
      */
-    public function store_bind_class_applay_del() {
+    public function store_bind_class_applay_del()
+    {
         $storebindclass_model = model('storebindclass');
         $condition = array();
         $condition[] = array('storebindclass_id', '=', intval(input('param.bid')));
@@ -529,7 +543,8 @@ class Store extends AdminControl {
         }
     }
 
-    private function get_store_joinin_state() {
+    private function get_store_joinin_state()
+    {
         $joinin_state_array = array(
             STORE_JOIN_STATE_NEW => lang('store_join_state_new'),
             STORE_JOIN_STATE_PAY => lang('store_join_state_pay'),
@@ -544,7 +559,8 @@ class Store extends AdminControl {
     /**
      * 店铺续签申请列表
      */
-    public function reopen_list() {
+    public function reopen_list()
+    {
         $condition = array();
         $store_id = input('get.store_id');
         if (intval($store_id)) {
@@ -573,7 +589,8 @@ class Store extends AdminControl {
     /**
      * 审核店铺续签申请
      */
-    public function reopen_check() {
+    public function reopen_check()
+    {
         if (intval(input('param.storereopen_id')) <= 0)
             exit();
         $storereopen_model = model('storereopen');
@@ -604,7 +621,8 @@ class Store extends AdminControl {
     /**
      * 删除店铺续签申请
      */
-    public function reopen_del() {
+    public function reopen_del()
+    {
         $storereopen_model = model('storereopen');
         $condition = array();
         $condition[] = array('storereopen_id', '=', intval(input('param.storereopen_id')));
@@ -628,7 +646,8 @@ class Store extends AdminControl {
     /**
      * 审核详细页
      */
-    public function store_joinin_detail() {
+    public function store_joinin_detail()
+    {
         $storejoinin_model = model('storejoinin');
         $member_id = input('param.member_id');
         $joinin_detail = $storejoinin_model->getOneStorejoinin(array('member_id' => $member_id));
@@ -654,7 +673,8 @@ class Store extends AdminControl {
     /**
      * 审核
      */
-    public function store_joinin_verify() {
+    public function store_joinin_verify()
+    {
         $storejoinin_model = model('storejoinin');
         $joinin_detail = $storejoinin_model->getOneStorejoinin(array('member_id' => input('param.member_id')));
 
@@ -671,7 +691,8 @@ class Store extends AdminControl {
         }
     }
 
-    private function store_joinin_verify_pass($joinin_detail) {
+    private function store_joinin_verify_pass($joinin_detail)
+    {
         $param = array();
         $param['joinin_state'] = input('post.verify_type') === 'pass' ? STORE_JOIN_STATE_VERIFY_SUCCESS : STORE_JOIN_STATE_VERIFY_FAIL;
         $param['joinin_message'] = input('post.joinin_message');
@@ -688,7 +709,8 @@ class Store extends AdminControl {
         }
     }
 
-    private function store_joinin_verify_open($joinin_detail) {
+    private function store_joinin_verify_open($joinin_detail)
+    {
         $storejoinin_model = model('storejoinin');
         $store_model = model('store');
 
@@ -699,9 +721,9 @@ class Store extends AdminControl {
 
         if (input('post.verify_type') === 'pass') {
             Db::startTrans();
-            try{
-                $store_model->setStoreOpen($joinin_detail,$param);
-            }catch(\Exception $e) {
+            try {
+                $store_model->setStoreOpen($joinin_detail, $param);
+            } catch (\Exception $e) {
                 Db::rollback();
                 $this->error($e->getMessage());
             }
@@ -709,41 +731,42 @@ class Store extends AdminControl {
             dsLayerOpenSuccess(lang('ds_common_op_succ'));
         } else {
             Db::startTrans();
-            try{
+            try {
                 $predeposit_model = model('predeposit');
-                if($joinin_detail['rcb_amount']>0){
-                            $data_pd = array();
-                            $data_pd['member_id'] = $joinin_detail['member_id'];
-                            $data_pd['member_name'] = $joinin_detail['member_name'];
-                            $data_pd['amount'] = $joinin_detail['rcb_amount'];
-                            $data_pd['order_sn'] = $joinin_detail['pay_sn'];
-                            $predeposit_model->changeRcb('storejoinin_cancel', $data_pd);
+                if ($joinin_detail['rcb_amount'] > 0) {
+                    $data_pd = array();
+                    $data_pd['member_id'] = $joinin_detail['member_id'];
+                    $data_pd['member_name'] = $joinin_detail['member_name'];
+                    $data_pd['amount'] = $joinin_detail['rcb_amount'];
+                    $data_pd['order_sn'] = $joinin_detail['pay_sn'];
+                    $predeposit_model->changeRcb('storejoinin_cancel', $data_pd);
                 }
-                if($joinin_detail['pd_amount']>0){
-                            $data_pd = array();
-                            $data_pd['member_id'] = $joinin_detail['member_id'];
-                            $data_pd['member_name'] = $joinin_detail['member_name'];
-                            $data_pd['amount'] = $joinin_detail['pd_amount'];
-                            $data_pd['order_sn'] = $joinin_detail['pay_sn'];
-                            $predeposit_model->changePd('storejoinin_cancel', $data_pd);
+                if ($joinin_detail['pd_amount'] > 0) {
+                    $data_pd = array();
+                    $data_pd['member_id'] = $joinin_detail['member_id'];
+                    $data_pd['member_name'] = $joinin_detail['member_name'];
+                    $data_pd['amount'] = $joinin_detail['pd_amount'];
+                    $data_pd['order_sn'] = $joinin_detail['pay_sn'];
+                    $predeposit_model->changePd('storejoinin_cancel', $data_pd);
                 }
-            //改变店铺状态
-            $storejoinin_model->editStorejoinin($param, array('member_id' => input('param.member_id')));
-            }catch(\Exception $e) {
-                    Db::rollback();
-                    $this->error($e->getMessage());
+                //改变店铺状态
+                $storejoinin_model->editStorejoinin($param, array('member_id' => input('param.member_id')));
+            } catch (\Exception $e) {
+                Db::rollback();
+                $this->error($e->getMessage());
             }
             Db::commit();
 
             dsLayerOpenSuccess(lang('ds_common_op_succ'));
-//            $this->error(lang('store_open_reject'));
+            //            $this->error(lang('store_open_reject'));
         }
     }
 
     /**
      * 提醒续费
      */
-    public function remind_renewal() {
+    public function remind_renewal()
+    {
         $store_id = intval(input('param.store_id'));
         $store_info = model('store')->getStoreInfoByID($store_id);
         if (!empty($store_info) && $store_info['store_endtime'] < (TIMESTAMP + 864000) && cookie('remindRenewal' . $store_id) == null) {
@@ -767,7 +790,7 @@ class Store extends AdminControl {
                     )
                 ),
             );
-            model('cron')->addCron(array('cron_exetime'=>TIMESTAMP,'cron_type'=>'sendStoremsg','cron_value'=>serialize($param)));
+            model('cron')->addCron(array('cron_exetime' => TIMESTAMP, 'cron_type' => 'sendStoremsg', 'cron_value' => serialize($param)));
 
             cookie('remindRenewal' . $store_id, 1, 86400 * 10);  // 十天
             $this->success(lang('ds_common_op_succ'));
@@ -809,7 +832,8 @@ class Store extends AdminControl {
      */
 
     //删除店铺操作 
-    public function del_join() {
+    public function del_join()
+    {
         $member_id = (int) input('param.member_id');
         $store_joinin = model('storejoinin');
         $condition = array(
@@ -820,7 +844,6 @@ class Store extends AdminControl {
             $this->error(lang('ds_common_op_fail'), get_referer());
         }
         if ($mm['joinin_state'] == '20') {
-            
         }
         $store_name = $mm['store_name'];
         $store_model = model('store');
@@ -829,29 +852,29 @@ class Store extends AdminControl {
             $this->error(lang('store_exist'), get_referer());
         }
         Db::startTrans();
-        try{
+        try {
             $predeposit_model = model('predeposit');
-            if($mm['rcb_amount']>0){
-                        $data_pd = array();
-                        $data_pd['member_id'] = $mm['member_id'];
-                        $data_pd['member_name'] = $mm['member_name'];
-                        $data_pd['amount'] = $mm['rcb_amount'];
-                        $data_pd['order_sn'] = $mm['pay_sn'];
-                        $predeposit_model->changeRcb('storejoinin_cancel', $data_pd);
+            if ($mm['rcb_amount'] > 0) {
+                $data_pd = array();
+                $data_pd['member_id'] = $mm['member_id'];
+                $data_pd['member_name'] = $mm['member_name'];
+                $data_pd['amount'] = $mm['rcb_amount'];
+                $data_pd['order_sn'] = $mm['pay_sn'];
+                $predeposit_model->changeRcb('storejoinin_cancel', $data_pd);
             }
-            if($mm['pd_amount']>0){
-                        $data_pd = array();
-                        $data_pd['member_id'] = $mm['member_id'];
-                        $data_pd['member_name'] = $mm['member_name'];
-                        $data_pd['amount'] = $mm['pd_amount'];
-                        $data_pd['order_sn'] = $mm['pay_sn'];
-                        $predeposit_model->changePd('storejoinin_cancel', $data_pd);
+            if ($mm['pd_amount'] > 0) {
+                $data_pd = array();
+                $data_pd['member_id'] = $mm['member_id'];
+                $data_pd['member_name'] = $mm['member_name'];
+                $data_pd['amount'] = $mm['pd_amount'];
+                $data_pd['order_sn'] = $mm['pay_sn'];
+                $predeposit_model->changePd('storejoinin_cancel', $data_pd);
             }
-        // 完全删除店铺入驻
-        $store_joinin->delStorejoinin($condition);
-        }catch(\Exception $e) {
-                Db::rollback();
-                $this->error($e->getMessage());
+            // 完全删除店铺入驻
+            $store_joinin->delStorejoinin($condition);
+        } catch (\Exception $e) {
+            Db::rollback();
+            $this->error($e->getMessage());
         }
         Db::commit();
 
@@ -859,7 +882,8 @@ class Store extends AdminControl {
         ds_json_encode('10000', lang('ds_common_del_succ'));
     }
 
-    public function newshop_add() {
+    public function newshop_add()
+    {
         if (!request()->isPost()) {
             return View::fetch('store_newshop_add');
         } else {
@@ -943,15 +967,17 @@ class Store extends AdminControl {
         }
     }
 
-    public function check_seller_name() {
+    public function check_seller_name()
+    {
         echo json_encode($this->checkSellerName(input('param.seller_name')));
         exit;
     }
 
-    private function checkSellerName($sellerName) {
+    private function checkSellerName($sellerName)
+    {
         // 判断store_joinin是否存在记录
         $count = (int) model('storejoinin')->getStorejoininCount(array(
-                    'seller_name' => $sellerName,
+            'seller_name' => $sellerName,
         ));
         if ($count > 0)
             return false;
@@ -965,28 +991,31 @@ class Store extends AdminControl {
         return TRUE;
     }
 
-    public function check_member_name() {
+    public function check_member_name()
+    {
         echo json_encode($this->checkMemberName(input('param.member_name')));
         exit;
     }
 
-    private function checkMemberName($member_name) {
+    private function checkMemberName($member_name)
+    {
         // 判断store_joinin是否存在记录
         $count = (int) model('storejoinin')->getStorejoininCount(array(
-                    'member_name' => $member_name,
+            'member_name' => $member_name,
         ));
         if ($count > 0)
             return false;
 
         return !model('member')->getMemberCount(array(
-                    'member_name' => $member_name,
+            'member_name' => $member_name,
         ));
     }
 
     /**
      * 验证店铺名称是否存在
      */
-    public function ckeck_store_name() {
+    public function ckeck_store_name()
+    {
         $where = array();
         $where[] = array('store_name', '=', input('param.store_name'));
         $where[] = array('store_id', '<>', input('param.store_id'));
@@ -1001,7 +1030,8 @@ class Store extends AdminControl {
     /**
      * 验证店铺名称是否存在
      */
-    private function ckeckStoreName($store_name) {
+    private function ckeckStoreName($store_name)
+    {
         $condition = array();
         $condition[] = array('store_name', '=', $store_name);
         $store_info = model('store')->getStoreInfo($condition);
@@ -1013,10 +1043,11 @@ class Store extends AdminControl {
     }
 
     //ajax操作
-    public function ajax() {
+    public function ajax()
+    {
         $store_model = model('store');
         switch (input('param.branch')) {
-            /**
+                /**
              * 品牌名称
              */
             case 'store_sort':
@@ -1034,7 +1065,8 @@ class Store extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'store',
@@ -1065,7 +1097,4 @@ class Store extends AdminControl {
         }
         return $menu_array;
     }
-
 }
-
-?>

+ 35 - 30
app/admin/controller/Storeclass.php

@@ -5,31 +5,34 @@
  */
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Storeclass extends AdminControl {
+class Storeclass extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/storeclass.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/storeclass.lang.php');
     }
 
     /**
      * 店铺分类
      */
-    public function store_class() {
+    public function store_class()
+    {
         $storeclass_model = model('storeclass');
 
         $store_class_list = $storeclass_model->getStoreclassList(array(), 20);
@@ -42,7 +45,8 @@ class Storeclass extends AdminControl {
     /**
      * 商品分类添加
      */
-    public function store_class_add() {
+    public function store_class_add()
+    {
         $storeclass_model = model('storeclass');
 
         if (!request()->isPost()) {
@@ -55,7 +59,7 @@ class Storeclass extends AdminControl {
             $insert_array['storeclass_sort'] = intval(input('post.storeclass_sort'));
 
             $storeclass_validate = ds_validate('storeclass');
-            if (!$storeclass_validate->scene('store_class_add')->check($insert_array)){
+            if (!$storeclass_validate->scene('store_class_add')->check($insert_array)) {
                 $this->error($storeclass_validate->getError());
             }
 
@@ -63,7 +67,7 @@ class Storeclass extends AdminControl {
             $result = $storeclass_model->addStoreclass($insert_array);
             if ($result) {
                 $this->log(lang('ds_add') . lang('store_class') . '[' . input('post.storeclass_name') . ']', 1);
-                dsLayerOpenSuccess(lang('ds_common_save_succ'),(string)url('Storeclass/store_class'));
+                dsLayerOpenSuccess(lang('ds_common_save_succ'), (string)url('Storeclass/store_class'));
             } else {
                 $this->error(lang('ds_common_save_fail'));
             }
@@ -73,7 +77,8 @@ class Storeclass extends AdminControl {
     /**
      * 编辑
      */
-    public function store_class_edit() {
+    public function store_class_edit()
+    {
         $storeclass_model = model('storeclass');
 
         if (!request()->isPost()) {
@@ -92,14 +97,14 @@ class Storeclass extends AdminControl {
             $update_array['storeclass_sort'] = intval(input('post.storeclass_sort'));
 
             $storeclass_validate = ds_validate('storeclass');
-            if (!$storeclass_validate->scene('store_class_edit')->check($update_array)){
+            if (!$storeclass_validate->scene('store_class_edit')->check($update_array)) {
                 $this->error($storeclass_validate->getError());
             }
 
             $result = $storeclass_model->editStoreclass($update_array, array('storeclass_id' => intval(input('param.storeclass_id'))));
-            if ($result>=0) {
+            if ($result >= 0) {
                 $this->log(lang('ds_edit') . lang('store_class') . '[' . input('post.storeclass_name') . ']', 1);
-                dsLayerOpenSuccess(lang('ds_common_save_succ'),(string)url('Storeclass/store_class'));
+                dsLayerOpenSuccess(lang('ds_common_save_succ'), (string)url('Storeclass/store_class'));
             } else {
                 $this->error(lang('ds_common_save_fail'));
             }
@@ -109,7 +114,8 @@ class Storeclass extends AdminControl {
     /**
      * 删除分类
      */
-    public function store_class_del() {
+    public function store_class_del()
+    {
         $storeclass_model = model('storeclass');
         $storeclass_id = input('param.storeclass_id');
         $storeclass_id_array = ds_delete_param($storeclass_id);
@@ -117,7 +123,7 @@ class Storeclass extends AdminControl {
             ds_json_encode('10001', lang('param_error'));
         }
         $condition = array();
-        $condition[]=array('storeclass_id','in', $storeclass_id_array);
+        $condition[] = array('storeclass_id', 'in', $storeclass_id_array);
 
         $result = $storeclass_model->delStoreclass($condition);
         if ($result) {
@@ -129,16 +135,17 @@ class Storeclass extends AdminControl {
     /**
      * ajax操作
      */
-    public function ajax() {
+    public function ajax()
+    {
         $storeclass_model = model('storeclass');
         $update_array = array();
         $branch = input('param.branch');
         switch ($branch) {
-            //分类:验证是否有重复的名称
+                //分类:验证是否有重复的名称
             case 'store_class_name':
                 $condition = array();
-                $condition[]=array('storeclass_name','=',input('get.value'));
-                $condition[]=array('storeclass_id','<>', intval(input('param.id')));
+                $condition[] = array('storeclass_name', '=', input('get.value'));
+                $condition[] = array('storeclass_id', '<>', intval(input('param.id')));
                 $class_list = $storeclass_model->getStoreclassList($condition);
                 if (empty($class_list)) {
                     $update_array['storeclass_name'] = input('get.value');
@@ -148,15 +155,15 @@ class Storeclass extends AdminControl {
                     $return = 'false';
                 }
                 break;
-            //分类: 排序 显示 设置
+                //分类: 排序 显示 设置
             case 'store_class_sort':
                 $update_array['storeclass_sort'] = intval(input('get.value'));
                 $result = $storeclass_model->editStoreclass($update_array, array('storeclass_id' => intval(input('param.id'))));
                 $return = 'true';
                 break;
-            //分类:添加、修改操作中 检测类别名称是否有重复
+                //分类:添加、修改操作中 检测类别名称是否有重复
             case 'check_class_name':
-                $condition[]=array('storeclass_name','=',input('get.storeclass_name'));
+                $condition[] = array('storeclass_name', '=', input('get.storeclass_name'));
                 $class_list = $storeclass_model->getStoreclassList($condition);
                 $return = empty($class_list) ? 'true' : 'false';
                 break;
@@ -167,7 +174,8 @@ class Storeclass extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'store_class',
@@ -177,12 +185,9 @@ class Storeclass extends AdminControl {
             array(
                 'name' => 'store_class_add',
                 'text' => lang('ds_new'),
-                'url' => "javascript:dsLayerOpen('".(string)url('Storeclass/store_class_add')."','".lang('ds_new')."')"
+                'url' => "javascript:dsLayerOpen('" . (string)url('Storeclass/store_class_add') . "','" . lang('ds_new') . "')"
             )
         );
         return $menu_array;
     }
-
 }
-
-?>

+ 105 - 97
app/admin/controller/Storedeposit.php

@@ -1,27 +1,30 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 use think\facade\Db;
 use app\common\model\Storedepositlog;
 use app\common\model\Storemoneylog;
+
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Storedeposit extends AdminControl {
+class Storedeposit extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/storedeposit.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/storedeposit.lang.php');
     }
 
 
@@ -29,31 +32,32 @@ class Storedeposit extends AdminControl {
      * 资金明细
      */
 
-    public function index() {
+    public function index()
+    {
         $condition = array();
         $stime = input('get.stime');
         $etime = input('get.etime');
         $if_start_date = preg_match('/^20\d{2}-\d{2}-\d{2}$/', $stime);
         $if_end_date = preg_match('/^20\d{2}-\d{2}-\d{2}$/', $etime);
         $start_unixtime = $if_start_date ? strtotime($stime) : null;
-        $end_unixtime = $if_end_date ? (strtotime($etime)+86399) : null;
+        $end_unixtime = $if_end_date ? (strtotime($etime) + 86399) : null;
         if ($start_unixtime) {
-            $condition[] = array('storedepositlog_add_time','>=', $start_unixtime);
+            $condition[] = array('storedepositlog_add_time', '>=', $start_unixtime);
         }
         if ($end_unixtime) {
-            $condition[] = array('storedepositlog_add_time','<=', $end_unixtime);
+            $condition[] = array('storedepositlog_add_time', '<=', $end_unixtime);
         }
         $mname = input('get.mname');
         if (!empty($mname)) {
-            $condition[]=array('store_name','like','%'.$mname.'%');
+            $condition[] = array('store_name', 'like', '%' . $mname . '%');
         }
         $storedepositlog_model = model('storedepositlog');
         $list_log = $storedepositlog_model->getStoredepositlogList($condition, 10, '*', 'storedepositlog_id desc');
         View::assign('show_page', $storedepositlog_model->page_info->render());
         View::assign('list_log', $list_log);
-        
+
         View::assign('filtered', $condition ? 1 : 0); //是否有查询条件
-        
+
         $this->setAdminCurItem('index');
         return View::fetch();
     }
@@ -61,20 +65,21 @@ class Storedeposit extends AdminControl {
     /*
      * 提现列表
      */
-    public function withdraw_list() {
-        $condition = array(array('storedepositlog_type','in',[Storedepositlog::TYPE_WITHDRAW,Storedepositlog::TYPE_RECHARGE]),);
+    public function withdraw_list()
+    {
+        $condition = array(array('storedepositlog_type', 'in', [Storedepositlog::TYPE_WITHDRAW, Storedepositlog::TYPE_RECHARGE]),);
         $paystate_search = input('param.paystate_search');
         if (isset($paystate_search) && $paystate_search !== '') {
-            $condition[] = array('storedepositlog_state','=',intval($paystate_search));
+            $condition[] = array('storedepositlog_state', '=', intval($paystate_search));
         }
 
         $storedepositlog_model = model('storedepositlog');
         $withdraw_list = $storedepositlog_model->getStoredepositlogList($condition, 10, '*', 'storedepositlog_id desc');
         View::assign('show_page', $storedepositlog_model->page_info->render());
         View::assign('withdraw_list', $withdraw_list);
-        
+
         View::assign('filtered', input('get.') ? 1 : 0); //是否有查询条件
-        
+
         $this->setAdminCurItem('withdraw_list');
         return View::fetch();
     }
@@ -84,60 +89,61 @@ class Storedeposit extends AdminControl {
     /**
      * 查看提现信息
      */
-    public function withdraw_view() {
+    public function withdraw_view()
+    {
         $id = intval(input('param.id'));
         if ($id <= 0) {
             $this->error(lang('param_error'));
         }
         $storedepositlog_model = model('storedepositlog');
         $condition = array();
-        $condition[] = array('storedepositlog_id','=',$id);
+        $condition[] = array('storedepositlog_id', '=', $id);
         $info = $storedepositlog_model->getStoredepositlogInfo($condition);
         if (!is_array($info) || count($info) < 0) {
             $this->error(lang('admin_storedeposit_record_error'));
         }
-        if(!request()->isPost()){
+        if (!request()->isPost()) {
             View::assign('info', $info);
             return View::fetch();
-        }else{
-            if(!input('param.verify_reason')){
-                $this->error(lang('ds_none_input').lang('admin_storedeposit_remark'));
+        } else {
+            if (!input('param.verify_reason')) {
+                $this->error(lang('ds_none_input') . lang('admin_storedeposit_remark'));
             }
-            $data=array(
-                'store_id'=>$info['store_id'],
-                'store_name'=>$info['store_name'],
-                'storedepositlog_type'=>Storedepositlog::TYPE_VERIFY,
-                'storedepositlog_state'=>Storedepositlog::STATE_VALID,
-                'storedepositlog_add_time'=>TIMESTAMP,
+            $data = array(
+                'store_id' => $info['store_id'],
+                'store_name' => $info['store_name'],
+                'storedepositlog_type' => Storedepositlog::TYPE_VERIFY,
+                'storedepositlog_state' => Storedepositlog::STATE_VALID,
+                'storedepositlog_add_time' => TIMESTAMP,
             );
-            if(input('param.verify_state')==1){//通过
-                    $data['store_freeze_deposit']=-$info['store_freeze_deposit'];
-                    $storedepositlog_state=Storedepositlog::STATE_AGREE;
-            }else{
-                $data['store_avaliable_deposit']=$info['store_freeze_deposit'];
-                    $data['store_freeze_deposit']=-$info['store_freeze_deposit'];
-                    $storedepositlog_state=Storedepositlog::STATE_REJECT;
+            if (input('param.verify_state') == 1) { //通过
+                $data['store_freeze_deposit'] = -$info['store_freeze_deposit'];
+                $storedepositlog_state = Storedepositlog::STATE_AGREE;
+            } else {
+                $data['store_avaliable_deposit'] = $info['store_freeze_deposit'];
+                $data['store_freeze_deposit'] = -$info['store_freeze_deposit'];
+                $storedepositlog_state = Storedepositlog::STATE_REJECT;
             }
             $admininfo = $this->getAdminInfo();
-            $data['storedepositlog_desc']=lang('order_admin_operator')."【" . $admininfo['admin_name'] . "】".((input('param.verify_state')==1)?lang('ds_pass'):lang('ds_refuse')).lang('ds_seller_name')."【" . $info['store_name'] . "】".lang('admin_storedeposit_log_stage_cash').':'.input('param.verify_reason');
+            $data['storedepositlog_desc'] = lang('order_admin_operator') . "【" . $admininfo['admin_name'] . "】" . ((input('param.verify_state') == 1) ? lang('ds_pass') : lang('ds_refuse')) . lang('ds_seller_name') . "【" . $info['store_name'] . "】" . lang('admin_storedeposit_log_stage_cash') . ':' . input('param.verify_reason');
             try {
                 Db::startTrans();
                 $storedepositlog_model->changeStoredeposit($data);
                 //修提现状态
-                if(!$storedepositlog_model->editStoredepositlog(array('storedepositlog_id'=>$id,'storedepositlog_state'=>Storedepositlog::STATE_WAIT),array('storedepositlog_state'=>$storedepositlog_state))){
+                if (!$storedepositlog_model->editStoredepositlog(array('storedepositlog_id' => $id, 'storedepositlog_state' => Storedepositlog::STATE_WAIT), array('storedepositlog_state' => $storedepositlog_state))) {
                     throw new \think\Exception(lang('admin_storedeposit_cash_edit_fail'), 10006);
                 }
                 //如果是通过取出保证金,则将保证金转换为店铺可用资金
-                if(input('param.verify_state')==1){
+                if (input('param.verify_state') == 1) {
                     $storemoneylog_model = model('storemoneylog');
-                    $data2=array(
-                        'store_id'=>$info['store_id'],
-                        'store_name'=>$info['store_name'],
-                        'storemoneylog_type'=>Storemoneylog::TYPE_DEPOSIT_OUT,
-                        'storemoneylog_state'=>Storemoneylog::STATE_VALID,
-                        'storemoneylog_add_time'=>TIMESTAMP,
-                        'store_avaliable_money'=>$info['store_freeze_deposit'],
-                        'storemoneylog_desc'=>$data['storedepositlog_desc'],
+                    $data2 = array(
+                        'store_id' => $info['store_id'],
+                        'store_name' => $info['store_name'],
+                        'storemoneylog_type' => Storemoneylog::TYPE_DEPOSIT_OUT,
+                        'storemoneylog_state' => Storemoneylog::STATE_VALID,
+                        'storemoneylog_add_time' => TIMESTAMP,
+                        'store_avaliable_money' => $info['store_freeze_deposit'],
+                        'storemoneylog_desc' => $data['storedepositlog_desc'],
                     );
                     $storemoneylog_model->changeStoremoney($data2);
                 }
@@ -152,50 +158,51 @@ class Storedeposit extends AdminControl {
             dsLayerOpenSuccess(lang('ds_common_op_succ'));
         }
     }
-    
-    
-    public function recharge_view() {
+
+
+    public function recharge_view()
+    {
         $id = intval(input('param.id'));
         if ($id <= 0) {
             $this->error(lang('param_error'));
         }
         $storedepositlog_model = model('storedepositlog');
         $condition = array();
-        $condition[] = array('storedepositlog_id','=',$id);
+        $condition[] = array('storedepositlog_id', '=', $id);
         $info = $storedepositlog_model->getStoredepositlogInfo($condition);
         if (!is_array($info) || count($info) < 0) {
             $this->error(lang('admin_storedeposit_record_error'));
         }
-        if(!request()->isPost()){
+        if (!request()->isPost()) {
             View::assign('info', $info);
             return View::fetch();
-        }else{
-            if(!input('param.verify_reason')){
-                $this->error(lang('ds_none_input').lang('admin_storedeposit_remark'));
+        } else {
+            if (!input('param.verify_reason')) {
+                $this->error(lang('ds_none_input') . lang('admin_storedeposit_remark'));
             }
-            $data=array(
-                'store_id'=>$info['store_id'],
-                'store_name'=>$info['store_name'],
-                'storedepositlog_type'=>Storedepositlog::TYPE_VIEW,
-                'storedepositlog_state'=>Storedepositlog::STATE_VALID,
-                'storedepositlog_add_time'=>TIMESTAMP,
+            $data = array(
+                'store_id' => $info['store_id'],
+                'store_name' => $info['store_name'],
+                'storedepositlog_type' => Storedepositlog::TYPE_VIEW,
+                'storedepositlog_state' => Storedepositlog::STATE_VALID,
+                'storedepositlog_add_time' => TIMESTAMP,
             );
-            if(input('param.verify_state')==1){//通过
-                $data['store_avaliable_deposit']=$info['store_payable_deposit'];
-                    $data['store_payable_deposit']=-$info['store_payable_deposit'];
-                    $storedepositlog_state=Storedepositlog::STATE_PAYED;
-            }else{
-                    $data['store_payable_deposit']=-$info['store_payable_deposit'];
-                    $storedepositlog_state=Storedepositlog::STATE_CANCEL;
+            if (input('param.verify_state') == 1) { //通过
+                $data['store_avaliable_deposit'] = $info['store_payable_deposit'];
+                $data['store_payable_deposit'] = -$info['store_payable_deposit'];
+                $storedepositlog_state = Storedepositlog::STATE_PAYED;
+            } else {
+                $data['store_payable_deposit'] = -$info['store_payable_deposit'];
+                $storedepositlog_state = Storedepositlog::STATE_CANCEL;
             }
             $admininfo = $this->getAdminInfo();
-            $data['storedepositlog_desc']=lang('order_admin_operator')."【" . $admininfo['admin_name'] . "】".lang('ds_update').lang('ds_seller_name')."【" . $info['store_name'] . "】".lang('admin_storedeposit_pay_state').((input('param.verify_state')==1)?lang('admin_storedeposit_payed'):lang('admin_storedeposit_cancel')).':'.input('param.verify_reason');
+            $data['storedepositlog_desc'] = lang('order_admin_operator') . "【" . $admininfo['admin_name'] . "】" . lang('ds_update') . lang('ds_seller_name') . "【" . $info['store_name'] . "】" . lang('admin_storedeposit_pay_state') . ((input('param.verify_state') == 1) ? lang('admin_storedeposit_payed') : lang('admin_storedeposit_cancel')) . ':' . input('param.verify_reason');
             try {
                 Db::startTrans();
                 $storedepositlog_model->changeStoredeposit($data);
                 //修提现状态
-                if(!$storedepositlog_model->editStoredepositlog(array('storedepositlog_id'=>$id,'storedepositlog_state'=>Storedepositlog::STATE_PAYING),array('storedepositlog_state'=>$storedepositlog_state))){
-                    throw new \think\Exception(lang('admin_storedeposit_pay_state').lang('ds_update').lang('ds_fail'), 10006);
+                if (!$storedepositlog_model->editStoredepositlog(array('storedepositlog_id' => $id, 'storedepositlog_state' => Storedepositlog::STATE_PAYING), array('storedepositlog_state' => $storedepositlog_state))) {
+                    throw new \think\Exception(lang('admin_storedeposit_pay_state') . lang('ds_update') . lang('ds_fail'), 10006);
                 }
 
                 Db::commit();
@@ -214,15 +221,16 @@ class Storedeposit extends AdminControl {
      * 调节资金
      */
 
-    public function adjust() {
+    public function adjust()
+    {
         if (!(request()->isPost())) {
             $store_id = intval(input('get.store_id'));
-            if($store_id>0){
+            if ($store_id > 0) {
                 $condition = array();
-                $condition[] = array('store_id','=',$store_id);
+                $condition[] = array('store_id', '=', $store_id);
                 $store = model('store')->getStoreInfo($condition);
-                if(!empty($store)){
-                    View::assign('store_info',$store);
+                if (!empty($store)) {
+                    View::assign('store_info', $store);
                 }
             }
             return View::fetch();
@@ -234,7 +242,7 @@ class Storedeposit extends AdminControl {
                 'lg_desc' => input('post.lg_desc'),
             );
             $storedeposit_validate = ds_validate('storedeposit');
-            if (!$storedeposit_validate->scene('adjust')->check($data)){
+            if (!$storedeposit_validate->scene('adjust')->check($data)) {
                 $this->error($storedeposit_validate->getError());
             }
 
@@ -261,27 +269,27 @@ class Storedeposit extends AdminControl {
             $storedepositlog_model = model('storedepositlog');
             #生成对应订单号
             $admininfo = $this->getAdminInfo();
-            $data=array(
-                'store_id'=>$store_info['store_id'],
-                'store_name'=>$store_info['store_name'],
-                'storedepositlog_type'=>Storedepositlog::TYPE_ADMIN,
-                'storedepositlog_state'=>Storedepositlog::STATE_VALID,
-                'storedepositlog_add_time'=>TIMESTAMP,
+            $data = array(
+                'store_id' => $store_info['store_id'],
+                'store_name' => $store_info['store_name'],
+                'storedepositlog_type' => Storedepositlog::TYPE_ADMIN,
+                'storedepositlog_state' => Storedepositlog::STATE_VALID,
+                'storedepositlog_add_time' => TIMESTAMP,
             );
             switch ($operatetype) {
                 case 1:
-                    $data['store_avaliable_deposit']=$money;
-                    $log_msg = lang('order_admin_operator')."【" . $admininfo['admin_name'] . "】".lang('ds_handle').lang('ds_seller_name')."【" . $store_info['store_name'] . "】".lang('ds_store_deposit')."【".lang('admin_storedeposit_artificial_operatetype_add')."】,".lang('admin_storedeposit_price') . $money;
+                    $data['store_avaliable_deposit'] = $money;
+                    $log_msg = lang('order_admin_operator') . "【" . $admininfo['admin_name'] . "】" . lang('ds_handle') . lang('ds_seller_name') . "【" . $store_info['store_name'] . "】" . lang('ds_store_deposit') . "【" . lang('admin_storedeposit_artificial_operatetype_add') . "】," . lang('admin_storedeposit_price') . $money;
                     break;
                 case 2:
-                    $data['store_avaliable_deposit']=-$money;
-                    $log_msg = lang('order_admin_operator')."【" . $admininfo['admin_name'] . "】".lang('ds_handle').lang('ds_seller_name')."【" . $store_info['store_name'] . "】".lang('ds_store_deposit')."【".lang('admin_storedeposit_artificial_operatetype_reduce')."】,".lang('admin_storedeposit_price') . $money;
+                    $data['store_avaliable_deposit'] = -$money;
+                    $log_msg = lang('order_admin_operator') . "【" . $admininfo['admin_name'] . "】" . lang('ds_handle') . lang('ds_seller_name') . "【" . $store_info['store_name'] . "】" . lang('ds_store_deposit') . "【" . lang('admin_storedeposit_artificial_operatetype_reduce') . "】," . lang('admin_storedeposit_price') . $money;
                     break;
                 default:
                     $this->error(lang('ds_common_op_fail'), 'Storedeposit/index');
                     break;
             }
-            $data['storedepositlog_desc']=$log_msg;
+            $data['storedepositlog_desc'] = $log_msg;
             try {
                 Db::startTrans();
                 $storedepositlog_model->changeStoredeposit($data);
@@ -297,7 +305,8 @@ class Storedeposit extends AdminControl {
     }
 
     //取得店主信息
-    public function checkseller() {
+    public function checkseller()
+    {
         $name = input('post.name');
         if (!$name) {
             exit(json_encode(array('id' => 0)));
@@ -311,11 +320,12 @@ class Storedeposit extends AdminControl {
             exit(json_encode(array('id' => 0)));
         }
     }
-    
+
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -330,11 +340,9 @@ class Storedeposit extends AdminControl {
             array(
                 'name' => 'adjust',
                 'text' => lang('admin_storedeposit_adjust'),
-                'url' => "javascript:dsLayerOpen('".(string)url('Storedeposit/adjust')."','".lang('admin_storedeposit_adjust')."')"
+                'url' => "javascript:dsLayerOpen('" . (string)url('Storedeposit/adjust') . "','" . lang('admin_storedeposit_adjust') . "')"
             ),
         );
         return $menu_array;
     }
 }
-
-?>

+ 39 - 32
app/admin/controller/Storegrade.php

@@ -1,30 +1,33 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Storegrade extends AdminControl {
+class Storegrade extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/storegrade.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/storegrade.lang.php');
     }
 
-    public function index() {
+    public function index()
+    {
         $like_storegrade_name = trim(input('param.like_storegrade_name'));
-        $condition[]=array('storegrade_name','like', "%" . $like_storegrade_name . "%");
+        $condition[] = array('storegrade_name', 'like', "%" . $like_storegrade_name . "%");
         $storegrade_list = model('storegrade')->getStoregradeList($condition);
         // 获取分页显示
         View::assign('storegrade_list', $storegrade_list);
@@ -33,7 +36,8 @@ class Storegrade extends AdminControl {
         return View::fetch();
     }
 
-    public function add() {
+    public function add()
+    {
         if (!request()->isPost()) {
             return View::fetch('form');
         } else {
@@ -48,7 +52,7 @@ class Storegrade extends AdminControl {
             );
 
             $storegrade_validate = ds_validate('storegrade');
-            if (!$storegrade_validate->scene('add')->check($data)){
+            if (!$storegrade_validate->scene('add')->check($data)) {
                 $this->error($storegrade_validate->getError());
             }
 
@@ -62,14 +66,15 @@ class Storegrade extends AdminControl {
             }
             $result = model('storegrade')->addStoregrade($data);
             if ($result) {
-                dsLayerOpenSuccess(lang('ds_common_op_succ'),(string)url('Storegrade/index'));
+                dsLayerOpenSuccess(lang('ds_common_op_succ'), (string)url('Storegrade/index'));
             } else {
                 $this->error(lang('ds_common_op_fail'));
             }
         }
     }
 
-    public function edit() {
+    public function edit()
+    {
         //注:pathinfo地址参数不能通过get方法获取,查看“获取PARAM变量”
         $storegrade_id = input('param.storegrade_id');
         if (empty($storegrade_id)) {
@@ -91,7 +96,7 @@ class Storegrade extends AdminControl {
                 'storegrade_sort' => input('post.storegrade_sort'),
             );
             $storegrade_validate = ds_validate('storegrade');
-            if (!$storegrade_validate->scene('edit')->check($data)){
+            if (!$storegrade_validate->scene('edit')->check($data)) {
                 $this->error($storegrade_validate->getError());
             }
             //验证等级名称
@@ -102,19 +107,20 @@ class Storegrade extends AdminControl {
             if (!$this->checkGradeSort(array('storegrade_sort' => trim(input('post.storegrade_sort')), 'storegrade_id' => intval(input('param.storegrade_id'))))) {
                 $this->error(lang('add_gradesortexist'));
             }
-            $result = model('storegrade')->editStoregrade($storegrade_id,$data);
-            if ($result>=0) {
-                dsLayerOpenSuccess(lang('ds_common_op_succ'),(string)url('Storegrade/index'));
+            $result = model('storegrade')->editStoregrade($storegrade_id, $data);
+            if ($result >= 0) {
+                dsLayerOpenSuccess(lang('ds_common_op_succ'), (string)url('Storegrade/index'));
             } else {
                 $this->error(lang('ds_common_op_fail'));
             }
         }
     }
 
-    public function drop() {
+    public function drop()
+    {
         //注:pathinfo地址参数不能通过get方法获取,查看“获取PARAM变量”
         $storegrade_id = intval(input('param.storegrade_id'));
-        if ($storegrade_id<=0) {
+        if ($storegrade_id <= 0) {
             ds_json_encode(10001, lang('param_error'));
         }
         if ($storegrade_id == '1') {
@@ -135,13 +141,14 @@ class Storegrade extends AdminControl {
     /**
      * 查询店铺等级名称是否存在
      */
-    private function checkGradeName($param) {
+    private function checkGradeName($param)
+    {
         $storegrade_model = model('storegrade');
-        $condition[]=array('storegrade_name','=',$param['storegrade_name']);
+        $condition[] = array('storegrade_name', '=', $param['storegrade_name']);
 
         if (isset($param['storegrade_id'])) {
             $storegrade_id = intval($param['storegrade_id']);
-            $condition[]=array('storegrade_id','<>', $storegrade_id);
+            $condition[] = array('storegrade_id', '<>', $storegrade_id);
         }
         $list = $storegrade_model->getStoregradeList($condition);
         if (empty($list)) {
@@ -154,13 +161,14 @@ class Storegrade extends AdminControl {
     /**
      * 查询店铺等级是否存在
      */
-    private function checkGradeSort($param) {
+    private function checkGradeSort($param)
+    {
         $storegrade_model = model('storegrade');
         $condition = array();
-        $condition[]=array('storegrade_sort','=',$param['storegrade_sort']);
+        $condition[] = array('storegrade_sort', '=', $param['storegrade_sort']);
         if (isset($param['storegrade_id'])) {
             $storegrade_id = intval($param['storegrade_id']);
-            $condition[]=array('storegrade_id','<>', $storegrade_id);
+            $condition[] = array('storegrade_id', '<>', $storegrade_id);
         }
         $list = array();
         $list = $storegrade_model->getStoregradeList($condition);
@@ -174,7 +182,8 @@ class Storegrade extends AdminControl {
     /**
      * 判断店铺等级是否能删除
      */
-    public function isable_delStoregrade($storegrade_id) {
+    public function isable_delStoregrade($storegrade_id)
+    {
         //判断该等级下是否存在店铺,存在的话不能删除
         $store_model = model('store');
         $store_list = $store_model->getStoreList(array('grade_id' => $storegrade_id));
@@ -187,7 +196,8 @@ class Storegrade extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -200,12 +210,9 @@ class Storegrade extends AdminControl {
             $menu_array[] = array(
                 'name' => 'add',
                 'text' => lang('ds_new'),
-                'url' => "javascript:dsLayerOpen('".(string)url('Storegrade/add')."','".lang('ds_new')."')"
+                'url' => "javascript:dsLayerOpen('" . (string)url('Storegrade/add') . "','" . lang('ds_new') . "')"
             );
         }
         return $menu_array;
     }
-
 }
-
-?>

+ 34 - 22
app/admin/controller/Storehelp.php

@@ -6,19 +6,20 @@ use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Storehelp extends AdminControl {
+class Storehelp extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize(); // 
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/storehelp.lang.php');
     }
@@ -26,7 +27,8 @@ class Storehelp extends AdminControl {
     /**
      * 帮助列表
      */
-    public function index() {
+    public function index()
+    {
         $help_model = model('help');
         $condition = array();
         $condition[] = array('help_id', '>', '99'); //内容列表不显示系统自动添加的数据
@@ -68,7 +70,8 @@ class Storehelp extends AdminControl {
     /**
      * 帮助类型
      */
-    public function help_type() {
+    public function help_type()
+    {
         $help_model = model('help');
         $condition = array();
 
@@ -83,7 +86,8 @@ class Storehelp extends AdminControl {
      * 新增帮助
      *
      */
-    public function add_help() {
+    public function add_help()
+    {
         $help_model = model('help');
         $help = array(
             'help_title' => '',
@@ -130,7 +134,8 @@ class Storehelp extends AdminControl {
      * 编辑帮助
      *
      */
-    public function edit_help() {
+    public function edit_help()
+    {
         $help_model = model('help');
         $condition = array();
         $help_id = intval(input('param.help_id'));
@@ -171,7 +176,8 @@ class Storehelp extends AdminControl {
      * 删除帮助
      *
      */
-    public function del_help() {
+    public function del_help()
+    {
         $help_model = model('help');
         $condition = array();
         $help_id = intval(input('param.help_id'));
@@ -189,7 +195,8 @@ class Storehelp extends AdminControl {
      * 新增帮助类型
      *
      */
-    public function add_type() {
+    public function add_type()
+    {
         $help_model = model('help');
         if (request()->isPost()) {
             $type_array = array();
@@ -220,7 +227,8 @@ class Storehelp extends AdminControl {
      * 编辑帮助类型
      *
      */
-    public function edit_type() {
+    public function edit_type()
+    {
         $help_model = model('help');
         $condition = array();
         $helptype_id = intval(input('param.helptype_id'));
@@ -249,7 +257,8 @@ class Storehelp extends AdminControl {
      * 删除帮助类型
      *
      */
-    public function del_type() {
+    public function del_type()
+    {
         $helptype_id = intval(input('param.helptype_id'));
         $help_model = model('help');
         $condition = array();
@@ -266,9 +275,10 @@ class Storehelp extends AdminControl {
     /**
      * 上传图片
      */
-    public function upload_pic() {
+    public function upload_pic()
+    {
         $data = array();
-        if (!empty($_FILES['fileupload']['name'])) {//上传图片
+        if (!empty($_FILES['fileupload']['name'])) { //上传图片
             $fprefix = 'admin/storehelp';
             $filename = $file_name = date('YmdHis') . rand(10000, 99999) . '.png';
             $res = ds_upload_pic($fprefix, 'fileupload', $filename);
@@ -290,7 +300,7 @@ class Storehelp extends AdminControl {
             if ($result) {
                 $data['file_id'] = $result;
                 $data['file_name'] = $file_name;
-                $data['file_path'] = ds_get_pic( $fprefix , $file_name);
+                $data['file_path'] = ds_get_pic($fprefix, $file_name);
             }
         }
         echo json_encode($data);
@@ -300,7 +310,8 @@ class Storehelp extends AdminControl {
     /**
      * 删除图片
      */
-    public function del_pic() {
+    public function del_pic()
+    {
         $condition = array();
         $condition[] = array('upload_id', '=', intval(input('param.file_id')));
         $help_model = model('help');
@@ -314,7 +325,8 @@ class Storehelp extends AdminControl {
         }
     }
 
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -344,9 +356,9 @@ class Storehelp extends AdminControl {
             $menu_array[] = array(
                 'name' => 'add_type',
                 'text' => lang('add_type'),
-                'url' => "javascript:dsLayerOpen('" . (string) url('Storehelp/add_type') . "','" . lang('add_type') . "')");
+                'url' => "javascript:dsLayerOpen('" . (string) url('Storehelp/add_type') . "','" . lang('add_type') . "')"
+            );
         }
         return $menu_array;
     }
-
 }

+ 23 - 17
app/admin/controller/Storejoin.php

@@ -6,19 +6,20 @@ use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Storejoin extends AdminControl {
+class Storejoin extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize(); // TODO: Change the autogenerated stub
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/storejoin.lang.php');
     }
@@ -26,7 +27,8 @@ class Storejoin extends AdminControl {
     /**
      * 前台头部图片传
      */
-    public function index() {
+    public function index()
+    {
         $size = 3; //上传显示图片总数
         $i = 1;
         $info['pic'] = array();
@@ -49,7 +51,7 @@ class Storejoin extends AdminControl {
             for ($i; $i <= $size; $i++) {
                 $file = 'pic' . $i;
                 $info['pic'][$i] = $post['show_pic' . $i];
-                if (!empty($_FILES[$file]['name'])) {//上传图片
+                if (!empty($_FILES[$file]['name'])) { //上传图片
                     $filename_tmparr = explode('.', $_FILES[$file]['name']);
                     $ext = end($filename_tmparr);
                     $file_name = 'store_joinin_' . $i . '.' . $ext;
@@ -82,7 +84,8 @@ class Storejoin extends AdminControl {
      * 入驻指南
      *
      */
-    public function help_list() {
+    public function help_list()
+    {
         $help_model = model('help');
         $condition = array();
         $condition[] = array('helptype_id', '=', '1');
@@ -96,7 +99,8 @@ class Storejoin extends AdminControl {
      * 编辑入驻指南
      *
      */
-    public function edit_help() {
+    public function edit_help()
+    {
         $help_model = model('help');
         $condition = array();
         $help_id = intval(input('param.help_id'));
@@ -130,9 +134,10 @@ class Storejoin extends AdminControl {
     /**
      * 上传图片
      */
-    public function upload_pic() {
+    public function upload_pic()
+    {
         $data = array();
-        if (!empty($_FILES['fileupload']['name'])) {//上传图片
+        if (!empty($_FILES['fileupload']['name'])) { //上传图片
             $fprefix = 'admin/storehelp';
             $res = ds_upload_pic($fprefix, 'fileupload');
             if ($res['code']) {
@@ -152,7 +157,7 @@ class Storejoin extends AdminControl {
             if ($result) {
                 $data['file_id'] = $result;
                 $data['file_name'] = $file_name;
-                $data['file_path'] = ds_get_pic( $fprefix , $file_name);
+                $data['file_path'] = ds_get_pic($fprefix, $file_name);
             }
         }
         echo json_encode($data);
@@ -162,7 +167,8 @@ class Storejoin extends AdminControl {
     /**
      * 删除图片
      */
-    public function del_pic() {
+    public function del_pic()
+    {
         $condition = array();
         $condition[] = array('upload_id', '=', intval(input('param.file_id')));
         $help_model = model('help');
@@ -176,7 +182,8 @@ class Storejoin extends AdminControl {
         }
     }
 
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index', 'text' => lang('image_and_notice'), 'url' => (string) url('Storejoin/index')
@@ -189,5 +196,4 @@ class Storejoin extends AdminControl {
         }
         return $menu_array;
     }
-
 }

+ 89 - 81
app/admin/controller/Storemoney.php

@@ -1,26 +1,29 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 use think\facade\Db;
 use app\common\model\Storemoneylog;
+
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Storemoney extends AdminControl {
+class Storemoney extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/storemoney.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/storemoney.lang.php');
     }
 
 
@@ -28,31 +31,32 @@ class Storemoney extends AdminControl {
      * 资金明细
      */
 
-    public function index() {
+    public function index()
+    {
         $condition = array();
         $stime = input('get.stime');
         $etime = input('get.etime');
         $if_start_date = preg_match('/^20\d{2}-\d{2}-\d{2}$/', $stime);
         $if_end_date = preg_match('/^20\d{2}-\d{2}-\d{2}$/', $etime);
         $start_unixtime = $if_start_date ? strtotime($stime) : null;
-        $end_unixtime = $if_end_date ? (strtotime($etime)+86399) : null;
+        $end_unixtime = $if_end_date ? (strtotime($etime) + 86399) : null;
         if ($start_unixtime) {
-            $condition[] = array('storemoneylog_add_time','>=', $start_unixtime);
+            $condition[] = array('storemoneylog_add_time', '>=', $start_unixtime);
         }
         if ($end_unixtime) {
-            $condition[] = array('storemoneylog_add_time','<=', $end_unixtime);
+            $condition[] = array('storemoneylog_add_time', '<=', $end_unixtime);
         }
         $mname = input('get.mname');
         if (!empty($mname)) {
-            $condition[]=array('store_name','like','%'.$mname.'%');
+            $condition[] = array('store_name', 'like', '%' . $mname . '%');
         }
         $storemoneylog_model = model('storemoneylog');
         $list_log = $storemoneylog_model->getStoremoneylogList($condition, 10, '*', 'storemoneylog_id desc');
         View::assign('show_page', $storemoneylog_model->page_info->render());
         View::assign('list_log', $list_log);
-        
+
         View::assign('filtered', $condition ? 1 : 0); //是否有查询条件
-        
+
         $this->setAdminCurItem('index');
         return View::fetch();
     }
@@ -60,21 +64,22 @@ class Storemoney extends AdminControl {
     /*
      * 提现列表
      */
-    public function withdraw_list() {
+    public function withdraw_list()
+    {
         $condition = array();
-        $condition[] = array('storemoneylog_type','=',Storemoneylog::TYPE_WITHDRAW);
+        $condition[] = array('storemoneylog_type', '=', Storemoneylog::TYPE_WITHDRAW);
         $paystate_search = input('param.paystate_search');
         if (isset($paystate_search) && $paystate_search !== '') {
-            $condition[] = array('storemoneylog_state','=',intval($paystate_search));
+            $condition[] = array('storemoneylog_state', '=', intval($paystate_search));
         }
 
         $storemoneylog_model = model('storemoneylog');
         $withdraw_list = $storemoneylog_model->getStoremoneylogList($condition, 10, '*', 'storemoneylog_id desc');
         View::assign('show_page', $storemoneylog_model->page_info->render());
         View::assign('withdraw_list', $withdraw_list);
-        
+
         View::assign('filtered', input('get.') ? 1 : 0); //是否有查询条件
-        
+
         $this->setAdminCurItem('withdraw_list');
         return View::fetch();
     }
@@ -82,25 +87,26 @@ class Storemoney extends AdminControl {
     /*
      * 提现设置
      */
-    public function withdraw_set(){
+    public function withdraw_set()
+    {
         $config_model = model('config');
-        if(!request()->isPost()){
+        if (!request()->isPost()) {
             $list_setting = rkcache('config', true);
-            View::assign('list_setting',$list_setting);
+            View::assign('list_setting', $list_setting);
             $this->setAdminCurItem('withdraw_set');
             return View::fetch();
-        }else{
-            $update_array=array(
-                'store_withdraw_min'=>abs(round(input('post.store_withdraw_min'),2)),
-                'store_withdraw_max'=>abs(round(input('post.store_withdraw_max'),2)),
-                'store_withdraw_cycle'=>abs(intval(input('post.store_withdraw_cycle'))),
+        } else {
+            $update_array = array(
+                'store_withdraw_min' => abs(round(input('post.store_withdraw_min'), 2)),
+                'store_withdraw_max' => abs(round(input('post.store_withdraw_max'), 2)),
+                'store_withdraw_cycle' => abs(intval(input('post.store_withdraw_cycle'))),
             );
             $result = $config_model->editConfig($update_array);
             if ($result) {
-                $this->log(lang('ds_update').lang('admin_storemoney_withdraw_set'),1);
+                $this->log(lang('ds_update') . lang('admin_storemoney_withdraw_set'), 1);
                 $this->success(lang('ds_common_op_succ'), 'Storemoney/withdraw_set');
-            }else{
-                $this->log(lang('ds_update').lang('admin_storemoney_withdraw_set'),0);
+            } else {
+                $this->log(lang('ds_update') . lang('admin_storemoney_withdraw_set'), 0);
             }
         }
     }
@@ -108,47 +114,48 @@ class Storemoney extends AdminControl {
     /**
      * 查看提现信息
      */
-    public function withdraw_view() {
+    public function withdraw_view()
+    {
         $id = intval(input('param.id'));
         if ($id <= 0) {
             $this->error(lang('param_error'));
         }
         $storemoneylog_model = model('storemoneylog');
         $condition = array();
-        $condition[] = array('storemoneylog_id','=',$id);
+        $condition[] = array('storemoneylog_id', '=', $id);
         $info = $storemoneylog_model->getStoremoneylogInfo($condition);
         if (!is_array($info) || count($info) < 0) {
             $this->error(lang('admin_storemoney_record_error'));
         }
-        if(!request()->isPost()){
+        if (!request()->isPost()) {
             View::assign('info', $info);
             return View::fetch();
-        }else{
-            if(!input('param.verify_reason')){
-                $this->error(lang('ds_none_input').lang('admin_storemoney_remark'));
+        } else {
+            if (!input('param.verify_reason')) {
+                $this->error(lang('ds_none_input') . lang('admin_storemoney_remark'));
             }
-            $data=array(
-                'store_id'=>$info['store_id'],
-                'store_name'=>$info['store_name'],
-                'storemoneylog_type'=>Storemoneylog::TYPE_VERIFY,
-                'storemoneylog_state'=>Storemoneylog::STATE_VALID,
-                'storemoneylog_add_time'=>TIMESTAMP,
+            $data = array(
+                'store_id' => $info['store_id'],
+                'store_name' => $info['store_name'],
+                'storemoneylog_type' => Storemoneylog::TYPE_VERIFY,
+                'storemoneylog_state' => Storemoneylog::STATE_VALID,
+                'storemoneylog_add_time' => TIMESTAMP,
             );
-            if(input('param.verify_state')==1){//通过
-                    $data['store_freeze_money']=-$info['store_freeze_money'];
-                    $storemoneylog_state=Storemoneylog::STATE_AGREE;
-            }else{
-                $data['store_avaliable_money']=$info['store_freeze_money'];
-                    $data['store_freeze_money']=-$info['store_freeze_money'];
-                    $storemoneylog_state=Storemoneylog::STATE_REJECT;
+            if (input('param.verify_state') == 1) { //通过
+                $data['store_freeze_money'] = -$info['store_freeze_money'];
+                $storemoneylog_state = Storemoneylog::STATE_AGREE;
+            } else {
+                $data['store_avaliable_money'] = $info['store_freeze_money'];
+                $data['store_freeze_money'] = -$info['store_freeze_money'];
+                $storemoneylog_state = Storemoneylog::STATE_REJECT;
             }
             $admininfo = $this->getAdminInfo();
-            $data['storemoneylog_desc']=lang('order_admin_operator')."【" . $admininfo['admin_name'] . "】".((input('param.verify_state')==1)?lang('ds_pass'):lang('ds_refuse')).lang('ds_seller_name')."【" . $info['store_name'] . "】".lang('admin_storemoney_log_stage_cash').':'.input('param.verify_reason');
+            $data['storemoneylog_desc'] = lang('order_admin_operator') . "【" . $admininfo['admin_name'] . "】" . ((input('param.verify_state') == 1) ? lang('ds_pass') : lang('ds_refuse')) . lang('ds_seller_name') . "【" . $info['store_name'] . "】" . lang('admin_storemoney_log_stage_cash') . ':' . input('param.verify_reason');
             try {
                 Db::startTrans();
                 $storemoneylog_model->changeStoremoney($data);
                 //修提现状态
-                if(!$storemoneylog_model->editStoremoneylog(array('storemoneylog_id'=>$id,'storemoneylog_state'=>Storemoneylog::STATE_WAIT),array('storemoneylog_state'=>$storemoneylog_state))){
+                if (!$storemoneylog_model->editStoremoneylog(array('storemoneylog_id' => $id, 'storemoneylog_state' => Storemoneylog::STATE_WAIT), array('storemoneylog_state' => $storemoneylog_state))) {
                     throw new \think\Exception(lang('admin_storemoney_cash_edit_fail'), 10006);
                 }
                 Db::commit();
@@ -167,15 +174,16 @@ class Storemoney extends AdminControl {
      * 调节资金
      */
 
-    public function adjust() {
+    public function adjust()
+    {
         if (!(request()->isPost())) {
             $store_id = intval(input('get.store_id'));
-            if($store_id>0){
+            if ($store_id > 0) {
                 $condition = array();
-                $condition[] = array('store_id','=',$store_id);
+                $condition[] = array('store_id', '=', $store_id);
                 $store = model('store')->getStoreInfo($condition);
-                if(!empty($store)){
-                    View::assign('store_info',$store);
+                if (!empty($store)) {
+                    View::assign('store_info', $store);
                 }
             }
             return View::fetch();
@@ -187,7 +195,7 @@ class Storemoney extends AdminControl {
                 'lg_desc' => input('post.lg_desc'),
             );
             $storedeposit_validate = ds_validate('storedeposit');
-            if (!$storedeposit_validate->scene('adjust')->check($data)){
+            if (!$storedeposit_validate->scene('adjust')->check($data)) {
                 $this->error($storedeposit_validate->getError());
             }
 
@@ -218,37 +226,37 @@ class Storemoney extends AdminControl {
             $storemoneylog_model = model('storemoneylog');
             #生成对应订单号
             $admininfo = $this->getAdminInfo();
-            $data=array(
-                'store_id'=>$store_info['store_id'],
-                'store_name'=>$store_info['store_name'],
-                'storemoneylog_type'=>Storemoneylog::TYPE_ADMIN,
-                'storemoneylog_state'=>Storemoneylog::STATE_VALID,
-                'storemoneylog_add_time'=>TIMESTAMP,
+            $data = array(
+                'store_id' => $store_info['store_id'],
+                'store_name' => $store_info['store_name'],
+                'storemoneylog_type' => Storemoneylog::TYPE_ADMIN,
+                'storemoneylog_state' => Storemoneylog::STATE_VALID,
+                'storemoneylog_add_time' => TIMESTAMP,
             );
             switch ($operatetype) {
                 case 1:
-                    $data['store_avaliable_money']=$money;
-                    $log_msg = lang('order_admin_operator')."【" . $admininfo['admin_name'] . "】".lang('ds_handle').lang('ds_seller_name')."【" . $store_info['store_name'] . "】".lang('ds_store_money')."【".lang('admin_storemoney_artificial_operatetype_add')."】,".lang('admin_storemoney_price') . $money;
+                    $data['store_avaliable_money'] = $money;
+                    $log_msg = lang('order_admin_operator') . "【" . $admininfo['admin_name'] . "】" . lang('ds_handle') . lang('ds_seller_name') . "【" . $store_info['store_name'] . "】" . lang('ds_store_money') . "【" . lang('admin_storemoney_artificial_operatetype_add') . "】," . lang('admin_storemoney_price') . $money;
                     break;
                 case 2:
-                    $data['store_avaliable_money']=-$money;
-                    $log_msg = lang('order_admin_operator')."【" . $admininfo['admin_name'] . "】".lang('ds_handle').lang('ds_seller_name')."【" . $store_info['store_name'] . "】".lang('ds_store_money')."【".lang('admin_storemoney_artificial_operatetype_reduce')."】,".lang('admin_storemoney_price') . $money;
+                    $data['store_avaliable_money'] = -$money;
+                    $log_msg = lang('order_admin_operator') . "【" . $admininfo['admin_name'] . "】" . lang('ds_handle') . lang('ds_seller_name') . "【" . $store_info['store_name'] . "】" . lang('ds_store_money') . "【" . lang('admin_storemoney_artificial_operatetype_reduce') . "】," . lang('admin_storemoney_price') . $money;
                     break;
                 case 3:
-                    $data['store_avaliable_money']=-$money;
-                    $data['store_freeze_money']=$money;
-                    $log_msg = lang('order_admin_operator')."【" . $admininfo['admin_name'] . "】".lang('ds_handle').lang('ds_seller_name')."【" . $store_info['store_name'] . "】".lang('ds_store_money')."【".lang('admin_storemoney_artificial_operatetype_freeze')."】,".lang('admin_storemoney_price') . $money;
+                    $data['store_avaliable_money'] = -$money;
+                    $data['store_freeze_money'] = $money;
+                    $log_msg = lang('order_admin_operator') . "【" . $admininfo['admin_name'] . "】" . lang('ds_handle') . lang('ds_seller_name') . "【" . $store_info['store_name'] . "】" . lang('ds_store_money') . "【" . lang('admin_storemoney_artificial_operatetype_freeze') . "】," . lang('admin_storemoney_price') . $money;
                     break;
                 case 4:
-                    $data['store_avaliable_money']=$money;
-                    $data['store_freeze_money']=-$money;
-                    $log_msg = lang('order_admin_operator')."【" . $admininfo['admin_name'] . "】".lang('ds_handle').lang('ds_seller_name')."【" . $store_info['store_name'] . "】".lang('ds_store_money')."【".lang('admin_storemoney_artificial_operatetype_unfreeze')."】,".lang('admin_storemoney_price') . $money;
+                    $data['store_avaliable_money'] = $money;
+                    $data['store_freeze_money'] = -$money;
+                    $log_msg = lang('order_admin_operator') . "【" . $admininfo['admin_name'] . "】" . lang('ds_handle') . lang('ds_seller_name') . "【" . $store_info['store_name'] . "】" . lang('ds_store_money') . "【" . lang('admin_storemoney_artificial_operatetype_unfreeze') . "】," . lang('admin_storemoney_price') . $money;
                     break;
                 default:
                     $this->error(lang('ds_common_op_fail'), 'Storemoney/index');
                     break;
             }
-            $data['storemoneylog_desc']=$log_msg;
+            $data['storemoneylog_desc'] = $log_msg;
             try {
                 Db::startTrans();
                 $storemoneylog_model->changeStoremoney($data);
@@ -264,7 +272,8 @@ class Storemoney extends AdminControl {
     }
 
     //取得店主信息
-    public function checkseller() {
+    public function checkseller()
+    {
         $name = input('post.name');
         if (!$name) {
             exit(json_encode(array('id' => 0)));
@@ -278,11 +287,12 @@ class Storemoney extends AdminControl {
             exit(json_encode(array('id' => 0)));
         }
     }
-    
+
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -302,11 +312,9 @@ class Storemoney extends AdminControl {
             array(
                 'name' => 'adjust',
                 'text' => lang('admin_storemoney_adjust'),
-                'url' => "javascript:dsLayerOpen('".(string)url('Storemoney/adjust')."','".lang('admin_storemoney_adjust')."')"
+                'url' => "javascript:dsLayerOpen('" . (string)url('Storemoney/adjust') . "','" . lang('admin_storemoney_adjust') . "')"
             ),
         );
         return $menu_array;
     }
 }
-
-?>

+ 51 - 46
app/admin/controller/Storesnstrace.php

@@ -1,52 +1,55 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Storesnstrace extends AdminControl {
+class Storesnstrace extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/storesnstrace.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/storesnstrace.lang.php');
     }
 
     /**
      * 动态列表
      */
-    public function index() {
+    public function index()
+    {
         // where条件
         $where = array();
         if (input('get.search_sname') != '') {
-            $where[]=array('stracelog_storename','like', '%' . trim(input('get.search_sname')) . '%');
+            $where[] = array('stracelog_storename', 'like', '%' . trim(input('get.search_sname')) . '%');
         }
         if (input('get.search_stitle') != '') {
-            $where[]=array('stracelog_title','like', '%' . trim(input('get.search_stitle')) . '%');
+            $where[] = array('stracelog_title', 'like', '%' . trim(input('get.search_stitle')) . '%');
         }
         if (input('get.search_scontent') != '') {
-            $where[]=array('stracelog_content','like', '%' . trim(input('get.search_scontent')) . '%');
+            $where[] = array('stracelog_content', 'like', '%' . trim(input('get.search_scontent')) . '%');
         }
         if (input('get.search_type') != '') {
-            $where[]=array('stracelog_type','=',trim(input('get.search_type')));
+            $where[] = array('stracelog_type', '=', trim(input('get.search_type')));
         }
         if (input('get.search_stime') != '') {
             $s_time = input('get.search_stime') != '' ? strtotime(input('get.search_stime')) : null;
-            $where[] = array('stracelog_time','>=', $s_time);
+            $where[] = array('stracelog_time', '>=', $s_time);
         }
         if (input('get.search_etime') != '') {
-            $e_time = input('get.search_etime') != '' ? (strtotime(input('get.search_etime'))+86399) : null;
-            $where[] = array('stracelog_time','<=', $e_time);
+            $e_time = input('get.search_etime') != '' ? (strtotime(input('get.search_etime')) + 86399) : null;
+            $where[] = array('stracelog_time', '<=', $e_time);
         }
         // 实例化模型
         $storesnstracelog_model = model('storesnstracelog');
@@ -69,18 +72,19 @@ class Storesnstrace extends AdminControl {
     /**
      * 删除动态
      */
-    public function strace_del() {
+    public function strace_del()
+    {
         $st_id = input('param.st_id');
         $st_id_array = ds_delete_param($st_id);
         if ($st_id_array == FALSE) {
             ds_json_encode('10001', lang('param_error'));
         }
         // 删除动态
-        $rs = model('storesnstracelog')->delStoresnstracelog(array(array('stracelog_id' ,'in', $st_id_array)));
+        $rs = model('storesnstracelog')->delStoresnstracelog(array(array('stracelog_id', 'in', $st_id_array)));
         if ($rs) {
             // 删除评论
-            model('storesnscomment')->delStoresnscomment(array(array('stracelog_id','in', $st_id_array)));
-            $this->log(lang('ds_del').lang('admin_snstrace_comment'), 1);
+            model('storesnscomment')->delStoresnscomment(array(array('stracelog_id', 'in', $st_id_array)));
+            $this->log(lang('ds_del') . lang('admin_snstrace_comment'), 1);
             ds_json_encode('10000', lang('ds_common_del_succ'));
         } else {
             ds_json_encode('10001', lang('ds_common_del_fail'));
@@ -90,7 +94,8 @@ class Storesnstrace extends AdminControl {
     /**
      * 编辑动态
      */
-    public function strace_edit() {
+    public function strace_edit()
+    {
         $st_id = input('param.st_id');
         $st_id_array = ds_delete_param($st_id);
         if ($st_id_array == FALSE) {
@@ -98,19 +103,19 @@ class Storesnstrace extends AdminControl {
         }
         // where条件
         $where = array();
-        $where[]=array('stracelog_id','in', $st_id_array);
+        $where[] = array('stracelog_id', 'in', $st_id_array);
         // update条件
         $update = array();
-        
+
         if (input('param.type') == 'hide') {
             $update['stracelog_state'] = 0;
-        }else{
-			$update['stracelog_state'] = 1;
-		}
+        } else {
+            $update['stracelog_state'] = 1;
+        }
         // 实例化模型
         $rs = model('storesnstracelog')->editStoresnstracelog($update, $where);
         if ($rs) {
-            $this->log(lang('ds_edit').lang('admin_snstrace_comment'), 1);
+            $this->log(lang('ds_edit') . lang('admin_snstrace_comment'), 1);
             ds_json_encode('10000', lang('ds_common_op_succ'));
         } else {
             ds_json_encode('10001', lang('ds_common_op_fail'));
@@ -120,34 +125,35 @@ class Storesnstrace extends AdminControl {
     /**
      * 评论列表
      */
-    public function storecomment_list() {
+    public function storecomment_list()
+    {
         // where 条件
         $where = array();
         $st_id = intval(input('get.st_id'));
         if ($st_id > 0) {
-            $where[]=array('stracelog_id','=',$st_id);
+            $where[] = array('stracelog_id', '=', $st_id);
         }
-        
+
         if (input('get.search_uname') != '') {
-            $where[]=array('storesnscomm_membername','like', '%' . trim(input('get.search_uname')) . '%');
+            $where[] = array('storesnscomm_membername', 'like', '%' . trim(input('get.search_uname')) . '%');
         }
         if (input('get.search_content') != '') {
-            $where[]=array('storesnscomm_content','like', '%' . trim(input('get.search_content')) . '%');
+            $where[] = array('storesnscomm_content', 'like', '%' . trim(input('get.search_content')) . '%');
         }
         if (input('get.search_state') != '') {
-            $where[]=array('storesnscomm_state','=',intval(input('get.search_state')));
+            $where[] = array('storesnscomm_state', '=', intval(input('get.search_state')));
         }
         if (input('get.search_stime') != '') {
             $s_time = input('get.search_stime') != '' ? strtotime(input('get.search_stime')) : null;
-            $where[] = array('storesnscomm_time','>=', $s_time);
+            $where[] = array('storesnscomm_time', '>=', $s_time);
         }
         if (input('get.search_etime') != '') {
-            $e_time = input('get.search_etime') != '' ? (strtotime(input('get.search_etime'))+86399) : null;
-            $where[] = array('storesnscomm_time','<=', $e_time);
+            $e_time = input('get.search_etime') != '' ? (strtotime(input('get.search_etime')) + 86399) : null;
+            $where[] = array('storesnscomm_time', '<=', $e_time);
         }
         $model_storesnscomment = model('storesnscomment');
         $storesnscomm_list = $model_storesnscomment->getStoresnscommentList($where, '*', 'storesnscomm_id desc', 0, 20);
-        
+
         $this->setAdminCurItem('index');
         View::assign('scomm_list', $storesnscomm_list);
         View::assign('show_page', $model_storesnscomment->page_info->render());
@@ -157,16 +163,17 @@ class Storesnstrace extends AdminControl {
     /**
      * 删除评论
      */
-    public function scomm_del() {
+    public function scomm_del()
+    {
         $sc_id = input('param.sc_id');
         $sc_id_array = ds_delete_param($sc_id);
         if ($sc_id_array == FALSE) {
             ds_json_encode('10001', lang('param_error'));
         }
         // 实例化模型
-        $rs = model('storesnscomment')->delStoresnscomment(array(array('storesnscomm_id','in', $sc_id_array)));
+        $rs = model('storesnscomment')->delStoresnscomment(array(array('storesnscomm_id', 'in', $sc_id_array)));
         if ($rs) {
-            $this->log(lang('ds_del').lang('admin_snstrace_pl'), 1);
+            $this->log(lang('ds_del') . lang('admin_snstrace_pl'), 1);
             ds_json_encode('10000', lang('ds_common_del_succ'));
         } else {
             ds_json_encode('10001', lang('ds_common_del_fail'));
@@ -176,7 +183,8 @@ class Storesnstrace extends AdminControl {
     /**
      * 评论编辑
      */
-    public function scomm_edit() {
+    public function scomm_edit()
+    {
         $sc_id = input('param.sc_id');
         $sc_id_array = ds_delete_param($sc_id);
         if ($sc_id_array == FALSE) {
@@ -187,15 +195,12 @@ class Storesnstrace extends AdminControl {
             $storesnscomm_state = 0;
         }
         // 实例化模型
-        $rs = model('storesnscomment')->editStoresnscomment(array('storesnscomm_state' => $storesnscomm_state), array(array('storesnscomm_id' ,'in', $sc_id_array)));
+        $rs = model('storesnscomment')->editStoresnscomment(array('storesnscomm_state' => $storesnscomm_state), array(array('storesnscomm_id', 'in', $sc_id_array)));
         if ($rs) {
-            $this->log(lang('ds_edit').lang('admin_snstrace_pl'), 1);
+            $this->log(lang('ds_edit') . lang('admin_snstrace_pl'), 1);
             ds_json_encode('10000', lang('ds_common_op_succ'));
         } else {
             ds_json_encode('10001', lang('ds_common_op_fail'));
         }
     }
-
 }
-
-?>

+ 122 - 111
app/admin/controller/Type.php

@@ -5,29 +5,32 @@
  */
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Db;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Type extends AdminControl {
+class Type extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/type.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/type.lang.php');
     }
 
-    public function index() {
+    public function index()
+    {
         $type_model = model('type');
         $type_list = $type_model->getTypeList('', 10);
         // 获取分页显示
@@ -41,7 +44,8 @@ class Type extends AdminControl {
      * 新增类型
      */
 
-    public function type_add() {
+    public function type_add()
+    {
         if (!(request()->isPost())) {
             $type = [
                 'class_id' => 0,
@@ -50,7 +54,7 @@ class Type extends AdminControl {
             //设置类型关联的分类
             $gc_list = model('goodsclass')->getGoodsclassListByParentId(0);
             View::assign('gc_list', $gc_list);
-            
+
             $this->setAdminCurItem('type_add');
             return View::fetch('type_form');
         } else {
@@ -84,7 +88,7 @@ class Type extends AdminControl {
                     $type_model->addTypebrand($typebrand);
                 }
             }
-            
+
             //添加类型与规格对应
             $spec_array = input('post.spec_id/a');
             if (!empty($spec_array)) {
@@ -137,7 +141,8 @@ class Type extends AdminControl {
         }
     }
 
-    public function type_edit() {
+    public function type_edit()
+    {
         $type_id = input('param.type_id');
         if (empty($type_id)) {
             $this->error(lang('param_error'));
@@ -145,7 +150,7 @@ class Type extends AdminControl {
         $type_model = model('type');
         if (!(request()->isPost())) {
             $type = $type_model->getOneType(array('type_id' => $type_id));
-            if(empty($type)){
+            if (empty($type)) {
                 $this->error(lang('param_error'));
             }
             View::assign('type', $type);
@@ -153,10 +158,10 @@ class Type extends AdminControl {
             $gc_list = model('goodsclass')->getGoodsclassListByParentId(0);
             View::assign('gc_list', $gc_list);
             //根据相同分类检索出对应的品牌
-            $b_related = $this->getBrand($type['class_id'],$type_id);
+            $b_related = $this->getBrand($type['class_id'], $type_id);
             View::assign('brand_list', $b_related);
             //根据相同分类检索出对应的规格
-            $sp_related = $this->getSpec($type['class_id'],$type_id);
+            $sp_related = $this->getSpec($type['class_id'], $type_id);
             View::assign('spec_list', $sp_related);
             //属性
             $attr_list = $type_model->typeRelatedList('attribute', array('type_id' => $type_id));
@@ -219,9 +224,9 @@ class Type extends AdminControl {
                         $attr_array['attr_sort'] = $v['sort'];
                         $attr_array['attr_show'] = isset($v['show']) && $v['show'] == "on" ? 1 : 0;
                         $condition = array();
-                        $condition[] = array('type_id','=',$type_id);
-                        $condition[] = array('attr_id','=',intval($v['attr_id']));
-                        $return = $type_model->editAttribute($condition,$attr_array);
+                        $condition[] = array('type_id', '=', $type_id);
+                        $condition[] = array('attr_id', '=', intval($v['attr_id']));
+                        $return = $type_model->editAttribute($condition, $attr_array);
                     } else if (!isset($v['form_submit'])) {
                         //添加新属性
                         if ($v['value'] != '') {
@@ -272,13 +277,14 @@ class Type extends AdminControl {
                 $type_array['type_sort'] = trim(input('post.type_sort'));
                 $type_array['class_id'] = input('post.class_id');
                 $type_array['class_name'] = input('post.class_name');
-                $type_model->editType(array('type_id' => $type_id),$type_array);
+                $type_model->editType(array('type_id' => $type_id), $type_array);
             }
             $this->success(lang('ds_common_op_succ'), 'Type/index');
         }
     }
 
-    public function attr_edit() {
+    public function attr_edit()
+    {
         $type_model = model('type');
         $attr_id = input('param.attr_id');
         if (empty($attr_id)) {
@@ -314,7 +320,7 @@ class Type extends AdminControl {
                         $update = array();
                         $update['attrvalue_name'] = $val['name'];
                         $update['attrvalue_sort'] = intval($val['sort']);
-                        $type_model->editAttributevalue(array('attrvalue_id' => intval($key)),$update);
+                        $type_model->editAttributevalue(array('attrvalue_id' => intval($key)), $update);
 
                         $attr_array[] = $val['name'];
                     } else if (!isset($val['form_submit'])) {
@@ -339,7 +345,7 @@ class Type extends AdminControl {
 
             //更新属性
             $data['attr_value'] = implode(',', $attr_array);
-            $type_model->editAttribute(array('attr_id' => $attr_id),$data);
+            $type_model->editAttribute(array('attr_id' => $attr_id), $data);
             dsLayerOpenSuccess(lang('ds_common_op_succ'));
         }
     }
@@ -347,14 +353,15 @@ class Type extends AdminControl {
     /*
      * 删除类型
      */
-    public function type_drop() {
+    public function type_drop()
+    {
         $type_model = model('type');
         $type_id = input('param.type_id');
         if (empty($type_id)) {
             ds_json_encode(10001, lang('param_error'));
         }
         $condition = array();
-        $condition[] = array('type_id','=',$type_id);
+        $condition[] = array('type_id', '=', $type_id);
         //更新前删除对应类型与品牌关联
         $type_model->delTypebrand($condition);
         //更新前删除对应类型与规格关联
@@ -375,7 +382,8 @@ class Type extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -387,131 +395,134 @@ class Type extends AdminControl {
         if (request()->action() == 'type_add' || request()->action() == 'index') {
             $menu_array[] = array(
                 'name' => 'type_add',
-                'text' => lang('ds_new').lang('type_index_type_name'),
+                'text' => lang('ds_new') . lang('type_index_type_name'),
                 'url' => (string)url('Type/type_add')
             );
         }
         if (request()->action() == 'type_edit') {
             $menu_array[] = array(
                 'name' => 'type_edit',
-                'text' => lang('ds_edit').lang('type_index_type_name'),
+                'text' => lang('ds_edit') . lang('type_index_type_name'),
                 'url' => ''
             );
         }
         return $menu_array;
     }
-    function getSpecRelated($type_id){
+    function getSpecRelated($type_id)
+    {
         //规格关联列表
         $type_model = model('type');
-            $spec_related = $type_model->typeRelatedList('typespec', array('type_id' => $type_id), 'sp_id');
-            $sp_related = array();
-            if (is_array($spec_related) && !empty($spec_related)) {
-                foreach ($spec_related as $val) {
-                    $sp_related[] = $val['sp_id'];
-                }
+        $spec_related = $type_model->typeRelatedList('typespec', array('type_id' => $type_id), 'sp_id');
+        $sp_related = array();
+        if (is_array($spec_related) && !empty($spec_related)) {
+            foreach ($spec_related as $val) {
+                $sp_related[] = $val['sp_id'];
             }
-            unset($spec_related);
-            return $sp_related;
+        }
+        unset($spec_related);
+        return $sp_related;
     }
-    function getBrandRelated($type_id){
+    function getBrandRelated($type_id)
+    {
         //类型与品牌关联列表
         $type_model = model('type');
-            $brand_related = $type_model->typeRelatedList('typebrand', array('type_id' => $type_id), 'brand_id');
-            $b_related = array();
-            if (is_array($brand_related) && !empty($brand_related)) {
-                foreach ($brand_related as $val) {
-                    $b_related[] = $val['brand_id'];
-                }
+        $brand_related = $type_model->typeRelatedList('typebrand', array('type_id' => $type_id), 'brand_id');
+        $b_related = array();
+        if (is_array($brand_related) && !empty($brand_related)) {
+            foreach ($brand_related as $val) {
+                $b_related[] = $val['brand_id'];
             }
-            unset($brand_related);
-            return $b_related;
+        }
+        unset($brand_related);
+        return $b_related;
     }
-    function getSpec($class_id,$type_id=0){
-        
+    function getSpec($class_id, $type_id = 0)
+    {
+
         $goodsclass_model = model('goodsclass');
-        $in_gc_id='0';
+        $in_gc_id = '0';
         //分类是否存在
-        if($class_id && Db::name('goodsclass')->where('gc_id',$class_id)->value('gc_id')){
-            $parent_gc_list=$goodsclass_model->getGoodsclassLineForTag($class_id);
-            if(is_array($parent_gc_list) && !empty($parent_gc_list)){
+        if ($class_id && Db::name('goodsclass')->where('gc_id', $class_id)->value('gc_id')) {
+            $parent_gc_list = $goodsclass_model->getGoodsclassLineForTag($class_id);
+            if (is_array($parent_gc_list) && !empty($parent_gc_list)) {
                 //获取分类的父分类ID
-                if(isset($parent_gc_list['gc_id_1'])){
-                    $in_gc_id.=','.$parent_gc_list['gc_id_1'];
+                if (isset($parent_gc_list['gc_id_1'])) {
+                    $in_gc_id .= ',' . $parent_gc_list['gc_id_1'];
                 }
-                if(isset($parent_gc_list['gc_id_2'])){
-                    $in_gc_id.=','.$parent_gc_list['gc_id_2'];
+                if (isset($parent_gc_list['gc_id_2'])) {
+                    $in_gc_id .= ',' . $parent_gc_list['gc_id_2'];
                 }
-                if(isset($parent_gc_list['gc_id_3'])){
-                    $in_gc_id.=','.$parent_gc_list['gc_id_3'];
+                if (isset($parent_gc_list['gc_id_3'])) {
+                    $in_gc_id .= ',' . $parent_gc_list['gc_id_3'];
                 }
             }
         }
-        
-            //根据相同分类检索出对应的规格
-            $spec_model = model('spec');
-            $condition = array();
-            $condition[]=array('gc_id','in',$in_gc_id);    
-            $spec_list = $spec_model->getSpecList($condition);
-            $s_list = array();
-            $sp_related = array();
-            if($type_id){
-                $sp_related=$this->getSpecRelated($type_id);
-            }
-            if (is_array($spec_list) && !empty($spec_list)) {
-                foreach ($spec_list as $k => $val) {
-                    $val['checked']= in_array($val['sp_id'], $sp_related)?1:0;
-                    $s_list[$val['gc_id']]['spec'][$k] = $val;
-                    $s_list[$val['gc_id']]['name'] = $val['gc_name'];
-                }
+
+        //根据相同分类检索出对应的规格
+        $spec_model = model('spec');
+        $condition = array();
+        $condition[] = array('gc_id', 'in', $in_gc_id);
+        $spec_list = $spec_model->getSpecList($condition);
+        $s_list = array();
+        $sp_related = array();
+        if ($type_id) {
+            $sp_related = $this->getSpecRelated($type_id);
+        }
+        if (is_array($spec_list) && !empty($spec_list)) {
+            foreach ($spec_list as $k => $val) {
+                $val['checked'] = in_array($val['sp_id'], $sp_related) ? 1 : 0;
+                $s_list[$val['gc_id']]['spec'][$k] = $val;
+                $s_list[$val['gc_id']]['name'] = $val['gc_name'];
             }
-            ksort($s_list);
-            return $s_list;
+        }
+        ksort($s_list);
+        return $s_list;
     }
-    function getBrand($class_id,$type_id=0){
+    function getBrand($class_id, $type_id = 0)
+    {
         $goodsclass_model = model('goodsclass');
-        
-        $in_gc_id[]=0;
+
+        $in_gc_id[] = 0;
         //分类是否存在
-        if($class_id && Db::name('goodsclass')->where('gc_id',$class_id)->value('gc_id')){
-            $parent_gc_list=$goodsclass_model->getGoodsclassLineForTag($class_id);
-            if(is_array($parent_gc_list) && !empty($parent_gc_list)){
+        if ($class_id && Db::name('goodsclass')->where('gc_id', $class_id)->value('gc_id')) {
+            $parent_gc_list = $goodsclass_model->getGoodsclassLineForTag($class_id);
+            if (is_array($parent_gc_list) && !empty($parent_gc_list)) {
                 //获取分类的父分类ID
-                if(isset($parent_gc_list['gc_id_1'])){
-                    $in_gc_id[]=$parent_gc_list['gc_id_1'];
+                if (isset($parent_gc_list['gc_id_1'])) {
+                    $in_gc_id[] = $parent_gc_list['gc_id_1'];
                 }
-                if(isset($parent_gc_list['gc_id_2'])){
-                    $in_gc_id[]=$parent_gc_list['gc_id_2'];
+                if (isset($parent_gc_list['gc_id_2'])) {
+                    $in_gc_id[] = $parent_gc_list['gc_id_2'];
                 }
-                if(isset($parent_gc_list['gc_id_3'])){
-                    $in_gc_id[]=$parent_gc_list['gc_id_3'];
+                if (isset($parent_gc_list['gc_id_3'])) {
+                    $in_gc_id[] = $parent_gc_list['gc_id_3'];
                 }
             }
         }
         $brand_model = model('brand');
-            $brand_list = $brand_model->getBrandPassedList(array(array('gc_id','in',$in_gc_id)));
-            $b_list = array();
-            $b_related = array();
-            if($type_id){
-                $b_related=$this->getBrandRelated($type_id);
-            }
-            if (is_array($brand_list) && !empty($brand_list)) {
-                foreach ($brand_list as $k => $val) {
-                    $val['checked']= in_array($val['brand_id'], $b_related)?1:0;
-                    $b_list[$val['gc_id']]['brand'][$k] = $val;
-                    $b_list[$val['gc_id']]['name'] = $val['brand_class'];
-                }
+        $brand_list = $brand_model->getBrandPassedList(array(array('gc_id', 'in', $in_gc_id)));
+        $b_list = array();
+        $b_related = array();
+        if ($type_id) {
+            $b_related = $this->getBrandRelated($type_id);
+        }
+        if (is_array($brand_list) && !empty($brand_list)) {
+            foreach ($brand_list as $k => $val) {
+                $val['checked'] = in_array($val['brand_id'], $b_related) ? 1 : 0;
+                $b_list[$val['gc_id']]['brand'][$k] = $val;
+                $b_list[$val['gc_id']]['name'] = $val['brand_class'];
             }
-            ksort($b_list);
-            return $b_list;
+        }
+        ksort($b_list);
+        return $b_list;
     }
-    function ajaxGetSpecAndBrand(){
-        $class_id=intval(input('class_id'));
-        $type_id=intval(input('type_id'));
-        $s_list=$this->getSpec($class_id,$type_id);
-        $b_list=$this->getBrand($class_id,$type_id);
-        echo json_encode(array('s_list'=>$s_list,'b_list'=>$b_list));
+    function ajaxGetSpecAndBrand()
+    {
+        $class_id = intval(input('class_id'));
+        $type_id = intval(input('type_id'));
+        $s_list = $this->getSpec($class_id, $type_id);
+        $b_list = $this->getBrand($class_id, $type_id);
+        echo json_encode(array('s_list' => $s_list, 'b_list' => $b_list));
         return;
     }
 }
-
-?>

+ 14 - 13
app/admin/controller/Upload.php

@@ -6,24 +6,26 @@ use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Upload extends AdminControl {
+class Upload extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize();
         Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/upload.lang.php');
     }
 
-    function default_thumb() {
+    function default_thumb()
+    {
         $config_model = model('config');
         $list_config = rkcache('config', true);
 
@@ -117,7 +119,8 @@ class Upload extends AdminControl {
         }
     }
 
-    public function upload_type() {
+    public function upload_type()
+    {
         if (!request()->isPost()) {
             $list_config = rkcache('config', true);
             View::assign('list_config', $list_config);
@@ -137,7 +140,8 @@ class Upload extends AdminControl {
     /**
      * 获取卖家栏目列表,针对控制器下的栏目
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'default_thumb', 'text' => lang('default_thumb'), 'url' => (string) url('Upload/default_thumb')
@@ -147,7 +151,4 @@ class Upload extends AdminControl {
         );
         return $menu_array;
     }
-
 }
-
-?>

+ 80 - 71
app/admin/controller/Voucher.php

@@ -1,28 +1,30 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Voucher extends AdminControl {
+class Voucher extends AdminControl
+{
 
     private $quotastate_arr;
     private $templatestate_arr;
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/voucher.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/voucher.lang.php');
         if (config('ds_config.voucher_allow') != 1 || config('ds_config.points_isuse') != 1) {
             $this->error(lang('admin_voucher_unavailable'), 'operation/setting');
         }
@@ -43,7 +45,8 @@ class Voucher extends AdminControl {
     /**
      * 代金券设置
      */
-    public function setting() {
+    public function setting()
+    {
         $setting_model = model('config');
         if (request()->isPost()) {
             $data = [
@@ -53,7 +56,7 @@ class Voucher extends AdminControl {
             ];
 
             $voucher_validate = ds_validate('voucher');
-            if (!$voucher_validate->scene('setting')->check($data)){
+            if (!$voucher_validate->scene('setting')->check($data)) {
                 $this->error($voucher_validate->getError());
             }
             //每月代金劵软件服务单价
@@ -93,10 +96,11 @@ class Voucher extends AdminControl {
      * 代金券面额列表
      */
 
-    public function pricelist() {
+    public function pricelist()
+    {
         //获得代金券金额列表
         $voucher_model = model('voucher');
-        $voucherprice_list = $voucher_model->getVoucherpriceList(10,'voucherprice asc');
+        $voucherprice_list = $voucher_model->getVoucherpriceList(10, 'voucherprice asc');
         View::assign('voucherprice_list', $voucherprice_list);
         View::assign('show_page', $voucher_model->page_info->render());
         $this->setAdminCurItem('pricelist');
@@ -107,7 +111,8 @@ class Voucher extends AdminControl {
      * 添加代金券面额页面
      */
 
-    public function priceadd() {
+    public function priceadd()
+    {
         if (request()->isPost()) {
             $voucher_model = model('voucher');
             $data = [
@@ -116,7 +121,7 @@ class Voucher extends AdminControl {
                 'voucher_points' => input('post.voucher_points')
             ];
             $voucher_validate = ds_validate('voucher');
-            if (!$voucher_validate->scene('priceadd')->check($data)){
+            if (!$voucher_validate->scene('priceadd')->check($data)) {
                 $this->error($voucher_validate->getError());
             }
 
@@ -127,20 +132,19 @@ class Voucher extends AdminControl {
             if (!empty($voucherprice_info)) {
                 $this->error(lang('admin_voucher_price_exist'));
             }
-                //保存
-                $insert_arr = array(
-                    'voucherprice_describe' => trim(input('post.voucher_price_describe')),
-                    'voucherprice' => $voucher_price, 'voucherprice_defaultpoints' => $voucher_points,
-                );
-                $rs = $voucher_model->addVoucherprice($insert_arr);
-                if ($rs) {
-                    $this->log(lang('ds_add') . lang('admin_voucher_priceadd') . '[' . input('post.voucher_price') . ']');
-                    dsLayerOpenSuccess(lang('ds_common_save_succ'),(string)url('voucher/pricelist'));
-                } else {
-                    $this->error(lang('ds_common_save_fail'), 'voucher/priceadd');
-                }
+            //保存
+            $insert_arr = array(
+                'voucherprice_describe' => trim(input('post.voucher_price_describe')),
+                'voucherprice' => $voucher_price, 'voucherprice_defaultpoints' => $voucher_points,
+            );
+            $rs = $voucher_model->addVoucherprice($insert_arr);
+            if ($rs) {
+                $this->log(lang('ds_add') . lang('admin_voucher_priceadd') . '[' . input('post.voucher_price') . ']');
+                dsLayerOpenSuccess(lang('ds_common_save_succ'), (string)url('voucher/pricelist'));
+            } else {
+                $this->error(lang('ds_common_save_fail'), 'voucher/priceadd');
             }
-         else {
+        } else {
             return View::fetch();
         }
     }
@@ -149,7 +153,8 @@ class Voucher extends AdminControl {
      * 编辑代金券面额
      */
 
-    public function priceedit() {
+    public function priceedit()
+    {
         $id = intval(input('param.priceid'));
         if ($id <= 0) {
             $this->error(lang('param_error'), 'voucher/pricelist');
@@ -161,7 +166,7 @@ class Voucher extends AdminControl {
                 'voucher_points' => input('post.voucher_points')
             ];
             $voucher_validate = ds_validate('voucher');
-            if (!$voucher_validate->scene('priceedit')->check($data)){
+            if (!$voucher_validate->scene('priceedit')->check($data)) {
                 $this->error($voucher_validate->getError());
             }
             //验证面额是否存在
@@ -169,25 +174,24 @@ class Voucher extends AdminControl {
             $voucher_points = intval(input('post.voucher_points'));
             $voucher_model = model('voucher');
             $where = array();
-            $where[]=array('voucherprice','=',$voucher_price);
-            $where[]=array('voucherprice_id','<>', $id);
+            $where[] = array('voucherprice', '=', $voucher_price);
+            $where[] = array('voucherprice_id', '<>', $id);
             $voucherprice_info = $voucher_model->getOneVoucherprice($where);
             if (!empty($voucherprice_info)) {
                 $this->error(lang('admin_voucher_price_exist'));
             }
-                $update_arr = array();
-                $update_arr['voucherprice_describe'] = trim(input('post.voucher_price_describe'));
-                $update_arr['voucherprice'] = $voucher_price;
-                $update_arr['voucherprice_defaultpoints'] = $voucher_points;
-                $rs = $voucher_model->editVoucherprice(array('voucherprice_id' => $id),$update_arr);
-                if ($rs>=0) {
-                    $this->log(lang('ds_edit') . lang('admin_voucher_priceadd') . '[' . input('post.voucher_price') . ']');
-                    dsLayerOpenSuccess(lang('ds_common_save_succ'),(string)url('voucher/pricelist'));
-                } else {
-                    $this->error(lang('ds_common_save_fail'), 'voucher/pricelist');
-                }
+            $update_arr = array();
+            $update_arr['voucherprice_describe'] = trim(input('post.voucher_price_describe'));
+            $update_arr['voucherprice'] = $voucher_price;
+            $update_arr['voucherprice_defaultpoints'] = $voucher_points;
+            $rs = $voucher_model->editVoucherprice(array('voucherprice_id' => $id), $update_arr);
+            if ($rs >= 0) {
+                $this->log(lang('ds_edit') . lang('admin_voucher_priceadd') . '[' . input('post.voucher_price') . ']');
+                dsLayerOpenSuccess(lang('ds_common_save_succ'), (string)url('voucher/pricelist'));
+            } else {
+                $this->error(lang('ds_common_save_fail'), 'voucher/pricelist');
             }
-        else {
+        } else {
             $voucher_model = model('voucher');
             $voucherprice_info = $voucher_model->getOneVoucherprice(array('voucherprice_id' => $id));
             if (empty($voucherprice_info)) {
@@ -202,14 +206,15 @@ class Voucher extends AdminControl {
      * 删除代金券面额
      */
 
-    public function pricedrop() {
+    public function pricedrop()
+    {
         $voucher_price_id = trim(input('param.voucher_price_id'));
         if (empty($voucher_price_id)) {
             $this->error(lang('param_error'), 'voucher/pricelist');
         }
         $voucher_model = model('voucher');
         $condition = array();
-        $condition[] = array('voucherprice_id','in', $voucher_price_id);
+        $condition[] = array('voucherprice_id', 'in', $voucher_price_id);
         $rs = $voucher_model->delVoucherprice($condition);
         if ($rs) {
             $this->log(lang('ds_del') . lang('admin_voucher_priceadd') . '[ID:' . $voucher_price_id . ']');
@@ -222,27 +227,28 @@ class Voucher extends AdminControl {
     /**
      * 套餐管理
      * */
-    public function quotalist() {
+    public function quotalist()
+    {
 
         //更新过期套餐的状态
         $time = TIMESTAMP;
         $voucher_model = model('voucher');
         $condition = array();
-        $condition[]=array('voucherquota_endtime','<', $time);
-        $condition[]=array('voucherquota_state','=',$this->quotastate_arr['activity'][0]);
+        $condition[] = array('voucherquota_endtime', '<', $time);
+        $condition[] = array('voucherquota_state', '=', $this->quotastate_arr['activity'][0]);
         $update = array();
         $update['voucherquota_state'] = $this->quotastate_arr['expire'][0];
-        $voucher_model->editVoucherquota($condition,$update);
+        $voucher_model->editVoucherquota($condition, $update);
 
         $param = array();
         if (trim(input('param.store_name'))) {
-            $param[] = array('voucherquota_storename','like', "%{input('param.store_name')}%");
+            $param[] = array('voucherquota_storename', 'like', "%{input('param.store_name')}%");
         }
         $state = intval(input('param.state'));
         if ($state) {
-            $param[]=array('voucherquota_state','=',$state);
+            $param[] = array('voucherquota_state', '=', $state);
         }
-        $voucherquota_list = $voucher_model->getVoucherquotaList($param,10,'voucherquota_id desc');
+        $voucherquota_list = $voucher_model->getVoucherquotaList($param, 10, 'voucherquota_id desc');
         View::assign('show_page', $voucher_model->page_info->render());
         View::assign('voucherquota_list', $voucherquota_list);
         $this->setAdminCurItem('quotalist');
@@ -252,30 +258,31 @@ class Voucher extends AdminControl {
     /**
      * 代金券列表
      */
-    public function index() {
+    public function index()
+    {
         $param = array();
         if (trim(input('param.store_name'))) {
-            $param[] = array('vouchertemplate_storename','like', "%{input('param.store_name')}%");
+            $param[] = array('vouchertemplate_storename', 'like', "%{input('param.store_name')}%");
         }
         if (trim(input('param.sdate'))) {
             $sdate = strtotime(input('param.sdate'));
-            $param[] = array('vouchertemplate_adddate','>=', $sdate);
+            $param[] = array('vouchertemplate_adddate', '>=', $sdate);
         }
         if (trim(input('param.edate'))) {
-            $edate = strtotime(input('param.edate'))+86399;
-            $param[] = array('vouchertemplate_adddate','<=', $edate);
+            $edate = strtotime(input('param.edate')) + 86399;
+            $param[] = array('vouchertemplate_adddate', '<=', $edate);
         }
         $state = intval(input('param.state'));
         if ($state) {
-            $param[]=array('vouchertemplate_state','=',$state);
+            $param[] = array('vouchertemplate_state', '=', $state);
         }
         if (input('param.recommend') === '1') {
-            $param[]=array('vouchertemplate_recommend','=',1);
+            $param[] = array('vouchertemplate_recommend', '=', 1);
         } elseif (input('param.recommend') === '0') {
-            $param[]=array('vouchertemplate_recommend','=',0);
+            $param[] = array('vouchertemplate_recommend', '=', 0);
         }
         $voucher_model = model('voucher');
-        $vouchertemplate_list = $voucher_model->getVouchertemplateList($param,'','',10,'vouchertemplate_state asc,vouchertemplate_id desc');
+        $vouchertemplate_list = $voucher_model->getVouchertemplateList($param, '', '', 10, 'vouchertemplate_state asc,vouchertemplate_id desc');
         View::assign('show_page', $voucher_model->page_info->render());
 
         View::assign('vouchertemplate_list', $vouchertemplate_list);
@@ -290,7 +297,8 @@ class Voucher extends AdminControl {
      * 代金券模版编辑
      */
 
-    public function templateedit() {
+    public function templateedit()
+    {
         $t_id = intval(input('param.tid'));
         if ($t_id <= 0) {
             $t_id = intval(input('post.tid'));
@@ -316,8 +324,8 @@ class Voucher extends AdminControl {
             $update_arr['vouchertemplate_state'] = intval(input('post.tstate')) == $this->templatestate_arr['usable'][0] ? $this->templatestate_arr['usable'][0] : $this->templatestate_arr['disabled'][0];
             $update_arr['vouchertemplate_recommend'] = intval(input('post.recommend')) == 1 ? 1 : 0;
             $condition = array();
-            $condition[] = array('vouchertemplate_id','=',$t_info['vouchertemplate_id']);
-            $rs = $voucher_model->editVouchertemplate($condition,$update_arr);
+            $condition[] = array('vouchertemplate_id', '=', $t_info['vouchertemplate_id']);
+            $rs = $voucher_model->editVouchertemplate($condition, $update_arr);
             if ($rs) {
                 $this->log(lang('ds_edit') . lang('ds_voucher_price_manage') . lang('admin_voucher_styletemplate') . '[ID:' . $t_id . ']');
                 $this->success(lang('ds_common_save_succ'), 'voucher/index');
@@ -329,7 +337,7 @@ class Voucher extends AdminControl {
             $store_class = rkcache('storeclass', true);
             View::assign('store_class', $store_class);
 
-        
+
 
             View::assign('t_info', $t_info);
             $this->setAdminCurItem('templateedit');
@@ -340,13 +348,14 @@ class Voucher extends AdminControl {
     /**
      * ajax操作
      */
-    public function ajax() {
+    public function ajax()
+    {
         $voucher_model = model('voucher');
         switch (input('param.branch')) {
             case 'vouchertemplate_recommend':
                 $voucher_model->editVouchertemplate(array('vouchertemplate_id' => intval(input('param.id'))), array(input('param.column') => intval(input('param.value'))));
                 $logtext = '';
-                if (intval(input('param.value')) == 1) {//推荐代金券
+                if (intval(input('param.value')) == 1) { //推荐代金券
                     $logtext = '推荐代金券';
                 } else {
                     $logtext = '取消推荐代金券';
@@ -364,7 +373,8 @@ class Voucher extends AdminControl {
      * @param array $array 附加菜单
      * @return
      */
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
         $menu_array = array(
             array(
                 'name' => 'index',
@@ -381,11 +391,11 @@ class Voucher extends AdminControl {
             ), array(
                 'name' => 'priceadd',
                 'text' => lang('admin_voucher_priceadd'),
-                'url' => "javascript:dsLayerOpen('".(string)url('Voucher/priceadd')."','".lang('admin_voucher_priceadd')."')"
+                'url' => "javascript:dsLayerOpen('" . (string)url('Voucher/priceadd') . "','" . lang('admin_voucher_priceadd') . "')"
             ), array(
                 'name' => 'setting',
                 'text' => lang('admin_voucher_setting'),
-                'url' => "javascript:dsLayerOpen('".(string)url('Voucher/setting')."','".lang('admin_voucher_setting')."')"
+                'url' => "javascript:dsLayerOpen('" . (string)url('Voucher/setting') . "','" . lang('admin_voucher_setting') . "')"
             ),
         );
 
@@ -404,5 +414,4 @@ class Voucher extends AdminControl {
         }
         return $menu_array;
     }
-
 }

+ 25 - 19
app/admin/controller/Vrgroupbuy.php

@@ -1,32 +1,35 @@
 <?php
 
 namespace app\admin\controller;
+
 use think\facade\View;
 use think\facade\Lang;
 
 /**
- * ============================================================================
+ 
+ * 
+ 
  * 
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
  * ----------------------------------------------------------------------------
  * 
- * ============================================================================
+ 
  * 控制器
  */
-class Vrgroupbuy extends AdminControl {
+class Vrgroupbuy extends AdminControl
+{
 
-    public function initialize() {
+    public function initialize()
+    {
         parent::initialize(); // TODO: Change the autogenerated stub
-        Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/vrgroupbuy.lang.php');
+        Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/vrgroupbuy.lang.php');
     }
 
     /*
      * 列表分类
      */
 
-    public function index() {
+    public function index()
+    {
         $vrgroupbuyclass_model = model('vrgroupbuyclass');
         $vrgroupbuyclass_list = $vrgroupbuyclass_model->getVrgroupbuyclassList();
         View::assign('vrgroupbuyclass_list', $vrgroupbuyclass_list);
@@ -38,7 +41,8 @@ class Vrgroupbuy extends AdminControl {
      * 添加分类
      */
 
-    public function class_add() {
+    public function class_add()
+    {
         if (request()->isPost()) { //添加虚拟抢购分类
             // 数据验证
             $data = [
@@ -66,11 +70,10 @@ class Vrgroupbuy extends AdminControl {
                 model('groupbuy')->dropCachedData('groupbuyvrclasses');
 
                 $this->log('添加虚拟抢购分类[ID:' . $res . ']', 1);
-                
+
                 dsLayerOpenSuccess(lang('ds_common_op_succ'));
             } else {
                 $this->error(lang('ds_common_op_fail'));
-                
             }
         } else {
             $vrgroupbuyclass_model = model('vrgroupbuyclass'); //一级分类
@@ -87,7 +90,8 @@ class Vrgroupbuy extends AdminControl {
      * 编辑分类
      */
 
-    public function class_edit() {
+    public function class_edit()
+    {
         if (request()->isPost()) {
             // 数据验证
             $data = [
@@ -109,7 +113,7 @@ class Vrgroupbuy extends AdminControl {
             }
 
             $condition = array(); //条件
-            $condition[] = array('vrgclass_id','=',intval(input('param.vrgclass_id')));
+            $condition[] = array('vrgclass_id', '=', intval(input('param.vrgclass_id')));
 
             $vrgroupbuyclass_model = model('vrgroupbuyclass');
             $result = $vrgroupbuyclass_model->editVrgroupbuyclass($condition, $params);
@@ -142,7 +146,8 @@ class Vrgroupbuy extends AdminControl {
      * 删除分类
      */
 
-    public function class_del() {
+    public function class_del()
+    {
         $vrgclass_id =  input('param.vrgclass_id');
         $vrgclass_id_array = ds_delete_param($vrgclass_id);
         if ($vrgclass_id_array == FALSE) {
@@ -162,7 +167,8 @@ class Vrgroupbuy extends AdminControl {
         ds_json_encode(10000, lang('ds_common_del_succ'));
     }
 
-    public function ajax() {
+    public function ajax()
+    {
         $field = input('param.column');
         $id = input('param.id');
         $value = input('param.value');
@@ -201,16 +207,16 @@ class Vrgroupbuy extends AdminControl {
         }
     }
 
-    protected function getAdminItemList() {
+    protected function getAdminItemList()
+    {
 
         $menu_array = array(
             array(
                 'name' => 'index', 'text' => lang('vrgroupbuy_cate_manage'), 'url' => (string)url('Vrgroupbuy/index')
             ), array(
-                'name' => 'class_add', 'text' => lang('vrgclass_add'), 'url' => "javascript:dsLayerOpen('".(string)url('Vrgroupbuy/class_add')."','".lang('vrgclass_add')."')"
+                'name' => 'class_add', 'text' => lang('vrgclass_add'), 'url' => "javascript:dsLayerOpen('" . (string)url('Vrgroupbuy/class_add') . "','" . lang('vrgclass_add') . "')"
             )
         );
         return $menu_array;
     }
-
 }

Some files were not shown because too many files changed in this diff