Commit 8a835653 authored by liuyuzhen's avatar liuyuzhen

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

parents 190722d9 e06683b1
<?php
class ShareController extends \Our\Controller_AbstractIndex {
public $memberId;
public function createIndexAction()
{
$shareService =\Business\User\ShareServiceModel::getInstance();
$saveData= $shareService->getSaveData($this->req['data']);
$shareService->saveDataToSession($saveData);
$res=$shareService->excuteCommand($this->key);
$this->success($res);
}
}
......@@ -131,6 +131,8 @@ class ApiConst
const refundSellerAgree = 2;
const refundSellerRefuse = 3;
const refundTypeGoods = 2;
const returnTypeNotReturn=1;
const returnTypeMustReturn=2;
const refundTypeMoney = 1;
const refundApplyOnlyMoney = 1;
......
......@@ -151,6 +151,8 @@ class NameConst {
const leftBracket = '[';
const rightBracket = ']';
const elasticName='elastic.master';
const searchDbName='qmcs';
}
?>
\ No newline at end of file
......@@ -22,7 +22,7 @@ use Our\ImageUtil;
class RefundServiceModel extends \Business\AbstractModel
{
private $orderField = "buyer_id as buyerId,buyer_name as buyerName,order_id as orderId,order_sn as orderSn,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,need_shipping_fee as needShippingFee,payment_code as paymentCode,delay_time as delayTime";
private $orderGoodsField = "commis_rate as commisRate,goods_type as goodsType,order_id as orderId,rec_id as recId,goods_id as goodsId,goods_name as goodsName,goods_price as goodsPrice,goods_num as goodsNum,goods_image as goodsImage,goods_pay_price as goodsPayPrice,sale_act_id as saleActId,sale_id as saleId,comment_state as commentState,is_refund as isRefund,goods_spec as goodsSpec,goods_group as goodsGroup";
private $orderGoodsField = "commis_rate as commisRate,goods_type as goodsType,order_id as orderId,rec_id as recId,goods_id as goodsId,goods_name as goodsName,goods_price as goodsPrice,goods_num as goodsNum,goods_image as goodsImage,goods_pay_price as goodsPayPrice,sale_act_id as saleActId,sale_id as saleId,comment_state as commentState,is_refund as isRefund,goods_spec as goodsSpec,goods_group as goodsGroup,refund_id as refundId";
private $addressField = " mob_phone as MobPhone,tel_phone as TelPhone,address as address,area_info as areaInfo,lng,lat,address_id as addressId,subaddress as subAddress";
private $daddressField = "address_id as addressId,store_id as storeId,seller_name as sellerName,area_id as areaId,city_id as cityId,area_info as areaInfo,address,telphone,company,is_store_address as isStoreAddress,is_default as isDefault";
......@@ -337,6 +337,12 @@ class RefundServiceModel extends \Business\AbstractModel
$orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::masterDBConnectName);
$orderLogDao = \DAO\Order\OrderLogModel::getInstance(DbNameConst::masterDBConnectName);
$orderGoods = $orderGoodsDao->getOneByOrderIdAndGoodsId($refund['orderId'], $refund['goodsId'], $this->orderGoodsField);
if(empty($orderGoods)){
ErrorModel::throwException(CodeConfigModel::notExistOrderGoods);
}
if($orderGoods['refundId']>ApiConst::zero){
ErrorModel::throwException(CodeConfigModel::alreadyExsitRefundGoods);
}
$refundAmount = $refund['refundAmount'];//退款金额
if ($orderInfo['paymentTime']) {
if (($refundAmount < ApiConst::zero) || ($refundAmount > $orderGoods['goodsPayPrice'])) {
......@@ -392,6 +398,8 @@ class RefundServiceModel extends \Business\AbstractModel
$refundArrayUnLine=Common::convertUnderline($refundArray);
$state = $refundReturnDao->addRefundReturn($refundArray,$orderInfo,$orderGoods);
if ($state) {
$orderDao->deleteOrderCache($memberId,$refund['orderId']);
$refundReturnDao->deleteRefundCache($memberId);
$refundStateName=$refundReturnDao->getRefundTextStatus($refundArrayUnLine);
$orderGoodsDao->update(array('rec_id'=>$orderGoods['recId']),array('refund_state_name'=>$refundStateName,'refund_id'=>$state));
$orderLogDao->addRefundOrderLog($orderInfo['orderId'],$refundArray['refund_type'],DescribeConst::buyer,$orderInfo['buyerName'],$orderInfo['orderState']);
......@@ -446,20 +454,24 @@ class RefundServiceModel extends \Business\AbstractModel
$info['canPlatformIn'] = $refundReturnDao->isPlatformIn($info) ? ApiConst::one : ApiConst::zero;
$info['canSendShippingType'] = $refundReturnDao->checkIsAddReturnShipping($info) ? ApiConst::one : ApiConst::zero;
if($info['refundShippingType']==ApiConst::bySeller){
if(!$info['diliverymanId']){
$info['diliveryman']=ArrayConst::defaultDeliveryMan;
}else{
$diliveryMan=$diliveryManDao->findById($info['diliverymanId']);
if(!empty($diliveryMan)){
$diliveryMan=array(
'id'=>$diliveryMan['id'],
'trueName'=>$diliveryMan['true_name'],
'mobile'=>$diliveryMan['mobile'],
);
$info['diliveryman']=$diliveryMan;
if($info['returnType']==ApiConst::returnTypeMustReturn){
if(!$info['diliverymanId']){
$info['diliveryman']=ArrayConst::defaultDeliveryMan;
}else{
$info['diliveryman']=new \stdClass();
$diliveryMan=$diliveryManDao->findById($info['diliverymanId']);
if(!empty($diliveryMan)){
$diliveryMan=array(
'id'=>$diliveryMan['id'],
'trueName'=>$diliveryMan['true_name'],
'mobile'=>$diliveryMan['mobile'],
);
$info['diliveryman']=$diliveryMan;
}else{
$info['diliveryman']=new \stdClass();
}
}
}else{
$info['diliveryman']=new \stdClass();
}
}else{
$info['diliveryman']=new \stdClass();
......
This diff is collapsed.
<?php
namespace DAO;
namespace Elasticsearch;
use Elasticsearch\ClientBuilder;
use Error\CodeConfigModel;
use Error\ErrorModel;
......@@ -50,9 +50,99 @@ class ElasticsTool{
'index'=>$this->dbName,
];
$r=$this->client->indices()->create($indexParams);
return $r;
}catch(\Exception $e){
ErrorModel::throwException(CodeConfigModel::elasticsError);
}
}
// public function create_index()
// {
// $indexParams['index'] = 'my_index';
// $indexParams['type'] = 'my_index';
// $indexParams['body']['settings']['number_of_shards'] = 2;
// $indexParams['body']['settings']['number_of_replicas'] = 0;
// $this->client->create($indexParams);
// }
public function add_document()
{
$params = array();
$params['body'] = array(
'testField' => 'dfdsfdsf'
);
$params['index'] = 'my_index';
$params['type'] = 'my_index';
$params['id'] = 'w1231313';
$ret = $this->client->index($params);
}
public function delete_index()
{
$deleteParams['index'] = 'my_index';
$this->client->indices()->delete($deleteParams);
}
public function deleteDocumentById($docId)
{
$deleteParams = array();
$deleteParams['index'] = $this->dbName;
$deleteParams['type'] = $this->tbName;
$deleteParams['id'] =$docId;
$retDelete = $this->client->delete($deleteParams);
return $retDelete;
}
public function update_document()
{
$updateParams = array();
$updateParams['index'] = 'my_index';
$updateParams['type'] = 'my_index';
$updateParams['id'] = 'my_id';
$updateParams['body']['doc']['asas'] = '111111';
$response = $this->client->update($updateParams);
}
public function search()
{
$searchParams['index'] = 'my_index';
$searchParams['type'] = 'my_index';
$searchParams['from'] = 0;
$searchParams['size'] = 100;
$searchParams['sort'] = array(
'_score' => array(
'order' => 'desc'
)
);
// $searchParams['body']['query']['match']['testField'] = 'abc';
$retDoc = $this->client->search($searchParams);
print_r($retDoc);
}
public function get_document()
{
$getParams = array();
$getParams['index'] = 'my_index';
$getParams['type'] = 'my_index';
$getParams['id'] = 'AU4Kn-knWOmOrmyOj2qg';
$retDoc = $this->client->get($getParams);
print_r($retDoc);
}
/**
* 类实例
*
* @var \DAO\UserModel
*/
private static $_instance = null;
/**
* 单例模式获取类实例
*
*/
public static function getInstance($type,$index=NameConst::searchDbName)
{
if (!(self::$_instance instanceof self)) {
self::$_instance = new self($index,$type);
}
return self::$_instance;
}
}
\ No newline at end of file
......@@ -261,6 +261,7 @@ class CodeConfigModel {
const notExistOrderGoods=300110;
const notExsitDeliver=300111;
const notExsitOrder=300112;
const alreadyExsitRefundGoods=300113;
//店铺相关错误码
//商品分类
......@@ -652,6 +653,7 @@ class CodeConfigModel {
self::deliverError=>'快递跟踪失败,订单状态有误',
self::notExsitDeliver=>'配送单不存在',
self::notExsitOrder=>'订单不存在',
self::alreadyExsitRefundGoods=>'退款订单已经存在',
self::deleteError=>'放入回收站失败,订单状态有误',
self::restoreError=>'永久删除、从回收站还原失败,订单状态有误',
self::shareError=>'分享失败,订单状态有误',
......
This diff is collapsed.
......@@ -9,8 +9,8 @@
</head>
<body>
<form action="/order/getRefundDetail" method="post">
用户登录状态key:<input name="data[key]" value="ceb72deab920ac0edb7272b2ed9dfa1e"/><br />
退款refundId:<input name="data[refundId]" value="316574"/><br />
用户登录状态key:<input name="data[key]" value="52da049f7e2fbf0e10da32dfe909850e"/><br />
退款refundId:<input name="data[refundId]" value="8"/><br />
<p id="img_area"></p>
<input type="submit" value="提交">
</form>
......
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