Nessuna descrizione
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ZcbdPosition.php 49KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258
  1. <?php
  2. /**
  3. * 易优CMS
  4. * ============================================================================
  5. * 版权所有 2016-2028 海南赞赞网络科技有限公司,并保留所有权利。
  6. * 网站地址: http://www.eyoucms.com
  7. * ----------------------------------------------------------------------------
  8. * 如果商业用途务必到官方购买正版授权, 以免引起不必要的法律纠纷.
  9. * ============================================================================
  10. * Author: 小虎哥 <1105415366@qq.com>
  11. * Date: 2018-4-3
  12. */
  13. namespace app\admin\controller;
  14. use think\Page;
  15. use think\Db;
  16. use think\Cache;
  17. class ZcbdPosition extends Base
  18. {
  19. private $ad_position_system_id = array(); // 系统默认位置ID,不可删除
  20. public function _initialize() {
  21. parent::_initialize();
  22. }
  23. public function index()
  24. {
  25. $list = array();
  26. $get = input('get.');
  27. $keywords = input('keywords/s');
  28. $condition = [];
  29. // 应用搜索条件
  30. foreach (['keywords', 'type'] as $key) {
  31. $get[$key] = addslashes(trim($get[$key]));
  32. if (isset($get[$key]) && $get[$key] !== '') {
  33. if ($key == 'keywords') {
  34. $condition['a.title'] = array('LIKE', "%{$get[$key]}%");
  35. } else {
  36. $tmp_key = 'a.'.$key;
  37. $condition[$tmp_key] = array('eq', $get[$key]);
  38. }
  39. }
  40. }
  41. // 多语言
  42. //$condition['a.lang'] = array('eq', $this->admin_lang);
  43. $adPositionM = Db::name('zc_form');
  44. $count = $adPositionM->alias('a')->where($condition)->count();// 查询满足要求的总记录数
  45. $Page = new Page($count, config('paginate.list_rows'));// 实例化分页类 传入总记录数和每页显示的记录数
  46. $list = $adPositionM->alias('a')->where($condition)
  47. ->order('type desc,type_son desc,id desc')
  48. ->limit($Page->firstRow.','.$Page->listRows)->getAllWithIndex('id');
  49. //var_dump($condition);die;
  50. // 每组获取三张图片
  51. $pids = get_arr_column($list, 'id');
  52. $ad = Db::name('zcwf')
  53. ->where(['pid' => ['IN', $pids], 'lang' => $this->admin_lang])
  54. ->order('pid asc, id asc')
  55. ->select();
  56. foreach ($list as $k => $v) {
  57. /*
  58. if (1 == $v['type']) {
  59. // 图片封面图片
  60. $v['ad'] = [];
  61. foreach ($ad as $m => $n) {
  62. if ($v['id'] == $n['pid']) {
  63. $n['litpic'] = get_default_pic($n['litpic']); // 支持子目录
  64. $v['ad'][] = $n;
  65. unset($ad[$m]);
  66. } else {
  67. continue;
  68. }
  69. }
  70. // 若没有内容则显示默认图片
  71. if (empty($v['ad'])) {
  72. $v['ad_count'] = 0;
  73. $v['ad'][]['litpic'] = ROOT_DIR . '/public/static/common/images/not_adv.jpg';
  74. } else {
  75. $v['ad_count'] = count($v['ad']);
  76. }
  77. // 广告类型
  78. $v['type_name'] = '图片';
  79. } else if (2 == $v['type']) {
  80. // 多媒体封面图片
  81. $v['ad'][]['litpic'] = ROOT_DIR . '/public/static/admin/images/ad_type_media.png';
  82. // 广告类型
  83. $v['type_name'] = '多媒体';
  84. } else if (3 == $v['type']) {
  85. // HTML代码封面图片
  86. $v['ad'][]['litpic'] = ROOT_DIR . '/public/static/admin/images/ad_type_html.png';
  87. // 广告类型
  88. $v['type_name'] = 'HTML代码';
  89. }*/
  90. //处理图片
  91. $v['ad'] = [];
  92. foreach ($ad as $m => $n) {
  93. if ($v['id'] == $n['pid']) {
  94. $n['litpic'] = get_default_pic($n['litpic']); // 支持子目录
  95. $v['ad'][] = $n;
  96. unset($ad[$m]);
  97. } else {
  98. continue;
  99. }
  100. }
  101. // 若没有内容则显示默认图片
  102. if (empty($v['ad'])) {
  103. $v['ad_count'] = 0;
  104. $v['ad'][]['litpic'] = ROOT_DIR . '/public/static/common/images/not_adv.jpg';
  105. } else {
  106. $v['ad_count'] = count($v['ad']);
  107. }
  108. //获取地区
  109. $one = Db::name('citysite')
  110. ->where(['id'=>$v['type']])
  111. ->find();
  112. $v['type_name'] = $one['name'];
  113. $v['extend'] = json_decode($v['extend'], true);
  114. $list[$k] = $v;
  115. }
  116. $show = $Page->show();// 分页显示输出
  117. $this->assign('page',$show);// 赋值分页输出
  118. $this->assign('list',$list);// 赋值数据集
  119. $this->assign('pager',$Page);// 赋值分页对象
  120. /*多语言模式下,广告位ID显示主体语言的ID和属性title名称*/
  121. $main_adv_list = [];
  122. if ($this->admin_lang != $this->main_lang && empty($this->globalConfig['language_split'])) {
  123. $attr_values = get_arr_column($list, 'id');
  124. $languageAttrRow = Db::name('language_attr')->field('attr_name,attr_value')->where([
  125. 'attr_value' => ['IN', $attr_values],
  126. 'attr_group' => 'ad_position',
  127. 'lang' => $this->admin_lang,
  128. ])->getAllWithIndex('attr_value');
  129. $ids = [];
  130. foreach ($languageAttrRow as $key => $val) {
  131. $tid_tmp = str_replace('adp', '', $val['attr_name']);
  132. array_push($ids, intval($tid_tmp));
  133. }
  134. $main_advRow = Db::name('zc_form')->field("id,title,CONCAT('adp', id) AS attr_name")
  135. ->where([
  136. 'id' => ['IN', $ids],
  137. 'lang' => $this->main_lang,
  138. ])->getAllWithIndex('attr_name');
  139. foreach ($list as $key => $val) {
  140. $key_tmp = !empty($languageAttrRow[$val['id']]['attr_name']) ? $languageAttrRow[$val['id']]['attr_name'] : '';
  141. $main_adv_list[$val['id']] = [
  142. 'id' => !empty($main_advRow[$key_tmp]['id']) ? $main_advRow[$key_tmp]['id'] : '',
  143. 'title' => !empty($main_advRow[$key_tmp]['title']) ? $main_advRow[$key_tmp]['title'] : '',
  144. ];
  145. }
  146. }
  147. $this->assign('main_adv_list', $main_adv_list);
  148. /*end*/
  149. //查找区域数据
  150. $pro_list = Db::name('citysite')->where(['level'=>1,'is_open'=>1])->select();
  151. //var_dump($pro_list);
  152. $this->assign('pro_list', $pro_list);
  153. return $this->fetch();
  154. }
  155. /*
  156. * 获取区域
  157. */
  158. public function getCity(){
  159. $id = request()->post('id');
  160. //查找子集城市
  161. $list = Db::name('citysite')->where(['status'=>1,'parent_id'=>$id])->select();
  162. $html = '<option value="0">选择市</option>';
  163. foreach ($list as $k=>$v){
  164. $html .= '<option value="'.$v['id'].'">'.$v['name'].'</option>';
  165. }
  166. $data = [
  167. 'code' => 0,
  168. 'msg' => '获取成功',
  169. 'data' => $html,
  170. ];
  171. return json($data);
  172. }
  173. /**
  174. * 新增
  175. */
  176. public function add()
  177. {
  178. //防止php超时
  179. function_exists('set_time_limit') && set_time_limit(0);
  180. if (is_language() && empty($this->globalConfig['language_split'])) {
  181. $this->language_access(); // 多语言功能操作权限
  182. }
  183. if (IS_POST) {
  184. $post = input('post.');
  185. /*
  186. * array(11) { ["title"]=> string(12) "建筑职称" ["type"]=> string(1) "1" ["img_id"]=> array(1) { [0]=> string(0) "" } ["img_litpic"]=> array(1) { [0]=> string(67) "https://oss.zcwf10000.com/uploads/allimg/20240528/1-24052R01005Z4.png" } ["img_title"]=> array(1) { [0]=> string(0) "" } ["img_links"]=> array(1) { [0]=> string(0) "" } ["img_intro"]=> array(1) { [0]=> string(0) "" } ["img_target"]=> array(1) { [0]=> string(1) "0" } ["video_litpic"]=> string(0) "" ["html_intro"]=> string(0) "" ["intro"]=> string(0) "" }
  187. */
  188. //var_dump($post);die;
  189. //增加
  190. $post['zhengshu_val'] = substr($post['zhengshu_val'], 0, -1);
  191. $post['zhengshu'] = explode(',',$post['zhengshu_val']);
  192. //var_dump($post['zhengshu']);die;
  193. //var_dump($post);die;
  194. if((int)$post['is_zs'] === 0){
  195. $post['zhengshu'] = '';
  196. $post['sjnx'] = '';
  197. }else{
  198. //重新遍历
  199. foreach ($post['zhengshu'] as $key => $value) {
  200. $sjnx_new[] = $post['sjnx'][$key];
  201. }
  202. $post['sjnx'] = $sjnx_new;
  203. }
  204. if(empty($post['zhengshu'])){
  205. $post['sjnx'] = '';
  206. $post['zhengshu'] = '';
  207. }
  208. //验证是否已经有重复的
  209. $one = Db::name('zc_form')->where([
  210. 'type' => $post['type'], //规则id
  211. 'type_son' => $post['type_son'], //第二规则id
  212. 'is_zs' => $post['is_zs'], //是否需要前置证书
  213. 'zhengshu' => json_encode($post['zhengshu']), //数组
  214. 'sjnx' => json_encode($post['sjnx']), //数组
  215. 'is_del' => 0,
  216. ])->find();
  217. if(!empty($one)){
  218. $this->error('该规则已存在,请检查!', url('ZcbdPosition/index'));
  219. }
  220. //拼装title $post['type']
  221. $post['title'] = '';
  222. if((int)$post['type'] > 0){
  223. $row = Db::name('zcwe_position')->where(['id'=>$post['type_son']])->find();
  224. $post['title'] .= $row['title'];
  225. }
  226. //允许重复
  227. /*$map = array(
  228. 'title' => trim($post['title']),
  229. 'lang' => $this->admin_lang,
  230. );
  231. if(Db::name('zc_form')->where($map)->count() > 0){
  232. $this->error('该职称名称已存在,请检查', url('ZcbdPosition/index'));
  233. }*/
  234. // 添加广告位置表信息
  235. $data = array(
  236. 'title' => trim($post['title']),
  237. 'type' => $post['type'], //职称地区
  238. 'type_son' => $post['type_son'], //职称地区
  239. 'intro' => '0', //备注
  240. 'admin_id' => session('admin_id'),
  241. 'lang' => $this->admin_lang,
  242. 'add_time' => getTime(),
  243. 'update_time' => getTime(),
  244. 'sf' => 0,
  245. 'cs' => 0,
  246. 'sbdj' => 0,
  247. 'is_ega' => 0,
  248. 'ega_0' => 0,
  249. 'ega_1' => 0,
  250. 'byzy' => 0,
  251. 'zhengshu2' => '',
  252. 'xlyq' => 0,
  253. 'xxlx' => 0,
  254. 'bysj' =>0,
  255. 'bysj_time' => 0,
  256. 'is_zs' => $post['is_zs'],
  257. 'zhengshu' => json_encode($post['zhengshu']),
  258. 'sjnx' => json_encode($post['sjnx']),
  259. 'gzyq' => json_encode($post['gzyq'],JSON_UNESCAPED_UNICODE),
  260. 'qttj' => $post['qttj'],
  261. );
  262. $insertID = Db::name('zc_form')->insertGetId($data);
  263. if (!empty($insertID)) {
  264. // 同步广告位置ID到多语言的模板变量里,添加多语言广告位
  265. //$this->syn_add_language_attribute($insertID);
  266. // 读取组合广告位的图片及信息
  267. $AdData = [];
  268. if (!empty($post['img_litpic'])) { // 图片类型
  269. $i = 1;
  270. foreach ($post['img_litpic'] as $key => $value) {
  271. if (!empty($value)) {
  272. // 去掉http:
  273. $value = str_replace("http:", "", $value);
  274. // 去掉https:
  275. $value = str_replace("https:", "", $value);
  276. // 主要参数
  277. $AdData['litpic'] = $value;
  278. $AdData['pid'] = $insertID;
  279. $AdData['title'] = trim($post['img_title'][$key]);
  280. $AdData['links'] = $post['img_links'][$key];
  281. $AdData['intro'] = $post['img_intro'][$key];
  282. $target = !empty($post['img_target'][$key]) ? 1 : 0;
  283. $AdData['target'] = $target;
  284. // 其他参数
  285. $AdData['media_type'] = 1;
  286. $AdData['admin_id'] = session('admin_id');
  287. $AdData['lang'] = $this->admin_lang;
  288. $AdData['sort_order'] = $i++;
  289. $AdData['add_time'] = getTime();
  290. $AdData['update_time'] = getTime();
  291. // 添加到广告图表
  292. $ad_id = Db::name('zcwf')->add($AdData);
  293. // 同步多语言
  294. //$this->syn_add_ad_language_attribute($ad_id);
  295. }
  296. }
  297. }
  298. //Cache::clear('ad');
  299. adminLog('新增职称:'.$post['title']);
  300. $this->success("操作成功", url('ZcbdPosition/index'));
  301. } else {
  302. $this->error("操作失败", url('ZcbdPosition/index'));
  303. }
  304. }
  305. // 上传通道
  306. $WeappConfig = Db::name('weapp')->field('code, status')->where('code', 'IN', ['Qiniuyun', 'AliyunOss', 'Cos'])->select();
  307. $WeappOpen = [];
  308. foreach ($WeappConfig as $value) {
  309. if ('Qiniuyun' == $value['code']) {
  310. $WeappOpen['qny_open'] = $value['status'];
  311. } else if ('AliyunOss' == $value['code']) {
  312. $WeappOpen['oss_open'] = $value['status'];
  313. } else if ('Cos' == $value['code']) {
  314. $WeappOpen['cos_open'] = $value['status'];
  315. }
  316. }
  317. $this->assign('WeappOpen', $WeappOpen);
  318. // 系统最大上传视频的大小
  319. $upload_max_filesize = upload_max_filesize();
  320. $this->assign('upload_max_filesize', $upload_max_filesize);
  321. // 视频类型
  322. $media_type = tpCache('global.media_type');
  323. $media_type = !empty($media_type) ? $media_type : config('global.media_ext');
  324. $media_type = str_replace(",", "|", $media_type);
  325. $this->assign('media_type', $media_type);
  326. //查找区域数据
  327. $pro_list = Db::name('citysite')->where(['level'=>1,'is_open'=>1])->select();
  328. //var_dump($pro_list);
  329. $this->assign('pro_list', $pro_list);
  330. //查找职称数据
  331. $pos = Db::name('zc_position')->where(['is_del'=>0])->select();
  332. //var_dump($pos);
  333. $this->assign('pos_list', $pos);
  334. $param = request()->param();
  335. //读取规则详情
  336. $row = Db::name('zcwd_position')->where(['id'=>$param['type']])->find();
  337. $this->assign('detail', $row);
  338. $this->assign('rule_id', $param['type']);
  339. //读取
  340. $row2 = Db::name('zcwe_position')->where(['id'=>$param['id']])->find();
  341. $this->assign('detail_son', $row2);
  342. $this->assign('rule_id_son', $param['id']);
  343. //读取证书详情
  344. $map_ids = Db::name('zc_zs')->where(['zc_id'=>$row['type'],'is_del'=>0])->column('map_id');
  345. $listwww = Db::name('zczs_position')->where('id','in',$map_ids)->select();
  346. //var_dump($listwww);
  347. $html = '';
  348. $arr = json_decode($row['zhengshu'],true);
  349. foreach ($listwww as $key => $value) {
  350. if(in_array($value['id'],$arr)){
  351. $checked = 'checked';
  352. }else{
  353. $checked = '';
  354. }
  355. $html .= '<span style="margin-right: 10px;margin-top:5px;display: block;"><input type="checkbox" name="zhengshu[]" '.$checked.' value="'.$value['id'].'" id="category'.$value['id'].'"/>'.$value['title'].'';
  356. $html .= '<select name="sjnx[]" class="select" id="selectTest888" style="margin:0px 5px;height:30px;width:60px;">
  357. <option value="0" selected>不限</option>
  358. <option value="1">1年</option>
  359. <option value="2">2年</option>
  360. <option value="3">3年</option>
  361. <option value="4">4年</option>
  362. <option value="5">5年</option>
  363. <option value="6">6年</option>
  364. <option value="7">7年</option>
  365. <option value="8">8年</option>
  366. </select>
  367. 以上(包括)</span>';
  368. }
  369. if(empty($html)){
  370. $html = '请先添加相关证书';
  371. }
  372. $this->assign('zs_html',$html);
  373. return $this->fetch();
  374. }
  375. public function getZs()
  376. {
  377. $id = request()->post('id',0);
  378. //读取证书
  379. $map_ids = Db::name('zc_zs')->where(['zc_id'=>$id,'is_del'=>0])->column('map_id');
  380. $list = Db::name('zczs_position')->where('id','in',$map_ids)->select();
  381. $html = '';
  382. foreach ($list as $key => $value) {
  383. $html .= '<span style="margin-right: 10px;"><input type="checkbox" name="zhengshu[]" value="'.$value['id'].'" id="category'.$value['id'].'"/>'.$value['title'].'</span>';
  384. }
  385. if(empty($html)){
  386. $html = '<font style="color:red;">请先绑定申报专业相关的证书才能进行选择!</font>';
  387. }
  388. $data = [
  389. 'code' => 0,
  390. 'msg' => '查询成功',
  391. 'data' => $html
  392. ];
  393. return json($data);
  394. }
  395. public function getZs2()
  396. {
  397. $id = request()->post('id',0);
  398. //读取证书
  399. $map_ids = Db::name('zc_zy')->where(['zc_id'=>$id,'is_del'=>0])->column('map_id');
  400. $list = Db::name('zczy_position')->where('id','in',$map_ids)->select();
  401. $html = '';
  402. foreach ($list as $key => $value) {
  403. $html .= '<span style="margin-right: 10px;"><input type="checkbox" name="zhengshu2[]" value="'.$value['id'].'" id="category'.$value['id'].'"/>'.$value['title'].'</span>';
  404. }
  405. if(empty($html)){
  406. $html = '<font style="color:red;">请先绑定申报专业相关的毕业专业才能进行选择!</font>';
  407. }
  408. $data = [
  409. 'code' => 0,
  410. 'msg' => '查询成功',
  411. 'data' => $html
  412. ];
  413. return json($data);
  414. }
  415. public function getMap($sid='')
  416. {
  417. if($sid == ''){
  418. $id = request()->post('id',0);
  419. }else{
  420. $id = $sid;
  421. }
  422. //查找区域
  423. $map_ids = Db::name('zc_map')
  424. ->where('zc_id','=',$id)
  425. ->where('is_del','=',0)
  426. ->column('map_id');
  427. //获取地区
  428. $list = Db::name('citysite')
  429. ->where('id','in',$map_ids)
  430. ->select();
  431. $type_name = '';
  432. foreach ($list as $k2 => $v2) {
  433. $type_name .= $v2['name'].',';
  434. }
  435. if(empty($type_name)){
  436. $type_name = '全国';
  437. }
  438. $data = [
  439. 'code' => 0,
  440. 'msg' => '获取成功',
  441. 'data' => $type_name,
  442. ];
  443. if($sid == ''){
  444. return json($data);
  445. }else{
  446. return $type_name;
  447. }
  448. }
  449. /**
  450. * 编辑
  451. */
  452. public function edit()
  453. {
  454. if (IS_POST) {
  455. $post = input('post.');
  456. if (!empty($post['id'])) {
  457. $post['id'] = intval($post['id']);
  458. if (array_key_exists($post['id'], $this->ad_position_system_id)) {
  459. $this->error("不可更改系统预定义位置", url('ZcbdPosition/edit',array('id'=>$post['id'])));
  460. }
  461. //增加
  462. $post['zhengshu_val'] = substr($post['zhengshu_val'], 0, -1);
  463. $post['zhengshu'] = explode(',',$post['zhengshu_val']);
  464. //var_dump($post['zhengshu']);die;
  465. //var_dump($post);die;
  466. if((int)$post['is_zs'] === 0){
  467. $post['zhengshu'] = '';
  468. $post['sjnx'] = '';
  469. }else{
  470. //重新遍历
  471. foreach ($post['zhengshu'] as $key => $value) {
  472. $sjnx_new[] = $post['sjnx'][$key];
  473. }
  474. $post['sjnx'] = $sjnx_new;
  475. }
  476. if(empty($post['zhengshu'])){
  477. $post['sjnx'] = '';
  478. $post['zhengshu'] = '';
  479. }
  480. //var_dump($post);die;
  481. //验证是否已经有重复的 排除自身ID
  482. $one = Db::name('zc_form')->where([
  483. 'type' => $post['type'], //规则id
  484. 'type_son' => $post['type_son'], //第二规则id
  485. 'is_zs' => $post['is_zs'], //是否需要前置证书
  486. 'zhengshu' => json_encode($post['zhengshu']), //数组
  487. 'sjnx' => json_encode($post['sjnx']), //数组
  488. 'is_del' => 0,
  489. ])->where('id','<>',$post['id'])->find();
  490. if(!empty($one)){
  491. $this->error('该规则已存在,请检查!', url('ZcbdPosition/index'));
  492. }
  493. //var_dump($one);die;
  494. //拼装title $post['type']
  495. $post['title'] = '';
  496. if((int)$post['type'] > 0){
  497. $row = Db::name('zcwe_position')->where(['id'=>$post['type_son']])->find();
  498. $post['title'] .= $row['title'];
  499. }
  500. /* 判断除自身外是否还有相同广告名称已存在 */
  501. /*$map = array(
  502. 'id' => array('NEQ', $post['id']),
  503. 'title' => trim($post['title']),
  504. //'lang' => $this->admin_lang,
  505. );
  506. if (Db::name('zc_form')->where($map)->count() > 0) $this->error('该职称名称已存在,请检查');*/
  507. //处理年龄
  508. /* if((int)$post['is_ega'] > 0){
  509. if((int)$post['ega'][0] >= (int)$post['ega'][1]){
  510. $this->error('请输入正确的年龄区间,请检查', url('ZcbdPosition/index'));
  511. }
  512. }*/
  513. /* END */
  514. /* 判断广告是否切换广告类型 */
  515. // $where = [
  516. // 'id' => $post['id'],
  517. // 'type' => $post['type'],
  518. // 'lang' => $this->admin_lang
  519. // ];
  520. // if (Db::name('zc_form')->where($where)->count() == 0) {
  521. // // 已切换广告类型,清除广告中的广告内容
  522. // $where = [
  523. // 'pid' => $post['id'],
  524. // 'lang' => $this->admin_lang
  525. // ];
  526. // Db::name('zcwf')->where($where)->delete();
  527. // }
  528. /* END */
  529. /* 修改广告主体信息 */
  530. $data = array(
  531. 'id' => $post['id'],
  532. 'title' => trim($post['title']),
  533. 'type' => $post['type'], //职称地区
  534. 'type_son' => $post['type_son'], //职称地区
  535. 'intro' => '0', //备注
  536. 'lang' => $this->admin_lang,
  537. 'update_time' => getTime(),
  538. 'sf' => 0,
  539. 'cs' => 0,
  540. 'sbdj' => 0,
  541. 'is_ega' => 0,
  542. 'ega_0' => 0,
  543. 'ega_1' => 0,
  544. 'byzy' => 0,
  545. 'zhengshu2' => '',
  546. 'xlyq' => 0,
  547. 'xxlx' => 0,
  548. 'bysj' =>0,
  549. 'bysj_time' => 0,
  550. 'is_zs' => $post['is_zs'],
  551. 'zhengshu' => json_encode($post['zhengshu']),
  552. 'sjnx' => json_encode($post['sjnx']),
  553. 'gzyq' => json_encode($post['gzyq'],JSON_UNESCAPED_UNICODE),
  554. 'qttj' => $post['qttj'],
  555. );
  556. $resultID = Db::name('zc_form')->update($data);
  557. /* END */
  558. }
  559. if (!empty($resultID)) {
  560. $ad_db = Db::name('zcwf');
  561. if (!empty($post['img_litpic'])) { // 图片类型
  562. // 读取组合广告位的图片及信息
  563. $i = 1;
  564. foreach ($post['img_litpic'] as $key => $value) {
  565. if (!empty($value)) {
  566. // 去掉http:
  567. $value = str_replace("http:", "", $value);
  568. // 去掉https:
  569. $value = str_replace("https:", "", $value);
  570. // 是否新窗口打开
  571. $target = !empty($post['img_target'][$key]) ? 1 : 0;
  572. // 广告位ID,为空则表示添加
  573. $ad_id = $post['img_id'][$key];
  574. if (!empty($ad_id)) {
  575. // 查询更新条件
  576. $where = [
  577. 'id' => $ad_id,
  578. 'lang' => $this->admin_lang,
  579. ];
  580. if ($ad_db->where($where)->count() > 0) {
  581. // 主要参数
  582. $AdData['litpic'] = $value;
  583. $AdData['title'] = $post['img_title'][$key];
  584. $AdData['links'] = $post['img_links'][$key];
  585. $AdData['intro'] = $post['img_intro'][$key];
  586. $AdData['target'] = $target;
  587. // 其他参数
  588. $AdData['sort_order'] = $i++;
  589. $AdData['update_time'] = getTime();
  590. // 更新,不需要同步多语言
  591. $ad_db->where($where)->update($AdData);
  592. } else {
  593. // 主要参数
  594. $AdData['litpic'] = $value;
  595. $AdData['pid'] = $post['id'];
  596. $AdData['title'] = $post['img_title'][$key];
  597. $AdData['links'] = $post['img_links'][$key];
  598. $AdData['intro'] = $post['img_intro'][$key];
  599. $AdData['target'] = $target;
  600. // 其他参数
  601. $AdData['media_type'] = 1;
  602. $AdData['admin_id'] = session('admin_id');
  603. $AdData['lang'] = $this->admin_lang;
  604. $AdData['sort_order'] = $i++;
  605. $AdData['add_time'] = getTime();
  606. $AdData['update_time'] = getTime();
  607. $ad_id = $ad_db->add($AdData);
  608. // 同步多语言
  609. //$this->syn_add_ad_language_attribute($ad_id);
  610. }
  611. } else {
  612. // 主要参数
  613. $AdData['litpic'] = $value;
  614. $AdData['pid'] = $post['id'];
  615. $AdData['title'] = $post['img_title'][$key];
  616. $AdData['links'] = $post['img_links'][$key];
  617. $AdData['intro'] = $post['img_intro'][$key];
  618. $AdData['target'] = $target;
  619. // 其他参数
  620. $AdData['media_type'] = 1;
  621. $AdData['admin_id'] = session('admin_id');
  622. $AdData['lang'] = $this->admin_lang;
  623. $AdData['sort_order'] = $i++;
  624. $AdData['add_time'] = getTime();
  625. $AdData['update_time'] = getTime();
  626. $ad_id = $ad_db->add($AdData);
  627. // 同步多语言
  628. //$this->syn_add_ad_language_attribute($ad_id);
  629. }
  630. }
  631. }
  632. }
  633. //Cache::clear('ad');
  634. adminLog('编辑职称名称:'.$post['title']);
  635. $this->success("操作成功", url('ZcbdPosition/index'));
  636. } else {
  637. $this->error("操作失败");
  638. }
  639. }
  640. $assign_data = array();
  641. $id = input('id/d');
  642. $field = Db::name('zc_form')->field('a.*')->alias('a')->where(array('a.id'=>$id))->find();
  643. if (empty($field)) $this->error('职称不存在,请联系管理员!');
  644. switch ($field['type']) {
  645. case '1':
  646. $field['type_name'] = '图片';
  647. break;
  648. case '2':
  649. $field['type_name'] = '多媒体';
  650. break;
  651. case '3':
  652. $field['type_name'] = 'HTML代码';
  653. break;
  654. }
  655. $assign_data['field'] = $field;
  656. // 广告
  657. $ad_data = Db::name('zcwf')->where(array('pid'=>$field['id']))->order('sort_order asc')->select();
  658. foreach ($ad_data as $key => $val) {
  659. if (1 == $val['media_type']) {
  660. $ad_data[$key]['litpic'] = get_default_pic($val['litpic']); // 支持子目录
  661. }
  662. }
  663. $assign_data['ad_data'] = $ad_data;
  664. // 上传通道
  665. $WeappConfig = Db::name('weapp')->field('code, status')->where('code', 'IN', ['Qiniuyun', 'AliyunOss', 'Cos'])->select();
  666. $WeappOpen = [];
  667. foreach ($WeappConfig as $value) {
  668. if ('Qiniuyun' == $value['code']) {
  669. $WeappOpen['qny_open'] = $value['status'];
  670. } else if ('AliyunOss' == $value['code']) {
  671. $WeappOpen['oss_open'] = $value['status'];
  672. } else if ('Cos' == $value['code']) {
  673. $WeappOpen['cos_open'] = $value['status'];
  674. }
  675. }
  676. $this->assign('WeappOpen', $WeappOpen);
  677. // 系统最大上传视频的大小
  678. $file_size = tpCache('global.file_size');
  679. $postsize = @ini_get('file_uploads') ? ini_get('post_max_size') : -1;
  680. $fileupload = @ini_get('file_uploads') ? ini_get('upload_max_filesize') : -1;
  681. $min_size = strval($file_size) < strval($postsize) ? $file_size : $postsize;
  682. $min_size = strval($min_size) < strval($fileupload) ? $min_size : $fileupload;
  683. $upload_max_filesize = intval($min_size) * 1024 * 1024;
  684. $assign_data['upload_max_filesize'] = $upload_max_filesize;
  685. // 视频类型
  686. $media_type = tpCache('global.media_type');
  687. $media_type = !empty($media_type) ? $media_type : config('global.media_ext');
  688. $media_type = str_replace(",", "|", $media_type);
  689. $assign_data['media_type'] = $media_type;
  690. //查找区域数据
  691. $pro_list = Db::name('citysite')->where(['level'=>1,'is_open'=>1])->select();
  692. //var_dump($pro_list);
  693. $this->assign('pro_list', $pro_list);
  694. $this->assign('curr_id', $field['type']);
  695. //查找职称数据
  696. $pos = Db::name('zc_position')->where(['is_del'=>0])->select();
  697. //var_dump($pos);
  698. $this->assign('pos_list', $pos);
  699. $tn = $this->getMap($field['type']);
  700. $this->assign('tn',$tn);
  701. if((int)$field['cs'] > 0) {
  702. $csn = Db::name('citysite')->where(['id' => $field['cs']])->value('name');
  703. $this->assign('csn',$csn);
  704. }
  705. $pro_list2 = Db::name('citysite')->where(['parent_id'=>$field['sf']])->select();
  706. //var_dump($pro_list2);
  707. $this->assign('pro_list2', $pro_list2);
  708. $this->assign('curr_id2', $field['cs']);
  709. if((int)$field['byzy'] > 0) {
  710. $map_ids = Db::name('zc_zy')->where(['zc_id'=>$field['type'],'is_del'=>0])->column('map_id');
  711. $listwww = Db::name('zczy_position')->where('id','in',$map_ids)->select();
  712. $html = '';
  713. $arr = json_decode($field['zhengshu2'],true);
  714. foreach ($listwww as $key => $value) {
  715. if(in_array($value['id'],$arr)){
  716. $checked = 'checked';
  717. }else{
  718. $checked = '';
  719. }
  720. $html .= '<span style="margin-right: 10px;"><input type="checkbox" name="zhengshu2[]" '.$checked.' value="'.$value['id'].'" id="category'.$value['id'].'"/>'.$value['title'].'</span>';
  721. }
  722. $this->assign('byzy_html',$html);
  723. }
  724. if((int)$field['is_zs'] > 0) {
  725. $map_ids = Db::name('zc_zs')->where(['zc_id'=>$field['type'],'is_del'=>0])->column('map_id');
  726. $listwww = Db::name('zczs_position')->where('id','in',$map_ids)->select();
  727. $html = '';
  728. $arr = json_decode($field['zhengshu'],true);
  729. foreach ($listwww as $key => $value) {
  730. if(in_array($value['id'],$arr)){
  731. $checked = 'checked';
  732. }else{
  733. $checked = '';
  734. }
  735. $html .= '<span style="margin-right: 10px;"><input type="checkbox" name="zhengshu[]" '.$checked.' value="'.$value['id'].'" id="category'.$value['id'].'"/>'.$value['title'].'</span>';
  736. }
  737. $this->assign('zs_html',$html);
  738. }
  739. $gzyq = json_decode($field['gzyq'],true);
  740. $this->assign('gzyq',$gzyq);
  741. $param = request()->param();
  742. //读取规则详情
  743. $row = Db::name('zcwd_position')->where(['id'=>$field['type']])->find();
  744. $this->assign('detail', $row);
  745. $this->assign('rule_id', $field['type']);
  746. //读取
  747. $row2 = Db::name('zcwe_position')->where(['id'=>$field['type_son']])->find();
  748. $this->assign('detail_son', $row2);
  749. $this->assign('rule_id_son', $field['type_son']);
  750. //读取证书详情
  751. $map_ids = Db::name('zc_zs')->where(['zc_id'=>$row['type'],'is_del'=>0])->column('map_id');
  752. $listwww = Db::name('zczs_position')->where('id','in',$map_ids)->select();
  753. //var_dump($listwww);
  754. $html = '';
  755. $arr = json_decode($field['zhengshu'],true);
  756. $arr_2 = json_decode($field['sjnx'],true);
  757. foreach ($listwww as $key => $value) {
  758. if(in_array($value['id'],$arr)){
  759. $checked = 'checked';
  760. foreach ($arr as $key_2 => $value_2) {
  761. if($value['id'] == $value_2){
  762. $year = $arr_2[$key_2];
  763. $option = '<option value="0">不限</option>';
  764. for($i=1;$i<=8;$i++){
  765. if($i == $year){
  766. $selected = 'selected';
  767. }else{
  768. $selected = '';
  769. }
  770. $option .= '<option value="'.$i.'" '.$selected.'>'.$i.'年</option>';
  771. }
  772. }
  773. }
  774. }else{
  775. $checked = '';
  776. $year = 0;
  777. $option = '<option value="0" selected>不限</option>
  778. <option value="1">1年</option>
  779. <option value="2">2年</option>
  780. <option value="3">3年</option>
  781. <option value="4">4年</option>
  782. <option value="5">5年</option>
  783. <option value="6">6年</option>
  784. <option value="7">7年</option>
  785. <option value="8">8年</option>';
  786. }
  787. $html .= '<span style="margin-right: 10px;margin-top:5px;display: block;"><input type="checkbox" name="zhengshu[]" '.$checked.' value="'.$value['id'].'" id="category'.$value['id'].'"/>'.$value['title'].'';
  788. $html .= '<select name="sjnx[]" class="select" id="selectTest888" style="margin:0px 5px;height:30px;width:60px;">
  789. '.$option.'
  790. </select>
  791. 以上(包括)</span>';
  792. }
  793. if(empty($html)){
  794. $html = '请先添加相关证书';
  795. }
  796. $this->assign('zs_html',$html);
  797. $this->assign($assign_data);
  798. return $this->fetch();
  799. }
  800. /**
  801. * 删除广告图片
  802. */
  803. public function del_imgupload()
  804. {
  805. if (is_language() && empty($this->globalConfig['language_split'])) {
  806. $this->language_access(); // 多语言功能操作权限
  807. }
  808. $id_arr = input('del_id/a');
  809. $id_arr = eyIntval($id_arr);
  810. if(IS_POST && !empty($id_arr)){
  811. /*多语言*/
  812. $attr_name_arr = [];
  813. if (empty($this->globalConfig['language_split'])) {
  814. foreach ($id_arr as $key => $val) {
  815. $attr_name_arr[] = 'ad'.$val;
  816. }
  817. if (is_language()) {
  818. $new_id_arr = Db::name('language_attr')->where([
  819. 'attr_name' => ['IN', $attr_name_arr],
  820. 'attr_group' => 'ad',
  821. ])->column('attr_value');
  822. !empty($new_id_arr) && $id_arr = $new_id_arr;
  823. }
  824. } else {
  825. if (get_admin_lang() == get_main_lang()) {
  826. foreach ($id_arr as $key => $val) {
  827. $attr_name_arr[] = 'ad'.$val;
  828. }
  829. }
  830. }
  831. /*--end*/
  832. $r = Db::name('zcwf')->where([
  833. 'id' => ['IN', $id_arr],
  834. ])
  835. ->delete();
  836. if ($r !== false) {
  837. /*多语言*/
  838. if (!empty($attr_name_arr)) {
  839. Db::name('language_attr')->where([
  840. 'attr_name' => ['IN', $attr_name_arr],
  841. 'attr_group' => 'ad',
  842. ])->delete();
  843. Db::name('language_attribute')->where([
  844. 'attr_name' => ['IN', $attr_name_arr],
  845. 'attr_group' => 'ad',
  846. ])->delete();
  847. }
  848. /*--end*/
  849. Cache::clear('ad');
  850. adminLog('删除广告-id:'.implode(',', $id_arr));
  851. }
  852. }
  853. }
  854. /**
  855. * 删除
  856. */
  857. public function del()
  858. {
  859. if (is_language() && empty($this->globalConfig['language_split'])) {
  860. $this->language_access(); // 多语言功能操作权限
  861. }
  862. $id_arr = input('del_id/a');
  863. $id_arr = eyIntval($id_arr);
  864. if(IS_POST && !empty($id_arr)){
  865. foreach ($id_arr as $key => $val) {
  866. if(array_key_exists($val, $this->ad_position_system_id)){
  867. $this->error('系统预定义,不能删除');
  868. }
  869. }
  870. /*多语言*/
  871. $attr_name_arr = [];
  872. foreach ($id_arr as $key => $val) {
  873. $attr_name_arr[] = 'adp'.$val;
  874. }
  875. if (is_language() && empty($this->globalConfig['language_split'])) {
  876. $new_id_arr = Db::name('language_attr')->where([
  877. 'attr_name' => ['IN', $attr_name_arr],
  878. 'attr_group' => 'ad_position',
  879. ])->column('attr_value');
  880. !empty($new_id_arr) && $id_arr = $new_id_arr;
  881. }
  882. /*--end*/
  883. $r = Db::name('zc_form')->where('id','IN',$id_arr)->delete();
  884. if ($r !== false) {
  885. /*多语言*/
  886. if (!empty($attr_name_arr)) {
  887. if (get_admin_lang() == get_main_lang()) {
  888. Db::name('language_attribute')->where([
  889. 'attr_name' => ['IN', $attr_name_arr],
  890. 'attr_group' => 'ad_position',
  891. ])->delete();
  892. }
  893. if (empty($this->globalConfig['language_split'])) {
  894. Db::name('language_attr')->where([
  895. 'attr_name' => ['IN', $attr_name_arr],
  896. 'attr_group' => 'ad_position',
  897. ])->delete();
  898. } else {
  899. Db::name('language_attr')->where([
  900. 'attr_value' => ['IN', $id_arr],
  901. 'attr_group' => 'ad_position',
  902. ])->delete();
  903. }
  904. }
  905. /*--end*/
  906. $ad_ids = Db::name('zcwf')->where(['pid'=>['IN', $id_arr]])->column('id');
  907. $attr_name_arr = [];
  908. foreach ($ad_ids as $key => $val) {
  909. $attr_name_arr[] = "ad{$val}";
  910. }
  911. $r1 = Db::name('zcwf')->where('pid','IN',$id_arr)->delete();
  912. if ($r1 !== false) {
  913. /*多语言*/
  914. if (!empty($attr_name_arr)) {
  915. if (get_admin_lang() == get_main_lang()) {
  916. Db::name('language_attribute')->where([
  917. 'attr_name' => ['IN', $attr_name_arr],
  918. 'attr_group' => 'ad',
  919. ])->delete();
  920. }
  921. if (empty($this->globalConfig['language_split'])) {
  922. Db::name('language_attr')->where([
  923. 'attr_name' => ['IN', $attr_name_arr],
  924. 'attr_group' => 'ad',
  925. ])->delete();
  926. } else {
  927. Db::name('language_attr')->where([
  928. 'attr_value' => ['IN', $ad_ids],
  929. 'attr_group' => 'ad',
  930. ])->delete();
  931. }
  932. }
  933. /*--end*/
  934. }
  935. Cache::clear('ad');
  936. adminLog('删除广告-id:'.implode(',', $id_arr));
  937. $this->success('删除成功');
  938. } else {
  939. $this->error('删除失败');
  940. }
  941. }else{
  942. $this->error('参数有误');
  943. }
  944. }
  945. /**
  946. * 打开预览视频
  947. */
  948. public function open_preview_video()
  949. {
  950. $post = input('post.');
  951. $video_litpic = $post['video_litpic'];
  952. if (!is_http_url($video_litpic)) {
  953. $video_litpic = request()->domain() . handle_subdir_pic($video_litpic, 'media');
  954. }
  955. $this->success('执行成功', $video_litpic);
  956. }
  957. /**
  958. * 检测广告名称是否存在重复
  959. */
  960. public function detection_title_repeat()
  961. {
  962. if (IS_AJAX_POST) {
  963. $post = input('post.');
  964. $where = [
  965. 'id' => ['NEQ', $post['id']],
  966. 'title' => trim($post['title']),
  967. 'lang' => $this->admin_lang,
  968. ];
  969. $count = Db::name('zc_form')->where($where)->count();
  970. if (empty($count)) {
  971. $this->success('检测通过');
  972. } else {
  973. $this->error('该广告名称已存在,请检查');
  974. }
  975. }
  976. }
  977. /**
  978. * 同步新增广告位置ID到多语言的模板变量里
  979. */
  980. private function syn_add_language_attribute($adp_id)
  981. {
  982. /*单语言情况下不执行多语言代码*/
  983. if (!is_language() || tpCache('language.language_split')) {
  984. return true;
  985. }
  986. /*--end*/
  987. $attr_group = 'ad_position';
  988. $admin_lang = $this->admin_lang;
  989. $main_lang = $this->main_lang;
  990. $languageRow = Db::name('language')->field('mark')->order('id asc')->select();
  991. if (!empty($languageRow) && $admin_lang == $main_lang) { // 当前语言是主体语言,即语言列表最早新增的语言
  992. $ad_position_db = Db::name('zc_form');
  993. $result = $ad_position_db->find($adp_id);
  994. $attr_name = 'adp'.$adp_id;
  995. $r = Db::name('language_attribute')->save([
  996. 'attr_title' => $result['title'],
  997. 'attr_name' => $attr_name,
  998. 'attr_group' => $attr_group,
  999. 'add_time' => getTime(),
  1000. 'update_time' => getTime(),
  1001. ]);
  1002. if (false !== $r) {
  1003. $data = [];
  1004. foreach ($languageRow as $key => $val) {
  1005. /*同步新广告位置到其他语言广告位置列表*/
  1006. if ($val['mark'] != $admin_lang) {
  1007. $addsaveData = $result;
  1008. $addsaveData['lang'] = $val['mark'];
  1009. $addsaveData['title'] = $val['mark'].$addsaveData['title'];
  1010. unset($addsaveData['id']);
  1011. $adp_id = $ad_position_db->insertGetId($addsaveData);
  1012. }
  1013. /*--end*/
  1014. /*所有语言绑定在主语言的ID容器里*/
  1015. $data[] = [
  1016. 'attr_name' => $attr_name,
  1017. 'attr_value' => $adp_id,
  1018. 'lang' => $val['mark'],
  1019. 'attr_group' => $attr_group,
  1020. 'add_time' => getTime(),
  1021. 'update_time' => getTime(),
  1022. ];
  1023. /*--end*/
  1024. }
  1025. if (!empty($data)) {
  1026. model('LanguageAttr')->saveAll($data);
  1027. }
  1028. }
  1029. }
  1030. }
  1031. /**
  1032. * 同步新增广告ID到多语言的模板变量里
  1033. */
  1034. private function syn_add_ad_language_attribute($ad_id)
  1035. {
  1036. /*单语言情况下不执行多语言代码*/
  1037. if (!is_language() || tpCache('language.language_split')) {
  1038. return true;
  1039. }
  1040. /*--end*/
  1041. $attr_group = 'ad';
  1042. $admin_lang = $this->admin_lang;
  1043. $main_lang = get_main_lang();
  1044. $languageRow = Db::name('language')->field('mark')->order('id asc')->select();
  1045. if (!empty($languageRow) && $admin_lang == $main_lang) { // 当前语言是主体语言,即语言列表最早新增的语言
  1046. $ad_db = Db::name('zcwf');
  1047. $result = $ad_db->find($ad_id);
  1048. $attr_name = 'ad'.$ad_id;
  1049. $r = Db::name('language_attribute')->save([
  1050. 'attr_title' => $result['title'],
  1051. 'attr_name' => $attr_name,
  1052. 'attr_group' => $attr_group,
  1053. 'add_time' => getTime(),
  1054. 'update_time' => getTime(),
  1055. ]);
  1056. if (false !== $r) {
  1057. $data = [];
  1058. foreach ($languageRow as $key => $val) {
  1059. /*同步新广告到其他语言广告列表*/
  1060. if ($val['mark'] != $admin_lang) {
  1061. $addsaveData = $result;
  1062. $addsaveData['lang'] = $val['mark'];
  1063. $newPid = Db::name('language_attr')->where([
  1064. 'attr_name' => 'adp'.$result['pid'],
  1065. 'attr_group' => 'ad_position',
  1066. 'lang' => $val['mark'],
  1067. ])->getField('attr_value');
  1068. $addsaveData['pid'] = $newPid;
  1069. $addsaveData['title'] = $val['mark'].$addsaveData['title'];
  1070. unset($addsaveData['id']);
  1071. $ad_id = $ad_db->insertGetId($addsaveData);
  1072. }
  1073. /*--end*/
  1074. /*所有语言绑定在主语言的ID容器里*/
  1075. $data[] = [
  1076. 'attr_name' => $attr_name,
  1077. 'attr_value' => $ad_id,
  1078. 'lang' => $val['mark'],
  1079. 'attr_group' => $attr_group,
  1080. 'add_time' => getTime(),
  1081. 'update_time' => getTime(),
  1082. ];
  1083. /*--end*/
  1084. }
  1085. if (!empty($data)) {
  1086. model('LanguageAttr')->saveAll($data);
  1087. }
  1088. }
  1089. }
  1090. }
  1091. public function show()
  1092. {
  1093. $this->assign(【】);
  1094. return $this->fetch();
  1095. }
  1096. }