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