Browse Source

好评有礼审核送金币

lizhen_gitee 1 year ago
parent
commit
70497262b0

+ 48 - 1
application/admin/controller/Appcomment.php

@@ -3,7 +3,7 @@
 namespace app\admin\controller;
 
 use app\common\controller\Backend;
-
+use think\Db;
 /**
  * 好评有礼
  *
@@ -71,4 +71,51 @@ class Appcomment extends Backend
         return $this->view->fetch();
     }
 
+    /**
+     * 审核
+     */
+    public function audit(){
+        $id = input('id');
+        $info = Db::name('app_comment')
+            ->where('id',$id)
+            ->find();
+
+        if ($this->request->isPost()) {
+            $status = input('status',0);
+            $data = [
+                'status' => $status,
+                'auditremark' => input('auditremark',''),
+                'audittime' => strtotime(input('auditremark')),
+                'updatetime' => time(),
+            ];
+            Db::startTrans();
+            $rs = Db::name('app_comment')->where('id',$id)->update($data);
+
+
+            if($status == 1){
+
+                $gift_gold = config('site.comment_for_gold_price') ?: 0;
+                if($gift_gold > 0){
+                    $wallet_rs = model('wallet')->lockChangeAccountRemain($info['user_id'],'gold',$gift_gold,70,'好评有礼');
+                    if($wallet_rs['status'] === false){
+                        Db::rollback();
+                        $this->error($wallet_rs['msg']);
+                    }
+                }
+
+                //系统消息
+                $msg_id = \app\common\model\Message::addMessage($info['user_id'],'好评有礼','好评有礼审核通过');
+            }elseif($status == 2){
+                //系统消息
+                $msg_id = \app\common\model\Message::addMessage($info['user_id'],'好评有礼','好评有礼审核不通过。'.$data['auditremark']);
+            }
+            Db::commit();
+
+            $this->success('审核完成');
+        }
+
+        $this->assign('row',$info);
+        return $this->view->fetch();
+    }
+
 }

+ 61 - 0
application/admin/view/appcomment/audit.html

@@ -0,0 +1,61 @@
+<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-user_id" data-rule="required" disabled data-source="user/user/index" data-field="username" class="form-control selectpage" name="row[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">{:__('Images')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <div class="input-group">
+                <input id="c-images" class="form-control" size="50" name="row[images]" type="text" value="{$row.images|htmlentities}">
+                <div class="input-group-addon no-border no-padding">
+                    <span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
+                    <span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
+                </div>
+                <span class="msg-box n-right" for="c-images"></span>
+            </div>
+            <ul class="row list-inline faupload-preview" id="p-images"></ul>
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Platform')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-platform" class="form-control" disabled name="row[platform]" type="text" value="{$row.platform|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            
+            <div class="radio">
+            {foreach name="statusList" item="vo"}
+            <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="status" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label>
+            {/foreach}
+            </div>
+
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Audittime')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-audittime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="audittime" type="text" value="{:$row.audittime?datetime($row.audittime):''}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Auditremark')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-auditremark" class="form-control" name="auditremark" type="text" value="{$row.auditremark|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">
+            <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>

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

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

+ 2 - 2
application/common/library/Auth.php

@@ -268,8 +268,8 @@ class Auth
                 if($intro_gold > 0){
                     $wallet_rs = model('wallet')->lockChangeAccountRemain($extend['intro_uid'],'gold',$intro_gold,63,'邀请'.$this->_user->username);
                     if($wallet_rs['status'] === false){
-                        $this->setError($wallet_rs['msg']);
                         Db::rollback();
+                        $this->setError($wallet_rs['msg']);
                         return false;
                     }
                 }
@@ -344,8 +344,8 @@ class Auth
                 if($intro_gold > 0){
                     $wallet_rs = model('wallet')->lockChangeAccountRemain($extend['intro_uid'],'gold',$intro_gold,63,'邀请'.$this->_user->username);
                     if($wallet_rs['status'] === false){
-                        $this->setError($wallet_rs['msg']);
                         Db::rollback();
+                        $this->setError($wallet_rs['msg']);
                         return false;
                     }
                 }

+ 1 - 0
application/extra/site.php

@@ -71,4 +71,5 @@ return array (
 3、提现扣除手续费1%
 4、相关额度会在1个工作日内审核发放,请注意查收',
   'intro_newuser_gift_goldnum' => '100',
+  'app_comment_audit_goldnum' => '50',
 );

+ 2 - 0
application/extra/wallet.php

@@ -27,6 +27,8 @@ return [
         61 => '完成个人任务',
         63 => '邀请注册奖励',//gold +
 
+        70 => '好评有礼',//gold +
+
     ],
     'moneyname' => [
         'money'    => '余额',

+ 20 - 2
public/assets/js/backend/appcomment.js

@@ -7,7 +7,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 extend: {
                     index_url: 'appcomment/index' + location.search,
                     add_url: 'appcomment/add',
-                    edit_url: 'appcomment/edit',
+//                    edit_url: 'appcomment/edit',
                     del_url: 'appcomment/del',
                     multi_url: 'appcomment/multi',
                     import_url: 'appcomment/import',
@@ -36,7 +36,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'auditremark', title: __('Auditremark'), operate: 'LIKE'},
                         {field: 'user.username', title: __('User.username'), operate: 'LIKE'},
                         {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
-                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                        {field: 'operate', title: __('Operate'), table: table,
+                            buttons:[
+                                {
+                                    name:'audit',
+                                    text:'审核',
+                                    title:'审核',
+                                    icon:'fa fa-exclamation-circle',
+                                    classname:'btn btn-xs btn-info btn-dialog',
+                                    url:'appcomment/audit/id/{ids}?dialog=1',
+                                    target:'_self',
+                                    hidden:function($row){
+                                        return $row.status == 0 ? false : true;
+                                    }
+                                }
+                            ],
+                            events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                     ]
                 ]
             });
@@ -44,6 +59,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             // 为表格绑定事件
             Table.api.bindevent(table);
         },
+        audit: function () {
+            Controller.api.bindevent();
+        },
         add: function () {
             Controller.api.bindevent();
         },