浏览代码

充值金币配置,重建

lizhen_gitee 9 月之前
父节点
当前提交
b48ed67dcc

+ 3 - 88
application/admin/controller/Paygoldconfig.php

@@ -3,13 +3,9 @@
 namespace app\admin\controller;
 
 use app\common\controller\Backend;
-use think\Db;
-use think\Exception;
-use think\exception\PDOException;
-use think\exception\ValidateException;
 
 /**
- * 充值配置
+ * 充值金币配置
  *
  * @icon fa fa-circle-o
  */
@@ -26,12 +22,8 @@ class Paygoldconfig extends Backend
     {
         parent::_initialize();
         $this->model = new \app\admin\model\Paygoldconfig;
-        $typeList = [
-            'isShowList' => $this->model->getIsShowList(),
-            'isDefaultList' => $this->model->getIsDefaultList(),
-        ];
-        $this->view->assign($typeList);
-        $this->assignconfig($typeList);
+        $this->view->assign("isShowList", $this->model->getIsShowList());
+        $this->view->assign("isDefaultList", $this->model->getIsDefaultList());
     }
 
     public function import()
@@ -45,82 +37,5 @@ class Paygoldconfig extends Backend
      * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
      */
     
-    /**
-     * 添加
-     */
-    public function add()
-    {
-        if ($this->request->isPost()) {
-            $params = $this->request->post("row/a");
-            $params = $this->preExcludeFields($params);
-            if (!$params) {
-                $this->error(__('Parameter %s can not be empty', ''));
-            }
-            try {
-                //是否采用模型验证
-                if ($this->modelValidate) {
-                    $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
-                    $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
-                    $this->model->validateFailException(true)->validate($validate);
-                }
-                $result = $this->model->allowField(true)->save($params);
-                if ($result == false) {
-                   throw new Exception(__('No rows were inserted'));
-                }
-                if ($params['is_default'] == 1) {
-                    $mWhere['is_default'] = 1;
-                    Db::name('paygold_config')->where($mWhere)->update(['is_default'=>0]);
-                }
-                $this->success();
-            } catch (ValidateException|PDOException|Exception $e) {
-                $this->error($e->getMessage());
-            }
-        }
-        return $this->view->fetch();
-    }
 
-    /**
-     * 编辑
-     */
-    public function edit($ids = null)
-    {
-        $row = $this->model->get($ids);
-        if (!$row) {
-            $this->error(__('No Results were found'));
-        }
-        $adminIds = $this->getDataLimitAdminIds();
-        if (is_array($adminIds)) {
-            if (!in_array($row[$this->dataLimitField], $adminIds)) {
-                $this->error(__('You have no permission'));
-            }
-        }
-        if ($this->request->isPost()) {
-            $params = $this->request->post("row/a");
-            if (!$params) {
-                $this->error(__('Parameter %s can not be empty', ''));
-            }
-            $params = $this->preExcludeFields($params);
-            try {
-                //是否采用模型验证
-                if ($this->modelValidate) {
-                    $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
-                    $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
-                    $row->validateFailException(true)->validate($validate);
-                }
-                if ($params['is_default'] == 1) {
-                    $mWhere['is_default'] = 1;
-                    Db::name('paygold_config')->where($mWhere)->update(['is_default'=>0]);
-                }
-                $result = $row->allowField(true)->save($params);
-                if ($result == false) {
-                   throw new Exception(__('No rows were inserted'));
-                }
-                $this->success();
-            } catch (ValidateException|PDOException|Exception $e) {
-                $this->error($e->getMessage());
-            }
-        }
-        $this->view->assign("row", $row);
-        return $this->view->fetch();
-    }
 }

+ 1 - 0
application/admin/lang/zh-cn/paygoldconfig.php

@@ -15,4 +15,5 @@ return [
     'Is_default'    => '是否默认',
     'Is_default 0'  => '否',
     'Is_default 1'  => '是',
+    'Jewel'         => '赠送钻石'
 ];

+ 9 - 5
application/admin/model/Paygoldconfig.php

@@ -26,7 +26,7 @@ class Paygoldconfig extends Model
     // 追加属性
     protected $append = [
         'is_show_text',
-        'is_default_text',
+        'is_default_text'
     ];
     
 
@@ -36,6 +36,11 @@ class Paygoldconfig extends Model
         return ['1' => __('Is_show 1'), '0' => __('Is_show 0')];
     }
 
+    public function getIsDefaultList()
+    {
+        return ['0' => __('Is_default 0'), '1' => __('Is_default 1')];
+    }
+
 
     public function getIsShowTextAttr($value, $data)
     {
@@ -44,10 +49,7 @@ class Paygoldconfig extends Model
         return isset($list[$value]) ? $list[$value] : '';
     }
 
-    public function getIsDefaultList()
-    {
-        return ['1' => __('Is_default 1'), '0' => __('Is_default 0')];
-    }
+
     public function getIsDefaultTextAttr($value, $data)
     {
         $value = $value ? $value : (isset($data['is_default']) ? $data['is_default'] : '');
@@ -56,4 +58,6 @@ class Paygoldconfig extends Model
     }
 
 
+
+
 }

+ 20 - 12
application/admin/view/paygoldconfig/add.html

@@ -31,16 +31,6 @@
         </div>
     </div>
     <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Is_default')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <select  id="c-is_default" data-rule="required" class="form-control selectpicker" name="row[is_default]">
