|
@@ -20,6 +20,7 @@ use app\index\model\userlocationhismodel;
|
|
use app\index\model\prjlocationmodel;
|
|
use app\index\model\prjlocationmodel;
|
|
use app\index\model\noticemodel;
|
|
use app\index\model\noticemodel;
|
|
use app\index\model\noticereadmodel;
|
|
use app\index\model\noticereadmodel;
|
|
|
|
+use app\index\model\questionusermodel;
|
|
|
|
|
|
class workermanger {
|
|
class workermanger {
|
|
public function getallworkerlist($pagenum, $pagesize) {
|
|
public function getallworkerlist($pagenum, $pagesize) {
|
|
@@ -252,9 +253,17 @@ class workermanger {
|
|
* 根据用户姓名获取
|
|
* 根据用户姓名获取
|
|
*/
|
|
*/
|
|
public function getworkerinfobyname($arr) {
|
|
public function getworkerinfobyname($arr) {
|
|
- $wname = $arr['wname'];
|
|
|
|
|
|
+ // $wname = $arr['wname'];
|
|
|
|
+ $fields = ['qu_active', 'wname', 'qu_isanswer'];
|
|
|
|
+ $where = [];
|
|
|
|
+ foreach ($fields as $key => $value) {
|
|
|
|
+ if (isset($arr[$value])) {
|
|
|
|
+ $where[$value] = $arr[$value];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
$t_work = new gworkermodel();
|
|
$t_work = new gworkermodel();
|
|
- $rlist = $t_work->selinfobyname($wname);
|
|
|
|
|
|
+ // $rlist = $t_work->selinfobyname($wname);
|
|
|
|
+ $rlist = $t_work->selinfobywhere($where);
|
|
return $rlist;
|
|
return $rlist;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -645,5 +654,79 @@ class workermanger {
|
|
return $icount;
|
|
return $icount;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * 设置答题人员
|
|
|
|
+ *
|
|
|
|
+ * @param [type] $arr
|
|
|
|
+ * @return void
|
|
|
|
+ * @author wj
|
|
|
|
+ * @date 2025-07-25
|
|
|
|
+ * isactive 是否有效 1有效 0无效
|
|
|
|
+ */
|
|
|
|
+ public function setquestionuser($arr) {
|
|
|
|
+ $fillfields = ['ids'];
|
|
|
|
+ foreach ($fillfields as $key => $value) {
|
|
|
|
+ if (!isset($arr[$value]) || empty($arr[$value])) {
|
|
|
|
+ return backarr(0, "请求错误");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ $ids = array_filter($arr['ids']);
|
|
|
|
|
|
|
|
+ $m_u = new gworkermodel();
|
|
|
|
+ $m_qu = new questionusermodel();
|
|
|
|
+
|
|
|
|
+ $isactive = 1;
|
|
|
|
+ if (isset($arr['isactive']) && empty($arr['isactive'])) {
|
|
|
|
+ $isactive = 0;
|
|
|
|
+ }
|
|
|
|
+ $errors = [];
|
|
|
|
+ $success_ids = [];
|
|
|
|
+ foreach ($ids as $key => $userid) {
|
|
|
|
+ $msg = "用户id[" . $userid . "]";
|
|
|
|
+ $uinfo = $m_u->getinfobyid($userid);
|
|
|
|
+ if (empty($uinfo)) {
|
|
|
|
+ $errors[] = $msg . "无信息";
|
|
|
|
+ unset($ids[$key]);
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ if (1 == $isactive) {
|
|
|
|
+ if (empty($uinfo['isactive'])) {
|
|
|
|
+ $errors[] = $msg . "已无效";
|
|
|
|
+ unset($ids[$key]);
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ if ($m_qu->isactivebyuseid($userid)) {
|
|
|
|
+ $errors[] = $msg . "已设置";
|
|
|
|
+ unset($ids[$key]);
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ $insertData = [
|
|
|
|
+ 'user_id' => $userid,
|
|
|
|
+ 'telno' => $uinfo['telno'],
|
|
|
|
+ 'is_active' => $isactive,
|
|
|
|
+ 'createtime' => date("Y-m-d H:i:s"),
|
|
|
|
+ ];
|
|
|
|
+ $quid = $m_qu->addinfo($insertData);
|
|
|
|
+ }
|
|
|
|
+ if (0 === $isactive) {
|
|
|
|
+ $quinfo = $m_qu->isactivebyuseid($userid);
|
|
|
|
+ if (empty($quinfo)) {
|
|
|
|
+ unset($ids[$key]);
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ $quid = $quinfo['id'];
|
|
|
|
+ $updateData = ['is_active' => 0];
|
|
|
|
+ $m_qu->updinfobyid($quid, $updateData);
|
|
|
|
+ }
|
|
|
|
+ $success_ids[] = ['userid' => $userid, 'quid' => $quid];
|
|
|
|
+ }
|
|
|
|
+ $data = [
|
|
|
|
+ 'errors' => $errors,
|
|
|
|
+ 'success_ids' => $success_ids,
|
|
|
|
+ ];
|
|
|
|
+ if (count($success_ids) <= 0) {
|
|
|
|
+ return backarr(0, "操作失败", $data);
|
|
|
|
+ }
|
|
|
|
+ return backarr(1, "操作成功", $data);
|
|
|
|
+ }
|
|
}
|
|
}
|