Commit e8aee150 authored by liuyuzhen's avatar liuyuzhen

Merge branch 'master_dev' of git.shenbd.com:qm-develop/shenbd into lyz_version1

parents d60c4e45 046f2cbb
......@@ -15,7 +15,7 @@ class GoodsController extends \Our\Controller_AbstractIndex {
public function getAction(){
$address = \Business\User\AddressServiceModel::getInstance()->getMyAddress($this->req[\Our\NameConst::data],$this->memberId,false);
$goodsInfo = $this->goodsService->getCommonDetail($this->req[\Our\NameConst::data],$this->memberId,$address);
$store = $this->goodsService->getStore($goodsInfo['storeId']);
$store = $this->goodsService->getStore($goodsInfo['storeId'],false,false);
$goodsInfo['freeShippingPrice'] = $store['freeShippingPrice'];
$goodsInfo['isQuality'] = $store['isQuality'];
$evaluation =$this->goodsService->getEvaluation($this->req[\Our\NameConst::data]);
......
......@@ -23,7 +23,7 @@ class GroupController extends \Our\Controller_AbstractIndex {
$goods = $this->GroupSaleService->getGroupGoods($this->req[\Our\NameConst::data],$address);
// $data = $this->GroupSaleService->getOnePBundingCache($this->req[\Our\NameConst::data]['groupId']);
// $this->GroupSaleService->handleData($data);
$storeInfo = \Business\Goods\GoodsCommonServiceModel::getInstance()->getStore($goods['store_id']);
$storeInfo = \Business\Goods\GoodsCommonServiceModel::getInstance()->getStore($goods['store_id'],false,false);
unset($storeInfo['freeShippingPrice']);unset($storeInfo['isQuality']);unset($storeInfo['shareDesc']);
$otherGroups = \Business\Goods\GroupSaleServiceModel::getInstance()->getOtherGroup($goods['store_id'],$this->req[\Our\NameConst::data]['groupId']);
\Business\Goods\GroupSaleServiceModel::getInstance()->addBrowseRecord($this->req[\Our\NameConst::data],$this->memberId);
......
......@@ -619,7 +619,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$commonInstance = \DAO\GoodsCommonModel::getInstance();
$count = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonInstance, 'getCount'),array(array('store_id'=>$storeId)),\Our\ApiConst::oneDaySecond);
return array('storeId'=>$storeId,'storeName'=>$storeInfo['store_name'],'storeLabel'=>\DAO\StoreModel::getInstance()->getStoreLabelSrc($storeInfo['store_label'],\Our\ImageConst::goodsStoreImg),'goodsTotal'=>$count,'isQuality'=>$storeInfo['store_zhping'],'freeShippingPrice'=>$storeInfo['free_shipping_price'],'shareDesc'=>$storeInfo['store_share_desc'],'memberId'=>$storeInfo['member_id']);
return array('storeId'=>$storeId,'storeName'=>$storeInfo['store_name'],'storeLabel'=>\DAO\StoreModel::getInstance()->getStoreLabelSrc($storeInfo['store_label'],\Our\ImageConst::goodsStoreImg),'goodsTotal'=>$count,'isQuality'=>$storeInfo['store_zhping'],'freeShippingPrice'=>$storeInfo['free_shipping_price'],'shareDesc'=>$storeInfo['store_share_desc'],'memberId'=>$storeInfo['member_id'],'isClose'=>$storeInfo['isClose']);
}
/**
......
......@@ -73,7 +73,8 @@ class OrderServiceModel extends \Business\AbstractModel
// $query2[]= array('match' => array('orderSn' => $keyword"));
$query2[] = array('match' => array('storeName' => $keyword));
$query2[] = array('match' => array('goodsName' => $keyword));
$query2[] = array('wildcard' => array('orderSn' => "*{$keyword}*"));
$query2[] = array('match' => array('orderSn' => "$keyword"));
// $query2[] = array('wildcard' => array('orderSn' => "*{$keyword}*"));
$res1['must'][1]['bool']['should'] = $query2;
$allQuery['bool'] = $res1;
// echo json_encode($allQuery);exit;
......@@ -123,16 +124,15 @@ class OrderServiceModel extends \Business\AbstractModel
if($orderState==ApiConst::orderStateComplete){
$where['evaluation_state']=ApiConst::waitEvaluation;
$where['order_state']=array('eq',ApiConst::orderStateComplete);
}
if($orderState==ApiConst::orderStateWaitRecieveOne){
}elseif($orderState==ApiConst::orderStateWaitRecieveOne){
$where['shipping_type']=array('eq',ApiConst::bySeller);
$where['order_state'] =array('in',array(ApiConst::orderStateWaitSend,ApiConst::orderStateWaitRecieve));
}
if($orderState==ApiConst::orderStateWaitSendOne){
}elseif($orderState==ApiConst::orderStateWaitSendOne){
$where['shipping_type']=array('eq',ApiConst::bySelf);
$where['order_state']=array('eq',ApiConst::orderStateWaitRecieve);
}else{
$where['order_state'] = array('eq', $orderState);
}
// $where['order_state'] = array('in', explode(',', $orderState));
}
}
......
......@@ -29,7 +29,7 @@ class StoreServiceModel extends \Business\AbstractModel{
\Error\ErrorModel::throwException(\Error\CodeConfigModel::emptyStoreId);
}
list($storeInfo,$storeLabel) = \DAO\StoreModel::getInstance()->get($storeId);
list($storeInfo,$storeLabel) = \DAO\StoreModel::getInstance()->get($storeId,true,false);
if((int)$param['isScan'] > 0) {
//扫码进入
if($memberId > 0) {
......@@ -135,10 +135,21 @@ class StoreServiceModel extends \Business\AbstractModel{
}
}
//营业时间
$businessHours = $storeInfo['store_start_time'].' - '.$storeInfo['store_close_time'];
if($storeInfo['store_start_time'] && $storeInfo['store_close_time']) {
if($storeInfo['store_start_time'] == $storeInfo['store_close_time']) {
$businessHours = '全天';
}elseif ($storeInfo['store_start_time'] > $storeInfo['store_close_time']) {
$businessHours = $storeInfo['store_start_time'].' - 次日'.$storeInfo['store_close_time'];
}else{
$businessHours = $storeInfo['store_start_time'].' - '.$storeInfo['store_close_time'];
}
}else{
$businessHours = '';
}
$sellerDistribution = $storeInfo['seller_distribution'];
$buyerDistribution = $storeInfo['buyer_distribution'];
return array('storeLabel'=>$storeLabel,'storeName'=>$storeInfo['store_name'],'grade'=>$grade,'fansCount'=>\DAO\FavoritesStoreModel::getInstance()->getFavoritesStoreCountByStoreId($storeId),'favType'=>$favType,'monthlySalesCount'=>$monthlySalesCount,'defaultDeliveryTime'=>$defaultDeliveryTime,'freeShippingPrice'=>$storeInfo['free_shipping_price'],'storeDistance'=>$distince,'storeNotice'=>$storeInfo['store_notice'],'startShippingPrice'=>$storeInfo['start_shipping_price'],'memberId'=>$storeInfo['member_id'],'inStoreService'=>$in_store_service_flag,'adv'=>$adv,'memberId'=>$storeInfo['member_id'],'businessHours'=>$businessHours,'sellerDistribution'=>$sellerDistribution,'buyerDistribution'=>$buyerDistribution,'bannerColor'=>'#ffa92f');
return array('storeLabel'=>$storeLabel,'storeName'=>$storeInfo['store_name'],'grade'=>$grade,'fansCount'=>\DAO\FavoritesStoreModel::getInstance()->getFavoritesStoreCountByStoreId($storeId),'favType'=>$favType,'monthlySalesCount'=>$monthlySalesCount,'defaultDeliveryTime'=>$defaultDeliveryTime,'freeShippingPrice'=>$storeInfo['free_shipping_price'],'storeDistance'=>$distince,'storeNotice'=>$storeInfo['store_notice'],'startShippingPrice'=>$storeInfo['start_shipping_price'],'memberId'=>$storeInfo['member_id'],'inStoreService'=>$in_store_service_flag,'adv'=>$adv,'memberId'=>$storeInfo['member_id'],'businessHours'=>$businessHours,'sellerDistribution'=>$sellerDistribution,'buyerDistribution'=>$buyerDistribution,'bannerColor'=>'#ffa92f','isClose'=>$storeInfo['isClose']);
}
/**
......@@ -624,6 +635,7 @@ class StoreServiceModel extends \Business\AbstractModel{
if(empty($exitStore)&&$serviceStores&&in_array($goodsClass['gcId'],array_keys($serviceStores))){
$exitStore = $allStores[$serviceStores[$goodsClass['gcId']]];
}
/*if(empty($exitStore)&&$expressStores&&in_array($goodsClass['gcId'],array_keys($expressStores))){
$exitStore = $allStores[$expressStores[$goodsClass['gcId']]];
}*/
......
......@@ -266,12 +266,21 @@ class StoreModel extends \DAO\AbstractModel
return $address;
}
public function get($storeId,$label = true)
public function get($storeId,$label = true,$reportError = true)
{
$storeInfo = $this->getStoreInfoCache($storeId);
if(!$storeInfo || $storeInfo['open_flag'] != 1 || $storeInfo['store_state'] != 1){
if(!$storeInfo) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::storeNotExistOrClose);
}
if($storeInfo['open_flag'] != 1 || $storeInfo['store_state'] != 1){
if($reportError) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::storeNotExistOrClose);
}else{
$storeInfo['isClose'] = 1;
}
}else{
$storeInfo['isClose'] = 0;
}
if($label){
//店铺头像
......
......@@ -303,7 +303,21 @@ class ElasticsToolModel
$res = $this->client->indices()->create($params);
return $res;
}
public function createIndexAndMapping($propertiesField)
{
$params = [
'index' => $this->dbName, //索引名称
'body' => [
'mappings' => [ //映射
$this->tbName => [ //默认配置,每个类型缺省的配置使用默认配置
'properties' => $propertiesField
],
],
]
];
$res = $this->client->indices()->create($params);
return $res;
}
// public function createIkField($indexFild)
// {
// $params = [
......
......@@ -15,34 +15,23 @@ application.modules = Index,Api,Admin,Client
[productone : common]
; 数据库配置
resources.database.params.driver = "pdo_mysql"
resources.database.params.hostname = "172.16.142.15"
resources.database.params.hostname = "rm-bp1j835zol35h2nm0.mysql.rds.aliyuncs.com"
resources.database.params.port = 3306
resources.database.params.database = "qmcs"
resources.database.params.username = "root"
resources.database.params.username = "chenchuanwen"
resources.database.params.password = "!@#$%12345werty"
resources.database.params.charset = "UTF8"
resources.database.params.driver_options.1002 = "SET NAMES utf8"
;
; ; 从库配置
resources.database.slave.params.driver = "pdo_mysql"
resources.database.slave.params.hostname = "172.16.142.13"
resources.database.slave.params.hostname = "rm-bp1j835zol35h2nm0.mysql.rds.aliyuncs.com"
resources.database.slave.params.port = 3306
resources.database.slave.params.database = "qmcs"
resources.database.slave.params.username = "root"
resources.database.slave.params.username = "chenchuanwen"
resources.database.slave.params.password = "!@#$%12345werty"
resources.database.slave.params.charset = "UTF8"
resources.database.slave.params.driver_options.1002 = "SET NAMES utf8"
; mongodb
resources.database.mongo.params.driver = "scram"
resources.database.mongo.params.hostname = "172.16.142.15"
resources.database.mongo.params.port = 27017
resources.database.mongo.params.database = "qmcs"
resources.database.mongo.params.username = "qmcs"
resources.database.mongo.params.password = "123456asdfgh"
resources.database.mongo.params.charset = "UTF8"
resources.database.mongo.params.driver_options.1002 = "SET NAMES utf8"
;
password.key='~!@#$`1234qwertasdfgzxcvb';
redis.database.params.host = "172.16.142.15"
......@@ -73,34 +62,24 @@ password.key='~!@#$`1234qwertasdfgzxcvb';
[product : common]
; 数据库配置
resources.database.params.driver = "pdo_mysql"
resources.database.params.hostname = "127.0.0.1"
resources.database.params.hostname = "rm-bp1j835zol35h2nm0.mysql.rds.aliyuncs.com"
resources.database.params.port = 3306
resources.database.params.database = "qmcs"
resources.database.params.username = "root"
resources.database.params.username = "chenchuanwen"
resources.database.params.password = "!@#$%12345werty"
resources.database.params.charset = "UTF8"
resources.database.params.driver_options.1002 = "SET NAMES utf8"
; 从库配置
resources.database.slave.params.driver = "pdo_mysql"
resources.database.slave.params.hostname = "172.16.142.13"
resources.database.slave.params.hostname = "rm-bp1j835zol35h2nm0.mysql.rds.aliyuncs.com"
resources.database.slave.params.port = 3306
resources.database.slave.params.database = "qmcs"
resources.database.slave.params.username = "root"
resources.database.slave.params.username = "chenchuanwen"
resources.database.slave.params.password = "!@#$%12345werty"
resources.database.slave.params.charset = "UTF8"
resources.database.slave.params.driver_options.1002 = "SET NAMES utf8"
; mongodb
resources.database.mongo.params.driver = "scram"
resources.database.mongo.params.hostname = "127.0.0.1"
resources.database.mongo.params.port = 27017
resources.database.mongo.params.database = "qmcs"
resources.database.mongo.params.username = "qmcs"
resources.database.mongo.params.password = "123456asdfgh"
resources.database.mongo.params.charset = "UTF8"
resources.database.mongo.params.driver_options.1002 = "SET NAMES utf8"
password.key='~!@#$`1234qwertasdfgzxcvb';
redis.database.params.host = "127.0.0.1"
redis.database.params.port = "6379"
......@@ -395,7 +374,7 @@ elastic.master.host="192.168.1.201"
elastic.master.port="9200"
elastic.master.scheme="http";
[lyz : common]
[lyztest : common]
; 数据库配置
resources.database.params.driver = "pdo_mysql"
resources.database.params.hostname = "127.0.0.1"
......@@ -442,7 +421,7 @@ elastic.master.host="192.168.1.201"
elastic.master.port="9200"
elastic.master.scheme="http";
[lyztest : common]
[lyz : common]
; 数据库配置
resources.database.params.driver = "pdo_mysql"
resources.database.params.hostname = "127.0.0.1"
......
<?php
/**
* 生成店铺订单索引
* 执行时间:每分钟执行一次
*
* @author chenjiebin <sjlinyu@qq.com>
*/
define("APPLICATION_PATH", realpath(dirname(__FILE__) . '/../../../')); //指向public的上一级
require APPLICATION_PATH . '/scripts/crontab/baseCli.php';
require APPLICATION_PATH . '/scripts/crontab/common.php';
error_reporting(E_ALL ^ E_NOTICE);
class clinNginxLogsIndex extends basecli
{
const CLI_ADMIN_ID = 255;
private $bDoUnLock = FALSE; // 是否允许释放 LOCK 文件
private $_debug = 0;
private $lockFileName;
public $key='';
private $fromState;
private function mkdirs($dir, $mode = 0777)
{
if (is_dir($dir) || @mkdir($dir, $mode)) {
return TRUE;
}
if (!$this->mkdirs(dirname($dir), $mode)) {
return FALSE;
}
return @mkdir($dir, $mode);
}
/**
* 析构
*/
public function __destruct()
{
parent::__destruct();
if ($this->bDoUnLock) {
@unlink($this->lockFileName);
}
}
public function getIndex($dayOption){
$dateStr=date('Y-m-d',strtotime($dayOption));
$indexStr=\Our\Common::format("nignx-log-".$dateStr);
return $indexStr;
}
public function removeNginxLogIndex(){
$index=$this->getIndex("-30 day");
$type="nginx-log";
$elasticsTool = \Elastics\ElasticsToolModel::getInstance($type,$index);
$i=30;
while($elasticsTool->indexExists($index)){
$elasticsTool->deleteIndex($index);
$i--;
$index=$this->getIndex("-{$i} day");
}
}
//创建索引
public function createNginxLogIndex()
{
$index=$this->getIndex("+1 day");
$type="nginx-log";
$elasticsTool = \Elastics\ElasticsToolModel::getInstance($type,$index);
$propertiesfield = [ //映射
"@timestamp"=>[
"type"=>"date",
"format"=> "strict_date_optional_time||epoch_millis"
],
"@version"=>[
"type"=> "string"
],
"client"=>[
"type"=> "string"
],
"domain"=>[
"type"=> "string"
],
"host"=>[
"type"=> "string"
],
"path"=>[
"type"=> "string"
],
"referer"=>[
"type"=> "string"
],
"responsetime"=>[
"type"=> "string"
],
"size"=>[
"type"=> "string"
],
"status"=>[
"type"=> "string"
],
"type"=>[
"type"=> "string"
],
"ua"=>[
"type"=> "string"
],
"url"=>[
"type"=> "string",
"index"=>"not_analyzed"
],
];
$elasticsTool->createIndexAndMapping($propertiesfield);
}
protected function _runCli()
{
$this->_debug = isset($this->aArgv[1]) ? intval($this->aArgv[1]) : 0;
if ($this->_debug) {
echo "*** Debug mode ***\n";
}
// Step: 02 检查是否已有相同CLI在运行中
$lockDir = $this->_getBaseFileName('logs');
if (!$this->mkdirs($lockDir)) {
echo '****create dir fail ****';
exit;
}
$this->lockFileName = $lockDir . DS . 'nginxLogsIndex.locks';
if (file_exists($this->lockFileName)) {
$stat = stat($this->lockFileName);
if ((TIMESTAMP - $stat['mtime']) > 1800) {
echo "文件被锁超过1800秒,被强制删除";
@unlink($this->lockFileName);
} else {
$this->halt('[' . date('Y-m-d H:i:s') . '] The CLI is running' . "\n");
}
}
$this->bDoUnLock = true;
file_put_contents($this->lockFileName, "running"); // CLI 独占锁
$shopkeeperService = \Business\Store\ShopkeeperServiceModel::getInstance();
$shopkeeperService->baseDir= \Our\Common::getConfig('out.config');
try {
$this->createNginxLogIndex();
} catch (\Exception $ex) {
throw new \Exception($ex->getMessage(),$ex->getCode());
}
echo 'nginx,log 生成成功' .date('Y-m-d H:i:s',TIMESTAMP). "\r\n";
}
}
$oCli = new clinNginxLogsIndex(TRUE);
EXIT;
?>
......@@ -241,9 +241,11 @@ $tcp_server->on('receive', function($serv, $fd, $from_id, $data) use($conf) {
if(!isset($data['uid']) || empty($data['uid'])){
foreach($data['data'] as $value){
if(isset($value['type'])&&$value['type']>100){
echo json_encode($value);
$sendStoreFd=$redis->hGet(KEY_PRE_STORE.$value['storeId'],'fd');
if(!empty($sendStoreFd)){
if(!$value['message']){
$value['message']=new \stdClass();
}
$serv->push($sendStoreFd, responseJson(1,"fromMsg","success", $value));
}
}else{
......@@ -253,6 +255,9 @@ $tcp_server->on('receive', function($serv, $fd, $from_id, $data) use($conf) {
$sendFd=$redis->hGet(KEY_PRE.$value['toId'],'fd');
$redis->hIncrBy(KEY_PRE.$value['toId'],'unread_message_count',\Our\ApiConst::one);
if(!empty($sendFd)){
if(!$value['message']){
$value['message']=new \stdClass();
}
$serv->push($sendFd, responseJson(1,"fromMsg","success", $value));
$redis->hSet(KEY_PRE.$value['fromId'],'sendTime', time());
}
......@@ -297,12 +302,16 @@ $serv->on('Close', function($server, $fd) use($conf){
});
function responseJson($status = 1,$method, $message = '', $data = array()) {
if(!$data['message']){
$data['message']=new \stdClass();
}
$data = [
'status' => $status,
'method'=>$method,
'message' => $message,
'data' => $data,
];
echo json_encode($data);
return json_encode($data);
}
$serv->start();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment