コード例 #1
0
ファイル: AdminModel.class.php プロジェクト: Orchild/mt
 public function delete()
 {
     $res = array_map(create_function('$v', 'return $v["id"];'), D('Role')->where('issys<>1')->select());
     $map['role_id'] = array('in', $res);
     $this->where($map);
     return parent::delete();
 }
コード例 #2
0
ファイル: Model.class.php プロジェクト: lychao8/tp-reflection
 /**
  * 修改think php的where方法,在执行查询时只查询没有删除的记录.
  *
  * @param isNeed 是指是否需要is_remove这个条件
  * @param mixed $where
  * @param null  $parse
  *
  * @return Model
  */
 public function where($where, $parse = null, $isNeed = 1)
 {
     if ($isNeed == 1) {
         parent::where(array('is_remove' => 0));
     }
     return parent::where($where, $parse);
 }
コード例 #3
0
 public function where($map, $parse = null)
 {
     if (!$this->not_belongs_to_company) {
         $this->real_model_name = $this->real_model_name ? $this->real_model_name : $this->getModelName();
         $map[$this->real_model_name . ".company_id"] = get_current_company_id();
     }
     return parent::where($map, $parse);
 }
コード例 #4
0
ファイル: BaseModel.class.php プロジェクト: hello7921/haorizi
 function _after_select(&$result, $options)
 {
     parent::_after_select($result, $options);
     foreach ($result as $key => $val) {
         if (method_exists($this, '_parse_item')) {
             $result[$key] = $this->_parse_item($val);
         }
         $result[$key] = $this->parse($result[$key]);
     }
 }
コード例 #5
0
 /**
  * 保存文章的时候,将详细内容存入到content表中
  * @return boolean
  */
 public function modifyArticle()
 {
     $request_data = $this->data;
     if (parent::save() !== false) {
         $data = array('article_id' => $request_data['id'], 'content' => I('post.content', '', false));
         if (M('ArticleContent')->save($data) !== false) {
             return true;
         }
     }
     return false;
 }
コード例 #6
0
ファイル: GroupModel.class.php プロジェクト: noikiy/luokeke2
 protected function _before_write(&$data)
 {
     parent::_before_write($data);
 }
コード例 #7
0
 public function __construct()
 {
     parent::__construct();
     //         echo 'Userinfo';
 }
コード例 #8
0
 public function __construct()
 {
     parent::__construct();
     //         echo 'academy';
 }
コード例 #9
0
 public function __construct()
 {
     parent::__construct();
     //         echo 'class';
 }
コード例 #10
0
ファイル: GoodsModel.class.php プロジェクト: kunx-edu/tp1030
 /**
  * 完成商品的更新。
  * 由于需要修改多张表的数据,所以我们重写了save方法,完成了复杂逻辑。
  * @return boolean
  */
 public function save()
 {
     $request_data = $this->data;
     if (parent::save() === false) {
         $this->error = '商品保存失败';
         return false;
     }
     //商品详细描述的信息
     $data = array('content' => I('post.content', '', false), 'goods_id' => $request_data['id']);
     if (D('GoodsIntro')->save($data) === false) {
         $this->error = '商品详情保存失败';
         return false;
     }
     //将商品的相册图片保存到数据表中
     $gallery = array();
     foreach (I('post.path', '', false) as $path) {
         $gallery[] = array('goods_id' => $request_data['id'], 'path' => $path);
     }
     if (!empty($gallery)) {
         if (M('GoodsGallery')->addAll($gallery) === false) {
             $this->error = '商品相册保存失败';
             return false;
         }
     }
     //将关联文章保存到数据表中
     $articles = array();
     foreach (I('post.article_ids', '', false) as $path) {
         $articles[] = array('goods_id' => $request_data['id'], 'article_id' => $path);
     }
     $article_model = M('GoodsArticle');
     $article_model->where(array('goods_id' => $request_data['id']))->delete();
     if (!empty($articles)) {
         if ($article_model->addAll($articles) === false) {
             $this->error = '关联文章保存失败';
             return false;
         }
     }
     return true;
 }