123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <?php
- namespace app\operate\controller;
- use app\common\model\ActivityPrice;
- use app\common\model\ActivitySponsor;
- use app\common\model\ActivityTemplate;
- use app\common\model\ChinaArea;
- use app\common\model\DatumIntro;
- use app\common\model\User;
- use library\Controller;
- use think\Db;
- /**
- * 活动
- * Class ActivityHx
- * @package app\operate\controller
- */
- class ActivityHx extends Controller
- {
- protected $table = 'StoreMember';
- /**
- * 列表
- * @auth true
- * @menu true
- * @throws \think\Exception
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\ModelNotFoundException
- * @throws \think\exception\DbException
- * @throws \think\exception\PDOException
- */
- public function index()
- {
- $this->title = '核销管理';
- $where = [];
- $where[] = ['m.is_deleted','=',0];
- $where[] = ['m.is_hx','=',1];
- if($name = input('get.name')) $where[] = ['m.name','like','%'.$name.'%'];
- if($phone = input('get.phone')) $where[] = ['m.phone','like','%'.$phone.'%'];
- $field="m.id,m.openid,m.name,m.is_first,m.headimg,m.level_exp,m.phone,m.status,m.create_at,m.account_type";
- $query = $this->_query($this->table)
- ->field($field)
- ->alias('m')
- ->where($where)
- ->order('id desc')->page();
- }
- /**
- * 添加
- * @auth true
- * @menu true
- * @throws \think\Exception
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\ModelNotFoundException
- * @throws \think\exception\DbException
- * @throws \think\exception\PDOException
- */
- public function add()
- {
- $this->title = '添加';
- if($this->request->post()) {
- $phone = input('phone');
- $user_info = User::where('phone',$phone)->find();
- if(empty($user_info))$this->error('用户不存在');
- if($user_info->is_deleted || !$user_info->status) $this->error('用户已禁用');
- User::where('id',$user_info->id)->update(['is_hx'=>1]);
- $this->success('添加成功');
- }
- $this->_form($this->table, 'form');
- }
- /**
- * 删除
- * @auth true
- * @throws \think\Exception
- * @throws \think\exception\PDOException
- */
- public function del()
- {
- $this->_save($this->table, ['is_hx' => '0']);
- $this->success('删除成功');
- }
- /**
- * 删除
- * @auth true
- * @throws \think\Exception
- * @throws \think\exception\PDOException
- */
- public function remove()
- {
- $this->_save($this->table, ['is_hx' => '0']);
- }
- }
|