Knowledge Points:
1, Ajax Delete;
2, a synchronous implementation of three asynchronous effect.
HTML section
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
Background thinkphp Section
<?php/** * Created by Phpstorm. * User:administrator * DATE:2017/6/9 * time:17:14 */namespace home\controller;class Recruitcontroller extends CompanyBa Secontroller {public Function __construct () {parent::__construct (); }//My Recruiting Public Function recruitment_manage () {if (!session ('? User.ID ')) {$this->redirect ( ' User/login '); } else {$name = $_session[' user ' [' username ']; $user = M ("Users"); $usermodel = $user->where ("Username=". $name)->find (); $this->assign ("user", $usermodel); }//1 shows the resumes received $received _resume= $this->received_resume (); 2 show downloaded CV $download _resume= $this->download_resume (); 3 Show position status $job _state= $this->job_state (); Output to template $this->assign (' Received_resume ', $received _resume); $this->assign (' Download_resume ', $download _resume); $this->assign (' Job_state ', $job _state); $this->display (); }//Received resume Public function Received_resume () {$sendObj =m ("Send"); $JOBOBJ =m ("Job"); $RESUMEOBJ =m ("Resume"); $basicConfig = M (' basicconfigcategory '); $array =array (' female ', ' Male ');//0 on behalf of female, 1 for male//Query the Send table contains company_id information in the Res//send table company_id equals the enterprise type User ID $re s= $sendObj->where (Array (' company_id ' = $this->uid))->order (' create_time desc ')->select (); Re-combines the contents of the Res object for output to the foreground. Equivalent to creating a new model foreach ($res as & $val) {//Circular query Res object val in job_id corresponding job table information deposited in re S2 $res 2 = $jobObj->where (array (' id ' = = $val [' job_id '])->find (); Query res user_id corresponding resume table information//user ID and resume ID is the same, the Resume table ID is not self-growth. Then you can only create a resume. $res 3 = $resumeObj->where (array (' id ' = = $val [' user_id '])->find (); $res 4= $basicConfig->where (array (' id ' = $res 3[' work_year '))->find (); In Res2 take the position name corresponding to the job_id $val [' job_name '] = $res 2[' nAme ']; Res3 the user name corresponding to the user_id $val [' name '] = $res 3[' name ']; Time foreground method do//$val [' create_time '] = Date ("y-m-d h:i", $val [' create_time ']); Sex $val [' sex '] = $array [$res 3[' sex ']; Working experience $val [' work_year ']= $res 4[' name ']; } return $res; }//downloaded CV public Function Download_resume () {$resume _download=m ("Resume_download"); $JOBOBJ =m ("Job"); $basicConfig = M (' basicconfigcategory '); Var_dump ($basicConfig); $RESUMEOBJ =m ("Resume"); $array =array (' female ', ' male '); The company_id in the table is actually the user (Enterprise) id $res = $resume _download->where (Array (' company_id ' + $this->uid))->order (' Create_time desc ')->select (); Re-combines the contents of the Res object for output to the foreground. The equivalent of creating a new model foreach ($res as & $val) {//$res 2 = $JOBOBJ->where (' ID ' = = $val [' job_id ']))->find (); The user ID and resume ID are the same, and the Resume table ID is not self-growing. $res 3 = $resumeObj->WHEre (Array (' id ' = = $val [' user_id ']))->find (); $res 4= $basicConfig->where (array (' id ' = $res 3[' work_year '))->find (); Job title//$val [' job_name '] = $res 2[' name ']; CV name $val [' Resume_name ']= $res 3[' resume_name ']; Username $val [' name '] = $res 3[' name ']; Sex $val [' sex '] = $array [$res 3[' sex ']; Working experience $val [' work_year ']= $res 4[' name ']; Time foreground method do//$val [' create_time '] = Date ("y-m-d h:i", $val [' create_time ']); } return $res; }/* Position status list shows CompanyID the current login post name (link to details), release time, release status company table id== user id==company_id==user_id */Publ IC function Job_state () {$jobObj =m (' job '); Find out all the jobs that this enterprise has posted//compan_id is the ID of the enterprise type user $res = $JOBOBJ->where (Array (' company_id ' = $this->uid))->o Rder (' create_time desc ')->select (); Looping through jobs//foreach ($res as & $val) {//$res2= $jobObj->where (array (' id ' = $val [' job_id '])->find ();///Job name//$val [' job_name ']= $res 2[' n Ame '];//} return $res; }//Delete position public Function del_job () {$id =i (' post.id '); $re =m (' Job ')->where (' id= '. $id)->delete (); $jobnum = M (' Job ')->where (Array (' state ' = = 1))->count (); Number of positions approved//$re = 1; The return value of the test//delete method is the number of records deleted, and if the return value is False it indicates a SQL error, and a return value of 0 indicates that no data was deleted. if ($re >0) {$msg [' code '] = 1; $msg [' msg '] = ' delete succeeded '; }else{$msg [' code '] = 0; $msg [' msg '] = ' delete failed '; } return $this->ajaxreturn ($msg); }//Delete received CV public Function Del_received_resume () {$id =i (' post.id '); $re =m (' Send ')->where (' id= '. $id)->delete (); $re = 0; The return value of the test//delete method is the number of records deleted, and if the return value is False it indicates a SQL error, and a return value of 0 indicates that no data was deleted. if ($re >0) {$msg [' code '] = 1; $msg [' msg '] = ' delete succeeded '; }else{ $msg [' code '] = 0; $msg [' msg '] = ' delete failed '; } return $this->ajaxreturn ($msg); }//Delete the downloaded CV public Function del_resume_download () {$id =i (' post.id '); $re =m (' Resume_download ')->where (' id= '. $id)->delete (); $re = 0; The return value of the test//delete method is the number of records deleted, and if the return value is False it indicates a SQL error, and a return value of 0 indicates that no data was deleted. if ($re >0) {$msg [' code '] = 1; $msg [' msg '] = ' delete succeeded '; }else{$msg [' code '] = 0; $msg [' msg '] = ' delete failed '; } return $this->ajaxreturn ($msg); }}
thinkphp Ajax Remove Hidden and display