Commit e4f99a5d authored by wwccw0591's avatar wwccw0591

pcclient

parent dfbd08b2
...@@ -424,4 +424,6 @@ class ApiConst ...@@ -424,4 +424,6 @@ class ApiConst
const memberAvatarType = 5; const memberAvatarType = 5;
const arriveTimeRadius=1800;
} }
\ No newline at end of file
...@@ -306,6 +306,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -306,6 +306,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$value['orderAmount'] = $value['orderAmount'] + $value['couponAmount']; $value['orderAmount'] = $value['orderAmount'] + $value['couponAmount'];
$value['reciverInfo'] = unserialize($value['reciverInfo']); $value['reciverInfo'] = unserialize($value['reciverInfo']);
$value['dlyoPickupCode'] = intval(substr($value['orderSn'], ApiConst::positionPickupCodeBegin)); $value['dlyoPickupCode'] = intval(substr($value['orderSn'], ApiConst::positionPickupCodeBegin));
$value['shippingArrivalTimeEnd'] = $value['shippingArrivalTime'] + ApiConst::arriveTimeRadius;
if ($value['diliverymanId']) { if ($value['diliverymanId']) {
$diliverymanDao = DiliverymanModel::getInstance(); $diliverymanDao = DiliverymanModel::getInstance();
$res = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$diliverymanDao, 'findById'), array($value['diliverymanId']), \Our\ApiConst::oneDaySecond, array($value['diliverymanId'])); $res = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$diliverymanDao, 'findById'), array($value['diliverymanId']), \Our\ApiConst::oneDaySecond, array($value['diliverymanId']));
...@@ -467,6 +468,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -467,6 +468,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$returnData['receiveAmount'] = $returnData['goodsAmount'] - $returnData['couponAmount']; $returnData['receiveAmount'] = $returnData['goodsAmount'] - $returnData['couponAmount'];
$returnData['orderAmount'] = $returnData['orderAmount'] + $returnData['couponAmount']; $returnData['orderAmount'] = $returnData['orderAmount'] + $returnData['couponAmount'];
$returnData['dlyoPickupCode'] = intval(substr($returnData['orderSn'], ApiConst::positionPickupCodeBegin)); $returnData['dlyoPickupCode'] = intval(substr($returnData['orderSn'], ApiConst::positionPickupCodeBegin));
$returnData['shippingArrivalTimeEnd'] = $returnData['shippingArrivalTime'] + ApiConst::arriveTimeRadius;
} else { } else {
unset($returnData['reciverInfo']); unset($returnData['reciverInfo']);
} }
...@@ -846,28 +848,65 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -846,28 +848,65 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
} }
public function getSellerCount($memberId)
{
$memberDao = \DAO\MemberModel::getInstance();
$storeId = $memberDao->getInfo($memberId, 'store_id');
$orderDao = \DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName);
$waitReceiveCount = $orderDao->getCountByOrderState($storeId, ApiConst::orderStateWaitConfirm);
$waitDeliveryCount = $orderDao->getCountByShippingTypeAndOrderState($storeId, ApiConst::bySeller, ApiConst::orderStateWaitRecieve);
$waitGetCount = $orderDao->getCountByShippingTypeAndOrderState($storeId, ApiConst::bySelf, ApiConst::orderStateWaitRecieve);
$orderCount=$waitReceiveCount+$waitDeliveryCount+$waitGetCount;
return array('waitReceiveCount' => $waitReceiveCount, 'waitDeliveryCount' => $waitDeliveryCount, 'waitGetCount' => $waitGetCount,'orderCount'=>$orderCount);
}
public function getSellerRefundCount($memberId)
{
$memberDao = \DAO\MemberModel::getInstance();
$storeId = $memberDao->getInfo($memberId, 'store_id');
$refundReturnDao = \DAO\Order\RefundReturnModel::getInstance(DbNameConst::salveDBConnectName);
//待处理
$waitRefundProccessCount = $refundReturnDao->getCountByRefundState($storeId, ApiConst::orderStateWaitConfirm);
$waitRefundReceiveCount = $refundReturnDao->getCountByRefundType($storeId, ApiConst::refundTypeGoods);
$refundCount=$waitRefundProccessCount+$waitRefundReceiveCount;
return array('waitRefundProccessCount' => $waitRefundProccessCount, 'waitRefundReceiveCount' => $waitRefundReceiveCount, 'refundCount' =>$refundCount);
}
public function getStorageAlarmCount($memberId)
{
$memberDao = \DAO\MemberModel::getInstance();
$storeId = $memberDao->getInfo($memberId, 'store_id');
$goodsDao=\DAO\GoodsModel::getInstance();
$alertCount=$goodsDao->getAlertCountByStoreId($storeId);
return array('alertCount'=>$alertCount);
}
public function getCount($memberId){
$orderCount=$this->getSellerCount($memberId);
$refundCount=$this->getSellerRefundCount($memberId);
$alertCount=$this->getStorageAlarmCount($memberId);
$res=array_merge($orderCount,$refundCount,$alertCount);
return $res;
}
/** /**
* 登录业务 * 登录业务
* *
* @var \Business\User\LoginV2Model * @var \Business\User\LoginV2Model
*/ */
private private
static $_instance = null; static $_instance = null;
/** /**
* 单例模式获取类实例 * 单例模式获取类实例
* *
* @return \Business\User\LoginV2Model * @return \Business\User\LoginV2Model
*/ */
public public
static function getInstance() static function getInstance()
{ {
if (!(self::$_instance instanceof self)) { if (!(self::$_instance instanceof self)) {
self::$_instance = new self(); self::$_instance = new self();
} }
return self::$_instance; return self::$_instance;
} }
} }
...@@ -57,7 +57,14 @@ abstract class AbstractModel { ...@@ -57,7 +57,14 @@ abstract class AbstractModel {
return $result; return $result;
} }
public function getCountByWhere($where){
$this->setDb($this->dbName);
if(is_array($where)){
$where=$this->db->getSqlWhereByArray($where);
}
$count=$this->db->from($this->_tableName)->where($where)->fetchNum();
return $count;
}
public function lists($where=array(),$order='',$field='*',$pageIndex=0,$pageSize=20,$group = null){ public function lists($where=array(),$order='',$field='*',$pageIndex=0,$pageSize=20,$group = null){
$this->db->from($this->_tableName); $this->db->from($this->_tableName);
$this->db->where($where); $this->db->where($where);
......
...@@ -432,4 +432,12 @@ class GoodsModel extends \DAO\AbstractModel { ...@@ -432,4 +432,12 @@ class GoodsModel extends \DAO\AbstractModel {
return $goodses; return $goodses;
} }
public function getAlertCountByStoreId($storeId){
$where=Common::format(" store_id={0}",$storeId);
$where.=" and goods_storage<goods_storage_alarm";
$alertCount=$this->getCountByWhere($where);
return $alertCount;
}
} }
...@@ -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,diliveryman_id as diliverymanId'; 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,shipping_arrival_time as shippingArrivalTime';
} }
public function getOrderShippingField() public function getOrderShippingField()
...@@ -1083,4 +1083,24 @@ class OrderModel extends \DAO\AbstractModel ...@@ -1083,4 +1083,24 @@ class OrderModel extends \DAO\AbstractModel
return self::$_instance; return self::$_instance;
} }
/**
* pcClient 获得订单数量
*/
public function getCountByOrderState($storeId,$orderState){
$where['store_id']=$storeId;
$where['order_state']=$orderState;
$count=$this->getCountByWhere($where);
return $count;
}
public function getCountByShippingTypeAndOrderState($storeId,$shippingType,$orderState){
$where['store_id']=$storeId;
$where['shipping_type']=$shippingType;
$where['order_state']=$orderState;
$count=$this->getCountByWhere($where);
return $count;
}
} }
...@@ -474,4 +474,28 @@ class RefundReturnModel extends \DAO\AbstractModel { ...@@ -474,4 +474,28 @@ class RefundReturnModel extends \DAO\AbstractModel {
return self::$_instance; return self::$_instance;
} }
/**
* @param $storeId
* @param $orderState
* @return mixed 待处理
*/
public function getCountByRefundState($storeId,$refundState){
$where['store_id']=$storeId;
$where['refund_state']=$refundState;
$count=$this->getCountByWhere($where);
return $count;
}
/**
* @param $storeId
* @param $orderState
* @return mixed 待收货
*/
public function getCountByRefundType($storeId,$refundType){
$where['store_id']=$storeId;
$where['refund_type']=$refundType;
$where['goods_state']=array('neq',ApiConst::four);
$count=$this->getCountByWhere($where);
return $count;
}
} }
...@@ -189,5 +189,17 @@ class ShopkeeperController extends \Our\Controller_AbstractApi { ...@@ -189,5 +189,17 @@ class ShopkeeperController extends \Our\Controller_AbstractApi {
$this->success($res); $this->success($res);
} }
/**
* 获得订单数量
*/
public function countAction(){
$result = $this->shopkeeperService->getCount($this->memberId);
if(!empty($result)){
$this->success($result);
}
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/count" method="post">
用户登录状态key:<input name="data[key]" value="73526b0db474f2a0e5f80c67301be73d"/><br />
<p id="img_area"></p>
<input type="submit" value="提交">
</form>
</body>
</html>
\ No newline at end of file
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