1
0
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:
xiaochong0302 2019-12-20 13:22:09 +08:00
parent a283296d35
commit 72e023920d
10 changed files with 1204 additions and 317 deletions

View File

@ -1,28 +1,28 @@
{%- macro item_info(order) %}
{% if order.item_type == 'course' %}
{% set course = order.item_info['course'] %}
{% set course = order.item_info.course %}
<div class="kg-order-item">
<p>课程名称:{{ course['title'] }}</p>
<p>市场价格:¥{{ course['market_price'] }}</p>
<p>有效期限:{{ date('Y-m-d', course['expire_time']) }}</p>
<p>课程名称:{{ course.title }}</p>
<p>市场价格:¥{{ course.market_price }}</p>
<p>有效期限:{{ date('Y-m-d', course.expire_time) }}</p>
</div>
{% elseif order.item_type == 'package' %}
{% set courses = order.item_info['courses'] %}
{% set courses = order.item_info.courses %}
{% for course in courses %}
<div class="kg-order-item">
<p>课程名称:{{ course['title'] }}</p>
<p>市场价格:¥{{ course['market_price'] }}</p>
<p>有效期限:{{ date('Y-m-d', course['expire_time']) }}</p>
<p>课程名称:{{ course.title }}</p>
<p>市场价格:¥{{ course.market_price }}</p>
<p>有效期限:{{ date('Y-m-d', course.expire_time) }}</p>
</div>
{% endfor %}
{% elseif order.item_type == 'reward' %}
{% set course = order.item_info['course'] %}
{% set course = order.item_info.course %}
<div class="kg-order-item">
<p>课程名称:{{ course['title'] }}</p>
<p>课程名称:{{ course.title }}</p>
<p>赞赏金额:¥{{ order.amount }}</p>
</div>
{% elseif order.item_type == 'vip' %}
{% set vip = order.item_info['vip'] %}
{% set vip = order.item_info.vip %}
<div class="kg-order-item">
<p>商品名称:{{ order.subject }}</p>
<p>商品价格:¥{{ order.amount }}</p>

View File

@ -20,7 +20,6 @@
<col>
<col>
<col>
<col>
<col width="10%">
</colgroup>
<thead>

View File

@ -16,12 +16,12 @@ class Database extends AbstractProvider
$config = $this->getShared('config');
$options = [
'host' => $config->db->host ?: '127.0.0.1',
'port' => $config->db->host ?: 3306,
'host' => $config->db->host,
'port' => $config->db->port,
'dbname' => $config->db->dbname,
'username' => $config->db->username,
'password' => $config->db->password,
'charset' => $config->db->charset ?: 'utf8',
'charset' => $config->db->charset,
];
$connection = new MySqlAdapter($options);

View File

@ -2,6 +2,7 @@
namespace App\Searchers;
use App\Models\Course as CourseModel;
use Phalcon\Mvc\User\Component as UserComponent;
class Course extends UserComponent
@ -82,7 +83,24 @@ class Course extends UserComponent
*/
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();

View File

@ -1,51 +1,55 @@
project.name = course
project.default_charset = UTF-8
server.index = 8383
server.search = 8384
[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]
type = title
[cover]
type = string
[summary]
type = body
[tags]
[keywords]
type = string
index = mixed
[market_price]
type = string
[vip_price]
type = string
[expiry]
type = string
index = both
[rating]
type = numeric
type = string
[score]
type = numeric
[price]
type = numeric
[model]
type = string
index = self
tokenizer = full
[level]
type = string
index = self
tokenizer = full
[status]
[student_count]
type = numeric
[lesson_count]
type = string
index = self
tokenizer = full
[create_time]
type = numeric

View File

@ -14,6 +14,7 @@
"hightman/xunsearch": "^1.4.14"
},
"require-dev": {
"odan/phinx-migrations-generator": "^4.6"
},
"repositories": {
"packagist": {

1362
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -32,6 +32,11 @@ $config['url']['static'] = '/static/';
*/
$config['db']['host'] = 'mysql';
/**
* 数据库端口
*/
$config['db']['port'] = 3306;
/**
* 数据库名称
*/
@ -63,7 +68,7 @@ $config['redis']['host'] = 'redis';
$config['redis']['port'] = 6379;
/**
* redis链接密码
* redis密码
*/
$config['redis']['auth'] = '1qaz2wsx3edc';

View File

@ -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()
{
}
}

View File

@ -1,6 +1,6 @@
<?php
use Boot\ConsoleKernel;
use Bootstrap\ConsoleKernel;
require __DIR__ . '/bootstrap/Kernel.php';
require __DIR__ . '/bootstrap/ConsoleKernel.php';
@ -9,7 +9,7 @@ $kernel = new ConsoleKernel();
$config = $kernel->getDI()->getShared('config');
$db = $config->database;
$db = $config->db;
$options = [
@ -26,7 +26,7 @@ $options = [
'default_database' => 'production',
'production' => [
'adapter' => $db->adapter,
'adapter' => 'mysql',
'host' => $db->host,
'port' => $db->port,
'name' => $db->dbname,