Commit 566f2429 authored by wwccw0591's avatar wwccw0591

temp

parents 59675070 22fc200d
......@@ -3,6 +3,7 @@ namespace OSS;
use OSS\OssClient;
use OSS\Core\OssException;
use Our\SecretKeys;
/**
......@@ -17,13 +18,11 @@ class Common
const accessKeySecret = \Our\SecretKeys::ossAccessKey;
const bucket = \Our\SecretKeys::ossBucket;
/**
* Get an OSSClient instance according to config.
*
* @return OssClient An OssClient instance
*/
public static function getOssClient()
{
const endpointPre=SecretKeys::ossEndpointPre;
const buketPre=SecretKeys::ossBucket;
public static function getOssClientOnline(){
try {
$ossClient = new OssClient(self::accessKeyId, self::accessKeySecret, self::endpoint, false);
} catch (OssException $e) {
......@@ -33,10 +32,40 @@ class Common
}
return $ossClient;
}
public static function getOssClientPre(){
try {
$ossClient = new OssClient(self::accessKeyId, self::accessKeySecret, self::endpointPre, false);
} catch (OssException $e) {
printf(__FUNCTION__ . "creating OssClient instance: FAILED\n");
printf($e->getMessage() . "\n");
return null;
}
return $ossClient;
}
/**
* Get an OSSClient instance according to config.
*
* @return OssClient An OssClient instance
*/
public static function getOssClient()
{
if(APP_ENV=='product' || APP_ENV=='productone'){
return self::getOssClientOnline();
}else{
return self::getOssClientPre();
}
}
public static function getBucketName()
{
if(APP_ENV=='product' || APP_ENV=='productone'){
return self::bucket;
}else{
return self::buketPre;
}
}
/**
......
......@@ -424,10 +424,11 @@ class ApiConst
const set = 2;
//桌面最新版本
const xpClietnAppVersion='1.0.2';
const winClientAppVersion='1.0.2';
//微信小程序是否发布
const xpClientAppVersion='1.0.4';
const winClientAppVersion='1.0.4';
const xpClientAppVersionOnline='1.0.0';
const winClientAppVersionOnline='1.0.0';
//微信小是否发布
const isWxPublish = 0;
//消息模板类型
......
......@@ -154,6 +154,7 @@ class DescribeConst
const notPayed = '未付款'; //货到付款
const refund='退款';
const refundRetund='退货';
const refundSuccess='退款成功';
const sellerRefuseReturn='卖家拒绝退货';
const sellerAgreeReturn='卖家同意退货';
......
......@@ -25,6 +25,11 @@ class SecretKeys {
const ossBucket = 'qmoss-01';//存储空间名称
const ossDomain = 'http://qmoss-01.oss-cn-hangzhou.aliyuncs.com';//访问oss使用域名
//pre环境使用的oss
const ossEndpointPre = 'http://oss-cn-shanghai.aliyuncs.com';//地域节点
const ossBucketPre = 'qmoss-shanghai';//存储空间名称
const ossDomainPre = 'http://qmoss-shanghai.oss-cn-shanghai.aliyuncs.com';//访问oss使用域名
//短信验证码相关
const aliYunSmsAppId = 'LTAICEp88gU0DNMe';
......
......@@ -10,7 +10,7 @@ class QPay extends \Payment\TencentPay{
public function __construct() {
$this->appid = \Our\PayConst::qPayAppId;
$this->notify_url = \Our\NameConst::httpPrefix.$_SERVER['SERVER_NAME'].\Our\PayConst::qPayNotifyUrl;
$this->notify_url = \Our\Common::getBaseUrl().\Our\PayConst::qPayNotifyUrl;
$this->mch_id = \Our\PayConst::qPayMchId;
$this->key = \Our\PayConst::qPayKey;
$this->sslcert_path = \Our\PayConst::qqSslcertPath;
......
......@@ -12,7 +12,7 @@ class WxLitePay extends \Payment\TencentPay{
public function __construct()
{
$this->appid = \Our\PayConst::wxLiteAppId;
$this->notify_url = \Our\NameConst::httpPrefix.$_SERVER['SERVER_NAME'].\Our\PayConst::wxLiteNotifyUrl;
$this->notify_url = \Our\Common::getBaseUrl().\Our\PayConst::wxLiteNotifyUrl;
$this->mch_id = \Our\PayConst::wxPayMchId;
$this->key = \Our\PayConst::wxSPayKey;
$this->sslcert_path = \Our\PayConst::wxSslcertPath;
......
......@@ -15,7 +15,7 @@ class WxPay extends \Payment\TencentPay
public function __construct()
{
$this->appid = \Our\PayConst::wxPayAppId;
$this->notify_url = \Our\NameConst::httpPrefix . $_SERVER['SERVER_NAME'] . \Our\PayConst::wxAppNotifyUrl;
$this->notify_url = \Our\Common::getBaseUrl(). \Our\PayConst::wxAppNotifyUrl;
$this->mch_id = \Our\PayConst::wxPayMchId;
$this->key = \Our\PayConst::wxPayKey;
$this->sslcert_path = \Our\PayConst::wxSslcertPath;
......
......@@ -686,11 +686,15 @@ class CartServiceModel extends \Business\AbstractModel{
if($deliverySetting['offlinePay']){
$offlinePaywayArray = unserialize($store['offline_payway']);
if($offlinePaywayArray){
if($offlinePaywayArray['images']){
foreach($offlinePaywayArray['images'] as $image){
if($image){
$offlinePaywayArray['imageUrls'][] = \Our\Common::getStaticFile($image, \Our\ImageConst::storeLabel);
}
}
}else{
$offlinePaywayArray['imageUrls'] = array();
}
$deliverySetting['offlinePayway'] = $offlinePaywayArray;
}
}
......
......@@ -26,21 +26,23 @@ class SettingServiceModel extends \Business\AbstractModel{
public function getAppVersion($data){
$settingDAO = \DAO\SettingModel::getInstance();
$version=array();
$version['app_version'] = ApiConst::xpClietnAppVersion;
if($data['opSystem']==NameConst::xp){
$version['app_version']=ApiConst::xpClietnAppVersion;
if(APP_ENV=='pre'){
$version['app_version'] = ApiConst::xpClientAppVersion;
$fileName='/'.NameConst::xpClientUpdateUrl;
}
if(APP_ENV=='product'|| APP_ENV=='productOne'){
$version['app_version'] = ApiConst::xpClientAppVersionOnline;
$fileName='/'.NameConst::xpOnlineClientUpdateUrl;
}
}else{
$version['app_version']=ApiConst::winClientAppVersion;
if(APP_ENV=='pre'){
$version['app_version']=ApiConst::winClientAppVersion;
$fileName='/'.NameConst::clientUpdateUrl;
}
if(APP_ENV=='product'|| APP_ENV=='productOne'){
$version['app_version']=ApiConst::winClientAppVersionOnline;
$fileName='/'.NameConst::onlineClientUpdateUrl;
}
......
......@@ -10,7 +10,7 @@ use Zend\Json\Server\Exception\ErrorException;
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';
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,goods_storage_alarm as goodsStorageAlarm';
private $setStorageType = array('add'=> 1, 'set'=>2);
public function init() {
......@@ -103,7 +103,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$where = array();
$where[] = 'store_id = '.$storeId;
$where[] = 'goods_storage_alarm > 0';
$where[] = 'goods_storage<=goods_storage_alarm';
$where[] = 'goods_storage<goods_storage_alarm';
//获得列表
if($datas = $goodsDao->getList(implode($where, ' and '), $this->goodsStorageField)) {
foreach ($datas as $key=>$val) {
......@@ -186,6 +186,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$where[] = 'goods_commonid in('.trim($ids,',').')';
}
}
$order[] = ['goodsCommonid','DESC'];
$saleSort ? $ttl = \Our\ApiConst::oneHour : \Our\ApiConst::oneDaySecond;
if($activities){
$activities = array_keys($activities);
......@@ -485,7 +486,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$keyword !== '' && $where[] = "goods_name like '%{$keyword}%'";
list($_where,$order,$attrStr,$saleSort) = $this->getParam($attrValue,$minPrice,$maxPrice,$goodsSort);
$where = array_merge($where,$_where);
$order[] = ['goodsCommonId','DESC'];
$commonDAO = \DAO\GoodsCommonModel::getInstance();
$saleSort ? $ttl = \Our\ApiConst::oneHour : \Our\ApiConst::oneDaySecond;
if(!$activities){
......@@ -1377,6 +1378,9 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
if(!$oldTemp){
$storeOnlineGoodsClassDao->insert($goodsClass);
}
$storeOnlineGoodsClassDao = \DAO\GoodsClass\StoreOnlineGoodsClassModel::getInstance();
\Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreOnlineGoodsClassRedisModel::getInstance(),array(&$storeOnlineGoodsClassDao, 'getList'),array(),array($goodsClass['store_id']));
\Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreOnlineGoodsClassRedisModel::getInstance(),array(&$storeOnlineGoodsClassDao, 'getStoreOnlineGoodsClassesByGcId'),array(),array($goodsClass['store_id']));
return true;
}
......@@ -1397,7 +1401,12 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
}
$tempOne = $goodsCommonDao->getOne($where,'goods_commonid');
if(!$tempOne){
$storeOnlineGoodsClassDao->del($goodsClass);
$result = $storeOnlineGoodsClassDao->del($goodsClass);
if($result){
$storeOnlineGoodsClassDao = \DAO\GoodsClass\StoreOnlineGoodsClassModel::getInstance();
\Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreOnlineGoodsClassRedisModel::getInstance(),array(&$storeOnlineGoodsClassDao, 'getList'),array(),array($goodsClass['store_id']));
\Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreOnlineGoodsClassRedisModel::getInstance(),array(&$storeOnlineGoodsClassDao, 'getStoreOnlineGoodsClassesByGcId'),array(),array($goodsClass['store_id']));
}
}
}
}
......
......@@ -445,7 +445,7 @@ class MessageServiceModel extends \Business\AbstractModel
}
}
public function addMessageCenterToDb()
public function addMessageCenterToDb($pushPushCenter=true)
{
$conf = \Yaf\Registry::get('config')->get('redis.database.params');
$this->baseRedis = new \Redis();
......@@ -454,7 +454,9 @@ class MessageServiceModel extends \Business\AbstractModel
$this->baseRedis->auth($conf['password']);
}
while ($center = $this->baseRedis->lPop('message_center')) {
if($pushPushCenter){
$this->baseRedis->rPush('push_center', $center);
}
$addData = unserialize($center);
$addData['message'] = unserialize($addData['message']);
$this->addMessage($addData['fromId'], $addData['fromUserId'], $addData['fromUserName'], $addData['fromType'], $addData['message'], $addData['toId'], $addData['toUserId'], $addData['toUserName'], $addData['toType'], $addData['id']);
......
......@@ -36,7 +36,7 @@ class RefundServiceModel extends \Business\AbstractModel
//获得退款详情字段
private $refundReturnField = 'refund_id as refundId,order_id as orderId,order_sn as orderSn,refund_sn as refundSn,store_id as storeId,store_name as storeName,seller_state as sellerState,goods_id as goodsId,order_goods_id as orderGoodsId,goods_name as goodsName,goods_num as goodsNum,refund_amount as refundAmount,goods_image as goodsImage,refund_type as refundType,refund_state as refundState,return_type as returnType,add_time as addTime,seller_time as sellerTime,admin_time as adminTime,reason_info as reasonInfo,pic_info as picInfo,buyer_message as buyerMessage,seller_message as sellerMessage,admin_message adminMessage,express_id as expressId,invoice_no as invoiceNo,ship_time as shipTime,delay_time as delayTime,receive_time as receiveTime,shipping_over as shippingOver,shipping_sign as shippingSign,shipping_html as shippingHtml,is_suc_refund as isSucRefund,refund_shipping_type as refundShippingType,address_id as addressId,diliveryman_id as diliverymanId,is_platform_in as isPlatformIn,platform_in_reason as platformInReason,platform_state as platformState,seller_state as sellerState,return_type as returnType,refund_shipping_type as refundShippingType,buyer_refund_amount as buyerRefundAmount,reason_id as reasonId,receive_message as receiveMessage,goods_state as goodsState';
private $storeRefundReturnField = 'refund_id as refundId,order_id as orderId,order_sn as orderSn,refund_sn as refundSn,store_id as storeId,store_name as storeName,seller_state as sellerState,goods_id as goodsId,order_goods_id as orderGoodsId,goods_name as goodsName,goods_num as goodsNum,refund_amount as refundAmount,buyer_refund_amount as buyerRefundAmount,goods_image as goodsImage,refund_type as refundType,refund_state as refundState,return_type as returnType,add_time as addTime,seller_time as sellerTime,admin_time as adminTime,reason_id as reasonId,reason_info as reasonInfo,pic_info as picInfo,buyer_message as buyerMessage,seller_message as sellerMessage,admin_message adminMessage,express_id as expressId,invoice_no as invoiceNo,ship_time as shipTime,delay_time as delayTime,receive_time as receiveTime,receive_message as receiveMessage,shipping_over as shippingOver,shipping_sign as shippingSign,shipping_html as shippingHtml,is_suc_refund as isSucRefund,refund_shipping_type as refundShippingType,address_id as addressId,diliveryman_id as diliverymanId,is_platform_in as isPlatformIn,platform_in_reason as platformInReason,platform_state as platformState,return_type as returnType,refund_shipping_type as refundShippingType,goods_state as goodsState';
private $storeRefundReturnField = 'refund_id as refundId,order_id as orderId,order_sn as orderSn,refund_sn as refundSn,store_id as storeId,store_name as storeName,seller_state as sellerState,goods_id as goodsId,order_goods_id as orderGoodsId,goods_name as goodsName,goods_num as goodsNum,refund_amount as refundAmount,buyer_refund_amount as buyerRefundAmount,goods_image as goodsImage,refund_type as refundType,refund_state as refundState,return_type as returnType,add_time as addTime,seller_time as sellerTime,admin_time as adminTime,reason_id as reasonId,reason_info as reasonInfo,pic_info as picInfo,buyer_message as buyerMessage,seller_message as sellerMessage,admin_message adminMessage,express_id as expressId,invoice_no as invoiceNo,ship_time as shipTime,delay_time as delayTime,receive_time as receiveTime,receive_message as receiveMessage,shipping_over as shippingOver,shipping_sign as shippingSign,shipping_html as shippingHtml,is_suc_refund as isSucRefund,refund_shipping_type as refundShippingType,address_id as addressId,diliveryman_id as diliverymanId,is_platform_in as isPlatformIn,platform_in_reason as platformInReason,platform_state as platformState,return_type as returnType,refund_shipping_type as refundShippingType,goods_state as goodsState,buyer_name as buyerName';
private $order;
......@@ -216,12 +216,17 @@ class RefundServiceModel extends \Business\AbstractModel
$refundReturnDao = \DAO\Order\RefundReturnModel::getInstance(DbNameConst::masterDBConnectName);
$returnDetail=$refundReturnDao->findByRefundId($refundId,$refundReturnDao->refundDetailField);
$storeDao=\DAO\StoreModel::getInstance(DbNameConst::masterDBConnectName);
$orderGoodsDao=\DAO\Order\OrderGoodsModel::getInstance();
if($returnDetail['storeId']!=$storeId){
ErrorModel::throwException(CodeConfigModel::notExistRefund);
}$updateData=array();
$updateData['is_suc_refund']=ApiConst::refundSuccess;
$updateData['refund_type']=ApiConst::refundStateComplete;
$updateData['refund_state']=ApiConst::refundStateComplete;
$res=$refundReturnDao->update(array('refund_id'=>$refundId), $updateData);
$goodsUpdateData['is_refund']=ApiConst::refundSuccess;
$goodsUpdateData['refund_state_name']=DescribeConst::refundSuccess;
$orderGoodsWhere['rec_id']=$returnDetail['orderGoodsId'];
$orderGoodsDao->update($orderGoodsWhere,$goodsUpdateData);
\Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$refundReturnDao, 'getList'), array(), array($refundId));
$storeDao->deleteStoreCache($storeId,$refundId);
$storeDao->deleteStoreRefundCache($storeId,$refundId);
......@@ -737,6 +742,7 @@ class RefundServiceModel extends \Business\AbstractModel
$value['deliveryTimeEnd'] = $value['deliveryTime'] + ApiConst::arriveTimeRadius;
$value['goodsImage'] = ImageUtil::getGoodsImgUrl($value['goodsImage'], ApiConst::goodsSmallSize);
$value['goodsAttr']=$goodsDao->getFormatGoodsAttr($value['goodsSpec']);
$value['finnshedTime']=$orders[$value['orderId']]['finnshedTime'];
$extent=$orderDao->getClienOrderCommon($orders[$value['orderId']]);
$value=array_merge($value,$extent);
$goodGroup=unserialize($value['goodsGroup']);
......@@ -1037,7 +1043,8 @@ class RefundServiceModel extends \Business\AbstractModel
}
} else {
$refundAmount = $orderGoods['goodsPrice']*$orderGoods['goodsNum'];
//$refundAmount = $orderGoods['goodsPrice']*$orderGoods['goodsNum'];
$refundAmount =$orderInfo['orderAmount'];
}
$returnData['refundAmount'] = $refundAmount - $orderInfo['refundAmount'] - $returnData['needShippingFee'] + $shippingFee;
if((int)$returnData['refundAmount'] <ApiConst::zero){
......
......@@ -61,6 +61,7 @@ class DeliveryServiceModel extends \Business\AbstractModel
$orderRes= $refundReturnDao->update($returnWhere,$orderData);
}else{
$orderData['order_state']=ApiConst::orderStateWaitRecieve;
$orderData['send_time']=TIMESTAMP;
$orderRes = $orderDao->updateByOrderId($orderData, $data['orderId']);
}
......@@ -145,6 +146,7 @@ class DeliveryServiceModel extends \Business\AbstractModel
}
$memberData['diliveryman_id']=$resData;
$memberDao->saveInfo($memberData,$member['memberId']);
// $memberDb0Redis=\Redis\Db0\MemberRedisModel::getInstance();
// $memberDb0Redis->tableHSet(trim($member['diliveryman_id']),$resData,ApiConst::tenDaySecond);
return $resData;
......
......@@ -276,7 +276,9 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
'orderId'=>$order['order_id']));
$push->addOneToClient($pushData);
$push->sendTcpMessage();
$push->addOneToClient();
$messageService=\Business\Message\MessageServiceModel::getInstance();
$messageService->addMessageCenterToDb();
// $push->addOneToClient();
// \Our\RedisHelper::rpush('client_push',array('storeId'=>$order['storeId'],'type'=>ApiConst::messageWaitReceive,'op'=>NameConst::reduce,'num'=>ApiConst::one,'params'=>array('c'=>'shopkeeper','m'=>'orderDetail','orderId'=>$order['orderId'])));
//\Our\RedisHelper::rpush('client_push',array('storeId'=>$order['storeId'],'type'=>$type,'op'=>NameConst::add,'num'=>ApiConst::one,'params'=>array('c'=>'shopkeeper','m'=>'orderDetail','orderId'=>$order['orderId'])));
$orderDao->deleteOrderCache($order['buyer_id'], $orderId, $order['store_id'], true);
......@@ -662,31 +664,30 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$this->taskIndex = PageConst::taskPageBegin;
$this->taskSize = PageConst::taskPageSize;
do {
$storeMemberStatisticData = $orderDao->getMemberStoreStaticsByCreateTime($beginTime, $this->taskIndex, $this->taskSize);
$orders = isset($storeMemberStatisticData['list']) ? $storeMemberStatisticData['list'] : false;
$storeMemberStatisticsDatas=array();
if ($orders) {
$storeMemberStatisticDatas = $orderDao->getMemberStoreStaticsByCreateTime($beginTime, $this->taskIndex, $this->taskSize);
$orders = isset($storeMemberStatisticDatas['list']) ? $storeMemberStatisticDatas['list'] : false;
$this->taskIndex++;
if ($orders) {
foreach($orders as $order){
$storeMemberStatisticsData['store_id']=$order['storeId'];
$storeMemberStatisticsData['member_id']=$order['memberId'];
$orderRes=$orderDao->getSumAmountCountByMemberIdAndStoreId($storeMemberStatisticsData['store_id'],$storeMemberStatisticsData['member_id']);
$storeMemberStatisticsData['order_total']=$orderRes['orderTotal']?$orderRes['orderTotal']:ApiConst::zero;
$orderGoodsRes=$orderGoodDao->getOrderGoodsCountBuyStoreIdAndMemberId( $storeMemberStatisticsData['store_id'],$storeMemberStatisticsData['member_id']);
$storeMemberStatisticsData['storeId']=$order['storeId'];
$storeMemberStatisticsData['buyerId']=$order['buyerId'];
$orderRes=$orderDao->getSumAmountCountByMemberIdAndStoreId($storeMemberStatisticsData['storeId'],$storeMemberStatisticsData['buyerId']);
$storeMemberStatisticsData['orderTotal']=$orderRes['orderTotal']?$orderRes['orderTotal']:ApiConst::zero;
$orderGoodsRes=$orderGoodDao->getOrderGoodsCountBuyStoreIdAndMemberId( $storeMemberStatisticsData['storeId'],$storeMemberStatisticsData['buyerId']);
$orderGoodsCount=$orderGoodsRes?$orderGoodsRes['orderGoodsCount']:ApiConst::zero;
$storeMemberStatisticsData['order_goods_count']=$orderGoodsCount;
$storeMemberStatisticsData['add_time']=TIMESTAMP;
array_push($storeMemberStatisticsDatas,$storeMemberStatisticsData);
$storeMemberStatisticsData['orderGoodsCount']=$orderGoodsCount;
$storeMemberStatisticsData['addTime']=TIMESTAMP;
try{
$storeMemberStatisticDao->addOrUpdate($storeMemberStatisticsData);
}catch(\Exception $ex){
echo $ex->getMessage().json_encode($storeMemberStatisticsData)."\r\n";
}
}
} while ($storeMemberStatisticData);
if(!empty($storeMemberStatisticsDatas)){
$storeMemberStatisticDao->addAll($storeMemberStatisticsDatas);
}
echo $this->taskIndex;
} while ($orders);
echo 234234;exit;
file_put_contents($this->baseDir . PathConst::orderGoodsCreateTime, TIMESTAMP);
}
//任务脚本原来的方法是下面那个
// public function insertStoreMemberStatics()
......
......@@ -199,8 +199,8 @@ class StoreServiceModel extends \Business\AbstractModel{
$sale = \DAO\SaleModel::getInstance()->getOne(array('sale_id'=>$param['sid']),'sale_act_id,member_id');
if($sale) {
$sale_act = \DAO\SaleActivityModel::getInstance()->getOne(array('sale_act_id'=>$sale['sale_act_id'],'sale_act_state'=>1),'*');
if($sale_act && $sale_act['sale_start_date'] >= time() && $sale_act['sale_end_date'] <= time()){
\DAO\SaleMemberModel::getInstance()->insertOrUpdate(array('sale_id'=>$sale['member_id'],'sale_act_id'=>$sale['sale_act_id'],'member_id'=>$memberId,'store_id'=>$storeId));
if($sale_act && $sale_act['sale_start_date'] <= time() && $sale_act['sale_end_date'] >= time()){
$result = \DAO\SaleMemberModel::getInstance()->insertOrUpdate(array('sale_id'=>$sale['member_id'],'sale_act_id'=>$sale['sale_act_id'],'member_id'=>$memberId,'store_id'=>$sale_act['store_id']));
\Redis\Db4\SaleActivityRedisModel::getInstance()->tableDel('storeId:'.$storeId);
}
}
......@@ -866,11 +866,23 @@ class StoreServiceModel extends \Business\AbstractModel{
$returnStores['stores'][] =$purchasedStore;
}
}
if($returnStores['stores']){
foreach($returnStores['stores'] as $key => $tempStore){
$tempDistance[$key] = $tempStore['storeDistance'];
}
array_multisort($tempDistance, SORT_ASC, $returnStores['stores']);
$return[] = $returnStores;
}
}
if($return){
$tempReturn = array();
foreach($return as $tempVal){
$distance = min(array_column($tempVal['stores'],'storeDistance'));
$tempReturn[$distance] = $tempVal;
}
ksort($tempReturn);
$return = array_values($tempReturn);
return $return;
}
}
......
......@@ -386,7 +386,8 @@ class MemberServiceModel extends \Business\AbstractModel
$saleIds = array_keys($scan_sale_ids);
$saleList = \DAO\SaleModel::getInstance()->getList(array('sale_id'=>array('in',$saleIds)),'sale_id,sale_act_id,member_id');
$saleMembers = array();
foreach($saleList as $sale){
if($saleList&&$saleList['list']){
foreach($saleList['list'] as $sale){
$saleMember = array();
$saleMember['member_id'] = $memberId;
$saleMember['store_id'] = $scan_sale_ids[$sale['sale_id']];
......@@ -397,6 +398,7 @@ class MemberServiceModel extends \Business\AbstractModel
$resultSaleMember = \DAO\SaleMemberModel::getInstance()->insertAllOrUpdate($saleMembers);
return $resultSaleMember;
}
}
return true;
}
......
......@@ -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,shipping_arrival_time as shippingArrivalTime,delivery_time as deliveryTime,order_note as orderNote';
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,delivery_time as deliveryTime,order_note as orderNote,send_time as sendTime';
}
public function getOrderShippingField()
......
......@@ -259,7 +259,7 @@ class OrderGoodsModel extends \DAO\AbstractModel {
$where['buyer_id']=array('eq',$memberId);
$where['is_refund']=array('neq',ApiConst::refundSuccess);
$where=$this->db->getSqlWhereByArray($where);
$res=$this->db->from($this->_tableName)->select($this->sumGoodsNum)->where($where)->group("buyer_id")->group("store_id")->fetchAll();
$res=$this->db->from($this->_tableName)->select($this->sumGoodsNum)->where($where)->group("buyer_id")->group("store_id")->fetchOne();
return $res?$res:array();
}
......
......@@ -168,7 +168,19 @@ class StoreMemberStatisticsModel extends \DAO\AbstractModel {
}
return $result;
}
//插入数据大量
public function addOrUpdate($data)
{
$this->setDb(DbNameConst::masterDBConnectName);
$error = 0;
$baseSql = "insert into {$this->_tableName}({$this->insertField}) values";
$addSql = \Our\Common::format("({0},{1},{2},{3},{4}) ", $data['storeId'], $data['buyerId'],$data['orderGoodsCount'], $data['orderTotal'],TIMESTAMP);
$extentSql=" ON DUPLICATE KEY UPDATE order_goods_count=values(order_goods_count),order_total=values(order_total),add_time=".TIMESTAMP;
$excuteSql=$baseSql.$addSql.$extentSql;
$one = $this->db->insert($this->_tableName)->query($excuteSql);
return $one;
}
//插入数据大量
public function addAll($datas,$field="orderGoodsCount")
{
......
......@@ -45,6 +45,7 @@ class DeliveryController extends \Our\Controller_AbstractClient {
*/
public function getDeliveriersAction(){
$result = $this->shopkeeperService->getDiliveryManByStoreId($this->memberId);
$result=$result?$result:[];
if($result!==false){
$this->success($result,\Our\DescribeConst::successMessage,\Our\DescribeConst::successMessage);
}
......@@ -67,7 +68,9 @@ class DeliveryController extends \Our\Controller_AbstractClient {
$deliveryService=\Business\Store\DeliveryServiceModel::getInstance();
$trueName=$this->req['data']['trueName'];
$memberMobile=$this->req['data']['memberMobile'];
$result =$deliveryService->addDeleiveryMan($this->storeId,$memberMobile,$trueName);
$this->req[NameConst::data]['memberId']=$result;
if($result!==false){
$this->success($result,\Our\DescribeConst::successMessage,\Our\DescribeConst::successMessage);
}
......
......@@ -156,6 +156,9 @@ class ShopkeeperController extends \Our\Controller_AbstractClient {
public function getDeliveriersAction(){
$result = $this->shopkeeperService->getDiliveryManByStoreId($this->memberId);
if($result!==false){
if(!$result){
$result=[];
}
$this->success($result,\Our\DescribeConst::successMessage,\Our\DescribeConst::successMessage);
}
ErrorModel::throwException(CodeConfigModel::commonError);
......
......@@ -37,7 +37,7 @@ class UserController extends \Our\Controller_AbstractIndex {
if(!empty($seller)){
$mobile=$seller['memberMobile'];
$mobile=$sellerName;
$isStore=$this->memberService->getOneByStoreId($seller['storeId']);
if(empty($isStore)){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::storeIsRefuse);
......@@ -47,8 +47,10 @@ class UserController extends \Our\Controller_AbstractIndex {
}else{
\Error\ErrorModel::throwException(\Error\CodeConfigModel::errorUsernameOrPassword);
}
if($this->memberService->checkUserNamePassWord($mobile,$password)){
if($this->memberService->checkUserNamePassWord($sellerName,$password)){
$member= $this->memberService->getOneByMobileAndPassword($mobile,$password);
//$member= $this->memberService->getOneByMobileAndPassword($mobile,$password);
// //第二步保存扫码会员信息
// $result = $this->memberService->saveStoreMembers($member['member_id']);
// if(!$result){
......
......@@ -55,7 +55,7 @@ config.url.convert=/usr/local/bin/wkhtmltoimage
config.url.resourcesHost = "http://apitest.shenbd.com"
; 用户中心host
config.url.userHost = ""
config.url.ossHost = "https://img.shenbd.com"
config.url.ossHost = "https://imgpre.shenbd.com"
; oss 域名
;config.url.ossHost = "https://qmoss-01.oss-cn-hangzhou.aliyuncs.com"
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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