当前位置: 首页>>代码示例>>PHP>>正文


PHP Model::addAll方法代码示例

本文整理汇总了PHP中think\Model::addAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Model::addAll方法的具体用法?PHP Model::addAll怎么用?PHP Model::addAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在think\Model的用法示例。


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

示例1: addAll

 public function addAll($rows)
 {
     $result = parent::addAll($rows);
     //删除购物车中的数据
     /*if($result!==false){
           D('ShoppingCar')->where(array('member_id'=>UID))->delete();
       }*/
     return $result;
 }
开发者ID:black-tangyang,项目名称:php0805,代码行数:9,代码来源:OrderInfoItemModel.class.php

示例2: add

 public function add($requestData)
 {
     //>>1.取出用户选择的商品组合
     $goods_attribute_idses = $requestData['goods_attribute_ids'];
     //保存之前先删除
     $this->where(array('goods_id' => $requestData['goods_id']))->delete();
     $rows = array();
     foreach ($goods_attribute_idses as $goods_attribute_ids) {
         $rows[] = array('goods_id' => $requestData['goods_id'], 'goods_attribute_ids' => $goods_attribute_ids, 'price' => $requestData['price'][$goods_attribute_ids], 'stock' => $requestData['stock'][$goods_attribute_ids]);
     }
     if (!empty($rows)) {
         $result = parent::addAll($rows);
         if ($result === false) {
             $this->error = '保存产品出错!';
             return false;
         }
     }
 }
开发者ID:qingsonge,项目名称:php,代码行数:18,代码来源:ProductModel.class.php

示例3: testAdd

 public function testAdd()
 {
     $config = $this->getConfig();
     $time = time();
     $user_model = new Model('test.user', $config);
     $data = ['username' => 'test', 'password' => md5('123456'), 'status' => 1, 'create_time' => $time];
     $user_id = $user_model->data($data)->add();
     $data = ['username' => 'test2', 'password' => md5('000000'), 'status' => 1, 'create_time' => $time];
     $user_model->add($data, true);
     $data = [['user_id' => $user_id, 'consignee' => '张三', 'area_info' => '广东深圳', 'city_id' => '42', 'area_id' => '111', 'address' => 'xx路xx号', 'mobile' => '1380000000000', 'isdefault' => '1'], ['user_id' => $user_id, 'consignee' => '李四', 'area_info' => '广东深圳', 'city_id' => '42', 'area_id' => '111', 'address' => 'xx路xx号', 'mobile' => '13999999999', 'isdefault' => '0']];
     $address_model = new Model('user_address', $config);
     $address_id = $address_model->addAll($data, [], true);
     $data = [['user_id' => $user_id, 'sn' => '10001', 'amount' => '200', 'freight_fee' => '10', 'address_id' => $address_id - 1, 'status' => '1', 'create_time' => $time], ['user_id' => $user_id, 'sn' => '10002', 'amount' => '350.80', 'freight_fee' => '10', 'address_id' => $address_id, 'status' => '0', 'create_time' => $time]];
     $address_model = new Model('order', $config);
     $address_model->addAll($data);
     $data = ['user_id' => $user_id, 'role_id' => 1];
     $config['db_name'] = 'test';
     $config['attr_case'] = 2;
     $model = new Model('', $config);
     $model->table($config['prefix'] . 'role_user')->data($data)->add();
 }
开发者ID:cnzin,项目名称:think,代码行数:21,代码来源:modelTest.php


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