Sfoglia il codice sorgente

超推增减金币

lizhen_gitee 11 mesi fa
parent
commit
024df6fc57

+ 32 - 1
application/admin/controller/Agent.php

@@ -3,7 +3,7 @@
 namespace app\admin\controller;
 
 use app\common\controller\Backend;
-
+use think\Db;
 /**
  * 会员管理
  *
@@ -65,6 +65,7 @@ class Agent extends Backend
             $list = $this->model
                     ->with(['usergroup','userwallet'])
                     ->where($where)
+                    ->where('agent.group_id','neq',1)
                     ->order($sort, $order)
                     ->paginate($limit);
 
@@ -81,4 +82,34 @@ class Agent extends Backend
         return $this->view->fetch();
     }
 
+    /**
+     * 代理收益金币
+     */
+    public function updateagentjewel(){
+        $id = input('id');
+        $info = Db::name('user_wallet')
+            ->where('id',$id)
+            ->find();
+
+        if ($this->request->isPost()) {
+
+            $user_id = input('user_id');
+            $agentjewel = input('agentjewel');
+            $remark = input('remark','后台调节');
+
+            Db::startTrans();
+            $rs = model('wallet')->lockChangeAccountRemain($user_id,'agentjewel',$agentjewel,5,$remark);
+            if($rs['status'] === false){
+                Db::rollback();
+                $this->error($rs['msg']);
+            }
+
+            Db::commit();
+            $this->success('充值完成');
+        }
+
+        $this->assign('row',$info);
+        return $this->view->fetch();
+    }
+
 }

+ 1 - 0
application/admin/view/agent/index.html

@@ -35,6 +35,7 @@
                     <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
                            data-operate-edit="{:$auth->check('agent/edit')}" 
                            data-operate-del="{:$auth->check('agent/del')}" 
+                           data-operate-updateagentjewel="{:$auth->check('agent/updateagentjewel')}"
                            width="100%">
                     </table>
                 </div>

+ 32 - 0
application/admin/view/agent/updateagentjewel.html

@@ -0,0 +1,32 @@
+<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+    <input type="hidden" name="id" value="{$row.id}">
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">用户:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-user_id" disabled data-rule="required" data-source="user/user/index" data-field="username" class="form-control selectpage" name="user_id" type="text" value="{$row.user_id|htmlentities}">
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">增加代理收益金币:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-jewel" data-rule="required" class="form-control" name="agentjewel" type="number" value="">
+            负数可以减少
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">备注:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-remark" data-rule="required" class="form-control" name="remark" type="text" value="">
+        </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">
+            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 2 - 1
application/extra/wallet.php

@@ -28,7 +28,8 @@ return [
         41 => '好友充值',//jewel + 充值的计划任务触发
         42 => '好友提现',//jewel + 提现审核通过触发
 
-///////////
+///////////////////////////////////////////////
+        5  => '系统调节', // agentjewel + -
         51 => '充值超推收益',//agentjewel + 充值的计划任务触发
         52 => '收益超推收益',//agentjewel + 收益的计划任务触发
         55 => '提现',//agentjewel - 收益的计划任务触发

+ 17 - 1
public/assets/js/backend/agent.js

@@ -83,7 +83,20 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
 //                        {field: 'charm_value', title: __('Charm_value')},
                         {field: 'userwallet.agentjewel', title: __('Userwallet.agentjewel'), operate:'BETWEEN'},
 //                        {field: 'userwallet.status', title: __('Userwallet.status')},
-                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                        {field: 'operate', title: __('Operate'), table: table,
+                            buttons:[
+                                {
+                                    name:'updateagentjewel',
+                                    text:'代理收益金币',
+                                    title:'代理收益金币',
+                                    icon:'fa fa-exclamation-circle',
+                                    classname:'btn btn-xs btn-info btn-dialog',
+                                    url:'agent/updateagentjewel/id/{ids}?dialog=1',
+                                    target:'_self',
+                                },
+
+                            ],
+                            events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                     ]
                 ]
             });
@@ -97,6 +110,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
         edit: function () {
             Controller.api.bindevent();
         },
+        updateagentjewel: function () {
+            Controller.api.bindevent();
+        },
         api: {
             bindevent: function () {
                 Form.api.bindevent($("form[role=form]"));