123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <?php
- namespace app\store\controller;
- use library\Controller;
- use think\Db;
- /**
- * 会员注册审核管理
- * Class Auth
- * @package app\store\controller
- */
- class MemberBasic extends Controller
- {
- /**
- * 绑定数据表
- * @var string
- */
- protected $table = 'store_member_basic';
- /**
- * 会员注册审核
- * @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 = '会员注册审核';
- $query = $this->_query($this->table)->like('nickname,phone')->equal('state#status');
- $query->dateBetween('create_at')->order('id desc')->page();
- }
- /**
- * 添加快递公司
- * @auth false
- * @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->_form($this->table, 'form');
- }
- /**
- * 编辑快递公司
- * @auth false
- * @throws \think\Exception
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\ModelNotFoundException
- * @throws \think\exception\DbException
- * @throws \think\exception\PDOException
- */
- public function edit()
- {
- $this->_form($this->table, 'form');
- }
- /**
- * 表单数据处理
- * @param array $data
- * @auth true
- */
- protected function _form_filter(&$data)
- {
- if ($this->request->isPost()) {
- if (isset($data['state'])) {
- if ($data['state'] == 1) {
- $info = Db::name('store_member_basic')->where('id', $data['id'])->find();
- $user = Db::name('store_member')->where('id',$info['mid'])->find();
- // $member = [
- // 'username' => $info['username'],
- // 'phone' => $info['phone'],
- // 'vip_level' => 0,
- // ];
- $member = [
- 'nickname'=>$info['nickname'],
- 'ID_car'=>$info['ID_car'],
- 'education'=>$info['education'],
- 'age'=>$info['age'],
- 'sex'=>$info['sex'],
- 'height'=>$info['height'],
- 'weight'=>$info['weight'],
- 'headimg'=>$info['headimg'],
- 'province_id'=>1375,
- 'city_id'=>1479,
- 'area_id'=>$info['area_id'],
- 'username' => $info['username'],
- 'phone' => $info['phone'],
- 'vip_level' => 0,
- ];
- if(empty($user['openid'])||$user['phone']){
- Db::name('store_member')->where('id', $info['mid'])->update($member);
- }
- else{
- $user2 = Db::name('store_member')->where('phone',$info['phone'])->find();
- if(empty($user2)){
- Db::name('store_member')->where('id', $info['mid'])->update($member);
- }
- else{
- Db::name('store_member')->where('id', $user2['id'])->update(['openid'=>$user['openid']]);
- Db::name('store_member')->where('id', $user['id'])->delete();
- }
- }
- }
- }
- }
- }
- }
|