From 72ab473a8b4d322e2a3dc49c52d2ca2ef77bc9e7 Mon Sep 17 00:00:00 2001 From: cyc Date: Fri, 26 Apr 2019 09:31:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E5=80=BC=E7=8F=AD=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E5=92=8Cvalue=E7=B3=BB=E7=BB=9F=E3=80=82=E3=80=82=E4=BB=8E123?= =?UTF-8?q?=E6=90=AC=E8=BF=81=E5=88=B0144?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dingmail/controllers/index.php | 714 ++++++++++++++++++ .../dingmail/models/ding_value_model.php | 334 ++++++++ webht/third_party/dingmail/views/like.php | 212 ++++++ webht/third_party/dingmail/views/login.php | 63 ++ webht/third_party/dingmail/views/mail.php | 552 ++++++++++++++ .../dingmail/views/rank_person.php | 251 ++++++ webht/third_party/dingmail/views/user.php | 258 +++++++ .../workflow/controllers/index.php | 114 ++- .../workflow/models/workflow_model.php | 37 +- .../third_party/workflow/views/form/rota.php | 29 +- .../workflow/views/index/rata_list.php | 9 +- .../workflow/views/index/unverify.php | 68 +- .../workflow/views/index/user_manage.php | 124 ++- .../workflow/views/index/verify.php | 6 +- .../workflow/views/mail_tpl/rota.php | 4 + webht/third_party/workflow/views/w-left.php | 5 +- 16 files changed, 2724 insertions(+), 56 deletions(-) create mode 100644 webht/third_party/dingmail/controllers/index.php create mode 100644 webht/third_party/dingmail/models/ding_value_model.php create mode 100644 webht/third_party/dingmail/views/like.php create mode 100644 webht/third_party/dingmail/views/login.php create mode 100644 webht/third_party/dingmail/views/mail.php create mode 100644 webht/third_party/dingmail/views/rank_person.php create mode 100644 webht/third_party/dingmail/views/user.php diff --git a/webht/third_party/dingmail/controllers/index.php b/webht/third_party/dingmail/controllers/index.php new file mode 100644 index 00000000..6b705811 --- /dev/null +++ b/webht/third_party/dingmail/controllers/index.php @@ -0,0 +1,714 @@ +load->model('ding_value_model'); + } + + public function test_cookie(){ + //https://oapi.dingtalk.com/connect/oauth2/sns_authorize?appid=dingoagxeeheunc0p95eu8&response_type=code&scope=snsapi_login&state=STATE&redirect_uri=http://www.mycht.cn/webht.php/apps/dingmail/index/test_cookie + + } + + public function index($unionid = null,$type = null){ + if($this->session->userdata('dingding_user_info') === false){ + $this->session->set_userdata('unionid', $unionid); + $this->session->set_userdata('type',$type); + $this->load->view('login'); + }else{ + if($unionid != null && $type != null){ + $user_info = $this->session->userdata('dingding_user_info'); + $data['type'] = $type; + $data['user'] = $user_info->ddu_Name; + $data['user_unionid'] = $user_info->ddu_Unionid; + if($this->ding_value_model->get_dingding_user($unionid) == null){ + echo '该用户还未登录过,请告知他登录后才能对他点赞或拍砖!
'; + echo '有问题请联系:CYC!'; + exit; + } + $data['comment_name'] = $this->ding_value_model->get_dingding_user($unionid)->ddu_Name; + $data['comment_unionid'] = $unionid; + $data['content'] = $type; + $data['mail_identify'] = $this->ding_value_model->get_dingding_user($unionid)->ddu_Sn.'_'.time(); + $data['createtime'] = time(); + if($data['user'] == $data['comment_name']){ + echo ''; + $this->index($unionid); + }else{ + $obj = $this->ding_value_model->get_user_time($data['comment_unionid'],$data['user_unionid']); + $last_time = $obj->ddv_Createtime; + $time_diff = ($data['createtime'] - $last_time) / 3600; + if($time_diff > 3){ + $flag = $this->ding_value_model->add_value($data); + if(!$flag){ + exit($type.'失败'); + }else{ + redirect(site_url('apps/dingmail/index/index/'.$unionid)); + } + }else{ + echo ''; + $this->index($unionid); + } + } + }else{ + if($unionid == null){ + $unionid = $this->session->userdata('dingding_user_info')->ddu_Unionid; + } + $mdata['user'] = $this->ding_value_model->get_dingding_user($unionid); + $mdata['user_unionid'] = $unionid; + $mdata['like_count'] = $this->ding_value_model->count_like($unionid); + $mdata['unlike_count'] = $this->ding_value_model->count_unlike($unionid); + $mdata['whos_like'] = $this->ding_value_model->whos_like($unionid); + $mdata['whos_unlike'] = $this->ding_value_model->whos_unlike($unionid); + $mdata['all_comment'] = $this->ding_value_model->all_comment($unionid); + //print_r($this->session->userdata('dingding_user_info')); + $this->load->view('user',$mdata); + } + } + } + + //value邮件页面 + public function mail_index(){ + if($this->session->userdata('dingding_user_info') === false){ + $this->load->view('login'); + }else{ + //print_r($this->session->userdata('dingding_user_info')); + $this->load->view('mail'); + } + } + + //发送邮件 + public function send_mail(){ + if(!$this->input->post('emaillist')){ + echo -1; + return; + } + $user_info = $this->session->userdata('dingding_user_info'); + $data['mail_content'] = htmlspecialchars($this->input->post('emailcontent')); + $data['mail_fromuser'] = $user_info->ddu_Name; + $data['mail_subject'] = $this->input->post('mail_subject'); + $data['mail_touser'] = $this->input->post('emaillist'); + $data['mail_ccuser'] = $this->input->post('cs_emaillist'); + $data['mail_value_key'] = $this->input->post('whm_value_key'); + $data['mail_createtime'] = time(); + $data['mail_identify'] = $user_info->ddu_Sn . '_' . time(); + $ddm_id = $this->ding_value_model->add_mail($data); + //邮件所有人,如果是value邮件,则属于被value的人,如果不是,则属于发邮件的人 + if ($this->input->post('whum_value_user')) { + $value_user_array = explode(';', $this->input->post('whum_value_user')); + foreach ($value_user_array as $vu) { + if (!empty($vu)) { + $vudata['value_user_name'] = $vu; + $vudata['value_user_identify'] = $data['mail_identify']; + $vudata['value_user_createtime'] = $data['mail_createtime']; + $ddum_id = $this->ding_value_model->add_value_user($vudata); + } + } + } else { + $vudata['value_user_name'] = $user_info->ddu_Name; + $vudata['value_user_identify'] = $data['mail_identify']; + $vudata['value_user_createtime'] = $data['mail_createtime']; + $ddum_id = $this->ding_value_model->add_value_user($vudata); + } + + //收件人 + $tostring = ''; + $tolist_array = array(); + $nowlist_array = explode(';', $this->input->post('emaillist')); + foreach ($nowlist_array as $v) { + if($v != null){ + $tostring .= "'".$v."'".','; + } + } + $tostring = substr($tostring,0,-1); + if(!empty($tostring)){ + $tolist_array = $this->ding_value_model->all_email($tostring); + }else{ + $tolist_array = null; + } + + + //抄送 + $ccstring = ''; + $cclist_array = array(); + $ccmail_array = explode(';', $this->input->post('cs_emaillist')); + + foreach ($ccmail_array as $c) { + if($c != null){ + $ccstring .= "'".$c."'".','; + } + } + $ccstring = substr($ccstring,0,-1); + if(!empty($ccstring)){ + $cclist_array = $this->ding_value_model->all_email($ccstring); + }else{ + $cclist_array = null; + } + $mailheader = '

FROM:'.$user_info->ddu_Name.'


'; + $mailbody = '
+ + + + + + +
'; + + $fromuser = $user_info->ddu_Name; + $subject = $this->input->post('mail_subject'); + + //是否为value邮件,如果不是value邮件,不在邮件下放置点赞按钮 + if($this->input->post('whum_value_user')){ + $body = $mailheader.$this->input->post('emailcontent').$mailbody; + }else{ + $body = $mailheader.$this->input->post('emailcontent'); + } + + if (!$this->do_sendmail($fromuser, $tolist_array, $cclist_array, $subject, $body)) { + $result = 0; //"邮件发送有误: " . $mail->ErrorInfo; + } else { + //是value邮件的话,默认发送人点赞 + if ($this->input->post('whum_value_user')) { + $obj = explode(';', $this->input->post('whum_value_user')); + foreach(array_filter($obj) as $value){ + $data['comment_name'] = $value; + $data['comment_unionid'] = $this->ding_value_model->get_dingding_unionid($data['comment_name'])->ddu_Unionid; + $data['type'] = 'like'; + $data['mail_identify'] = $data['mail_identify']; + $data['user'] = $user_info->ddu_Name; + $data['user_unionid'] = $user_info->ddu_Unionid; + $data['content'] = $this->ding_value_model->get_mail($data['mail_identify'])->ddm_Content; + $data['createtime'] = time(); + $whc_id = $this->ding_value_model->add_value($data); + } + } + $result = 1; + } + echo $result; + return; + } + + //执行邮件发送功能 + public function do_sendmail($fromuser, $tolist_array, $cclist_array, $subject, $mailbody) { + $this->load->library('Phpmailer_lib'); + $mail = new PHPMailer(); + $mail->IsSMTP(); + $mail->Host = 'smtp.mxhichina.com';//smtp.sendgrid.net + $mail->Port = 25; + $mail->SMTPAuth = true; + $mail->Username = 'admin@hainatravel.com'; + $mail->Password = "Hainatravel123";//Hainatravel1234 + $mail->SMTPSecure = 'tls'; + $mail->CharSet = "utf-8"; + $mail->Encoding = "base64"; + $mail->IsHTML(true); + + + $mail->FromName = $fromuser; //收件人昵称 + $mail->From = 'admin@hainatravel.com'; //发件人 + //$mail->setFrom('zm198311@yahoo.com.cn‍', $fromuser); + + if($tolist_array != null){ + foreach ($tolist_array as $v) { + $mail->AddAddress($v->ddu_Email); //收件人 + } + } + if($cclist_array != null){ + foreach ($cclist_array as $c) { + $mail->addCC($c->ddu_Email); //抄送 + } + } + + $mail->Subject = $subject; //邮件主题 + $mail->Body = $mailbody; //邮件内容 + + if (!$mail->Send()) { + $result = $mail->ErrorInfo; + echo "邮件发送有误: " . $mail->ErrorInfo; + } else { + $result = true; + } + return $result; + } + + //钉邮群体点赞功能 + public function like($identify = null,$type = null){ + if($this->session->userdata('dingding_user_info') === false){ + $this->session->set_userdata('identify',$identify); + $this->session->set_userdata('mail_type',$type); + $this->load->view('login'); + }else{ + $user_info = $this->session->userdata('dingding_user_info'); + if(!empty($user_info)){ + $data['user'] = $user_info->ddu_Name; + if(($type == 'like' || $type == 'unlike') && $identify){ + $data['type'] = $type; + $data['mail_identify'] = $identify; + $data['user_unionid'] = $user_info->ddu_Unionid; + $has_like = $this->ding_value_model->is_liked($data); + if(!$has_like){ + $data['createtime'] = time(); + $data['content'] = $this->ding_value_model->get_mail($data['mail_identify'])->ddm_Content; + $data['comment_name'] = 'value邮件'; + $data['comment_unionid'] = $this->ding_value_model->get_mail($identify)->ddm_Sn; + //对邮件点赞 + $whc_id = $this->ding_value_model->add_value($data); + } + //对value对象点赞 + $valuedata['type'] = $type; + $valuedata['mail_identify'] = $identify; + $valuedata['user'] = $user_info->ddu_Name; + $valuedata['user_unionid'] = $user_info->ddu_Unionid; + $valuedata['createtime'] = time(); + $valuedata['content'] = $this->ding_value_model->get_mail($identify)->ddm_Content; + $obj = $this->ding_value_model->get_value($identify,$valuedata['user_unionid']); + if(!empty($obj)){ + //这里没有判空 + foreach($obj as $value){ + + $valuedata['comment_name'] = $value->ddum_Name; + $valuedata['comment_unionid'] = $value->ddu_Unionid; + $obj = $this->ding_value_model->get_user_time($valuedata['comment_unionid'],$valuedata['user_unionid'],$identify); + if($obj){ + $last_time = $obj->ddv_Createtime; + }else{ + $last_time = 0; + } + $time_diff = ($valuedata['createtime'] - $last_time) / 3600; + if($time_diff > 100000){ + $flag = $this->ding_value_model->add_value($valuedata); + + if(!$flag){ + continue; + } + + }else{ + echo ''; + } + } + //sleep(3); + //redirect(site_url('apps/dingmail/index/like/'.$identify)); + } + + } + } + $tpldata['value_mail'] = $this->ding_value_model->get_mail($identify); + $tpldata['whos_like'] = $this->ding_value_model->value_whos_like($identify); + $tpldata['whos_unlike'] = $this->ding_value_model->value_whos_unlike($identify); + $this->load->view('like',$tpldata); + } + } + + //增加评论 + public function add_comment(){ + $data = array(); + if($this->input->post('hidden_name')){ + $data['user'] = '猜猜我是谁'; + $data['user_unionid'] = 'xxxxxxx'; + $data['type'] = 'hidden_comment'; + }else{ + $data['user'] = $this->session->userdata('dingding_user_info')->ddu_Name; + $data['user_unionid'] = $this->session->userdata('dingding_user_info')->ddu_Unionid; + $data['type'] = 'comment'; + } + + $data['comment_name'] = $this->input->post('user_name'); + $data['comment_unionid'] = $this->input->post('user_unionid'); + $data['content'] = str_replace(PHP_EOL, '', $this->input->post('comment')); + + $data['createtime'] = time(); + $data['mail_identify'] = $this->input->post('user_sn').'_'.$data['createtime']; + + $obj = $this->ding_value_model->get_last_comment($data['comment_name'],$data['comment_unionid']); + + if(empty($obj)){ + $time = 0; + }else{ + $time = $obj[0]->ddv_Createtime; + } + + $tolist_array = $this->ding_value_model->all_email("'".$data['comment_name']."'"); + $difftime = time() - $time; + if($difftime / 3600 > 24){ + $this->do_sendmail($data['user'], $tolist_array, null, '今天有人评论你了哟!', '快去看看吧:http://www.mycht.cn/webht.php/apps/dingmail/index/index/'.$data['comment_unionid']); + } + + $comment_id = $this->ding_value_model->add_value($data); + + echo $comment_id; + } + + public function test(){ + $this->ding_value_model->test(); + } + + //点赞排行榜 + public function rank_person() { + if($this->session->userdata('dingding_user_info') === false){ + $this->load->view('login'); + }else{ + $data = array(); + $user_info = $this->session->userdata('dingding_user_info'); + if (!empty($user_info)) { + $data['uname'] = $user_info->ddu_Name; + } + //$data['current_user'] = $current_user; + //周榜 + $monday = strtotime('this week'); + $sunday = strtotime('last day this week +7 day'); + $data['rank_week'] = $this->ding_value_model->get_person_rank($monday, $sunday); + + //月榜 + $from_date = strtotime(date('Y-m-01', time())); + $firstday = date('Y-m-01', time()); + $to_date = strtotime("$firstday +1 month -1 day"); + $data['rank_month'] = $this->ding_value_model->get_person_rank($from_date, $to_date); + //年榜 + $year_start = strtotime(date('Y-01-01', time())); + //echo strtotime(date('2017-12-31', time())); + + //$year_start = strtotime(date('2016-01-01')); + $year_end = strtotime(date('Y-12-31', time())); + //$year_end = strtotime(date('2016-12-31')); + $data['rank_year'] = $this->ding_value_model->get_person_rank($year_start, $year_end); + //总榜 + //$data['rank_all']=$this->Outlook_model->get_person_rank(); + //每条价值观对应获得最多的人 + /* ycc,暂时不需要了 + $rank=array(); + $value_array=array('team','chengxin','customer','discovery','system'); + foreach ($value_array as $value) { + $rank[$value]=$this->Outlook_model->value_key_rank($value); + for ($i=1; $i < 5; $i++) { + $value_key=$value.$i; + $rank[$value_key]=$this->Outlook_model->value_key_rank($value_key); + } + } + $data['rank']=$rank; + */ + $this->load->view('rank_person',$data); + } + } + + //钉钉扫码登录 + public function auth_login(){ + //获取code + $code = $_REQUEST['code']; + //请求access_token,并且打印出来 + $url = 'https://oapi.dingtalk.com/sns/gettoken?appid=dingoagxeeheunc0p95eu8&appsecret=R3fhIY1zWw5wJZNWeszXg0VNpxzU5i95T4tUuboTQBEWAaQyg3mGC-ssskeyt9DY'; + $access_token = json_decode($this->get_http($url,$data = '',$method = 'GET')); + //请求接口获取persistent_code + $url_info = 'https://oapi.dingtalk.com/sns/get_persistent_code?access_token='.$access_token->access_token; + $tmp_auth_code = '{"tmp_auth_code":"'.$code.'"}'; + $info = json_decode($this->get_http($url_info,$data = $tmp_auth_code,$method = 'POST')); + //请求sns_token + $url_sns = 'https://oapi.dingtalk.com/sns/get_sns_token?access_token='.$access_token->access_token; + $sns_code = '{"openid":"'.$info->openid.'","persistent_code":"'.$info->persistent_code.'"}'; + $sns_token = json_decode($this->get_http($url_sns,$sns_code,$method = 'POST')); + //获取个人信息 + $url_person = 'https://oapi.dingtalk.com/sns/getuserinfo?sns_token='.$sns_token->sns_token; + $person = json_decode($this->get_http($url_person,$data = '',$method = 'GET')); + $unionid = $person->user_info->unionid; + $username = $person->user_info->nick; + $check_login = $this->ding_value_model->get_dingding_user($unionid); + if(!$check_login){ + $data = $this->get_user_info($unionid); + $flag = $this->ding_value_model->add_dingding_user($data['ddu_Name'],$data['ddu_Unionid'],$data['ddu_Mobile'],$data['ddu_Email'],$data['ddu_Position'],$data['ddu_Avatar'],$data['ddu_Datetime']); + if(!$flag){ + exit('新增用户失败!'); + }else{ + $user_info = $this->ding_value_model->get_dingding_user($data['ddu_Unionid']); + $this->session->set_userdata('dingding_user_info',$user_info); + if($this->session->userdata('unionid') && $this->session->userdata('type')){ + redirect(site_url('apps/dingmail/index/index/'.$this->session->userdata('unionid').'/'.$this->session->userdata('type'))); + }elseif($this->session->userdata('identify') && $this->session->userdata('mail_type')){ + redirect(site_url('apps/dingmail/index/like/'.$this->session->userdata('identify').'/'.$this->session->userdata('mail_type'))); + }else{ + redirect(site_url('apps/dingmail/index/index/'.$user_info->ddu_Unionid)); + } + } + } + $now_time = time(); + if($check_login->ddu_Datetime == null){ + $check_login->ddu_Datetime = 0; + } + $last_time = $check_login->ddu_Datetime; + $time_diff = ($now_time - $last_time) / 86400; + if($time_diff > 30){ + $data= $this->get_user_info($unionid); + $this->ding_value_model->update_dingding_user($data['ddu_Name'],$data['ddu_Unionid'],$data['ddu_Mobile'],$data['ddu_Email'],$data['ddu_Position'],$data['ddu_Avatar'],$data['ddu_Datetime']); + $check_login = $this->ding_value_model->get_dingding_user($unionid); + } + $this->session->set_userdata('dingding_user_info', $check_login); + if($this->session->userdata('unionid') && $this->session->userdata('type')){ + redirect(site_url('apps/dingmail/index/index/'.$this->session->userdata('unionid').'/'.$this->session->userdata('type'))); + }elseif($this->session->userdata('identify') && $this->session->userdata('mail_type')){ + redirect(site_url('apps/dingmail/index/like/'.$this->session->userdata('identify').'/'.$this->session->userdata('mail_type'))); + }else{ + redirect(site_url('apps/dingmail/index/index/'.$check_login->ddu_Unionid)); + } + + } + + //通过钉钉获取用户详细信息 + public function get_user_info($unionid){ + //公司的access_token. + //unionid是通过扫码获取到 + //获取公司access_token,用access_token和unionid获取userid,利用userid获取成员详细信息。 + $url_access_token = 'https://oapi.dingtalk.com/gettoken?corpid=ding48bce8fd3957c96b&corpsecret=4I_TlkOUtWQ60tUYX_447WXM5mNX41q_Q03xtZJgvBOzMPzGbNKZZz_Bsv-0B9I1'; + $company_info = json_decode($this->get_http($url_access_token,$data='',$method='GET')); + $url_unionid = 'https://oapi.dingtalk.com/user/getUseridByUnionid?access_token='.$company_info->access_token.'&unionid='.$unionid; + $userid = json_decode($this->get_http($url_unionid,$data='',$method='GET')); + $url_userid = 'https://oapi.dingtalk.com/user/get?access_token='.$company_info->access_token.'&userid='.$userid->userid; + $person_details = json_decode($this->get_http($url_userid,$data='',$method='GET')); + $data['ddu_Name'] = $person_details->name; + $data['ddu_Unionid'] = $person_details->unionid; + $data['ddu_Mobile'] = $person_details->mobile; + $data['ddu_Email'] = $person_details->orgEmail; + $data['ddu_Position'] = $person_details->position; + $data['ddu_Avatar'] = $person_details->avatar; + $data['ddu_Datetime'] = time(); + return $data; + } + + //发送请求 + public function get_http($url, $data = '', $method = 'GET') { + $curl = curl_init(); // 启动一个CURL会话 + curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址 + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查 + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在 + curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // 模拟用户使用的浏览器 + curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转 + curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer + if ($method == 'POST' && !empty($data)) { + curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求 + curl_setopt($curl, CURLOPT_POSTFIELDS, $data); // Post提交的数据包 + curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json')); + } + curl_setopt($curl, CURLOPT_TIMEOUT, 45); // 设置超时限制防止死循环 + curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容 + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回 + $tmpInfo = curl_exec($curl); // 执行操作 + $errno = curl_errno($curl); + if ($errno !== 0) { + return false; + echo $errno . curl_error($curl); //记录错误日志 + } + curl_close($curl); //关闭CURL会话 + return $tmpInfo; //返回数据 + } + + //自动提示 + public function get_user_list(){ + $q = $this->input->get('q'); + $str_array = explode(';', $q); + $q = end($str_array); + if (!$q) + return; + + $showcount = 1; + $tmp = $this->ding_value_model->all_email(); + foreach ($tmp as $value) { + if ($showcount > 8) + break; + if (strstr($value->ddu_Name, $q)) { + echo $value->ddu_Name . ';' . "\n"; + $showcount++; + } + } + } + + //检测是否有value + public function check_value_user() { + $value_user_array = explode(';', $this->input->post('value_user')); + foreach ($value_user_array as $vu) { + if (!empty($vu)) { + $result = $this->ding_value_model->has_user($vu); + if (empty($result)) { + echo 0; + return; + } + } + } + echo 1; + return; + } + + //退出 + public function logout(){ + $this->session->unset_userdata('dingding_user_info'); + $this->session->unset_userdata('unionid'); + $this->session->unset_userdata('type'); + $this->session->unset_userdata('identify'); + $this->session->unset_userdata('mail_type'); + $this->input->set_cookie('userdata', '', ''); + redirect(site_url('apps/dingmail/index/index/')); + } + + public function valuemail_list(){ + header("Content-type:text/html;charset=utf-8"); + $data = $this->ding_value_model->get_valuemail_list(); + for($i=0;$i时间:'.date('y-m-d',$data[$i]->ddm_Createtime).'
'; + echo '

标题:

'.$data[$i]->ddm_Subject.'
'; + echo '

value邮件内容:

'.htmlspecialchars_decode($data[$i]->ddm_Content).'
'; + echo '
'; + } + + } + + //查询那条value使用的次数最多 + public function count_valueitems(){ + //获取所有的item条目 + $obj = $this->ding_value_model->get_allvalueitems(); + //定义变量存储数据 + $data = array(); + $data['team1_cn'] = '心存谦卑,发现并欣赏他人的长处'; + $data['team2_cn'] = '人比事更重要,爱能包容一切过错'; + $data['team3_cn'] = '相信一群平凡的人,能组成一个不平凡的团队'; + $data['team4_cn'] = '人人平等,在爱里说诚实话'; + $data['team1_num'] = 0;$data['team2_num'] = 0;$data['team3_num'] = 0;$data['team4_num'] = 0; + + $data['chengxin1_cn'] = '行真善美,恨不义财'; + $data['chengxin2_cn'] = '诚实可信,说到做到,不隐藏真相'; + $data['chengxin3_cn'] = '做人一诺千金,做事全力以赴'; + $data['chengxin4_cn'] = '勇于承担责任使你更优秀'; + $data['chengxin1_num'] = 0;$data['chengxin2_num'] = 0;$data['chengxin3_num'] = 0;$data['chengxin4_num'] = 0; + + $data['customer1_cn'] = '穿客户的鞋,客户是我们最好的老师'; + $data['customer2_cn'] = '细节展现专业,多走一里路'; + $data['customer3_cn'] = '客户的独特性就是我们存在的理由'; + $data['customer4_cn'] = '不让一点瑕疵破坏客人一生中唯一的旅程,一眚能掩大德'; + $data['customer1_num'] = 0;$data['customer2_num'] = 0;$data['customer3_num'] = 0;$data['customer4_num'] = 0; + + $data['discovery1_cn'] = '好奇心,好头脑风暴'; + $data['discovery2_cn'] = '第一个行动的,失败了也光荣;行动太迟,正确的决策也可能变成错误'; + $data['discovery3_cn'] = '以往的成功经验未必是今天问题的解决方案'; + $data['discovery4_cn'] = 'Do Without,自己创造条件达到目标'; + $data['discovery1_num'] = 0;$data['discovery2_num'] = 0;$data['discovery3_num'] = 0;$data['discovery4_num'] = 0; + + foreach ($obj as $item){ + $items = explode(',',$item->ddm_value_key); + foreach($items as $value){ + if(!empty($value)){ + switch ($value){ + case 'team1': + $data['team1_num']++; + break; + case 'team2': + $data['team2_num']++; + break; + case 'team3': + $data['team3_num']++; + break; + case 'team4': + $data['team4_num']++; + break; + case 'chengxin1': + $data['chengxin1_num']++; + break; + case 'chengxin2': + $data['chengxin2_num']++; + break; + case 'chengxin3': + $data['chengxin3_num']++; + break; + case 'chengxin4': + $data['chengxin4_num']++; + break; + case 'customer1': + $data['customer1_num']++; + break; + case 'customer2': + $data['customer2_num']++; + break; + case 'customer3': + $data['customer3_num']++; + break; + case 'customer4': + $data['customer4_num']++; + break; + case 'discovery1': + $data['discovery1_num']++; + break; + case 'discovery2': + $data['discovery2_num']++; + break; + case 'discovery3': + $data['discovery3_num']++; + break; + case 'discovery4': + $data['discovery4_num']++; + break; + } + } + } + } + + //输出内容 + echo '使用条目:'.$data['team1_cn'].' | 使用次数:'.$data['team1_num'].'
'; + echo '使用条目:'.$data['team2_cn'].' | 使用次数:'.$data['team2_num'].'
'; + echo '使用条目:'.$data['team3_cn'].' | 使用次数:'.$data['team3_num'].'
'; + echo '使用条目:'.$data['team4_cn'].' | 使用次数:'.$data['team4_num'].'
'; + echo '使用条目:'.$data['chengxin1_cn'].' | 使用次数:'.$data['chengxin1_num'].'
'; + echo '使用条目:'.$data['chengxin2_cn'].' | 使用次数:'.$data['chengxin2_num'].'
'; + echo '使用条目:'.$data['chengxin3_cn'].' | 使用次数:'.$data['chengxin3_num'].'
'; + echo '使用条目:'.$data['chengxin4_cn'].' | 使用次数:'.$data['chengxin4_num'].'
'; + echo '使用条目:'.$data['customer1_cn'].' | 使用次数:'.$data['customer1_num'].'
'; + echo '使用条目:'.$data['customer2_cn'].' | 使用次数:'.$data['customer2_num'].'
'; + echo '使用条目:'.$data['customer3_cn'].' | 使用次数:'.$data['customer3_num'].'
'; + echo '使用条目:'.$data['customer4_cn'].' | 使用次数:'.$data['customer4_num'].'
'; + echo '使用条目:'.$data['discovery1_cn'].' | 使用次数:'.$data['discovery1_num'].'
'; + echo '使用条目:'.$data['discovery2_cn'].' | 使用次数:'.$data['discovery2_num'].'
'; + echo '使用条目:'.$data['discovery3_cn'].' | 使用次数:'.$data['discovery3_num'].'
'; + echo '使用条目:'.$data['discovery4_cn'].' | 使用次数:'.$data['discovery4_num'].'
'; + + } + + public function ajax_get_data(){ + header("Content-Type: text/html;charset=utf-8"); + $from_time = $this->input->get_post('from_time'); + $to_time = $this->input->get_post('to_time'); + $type = $this->input->get_post('type'); + + if($type == 'week'){ + $from_time = strtotime($from_time); + $to_time = strtotime($to_time); + }else if($type == 'month'){ + $firstday = $from_time; + $from_time = strtotime($from_time); + $to_time = strtotime("$firstday +1 month -1 day"); + }else if($type == 'year'){ + $from_time = strtotime($from_time); + $to_time = strtotime($to_time); + } + + $rank_data = $this->ding_value_model->get_person_rank($from_time, $to_time); + + $return_html = ''; + foreach($rank_data as $key=>$value){ + $return_html .= '
  • '; + $num = $key+1; + $return_html .= 'No.'.$num.' '; + $return_html .= ''.$value->ddv_Comment_Name.''; + $return_html .= ''.$value->like_count.' like
  • '; + } + print_r($return_html); + } + + public function delete_value($sn=null){ + if(empty($sn)){ + exit('传参错误'); + }else{ + $this->ding_value_model->delete_value($sn); + } + + } +} + + +?> \ No newline at end of file diff --git a/webht/third_party/dingmail/models/ding_value_model.php b/webht/third_party/dingmail/models/ding_value_model.php new file mode 100644 index 00000000..cc656095 --- /dev/null +++ b/webht/third_party/dingmail/models/ding_value_model.php @@ -0,0 +1,334 @@ +HT = $this->load->database('HT', TRUE); + } + + //扫码获取相应人的信息 + function get_dingding_user($unionid){ + $sql = "select + * + from + Dingding_User + where + ddu_Unionid = ?"; + $query = $this->HT->query($sql, array($unionid)); + if ($query->num_rows() > 0){ + $row = $query->row(); + return $row; + } + else{ + return FALSE; + } + } + + //根据姓名获取唯一unionid + public function get_dingding_unionid($name){ + $sql = "select ddu_Unionid from Dingding_User where ddu_Name = ?"; + $query = $this->HT->query($sql, array($name)); + if ($query->num_rows() > 0){ + $row = $query->row(); + return $row; + } + else{ + return FALSE; + } + } + + + //添加用户 + function add_dingding_user($name,$unionid,$mobile,$email,$position,$avatar,$time){ + $sql = "INSERT INTO Dingding_User (ddu_Name,ddu_Unionid,ddu_Mobile,ddu_Email,ddu_Position,ddu_Avatar,ddu_Datetime) VALUES (N?,?,?,?,N?,?,?)"; + $query = $this->HT->query($sql,array($name,$unionid,$mobile,$email,$position,$avatar,$time)); + if ($query){ + return TRUE; + }else{ + return FALSE; + } + } + + //添加value事件 + function add_value($data){ + $sql = "INSERT INTO Dingding_Value (ddv_Type,ddv_Name,ddv_User_Unionid,ddv_Comment_Name,ddv_Comment_Unionid,ddv_Content,ddv_Identify,ddv_Createtime) VALUES (?,N?,?,N?,?,N?,?,?)"; + $query = $this->HT->query($sql,array($data['type'],$data['user'],$data['user_unionid'],$data['comment_name'],$data['comment_unionid'],$data['content'],$data['mail_identify'],$data['createtime'])); + if($query){ + return TRUE; + }else{ + return FALSE; + } + } + + //统计like人数 + function count_like($unionid){ + $year_start = strtotime(date('Y-01-01', time())); + $year_end = strtotime(date('Y-12-31', time())); + $sql = "SELECT COUNT(*) AS count FROM Dingding_Value WHERE ddv_Comment_Unionid = ? AND ddv_Type = 'like' AND ddv_Type = 'like' and ddv_Createtime > '{$year_start}' and ddv_Createtime < '{$year_end}'"; + $query = $this->HT->query($sql,$unionid); + $row = $query->row(); + return $row; + } + + //获取like的人是那些 + function whos_like($unionid){ + $year_start = strtotime(date('Y-01-01', time())); + $year_end = strtotime(date('Y-12-31', time())); + $sql = "SELECT ddv_Name FROM Dingding_Value WHERE ddv_Comment_Unionid = ? AND ddv_Type = 'like' and ddv_Createtime > '{$year_start}' and ddv_Createtime < '{$year_end}' ORDER BY ddv_Sn DESC"; + $query = $this->HT->query($sql,$unionid); + $row = $query->result(); + return $row; + } + + //获取value点赞的人 + function value_whos_like($identify){ + $sql = "SELECT ddv_Name FROM Dingding_Value WHERE ddv_Identify = ? and ddv_Type = 'like' and ddv_Comment_Name = 'value邮件' ORDER BY ddv_Createtime DESC"; + $query = $this->HT->query($sql,$identify); + $row = $query->result(); + return $row; + } + + //获取value拍砖的人 + function value_whos_unlike($identify){ + $sql = "SELECT ddv_Name FROM Dingding_Value WHERE ddv_Identify = ? and ddv_Type = 'unlike' and ddv_Comment_Name = 'value邮件' ORDER BY ddv_Createtime DESC"; + $query = $this->HT->query($sql,$identify); + $row = $query->result(); + return $row; + } + + //根据Identify获取value邮件 + function get_mail($identify){ + $sql = "SELECT * FROM Dingding_Mail where ddm_Identify = ?"; + $query = $this->HT->query($sql, array($identify)); + if ($query->num_rows() > 0){ + $row = $query->row(); + return $row; + } + else{ + return FALSE; + } + } + + //根据Identify获取value邮件中value的人 + function get_value($identify,$user_unionid){ + $sql = "select * from Dingding_user_mail left join Dingding_User on(ddum_Name = ddu_Name) where ddum_Identify = ? and ddu_Unionid != '$user_unionid'"; + $query = $this->HT->query($sql, array($identify)); + if ($query->num_rows() > 0){ + $row = $query->result(); + return $row; + } + else{ + return FALSE; + } + } + + //统计unlike人数 + function count_unlike($unionid){ + $year_start = strtotime(date('Y-01-01', time())); + $year_end = strtotime(date('Y-12-31', time())); + $sql = "SELECT COUNT(*) AS count FROM Dingding_Value WHERE ddv_Comment_Unionid = ? AND ddv_Type = 'unlike' and ddv_Createtime > '{$year_start}' and ddv_Createtime < '{$year_end}'"; + $query = $this->HT->query($sql,$unionid); + $row = $query->row(); + return $row; + } + + //获取unlike的人是那些 + function whos_unlike($unionid){ + $year_start = strtotime(date('Y-01-01', time())); + $year_end = strtotime(date('Y-12-31', time())); + $sql = "SELECT ddv_Name FROM Dingding_Value WHERE ddv_Comment_Unionid = ? AND ddv_Type = 'unlike' and ddv_Createtime > '{$year_start}' and ddv_Createtime < '{$year_end}' ORDER BY ddv_Sn DESC"; + $query = $this->HT->query($sql,$unionid); + $row = $query->result(); + return $row; + } + + //获取所有点评了的人的列表 + function all_comment($unionid){ + $year_start = strtotime(date('Y-01-01', time())); + $year_end = strtotime(date('Y-12-31', time())); + $sql = "SELECT * + FROM Dingding_Value + left join Dingding_User on ddu_Unionid = ddv_User_Unionid + left join Dingding_Mail on ddv_Identify = ddm_Identify + where ddv_Comment_Unionid = '$unionid' + and ddv_Createtime > '{$year_start}' and ddv_Createtime < '{$year_end}' + ORDER BY ddv_Sn DESC"; + $query = $this->HT->query($sql,$unionid); + $row = $query->result(); + return $row; + } + /* + //获取所有点评了的人的列表 + function all_comment($unionid){ + $sql = "SELECT * FROM Dingding_Value WHERE ddv_Comment_Unionid = ? ORDER BY ddv_Sn DESC"; + $query = $this->HT->query($sql,$unionid); + $row = $query->result(); + return $row; + } + */ + //获取所有员工的姓名以及邮箱(钉钉邮箱) + function all_email($data = null){ + if($data){ + $where = "where ddu_Name in ($data)"; + }else{ + $where = ''; + } + $sql = "SELECT ddu_Name,ddu_Email FROM Dingding_User ".$where; + $query = $this->HT->query($sql); + $row = $query->result(); + return $row; + } + + //根据名字确定是否存在 + public function has_user($user_name){ + $sql="SELECT * FROM Dingding_User WHERE ddu_Name='$user_name' "; + $query = $this->HT->query($sql); + return $query->result(); + } + + //新增value邮件 + public function add_mail($data){ + $sql="INSERT INTO Dingding_Mail( + ddm_subject, + ddm_content, + ddm_touser, + ddm_ccuser, + ddm_fromuser, + ddm_value_key, + ddm_identify, + ddm_createtime + ) + VALUES (N?,N?,N?,N?,N?,?,?,?)"; + $this->HT->query($sql, array($data['mail_subject'],$data['mail_content'],$data['mail_touser'],$data['mail_ccuser'],$data['mail_fromuser'],$data['mail_value_key'],$data['mail_identify'],$data['mail_createtime'])); + return $this->HT->last_id('Dingding_Mail'); + } + + //新增value的名单 + public function add_value_user($data){ + $sql="INSERT INTO Dingding_User_Mail ( + ddum_name, + ddum_identify, + ddum_createtime) + VALUES (?,?,?)"; + $this->HT->query($sql, array($data['value_user_name'],$data['value_user_identify'],$data['value_user_createtime'])); + return $this->HT->last_id('webht_user_mail'); + } + + //检测是否已经点赞(仅用于value邮件点赞) + public function is_liked($data){ + $sql = "select * from Dingding_Value where ddv_Identify = ? and ddv_User_Unionid = ? and ddv_Comment_Name = 'value邮件'"; + $query = $this->HT->query($sql,array($data['mail_identify'],$data['user_unionid'])); + if($query->num_rows() >= 1){ + return true; + }else{ + return false; + } + } + + //获取用户最新一次被点赞的时间以及人 + public function get_user_time($unionid,$user_unionid,$identify=false){ + if($identify){ + $where = "and ddv_identify = '$identify'"; + }else{ + $where = ""; + } + $sql = "select ddv_Name,ddv_Createtime from Dingding_Value where ddv_Comment_Unionid = '$unionid' and ddv_User_Unionid = '$user_unionid'$where order by ddv_Createtime desc"; + $query = $this->HT->query($sql); + if($query){ + return $query->row(); + }else{ + return false; + } + } + + //获取最新一次被评论的时间 + public function get_last_comment($comment_name,$comment_unionid){ + $sql = "select + top 1 * + from + Dingding_Value + where + ddv_Comment_Name = '$comment_name' + and + ddv_Comment_Unionid = '$comment_unionid' + and + ddv_Type in ('comment','hidden_comment') + order by + ddv_Createtime desc"; + $query = $this->HT->query($sql); + $result=$query->result(); + return $result; + } + + + //获取点赞排行榜 + public function get_person_rank($from_date=false,$to_date=false){ + $datesql=""; + if ($from_date) { + $datesql=" AND ddv_Createtime BETWEEN '$from_date' AND '$to_date' "; + } + $sql="SELECT TOP 15 + ddv_Comment_Name, + ddv_Comment_Unionid, + COUNT(ddv_Comment_Name) as like_count + FROM Dingding_Value + WHERE ddv_Type='like' AND ddv_Comment_Name != 'value邮件' + $datesql + GROUP BY ddv_Comment_Name,ddv_Comment_Unionid + ORDER BY like_count DESC"; + + $query = $this->HT->query($sql); + $result=$query->result(); + return $result; + } + + //更新用户信息 + function update_dingding_user($name,$unionid,$mobile,$email,$position,$avatar,$time){ + $sql = "UPDATE Dingding_User SET + ddu_Name = '$name', + ddu_Mobile = '$mobile', + ddu_Email = '$email', + ddu_Position = '$position', + ddu_Avatar = '$avatar', + ddu_Datetime = '$time' + WHERE ddu_Unionid = '$unionid'"; + $query = $this->HT->query($sql); + if ($query){ + return true; + }else{ + return FALSE; + } + } + + //获取value邮件列表 + public function get_valuemail_list(){ + $year = strtotime(date('Y-01-01')); + $sql = "select * from Dingding_Mail where ddm_Createtime > '$year' order by ddm_Createtime desc "; + $query = $this->HT->query($sql); + return $query->result(); + + } + + //获取所有value邮件所用的价值观 + public function get_allvalueitems(){ + $sql = "select ddm_value_key from Dingding_Mail where ddm_value_key != ''"; + $query = $this->HT->query($sql); + return $query->result(); + } + + public function delete_value($sn){ + $sql = "DELETE FROM Dingding_Value WHERE ddv_Sn = '{$sn}'"; + $query = $this->HT->query($sql); + } + + public function test(){ + $sql = "delete from Dingding_Value where ddv_Sn = '9125'"; + $query = $this->HT->query($sql); + } + +} \ No newline at end of file diff --git a/webht/third_party/dingmail/views/like.php b/webht/third_party/dingmail/views/like.php new file mode 100644 index 00000000..fdde9754 --- /dev/null +++ b/webht/third_party/dingmail/views/like.php @@ -0,0 +1,212 @@ + + + + + + + HT在线平台 + + + + + + + + + + + + + + +
    +
    +
    +
    +
    +
    + + + 他们都觉得很赞! + + + + ddv_Name; ?>; + +
    +
    +
    +
    +
    + + + 他们拍砖了! + + + ddv_Name; ?>; + +
    +
    +
    + +
    + +
    +
    +

    ddm_Subject;?>

    +
    ddm_Content); ?>
    + +
    + +
    + $c) { ?> +
    +

    whu_uname; ?>

    +

    whc_content; ?>

    +

    + whc_createtime); ?> + 回复 +

    +
    + + +
    + + +
    + +
    +
    + + + + + \ No newline at end of file diff --git a/webht/third_party/dingmail/views/login.php b/webht/third_party/dingmail/views/login.php new file mode 100644 index 00000000..39421aa0 --- /dev/null +++ b/webht/third_party/dingmail/views/login.php @@ -0,0 +1,63 @@ + + + + + value系统登录 + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +

    Welcome

    + +
    + +
    + +
    +

    IE6 isn't allowed!

    + Please use Google Chrome, Firefox, Safair, or IE7+. +
    + +
    +
    + + +
    + + + + + + diff --git a/webht/third_party/dingmail/views/mail.php b/webht/third_party/dingmail/views/mail.php new file mode 100644 index 00000000..cbcbdef3 --- /dev/null +++ b/webht/third_party/dingmail/views/mail.php @@ -0,0 +1,552 @@ + + + + + + + HT在线平台 + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    +
    +
    + +
    +
    +
    + + + + +
    +
    +
    + + + + +
    +
    +
    +
    +
    + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + \ No newline at end of file diff --git a/webht/third_party/dingmail/views/rank_person.php b/webht/third_party/dingmail/views/rank_person.php new file mode 100644 index 00000000..e1a89a0f --- /dev/null +++ b/webht/third_party/dingmail/views/rank_person.php @@ -0,0 +1,251 @@ + + + + + + + HT在线平台 + + + + + + + + + + + + + + + + + +
    +
    +
    +
    +

    个人获赞排行榜

    +
    +
    +
    +
    +

    周榜

    +
    +
    +
    + +
    +
    +
    +
    +
    +

    月榜

    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +

    年榜

    +
    + +
    +
    + +
    +
    +
    + +
    + + + \ No newline at end of file diff --git a/webht/third_party/dingmail/views/user.php b/webht/third_party/dingmail/views/user.php new file mode 100644 index 00000000..3364dc35 --- /dev/null +++ b/webht/third_party/dingmail/views/user.php @@ -0,0 +1,258 @@ + + + + + + + HT在线平台 + + + + + + + + + + + + + + + +
    +
    +
    +
    +
    +
    +
    + ddu_Avatar)){?> + + + 请退出后再次扫码登录,将展示你的钉钉头像 + +
    +
    +

    ddu_Name?>

    + + +

    +
    +
    +
    +
    +
    +
    +
    + + + 他们都觉得很赞! + + + ddv_Name; ?>; + +
    +
    +
    +
    +
    + + + 他们拍砖了! + + + ddv_Name; ?>; + +
    +
    +
    + session->userdata('dingding_user_info')->ddu_Name == $user->ddu_Name ){ ?> +
    +
    + + + 个人邮件签名设置! + + +
    +

    钉邮签名没有更新成功的同学请看这里:

    +

    拖动鼠标选中上方的三个按钮(在按钮下方鼠标左键三击试试),然后按下Ctrl+C键进行复制到自己的outlook签名里即可。

    温馨提示:不能直接用鼠标右键功能进行复制

    +
    +
    +
    + +
    + +
    +
    + +
    +
    +

    大家好,我是ddu_Name; ?>,欢迎留言......

    +
    + +
    +
    +
    + + + +
    + + +
    +
    +
    +
    + +
    + $value){?> +
    +

    + ddu_Avatar){?> + + + ddv_Type == 'hidden_comment'){ + echo $value->ddv_Name; + }else{?> + ddv_Name?> + +

    + ddv_Content == 'like' || $value->ddv_Content == 'unlike' ){ ?> +

    对你点了一个ddv_Content?>

    + ddv_Type == 'comment' || $value->ddv_Type == 'hidden_comment'){?> +

    ddv_Content?>

    + +

    ddv_Type.'+1'.'
    ';echo $value->ddm_Subject; ?>

    查看更多 + +

    + ddv_Createtime)?> +

    +
    + + +
    + +
    +
    +
    + + + + \ No newline at end of file diff --git a/webht/third_party/workflow/controllers/index.php b/webht/third_party/workflow/controllers/index.php index c37ca49a..0f209053 100644 --- a/webht/third_party/workflow/controllers/index.php +++ b/webht/third_party/workflow/controllers/index.php @@ -15,7 +15,11 @@ class Index extends CI_Controller $this->permission->is_admin(false); $this->load->model('workflow_model'); } - + + public function test(){ + $this->workflow_model->delete_test(); + } + //首页 public function index() { @@ -24,6 +28,7 @@ class Index extends CI_Controller } $data=array(); $typelist=$this->workflow_model->get_type_list('all'); + //print_r($typelist); $data['typelist']=array(); foreach ($typelist as $t) { $data['typelist'][$t->wt_parentid][]=$t; @@ -62,7 +67,12 @@ class Index extends CI_Controller //添加一个具体事务到数据库 public function do_add_work() - { + { + + $this->load->model('operator_model'); + $current_user=$this->input->post('wf_user'); + $tmp = $this->operator_model->get_user_by_name($current_user); + //判断是不是补填的值班记录 if ($this->input->post('mail_title')=='值班记录') { //本月和上个月的值班表(有可能本月初和上月尾是连着的假期) @@ -73,27 +83,32 @@ class Index extends CI_Controller $data['flow_data'][]=$this->workflow_model->get_work_flow_data($v->wf_sn); } //节假日列表 - $needdate_list=array(); + $needdate_list=$myrota=array(); foreach ($data['flow_data'] as $f) { foreach ($f as $d) { $wfd_key_arr=explode('_', $d->wfd_key); + //值班日期是周末的日期集合 if ($wfd_key_arr[0]=='weekend' && $d->wfd_value==1) { $wfd_key_arr[1]=strlen($wfd_key_arr[1])==7?substr($wfd_key_arr[1], 0,-1).'0'.substr($wfd_key_arr[1],-1):$wfd_key_arr[1]; $needdate_list[]=$wfd_key_arr[1]; } + //当前用户的值班日期集合 + $name_string=str_replace('惠毅', '惠毅;惠 毅', $d->wfd_value); + if (!empty($d->wfd_value) && stripos($name_string, $tmp['OPI_Name'])!==false && isset($wfd_key_arr[2]) && is_numeric($wfd_key_arr[2])) { + $need_date=strlen($wfd_key_arr[2])==7?substr($wfd_key_arr[2], 0,-1).'0'.substr($wfd_key_arr[2],-1):$wfd_key_arr[2]; + $myrota[]=date('Ymd',strtotime($need_date)); + } } } + $needdate_list=array_intersect($needdate_list,$myrota); $zhiban_date=date('Ymd',strtotime($this->input->post('wf_time'))); - if (!in_array($zhiban_date, $needdate_list)) { - echo json_encode(array('status'=>'no','msg'=>'请把左上角的日期改为你值班当天的日期')); - return true; + if (empty($needdate_list) or !in_array($zhiban_date, $needdate_list)) { + //echo json_encode(array('status'=>'no','msg'=>'值班日期与值班表不符,更换了值班的同学请更改值班表')); + //return true; } } //保存任务 - $this->load->model('operator_model'); - $current_user=$this->input->post('wf_user'); - $tmp = $this->operator_model->get_user_by_name($current_user); $wf_user=$tmp['OPI_SN']; $wf_time=strtotime($this->input->post('wf_time')); $group_admin=explode('@', $this->input->post('wf_wt_sn')); @@ -108,10 +123,13 @@ class Index extends CI_Controller if ($wfd_key=='emailcontent') { $wfd_value=htmlspecialchars($wfd_value); } - $col_val.="('".trim($wfd_key)."','".$wfd_value."',".$wfd_wf_sn."),"; + // $col_val.="('".trim($wfd_key)."','".$wfd_value."',".$wfd_wf_sn."),"; + $col_val.="('".trim($wfd_key)."','".chop($wfd_value)."',".$wfd_wf_sn."),";//csk 2016-9-22 去掉末尾的换行和空格 $mail_data[$wfd_key]=$wfd_value; $mail_data['flow_data'][$wfd_key]=$wfd_value; + $mail_data['flow_data'][$wfd_key]=chop($wfd_value);//csk 2016-9-22 去掉末尾的换行和空格 } + $apply_user=$this->input->post('apply_user'); if (empty($apply_user)) { $col_val.="('apply_user','".$current_user."',".$wfd_wf_sn."),"; @@ -123,7 +141,6 @@ class Index extends CI_Controller //添加审核人 $typeinfo=$this->workflow_model->get_type_list(0,$wf_wt_sn); $verify_tolist_array=$this->get_verify_admin_list($wfd_wf_sn,$group_admin[1],$typeinfo[0]->wt_linear); - //抄送邮件给指定人员 if ($wfd_wf_sn && $wfd_sn) { $data['userdata']=$this->session->userdata('admin_chtcdn'); @@ -177,6 +194,7 @@ class Index extends CI_Controller } $data['userdata']=$this->session->userdata('admin_chtcdn'); + //print_r($data['userdata']); //事务申请人信息 $userdata=$this->session->userdata('admin_chtcdn'); $flow=$this->workflow_model->get_work_list($userdata['OPI_SN'],$wv_status,$wf_sn); @@ -189,6 +207,7 @@ class Index extends CI_Controller $data[$d->wfd_key]=$d->wfd_value; $data['flow_data'][$d->wfd_key]=$d->wfd_value; } + //print_r($data); $form=$data['flow']->wt_form; $data['wf_sn']=$wf_sn; @@ -201,12 +220,16 @@ class Index extends CI_Controller //当前用户是否审核人员 0否 1是 $verify_user=$this->workflow_model->get_verify($wf_sn,0,false,50); $data['is_verify_user']=0; - foreach ($verify_user as $vu) { + // var_dump($data['userdata']);die; + if(!empty($data['userdata']['whu_uid'])){//csk2016-11-29 + foreach ($verify_user as $vu) { if ($data['userdata']['whu_uid']==$vu->wv_admin) { $data['is_verify_user']=1; break; } + } } + //用于做导航激活状态 $data['nav_type']=$nav_type; if ($nav_type=='userlist') { @@ -222,6 +245,7 @@ class Index extends CI_Controller } $data['wv_status']=$wv_status; $data['form']=$this->load->view("form/$form",$data,true); + //print_r($data); $this->load->view('n-header', $data); $this->load->view('w-nav'); $this->load->view('w-left'); @@ -313,7 +337,7 @@ class Index extends CI_Controller $namestrings=str_replace(';', ';', $namestrings); $namestrings=str_replace('(', '(', $namestrings); $namestrings=str_replace(')', ');', $namestrings); - $namestrings=str_replace('惠毅', '惠 毅', $namestrings); + //$namestrings=str_replace('惠毅', '惠 毅', $namestrings); $namestrings=str_replace("\n", ";", $namestrings); $namestrings=str_replace("\r", ";", $namestrings); $namestrings_arr=explode(';', $namestrings); @@ -336,9 +360,6 @@ class Index extends CI_Controller } if (isset($atd_sn_arr[0]->ATT_SN) && isset($epy_sn_arr[0]->EPY_ID)) { $jabtime=7; - if ($workdata[0]->OPI_Name=='周玲霞') { - $jabtime=3.5; - } //如果有自定义的考勤时间则使用自定义的数据 $kaoqin_time=$this->input->post('kaoqin_time')?$this->input->post('kaoqin_time'):''; $kaoqin_time=trim($kaoqin_time); @@ -467,6 +488,7 @@ class Index extends CI_Controller return $verify_tolist_array; } + // public function other_verify($wf_sn,$wv_status=0) { //获取当前值班名单 @@ -542,9 +564,9 @@ class Index extends CI_Controller array_multisort($datetemp3, SORT_ASC, $js_uname_list); $data['en_uname_list']=$en_uname_list; - $data['sw_uname_list']=$sw_uname_list; - $data['jd_uname_list']=$jd_uname_list; - $data['js_uname_list']=$js_uname_list; + $data['sw_uname_list']=array();//$sw_uname_list; + $data['jd_uname_list']=array();//$jd_uname_list; + $data['js_uname_list']=array();//$js_uname_list; $data['wf_sn']=$wf_sn; $data['nav_type']='rata_list'; @@ -624,6 +646,7 @@ class Index extends CI_Controller //分页 $page_flag=true; $list=$this->workflow_model->get_work_list($userdata['whu_uid'],$wv_status,false,$page_flag,false); + //print_r($list); $pages['total']=count($list);//数据总条数 $pages['pageSize']= 30;//每页展示数量 $pages['url'] = site_url("apps/workflow/index/unverify/$wv_status/");//页码链接 @@ -638,18 +661,34 @@ class Index extends CI_Controller } $datalist=$this->workflow_model->get_work_list_by_sn($task_id_str); $worklist=array(); + $wf_sn_str='0'; foreach ($datalist as $wlist) { $worklist[$wlist->wf_sn]=$wlist; + $wf_sn_str.=','.$wlist->wf_sn; } + $data['list']=$worklist; - + $flow_data=$this->workflow_model->get_work_flow_data($wf_sn_str); + + $f_datas=array(); + foreach ($flow_data as $k => $f) { + $f_datas[$f->wfd_wf_sn][$f->wfd_key]=$f->wfd_value; + } + $data['f_datas']=$f_datas; + $data['nav_type']='verify'; $data['left_nav']=$wv_status==0?'unverify':'verify'; $data['wv_status']=$wv_status; + //print_r($data); if ($wv_status==1) { $data['nav_type']='verifyed'; } - + // var_dump($data["list"]); + // foreach ($data["list"] as $key => $v) { + // echo $v->wf_status; + // echo $v->isverify; + // echo "
    "; + // } $this->load->view('n-header', $data); $this->load->view('w-nav'); $this->load->view('w-left'); @@ -847,10 +886,11 @@ class Index extends CI_Controller $data['rolelist']=$this->workflow_model->get_department_list(2); //用户列表 $data['userlist']=$this->workflow_model->get_user_list(); + if ($whu_uid!==false) { $data['userinfo']=$this->workflow_model->get_user_list($whu_uid); - $data['userinfo']=$data['userinfo'][0]; - $data['userrole']=array_filter(explode(',', $data['userinfo']->role)); + $data['userinfo']=$data['userinfo'][0]; + $data['userrole']=array_filter(explode(',', $data['userinfo']->role)); } $this->load->view('n-header', $data); $this->load->view('w-nav'); @@ -863,6 +903,7 @@ class Index extends CI_Controller //员工资料更新 public function user_edit() { + $type=$this->input->post('type'); $whu_role=$this->input->post('userrole'); $whu_uname=$this->input->post('whu_uname'); $whu_email=$this->input->post('whu_email'); @@ -870,11 +911,19 @@ class Index extends CI_Controller $department=$this->input->post('department'); $role=!empty($whu_role)?implode(',',$this->input->post('userrole')):NULL; $whu_uid=$this->input->post('whu_uid'); - $result=$this->workflow_model->update_webuser($whu_uname,$whu_email,$whu_ip,$department,$role,$whu_uid); + if($type == 'add'){ + $result = $result=$this->workflow_model->add_webuser($whu_uname,$whu_email,$whu_ip,$department,$role,$whu_uid); + }else if($type == 'delete'){ + $result=$this->workflow_model->delete_webuser($whu_uname,$whu_uid); + + }else if($type == 'update'){ + $result=$this->workflow_model->update_webuser($whu_uname,$whu_email,$whu_ip,$department,$role,$whu_uid); + } + if ($result) { - echo json_encode(array('status'=>'ok','msg'=>'保存成功!')); + echo json_encode(array('status'=>'ok','msg'=>'操作成功!')); }else{ - echo json_encode(array('status'=>'no','msg'=>'保存失败!')); + echo json_encode(array('status'=>'no','msg'=>'操作失败!')); } } @@ -1001,8 +1050,8 @@ class Index extends CI_Controller //发送邮件 $mail_tpl='rota.php'; - $subject='电子商务部'.date('n',$wf_time).'月值班安排'; - $html='各位同事,
    以下是电子商务部'.date('Y',$wf_time).'年'.date('n',$wf_time).'月值班安排,请大家做好提醒,按相关值班规定值班。
    为方便统计加班小时数,请记得到值班记录系统填写值班记录,自行调班的同事请记得到值班记录系统里面更改。
    谢谢!'; + $subject='海纳国旅'.date('n',$wf_time).'月值班安排'; + $html='各位同事,
    以下是海纳国旅'.date('Y',$wf_time).'年'.date('n',$wf_time).'月值班安排,请大家做好提醒,按相关值班规定值班。
    为方便统计加班小时数,请记得到值班记录系统填写值班记录,自行调班的同事请记得到值班记录系统里面更改。
    谢谢!'; $mailbody=$html.'

    '.$this->load->view("mail_tpl/$mail_tpl",$mail_data,true); //发送人信息 @@ -1032,13 +1081,16 @@ class Index extends CI_Controller if ($this->workflow_model->delete_wfd($wf_sn)) { $col_val=''; foreach ($this->input->post() as $wfd_key => $wfd_value) { - $col_val.="('".trim($wfd_key)."','".$wfd_value."',".$wf_sn."),"; + // $col_val.="('".trim($wfd_key)."','".$wfd_value."',".$wf_sn."),"; + + $col_val.="('".trim($wfd_key)."','".chop($wfd_value)."',".$wf_sn."),";//csk 2016-9-22 去掉末尾的换行和空格 } $apply_user=$this->input->post('apply_user'); if (empty($apply_user)) { $col_val.="('apply_user','".$current_user."',".$wf_sn."),"; } $col_val=substr($col_val, 0, -1); + $wfd_sn=$this->workflow_model->add_work_data($col_val); } @@ -1053,6 +1105,7 @@ class Index extends CI_Controller if ($this->session->userdata('verify_referer')) { $verify_referer_url=$this->session->userdata('verify_referer'); } + echo json_encode(array('status'=>'ok_go','msg'=>'更新成功!','url'=>$verify_referer_url)); } @@ -1413,5 +1466,6 @@ class Index extends CI_Controller } $this->load->view('index/print_text', $data); } - + + } diff --git a/webht/third_party/workflow/models/workflow_model.php b/webht/third_party/workflow/models/workflow_model.php index 3da7b4b6..da3c6732 100644 --- a/webht/third_party/workflow/models/workflow_model.php +++ b/webht/third_party/workflow/models/workflow_model.php @@ -100,7 +100,7 @@ class Workflow_model extends CI_Model { } public function get_work_list($wv_admin,$wv_status,$wf_sn=false,$page_flag=false,$wv_actived=-1) - { + {// $map=" AND wt_form!='rota.php' AND (wv_admin=258 or wv_admin='$wv_admin')"; if (!$wv_actived) { $map.=" AND wv_actived!=-1 "; @@ -117,7 +117,7 @@ class Workflow_model extends CI_Model { left join work_type on wf_wt_sn=wt_sn left join OperatorInfo on wf_user=OPI_SN WHERE wv_status=? $map - ORDER BY wf_time desc"; + ORDER BY wf_time desc"; $query = $this->HT->query($sql, array($wv_status)); $result=$query->result(); return $result; @@ -411,6 +411,34 @@ class Workflow_model extends CI_Model { $query = $this->HT->query($sql,array($whu_uname,$whu_email,$whu_ip,$department,$role,$whu_uid)); return $query; } + + public function add_webuser($whu_uname,$whu_email,$whu_ip,$department,$role) + { + $status = 1; + $sql="INSERT INTO webht_user + (whu_uname, + whu_email, + whu_ip, + whu_status, + department, + role) + VALUES + (?,?,?,?,?,?)"; + $query = $this->HT->query($sql,array($whu_uname,$whu_email,$whu_ip,$status,$department,$role)); + return $query; + } + + public function delete_webuser($whu_uname,$whu_uid) + { + $sql="DELETE FROM + webht_user + WHERE + whu_uname=? + and + whu_uid=?"; + $query = $this->HT->query($sql,array($whu_uname,$whu_uid)); + return $query; + } public function delete_wt($wt_sn,$wt_isdelete=1) { @@ -437,5 +465,10 @@ class Workflow_model extends CI_Model { $query=$this->HT->query($sql, array($wv_wf_sn)); return $query; } + + public function delete_test(){ + $sql = "delete from work_flow_data where wfd_key like '%201905%'"; + $query=$this->HT->query($sql); + } } \ No newline at end of file diff --git a/webht/third_party/workflow/views/form/rota.php b/webht/third_party/workflow/views/form/rota.php index 91ae4018..8d36ad27 100644 --- a/webht/third_party/workflow/views/form/rota.php +++ b/webht/third_party/workflow/views/form/rota.php @@ -5,7 +5,7 @@
    CH销售 CT 商务 - 德语 国际 技术 计调 + APP + 目的地 + 亚洲事业部 值班时间 12点-13点 9:30-12:00,13:00-17:00 - 10:00-16:00 + 10:00-16:00 到办公室 VPN 技术远程值班 无团电话值班 + VPN(8:30-23:00) + VPN(8:30-23:00) + VPN(8:30-23:00) - > + > @@ -89,9 +96,6 @@ - - - @@ -104,6 +108,15 @@ + + + + + + + + + diff --git a/webht/third_party/workflow/views/index/rata_list.php b/webht/third_party/workflow/views/index/rata_list.php index f897cfee..37e506a3 100644 --- a/webht/third_party/workflow/views/index/rata_list.php +++ b/webht/third_party/workflow/views/index/rata_list.php @@ -5,7 +5,8 @@ 提交时间 状态 操作 - 其他 + 其他 + session->userdata('admin_chtcdn'); ?> $v) { ?> @@ -23,7 +24,11 @@ 删除 - 不用发邮件记录考勤的员工 + + + 中午值班审核 + + diff --git a/webht/third_party/workflow/views/index/unverify.php b/webht/third_party/workflow/views/index/unverify.php index e37e0edc..98e05a90 100644 --- a/webht/third_party/workflow/views/index/unverify.php +++ b/webht/third_party/workflow/views/index/unverify.php @@ -6,9 +6,14 @@ 状态 操作 - $v) { ?> + $v) { ?> - + + + + + + wt_name.'('.$v->OPI_Name.')'; ?> wf_time); ?> wf_status==0? ($v->isverify!=1?'还没处理':'处理中'):'已审核';echo $status; ?> @@ -20,6 +25,15 @@ + + + + session->userdata('admin_chtcdn'); if (isset($left_nav) && $left_nav=='unverify' && ($userdata['OPI_Name']=='侯敏' || $userdata['OPI_Name']=='王婷' )) { ?> + 批量审核 + 审核不通过 + + + @@ -29,4 +43,52 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/webht/third_party/workflow/views/index/user_manage.php b/webht/third_party/workflow/views/index/user_manage.php index e34bf2e7..4fde522d 100644 --- a/webht/third_party/workflow/views/index/user_manage.php +++ b/webht/third_party/workflow/views/index/user_manage.php @@ -20,7 +20,14 @@
    员工资料编辑 - + +
    +
    +
    @@ -63,16 +70,117 @@
    - - - + + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    + + + +
    +
    +
    + +
    +
    + + + + +
    +
    +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    + + + +
    +
    +
    + +
    +
    + + + + +
    +
    +
    +
    +
    + +
    diff --git a/webht/third_party/workflow/views/index/verify.php b/webht/third_party/workflow/views/index/verify.php index 17024a14..cb3a6ee5 100644 --- a/webht/third_party/workflow/views/index/verify.php +++ b/webht/third_party/workflow/views/index/verify.php @@ -31,9 +31,11 @@
    - + - + diff --git a/webht/third_party/workflow/views/mail_tpl/rota.php b/webht/third_party/workflow/views/mail_tpl/rota.php index 9d92193a..83bbc015 100644 --- a/webht/third_party/workflow/views/mail_tpl/rota.php +++ b/webht/third_party/workflow/views/mail_tpl/rota.php @@ -23,6 +23,7 @@ table th,table td{padding: 5px;font-size: 12px;text-align: center;vertical-align 国际 技术 计调 + APP 值班时间 @@ -33,6 +34,7 @@ table th,table td{padding: 5px;font-size: 12px;text-align: center;vertical-align VPN 技术远程值班 无团电话值班 + VPN(8:30-23:00) @@ -63,6 +66,7 @@ table th,table td{padding: 5px;font-size: 12px;text-align: center;vertical-align

    +

    \ No newline at end of file diff --git a/webht/third_party/workflow/views/w-left.php b/webht/third_party/workflow/views/w-left.php index f54dc2be..e4a3ce23 100644 --- a/webht/third_party/workflow/views/w-left.php +++ b/webht/third_party/workflow/views/w-left.php @@ -8,7 +8,10 @@
  • - session->userdata('admin_chtcdn'); if ($userdata['whu_isadmin']==1) { ?> + session->userdata('admin_chtcdn'); + if ( !empty($userdata['whu_isadmin']) && $userdata['whu_isadmin']==1) { + ?>