123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515 |
- <?php
-
-
- namespace app\api\model\v1;
-
- use think\Db;
- use think\Cache;
-
- class Zc extends Base{
-
-
-
- public function zcPos($name){
-
- $name = trim($name);
- $row = Db::name('zc_position')->where('title',$name)->find();
- if($row){
- return $row['id'];
- }else{
- $id = Db::name('zc_position')->insertGetId([
- 'title' => $name,
- 'intro' => '0',
- 'type' => 0,
- 'dj_group_id' => 0,
- 'add_time' => time(),
- 'update_time' => time(),
- ]);
- return $id;
- }
- }
-
-
- public function zcTypeAndDj($aid,$name){
-
- $one = Db::name('zc_position')->where(['id'=>$aid])->find();
-
-
-
- $row = Db::name('zcdj_position')
- ->where('title',$name)
- ->where('type',$one['dj_group_id'])
- ->find();
-
- if($row){
-
- return $row['id'];
- }else{
-
- if((int)$one['dj_group_id'] > 0){
-
- $id = Db::name('zcdj_position')->insertGetId([
- 'title' => $name,
- 'intro' => '0',
- 'type' => $one['dj_group_id'],
- 'add_time' => time(),
- 'update_time' => time(),
- ]);
- return $id;
- }else{
-
-
-
- $cid = Db::name('zc_type')->insertGetId([
- 'name' => $one['title'],
- 'pid' => 25,
- 'level' => 1,
- 'add_time' => time(),
- 'update_time' => time(),
- 'catid' => 3
- ]);
-
- $did = Db::name('zcdj_position')->insertGetId([
- 'title' => $name,
- 'type' => $cid,
- 'intro' => '0',
- 'add_time' => time(),
- 'update_time' => time()
- ]);
-
- Db::name('zc_position')->where(['id'=>$aid])->update([
- 'dj_group_id' => $cid
- ]);
- return $did;
- }
- }
- }
-
-
-
- public function zczyAdd($aid,$rowData){
-
- $one = Db::name('zc_position')->where(['id'=>$aid])->find();
-
- $two = Db::name('zc_type')->where([
- 'pid' => 23,
- 'level' => 1,
- 'is_del' => 0,
- 'name' => $one['title'],
- 'catid' => 2,
- ])->find();
- if($two){
- $yid = $two['id'];
- }else{
-
- $yid = Db::name('zc_type')->insertGetId([
- 'name' => $one['title'],
- 'pid' => 23,
- 'level' => 1,
- 'add_time' => time(),
- 'update_time' => time(),
- 'catid' => 2
- ]);
- }
-
- $list_ids = [];
- foreach ($rowData[0] as $k=>$v){
- if($k >= 10){
- if(!empty($v)) {
-
- $row = Db::name('zczy_position')
- ->where('title', $v)
-
- ->where('is_del', 0)
- ->find();
- if ($row) {
- $list_ids[] = (int)$row['id'];
- } else {
-
- $zy_id = Db::name('zczy_position')->insertGetId([
- 'title' => $v,
- 'type' => $yid,
- 'intro' => '0',
- 'add_time' => time(),
- 'update_time' => time()
- ]);
- $list_ids[] = (int)$zy_id;
- }
- }
- }
- }
- return $list_ids;
- }
-
-
-
- public function bindZcZy($aid,$yids){
-
- Db::name('zc_zy')
- ->where(['zc_id'=>$aid,'is_del'=>0])
- ->update(['is_del'=>1,'del_time'=>time()]);
-
-
- $map_data = [];
- foreach ($yids as $k => $v) {
- $map_data[] = [
- 'map_id' => $v,
- 'zc_id' => $aid,
- 'add_time' => time(),
- 'is_del' => 0,
- 'del_time' => 0
- ];
- }
- Db::name('zc_zy')->insertAll($map_data);
- }
-
-
- public function ZsZcAdd($aid,$name){
- $one = Db::name('zc_position')->where(['id'=>$aid])->find();
-
- $two = Db::name('zc_type')->where([
- 'pid' => 17,
- 'level' => 1,
- 'is_del' => 0,
- 'name' => $one['title'],
- 'catid' => 1,
- ])->find();
- if(empty($two)){
-
- $sid = Db::name('zc_type')->insertGetId([
- 'name' => $one['title'],
- 'pid' => 17,
- 'level' => 1,
- 'add_time' => time(),
- 'update_time' => time(),
- 'catid' => 1
- ]);
- }else{
- $sid = $two['id'];
- }
-
-
- $row = Db::name('zczs_position')
- ->where('title',$name)
- ->where('type',$sid)
- ->where('is_del',0)
- ->find();
- if($row){
- return $row['id'];
- }else{
-
- $zs_id = Db::name('zczs_position')->insertGetId([
- 'title' => $name,
- 'type' => $sid,
- 'intro' => '0',
- 'add_time' => time(),
- 'update_time' => time()
- ]);
- return $zs_id;
- }
- }
-
-
- public function bingZs($aid,$zids){
-
- Db::name('zc_zs')
- ->where(['zc_id'=>$aid,'is_del'=>0])
- ->update(['is_del'=>1,'del_time'=>time()]);
-
-
- $map_data = [];
- foreach ($zids as $k => $v) {
- $map_data[] = [
- 'map_id' => $v,
- 'zc_id' => $aid,
- 'add_time' => time(),
- 'is_del' => 0,
- 'del_time' => 0
- ];
- }
- Db::name('zc_zs')->insertAll($map_data);
- }
-
-
-
- public function zsBindXl($sid,$rowData){
- $xl = $rowData[0][4];
- $xl_str = [
- '博士' => 6,
- '硕士' => 5,
-
-
- '本科' => 4,
- '大专' => 3,
- '高技' => 2,
- '中专' => 1,
- ];
- if(!empty($xl)){
-
-
- $bdxl = Db::name('zczs_position')->where(['id'=>$sid])->value('bdxl');
- $xl_num = $xl_str[$xl];
-
- if(empty($bdxl) || !empty($bdxl) && (int)$bdxl > (int)$xl_num){
- Db::name('zczs_position')->where(['id'=>$sid])->update(['bdxl'=>$xl_num]);
- }
- }
- }
-
-
-
- public function addZcwd($aid,$did,$rowData){
-
-
- $area = $rowData[0][1];
- if(!empty($area)){
-
- $a = Db::name('citysite')
- ->where('name','like','%'.$area)
- ->find();
- $sf = $a['id'];
- $cs = 0;
-
- if((int)$a['level'] === 2){
-
- $b = Db::name('citysite')
- ->where('id','=',$a['parent_id'])
- ->find();
- $sf = $b['id'];
- $cs = $a['id'];
- }
- }else{
-
- $sf = 28;
- $cs = 0;
- }
-
- $zc = Db::name('zcwd_position')->where([
- 'type' => $aid,
- 'sf' => $sf,
- 'cs' => $cs,
- 'sbdj' => $did,
- 'is_del' => 0
- ])->find();
-
- if($zc){
- return $zc['id'];
- }else{
-
- $title = $rowData[0][0].'-'.$rowData[0][2].'-'.$rowData[0][1];
-
- $data = array(
- 'title' => $title,
- 'type' => $aid,
- 'intro' => '0',
- 'admin_id' => 1,
- 'lang' => 'cn',
- 'add_time' => getTime(),
- 'update_time' => getTime(),
- 'sf' => $sf,
- 'cs' => $cs,
- 'sbdj' => $did,
- 'is_ega' => 0,
- 'ega_0' => 23,
- 'ega_1' => 60,
- 'byzy' => 0,
- 'zhengshu2' => '',
- 'xlyq' => 0,
- 'xxlx' => 0,
- 'bysj' => 0,
- 'bysj_time' => 0,
- 'is_zs' => 0,
- 'zhengshu' => '',
- 'sjnx' => 0,
- 'gzyq' => json_encode([]),
- 'qttj' => '',
- 'orderno' => date('YmdHis',time()).rand(1000,9999)
- );
- $insertID = Db::name('zcwd_position')->insertGetId($data);
- return $insertID;
- }
- }
-
-
-
-
- public function addZcXi($gid,$yids,$rowData){
-
-
-
- $nl = $rowData[0][6];
- if(empty($nl)){
- $is_ega = 0;
- $ega_0 = 18;
- $ega_1 = 99;
- }else{
- $is_ega = 1;
- $ega_0 = $nl;
- $ega_1 = 99;
- }
-
-
- $zyyq = $rowData[0][7];
- if($zyyq == '一致'){
- $byzy = 1;
- }else{
- $byzy = 0;
- }
-
-
- $xlyq_str = $rowData[0][4];
- $xl_str = [
- '博士' => 6,
- '硕士' => 5,
-
-
- '本科' => 4,
- '大专' => 3,
- '高技' => 2,
- '中专' => 1,
- ];
- $xlyq = 0;
- if(isset($xl_str[$xlyq_str])){
- $xlyq = $xl_str[$xlyq_str];
- }
-
-
- $xxlx_str = $rowData[0][3];
- if($xxlx_str == '不限'){
- $xxlx = 0;
- }else if($xxlx_str == '全日制'){
- $xxlx = 1;
- }else if($xxlx_str == '非全日制'){
- $xxlx = 2;
- }else{
-
- $xxlx = 0;
- }
-
-
- $bynx = $rowData[0][5];
- if(empty($bynx)){
-
- $bysj = 0;
- $bynx = 0;
- }else{
- $bysj = 1;
- }
-
-
- $oen = Db::name('zcwe_position')
- ->where([
- 'type'=>$gid,
- 'is_del' => 0,
- 'is_ega' => $is_ega,
- 'ega_0' => $ega_0,
- 'ega_1' => $ega_1,
- 'byzy' => $byzy,
- 'zhengshu2' => json_encode($yids,JSON_UNESCAPED_UNICODE),
- 'xlyq' => $xlyq,
- 'xxlx' => $xxlx,
- 'bysj' => $bysj,
- 'bysj_time' => $bynx,
- ])->find();
- if($oen){
-
- return $oen['id'];
- }else{
-
-
- $title = $rowData[0][0].'-'.$rowData[0][2].'-'.$rowData[0][1].'-'.$rowData[0][4];
-
- $data = array(
- 'title' => $title,
- 'type' => $gid,
- 'intro' => '0',
- 'admin_id' => 1,
- 'lang' => 'cn',
- 'add_time' => getTime(),
- 'update_time' => getTime(),
- 'sf' => 0,
- 'cs' => 0,
- 'sbdj' => 0,
- 'is_ega' => $is_ega,
- 'ega_0' => $ega_0,
- 'ega_1' => $ega_1,
- 'byzy' => $byzy,
- 'zhengshu2' => json_encode($yids,JSON_UNESCAPED_UNICODE),
- 'xlyq' => $xlyq,
- 'xxlx' => $xxlx,
- 'bysj' => $bysj,
- 'bysj_time' => $bynx,
- 'is_zs' => 0,
- 'zhengshu' => '',
- 'sjnx' => 0,
- 'gzyq' => json_encode([]),
- 'qttj' => ''
- );
- $insertID = Db::name('zcwe_position')->insertGetId($data);
- return $insertID;
- }
- }
-
-
-
- public function addZsGz($gid,$xid,$sid,$rowData){
- $oen = Db::name('zcwf_position')
- ->where([
- 'type' => $gid,
- 'type_son' => $xid,
- 'is_zs' => 1,
- 'zhengshu' => json_encode([(int)$sid]),
- 'sjnx' => json_encode([$rowData[0][9]]),
- ])->find();
- if($oen){
- return $oen['id'];
- }else{
-
- $title = $rowData[0][0].'-'.$rowData[0][2].'-'.$rowData[0][1].'-'.$rowData[0][4];
-
- $data = array(
- 'title' => $title,
- 'type' => $gid,
- 'type_son' => $xid,
- 'intro' => '0',
- 'admin_id' => 1,
- 'lang' => 'cn',
- 'add_time' => getTime(),
- 'update_time' => getTime(),
- 'sf' => 0,
- 'cs' => 0,
- 'sbdj' => 0,
- 'is_ega' => 0,
- 'ega_0' => 0,
- 'ega_1' => 0,
- 'byzy' => 0,
- 'zhengshu2' => '',
- 'xlyq' => 0,
- 'xxlx' => 0,
- 'bysj' =>0,
- 'bysj_time' => 0,
- 'is_zs' => 1,
- 'zhengshu' => json_encode([(int)$sid]),
- 'sjnx' => json_encode([$rowData[0][9]]),
- 'gzyq' => json_encode([]),
- 'qttj' => '',
- );
- $insertID = Db::name('zcwf_position')->insertGetId($data);
- return $insertID;
- }
- }
- }
|