Commit 7748b87a authored by wwccw0591's avatar wwccw0591

Merge branch 'master_dev' of git.shenbd.com:qm-develop/shenbd into linqing

parents df28dae1 434102e1
...@@ -21,6 +21,14 @@ class IndexController extends \Our\Controller_Abstract { ...@@ -21,6 +21,14 @@ class IndexController extends \Our\Controller_Abstract {
return false; return false;
} }
public function getQrcodeFlowAction(){
$imageKey=$_GET['imageKey'];
$memberDb0Redis=\Redis\Db0\MemberRedisModel::getInstance();
$imageFlow=$memberDb0Redis->tableCacheGet($imageKey);
header('Content-type: image/jpg');
echo $imageFlow;
exit;
}
public function getHtmlAction(){ public function getHtmlAction(){
$this->req=$this->getRequest()->getQuery(); $this->req=$this->getRequest()->getQuery();
$postData=$this->req; $postData=$this->req;
...@@ -37,7 +45,7 @@ class IndexController extends \Our\Controller_Abstract { ...@@ -37,7 +45,7 @@ class IndexController extends \Our\Controller_Abstract {
} }
$this->memberDb0Redis=\Redis\Db0\MemberRedisModel::getInstance(); $this->memberDb0Redis=\Redis\Db0\MemberRedisModel::getInstance();
$paramsStr= $this->memberDb0Redis->tablelpop($this->key); $paramsStr= $this->memberDb0Redis->tableCacheGet($this->key);
if($_GET['debug']==1){ if($_GET['debug']==1){
$paramsStr='{ $paramsStr='{
"desc": "最优质的产品,最实惠的价格,最好的服务质量,欢迎选购", "desc": "最优质的产品,最实惠的价格,最好的服务质量,欢迎选购",
......
...@@ -720,7 +720,11 @@ class OrderConfirmUtil { ...@@ -720,7 +720,11 @@ class OrderConfirmUtil {
public function delCouponCahce(){ public function delCouponCahce(){
$memberCouponDao = \DAO\Coupon\MemberCouponModel::getInstance(); $memberCouponDao = \DAO\Coupon\MemberCouponModel::getInstance();
$couponService = \Business\Coupon\CouponServiceModel::getInstance();
\Our\RedisHelper::delCachedFunction(\Redis\Db13\MemberCouponRedisModel::getInstance(),array(&$memberCouponDao, 'getList'),array(),array($this->memberId)); \Our\RedisHelper::delCachedFunction(\Redis\Db13\MemberCouponRedisModel::getInstance(),array(&$memberCouponDao, 'getList'),array(),array($this->memberId));
foreach($this->storeIds as $tempStoreId){
\Our\RedisHelper::delCachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$couponService, 'getStoreCouponsById'),array(),array($tempStoreId."_".$this->memberId));
}
} }
public function delCartCache(){ public function delCartCache(){
...@@ -1227,12 +1231,12 @@ class OrderConfirmUtil { ...@@ -1227,12 +1231,12 @@ class OrderConfirmUtil {
} }
} }
} }
$storeGoodsList['gcPrices'] = isset($storeGcCouponPriceArray); $storeGoodsList['gcPrices'] = isset($storeGcCouponPriceArray)?$storeGcCouponPriceArray:array();
$storeGoodsList['goodsCommonPrices'] = $storeGoodsCommonCouponPriceArray; $storeGoodsList['goodsCommonPrices'] = $storeGoodsCommonCouponPriceArray;
$storeGoodsList['storeCouponPrice'] = $storeCouponPrice; $storeGoodsList['storeCouponPrice'] = $storeCouponPrice;
$reliefAmount = $cartService->getOneCouponReliefAmount($coupon,$storeGoodsList); $reliefAmount = $cartService->getOneCouponReliefAmount($coupon,$storeGoodsList);
if($reliefAmount&&$reliefAmount>\Our\ApiConst::zero){ if($reliefAmount&&$reliefAmount>\Our\ApiConst::zero){
$totalPrice = $totalPrice-$reliefAmount; $totalPrice = ($reliefAmount > $totalPrice)? 0 : ($totalPrice-$reliefAmount);
} }
return $totalPrice; return $totalPrice;
} }
......
...@@ -312,6 +312,7 @@ class ApiConst ...@@ -312,6 +312,7 @@ class ApiConst
const signClassStyle = 2; const signClassStyle = 2;
const isEffective=0; const isEffective=0;
const notEffectiveAllRefund=3;
const defaultAddressCount = 3; const defaultAddressCount = 3;
...@@ -368,7 +369,7 @@ class ApiConst ...@@ -368,7 +369,7 @@ class ApiConst
//等于0表示没有选中地址时是选中当前传入经纬度,等于1表示没有命中地址是选中地址列表中按照is_default desc,address_id desc倒序的第一条地址 //等于0表示没有选中地址时是选中当前传入经纬度,等于1表示没有命中地址是选中地址列表中按照is_default desc,address_id desc倒序的第一条地址
const defaultAddressRoute = 0; const defaultAddressRoute = 0;
const shareLimitProgrameError=40001;
const addGoodsToCart = 1; //将商品加入购物车 const addGoodsToCart = 1; //将商品加入购物车
const addBundingToCart = 2; //将组合销售商品加入购物车 const addBundingToCart = 2; //将组合销售商品加入购物车
const positionPickupCodeBegin=12; const positionPickupCodeBegin=12;
...@@ -430,7 +431,7 @@ class ApiConst ...@@ -430,7 +431,7 @@ class ApiConst
const xpClientAppVersionOnline='1.0.0'; const xpClientAppVersionOnline='1.0.0';
const winClientAppVersionOnline='1.0.0'; const winClientAppVersionOnline='1.0.0';
//微信小是否发布 //微信小是否发布
const isWxPublish = 0; const isWxPublish = 1;
//消息模板类型 //消息模板类型
const reachRemindMessageType = 1; const reachRemindMessageType = 1;
......
...@@ -4,7 +4,8 @@ namespace Our; ...@@ -4,7 +4,8 @@ namespace Our;
class Common class Common
{ {
public static $requestTime; public static $requestTime;
/** /**
* 获取http状态码 * 获取http状态码
* *
...@@ -58,40 +59,42 @@ class Common ...@@ -58,40 +59,42 @@ class Common
return isset($httpStatusCodes[$num]) ? $httpStatusCodes[$num] : ''; return isset($httpStatusCodes[$num]) ? $httpStatusCodes[$num] : '';
} }
public static function isCurentTimeInSection($begin,$end) public static function isCurentTimeInSection($begin, $end)
{ {
$checkDayStr = date('Y-m-d ',time()); $checkDayStr = date('Y-m-d ', time());
$timeBegin1 = strtotime($checkDayStr.$begin.":00"); $timeBegin1 = strtotime($checkDayStr . $begin . ":00");
$timeEnd1 = strtotime($checkDayStr.$end.":00"); $timeEnd1 = strtotime($checkDayStr . $end . ":00");
$curr_time = time(); $curr_time = time();
if($curr_time >= $timeBegin1 && $curr_time <= $timeEnd1) if ($curr_time >= $timeBegin1 && $curr_time <= $timeEnd1) {
{
return true; return true;
} }
return false; return false;
} }
public static function isSerialized( $data ) {
$data = trim( $data ); public static function isSerialized($data)
if ( 'N;' == $data ) {
$data = trim($data);
if ('N;' == $data)
return true; return true;
if ( !preg_match( '/^([adObis]):/', $data, $badions ) ) if (!preg_match('/^([adObis]):/', $data, $badions))
return false; return false;
switch ( $badions[1] ) { switch ($badions[1]) {
case 'a' : case 'a' :
case 'O' : case 'O' :
case 's' : case 's' :
if ( preg_match( "/^{$badions[1]}:[0-9]+:.*[;}]\$/s", $data ) ) if (preg_match("/^{$badions[1]}:[0-9]+:.*[;}]\$/s", $data))
return true; return true;
break; break;
case 'b' : case 'b' :
case 'i' : case 'i' :
case 'd' : case 'd' :
if ( preg_match( "/^{$badions[1]}:[0-9.E-]+;\$/", $data ) ) if (preg_match("/^{$badions[1]}:[0-9.E-]+;\$/", $data))
return true; return true;
break; break;
} }
return false; return false;
} }
/** /**
* 获取客户端IP * 获取客户端IP
* *
...@@ -120,41 +123,46 @@ class Common ...@@ -120,41 +123,46 @@ class Common
{ {
return 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; return 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
} }
public static function getConfig($key){
$config=\Yaf\Registry::get('config'); public static function getConfig($key)
$configValue=$config->get($key); {
$config = \Yaf\Registry::get('config');
$configValue = $config->get($key);
return $configValue; return $configValue;
} }
public static function getBaseUrl(){ public static function getBaseUrl()
{
$prefix = 'http'; $prefix = 'http';
if(self::is_https()){ if (self::is_https()) {
$prefix = 'https'; $prefix = 'https';
} }
$url = $prefix.'://'.$_SERVER['SERVER_NAME']; $url = $prefix . '://' . $_SERVER['SERVER_NAME'];
return $url; return $url;
} }
public static function is_https() { public static function is_https()
if ( !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') { {
if (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') {
return true; return true;
} elseif ( isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' ) { } elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
return true; return true;
} elseif ( !empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off') { } elseif (!empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off') {
return true; return true;
}elseif($_SERVER['SERVER_PORT'] == 89){ } elseif ($_SERVER['SERVER_PORT'] == 89) {
return true; return true;
} }
return false; return false;
} }
/** /**
* 获取静态资源文件 * 获取静态资源文件
* *
* @param unknown_type $filename * @param unknown_type $filename
*/ */
public static function getStaticFile($filename,$directory='image/',$urlName='ossHost') public static function getStaticFile($filename, $directory = 'image/', $urlName = 'ossHost')
{ {
$files = array(); $files = array();
$static = array(); $static = array();
...@@ -197,12 +205,12 @@ class Common ...@@ -197,12 +205,12 @@ class Common
case '.png' : case '.png' :
case '.apk' : case '.apk' :
foreach ($files as $f) { foreach ($files as $f) {
$output = $staticUrl . '/' .$directory . $f; $output = $staticUrl . '/' . $directory . $f;
} }
break; break;
default: default:
foreach ($files as $f) { foreach ($files as $f) {
$output = $staticUrl . '/' .$directory . $f.\Our\NameConst::jpgSuffix; $output = $staticUrl . '/' . $directory . $f . \Our\NameConst::jpgSuffix;
} }
break; break;
} }
...@@ -222,7 +230,6 @@ class Common ...@@ -222,7 +230,6 @@ class Common
} }
public static function generatePassword($length = 8) public static function generatePassword($length = 8)
{ {
// 密码字符集,可任意添加你需要的字符 // 密码字符集,可任意添加你需要的字符
...@@ -243,17 +250,17 @@ class Common ...@@ -243,17 +250,17 @@ class Common
*/ */
public static function bulidToken($mobilePhone = null, $password = null, $zenid = null, $iso = null) public static function bulidToken($mobilePhone = null, $password = null, $zenid = null, $iso = null)
{ {
$bassStr=self::getClientIp(); $bassStr = self::getClientIp();
if($zenid){ if ($zenid) {
$bassStr.=$zenid; $bassStr .= $zenid;
} }
if($iso){ if ($iso) {
$bassStr.=$zenid; $bassStr .= $zenid;
} }
if (empty($mobilePhone) || empty($password)) { if (empty($mobilePhone) || empty($password)) {
$md5Key=md5($bassStr.TIMESTAMP); $md5Key = md5($bassStr . TIMESTAMP);
}else{ } else {
$md5Key=md5($bassStr.self::generatePassword(ApiConst::randLengh).TIMESTAMP); $md5Key = md5($bassStr . self::generatePassword(ApiConst::randLengh) . TIMESTAMP);
} }
return $md5Key; return $md5Key;
} }
...@@ -263,34 +270,49 @@ class Common ...@@ -263,34 +270,49 @@ class Common
* @param unknown $phone * @param unknown $phone
* @return boolean * @return boolean
*/ */
public static function checkMobilePhone($phone){ public static function checkMobilePhone($phone)
if( empty($phone) ){ {
if (empty($phone)) {
return false; return false;
} }
if( !preg_match('/^1[3456789]\d{9}$/', $phone) ){ if (!preg_match('/^1[3456789]\d{9}$/', $phone)) {
return false; return false;
} }
return true; return true;
} }
public static function getRealStr($originStr){
$result=str_replace(array("\r\n", "\r", "\n"), "", $originStr); public static function getRealStr($originStr)
$result=trim($result); {
$result = str_replace(array("\r\n", "\r", "\n"), "", $originStr);
$result = trim($result);
return $result; return $result;
} }
public static function getDivNum($num){
return bcdiv($num,100,2); public static function getDivNum($num)
{
return bcdiv($num, 100, 2);
}
public static function mutiplicative($num)
{
return intval(bcmul($num, \Our\ApiConst::oneHandred));
} }
public static function mutiplicative($num){
return intval(bcmul($num, \Our\ApiConst::oneHandred)); public static function isJson($string)
{
json_decode($string);
return (json_last_error() == JSON_ERROR_NONE);
} }
/** /**
* sql字符串格式化 * sql字符串格式化
* @param unknown $phone * @param unknown $phone
* @return boolean * @return boolean
*/ */
public static function format() { public static function format()
{
$args = func_get_args(); $args = func_get_args();
if (count($args) == 0) { if (count($args) == 0) {
return; return;
...@@ -302,45 +324,58 @@ class Common ...@@ -302,45 +324,58 @@ class Common
$str = preg_replace_callback('/\\{(0|[1-9]\\d*)\\}/', create_function('$match', '$args = ' . var_export($args, true) . '; return isset($args[$match[1]]) ? $args[$match[1]] : $match[0];'), $str); $str = preg_replace_callback('/\\{(0|[1-9]\\d*)\\}/', create_function('$match', '$args = ' . var_export($args, true) . '; return isset($args[$match[1]]) ? $args[$match[1]] : $match[0];'), $str);
return $str; return $str;
} }
// //
public static function getDriverType($isstring=false){ public static function getDriverType($isstring = false)
{
$agent = strtolower($_SERVER['HTTP_USER_AGENT']); $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
//分析数据 //分析数据
$is_wx=(strpos($agent, 'miniprogram')||strpos($agent, 'micromessenger')) ? true : false; $is_wx = (strpos($agent, 'miniprogram') || strpos($agent, 'micromessenger')) ? true : false;
$is_pc = (strpos($agent, 'windows nt')) ? true : false; $is_pc = (strpos($agent, 'windows nt')) ? true : false;
$is_iphone = (strpos($agent, 'iphone')) ? true : false; $is_iphone = (strpos($agent, 'iphone')) ? true : false;
$is_ipad = (strpos($agent, 'ipad')) ? true : false; $is_ipad = (strpos($agent, 'ipad')) ? true : false;
//$is_android = (strpos($agent, 'android')) ? true : false; //$is_android = (strpos($agent, 'android')) ? true : false;
//输出数据 //输出数据
$driverType=ApiConst::adroidType; $driverType = ApiConst::adroidType;
if($is_pc){ if ($is_pc) {
$driverType=ApiConst::pcType; $driverType = ApiConst::pcType;
} }
if($is_iphone){ if ($is_iphone) {
$driverType=ApiConst::iphoneType; $driverType = ApiConst::iphoneType;
} }
if($is_ipad){ if ($is_ipad) {
$driverType=ApiConst::ipadType; $driverType = ApiConst::ipadType;
} }
if($is_wx){ if ($is_wx) {
$driverType=ApiConst::wxType; $driverType = ApiConst::wxType;
} }
if($isstring){ if ($isstring) {
switch($driverType){ switch ($driverType) {
case ApiConst::pcType:$driverType=NameConst::pc;break; case ApiConst::pcType:
case ApiConst::iphoneType:$driverType=NameConst::iphone;break; $driverType = NameConst::pc;
case ApiConst::adroidType:$driverType=NameConst::android;break; break;
case ApiConst::ipadType:$driverType=NameConst::ipad;break; case ApiConst::iphoneType:
default:ApiConst::zero;break; $driverType = NameConst::iphone;
break;
case ApiConst::adroidType:
$driverType = NameConst::android;
break;
case ApiConst::ipadType:
$driverType = NameConst::ipad;
break;
default:
ApiConst::zero;
break;
} }
} }
return $driverType; return $driverType;
} }
public static function getIdentify(){ public static function getIdentify()
return self::getClientIp().'-'.self::getDriverType(); {
return self::getClientIp() . '-' . self::getDriverType();
} }
/** /**
...@@ -350,33 +385,38 @@ class Common ...@@ -350,33 +385,38 @@ class Common
*/ */
public static function underlineToHump($str) public static function underlineToHump($str)
{ {
$str = preg_replace_callback('/([-_]+([a-z]{1}))/i',function($matches){ $str = preg_replace_callback('/([-_]+([a-z]{1}))/i', function ($matches) {
return strtoupper($matches[2]); return strtoupper($matches[2]);
},$str); }, $str);
return $str; return $str;
} }
/** /**
* 驼峰转下划线 * 驼峰转下划线
*/ */
public static function humpToLine($str){ public static function humpToLine($str)
$str = preg_replace_callback('/([A-Z]{1})/',function($matches){ {
return '_'.strtolower($matches[0]); $str = preg_replace_callback('/([A-Z]{1})/', function ($matches) {
},$str); return '_' . strtolower($matches[0]);
}, $str);
return $str; return $str;
} }
public static function getTodayBeginTimpSpan(){
$totayTimeSpan=strtotime(date('Y-m-d')); public static function getTodayBeginTimpSpan()
{
$totayTimeSpan = strtotime(date('Y-m-d'));
return $totayTimeSpan; return $totayTimeSpan;
} }
/** /**
* 驼峰数组转下划线数组 * 驼峰数组转下划线数组
* @param array $data * @param array $data
* @return array * @return array
*/ */
public static function convertHump($data = array()){ public static function convertHump($data = array())
{
$result = []; $result = [];
if($data){ if ($data) {
foreach ($data as $key => $item) { foreach ($data as $key => $item) {
if (is_array($item) || is_object($item)) { if (is_array($item) || is_object($item)) {
$result[self::humpToLine($key)] = self::convertHump((array)$item); $result[self::humpToLine($key)] = self::convertHump((array)$item);
...@@ -394,9 +434,10 @@ class Common ...@@ -394,9 +434,10 @@ class Common
* @param array $data * @param array $data
* @return array * @return array
*/ */
public static function convertUnderline( $data=array()){ public static function convertUnderline($data = array())
{
$result = []; $result = [];
if($data){ if ($data) {
foreach ($data as $key => $item) { foreach ($data as $key => $item) {
if (is_array($item) || is_object($item)) { if (is_array($item) || is_object($item)) {
$result[self::underlineToHump($key)] = self::convertUnderline((array)$item); $result[self::underlineToHump($key)] = self::convertUnderline((array)$item);
...@@ -412,19 +453,19 @@ class Common ...@@ -412,19 +453,19 @@ class Common
public static function sendTcpMessage($data, $uid = false) public static function sendTcpMessage($data, $uid = false)
{ {
$push= \Yaf\Registry::get("push"); $push = \Yaf\Registry::get("push");
if($push['open']){ if ($push['open']) {
$argv = $GLOBALS['argv']; $argv = $GLOBALS['argv'];
$isDebug = isset($argv[1]) ? intval($argv[1]) : false; $isDebug = isset($argv[1]) ? intval($argv[1]) : false;
$message['data']=$data; $message['data'] = $data;
$message['uid']=$uid; $message['uid'] = $uid;
$message = json_encode($message); $message = json_encode($message);
$message = $message . "\r\n"; $message = $message . "\r\n";
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if(!@socket_connect($socket, $push['host'], $push['port'])){ if (!@socket_connect($socket, $push['host'], $push['port'])) {
return false; return false;
} }
// @socket_connect($socket, $push['host'], $push['port']) or die("推送连接失败"); // @socket_connect($socket, $push['host'], $push['port']) or die("推送连接失败");
$num = 0; $num = 0;
$length = strlen($message); $length = strlen($message);
do { do {
...@@ -448,34 +489,38 @@ class Common ...@@ -448,34 +489,38 @@ class Common
return $server_data['data']['error_code']; return $server_data['data']['error_code'];
} }
} }
}else{ } else {
return false; return false;
} }
} }
public static function getSortArr($sortArray){
public static function getSortArr($sortArray)
{
ksort($sortArray); ksort($sortArray);
$str=''; $str = '';
foreach($sortArray as $val){ foreach ($sortArray as $val) {
$str.=$val; $str .= $val;
} }
return $str; return $str;
} }
//合并一对多列表 //合并一对多列表
public static function intergrateOneToMany($list1,$list2,$mergekey1,$mergekey2,$listName='orderGoods',$sortField='gmtUpdate'){ public static function intergrateOneToMany($list1, $list2, $mergekey1, $mergekey2, $listName = 'orderGoods', $sortField = 'gmtUpdate')
$mergeArray=array(); {
$list2key=array(); $mergeArray = array();
foreach($list1 as $value){ $list2key = array();
$list2key[$value[$mergekey1]]=$value; foreach ($list1 as $value) {
} $list2key[$value[$mergekey1]] = $value;
$value[$listName]=array(); }
foreach($list2 as &$value){ $value[$listName] = array();
if(isset($list2key[$value[$mergekey2]])&&!empty($list2key[$value[$mergekey2]])){ foreach ($list2 as &$value) {
$list2key[$value[$mergekey2]][$listName][]=$value; if (isset($list2key[$value[$mergekey2]]) && !empty($list2key[$value[$mergekey2]])) {
$list2key[$value[$mergekey2]][$listName][] = $value;
} }
} }
$orders=array_values($list2key); $orders = array_values($list2key);
array_multisort(array_column($orders,$sortField),SORT_DESC,$orders); array_multisort(array_column($orders, $sortField), SORT_DESC, $orders);
return $orders; return $orders;
} }
// //合并一对多列表 // //合并一对多列表
...@@ -496,45 +541,47 @@ class Common ...@@ -496,45 +541,47 @@ class Common
// } // }
//合并一对一数组 //合并一对一数组
//合并一对多列表 //合并一对多列表
public static function intergrateOneToOne($list1,$list2,$mergekey1,$mergekey2){ public static function intergrateOneToOne($list1, $list2, $mergekey1, $mergekey2)
$mergeArray=array(); {
$list2key=array(); $mergeArray = array();
foreach($list2 as $value){ $list2key = array();
$list2key[$value[$mergekey2]]=$value; foreach ($list2 as $value) {
} $list2key[$value[$mergekey2]] = $value;
foreach($list1 as &$value){ }
if(isset($list2key[$value[$mergekey1]])&&!empty($list2key[$value[$mergekey1]])){ foreach ($list1 as &$value) {
$value=array_merge($value,$list2key[$value[$mergekey1]]); if (isset($list2key[$value[$mergekey1]]) && !empty($list2key[$value[$mergekey1]])) {
$value = array_merge($value, $list2key[$value[$mergekey1]]);
} }
array_push($mergeArray,$value); array_push($mergeArray, $value);
} }
return $mergeArray; return $mergeArray;
} }
public static function sendurl($url,$access_token='',$data,$method='get') { public static function sendurl($url, $access_token = '', $data, $method = 'get')
{
//$data = str_replace("\'","'",$data); //$data = str_replace("\'","'",$data);
if(strtolower($method)=='post') { if (strtolower($method) == 'post') {
$curl = curl_init(); $curl = curl_init();
curl_setopt($curl,CURLOPT_URL,$url.$access_token); curl_setopt($curl, CURLOPT_URL, $url . $access_token);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
} else { } else {
$curl = curl_init($url.$access_token); $curl = curl_init($url . $access_token);
} }
//$curl = curl_init($url.$access_token); //$curl = curl_init($url.$access_token);
curl_setopt($curl,CURLOPT_FAILONERROR,1); curl_setopt($curl, CURLOPT_FAILONERROR, 1);
//设置允许页面重定向 //设置允许页面重定向
curl_setopt($curl,CURLOPT_FOLLOWLOCATION,1); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
//设置返回值赋给变量 //设置返回值赋给变量
curl_setopt($curl,CURLOPT_RETURNTRANSFER,1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
//设置操作时间 //设置操作时间
curl_setopt($curl,CURLOPT_TIMEOUT,5); curl_setopt($curl, CURLOPT_TIMEOUT, 5);
if($method=='post'){ if ($method == 'post') {
if(!$data) $data=''; if (!$data) $data = '';
// 使用post 请 // 使用post 请
curl_setopt($curl,CURLOPT_POST,1); curl_setopt($curl, CURLOPT_POST, 1);
// 设置请求参数 // 设置请求参数
curl_setopt($curl,CURLOPT_POSTFIELDS,$data); curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
} }
//开始事务 //开始事务
...@@ -543,14 +590,15 @@ class Common ...@@ -543,14 +590,15 @@ class Common
return $r; return $r;
} }
public static function aliyunExpressApi($expressNo,$expressType){ public static function aliyunExpressApi($expressNo, $expressType)
{
$host = SecretKeys::expressUrl; $host = SecretKeys::expressUrl;
$path = SecretKeys::expressPath; $path = SecretKeys::expressPath;
$method = "GET"; $method = "GET";
$appcode = SecretKeys::expressAppCode; $appcode = SecretKeys::expressAppCode;
$headers = array(); $headers = array();
array_push($headers, "Authorization:APPCODE " . $appcode); array_push($headers, "Authorization:APPCODE " . $appcode);
$querys=self::format("no={0}&type={1}",$expressNo,$expressType); $querys = self::format("no={0}&type={1}", $expressNo, $expressType);
$bodys = ""; $bodys = "";
$url = $host . $path . "?" . $querys; $url = $host . $path . "?" . $querys;
$curl = curl_init(); $curl = curl_init();
...@@ -560,22 +608,23 @@ class Common ...@@ -560,22 +608,23 @@ class Common
curl_setopt($curl, CURLOPT_FAILONERROR, false); curl_setopt($curl, CURLOPT_FAILONERROR, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_HEADER, false);
if (ApiConst::one == strpos("$".$host, "https://")) if (ApiConst::one == strpos("$" . $host, "https://")) {
{
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
} }
$res=curl_exec($curl); $res = curl_exec($curl);
return json_decode($res,true); return json_decode($res, true);
} }
/** /**
* 价格格式化 * 价格格式化
* *
* @param int $price * @param int $price
* @return string $price_format * @return string $price_format
*/ */
public static function priceFormat($price) { public static function priceFormat($price)
$price_format = number_format($price,2,'.',''); {
$price_format = number_format($price, 2, '.', '');
return $price_format; return $price_format;
} }
...@@ -584,10 +633,11 @@ class Common ...@@ -584,10 +633,11 @@ class Common
* 获取当前访问用户地址 * 获取当前访问用户地址
* @return string * @return string
*/ */
public static function getIP(){ public static function getIP()
{
static $realip; static $realip;
if (isset($_SERVER)){ if (isset($_SERVER)) {
if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])){ if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
$realip = $_SERVER["HTTP_X_FORWARDED_FOR"]; $realip = $_SERVER["HTTP_X_FORWARDED_FOR"];
} else if (isset($_SERVER["HTTP_CLIENT_IP"])) { } else if (isset($_SERVER["HTTP_CLIENT_IP"])) {
$realip = $_SERVER["HTTP_CLIENT_IP"]; $realip = $_SERVER["HTTP_CLIENT_IP"];
...@@ -595,7 +645,7 @@ class Common ...@@ -595,7 +645,7 @@ class Common
$realip = $_SERVER["REMOTE_ADDR"]; $realip = $_SERVER["REMOTE_ADDR"];
} }
} else { } else {
if (getenv("HTTP_X_FORWARDED_FOR")){ if (getenv("HTTP_X_FORWARDED_FOR")) {
$realip = getenv("HTTP_X_FORWARDED_FOR"); $realip = getenv("HTTP_X_FORWARDED_FOR");
} else if (getenv("HTTP_CLIENT_IP")) { } else if (getenv("HTTP_CLIENT_IP")) {
$realip = getenv("HTTP_CLIENT_IP"); $realip = getenv("HTTP_CLIENT_IP");
...@@ -611,10 +661,11 @@ class Common ...@@ -611,10 +661,11 @@ class Common
* @param $ip * @param $ip
* @return array|bool * @return array|bool
*/ */
public static function getIpCity($ip){ public static function getIpCity($ip)
$url="http://ip.taobao.com/service/getIpInfo.php?ip=".$ip; {
$ip=json_decode(file_get_contents($url)); $url = "http://ip.taobao.com/service/getIpInfo.php?ip=" . $ip;
if((string)$ip->code=='1'){ $ip = json_decode(file_get_contents($url));
if ((string)$ip->code == '1') {
return false; return false;
} }
$data = (array)$ip->data; $data = (array)$ip->data;
......
...@@ -94,7 +94,7 @@ class ImageConst{ ...@@ -94,7 +94,7 @@ class ImageConst{
4=>self::reportPath, 4=>self::reportPath,
5=>self::memberAvatar 5=>self::memberAvatar
); );
const ninTyPath='?x-oss-process=image/resize,m_fill,h_90,w_90';
const sizeScale = 1.5; const sizeScale = 1.5;
const goodsListImgSize = 334; const goodsListImgSize = 334;
const CommentGoodsImgSize = 138; const CommentGoodsImgSize = 138;
......
...@@ -17,7 +17,8 @@ class PathConst { ...@@ -17,7 +17,8 @@ class PathConst {
const wxGoodsParams="id={0}"; const wxGoodsParams="id={0}";
//1:店铺小程序二维码生成路径,2:商品小程序二维码路径 //1:店铺小程序二维码生成路径,2:商品小程序二维码路径
const wxStorePath="pages/shops/home/index"; const wxStorePath="pages/shops/home/index";
const wxGoodsPath="pages/products/home/index"; const wxGoodsPath="pages/products/details/index";
// const wxGoodsPath="pages/goods/home/index";
//默认小程序的图片 //默认小程序的图片
const wxDefaultPath="/data/img/qrcode.jpg"; const wxDefaultPath="/data/img/qrcode.jpg";
//下载app的页面 //下载app的页面
......
...@@ -45,6 +45,7 @@ class PayConst { ...@@ -45,6 +45,7 @@ class PayConst {
const wxAppNotifyUrl = '/pay/wxAppNotify.php'; const wxAppNotifyUrl = '/pay/wxAppNotify.php';
const wxAppNotifyUrlService = '/pay/wxAppNotifyService.php';
const aliAppNotifyUrl = '/pay/aliAppNotify.php'; const aliAppNotifyUrl = '/pay/aliAppNotify.php';
const wxLiteNotifyUrl = '/pay/wxLiteNotify.php'; const wxLiteNotifyUrl = '/pay/wxLiteNotify.php';
const qPayNotifyUrl = '/pay/qPayNotify.php'; const qPayNotifyUrl = '/pay/qPayNotify.php';
......
...@@ -73,7 +73,7 @@ class WechatCommon ...@@ -73,7 +73,7 @@ class WechatCommon
} }
public function httpsPostJson($url, $data = '', $array = true) public function httpsPostJson($url, $data = '', $array = false)
{ {
$curl = curl_init($url); $curl = curl_init($url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
......
...@@ -33,7 +33,7 @@ class Pay { ...@@ -33,7 +33,7 @@ class Pay {
$orderInfo = $this->getOrder($wxFlag); $orderInfo = $this->getOrder($wxFlag);
if($data['channel'] == \Our\NameConst::wxAppChannel){ if($data['channel'] == \Our\NameConst::wxAppChannel){
$wxpay = WxPay::getInstance(); $wxpay = WxPay::getInstance();
unset($orderInfo['subMchId']); //unset($orderInfo['subMchId']);
$return = $wxpay->doPay($orderInfo); $return = $wxpay->doPay($orderInfo);
}else if($data['channel'] == \Our\NameConst::aliApiChannel){ }else if($data['channel'] == \Our\NameConst::aliApiChannel){
$alipay= Alipay::getInstance(); $alipay= Alipay::getInstance();
......
...@@ -22,6 +22,7 @@ class TencentPay { ...@@ -22,6 +22,7 @@ class TencentPay {
protected $s_appid =''; protected $s_appid ='';
protected $s_key = ''; protected $s_key = '';
protected $s_mch_id =''; protected $s_mch_id ='';
protected $s_notify_url = '';
protected $prepay_id =''; protected $prepay_id ='';
protected $tradeType = ''; protected $tradeType = '';
public $data;//接收到的数据,类型为关联数组 public $data;//接收到的数据,类型为关联数组
...@@ -79,11 +80,10 @@ class TencentPay { ...@@ -79,11 +80,10 @@ class TencentPay {
$this->parameters['sub_openid'] = $orderInfo['openid']; $this->parameters['sub_openid'] = $orderInfo['openid'];
} }
$this->parameters['spbill_create_ip']=\Our\Common::getClientIp(); $this->parameters['spbill_create_ip']=\Our\Common::getClientIp();
$this->parameters['notify_url']=$this->notify_url; $this->parameters['notify_url']=$this->s_notify_url;
$this->parameters['trade_type']= $this->tradeType; $this->parameters['trade_type']= $this->tradeType;
//$this->parameters['openid']=$_SESSION['openid']; //$this->parameters['openid']=$_SESSION['openid'];
//print_r($this->parameters);exit; //print_r($this->parameters);exit;
\Our\Log::getInstance()->write(json_encode($this->parameters),'/data/log/apptest');
$prepay_id = $this->getPrepayId(); $prepay_id = $this->getPrepayId();
$this->setPrepayId($prepay_id); $this->setPrepayId($prepay_id);
} }
...@@ -124,7 +124,6 @@ class TencentPay { ...@@ -124,7 +124,6 @@ class TencentPay {
$this->postXml($this->orderquery_url); $this->postXml($this->orderquery_url);
$this->result = $this->xmlToArray($this->response); $this->result = $this->xmlToArray($this->response);
\Our\Log::getInstance()->write(json_encode($this->result),'/data/log/apptest'); \Our\Log::getInstance()->write(json_encode($this->result),'/data/log/apptest');
\Our\Log::getInstance()->write(json_encode($this->result),'/data/log/apptest');
if($this->result['return_code']=="SUCCESS"&&$this->result['result_code']=="SUCCESS"&&$this->result['trade_state']=="SUCCESS"){ if($this->result['return_code']=="SUCCESS"&&$this->result['result_code']=="SUCCESS"&&$this->result['trade_state']=="SUCCESS"){
return true; return true;
} }
...@@ -148,9 +147,7 @@ class TencentPay { ...@@ -148,9 +147,7 @@ class TencentPay {
function postXml($url=false) function postXml($url=false)
{ {
$xml = $this->createXml(); $xml = $this->createXml();
\Our\Log::getInstance()->write($xml,'/data/log/applog');
$this->response = $this->postXmlCurl($xml,$url?$url:$this->pay_url,$this->curl_timeout); $this->response = $this->postXmlCurl($xml,$url?$url:$this->pay_url,$this->curl_timeout);
\Our\Log::getInstance()->write(serialize($this->response),'/data/log/applog');
return $this->response; return $this->response;
} }
...@@ -360,9 +357,12 @@ class TencentPay { ...@@ -360,9 +357,12 @@ class TencentPay {
/** /**
* 获取notify信息 * 获取notify信息
*/ */
public function getNotifyInfo() { public function getNotifyInfo($serviceFlag=false) {
$xml = file_get_contents("php://input"); $xml = file_get_contents("php://input");
$this->saveData($xml); $this->saveData($xml);
if($serviceFlag){
$this->key= $this->s_key;
}
$verify = false; $verify = false;
if($this->checkSign() == FALSE){ if($this->checkSign() == FALSE){
$this->setReturnParameter("return_msg","签名失败");//返回信息 $this->setReturnParameter("return_msg","签名失败");//返回信息
......
...@@ -13,6 +13,7 @@ class WxLitePay extends \Payment\TencentPay{ ...@@ -13,6 +13,7 @@ class WxLitePay extends \Payment\TencentPay{
{ {
$this->appid = \Our\PayConst::wxLiteAppId; $this->appid = \Our\PayConst::wxLiteAppId;
$this->notify_url = \Our\Common::getBaseUrl().\Our\PayConst::wxLiteNotifyUrl; $this->notify_url = \Our\Common::getBaseUrl().\Our\PayConst::wxLiteNotifyUrl;
$this->s_notify_url = \Our\Common::getBaseUrl().\Our\PayConst::wxLiteNotifyUrl;
//$this->notify_url = \Our\NameConst::httpPrefix. $_SERVER['SERVER_NAME'] .\Our\PayConst::wxLiteNotifyUrl; //$this->notify_url = \Our\NameConst::httpPrefix. $_SERVER['SERVER_NAME'] .\Our\PayConst::wxLiteNotifyUrl;
$this->mch_id = \Our\PayConst::wxPayMchId; $this->mch_id = \Our\PayConst::wxPayMchId;
$this->key = \Our\PayConst::wxSPayKey; $this->key = \Our\PayConst::wxSPayKey;
......
...@@ -15,7 +15,7 @@ class WxPay extends \Payment\TencentPay ...@@ -15,7 +15,7 @@ class WxPay extends \Payment\TencentPay
public function __construct() public function __construct()
{ {
$this->appid = \Our\PayConst::wxPayAppId; $this->appid = \Our\PayConst::wxPayAppId;
$this->notify_url = \Our\Common::getBaseUrl(). \Our\PayConst::wxAppNotifyUrl; $this->notify_url = \Our\Common::getBaseUrl().\Our\PayConst::wxAppNotifyUrl;
$this->mch_id = \Our\PayConst::wxPayMchId; $this->mch_id = \Our\PayConst::wxPayMchId;
$this->key = \Our\PayConst::wxPayKey; $this->key = \Our\PayConst::wxPayKey;
$this->sslcert_path = \Our\PayConst::wxSslcertPath; $this->sslcert_path = \Our\PayConst::wxSslcertPath;
...@@ -25,6 +25,7 @@ class WxPay extends \Payment\TencentPay ...@@ -25,6 +25,7 @@ class WxPay extends \Payment\TencentPay
$this->s_mch_id = \Our\PayConst::wxSPayMchId; $this->s_mch_id = \Our\PayConst::wxSPayMchId;
$this->s_key = \Our\PayConst::wxSPayKey; $this->s_key = \Our\PayConst::wxSPayKey;
$this->s_appid = \Our\PayConst::wxSPayAppId; $this->s_appid = \Our\PayConst::wxSPayAppId;
$this->s_notify_url = \Our\Common::getBaseUrl().\Our\PayConst::wxAppNotifyUrlService;
} }
public function doPay($orderInfo) public function doPay($orderInfo)
......
...@@ -603,7 +603,7 @@ class CartServiceModel extends \Business\AbstractModel{ ...@@ -603,7 +603,7 @@ class CartServiceModel extends \Business\AbstractModel{
foreach($storeIds as $storeId){ foreach($storeIds as $storeId){
$store = $storeDao->get($storeId,false); $store = $storeDao->get($storeId,false);
$storeCarts = $storeCartData['cartList'][$storeId]; $storeCarts = $storeCartData['cartList'][$storeId];
$deliverySetting['onelinePay'] = $store['wx_pay'];//是否支持线上支付 $deliverySetting['onelinePay'] = $store['wx_pay']&&$store['onlinepay_flag']?\Our\ApiConst::one:\Our\ApiConst::zero;//是否支持线上支付
$deliverySetting['offlinePay'] = $store['offline_pay']; $deliverySetting['offlinePay'] = $store['offline_pay'];
if($deliverySetting['offlinePay']){ if($deliverySetting['offlinePay']){
...@@ -680,7 +680,7 @@ class CartServiceModel extends \Business\AbstractModel{ ...@@ -680,7 +680,7 @@ class CartServiceModel extends \Business\AbstractModel{
foreach($storeIds as $storeId){ foreach($storeIds as $storeId){
$store = $storeDao->get($storeId,false); $store = $storeDao->get($storeId,false);
$storeCarts = $storeCartData['cartList'][$storeId]; $storeCarts = $storeCartData['cartList'][$storeId];
$deliverySetting['onelinePay'] = $store['wx_pay'];//是否支持线上支付 $deliverySetting['onelinePay'] = $store['wx_pay']&&$store['onlinepay_flag']?\Our\ApiConst::one:\Our\ApiConst::zero;//是否支持线上支付
$deliverySetting['offlinePay'] = $store['offline_pay']; $deliverySetting['offlinePay'] = $store['offline_pay'];
$deliverySetting['offlinePayway'] = array('payway'=>'','imageUrls'=>array()); $deliverySetting['offlinePayway'] = array('payway'=>'','imageUrls'=>array());
if($deliverySetting['offlinePay']){ if($deliverySetting['offlinePay']){
......
File mode changed from 100755 to 100644
...@@ -670,9 +670,12 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -670,9 +670,12 @@ class OrderServiceModel extends \Business\AbstractModel
//更新订单信息 //更新订单信息
$updateData = array('order_state' => ApiConst::orderStateCancel,'is_effective'=>ApiConst::cancelOrderAuto); $updateData = array('order_state' => ApiConst::orderStateCancel,'is_effective'=>ApiConst::cancelOrderAuto);
$update = $orderDao->update(array('order_id' => $order['orderId']),$updateData); $update = $orderDao->update(array('order_id' => $order['orderId']),$updateData);
$updateCommonData['order_message']=DescribeConst::cancelOrderMessage; // $updateCommonData['order_message']=DescribeConst::cancelOrderMessage;
$res=$orderCommonDao->update(array('order_id'=>$order['orderId']),$updateCommonData); // $res=$orderCommonDao->update(array('order_id'=>$order['orderId']),$updateCommonData);
if(!$update || !$res){ // if(!$update || !$res){
// echo '订单:'.$order['orderId'].'没取消成功!';
// }
if(!$update){
echo '订单:'.$order['orderId'].'没取消成功!'; echo '订单:'.$order['orderId'].'没取消成功!';
} }
//$orderGoodsUpdateData['refund_state_name']='退款成功'; //$orderGoodsUpdateData['refund_state_name']='退款成功';
...@@ -1167,7 +1170,13 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -1167,7 +1170,13 @@ class OrderServiceModel extends \Business\AbstractModel
$paySn = $data['paySn']; $paySn = $data['paySn'];
$oldOrderPay = $orderPayModel->find(array('pay_sn'=>$paySn)); $oldOrderPay = $orderPayModel->find(array('pay_sn'=>$paySn));
$orderStateArray = array_column($orderList,'order_state'); $orderStateArray = array_column($orderList,'order_state');
\Our\Log::getInstance()->write(json_encode($orderStateArray),'/data/log/apptest');
if(isset($data['wxLitePayFlag'])&&$data['wxLitePayFlag']==\Our\ApiConst::one){//微信小程序支付时
$oldOrderPay['pay_type'] = \Our\ApiConst::wxLitePayType;
}
if(in_array(\Our\ApiConst::orderStateWaitPay,$orderStateArray)&&in_array($oldOrderPay['pay_type'],array(\Our\ApiConst::wxAppPayType,\Our\ApiConst::wxLitePayType))&&((isset($data['payFlag'])&&$data['payFlag']==\Our\ApiConst::one)||!isset($data['payFlag']))){ if(in_array(\Our\ApiConst::orderStateWaitPay,$orderStateArray)&&in_array($oldOrderPay['pay_type'],array(\Our\ApiConst::wxAppPayType,\Our\ApiConst::wxLitePayType))&&((isset($data['payFlag'])&&$data['payFlag']==\Our\ApiConst::one)||!isset($data['payFlag']))){
\Our\Log::getInstance()->write($data['payFlag'],'/data/log/apptest');
if($oldOrderPay['pay_type']==\Our\ApiConst::wxLitePayType){ if($oldOrderPay['pay_type']==\Our\ApiConst::wxLitePayType){
$wxLitePay = \Payment\WxLitePay::getInstance(); $wxLitePay = \Payment\WxLitePay::getInstance();
$storeId = $orderList[0]['store_id']; $storeId = $orderList[0]['store_id'];
...@@ -1179,7 +1188,13 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -1179,7 +1188,13 @@ class OrderServiceModel extends \Business\AbstractModel
$payResult = $wxLitePay->getOrderPayResult($paySn,$subMchId); $payResult = $wxLitePay->getOrderPayResult($paySn,$subMchId);
}else{ }else{
$wxPay = \Payment\WxPay::getInstance(); $wxPay = \Payment\WxPay::getInstance();
$payResult = $wxPay->getOrderPayResult($paySn); $storeId = $orderList[0]['store_id'];
$mchIdArray = $storeDao->getStoreWxMchId($storeId);
if($mchIdArray['errorCode']>0){
\Error\ErrorModel::throwException($mchIdArray['errorCode']);
}
$subMchId = $mchIdArray['mchId'];
$payResult = $wxPay->getOrderPayResult($paySn,$subMchId);
} }
\Our\Log::getInstance()->write('支付结果'.$payResult,'/data/log/apptest'); \Our\Log::getInstance()->write('支付结果'.$payResult,'/data/log/apptest');
if($payResult){ if($payResult){
...@@ -1249,7 +1264,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -1249,7 +1264,7 @@ class OrderServiceModel extends \Business\AbstractModel
$return['orderState'] = $orderState; $return['orderState'] = $orderState;
if(isset($data['wxLitePayFlag'])&&$data['wxLitePayFlag']==\Our\ApiConst::one){ if(isset($data['wxLitePayFlag'])&&$data['wxLitePayFlag']==\Our\ApiConst::one){
$return['paySn'] = $data['paySn']; $return['paySn'] = $data['paySn'];
if(!$orderState){ if(!$orderState&&!((isset($data['payFlag'])&&$data['payFlag']==\Our\ApiConst::one))){
$orderConfirmUtil = \Order\OrderConfirmUtil::getInstance(); $orderConfirmUtil = \Order\OrderConfirmUtil::getInstance();
$paySn = $orderConfirmUtil->makeNewPaySnForOrderWithOldPaySn($data['paySn'],$memberId); $paySn = $orderConfirmUtil->makeNewPaySnForOrderWithOldPaySn($data['paySn'],$memberId);
$return['paySn'] = $paySn; $return['paySn'] = $paySn;
......
...@@ -57,7 +57,7 @@ class PaymentServiceModel extends \Business\AbstractModel{ ...@@ -57,7 +57,7 @@ class PaymentServiceModel extends \Business\AbstractModel{
/** /**
* app微信支付回调 * app微信支付回调
*/ */
public function updateOrderToPayed($channel = \Our\NameConst::wxAppChannel){ public function updateOrderToPayed($channel = \Our\NameConst::wxAppChannel,$serviceFlag=false){
if($channel == \Our\NameConst::wxLiteChannel){ if($channel == \Our\NameConst::wxLiteChannel){
$wxpay = \Payment\WxLitePay::getInstance(); $wxpay = \Payment\WxLitePay::getInstance();
$param['pay_type'] = \Our\ApiConst::wxLitePayType; $param['pay_type'] = \Our\ApiConst::wxLitePayType;
...@@ -68,7 +68,7 @@ class PaymentServiceModel extends \Business\AbstractModel{ ...@@ -68,7 +68,7 @@ class PaymentServiceModel extends \Business\AbstractModel{
$wxpay = \Payment\WxPay::getInstance(); $wxpay = \Payment\WxPay::getInstance();
$param['pay_type'] = \Our\ApiConst::wxAppPayType; $param['pay_type'] = \Our\ApiConst::wxAppPayType;
} }
$callbackInfo = $wxpay->getNotifyInfo(); $callbackInfo = $wxpay->getNotifyInfo($serviceFlag);
if($callbackInfo) { if($callbackInfo) {
//验证成功 //验证成功
$param['paySn'] = $callbackInfo['out_trade_no']; $param['paySn'] = $callbackInfo['out_trade_no'];
......
...@@ -482,6 +482,7 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -482,6 +482,7 @@ class RefundServiceModel extends \Business\AbstractModel
$refundReturnDao->db->doRollback(); $refundReturnDao->db->doRollback();
return false; return false;
} }
//$this->recordSellerLog('退款处理,退款编号:'.$refund['refund_sn']); //待确认 //$this->recordSellerLog('退款处理,退款编号:'.$refund['refund_sn']); //待确认
//记录操作日志 //记录操作日志
$sellerLogDAO = \DAO\SellerLogModel::getInstance(); $sellerLogDAO = \DAO\SellerLogModel::getInstance();
...@@ -512,14 +513,14 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -512,14 +513,14 @@ class RefundServiceModel extends \Business\AbstractModel
'refundId'=>$refund['refund_id'])); 'refundId'=>$refund['refund_id']));
$push->addOneToClient($pushData); $push->addOneToClient($pushData);
$push->sendTcpMessage(); $push->sendTcpMessage();
return true;
}
if($refundAmount > $refund['buyer_refund_amount']){ return true;
//showDialog('退款金额不可大于本订单支付金额','','error');
$refundReturnDao->db->doRollback();
return false;
} }
// if($refundAmount > $refund['buyer_refund_amount']){
// //showDialog('退款金额不可大于本订单支付金额','','error');
// $refundReturnDao->db->doRollback();
// return false;
// }
//以下为同意退款流程 //以下为同意退款流程
if($order_info['order_state']==40){ //交易完成订单,退积分 if($order_info['order_state']==40){ //交易完成订单,退积分
...@@ -1001,7 +1002,8 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -1001,7 +1002,8 @@ class RefundServiceModel extends \Business\AbstractModel
// $shippingTypes = ArrayConst::refundShippingType[$orderInfo['shippingType']]; // $shippingTypes = ArrayConst::refundShippingType[$orderInfo['shippingType']];
//获得订单商品 //获得订单商品
$orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(); $orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance();
$orderGoodses = \Our\RedisHelper::cachedFunction(\Redis\Db5\RefundReasonRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsByOrderIds'), array($orderInfo['orderId'], $this->orderGoodsField), \Our\ApiConst::oneDaySecond); $orderGoodses =$orderGoodsDao->getOrderGoodsByOrderIds($orderInfo['orderId'], $this->orderGoodsField);
//\Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsByOrderIds'), array($orderInfo['orderId'], $this->orderGoodsField), \Our\ApiConst::oneDaySecond);
$orderGoodses = $orderGoodsDao->convertOrderGoods($orderGoodses, 'goodsId'); $orderGoodses = $orderGoodsDao->convertOrderGoods($orderGoodses, 'goodsId');
$allOrderGoods=$orderGoodses; $allOrderGoods=$orderGoodses;
$goodsIds = $orderGoodsDao->getRefundOrderGoodsIds($orderGoodses); $goodsIds = $orderGoodsDao->getRefundOrderGoodsIds($orderGoodses);
...@@ -1013,19 +1015,20 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -1013,19 +1015,20 @@ class RefundServiceModel extends \Business\AbstractModel
$orderGoods = $orderGoodses[$goodsId]; $orderGoods = $orderGoodses[$goodsId];
} }
if (!empty($orderGoods)) { if (!empty($orderGoods)) {
array_push($goodsIds, $goodsId); array_push($goodsIds, (int)$goodsId);
}else{ }else{
ErrorModel::throwException(CodeConfigModel::notExistOrderGoods); ErrorModel::throwException(CodeConfigModel::notExistOrderGoods);
} }
$shippingFee = ApiConst::zero; $shippingFee = ApiConst::zero;
$allReadyGoodsCount=count($goodsIds); $allReadyGoodsCount=count($goodsIds);
$allGoodsCount=count($orderGoodses); $allGoodsCount=count($orderGoodses);
// $shippingFee = $storeDao->isFee($orderInfo['storeId'], $orderInfo['shippingType'], $orderInfo['orderState']) ? $orderInfo['shippingFee'] : ApiConst::zero; $shippingFee = $storeDao->isFee($orderInfo['storeId'], $orderInfo['shippingType'], $orderInfo['orderState']) ? $orderInfo['shippingFee'] : ApiConst::zero;
if($allReadyGoodsCount==ApiConst::one){ // if($allReadyGoodsCount==ApiConst::one){
$shippingFee = $storeDao->isFee($orderInfo['storeId'], $orderInfo['shippingType'], $orderInfo['orderState']) ? $orderInfo['shippingFee'] : ApiConst::zero; // $shippingFee = $storeDao->isFee($orderInfo['storeId'], $orderInfo['shippingType'], $orderInfo['orderState']) ? $orderInfo['shippingFee'] : ApiConst::zero;
}else{ // }else{
$shippingFee == ApiConst::zero; // $shippingFee == ApiConst::zero;
} // }
// if (count($orderGoods) == ApiConst::one) { // if (count($orderGoods) == ApiConst::one) {
// $shippingFee = $storeDao->isFee($orderInfo['storeId'], $orderInfo['shippingType'], $orderInfo['orderState']) ? $orderInfo['shippingFee'] : ApiConst::zero; // $shippingFee = $storeDao->isFee($orderInfo['storeId'], $orderInfo['shippingType'], $orderInfo['orderState']) ? $orderInfo['shippingFee'] : ApiConst::zero;
// } else { // } else {
...@@ -1055,7 +1058,6 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -1055,7 +1058,6 @@ class RefundServiceModel extends \Business\AbstractModel
if ($orderInfo['paymentTime']) { if ($orderInfo['paymentTime']) {
$orderConfirmUtil = \Order\OrderConfirmUtil::getInstance(); $orderConfirmUtil = \Order\OrderConfirmUtil::getInstance();
if ($orderInfo['couponId']) { if ($orderInfo['couponId']) {
if ($refundCondition) { if ($refundCondition) {
$refundCondition['storeCarts']['storeCarts'] = $cartDao->refundGoodsRemove($refundCondition['storeCarts']['storeCarts'], $goodsIds); $refundCondition['storeCarts']['storeCarts'] = $cartDao->refundGoodsRemove($refundCondition['storeCarts']['storeCarts'], $goodsIds);
...@@ -1070,45 +1072,33 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -1070,45 +1072,33 @@ class RefundServiceModel extends \Business\AbstractModel
// if(!$alreadyRefundGoodsIds){ // if(!$alreadyRefundGoodsIds){
// $refundAmount=$refundAmount-$discountAmount; // $refundAmount=$refundAmount-$discountAmount;
// } // }
if($shippingFee){
$refundAmount=$refundAmount-$orderInfo['shippingFee'];
}
} else { } else {
$refundAmount = $orderGoods['goodsPrice']*$orderGoods['goodsNum']; $refundAmount = $orderGoods['goodsPrice']*$orderGoods['goodsNum'];
// if(!$alreadyRefundGoodsIds){ if($allReadyGoodsCount==ApiConst::one){
// $refundAmount=$refundAmount-$discountAmount;
// }
}
if($allReadyGoodsCount==ApiConst::one){
if($orderInfo['couponId']){
if($shippingFee){
$refundAmount=$refundAmount-$orderInfo['shippingFee'];
}
}else{
$refundAmount=$refundAmount+$orderInfo['shippingFee']; $refundAmount=$refundAmount+$orderInfo['shippingFee'];
if($shippingFee){ if($shippingFee){
$refundAmount=$refundAmount-$orderInfo['shippingFee']; $refundAmount=$refundAmount-$orderInfo['shippingFee'];
} }
} }
// if($shippingFee && ($orderInfo['shippingType']==ApiConst::bySeller)){ //修改后的优惠金额按比例退回
// $refundAmount=$refundAmount-$orderInfo['shippingFee']; $discountAmount=$orderInfo['originAmount']- $orderInfo['orderAmount'];
// } $mustReduceAmount=ApiConst::zero;
}else{ if($discountAmount){
if($orderInfo['couponId']){ $orderGoodsConvertes=array();
if($shippingFee){ array_push($orderGoodsConvertes,$orderGoodsConvert);
$refundAmount=$refundAmount-$orderInfo['shippingFee']; $mustReduceAmount=$orderGoodsDao->getMustReduceAmount($allOrderGoods,$discountAmount,$orderGoodsConvertes);
}
} }
}
//修改后的优惠金额按比例退回
$discountAmount=$orderInfo['originAmount']- $orderInfo['orderAmount'];
$mustReduceAmount=ApiConst::zero;
if($discountAmount){
$mustReduceAmount=$orderGoodsDao->getMustReduceAmount($allOrderGoods,$discountAmount,$orderGoodsConvert);
}
if(!$orderInfo['couponId']){
$refundAmount=$refundAmount-$mustReduceAmount; $refundAmount=$refundAmount-$mustReduceAmount;
// if(!$alreadyRefundGoodsIds){
// $refundAmount=$refundAmount-$discountAmount;
// }
} }
//配送订单配送费按比例收取 //配送订单配送费按比例收取
// if($orderInfo['shippingType']==ApiConst::bySeller){ // if($orderInfo['shippingType']==ApiConst::bySeller){
// $mustSheepingFee=ApiConst::zero; // $mustSheepingFee=ApiConst::zero;
...@@ -1267,10 +1257,12 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -1267,10 +1257,12 @@ class RefundServiceModel extends \Business\AbstractModel
$refundArray['add_time'] = TIMESTAMP; $refundArray['add_time'] = TIMESTAMP;
$refundArray['refund_type']=$refund['refundType']; $refundArray['refund_type']=$refund['refundType'];
$refundArray['refund_shipping_type']=isset($refund['refundShippingType'])?$refund['refundShippingType']:ApiConst::zero; $refundArray['refund_shipping_type']=isset($refund['refundShippingType'])?$refund['refundShippingType']:ApiConst::zero;
$refundArray['payment_type']=$orderInfo['paymentType'];
$refundArrayUnLine=Common::convertUnderline($refundArray); $refundArrayUnLine=Common::convertUnderline($refundArray);
$state = $refundReturnDao->addRefundReturn($refundArray,$orderInfo,$orderGoods); $state = $refundReturnDao->addRefundReturn($refundArray,$orderInfo,$orderGoods);
$updateOrderData['refund_amount']= $orderInfo['refundAmount']+ $refundArray['refund_amount'];
$updateOrderData['origin_refund_amount']= $orderInfo['origin_refund_amount']+$originRefundAmount; $updateOrderData['refund_amount']= $orderInfo['refundAmount']+ $refundAmount;
$updateOrderData['origin_refund_amount']= $orderInfo['originRefundAmount']+$originRefundAmount;
$orderDao->deleteOrderCache($memberId,$orderInfo['orderId'],$orderInfo['storeId'],true); $orderDao->deleteOrderCache($memberId,$orderInfo['orderId'],$orderInfo['storeId'],true);
$storeDao->deleteStoreCache($orderInfo['storeId'],$orderInfo['orderId']); $storeDao->deleteStoreCache($orderInfo['storeId'],$orderInfo['orderId']);
......
...@@ -76,7 +76,7 @@ class DeliveryServiceModel extends \Business\AbstractModel ...@@ -76,7 +76,7 @@ class DeliveryServiceModel extends \Business\AbstractModel
$qmDeliveryManLogData['distribution_fee'] =$data['distributionFee']; $qmDeliveryManLogData['distribution_fee'] =$data['distributionFee'];
$qmDeliveryManLogData['order_type'] = $data['orderType']; $qmDeliveryManLogData['order_type'] = $data['orderType'];
if($data['orderType']==ApiConst::orderTypeRefund){ if($data['orderType']==ApiConst::orderTypeRefund){
$qmDeliveryManLogData['shipping_fee']=$orderD['need_shipping_fee']; $qmDeliveryManLogData['shipping_fee']=$orderD['needShippingFee'];
}else{ }else{
$qmDeliveryManLogData['shipping_fee'] = $orderD['shippingFee']; $qmDeliveryManLogData['shipping_fee'] = $orderD['shippingFee'];
} }
......
...@@ -77,8 +77,10 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -77,8 +77,10 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$data['storeName'] = $store['store_name']; $data['storeName'] = $store['store_name'];
$data['storeLabel'] = $store['store_label']; $data['storeLabel'] = $store['store_label'];
$data['goodsCount'] = $goodsCount?$goodsCount:ApiConst::zero; $data['goodsCount'] = $goodsCount?$goodsCount:ApiConst::zero;
$data['goodsCount']=(int)$data['goodsCount'];
$data['orderCount'] = $storeStats['orderCount']; $data['orderCount'] = $storeStats['orderCount'];
$data['orderTotal'] = $orderTotal?$orderTotal:ApiConst::zero; $data['orderTotal'] = $orderTotal?$orderTotal:ApiConst::zero;
$data['orderTotal']= (int)$data['orderTotal'];
$data['orderTotalOnline'] = $orderTotalOnline; $data['orderTotalOnline'] = $orderTotalOnline;
$data['favCount'] = $storeFavariteCount['favCount']; $data['favCount'] = $storeFavariteCount['favCount'];
$data['todayOrderCount'] = $storeStats['todayOrderCount']; $data['todayOrderCount'] = $storeStats['todayOrderCount'];
...@@ -237,9 +239,13 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -237,9 +239,13 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
* @param $orderId * @param $orderId
* @return bool * @return bool
*/ */
public function orderReceive($memberId, $orderId) public function orderReceive($memberId, $orderId,$isStore=false)
{ {
$storeId = $this->_getStoreByMemberId($memberId); if($isStore){
$storeId=$memberId;
}else{
$storeId = $this->_getStoreByMemberId($memberId);
}
$where['order_id'] = $orderId; $where['order_id'] = $orderId;
$where['store_id'] = $storeId; $where['store_id'] = $storeId;
$where['order_state'] = ApiConst::orderStateWaitConfirm; $where['order_state'] = ApiConst::orderStateWaitConfirm;
...@@ -293,15 +299,20 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -293,15 +299,20 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
} }
} }
public function getStoreOrders($memberId, $pageIndex, $pageSize, $orderState, $keyword) public function getStoreOrders($memberId, $pageIndex, $pageSize, $orderState, $keyword,$isStoreId=false)
{ {
$storeId = $this->_getStoreByMemberId($memberId); if($isStoreId){
$storeId=$memberId;
}else{
$storeId = $this->_getStoreByMemberId($memberId);
}
$storeStatisticsDao = \DAO\StoreStatisticsModel::getInstance(); $storeStatisticsDao = \DAO\StoreStatisticsModel::getInstance();
//获取店铺数据统计 //获取店铺数据统计
$storeStats = $storeStatisticsDao->find(array('store_id' => $storeId)); $storeStats = $storeStatisticsDao->find(array('store_id' => $storeId));
$data['orderTotal'] = $storeStats['order_total']; $data['orderTotal'] = $storeStats['order_total'];
$data['orderCount'] = $storeStats['order_count']; $data['orderCount'] = $storeStats['order_count'];
$result = $this->getOrders($memberId, $pageIndex, $pageSize, $orderState, $keyword); $result = $this->getOrders($memberId, $pageIndex, $pageSize, $orderState, $keyword,$isStoreId);
$data['orders'] = $result['orders']; $data['orders'] = $result['orders'];
return $data; return $data;
} }
...@@ -414,12 +425,17 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -414,12 +425,17 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
return $where; return $where;
} }
public function getOrders($memberId, $pageIndex, $pageSize, $orderState, $keyword) public function getOrders($memberId, $pageIndex, $pageSize, $orderState, $keyword,$isstoreId=false)
{ {
$order = array('gmt_update' => 'desc'); $order = array('gmt_update' => 'desc');
$orderDao=\DAO\Order\OrderModel::getInstance(); $orderDao=\DAO\Order\OrderModel::getInstance();
$storeId = $this->_getStoreByMemberId($memberId); if($isstoreId){
$storeId=$memberId;
}else{
$storeId = $this->_getStoreByMemberId($memberId);
}
if (empty($storeId)) { if (empty($storeId)) {
ErrorModel::throwException(CodeConfigModel::paramsError); ErrorModel::throwException(CodeConfigModel::paramsError);
} }
...@@ -480,24 +496,28 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -480,24 +496,28 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
return $this->orderGoodsField . ',goods_commonid as goodsCommonid,goods_commonid as goodsCommonId,goods_spec as goodsSpec '; return $this->orderGoodsField . ',goods_commonid as goodsCommonid,goods_commonid as goodsCommonId,goods_spec as goodsSpec ';
} }
public function getDiliveryManByStoreId($memberId) public function getDiliveryManByStoreId($memberId,$isStoreId=false)
{ {
$memberDao = \DAO\MemberModel::getInstance(); $memberDao = \DAO\MemberModel::getInstance();
$storeId = $memberDao->getInfo($memberId, 'store_id'); if($isStoreId){
$storeId=$memberId;
}else{
$storeId = $memberDao->getInfo($memberId, 'store_id');
}
if (empty($storeId)) { if (empty($storeId)) {
ErrorModel::throwException(CodeConfigModel::emptyStoreId); ErrorModel::throwException(CodeConfigModel::emptyStoreId);
} }
$diliveryMan = \DAO\Order\DiliverymanModel::getInstance(); $diliveryMan = \DAO\Order\DiliverymanModel::getInstance();
$diliveryMans=\Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$diliveryMan, 'getDeliveryManByStoreId'), array($storeId), \Our\ApiConst::oneHourCache, array($storeId)); $diliveryMans=\Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$diliveryMan, 'getDeliveryManByStoreId'), array($storeId), \Our\ApiConst::oneDaySecond, array($storeId));
foreach($diliveryMans as &$dilivery){ foreach($diliveryMans as &$dilivery){
$dilivery['memberAvatar']=$memberDao->getMemberAvatar($dilivery['memberId']); $dilivery['memberAvatar']=$memberDao->getMemberAvatar($dilivery['memberId']);
} }
return $diliveryMans; return $diliveryMans;
} }
public function confirmReceivePayment($memberId,$orderId){ public function confirmReceivePayment($memberId,$storeId,$orderId){
$memberDao = \DAO\MemberModel::getInstance(); $memberDao = \DAO\MemberModel::getInstance();
$storeId = $memberDao->getInfo($memberId, 'store_id'); // $storeId = $memberDao->getInfo($memberId, 'store_id');
$orderDao=\DAO\Order\OrderModel::getInstance(DbNameConst::masterDBConnectName); $orderDao=\DAO\Order\OrderModel::getInstance(DbNameConst::masterDBConnectName);
$where['order_id']=$orderId; $where['order_id']=$orderId;
$where['store_id']=$storeId; $where['store_id']=$storeId;
...@@ -672,6 +692,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -672,6 +692,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$storeDao=\DAO\StoreModel::getInstance(); $storeDao=\DAO\StoreModel::getInstance();
$memberFavoritesStoreMemberStatisticsDao=\DAO\Store\MemberFavoritesStoreStoreMemberStatisticsModel::getInstance(DbNameConst::masterDBConnectName); $memberFavoritesStoreMemberStatisticsDao=\DAO\Store\MemberFavoritesStoreStoreMemberStatisticsModel::getInstance(DbNameConst::masterDBConnectName);
foreach($distincts as $order){ foreach($distincts as $order){
$storeDao->deleteStoreTotalCount($order['storeId']); $storeDao->deleteStoreTotalCount($order['storeId']);
// $orderDao->deleteOrderCache($order['buyerId'], $order['orderId'], $order['storeId'], true, true); // $orderDao->deleteOrderCache($order['buyerId'], $order['orderId'], $order['storeId'], true, true);
$storeMemberStatisticsData['storeId']=$order['storeId']; $storeMemberStatisticsData['storeId']=$order['storeId'];
...@@ -942,8 +963,8 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -942,8 +963,8 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
{ {
$refundReturnDao = \DAO\Order\RefundReturnModel::getInstance(DbNameConst::salveDBConnectName); $refundReturnDao = \DAO\Order\RefundReturnModel::getInstance(DbNameConst::salveDBConnectName);
// $storeMemberStatisticDao = \DAO\StoreMemberStatisticsModel::getInstance(DbNameConst::masterDBConnectName); // $storeMemberStatisticDao = \DAO\StoreMemberStatisticsModel::getInstance(DbNameConst::masterDBConnectName);
// $orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::masterDBConnectName); $orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::masterDBConnectName);
// $orderDao = \DAO\Order\OrderModel::getInstance(DbNameConst::masterDBConnectName); $orderDao = \DAO\Order\OrderModel::getInstance(DbNameConst::masterDBConnectName);
$gmtUpdate = file_get_contents($this->baseDir . PathConst::refundRetrunGmtUpdate); $gmtUpdate = file_get_contents($this->baseDir . PathConst::refundRetrunGmtUpdate);
$gmtUpdate = $gmtUpdate ? $gmtUpdate : ApiConst::zero; $gmtUpdate = $gmtUpdate ? $gmtUpdate : ApiConst::zero;
$this->taskIndex = PageConst::taskPageBegin; $this->taskIndex = PageConst::taskPageBegin;
...@@ -953,14 +974,28 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -953,14 +974,28 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$this->taskIndex++; $this->taskIndex++;
$refundReturns = isset($refundReturns['list']) ? $refundReturns['list'] : false; $refundReturns = isset($refundReturns['list']) ? $refundReturns['list'] : false;
$reduceDatasDistinct=array(); $reduceDatasDistinct=array();
if (!empty($refundReturns)) { if (!empty($refundReturns)) {
foreach ($refundReturns as $refundReturn) { foreach ($refundReturns as $refundReturn) {
$res = $orderGoodsDao->getCountByOrderId($refundReturn['orderId']);
if($res){
$refundReturnWhere['order_id']=$refundReturn['orderId'];
$refundReturnWhere['is_suc_refund']=ApiConst::refundSuccess;
$refundCount= $refundReturnDao->getCount($refundReturnWhere);
if($res==$refundCount){
$orderWhere['order_id']=$refundReturn['orderId'];
$updateData['is_effective']=ApiConst::notEffectiveAllRefund;
$orderDao->update($orderWhere,$updateData);
}
}
$key=$refundReturn['storeId'].'+'.$refundReturn['buyerId']; $key=$refundReturn['storeId'].'+'.$refundReturn['buyerId'];
$reduceDatasDistinct[$key]=$refundReturn; $reduceDatasDistinct[$key]=$refundReturn;
} }
} }
$this->insertStoreMemberStaticsDistinct($reduceDatasDistinct); $this->insertStoreMemberStaticsDistinct($reduceDatasDistinct);
} while ($refundReturns); } while ($refundReturns);
//$storeMemberStatisticDao->addAllReduce($refundReturns); //$storeMemberStatisticDao->addAllReduce($refundReturns);
file_put_contents($this->baseDir . PathConst::refundRetrunGmtUpdate, TIMESTAMP); file_put_contents($this->baseDir . PathConst::refundRetrunGmtUpdate, TIMESTAMP);
...@@ -1074,10 +1109,10 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -1074,10 +1109,10 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
} }
public function getSellerCount($memberId) public function getSellerCount($storeId)
{ {
$memberDao = \DAO\MemberModel::getInstance(); $memberDao = \DAO\MemberModel::getInstance();
$storeId = $memberDao->getInfo($memberId, 'store_id'); // $storeId = $memberDao->getInfo($memberId, 'store_id');
$orderDao = \DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName); $orderDao = \DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName);
$waitReceiveCount = $orderDao->getCountByOrderState($storeId, ApiConst::orderStateWaitConfirm); $waitReceiveCount = $orderDao->getCountByOrderState($storeId, ApiConst::orderStateWaitConfirm);
$waitDeliveryCount = $orderDao->getCountByShippingTypeAndOrderState($storeId); $waitDeliveryCount = $orderDao->getCountByShippingTypeAndOrderState($storeId);
...@@ -1085,10 +1120,10 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -1085,10 +1120,10 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$orderCount=$waitReceiveCount+$waitDeliveryCount+$waitGetCount; $orderCount=$waitReceiveCount+$waitDeliveryCount+$waitGetCount;
return array('waitReceiveCount' => $waitReceiveCount, 'waitDeliveryCount' => $waitDeliveryCount, 'waitGetCount' => $waitGetCount,'orderCount'=>$orderCount); return array('waitReceiveCount' => $waitReceiveCount, 'waitDeliveryCount' => $waitDeliveryCount, 'waitGetCount' => $waitGetCount,'orderCount'=>$orderCount);
} }
public function getSellerRefundCount($memberId) public function getSellerRefundCount($storeId)
{ {
$memberDao = \DAO\MemberModel::getInstance(); $memberDao = \DAO\MemberModel::getInstance();
$storeId = $memberDao->getInfo($memberId, 'store_id'); // $storeId = $memberDao->getInfo($memberId, 'store_id');
$refundReturnDao = \DAO\Order\RefundReturnModel::getInstance(DbNameConst::salveDBConnectName); $refundReturnDao = \DAO\Order\RefundReturnModel::getInstance(DbNameConst::salveDBConnectName);
//待处理 //待处理
$waitRefundProccessCount = $refundReturnDao->getCountByRefundState($storeId); $waitRefundProccessCount = $refundReturnDao->getCountByRefundState($storeId);
...@@ -1096,10 +1131,10 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -1096,10 +1131,10 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$refundCount=$waitRefundProccessCount+$waitRefundReceiveCount; $refundCount=$waitRefundProccessCount+$waitRefundReceiveCount;
return array('waitRefundProccessCount' => $waitRefundProccessCount, 'waitRefundReceiveCount' => $waitRefundReceiveCount, 'refundCount' =>$refundCount); return array('waitRefundProccessCount' => $waitRefundProccessCount, 'waitRefundReceiveCount' => $waitRefundReceiveCount, 'refundCount' =>$refundCount);
} }
public function getStorageAlarmCount($memberId) public function getStorageAlarmCount($storeId)
{ {
$memberDao = \DAO\MemberModel::getInstance(); $memberDao = \DAO\MemberModel::getInstance();
$storeId = $memberDao->getInfo($memberId, 'store_id'); // $storeId = $memberDao->getInfo($memberId, 'store_id');
$goodsDao=\DAO\GoodsModel::getInstance(); $goodsDao=\DAO\GoodsModel::getInstance();
$alertCount=$goodsDao->getAlertCountByStoreId($storeId); $alertCount=$goodsDao->getAlertCountByStoreId($storeId);
return array('alertCount'=>$alertCount); return array('alertCount'=>$alertCount);
......
...@@ -213,14 +213,9 @@ class StoreServiceModel extends \Business\AbstractModel{ ...@@ -213,14 +213,9 @@ class StoreServiceModel extends \Business\AbstractModel{
$storeMember['fav_type'] = \Our\ApiConst::one; $storeMember['fav_type'] = \Our\ApiConst::one;
$storeMembers[] = $storeMember; $storeMembers[] = $storeMember;
$favoritesStoreDao = \DAO\FavoritesStoreModel::getInstance(); $favoritesStoreDao = \DAO\FavoritesStoreModel::getInstance();
$one = $favoritesStoreDao->getOne('store_id',array('store_id'=>$storeId,'member_id'=>$memberId,'fav_type'=>\Our\ApiConst::one,'fav_from'=>\Our\ApiConst::scanFavor),''); $result = $favoritesStoreDao->insertAll($storeMembers);
if(!$one) { if($result) {
$result = $favoritesStoreDao->insertAll($storeMembers); $favoritesStoreDao->updateStoreCollecitonsCache(array($storeId),$memberId,2);
if($result) {
$favoritesStoreDao->updateStoreCollecitonsCache(array($storeId),$memberId,2);
}
$favoritesDao = \DAO\FavoritesStoreModel::getInstance();
\Our\RedisHelper::delCachedFunction(\Redis\Db6\FavoritesStoreRedisModel::getInstance(),array(&$favoritesDao, 'getOne'),array(),array($memberId));
} }
}else{ }else{
......
...@@ -376,8 +376,6 @@ class MemberServiceModel extends \Business\AbstractModel ...@@ -376,8 +376,6 @@ class MemberServiceModel extends \Business\AbstractModel
return false; return false;
} }
$favoritesStoreDao->updateStoreCollecitonsCache($storeIds,$memberId,2); $favoritesStoreDao->updateStoreCollecitonsCache($storeIds,$memberId,2);
$favoritesDao = \DAO\FavoritesStoreModel::getInstance();
\Our\RedisHelper::delCachedFunction(\Redis\Db6\FavoritesStoreRedisModel::getInstance(),array(&$favoritesDao, 'getOne'),array(),array($memberId));
} }
} }
...@@ -1128,7 +1126,7 @@ class MemberServiceModel extends \Business\AbstractModel ...@@ -1128,7 +1126,7 @@ class MemberServiceModel extends \Business\AbstractModel
public function updateMemberAreaInfo(){ public function updateMemberAreaInfo(){
$currentTime = TIMESTAMP; $currentTime = TIMESTAMP;
$startTime = $currentTime-\Our\ApiConst::oneDaySecond; $startTime = $currentTime-\Our\ApiConst::oneDaySecond;
if($currentTime<1545235200){ if($currentTime<1546272000){
$startTime =0; $startTime =0;
} }
$whereSql = \Our\Common::format("member_provinceid = '0' and member_cityid = '0' and register_ip !='' and (member_time between '{0}' and '{1}') ",$startTime,$currentTime); $whereSql = \Our\Common::format("member_provinceid = '0' and member_cityid = '0' and register_ip !='' and (member_time between '{0}' and '{1}') ",$startTime,$currentTime);
......
...@@ -79,7 +79,7 @@ class ShareServiceModel extends \Business\AbstractModel ...@@ -79,7 +79,7 @@ class ShareServiceModel extends \Business\AbstractModel
} }
public function saveDataToSession($data){ public function saveDataToSession($data){
$this->memberDb0Redis=\Redis\Db0\MemberRedisModel::getInstance(); $this->memberDb0Redis=\Redis\Db0\MemberRedisModel::getInstance();
$res= $this->memberDb0Redis->tablerpush($data['key'],json_encode($data)); $res= $this->memberDb0Redis->tableCacheSet($data['key'],json_encode($data),ApiConst::oneDaySecond);
return $res; return $res;
} }
//二进制转图片image/png //二进制转图片image/png
...@@ -111,6 +111,12 @@ class ShareServiceModel extends \Business\AbstractModel ...@@ -111,6 +111,12 @@ class ShareServiceModel extends \Business\AbstractModel
return Common::format(PathConst::shareGroups,$data['groupId'],$data['storeId']); return Common::format(PathConst::shareGroups,$data['groupId'],$data['storeId']);
} }
if($type='smallPrograme'){
$host=\Bootstrap::getUrlIniConfig('resourcesHost');
$url=Common::format($host."/index/getQrcodeFlow?imageKey={0}",$data);
return $url;
}
} }
public function growQrcode($data){ public function growQrcode($data){
...@@ -121,12 +127,21 @@ class ShareServiceModel extends \Business\AbstractModel ...@@ -121,12 +127,21 @@ class ShareServiceModel extends \Business\AbstractModel
$scene= \Our\Common::format(\Our\PathConst::wxStoreParams,$data['id']); $scene= \Our\Common::format(\Our\PathConst::wxStoreParams,$data['id']);
$page=\Our\PathConst::wxStorePath; $page=\Our\PathConst::wxStorePath;
$res=$this->getQrcode($page,$scene); $res=$this->getQrcode($page,$scene);
$fileName=md5($page.$res); if(Common::isJson($res)){
$fileName=$fileName.NameConst::jpgSuffix; $res=json_decode($res,true);
$base64image=$this->dataUri($res,ImageConst::imagePgn); if($res['errcode']==ApiConst::shareLimitProgrameError){
$url= ImageUtil::uploadBase64Image($base64image,ImageConst::shareImage,$fileName); $memberRedis = \Redis\Db0\MemberRedisModel::getInstance();
$this->memberDb0Redis->tableCacheSet($fileName,$url,ApiConst::zero); $memberRedis->tableDel('wechatAccessToken');
return $url; $res=$this->getQrcode($page,$scene);
}
}
$fileName=md5($res);
//$fileName=$fileName.NameConst::jpgSuffix;
// $base64image=$this->dataUri($res,ImageConst::imagePgn);
// $url= ImageUtil::uploadBase64Image($base64image,ImageConst::shareImage,$fileName);
$this->memberDb0Redis->tableCacheSet($fileName,$res,ApiConst::oneDaySecond);
$qrcodeUrl=$this->getQrUrl($fileName,'smallPrograme');
return $qrcodeUrl;
}else{ }else{
return $this->getQrUrl($data); return $this->getQrUrl($data);
// return PathConst::wxDefaultPath; // return PathConst::wxDefaultPath;
...@@ -140,15 +155,28 @@ class ShareServiceModel extends \Business\AbstractModel ...@@ -140,15 +155,28 @@ class ShareServiceModel extends \Business\AbstractModel
if($data['type']==\Our\ApiConst::shareGoods){ if($data['type']==\Our\ApiConst::shareGoods){
if(($data['shareType']==ApiConst::shareWxFriend || $data['shareType']==ApiConst::shareWxFriends)){ if(($data['shareType']==ApiConst::shareWxFriend || $data['shareType']==ApiConst::shareWxFriends)){
if(\Our\ApiConst::isWxPublish){ if(\Our\ApiConst::isWxPublish){
$scene= \Our\Common::format(\Our\PathConst::wxGoodsParams,$data['id']); //$scene= \Our\Common::format(\Our\PathConst::wxGoodsParams,$data['id']);
$scene= \Our\Common::format(\Our\PathConst::wxGoodsParams,$data['goodsCommonid']);
$page=\Our\PathConst::wxGoodsPath; $page=\Our\PathConst::wxGoodsPath;
$res=$this->getQrcode($page,$scene); $res=$this->getQrcode($page,$scene);
$fileName=md5($page.$res); if(Common::isJson($res)){
$fileName=$fileName.NameConst::jpgSuffix; $res=json_decode($res,true);
$base64image=$this->dataUri($res,ImageConst::imagePgn); if($res['errcode']==ApiConst::shareLimitProgrameError){
$url= ImageUtil::uploadBase64Image($base64image,ImageConst::shareImage,$fileName); $memberRedis = \Redis\Db0\MemberRedisModel::getInstance();
$this->memberDb0Redis->tableCacheSet($fileName,$url,ApiConst::zero); $memberRedis->tableDel('wechatAccessToken');
return $url; $res=$this->getQrcode($page,$scene);
}
}
// var_dump($res);exit;
// header('Content-type: image/jpg');
// echo $res;exit;
$fileName=md5($res);
//$fileName=$fileName.NameConst::jpgSuffix;
// $base64image=$this->dataUri($res,ImageConst::imagePgn);
// $url= ImageUtil::uploadBase64Image($base64image,ImageConst::shareImage,$fileName);
$this->memberDb0Redis->tableCacheSet($fileName,$res,ApiConst::oneDaySecond);
$qrcodeUrl=$this->getQrUrl($fileName,'smallPrograme');
return $qrcodeUrl;
}else{ }else{
return $this->getQrUrl($data,'goods'); return $this->getQrUrl($data,'goods');
//return PathConst::wxDefaultPath; //return PathConst::wxDefaultPath;
......
...@@ -75,6 +75,7 @@ abstract class AbstractModel { ...@@ -75,6 +75,7 @@ abstract class AbstractModel {
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);
$this->db->select($field);
$count=$this->db->fetchNum(); $count=$this->db->fetchNum();
$this->db->from($this->_tableName); $this->db->from($this->_tableName);
$this->db->where($where); $this->db->where($where);
......
...@@ -38,10 +38,6 @@ class ArticleModel extends \DAO\AbstractModel{ ...@@ -38,10 +38,6 @@ class ArticleModel extends \DAO\AbstractModel{
return $data; return $data;
} }
public function findFromCache($where,$field= \Our\NameConst::allField){
}
public function getList($where,$field = \Our\NameConst::allField,$order = null){ public function getList($where,$field = \Our\NameConst::allField,$order = null){
$this->setDb($this->dbName); $this->setDb($this->dbName);
if(is_array($where)){ if(is_array($where)){
...@@ -57,6 +53,16 @@ class ArticleModel extends \DAO\AbstractModel{ ...@@ -57,6 +53,16 @@ class ArticleModel extends \DAO\AbstractModel{
return $result; return $result;
} }
public function delArtcileCache($articleClassId = false,$articleId = false){
if($articleClassId){
\Our\RedisHelper::cachedFunction(\Redis\Db10\ArticleRedisModel::getInstance(),array(&$this, 'getList'),array(),array($articleClassId));
}
if($articleId){
\Our\RedisHelper::cachedFunction(\Redis\Db10\ArticleRedisModel::getInstance(),array(&$this, 'find'),array(),array($articleId));
}
}
/** /**
* 类实例 * 类实例
*/ */
......
...@@ -271,18 +271,23 @@ class CartModel extends \DAO\AbstractModel{ ...@@ -271,18 +271,23 @@ class CartModel extends \DAO\AbstractModel{
return false; return false;
} }
public function refundGoodsRemove($storeCarts,$goodsIds){ public function refundGoodsRemove($storeCarts,$goodsIds){
for($i=0;$i<count($storeCarts);$i++){ $newStoreCarts= array();
if(is_array($goodsIds)){
if(in_array($storeCarts[$i]['goodsId'],$goodsIds)){ foreach($storeCarts as $val){
unset($storeCarts[$i]); if(is_array($goodsIds)){
} if(!in_array($val['goodsId'],$goodsIds)){
}else{ array_push($newStoreCarts,$val);
if($storeCarts[$i]['goodsId']==$goodsIds){ // unset($storeCarts[$i]);
unset($storeCarts[$i]); }
}else{
if($val['goodsId']!=$goodsIds){
array_push($newStoreCarts,$val);
}
} }
} }
} return $newStoreCarts;
return $storeCarts;
} }
public function insertAllOrUpdate($datas){ public function insertAllOrUpdate($datas){
......
...@@ -205,6 +205,8 @@ class FavoritesStoreModel extends \DAO\AbstractModel { ...@@ -205,6 +205,8 @@ class FavoritesStoreModel extends \DAO\AbstractModel {
\Our\RedisHelper::delCachedFunction(\Redis\Db6\FavoritesStoreRedisModel::getInstance(),array(&$this, 'getOne'),array(),array($memberId)); \Our\RedisHelper::delCachedFunction(\Redis\Db6\FavoritesStoreRedisModel::getInstance(),array(&$this, 'getOne'),array(),array($memberId));
} }
\Our\RedisHelper::delCachedFunction(\Redis\Db6\FavoritesStoreRedisModel::getInstance(),array(&$this, 'getFavoritesStores'),array(),array($memberId)); \Our\RedisHelper::delCachedFunction(\Redis\Db6\FavoritesStoreRedisModel::getInstance(),array(&$this, 'getFavoritesStores'),array(),array($memberId));
\Our\RedisHelper::delCachedFunction(\Redis\Db6\FavoritesStoreRedisModel::getInstance(), array(&$this, 'selectList'), array(),array($memberId));
//更新个人中心首页数量 //更新个人中心首页数量
\DAO\MemberModel::getInstance()->_changeNum(\Our\NameConst::storeCollection,$memberId,$type == 1 ? -(count($storeIds)) : count($storeIds)); \DAO\MemberModel::getInstance()->_changeNum(\Our\NameConst::storeCollection,$memberId,$type == 1 ? -(count($storeIds)) : count($storeIds));
return true; return true;
......
...@@ -240,8 +240,15 @@ class GoodsModel extends \DAO\AbstractModel { ...@@ -240,8 +240,15 @@ class GoodsModel extends \DAO\AbstractModel {
if($op==\Our\ApiConst::plus){ if($op==\Our\ApiConst::plus){
$updateGoodsNum = -$updateGoodsNum; $updateGoodsNum = -$updateGoodsNum;
} }
if($goodsCommonRedis->tableHExists($onlineGoodsCommonSaleNumKey,$goodsCommonId)){ if($goodsCommonRedis->tableHExists($onlineGoodsCommonSaleNumKey,$goodsCommonId)){
$goodsCommonRedis->tableHIncrBy($onlineGoodsCommonSaleNumKey,$goodsCommonId,$updateGoodsNum); $oldSaleNum = $goodsCommonRedis->tableHGet($onlineGoodsCommonSaleNumKey,$goodsCommonId);
if($op==\Our\ApiConst::plus&&($oldSaleNum+$updateGoodsNum)<\Our\ApiConst::zero){
$updateGoodsNum = \Our\ApiConst::zero;
$goodsCommonRedis->tableHSet($onlineGoodsCommonSaleNumKey,$goodsCommonId,$updateGoodsNum);
}else{
$goodsCommonRedis->tableHIncrBy($onlineGoodsCommonSaleNumKey,$goodsCommonId,$updateGoodsNum);
}
} }
} }
\DAO\PBundlingModel::getInstance()->deletePBundlingByGoodsCommonId($goodsCommonId); \DAO\PBundlingModel::getInstance()->deletePBundlingByGoodsCommonId($goodsCommonId);
......
...@@ -107,6 +107,7 @@ class DiliverymanModel extends \DAO\AbstractModel ...@@ -107,6 +107,7 @@ class DiliverymanModel extends \DAO\AbstractModel
} }
public function getDeliveryManByStoreId($storeId){ public function getDeliveryManByStoreId($storeId){
$where['store_id']=$storeId; $where['store_id']=$storeId;
$where['is_del']=ApiConst::zero;
return $this->getByWhere($where); 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,origin_amount as originAmount,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'; return 'order_id as orderId,coupon_id as couponId,refund_amount as refundAmount,origin_amount as originAmount,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,origin_refund_amount as originRefundAmount';
} }
public function getOrderShippingField() public function getOrderShippingField()
...@@ -478,20 +478,30 @@ class OrderModel extends \DAO\AbstractModel ...@@ -478,20 +478,30 @@ class OrderModel extends \DAO\AbstractModel
} }
public function getOrderOrderTotalOnlineByStoreId($storeId,$today=false){ public function getOrderOrderTotalOnlineByStoreId($storeId,$today=false){
$this->setDb($this->dbName); $this->setDb($this->dbName);
$refundReturnDao=\DAO\Order\RefundReturnModel::getInstance();
$where['store_id']=$storeId; $where['store_id']=$storeId;
$where['order_state']=array('notin',ArrayConst::orderCloseAndCancel); $where['order_state']=array('notin',ArrayConst::orderCloseAndCancel);
$where['refund_state']=array('neq',ApiConst::refundStateAll); // $where['refund_state']=array('neq',ApiConst::refundStateAll);
$where['payment_type']=array('in',ArrayConst::payTypeOnlines); $where['payment_type']=array('in',ArrayConst::orderPayTypeOnlines);
if($today){ if($today){
$todayBegin=Common::getTodayBeginTimpSpan(); $todayBegin=Common::getTodayBeginTimpSpan();
$where['gmt_update']=array('egt',$todayBegin); $where['gmt_update']=array('between',$todayBegin,TIMESTAMP);
$where['gmt_update']=array('elt',TIMESTAMP); // $where['gmt_update']=array('elt',TIMESTAMP);
} }
if(is_array($where)){ if(is_array($where)){
$where= $this->db->getSqlWhereByArray($where); $where= $this->db->getSqlWhereByArray($where);
} }
if($today){
$res=$this->db->from($this->_tableName)->where($where)->select(" buyer_id as buyerId,store_id as storeId,(order_amount-refund_amount) as orderTotalOnline")->fetchOne(); $refundAmount= $refundReturnDao->getSumRefundAmountByStoreId($storeId,$today,true);
}else{
$refundAmount= $refundReturnDao->getSumRefundAmountByStoreId($storeId,false,true);
}
$res=$this->db->from($this->_tableName)->where($where)->select(" buyer_id as buyerId,store_id as storeId,order_amount as orderTotalOnline")->fetchOne();
if(!$res){
$res=array();
$res['orderTotalOnline']=ApiConst::zero;
$res['orderTotalOnline']-=$refundAmount;
}
return $res?$res:array(); return $res?$res:array();
} }
......
...@@ -37,7 +37,16 @@ class OrderGoodsModel extends \DAO\AbstractModel ...@@ -37,7 +37,16 @@ class OrderGoodsModel extends \DAO\AbstractModel
{ {
} }
public function getCountByWhere($where){
$this->setDb($this->dbName);
$goodsCount = $this->db->select("count(*) as cou")->from($this->_tableName)->where($where)->fetchNum();
return $goodsCount?$goodsCount:ApiConst::zero;
}
public function getCountByOrderId($orderId){
$this->setDb($this->dbName);
$where['order_id']=$orderId;
return $this->getCountByWhere($where);
}
public function getOrderGoodsList($where, $field, $group = null, $limit = []) public function getOrderGoodsList($where, $field, $group = null, $limit = [])
{ {
$this->setDb(); $this->setDb();
...@@ -179,12 +188,17 @@ class OrderGoodsModel extends \DAO\AbstractModel ...@@ -179,12 +188,17 @@ class OrderGoodsModel extends \DAO\AbstractModel
{ {
$newOrderGoods = array(); $newOrderGoods = array();
$orderGoods = array_values($orderGoods); $orderGoods = array_values($orderGoods);
for ($i = ApiConst::zero; $i < count($orderGoods); $i++) { foreach($orderGoods as $orderGood){
if ($orderGoods[$i]['refundId'] != ApiConst::zero) { if($orderGood['refundId']!=ApiConst::zero){
array_push($newOrderGoods, $orderGoods); array_push($newOrderGoods, $orderGood);
// unset($orderGoods[$i]);
} }
} }
// for ($i = ApiConst::zero; $i < count($orderGoods); $i++) {
// if ($orderGoods[$i]['refundId'] != ApiConst::zero) {
// array_push($newOrderGoods, $orderGoods);
// // unset($orderGoods[$i]);
// }
// }
$goodsIds = array_column($newOrderGoods, 'goodsId'); $goodsIds = array_column($newOrderGoods, 'goodsId');
return $goodsIds; return $goodsIds;
} }
...@@ -241,7 +255,11 @@ class OrderGoodsModel extends \DAO\AbstractModel ...@@ -241,7 +255,11 @@ class OrderGoodsModel extends \DAO\AbstractModel
// $allGoodsPrice = array_column($orderGoodses, 'goodsPrice'); // $allGoodsPrice = array_column($orderGoodses, 'goodsPrice');
// $allGoodsPrice=array_sum($allGoodsPrice); // $allGoodsPrice=array_sum($allGoodsPrice);
// $allMoney = $allNumbers * $allGoodsPrice; // $allMoney = $allNumbers * $allGoodsPrice;
$thisOrderGoodsAmount = $convertOrderGoods['goodsNum'] * $convertOrderGoods['goodsPrice']; $thisOrderGoodsAmount=ApiConst::zero;
foreach($convertOrderGoods as $convertOrderGood){
$thisOrderGoodsAmount += $convertOrderGood['goodsNum'] * $convertOrderGood['goodsPrice'];
}
$reduceAmount=($discountAmount*$thisOrderGoodsAmount)/($allMoney); $reduceAmount=($discountAmount*$thisOrderGoodsAmount)/($allMoney);
return round($reduceAmount); return round($reduceAmount);
......
...@@ -7,6 +7,7 @@ use Error\CodeConfigModel; ...@@ -7,6 +7,7 @@ use Error\CodeConfigModel;
use Error\ErrorModel; use Error\ErrorModel;
use OSS\Common; use OSS\Common;
use Our\ApiConst; use Our\ApiConst;
use Our\ArrayConst;
use Our\DbNameConst; use Our\DbNameConst;
use Our\DescribeConst; use Our\DescribeConst;
use Our\ImageConst; use Our\ImageConst;
...@@ -43,8 +44,8 @@ class RefundReturnModel extends \DAO\AbstractModel ...@@ -43,8 +44,8 @@ class RefundReturnModel extends \DAO\AbstractModel
public function getCount($where) public function getCount($where)
{ {
$this->setDb(); $this->setDb($this->dbName);
return $this->db->from($this->_tableName)->where($where)->fetchNum(); return $this->db->from($this->_tableName)->where($where)->select()->fetchNum();
} }
public function getAll($where, $field, $db = DbNameConst::salveDBConnectName) public function getAll($where, $field, $db = DbNameConst::salveDBConnectName)
...@@ -55,13 +56,26 @@ class RefundReturnModel extends \DAO\AbstractModel ...@@ -55,13 +56,26 @@ class RefundReturnModel extends \DAO\AbstractModel
} }
public function getRefundSuccessMoneyByStoreId($storeId, $beginTime = false, $endTime = false) public function getRefundSuccessMoneyByStoreId($storeId, $beginTime = false, $endTime = false,$online=false)
{ {
$this->setDb($this->dbName); $this->setDb($this->dbName);
if ($beginTime) { if ($beginTime) {
$where = \Our\Common::format(" store_id={0} and is_suc_refund={1} and gmt_update between {2} and {3}", $storeId, ApiConst::refundSuccess, $beginTime, $endTime); $where['store_id']=$storeId;
$where['is_suc_refund']=ApiConst::refundSuccess;
if($online){
$where['payment_type']=array('in',ArrayConst::orderPayTypeOnlines);
}
$where['gmt_update']=array('between',$beginTime,$endTime);
} else { } else {
$where = \Our\Common::format(" store_id={0} and is_suc_refund={1}", $storeId, ApiConst::refundSuccess); $where['store_id']=$storeId;
$where['is_suc_refund']=ApiConst::refundSuccess;
if($online){
$where['payment_type']=array('in',ArrayConst::orderPayTypeOnlines);
}
//$where = \Our\Common::format(" store_id={0} and is_suc_refund={1}", $storeId, ApiConst::refundSuccess);
}
if(is_array($where)){
$where = $this->db->getSqlWhereByArray($where);
} }
$res = $this->db->from($this->_tableName)->select($this->sumRefundAmount)->where($where)->fetchValue(); $res = $this->db->from($this->_tableName)->select($this->sumRefundAmount)->where($where)->fetchValue();
return !empty($res) ? $res : ApiConst::zero; return !empty($res) ? $res : ApiConst::zero;
...@@ -384,6 +398,7 @@ class RefundReturnModel extends \DAO\AbstractModel ...@@ -384,6 +398,7 @@ class RefundReturnModel extends \DAO\AbstractModel
if ($pics) { if ($pics) {
foreach ($pics as $pic) { foreach ($pics as $pic) {
$readFile = \Our\Common::getStaticFile($pic, ImageConst::refund); $readFile = \Our\Common::getStaticFile($pic, ImageConst::refund);
//$readFile.=ImageConst::ninTyPath;
array_push($picsRes, $readFile); array_push($picsRes, $readFile);
} }
} }
...@@ -414,7 +429,7 @@ class RefundReturnModel extends \DAO\AbstractModel ...@@ -414,7 +429,7 @@ class RefundReturnModel extends \DAO\AbstractModel
} }
if (intval($orderInfo['payment_type']) == ApiConst::wxAppPayType) { if (intval($orderInfo['payment_type']) == ApiConst::wxAppPayType) {
$wxpay = \Payment\WxPay::getInstance(); $wxpay = \Payment\WxPay::getInstance();
unset($param['subMchId']); //unset($param['subMchId']);
$refund_return = $wxpay->refund($param); $refund_return = $wxpay->refund($param);
$this->errorMessage = "微信返回:" . json_encode($refund_return); $this->errorMessage = "微信返回:" . json_encode($refund_return);
if (!($refund_return['return_code'] == 'SUCCESS' && $refund_return['result_code'] == 'SUCCESS')) { if (!($refund_return['return_code'] == 'SUCCESS' && $refund_return['result_code'] == 'SUCCESS')) {
...@@ -469,7 +484,7 @@ class RefundReturnModel extends \DAO\AbstractModel ...@@ -469,7 +484,7 @@ class RefundReturnModel extends \DAO\AbstractModel
} }
if (intval($orderInfo['paymentType']) == ApiConst::wxAppPayType) { if (intval($orderInfo['paymentType']) == ApiConst::wxAppPayType) {
$wxpay = \Payment\WxPay::getInstance(); $wxpay = \Payment\WxPay::getInstance();
unset($param['subMchId']); //unset($param['subMchId']);
$refund_return = $wxpay->refund($param); $refund_return = $wxpay->refund($param);
$this->errorMessage = "微信返回:" . json_encode($refund_return); $this->errorMessage = "微信返回:" . json_encode($refund_return);
if (!($refund_return['return_code'] == 'SUCCESS' && $refund_return['result_code'] == 'SUCCESS')) { if (!($refund_return['return_code'] == 'SUCCESS' && $refund_return['result_code'] == 'SUCCESS')) {
...@@ -727,6 +742,18 @@ class RefundReturnModel extends \DAO\AbstractModel ...@@ -727,6 +742,18 @@ class RefundReturnModel extends \DAO\AbstractModel
$res=$this->db->from($this->_tableName)->where($where)->select(" buyer_id as buyerId,store_id as storeId,(SUM(refund_amount)) AS refundAmount")->fetchOne(); $res=$this->db->from($this->_tableName)->where($where)->select(" buyer_id as buyerId,store_id as storeId,(SUM(refund_amount)) AS refundAmount")->fetchOne();
return $res?$res:array(); return $res?$res:array();
} }
public function getSumRefundAmountByStoreId($storeId,$today=false,$isOnline=false){
$this->setDb($this->dbName);
if($today){
$todayBegin=\Our\Common::getTodayBeginTimpSpan();
$res=$this->getRefundSuccessMoneyByStoreId($storeId,$todayBegin,TIMESTAMP,$isOnline);
}else{
$res=$this->getRefundSuccessMoneyByStoreId($storeId,false,false,$isOnline);
}
return $res?$res:ApiConst::zero;
}
/** /**
* @param $storeId * @param $storeId
* @param $orderState * @param $orderState
......
...@@ -300,10 +300,17 @@ class StoreModel extends \DAO\AbstractModel ...@@ -300,10 +300,17 @@ class StoreModel extends \DAO\AbstractModel
$favoritesStoreDao = \DAO\FavoritesStoreModel::getInstance(); $favoritesStoreDao = \DAO\FavoritesStoreModel::getInstance();
$orderDao=\DAO\Order\OrderModel::getInstance(); $orderDao=\DAO\Order\OrderModel::getInstance();
$storeStatisticsDao=\DAO\StoreStatisticsModel::getInstance(); $storeStatisticsDao=\DAO\StoreStatisticsModel::getInstance();
$storeMemberStaticDao=\DAO\StoreMemberStatisticsModel::getInstance();
$favoritesStoreDao->deleteGetFavoritesCountByStoreId($storeId); $favoritesStoreDao->deleteGetFavoritesCountByStoreId($storeId);
$memberFavoritesStoreStoreMemberStatisticsDao = \DAO\Store\MemberFavoritesStoreStoreMemberStatisticsModel::getInstance(); $memberFavoritesStoreStoreMemberStatisticsDao = \DAO\Store\MemberFavoritesStoreStoreMemberStatisticsModel::getInstance();
$memberFavoritesStoreStoreMemberStatisticsDao->deleteGetGoodsCountOrderTotalByStoreIdCache($storeId); $memberFavoritesStoreStoreMemberStatisticsDao->deleteGetGoodsCountOrderTotalByStoreIdCache($storeId);
\Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$storeMemberStaticDao, 'getGoodsCountOrderTotalByStoreId'), array(), array($storeId));
\Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$memberFavoritesStoreStoreMemberStatisticsDao, 'getGoodsCountOrderTotalByStoreId'), array(), array($storeId));
\Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderDao, 'getShopKeeperCountByStoreId'), array(), array($storeId));
\Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$storeStatisticsDao, 'getByStoreId'), array(), array($storeId));;
\Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$favoritesStoreDao, 'getFavoritesCountByStoreId'), array(), array($storeId));
$orderDao->deleteGetOrderOrderTotalOnlineByStoreIdCache($storeId); $orderDao->deleteGetOrderOrderTotalOnlineByStoreIdCache($storeId);
// \Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$storeStatisticsDao, 'getByStoreId'), array($storeId), array($storeId));;
$storeStatisticsDao->deleteGetByStoreIdCache($storeId); $storeStatisticsDao->deleteGetByStoreIdCache($storeId);
} }
...@@ -608,7 +615,7 @@ class StoreModel extends \DAO\AbstractModel ...@@ -608,7 +615,7 @@ class StoreModel extends \DAO\AbstractModel
$mchId = ''; $mchId = '';
if($store['wx_pay']){ if($store['wx_pay']){
if(!($store['wxpay_mchid']&&$store['onlinepay_flag'])){ if(!($store['wxpay_mchid']&&$store['onlinepay_flag'])){
$errorCode = \Error\CodeConfigModel::orderWxPayError;; $errorCode = \Error\CodeConfigModel::orderWxPayError;
} }
$addKey=\Our\Common::getConfig('password.key'); $addKey=\Our\Common::getConfig('password.key');
if ($store['wxpay_mchid_sign'] == md5($store['gmt_create'].$store['wxpay_mchid'].$addKey)) { if ($store['wxpay_mchid_sign'] == md5($store['gmt_create'].$store['wxpay_mchid'].$addKey)) {
......
...@@ -44,7 +44,7 @@ class DeliveryController extends \Our\Controller_AbstractClient { ...@@ -44,7 +44,7 @@ class DeliveryController extends \Our\Controller_AbstractClient {
* 获得配送员列表 * 获得配送员列表
*/ */
public function getDeliveriersAction(){ public function getDeliveriersAction(){
$result = $this->shopkeeperService->getDiliveryManByStoreId($this->memberId); $result = $this->shopkeeperService->getDiliveryManByStoreId($this->storeId,true);
$result=$result?$result:[]; $result=$result?$result:[];
if($result!==false){ if($result!==false){
$this->success($result,\Our\DescribeConst::successMessage,\Our\DescribeConst::successMessage); $this->success($result,\Our\DescribeConst::successMessage,\Our\DescribeConst::successMessage);
......
...@@ -111,7 +111,7 @@ class ShopkeeperController extends \Our\Controller_AbstractClient { ...@@ -111,7 +111,7 @@ class ShopkeeperController extends \Our\Controller_AbstractClient {
*/ */
public function orderReceiveAction(){ public function orderReceiveAction(){
$orderId = $this->req['data']['orderId']; $orderId = $this->req['data']['orderId'];
$result = $this->shopkeeperService->orderReceive($this->memberId, $orderId); $result = $this->shopkeeperService->orderReceive($this->storeId, $orderId,true);
if ($result) { if ($result) {
$this->success(array(), \Our\DescribeConst::successMessage, \Our\DescribeConst::successMessage); $this->success(array(), \Our\DescribeConst::successMessage, \Our\DescribeConst::successMessage);
}else{ }else{
...@@ -128,7 +128,7 @@ class ShopkeeperController extends \Our\Controller_AbstractClient { ...@@ -128,7 +128,7 @@ class ShopkeeperController extends \Our\Controller_AbstractClient {
$pageSize=isset($this->req['data']['pageSize'])?$this->req['data']['pageSize']:10; $pageSize=isset($this->req['data']['pageSize'])?$this->req['data']['pageSize']:10;
$orderState = isset($this->req['data']['orderState'])?$this->req['data']['orderState']:''; $orderState = isset($this->req['data']['orderState'])?$this->req['data']['orderState']:'';
$keyword = isset($this->req['data']['keyword'])?$this->req['data']['keyword']:''; $keyword = isset($this->req['data']['keyword'])?$this->req['data']['keyword']:'';
$result = $this->shopkeeperService->getStoreOrders($this->memberId,$pageIndex,$pageSize,$orderState,$keyword); $result = $this->shopkeeperService->getStoreOrders($this->storeId,$pageIndex,$pageSize,$orderState,$keyword,true);
$this->success($result); $this->success($result);
if($result){ if($result){
$this->success(array(),\Our\DescribeConst::successMessage,\Our\DescribeConst::successMessage); $this->success(array(),\Our\DescribeConst::successMessage,\Our\DescribeConst::successMessage);
...@@ -143,7 +143,7 @@ class ShopkeeperController extends \Our\Controller_AbstractClient { ...@@ -143,7 +143,7 @@ class ShopkeeperController extends \Our\Controller_AbstractClient {
$pageSize=$this->getPageSize(); $pageSize=$this->getPageSize();
$orderState = isset($this->req['data']['orderState'])?$this->req['data']['orderState']:''; $orderState = isset($this->req['data']['orderState'])?$this->req['data']['orderState']:'';
$keyword = isset($this->req['data']['keyword'])?$this->req['data']['keyword']:''; $keyword = isset($this->req['data']['keyword'])?$this->req['data']['keyword']:'';
$result = $this->shopkeeperService->getOrders($this->memberId,$pageIndex,$pageSize,$orderState,$keyword); $result = $this->shopkeeperService->getOrders($this->storeId,$pageIndex,$pageSize,$orderState,$keyword,true);
$this->success($result); $this->success($result);
// if($result){ // if($result){
// $this->success(array(),\Our\DescribeConst::successMessage,\Our\DescribeConst::successMessage); // $this->success(array(),\Our\DescribeConst::successMessage,\Our\DescribeConst::successMessage);
...@@ -183,7 +183,7 @@ class ShopkeeperController extends \Our\Controller_AbstractClient { ...@@ -183,7 +183,7 @@ class ShopkeeperController extends \Our\Controller_AbstractClient {
* 获得订单数量 * 获得订单数量
*/ */
public function countAction(){ public function countAction(){
$result = $this->shopkeeperService->getCount($this->memberId); $result = $this->shopkeeperService->getCount($this->storeId);
if(!empty($result)){ if(!empty($result)){
$this->success($result); $this->success($result);
} }
...@@ -193,7 +193,7 @@ class ShopkeeperController extends \Our\Controller_AbstractClient { ...@@ -193,7 +193,7 @@ class ShopkeeperController extends \Our\Controller_AbstractClient {
public function receivePaymentAction(){ public function receivePaymentAction(){
$shopkeeperService=\Business\Store\ShopkeeperServiceModel::getInstance(); $shopkeeperService=\Business\Store\ShopkeeperServiceModel::getInstance();
$res=$shopkeeperService->confirmReceivePayment($this->memberId,$this->req['data']['orderId']); $res=$shopkeeperService->confirmReceivePayment($this->memberId,$this->storeId,$this->req['data']['orderId']);
if($res){ if($res){
$this->success(array(),\Our\DescribeConst::successMessage); $this->success(array(),\Our\DescribeConst::successMessage);
}else{ }else{
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<span id="price"></span> <span id="price"></span>
</div> </div>
<div class="qrcode" id="qrcode"> <div class="qrcode" id="qrcode">
<img id="qrImg" src="" /> <img id="qrImg" width="250" height="250" src="" />
<div id="qrcodeImg"></div> <div id="qrcodeImg"></div>
<p id="tip"></p> <p id="tip"></p>
</div> </div>
...@@ -63,13 +63,11 @@ ...@@ -63,13 +63,11 @@
if(pageObj.price != pageObj.discount) if(pageObj.price != pageObj.discount)
document.getElementById("price").innerHTML = "<span style='font-size:30px;'>¥</span>"+(pageObj.price / 100).toFixed(2); document.getElementById("price").innerHTML = "<span style='font-size:30px;'>¥</span>"+(pageObj.price / 100).toFixed(2);
if(pageObj.type<=2){
new QRCode(document.getElementById('qrcodeImg'), pageObj.url); document.getElementById("qrImg").src = pageObj.qrImg;}
// if(pageObj.type<=2){ else{
// document.getElementById("qrImg").src = pageObj.qrImg;} new QRCode(document.getElementById('qrcodeImg'), pageObj.url);
// else{ }
// new QRCode(document.getElementById('qrcodeImg'), pageObj.url);
// }
......
...@@ -161,6 +161,7 @@ ...@@ -161,6 +161,7 @@
</div> </div>
</body> </body>
<script> <script>
// new QRCode(document.getElementById('qrcodeImg'), { // new QRCode(document.getElementById('qrcodeImg'), {
// text: '<?php //echo $params['qrCode']."?x-oss-process=image/resize,m_fill,h_186,w_186";?>//', // text: '<?php //echo $params['qrCode']."?x-oss-process=image/resize,m_fill,h_186,w_186";?>//',
// width: 250, // width: 250,
......
...@@ -162,11 +162,19 @@ ...@@ -162,11 +162,19 @@
</div> </div>
</body> </body>
<script> <script>
new QRCode(document.getElementById('qrcodeImg'), { var shareType="<?php echo $params['shareType'];?>";
text: '<?php echo $params['qrCode'];?>', var qrCode='<?php echo $params['qrCode'];?>';
width: 250, var shareType=parseInt(shareType);
height: 250 if(shareType==1 || shareType==2){
document.getElementById('qrcodeImg').innerHTML='<img id="qrcodeImg" src="'+ qrCode+'" alt="">';
}else{
new QRCode(document.getElementById('qrcodeImg'), {
text: '<?php echo $params['qrCode'];?>',
width: 250,
height: 250
});
}
});
</script> </script>
</html> </html>
\ No newline at end of file
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<div class="detail"> <div class="detail">
<p class="title c1 s1"><?php echo $problem['problemTitle'];?></p> <p class="title c1 s1"><?php echo $problem['problemTitle'];?></p>
<p class="desc c3 s3"> <p class="desc c3 s3">
<?php echo $problem['problemContent'];?> <?php echo htmlspecialchars_decode($problem['problemContent']);?>
</p> </p>
</div> </div>
</body> </body>
......
...@@ -122,7 +122,7 @@ config.url.resourcesHost = "http://local.qm.com" ...@@ -122,7 +122,7 @@ config.url.resourcesHost = "http://local.qm.com"
config.url.userHost = "" config.url.userHost = ""
; oss 域名 ; oss 域名
config.url.ossHost = "http://qmoss-01.oss-cn-hangzhou.aliyuncs.com" config.url.ossHost = "https://imgpre.shenbd.com"
;推送域名 ;推送域名
config.url.pushHost="192.168.1.201:9503"; config.url.pushHost="192.168.1.201:9503";
......
<?php
/**
* APP微信支付回调
* User: liuyuzhen
* Date: 2018/7/3
* Time: 15:23
* Description:
*/
include 'security.php';
date_default_timezone_set("Asia/Shanghai");
mb_internal_encoding("UTF-8");
define("APPLICATION_PATH", realpath(dirname(__FILE__) . '/../../'));
error_reporting(E_ALL);
define("APP_ENV",ini_get('yaf.environ'));
define("TIMESTAMP",time());
$app = new \Yaf\Application(APPLICATION_PATH . "/conf/application.ini");
$app->bootstrap();
$paymentService = \Business\Order\PaymentServiceModel::getInstance();
$paymentService->updateOrderToPayed(\Our\NameConst::wxAppChannel,true);
\ 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