$v){ $list[$k]['cinema_director'] = explode(',',$v['cinema_director']); $list[$k]['cinema_star'] = explode(',',$v['cinema_star']); $list[$k]['cinema_performers'] = explode(',',$v['cinema_performers']); $list[$k]['cinema_create_time'] = date('Y-m-d H:i:s',$v['cinema_create_time']); if (!empty($v['cinema_update_time'])){ $list[$k]['cinema_update_time'] = date('Y-m-d H:i:s',$v['cinema_update_time']); } } } return compact('list', 'page', 'limit', 'count'); } /** * Notes:修改影片 * @param string $cinema_name * @param int $cinema_id * @return int * User: ZQ * Date: 2022/9/3 */ public static function updateCinema($cinema_id, $cinema_name, $cinema_video, $cinema_mold, $cinema_director, $cinema_star, $cinema_price, $cinema_introduction, $cinema_performers, $cinema_seat, $cinema_length, $cinema_time, $cinema_label, $cinema_img, $cinema_status, $cinema_week, $admin_id) { LifeCinema::affairBegin(); try { $where = []; $where['cinema_id'] = $cinema_id; $data = []; $data['cinema_name'] = $cinema_name; $data['cinema_video'] = $cinema_video; $data['cinema_mold'] = implode(',',$cinema_mold); $data['cinema_director'] = implode(',',$cinema_director); $data['cinema_price'] = $cinema_price; $data['cinema_star'] = implode(',',$cinema_star); $data['cinema_introduction'] = $cinema_introduction; $data['cinema_performers'] = implode(',',$cinema_performers); $data['cinema_seat'] = $cinema_seat; $data['cinema_length'] = $cinema_length; $data['cinema_week'] = is_array($cinema_week) ? implode(',', $cinema_week) : $cinema_week; $data['cinema_time'] = is_array($cinema_time) ? implode('~', $cinema_time) : $cinema_time; $data['cinema_label'] = $cinema_label; $data['cinema_img'] = $cinema_img; $data['cinema_status'] = $cinema_status; $data['cinema_update_time'] = time(); $result = LifeCinema::where($where)->update($data); if ($result !== false){ $msg = '管理员:' . $admin_id . '在:' . date("Y-m-d H:i:s", time()) . '修改万悦影院影片-编号: ' . $cinema_id; plog('life-cinema-update', '悦活-万悦影院-修改影片', $msg); LifeCinema::affairCommit(); return true; } throw new \Exception('操作失败!'); }catch (\Exception $exception){ LifeCinema::affairRollback(); throw new \Exception($exception->getMessage(), 500); } } /** * Notes:删除影片 * @param int $cinema_id * @return int * User: ZQ * Date: 2022/9/13 */ public static function delCinema($cinema_id,$admin_id) { LifeCinema::affairBegin(); try { $where = []; $where['cinema_id'] = $cinema_id; $data['cinema_is_del'] = 1; $result = LifeCinema::where($where)->update($data); if (!empty($result)){ $msg = '管理员:' . $admin_id . '在:' . date("Y-m-d H:i:s", time()) . '删除万悦影院影片-编号: ' . $cinema_id; plog('life-cinema-delete', '悦活-万悦影院-删除影片', $msg); LifeCinema::affairCommit(); return true; }else{ return false; } }catch (\Exception $exception){ LifeCinema::affairRollback(); throw new \Exception($exception->getMessage(), 500); } } /** * Notes: 添加影片 * @param string $cinema_name * @param array $cinema_rules * @return int * User: ZQ * Date: 2022/9/13 */ public static function insertCinema($cinema_name, $cinema_video, $cinema_mold, $cinema_director, $cinema_star, $cinema_price, $cinema_introduction, $cinema_performers, $cinema_seat, $cinema_length, $cinema_time, $cinema_label, $cinema_img, $cinema_status, $cinema_week, $admin_id) { LifeCinema::affairBegin(); try { $data = []; $data['cinema_name'] = $cinema_name; $data['cinema_video'] = $cinema_video; $data['cinema_mold'] = implode(',',$cinema_mold); $data['cinema_director'] = implode(',',$cinema_director); $data['cinema_price'] = $cinema_price; $data['cinema_star'] = implode(',',$cinema_star); $data['cinema_introduction'] = $cinema_introduction; $data['cinema_performers'] = implode(',',$cinema_performers); $data['cinema_seat'] = $cinema_seat; $data['cinema_length'] = $cinema_length; $data['cinema_week'] = is_array($cinema_week) ? implode(',', $cinema_week) : $cinema_week; $data['cinema_time'] = is_array($cinema_time) ? implode('~', $cinema_time) : $cinema_time; $data['cinema_label'] = $cinema_label; $data['cinema_img'] = $cinema_img; $data['cinema_status'] = $cinema_status; $data['cinema_create_time'] = time(); $result = LifeCinema::insertGetId($data); if (!empty($result)){ $msg = '管理员:' . $admin_id . '在:' . date("Y-m-d H:i:s", time()) . '添加万悦影院影片-编号: ' . $result; plog('life-cinema-create', '悦活-万悦影院-添加影片', $msg); LifeCinema::affairCommit(); return $result; } throw new \Exception('操作失败!'); }catch (\Exception $exception){ LifeCinema::affairRollback(); throw new \Exception($exception->getMessage(), 500); } } /** * Notes:查询影片 * @param int $cinema_id * @return int * User: ZQ * Date: 2022/9/13 */ public static function cinemaInfo($cinema_id) { $where = []; $where['cinema_id'] = $cinema_id; $result = LifeCinema::where($where)->first(); if (!empty($result)){ $cinema_mold = explode(',',$result['cinema_mold']); if (!empty($cinema_mold)){ for ($i=0;$iupdate($data); if ($result !== false){ LifeCinema::affairCommit(); return true; } throw new \Exception('操作失败!'); }catch (\Exception $exception){ LifeCinema::affairRollback(); throw new \Exception($exception->getMessage(), 500); } } }