diff --git a/addon/futures/model/User.php b/addon/futures/model/User.php new file mode 100644 index 00000000..c3369870 --- /dev/null +++ b/addon/futures/model/User.php @@ -0,0 +1,107 @@ +site_id = (int)$site_id; + } + + /** + * Common: 获取用户列表 + * Author: wu-hui + * Time: 2023/02/23 9:33 + * @return array + * @throws \think\db\exception\DbException + */ + public function getList(){ + // 参数获取 + $page = input('page',1); + $pageSize = input('page_size',PAGE_LIST_ROWS); + $nickname = (string)input('nickname',''); + $status = (int)input('status',0);// 是否为特殊身份:2=不是,1=是 + // 条件生成 + $where = [ + ['m.site_id','=',$this->site_id], + ['m.is_delete','=',0] + ]; + if($nickname) $where[] = ['m.username|m.nickname',"like","%{$nickname}%"]; + if($status > 0) $where[] = ['fu.is_special',"=",($status == 2 ? 0 : 1 )];//是否为特殊身份:0=不是,1=是 + // 列表获取 + $field = [ + 'fu.id', + 'm.member_id', + 'IFNULL(fu.is_special,0) as is_special', + 'IFNULL(fu.violation_num,0) as violation_num', + 'IFNULL(fu.total_violation_num,0) as total_violation_num', + 'IFNULL(fu.punish_time,0) as punish_time', + 'IFNULL(fu.business_num,0) as business_num', + 'IFNULL(fu.total_business_num,0) as total_business_num', + 'm.username', + 'm.nickname', + 'm.headimg', + ]; + $result = Db::name('member') + ->alias('m') + ->join('futures_user fu','fu.member_id = m.member_id','left') + ->field($field) + ->where($where) + ->order(['m.member_id'=>'DESC']) + ->paginate(['list_rows' => $pageSize,'page' => $page]); + if($result) { + $result = $result->toArray(); + $list = [ + 'count' => $result['total'], + 'list' => $result['data'], + 'page_count' => $result['last_page'], + ]; + return $this->success($list); + } + + return $this->success(); + } + /** + * Common: 特殊身份变更 + * Author: wu-hui + * Time: 2023/02/23 9:24 + * @return array + */ + public function changeSpecial(){ + // 参数获取 + $memberId = (int)input('member_id',0); + $isSpecial = (int)input('is_special',0); + // 修改信息 + try{ + $data['is_special'] = $isSpecial == 1 ? 0 : 1; + $isHas = (int)Db::name('futures_user') + ->where('member_id',$memberId) + ->value('id'); + if($isHas > 0) Db::name('futures_user')->where('member_id',$memberId)->update($data); + else{ + $data['member_id'] = $memberId; + $data['site_id'] = $this->site_id; + $data['created_time'] = time(); + Db::name('futures_user')->insert($data); + } + + return $this->success(); + }catch(Exception $e){ + return $this->error('',$e->getMessage()); + } + } + + + + + + + + + +} \ No newline at end of file diff --git a/addon/futures/shop/controller/User.php b/addon/futures/shop/controller/User.php new file mode 100644 index 00000000..36b9937d --- /dev/null +++ b/addon/futures/shop/controller/User.php @@ -0,0 +1,46 @@ +isAjax()) return (new userModel($this->site_id))->getList(); + + $this->forthMenu(); + return $this->fetch('user/index'); + } + /** + * Common: 特殊身份变更 + * Author: wu-hui + * Time: 2023/02/23 9:33 + * @return array + */ + public function changeSpecial(){ + + return (new userModel($this->site_id))->changeSpecial(); + } + + + + + +} \ No newline at end of file diff --git a/addon/futures/shop/view/futures/index.html b/addon/futures/shop/view/futures/index.html index d7e592da..d0f91651 100644 --- a/addon/futures/shop/view/futures/index.html +++ b/addon/futures/shop/view/futures/index.html @@ -40,11 +40,7 @@ {block name="script"} + + +{/block} + +{block name="script"} + +{/block} \ No newline at end of file