123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251 |
- <?php
- /**
- * ES初始化类 创建映射
- * Created by PhpStorm.
- * User: wxj
- * Date: 2019/11/8
- * Time: 14:47
- */
- namespace Jindouyun\Controller\Common;
- use Mall\Framework\Core\Config;
- use Mall\Framework\Core\ErrorCode;
- use Mall\Framework\Factory;
- use Mall\Framework\Core\Request;
- class ESInit
- {
- private $request;
- public function __construct()
- {
- $this->request = Request::getInstance();
- }
- public function search($s = 0)
- {
- if ($s) {
- $c = intval($s);
- } else {
- $data = Request::params();
- $c = $data['b'] ?: 1;
- }
- switch ($c) {
- //添加商品索引库
- case 1:
- $mappings = array(
- 'mappings' => array(
- "_default_" => [
- "properties" => [
- 'basicGoodsId' => ["type" => "integer"],//关联商品基本资料id,
- 'id' => ["type" => "integer"],//商品id,
- 'enterpriseId' => ['type' => 'integer'],//enterpriseId,
- 'shopId' => ["type" => "integer"],//'商铺id',
- 'warehouseId' => ["type" => "integer"],//'仓库id',
- 'images' => [
- 'type' => 'text'
- ],
- 'serviceInfo' => ["type" => "integer"],//'服务保证',
- 'salesNum' => [
- "properties" => [
- "skuId" => ["type" => "integer",],
- "salesNum" => ["type" => "integer",],
- ]
- ],//销量
- 'content' => [
- 'type' => 'text',
- "analyzer" => "ik_max_word",
- "search_analyzer" => "ik_max_word"
- ],//'商品详情',
- 'extend' => [
- 'type' => 'text',
- "analyzer" => "ik_max_word",
- "search_analyzer" => "ik_max_word"
- ],// '扩展字段',
- 'sort' => ["type" => "integer"],//'排序',
- 'isRecommend' => ["type" => "integer"],//是否推荐(5是 4否)',
- 'deleteStatus' => ["type" => "integer"],//删除状态(5未删除 4已删除)',
- 'enableStatus' => ["type" => "integer"],//上下架(5上架 4下架)',
- 'createTime' => [
- 'type' => 'integer',
- ],//'创建时间'
- 'updateTime' => [
- 'type' => 'integer',
- ],//'修改时间',
- ]
- ]
- )
- );
- $searchServer = Factory::search('goods_search');
- $result = $searchServer->createBase('online_goods_search', $mappings);
- if ($result && !isset($result['error'])) {
- echo 'online_goods_search init done.';
- return true;
- } else {
- print_r($result['error']);
- return false;
- }
- break;
- //删除商品索引库
- case 2:
- $searchServer = Factory::search('goods_search');
- $searchServer->setIndex('online_goods_search');
- $a = $searchServer->deleteBase('online_goods_search');
- print_r($a);
- break;
- //添加客户索引库
- case 3:
- $mappings = array(
- 'mappings' => array(
- "_default_" => [
- "properties" => [
- 'id' => ['type' => 'integer'],//customerId,
- 'userCenterId' => ['type' => 'integer'],//userCenterId,
- 'mobile' => ['type' => 'keyword'],
- 'source' => ['type' => 'integer'],//客户来源
- 'enterpriseId' => ['type' => 'integer'],//enterpriseId,
- 'status' => ['type' => 'integer'],//'账号状态(1已审核 2待审核)',
- 'statusName' => ['type' => 'keyword'],//状态名称,
- 'name' => [
- 'type' => 'text',
- "analyzer" => "ik_max_word",
- "search_analyzer" => "ik_max_word"
- ],//'客户名称',
- 'code' => ['type' => 'keyword'],//'客户编码',
- 'type' => ['type' => 'integer'],//'客户类型',
- 'provinceCode' => ['type' => 'keyword'],//varchar(20) NOT NULL COMMENT '客户地址省编码',
- 'cityCode' => ['type' => 'keyword'],//varchar(20) NOT NULL COMMENT '客户地址市编码',
- 'districtCode' => ['type' => 'keyword'],//varchar(20) NOT NULL COMMENT '客户地址区编码',
- 'provinceName' => ['type' => 'keyword'],//省名称
- 'cityName' => ['type' => 'keyword'],//市名称
- 'districtName' => ['type' => 'keyword'],//区名称
- "address" => [
- "type" => "text",
- "analyzer" => "ik_max_word",
- "search_analyzer" => "ik_max_word"
- ],
- 'managerMobile' => ['type' => 'keyword'],//'负责人电话',
- 'shopId' => ['type' => 'integer'],//商铺id,
- 'shopName' => ['type' => 'keyword'],//商铺名称,
- 'departmentId' => ['type' => 'integer'],//销售部Id,
- 'departmentName' => ['type' => 'keyword'],//部门名称,
- 'salesManId' => ['type' => 'integer'],//int(10) DEFAULT NULL COMMENT '业务员id',
- 'salesManCode' => ['type' => 'keyword'],//'业务员编码',
- 'salesManName' => [
- 'type' => 'text',
- "analyzer" => "ik_max_word",
- "search_analyzer" => "ik_max_word"
- ],//'业务员名称',
- 'birthday' => [
- 'type' => 'integer'
- ],//'客户生日',
- 'enableStatus' => ['type' => 'integer'],//'启用状态(5启用 4禁用)',
- 'deleteStatus' => ['type' => 'integer'],//'删除状态(5未删除 4已删除)',
- 'createTime' => ['type' => 'integer'],//'创建时间'
- 'updateTime' => ['type' => 'integer'],//'修改时间',
- 'extend' => [
- 'type' => 'text',
- "analyzer" => "ik_max_word",
- "search_analyzer" => "ik_max_word"
- ],// '扩展字段',
- 'tag' => [// '客户标签',
- 'type' => 'text',
- "analyzer" => "ik_max_word",
- "search_analyzer" => "ik_max_word"
- ],
- 'remark' => [
- "type" => "text",
- "analyzer" => "ik_max_word",
- "search_analyzer" => "ik_max_word",
- ],// '备注'
- 'location' => [
- "type" => "geo_point",
- ],//经纬度
- 'contact' => [
- "properties" => [
- "name" => ["type" => "keyword",],
- "mobile" => ["type" => "keyword",],
- ]
- ],// '联系人'
- ]
- ]
- )
- );
- $searchServer = Factory::search('customer_search');
- $result = $searchServer->createBase('online_customer_search', $mappings);
- if ($result && !isset($result['error'])) {
- echo 'online_customer_search init done.';
- return true;
- } else {
- print_r($result['error']);
- return false;
- }
- break;
- //删除客户索引库
- case 4:
- $searchServer = Factory::search('customer_search');
- $searchServer->setIndex('online_customer_search');
- $a = $searchServer->deleteBase('online_customer_search');
- print_r($a);
- break;
- //添加商品基本资料
- case 5:
- //创建映射
- $mappings = array(
- "settings" => [
- "analysis" => [
- "analyzer" => [
- "comma"=>[
- "type" => "pattern",
- "pattern" => ","
- ]
- ]
- ]
- ],
- 'mappings' => array(
- "_default_" => [
- "properties" => [
- 'id' => ["type" => "integer"],//商品基本资料id,
- 'enterpriseId' => ['type' => 'integer'],//enterpriseId,
- 'images' => ['type' => 'text'],
- 'title' => [
- 'type' => 'text',
- "analyzer" => "ik_max_word",
- "search_analyzer" => "ik_max_word"
- ],//商品名称,
- 'code' => ["type" => "keyword"],
- 'barCode' => ["type" => "keyword"],
- 'categoryId' => ["type" => "integer"],//'商品分类id',
- 'expireTime' => ["type" => "integer"],//'过期时间',
- 'brandId' => ["type" => "integer"],//'品牌id',
- 'tag' => [
- 'type' => 'text',
- "analyzer" => "ik_max_word",
- "search_analyzer" => "ik_max_word"
- ],//'关键词',
- 'description' => [
- 'type' => 'text',
- "analyzer" => "ik_max_word",
- "search_analyzer" => "ik_max_word"
- ],//'商品详情',
- 'noSalesShop' => ['type' => 'text'],//'禁止销售店铺',
- 'extends' => [
- 'type' => 'text',
- "analyzer" => "ik_max_word",
- "search_analyzer" => "ik_max_word"
- ],//'拓展字段',
- 'enableStatus' => ["type" => "integer"],//'商品状态 默认5 上线 6下线',
- 'deleteStatus' => ["type" => "integer"],//'是否删除 4 删除 5正常',
- 'createTime' => [
- 'type' => 'integer',
- ],//'创建时间'
- 'updateTime' => [
- 'type' => 'integer',
- ],//'修改时间',
- 'categoryPath' => [
- "type" => "text",
- "analyzer" => "comma",
- "search_analyzer" => "comma"
- ],//'分类路径',
- 'skuData' => [
- "properties" => [
- "masterUnit" => [
- "properties" => [
- "id" => ["type" => "integer",],
- "unitName" => ["type" => "keyword",],
- "unitId" => ["type" => "integer",],
- "isMaster" => ["type" => "integer",],
- "deleteStatus" => ["type" => "integer",],
- ]
- ],
- "branchUnit" => [
- "properties" => [
- "id" => ["type" => "integer",],
- "unitName" => ["type" => "keyword",],
- "unitId" => ["type" => "integer",],
- "isMaster" => ["type" => "integer",],
- "deleteStatus" => ["type" => "integer",],
- ]
- ]
- ]
- ],//sku
- ],
- ]
- )
- );
- $searchServer = Factory::search('goods_basic_search');
- $result = $searchServer->createBase('goods_basic_search', $mappings);
- if ($result && !isset($result['error'])) {
- echo 'online_goods_basic_search init done.';
- return true;
- } else {
- print_r($result['error']);
- return false;
- }
- break;
- //删除商品基本资料索引库
- case 6:
- $searchServer = Factory::search('goods_basic_search');
- $searchServer->setIndex('goods_basic_search');
- $a = $searchServer->deleteBase('online_goods_basic_search');
- print_r($a);
- break;
- //创建订单索引库
- case 7:
- $mappings = array(
- 'mappings' => array(
- "order" => [
- "properties" => [
- /*订单表信息*/
- 'id' => ["type" => "integer"],//订单id,
- 'no' => ["type" => "keyword"],//订单编号,
- 'outerTradeNo' => ['type' => 'keyword'],//'外部流水号(支付宝/微信返回的流水号)'
- 'shopId' => ['type' => 'integer'],//商铺id
- 'userCenterId' => ['type' => 'integer'],//用户id
- 'enterpriseId' => ['type' => 'integer'],//企业id
- 'customerType' => ['type' => 'integer'],//客户类型
- 'totalMoney' => [
- 'type' => 'scaled_float',
- 'scaling_factor' => 100
- ],//'总金额',
- 'payAmount' => [
- 'type' => 'scaled_float',
- 'scaling_factor' => 100
- ],//实付金额
- 'buyTotal' => ["type" => "integer"],//购买总数
- 'customerName' => ["type" => "keyword"],//客户姓名
- 'customerId' => ["type" => "integer"],//客户id
- 'payStatus' => ["type" => "integer"],//'支付状态 默认1 未支付 2已支付'
- 'orderStatus' => ["type" => "integer"],//订单状态 默认1 创建 2待支付 3代发货 4待收货 5已完成 6已关闭
- 'payType' => ["type" => "integer"],//'支付方式 1微信 2支付宝 3货到付款 4上门自提'
- 'deliveryType' => ["type" => "integer"],//'配送方式 1商品配送 2上门自提'
- 'source' => ["type" => "integer"],//订单来源 默认1 ios 2android 3小程序 4后台创建
- 'remark' => [
- 'type' => 'text',
- "analyzer" => "ik_max_word",
- "search_analyzer" => "ik_max_word"
- ],//订单备注
- 'auditStatus' => ["type" => "integer"],// '审核状态 默认1 待审 2审核通过 3 审核未通过 4 审核中'
- 'payTime' => [
- 'type' => 'integer',
- /**/
- ],//'付款时间'
- 'createTime' => [
- 'type' => 'integer',
- ],//'创建时间'
- 'updateTime' => [
- 'type' => 'integer',
- ],//'修改时间',
- 'salesManId' => ["type" => "integer"],//业务员id
- 'salesManName' => ["type" => "keyword"],//业务员名称
- /*收货人信息*/
- 'realName' => ["type" => "keyword"],//收货人姓名
- 'mobile' => ["type" => "keyword"],//收货人电话
- 'address' => [
- 'type' => 'text',
- "analyzer" => "ik_max_word",
- "search_analyzer" => "ik_max_word"
- ],//收货详细地址
- 'provinceCode' => ["type" => "integer"],//收货人省份编码
- 'cityCode' => ["type" => "integer"],//收货人城市编码
- 'districtCode' => ["type" => "integer"],//收货人区编码
- 'goodsName' => [
- 'type' => 'text',
- "analyzer" => "ik_max_word",
- "search_analyzer" => "ik_max_word"
- ],
- ]
- ]
- )
- );
- $searchServer = Factory::search('order_search');
- $result = $searchServer->createBase('online_order_search', $mappings);
- if ($result && !isset($result['error'])) {
- echo 'online_order_search init done.';
- return true;
- } else {
- print_r($result['error']);
- return false;
- }
- break;
- //删除订单索引库
- case 8:
- $searchServer = Factory::search('order_search');
- $searchServer->setIndex('online_order_search');
- $a = $searchServer->deleteBase('online_order_search');
- print_r($a);
- break;
- //添加商铺索引库
- case 9:
- //创建映射
- $mappings = array(
- "settings" => [
- "analysis" => [
- "analyzer" => [
- "comma"=>[
- "type" => "pattern",
- "pattern" => ","
- ]
- ]
- ]
- ],
- 'mappings' => array(
- "_default_" => [
- "properties" => [
- 'id' => ["type" => "integer"],//商铺id,
- 'enterpriseId' => ['type' => 'integer'],//enterpriseId,
- 'name' => [
- 'type' => 'text',
- "analyzer" => "ik_max_word",
- "search_analyzer" => "ik_max_word"
- ],//商铺名称,
- 'logo' => ['type' => 'text'],//商铺logo,
- 'shopCode' => ['type' => 'text'],//商铺仓库编码,
- 'shopType' => ['type' => 'integer'],//商铺类型,
- 'openTime' => [
- "properties" => [
- "start" => ["type" => "text",],
- "end" => ["type" => "text",],
- "isAllDay" => ["type" => "integer",],
- ]
- ],//营业时间
- 'contactName' => ['type' => 'keyword'],//联系人,
- 'mobile' => ['type' => 'keyword'],//联系电话,
- 'deleteStatus' => ["type" => "integer"],//删除状态(5未删除 4已删除)',
- 'enableStatus' => ["type" => "integer"],//启用状态(4未启用 5已启用)
- 'createTime' => [
- 'type' => 'integer',
- ],//'创建时间'
- 'updateTime' => [
- 'type' => 'integer',
- ],//'修改时间',
- 'provinceCode' => ['type' => 'keyword'],//varchar(20) NOT NULL COMMENT '商铺地址省编码',
- 'cityCode' => ['type' => 'keyword'],//varchar(20) NOT NULL COMMENT '商铺地址市编码',
- 'districtCode' => ['type' => 'keyword'],//varchar(20) NOT NULL COMMENT '商铺地址区编码',
- 'provinceName' => ['type' => 'keyword'],//商铺省名称
- 'cityName' => ['type' => 'keyword'],//商铺市名称
- 'districtName' => ['type' => 'keyword'],//商铺区名称
- "address" => [
- "type" => "text",
- "analyzer" => "ik_max_word",
- "search_analyzer" => "ik_max_word"
- ],
- 'location' => [
- "type" => "geo_point",
- ],//经纬度
- 'salesArea' => [
- "type" => "text",
- "analyzer" => "comma",
- "search_analyzer" => "comma"
- ],//'销售区域',
- ],
- ]
- )
- );
- $searchServer = Factory::search('shop_search');
- $result = $searchServer->createBase('online_shop_search', $mappings);
- if ($result && !isset($result['error'])) {
- echo 'online_shop_search init done.';
- return true;
- } else {
- print_r($result['error']);
- return false;
- }
- break;
- //删除商铺索引库
- case 10:
- $searchServer = Factory::search('shop_search');
- $searchServer->setIndex('online_shop_search');
- $a = $searchServer->deleteBase('online_shop_search');
- print_r($a);
- break;
- //添加登录日志索引库
- case 11:
- //创建映射
- $mappings = array(
- 'mappings' => array(
- "_default_" => [
- "properties" => [
- 'id' => ["type" => "integer"],
- 'userCenterId' => ['type' => 'integer'],
- 'enterpriseId' => ['type' => 'integer'],//enterpriseId,
- 'mobile' => ['type' => 'keyword'],//联系电话,
- 'createTime' => [
- 'type' => 'integer',
- ],//'创建时间'
- 'source' => [
- 'type' => 'keyword',
- ],
- 'actionType' => [
- 'type' => 'keyword',
- ]
- ]
- ]
- )
- );
- $searchServer = Factory::search('login_log');
- $result = $searchServer->createBase('online_login_log', $mappings);
- if ($result && !isset($result['error'])) {
- echo 'online_login_log init done.';
- return true;
- } else {
- print_r($result['error']);
- return false;
- }
- break;
- //删除登录日志
- case 12:
- $searchServer = Factory::search('login_log');
- $searchServer->setIndex('online_login_log');
- $a = $searchServer->deleteBase('online_login_log');
- print_r($a);
- break;
- //添加日志索引库
- case 13:
- //创建映射
- $mappings = array(
- 'mappings' => array(
- "_default_" => [
- "properties" => [
- 'id' => ["type" => "integer"],
- 'userCenterId' => ['type' => 'integer'],
- 'enterpriseId' => ['type' => 'integer'],//enterpriseId,
- 'createTime' => [
- 'type' => 'integer',
- ],//'创建时间'
- 'no' => [
- 'type' => 'text',
- "analyzer" => "ik_max_word",
- "search_analyzer" => "ik_max_word"
- ],
- 'actionType' => [
- 'type' => 'keyword',
- ]
- ]
- ]
- )
- );
- $searchServer = Factory::search('logs');
- $result = $searchServer->createBase('online_logs', $mappings);
- if ($result && !isset($result['error'])) {
- echo 'online_logs init done.';
- return true;
- } else {
- print_r($result['error']);
- return false;
- }
- break;
- //删除日志
- case 14:
- $searchServer = Factory::search('logs');
- $searchServer->setIndex('online_logs');
- $a = $searchServer->deleteBase('online_logs');
- print_r($a);
- break;
- //入库列表
- case 15:
- $mappings = array(
- 'mappings' => array(
- "inventory_in" => [
- "properties" => [
- //入库表信息
- 'id' => ["type" => "integer"],//入库id
- 'no' => ["type" => "keyword"],//入库编号
- 'sourceNo' => ['type' => 'keyword'],//来源单号
- 'materielNum' => ['type' => 'integer'],//商品数量
- 'amount' => ['type' => 'scaled_float', 'scaling_factor' => 100],//总金额
- 'warehouseId' => ['type' => 'integer'],//仓库id
- 'warehouseName' => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],//仓库名称
- 'operatorId' => ['type' => 'integer'],//操作人id
- 'operatorName' => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],//操作人name
- 'auditId' => ['type' => 'integer'],//审核人id
- 'auditName' => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"], //审核人name
- 'remark' => ['type' => 'text'],//备注
- 'deleteStatus' => ['type' => 'integer'],//删除状态
- 'source' => ['type' => 'integer'],//来源
- 'type' => ['type' => 'integer'],
- 'auditStatus' => ['type' => 'integer'],//审核状态
- 'auditTime' => ['type' => 'integer'],//审核日期
- 'createTime' => ['type' => 'integer'],//创建时间
- 'updateTime' => ['type' => 'integer'],//更新时间
- ],
- ]
- )
- );
- $searchServer = Factory::search('inventory_in_search');
- $result = $searchServer->createBase('online_inventory_in_search', $mappings);
- if ($result && !isset($result['error'])) {
- echo 'online_inventory_in_search init done.';
- return true;
- } else {
- print_r($result['error']);
- return false;
- }
- break;
- //删除入库
- case 16:
- $searchServer = Factory::search('inventory_in_search');
- $searchServer->setIndex('online_inventory_in_search');
- $a = $searchServer->deleteBase('online_inventory_in_search');
- print_r($a);
- break;
- //出库列表
- case 17:
- $mappings = array(
- 'mappings' => array(
- "inventory_out" => [
- "properties" => [
- //入库表信息
- 'id' => ["type" => "integer"],//入库id
- 'no' => ["type" => "keyword"],//入库编号
- 'sourceNo' => ['type' => 'keyword'],//来源单号
- 'materielNum' => ['type' => 'integer'],//商品数量
- 'amount' => ['type' => 'scaled_float', 'scaling_factor' => 100],//总金额
- 'warehouseId' => ['type' => 'integer'],//仓库id
- 'warehouseName' => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],//仓库名称
- 'operatorId' => ['type' => 'integer'],//操作人id
- 'operatorName' => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],//操作人name
- 'auditId' => ['type' => 'integer'],//审核人id
- 'auditName' => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"], //审核人name
- 'customerId' => ['type' => 'integer'],
- 'customerName' => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],
- 'customerCode' => ['type' => 'text'],
- 'customerMobile' => ['type' => 'keyword'],
- 'remark' => ['type' => 'text'],//备注
- 'deleteStatus' => ['type' => 'integer'],//删除状态
- 'source' => ['type' => 'integer'],//来源
- 'type' => ['type' => 'integer'],
- 'auditStatus' => ['type' => 'integer'],//审核状态
- 'auditTime' => ['type' => 'integer'],//审核日期
- 'createTime' => ['type' => 'integer'],//创建时间
- 'updateTime' => ['type' => 'integer'],//更新时间
- ]
- ]
- )
- );
- $searchServer = Factory::search('inventory_out_search');
- $result = $searchServer->createBase('online_inventory_out_search', $mappings);
- if ($result && !isset($result['error'])) {
- echo 'online_inventory_out_search init done.';
- return true;
- } else {
- print_r($result['error']);
- return false;
- }
- break;
- //删除出库
- case 18:
- $searchServer = Factory::search('inventory_out_search');
- $searchServer->setIndex('online_inventory_out_search');
- $a = $searchServer->deleteBase('online_inventory_out_search');
- print_r($a);
- break;
- //商品调价单
- case 19:
- $mappings = array(
- 'mappings' => array(
- "priceAdjustmentSheet" => [
- "properties" => [
- /*订单表信息*/
- 'enterpriseId' => ['type' => 'integer'],//enterpriseId,
- 'id' => ["type" => "integer"],//自增id,
- 'no' => ["type" => "keyword"],//调价单号,
- 'goodsCode' => ['type' => 'keyword'],//商品编号
- 'goodsName' => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],//商品名称
- 'goodsId' => ['type' => 'integer'],//商品id
- 'saleType' => ['type' => 'integer'],//销售类型 1实物销售 2虚库销售
- 'salePriceAreaType' => ['type' => 'integer'],//销售价格生效区域类型 1全国统一价 2大区价
- 'salePriceType' => ['type' => 'integer'],//销售价格类型 1销售价格 2秒杀活动价
- 'shopId' => ['type' => 'integer'],//店铺id
- 'shopName' => ['type' => 'keyword'],//店铺名称
- 'cargoOwnerCode' => ['type' => 'keyword'],//货主编码
- 'createUserId' => ['type' => 'integer'],//创建人id
- 'createUserName' => ['type' => 'keyword'],//创建人姓名
- 'effectiveUserName' => ['type' => 'keyword'],//生效人姓名
- 'effectiveUserId' => ['type' => 'integer'],//生效人id
- 'deleteStatus' => ['type' => 'integer'],//删除状态 4删除 5正常
- 'effectiveStatus' => ['type' => 'integer'],//生效状态 1.待审 2审核通过 3未通过 4审核中
- 'createTime' => ['type' => 'integer',],//创建时间
- 'updateTime' => ['type' => 'integer',],//修改时间
- 'salePrice' => [
- "properties" => [
- ]
- ],//销售价格
- ]
- ]
- )
- );
- $searchServer = Factory::search('priceAdjustmentSheet_search');
- $result = $searchServer->createBase('online_priceadjustmentsheet_search', $mappings);
- if ($result && !isset($result['error'])) {
- echo 'online_priceadjustmentsheet_search init done.';
- } else {
- print_r($result['error']);
- return false;
- }
- break;
- //删除商品调价单
- case 20:
- $searchServer = Factory::search('priceAdjustmentSheet_search');
- $searchServer->setIndex('online_priceadjustmentsheet_search');
- $a = $searchServer->deleteBase('online_priceadjustmentsheet_search');
- print_r($a);
- break;
- //调拨列表
- case 21:
- $mappings = array(
- 'mappings' => array(
- "allocate" => [
- "properties" => [
- //入库表信息
- 'id' => ["type" => "integer"],//入库id
- 'no' => ["type" => "keyword"],//入库编号
- 'warehouseId' => ['type' => 'integer'],//仓库id
- 'inWarehouseId' => ['type' => 'integer'],//in仓库id
- 'warehouseName' => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],//仓库名称
- 'operatorId' => ['type' => 'integer'],//操作人id
- 'operatorName' => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],//操作人name
- 'auditId' => ['type' => 'integer'],//审核人id
- 'auditName' => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"], //审核人name
- 'remark' => ['type' => 'text'],//备注
- 'deleteStatus' => ['type' => 'integer'],//删除状态
- 'auditStatus' => ['type' => 'integer'],//审核状态
- 'auditTime' => ['type' => 'integer'],//审核日期
- 'createTime' => ['type' => 'integer'],//创建时间
- 'updateTime' => ['type' => 'integer'],//更新时间
- 'linkId' => ["type" => "integer"],
- 'materielId' => ["type" => "integer"],
- 'materielName' => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],
- 'materielCode' => ["type" => "text"],
- 'skuId' => ["type" => "integer"],
- 'num' => ["type" => "double"],
- 'costUnitPrice' => ["type" => "double"],
- 'batch' => ["type" => "object"],
- ]
- ]
- )
- );
- $searchServer = Factory::search('allocate_search');
- $result = $searchServer->createBase('dev_allocate_search', $mappings);
- if ($result && !isset($result['error'])) {
- echo 'dev_allocate_search init done.';
- return true;
- } else {
- print_r($result['error']);
- return false;
- }
- break;
- //调拨删除
- case 22:
- $searchServer = Factory::search('allocate_search');
- $searchServer->setIndex('dev_allocate_search');
- $a = $searchServer->deleteBase('dev_allocate_search');
- print_r($a);
- break;
- //盘点
- case 23:
- $mappings = array(
- 'mappings' => array(
- "stocktaking" => [
- "properties" => [
- 'id' => ["type" => "integer"],
- 'no' => ["type" => "keyword"],
- 'warehouseId' => ['type' => 'integer'],
- 'operatorId' => ['type' => 'integer'],
- 'operatorName' => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],
- 'auditId' => ['type' => 'integer'],
- 'auditName' => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],
- 'remark' => ['type' => 'text'],
- 'deleteStatus' => ['type' => 'integer'],
- 'stocktakingTime' => ['type' => 'integer'],
- 'saleOutTime' => ['type' => 'integer'],
- 'createTime' => ['type' => 'integer'],
- 'updateTime' => ['type' => 'integer'],
- 'auditStatus' => ["type" => "integer"],
- 'auditTime' => ["type" => "integer"],
- ]
- ]
- )
- );
- $searchServer = Factory::search('stocktaking_search');
- $result = $searchServer->createBase('dev_stocktaking_search', $mappings);
- if ($result && !isset($result['error'])) {
- echo 'dev_stocktaking_search init done.';
- return true;
- } else {
- print_r($result['error']);
- return false;
- }
- break;
- //盘点删除
- case 24:
- $searchServer = Factory::search('stocktaking_search');
- $searchServer->setIndex('dev_stocktaking_search');
- $a = $searchServer->deleteBase('dev_stocktaking_search');
- print_r($a);
- break;
- //库存流水
- case 25:
- $mappings = array(
- 'mappings' => array(
- "inventory_details" => [
- "properties" => [
- 'id' => ["type" => "integer"],
- 'sourceNo' => ["type" => "keyword"],
- 'warehouseId' => ['type' => 'integer'],
- 'materielId' => ['type' => 'integer'],
- 'materielName' => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],
- 'operatorId' => ['type' => 'integer'],
- 'operatorName' => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],
- 'inventoryNum' => ['type' => 'double'],
- 'inventoryChangeNum' => ['type' => 'double'],
- 'skuId' => ['type' => 'integer'],
- 'source' => ['type' => 'integer'],
- 'batch' => ['type' => 'object'],
- 'costType' => ['type' => 'integer'],
- 'averageCost' => ['type' => 'double'],
- 'batchCost' => ['type' => 'double'],
- 'actionType' => ["type" => "integer"],
- 'createTime' => ['type' => 'integer'],
- 'updateTime' => ['type' => 'integer'],
- ]
- ]
- )
- );
- $searchServer = Factory::search('inventory_details_search');
- $result = $searchServer->createBase('online_inventory_details_search', $mappings);
- if ($result && !isset($result['error'])) {
- echo 'online_inventory_details_search init done.';
- return true;
- } else {
- print_r($result['error']);
- return false;
- }
- break;
- //库存流水删除
- case 26:
- $searchServer = Factory::search('inventory_details_search');
- $searchServer->setIndex('online_inventory_details_search');
- $a = $searchServer->deleteBase('online_inventory_details_search');
- print_r($a);
- break;
- //客户调价单
- case 27:
- $mappings = array(
- 'mappings' => array(
- "customerPriceAdjustmentSheet" => [
- "properties" => [
- /*订单表信息*/
- 'enterpriseId' => ['type' => 'integer'],//enterpriseId,
- 'id' => ["type" => "integer"],//自增id,
- 'no' => ["type" => "keyword"],//调价单号,
- 'goodsCode' => ['type' => 'keyword'],//商品编号
- 'goodsName' => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],//商品名称
- 'goodsId' => ['type' => 'integer'],//商品id
- 'shopId' => ['type' => 'integer'],//店铺id
- 'shopName' => ['type' => 'keyword'],//店铺名称
- 'createUserId' => ['type' => 'integer'],//创建人id
- 'createUserName' => ['type' => 'keyword'],//创建人姓名
- 'effectiveUserName' => ['type' => 'keyword'],//生效人姓名
- 'effectiveUserId' => ['type' => 'integer'],//生效人id
- 'deleteStatus' => ['type' => 'integer'],//删除状态 4删除 5正常
- 'effectiveStatus' => ['type' => 'integer'],//生效状态 1.待审 2审核通过 3未通过 4审核中
- 'createTime' => ['type' => 'integer'],//创建时间
- 'updateTime' => ['type' => 'integer'],//修改时间
- 'customerId' => ['type' => 'integer'],//客户id
- 'customerName' => ['type' => 'keyword'],//客户名称
- 'customerCode' => ['type' => 'keyword'],//客户编码
- 'salePrice' => [
- "properties" => [
- ]
- ],//销售价格
- ]
- ]
- )
- );
- $searchServer = Factory::search('customerPriceAdjustmentSheet_search');
- $result = $searchServer->createBase('online_customer_price_adjustment_sheet_search', $mappings);
- if ($result && !isset($result['error'])) {
- echo 'online_customer_price_adjustment_sheet_search init done.';
- } else {
- print_r($result['error']);
- return false;
- }
- break;
- //客户调价单删除
- case 28:
- $searchServer = Factory::search('customerPriceAdjustmentSheet_search');
- $searchServer->setIndex('online_customer_price_adjustment_sheet_search');
- $a = $searchServer->deleteBase('dev_customer_price_adjustment_sheet_search');
- print_r($a);
- break;
- //销售退货
- case 29:
- $mappings = array(
- 'mappings' => array(
- "order_out" => [
- "properties" => [
- 'id' => ["type" => "integer"],
- 'no' => ["type" => "keyword"],
- 'sourceId' => ["type" => "integer"],
- 'sourceNo' => ["type" => "keyword"],
- 'shopId' => ['type' => 'integer'],
- 'operatorId' => ['type' => 'integer'],
- 'operatorName' => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],
- 'auditId' => ['type' => 'integer'],
- 'auditName' => ['type' => 'text'],
- 'remark' => ['type' => 'text'],
- 'auditTime' => ['type' => 'integer'],
- 'auditStatus' => ['type' => 'integer'],
- 'deleteStatus' => ['type' => 'integer'],
- 'linkId' => ['type' => 'integer'],
- 'goodsId' => ['type' => 'integer'],
- 'goodsName' => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],
- 'goodsCode' => ['type' => 'text'],
- 'goodsBasicId' => ['type' => 'integer'],
- 'skuId' => ['type' => 'integer'],
- 'num' => ['type' => 'double'],
- 'costUnitPrice' => ['type' => 'double'],
- 'createTime' => ['type' => 'integer'],
- 'updateTime' => ['type' => 'integer'],
- ]
- ]
- )
- );
- $searchServer = Factory::search('order_out_search');
- $result = $searchServer->createBase('online_order_out_search', $mappings);
- if ($result && !isset($result['error'])) {
- echo 'online_order_out_search init done.';
- return true;
- } else {
- print_r($result['error']);
- return false;
- }
- break;
- //销售退货删除
- case 30:
- $searchServer = Factory::search('order_out_search');
- $searchServer->setIndex('online_order_out_search');
- $a = $searchServer->deleteBase('online_order_out_search');
- print_r($a);
- break;
- //采购明细
- case 31:
- $mappings = array(
- 'mappings' => array(
- "purchase_details" => [
- "properties" => [
- 'id' => ["type" => "integer"],
- 'no' => ["type" => "keyword"],
- 'shopId' => ["type" => "integer"],
- 'shopName' => ["type" => "text", "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],
- 'supplierId' => ['type' => 'integer'],
- 'supplierName' => ['type' => 'text'],
- 'buyerId' => ['type' => 'integer'],
- 'buyerName' => ['type' => 'text'],
- 'remark' => ['type' => 'text'],
- 'operatorId' => ['type' => 'integer'],
- 'operatorName' => ['type' => 'text'],
- 'auditId' => ['type' => 'integer'],
- 'auditName' => ['type' => 'text'],
- 'auditTime' => ['type' => 'integer'],
- 'auditStatus' => ['type' => 'integer'],
- 'deleteStatus' => ['type' => 'integer'],
- 'createTime' => ['type' => 'integer'],
- 'updateTime' => ['type' => 'integer'],
- 'linkId' => ['type' => 'integer'],
- 'goodsId' => ['type' => 'integer'],
- 'goodsName' => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],
- 'basicGoodsId' => ['type' => 'integer'],
- 'skuId' => ['type' => 'integer'],
- 'categoryId' => ['type' => 'integer'],
- 'categoryName' => ['type' => 'text'],
- 'buyerNum' => ['type' => 'double'],
- 'buyerUnitPrice' => ['type' => 'double'],
- 'subtotalPrice' => ['type' => 'double'],
- ]
- ]
- )
- );
- $searchServer = Factory::search('purchase_details_search');
- $result = $searchServer->createBase('online_purchase_details_search', $mappings);
- if ($result && !isset($result['error'])) {
- echo 'online_purchase_details_search init done.';
- return true;
- } else {
- print_r($result['error']);
- return false;
- }
- break;
- //采购明细删除
- case 32:
- $searchServer = Factory::search('purchase_details_search');
- $searchServer->setIndex('online_purchase_details_search');
- $a = $searchServer->deleteBase('online_purchase_details_search');
- print_r($a);
- break;
- //优惠券
- case 33:
- $mappings = array(
- 'mappings' => array(
- "coupon" => [
- "properties" => [
- /*优惠券信息*/
- 'enterpriseId' => ['type' => 'integer'],//enterpriseId,
- 'id' => ["type" => "integer"],//自增id,
- 'startTime' => ["type" => "keyword"],//优惠券生效开始时间
- 'endTime' => ['type' => 'keyword'],//结束时间
- 'name' => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],//优惠券名称
- 'couponType' => ['type' => 'integer'],//优惠券类型
- 'reducePrice' => ['type' => 'scaled_float', 'scaling_factor' => 100],//满减券-减免金额(面值)
- 'minPrice' => ['type' => 'scaled_float', 'scaling_factor' => 100],//最低消费金额 0.00不限金额
- 'remark' => ['type' => 'text'],//使用说明
- 'grantType' => ['type' => 'integer'],//发放方式(10主动领取 20定向发放 30注册领取 40在线支付赠送)
- 'totalNum' => ['type' => 'integer'],//发放总数量(-1为不限制)
- 'allowNum' => ['type' => 'integer'],//每人限制领取数量(-1为不限制)
- 'customerSourceId' => ['type' => 'text'],//领取范围
- 'mustCondition' => ['type' => 'scaled_float', 'scaling_factor' => 100],//(40在线支付赠送)-满X金额发放 0.00所有在线支付不限金额可领取这个优惠券
- 'grantStartTime' => ['type' => 'integer'],//发放开始时间
- 'grantEndTime' => ['type' => 'integer'],//发放结束时间
- 'useShop' => ['type' => 'text'],//使用范围
- 'applyRange' => ['type' => 'integer'],//商品适用范围
- 'categoryCollect' => ['type' => 'text'],//分类集合
- 'brandCollect' => ['type' => 'text'],//品牌集合
- 'receiveNum' => ['type' => 'integer'],//已领取数量
- 'deleteStatus' => ['type' => 'integer'],//删除状态
- 'auditStatus' => ['type' => 'integer'],
- 'createTime' => ['type' => 'integer'],
- 'updateTime' => ['type' => 'integer'],
- ]
- ]
- )
- );
- $searchServer = Factory::search('coupon_search');
- $result = $searchServer->createBase('dev_coupon_search', $mappings);
- if ($result && !isset($result['error'])) {
- echo 'dev_coupon_search init done.';
- } else {
- print_r($result['error']);
- return false;
- }
- break;
- //删除优惠券
- case 34:
- $searchServer = Factory::search('coupon_search');
- $searchServer->setIndex('dev_coupon_search');
- $a = $searchServer->deleteBase('dev_coupon_search');
- print_r($a);
- break;
- //优惠券记录
- case 35:
- $mappings = array(
- 'mappings' => array(
- "user_coupon" => [
- "properties" => [
- /*优惠券信息*/
- 'enterpriseId' => ['type' => 'integer'],//enterpriseId,
- 'id' => ["type" => "integer"],//自增id,
- 'couponId' => ["type" => "integer"],//优惠券id
- 'name' => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],//优惠券名称
- 'remark' => ['type' => 'text'],//使用说明
- 'couponType' => ['type' => 'integer'],//优惠券类型
- 'reducePrice' => ['type' => 'scaled_float', 'scaling_factor' => 100],//满减券-减免金额(面值)
- 'minPrice' => ['type' => 'scaled_float', 'scaling_factor' => 100],//最低消费金额 0.00不限金额
- 'startTime' => ["type" => "keyword"],//优惠券生效开始时间,
- 'endTime' => ['type' => 'keyword'],//结束时间
- 'applyRange' => ['type' => 'integer'],//商品适用范围
- 'categoryCollect' => ['type' => 'text'],//分类集合
- 'brandCollect' => ['type' => 'text'],//品牌集合
- 'isExpire' => ['type' => 'integer'],//是否过期 4未过期 5已过期
- 'isUse' => ['type' => 'integer'],//是否使用 4未过期 5已过期
- 'useTime' => ['type' => 'integer'],//使用时间
- 'userId' => ['type' => 'integer'],//用户id
- 'customerId' => ['type' => 'integer'],//客户id
- 'shopId' => ['type' => 'integer'],//店铺id
- 'useShop' => ['type' => 'text'],//使用范围
- 'source' => ['type' => 'integer'],//优惠券来源(10主动领取 20定向发放 30注册领取 40在线支付赠送)
- 'createTime' => ['type' => 'integer'],//创建时间
- 'updateTime' => ['type' => 'integer'],//更新时间
- 'orderNo' => ['type' => 'text'],//使用单号
- 'orderId' => ['type' => 'integer'],//订单id
- ]
- ]
- )
- );
- $searchServer = Factory::search('user_coupon_search');
- $result = $searchServer->createBase('online_user_coupon_search', $mappings);
- if ($result && !isset($result['error'])) {
- echo 'online_user_coupon_search init done.';
- } else {
- print_r($result['error']);
- return false;
- }
- break;
- //删除优惠券记录
- case 36:
- $searchServer = Factory::search('user_coupon_search');
- $searchServer->setIndex('online_user_coupon_search');
- $a = $searchServer->deleteBase('online_user_coupon_search');
- print_r($a);
- break;
- //促销活动
- case 37:
- $mappings = array(
- 'mappings' => array(
- "activity" => [
- "properties" => [
- /*促销活动信息*/
- 'enterpriseId' => ['type' => 'integer'],//enterpriseId,
- 'id' => ["type" => "integer"],//自增id,
- 'activityType' => ["type" => "integer"],//活动类型
- 'title' => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],//名称
- 'remark' => ['type' => 'text'],//客户沟通
- 'startTime' => ["type" => "integer"],//活动开始时间,
- 'endTime' => ['type' => 'integer'],//活动结束时间
- 'enableStatus' => ["type" => "integer"],
- 'images' => ["type" => "text"],//活动图
- 'useShop' => ['type' => 'text'],//使用范围
- 'customerRange' => ['type' => 'integer'],//客户范围
- 'customerSourceId' => ['type' => 'text'],//客户id 1,2
- 'sort' => ['type' => 'integer'],
- 'describe' => ['type' => 'text'],
- 'createTime' => ['type' => 'integer'],
- 'updateTime' => ['type' => 'integer'],
- 'isEnd' => ['type' => 'integer'],
- 'deleteStatus' => ['type' => 'integer'],
- 'auditStatus' => ['type' => 'integer'],
- ]
- ]
- )
- );
- $searchServer = Factory::search('activity_search');
- $result = $searchServer->createBase('online_activity_search', $mappings);
- if ($result && !isset($result['error'])) {
- echo 'online_activity_search init done.';
- } else {
- print_r($result['error']);
- return false;
- }
- break;
- //促销活动删除
- case 38:
- $searchServer = Factory::search('activity_search');
- $searchServer->setIndex('online_activity_search');
- $a = $searchServer->deleteBase('online_activity_search');
- print_r($a);
- break;
- //批次
- case 39:
- $mappings = array(
- 'mappings' => array(
- "inventory_batch" => [
- "properties" => [
- 'id' => ["type" => "integer"],
- 'enterpriseId' => ['type' => 'integer'],
- 'warehouseId' => ["type" => "integer"],
- 'batchNo' => ["type" => "keyword"],
- 'originId' => ["type" => "integer"],
- 'originNo' => ["type" => "keyword"],
- 'sourceNo' => ["type" => "keyword"],
- 'materielId' => ["type" => "integer"],
- 'materielCode' => ["type" => "keyword"],
- 'materielName' => ["type" => "text", "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],
- 'skuId' => ["type" => "integer"],
- 'num' => ['type' => 'double'],
- 'averageCost' => ['type' => 'double'],
- 'batchCost' => ['type' => 'double'],
- 'productionData' => ["type" => "integer"],
- 'batchStatus' => ["type" => "integer"],
- 'createTime' => ["type" => "integer"],
- 'updateTime' => ["type" => "integer"],
- ]
- ]
- )
- );
- $searchServer = Factory::search('inventory_batch_search');
- $result = $searchServer->createBase('online_inventory_batch_search', $mappings);
- if ($result && !isset($result['error'])) {
- echo 'online_inventory_batch_search init done.';
- return true;
- } else {
- print_r($result['error']);
- return false;
- }
- break;
- //批次删除
- case 40:
- $searchServer = Factory::search('inventory_batch_search');
- $searchServer->setIndex('online_inventory_batch_search');
- $a = $searchServer->deleteBase('online_inventory_batch_search');
- print_r($a);
- break;
- //添加登录日志索引库
- case 41:
- //创建映射
- $mappings = array(
- 'mappings' => array(
- "_default_" => [
- "properties" => [
- 'id' => ["type" => "integer"],
- 'name' => ['type' => 'keyword'],//联系电话
- ]
- ]
- )
- );
- $searchServer = Factory::search('test');
- $result = $searchServer->createBase('test', $mappings);
- if ($result && !isset($result['error'])) {
- echo 'test init done.';
- return true;
- } else {
- print_r($result['error']);
- return false;
- }
- break;
- //删除登录日志
- case 42:
- $searchServer = Factory::search('test');
- $searchServer->setIndex('test');
- $a = $searchServer->deleteBase('test');
- print_r($a);
- break;
- }
- }
- public function initSearch()
- {
- $num = $this->request->param('request_id');
- //$search = [2,4,6,8,10,12];
- //$search = [1,3,5,7,9,11];
- $search = [$num];
- foreach ($search as $s) {
- $this->search($s);
- }
- }
- }
|