mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-07-12 19:39:10 +08:00
测试xunsearch
This commit is contained in:
parent
a283296d35
commit
72e023920d
@ -1,28 +1,28 @@
|
|||||||
{%- macro item_info(order) %}
|
{%- macro item_info(order) %}
|
||||||
{% if order.item_type == 'course' %}
|
{% if order.item_type == 'course' %}
|
||||||
{% set course = order.item_info['course'] %}
|
{% set course = order.item_info.course %}
|
||||||
<div class="kg-order-item">
|
<div class="kg-order-item">
|
||||||
<p>课程名称:{{ course['title'] }}</p>
|
<p>课程名称:{{ course.title }}</p>
|
||||||
<p>市场价格:¥{{ course['market_price'] }}</p>
|
<p>市场价格:¥{{ course.market_price }}</p>
|
||||||
<p>有效期限:{{ date('Y-m-d', course['expire_time']) }}</p>
|
<p>有效期限:{{ date('Y-m-d', course.expire_time) }}</p>
|
||||||
</div>
|
</div>
|
||||||
{% elseif order.item_type == 'package' %}
|
{% elseif order.item_type == 'package' %}
|
||||||
{% set courses = order.item_info['courses'] %}
|
{% set courses = order.item_info.courses %}
|
||||||
{% for course in courses %}
|
{% for course in courses %}
|
||||||
<div class="kg-order-item">
|
<div class="kg-order-item">
|
||||||
<p>课程名称:{{ course['title'] }}</p>
|
<p>课程名称:{{ course.title }}</p>
|
||||||
<p>市场价格:¥{{ course['market_price'] }}</p>
|
<p>市场价格:¥{{ course.market_price }}</p>
|
||||||
<p>有效期限:{{ date('Y-m-d', course['expire_time']) }}</p>
|
<p>有效期限:{{ date('Y-m-d', course.expire_time) }}</p>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% elseif order.item_type == 'reward' %}
|
{% elseif order.item_type == 'reward' %}
|
||||||
{% set course = order.item_info['course'] %}
|
{% set course = order.item_info.course %}
|
||||||
<div class="kg-order-item">
|
<div class="kg-order-item">
|
||||||
<p>课程名称:{{ course['title'] }}</p>
|
<p>课程名称:{{ course.title }}</p>
|
||||||
<p>赞赏金额:¥{{ order.amount }}</p>
|
<p>赞赏金额:¥{{ order.amount }}</p>
|
||||||
</div>
|
</div>
|
||||||
{% elseif order.item_type == 'vip' %}
|
{% elseif order.item_type == 'vip' %}
|
||||||
{% set vip = order.item_info['vip'] %}
|
{% set vip = order.item_info.vip %}
|
||||||
<div class="kg-order-item">
|
<div class="kg-order-item">
|
||||||
<p>商品名称:{{ order.subject }}</p>
|
<p>商品名称:{{ order.subject }}</p>
|
||||||
<p>商品价格:¥{{ order.amount }}</p>
|
<p>商品价格:¥{{ order.amount }}</p>
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
<col>
|
<col>
|
||||||
<col>
|
<col>
|
||||||
<col>
|
<col>
|
||||||
<col>
|
|
||||||
<col width="10%">
|
<col width="10%">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -16,12 +16,12 @@ class Database extends AbstractProvider
|
|||||||
$config = $this->getShared('config');
|
$config = $this->getShared('config');
|
||||||
|
|
||||||
$options = [
|
$options = [
|
||||||
'host' => $config->db->host ?: '127.0.0.1',
|
'host' => $config->db->host,
|
||||||
'port' => $config->db->host ?: 3306,
|
'port' => $config->db->port,
|
||||||
'dbname' => $config->db->dbname,
|
'dbname' => $config->db->dbname,
|
||||||
'username' => $config->db->username,
|
'username' => $config->db->username,
|
||||||
'password' => $config->db->password,
|
'password' => $config->db->password,
|
||||||
'charset' => $config->db->charset ?: 'utf8',
|
'charset' => $config->db->charset,
|
||||||
];
|
];
|
||||||
|
|
||||||
$connection = new MySqlAdapter($options);
|
$connection = new MySqlAdapter($options);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Searchers;
|
namespace App\Searchers;
|
||||||
|
|
||||||
|
use App\Models\Course as CourseModel;
|
||||||
use Phalcon\Mvc\User\Component as UserComponent;
|
use Phalcon\Mvc\User\Component as UserComponent;
|
||||||
|
|
||||||
class Course extends UserComponent
|
class Course extends UserComponent
|
||||||
@ -18,7 +19,7 @@ class Course extends UserComponent
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 搜索
|
* 搜索
|
||||||
*
|
*
|
||||||
* @param string $query
|
* @param string $query
|
||||||
* @param integer $limit
|
* @param integer $limit
|
||||||
* @param integer $offset
|
* @param integer $offset
|
||||||
@ -41,7 +42,7 @@ class Course extends UserComponent
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加索引
|
* 添加索引
|
||||||
*
|
*
|
||||||
* @param CourseModel $course
|
* @param CourseModel $course
|
||||||
*/
|
*/
|
||||||
public function addIndex($course)
|
public function addIndex($course)
|
||||||
@ -53,7 +54,7 @@ class Course extends UserComponent
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新索引
|
* 更新索引
|
||||||
*
|
*
|
||||||
* @param CourseModel $course
|
* @param CourseModel $course
|
||||||
* @throws \XSException
|
* @throws \XSException
|
||||||
*/
|
*/
|
||||||
@ -66,7 +67,7 @@ class Course extends UserComponent
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除索引
|
* 删除索引
|
||||||
*
|
*
|
||||||
* @param CourseModel $course
|
* @param CourseModel $course
|
||||||
*/
|
*/
|
||||||
public function deleteIndex($course)
|
public function deleteIndex($course)
|
||||||
@ -76,13 +77,30 @@ class Course extends UserComponent
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置文档
|
* 设置文档
|
||||||
*
|
*
|
||||||
* @param CourseModel $course
|
* @param CourseModel $course
|
||||||
* @return \XSDocument
|
* @return \XSDocument
|
||||||
*/
|
*/
|
||||||
private function setXSDocument($course)
|
private function setXSDocument($course)
|
||||||
{
|
{
|
||||||
$data = $course->toArray();
|
|
||||||
|
$data = [
|
||||||
|
'id' => $course->id,
|
||||||
|
'title' => $course->title,
|
||||||
|
'cover' => $course->cover,
|
||||||
|
'summary' => $course->summary,
|
||||||
|
'keywords' => $course->keywords,
|
||||||
|
'market_price' => $course->market_price,
|
||||||
|
'vip_price' => $course->vip_price,
|
||||||
|
'expiry' => $course->expiry,
|
||||||
|
'rating' => $course->rating,
|
||||||
|
'score' => $course->score,
|
||||||
|
'model' => $course->model,
|
||||||
|
'level' => $course->level,
|
||||||
|
'student_count' => $course->student_count,
|
||||||
|
'lesson_count' => $course->lesson_count,
|
||||||
|
'created_at' => $course->created_at,
|
||||||
|
];
|
||||||
|
|
||||||
$doc = new \XSDocument();
|
$doc = new \XSDocument();
|
||||||
|
|
||||||
|
@ -1,51 +1,55 @@
|
|||||||
project.name = course
|
project.name = course
|
||||||
|
project.default_charset = UTF-8
|
||||||
|
|
||||||
|
server.index = 8383
|
||||||
|
server.search = 8384
|
||||||
|
|
||||||
[id]
|
[id]
|
||||||
type = id
|
type = id
|
||||||
|
|
||||||
[user_id]
|
|
||||||
type = string
|
|
||||||
index = self
|
|
||||||
tokenizer = full
|
|
||||||
|
|
||||||
[category_id]
|
|
||||||
type = string
|
|
||||||
index = self
|
|
||||||
tokenizer = full
|
|
||||||
|
|
||||||
[type]
|
|
||||||
type = string
|
|
||||||
index = self
|
|
||||||
tokenizer = full
|
|
||||||
|
|
||||||
[title]
|
[title]
|
||||||
type = title
|
type = title
|
||||||
|
|
||||||
|
[cover]
|
||||||
|
type = string
|
||||||
|
|
||||||
[summary]
|
[summary]
|
||||||
type = body
|
type = body
|
||||||
|
|
||||||
[tags]
|
[keywords]
|
||||||
|
type = string
|
||||||
|
index = mixed
|
||||||
|
|
||||||
|
[market_price]
|
||||||
|
type = string
|
||||||
|
|
||||||
|
[vip_price]
|
||||||
|
type = string
|
||||||
|
|
||||||
|
[expiry]
|
||||||
type = string
|
type = string
|
||||||
index = both
|
|
||||||
|
|
||||||
[rating]
|
[rating]
|
||||||
type = numeric
|
type = string
|
||||||
|
|
||||||
[score]
|
[score]
|
||||||
type = numeric
|
type = numeric
|
||||||
|
|
||||||
[price]
|
[model]
|
||||||
type = numeric
|
type = string
|
||||||
|
index = self
|
||||||
|
tokenizer = full
|
||||||
|
|
||||||
[level]
|
[level]
|
||||||
type = string
|
type = string
|
||||||
index = self
|
index = self
|
||||||
tokenizer = full
|
tokenizer = full
|
||||||
|
|
||||||
[status]
|
[student_count]
|
||||||
|
type = numeric
|
||||||
|
|
||||||
|
[lesson_count]
|
||||||
type = string
|
type = string
|
||||||
index = self
|
|
||||||
tokenizer = full
|
|
||||||
|
|
||||||
[create_time]
|
[create_time]
|
||||||
type = numeric
|
type = numeric
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
"hightman/xunsearch": "^1.4.14"
|
"hightman/xunsearch": "^1.4.14"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
"odan/phinx-migrations-generator": "^4.6"
|
||||||
},
|
},
|
||||||
"repositories": {
|
"repositories": {
|
||||||
"packagist": {
|
"packagist": {
|
||||||
|
1362
composer.lock
generated
1362
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -32,6 +32,11 @@ $config['url']['static'] = '/static/';
|
|||||||
*/
|
*/
|
||||||
$config['db']['host'] = 'mysql';
|
$config['db']['host'] = 'mysql';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据库端口
|
||||||
|
*/
|
||||||
|
$config['db']['port'] = 3306;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据库名称
|
* 数据库名称
|
||||||
*/
|
*/
|
||||||
@ -63,7 +68,7 @@ $config['redis']['host'] = 'redis';
|
|||||||
$config['redis']['port'] = 6379;
|
$config['redis']['port'] = 6379;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* redis链接密码
|
* redis密码
|
||||||
*/
|
*/
|
||||||
$config['redis']['auth'] = '1qaz2wsx3edc';
|
$config['redis']['auth'] = '1qaz2wsx3edc';
|
||||||
|
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Phinx\Migration\AbstractMigration;
|
|
||||||
|
|
||||||
class MyTestMigration extends AbstractMigration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Change Method.
|
|
||||||
*
|
|
||||||
* Write your reversible migrations using this method.
|
|
||||||
*
|
|
||||||
* More information on writing migrations is available here:
|
|
||||||
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
|
|
||||||
*
|
|
||||||
* The following commands can be used in this method and Phinx will
|
|
||||||
* automatically reverse them when rolling back:
|
|
||||||
*
|
|
||||||
* createTable
|
|
||||||
* renameTable
|
|
||||||
* addColumn
|
|
||||||
* addCustomColumn
|
|
||||||
* renameColumn
|
|
||||||
* addIndex
|
|
||||||
* addForeignKey
|
|
||||||
*
|
|
||||||
* Any other destructive changes will result in an error when trying to
|
|
||||||
* rollback the migration.
|
|
||||||
*
|
|
||||||
* Remember to call "create()" or "update()" and NOT "save()" when working
|
|
||||||
* with the Table class.
|
|
||||||
*/
|
|
||||||
public function change()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Boot\ConsoleKernel;
|
use Bootstrap\ConsoleKernel;
|
||||||
|
|
||||||
require __DIR__ . '/bootstrap/Kernel.php';
|
require __DIR__ . '/bootstrap/Kernel.php';
|
||||||
require __DIR__ . '/bootstrap/ConsoleKernel.php';
|
require __DIR__ . '/bootstrap/ConsoleKernel.php';
|
||||||
@ -9,7 +9,7 @@ $kernel = new ConsoleKernel();
|
|||||||
|
|
||||||
$config = $kernel->getDI()->getShared('config');
|
$config = $kernel->getDI()->getShared('config');
|
||||||
|
|
||||||
$db = $config->database;
|
$db = $config->db;
|
||||||
|
|
||||||
$options = [
|
$options = [
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ $options = [
|
|||||||
'default_database' => 'production',
|
'default_database' => 'production',
|
||||||
|
|
||||||
'production' => [
|
'production' => [
|
||||||
'adapter' => $db->adapter,
|
'adapter' => 'mysql',
|
||||||
'host' => $db->host,
|
'host' => $db->host,
|
||||||
'port' => $db->port,
|
'port' => $db->port,
|
||||||
'name' => $db->dbname,
|
'name' => $db->dbname,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user