Browse Source

后台处理投诉 影集接口

15954078560 3 years ago
parent
commit
14a3dbad69

+ 59 - 0
application/admin/controller/user/Report.php

@@ -3,6 +3,7 @@
 namespace app\admin\controller\user;
 
 use app\common\controller\Backend;
+use Think\Db;
 
 /**
  * 用户举报管理
@@ -73,4 +74,62 @@ class Report extends Backend
         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) {
+                $params = $this->preExcludeFields($params);
+                $result = false;
+                Db::startTrans();
+                if ($params['status'] == 1) {
+                    //发送通知
+                    $title = '举报处理结果';
+                    $content = '您的举报后台已经处理,备注:' . $params['remarks'];
+                    \app\common\model\SysMsg::sendSysMsg($row['user_id'],9,$title,$content);
+                }
+
+                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);
+                    }
+                    $result = $row->allowField(true)->save($params);
+                    Db::commit();
+                } catch (ValidateException $e) {
+                    Db::rollback();
+                    $this->error($e->getMessage());
+                } catch (PDOException $e) {
+                    Db::rollback();
+                    $this->error($e->getMessage());
+                } catch (Exception $e) {
+                    Db::rollback();
+                    $this->error($e->getMessage());
+                }
+                if ($result !== false) {
+                    $this->success();
+                } else {
+                    $this->error(__('No rows were updated'));
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $this->view->assign("row", $row);
+        return $this->view->fetch();
+    }
 }

+ 1 - 1
application/admin/model/user/User.php

@@ -40,7 +40,7 @@ class User extends Model
     
     public function getGenderList()
     {
-        return ['1' => __('Gender 1'), '-1' => __('Gender -1')];
+        return ['1' => __('Gender 1'), '0' => __('Gender -1')];
     }
 
     public function getIsAuthList()

+ 21 - 7
application/admin/view/user/report/edit.html

@@ -3,46 +3,60 @@
     <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" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
+            <input id="c-user_id" data-rule="required" disabled data-source="user/user/index" data-field="nickname" 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">{:__('Ruser_id')}:</label>
         <div class="col-xs-12 col-sm-8">
-            <input id="c-ruser_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[ruser_id]" type="text" value="{$row.ruser_id|htmlentities}">
+            <input id="c-ruser_id" data-rule="required" disabled data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[ruser_id]" type="text" value="{$row.ruser_id|htmlentities}">
         </div>
     </div>
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Type_id')}:</label>
         <div class="col-xs-12 col-sm-8">
-            <input id="c-type_id" data-rule="required" data-source="website/reporttype/index" class="form-control selectpage" name="row[type_id]" type="text" value="{$row.type_id|htmlentities}">
+            <input id="c-type_id" data-rule="required" disabled data-source="website/reporttype/index" class="form-control selectpage" name="row[type_id]" type="text" value="{$row.type_id|htmlentities}">
         </div>
     </div>
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
         <div class="col-xs-12 col-sm-8">
-            <input id="c-content" class="form-control" name="row[content]" type="text" value="{$row.content|htmlentities}">
+            <input id="c-content" class="form-control" readonly name="row[content]" type="text" value="{$row.content|htmlentities}">
         </div>
     </div>
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
         <div class="col-xs-12 col-sm-8">
             <div class="input-group">
-                <input id="c-image" class="form-control" size="50" name="row[image]" type="text" value="{$row.image|htmlentities}">
+                <input id="c-image" class="form-control" readonly size="50" name="row[image]" type="text" value="{$row.image|htmlentities}">
                 <div class="input-group-addon no-border no-padding">
-                    <span><button type="button" id="faupload-image" class="btn btn-danger faupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
-                    <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
+                    <span><button type="button" id="faupload-image" disabled class="btn btn-danger faupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
+                    <span><button type="button" id="fachoose-image" disabled class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                 </div>
                 <span class="msg-box n-right" for="c-image"></span>
             </div>
             <ul class="row list-inline faupload-preview" id="p-image"></ul>
         </div>
     </div>
+    <div class="form-group">
+        <label for="content" class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            {:build_radios('row[status]', ['0'=>__('待处理'), '1'=>__('已处理')], $row['status'])}
+        </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-remarks" data-rule="required" class="form-control" name="row[remarks]" maxlength="255" type="text" value="{$row.remarks|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">
+            {if $row['status'] === 0}
             <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
             <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+            {/if}
         </div>
     </div>
 </form>

+ 27 - 1
application/admin/view/user/user/edit.html

@@ -50,7 +50,33 @@
             <input id="c-age" class="form-control" name="row[age]" type="text" value="{$row.age|htmlentities}">
         </div>
     </div>
-<!--    <div class="form-group">-->
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('省市区')}:</label>
+        <div class="form-inline col-xs-12 col-sm-8" data-toggle="cxselect" data-selects="province,city,area">
+            <select class="province form-control" name="province" data-url="ajax/area">
+                <option value="{$row.province}" selected="">{$row.province_name}</option>
+            </select>
+            <select class="city form-control" name="city" data-url="ajax/area">
+                <option value="{$row.city}" selected="">{$row.city_name}</option>
+            </select>
+            <select class="area form-control" name="area" data-url="ajax/area">
+                <option value="{$row.district}" selected="">{$row.district_name}</option>
+            </select>
+        </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-lng" class="form-control" name="row[lng]" type="text" value="{$row.lng|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-lat" class="form-control" name="row[lat]" type="text" value="{$row.lat|htmlentities}">
+        </div>
+    </div>
+    <!--    <div class="form-group">-->
 <!--        <label class="control-label col-xs-12 col-sm-2">{:__('Money')}:</label>-->
 <!--        <div class="col-xs-12 col-sm-8">-->
 <!--            <input id="c-money" data-rule="required" class="form-control" step="0.01" name="row[money]" type="number" value="{$row.money|htmlentities}">-->

+ 13 - 3
application/api/controller/Eyemargin.php

@@ -123,10 +123,11 @@ class Eyemargin extends Common
      * 获取眼缘视频/影集
      */
     public function getFate() {
+        $is_city = $this->request->request('is_city'); // 是否同城:1=是,0=否
         $is_goddess = $this->request->request('is_goddess'); // 是否女神:1=是,0=否
         $is_new = $this->request->request('is_new'); // 是否新人:1=是,0=否
         $is_neal = $this->request->request('is_neal'); // 是否附近:1=是,0=否
-        if (!in_array($is_goddess,[0,1]) && !in_array($is_new,[0,1]) && !in_array($is_neal,[0,1])) {
+        if (!in_array($is_city,[0,1]) && !in_array($is_goddess,[0,1]) && !in_array($is_new,[0,1]) && !in_array($is_neal,[0,1])) {
             $this->error(__('请选择展示tab!'));
         }
         $pageNum = $this->request->request('pageNum',10); // 每页显示条数
@@ -138,12 +139,21 @@ class Eyemargin extends Common
         $time = time() - 30*86400;
         $common_where = [];
 //        $common_where['u.avatar'] = ['like', 'https%'];
-        $common_where['a.is_main'] = 1;
+        if (!$is_city) {
+            $common_where['a.is_main'] = 1;
+        }
         $common_where['a.status'] = 1;
         $common_where['u.city'] = $this->auth->city;
         $is_goddess && $common_where['u.is_goddess'] = 1;
         $is_new && $common_where['u.createtime'] = ['gt',$time];
-        $common_where['a.status'] = 1;
+        if ($this->auth->gender == 1) {
+            //男只能看女视频
+            $common_where['u.gender'] = 0;
+            $common_where['u.wechat'] = ['neq', '']; //女生微信号必须审核通过
+        } else {
+            //女只能看男视频
+            $common_where['u.gender'] = 1;
+        }
 
         $field = "a.*,u.avatar,u.city_name,u.district_name,u.nickname,u.is_goddess,u.is_auth,vipStatus(u.vip_duetime) as is_vip, 
         u.age,u.constellation,u.hobby_ids,u.profession,u.declaration,u.lng,u.lat,u.mobile,u.copy_mobile,u.wechat,u.gender,u.profession";

+ 103 - 5
application/api/controller/User.php

@@ -451,10 +451,10 @@ class User extends Api
     public function userAvatar()
     {
         $user = $this->auth->getUser();
-        $gender = $this->request->request('gender'); // 性别:1=男,-1=女
+        $gender = $this->request->request('gender'); // 性别:1=男,0=女
         $nickname_auth = $this->request->request('nickname');
         $avatar_auth = $this->request->request('avatar');
-        if (!$gender && !$nickname_auth && !$avatar_auth) $this->error('参数为空!');
+        if (!in_array($gender, [0, 1]) && !$nickname_auth && !$avatar_auth) $this->error('参数为空!');
         // 随机获取昵称和头像
         if(!$user->nickname && !$nickname_auth) {
             $nicknameList = \app\admin\model\website\Nickname::select();//得到总条数
@@ -502,7 +502,7 @@ class User extends Api
                 $data['createtime'] = time();
                 $res1 = \app\common\model\AvatarAuth::insert($data);
             }
-            $gender && $user->gender = $gender;
+            in_array($gender, [0, 1]) && $user->gender = $gender;
             $res2 = $user->save();
             if($res1 && $res2 !== false) {
                 Db::commit();
@@ -871,7 +871,7 @@ class User extends Api
                 }
 
                 // 添加返利
-                if ($fate_user['gender'] == -1) {
+                if ($fate_user['gender'] == 0) {
                     //女的返钱
                     if ($user->is_goddess == 1) {
                         $memo = '被查看有眼缘获得收益!';
@@ -1640,7 +1640,7 @@ class User extends Api
                 }
 
                 // 添加返利
-                if ($fate_user['gender'] == -1) {
+                if ($fate_user['gender'] == 0) {
                     //女的返钱
                     if ($user->is_goddess == 1) {
                         $memo = '被查看有眼缘获得收益!';
@@ -1723,4 +1723,102 @@ class User extends Api
 
         $this->success('设置成功', $status);
     }
+
+    //查询是否可以聊天
+    public function getchatstatus() {
+        if ($this->auth->gender == 0) {
+            $this->success('可以聊天', '1');
+        }
+
+        $other_user_id = input('other_user_id', 0, 'intval');
+        if (!$other_user_id) {
+            $this->error('参数缺失');
+        }
+        if ($this->auth->id == $other_user_id) {
+            $this->error('这是您自己');
+        }
+
+        $info = Db::name('user')->find($other_user_id);
+        if (!$info) {
+            $this->error('用户不存在');
+        }
+        //查询是否有眼缘
+        $fate_count = Db::name('user_fate')->where(['user_id' => $this->auth->id, 'fate_user_id' => $other_user_id, 'createtime' => ['egt', time() - 86400]])->count('id');
+        if ($fate_count) {
+            $this->success('可以聊天', '1');
+        }
+        //查询是否支付过
+        $pay_count = Db::name('user_chat_pay')->where(['user_id' => $this->auth->id, 'chat_user_id' => $other_user_id])->count('id');
+        if ($pay_count) {
+            $this->success('可以聊天', '1');
+        }
+
+        $this->success('请先支付', '0');
+    }
+
+    //男士支付聊天钻石
+    public function paychat() {
+        $other_user_id = input('other_user_id', 0, 'intval');
+        if (!$other_user_id) {
+            $this->error('参数缺失');
+        }
+        if ($this->auth->id == $other_user_id) {
+            $this->error('这是您自己');
+        }
+        $info = Db::name('user')->find($other_user_id);
+        if (!$info) {
+            $this->error('用户不存在');
+        }
+        //查询是否支付过
+        $pay_count = Db::name('user_chat_pay')->where(['user_id' => $this->auth->id, 'chat_user_id' => $other_user_id])->count('id');
+        if ($pay_count) {
+            $this->error('已经支付过');
+        }
+        $manpaychat = (int)config('site.manpaychat'); //男士被查看有眼缘(未添加对方时)回复聊天支付钻石数量
+        if ($manpaychat <= 0) {
+            $this->error('支付数量异常,请联系管理员');
+        }
+        if ($this->auth->diamond < $manpaychat) {
+            $this->error(__('钻石余额不足,请先充值!'), [],100);
+        }
+
+        //开启事务
+        Db::startTrans();
+        //修改用户钻石余额
+        $user = Db::name('user')->find($this->auth);
+        $diamond = $user['diamond'] - $manpaychat;
+        $res1 = Db::name('user')->where(['id' => $user['id'], 'diamond' => $user['diamond']])->setField('diamond', $diamond);
+        // 添加钻石明细
+        $diamond_log = Db::name('user_diamond_log')->where(['user_id' => $user['id']])->order('id', 'desc')->find();
+        if (!$diamond_log && $user['diamond'] > 0) {
+            Db::rollback();
+            $this->error('钻石余额异常');
+        }
+        if ($diamond_log && $diamond_log['after'] != $user['diamond']) {
+            Db::rollback();
+            $this->error('钻石余额异常');
+        }
+        $_data['user_id'] = $user['id'];
+        $_data['diamond'] = -$manpaychat;
+        $_data['before'] = $user['diamond'];
+        $_data['after'] = $diamond;
+        $_data['memo'] = '支付聊天';
+        $_data['createtime'] = time();
+        $res2 = Db::name('user_diamond_log')->insertGetId($_data);
+        //添加支付记录
+        $chat_pay['user_id'] = $user['id'];
+        $chat_pay['chat_user_id'] = $other_user_id;
+        $chat_pay['createtime'] = time();
+        $res3 = Db::name('user_chat_pay')->insertGetId($chat_pay);
+
+        if ($res1 && $res2 && $res3) {
+            Db::commit();
+            $this->success('支付成功');
+        }
+
+        Db::rollback();
+        $this->error('支付失败');
+    }
+
+
 }

+ 3 - 0
public/assets/js/backend/user/report.js

@@ -35,6 +35,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
                         {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                         {field: 'reporttype.name', title: __('Reporttype.name'), operate: 'LIKE'},
+                        {field: 'status', title: __('状态'), formatter: Table.api.formatter.status, searchList: {"0":__('待处理'),"1":__('已处理')},
+                            custom: {1:'success'}},
+                        {field: 'remarks', title: __('备注'), operate: 'LIKE'},
                         {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                     ]
                 ]

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

@@ -27,7 +27,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
                         {field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
                         {field: 'avatar', title: __('Avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
-                        {field: 'gender', title: __('Gender'), searchList: {"1":__('Gender 1'),"-1":__('Gender -1')}, formatter: Table.api.formatter.normal},
+                        {field: 'gender', title: __('Gender'), searchList: {"1":__('Gender 1'),"0":__('Gender -1')}, formatter: Table.api.formatter.normal},
                         {field: 'birthday', title: __('Birthday'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
                         {field: 'age', title: __('Age'), operate: 'LIKE'},
                         {field: 'province_name', title: __('Province_name'), operate: 'LIKE'},