insertGetId($data); } /** * 根据条件更新 * @author csdeshang * @param array $data 更新内容 * @param array $condition 更新条件 * @return bool */ public function editActivitydetail($data,$condition){ return Db::name('activitydetail')->where($condition)->update($data); } /** * 根据条件删除 * @author csdeshang * @param array $condition 条件数组 * @return bool */ public function delActivitydetail($condition){ return Db::name('activitydetail')->where($condition)->delete(); } /** * 根据条件查询活动内容信息 * @author csdeshang * @param array $condition 查询条件数组 * @param obj $pagesize 分页页数 * @param string $order 排序 * @return array 二维数组 */ public function getActivitydetailList($condition,$pagesize='',$order='activitydetail_sort desc'){ if ($pagesize) { $res = Db::name('activitydetail')->where($condition)->order($order)->paginate(['list_rows'=>$pagesize,'query' => request()->param()],false); $this->page_info = $res; return $res->items(); }else{ return Db::name('activitydetail')->where($condition)->order($order)->select()->toArray(); } } /** * 根据条件查询活动商品内容信息 * @author csdeshang * @param array $condition 查询条件数组 * @param obj $pagesize 分页页数 * @param string $order 排序 * @return array 二维数组 */ public function getGoodsJoinList($condition,$pagesize='',$order='',$group=''){ $field = 'activitydetail.*,goods.*'; $res=Db::name('activitydetail')->alias('activitydetail')->join('goods goods','activitydetail.item_id=goods.goods_id')->field($field)->where($condition)->order($order); if($group){ $res=$res->group($group); } if ($pagesize) { $res=$res->paginate(['list_rows'=>$pagesize,'query' => request()->param()],false); $this->page_info=$res; return $res->items(); }else{ return $res->select()->toArray(); } } }