Merge pull request 'dev' (#54) from dev into preview

Reviewed-on: #54
This commit is contained in:
mkm 2023-10-27 16:28:24 +08:00
commit 0b0cc56d00
33 changed files with 569 additions and 299 deletions

View File

@ -78,7 +78,7 @@ class StoreCartDao extends BaseDao
$query->field('product_id,stock,price,unique,sku,image,svip_price');
},
'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();

View File

@ -55,7 +55,7 @@ class MerchantTypeDao extends BaseDao
[
'type' => 'div',
'children' => [
'保证金:' . $item['margin']. ' 元'
'金:' . $item['margin']. ' 元'
],
'style' => [
'paddingTop' => '100px',

View File

@ -623,39 +623,40 @@ class CommunityRepository extends BaseRepository
$resale->update($value);
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();
// if ($exist) {
// throw new ValidateException('已发起转售');
// }
$totalNumber = PurchaseRecord::where('unique', $value['product_attr_unique'])->sum('number');
$totalSalesVolume = PurchaseRecord::where('unique', $value['product_attr_unique'])->sum('sales_volume');
if (empty($purchaseRecord) || ($totalNumber - $totalSalesVolume) <= 0) {
throw new ValidateException('进货记录不存在或已售罄');
}
if (($totalNumber - $totalSalesVolume) < $value['number']) {
throw new ValidateException('库存不足');
}
// $totalNumber = PurchaseRecord::where('unique', $value['product_attr_unique'])->sum('number');
// $totalSalesVolume = PurchaseRecord::where('unique', $value['product_attr_unique'])->sum('sales_volume');
// if (empty($purchaseRecord) || ($totalNumber - $totalSalesVolume) <= 0) {
// throw new ValidateException('进货记录不存在或已售罄');
// }
// if (($totalNumber - $totalSalesVolume) < $value['number']) {
// throw new ValidateException('库存不足');
// }
if ($value) {
$insert[] = [
'community_id' => $id,
'purchase_record_id' => $purchaseRecord['id'],
'product_id' => $purchaseRecord['product_id'],
'product_attr_unique' => $purchaseRecord['unique'],
'mer_id' => $purchaseRecord['mer_id'],
'number' => $value['number'],
'price' => $value['price'],
'resale_type' => $resaleType,
'deliver_method' => $value['deliver_method'] ?? '',
'update_time' => date('Y-m-d H:i:s'),
];
$attrValue = ProductAttrValue::where('unique', $value['product_attr_unique'])->find();
if($attrValue){
$insert[] = [
'community_id' => $id,
'purchase_record_id' => 0,
'product_id' => $attrValue['product_id'],
'product_attr_unique' => $attrValue['unique'],
'mer_id' => $attrValue['mer_id'],
'number' => $value['number'],
'price' => $value['price'],
'resale_type' => $resaleType,
'deliver_method' => $value['deliver_method'] ?? '',
'update_time' => date('Y-m-d H:i:s'),
];
$attrValue->stock -= $value['number'];
$attrValue->save();
}
}
$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->save();
}
if ($insert) {
Resale::getInstance()->insertAll($insert);

View File

@ -375,7 +375,7 @@ class StoreOrderRepository extends BaseRepository
'financial_record_sn' => $financeSn . ($i++)
];
}
//保证金计算
//金计算
if ($_payPrice > 0) {
/** @var MerchantRepository $merchantRepo */
$merchantRepo = app()->make(MerchantRepository::class);

View File

@ -202,7 +202,6 @@ class SpuRepository extends BaseRepository
}
$where['product_id'] = $randPidList;
unset($where['mer_rand_id'], $where['page']);
$page = 1;
}
$entryMerId = $where['entry_mer_id'] ?? '';
unset($where['entry_mer_id']);

View File

@ -318,7 +318,7 @@ class FinancialRepository extends BaseRepository
if ($res['is_margin'] == -1) throw new ValidateException('请勿重复申请');
if (!in_array($res['is_margin'],[10,-10]) || $res['paid_margin'] <= 0)
throw new ValidateException('无可退保证金');
throw new ValidateException('无可退金');
$order = app()->make(ServeOrderRepository::class)->getWhere([
'mer_id' => $res['mer_id'],
@ -327,7 +327,7 @@ class FinancialRepository extends BaseRepository
]);
if (!$order) throw new ValidateException('未查询到支付订单');
$financial_account = [
'name' => '保证金退款',
'name' => '金退款',
'order_id' => $order['order_id'],
'order_sn' => $order['order_sn'],
'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_id','商户ID', $data['mer_id'])->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('refund','退回金额', $data['extract_money'])->disabled(true),
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
* @author Qinii
* @day 1/27/22
@ -657,10 +657,10 @@ class FinancialRepository extends BaseRepository
//验证
$comp = bccomp($res['financial_account']->pay_price, $res['extract_money'], 2);
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)
// throw new ValidateException('申请退款金额:'.$res['extract_money'].',大于剩余保证金:'.$res['merchant']['margin']);
// throw new ValidateException('申请退款金额:'.$res['extract_money'].',大于剩余金:'.$res['merchant']['margin']);
Db::transaction(function () use ($res){
//退款

View File

@ -254,7 +254,7 @@ class FinancialRecordRepository extends BaseRepository
{
//商户收入
$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_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',
'count' => bcsub($auto_margin,$auto_margin_refund,2),
'field' => '元',
'name' => '商户保证金金额'
'name' => '商户金金额'
],
];
return compact('stat');
@ -490,7 +490,7 @@ class FinancialRecordRepository extends BaseRepository
bcsub($expend['count_order_charge'], $expend['count_charge']). '笔',
],
[
'店铺保证金',
'店铺金',
$expend['number_auto_margin'] . '元',
$expend['count_auto_margin'] . '笔'
@ -674,10 +674,10 @@ class FinancialRecordRepository extends BaseRepository
$financialType = ['order_charge', 'presell_charge'];
[$data['count_order_charge'], $data['number_order_charge']] = $this->dao->getDataByType($type, $where, $date, $financialType);
//商户保证
//商户
$financialType = ['auto_margin'];
[$data['count_auto_margin'], $data['number_auto_margin']] = $this->dao->getDataByType($type, $where, $date, $financialType);
//商户保证金退回
//商户金退回
$financialType = ['auto_margin_refund'];
[$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);

View File

@ -137,7 +137,7 @@ class MerchantIntentionRepository extends BaseRepository
'is_bro_goods' => $config['broadcast_goods_type'] == 1 ? 0 : 1,
'mer_password' => $password,
'is_margin' => $margin['is_margin'] ?? -1,
// 用户需缴纳保证
// 用户需缴纳
'margin' => $margin['margin'] ?? 0,
'uid' => $intention['uid'],
'reg_admin_id' => $autoCreate ? 0: request()->adminId(),

View File

@ -66,14 +66,14 @@ use think\Model;
class MerchantRepository extends BaseRepository
{
const WithoutMargin = 0; //不需要保证
const NeedMargin = 1; //需要保证
const PaidMargin = 10; //已支付保证
const RefundMargin = -1; //申请退还保证
const RefuseMargin = -10; //拒绝退还保证
const WithoutMargin = 0; //不需要
const NeedMargin = 1; //需要
const PaidMargin = 10; //已支付
const RefundMargin = -1; //申请退还
const RefuseMargin = -10; //拒绝退还
public $merId;
public $forceMargin = false; //强制扣除保证
public $forceMargin = false; //强制扣除
/**
* MerchantRepository constructor.
@ -622,17 +622,17 @@ class MerchantRepository extends BaseRepository
{
$merchant = $this->dao->get($id);
if ($merchant->is_margin !== 10) {
throw new ValidateException('商户无保证金可扣');
throw new ValidateException('商户无金可扣');
}
$form = Elm::createForm(Route::buildUrl('systemMarginSet')->build());
$form->setRule([
Elm::input('mer_name', '商户名称', $merchant->mer_name)->disabled(true),
Elm::input('mer_id', '商户ID', $merchant->mer_id)->disabled(true),
Elm::input('margin', '商户剩余保证金', $merchant->paid_margin)->disabled(true),
Elm::number('number', '保证金扣除金额', 0)->max($merchant->paid_margin)->precision(2)->required(),
Elm::text('mark', '保证金扣除原因')->required(),
Elm::input('margin', '商户剩余金', $merchant->paid_margin)->disabled(true),
Elm::number('number', '金扣除金额', 0)->max($merchant->paid_margin)->precision(2)->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']);
if ($merechant->is_margin !== 10) {
throw new ValidateException('商户未支付保证金或已申请退款');
throw new ValidateException('商户未支付金或已申请退款');
}
if ($data['number'] < 0) {
throw new ValidateException('扣除保证金额不能小于0');
throw new ValidateException('扣除金额不能小于0');
}
if (bccomp($merechant->paid_margin, $data['number'], 2) == -1) {
throw new ValidateException('扣除保证金额不足');
throw new ValidateException('扣除金额不足');
}
$data['balance'] = bcsub($merechant->paid_margin, $data['number'], 2);
@ -679,7 +679,7 @@ class MerchantRepository extends BaseRepository
}
/**
* 自动扣除保证
* 自动扣除
* @param $income
* @param $order
* @param $finance
@ -691,12 +691,12 @@ class MerchantRepository extends BaseRepository
{
$merchant = Merchant::find($this->merId);
$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)) {
return [$income, $finance, false];
}
$rate = $this->forceMargin ? 100 : $merchant['auto_margin_rate'];
// //商户保证金未完全缴纳且设置了自动扣除比例
// //商户金未完全缴纳且设置了自动扣除比例
$margin= bcmul($income, bcdiv($rate, 100,2), 2);
// $margin = min(bcsub($margin, $merchant['paid_margin'], 2), $margin);
// $income = max(bcsub($income, $margin, 2), 0);

View File

@ -124,7 +124,7 @@ class MerchantTypeRepository extends BaseRepository
$make = app()->make(RelevanceRepository::class);
$make->batchDelete($id, RelevanceRepository::TYPE_MERCHANT_AUTH);
$make->insertAll($inserts);
//更新未交保证金的商户
//更新未交金的商户
app()->make(MerchantRepository::class)->updateMargin($id, $data['margin'], $data['is_margin']);
});
}

View File

@ -38,7 +38,7 @@ class ServeOrderRepository extends BaseRepository
const TYPE_COPY_PRODUCT = 1;
//电子面单
const TYPE_DUMP = 2;
//保证金 margin
//金 margin
const TYPE_MARGIN = 10;
//同城配送delivery
const TYPE_DELIVERY = 20;
@ -83,7 +83,7 @@ class ServeOrderRepository extends BaseRepository
}
/**
* TODO 商户保证支付
* TODO 商户支付
* @param $merId
* @param $data
* @return array
@ -93,7 +93,7 @@ class ServeOrderRepository extends BaseRepository
public function margin($merId, $data)
{
$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());
$arr = [
'type_id' => $ret['type_id'],

View File

@ -67,11 +67,11 @@ class MerchantMargin extends BaseController
public function setMargin()
{
$data = $this->request->params(['mer_id','number',['type','mer_margin'],'mark']);
$data['title'] = '保证金扣除';
$data['title'] = '金扣除';
if ($data['number'] < 0)
return app('json')->fail('扣除金额不能小于0');
app()->make(MerchantRepository::class)->setMargin($data);
return app('json')->success('扣除保证金成功');
return app('json')->success('扣除金成功');
}
}

View File

@ -95,7 +95,7 @@ class MerchantType extends BaseController
$validate = app()->make(MerchantTypeValidate::class);
$validate->check($data);
if ($data['is_margin'] == 1) {
if ($data['margin'] <= 0) throw new ValidateException('保证金必须大于0');
if ($data['margin'] <= 0) throw new ValidateException('金必须大于0');
} else {
$data['margin'] = 0;
}

View File

@ -57,7 +57,7 @@ use app\common\service\TopClient;
use app\controller\api\Ceshi;
use taobao\request\TbkItemInfoGetRequest;
use app\common\repositories\store\product\ProductRepository;
use crmeb\services\UploadService;
use think\facade\App;
/**
* Class Auth
@ -69,33 +69,36 @@ class Auth extends BaseController
{
public function caiji()
{
$url=$this->request->host();
$parmas = $this->request->param();
$query = parse_url($parmas['url']);
$itemId = $this->convertUrlQuery($query['query']);
$query=parse_url($parmas['url']);
$itemId=$this->convertUrlQuery($query['query']);
$c = new TopClient;
$c->appkey = '34537213';
$c->secretKey = '4a35f3657156580c1f533750295c54c4';
$req = new TbkItemInfoGetRequest;
$req->setNumIids($itemId['itemId']);
$resp = $c->execute($req);
$res = $resp->results->n_tbk_item;
$arr = json_decode(json_encode($res), true);
$images = [];
$upload = UploadService::create();
$dir = 'def/' . date('Y-m-d');
$oss = $upload->to($dir)->stream(file_get_contents($arr['pict_url']));
$pict_url = $oss->filePath;
foreach ($arr['small_images']['string'] as $k => $v) {
$oss = $upload->to($dir)->stream(file_get_contents($v));
$images[] = $oss->filePath;
$res=$resp->results->n_tbk_item;
$images=[];
$filename = basename($res->pict_url); // 获取文件名
$destination = public_path('uploads').'img/' . $filename; // 目标路径
$pict_url= $url.'/uploads/img/'.$filename;
file_put_contents($destination, file_get_contents($res->pict_url));
if($resp && isset($resp->small_images) && isset($resp->small_images->string)){
foreach($resp->small_images->string as $k=>$v){
$filename = basename($v); // 获取文件名
$destination = public_path('uploads').'img/' . $filename; // 目标路径
file_put_contents($destination, file_get_contents($v));
$images[]=$url.'/uploads/img/'.$filename;
}
}
$data = [
$data=[
"image" => $pict_url,
"slider_image" => $images,
"store_name" => $arr['title'],
"store_info" => $arr['cat_leaf_name'],
"slider_image" =>$images,
"store_name" => json_decode(json_encode($res->title),true)[0],
"store_info" => json_decode(json_encode($res->cat_leaf_name),true)[0],
"keyword" => "",
"bar_code" => "",
"guarantee_template_id" => "",
@ -115,8 +118,8 @@ class Auth extends BaseController
"attr" => [],
"mer_labels" => [],
"delivery_way" => [
0 => "1",
1 => "2"
0 => "1",
1 => "2"
],
"delivery_free" => 0,
"param_temp_id" => [],
@ -128,17 +131,17 @@ class Auth extends BaseController
"once_min_count" => 0,
"pay_limit" => 0,
"attrValue" => [
0 => [
"image" => $pict_url,
"price" => bcsub($arr['reserve_price'], ($arr['reserve_price'] * 0.05), 2),
"cost" => 0,
"ot_price" => 0,
"svip_price" => null,
"stock" => 100,
"bar_code" => "",
"weight" => 0,
"volume" => 0,
],
0 => [
"image" => $pict_url,
"price" => bcsub($res->reserve_price,($res->reserve_price*0.05),2),
"cost" => 0,
"ot_price" => 0,
"svip_price" => null,
"stock" => 100,
"bar_code" => "",
"weight" => 0,
"volume" => 0,
],
],
"give_coupon_ids" => [],
"type" => 0,
@ -149,22 +152,22 @@ class Auth extends BaseController
"status" => 0,
"mer_status" => 1,
"rate" => 3,
];
$a = app()->make(ProductRepository::class)->create($data, 0, 1);
];
$a= app()->make( ProductRepository::class)->create($data,0,1);
// 下载图片并保存到目标路径
return app('json')->success($a);
}
function convertUrlQuery($query)
{
$queryParts = explode('&', $query);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return $params;
$queryParts = explode('&', $query);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return $params;
}
public function dotest()
{
@ -382,13 +385,14 @@ class Auth extends BaseController
public function doMargin()
{
return app('json')->fail('线上缴纳调整中,请在线下缴纳');
$user = $this->request->userInfo();
$merchant = Db::name('merchant')->where('uid', $user['uid'])->where('status', 1)->find();
if (!$merchant) {
return app('json')->fail('没有店铺');
}
if ($merchant['is_margin'] == 10) {
return app('json')->fail('保证金已缴纳');
return app('json')->fail('金已缴纳');
}
if ($merchant['margin'] == 0) {
$margin = Db::name('MerchantType')->where('mer_type_id', $merchant['type_id'])->value('margin');

View 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]);
}
}

View File

@ -800,13 +800,17 @@ class Community extends BaseController
if (!$communityInfo) {
return app('json')->fail('委托商品不存在');
}
$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();
// $uid = $this->request->uid();
$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();
if (empty($communityInfo['mer_info']) || empty($communityInfo['entrust_mer_info'])) {
return app('json')->fail('无权限查看委托商品');
}
$entrustDay = Db::name('entrust')->where('community_id', $id)->where('is_del', 0)->value('entrust_day');
$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();
if ($communityInfo['product_list']) $communityInfo['product_list'] = $communityInfo['product_list']->toArray();

View File

@ -215,7 +215,7 @@ class Merchant extends BaseController
$data = $this->request->params(['mer_state']);
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'))
return app('json')->fail('开启店铺前请先完成微信子商户入驻');

View File

@ -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);
}
}

View File

@ -23,6 +23,7 @@ use think\App;
use crmeb\basic\BaseController;
use app\common\repositories\store\product\ProductRepository as repository;
use think\facade\Cache;
use think\facade\Db;
class StoreProduct extends BaseController
{
@ -196,4 +197,41 @@ class StoreProduct extends BaseController
}
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('编辑成功');
}
}

View 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'));
}
}

View File

@ -277,13 +277,22 @@ class Product extends BaseController
"is_good",
"attr",
"attrValue",
'spec_type'
'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;
$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('编辑成功');
}

View File

@ -122,7 +122,7 @@ class Merchant extends BaseController
$data = $this->request->params(['mer_state']);
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'))
return app('json')->fail('开启店铺前请先完成微信子商户入驻');

View File

@ -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 ($financialRecord['financial_type'] == 'commission_to_entry_merchant') {
//入口店铺的佣金,如果有保证金,不退佣金
//入口店铺的佣金,如果有金,不退佣金
$isMargin = $this->isMargin($financialRecords, $financialRecord['mer_id']);
if (!$isMargin) {
$this->subMoney($financialRecord);
@ -49,7 +49,7 @@ class AfterRefund
}
if ($financialRecord['financial_type'] == 'auto_margin') {
Log::info("refundMargin, mer_id: {$financialRecord['mer_id']}, money: {$financialRecord['number']}");
//保证金类型的扣除保证
//押金类型的扣除押
ServeOrder::getInstance()->where('store_order_id', $financialRecord['order_id'])->update(['is_del' => 1]);
$merchant = app()->make(MerchantDao::class)->get($financialRecord['mer_id']);
$merchant->paid_margin = max(bcsub($merchant['paid_margin'], $financialRecord['number'], 2), 0);
@ -65,7 +65,7 @@ class AfterRefund
}
/**
* 是否有保证
* 是否有
* @param $financialRecords
* @param $merId
* @return bool

View File

@ -14,7 +14,7 @@ class paySuccessMargin
public $event;
public function handle($event)
{
Log::info('微信支付保证金成功回调' . json_encode($event));
Log::info('微信支付金成功回调' . json_encode($event));
Db::startTrans();
try {
$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();
$merchant_type = Db::name('merchant_type')->where('mer_type_id', $merchantInfo['type_id'])->find();
//已支付的保证
//已支付的
$paidMarginAmount = bcadd($merchantInfo['paid_margin'], $marginInfo['total_price'], 2);
Db::name('merchant')->where('mer_id', $marginInfo['mer_id'])->where('uid', $marginInfo['uid'])->update([
'paid_margin' => $paidMarginAmount,'ot_margin'=>$paidMarginAmount
@ -45,7 +45,7 @@ class paySuccessMargin
// 提交事务
Db::commit();
} catch (\Exception $e) {
Log::error('微信支付保证金失败' . $e->getMessage());
Log::error('微信支付金失败' . $e->getMessage());
// 回滚事务
Db::rollback();
}

View File

@ -22,9 +22,9 @@ class MerchantTypeValidate extends Validate
protected $rule = [
'type_name|店铺类型名称' => 'require|max:5',
'type_info|店铺类型要求' => 'max:256',
'is_margin|是否有保证金' => 'require|in:0,1',
'is_margin|是否有金' => 'require|in:0,1',
'auth|权限' => 'require|array|min:1',
'margin|保证金(¥)' => 'requireIf:is_margin,1',
'margin|金(¥)' => 'requireIf:is_margin,1',
'description|其他说明' => 'max:256',
];
}

View File

@ -51,8 +51,8 @@ class MerchantValidate extends Validate
'is_bro_room|直播间状态' => 'require|in:0,1',
'is_trader|自营状态' => 'require|in:0,1',
'commission_rate|提成比例' => '>=:0',
'auto_margin_rate|自动扣除保证金比例' => '>=:0',
'paid_margin|已支付的保证金' => '>=:0',
'auto_margin_rate|自动扣除金比例' => '>=:0',
'paid_margin|已支付的金' => '>=:0',
];
/**

View File

@ -62,9 +62,9 @@ return [
'APPLYMENTS_FAIL' => 550523,
//商户申请分账待验证
'APPLYMENTS_SIGN' => 550525,
//商户申请退回保证金通过
//商户申请退回金通过
'REFUND_MARGIN_SUCCESS' => 710327,
//商户申请退回保证金未通过
//商户申请退回金未通过
'REFUND_MARGIN_FAIL' => 710328,
],
//微信

View File

@ -72,9 +72,9 @@ return [
'APPLYMENTS_SIGN' => 550525,
//商户申请分账未通过 2.1
'APPLYMENTS_FAIL' => 550523,
//商户申请退回保证金通过 2.1
//商户申请退回金通过 2.1
'REFUND_MARGIN_SUCCESS' => 710327,
//商户申请退回保证金未通过 2.1
//商户申请退回金未通过 2.1
'REFUND_MARGIN_FAIL' => 710328,
//付费会员充值成功提醒 2.1
'SVIP_PAY_SUCCESS' => 856046
@ -130,9 +130,9 @@ return [
'APPLYMENTS_FAIL' => '',
//商户申请分账待验证
'APPLYMENTS_SIGN' => '',
//商户申请退回保证金通过
//商户申请退回金通过
'REFUND_MARGIN_SUCCESS' => '',
//商户申请退回保证金未通过
//商户申请退回金未通过
'REFUND_MARGIN_FAIL' => '',
],
]

View File

@ -354,7 +354,7 @@ class ExcelService
'order_presell' => '预售订单(定金)',
'refund_platform_coupon' => '退回优惠券补贴',
'order_platform_coupon' => '优惠券补贴',
'auto_margin' => '保证金',
'auto_margin' => '金',
'commission_to_service_team' => '订单平台佣金',
'commission_to_platform' => '订单剩余平台手续费',
'commission_to_village' => '订单平台佣金',
@ -363,7 +363,7 @@ class ExcelService
'commission_to_platform_refund' => '退回剩余平台手续费',
'commission_to_village_refund' => '退回平台佣金',
'commission_to_town_refund' => '退回平台佣金',
'auto_margin_refund' => '退回保证金',
'auto_margin_refund' => '退回金',
'commission_to_entry_merchant' => '订单平台佣金',
'commission_to_cloud_warehouse' => '订单平台佣金',
'commission_to_entry_merchant_refund' => '退回平台佣金',

View File

@ -261,10 +261,10 @@ class SmsService
'site' => systemConfig('site_name'),
]);
break;
//保证金退回申请通过通知 2.1
//金退回申请通过通知 2.1
case 'REFUND_MARGIN_SUCCESS':
//nobreak;
//保证金退回申请未通过通知 2.1
//金退回申请未通过通知 2.1
case 'REFUND_MARGIN_FAIL':
self::create()->send($id['phone'], $tempId, ['name' => $id['name'], 'time' => $id['time'],]);
break;

View File

@ -193,7 +193,7 @@ Route::group(function () {
'_auth' => true,
]);
//保证
//
Route::group('margin', function () {
//缴纳记录
Route::get('lst', 'merchant.MerchantMargin/lst')->name('systemMerchantMarginLst')->option([
@ -204,14 +204,14 @@ Route::group(function () {
'_alias' => '扣费记录',
]);
//扣除保证
//扣除
Route::get('set/:id/form', 'merchant.MerchantMargin/setMarginForm')->name('systemMarginSetForm')->option([
'_alias' => '扣除保证金表单',
'_alias' => '扣除金表单',
'_auth' => false,
'_form' => 'systemMarginSet',
]);
Route::post('set', 'merchant.MerchantMargin/setMargin')->name('systemMarginSet')->option([
'_alias' => '扣除保证金',
'_alias' => '扣除金',
]);
//退款申请

View File

@ -39,6 +39,10 @@ Route::group('api/', function () {
Route::post('articleCatch', 'api.Upload/article');
//强制登录
Route::group(function () {
Route::post('user_free_trial/:id', 'api.store.product.StoreProduct/UserFreeTrial')->option([
'_alias' => '免审编辑',
]);
Route::post('sync/token', 'api.Auth/syncToken');
Route::group('micro', function () {
@ -69,10 +73,14 @@ Route::group('api/', function () {
//绑定推荐人
Route::post('user/spread', 'api.Auth/spread');
//用户缴纳保证
//用户缴纳
Route::post('user/margin', 'api.Auth/doMargin');
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::post('receive/:id', 'api.store.product.StoreCoupon/receiveCoupon');
@ -310,10 +318,7 @@ Route::group('api/', function () {
Route::post('attr/delete', 'StoreProductAttrTemplate/batchDelete');
Route::get('attr/detail/:id', 'StoreProductAttrTemplate/detail');
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);
//管理员订单
Route::group('admin/:merId', function () {
@ -334,8 +339,7 @@ Route::group('api/', function () {
Route::get('/purchaseOrder', '/purchaseOrder');
Route::post('/settle', '/settle');
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);
//管理员申请转账
Route::get('admin/:merId/apply', 'api.store.merchant.Merchant/apply');
@ -354,12 +358,12 @@ Route::group('api/', function () {
Route::get('express/:id', '/express');
Route::post('status/:id', '/switchStatus');
Route::post('mark/:id', '/mark');
})->prefix('api.server.StoreRefundOrder')->middleware(\app\common\middleware\MerchantServerMiddleware::class,0);
})->prefix('api.server.StoreRefundOrder')->middleware(\app\common\middleware\MerchantServerMiddleware::class, 0);
//核销
Route::group('verifier/:merId', function () {
Route::get('order/:id', '/detail');
Route::post(':id', '/verify');
})->prefix('api.store.order.StoreOrderVerify')->middleware(\app\common\middleware\MerchantServerMiddleware::class,0);
})->prefix('api.store.order.StoreOrderVerify')->middleware(\app\common\middleware\MerchantServerMiddleware::class, 0);
//社区
Route::group('community', function () {
@ -398,14 +402,13 @@ Route::group('api/', function () {
Route::post('/entrust/check/:id', 'Community/checkEntrust');
Route::post('/entrust/addEntrustCart', 'Community/addEntrustCart');
Route::post('/entrust/apply/finish/:id', 'Community/applyFinishEntrust');
Route::post('/entrust/finish/:id', 'Community/finishEntrust');
Route::post('/entrust/finish/:id', 'Community/finishEntrust');
})->prefix('api.community.');
Route::group('svip', function () {
//价格列表
Route::post('pay/:id', '/createOrder')->middleware(\app\common\middleware\BlockerMiddleware::class);
})->prefix('api.user.Svip');
})->middleware(UserTokenMiddleware::class, true);
//非强制登录
@ -448,7 +451,7 @@ Route::group('api/', function () {
Route::get('service/info/:id', 'api.store.service.Service/merchantInfo');
//公共配置
Route::get('config', 'api.Common/config');
Route::get('has_service/:id','api.store.service.Service/hasService');
Route::get('has_service/:id', 'api.store.service.Service/hasService');
//专题
Route::group('activity', function () {
Route::get('lst/:id', 'api.Common/activityLst');
@ -583,7 +586,6 @@ Route::group('api/', function () {
Route::any('store/test', 'api.Test/test');
Route::get('subscribe', 'api.Common/subscribe');
Route::resource('store/product/cloudWarehouse', 'api.store.product.CloudWarehouse');
})->middleware(UserTokenMiddleware::class, false);
//微信支付回调
@ -683,10 +685,18 @@ Route::group('api/', function () {
Route::get('micro', 'api.Common/micro');
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::post('ajcheck', 'api.Auth/ajcheck');
})->middleware(AllowOriginMiddleware::class)
->middleware(InstallMiddleware::class)
->middleware(CheckSiteOpenMiddleware::class)
@ -703,5 +713,6 @@ Route::group('/pages', function () {
Route::group('/open-location', function () {
Route::miss('View/h5');
})->middleware(InstallMiddleware::class)
->middleware(CheckSiteOpenMiddleware::class)
;
->middleware(CheckSiteOpenMiddleware::class);

View File

@ -19,7 +19,7 @@ Route::group(function () {
Route::group('financial', function () {
Route::post('refund/margin', 'Financial/refundMargin')->name('merchantFinancialRefundMargin')->option([
'_alias' => '退保证金申请',
'_alias' => '退金申请',
]);
})->prefix('merchant.system.financial.')->option([
'_path' => 'merchant/margin',