123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- <?php
- /**
- * Circle Level
- *
- *
- *
- *
-
- */
- defined('InShopNC') or exit('Access Invalid!');
- class circle_recycleModel extends Model {
- public function __construct(){
- parent::__construct();
- }
- /**
- * Saved to the recycle bin
- *
- * @param array $param
- */
- public function saveRecycle($param, $data = array()){
- switch($param['type']){
- case 'theme':
- return $this->saveRecycleTheme($param);
- break;
- case 'reply':
- return $this->saveRecycleReply($param);
- break;
- case 'admintheme':
- return $this->saveRecycleThemeAdmin($param, $data);
- break;
- case 'adminreply':
- return $this->saveRecycleReplyAdmin($param, $data);
- break;
- default:
- return false;
- break;
- }
- }
- /**
- * Keep the theme to the recycle bin
- *
- * @param array $param
- */
- private function saveRecycleTheme($param){
- $theme_info = $this->themeInfo($param);
- if(empty($theme_info)) return false;
- $insert = array();
- $insert['member_id'] = $theme_info['member_id'];
- $insert['member_name'] = $theme_info['member_name'];
- $insert['circle_id'] = $theme_info['circle_id'];
- $insert['circle_name'] = $theme_info['circle_name'];
- $insert['theme_name'] = $theme_info['theme_name'];
- $insert['recycle_content'] = $theme_info['theme_content'];
- $insert['recycle_opid'] = $param['op_id'];
- $insert['recycle_opname'] = $param['op_name'];
- $insert['recycle_type'] = 1;
- $insert['recycle_time'] = time();
- return $this->add($insert);
- }
- /**
- * Keep the theme to the recycle bin
- *
- * @param array $param
- */
- private function saveRecycleThemeAdmin($param, $theme_info){
- $insert = array();
- $insert['member_id'] = $theme_info['member_id'];
- $insert['member_name'] = $theme_info['member_name'];
- $insert['circle_id'] = $theme_info['circle_id'];
- $insert['circle_name'] = $theme_info['circle_name'];
- $insert['theme_name'] = $theme_info['theme_name'];
- $insert['recycle_content'] = $theme_info['theme_content'];
- $insert['recycle_opid'] = $param['op_id'];
- $insert['recycle_opname'] = $param['op_name'];
- $insert['recycle_type'] = 1;
- $insert['recycle_time'] = time();
- return $this->add($insert);
- }
- /**
- * Keep the reply to the recycle bin
- *
- * @param array $param
- */
- private function saveRecycleReply($param){
- $theme_info = $this->themeInfo($param);
- if(empty($theme_info)) return false;
- $reply_info = $this->replyInfo($param);
- if(empty($reply_info)) return false;
- $insert = array();
- $insert['member_id'] = $reply_info['member_id'];
- $insert['member_name'] = $reply_info['member_name'];
- $insert['circle_id'] = $theme_info['circle_id'];
- $insert['circle_name'] = $theme_info['circle_name'];
- $insert['theme_name'] = $theme_info['theme_name'];
- $insert['recycle_content'] = $reply_info['reply_content'];
- $insert['recycle_opid'] = $param['op_id'];
- $insert['recycle_opname'] = $param['op_name'];
- $insert['recycle_type'] = 2;
- $insert['recycle_time'] = time();
- return $this->add($insert);
- }
- /**
- * Keep the reply to the recycle bin for admin
- *
- * @param array $param
- */
- private function saveRecycleReplyAdmin($param, $reply_info){
- $theme_info = $this->themeInfo($param);
- if(empty($theme_info)) return false;
- $insert = array();
- $insert['member_id'] = $reply_info['member_id'];
- $insert['member_name'] = $reply_info['member_name'];
- $insert['circle_id'] = $theme_info['circle_id'];
- $insert['circle_name'] = $theme_info['circle_name'];
- $insert['theme_name'] = $theme_info['theme_name'];
- $insert['recycle_content'] = $reply_info['reply_content'];
- $insert['recycle_opid'] = $param['op_id'];
- $insert['recycle_opname'] = $param['op_name'];
- $insert['recycle_type'] = 2;
- $insert['recycle_time'] = time();
- return $this->add($insert);
- }
- /**
- * save data
- *
- * @param array $param
- */
- private function add($param){
- return $this->table('circle_recycle')->insert($param);
- }
- /**
- * theme information
- *
- * @param array $param
- * @return array
- */
- private function themeInfo($param){
- return $this->table('circle_theme')->where(array('theme_id'=>$param['theme_id']))->find();
- }
- /**
- * theme information
- *
- * @param array $param
- * @return array
- */
- private function replyInfo($param){
- return $this->table('circle_threply')->where(array('theme_id'=>$param['theme_id'], 'reply_id'=>$param['reply_id']))->find();
- }
- }
|