diff --git a/.gitignore b/.gitignore index c1e37b3e..5870809d 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,5 @@ /public/robots.txt /public/sitemap.xml /public/h5 +/storage/cache/purifier *KgTest* diff --git a/app/Http/Admin/Controllers/CategoryController.php b/app/Http/Admin/Controllers/CategoryController.php index ac0c3720..a82dffe2 100644 --- a/app/Http/Admin/Controllers/CategoryController.php +++ b/app/Http/Admin/Controllers/CategoryController.php @@ -35,9 +35,12 @@ class CategoryController extends Controller $categories = $categoryService->getTopCategories($type); } + $showAddButton = $categoryService->showAddButton($type, $parent); + $this->view->setVar('type', $type); $this->view->setVar('parent', $parent); $this->view->setVar('categories', $categories); + $this->view->setVar('show_add_button', $showAddButton); } /** diff --git a/app/Http/Admin/Services/Category.php b/app/Http/Admin/Services/Category.php index e5750e6c..92e8caf8 100644 --- a/app/Http/Admin/Services/Category.php +++ b/app/Http/Admin/Services/Category.php @@ -17,6 +17,51 @@ use App\Validators\Category as CategoryValidator; class Category extends Service { + public function getCategoryOptions($type) + { + $cache = new CategoryTreeListCache(); + + $categories = $cache->get($type); + + $result = []; + + if (!$categories) return $result; + + foreach ($categories as $category) { + $result[] = [ + 'id' => $category['id'], + 'name' => $category['name'], + ]; + if (count($category['children']) > 0) { + foreach ($category['children'] as $child) { + $result[] = [ + 'id' => $child['id'], + 'name' => sprintf('|--- %s', $child['name']), + ]; + } + } + } + + return $result; + } + + public function showAddButton($type, CategoryModel $parent) + { + $result = true; + + if ($type == CategoryModel::TYPE_COURSE) { + $result = $parent->level < 2; + } elseif ($type == CategoryModel::TYPE_HELP) { + $result = $parent->level < 1; + } elseif ($type == CategoryModel::TYPE_ARTICLE) { + $result = $parent->level < 1; + } elseif ($type == CategoryModel::TYPE_QUESTION) { + $result = $parent->level < 1; + } + + return $result; + } + public function getCategory($id) { return $this->findOrFail($id); diff --git a/app/Http/Admin/Views/category/list.volt b/app/Http/Admin/Views/category/list.volt index 4683373c..2b79388e 100644 --- a/app/Http/Admin/Views/category/list.volt +++ b/app/Http/Admin/Views/category/list.volt @@ -4,7 +4,6 @@ {% set back_url = url({'for':'admin.category.list'},{'type':type}) %} {% set add_url = url({'for':'admin.category.add'},{'type':type,'parent_id':parent.id}) %} - {% set allow_add = (type == 1 and parent.level < 2) or (type == 2 and parent.level < 1) %}
物品名称:{{ item.gift_name }}({{ item.gift_id }})
-物品类型:{{ gift_type_info(item.gift_type) }}
+物品类型:{{ gift_type(item.gift_type) }}
用户名称:{{ item.user_name }}({{ item.user_id }})
联系方式:查看
{% for lesson in chapter.children %} {% if lesson.model == 1 %} -- {{ vod_lesson_info(lesson) }}
+ - {{ vod_lesson_info(lesson) }}
{% elseif lesson.model == 2 %}
- - {{ live_lesson_info(lesson) }}
+ - {{ live_lesson_info(lesson) }}
{% elseif lesson.model == 3 %}
- - {{ read_lesson_info(lesson) }}
+ - {{ read_lesson_info(lesson) }}
{% elseif lesson.model == 4 %}
- - {{ offline_lesson_info(lesson) }}
+ - {{ offline_lesson_info(lesson) }}
{% endif %}
{% endfor %}
diff --git a/app/Http/Home/Views/course/show_meta.volt b/app/Http/Home/Views/course/show_meta.volt index a0d37b9a..ff79b74d 100644 --- a/app/Http/Home/Views/course/show_meta.volt +++ b/app/Http/Home/Views/course/show_meta.volt @@ -61,12 +61,8 @@ {%- macro meta_price_info(course) %}- {% if course.origin_price > 0 %} - 原始价格 - {{ '¥%0.2f'|format(course.origin_price) }} - {% endif %} {% if course.market_price > 0 %} - 优惠价格 + 市场价格 {{ '¥%0.2f'|format(course.market_price) }} {% else %} 优惠价格 @@ -93,7 +89,7 @@
{%- endmacro %} -{{ info.question.title }}
+ {% else %} +N/A
{% endif %} {%- endmacro %} \ No newline at end of file diff --git a/app/Http/Home/Views/order/confirm.volt b/app/Http/Home/Views/order/confirm.volt index 3d2f7d14..88bb5c7f 100644 --- a/app/Http/Home/Views/order/confirm.volt +++ b/app/Http/Home/Views/order/confirm.volt @@ -6,14 +6,14 @@ {%- macro cart_course_card(course, user) %} {% set course_url = url({'for':'home.course.show','id':course.id}) %} -{{ course.title }}
- 优惠价格 + 市场价格 {{ '¥%0.2f'|format(course.market_price) }} 会员价格 {{ '¥%0.2f'|format(course.vip_price) }} @@ -46,7 +46,7 @@ {% set course = item_info.course %} {% set reward = item_info.reward %} {% set course_url = url({'for':'home.course.show','id':course.id}) %} -
-- 我的好友
- - 我的群组
-
-{{ item.subject }}
++ 编号:{{ item.sn }} + 时间:{{ date('Y-m-d',item.create_time) }} +
+{{ item.subject }}
++ 编号:{{ item.sn }} + 时间:{{ date('Y-m-d',item.create_time) }} +
+