123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?php
- namespace User\Lib;
- use Dever;
- class Auth
- {
- # 获取是否认证
- public function status($uid)
- {
- $info = $this->getInfo();
- if (!$info) {
- # 未提交资料
- return -1;
- }
- return $info['status'];
- }
- # 获取认证信息
- public function getInfo($uid)
- {
- return Dever::db('user/auth')->find(array('uid' => $uid));
- }
- # 更新
- public function update($id, $uid, $name, $idcard, $idcard_front, $idcard_back, $type = 1, $tel = '', $email = '', $area = '', $address = '')
- {
- if ($name) {
- $update['name'] = $name;
- } else {
- Dever::alert('请输入真实姓名');
- }
- if ($idcard) {
- $update['idcard'] = $idcard;
- } else {
- Dever::alert('请输入身份证号');
- }
- if ($idcard_front) {
- $update['idcard_front'] = $city;
- } else {
- Dever::alert('请上传身份证正面');
- }
- if ($idcard_back) {
- $update['idcard_back'] = $county;
- } else {
- Dever::alert('请上传身份证背面');
- }
- if ($tel) {
- $update['tel'] = $tel;
- }
-
- if ($email) {
- $update['email'] = $email;
- }
- if ($area) {
- $update['area'] = $area;
- }
- if ($address) {
- $update['address'] = $address;
- }
- $update['type'] = $type;
- $update['status'] = 1;
- if ($id) {
- $update['where_id'] = $id;
- Dever::db('user/auth')->update($update);
- } else {
- $update['uid'] = $uid;
- $id = Dever::db('user/auth')->insert($update);
- }
- return $id;
- }
- public function manage_update($id, $name, $param)
- {
- $area = Dever::param('area', $param);
- $audit_status = Dever::param('audit_status', $param);
- if ($audit_status) {
- $admin = Dever::load('manage/auth.info');
- $update['where_id'] = $id;
- $update['status'] = $audit_status;
- $update['audit_date'] = time();
- if ($admin) {
- $update['audit_admin'] = $admin['id'];
- }
- Dever::db('user/auth')->update($update);
- }
- }
- }
|