$shop_id])->order('sort asc')->paginate([ 'list_rows' => $limit, 'page' => $page, ]); return ['count' => $list->total(), 'lists' => $list->getCollection()]; } /** * @notes 新增话术 * @param $post * @return bool * @author cjhao * @date 2021/11/29 15:54 */ public static function add(int $shop_id,array $post) { $kefu_lang = new KefuLang(); $kefu_lang->shop_id = $shop_id; $kefu_lang->title = $post['title']; $kefu_lang->content = $post['content']; $kefu_lang->sort = $post['sort']; return $kefu_lang->save(); } /** * @notes 编辑话术 * @param $post * @return bool * @author cjhao * @date 2021/11/29 15:59 */ public static function edit(array $post){ return KefuLang::update($post); } /** * @notes 获取话术 * @param $id * @return array|\think\Model|null * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author cjhao * @date 2021/11/29 16:02 */ public static function detail(int $shop_id,int $id){ return KefuLang::where(['id'=>$id,'shop_id'=>$shop_id])->find(); } /** * @notes 删除话术 * @param int $id * @return bool * @author cjhao * @date 2021/11/29 16:11 */ public static function del(int $shop_id,int $id){ return KefuLang::where(['id'=>$id,'shop_id'=>$shop_id])->delete(); } }