Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
my-yaf-project
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenchuanwen
my-yaf-project
Commits
164a57d0
Commit
164a57d0
authored
Nov 13, 2018
by
christ
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master_dev' of git.shenbd.com:qm-develop/shenbd
parents
14f9221a
ceeca93b
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
80 additions
and
69 deletions
+80
-69
Cart.php
application/controllers/Cart.php
+2
-28
Abstract.php
application/library/Our/Controller/Abstract.php
+1
-1
AbstractIndex.php
application/library/Our/Controller/AbstractIndex.php
+1
-1
CartService.php
application/models/Business/Cart/CartService.php
+16
-5
AddressService.php
application/models/Business/User/AddressService.php
+41
-18
MemberService.php
application/models/Business/User/MemberService.php
+2
-1
Area.php
application/models/DAO/Area.php
+1
-0
CodeConfig.php
application/models/Error/CodeConfig.php
+14
-13
application.ini
conf/application.ini
+2
-2
No files found.
application/controllers/Cart.php
View file @
164a57d0
...
...
@@ -117,7 +117,7 @@ class CartController extends \Our\Controller_AbstractApi{
$storeCartData
=
$cartService
->
checkCouponForCart
(
$storeCartData
,
$this
->
memberId
);
//$this->success($storeCartData);
if
(
CURRENTVERSION
==
\Our\NameConst
::
versionOne
){
$storeCartData
=
$cartService
->
getDeliveryTypeForCartNew
(
$address
,
$storeCartData
);
$storeCartData
=
$cartService
->
getDeliveryTypeForCartNew
(
$address
,
$storeCartData
,
$this
->
memberId
);
//$this->success($storeCartData);
$data
=
$cartService
->
getFormatCartListForOrderNew
(
$storeCartData
,
$address
);
}
else
{
...
...
@@ -128,31 +128,6 @@ class CartController extends \Our\Controller_AbstractApi{
}
/**
* 购物车购买
*/
public
function
checkoutNewAction
(){
$cartService
=
\Business\Cart\CartServiceModel
::
getInstance
();
$data
=
$this
->
req
[
\Our\NameConst
::
data
];
$sess
=
\Yaf\Session
::
getInstance
();
$currentAddress
=
$sess
->
get
(
'currentAddress'
);
$address
=
$cartService
->
checkCurrentAddress
(
$currentAddress
,
$this
->
memberId
);
$storeCartList
=
$cartService
->
checkCart
(
$data
,
$this
->
memberId
);
$pBundlingService
=
\Business\Goods\GroupSaleServiceModel
::
getInstance
();
$cartList
=
$pBundlingService
->
getFormatCartListForOrder
(
$storeCartList
,
$this
->
memberId
,
true
);
$gcIds
=
isset
(
$cartList
[
'gcIds'
])
?
$cartList
[
'gcIds'
]
:
array
();
$storeCartData
=
array
(
'cartList'
=>
$cartList
[
'list'
],
'storeIds'
=>
$storeCartList
[
'storeIds'
],
'goodsIds'
=>
$storeCartList
[
'goodsIds'
],
'goodsCommonIds'
=>
$storeCartList
[
'goodsCommonIds'
],
'blIds'
=>
$storeCartList
[
'blIds'
],
'gcIds'
=>
$gcIds
);
//var_dump($storeCartData);
$storeCartData
=
$cartService
->
checkCouponForCart
(
$storeCartData
,
$this
->
memberId
);
//$this->success($storeCartData);
$storeCartData
=
$cartService
->
getDeliveryTypeForCartNew
(
$address
,
$storeCartData
);
$data
=
$cartService
->
getFormatCartListForOrderNew
(
$storeCartData
,
$address
);
$this
->
success
(
$data
);
}
/**
* 立即购买
*/
...
...
@@ -170,8 +145,7 @@ class CartController extends \Our\Controller_AbstractApi{
$storeCartData
=
$cartService
->
checkCouponForCart
(
$storeCartData
,
$this
->
memberId
);
//$this->success($storeCartData);
if
(
CURRENTVERSION
==
\Our\NameConst
::
versionOne
){
$storeCartData
=
$cartService
->
getDeliveryTypeForCartNew
(
$address
,
$storeCartData
);
//$this->success($storeCartData);
$storeCartData
=
$cartService
->
getDeliveryTypeForCartNew
(
$address
,
$storeCartData
,
$this
->
memberId
);
$data
=
$cartService
->
getFormatCartListForOrderNew
(
$storeCartData
,
$address
);
}
else
{
$storeCartData
=
$cartService
->
getDeliveryTypeForCart
(
$address
,
$storeCartData
);
...
...
application/library/Our/Controller/Abstract.php
View file @
164a57d0
...
...
@@ -9,7 +9,7 @@ abstract class Controller_Abstract extends \Yaf\Controller_Abstract {
public
function
init
(){
$this
->
req
=
$this
->
getRequest
()
->
getPost
();
$version
=
$this
->
req
[
'
data'
][
'
currentVersion'
];
$version
=
$this
->
req
[
'currentVersion'
];
if
(
$version
){
define
(
'CURRENTVERSION'
,
$version
);
}
else
{
...
...
application/library/Our/Controller/AbstractIndex.php
View file @
164a57d0
...
...
@@ -23,7 +23,7 @@ abstract class Controller_AbstractIndex extends \Our\Controller_Abstract {
}
public
function
init
(){
parent
::
init
();
$this
->
req
=
$this
->
getRequest
()
->
getPost
();
//
$this->req=$this->getRequest()->getPost();
$postData
=
$this
->
req
[
'data'
];
$this
->
checkEncrypt
();
if
(
isset
(
$postData
[
NameConst
::
sessionKey
])
&&!
empty
(
$postData
[
NameConst
::
sessionKey
])){
...
...
application/models/Business/Cart/CartService.php
View file @
164a57d0
...
...
@@ -605,8 +605,14 @@ class CartServiceModel extends \Business\AbstractModel{
$storeCarts
=
$storeCartData
[
'cartList'
][
$storeId
];
$deliverySetting
[
'onelinePay'
]
=
$store
[
'wx_pay'
];
//是否支持线上支付
$deliverySetting
[
'offlinePay'
]
=
$store
[
'offline_pay'
];
if
(
$deliverySetting
[
'offlinePay'
]){
$deliverySetting
[
'offlinePayway'
]
=
$store
[
'offline_payway'
];
if
(
\Our\Common
::
isSerialized
(
$store
[
'offline_payway'
])){
$paywayArray
=
unserialize
(
$store
[
'offline_payway'
]);
$deliverySetting
[
'offlinePayway'
]
=
$paywayArray
[
'payway'
];
}
else
{
$deliverySetting
[
'offlinePayway'
]
=
$store
[
'offline_payway'
];
}
}
$deliverySetting
[
'aogPay'
]
=
$store
[
'aog_pay'
];
$deliverySetting
[
'buyerDistribution'
]
=
$store
[
'buyer_distribution'
];
...
...
@@ -663,10 +669,14 @@ class CartServiceModel extends \Business\AbstractModel{
* @param $address
* @param $storeCartData
*/
public
function
getDeliveryTypeForCartNew
(
$address
,
$storeCartData
,
$dbName
=
\Our\DbNameConst
::
salveDBConnectName
,
$checkFlag
=
false
){
public
function
getDeliveryTypeForCartNew
(
$address
,
$storeCartData
,
$
memberId
,
$
dbName
=
\Our\DbNameConst
::
salveDBConnectName
,
$checkFlag
=
false
){
$storeIds
=
$storeCartData
[
'storeIds'
];
$storeDao
=
\DAO\StoreModel
::
getInstance
();
$deliveryFormulaDao
=
\DAO\DeliveryFormulaModel
::
getInstance
(
$dbName
);
$buyerMobile
=
\DAO\MemberModel
::
getInstance
(
$dbName
)
->
getInfo
(
$memberId
,
'member_mobile'
);
if
(
$buyerMobile
&&!
\Our\Common
::
checkMobilePhone
(
$buyerMobile
)){
$buyerMobile
=
\Our\NameConst
::
emptyString
;
}
foreach
(
$storeIds
as
$storeId
){
$store
=
$storeDao
->
get
(
$storeId
,
false
);
$storeCarts
=
$storeCartData
[
'cartList'
][
$storeId
];
...
...
@@ -692,7 +702,8 @@ class CartServiceModel extends \Business\AbstractModel{
'address'
=>
(
$store
[
'store_address'
]
.
$store
[
'store_subaddress'
]),
'longitude'
=>
$store
[
'store_longitude'
],
'latitude'
=>
$store
[
'store_latitude'
],
'cityCode'
=>
$store
[
'store_citycode'
]
'cityCode'
=>
$store
[
'store_citycode'
],
'buyerMobile'
=>
$buyerMobile
);
if
(
$deliverySetting
[
'buyerDistribution'
]){
$selfDeliveryTimeData
=
$deliveryFormulaDao
->
getBuyerFormulaForCart
(
$store
);
...
...
@@ -958,7 +969,7 @@ class CartServiceModel extends \Business\AbstractModel{
$newStoreData
[
'leftAmount'
]
=
\Our\ApiConst
::
zero
;
$newStoreData
[
'inServiceAreaFlag'
]
=
\Our\ApiConst
::
zero
;
$newStoreData
[
'storeAddress'
]
=
$deliverySetting
[
'storeAddress'
];
if
(
$deliverySetting
[
'sellerDistribution'
]
==
\Our\ApiConst
::
one
&&
$deliverySetting
[
'deliverTimeList'
]
){
if
(
$deliverySetting
[
'sellerDistribution'
]
==
\Our\ApiConst
::
one
){
$deliveryTimes
=
$deliverySetting
[
'deliverTimeList'
];
$newStoreData
[
'inServiceAreaFlag'
]
=
$deliverySetting
[
'inServiceAreaFlag'
];
...
...
@@ -966,7 +977,7 @@ class CartServiceModel extends \Business\AbstractModel{
$delivery
=
array
();
$delivery
[
'name'
]
=
\Our\DescribeConst
::
deliveryNameStore
;
$delivery
[
'type'
]
=
\Our\ApiConst
::
deliveryStore
;
$deliveryFee
=
$deliverySetting
[
'sellerDefaultFee'
]
;
$deliveryFee
=
isset
(
$deliverySetting
[
'sellerDefaultFee'
])
&&
$deliverySetting
[
'sellerDefaultFee'
]
?
$deliverySetting
[
'sellerDefaultFee'
]
:
\Our\ApiConst
::
zero
;
$shippingFee
=
$deliveryFee
;
$delivery
[
'isChoosed'
]
=
\Our\ApiConst
::
one
;
$delivery
[
'deliveryFee'
]
=
$deliveryFee
;
...
...
application/models/Business/User/AddressService.php
View file @
164a57d0
...
...
@@ -12,8 +12,7 @@ use Our\ApiConst;
class
AddressServiceModel
extends
\Business\AbstractModel
{
public
function
init
()
{
public
function
init
(){
}
...
...
@@ -215,29 +214,50 @@ class AddressServiceModel extends \Business\AbstractModel {
$limit
=
\Our\ApiConst
::
defaultAddressCount
;
//1、判断当前用户的地址列表中是否存在和当前经纬度坐标小于200的地址(当前经纬度是否存在对应收货地址)
$addressList
=
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db8\AddressRedisModel
::
getInstance
(),
array
(
&
$addressDao
,
'selectByWhere'
),
array
(
$condition
,
$columns
),
\Our\ApiConst
::
oneHour
,
array
(
$memberId
));
$shootFlag
=
\Our\ApiConst
::
zero
;
//是否找到完全匹配地址
if
(
$addressList
){
$newAddressList
=
array
();
foreach
(
$addressList
as
$addr
){
if
(
$tempLatLng
[
'lat'
]
==
$addr
[
'lat'
]
&&
$tempLatLng
[
'lng'
]
==
$addr
[
'lng'
]){
$address
=
array
();
$address
[
'addressId'
]
=
$addr
[
'address_id'
];
$address
[
'address'
]
=
$addr
[
'address'
];
$address
[
'name'
]
=
$addr
[
'name'
];
$address
[
'tagType'
]
=
$addr
[
'tag_type'
];
$address
[
'lng'
]
=
$addr
[
'lng'
];
$address
[
'lat'
]
=
$addr
[
'lat'
];
$address
[
'cityCode'
]
=
$addr
[
'citycode'
];
$choosedAddressId
=
$addr
[
'addressId'
];
$newAddress
=
$address
;
$newAddress
[
'chooseFlag'
]
=
\Our\ApiConst
::
one
;
$sess
[
'currentAddress'
]
=
$newAddress
;
$returnAddresses
[]
=
$address
;
$shootFlag
=
\Our\ApiConst
::
one
;
break
;
}
$newAddressList
[
$addr
[
'address_id'
]]
=
$addr
;
$distince
=
\Our\CommonExtension
::
getDistance
(
$tempLatLng
[
'lat'
],
$tempLatLng
[
'lng'
],
$addr
[
'lat'
],
$addr
[
'lng'
],
1
);
$distinceArray
[
$addr
[
'address_id'
]]
=
$distince
;
}
$pos
=
array_search
(
min
(
$distinceArray
),
$distinceArray
);
$minDistince
=
$distinceArray
[
$pos
];
if
(
$minDistince
<
\Our\ApiConst
::
minDistanceForCurrentPosition
){
$address
=
array
();
$address
[
'addressId'
]
=
$newAddressList
[
$pos
][
'address_id'
];
$address
[
'address'
]
=
$newAddressList
[
$pos
][
'address'
];
$address
[
'name'
]
=
$newAddressList
[
$pos
][
'name'
];
$address
[
'tagType'
]
=
$newAddressList
[
$pos
][
'tag_type'
];
$address
[
'lng'
]
=
$newAddressList
[
$pos
][
'lng'
];
$address
[
'lat'
]
=
$newAddressList
[
$pos
][
'lat'
];
$address
[
'cityCode'
]
=
$newAddressList
[
$pos
][
'citycode'
];
$choosedAddressId
=
$address
[
'addressId'
];
$newAddress
=
$address
;
$newAddress
[
'chooseFlag'
]
=
\Our\ApiConst
::
one
;
$sess
[
'currentAddress'
]
=
$newAddress
;
$returnAddresses
[]
=
$address
;
//如果没有找到完全匹配地址并且缓存里面的地址页没有命中则可以命中当前选择地址200米范围内的地址
if
(
$shootFlag
==
\Our\ApiConst
::
zero
&&
$currentAddress
[
'chooseFlag'
]
==
\Our\ApiConst
::
zero
){
$pos
=
array_search
(
min
(
$distinceArray
),
$distinceArray
);
$minDistince
=
$distinceArray
[
$pos
];
if
(
$minDistince
<
\Our\ApiConst
::
minDistanceForCurrentPosition
){
$address
=
array
();
$address
[
'addressId'
]
=
$newAddressList
[
$pos
][
'address_id'
];
$address
[
'address'
]
=
$newAddressList
[
$pos
][
'address'
];
$address
[
'name'
]
=
$newAddressList
[
$pos
][
'name'
];
$address
[
'tagType'
]
=
$newAddressList
[
$pos
][
'tag_type'
];
$address
[
'lng'
]
=
$newAddressList
[
$pos
][
'lng'
];
$address
[
'lat'
]
=
$newAddressList
[
$pos
][
'lat'
];
$address
[
'cityCode'
]
=
$newAddressList
[
$pos
][
'citycode'
];
$choosedAddressId
=
$address
[
'addressId'
];
$newAddress
=
$address
;
$newAddress
[
'chooseFlag'
]
=
\Our\ApiConst
::
one
;
$sess
[
'currentAddress'
]
=
$newAddress
;
$returnAddresses
[]
=
$address
;
}
}
}
//2、如果不存在,存入当前经纬度作为临时地址,并且取当前用户最近使用过的最多3条地址返回去
...
...
@@ -447,7 +467,10 @@ class AddressServiceModel extends \Business\AbstractModel {
if
(
$fromWx
){
$citList
=
$areaDao
->
getCityListWithoutCounty
();
}
else
{
\Our\Log
::
getInstance
()
->
write
(
microtime
(),
'/data/log/applogtest'
);
$citList
=
$areaDao
->
getCityList
();
\Our\Log
::
getInstance
()
->
write
(
microtime
(),
'/data/log/applogtest'
);
}
if
(
$citList
){
return
$citList
;
...
...
application/models/Business/User/MemberService.php
View file @
164a57d0
...
...
@@ -11,6 +11,7 @@ use Our\ApiConst;
use
Our\Common
;
use
Our\CommonExtension
;
use
Our\DbNameConst
;
use
Our\NameConst
;
/**
...
...
@@ -66,7 +67,7 @@ class MemberServiceModel extends \Business\AbstractModel
$storeFd
=
$storeRedisDb0
->
tableHGet
(
trim
(
$member
[
'store_id'
]),
'fd'
);
if
(
!
empty
(
$storeFd
)){
$push
=
\Our\Push
::
getInstance
();
$push
->
addOneToClient
(
array
(
'storeId'
=>
$member
[
'store_id'
],
'type'
=>
\Our\ApiConst
::
messageOtherLogin
,
'op'
=>
NameConst
::
logOut
,
'num'
=>
\Our\ApiConst
::
zero
,
'params'
=>
array
(
'c'
=>
'member'
,
'm'
=>
'logOut'
)));
$push
->
addOneToClient
(
array
(
'storeId'
=>
$member
[
'store_id'
],
'type'
=>
\Our\ApiConst
::
messageOtherLogin
,
'op'
=>
\Our\
NameConst
::
logOut
,
'num'
=>
\Our\ApiConst
::
zero
,
'params'
=>
array
(
'c'
=>
'member'
,
'm'
=>
'logOut'
)));
$push
->
sendTcpMessage
();
}
$this
->
updataSellerToken
(
$member
);
...
...
application/models/DAO/Area.php
View file @
164a57d0
...
...
@@ -99,6 +99,7 @@ class AreaModel extends \DAO\AbstractModel {
$addressRedis
=
AddressRedisModel
::
getInstance
();
$cityList
=
$addressRedis
->
find
(
'cityList'
);
if
(
$cityList
){
\Our\Log
::
getInstance
()
->
write
(
json_encode
(
$cityList
),
'/data/log/applog'
);
return
$cityList
;
}
$areaList
=
$this
->
getAllCityList
();
...
...
application/models/Error/CodeConfig.php
View file @
164a57d0
...
...
@@ -286,29 +286,30 @@ class CodeConfigModel
const
notAllowDelete
=
300114
;
const
emptyDeliveryTime
=
300115
;
const
noExpressDeliveryForOrder1
=
30115
;
const
goodsNoStoreForCartOrOrder1
=
30116
;
const
platFormAreadyIn
=
300117
;
const
confirmReceiveError
=
300118
;
const
alreadyExsitDeliveryMan
=
300119
;
const
updateOrderFail
=
300120
;
const
selectDeliveryFail
=
300121
;
const
alreadyExsitQmDeliveryLog
=
300122
;
const
notExsitDeliveryMan
=
300123
;
const
addDeliveryManError
=
300124
;
const
updateOrderFail
=
300120
;
const
selectDeliveryFail
=
300121
;
const
notAllowUpdataOrderAmount
=
300125
;
const
noEnoughStorageForBundlingGoods
=
30118
;
const
noOrderWaitToPay
=
30119
;
const
wrongEvaluation
=
30120
;
const
selfGoodsForStoreOrder
=
30121
;
const
refundAddPointsLogError
=
30122
;
const
wrongDeliveryTime
=
300123
;
const
wrongBuyerTimeRangeForOrder
=
300124
;
const
emptyBuyerMobile
=
300125
;
const
wrongBuyerMobile
=
300126
;
const
leftAmountError
=
300127
;
const
noExpressDeliveryForOrder1
=
30128
;
const
noEnoughStorageForBundlingGoods
=
30129
;
const
noOrderWaitToPay
=
30130
;
const
wrongEvaluation
=
30131
;
const
selfGoodsForStoreOrder
=
3032
;
const
refundAddPointsLogError
=
30133
;
const
wrongDeliveryTime
=
300134
;
const
wrongBuyerTimeRangeForOrder
=
300135
;
const
emptyBuyerMobile
=
300136
;
//店铺相关错误码
//商品分类
...
...
conf/application.ini
View file @
164a57d0
...
...
@@ -374,7 +374,7 @@ elastic.master.host="192.168.1.201"
elastic.master.port
=
"9200"
elastic.master.scheme
=
"http"
;
[lyz
test
: common]
[lyz : common]
; 数据库配置
resources.database.params.driver
=
"pdo_mysql"
resources.database.params.hostname
=
"127.0.0.1"
...
...
@@ -421,7 +421,7 @@ elastic.master.host="192.168.1.201"
elastic.master.port
=
"9200"
elastic.master.scheme
=
"http"
;
[lyz : common]
[lyz
test
: common]
; 数据库配置
resources.database.params.driver
=
"pdo_mysql"
resources.database.params.hostname
=
"127.0.0.1"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment