commit
0b0cc56d00
@ -78,7 +78,7 @@ class StoreCartDao extends BaseDao
|
|||||||
$query->field('product_id,stock,price,unique,sku,image,svip_price');
|
$query->field('product_id,stock,price,unique,sku,image,svip_price');
|
||||||
},
|
},
|
||||||
'merchant' => function ($query) {
|
'merchant' => function ($query) {
|
||||||
$query->field('mer_id,mer_name,mer_state,mer_avatar,is_trader,type_id')->with(['type_name']);
|
$query->field('mer_id,mer_name,mer_state,mer_avatar,is_trader,type_id,credit_buy')->with(['type_name']);
|
||||||
}
|
}
|
||||||
])->select();
|
])->select();
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ class MerchantTypeDao extends BaseDao
|
|||||||
[
|
[
|
||||||
'type' => 'div',
|
'type' => 'div',
|
||||||
'children' => [
|
'children' => [
|
||||||
'保证金:' . $item['margin']. ' 元'
|
'押金:' . $item['margin']. ' 元'
|
||||||
],
|
],
|
||||||
'style' => [
|
'style' => [
|
||||||
'paddingTop' => '100px',
|
'paddingTop' => '100px',
|
||||||
|
@ -623,40 +623,41 @@ class CommunityRepository extends BaseRepository
|
|||||||
$resale->update($value);
|
$resale->update($value);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$purchaseRecord = PurchaseRecord::where('unique', $value['product_attr_unique'])->find();
|
// $purchaseRecord = PurchaseRecord::where('unique', $value['product_attr_unique'])->find();
|
||||||
// $exist = Resale::where('purchase_record_id', $purchaseRecord['id'])->find();
|
// $exist = Resale::where('purchase_record_id', $purchaseRecord['id'])->find();
|
||||||
// if ($exist) {
|
// if ($exist) {
|
||||||
// throw new ValidateException('已发起转售');
|
// throw new ValidateException('已发起转售');
|
||||||
// }
|
// }
|
||||||
$totalNumber = PurchaseRecord::where('unique', $value['product_attr_unique'])->sum('number');
|
// $totalNumber = PurchaseRecord::where('unique', $value['product_attr_unique'])->sum('number');
|
||||||
$totalSalesVolume = PurchaseRecord::where('unique', $value['product_attr_unique'])->sum('sales_volume');
|
// $totalSalesVolume = PurchaseRecord::where('unique', $value['product_attr_unique'])->sum('sales_volume');
|
||||||
if (empty($purchaseRecord) || ($totalNumber - $totalSalesVolume) <= 0) {
|
// if (empty($purchaseRecord) || ($totalNumber - $totalSalesVolume) <= 0) {
|
||||||
throw new ValidateException('进货记录不存在或已售罄');
|
// throw new ValidateException('进货记录不存在或已售罄');
|
||||||
}
|
// }
|
||||||
if (($totalNumber - $totalSalesVolume) < $value['number']) {
|
// if (($totalNumber - $totalSalesVolume) < $value['number']) {
|
||||||
throw new ValidateException('库存不足');
|
// throw new ValidateException('库存不足');
|
||||||
}
|
// }
|
||||||
|
|
||||||
if ($value) {
|
if ($value) {
|
||||||
|
$attrValue = ProductAttrValue::where('unique', $value['product_attr_unique'])->find();
|
||||||
|
if($attrValue){
|
||||||
$insert[] = [
|
$insert[] = [
|
||||||
'community_id' => $id,
|
'community_id' => $id,
|
||||||
'purchase_record_id' => $purchaseRecord['id'],
|
'purchase_record_id' => 0,
|
||||||
'product_id' => $purchaseRecord['product_id'],
|
'product_id' => $attrValue['product_id'],
|
||||||
'product_attr_unique' => $purchaseRecord['unique'],
|
'product_attr_unique' => $attrValue['unique'],
|
||||||
'mer_id' => $purchaseRecord['mer_id'],
|
'mer_id' => $attrValue['mer_id'],
|
||||||
'number' => $value['number'],
|
'number' => $value['number'],
|
||||||
'price' => $value['price'],
|
'price' => $value['price'],
|
||||||
'resale_type' => $resaleType,
|
'resale_type' => $resaleType,
|
||||||
'deliver_method' => $value['deliver_method'] ?? '',
|
'deliver_method' => $value['deliver_method'] ?? '',
|
||||||
'update_time' => date('Y-m-d H:i:s'),
|
'update_time' => date('Y-m-d H:i:s'),
|
||||||
];
|
];
|
||||||
}
|
|
||||||
$purchaseRecord->product->stock -= $value['number'];
|
|
||||||
$purchaseRecord->product->save();
|
|
||||||
$attrValue = ProductAttrValue::where('product_id', $purchaseRecord['product_id'])->where('unique', $purchaseRecord['unique'])->find();
|
|
||||||
$attrValue->stock -= $value['number'];
|
$attrValue->stock -= $value['number'];
|
||||||
$attrValue->save();
|
$attrValue->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
if ($insert) {
|
if ($insert) {
|
||||||
Resale::getInstance()->insertAll($insert);
|
Resale::getInstance()->insertAll($insert);
|
||||||
}
|
}
|
||||||
|
@ -375,7 +375,7 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
'financial_record_sn' => $financeSn . ($i++)
|
'financial_record_sn' => $financeSn . ($i++)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
//保证金计算
|
//押金计算
|
||||||
if ($_payPrice > 0) {
|
if ($_payPrice > 0) {
|
||||||
/** @var MerchantRepository $merchantRepo */
|
/** @var MerchantRepository $merchantRepo */
|
||||||
$merchantRepo = app()->make(MerchantRepository::class);
|
$merchantRepo = app()->make(MerchantRepository::class);
|
||||||
|
@ -202,7 +202,6 @@ class SpuRepository extends BaseRepository
|
|||||||
}
|
}
|
||||||
$where['product_id'] = $randPidList;
|
$where['product_id'] = $randPidList;
|
||||||
unset($where['mer_rand_id'], $where['page']);
|
unset($where['mer_rand_id'], $where['page']);
|
||||||
$page = 1;
|
|
||||||
}
|
}
|
||||||
$entryMerId = $where['entry_mer_id'] ?? '';
|
$entryMerId = $where['entry_mer_id'] ?? '';
|
||||||
unset($where['entry_mer_id']);
|
unset($where['entry_mer_id']);
|
||||||
|
@ -318,7 +318,7 @@ class FinancialRepository extends BaseRepository
|
|||||||
if ($res['is_margin'] == -1) throw new ValidateException('请勿重复申请');
|
if ($res['is_margin'] == -1) throw new ValidateException('请勿重复申请');
|
||||||
|
|
||||||
if (!in_array($res['is_margin'],[10,-10]) || $res['paid_margin'] <= 0)
|
if (!in_array($res['is_margin'],[10,-10]) || $res['paid_margin'] <= 0)
|
||||||
throw new ValidateException('无可退保证金');
|
throw new ValidateException('无可退押金');
|
||||||
|
|
||||||
$order = app()->make(ServeOrderRepository::class)->getWhere([
|
$order = app()->make(ServeOrderRepository::class)->getWhere([
|
||||||
'mer_id' => $res['mer_id'],
|
'mer_id' => $res['mer_id'],
|
||||||
@ -327,7 +327,7 @@ class FinancialRepository extends BaseRepository
|
|||||||
]);
|
]);
|
||||||
if (!$order) throw new ValidateException('未查询到支付订单');
|
if (!$order) throw new ValidateException('未查询到支付订单');
|
||||||
$financial_account = [
|
$financial_account = [
|
||||||
'name' => '保证金退款',
|
'name' => '押金退款',
|
||||||
'order_id' => $order['order_id'],
|
'order_id' => $order['order_id'],
|
||||||
'order_sn' => $order['order_sn'],
|
'order_sn' => $order['order_sn'],
|
||||||
'pay_price'=> $order['pay_price'],
|
'pay_price'=> $order['pay_price'],
|
||||||
@ -471,7 +471,7 @@ class FinancialRepository extends BaseRepository
|
|||||||
Elm::input('mer_name','商户名称', $data['merchant']->mer_name)->disabled(true),
|
Elm::input('mer_name','商户名称', $data['merchant']->mer_name)->disabled(true),
|
||||||
Elm::input('mer_id','商户ID', $data['mer_id'])->disabled(true),
|
Elm::input('mer_id','商户ID', $data['mer_id'])->disabled(true),
|
||||||
Elm::input('type_name','店铺类型', $data['merchant']->merchantType->type_name)->disabled(true),
|
Elm::input('type_name','店铺类型', $data['merchant']->merchantType->type_name)->disabled(true),
|
||||||
Elm::input('pay_price','保证金额度', $data['merchant']->marginOrder->pay_price)->disabled(true),
|
Elm::input('pay_price','押金额度', $data['merchant']->marginOrder->pay_price)->disabled(true),
|
||||||
Elm::input('sub','扣费金额', bcsub($data['merchant']->marginOrder->pay_price, $data['extract_money'], 2))->disabled(true),
|
Elm::input('sub','扣费金额', bcsub($data['merchant']->marginOrder->pay_price, $data['extract_money'], 2))->disabled(true),
|
||||||
Elm::input('refund','退回金额', $data['extract_money'])->disabled(true),
|
Elm::input('refund','退回金额', $data['extract_money'])->disabled(true),
|
||||||
Elm::radio('status', '审核', -1)->setOptions([
|
Elm::radio('status', '审核', -1)->setOptions([
|
||||||
@ -485,7 +485,7 @@ class FinancialRepository extends BaseRepository
|
|||||||
]
|
]
|
||||||
],])
|
],])
|
||||||
]);
|
]);
|
||||||
return $form->setTitle('退保证金审核');
|
return $form->setTitle('退押金审核');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -647,7 +647,7 @@ class FinancialRepository extends BaseRepository
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO 同意退保证金
|
* TODO 同意退押金
|
||||||
* @param $res
|
* @param $res
|
||||||
* @author Qinii
|
* @author Qinii
|
||||||
* @day 1/27/22
|
* @day 1/27/22
|
||||||
@ -657,10 +657,10 @@ class FinancialRepository extends BaseRepository
|
|||||||
//验证
|
//验证
|
||||||
$comp = bccomp($res['financial_account']->pay_price, $res['extract_money'], 2);
|
$comp = bccomp($res['financial_account']->pay_price, $res['extract_money'], 2);
|
||||||
if ($comp == -1)
|
if ($comp == -1)
|
||||||
throw new ValidateException('申请退款金额:'.$res['extract_money'].',大于支付保证金:'.$res['financial_account']->pay_price);
|
throw new ValidateException('申请退款金额:'.$res['extract_money'].',大于支付押金:'.$res['financial_account']->pay_price);
|
||||||
|
|
||||||
// if (bccomp($res['merchant']['margin'], $res['extract_money'],2) == -1)
|
// if (bccomp($res['merchant']['margin'], $res['extract_money'],2) == -1)
|
||||||
// throw new ValidateException('申请退款金额:'.$res['extract_money'].',大于剩余保证金:'.$res['merchant']['margin']);
|
// throw new ValidateException('申请退款金额:'.$res['extract_money'].',大于剩余押金:'.$res['merchant']['margin']);
|
||||||
|
|
||||||
Db::transaction(function () use ($res){
|
Db::transaction(function () use ($res){
|
||||||
//退款
|
//退款
|
||||||
|
@ -254,7 +254,7 @@ class FinancialRecordRepository extends BaseRepository
|
|||||||
{
|
{
|
||||||
//商户收入
|
//商户收入
|
||||||
$count = $this->dao->search($where)->where('financial_type', 'in', ['order', 'mer_presell'])->sum('number');
|
$count = $this->dao->search($where)->where('financial_type', 'in', ['order', 'mer_presell'])->sum('number');
|
||||||
//保证金
|
//押金
|
||||||
$auto_margin = $this->dao->search($where)->where('financial_type', 'auto_margin')->sum('number');
|
$auto_margin = $this->dao->search($where)->where('financial_type', 'auto_margin')->sum('number');
|
||||||
$auto_margin_refund = $this->dao->search($where)->where('financial_type', 'auto_margin_refund')->sum('number');
|
$auto_margin_refund = $this->dao->search($where)->where('financial_type', 'auto_margin_refund')->sum('number');
|
||||||
//平台优惠券
|
//平台优惠券
|
||||||
@ -330,7 +330,7 @@ class FinancialRecordRepository extends BaseRepository
|
|||||||
'className' => 'el-icon-s-cooperation',
|
'className' => 'el-icon-s-cooperation',
|
||||||
'count' => bcsub($auto_margin,$auto_margin_refund,2),
|
'count' => bcsub($auto_margin,$auto_margin_refund,2),
|
||||||
'field' => '元',
|
'field' => '元',
|
||||||
'name' => '商户保证金金额'
|
'name' => '商户押金金额'
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
return compact('stat');
|
return compact('stat');
|
||||||
@ -490,7 +490,7 @@ class FinancialRecordRepository extends BaseRepository
|
|||||||
bcsub($expend['count_order_charge'], $expend['count_charge']). '笔',
|
bcsub($expend['count_order_charge'], $expend['count_charge']). '笔',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'店铺保证金',
|
'店铺押金',
|
||||||
$expend['number_auto_margin'] . '元',
|
$expend['number_auto_margin'] . '元',
|
||||||
$expend['count_auto_margin'] . '笔'
|
$expend['count_auto_margin'] . '笔'
|
||||||
|
|
||||||
@ -674,10 +674,10 @@ class FinancialRecordRepository extends BaseRepository
|
|||||||
$financialType = ['order_charge', 'presell_charge'];
|
$financialType = ['order_charge', 'presell_charge'];
|
||||||
[$data['count_order_charge'], $data['number_order_charge']] = $this->dao->getDataByType($type, $where, $date, $financialType);
|
[$data['count_order_charge'], $data['number_order_charge']] = $this->dao->getDataByType($type, $where, $date, $financialType);
|
||||||
|
|
||||||
//商户保证金
|
//商户押金
|
||||||
$financialType = ['auto_margin'];
|
$financialType = ['auto_margin'];
|
||||||
[$data['count_auto_margin'], $data['number_auto_margin']] = $this->dao->getDataByType($type, $where, $date, $financialType);
|
[$data['count_auto_margin'], $data['number_auto_margin']] = $this->dao->getDataByType($type, $where, $date, $financialType);
|
||||||
//商户保证金退回
|
//商户押金退回
|
||||||
$financialType = ['auto_margin_refund'];
|
$financialType = ['auto_margin_refund'];
|
||||||
[$data['count_auto_margin_refund'], $data['number_auto_margin_refund']] = $this->dao->getDataByType($type, $where, $date, $financialType);
|
[$data['count_auto_margin_refund'], $data['number_auto_margin_refund']] = $this->dao->getDataByType($type, $where, $date, $financialType);
|
||||||
$number3 = bcsub($data['number_auto_margin'], $data['number_auto_margin_refund'], 2);
|
$number3 = bcsub($data['number_auto_margin'], $data['number_auto_margin_refund'], 2);
|
||||||
|
@ -137,7 +137,7 @@ class MerchantIntentionRepository extends BaseRepository
|
|||||||
'is_bro_goods' => $config['broadcast_goods_type'] == 1 ? 0 : 1,
|
'is_bro_goods' => $config['broadcast_goods_type'] == 1 ? 0 : 1,
|
||||||
'mer_password' => $password,
|
'mer_password' => $password,
|
||||||
'is_margin' => $margin['is_margin'] ?? -1,
|
'is_margin' => $margin['is_margin'] ?? -1,
|
||||||
// 用户需缴纳保证金
|
// 用户需缴纳押金
|
||||||
'margin' => $margin['margin'] ?? 0,
|
'margin' => $margin['margin'] ?? 0,
|
||||||
'uid' => $intention['uid'],
|
'uid' => $intention['uid'],
|
||||||
'reg_admin_id' => $autoCreate ? 0: request()->adminId(),
|
'reg_admin_id' => $autoCreate ? 0: request()->adminId(),
|
||||||
|
@ -66,14 +66,14 @@ use think\Model;
|
|||||||
class MerchantRepository extends BaseRepository
|
class MerchantRepository extends BaseRepository
|
||||||
{
|
{
|
||||||
|
|
||||||
const WithoutMargin = 0; //不需要保证金
|
const WithoutMargin = 0; //不需要押金
|
||||||
const NeedMargin = 1; //需要保证金
|
const NeedMargin = 1; //需要押金
|
||||||
const PaidMargin = 10; //已支付保证金
|
const PaidMargin = 10; //已支付押金
|
||||||
const RefundMargin = -1; //申请退还保证金
|
const RefundMargin = -1; //申请退还押金
|
||||||
const RefuseMargin = -10; //拒绝退还保证金
|
const RefuseMargin = -10; //拒绝退还押金
|
||||||
|
|
||||||
public $merId;
|
public $merId;
|
||||||
public $forceMargin = false; //强制扣除保证金
|
public $forceMargin = false; //强制扣除押金
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MerchantRepository constructor.
|
* MerchantRepository constructor.
|
||||||
@ -622,17 +622,17 @@ class MerchantRepository extends BaseRepository
|
|||||||
{
|
{
|
||||||
$merchant = $this->dao->get($id);
|
$merchant = $this->dao->get($id);
|
||||||
if ($merchant->is_margin !== 10) {
|
if ($merchant->is_margin !== 10) {
|
||||||
throw new ValidateException('商户无保证金可扣');
|
throw new ValidateException('商户无押金可扣');
|
||||||
}
|
}
|
||||||
$form = Elm::createForm(Route::buildUrl('systemMarginSet')->build());
|
$form = Elm::createForm(Route::buildUrl('systemMarginSet')->build());
|
||||||
$form->setRule([
|
$form->setRule([
|
||||||
Elm::input('mer_name', '商户名称', $merchant->mer_name)->disabled(true),
|
Elm::input('mer_name', '商户名称', $merchant->mer_name)->disabled(true),
|
||||||
Elm::input('mer_id', '商户ID', $merchant->mer_id)->disabled(true),
|
Elm::input('mer_id', '商户ID', $merchant->mer_id)->disabled(true),
|
||||||
Elm::input('margin', '商户剩余保证金', $merchant->paid_margin)->disabled(true),
|
Elm::input('margin', '商户剩余押金', $merchant->paid_margin)->disabled(true),
|
||||||
Elm::number('number', '保证金扣除金额', 0)->max($merchant->paid_margin)->precision(2)->required(),
|
Elm::number('number', '押金扣除金额', 0)->max($merchant->paid_margin)->precision(2)->required(),
|
||||||
Elm::text('mark', '保证金扣除原因')->required(),
|
Elm::text('mark', '押金扣除原因')->required(),
|
||||||
]);
|
]);
|
||||||
return $form->setTitle('扣除保证金');
|
return $form->setTitle('扣除押金');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -646,14 +646,14 @@ class MerchantRepository extends BaseRepository
|
|||||||
{
|
{
|
||||||
$merechant = $this->dao->get($data['mer_id']);
|
$merechant = $this->dao->get($data['mer_id']);
|
||||||
if ($merechant->is_margin !== 10) {
|
if ($merechant->is_margin !== 10) {
|
||||||
throw new ValidateException('商户未支付保证金或已申请退款');
|
throw new ValidateException('商户未支付押金或已申请退款');
|
||||||
}
|
}
|
||||||
if ($data['number'] < 0) {
|
if ($data['number'] < 0) {
|
||||||
throw new ValidateException('扣除保证金额不能小于0');
|
throw new ValidateException('扣除押金额不能小于0');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bccomp($merechant->paid_margin, $data['number'], 2) == -1) {
|
if (bccomp($merechant->paid_margin, $data['number'], 2) == -1) {
|
||||||
throw new ValidateException('扣除保证金额不足');
|
throw new ValidateException('扣除押金额不足');
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['balance'] = bcsub($merechant->paid_margin, $data['number'], 2);
|
$data['balance'] = bcsub($merechant->paid_margin, $data['number'], 2);
|
||||||
@ -679,7 +679,7 @@ class MerchantRepository extends BaseRepository
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自动扣除保证金
|
* 自动扣除押金
|
||||||
* @param $income
|
* @param $income
|
||||||
* @param $order
|
* @param $order
|
||||||
* @param $finance
|
* @param $finance
|
||||||
@ -691,12 +691,12 @@ class MerchantRepository extends BaseRepository
|
|||||||
{
|
{
|
||||||
$merchant = Merchant::find($this->merId);
|
$merchant = Merchant::find($this->merId);
|
||||||
$margin_type = Db::name('MerchantType')->where('mer_type_id', $merchant['type_id'])->value('margin');
|
$margin_type = Db::name('MerchantType')->where('mer_type_id', $merchant['type_id'])->value('margin');
|
||||||
//商户保证金大于支付保证金 或者forceMargin==false 直接返回 不计算保证金
|
//商户押金大于支付押金 或者forceMargin==false 直接返回 不计算押金
|
||||||
if ($merchant['paid_margin']>= $margin_type|| ($this->forceMargin === false && $merchant['auto_margin_rate'] == 0)) {
|
if ($merchant['paid_margin']>= $margin_type|| ($this->forceMargin === false && $merchant['auto_margin_rate'] == 0)) {
|
||||||
return [$income, $finance, false];
|
return [$income, $finance, false];
|
||||||
}
|
}
|
||||||
$rate = $this->forceMargin ? 100 : $merchant['auto_margin_rate'];
|
$rate = $this->forceMargin ? 100 : $merchant['auto_margin_rate'];
|
||||||
// //商户保证金未完全缴纳且设置了自动扣除比例
|
// //商户押金未完全缴纳且设置了自动扣除比例
|
||||||
$margin= bcmul($income, bcdiv($rate, 100,2), 2);
|
$margin= bcmul($income, bcdiv($rate, 100,2), 2);
|
||||||
// $margin = min(bcsub($margin, $merchant['paid_margin'], 2), $margin);
|
// $margin = min(bcsub($margin, $merchant['paid_margin'], 2), $margin);
|
||||||
// $income = max(bcsub($income, $margin, 2), 0);
|
// $income = max(bcsub($income, $margin, 2), 0);
|
||||||
|
@ -124,7 +124,7 @@ class MerchantTypeRepository extends BaseRepository
|
|||||||
$make = app()->make(RelevanceRepository::class);
|
$make = app()->make(RelevanceRepository::class);
|
||||||
$make->batchDelete($id, RelevanceRepository::TYPE_MERCHANT_AUTH);
|
$make->batchDelete($id, RelevanceRepository::TYPE_MERCHANT_AUTH);
|
||||||
$make->insertAll($inserts);
|
$make->insertAll($inserts);
|
||||||
//更新未交保证金的商户
|
//更新未交押金的商户
|
||||||
app()->make(MerchantRepository::class)->updateMargin($id, $data['margin'], $data['is_margin']);
|
app()->make(MerchantRepository::class)->updateMargin($id, $data['margin'], $data['is_margin']);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ class ServeOrderRepository extends BaseRepository
|
|||||||
const TYPE_COPY_PRODUCT = 1;
|
const TYPE_COPY_PRODUCT = 1;
|
||||||
//电子面单
|
//电子面单
|
||||||
const TYPE_DUMP = 2;
|
const TYPE_DUMP = 2;
|
||||||
//保证金 margin
|
//押金 margin
|
||||||
const TYPE_MARGIN = 10;
|
const TYPE_MARGIN = 10;
|
||||||
//同城配送delivery
|
//同城配送delivery
|
||||||
const TYPE_DELIVERY = 20;
|
const TYPE_DELIVERY = 20;
|
||||||
@ -83,7 +83,7 @@ class ServeOrderRepository extends BaseRepository
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO 商户保证金 支付
|
* TODO 商户押金 支付
|
||||||
* @param $merId
|
* @param $merId
|
||||||
* @param $data
|
* @param $data
|
||||||
* @return array
|
* @return array
|
||||||
@ -93,7 +93,7 @@ class ServeOrderRepository extends BaseRepository
|
|||||||
public function margin($merId, $data)
|
public function margin($merId, $data)
|
||||||
{
|
{
|
||||||
$ret = app()->make(MerchantRepository::class)->get($merId);
|
$ret = app()->make(MerchantRepository::class)->get($merId);
|
||||||
if ($ret['is_margin'] !== 1) throw new ValidateException('此商户无需支付保证金');
|
if ($ret['is_margin'] !== 1) throw new ValidateException('此商户无需支付押金');
|
||||||
$key = 'Margin_'.$merId.'_'.date('YmdH',time());
|
$key = 'Margin_'.$merId.'_'.date('YmdH',time());
|
||||||
$arr = [
|
$arr = [
|
||||||
'type_id' => $ret['type_id'],
|
'type_id' => $ret['type_id'],
|
||||||
|
@ -67,11 +67,11 @@ class MerchantMargin extends BaseController
|
|||||||
public function setMargin()
|
public function setMargin()
|
||||||
{
|
{
|
||||||
$data = $this->request->params(['mer_id','number',['type','mer_margin'],'mark']);
|
$data = $this->request->params(['mer_id','number',['type','mer_margin'],'mark']);
|
||||||
$data['title'] = '保证金扣除';
|
$data['title'] = '押金扣除';
|
||||||
if ($data['number'] < 0)
|
if ($data['number'] < 0)
|
||||||
return app('json')->fail('扣除金额不能小于0');
|
return app('json')->fail('扣除金额不能小于0');
|
||||||
app()->make(MerchantRepository::class)->setMargin($data);
|
app()->make(MerchantRepository::class)->setMargin($data);
|
||||||
return app('json')->success('扣除保证金成功');
|
return app('json')->success('扣除押金成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ class MerchantType extends BaseController
|
|||||||
$validate = app()->make(MerchantTypeValidate::class);
|
$validate = app()->make(MerchantTypeValidate::class);
|
||||||
$validate->check($data);
|
$validate->check($data);
|
||||||
if ($data['is_margin'] == 1) {
|
if ($data['is_margin'] == 1) {
|
||||||
if ($data['margin'] <= 0) throw new ValidateException('保证金必须大于0');
|
if ($data['margin'] <= 0) throw new ValidateException('押金必须大于0');
|
||||||
} else {
|
} else {
|
||||||
$data['margin'] = 0;
|
$data['margin'] = 0;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ use app\common\service\TopClient;
|
|||||||
use app\controller\api\Ceshi;
|
use app\controller\api\Ceshi;
|
||||||
use taobao\request\TbkItemInfoGetRequest;
|
use taobao\request\TbkItemInfoGetRequest;
|
||||||
use app\common\repositories\store\product\ProductRepository;
|
use app\common\repositories\store\product\ProductRepository;
|
||||||
use crmeb\services\UploadService;
|
use think\facade\App;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Auth
|
* Class Auth
|
||||||
@ -69,6 +69,7 @@ class Auth extends BaseController
|
|||||||
{
|
{
|
||||||
public function caiji()
|
public function caiji()
|
||||||
{
|
{
|
||||||
|
$url=$this->request->host();
|
||||||
$parmas = $this->request->param();
|
$parmas = $this->request->param();
|
||||||
$query=parse_url($parmas['url']);
|
$query=parse_url($parmas['url']);
|
||||||
$itemId=$this->convertUrlQuery($query['query']);
|
$itemId=$this->convertUrlQuery($query['query']);
|
||||||
@ -79,23 +80,25 @@ class Auth extends BaseController
|
|||||||
$req->setNumIids($itemId['itemId']);
|
$req->setNumIids($itemId['itemId']);
|
||||||
$resp = $c->execute($req);
|
$resp = $c->execute($req);
|
||||||
$res=$resp->results->n_tbk_item;
|
$res=$resp->results->n_tbk_item;
|
||||||
$arr = json_decode(json_encode($res), true);
|
|
||||||
$images=[];
|
$images=[];
|
||||||
$upload = UploadService::create();
|
$filename = basename($res->pict_url); // 获取文件名
|
||||||
$dir = 'def/' . date('Y-m-d');
|
$destination = public_path('uploads').'img/' . $filename; // 目标路径
|
||||||
|
$pict_url= $url.'/uploads/img/'.$filename;
|
||||||
|
file_put_contents($destination, file_get_contents($res->pict_url));
|
||||||
|
|
||||||
$oss = $upload->to($dir)->stream(file_get_contents($arr['pict_url']));
|
if($resp && isset($resp->small_images) && isset($resp->small_images->string)){
|
||||||
|
foreach($resp->small_images->string as $k=>$v){
|
||||||
$pict_url = $oss->filePath;
|
$filename = basename($v); // 获取文件名
|
||||||
foreach ($arr['small_images']['string'] as $k => $v) {
|
$destination = public_path('uploads').'img/' . $filename; // 目标路径
|
||||||
$oss = $upload->to($dir)->stream(file_get_contents($v));
|
file_put_contents($destination, file_get_contents($v));
|
||||||
$images[] = $oss->filePath;
|
$images[]=$url.'/uploads/img/'.$filename;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$data=[
|
$data=[
|
||||||
"image" => $pict_url,
|
"image" => $pict_url,
|
||||||
"slider_image" =>$images,
|
"slider_image" =>$images,
|
||||||
"store_name" => $arr['title'],
|
"store_name" => json_decode(json_encode($res->title),true)[0],
|
||||||
"store_info" => $arr['cat_leaf_name'],
|
"store_info" => json_decode(json_encode($res->cat_leaf_name),true)[0],
|
||||||
"keyword" => "",
|
"keyword" => "",
|
||||||
"bar_code" => "",
|
"bar_code" => "",
|
||||||
"guarantee_template_id" => "",
|
"guarantee_template_id" => "",
|
||||||
@ -130,7 +133,7 @@ class Auth extends BaseController
|
|||||||
"attrValue" => [
|
"attrValue" => [
|
||||||
0 => [
|
0 => [
|
||||||
"image" => $pict_url,
|
"image" => $pict_url,
|
||||||
"price" => bcsub($arr['reserve_price'], ($arr['reserve_price'] * 0.05), 2),
|
"price" => bcsub($res->reserve_price,($res->reserve_price*0.05),2),
|
||||||
"cost" => 0,
|
"cost" => 0,
|
||||||
"ot_price" => 0,
|
"ot_price" => 0,
|
||||||
"svip_price" => null,
|
"svip_price" => null,
|
||||||
@ -382,13 +385,14 @@ class Auth extends BaseController
|
|||||||
|
|
||||||
public function doMargin()
|
public function doMargin()
|
||||||
{
|
{
|
||||||
|
return app('json')->fail('线上缴纳调整中,请在线下缴纳');
|
||||||
$user = $this->request->userInfo();
|
$user = $this->request->userInfo();
|
||||||
$merchant = Db::name('merchant')->where('uid', $user['uid'])->where('status', 1)->find();
|
$merchant = Db::name('merchant')->where('uid', $user['uid'])->where('status', 1)->find();
|
||||||
if (!$merchant) {
|
if (!$merchant) {
|
||||||
return app('json')->fail('没有店铺');
|
return app('json')->fail('没有店铺');
|
||||||
}
|
}
|
||||||
if ($merchant['is_margin'] == 10) {
|
if ($merchant['is_margin'] == 10) {
|
||||||
return app('json')->fail('保证金已缴纳');
|
return app('json')->fail('押金已缴纳');
|
||||||
}
|
}
|
||||||
if ($merchant['margin'] == 0) {
|
if ($merchant['margin'] == 0) {
|
||||||
$margin = Db::name('MerchantType')->where('mer_type_id', $merchant['type_id'])->value('margin');
|
$margin = Db::name('MerchantType')->where('mer_type_id', $merchant['type_id'])->value('margin');
|
||||||
|
211
app/controller/api/Statistics.php
Normal file
211
app/controller/api/Statistics.php
Normal file
@ -0,0 +1,211 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\controller\api;
|
||||||
|
|
||||||
|
use crmeb\basic\BaseController;
|
||||||
|
use think\facade\Db;
|
||||||
|
|
||||||
|
class Statistics extends BaseController
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 商户入驻统计
|
||||||
|
*/
|
||||||
|
public function SupplyChainMerCount()
|
||||||
|
{
|
||||||
|
$parmas = $this->request->param();
|
||||||
|
if (isset($parmas['type']) && $parmas['type'] != '') {
|
||||||
|
switch ($parmas['type']) {
|
||||||
|
case 'area':
|
||||||
|
$type = 'area_id';
|
||||||
|
break;
|
||||||
|
case 'street':
|
||||||
|
$type = 'street_id';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return app('json')->fail('type:格式错误');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$type = 'street_id';
|
||||||
|
}
|
||||||
|
if (!isset($parmas['start_time']) || $parmas['start_time'] == '') {
|
||||||
|
return app('json')->fail('start_time:格式错误');
|
||||||
|
}
|
||||||
|
if (!isset($parmas['end_time']) || $parmas['end_time'] == '') {
|
||||||
|
return app('json')->fail('end_time:格式错误');
|
||||||
|
}
|
||||||
|
$where[]=['create_time','between time',[date("Y-m-d H:i:s",$parmas['start_time']),date("Y-m-d H:i:s",$parmas['end_time'])]];
|
||||||
|
if (isset($parmas['responsible_area']) && $parmas['responsible_area'] != '') {
|
||||||
|
$where[] = [$type,'in',explode(',', $parmas['responsible_area'])];
|
||||||
|
}
|
||||||
|
$where[]=['is_del','=',0];
|
||||||
|
$where[]=['status','=',1];
|
||||||
|
$count=Db::name('merchant')->where($where)->count();
|
||||||
|
return app('json')->success(['count'=>$count]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户商品数量查询
|
||||||
|
*/
|
||||||
|
public function SupplyChainProductCount()
|
||||||
|
{
|
||||||
|
$parmas = $this->request->param();
|
||||||
|
|
||||||
|
if (!isset($parmas['start_time']) || $parmas['start_time'] == '') {
|
||||||
|
return app('json')->fail('start_time:格式错误');
|
||||||
|
}
|
||||||
|
if (!isset($parmas['end_time']) || $parmas['end_time'] == '') {
|
||||||
|
return app('json')->fail('end_time:格式错误');
|
||||||
|
}
|
||||||
|
if (!isset($parmas['mer_intention_id']) || $parmas['mer_intention_id'] == '') {
|
||||||
|
return app('json')->fail('mer_intention_id:格式错误');
|
||||||
|
}
|
||||||
|
$where[]=['create_time','between time',[date("Y-m-d H:i:s",$parmas['start_time']),date("Y-m-d H:i:s",$parmas['end_time'])]];
|
||||||
|
$where[] = ['mer_id','=',$parmas['mer_intention_id']];
|
||||||
|
$where[]=['mer_status','=',1];
|
||||||
|
$where[]=['status','=',1];
|
||||||
|
$where[]=['is_used','=',1];
|
||||||
|
$where[]=['is_show','=',1];
|
||||||
|
$count=Db::name('store_product')->where($where)->count();
|
||||||
|
return app('json')->success(['count'=>$count]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户商品库存更新查询
|
||||||
|
*/
|
||||||
|
public function SupplyChainProductStockCount()
|
||||||
|
{
|
||||||
|
$parmas = $this->request->param();
|
||||||
|
|
||||||
|
if (!isset($parmas['start_time']) || $parmas['start_time'] == '') {
|
||||||
|
return app('json')->fail('start_time:格式错误');
|
||||||
|
}
|
||||||
|
if (!isset($parmas['end_time']) || $parmas['end_time'] == '') {
|
||||||
|
return app('json')->fail('end_time:格式错误');
|
||||||
|
}
|
||||||
|
if (!isset($parmas['mer_intention_id']) || $parmas['mer_intention_id'] == '') {
|
||||||
|
return app('json')->fail('mer_intention_id:格式错误');
|
||||||
|
}
|
||||||
|
$where[]=['create_time','between time',[date("Y-m-d H:i:s",$parmas['start_time']),date("Y-m-d H:i:s",$parmas['end_time'])]];
|
||||||
|
$where[] = ['mer_id','=',$parmas['mer_intention_id']];
|
||||||
|
$count=Db::name('store_product_stock')->where($where)->count();
|
||||||
|
return app('json')->success(['count'=>$count]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品列表
|
||||||
|
*/
|
||||||
|
public function ProductList(){
|
||||||
|
$parmas = $this->request->param();
|
||||||
|
|
||||||
|
if (!isset($parmas['page']) || $parmas['page'] == '') {
|
||||||
|
return app('json')->fail('page:格式错误');
|
||||||
|
}
|
||||||
|
$where[]=['mer_status','=',1];
|
||||||
|
$where[]=['status','=',1];
|
||||||
|
$where[]=['is_used','=',1];
|
||||||
|
$where[]=['is_show','=',1];
|
||||||
|
if (isset($parmas['keyword']) &&$parmas['keyword'] != '') {
|
||||||
|
$where[] = ['store_name','like','%'.$parmas['keyword'].'%'];
|
||||||
|
}
|
||||||
|
$list=Db::name('store_product')->where($where)->page($parmas['page'])
|
||||||
|
->field('product_id,store_name,image,price')
|
||||||
|
->limit(10)->select();
|
||||||
|
return app('json')->success(['page'=>$parmas['page'],'data'=>$list]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购金额和销售金额统计
|
||||||
|
*/
|
||||||
|
public function SupplyChainProductPriceCount()
|
||||||
|
{
|
||||||
|
$parmas = $this->request->param();
|
||||||
|
if (isset($parmas['type']) && $parmas['type'] != '') {
|
||||||
|
switch ($parmas['type']) {
|
||||||
|
case 200:
|
||||||
|
$where[] = ['p.source','=',200];
|
||||||
|
break;
|
||||||
|
case 300:
|
||||||
|
$where[] = ['p.source','=',300];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return app('json')->fail('type:格式错误');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$where[] = ['p.source','=',0];
|
||||||
|
}
|
||||||
|
if (!isset($parmas['start_time']) || $parmas['start_time'] == '') {
|
||||||
|
return app('json')->fail('start_time:格式错误');
|
||||||
|
}
|
||||||
|
if (!isset($parmas['end_time']) || $parmas['end_time'] == '') {
|
||||||
|
return app('json')->fail('end_time:格式错误');
|
||||||
|
}
|
||||||
|
if (!isset($parmas['mer_intention_id']) || $parmas['mer_intention_id'] == '') {
|
||||||
|
return app('json')->fail('mer_intention_id:格式错误');
|
||||||
|
}
|
||||||
|
if (!isset($parmas['goods_id']) || $parmas['goods_id'] == '') {
|
||||||
|
return app('json')->fail('goods_id:格式错误');
|
||||||
|
}
|
||||||
|
|
||||||
|
$where[]=['p.create_time','between time',[date("Y-m-d H:i:s",$parmas['start_time']),date("Y-m-d H:i:s",$parmas['end_time'])]];
|
||||||
|
$where[] = ['p.product_id','in',explode(',', $parmas['goods_id'])];
|
||||||
|
$where[] = ['p.is_refund','=',0];
|
||||||
|
$count=Db::name('store_order_product')->alias('p')
|
||||||
|
->where($where)
|
||||||
|
->join('store_order o','o.mer_id='.$parmas['mer_intention_id'].' and o.paid=1 and o.is_del=0')
|
||||||
|
->sum('p.total_price');
|
||||||
|
return app('json')->success(['procure_amount'=>$count]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 镇一般商户采购金额和销售金额统计
|
||||||
|
*/
|
||||||
|
public function SupplyChainStreetProductPriceCount()
|
||||||
|
{
|
||||||
|
$parmas = $this->request->param();
|
||||||
|
if (isset($parmas['type']) && $parmas['type'] != '') {
|
||||||
|
switch ($parmas['type']) {
|
||||||
|
case 200:
|
||||||
|
$where[] = ['p.source','=',200];
|
||||||
|
break;
|
||||||
|
case 300:
|
||||||
|
$where[] = ['p.source','=',300];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return app('json')->fail('type:格式错误');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$where[] = ['p.source','=',0];
|
||||||
|
}
|
||||||
|
if (!isset($parmas['start_time']) || $parmas['start_time'] == '') {
|
||||||
|
return app('json')->fail('start_time:格式错误');
|
||||||
|
}
|
||||||
|
if (!isset($parmas['end_time']) || $parmas['end_time'] == '') {
|
||||||
|
return app('json')->fail('end_time:格式错误');
|
||||||
|
}
|
||||||
|
if (!isset($parmas['goods_id']) || $parmas['goods_id'] == '') {
|
||||||
|
return app('json')->fail('goods_id:格式错误');
|
||||||
|
}
|
||||||
|
if (isset($parmas['responsible_area']) && $parmas['responsible_area'] != '') {
|
||||||
|
$area[] = ['street_id','in',explode(',', $parmas['responsible_area'])];
|
||||||
|
}else{
|
||||||
|
return app('json')->fail('responsible_area:格式错误');
|
||||||
|
}
|
||||||
|
$merchant=Db::name('merchant')->where($area)->column('mer_id');
|
||||||
|
if(!$merchant){
|
||||||
|
return app('json')->fail('查询商户为空');
|
||||||
|
}
|
||||||
|
$where[]=['p.create_time','between time',[date("Y-m-d H:i:s",$parmas['start_time']),date("Y-m-d H:i:s",$parmas['end_time'])]];
|
||||||
|
$where[] = ['p.product_id','in',explode(',', $parmas['goods_id'])];
|
||||||
|
$where[] = ['p.is_refund','=',0];
|
||||||
|
$count=Db::name('store_order_product')->alias('p')
|
||||||
|
->where($where)
|
||||||
|
->join('store_order o','o.mer_id in ('.implode(',',$merchant).') and o.paid=1 and o.is_del=0')
|
||||||
|
->sum('p.total_price');
|
||||||
|
return app('json')->success(['procure_amount'=>$count]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -800,13 +800,17 @@ class Community extends BaseController
|
|||||||
if (!$communityInfo) {
|
if (!$communityInfo) {
|
||||||
return app('json')->fail('委托商品不存在');
|
return app('json')->fail('委托商品不存在');
|
||||||
}
|
}
|
||||||
$uid = $this->request->uid();
|
// $uid = $this->request->uid();
|
||||||
$communityInfo['mer_info'] = Db::name('merchant')->where('uid', $uid)->where('is_del', 0)->field(['mer_id', 'mer_name', 'mer_address', 'mer_avatar', 'settle_cycle', 'interest_rate'])->find();
|
$entrust = Db::name('entrust')->where('community_id', $id)->find();
|
||||||
|
if (!$entrust) {
|
||||||
|
return app('json')->fail('委托商品不存在');
|
||||||
|
}
|
||||||
|
$entrustDay=$entrust['entrust_day'];
|
||||||
|
$communityInfo['mer_info'] = Db::name('merchant')->where('mer_id', $entrust['mer_id'])->where('is_del', 0)->field(['mer_id', 'mer_name', 'mer_address', 'mer_avatar', 'settle_cycle', 'interest_rate'])->find();
|
||||||
$communityInfo['entrust_mer_info'] = Db::name('merchant')->where('mer_id', $communityInfo['entrust_mer_id'])->where('is_del', 0)->field(['mer_id', 'mer_name', 'mer_address', 'mer_avatar'])->find();
|
$communityInfo['entrust_mer_info'] = Db::name('merchant')->where('mer_id', $communityInfo['entrust_mer_id'])->where('is_del', 0)->field(['mer_id', 'mer_name', 'mer_address', 'mer_avatar'])->find();
|
||||||
if (empty($communityInfo['mer_info']) || empty($communityInfo['entrust_mer_info'])) {
|
if (empty($communityInfo['mer_info']) || empty($communityInfo['entrust_mer_info'])) {
|
||||||
return app('json')->fail('无权限查看委托商品');
|
return app('json')->fail('无权限查看委托商品');
|
||||||
}
|
}
|
||||||
$entrustDay = Db::name('entrust')->where('community_id', $id)->where('is_del', 0)->value('entrust_day');
|
|
||||||
$communityInfo['entrust_day'] = $entrustDay;
|
$communityInfo['entrust_day'] = $entrustDay;
|
||||||
$communityInfo['product_list'] = Db::name('entrust')->alias('e')->leftJoin('store_product sp','e.product_id = sp.product_id')->leftJoin('store_product_attr_value spav','spav.unique = e.product_attr_unique')->where('e.community_id', $id)->where('sp.is_del', 0)->setOption('field', [])->field(['e.product_id, e.product_attr_unique, e.number, e.price, e.status, spav.price as old_price, sp.store_name, sp.image'])->select();
|
$communityInfo['product_list'] = Db::name('entrust')->alias('e')->leftJoin('store_product sp','e.product_id = sp.product_id')->leftJoin('store_product_attr_value spav','spav.unique = e.product_attr_unique')->where('e.community_id', $id)->where('sp.is_del', 0)->setOption('field', [])->field(['e.product_id, e.product_attr_unique, e.number, e.price, e.status, spav.price as old_price, sp.store_name, sp.image'])->select();
|
||||||
if ($communityInfo['product_list']) $communityInfo['product_list'] = $communityInfo['product_list']->toArray();
|
if ($communityInfo['product_list']) $communityInfo['product_list'] = $communityInfo['product_list']->toArray();
|
||||||
|
@ -215,7 +215,7 @@ class Merchant extends BaseController
|
|||||||
$data = $this->request->params(['mer_state']);
|
$data = $this->request->params(['mer_state']);
|
||||||
|
|
||||||
if ($merchant['is_margin'] == 1 && $data['mer_state'] == 1)
|
if ($merchant['is_margin'] == 1 && $data['mer_state'] == 1)
|
||||||
return app('json')->fail('开启店铺前请先支付保证金');
|
return app('json')->fail('开启店铺前请先支付押金');
|
||||||
|
|
||||||
if ($data['mer_state'] && !$merchant['sub_mchid'] && systemConfig('open_wx_combine'))
|
if ($data['mer_state'] && !$merchant['sub_mchid'] && systemConfig('open_wx_combine'))
|
||||||
return app('json')->fail('开启店铺前请先完成微信子商户入驻');
|
return app('json')->fail('开启店铺前请先完成微信子商户入驻');
|
||||||
|
@ -1,139 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Author: CRMEB Team <admin@crmeb.com>
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace app\controller\api\store\merchant;
|
|
||||||
|
|
||||||
use app\common\repositories\system\merchant\MerchantAdminRepository;
|
|
||||||
use app\common\repositories\system\merchant\MerchantCategoryRepository;
|
|
||||||
use app\common\repositories\system\merchant\MerchantRepository;
|
|
||||||
use app\common\repositories\system\merchant\MerchantTypeRepository;
|
|
||||||
use app\validate\api\MerchantIntentionValidate;
|
|
||||||
use crmeb\services\SmsService;
|
|
||||||
use crmeb\services\SwooleTaskService;
|
|
||||||
use crmeb\services\YunxinSmsService;
|
|
||||||
use think\App;
|
|
||||||
use crmeb\basic\BaseController;
|
|
||||||
use app\common\repositories\system\merchant\MerchantIntentionRepository as repository;
|
|
||||||
use think\exception\ValidateException;
|
|
||||||
|
|
||||||
class MerchantIntention extends BaseController
|
|
||||||
{
|
|
||||||
protected $repository;
|
|
||||||
protected $userInfo;
|
|
||||||
|
|
||||||
public function __construct(App $app, repository $repository)
|
|
||||||
{
|
|
||||||
parent::__construct($app);
|
|
||||||
$this->repository = $repository;
|
|
||||||
$this->userInfo = $this->request->isLogin() ? $this->request->userInfo() : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function create()
|
|
||||||
{
|
|
||||||
$data = $this->checkParams();
|
|
||||||
if (!systemConfig('mer_intention_open')) {
|
|
||||||
return app('json')->fail('未开启商户入驻');
|
|
||||||
}
|
|
||||||
if ($this->userInfo) $data['uid'] = $this->userInfo->uid;
|
|
||||||
$make = app()->make(MerchantRepository::class);
|
|
||||||
if ($make->fieldExists('mer_name', $data['mer_name']))
|
|
||||||
throw new ValidateException('商户名称已存在,不可申请');
|
|
||||||
if ($make->fieldExists('mer_phone', $data['phone']))
|
|
||||||
throw new ValidateException('手机号已存在,不可申请');
|
|
||||||
$adminRepository = app()->make(MerchantAdminRepository::class);
|
|
||||||
if ($adminRepository->fieldExists('account', $data['phone']))
|
|
||||||
throw new ValidateException('手机号已是管理员,不可申请');
|
|
||||||
$intention = $this->repository->create($data);
|
|
||||||
SwooleTaskService::admin('notice', [
|
|
||||||
'type' => 'new_intention',
|
|
||||||
'data' => [
|
|
||||||
'title' => '商户入驻申请',
|
|
||||||
'message' => '您有一个新的商户入驻申请',
|
|
||||||
'id' => $intention->mer_intention_id
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
return app('json')->success('提交成功');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function update($id)
|
|
||||||
{
|
|
||||||
if (!$this->repository->getWhere(['mer_intention_id' => (int)$id, 'uid' => $this->userInfo->uid, 'is_del' => 0]))
|
|
||||||
return app('json')->fail('数据不存在');
|
|
||||||
$data = $this->checkParams();
|
|
||||||
if (!systemConfig('mer_intention_open')) {
|
|
||||||
return app('json')->fail('未开启商户入驻');
|
|
||||||
}
|
|
||||||
$data['create_time'] = date('Y-m-d H:i:s', time());
|
|
||||||
$this->repository->updateIntention((int)$id, $data);
|
|
||||||
SwooleTaskService::admin('notice', [
|
|
||||||
'type' => 'new_intention',
|
|
||||||
'data' => [
|
|
||||||
'title' => '商户入驻申请',
|
|
||||||
'message' => '您有一个新的商户入驻申请',
|
|
||||||
'id' => $id
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
return app('json')->success('修改成功');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function lst()
|
|
||||||
{
|
|
||||||
[$page, $limit] = $this->getPage();
|
|
||||||
$data = $this->repository->getList(['uid' => $this->userInfo->uid], $page, $limit);
|
|
||||||
return app('json')->success($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
function detail($id)
|
|
||||||
{
|
|
||||||
$data = $this->repository->detail((int)$id, $this->userInfo->uid);
|
|
||||||
if (!$data) {
|
|
||||||
return app('json')->fail('数据不存在');
|
|
||||||
}
|
|
||||||
if ($data->status == 1) {
|
|
||||||
$data['login_url'] = rtrim(systemConfig('site_url'), '/') . '/' . config('admin.merchant_prefix');
|
|
||||||
}
|
|
||||||
return app('json')->success($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function checkParams()
|
|
||||||
{
|
|
||||||
$data = $this->request->params(['phone', 'mer_name', 'name', 'code', 'images', 'merchant_category_id', 'mer_type_id']);
|
|
||||||
app()->make(MerchantIntentionValidate::class)->check($data);
|
|
||||||
$check = app()->make(SmsService::class)->checkSmsCode($data['phone'], $data['code'], 'intention');
|
|
||||||
$data['mer_type_id'] = (int)$data['mer_type_id'];
|
|
||||||
if (!$check) throw new ValidateException('验证码不正确');
|
|
||||||
if (!app()->make(MerchantCategoryRepository::class)->get($data['merchant_category_id'])) throw new ValidateException('商户分类不存在');
|
|
||||||
if ($data['mer_type_id'] && !app()->make(MerchantTypeRepository::class)->exists($data['mer_type_id']))
|
|
||||||
throw new ValidateException('店铺类型不存在');
|
|
||||||
unset($data['code']);
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商户分类
|
|
||||||
* @Author:Qinii
|
|
||||||
* @Date: 2020/9/15
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function cateLst()
|
|
||||||
{
|
|
||||||
$lst = app()->make(MerchantCategoryRepository::class)->getSelect();
|
|
||||||
return app('json')->success($lst);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function typeLst()
|
|
||||||
{
|
|
||||||
$lst = app()->make(MerchantTypeRepository::class)->getSelect();
|
|
||||||
return app('json')->success($lst);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -23,6 +23,7 @@ use think\App;
|
|||||||
use crmeb\basic\BaseController;
|
use crmeb\basic\BaseController;
|
||||||
use app\common\repositories\store\product\ProductRepository as repository;
|
use app\common\repositories\store\product\ProductRepository as repository;
|
||||||
use think\facade\Cache;
|
use think\facade\Cache;
|
||||||
|
use think\facade\Db;
|
||||||
|
|
||||||
class StoreProduct extends BaseController
|
class StoreProduct extends BaseController
|
||||||
{
|
{
|
||||||
@ -196,4 +197,41 @@ class StoreProduct extends BaseController
|
|||||||
}
|
}
|
||||||
return app('json')->fail('规则不存在');
|
return app('json')->fail('规则不存在');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 免审编辑
|
||||||
|
*/
|
||||||
|
public function UserFreeTrial($id)
|
||||||
|
{
|
||||||
|
$params = [
|
||||||
|
"mer_cate_id",
|
||||||
|
"sort" ,
|
||||||
|
"is_show",
|
||||||
|
"is_good",
|
||||||
|
"attr",
|
||||||
|
"attrValue",
|
||||||
|
'spec_type',
|
||||||
|
'is_stock'
|
||||||
|
];
|
||||||
|
$data = $this->request->params($params);
|
||||||
|
// $count = app()->make(StoreCategoryRepository::class)->getWhereCount(['store_category_id' => $data['mer_cate_id'],'is_show' => 1,'mer_id' => $this->request->merId()]);
|
||||||
|
// if (!$count) throw new ValidateException('商户分类不存在或不可用');
|
||||||
|
$data['status'] = 1;
|
||||||
|
$uid=$this->request->userInfo()['uid'];
|
||||||
|
$mer_id=Db::name('store_service')->where(['uid'=>$uid,'status'=>1,'is_del'=>0,'is_goods'=>1])->value('mer_id');
|
||||||
|
if(!$mer_id){
|
||||||
|
return app('json')->fail('编辑免申商品参数错误');
|
||||||
|
}
|
||||||
|
$res=$this->repository->freeTrial($id, $data,$mer_id);
|
||||||
|
if($res && $params['is_stock']==1){
|
||||||
|
$arr=[
|
||||||
|
'mer_id'=>$mer_id,
|
||||||
|
'uid'=>$uid,
|
||||||
|
'product_id'=>$data['attrValue'][0]['product_id'],
|
||||||
|
'create_time'=>date('Y-m-d H:i:s')
|
||||||
|
];
|
||||||
|
Db::name('store_product_stock')->insert($arr);
|
||||||
|
}
|
||||||
|
return app('json')->success('编辑成功');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
132
app/controller/api/user/Zhibo.php
Normal file
132
app/controller/api/user/Zhibo.php
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: CRMEB Team <admin@crmeb.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\controller\api\user;
|
||||||
|
|
||||||
|
use crmeb\basic\BaseController;
|
||||||
|
use app\common\repositories\user\UserBillRepository;
|
||||||
|
use think\App;
|
||||||
|
use think\exception\HttpResponseException;
|
||||||
|
use think\exception\ValidateException;
|
||||||
|
use think\facade\Db;
|
||||||
|
use think\response\Json;
|
||||||
|
use GuzzleHttp\Exception\GuzzleException;
|
||||||
|
use GuzzleHttp\Client;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Auth
|
||||||
|
* @package app\controller\api
|
||||||
|
* @author xaboy
|
||||||
|
* @day 2020-05-06
|
||||||
|
*/
|
||||||
|
class Zhibo extends BaseController
|
||||||
|
{
|
||||||
|
//用户直播送礼
|
||||||
|
public function reward()
|
||||||
|
{
|
||||||
|
$user = $this->request->userInfo();
|
||||||
|
$params = $this->request->params(['live_stream_id', 'master_id', 'live_name', 'gift_id', 'gift_name', 'gift_num', 'amount']);
|
||||||
|
if (empty($params['live_stream_id']) || empty($params['master_id']) || empty($params['gift_id']) || empty($params['live_name']) || empty($params['gift_name']) || empty($params['amount'])) {
|
||||||
|
return app('json')->fail('live_stream_id, master_id, live_name, gift_id, gift_name, gift_num, amount 参数不能为空');
|
||||||
|
}
|
||||||
|
if ($params['amount'] > $user['now_money']) {
|
||||||
|
return app('json')->fail('余额不足');
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Db::transaction(function () use ($user, $params) {
|
||||||
|
//打赏订单
|
||||||
|
$orderId = Db::name('user_zhibo_order')->insertGetId([
|
||||||
|
'live_stream_id' => $params['live_stream_id'],
|
||||||
|
'live_name' => $params['live_name'],
|
||||||
|
'gift_id' => $params['gift_id'],
|
||||||
|
'gift_name' => $params['gift_name'],
|
||||||
|
'gift_num' => $params['gift_num'],
|
||||||
|
'uid' => $user['uid'],
|
||||||
|
'master_id' => $params['master_id'],
|
||||||
|
'order_sn' => 'zb' . date('YmdHis') . mt_rand(1000, 9999),
|
||||||
|
'amount' => $params['amount'],
|
||||||
|
'pay_status' => 1,
|
||||||
|
'pay_time' => date('Y-m-d H:i:s'),
|
||||||
|
'create_time' => date('Y-m-d H:i:s'),
|
||||||
|
'update_time' => date('Y-m-d H:i:s'),
|
||||||
|
]);
|
||||||
|
//打赏人扣钱
|
||||||
|
$user->now_money = bcsub($user['now_money'], $params['amount']);
|
||||||
|
$user->save();
|
||||||
|
$userBillRepository = app()->make(UserBillRepository::class);
|
||||||
|
//打赏人账单
|
||||||
|
$userBillRepository->decBill($user['uid'], 'now_money', 'zhibo_reward', [
|
||||||
|
'link_id' => $orderId,
|
||||||
|
'status' => 1,
|
||||||
|
'title' => '直播送礼支出',
|
||||||
|
'number' => $params['amount'],
|
||||||
|
'mark' => '余额送礼',
|
||||||
|
'balance' => $user->now_money
|
||||||
|
]);
|
||||||
|
//主播加钱
|
||||||
|
Db::name('user')->where('uid', $params['master_id'])->inc('now_money', $params['amount'])->update();
|
||||||
|
$master = Db::name('user')->where('uid', $params['master_id'])->find();
|
||||||
|
//主播账单
|
||||||
|
$userBillRepository->incBill($master['uid'], 'now_money', 'zhibo_reward', [
|
||||||
|
'link_id' => $orderId,
|
||||||
|
'status' => 1,
|
||||||
|
'title' => '直播送礼收入',
|
||||||
|
'number' => $params['amount'],
|
||||||
|
'mark' => '直播送礼收入',
|
||||||
|
'balance' => $master['now_money']
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return app('json')->fail($e->getMessage());
|
||||||
|
}
|
||||||
|
return app('json')->success('送礼成功');
|
||||||
|
}
|
||||||
|
|
||||||
|
//用户送礼收礼记录
|
||||||
|
public function rewardList()
|
||||||
|
{
|
||||||
|
[$page, $limit] = $this->getPage();
|
||||||
|
$token = request()->header('x-token');
|
||||||
|
$params = $this->request->params(['type']);
|
||||||
|
if (empty($params['type'])) {
|
||||||
|
return app('json')->fail('类型不能为空');
|
||||||
|
}
|
||||||
|
$user = $this->request->userInfo();
|
||||||
|
$where = [];
|
||||||
|
if ($params['type'] == 1) {
|
||||||
|
// 送出的礼物
|
||||||
|
$where['ub.pm'] = 0;
|
||||||
|
$where['ub.type'] = 'zhibo_reward';
|
||||||
|
$where['uzo.uid'] = $user['uid'];
|
||||||
|
} elseif ($params['type'] == 2){
|
||||||
|
// 收到的礼物
|
||||||
|
$where['ub.pm'] = 1;
|
||||||
|
$where['ub.type'] = 'zhibo_reward';
|
||||||
|
$where['uzo.master_id'] = $user['uid'];
|
||||||
|
} else {
|
||||||
|
return app('json')->fail('类型错误');
|
||||||
|
}
|
||||||
|
$count = Db::name('user_bill')->alias('ub')->leftJoin('user_zhibo_order uzo','uzo.order_id = ub.link_id')->where($where)->count();
|
||||||
|
$list = Db::name('user_bill')->alias('ub')->leftJoin('user_zhibo_order uzo','uzo.order_id = ub.link_id')->where($where)->limit(($page-1) * $limit, $limit)->field([
|
||||||
|
'uzo.order_id',
|
||||||
|
'uzo.live_stream_id',
|
||||||
|
'uzo.live_name',
|
||||||
|
'uzo.gift_id',
|
||||||
|
'uzo.gift_name',
|
||||||
|
'uzo.order_sn',
|
||||||
|
'uzo.amount',
|
||||||
|
'ub.title',
|
||||||
|
'uzo.create_time'
|
||||||
|
])->select();
|
||||||
|
return app('json')->success(compact('count', 'list'));
|
||||||
|
}
|
||||||
|
}
|
@ -277,13 +277,22 @@ class Product extends BaseController
|
|||||||
"is_good",
|
"is_good",
|
||||||
"attr",
|
"attr",
|
||||||
"attrValue",
|
"attrValue",
|
||||||
'spec_type'
|
'spec_type',
|
||||||
|
'is_stock'
|
||||||
];
|
];
|
||||||
$data = $this->request->params($params);
|
$data = $this->request->params($params);
|
||||||
// $count = app()->make(StoreCategoryRepository::class)->getWhereCount(['store_category_id' => $data['mer_cate_id'],'is_show' => 1,'mer_id' => $this->request->merId()]);
|
// $count = app()->make(StoreCategoryRepository::class)->getWhereCount(['store_category_id' => $data['mer_cate_id'],'is_show' => 1,'mer_id' => $this->request->merId()]);
|
||||||
// if (!$count) throw new ValidateException('商户分类不存在或不可用');
|
// if (!$count) throw new ValidateException('商户分类不存在或不可用');
|
||||||
$data['status'] = 1;
|
$data['status'] = 1;
|
||||||
$this->repository->freeTrial($id, $data,$this->request->merId());
|
$res=$this->repository->freeTrial($id, $data,$this->request->merId());
|
||||||
|
if($res && $params['is_stock']==1){
|
||||||
|
$arr=[
|
||||||
|
'mer_id'=>$this->request->merId(),
|
||||||
|
'product_id'=>$data['attrValue'][0]['product_id'],
|
||||||
|
'create_time'=>date('Y-m-d H:i:s')
|
||||||
|
];
|
||||||
|
Db::name('store_product_stock')->insert($arr);
|
||||||
|
}
|
||||||
return app('json')->success('编辑成功');
|
return app('json')->success('编辑成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ class Merchant extends BaseController
|
|||||||
$data = $this->request->params(['mer_state']);
|
$data = $this->request->params(['mer_state']);
|
||||||
|
|
||||||
if ($merchant->is_margin == 1 && $data['mer_state'] == 1)
|
if ($merchant->is_margin == 1 && $data['mer_state'] == 1)
|
||||||
return app('json')->fail('开启店铺前请先支付保证金');
|
return app('json')->fail('开启店铺前请先支付押金');
|
||||||
|
|
||||||
if ($data['mer_state'] && !$merchant->sub_mchid && systemConfig('open_wx_combine'))
|
if ($data['mer_state'] && !$merchant->sub_mchid && systemConfig('open_wx_combine'))
|
||||||
return app('json')->fail('开启店铺前请先完成微信子商户入驻');
|
return app('json')->fail('开启店铺前请先完成微信子商户入驻');
|
||||||
|
@ -34,7 +34,7 @@ class AfterRefund
|
|||||||
if (in_array($financialRecord['financial_type'], ['commission_to_cloud_warehouse', 'commission_to_entry_merchant', 'commission_to_service_team', 'commission_to_village', 'commission_to_town', ])) {
|
if (in_array($financialRecord['financial_type'], ['commission_to_cloud_warehouse', 'commission_to_entry_merchant', 'commission_to_service_team', 'commission_to_village', 'commission_to_town', ])) {
|
||||||
//佣金类型的退还佣金
|
//佣金类型的退还佣金
|
||||||
if ($financialRecord['financial_type'] == 'commission_to_entry_merchant') {
|
if ($financialRecord['financial_type'] == 'commission_to_entry_merchant') {
|
||||||
//入口店铺的佣金,如果有保证金,不退佣金
|
//入口店铺的佣金,如果有押金,不退佣金
|
||||||
$isMargin = $this->isMargin($financialRecords, $financialRecord['mer_id']);
|
$isMargin = $this->isMargin($financialRecords, $financialRecord['mer_id']);
|
||||||
if (!$isMargin) {
|
if (!$isMargin) {
|
||||||
$this->subMoney($financialRecord);
|
$this->subMoney($financialRecord);
|
||||||
@ -49,7 +49,7 @@ class AfterRefund
|
|||||||
}
|
}
|
||||||
if ($financialRecord['financial_type'] == 'auto_margin') {
|
if ($financialRecord['financial_type'] == 'auto_margin') {
|
||||||
Log::info("refundMargin, mer_id: {$financialRecord['mer_id']}, money: {$financialRecord['number']}");
|
Log::info("refundMargin, mer_id: {$financialRecord['mer_id']}, money: {$financialRecord['number']}");
|
||||||
//保证金类型的扣除保证金
|
//押金类型的扣除押金
|
||||||
ServeOrder::getInstance()->where('store_order_id', $financialRecord['order_id'])->update(['is_del' => 1]);
|
ServeOrder::getInstance()->where('store_order_id', $financialRecord['order_id'])->update(['is_del' => 1]);
|
||||||
$merchant = app()->make(MerchantDao::class)->get($financialRecord['mer_id']);
|
$merchant = app()->make(MerchantDao::class)->get($financialRecord['mer_id']);
|
||||||
$merchant->paid_margin = max(bcsub($merchant['paid_margin'], $financialRecord['number'], 2), 0);
|
$merchant->paid_margin = max(bcsub($merchant['paid_margin'], $financialRecord['number'], 2), 0);
|
||||||
@ -65,7 +65,7 @@ class AfterRefund
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否有保证金
|
* 是否有押金
|
||||||
* @param $financialRecords
|
* @param $financialRecords
|
||||||
* @param $merId
|
* @param $merId
|
||||||
* @return bool
|
* @return bool
|
||||||
|
@ -14,7 +14,7 @@ class paySuccessMargin
|
|||||||
public $event;
|
public $event;
|
||||||
public function handle($event)
|
public function handle($event)
|
||||||
{
|
{
|
||||||
Log::info('微信支付保证金成功回调' . json_encode($event));
|
Log::info('微信支付押金成功回调' . json_encode($event));
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
$order_sn = $event['order_sn'];
|
$order_sn = $event['order_sn'];
|
||||||
@ -27,7 +27,7 @@ class paySuccessMargin
|
|||||||
$merchantInfo = Db::name('merchant')->where('mer_id', $marginInfo['mer_id'])->where('uid', $marginInfo['uid'])->find();
|
$merchantInfo = Db::name('merchant')->where('mer_id', $marginInfo['mer_id'])->where('uid', $marginInfo['uid'])->find();
|
||||||
$merchant_type = Db::name('merchant_type')->where('mer_type_id', $merchantInfo['type_id'])->find();
|
$merchant_type = Db::name('merchant_type')->where('mer_type_id', $merchantInfo['type_id'])->find();
|
||||||
|
|
||||||
//已支付的保证金
|
//已支付的押金
|
||||||
$paidMarginAmount = bcadd($merchantInfo['paid_margin'], $marginInfo['total_price'], 2);
|
$paidMarginAmount = bcadd($merchantInfo['paid_margin'], $marginInfo['total_price'], 2);
|
||||||
Db::name('merchant')->where('mer_id', $marginInfo['mer_id'])->where('uid', $marginInfo['uid'])->update([
|
Db::name('merchant')->where('mer_id', $marginInfo['mer_id'])->where('uid', $marginInfo['uid'])->update([
|
||||||
'paid_margin' => $paidMarginAmount,'ot_margin'=>$paidMarginAmount
|
'paid_margin' => $paidMarginAmount,'ot_margin'=>$paidMarginAmount
|
||||||
@ -45,7 +45,7 @@ class paySuccessMargin
|
|||||||
// 提交事务
|
// 提交事务
|
||||||
Db::commit();
|
Db::commit();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error('微信支付保证金失败' . $e->getMessage());
|
Log::error('微信支付押金失败' . $e->getMessage());
|
||||||
// 回滚事务
|
// 回滚事务
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
}
|
}
|
||||||
|
@ -22,9 +22,9 @@ class MerchantTypeValidate extends Validate
|
|||||||
protected $rule = [
|
protected $rule = [
|
||||||
'type_name|店铺类型名称' => 'require|max:5',
|
'type_name|店铺类型名称' => 'require|max:5',
|
||||||
'type_info|店铺类型要求' => 'max:256',
|
'type_info|店铺类型要求' => 'max:256',
|
||||||
'is_margin|是否有保证金' => 'require|in:0,1',
|
'is_margin|是否有押金' => 'require|in:0,1',
|
||||||
'auth|权限' => 'require|array|min:1',
|
'auth|权限' => 'require|array|min:1',
|
||||||
'margin|保证金(¥)' => 'requireIf:is_margin,1',
|
'margin|押金(¥)' => 'requireIf:is_margin,1',
|
||||||
'description|其他说明' => 'max:256',
|
'description|其他说明' => 'max:256',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -51,8 +51,8 @@ class MerchantValidate extends Validate
|
|||||||
'is_bro_room|直播间状态' => 'require|in:0,1',
|
'is_bro_room|直播间状态' => 'require|in:0,1',
|
||||||
'is_trader|自营状态' => 'require|in:0,1',
|
'is_trader|自营状态' => 'require|in:0,1',
|
||||||
'commission_rate|提成比例' => '>=:0',
|
'commission_rate|提成比例' => '>=:0',
|
||||||
'auto_margin_rate|自动扣除保证金比例' => '>=:0',
|
'auto_margin_rate|自动扣除押金比例' => '>=:0',
|
||||||
'paid_margin|已支付的保证金' => '>=:0',
|
'paid_margin|已支付的押金' => '>=:0',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -62,9 +62,9 @@ return [
|
|||||||
'APPLYMENTS_FAIL' => 550523,
|
'APPLYMENTS_FAIL' => 550523,
|
||||||
//商户申请分账待验证
|
//商户申请分账待验证
|
||||||
'APPLYMENTS_SIGN' => 550525,
|
'APPLYMENTS_SIGN' => 550525,
|
||||||
//商户申请退回保证金通过
|
//商户申请退回押金通过
|
||||||
'REFUND_MARGIN_SUCCESS' => 710327,
|
'REFUND_MARGIN_SUCCESS' => 710327,
|
||||||
//商户申请退回保证金未通过
|
//商户申请退回押金未通过
|
||||||
'REFUND_MARGIN_FAIL' => 710328,
|
'REFUND_MARGIN_FAIL' => 710328,
|
||||||
],
|
],
|
||||||
//微信
|
//微信
|
||||||
|
@ -72,9 +72,9 @@ return [
|
|||||||
'APPLYMENTS_SIGN' => 550525,
|
'APPLYMENTS_SIGN' => 550525,
|
||||||
//商户申请分账未通过 2.1
|
//商户申请分账未通过 2.1
|
||||||
'APPLYMENTS_FAIL' => 550523,
|
'APPLYMENTS_FAIL' => 550523,
|
||||||
//商户申请退回保证金通过 2.1
|
//商户申请退回押金通过 2.1
|
||||||
'REFUND_MARGIN_SUCCESS' => 710327,
|
'REFUND_MARGIN_SUCCESS' => 710327,
|
||||||
//商户申请退回保证金未通过 2.1
|
//商户申请退回押金未通过 2.1
|
||||||
'REFUND_MARGIN_FAIL' => 710328,
|
'REFUND_MARGIN_FAIL' => 710328,
|
||||||
//付费会员充值成功提醒 2.1
|
//付费会员充值成功提醒 2.1
|
||||||
'SVIP_PAY_SUCCESS' => 856046
|
'SVIP_PAY_SUCCESS' => 856046
|
||||||
@ -130,9 +130,9 @@ return [
|
|||||||
'APPLYMENTS_FAIL' => '',
|
'APPLYMENTS_FAIL' => '',
|
||||||
//商户申请分账待验证
|
//商户申请分账待验证
|
||||||
'APPLYMENTS_SIGN' => '',
|
'APPLYMENTS_SIGN' => '',
|
||||||
//商户申请退回保证金通过
|
//商户申请退回押金通过
|
||||||
'REFUND_MARGIN_SUCCESS' => '',
|
'REFUND_MARGIN_SUCCESS' => '',
|
||||||
//商户申请退回保证金未通过
|
//商户申请退回押金未通过
|
||||||
'REFUND_MARGIN_FAIL' => '',
|
'REFUND_MARGIN_FAIL' => '',
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
|
@ -354,7 +354,7 @@ class ExcelService
|
|||||||
'order_presell' => '预售订单(定金)',
|
'order_presell' => '预售订单(定金)',
|
||||||
'refund_platform_coupon' => '退回优惠券补贴',
|
'refund_platform_coupon' => '退回优惠券补贴',
|
||||||
'order_platform_coupon' => '优惠券补贴',
|
'order_platform_coupon' => '优惠券补贴',
|
||||||
'auto_margin' => '保证金',
|
'auto_margin' => '押金',
|
||||||
'commission_to_service_team' => '订单平台佣金',
|
'commission_to_service_team' => '订单平台佣金',
|
||||||
'commission_to_platform' => '订单剩余平台手续费',
|
'commission_to_platform' => '订单剩余平台手续费',
|
||||||
'commission_to_village' => '订单平台佣金',
|
'commission_to_village' => '订单平台佣金',
|
||||||
@ -363,7 +363,7 @@ class ExcelService
|
|||||||
'commission_to_platform_refund' => '退回剩余平台手续费',
|
'commission_to_platform_refund' => '退回剩余平台手续费',
|
||||||
'commission_to_village_refund' => '退回平台佣金',
|
'commission_to_village_refund' => '退回平台佣金',
|
||||||
'commission_to_town_refund' => '退回平台佣金',
|
'commission_to_town_refund' => '退回平台佣金',
|
||||||
'auto_margin_refund' => '退回保证金',
|
'auto_margin_refund' => '退回押金',
|
||||||
'commission_to_entry_merchant' => '订单平台佣金',
|
'commission_to_entry_merchant' => '订单平台佣金',
|
||||||
'commission_to_cloud_warehouse' => '订单平台佣金',
|
'commission_to_cloud_warehouse' => '订单平台佣金',
|
||||||
'commission_to_entry_merchant_refund' => '退回平台佣金',
|
'commission_to_entry_merchant_refund' => '退回平台佣金',
|
||||||
|
@ -261,10 +261,10 @@ class SmsService
|
|||||||
'site' => systemConfig('site_name'),
|
'site' => systemConfig('site_name'),
|
||||||
]);
|
]);
|
||||||
break;
|
break;
|
||||||
//保证金退回申请通过通知 2.1
|
//押金退回申请通过通知 2.1
|
||||||
case 'REFUND_MARGIN_SUCCESS':
|
case 'REFUND_MARGIN_SUCCESS':
|
||||||
//nobreak;
|
//nobreak;
|
||||||
//保证金退回申请未通过通知 2.1
|
//押金退回申请未通过通知 2.1
|
||||||
case 'REFUND_MARGIN_FAIL':
|
case 'REFUND_MARGIN_FAIL':
|
||||||
self::create()->send($id['phone'], $tempId, ['name' => $id['name'], 'time' => $id['time'],]);
|
self::create()->send($id['phone'], $tempId, ['name' => $id['name'], 'time' => $id['time'],]);
|
||||||
break;
|
break;
|
||||||
|
@ -193,7 +193,7 @@ Route::group(function () {
|
|||||||
'_auth' => true,
|
'_auth' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//保证金
|
//押金
|
||||||
Route::group('margin', function () {
|
Route::group('margin', function () {
|
||||||
//缴纳记录
|
//缴纳记录
|
||||||
Route::get('lst', 'merchant.MerchantMargin/lst')->name('systemMerchantMarginLst')->option([
|
Route::get('lst', 'merchant.MerchantMargin/lst')->name('systemMerchantMarginLst')->option([
|
||||||
@ -204,14 +204,14 @@ Route::group(function () {
|
|||||||
'_alias' => '扣费记录',
|
'_alias' => '扣费记录',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//扣除保证金
|
//扣除押金
|
||||||
Route::get('set/:id/form', 'merchant.MerchantMargin/setMarginForm')->name('systemMarginSetForm')->option([
|
Route::get('set/:id/form', 'merchant.MerchantMargin/setMarginForm')->name('systemMarginSetForm')->option([
|
||||||
'_alias' => '扣除保证金表单',
|
'_alias' => '扣除押金表单',
|
||||||
'_auth' => false,
|
'_auth' => false,
|
||||||
'_form' => 'systemMarginSet',
|
'_form' => 'systemMarginSet',
|
||||||
]);
|
]);
|
||||||
Route::post('set', 'merchant.MerchantMargin/setMargin')->name('systemMarginSet')->option([
|
Route::post('set', 'merchant.MerchantMargin/setMargin')->name('systemMarginSet')->option([
|
||||||
'_alias' => '扣除保证金',
|
'_alias' => '扣除押金',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//退款申请
|
//退款申请
|
||||||
|
@ -39,6 +39,10 @@ Route::group('api/', function () {
|
|||||||
Route::post('articleCatch', 'api.Upload/article');
|
Route::post('articleCatch', 'api.Upload/article');
|
||||||
//强制登录
|
//强制登录
|
||||||
Route::group(function () {
|
Route::group(function () {
|
||||||
|
|
||||||
|
Route::post('user_free_trial/:id', 'api.store.product.StoreProduct/UserFreeTrial')->option([
|
||||||
|
'_alias' => '免审编辑',
|
||||||
|
]);
|
||||||
Route::post('sync/token', 'api.Auth/syncToken');
|
Route::post('sync/token', 'api.Auth/syncToken');
|
||||||
|
|
||||||
Route::group('micro', function () {
|
Route::group('micro', function () {
|
||||||
@ -69,10 +73,14 @@ Route::group('api/', function () {
|
|||||||
|
|
||||||
//绑定推荐人
|
//绑定推荐人
|
||||||
Route::post('user/spread', 'api.Auth/spread');
|
Route::post('user/spread', 'api.Auth/spread');
|
||||||
//用户缴纳保证金
|
//用户缴纳押金
|
||||||
Route::post('user/margin', 'api.Auth/doMargin');
|
Route::post('user/margin', 'api.Auth/doMargin');
|
||||||
Route::get('user/margin/list', 'api.Auth/marginList');
|
Route::get('user/margin/list', 'api.Auth/marginList');
|
||||||
|
|
||||||
|
|
||||||
|
Route::post('zhibo/reward', 'api.user.Zhibo/reward');
|
||||||
|
Route::get('zhibo/rewardList', 'api.user.Zhibo/rewardList');
|
||||||
|
|
||||||
//优惠券
|
//优惠券
|
||||||
Route::group('coupon', function () {
|
Route::group('coupon', function () {
|
||||||
Route::post('receive/:id', 'api.store.product.StoreCoupon/receiveCoupon');
|
Route::post('receive/:id', 'api.store.product.StoreCoupon/receiveCoupon');
|
||||||
@ -310,9 +318,6 @@ Route::group('api/', function () {
|
|||||||
Route::post('attr/delete', 'StoreProductAttrTemplate/batchDelete');
|
Route::post('attr/delete', 'StoreProductAttrTemplate/batchDelete');
|
||||||
Route::get('attr/detail/:id', 'StoreProductAttrTemplate/detail');
|
Route::get('attr/detail/:id', 'StoreProductAttrTemplate/detail');
|
||||||
Route::get('attr/list', 'StoreProductAttrTemplate/getlist');
|
Route::get('attr/list', 'StoreProductAttrTemplate/getlist');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})->prefix('api.server.')->middleware(\app\common\middleware\MerchantServerMiddleware::class, 1);
|
})->prefix('api.server.')->middleware(\app\common\middleware\MerchantServerMiddleware::class, 1);
|
||||||
|
|
||||||
//管理员订单
|
//管理员订单
|
||||||
@ -334,7 +339,6 @@ Route::group('api/', function () {
|
|||||||
Route::get('/purchaseOrder', '/purchaseOrder');
|
Route::get('/purchaseOrder', '/purchaseOrder');
|
||||||
Route::post('/settle', '/settle');
|
Route::post('/settle', '/settle');
|
||||||
Route::post('/confirm', '/confirm');
|
Route::post('/confirm', '/confirm');
|
||||||
|
|
||||||
})->prefix('api.server.StoreOrder')->middleware(\app\common\middleware\MerchantServerMiddleware::class, 0);
|
})->prefix('api.server.StoreOrder')->middleware(\app\common\middleware\MerchantServerMiddleware::class, 0);
|
||||||
|
|
||||||
//管理员申请转账
|
//管理员申请转账
|
||||||
@ -405,7 +409,6 @@ Route::group('api/', function () {
|
|||||||
//价格列表
|
//价格列表
|
||||||
Route::post('pay/:id', '/createOrder')->middleware(\app\common\middleware\BlockerMiddleware::class);
|
Route::post('pay/:id', '/createOrder')->middleware(\app\common\middleware\BlockerMiddleware::class);
|
||||||
})->prefix('api.user.Svip');
|
})->prefix('api.user.Svip');
|
||||||
|
|
||||||
})->middleware(UserTokenMiddleware::class, true);
|
})->middleware(UserTokenMiddleware::class, true);
|
||||||
|
|
||||||
//非强制登录
|
//非强制登录
|
||||||
@ -583,7 +586,6 @@ Route::group('api/', function () {
|
|||||||
Route::any('store/test', 'api.Test/test');
|
Route::any('store/test', 'api.Test/test');
|
||||||
Route::get('subscribe', 'api.Common/subscribe');
|
Route::get('subscribe', 'api.Common/subscribe');
|
||||||
Route::resource('store/product/cloudWarehouse', 'api.store.product.CloudWarehouse');
|
Route::resource('store/product/cloudWarehouse', 'api.store.product.CloudWarehouse');
|
||||||
|
|
||||||
})->middleware(UserTokenMiddleware::class, false);
|
})->middleware(UserTokenMiddleware::class, false);
|
||||||
|
|
||||||
//微信支付回调
|
//微信支付回调
|
||||||
@ -683,10 +685,18 @@ Route::group('api/', function () {
|
|||||||
Route::get('micro', 'api.Common/micro');
|
Route::get('micro', 'api.Common/micro');
|
||||||
Route::get('version', 'admin.Common/version');
|
Route::get('version', 'admin.Common/version');
|
||||||
|
|
||||||
|
Route::group('statistics', function () {
|
||||||
|
Route::get('supply_chain_mer_count', '/SupplyChainMerCount');
|
||||||
|
Route::get('supply_chain_product_count', '/SupplyChainProductCount');
|
||||||
|
Route::get('supply_chain_product_stock_count', '/SupplyChainProductStockCount');
|
||||||
|
Route::get('product_list', '/ProductList');
|
||||||
|
Route::get('supply_chain_product_price_count', '/SupplyChainProductPriceCount');
|
||||||
|
Route::get('supply_chain_street_product_price_count', '/SupplyChainStreetProductPriceCount');
|
||||||
|
})->prefix('api.Statistics');
|
||||||
|
|
||||||
//滑块验证码
|
//滑块验证码
|
||||||
Route::get('ajcaptcha', 'api.Auth/ajcaptcha');
|
Route::get('ajcaptcha', 'api.Auth/ajcaptcha');
|
||||||
Route::post('ajcheck', 'api.Auth/ajcheck');
|
Route::post('ajcheck', 'api.Auth/ajcheck');
|
||||||
|
|
||||||
})->middleware(AllowOriginMiddleware::class)
|
})->middleware(AllowOriginMiddleware::class)
|
||||||
->middleware(InstallMiddleware::class)
|
->middleware(InstallMiddleware::class)
|
||||||
->middleware(CheckSiteOpenMiddleware::class)
|
->middleware(CheckSiteOpenMiddleware::class)
|
||||||
@ -703,5 +713,6 @@ Route::group('/pages', function () {
|
|||||||
Route::group('/open-location', function () {
|
Route::group('/open-location', function () {
|
||||||
Route::miss('View/h5');
|
Route::miss('View/h5');
|
||||||
})->middleware(InstallMiddleware::class)
|
})->middleware(InstallMiddleware::class)
|
||||||
->middleware(CheckSiteOpenMiddleware::class)
|
->middleware(CheckSiteOpenMiddleware::class);
|
||||||
;
|
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ Route::group(function () {
|
|||||||
|
|
||||||
Route::group('financial', function () {
|
Route::group('financial', function () {
|
||||||
Route::post('refund/margin', 'Financial/refundMargin')->name('merchantFinancialRefundMargin')->option([
|
Route::post('refund/margin', 'Financial/refundMargin')->name('merchantFinancialRefundMargin')->option([
|
||||||
'_alias' => '退保证金申请',
|
'_alias' => '退押金申请',
|
||||||
]);
|
]);
|
||||||
})->prefix('merchant.system.financial.')->option([
|
})->prefix('merchant.system.financial.')->option([
|
||||||
'_path' => 'merchant/margin',
|
'_path' => 'merchant/margin',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user