Commit 7b3f72ea authored by wwccw0591's avatar wwccw0591

clientAndUpdateBridge

parent a7744362
...@@ -60,6 +60,7 @@ class ApiConst ...@@ -60,6 +60,7 @@ class ApiConst
const zero = 0; const zero = 0;
const one = 1; const one = 1;
const two = 2; const two = 2;
const four=4;
const cannotSendMsg=-1; const cannotSendMsg=-1;
const canSendMsg=1; const canSendMsg=1;
...@@ -226,6 +227,9 @@ class ApiConst ...@@ -226,6 +227,9 @@ class ApiConst
const bySeller = 1; const bySeller = 1;
const express = 2; const express = 2;
const oneHandred=100;
const oneHandredOne=101;
//文案类型 //文案类型
const buyerText = 1; const buyerText = 1;
const storeText = 2; const storeText = 2;
...@@ -343,7 +347,8 @@ class ApiConst ...@@ -343,7 +347,8 @@ class ApiConst
const addGoodsToCart = 1; //将商品加入购物车 const addGoodsToCart = 1; //将商品加入购物车
const addBundingToCart = 2; //将组合销售商品加入购物车 const addBundingToCart = 2; //将组合销售商品加入购物车
const positionPickupCodeBegin=12;
const positionPickupCodeBeginMysql=13;
const onlineGoodsState = 1;//正常商品状态 const onlineGoodsState = 1;//正常商品状态
const onlineGoodsVerify = 1; //商品已通过审核 const onlineGoodsVerify = 1; //商品已通过审核
const onlineGoodsDel = 0; //商品未删除 const onlineGoodsDel = 0; //商品未删除
......
...@@ -168,6 +168,8 @@ class NameConst { ...@@ -168,6 +168,8 @@ class NameConst {
const frontPrefix = 'front'; const frontPrefix = 'front';
const blGoods = '_goodsCommon'; const blGoods = '_goodsCommon';
const pcClient='pc-client';
} }
?> ?>
\ No newline at end of file
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace Business\Store; namespace Business\Store;
use DAO\Order\DiliverymanModel;
use DAO\StoreModel; use DAO\StoreModel;
use DAO\MemberModel; use DAO\MemberModel;
use DAO\StoreStatisticsModel; use DAO\StoreStatisticsModel;
...@@ -33,6 +34,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -33,6 +34,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
private $lastFavId; private $lastFavId;
private $taskIndex; private $taskIndex;
private $taskSize; private $taskSize;
public $clientType = false;
public function init() public function init()
{ {
...@@ -53,7 +55,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -53,7 +55,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
// $storeStatisticsDao = \DAO\StoreStatisticsModel::getInstance(); // $storeStatisticsDao = \DAO\StoreStatisticsModel::getInstance();
$orderDao = \DAO\Order\OrderModel::getInstance(); $orderDao = \DAO\Order\OrderModel::getInstance();
$favoritesStoreDao = \DAO\FavoritesStoreModel::getInstance(); $favoritesStoreDao = \DAO\FavoritesStoreModel::getInstance();
$memberFavoritesStoreStoreMemberStatisticsDao=\DAO\Store\MemberFavoritesStoreStoreMemberStatisticsModel::getInstance(); $memberFavoritesStoreStoreMemberStatisticsDao = \DAO\Store\MemberFavoritesStoreStoreMemberStatisticsModel::getInstance();
$orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(); $orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance();
//$goodsCount = \Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsCountByStoreId'), array($storeId), ApiConst::tenDaySecond, array($storeId)); //$goodsCount = \Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsCountByStoreId'), array($storeId), ApiConst::tenDaySecond, array($storeId));
$totalOrderCount = \Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$memberFavoritesStoreStoreMemberStatisticsDao, 'getGoodsCountOrderTotalByStoreId'), array($storeId), ApiConst::oneDaySecond, array($storeId)); $totalOrderCount = \Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$memberFavoritesStoreStoreMemberStatisticsDao, 'getGoodsCountOrderTotalByStoreId'), array($storeId), ApiConst::oneDaySecond, array($storeId));
...@@ -67,8 +69,8 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -67,8 +69,8 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$storeStats = $orderDao->getShopKeeperCountByStoreIdCache($storeId); $storeStats = $orderDao->getShopKeeperCountByStoreIdCache($storeId);
$storeFavariteCount = $favoritesStoreDao->getFavoritesCountByStoreIdCache($storeId); $storeFavariteCount = $favoritesStoreDao->getFavoritesCountByStoreIdCache($storeId);
$goodsCount=$totalOrderCount['orderGoodsCount']; $goodsCount = $totalOrderCount['orderGoodsCount'];
$orderTotal=$totalOrderCount['orderTotal']; $orderTotal = $totalOrderCount['orderTotal'];
$data['storeId'] = $store['store_id']; $data['storeId'] = $store['store_id'];
$data['storeName'] = $store['store_name']; $data['storeName'] = $store['store_name'];
$data['storeLabel'] = $store['store_label']; $data['storeLabel'] = $store['store_label'];
...@@ -245,7 +247,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -245,7 +247,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
} }
} else { } else {
$update_data['order_state'] = ApiConst::orderStateWaitSend; $update_data['order_state'] = ApiConst::orderStateWaitSend;
$update_data['accept_time']=TIMESTAMP; $update_data['accept_time'] = TIMESTAMP;
$result = $orderDao->update($where, $update_data); $result = $orderDao->update($where, $update_data);
$orderDao->deleteOrderCache($order['buyer_id'], $orderId, $order['store_id'], true); $orderDao->deleteOrderCache($order['buyer_id'], $orderId, $order['store_id'], true);
// \Our\RedisHelper::memberTotalFromStateToState($order['buyer_id'], $order['order_state'], ApiConst::orderStateWaitSend); // \Our\RedisHelper::memberTotalFromStateToState($order['buyer_id'], $order['order_state'], ApiConst::orderStateWaitSend);
...@@ -266,12 +268,12 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -266,12 +268,12 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
return $data; return $data;
} }
public function getRetrunDatas($storeId,$where, $pageIndex, $pageSize) public function getRetrunDatas($storeId, $where, $pageIndex, $pageSize)
{ {
$orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(); $orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance();
$orderDao = \DAO\Order\OrderModel::getInstance(); $orderDao = \DAO\Order\OrderModel::getInstance();
$goodsDao = \DAO\GoodsModel::getInstance(); $goodsDao = \DAO\GoodsModel::getInstance();
$orderCommonDao=\DAO\Order\OrderCommonModel::getInstance(); $orderCommonDao = \DAO\Order\OrderCommonModel::getInstance();
$returnData = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderDao, 'getList'), array($where, $orderDao->getOrderDetailField(), $pageIndex, $pageSize, $order = array('gmt_update' => 'desc')), \Our\ApiConst::oneDaySecond, array($storeId)); $returnData = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderDao, 'getList'), array($where, $orderDao->getOrderDetailField(), $pageIndex, $pageSize, $order = array('gmt_update' => 'desc')), \Our\ApiConst::oneDaySecond, array($storeId));
//$returnData = $orderDao->getOrders($where, $this->orderListField, $pageIndex, $pageSize); //$returnData = $orderDao->getOrders($where, $this->orderListField, $pageIndex, $pageSize);
...@@ -279,11 +281,10 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -279,11 +281,10 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
if (!empty($orders)) { if (!empty($orders)) {
$orderIds = array_column($orders, 'orderId'); $orderIds = array_column($orders, 'orderId');
if (!empty($orderIds)) { if (!empty($orderIds)) {
$orderGoods = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsByOrderIds'), array($orderIds, $orderGoodsDao->orderGoodsField), \Our\ApiConst::oneDaySecond, array($storeId)); $orderGoods = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsByOrderIds'), array($orderIds, $orderGoodsDao->orderGoodsField), \Our\ApiConst::oneDaySecond, array($storeId));
//$orderGoods = $orderGoodsDao->getOrderGoodsByOrderIds($orderIds, $orderGoodsDao->orderGoodsField); //$orderGoods = $orderGoodsDao->getOrderGoodsByOrderIds($orderIds, $orderGoodsDao->orderGoodsField);
$orderCommons=$orderCommonDao->getAllByOrderIds($orderIds,$orderCommonDao->orderCommonField); $orderCommons = $orderCommonDao->getAllByOrderIds($orderIds, $orderCommonDao->orderCommonField);
$ordersOrderCommons=Common::intergrateOneToOne($orders,$orderCommons,'orderId','orderId'); $ordersOrderCommons = Common::intergrateOneToOne($orders, $orderCommons, 'orderId', 'orderId');
$orderMerge = \Our\Common::intergrateOneToMany($ordersOrderCommons, $orderGoods, 'orderId', 'orderId', 'orderGoods'); $orderMerge = \Our\Common::intergrateOneToMany($ordersOrderCommons, $orderGoods, 'orderId', 'orderId', 'orderGoods');
foreach ($orderMerge as &$value) { foreach ($orderMerge as &$value) {
$value['orderStateName'] = $orderDao->getStatusText($value); $value['orderStateName'] = $orderDao->getStatusText($value);
...@@ -299,6 +300,20 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -299,6 +300,20 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
} else { } else {
$value['orderGoods'] = array(); $value['orderGoods'] = array();
} }
if ($this->clientType && $this->clientType == NameConst::pcClient) {
$value['couponAmount'] = ($value['goodsAmount'] + $value['shippingFee']) - $value['orderAmount'];//优惠券金额
$value['receiveAmount'] = $value['goodsAmount'] - $value['couponAmount'];
$value['orderAmount'] = $value['orderAmount'] + $value['couponAmount'];
$value['reciverInfo'] = unserialize($value['reciverInfo']);
$value['dlyoPickupCode'] = intval(substr($value['orderSn'], ApiConst::positionPickupCodeBegin));
if ($value['diliverymanId']) {
$diliverymanDao = DiliverymanModel::getInstance();
$res = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$diliverymanDao, 'findById'), array($value['diliverymanId']), \Our\ApiConst::oneDaySecond, array($value['diliverymanId']));
$value['deliveryman'] = $diliverymanDao->convert($res);
}
} else {
unset($value['reciverInfo']);
}
unset($value['couponId']); unset($value['couponId']);
unset($value['refundAmount']); unset($value['refundAmount']);
unset($value['paymentTime']); unset($value['paymentTime']);
...@@ -308,7 +323,6 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -308,7 +323,6 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
unset($value['refundCondition']); unset($value['refundCondition']);
unset($value['delayTime']); unset($value['delayTime']);
unset($value['reciverName']); unset($value['reciverName']);
unset($value['reciverInfo']);
unset($value['daddressId']); unset($value['daddressId']);
} }
$return['orders'] = $orderMerge; $return['orders'] = $orderMerge;
...@@ -321,10 +335,11 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -321,10 +335,11 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
} }
return $return; return $return;
} }
public function getOrderIndexWhere($storeId, $keyword, $pageIndex, $pageSize,$orderState=false)
public function getOrderIndexWhere($storeId, $keyword, $pageIndex, $pageSize, $orderState = false)
{ {
$query1[] = array('match' => array('storeId' => $storeId)); $query1[] = array('match' => array('storeId' => $storeId));
if($orderState!=false){ if ($orderState != false) {
$query1[] = array('match' => array('orderState' => $orderState)); $query1[] = array('match' => array('orderState' => $orderState));
} }
$res1['must'][0] = $query1; $res1['must'][0] = $query1;
...@@ -337,32 +352,48 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -337,32 +352,48 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$orderIdsField = array_column($res['list'], 'orderId'); $orderIdsField = array_column($res['list'], 'orderId');
$orderIds = implode(',', $orderIdsField); $orderIds = implode(',', $orderIdsField);
if ($orderIds) { if ($orderIds) {
$where = Common::format(" order_id in({0})", $orderIds); $where = Common::format(" order_id in({0})", $orderIds);
}else{ } else {
$where=false; $where = false;
} }
return $where; return $where;
} }
public function getOrders($memberId, $pageIndex, $pageSize, $orderState, $keyword) public function getOrders($memberId, $pageIndex, $pageSize, $orderState, $keyword)
{ {
$storeId = $this->_getStoreByMemberId($memberId); $storeId = $this->_getStoreByMemberId($memberId);
if(empty($storeId)){ if (empty($storeId)) {
ErrorModel::throwException(CodeConfigModel::paramsError); ErrorModel::throwException(CodeConfigModel::paramsError);
} }
$allQuery = array(); $allQuery = array();
$allQuery['bool'] = array(); $allQuery['bool'] = array();
if (!empty($keyword)) { if (!empty($keyword)) {
$orderState=!empty($orderState)?$orderState:false; $orderState = !empty($orderState) ? $orderState : false;
$where= $this->getOrderIndexWhere($storeId,$keyword,$pageIndex,$pageSize,$orderState); if(strlen($keyword)==ApiConst::four){
$where = 'han_order.store_id=' . $storeId;
$where .= Common::format(" and SUBSTRING(order_sn, {0}, {1})='{2}'",ApiConst::positionPickupCodeBeginMysql,ApiConst::four,$keyword);
}else{
$where = $this->getOrderIndexWhere($storeId, $keyword, $pageIndex, $pageSize, $orderState);
}
} else { } else {
$where = 'han_order.store_id=' . $storeId; $where = 'han_order.store_id=' . $storeId;
if (!empty($orderState)) { if ($orderState == ApiConst::oneHandred || (int)$orderState == ApiConst::oneHandredOne) {
$where .= ' and han_order.order_state=' . $orderState; if ($orderState == ApiConst::oneHandred) {
$where .= ' and han_order.shipping_type=' . ApiConst::bySelf;
} else {
$where .= ' and han_order.shipping_type=' . ApiConst::bySeller;
}
} else {
if (!empty($orderState)) {
$where .= ' and han_order.order_state=' . $orderState;
}
} }
} }
if (!empty($where)) { if (!empty($where)) {
$returnData = $this->getRetrunDatas($storeId,$where, $pageIndex, $pageSize); $returnData = $this->getRetrunDatas($storeId, $where, $pageIndex, $pageSize);
} else { } else {
$returnData = new \stdClass(); $returnData = new \stdClass();
} }
...@@ -371,7 +402,18 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -371,7 +402,18 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
private function getGoodsDetailField() private function getGoodsDetailField()
{ {
return $this->orderGoodsField . ',goods_commonid as goodsCommonid,goods_commonid as goodsCommonId,goods_goods_spec as goodsSpec '; return $this->orderGoodsField . ',goods_commonid as goodsCommonid,goods_commonid as goodsCommonId,goods_spec as goodsSpec ';
}
public function getDiliveryManByStoreId($memberId)
{
$memberDao=\DAO\MemberModel::getInstance();
$storeId = $memberDao->getInfo($memberId, 'store_id');
if (empty($storeId)) {
ErrorModel::throwException(CodeConfigModel::emptyStoreId);
}
$diliveryMan = \DAO\Order\DiliverymanModel::getInstance();
return \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$diliveryMan, 'getDeliveryManByStoreId'), array($storeId), \Our\ApiConst::oneHourCache, array($storeId));
} }
/** /**
...@@ -409,7 +451,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -409,7 +451,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$this->store = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$storeDao, 'getInfoById'), array($this->order['storeId'], $this->storeField), \Our\ApiConst::oneDaySecond); $this->store = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$storeDao, 'getInfoById'), array($this->order['storeId'], $this->storeField), \Our\ApiConst::oneDaySecond);
$returnData = $this->order; $returnData = $this->order;
//配送员信息 //配送员信息
$this->diliveryman = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$diliverymanDao, 'findById'), array($returnData['diliverymanId']), \Our\ApiConst::oneDaySecond); $this->diliveryman = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$diliverymanDao, 'findById'), array($returnData['diliverymanId']), \Our\ApiConst::oneDaySecond,array($returnData['diliverymanId']));
//地址 //地址
$returnData['shippingName'] = $orderDao->getShippingName($returnData['shippingType']); $returnData['shippingName'] = $orderDao->getShippingName($returnData['shippingType']);
$returnData['orderMessage'] = $this->orderCommon['orderMessage']; $returnData['orderMessage'] = $this->orderCommon['orderMessage'];
...@@ -420,14 +462,23 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -420,14 +462,23 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$returnData['orderExtentText'] = $orderDao->getText($this->order, ApiConst::orderDetailDescribe); $returnData['orderExtentText'] = $orderDao->getText($this->order, ApiConst::orderDetailDescribe);
$returnData['couponId'] = $returnData['couponId'] ? $returnData['couponId'] : ApiConst::zero; $returnData['couponId'] = $returnData['couponId'] ? $returnData['couponId'] : ApiConst::zero;
$returnData['shippingTime'] = $this->orderCommon['shippingTime']; $returnData['shippingTime'] = $this->orderCommon['shippingTime'];
if ($this->clientType && $this->clientType == NameConst::pcClient) {
$returnData['couponAmount'] = ($returnData['goodsAmount'] + $returnData['shippingFee']) - $returnData['orderAmount'];//优惠券金额
$returnData['receiveAmount'] = $returnData['goodsAmount'] - $returnData['couponAmount'];
$returnData['orderAmount'] = $returnData['orderAmount'] + $returnData['couponAmount'];
$returnData['dlyoPickupCode'] = intval(substr($returnData['orderSn'], ApiConst::positionPickupCodeBegin));
} else {
unset($returnData['reciverInfo']);
}
if ($returnData['diliverymanId']) { if ($returnData['diliverymanId']) {
$returnData['deliveryman'] = $diliverymanDao->convert($this->diliveryman, $this->getDeliveryManFields()); $returnData['deliveryman'] = $diliverymanDao->convert($this->diliveryman, $diliverymanDao->getDeliveryManFields());
} else { } else {
$returnData['diliverymanId'] = ApiConst::zero; $returnData['diliverymanId'] = ApiConst::zero;
$returnData['deliveryman'] = new \stdClass(); $returnData['deliveryman'] = new \stdClass();
} }
$returnData['totalGoodsNum'] = $orderGoodsDao->getGoodsCount($this->orderGoodsList); $returnData['totalGoodsNum'] = $orderGoodsDao->getGoodsCount($this->orderGoodsList);
$returnData['offlinePayway'] = $this->store['offlinePayway'] ? $this->store['offlinePayway'] : ''; $returnData['offlinePayway'] = $this->store['offlinePayway'] ? $this->store['offlinePayway'] : '';
$returnData['reciverInfo'] = $this->address; $returnData['reciverInfo'] = $this->address;
$returnData['orderGoods'] = $goodsDao->convert($this->orderGoodsList); $returnData['orderGoods'] = $goodsDao->convert($this->orderGoodsList);
return $returnData; return $returnData;
......
...@@ -57,8 +57,8 @@ class ApiReciverInfoModel extends \DAO\AbstractModel ...@@ -57,8 +57,8 @@ class ApiReciverInfoModel extends \DAO\AbstractModel
$this->address=$reciverInfo['address']; $this->address=$reciverInfo['address'];
$this->areaInfo=$reciverInfo['area']; $this->areaInfo=$reciverInfo['area'];
$this->street=$reciverInfo['street']; $this->street=$reciverInfo['street'];
$this->lng=$reciverInfo['lng']; $this->lng=isset($reciverInfo['lng'])?$reciverInfo['lng']:ApiConst::zero;
$this->lat=$reciverInfo['lat']; $this->lat=isset($reciverInfo['lat'])?$reciverInfo['lat']:ApiConst::zero;
$this->cityCode=isset($reciverInfo['citycode'])?$reciverInfo['citycode']:''; $this->cityCode=isset($reciverInfo['citycode'])?$reciverInfo['citycode']:'';
$this->addressId=$reciverInfo['address_id']; $this->addressId=$reciverInfo['address_id'];
$this->subAddress=isset($reciverInfo['subaddress'])?$reciverInfo['subaddress']:''; $this->subAddress=isset($reciverInfo['subaddress'])?$reciverInfo['subaddress']:'';
......
...@@ -61,7 +61,7 @@ class DiliverymanModel extends \DAO\AbstractModel ...@@ -61,7 +61,7 @@ class DiliverymanModel extends \DAO\AbstractModel
*/ */
public function find($where) public function find($where)
{ {
$data = $this->db->from($this->_tableName)->where($where)->fetchOne(); $data = $this->db->from($this->_tableName)->select($this->detailField)->where($where)->fetchOne();
return $data; return $data;
} }
//任务脚本方法 //任务脚本方法
...@@ -80,17 +80,31 @@ class DiliverymanModel extends \DAO\AbstractModel ...@@ -80,17 +80,31 @@ class DiliverymanModel extends \DAO\AbstractModel
$where[$this->_primaryKey] = $id; $where[$this->_primaryKey] = $id;
return $this->find($where); return $this->find($where);
} }
public function getDeliveryManFields()
public function convert($info,$keyValues,$imageField='qrcode_path'){ {
$convertInfo=array(); return array(
foreach($keyValues as $key =>$val){ 'qrcode_path' => 'qrcodePath',
if($key!=$imageField){ 'true_name' => 'trueName',
$convertInfo[$val]=$info[$key]; 'mobile' => 'mobile',
}else{ );
$convertInfo[$val]=\Our\Common::getStaticFile($info[$key],ImageConst::memberAvatar) ; }
} public function convert($info){
$memberDao=\DAO\MemberModel::getInstance();
$info['qrcodePath']=$memberDao->getMemberAvatar($info['memberId']);
return $info;
}
public function getByWhere($where)
{
$this->setDb($this->dbName);
if(is_array($where)){
$where = $this->db->getSqlWhereByArray($where);
} }
return $convertInfo; $list = $this->db->select($this->detailField)->from($this->_tableName)->where($where)->fetchAll();
return $list;
}
public function getDeliveryManByStoreId($storeId){
$where['store_id']=$storeId;
return $this->getByWhere($where);
} }
......
...@@ -45,7 +45,7 @@ class OrderModel extends \DAO\AbstractModel ...@@ -45,7 +45,7 @@ class OrderModel extends \DAO\AbstractModel
public function getOrderDetailField() public function getOrderDetailField()
{ {
return 'order_id as orderId,coupon_id as couponId,refund_amount as refundAmount,order_sn as orderSn,pay_sn as paySn,store_name as storeName,add_time as addTime,store_id as storeId,goods_amount as goodsAmount,shipping_fee as shippingFee,order_amount as orderAmount,shipping_type as shippingType,payment_type as paymentType,order_state as orderState,shipping_fee as shippingFee,refund_state as refundState,order_type as orderType,is_receive_payment as isReceivePayment,payment_time as paymentTime,finnshed_time as finnshedTime,need_shipping_fee as needShippingFee,payment_code as paymentCode,buyer_id as buyerId,buyer_name as buyerName,refund_condition as refundCondition,delay_time as delayTime,gmt_update as gmtUpdate'; return 'order_id as orderId,coupon_id as couponId,refund_amount as refundAmount,order_sn as orderSn,pay_sn as paySn,store_name as storeName,add_time as addTime,store_id as storeId,goods_amount as goodsAmount,shipping_fee as shippingFee,order_amount as orderAmount,shipping_type as shippingType,payment_type as paymentType,order_state as orderState,shipping_fee as shippingFee,refund_state as refundState,order_type as orderType,is_receive_payment as isReceivePayment,payment_time as paymentTime,finnshed_time as finnshedTime,need_shipping_fee as needShippingFee,payment_code as paymentCode,buyer_id as buyerId,buyer_name as buyerName,refund_condition as refundCondition,delay_time as delayTime,gmt_update as gmtUpdate,diliveryman_id as diliverymanId';
} }
public function getOrderShippingField() public function getOrderShippingField()
......
...@@ -64,7 +64,9 @@ class LinkMySQLModel{ ...@@ -64,7 +64,9 @@ class LinkMySQLModel{
} }
public static function unsetDbConecet(){ public static function unsetDbConecet(){
unset(self::$_instances); if(!empty(self::$_instances)){
unset(self::$_instances);
}
} }
......
<?php
use Business\User\LoginV2Model;
use Error\ErrorModel;
use Our\ApiConst;
use Our\NameConst;
use Error\CodeConfigModel;
use Business\User\MemberServiceModel;
use Our\DescribeConst;
class MemberController extends \Our\Controller_AbstractApi {
private $memberService;
public function init(){
parent::init();
$this->memberService=MemberServiceModel::getInstance();
}
public function indexAction() {
throw new Exception('hello ',404);
}
/**
* 获取会员基本信息
*
* @var member/getMemberInfo
*/
public function getMemberInfoAction(){
$result=$this->memberService->getMemberInfo($this->memberId);
$this->success($result);
}
/**
* 保存用户信息
* @throws Exception
*/
public function saveMemberInfoAction(){
$data = $this->req[\Our\NameConst::data];
$result = $this->memberService->saveMemberInfo($data,$this->memberId);
if($result===false){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::saveMemberFailed);
}
$this->success(new stdClass(),\Our\DescribeConst::saveMemberSuccess,\Our\DescribeConst::saveMemberSuccess);
}
/**
* 保存用户头像
*/
public function saveMemberAvatarAction(){
$data = $this->req[\Our\NameConst::data];
$result = $this->memberService->saveMemberAvatar($data,$this->memberId);
$member = $this->memberService->getMemberInfo($this->memberId);
if($result!==false){
$this->success(array('memberAvatar'=>$member['memberAvatar']));
}
\Error\ErrorModel::throwException(\Error\CodeConfigModel::saveMemberAvatarFailed);
}
/**
* 取消第三方绑定
*/
public function cancelBindingAction(){
$data = $this->req[\Our\NameConst::data];
$this->memberService->cancelBinding($data,$this->memberId);
if($data['userType']==\Our\ApiConst::userFromWx){
$userToken=$this->memberService->getWxUserToken($this->memberId);
if(!empty($userToken)){
$this->updateOldLoginKey($userToken);
}
}
$this->success(new stdClass(),\Our\DescribeConst::cancelBindingSuccess,\Our\DescribeConst::cancelBindingSuccess);
}
/**
* 已登录用户绑定第三方平台账号
*/
public function bindThirdPlatformAction(){
$data = $this->req[\Our\NameConst::data];
$result = $this->memberService->bindThirdPlatform($data,$this->memberId);
if($result){
$this->success(new stdClass(),\Our\DescribeConst::bindingSuccess,\Our\DescribeConst::bindingSuccess);
}
\Error\ErrorModel::throwException(\Error\CodeConfigModel::bindingSuccess);
}
/**
* 用户退出登录
* @throws Exception
*/
public function logOutAction(){
$key = $this->req[\Our\NameConst::data]['key'];
$result = $this->memberService->logOut($key);
session_unset();
session_destroy();
if($result){
$this->success(new stdClass());
}
ErrorModel::throwException(CodeConfigModel::noLogin);
}
/**
* 用户退出登录
* @throws Exception
*/
public function logOutTestAction(){
$key = $this->req[\Our\NameConst::data]['key'];
$result = $this->memberService->logOutTest($key);
if($result){
$this->success(new stdClass());
}
ErrorModel::throwException(CodeConfigModel::noLogin);
}
/**
* 修改密码
*/
public function changePasswordAction(){
$data = $this->req[\Our\NameConst::data];
$result = $this->memberService->changePassword($data,$this->memberId);
if($result){
$this->success(new stdClass(),\Our\DescribeConst::changePasswordSuccess,\Our\DescribeConst::changePasswordSuccess);
}
\Error\ErrorModel::throwException(\Error\CodeConfigModel::bindingSuccess);
}
/**
* 修改手机号码
*/
public function changeMobileAction(){
$data = $this->req[\Our\NameConst::data];
$this->memberService->changeMobile($data,$this->memberId);
$this->success(new stdClass(),\Our\DescribeConst::changeMobileSuccess,\Our\DescribeConst::changeMobileSuccess);
}
/**
* 微信绑定手机号码
*/
public function bindMobileForWxAction(){
$data = $this->req[\Our\NameConst::data];
$this->memberService->bindMobile($data,$this->memberId);
$this->success(new stdClass(),\Our\DescribeConst::bindMobileForWxSuccess,\Our\DescribeConst::bindMobileForWxSuccess);
}
}
...@@ -23,6 +23,7 @@ class ShopkeeperController extends \Our\Controller_AbstractApi { ...@@ -23,6 +23,7 @@ class ShopkeeperController extends \Our\Controller_AbstractApi {
parent::init(); parent::init();
$this->memberService = MemberServiceModel::getInstance(); $this->memberService = MemberServiceModel::getInstance();
$this->shopkeeperService = ShopkeeperServiceModel::getInstance(); $this->shopkeeperService = ShopkeeperServiceModel::getInstance();
$this->shopkeeperService->clientType=NameConst::pcClient;
} }
/** /**
...@@ -151,6 +152,17 @@ class ShopkeeperController extends \Our\Controller_AbstractApi { ...@@ -151,6 +152,17 @@ class ShopkeeperController extends \Our\Controller_AbstractApi {
} }
} }
/**
* 获得配送员列表
*/
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);
}
/** /**
* 订单详情 * 订单详情
*/ */
......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>简单的html5 File测试 for pic2base64</title>
<style>
</style>
</head>
<body>
<form action="/client/shopkeeper/getDeliveriers" method="post">
用户登录状态key:<input name="data[key]" value="681c788e2d5a1a67bb4432aebe67c35b"/><br />
<p id="img_area"></p>
<input type="submit" value="提交">
</form>
</body>
</html>
\ No newline at end of file
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
</head> </head>
<body> <body>
<form action="/shopkeeper/orderDetail" method="post"> <form action="/client/shopkeeper/orderDetail" method="post">
用户登录状态key:<input name="data[key]" value="ceb72deab920ac0edb7272b2ed9dfa1e"/><br /> 用户登录状态key:<input name="data[key]" value="ceb72deab920ac0edb7272b2ed9dfa1e"/><br />
订单id:<input name="data[orderId]" value="935"/><br /> 订单id:<input name="data[orderId]" value="935"/><br />
<p id="img_area"></p> <p id="img_area"></p>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
</head> </head>
<body> <body>
<form action="/shopkeeper/orders" method="post"> <form action="/client/shopkeeper/orders" method="post">
用户登录状态key:<input name="data[key]" value="ceb72deab920ac0edb7272b2ed9dfa1e"/><br /> 用户登录状态key:<input name="data[key]" value="ceb72deab920ac0edb7272b2ed9dfa1e"/><br />
订单状态id:<input name="data[orderState]" value=""/><br /> 订单状态id:<input name="data[orderState]" value=""/><br />
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</head> </head>
<body> <body>
<form action="/user/login" method="post"> <form action="/client/user/login" method="post">
用户名:<input name="data[mobile]" value="18305954587"/><br /> 用户名:<input name="data[mobile]" value="18305954587"/><br />
密码:<input name="data[password]" value="123456"/><br /> 密码:<input name="data[password]" value="123456"/><br />
key:<input name="data[key]" value="c2e5e7bfce8a727c7fb6f696bcaa23ac"/><br /> key:<input name="data[key]" value="c2e5e7bfce8a727c7fb6f696bcaa23ac"/><br />
......
...@@ -14,20 +14,20 @@ $http = new swoole_http_server("0.0.0.0", 9501); ...@@ -14,20 +14,20 @@ $http = new swoole_http_server("0.0.0.0", 9501);
$http->on('request', function ($request, $response) { $http->on('request', function ($request, $response) {
try{ try{
$respData=$request->post; $respData=$request->post;
echo json_encode($respData); // echo json_encode($respData);
echo 'abcdefg'.'|||||||||||';
if(isset($respData['type'])&&$respData['type']==1){ if(isset($respData['type'])&&$respData['type']==1){
$info=$respData['content']; $info=$respData['content'];
$memberDao=$info['className']::getInstance(\Our\DbNameConst::masterDBConnectName); $memberDao=$info['className']::getInstance(\Our\DbNameConst::masterDBConnectName);
echo json_encode($info['params']); echo json_encode($info['params']);
if(empty($info['params'])){ if(empty($info['params'])){
$res=call_user_func_array(array($memberDao,$info['method'])); $res=call_user_func_array(array($memberDao,$info['method']));
}else{ }else{
$res=call_user_func_array(array($memberDao,$info['method']),$info['params']); $res=call_user_func_array(array($memberDao,$info['method']),$info['params']);
} }
$res=(isset($res)&&!empty($res))?$res:false; $res=(isset($res)&&!empty($res))?$res:false;
unset($memberDao); unset($memberDao);
\Mysql\LinkMySQLModel::unsetDbConecet();
if($res!==false){ if($res!==false){
echo 'success'; echo 'success';
$response->end(json_encode(array('status'=>1,'message'=>'执行成功','data'=>$res))); $response->end(json_encode(array('status'=>1,'message'=>'执行成功','data'=>$res)));
......
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