• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Model\CommonModel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Common\Model\CommonModel的典型用法代码示例。如果您正苦于以下问题:PHP CommonModel类的具体用法?PHP CommonModel怎么用?PHP CommonModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CommonModel类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: addData

 public function addData()
 {
     $brand_id = I('get.brand_id');
     $user_id = $this->user_id;
     if (!$user_id) {
         return $this->nologin;
     } else {
         $where['brand_id'] = $brand_id;
         $where['user_id'] = $user_id;
         $res = $this->where($where)->find();
         if ($res) {
             return $this->hbrand;
         }
         if ($brand_id == '') {
             return $this->nobrand;
         }
         $time = time();
         $data['user_id'] = $this->user_id;
         $data['brand_id'] = $brand_id;
         $data['time'] = $time;
         $list = parent::addData($data);
         if ($list == CommonModel::MSUCCESS) {
             return $this->success;
         } else {
             return $this->fail;
         }
     }
     //return $list;
 }
开发者ID:foryoufeng,项目名称:thinkmobile,代码行数:29,代码来源:FocusModel.class.php


示例2: addData

 public function addData()
 {
     $user_id = session('user.user_id');
     if (!$user_id) {
         return $this->nologin;
     } else {
         $goods_id = I('get.goods_id');
         //蹇呬紶鍙傛暟锛岃幏寰楁敹钘忕殑閭d釜鍟嗗搧
         if ($goods_id == '') {
             return $this->nogoods;
         }
         $where['goods_id'] = $goods_id;
         $where['user_id'] = $user_id;
         $res = $this->where($where)->find();
         if ($res) {
             return $this->hgoods;
         }
         $data['goods_id'] = $goods_id;
         $data['user_id'] = $user_id;
         $data['add_time'] = time();
         $list = parent::addData($data);
         if ($list == CommonModel::MSUCCESS) {
             return $this->success;
         } else {
             return $this->fail;
         }
     }
 }
开发者ID:foryoufeng,项目名称:thinkmobile,代码行数:28,代码来源:CollectModel.class.php


示例3: addCart

 private function addCart($goods_id, $attr_id, $number)
 {
     $data = $this->getAttr($goods_id);
     //获取商品属性
     if ($data && !$attr_id) {
         //有商品属性没有传商品属性id
         return $this->noattrid;
         //没有商品
     }
     $result = $this->getCart($goods_id, $attr_id);
     $amount = $this->getNumber($goods_id, $attr_id);
     //获取库存
     if ($result) {
         //购物车中存在商品就更新
         if (intval($number) + intval($result['goods_number']) > $amount) {
             return $this->nonum;
             //库存不足
         }
         $res = $this->addNum($goods_id, $attr_id, $number);
         if ($res) {
             return $this->success;
             //添加成功
         } else {
             return $this->fail;
             //添加失败
         }
     } else {
         //没有就加入购物车
         $amount = $this->getNumber($goods_id, $attr_id);
         if (intval($number) > $amount) {
             return $this->nonum;
             //库存不足
         }
         $info = array('user_id' => $this->user_id, 'session_id' => session_id(), 'goods_id' => $goods_id, 'goods_attr_id' => $attr_id, 'goods_number' => $number, 'goods_price' => $this->getPrice($goods_id, $attr_id));
         $where['goods_id'] = $goods_id;
         $ginfo = $this->goods->field('goods_sn,market_price,shop_price,goods_name')->where($where)->find();
         //获取商品信息
         $product = $this->getProduct($goods_id, $attr_id);
         $datas = array_merge($info, $ginfo, $product);
         $datas['goods_attr'] = $this->getAttrName($goods_id, $attr_id);
         $res = parent::addData($datas);
         if ($res == CommonModel::MSUCCESS) {
             return $this->success;
             //添加成功
         } else {
             return $this->fail;
             //添加失败
         }
     }
 }
开发者ID:foryoufeng,项目名称:thinkmobile,代码行数:50,代码来源:CartModel.class.php


示例4: _before_write

 protected function _before_write(&$data)
 {
     parent::_before_write($data);
     if (!empty($data['user_pass']) && strlen($data['user_pass']) < 25) {
         $data['user_pass'] = sp_password($data['user_pass']);
     }
 }
