| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937 |
- <?php
- // +----------------------------------------------------------------------
- // | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
- // +----------------------------------------------------------------------
- // | Author: 小夏 < 449134904@qq.com>
- // +----------------------------------------------------------------------
- namespace app\admin\controller;
- use cmf\controller\AdminBaseController;
- use think\Db;
- use think\db\Query;
- use app\admin\model\BooksModel;
- use app\weixin\service\Activity;
- use app\weixin\service\PRedis;
- /**
- * Class UserController
- * @package app\admin\controller
- * @adminMenuRoot(
- * 'name' => '管理组',
- * 'action' => 'default',
- * 'parent' => 'user/AdminIndex/default',
- * 'display'=> true,
- * 'order' => 10000,
- * 'icon' => '',
- * 'remark' => '管理组'
- * )
- */
- class MarketController extends AdminBaseController
- {
- /**
- * 分销设置界面
- */
- public function marketset(){
- //查询得到分销表
- $market=Db::name('market')->where('id',1)->find();
-
- // var_dump($market);die();
- $this->assign('market', $market);
- return $this->fetch();
- }
- /**
- * 分销设置界面提交
- */
- public function marketsetpost(){
- //提交 param('level_1'),也可以相当于param['level_1'];
- $data=$this->request->param();
- $data['updated_at'] = date('Y-m-d H:i:s',time());
-
- if(Db::name('market')->where('id',1)->update($data)){
- $this->success('保存成功!');
- }else{
- $this->error('保存失败!');
- }
- }
- //分销用户显示
- public function marketuser(){
- $data = $this->request->param();
- session('search',[
- 'uid' => isset($data['uid'])? intval($data['uid']) : 0,
- 'keyword' => isset($data['keyword'])? trim($data['keyword']) : '',
- ]);
- // 添加返回历史修改 by wesmiler 2020-02-16
- $history = isset($data['history'])? intval($data['history']) : 0;
- if($history){
- $data = session('user_search');
- }else{
- session('user_search', $data);
- }
- // 修改 end
- //var_dump($data);die;
- $list = Db::name('user')->field('u.id,u.user_login,u.user_nickname,u.real_name,u.redheart,u.is_tuijian,u.create_time,u.is_heart,u.user_status,u.mobile,u.freezing,u.updated_at,last_login_time,up.idcard,
- up.idcard_check,up.position_check,up.education_check')
- ->alias('u')
- ->join('user_profile up','u.id=up.userid','left')
-
- ->where(function (Query $query) use($data){
- $query->where('u.user_type', 2);
- $query->where('u.openid', 'not in','');
- $query->where('u.agent_type',1);
- //代表是否付费定制
- ($this->request->action()=='custom' || $this->request->param('u')==2)?$query->where('u.is_vip', 1):$query->where('u.is_vip', 0);
- //代表是否冻结
- if($this->request->action()!='userlogout' && $this->request->param('u')!=5){
- ($this->request->action()=='userban' || $this->request->param('u')==3)?$query->where('u.user_status', 0):$query->where('u.user_status', 1);
- }
- //代表是否筛选
- ($this->request->action()=='screen' || $this->request->param('u')==4)?$query->where('u.is_screen', 1):$query->where('u.is_screen', 0);
- //代表是否注销
- if($this->request->action()!='userban' && $this->request->param('u')!=3){
- ($this->request->action()=='userlogout' || $this->request->param('u')==5)?$query->where('u.user_status', -1):$query->where('u.user_status', 1);
- }
- //$data = $this->request->param();
- if (!empty($data['uid'])) {
- $query->where('u.id', intval($data['uid']));
- }
- if (!empty($data['keyword'])) {
- $keyword = $data['keyword'];
- $query->where('u.user_nickname|u.real_name|u.mobile', 'like', "%$keyword%");
- }
- //年龄区间查询
- if((!empty($data['age1']) && $data['age1']!='none') && (!empty($data['age2']) && $data['age2']!='none')){
- $query->where('u.birthday',['>',strtotime($data['age1'])],['<',strtotime($data['age2'])],'and');
- $query->whereNotNull('u.birthday');
- }
- // //只有第一个年龄的情况下
- if((!empty($data['age1']) && $data['age1']!='none') && (empty($data['age2']) || $data['age2']=='none')){
- $birthday = $data['age1'];
- $query->whereRaw("YEAR(from_unixtime(u.`birthday`))=$birthday and u.birthday is not null ");
- }
- // //只有第二个年龄的情况下
- if((empty($data['age1']) || $data['age1']=='none') && (!empty($data['age2']) && $data['age2']!='none')){
- $birthday = $data['age2'];
- $query->whereRaw("YEAR(from_unixtime(u.`birthday`))=$birthday and u.birthday is not null ");
- }
- //身高区间查询
- if((!empty(input('height')) && input('height')!='none') && (!empty(input('heightt')) && input('heightt')!='none')){
- $query->where('up.height',['>',input('height')],['<',input('heightt')],'and');
- }
- //身高第一个查找
- if((!empty(input('height')) && input('height')!='none') && (empty(input('heightt')) || input('heightt')=='none')){
- $query->where('up.height',input('height'));
- }
- //身高第二个查找
- if((empty(input('height')) ||input('height')=='none') && (!empty(input('heightt')) && input('heightt')!='none')){
- $query->where('up.height',input('heightt'));
- }
- //学历
- if((!empty(input('education')) && input('education')!='none') ){
- $query->where('up.education',input('education'));
- }
- //职位
- if((!empty(input('occupation')) && input('occupation')!='none') ){
- $query->where('up.occupation',input('occupation'));
- }
- //收入
- if((!empty(input('salary')) && input('salary')!='none') ){
- $query->where('up.salary',input('salary'));
- }
- //资产
- if((!empty(input('property')) && input('property')!='none') ){
- $query->where('up.property',input('property'));
- }
- //家乡
- if((!empty(input('home_city')) && input('home_city')!='none') ){
- $query->where('up.home_province|up.home_city','like','%'.input('home_city').'%','or');
- }
- //居住地(市)
- if((!empty(input('city')) && input('city')!='none') ){
- $query->where('up.city','like','%'.input('city').'%');
- }
- //婚姻状况
- if((!empty(input('married')) && input('married')!='none') ){
- $query->where('up.married',input('married'));
- }
- //性别
- if((!empty(input('sex')) && input('sex')!='none') ){
- $query->where('u.sex',input('sex'));
- }
- })
- //待审核
- ->order("u.create_time DESC")
- ->paginate(10,false,['query'=>request()->param()]);
- // echo Db::name('user')->getLastSql();die;
- // 获取分页显示
- $page = $list->render();
- $this->assign('list', $list);
- $this->assign('page', $page);
-
- return $this->fetch();
- }
- //分销员审核
- public function marketexamine(){
- $data = $this->request->param();
- session('search',[
- 'uid' => isset($data['uid'])? intval($data['uid']) : 0,
- 'keyword' => isset($data['keyword'])? trim($data['keyword']) : '',
- ]);
- // 添加返回历史修改 by wesmiler 2020-02-16
- $history = isset($data['history'])? intval($data['history']) : 0;
- if($history){
- $data = session('user_search');
- }else{
- session('user_search', $data);
- }
- // 修改 end
- //var_dump($data);die;
- $list = Db::name('user')->field('u.id,u.user_login,u.user_nickname,u.real_name,u.redheart,u.is_tuijian,u.create_time,u.is_heart,u.user_status,u.mobile,u.freezing,u.updated_at,u.agent_create_time,last_login_time,up.idcard,
- up.idcard_check,up.position_check,up.education_check')
- ->alias('u')
- ->join('user_profile up','u.id=up.userid','left')
-
- ->where(function (Query $query) use($data){
- $query->where('u.user_type', 2);
- $query->where('u.openid', 'not in','');
- $query->where('u.agent_status',2); //待审核
- //代表是否付费定制
- ($this->request->action()=='custom' || $this->request->param('u')==2)?$query->where('u.is_vip', 1):$query->where('u.is_vip', 0);
- //代表是否冻结
- if($this->request->action()!='userlogout' && $this->request->param('u')!=5){
- ($this->request->action()=='userban' || $this->request->param('u')==3)?$query->where('u.user_status', 0):$query->where('u.user_status', 1);
- }
- //代表是否筛选
- ($this->request->action()=='screen' || $this->request->param('u')==4)?$query->where('u.is_screen', 1):$query->where('u.is_screen', 0);
- //代表是否注销
- if($this->request->action()!='userban' && $this->request->param('u')!=3){
- ($this->request->action()=='userlogout' || $this->request->param('u')==5)?$query->where('u.user_status', -1):$query->where('u.user_status', 1);
- }
- //$data = $this->request->param();
- if (!empty($data['uid'])) {
- $query->where('u.id', intval($data['uid']));
- }
- if (!empty($data['keyword'])) {
- $keyword = $data['keyword'];
- $query->where('u.user_nickname|u.real_name|u.mobile', 'like', "%$keyword%");
- }
- //年龄区间查询
- if((!empty($data['age1']) && $data['age1']!='none') && (!empty($data['age2']) && $data['age2']!='none')){
- $query->where('u.birthday',['>',strtotime($data['age1'])],['<',strtotime($data['age2'])],'and');
- $query->whereNotNull('u.birthday');
- }
- // //只有第一个年龄的情况下
- if((!empty($data['age1']) && $data['age1']!='none') && (empty($data['age2']) || $data['age2']=='none')){
- $birthday = $data['age1'];
- $query->whereRaw("YEAR(from_unixtime(u.`birthday`))=$birthday and u.birthday is not null ");
- }
- // //只有第二个年龄的情况下
- if((empty($data['age1']) || $data['age1']=='none') && (!empty($data['age2']) && $data['age2']!='none')){
- $birthday = $data['age2'];
- $query->whereRaw("YEAR(from_unixtime(u.`birthday`))=$birthday and u.birthday is not null ");
- }
- //身高区间查询
- if((!empty(input('height')) && input('height')!='none') && (!empty(input('heightt')) && input('heightt')!='none')){
- $query->where('up.height',['>',input('height')],['<',input('heightt')],'and');
- }
- //身高第一个查找
- if((!empty(input('height')) && input('height')!='none') && (empty(input('heightt')) || input('heightt')=='none')){
- $query->where('up.height',input('height'));
- }
- //身高第二个查找
- if((empty(input('height')) ||input('height')=='none') && (!empty(input('heightt')) && input('heightt')!='none')){
- $query->where('up.height',input('heightt'));
- }
- //学历
- if((!empty(input('education')) && input('education')!='none') ){
- $query->where('up.education',input('education'));
- }
- //职位
- if((!empty(input('occupation')) && input('occupation')!='none') ){
- $query->where('up.occupation',input('occupation'));
- }
- //收入
- if((!empty(input('salary')) && input('salary')!='none') ){
- $query->where('up.salary',input('salary'));
- }
- //资产
- if((!empty(input('property')) && input('property')!='none') ){
- $query->where('up.property',input('property'));
- }
- //家乡
- if((!empty(input('home_city')) && input('home_city')!='none') ){
- $query->where('up.home_province|up.home_city','like','%'.input('home_city').'%','or');
- }
- //居住地(市)
- if((!empty(input('city')) && input('city')!='none') ){
- $query->where('up.city','like','%'.input('city').'%');
- }
- //婚姻状况
- if((!empty(input('married')) && input('married')!='none') ){
- $query->where('up.married',input('married'));
- }
- //性别
- if((!empty(input('sex')) && input('sex')!='none') ){
- $query->where('u.sex',input('sex'));
- }
- })
- //待审核
- ->order("u.agent_create_time DESC")
- ->paginate(10,false,['query'=>request()->param()]);
- //echo Db::name('user')->getLastSql();die;
- // 获取分页显示
- $page = $list->render();
- $this->assign('list', $list);
- $this->assign('page', $page);
-
- return $this->fetch();
- }
- //分销一级用户显示
- public function Marketoneuser(){
- $data = $this->request->param();
- session('search',[
- 'uid' => isset($data['uid'])? intval($data['uid']) : 0,
- 'keyword' => isset($data['keyword'])? trim($data['keyword']) : '',
- ]);
- // 添加返回历史修改 by wesmiler 2020-02-16
- $history = isset($data['history'])? intval($data['history']) : 0;
- if($history){
- $data = session('user_search');
- }else{
- session('user_search', $data);
- }
- // 修改 end
- //var_dump($data);die;
- $list = Db::name('user')->field('u.id,u.user_login,u.user_nickname,u.real_name,u.redheart,u.is_tuijian,u.create_time,u.is_heart,u.user_status,u.mobile,u.freezing,u.updated_at,last_login_time,up.idcard,
- up.idcard_check,up.position_check,up.education_check')
- ->alias('u')
- ->join('user_profile up','u.id=up.userid','left')
-
- ->where(function (Query $query) use($data){
- $query->where('u.user_type', 2);
- $query->where('u.openid', 'not in','');
- $query->where('u.agent_type',1);
- //代表是否付费定制
- ($this->request->action()=='custom' || $this->request->param('u')==2)?$query->where('u.is_vip', 1):$query->where('u.is_vip', 0);
- //代表是否冻结
- if($this->request->action()!='userlogout' && $this->request->param('u')!=5){
- ($this->request->action()=='userban' || $this->request->param('u')==3)?$query->where('u.user_status', 0):$query->where('u.user_status', 1);
- }
- //代表是否筛选
- ($this->request->action()=='screen' || $this->request->param('u')==4)?$query->where('u.is_screen', 1):$query->where('u.is_screen', 0);
- //代表是否注销
- if($this->request->action()!='userban' && $this->request->param('u')!=3){
- ($this->request->action()=='userlogout' || $this->request->param('u')==5)?$query->where('u.user_status', -1):$query->where('u.user_status', 1);
- }
- //$data = $this->request->param();
- if (!empty($data['uid'])) {
- $query->where('u.id', intval($data['uid']));
- }
- if (!empty($data['keyword'])) {
- $keyword = $data['keyword'];
- $query->where('u.user_nickname|u.real_name|u.mobile', 'like', "%$keyword%");
- }
- //年龄区间查询
- if((!empty($data['age1']) && $data['age1']!='none') && (!empty($data['age2']) && $data['age2']!='none')){
- $query->where('u.birthday',['>',strtotime($data['age1'])],['<',strtotime($data['age2'])],'and');
- $query->whereNotNull('u.birthday');
- }
- // //只有第一个年龄的情况下
- if((!empty($data['age1']) && $data['age1']!='none') && (empty($data['age2']) || $data['age2']=='none')){
- $birthday = $data['age1'];
- $query->whereRaw("YEAR(from_unixtime(u.`birthday`))=$birthday and u.birthday is not null ");
- }
- // //只有第二个年龄的情况下
- if((empty($data['age1']) || $data['age1']=='none') && (!empty($data['age2']) && $data['age2']!='none')){
- $birthday = $data['age2'];
- $query->whereRaw("YEAR(from_unixtime(u.`birthday`))=$birthday and u.birthday is not null ");
- }
- //身高区间查询
- if((!empty(input('height')) && input('height')!='none') && (!empty(input('heightt')) && input('heightt')!='none')){
- $query->where('up.height',['>',input('height')],['<',input('heightt')],'and');
- }
- //身高第一个查找
- if((!empty(input('height')) && input('height')!='none') && (empty(input('heightt')) || input('heightt')=='none')){
- $query->where('up.height',input('height'));
- }
- //身高第二个查找
- if((empty(input('height')) ||input('height')=='none') && (!empty(input('heightt')) && input('heightt')!='none')){
- $query->where('up.height',input('heightt'));
- }
- //学历
- if((!empty(input('education')) && input('education')!='none') ){
- $query->where('up.education',input('education'));
- }
- //职位
- if((!empty(input('occupation')) && input('occupation')!='none') ){
- $query->where('up.occupation',input('occupation'));
- }
- //收入
- if((!empty(input('salary')) && input('salary')!='none') ){
- $query->where('up.salary',input('salary'));
- }
- //资产
- if((!empty(input('property')) && input('property')!='none') ){
- $query->where('up.property',input('property'));
- }
- //家乡
- if((!empty(input('home_city')) && input('home_city')!='none') ){
- $query->where('up.home_province|up.home_city','like','%'.input('home_city').'%','or');
- }
- //居住地(市)
- if((!empty(input('city')) && input('city')!='none') ){
- $query->where('up.city','like','%'.input('city').'%');
- }
- //婚姻状况
- if((!empty(input('married')) && input('married')!='none') ){
- $query->where('up.married',input('married'));
- }
- //性别
- if((!empty(input('sex')) && input('sex')!='none') ){
- $query->where('u.sex',input('sex'));
- }
- })
- //待审核
- ->order("u.create_time DESC")
- ->paginate(10,false,['query'=>request()->param()]);
- // echo Db::name('user')->getLastSql();die;
- // 获取分页显示
- $page = $list->render();
- $this->assign('list', $list);
- $this->assign('page', $page);
-
- return $this->fetch();
- }
- //分二级用户显示
- public function Markettwouser(){
- $data = $this->request->param();
- session('search',[
- 'uid' => isset($data['uid'])? intval($data['uid']) : 0,
- 'keyword' => isset($data['keyword'])? trim($data['keyword']) : '',
- ]);
- // 添加返回历史修改 by wesmiler 2020-02-16
- $history = isset($data['history'])? intval($data['history']) : 0;
- if($history){
- $data = session('user_search');
- }else{
- session('user_search', $data);
- }
- // 修改 end
- //var_dump($data);die;
- $list = Db::name('user')->field('u.id,u.user_login,u.user_nickname,u.real_name,u.redheart,u.is_tuijian,u.create_time,u.is_heart,u.user_status,u.mobile,u.freezing,u.updated_at,last_login_time,up.idcard,
- up.idcard_check,up.position_check,up.education_check')
- ->alias('u')
- ->join('user_profile up','u.id=up.userid','left')
-
- ->where(function (Query $query) use($data){
- $query->where('u.user_type', 2);
- $query->where('u.openid', 'not in','');
- $query->where('u.agent_type',1);
- //代表是否付费定制
- ($this->request->action()=='custom' || $this->request->param('u')==2)?$query->where('u.is_vip', 1):$query->where('u.is_vip', 0);
- //代表是否冻结
- if($this->request->action()!='userlogout' && $this->request->param('u')!=5){
- ($this->request->action()=='userban' || $this->request->param('u')==3)?$query->where('u.user_status', 0):$query->where('u.user_status', 1);
- }
- //代表是否筛选
- ($this->request->action()=='screen' || $this->request->param('u')==4)?$query->where('u.is_screen', 1):$query->where('u.is_screen', 0);
- //代表是否注销
- if($this->request->action()!='userban' && $this->request->param('u')!=3){
- ($this->request->action()=='userlogout' || $this->request->param('u')==5)?$query->where('u.user_status', -1):$query->where('u.user_status', 1);
- }
- //$data = $this->request->param();
- if (!empty($data['uid'])) {
- $query->where('u.id', intval($data['uid']));
- }
- if (!empty($data['keyword'])) {
- $keyword = $data['keyword'];
- $query->where('u.user_nickname|u.real_name|u.mobile', 'like', "%$keyword%");
- }
- //年龄区间查询
- if((!empty($data['age1']) && $data['age1']!='none') && (!empty($data['age2']) && $data['age2']!='none')){
- $query->where('u.birthday',['>',strtotime($data['age1'])],['<',strtotime($data['age2'])],'and');
- $query->whereNotNull('u.birthday');
- }
- // //只有第一个年龄的情况下
- if((!empty($data['age1']) && $data['age1']!='none') && (empty($data['age2']) || $data['age2']=='none')){
- $birthday = $data['age1'];
- $query->whereRaw("YEAR(from_unixtime(u.`birthday`))=$birthday and u.birthday is not null ");
- }
- // //只有第二个年龄的情况下
- if((empty($data['age1']) || $data['age1']=='none') && (!empty($data['age2']) && $data['age2']!='none')){
- $birthday = $data['age2'];
- $query->whereRaw("YEAR(from_unixtime(u.`birthday`))=$birthday and u.birthday is not null ");
- }
- //身高区间查询
- if((!empty(input('height')) && input('height')!='none') && (!empty(input('heightt')) && input('heightt')!='none')){
- $query->where('up.height',['>',input('height')],['<',input('heightt')],'and');
- }
- //身高第一个查找
- if((!empty(input('height')) && input('height')!='none') && (empty(input('heightt')) || input('heightt')=='none')){
- $query->where('up.height',input('height'));
- }
- //身高第二个查找
- if((empty(input('height')) ||input('height')=='none') && (!empty(input('heightt')) && input('heightt')!='none')){
- $query->where('up.height',input('heightt'));
- }
- //学历
- if((!empty(input('education')) && input('education')!='none') ){
- $query->where('up.education',input('education'));
- }
- //职位
- if((!empty(input('occupation')) && input('occupation')!='none') ){
- $query->where('up.occupation',input('occupation'));
- }
- //收入
- if((!empty(input('salary')) && input('salary')!='none') ){
- $query->where('up.salary',input('salary'));
- }
- //资产
- if((!empty(input('property')) && input('property')!='none') ){
- $query->where('up.property',input('property'));
- }
- //家乡
- if((!empty(input('home_city')) && input('home_city')!='none') ){
- $query->where('up.home_province|up.home_city','like','%'.input('home_city').'%','or');
- }
- //居住地(市)
- if((!empty(input('city')) && input('city')!='none') ){
- $query->where('up.city','like','%'.input('city').'%');
- }
- //婚姻状况
- if((!empty(input('married')) && input('married')!='none') ){
- $query->where('up.married',input('married'));
- }
- //性别
- if((!empty(input('sex')) && input('sex')!='none') ){
- $query->where('u.sex',input('sex'));
- }
- })
- //待审核
- ->order("u.create_time DESC")
- ->paginate(10,false,['query'=>request()->param()]);
- // echo Db::name('user')->getLastSql();die;
- // 获取分页显示
- $page = $list->render();
- $this->assign('list', $list);
- $this->assign('page', $page);
-
- return $this->fetch();
- }
-
- /**
- * 审核通过和审核不通过的弹框
- */
- public function goconfrom(){
- $this->assign("id",input('id'));
- return $this->fetch('marketconfrom');
- }
- /**
- * 审核通过和审核不通过的弹框操作
- */
- public function doconfrom(){
- $param= $this->request->param();
- if(isset($param['yes']) && isset($param['id'])){
- //开始进行调用成功发送
- $data['agent_status'] = 1;
- $result=Db::name('user')->where('id',$param['id'])->update($data);
- // echo Db::name('user')->getLastSql();die();
- //$result=Activity::bookConfirm($param['id'],3);
- // if(is_array($result)){
- if($result){
- echo 1;die;
- }else{
- echo 0;die;
- }
- }
- if(isset($param['no']) && isset($param['id'])){
- //开始进行调用审核失败发送
- // $result=Activity::bookConfirm($param['id'],5,$param['noremark']);
- if(is_array($result)){
- echo 1;die;
- }else{
- echo 0;die;
- }
- }
- }
- /**
- * 分销员奖励交易记录表
- */
- public function markettrans(){
- //
- /**搜索条件**/
- $trans_name = $this->request->param('user_nickname');
- $money = $this->request->param('money');
- //$userEmail = trim($this->request->param('user_email'));
- //账户明细表(包含用户名称,爱心,余额)
- $account_logs = Db::name('user_balance_log')
- ->alias('blog')
- ->join('user u','blog.user_id=u.id','left')
- ->whereIn('blog.type',[31,32])
- ->where(function (Query $query) use ($trans_name,$money) {
- if ($trans_name) {
- $query->where('u.user_nickname', 'like', "%$trans_name%");
- }
- if ($money) {
- $query->where('blog.balance', $money);
- }
- })
- ->field('blog.*,u.user_nickname')
- ->order("blog.id DESC")
- ->paginate(10,false,['query'=>request()->param()])
- ->each(function($item,$key){
- $item['source_username'] = Db::name('user')->where(['id'=> $item['source_uid'], 'user_type'=> 2])->field('user_nickname')->find();
-
- return $item;
- })
- ;
- //echo Db::name('user_balance_log')->getLastSql();die();
- $account_logs->appends(['title' => $trans_name]);
- // 获取分页显示
- $page = $account_logs->render();
-
- $this->assign("page", $page);
- $this->assign("account_logs", $account_logs);
- return $this->fetch();
-
- }
- /**
- * 分销奖励和扣除查看详情
- */
- public function transinfo(){
- $id=input('id');
- $balance_log = Db::name('user_balance_log')
- ->alias('blog')
- ->join('user u','blog.user_id=u.id','left')
- ->where(function (Query $query) use ($id) {
- if ($id) {
- $query->where('blog.id', $id);
- }
- })
- ->field('blog.*,u.user_nickname')
- ->find();
-
- $this->assign($balance_log);
- return $this->fetch();
- }
- /**
- * 分销记录
- */
- public function marketrecord(){
-
- // echo Db::name('user')->getLastSql().var_dump( $result);die();
- /**搜索条件**/
- $trans_name = $this->request->param('user_nickname');
- $money = $this->request->param('money');
- //$userEmail = trim($this->request->param('user_email'));
- //账户明细表(包含用户名称,爱心,余额)
- $balance_logs = Db::name('user_balance_log')
- ->alias('blog')
- ->join('user u','blog.user_id=u.id','left')
- ->whereIn('blog.type',[31,32])
- ->where(function (Query $query) use ($trans_name,$money) {
- if ($trans_name) {
- $query->where('u.user_nickname', 'like', "%$trans_name%");
- }
- if ($money) {
- $query->where('blog.balance', $money);
- }
- })
- ->field('blog.*,u.user_nickname')
- ->order("blog.id DESC")
- ->paginate(10,false,['query'=>request()->param()])
- ->each(function($item,$key){
- $item['source_username'] = Db::name('user')->where(['id'=> $item['source_uid'], 'user_type'=> 2])->field('user_nickname')->find();
-
- return $item;
- })
- ;
- //echo Db::name('user_balance_log')->getLastSql();die();
- $balance_logs->appends(['title' => $trans_name]);
- // 获取分页显示
- $page = $balance_logs->render();
- // var_dump($balance_logs);die();
- $this->assign("page", $page);
- $this->assign("balance_logs", $balance_logs);
- return $this->fetch();
- }
- //假删除用户
- public function todelete(){
- $param = $this->request->param();
- if (isset($param['ids']) && isset($param["yes"])) {
- $ids = $this->request->param('ids/a');
- Db::name('user')->where('id', 'in', $ids)->update(['agent_type' => 0]);
- $this->success("删除成功!");
- }
- if (isset($_POST['ids']) && isset($param["no"])) {
- $ids = $this->request->param('ids/a');
- Db::name('user')->where('id', 'in', $ids)->update(['agent_type' => 1]);
- $this->success("取消删除成功!", '/market/marketexamine');
- }
- }
-
- /**
- * 显示奖励充值
- */
- public function marketshowreward(){
- $this->assign("id",input('id'));
- return $this->fetch();
- }
- /**
- * 进行奖励充值
- */
- public function markettoreward(){
- $this->assign("id",input('id'));
- return $this->fetch();
- }
-
- }
|