diff --git a/app/Admin/Controllers/GoodsTypeController.php b/app/Admin/Controllers/GoodsTypeController.php deleted file mode 100644 index f006007..0000000 --- a/app/Admin/Controllers/GoodsTypeController.php +++ /dev/null @@ -1,96 +0,0 @@ -id->sortable(); - $grid->cover_img->image('',50); - $grid->type_name; - $grid->store_type_id->display(function ($storeTypeId){ - $storeType = StoreTypeModel::getStoreTypeInfo($storeTypeId,'type_name'); - return empty($storeType) ? '' : $storeType->type_name; - }); - $grid->sort->sortable(); - // 排序 - $grid->model()->orderBy('id', 'desc'); - - $grid->filter(function (Grid\Filter $filter) { - $filter->like('type_name'); - }); - - // 每页10条 - $grid->paginate(10); - }); - } - - /** - * Make a show builder. - * - * @param mixed $id - * - * @return Show - */ - protected function detail($id) - { - return Show::make($id, new GoodsType(), function (Show $show) { - $show->type_name->width(4); - $show->cover_img->image()->width(2); - $show->sort->width(1); - $show->created_at_text->width(2); - $show->updated_at_text->width(2); - }); - } - - /** - * Make a form builder. - * - * @return Form - */ - protected function form() - { - $builder = GoodsTypeModel::with('correlation'); - - return Form::make($builder, function (Form $form) { - $form->hidden('id'); - // 查询一级分类(店铺分类) - $storeTypeList = StoreTypeModel::getStoreTypeArray(); - - // $form->select('store_type_id')->options($storeTypeList); - $form->hasMany('correlation',function (Form\NestedForm $form) use($storeTypeList){ - $form->select('store_type_id')->options($storeTypeList); - $form->hidden('goods_type_id')->value($form->getKey()); - }); - - $form->text('type_name')->required()->maxLength(20,'最多只能输入20个中文字'); - - /* uniqueName图片名称唯一,否则可能图片上传失败 */ - $form->image('cover_img')->required()->uniqueName(); - - $form->number('sort')->width(100); - - $form->disableResetButton(); - $form->disableViewCheck(); - $form->disableEditingCheck(); - $form->disableCreatingCheck(); - - - }); - } -} diff --git a/app/Admin/Controllers/StoreTypeController.php b/app/Admin/Controllers/StoreTypeController.php deleted file mode 100644 index b1bc7ab..0000000 --- a/app/Admin/Controllers/StoreTypeController.php +++ /dev/null @@ -1,89 +0,0 @@ -id->sortable(); - $grid->cover_img->image('',50); - $grid->type_name; - $grid->sort->sortable(); - // 排序 - $grid->model()->orderBy('id', 'desc'); - - $grid->filter(function (Grid\Filter $filter) { - $filter->like('type_name'); - }); - - // 每页10条 - $grid->paginate(10); - }); - } - - /** - * Make a show builder. - * - * @param mixed $id - * - * @return Show - */ - protected function detail($id) - { - return Show::make($id, new StoreType(), function (Show $show) { - $show->type_name->width(4); - $show->cover_img_url->image()->width(1); - $show->sort->width(1); - $show->created_at_text->width(2); - $show->updated_at_text->width(2); - }); - } - - /** - * Make a form builder. - * - * @return Form - */ - protected function form() - { - $builder = StoreTypeModel::with('correlation'); - - return Form::make(new StoreType(), function (Form $form) { - $form->hidden('id'); - // 二级分类 - $goodsTypeList = GoodsTypeModel::getGoodsTypeArray(); - - $form->text('type_name')->required()->maxLength(20,'最多只能输入20个中文字'); - - /* uniqueName图片名称唯一,否则可能图片上传失败 */ - $form->image('cover_img')->required()->uniqueName(); - - //选择二级分类 - $form->hasMany('correlation',function (Form\NestedForm $form) { - $form->multipleSelect(); - }); - - $form->number('sort')->width(100); - - $form->disableResetButton(); - $form->disableViewCheck(); - $form->disableEditingCheck(); - $form->disableCreatingCheck(); - }); - } -} diff --git a/app/Admin/Controllers/TypeCorrelationController.php b/app/Admin/Controllers/TypeCorrelationController.php deleted file mode 100644 index 5d6aaab..0000000 --- a/app/Admin/Controllers/TypeCorrelationController.php +++ /dev/null @@ -1,117 +0,0 @@ -id->sortable(); - $grid->store_type_name; - $grid->goods_type_id; - - $grid->filter(function (Grid\Filter $filter) { - $filter->equal('id'); - }); - - $grid->disableCreateButton(); - $grid->disableViewButton(); - $grid->disableEditButton(); - $grid->disableDeleteButton(); - $grid->disableBatchDelete(); - $grid->actions(function (Grid\Displayers\Actions $actions) { - // new TypeCorrelationBind() - $id = $actions->getKey(); - $actions->append('绑定'); - }); - }); - } - - /** - * Make a show builder. - * - * @param mixed $id - * - * @return Show - */ - protected function detail($id) - { - return Show::make($id, new TypeCorrelation(), function (Show $show) { - $show->id; - $show->store_type_id; - $show->goods_type_id; - }); - } - - /** - * Make a form builder. - * - * @return Form - */ - protected function form() - { - return Form::make(new TypeCorrelation(), function (Form $form) { - $form->hidden('id'); - - if ($form->isEditing()) { - - } - $storeName = $this->createNames(); - $form->listbox('goods_ids', '商品分类')->options($storeName); - - $form->disableHeader(); - $form->disableResetButton(); - $form->disableViewCheck(); - $form->disableEditingCheck(); - $form->disableCreatingCheck(); - }); - } - - /** - * 搜索获取店铺名称 - */ - protected function searchStoreName() - { - if (isset($this->storeName)) { - return $this->storeName; - } - $this->storeName = []; - $store = StoreModel::select('id','name')->where('name','like','')->get(); - - - return $this->storeName; - } - /** - * 生成随机数据 - * - * @return array - */ - protected function createNames() - { - if (isset($this->names)) { - return $this->names; - } - // $faker = Factory::create(); - $faker = ['胜多负少','sdsf','风格恢复']; - $this->names = []; - foreach ($faker as $key => $value) { - $name = $value; - $this->names[$name] = $name; - } - return $this->names; - } -} diff --git a/app/Admin/Repositories/GoodsType.php b/app/Admin/Repositories/GoodsType.php deleted file mode 100644 index 43250f3..0000000 --- a/app/Admin/Repositories/GoodsType.php +++ /dev/null @@ -1,16 +0,0 @@ -setPaginate($model); /* 根据流水查询 2020-08-18 目前用全匹配文字方式查询新用户 */ - $storeAccountModel = new storeAccountModel(); + $storeAccountModel = new StoreAccountModel(); $query = $storeAccountModel::join('ims_cjdc_store as store','ims_cjdc_store_account.store_id','store.id') ->select('store_id','store.market_id','store.name as store_name',DB::raw("count(distinct ims_cjdc_store_account.id) as new_user_total")) ->whereRaw("note = '新用户下单成功,平台奖励'") diff --git a/app/Admin/Repositories/TypeCorrelation.php b/app/Admin/Repositories/TypeCorrelation.php deleted file mode 100644 index 597db80..0000000 --- a/app/Admin/Repositories/TypeCorrelation.php +++ /dev/null @@ -1,16 +0,0 @@ -hasMany(TypeCorrelation::class,'goods_type_id','id'); - } - - public function getCreatedAtTextAttribute($value) - { - $value = $value ? $value : $this->created_at; - return $value; - // return date('Y-m-d H:i:s',$value); - } - public function getUpdatedAtTextAttribute($value) - { - $value = $value ? $value : $this->updated_at; - return $value; - // return date('Y-m-d H:i:s',$value); - } - - public function getCoverImgUrlAttribute($value) - { - $value = $value ? $value : $this->cover_img; - return $this->imageUrl($value); - } - - /** - * 获取单个商品信息 - * @param int $id - * @param string $field - * @return string - */ - public static function getGoodsInfo($id,$field = '*') - { - return self::select($field)->find($id); - } - - /** - * 获取二级分类数组 - * id为键,name为值 - * @return array - */ - public static function getGoodsTypeArray() - { - $list = self::select('id','type_name') - ->where('status',1) - ->whereNull('deleted_at') - ->get(); - $array = []; - if(count($list) > 0){ - foreach ($list as $value) { - $array[$value->id] = $value->type_name; - } - } - - return $array; - } - - // 处理图片 - public function imageUrl($value) - { - return env('OSS_IMG_HOST').'/'.$value; - } -} diff --git a/app/Models/StoreType.php b/app/Models/StoreType.php deleted file mode 100644 index 18c8a8f..0000000 --- a/app/Models/StoreType.php +++ /dev/null @@ -1,93 +0,0 @@ -hasMany(TypeCorrelation::class,'store_type_id','id'); - } - - public function getCreatedAtTextAttribute($value) - { - $value = $value ? $value : $this->created_at; - return $value; - // return date('Y-m-d H:i:s',$value); - } - public function getUpdatedAtTextAttribute($value) - { - $value = $value ? $value : $this->updated_at; - return $value; - // return date('Y-m-d H:i:s',$value); - } - - public function getCoverImgUrlAttribute($value) - { - $value = $value ? $value : $this->cover_img; - return $this->imageUrl($value); - } - - /** - * 获取单个一级分类信息 - * @param int $id - * @param string $field - * @return object - */ - public static function getStoreTypeInfo($id,$field = '*') - { - return self::select($field)->find($id); - } - - /** - * 获取一级分类数组 - * id为键,name为值 - * @return array - */ - public static function getStoreTypeArray() - { - $list = self::select('id','type_name') - ->where('status',1) - ->whereNull('deleted_at') - ->get(); - $array = []; - if(count($list) > 0){ - foreach ($list as $value) { - $array[$value->id] = $value->type_name; - } - } - - return $array; - } - - // 处理图片 - public function imageUrl($value) - { - if(strripos($value,"http") === false){ - return env('OSS_IMG_HOST').'/'.$value; - }else{ - return $value; - } - } -} diff --git a/app/Models/TypeCorrelation.php b/app/Models/TypeCorrelation.php deleted file mode 100644 index 68e35a5..0000000 --- a/app/Models/TypeCorrelation.php +++ /dev/null @@ -1,25 +0,0 @@ -store_type_id,'name'); - return $store ? $store->name : ''; - } - -} diff --git a/app/Models/storeUserReport.php b/app/Models/storeUserReport.php deleted file mode 100644 index 6a3c05d..0000000 --- a/app/Models/storeUserReport.php +++ /dev/null @@ -1,15 +0,0 @@ - [ - 'GoodsType' => '二级分类(商品)', - 'goodsType' => '二级分类(商品)', - ], - 'fields' => [ - 'type_name' => '分类名称', - 'cover_img' => '封面图', - 'cover_img_url' => '封面图', - 'sort' => '排序', - 'store_type_id' => '上级分类', - 'correlation' =>'上级分类' - ], - 'options' => [ - ], -]; diff --git a/resources/lang/zh-CN/store-type.php b/resources/lang/zh-CN/store-type.php deleted file mode 100644 index bb465bc..0000000 --- a/resources/lang/zh-CN/store-type.php +++ /dev/null @@ -1,15 +0,0 @@ - [ - 'StoreType' => '一级分类(店铺)', - 'storeType' => '一级分类(店铺)', - ], - 'fields' => [ - 'type_name' => '分类名称', - 'cover_img' => '封面图', - 'cover_img_url' => '封面图', - 'sort' => '排序' - ], - 'options' => [ - ], -]; diff --git a/resources/lang/zh-CN/type-correlation.php b/resources/lang/zh-CN/type-correlation.php deleted file mode 100644 index e252f8c..0000000 --- a/resources/lang/zh-CN/type-correlation.php +++ /dev/null @@ -1,17 +0,0 @@ - [ - 'TypeCorrelation' => '分类绑定', - 'typeCorrelation' => '分类绑定', - 'Edit' => '绑定', - 'edit' => '绑定' - ], - 'fields' => [ - 'store_type_id' => '一级分类(店铺)', - 'store_type_name' => '一级分类(店铺)', - 'goods_type_id' => '二级分类(商品)', - 'goods_type_name' => '二级分类(商品)', - ], - 'options' => [ - ], -];