开发者ID:2flying2,项目名称:IDF-CTF-PLAT,代码行数:7,代码来源:UsersModel.class.php


示例5: editData

 /**
  * 编辑数据
  * @return int|string MSUCCESS表示成功  MFAIL表示失败  getError返回错误信息
  */
 public function editData($id)
 {
     $data['user_id'] = session('user.id');
     $data['name'] = I('name');
     $data['phone'] = I('phone');
     $data['address'] = I('address');
     $data['id'] = $id;
     return parent::editData($data);
 }
开发者ID:foryoufeng,项目名称:thinkmobile,代码行数:13,代码来源:ClanModel.class.php


示例6: _after_update

 protected function _after_update($data, $options)
 {
     parent::_after_update($data, $options);
     $id = $data['id'];
     $parent_id = $data['parentid'];
     if ($parent_id == 0) {
         $d['path'] = "0-{$id}";
     } else {
         $parent = $this->where("id={$parent_id}")->find();
         $d['path'] = $parent['path'] . '-' . $id;
     }
     $this->where("id={$id}")->save($d);
 }
开发者ID:2flying2,项目名称:IDF-CTF-PLAT,代码行数:13,代码来源:CommentsModel.class.php


示例7: _before_write

 protected function _before_write(&$data)
 {
     parent::_before_write($data);
 }
开发者ID:noikiy,项目名称:luokeke2,代码行数:4,代码来源:ArticleCatModel.class.php


示例8: __construct

 public function __construct()
 {
     parent::__construct();
     $this->main_model = model_alias_to_name($this->main_model_alias);
     $this->detail_model = model_alias_to_name($this->detail_model_alias);
 }
开发者ID:npk,项目名称:ones,代码行数:6,代码来源:CommonBillService.class.php


示例9: _after_delete

 public function _after_delete($data, $options)
 {
     parent::_after_delete($data, $options);
     $this->_before_write($data);
 }
开发者ID:feng8605765,项目名称:xmmusic,代码行数:5,代码来源:MenuModel.class.php


示例10: _before_write

 protected function _before_write(&$data)
 {
     parent::_before_write($data);
     $data['create_time'] = $this->mGetDate();
 }
开发者ID:crab890715,项目名称:GoOut-Panel,代码行数:5,代码来源:OrderModel.class.php


示例11: __construct

 public function __construct($name = '', $tablePrefix = '', $connection = '')
 {
     parent::__construct($name = '', $tablePrefix = '', $connection = '');
     $this->AUTH_NODE_FLAGS = array(array('id' => '1', 'label' => __('common.Everybody')), array('id' => '2', 'label' => __('common.Self only')), array('id' => '3', 'label' => __('common.Self and directly subordinate')), array('id' => '4', 'label' => __('common.Self and all subordinate')), array('id' => '5', 'label' => __('common.Self department')), array('id' => '6', 'label' => __('common.Self department and it\'s subordinate department')), array('id' => '0', 'label' => '|---' . __('common.Confirm APP supported under this')), array('id' => '7', 'label' => __('common.Self Headed Only')), array('id' => '8', 'label' => __('common.Self and directly subordinate Headed')), array('id' => '9', 'label' => __('common.Self and all subordinate Headed')));
 }
开发者ID:DevlJs,项目名称:ones,代码行数:5,代码来源:AuthNodeService.class.php


示例12:

 function _initialize()
 {
     parent::_initialize();
 }
开发者ID:Njupt-Sast-Network,项目名称:UMR,代码行数:4,代码来源:ContentModel.class.php


示例13: __construct

 public function __construct($name = '', $tablePrefix = '', $connection = '')
 {
     parent::__construct($name, $tablePrefix, $connection);
     $this->save_path = ENTRY_PATH . '/uploads';
 }
开发者ID:DevlJs,项目名称:ones,代码行数:5,代码来源:AttachmentService.class.php



注:本文中的Common\Model\CommonModel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP models\Article类代码示例发布时间:2022-05-23
下一篇:
PHP Controller\AdminbaseController类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap