Commit b359d583 authored by wwccw0591's avatar wwccw0591

delivery

parents 3b6a9cb8 7538529c
...@@ -52,12 +52,11 @@ class IndexController extends \Our\Controller_Abstract { ...@@ -52,12 +52,11 @@ class IndexController extends \Our\Controller_Abstract {
} }
public function indexAction() { public function indexAction() {
//// echo 1;exit; $orderDao = \DAO\Order\OrderModel::getInstance();
//// $orderDao = \DAO\Order\OrderModel::getInstance();
//// $res=$orderDao->getList(array('buyer_id'=>1),'*',0,10);
//// $res=$orderDao->getList(array('buyer_id'=>1),'*',0,10); echo json_encode($res);exit;
//// echo json_encode($res);exit; //$list = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsBrowserRedisModel::getInstance(),array(&$browseDAO, 'getDistinctDate'),array($memberId,$startTime,$endTime,$order),\Our\ApiConst::twoMinSecond,array($memberId));
//// //$list = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsBrowserRedisModel::getInstance(),array(&$browseDAO, 'getDistinctDate'),array($memberId,$startTime,$endTime,$order),\Our\ApiConst::twoMinSecond,array($memberId));
// $clientPush=\JPush\ClientPush::getInstance(); // $clientPush=\JPush\ClientPush::getInstance();
// $clientPush->pushAll(); // $clientPush->pushAll();
// exit; // exit;
......
<?php
use Business\User\LoginV2Model;
use Business\Message\MessageServiceModel;
class IndexController extends \Our\Controller_Abstract {
public $req;
public $memberId;
public $messageService;
public function init(){
}
public function is_https() {
if ( !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') {
return true;
} elseif ( isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' ) {
return true;
} elseif ( !empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off') {
return true;
}elseif($_SERVER['SERVER_PORT'] == 89){
return true;
}
return false;
}
public function getHtmlAction(){
$this->req=$this->getRequest()->getQuery();
$postData=$this->req;
$postData=base64_decode($postData[\Our\NameConst::sessionKey]);
$params=explode(\Our\PathConst::cutVertical,$postData);
$this->key=$params[0];
session_id($this->key);
$this->sess=\Yaf\Session::getInstance();
$this->sess->start();
if($this->sess['key']!=$this->key){
echo 'error auth!';
exit;
// ErrorModel::throwException(CodeConfigModel::authExpire);
}
$this->memberDb0Redis=\Redis\Db0\MemberRedisModel::getInstance();
$paramsStr= $this->memberDb0Redis->tablelpop($this->key);
$paramsStr=json_decode($paramsStr,true);
$this->_view->assign("params", $paramsStr);
if($paramsStr['type']==\Our\ApiConst::sharePlat){
$this->_view->display('index/plat.phtml');
}
if($paramsStr['type']==\Our\ApiConst::shareStore){
$this->_view->display('index/store.phtml');
}
if($paramsStr['type']==\Our\ApiConst::shareGoods){
$this->_view->display('index/goods.phtml');
}
exit;
}
public function indexAction() {
echo 1;exit;
$orderDao = \DAO\Order\OrderModel::getInstance();
$res=$orderDao->getList(array('buyer_id'=>1),'*',0,10);
echo json_encode($res);exit;
//$list = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsBrowserRedisModel::getInstance(),array(&$browseDAO, 'getDistinctDate'),array($memberId,$startTime,$endTime,$order),\Our\ApiConst::twoMinSecond,array($memberId));
// $clientPush=\JPush\ClientPush::getInstance();
// $clientPush->pushAll();
$mongoDb= new \Mongo\MongoDbModel();
$res= $mongoDb->insert('message_history',array('id'=>1,'name'=>'chenchuanwen'));
echo json_encode($res);
exit;
\Our\Log::getInstance()->write('testLog|||||testLog');
var_dump($_SERVER);exit;
// echo $_SERVER['USER']);exit;
$elasticConfig=\Our\Common::getConfig('elastic.master');
$configArray=array(
$elasticConfig->host.':'.$elasticConfig->port,
);
$client=\Elasticsearch\ClientBuilder::create()->setHosts($configArray)->build();
$res=array(
'id'=>'nignx-log*',
'index'=>'.kibana',
'type'=>'index-pattern'
);
$res=$client->getSource($res);
echo json_encode($res);
exit;
}
public function check(){
$this->req=$this->getRequest()->getPost();
$this->checkEncrypt();
if(empty($this->req['data']['key'])){
\Error\ErrorModel::throwException(CodeConfigModel::illegalAccess);
}
session_id($this->req['data']['key']);
ini_set('session.gc_maxlifetime', \Our\ApiConst::tenDaySecond);
$sess=\Yaf\Session::getInstance();
$sess->start();
$this->memberId=$sess->get('member_id');
if(empty($this->memberId)){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::noLogin);
}
//\Yaf\Dispatcher::getInstance()->disableView();
}
public function chatRoomAction(){
$this->check();
$this->messageService=MessageServiceModel::getInstance();
$pageIndex=isset($this->req['data']['pageIndex'])?$this->req['data']['pageIndex']:0;
$pageSize=isset($this->req['data']['pageSize'])?$this->req['data']['pageSize']:20;
if(!empty($this->req['data']['toType'])){
$returnMessage=\Our\RedisHelper::cachedFunction(\Redis\Db15\MessageRedisModel::getInstance(),array(&$this->messageService, 'getMemberList'),array($this->memberId,$this->req['data']['fromType'],$this->req['data']['toId'],$this->req['data']['toType'],'*',$pageIndex,$pageSize),3600,array($this->memberId));
}else{
$returnMessage=\Our\RedisHelper::cachedFunction(\Redis\Db15\MessageRedisModel::getInstance(),array(&$this->messageService, 'getList'),array($this->memberId,$pageIndex,$pageSize),1,array($this->memberId));
}
$push= \Yaf\Registry::get('config')->get('push');
$pushUrl=$push['clientHost'];
$this->_view->assign("key",$this->req['data']['key']);
$this->_view->assign('users',$returnMessage['list']);
$this->_view->assign('memberId',$this->memberId);
$this->_view->assign('pushUrl',$pushUrl);
$this->_view->assign('totalCount',$returnMessage['totalCount']);
}
public function goodsDetailAction() {
$goodsCommonId=(int)$this->getRequest()->getQuery()['goodsCommonId'];
if($goodsCommonId > 0) {
$commonGoodsInstance = \DAO\GoodsCommonModel::getInstance();
$commonInfo = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonGoodsInstance, 'getOneById'),array($goodsCommonId),0,array($goodsCommonId));
}
$this->_view->assign('commonInfo',$commonInfo);
}
}
...@@ -7,10 +7,31 @@ use Zend\Json\Server\Exception\ErrorException; ...@@ -7,10 +7,31 @@ use Zend\Json\Server\Exception\ErrorException;
class GoodsCommonServiceModel extends \Business\AbstractModel class GoodsCommonServiceModel extends \Business\AbstractModel
{ {
private $goodsStorageField = 'goods_id goodsId,goods_name goodsName,goods_verify goodsVerify,goods_state goodsState,goods_image goodsImage,goods_price goodsPrice,goods_storage goodsStorage,goods_spec goodsAttr';
public function init() { public function init() {
}
/**
* 获取商品库存方法
*
*/
public function getGoodsStorageList($storeId, $pageIndex = ApiConst::zero, $pageSize = ApiConst::pageSize)
{
$goodsDao=\DAO\GoodsModel::getInstance(DbNameConst::salveDBConnectName);
$where = array();
$where[] = 'store_id = '.$storeId;
$where[] = 'goods_storage<=goods_storage_alarm';
//获得列表
$datas = $goodsDao->getListPage(implode($where, ' and '), $this->goodsStorageField, $pageIndex, $pageSize);
//获得售后商品列表getOrderGoodsByRecIds
if (!empty($datas)) {
return $datas;
} else {
return new \stdClass();
}
} }
/** /**
* 验证商品是否存在 * 验证商品是否存在
......
...@@ -29,6 +29,27 @@ class GoodsModel extends \DAO\AbstractModel { ...@@ -29,6 +29,27 @@ class GoodsModel extends \DAO\AbstractModel {
public function init(){ public function init(){
} }
/**
*
* 分页获取商品列表
* @param $where
* @param $field
* @param $pageIndex
* @param $pageSize
* @param array $order
* @return array|mixed
*/
public function getListPage($where, $field, $pageIndex, $pageSize, $order = array('goods_id' => 'asc'))
{
$this->setDb($this->dbName);
if($datas = $this->lists($where, $order, $field, $pageIndex, $pageSize)) {
foreach ($datas['list'] as $key=>$val) {
$datas['list'][$key]['goodsAttr'] = $this->getFormatGoodsAttr($val['goodsAttrs']);
}
}
return $datas ? $datas : array();
}
public function getList($where,$field){ public function getList($where,$field){
$this->setDb(); $this->setDb();
return $this->db->select($field)->from($this->_tableName)->where($where)->fetchAll(); return $this->db->select($field)->from($this->_tableName)->where($where)->fetchAll();
......
<<<<<<< HEAD
<?php <?php
...@@ -206,3 +207,241 @@ class ShopkeeperController extends \Our\Controller_AbstractClient { ...@@ -206,3 +207,241 @@ class ShopkeeperController extends \Our\Controller_AbstractClient {
} }
=======
<?php
use Error\ErrorModel;
use Error\CodeConfigModel;
use Our\NameConst;
use Our\Common;
use Business\User\MemberServiceModel;
use Business\Store\ShopkeeperServiceModel;
/**
* 我是店主
*
* @date 2018-5-10
* @author csw <993768343@qq.com>
*/
class ShopkeeperController extends \Our\Controller_AbstractClient {
public $memberService;
public $shopkeeperService;
public function init(){
parent::init();
$this->memberService = MemberServiceModel::getInstance();
$this->shopkeeperService = ShopkeeperServiceModel::getInstance();
$this->shopkeeperService->clientType=NameConst::pcClient;
}
/**
* 店主首页
*/
public function indexAction() {
$result = $this->shopkeeperService->getShopkeeper($this->memberId);
$this->success($result);
}
/**
* 获得店铺统计数据ccw:18305954587
*/
public function statisticsAction(){
$result = $this->shopkeeperService->getStatistics($this->memberId);
$this->success($result);
if($result){
$this->success(array(),\Our\DescribeConst::successMessage,\Our\DescribeConst::successMessage);
}
}
/**
* 分类店铺销量排行(及列表第一页)
*/
public function myStoreClassRankAction() {
$gcId = isset($this->req['data']['gcId'])?$this->req['data']['gcId']:\Our\ApiConst::zero;
if(empty($gcId)){
ErrorModel::throwException(CodeConfigModel::emptyGcId);
}
$pageIndex = $this->getPageIndex();
$pageSize=$this->getPageSize(\Our\ApiConst::salePageSize);
$result = $this->shopkeeperService->getMyStoreClassRank($this->memberId,$gcId,$pageIndex,$pageSize);
$this->success($result);
if($result){
$this->success(array(),\Our\DescribeConst::successMessage,\Our\DescribeConst::successMessage);
}
}
/**
* 分类店铺销量排行分页
*/
public function storeClassRankAction() {
$gcId = $this->req['data']['gcId'];
$pageIndex = (int)$this->req['data']['pageIndex'];
$pageSize=isset($this->req['data']['pageSize'])?$this->req['data']['pageSize']:10;
if(empty($gcId)){
ErrorModel::throwException(CodeConfigModel::illegalAccess);
}
$result = $this->shopkeeperService->getStoreClassRankList($gcId,$pageIndex,$pageSize);
$this->success($result);
if($result){
$this->success(array(),\Our\DescribeConst::successMessage,\Our\DescribeConst::successMessage);
}
}
/**
* 店铺关注会员统计(及列表第一页)
*/
public function storeMemberStatsAction(){
$pageIndex = $this->getPageIndex();
$pageSize=$this->getPageSize(\Our\ApiConst::pageSizeTen);
$keyword = (isset($this->req['data']['keyword'])&&!empty($this->req['data']['keyword']))?$this->req['data']['keyword']:'';
$sort = isset($this->req['data']['sort'])?$this->req['data']['sort']:\Our\ApiConst::one;
$result = $this->shopkeeperService->getStoreMemberStats($this->memberId,$pageIndex,$pageSize,$sort,$keyword);
$this->success($result);
if($result){
$this->success(array(),\Our\DescribeConst::successMessage,\Our\DescribeConst::successMessage);
}
}
/**
* 店铺关注会员统计列表
*/
public function membersStatsAction(){
$pageIndex = (int)$this->getPageIndex();
$pageSize=$this->getPageSize(\Our\ApiConst::pageSizeTen);
$keyword = trim($this->req['data']['keyword']);
$sort = isset($this->req['data']['sort'])?$this->req['data']['sort']:\Our\ApiConst::one;
$result = $this->shopkeeperService->getMemberStats($this->memberId,$pageIndex,$pageSize,$sort,$keyword);
$this->success($result);
if($result){
$this->success(array(),\Our\DescribeConst::successMessage,\Our\DescribeConst::successMessage);
}
}
/**
* 接单
*/
public function orderReceiveAction(){
$orderId = $this->req['data']['orderId'];
$result = $this->shopkeeperService->orderReceive($this->memberId, $orderId);
if ($result) {
$this->success(array(), \Our\DescribeConst::successMessage, \Our\DescribeConst::successMessage);
}else{
ErrorModel::throwException(CodeConfigModel::receiveError);
}
}
/**
* 店铺订单列表(第一页数据)
*/
public function storeOrdersAction(){
$pageIndex = (int)$this->req['data']['pageIndex'];
$pageIndex = $pageIndex?$pageIndex:0;
$pageSize=isset($this->req['data']['pageSize'])?$this->req['data']['pageSize']:10;
$orderState = isset($this->req['data']['orderState'])?$this->req['data']['orderState']:'';
$keyword = isset($this->req['data']['keyword'])?$this->req['data']['keyword']:'';
$result = $this->shopkeeperService->getStoreOrders($this->memberId,$pageIndex,$pageSize,$orderState,$keyword);
$this->success($result);
if($result){
$this->success(array(),\Our\DescribeConst::successMessage,\Our\DescribeConst::successMessage);
}
}
/**
* 店铺订单列表(分页)
*/
public function ordersAction(){
$pageIndex = $this->getPageIndex();
$pageSize=$this->getPageSize();
$orderState = isset($this->req['data']['orderState'])?$this->req['data']['orderState']:'';
$keyword = isset($this->req['data']['keyword'])?$this->req['data']['keyword']:'';
$result = $this->shopkeeperService->getOrders($this->memberId,$pageIndex,$pageSize,$orderState,$keyword);
$this->success($result);
// if($result){
// $this->success(array(),\Our\DescribeConst::successMessage,\Our\DescribeConst::successMessage);
// }
}
/**
* 获得配送员列表
*/
public function getDeliveriersAction(){
$result = $this->shopkeeperService->getDiliveryManByStoreId($this->memberId);
if($result!==false){
$this->success($result,\Our\DescribeConst::successMessage,\Our\DescribeConst::successMessage);
}
ErrorModel::throwException(CodeConfigModel::commonError);
}
/**
* 订单详情
*/
public function orderDetailAction(){
$orderId = $this->req['data']['orderId'];
if(empty($orderId)){
ErrorModel::throwException(CodeConfigModel::emptyOrderIdForPay);
}
$result = $this->shopkeeperService->getOrderDetail($this->memberId,$orderId);
$this->success($result);
if($result){
$this->success(array(),\Our\DescribeConst::successMessage,\Our\DescribeConst::successMessage);
}
}
/**
* 获得售后列表
*/
public function getRefunds(){
$refundService=\Business\Order\RefundServiceModel::getInstance();
$pageIndex=$this->getPageIndex();
$pageSize=$this->getPageSize();
$res=$refundService->getList($this->memberId,$pageIndex,$pageSize);
$this->success($res);
}
/**
* 获得订单数量
*/
public function countAction(){
$result = $this->shopkeeperService->getCount($this->memberId);
if(!empty($result)){
$this->success($result);
}
ErrorModel::throwException(CodeConfigModel::commonError);
}
public function receivePaymentAction(){
$shopkeeperService=\Business\Store\ShopkeeperServiceModel::getInstance();
$res=$shopkeeperService->confirmReceivePayment($this->memberId,$this->req['data']['orderId']);
if($res){
$this->success(array(),\Our\DescribeConst::successMessage);
}else{
ErrorModel::throwException(CodeConfigModel::confirmReceiveError);
}
}
/**
* 查询配送员
*
*/
public function searchDeliveryAction(){
$shopkeeperService=\Business\Store\ShopkeeperServiceModel::getInstance();
$res=$shopkeeperService->getDiliveryMan($this->req['data']['mobile']);
$res=$res?$res:new \stdClass();
$this->success($res,\Our\DescribeConst::successMessage);
}
/**
* 单一属性商品库存预警
*/
public function warningAction(){
$goodsCommonService = \Business\Goods\GoodsCommonServiceModel::getInstance();
$pageIndex=$this->getPageIndex();
$pageSize=$this->getPageSize();
$res = $goodsCommonService->getGoodsStorageList($this->store_id, $pageIndex, $pageSize);
$this->success($res);
}
}
>>>>>>> 7538529c5593d8b2d9790be4d3280536ed661e74
...@@ -437,3 +437,51 @@ push.user.service.type=7 ...@@ -437,3 +437,51 @@ push.user.service.type=7
elastic.master.host="192.168.1.201" elastic.master.host="192.168.1.201"
elastic.master.port="9200" elastic.master.port="9200"
elastic.master.scheme="http"; elastic.master.scheme="http";
[linqing : common]
; 数据库配置
resources.database.params.driver = "pdo_mysql"
resources.database.params.hostname = "127.0.0.1"
resources.database.params.port = 3306
resources.database.params.database = "qmcs"
resources.database.params.username = "root"
resources.database.params.password = "123456"
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 = "127.0.0.1"
resources.database.slave.params.port = 3306
resources.database.slave.params.database = "qmcs"
resources.database.slave.params.username = "root"
resources.database.slave.params.password = "123456"
resources.database.slave.params.charset = "UTF8"
resources.database.slave.params.driver_options.1002 = "SET NAMES utf8"
redis.database.params.host = "127.0.0.1"
redis.database.params.port = "6379"
redis.database.params.prefix = "qm_"
redis.database.params.password = "23456ertyu"
out.config="/data/config";
;锁文件
out.locks="/data/locks";
; redis配置
password.key='~!@#$`1234qwertasdfgzxcvb'
;redis.database.params.password = "test"
;推送配置
push.clientHost="ws://192.168.80.18:9502"
push.host="192.168.80.18"
push.port="9503"
push.open=1
push.user.service.id=293
push.user.service.type=7
elastic.master.host="192.168.1.201"
elastic.master.port="9200"
elastic.master.scheme="http";
;resources.database.params.hostname = "127.0.0.1"
;resources.database.params.database = "database"
;resources.database.params.username = "username"
;resources.database.params.password = "password"
\ No newline at end of file
...@@ -180,3 +180,40 @@ config.url.pushHost="127.0.0.1:9503"; ...@@ -180,3 +180,40 @@ config.url.pushHost="127.0.0.1:9503";
config.url.convert="/usr/local/bin/wkhtmltoimage"; config.url.convert="/usr/local/bin/wkhtmltoimage";
config.url.indexUrl="/www/local.qm.com/application/library/React" config.url.indexUrl="/www/local.qm.com/application/library/React"
config.url.libary="/www/local.qm.com/application/library" config.url.libary="/www/local.qm.com/application/library"
[linqing : common]
; url相关配置
config.url.resourcesHost = "http://local.qm.com"
; 用户中心host
config.url.userHost = ""
; oss 域名
config.url.ossHost = "http://qmoss-01.oss-cn-hangzhou.aliyuncs.com"
;推送域名
config.url.pushHost="127.0.0.1:9503";
config.url.convert="/usr/local/bin/wkhtmltoimage";
config.url.indexUrl="/www/local.qm.com/application/library/React"
config.url.libary="/www/local.qm.com/application/library"
; 文件目录
[ccw : common]
; url相关配置
config.url.resourcesHost = "http://local.qm.com"
; 用户中心host
config.url.userHost = ""
; oss 域名
config.url.ossHost = "http://qmoss-01.oss-cn-hangzhou.aliyuncs.com"
;推送域名
config.url.pushHost="127.0.0.1:9503";
config.url.convert="/usr/local/bin/wkhtmltoimage";
config.url.indexUrl="/www/local.qm.com/application/library/React"
config.url.libary="/www/local.qm.com/application/library"
; 文件目录
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