afa 6 сар өмнө
parent
commit
390de1a1ba

+ 56 - 4
application/admin/controller/user/Userpledge.php

@@ -6,6 +6,10 @@ use app\common\controller\Backend;
 use app\common\model\ProductLists;
 use think\exception\DbException;
 use think\response\Json;
+use Exception;
+use think\Db;
+use think\exception\PDOException;
+use think\exception\ValidateException;
 
 /**
  * 用户存储列表 TeamRewards
@@ -71,13 +75,61 @@ class Userpledge extends Backend
         if ($this->request->isAjax()) {
             $this->success("Ajax请求成功", null, ['id' => $ids]);
         }
-        //$product = new ProductLists();
         $details = json_decode($row->details, true);
-        // foreach ($details as &$detail) {
-        //     $detail['name'] = $product::where('id', $detail['id'])->value('zh_name');
-        // }
         $this->view->assign("row", $details);
         return $this->view->fetch();
     }
 
+
+    /**
+     * 编辑
+     *
+     * @param $ids
+     * @return string
+     * @throws DbException
+     * @throws \think\Exception
+     */
+    public function cancel($ids = null)
+    {
+        $row = $this->model->get($ids);
+        if (!$row) {
+            $this->error(__('No Results were found'));
+        }
+        $adminIds = $this->getDataLimitAdminIds();
+        if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
+            $this->error(__('You have no permission'));
+        }
+        if (false === $this->request->isPost()) {
+            $this->view->assign('row', $row);
+            return $this->view->fetch();
+        }
+        $params = $this->request->post('row/a');
+        if (empty($params)) {
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        if ($params['type_id'] == '1' && strpos($params['product_id'] , ',') !== false) {
+            $this->error(__('单品只能选择一个质押产品'));
+        }
+        $params = $this->preExcludeFields($params);
+        $result = false;
+        Db::startTrans();
+        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()->validate($validate);
+            }
+            $result = $row->allowField(true)->save($params);
+            Db::commit();
+        } catch (ValidateException|PDOException|Exception $e) {
+            Db::rollback();
+            $this->error($e->getMessage());
+        }
+        if (false === $result) {
+            $this->error(__('No rows were updated'));
+        }
+        $this->success();
+    }
+
 }

+ 14 - 11
application/config.php

@@ -324,16 +324,19 @@ return [
     'min_frozen'          => 9.9, //最小保留标记金额
     //提现说明
     'withdraw_desc'       => "
-        1. 茶宝提现指的是将茶宝转化为 USDT,并提到指定地址。
-        2. 提现后由平台管理员审核,如无异常将于48小时之内完成审核并转入提现地址,您可在右上角明细中查看订单进度。
-        3. 主网现阶段默认且仅支持币安链提现地址,请务必保证地址准确无误,否则将造成资产无法找回。
-        4. 请确保转出地址和数额无误,如因提现地址填写错误造成的损失由用户自行承担。
+        1. 茶宝提现指的是将茶宝转化为 USDT,并提到指定地址。<br/>
+        2. 提现后由平台管理员审核,如无异常将于48小时之内完成审核并转入提现地址,您可在右上角明细中查看订单进度。br/>
+        3. 主网现阶段默认且仅支持币安链提现地址,请务必保证地址准确无误,否则将造成资产无法找回。br/>
+        4. 请确保转出地址和数额无误,如因提现地址填写错误造成的损失由用户自行承担。br/>
         5. 提现手续费:300 茶宝以内每笔 3 茶宝,300 茶宝以上 1%。",
     //市场配置 
     'market_transfer' => [
         'lock_time'         => 180, //锁定时间秒
         'min_buy_price'     => 10,  //最小求购价格
-        'serve_desc'        => "服务描述",
+        'serve_desc'        => '求购说明<br/>
+            1.预付成功后,可在"我的﹣求购订单"中取消订单。br/>
+            2.成交顺序以发起求购成功的时间,顺序成交。br/>
+            3.求购期间成交,无法撤销。',
         'serve_fee'         => 0.045, //服务费
         'max_buying_count'  => 10, //最大求购套数
         'zh_serve_agree'      => 217, //中文服务协议id
@@ -347,13 +350,13 @@ return [
         'buy_min_price'          => 0.01,    //最小求购价格
         'buy_min_num'            => 100,    //最小求购数量
         'buy_serve_fee'          => 0.05, //求购服务费
-        'sell_desc'              => "出售说明:
-            1.TeaC未经购买前,可取消出售订单。一经购买,无法取消出售。
-            2. 您将获得除综合服务费(5%)之外的所有出售收入。
+        'sell_desc'              => "出售说明:br/>
+            1.TeaC未经购买前,可取消出售订单。一经购买,无法取消出售。br/>
+            2. 您将获得除综合服务费(5%)之外的所有出售收入。br/>
             3. 出售成功后,出售收入将默认进入茶宝账户余额。",
-        'buy_desc'               => "求购说明:
-            1. 预付成功后,可在’我的订单﹣求购订单‘中取消订单。
-            2.成交顺序以发起求购成功的时间,顺序成交。
+        'buy_desc'               => "求购说明:br/>
+            1. 预付成功后,可在’我的订单﹣求购订单‘中取消订单。br/>
+            2.成交顺序以发起求购成功的时间,顺序成交。br/>
             3.求购期间成交,无法撤销。",   //求购说明
     ],
 ];

+ 8 - 1
public/assets/js/backend/user/userpledge.js

@@ -34,6 +34,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'update_time', title: __('Updatetime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
                         { field: 'operate', title: __('Operate'),
                             buttons:[
+                                {
+                                    classname: 'btn btn-xs btn-danger btn-dialog',
+                                    name: '取消详情',
+                                    text: __('取消详情'),
+                                    title: __('取消详情'),
+                                    url: 'user/userpledge/cancel',
+                                },
                                 {
                                     classname: 'btn btn-xs btn-info btn-dialog',
                                     name: '存储详情',
@@ -53,7 +60,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             // 为表格绑定事件
             Table.api.bindevent(table);
         },
-        add: function () {
+        cancel: function () {
             Controller.api.bindevent();
         },
         edit: function () {