-                {foreach name="isDefaultList" item="vo"}
-                <option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
-                {/foreach}
-            </select>
-        </div>
-    </div>
-    <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Weight')}:</label>
         <div class="col-xs-12 col-sm-8">
             <input id="c-weight" class="form-control" name="row[weight]" type="number" value="1">
@@ -52,18 +42,36 @@
             <input id="c-first_gold" class="form-control" name="row[first_gold]" type="number" value="0">
         </div>
     </div>
-    <!--<div class="form-group">
+    <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('First_vipdays')}:</label>
         <div class="col-xs-12 col-sm-8">
             <input id="c-first_vipdays" class="form-control" name="row[first_vipdays]" type="number" value="0">
         </div>
-    </div>-->
+    </div>
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Vip_gold')}:</label>
         <div class="col-xs-12 col-sm-8">
             <input id="c-vip_gold" class="form-control" name="row[vip_gold]" type="number" value="0">
         </div>
     </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Is_default')}:</label>
+        <div class="col-xs-12 col-sm-8">
+                        
+            <select  id="c-is_default" data-rule="required" class="form-control selectpicker" name="row[is_default]">
+                {foreach name="isDefaultList" item="vo"}
+                    <option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
+                {/foreach}
+            </select>
+
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Jewel')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-jewel" class="form-control" name="row[jewel]" type="number" value="0">
+        </div>
+    </div>
     <div class="form-group layer-footer">
         <label class="control-label col-xs-12 col-sm-2"></label>
         <div class="col-xs-12 col-sm-8">

+ 20 - 12
application/admin/view/paygoldconfig/edit.html

@@ -31,16 +31,6 @@
         </div>
     </div>
     <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Is_default')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <select  id="c-is_default" data-rule="required" class="form-control selectpicker" name="row[is_default]">
-                {foreach name="isDefaultList" item="vo"}
-                <option value="{$key}" {in name="key" value="$row.is_default"}selected{/in}>{$vo}</option>
-                {/foreach}
-            </select>
-        </div>
-    </div>
-    <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Weight')}:</label>
         <div class="col-xs-12 col-sm-8">
             <input id="c-weight" class="form-control" name="row[weight]" type="number" value="{$row.weight|htmlentities}">
@@ -52,18 +42,36 @@
             <input id="c-first_gold" class="form-control" name="row[first_gold]" type="number" value="{$row.first_gold|htmlentities}">
         </div>
     </div>
-    <!--<div class="form-group">
+    <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('First_vipdays')}:</label>
         <div class="col-xs-12 col-sm-8">
             <input id="c-first_vipdays" class="form-control" name="row[first_vipdays]" type="number" value="{$row.first_vipdays|htmlentities}">
         </div>
-    </div>-->
+    </div>
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Vip_gold')}:</label>
         <div class="col-xs-12 col-sm-8">
             <input id="c-vip_gold" class="form-control" name="row[vip_gold]" type="number" value="{$row.vip_gold|htmlentities}">
         </div>
     </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Is_default')}:</label>
+        <div class="col-xs-12 col-sm-8">
+                        
+            <select  id="c-is_default" data-rule="required" class="form-control selectpicker" name="row[is_default]">
+                {foreach name="isDefaultList" item="vo"}
+                    <option value="{$key}" {in name="key" value="$row.is_default"}selected{/in}>{$vo}</option>
+                {/foreach}
+            </select>
+
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Jewel')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-jewel" class="form-control" name="row[jewel]" type="number" value="{$row.jewel|htmlentities}">
+        </div>
+    </div>
     <div class="form-group layer-footer">
         <label class="control-label col-xs-12 col-sm-2"></label>
         <div class="col-xs-12 col-sm-8">

+ 1 - 1
application/api/controller/Notify.php

@@ -27,7 +27,7 @@ class Notify extends Api
         //验证,拿订单号等信息
         $data = $pay->verify();
         $out_trade_no = $data['out_trade_no'];
-        
+
         //订单查询
         $info = Db::name('pay_order')->where('pay_no',$out_trade_no)->find();
 

+ 4 - 3
public/assets/js/backend/paygoldconfig.js

@@ -8,7 +8,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     index_url: 'paygoldconfig/index' + location.search,
                     add_url: 'paygoldconfig/add',
                     edit_url: 'paygoldconfig/edit',
-//                    del_url: 'paygoldconfig/del',
+                    del_url: 'paygoldconfig/del',
                     multi_url: 'paygoldconfig/multi',
                     import_url: 'paygoldconfig/import',
                     table: 'paygold_config',
@@ -30,11 +30,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'gold', title: __('Gold')},
                         {field: 'title', title: __('Title'), operate: 'LIKE'},
                         {field: 'is_show', title: __('Is_show'), searchList: {"1":__('Is_show 1'),"0":__('Is_show 0')}, formatter: Table.api.formatter.normal},
-                        {field: 'is_default', title: __('Is_default'), searchList: Config.isDefaultList, formatter: Table.api.formatter.normal},
                         {field: 'weight', title: __('Weight')},
                         {field: 'first_gold', title: __('First_gold')},
-                        // {field: 'first_vipdays', title: __('First_vipdays')},
+                        {field: 'first_vipdays', title: __('First_vipdays')},
                         {field: 'vip_gold', title: __('Vip_gold')},
+                        {field: 'is_default', title: __('Is_default'), searchList: {"0":__('Is_default 0'),"1":__('Is_default 1')}, formatter: Table.api.formatter.normal},
+                        {field: 'jewel', title: __('Jewel')},
                         {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                     ]
                 ]