123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743 |
- <?php
- /*
- * @Author: wang jun
- * @Date: 2021-09-27 09:02:06
- * @Last Modified by: wang jun
- * @Last Modified time: 2021-11-19 11:38:38
- */
- namespace app\index\logic;
- use app\index\logic\wxlogic;
- use app\index\model\companymodel;
- use app\index\model\logmodel;
- use app\index\model\userinfomodel;
- use app\index\model\workerinfomodel;
- use app\index\model\workermodel;
- use think\Db;
- use think\Log;
- class userinfologic
- {
- private $userinfomodel;
- public function __construct()
- {
- $this->userinfomodel = new userinfomodel();
- }
- public function getinfobyid($id, $field = '*')
- {
- $where = ['id' => $id];
- $info = $this->userinfomodel->getInfo($where, $field);
- return $info;
- }
- public function getinfobysfzid($sfzid, $field = '*')
- {
- $where = ['sfzid' => $sfzid];
- $info = $this->userinfomodel->getInfo($where, $field);
- return $info;
- }
- public function getinfobyopenid($arr, $field = '*')
- {
- if (!isset($arr['openid']) || empty($arr['openid'])) {
- return backarr(0, "请求错误");
- }
- $openid = $arr['openid'];
- $where = ['openid' => $openid];
- $info = $this->userinfomodel->getInfo($where, $field);
- if (empty($info)) {
- return backarr(0, "无数据");
- }
- $m_c = new companymodel();
- $cinfo = $m_c->getInfo(['userid' => $info['id'], 'isactive' => 1], ['id', 'company']);
- $info['company'] = empty($cinfo) ? false : $cinfo;
- return backarr(1, "查询成功", $info);
- }
- /*
- * 20211003
- * steelxu
- * 根据电话号码获取用户消息
- */
- public function getinfobytelno($telno, $field = '*')
- {
- $where = ['telno' => $telno];
- $info = $this->userinfomodel->getInfo($where, $field);
- return $info;
- }
- public function insertinfo($info)
- {
- $sfzid = $info['sfzid'];
- if (empty($sfzid)) {
- return backarr(0, "身份证号无数据");
- }
- $userinfo = $this->getinfobysfzid($sfzid);
- if ($userinfo) {
- return backarr(0, "身份证已存在");
- }
- //$id = $this->userinfomodel->insertData($info);
- $id = $this->insertUserInfo($info);
- if (!$id) {
- return backarr(0, "用户添加失败");
- }
- return backarr(1, "添加成功", $id);
- }
- /*
- * wj
- * 20211002
- * edit by steelxu
- * upate 改为 update
- * 另,使用者注意,此方法仅适用于根据id无条件更新,如有其它条件,需另行写方法
- * edit steelxu
- * update方法参数顺序
- */
- public function updateinfobyid($id, $updateData)
- {
- $where = ['id' => $id];
- $result = $this->userinfomodel->where($where)->update($updateData);
- return $result;
- }
- /*
- * 20211002
- * steelxu5
- * 快速发单,用户可不实名认证
- * 小程序用户仅通过openid就可以获得帐户
- */
- public function saveuseronlyopenid($arr)
- {
- $arr['createtime'] = date('Y-m-d H:i:s');
- $id = $this->userinfomodel->insertData($arr);
- if (!$id) {
- return backarr(0, "用户添加失败");
- }
- return backarr(1, "添加成功", $id);
- }
- /*
- * 20211003
- * steelxu5
- * 小程序快速发单,用户不实名认证
- * 提交openid 与telno
- * 如果user表中telno已存在,则更新openid
- * 如果telno 不存在,则创建新用户
- * 另外返回时不返回sfzid
- * 需要加上头像处理,如果前端处理一并提交头像,服务端已处理20211003
- * eidt by steelxu5
- * edit in 20211105
- * 新注册的用户加上platform
- * sdit by steelxu5
- * edit in 20211119
- * 返回做限制,不能返回所有的数据
- */
- public function saveuserwithopenidtelno($arr)
- {
- if (!isset($arr['telno']) || !isset($arr['openid'])) {
- return backarr(0, "请求错误");
- }
- //先检查是否电话号码已存在
- $telno = $arr['telno'];
- $rinfo = $this->getinfobytelno($telno, 'id,telno,isright,openid'); //20211119 edit by steelxu5
- if ($rinfo) {
- //根据id更新openid
- $rid = $rinfo['id'];
- if ($arr['openid'] != $rinfo['openid']) {
- $updatearr['openid'] = $arr['openid'];
- if (array_key_exists('photourl', $arr)) {
- $updatearr['photourl'] = $arr['photourl'];
- }
- $kd = $this->updateinfobyid($rid, $updatearr);
- }
- $rinfo = $this->getinfobyid($rid);
- if (isset($rinfo['sfzid'])) {
- $rinfo['sfzid'] = '';
- }
- if (isset($rinfo['sfzid'])) {
- $rinfo['sfzid'] = '';
- }
- return backarr(1, "添加成功", $rinfo);
- } else {
- Db::startTrans();
- try {
- $arr['createtime'] = date('Y-m-d H:i:s');
- $arr['platform'] = '水猫小程序';
- $id = $this->userinfomodel->insertData($arr);
- if (!$id) {
- throw new \Exception("用户添加失败");
- }
- $uid = $id;
- /* $l_w = new wxlogic();
- $filename = $uid . '_' . time();
- $qrcode = [
- 'scene' => 'userid=' . $uid,
- 'page' => 'src/views/index/index',
- ];
- $qrresult = $l_w->getqrcode($qrcode, $filename);
- if (1 != $qrresult['status']) {
- throw new \Exception($qrresult['msg']);
- }
- $qrcode = $qrresult['data']['qrcode'];
- $updatedata = [
- 'qrcode' => $qrcode,
- ];
- $updaterow = $this->updateinfobyid($uid, $updatedata);
- if (1 != $updaterow) {
- throw new \Exception("小程序二维码保存错误");
- }*/
- $rinfo = $this->getinfobyid($id);
- if (isset($rinfo['sfzid'])) {
- $rinfo['sfzid'] = '';
- }
- Db::commit();
- return backarr(1, "添加成功", $rinfo);
- } catch (\Exception $e) {
- $msg = $e->getMessage();
- log::info($e->getTrace());
- Db::rollback();
- return backjson(0, $msg);
- }
- }
- }
- /*
- * 20211031
- * 小程序实名认证,通过openid更新其它数据
- * steelxu5
- */
- public function updateinfobyopenid($arr)
- {
- Db::startTrans();
- try {
- if (!isset($arr['openid']) || empty($arr['openid'])) {
- return backarr(0, "请求错误");
- }
- $openid = $arr['openid'];
- $info = $this->userinfomodel->getInfo(['openid' => $openid]);
- if (empty($info)) {
- $insertData = ['openid' => $openid];
- $userid = $this->insertUserInfo($insertData);
- $info = $this->userinfomodel->getInfo(['id' => $userid]);
- //throw new \Exception("无用户信息");
- }
- $sfzid = $arr['sfzid'];
- $m_wi = new workerinfomodel();
- $wiWhere = ['sfzid' => $sfzid];
- $wiinfo = $m_wi->getinfo($wiWhere);
- if (empty($wiinfo)) {
- $insertData = [];
- //工会新建信息 未缴费 value userinfo字段 key workerinfo字段
- $insertFiledArr = [
- 'sfzid' => 'sfzid',
- 'wname' => 'wname',
- 'gender' => 'gender',
- 'wage' => 'wage',
- 'nation' => 'nation',
- 'telno' => 'telno',
- 'signurl' => 'signurl',
- 'frontsfzurl' => 'frontsfzurl',
- 'backsfzurl' => 'backsfzurl',
- 'city' => 'city',
- 'disc' => 'disc',
- 'address' => 'address',
- ];
- foreach ($insertFiledArr as $key => $value) {
- if (isset($arr[$value]) && !empty($arr[$value])) {
- $insertData[$key] = $arr[$value];
- }
- }
- $insertData['ispass'] = 1;
- $insertData['isactive'] = 0;
- $labid = $m_wi->insinfo($insertData);
- if (empty($labid)) {
- throw new \Exception("工会用户添加失败");
- }
- } else {
- $labid = $wiinfo['id'];
- }
- if (empty($labid)) {
- throw new \Exception("无工会用户id");
- }
- $updatearr['labid'] = $labid;
- $updatearr['gender'] = $arr['gender'];
- $updatearr['nation'] = $arr['nation'];
- $updatearr['address'] = $arr['address'];
- $updatearr['backsfzurl'] = $arr['backsfzurl'];
- $updatearr['frontsfzurl'] = $arr['frontsfzurl'];
- $updatearr['sfzenddate'] = $arr['sfzenddate'];
- $updatearr['sfzid'] = $arr['sfzid'];
- $updatearr['telno'] = $arr['telno'];
- $updatearr['wname'] = $arr['wname'];
- if (isset($arr['wage']) && is_numeric($arr['wage']) && !empty($arr['wage'])) {
- $updatearr['wage'] = $arr['wage'];
- } else {
- $age = getGenderByAge($sfzid);
- if ($age < 60 && $age > 10) {
- $arr['wage'] = $age;
- }
- $updatearr['wage'] = $arr['wage'];
- }
- $updatearr['worktype'] = $arr['worktype'];
- $where['id'] = $info['id'];
- $row = $this->updateUserInfo($where, $updatearr);
- if (empty($row)) {
- throw new \Exception("更新失败");
- }
- Db::commit();
- return backarr(1, '更新成功', $info['id']);
- } catch (\Exception $e) {
- Db::rollback();
- $msg = $e->getMessage();
- return backarr(0, $msg);
- }
- }
- /*
- * 20211105
- * app实名认证,通过id更新其它数据
- * wj
- */
- public function updateinfobyidforapp($arr)
- {
- $fillField = ['uid', 'sfzid'];
- foreach ($fillField as $key => $value) {
- if (!isset($arr[$value]) || empty($arr[$value])) {
- return backarr(0, "请求错误");
- }
- }
- $sfzid = $arr['sfzid'];
- $uid = $arr['uid'];
- $userinfo = $this->getinfobyid($uid);
- if (empty($userinfo)) {
- return backarr(0, "无用户数据");
- }
- if (isset($arr['sfzid']) && !empty($arr['sfzid'])) {
- $wheresfz = [
- 'sfzid' => $arr['sfzid'],
- 'id' => ['not in', [$uid]],
- ];
- $sfzinfo = $this->userinfomodel->getInfo($wheresfz);
- if (!empty($sfzinfo)) {
- return backarr(0, "身份证已存在");
- }
- }
- if (isset($arr['sfzenddate'])) {
- $sfzenddate = getSfzend($arr['sfzenddate']);
- if ($sfzenddate) {
- $arr['sfzenddate'] = $sfzenddate;
- }
- }
- //年龄
- $age = getGenderByAge($sfzid);
- if ($age < 60 && $age > 10) {
- $arr['wage'] = $age;
- }
- $arr = array_merge($userinfo->toArray(), $arr);
- Db::startTrans();
- try {
- //工会用户信息
- $m_wi = new workerinfomodel();
- $wiWhere = ['sfzid' => $sfzid];
- $wiinfo = $m_wi->getinfo($wiWhere);
- if (empty($wiinfo)) {
- $insertData = [];
- //工会新建信息 未缴费 value userinfo字段 key workerinfo字段
- $insertFiledArr = [
- 'sfzid' => 'sfzid',
- 'wname' => 'wname',
- 'gender' => 'gender',
- 'wage' => 'wage',
- 'nation' => 'nation',
- 'telno' => 'telno',
- 'signurl' => 'signurl',
- 'frontsfzurl' => 'frontsfzurl',
- 'backsfzurl' => 'backsfzurl',
- 'city' => 'city',
- 'disc' => 'disc',
- 'address' => 'address',
- ];
- foreach ($insertFiledArr as $key => $value) {
- if (isset($arr[$value]) && !empty($arr[$value])) {
- $insertData[$key] = $arr[$value];
- }
- }
- $insertData['ispass'] = 1;
- $insertData['isactive'] = 0;
- $labid = $m_wi->insinfo($insertData);
- if (empty($labid)) {
- throw new \Exception("工会用户添加失败");
- }
- } else {
- $labid = $wiinfo['id'];
- }
- if (empty($labid)) {
- throw new \Exception("无工会用户id");
- }
- //改用户信息
- $updateData = [];
- $updateFiledStr = ['gender', 'nation', 'city', 'disc', 'address', 'signurl', 'backsfzurl', 'frontsfzurl', 'sfzenddate', 'sfzid', 'telno', 'wname', 'wage', 'nickname'];
- foreach ($updateFiledStr as $key => $value) {
- if (isset($arr[$value]) && !empty($arr[$value])) {
- if ($userinfo[$value] != $arr[$value]) {
- $updateData[$value] = $arr[$value];
- }
- }
- }
- $where = ['id' => $uid];
- $updateData['labid'] = $labid;
- if (isset($updateData['sfzenddate'])) {
- $sfzenddate = getSfzend($updateData['sfzenddate']);
- if ($sfzenddate) {
- $updateData['sfzenddate'] = $sfzenddate;
- }
- }
- $row = $this->updateUserInfo($where, $updateData);
- if (empty($row)) {
- throw new \Exception("更新失败");
- }
- Db::commit();
- $where = ['id' => $uid];
- $field = ['id', 'gender', 'telno', 'wname', 'isactive', 'labid', 'sfzid'];
- $info = $this->userinfomodel->getInfo($where, $field);
- $info['sfzid'] = empty($info['sfzid']) ? false : true;
- return backarr(1, "更新成功", $info);
- } catch (\Exception $e) {
- Db::rollback();
- $msg = $e->getMessage();
- return backarr(0, $msg);
- }
- }
- /*
- * 20210815
- * 身份证查重
- * edit by steelxu
- * edit 20211031
- */
- public function checksfzrepeat($arr)
- {
- $t_gw = new userinfomodel();
- $isrepeat = $t_gw->precheckindex($arr);
- return $isrepeat;
- }
- /**
- * 添加会员信息
- * userinfo worker 统一操作
- * wj
- * 20211103
- */
- public function insertUserInfo($info)
- {
- $m_u = new userinfomodel();
- $m_w = new workermodel();
- $userDesc = $m_u->gettablefields();
- $workerDesc = $m_w->gettablefields();
- $userInsertData = [];
- $workerInsertData = [];
- foreach ($userDesc as $key => $value) {
- $field = $value['Field'];
- if (isset($info[$field])) {
- $userInsertData[$field] = $info[$field];
- }
- }
- foreach ($workerDesc as $key => $value) {
- $field = $value['Field'];
- if (isset($info[$field])) {
- $workerInsertData[$field] = $info[$field];
- }
- }
- $userid = $m_u->insertData($userInsertData);
- $workerInsertData['userid'] = $userid;
- $workerid = $m_w->insertData($workerInsertData);
- return $userid;
- }
- /**
- * 修改会员信息
- * userinfo worker 统一操作
- * wj
- * 20211103
- */
- public function updateUserInfo($where, $updateData)
- {
- $m_u = new userinfomodel();
- $m_w = new workermodel();
- $userinfo = $m_u->getInfo($where);
- $workerinfo = $m_w->getInfo(['userid' => $userinfo['id']]);
- if (empty($workerinfo)) {
- $wid = $m_w->insertData(['userid' => $userinfo['id']]);
- $workerinfo = $m_w->getInfo(['id' => $wid]);
- }
- $userUpdateData = [];
- $workerUpdateData = [];
- foreach ($updateData as $key => $value) {
- if (isset($userinfo[$key])) {
- if ($value != $userinfo[$key]) {
- $userUpdateData[$key] = $updateData[$key];
- }
- }
- }
- foreach ($updateData as $key => $value) {
- if (isset($workerinfo[$key])) {
- if ($value != $workerinfo[$key]) {
- $workerUpdateData[$key] = $updateData[$key];
- }
- }
- }
- $userWhere = ['id' => $userinfo['id']];
- $workerWhere = ['id' => $workerinfo['id']];
- $userRow = $m_u->updateinfo($userWhere, $userUpdateData);
- $workerRow = $m_w->updateinfo($workerWhere, $workerUpdateData);
- return $userRow;
- }
- /**
- * 根据条件获取用户列表
- * 20211118
- * wj
- */
- public function getuserlist($arr)
- {
- $page = isset($arr['page']) && !empty($arr['page']) ? $arr['page'] : 1;
- $size = isset($arr['size']) && !empty($arr['size']) ? $arr['size'] : 10;
- $where = [];
- if (isset($arr['wname']) && !empty($arr['wname'])) {
- if ('null' == $arr['wname']) {
- $where['wname'] = 'NULL';
- } elseif (is_string($arr['wname'])) {
- $where['wname'] = ['like', '%' . $arr['wname'] . '%'];
- }
- }
- if (isset($arr['telno']) && !empty($arr['telno'])) {
- $where['telno'] = ['like', '%' . $arr['telno'] . '%'];
- }
- if (isset($arr['sfzid']) && !empty($arr['sfzid'])) {
- if ('null' == $arr['sfzid']) {
- $where['sfzid'] = 'NULL';
- } elseif (is_string($arr['sfzid'])) {
- $where['sfzid'] = ['like', '%' . $arr['sfzid'] . '%'];
- }
- }
- if (isset($arr['isactive']) && is_numeric($arr['isactive'])) {
- if ($arr['isactive']) {
- $where['isactive'] = 1;
- } else {
- $where['isactive'] = 0;
- }
- }
- if (isset($arr['isright']) && is_numeric($arr['isright'])) {
- if ($arr['isright']) {
- $where['isright'] = 1;
- } else {
- $where['isright'] = 0;
- }
- }
- $m_u = new userinfomodel();
- $count = $m_u->getList($where, 'count');
- if ($count < 0) {
- return backarr(0, '无数据');
- }
- $list = $m_u->getList($where, '*', $page, $size, 'id desc');
- $data = [
- 'list' => $list,
- 'count' => $count,
- ];
- return backarr(1, "查询成功", $data);
- }
- /**
- * 改用户状态
- * 20211118
- * wj
- */
- public function updateuserisright($arr)
- {
- if (
- !isset($arr['isright']) ||
- !isset($arr['userid']) || empty($arr['userid'])
- ) {
- return backarr(0, "请求错误");
- }
- $id = $arr['userid'];
- $where = ['id' => $id];
- $info = $this->userinfomodel->getInfo($where);
- if (empty($info)) {
- return backarr(0, "无会员数据");
- }
- if (empty($arr['isright'])) {
- $arr['isright'] = 0;
- } else {
- $arr['isright'] = 1;
- }
- $isright = $arr['isright'];
- if ($info['isright'] === $isright) {
- return backarr(0, "无修改数据");
- }
- $updateData = [
- 'isright' => $isright,
- ];
- $row = $this->userinfomodel->updateinfo($where, $updateData);
- if ($row <= 0) {
- return backarr(0, "操作失败");
- }
- return backarr(1, "操作成功", ['id' => $id]);
- }
- /***
- * 配置用户labid 根据uid
- * 20211124
- * wj
- */
- public function setlabidbyuid($arr)
- {
- if (!isset($arr['uid']) || empty($arr['uid'])) {
- return backarr(0, "请求错误");
- }
- $uid = $arr['uid'];
- $userinfo = $this->getinfobyid($uid);
- if (empty($userinfo)) {
- return backarr(0, "无用户信息");
- }
- $sfzid = $userinfo['sfzid'];
- if (empty($sfzid)) {
- return backarr(0, "无用户身份证号");
- }
- $m_wi = new workerinfomodel();
- $wiWhere = ['sfzid' => $sfzid];
- $wiinfo = $m_wi->getinfo($wiWhere);
- if (empty($wiinfo)) {
- $insertData = [];
- //工会新建信息 未缴费 value userinfo字段 key workerinfo字段
- $insertFiledArr = [
- 'sfzid' => 'sfzid',
- 'wname' => 'wname',
- 'gender' => 'gender',
- 'wage' => 'wage',
- 'nation' => 'nation',
- 'telno' => 'telno',
- 'signurl' => 'signurl',
- 'frontsfzurl' => 'frontsfzurl',
- 'backsfzurl' => 'backsfzurl',
- 'city' => 'city',
- 'disc' => 'disc',
- 'address' => 'address',
- ];
- foreach ($insertFiledArr as $key => $value) {
- if (isset($userinfo[$value]) && !empty($userinfo[$value])) {
- $insertData[$key] = $userinfo[$value];
- }
- }
- $insertData['ispass'] = 1;
- $insertData['isactive'] = 0;
- $labid = $m_wi->insinfo($insertData);
- if (empty($labid)) {
- return backarr(0, "工会用户添加失败");
- }
- } else {
- $labid = $wiinfo['id'];
- }
- if (empty($labid)) {
- return backarr(0, "无工会用户id");
- }
- $updateData = [];
- if (empty($userinfo['labid'])) {
- $updateData['labid'] = $labid;
- } else {
- if ($labid != $userinfo['labid']) {
- $updateData['labid'] = $labid;
- }
- }
- if (empty($updateData)) {
- return backarr(1, "操作成功", ['labid' => $uid]);
- }
- $m_u = new userinfomodel();
- $uwhere = ['id' => $uid];
- $row = $m_u->updateinfo($uwhere, $updateData);
- if (empty($row)) {
- return backarr(0, "操作失败");
- }
- return backarr(1, "操作成功", ['labid' => $labid]);
- }
- /*
- * 20220111
- * steelxu5
- * 根据uid获得qrcode
- */
- public function getqrcodebyuid($arr){
- if (!isset($arr['userid']) || empty($arr['userid'])) {
- return backarr(0, "请求错误");
- }
- $uid=$arr['userid'];
- $t_u=new userinfomodel();
- $qrcode=$t_u->selqrcodebyuid($uid);
- if($qrcode['qrcode']){
- return backarr(1, "请求成功", $qrcode['qrcode']);
- }else{
- $l_w = new wxlogic();
- $filename = $uid . '_' . time();
- $qrcode = [
- 'scene' => 'userid=' . $uid,
- 'page' => 'src/views/subtelno/subtelno',
- ];
- $qrresult = $l_w->getqrcode($qrcode, $filename);
- if (1 != $qrresult['status']) {
- throw new \Exception($qrresult['msg']);
- }
- $qrcode = $qrresult['data']['qrcode'];
- $updatedata = [
- 'qrcode' => $qrcode,
- ];
- $updaterow = $this->updateinfobyid($uid, $updatedata);
- if (1 != $updaterow) {
- throw new \Exception("小程序二维码保存错误");
- }
- return backarr(1, "请求成功", $qrcode);
- }
- }
- /**
- * 改用户可用状态
- * 20220111
- * wj
- */
- public function updateuserisactive($arr)
- {
- if (
- !isset($arr['isactive']) ||
- !isset($arr['userid']) || empty($arr['userid'])
- ) {
- return backarr(0, "请求错误");
- }
- $id = $arr['userid'];
- $where = ['id' => $id];
- $info = $this->userinfomodel->getInfo($where);
- if (empty($info)) {
- return backarr(0, "无会员数据");
- }
- if (empty($arr['isactive'])) {
- $arr['isactive'] = 0;
- } else {
- $arr['isactive'] = 1;
- }
- $isactive = $arr['isactive'];
- if ($info['isactive'] === $isactive) {
- return backarr(0, "无修改数据");
- }
- $updateData = [
- 'isactive' => $isactive,
- ];
- $row = $this->userinfomodel->updateinfo($where, $updateData);
- if ($row <= 0) {
- return backarr(0, "操作失败");
- }
- $m_l = new logmodel();
- $loginfo['create_date'] = date('Y-m-d H:i:s', time());
- $loginfo['json'] = json_encode(['userid' => $id, 'msg' => '用户注销'], 320);
- $L_id = $m_l->savelog($loginfo);
- return backarr(1, "操作成功", ['id' => $id]);
- }
- }
|