//批量淘汰-----和待定-----批量婉拒 ------的操作 public function beatchOperation($params = array() ){ $fstatus = $params['fstatus']; $action = $params['action']; ; $action_str = '' ; $action_id = $params['action_id']; $sourceInterview = new Source_Interview(); $action_id = $sourceInterview->getActionIdByParams($action_id); if(empty($action_id)){ return array('code' => -3 , 'msg' =>Common::GetLangStr('resume_action_choose','company' )); } $action_str = $action_id ; $action_ids = explode(",", $action_id); if(count($action_ids) > 50 ){ return array('code' => -3 , 'msg' =>Common::GetLangStr('resume_action_num_max','company' )); } $actionModel = new ActionModel(); $deliveryLogModel = new DeliveryLogModel(); $actionData = $actionModel->getActionDataById($action_id); if(empty($actionData)){ return array('code' =>0, 'msg' => Common::GetLangStr('resume_action_choose','company' )); } $c_user_id = 0 ;//企业的id $c_user_id = isset($actionData[0]['c_user_id']) ? $actionData[0]['c_user_id'] : 0 ; if(empty($c_user_id)){ return array('code' =>0, 'msg' =>"error company "); } //查询企业的帐号状态 $userModel = new UserModel(); $cUser = $userModel->getUserDataById($c_user_id , "*"); if(empty($cUser)){ return array('code' =>0, 'msg' =>"error company.."); } if($cUser['fstatus'] != 1 ){ $notActive = array( 'email' => $cUser['email'], 'email_check' => $cUser['email_check'], 'mobile' => $cUser['mobile'], 'c_user_id' => $c_user_id, ) ; return array('code' => -1002 , 'msg' =>Common::GetLangStr('account_not_active','user' ),'data' => $notActive); } $object = $this->db(0); $now = date('Y-m-d H:i:s', time()); $deliveryLog = array(); try{ $object->beginTransaction() ; //开始事物 $sql = "update {$object->dbprefix}action set fstatus = '{$fstatus}' ,interview_status = '1' ,updatetime='{$now}' where id in ($action_str)" ; $num = $object->Exec($sql); if($num <= 0 ){ throw new Exception(Common::GetLangStr('resume_action_error','company' ) ); } foreach ($actionData as $key => $value ) { $deliveryLog[]=array( 'user_id' => $value['p_user_id'], 'action_id' => $value['id'], 'add_time' => $now, 'action' => $action, ); } $dNum = $deliveryLogModel->addAllDeliveryLog($deliveryLog); if($dNum <= 0 ){ throw new Exception(Common::GetLangStr('resume_action_add_log_error','company' ) ); } //修改action表中的那个最终的状态 if($fstatus == 4 ){ $actionModel->updateDeliveryAstatus($action_str,4); } $object->commit();//事物提交哦 return array('code' => 1 , 'msg' => Common::GetLangStr('resume_action_operation_success','company' )); }catch(Exception $e){ $object->rollBack(); return array('code'=>-4 , 'msg'=>$e->getMessage()); }
此代码是PC端接口调用的内部代码