Commit 1499bf76 authored by wwccw0591's avatar wwccw0591

temp

parents f7cebc13 a8b38774
......@@ -959,7 +959,7 @@ class OrderConfirmUtil {
$memberId = $orderList[0]['buyer_id'];
$updateOrder = array();
$updateOrder['order_state'] = \Our\ApiConst::orderStateWaitConfirm;
$updateOrder['is_receive_payment'] = \Our\ApiConst::one;
$updateOrder['is_receive_payment'] = TIMESTAMP;
$updateOrder['payment_time'] = (isset($data['payment_time'])? strtotime($data['payment_time']) : TIMESTAMP);
$updateOrder['payment_type'] = $this->getOrderPaymentType($data['pay_type']);
$orderUpdateResult = $orderModel->update($orderCon,$updateOrder);
......
......@@ -424,4 +424,6 @@ class ApiConst
const memberAvatarType = 5;
const arriveTimeRadius=1800;
}
\ No newline at end of file
......@@ -268,14 +268,14 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
return $data;
}
public function getRetrunDatas($storeId, $where, $pageIndex, $pageSize)
public function getRetrunDatas($storeId, $where, $pageIndex, $pageSize,$order = array('gmt_update' => 'desc'))
{
$orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance();
$orderDao = \DAO\Order\OrderModel::getInstance();
$goodsDao = \DAO\GoodsModel::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, \Our\ApiConst::oneDaySecond, array($storeId)));
//$returnData = $orderDao->getOrders($where, $this->orderListField, $pageIndex, $pageSize);
$orders = $returnData['list'];
if (!empty($orders)) {
......@@ -306,6 +306,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$value['orderAmount'] = $value['orderAmount'] + $value['couponAmount'];
$value['reciverInfo'] = unserialize($value['reciverInfo']);
$value['dlyoPickupCode'] = intval(substr($value['orderSn'], ApiConst::positionPickupCodeBegin));
$value['shippingArrivalTimeEnd'] = $value['shippingArrivalTime'] + ApiConst::arriveTimeRadius;
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']));
......@@ -362,6 +363,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
public function getOrders($memberId, $pageIndex, $pageSize, $orderState, $keyword)
{
$order = array('gmt_update' => 'desc');
$storeId = $this->_getStoreByMemberId($memberId);
if (empty($storeId)) {
ErrorModel::throwException(CodeConfigModel::paramsError);
......@@ -382,6 +384,10 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
if ($orderState == ApiConst::oneHandred) {
$where .= ' and han_order.shipping_type=' . ApiConst::bySelf;
} else {
$order=array(
'diliveryman_id'=>'asc',
'gmt_update'=>'asc'
);
$where .= ' and han_order.shipping_type=' . ApiConst::bySeller;
}
......@@ -393,7 +399,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
}
if (!empty($where)) {
$returnData = $this->getRetrunDatas($storeId, $where, $pageIndex, $pageSize);
$returnData = $this->getRetrunDatas($storeId, $where, $pageIndex, $pageSize,$order);
} else {
$returnData = new \stdClass();
}
......@@ -416,6 +422,23 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
return \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$diliveryMan, 'getDeliveryManByStoreId'), array($storeId), \Our\ApiConst::oneHourCache, array($storeId));
}
public function confirmReceivePayment($memberId,$orderId){
$memberDao = \DAO\MemberModel::getInstance();
$storeId = $memberDao->getInfo($memberId, 'store_id');
$orderDao=\DAO\Order\OrderModel::getInstance(DbNameConst::masterDBConnectName);
$where['order_id']=$orderId;
$where['store_id']=$storeId;
$count=$orderDao->getCountByWhere($where);
if($count){
$data['is_receive_payment']=TIMESTAMP;
$updateId=$orderDao->updateByOrderId($data,$orderId);
return $updateId;
}else{
ErrorModel::throwException(CodeConfigModel::notExsitOrder);
}
}
/**
* 订单详情
*/
......@@ -467,6 +490,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$returnData['receiveAmount'] = $returnData['goodsAmount'] - $returnData['couponAmount'];
$returnData['orderAmount'] = $returnData['orderAmount'] + $returnData['couponAmount'];
$returnData['dlyoPickupCode'] = intval(substr($returnData['orderSn'], ApiConst::positionPickupCodeBegin));
$returnData['shippingArrivalTimeEnd'] = $returnData['shippingArrivalTime'] + ApiConst::arriveTimeRadius;
} else {
unset($returnData['reciverInfo']);
}
......@@ -846,28 +870,72 @@ 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
*/
private
static $_instance = null;
public function getDiliveryMan($mobile){
$memberDao = \DAO\MemberModel::getInstance();
$member= $memberDao->getByMemberMobile($mobile);
return $member;
/**
* 单例模式获取类实例
*
* @return \Business\User\LoginV2Model
*/
public
static function getInstance()
{
if (!(self::$_instance instanceof self)) {
self::$_instance = new self();
}
return self::$_instance;
}
/**
* 登录业务
*
* @var \Business\User\LoginV2Model
*/
private
static $_instance = null;
/**
* 单例模式获取类实例
*
* @return \Business\User\LoginV2Model
*/
public
static function getInstance()
{
if (!(self::$_instance instanceof self)) {
self::$_instance = new self();
}
return self::$_instance;
}
}
......@@ -57,7 +57,14 @@ abstract class AbstractModel {
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){
$this->db->from($this->_tableName);
$this->db->where($where);
......
......@@ -453,4 +453,12 @@ class GoodsModel extends \DAO\AbstractModel {
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;
}
}
This diff is collapsed.
......@@ -39,21 +39,6 @@ class DiliverymanModel extends \DAO\AbstractModel
}
public function getCount($where, $isArray = true)
{
$this->setDb();
if (!$isArray) {
$str = '$count = $this->db->from($this->_tableName)';
foreach ($where as $v) {
$str .= "->where('$v')";
}
$str .= "->fetchNum();";
eval($str);
return $count;
}
return $this->db->from($this->_tableName)->where($where)->fetchNum();
}
/**
* 获取单条数据
* @param $where
......@@ -80,6 +65,12 @@ class DiliverymanModel extends \DAO\AbstractModel
$where[$this->_primaryKey] = $id;
return $this->find($where);
}
public function getByMobile($mobile){
$this->setDb($this->dbName);
$where['mobile'] = $mobile;
$result=$this->find($where);
return $result;
}
public function getDeliveryManFields()
{
return array(
......
......@@ -45,7 +45,7 @@ class OrderModel extends \DAO\AbstractModel
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()
......@@ -233,6 +233,11 @@ class OrderModel extends \DAO\AbstractModel
return $this->db->update($this->_tableName)->where($where)->rows($data)->execute();
}
public function updateByOrderId($data,$orderId){
$where['order_id']=$orderId;
$res=$this->update($where,$data);
return $res;
}
public function insert($data)
{
$this->setDb(\Our\DbNameConst::masterDBConnectName);
......@@ -1083,4 +1088,24 @@ class OrderModel extends \DAO\AbstractModel
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 {
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;
}
}
This diff is collapsed.
......@@ -147,9 +147,9 @@ class ShopkeeperController extends \Our\Controller_AbstractApi {
$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);
}
// if($result){
// $this->success(array(),\Our\DescribeConst::successMessage,\Our\DescribeConst::successMessage);
// }
}
/**
......@@ -196,6 +196,43 @@ class ShopkeeperController extends \Our\Controller_AbstractApi {
$goodsCommonService = \Business\Goods\GoodsCommonServiceModel::getInstance();
$pageIndex=$this->getPageIndex();
$pageSize=$this->getPageSize();
$res = $goodsCommonService->getGoodsStorageList($this->memberId, $pageIndex, $pageSize);
$memberDao = \DAO\MemberModel::getInstance();
$storeId = $memberDao->getInfo($this->memberId, 'store_id');
$res = $goodsCommonService->getGoodsStorageList($storeId, $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);
}
}
......@@ -68,7 +68,7 @@ class UserController extends \Our\Controller_AbstractIndex {
$member['store_id']=$seller['storeId'];
$member['seller_id']=$seller['sellerId'];
$this->memberService->saveMember($member,'seller');
$this->success(array('key'=>$this->key,'memberName'=>$member['member_name'],'memberAvatar'=>$member['memberAvatarUrl'],'memberId'=>(int)$member['member_id']));
$this->success(array('key'=>$this->key,'trueName'=>$seller['trueName'],'memberAvatar'=>$member['memberAvatarUrl'],'memberId'=>(int)$member['member_id'],'storeId'=>(int)$seller['storeId']));
}else{
ErrorModel::throwException(CodeConfigModel::errorUsernameOrPassword);
}
......
<!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
<!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/receivePayment" method="post">
用户登录状态key:<input name="data[key]" value="ceb72deab920ac0edb7272b2ed9dfa1e"/><br />
订单id:<input name="data[orderId]" value=""/><br />
<input type="submit" value="提交">
</form>
</body>
</html>
\ No newline at end of file
<!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/searchDelivery" method="post">
用户登录状态key:<input name="data[key]" value="73526b0db474f2a0e5f80c67301be73d"/><br />
配送员电话:<input name="data[mobile]" value="18305954587"/><br />
<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