commit
28ddba5f75
@ -1178,5 +1178,20 @@ if (!function_exists('Financial_Operations')) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('reset_index')) {
|
||||
/**
|
||||
* 重置数组索引
|
||||
* @param array $data
|
||||
* @param string $index
|
||||
* @return array
|
||||
*/
|
||||
function reset_index(array $data, string $index)
|
||||
{
|
||||
$return = [];
|
||||
foreach ($data as $item) {
|
||||
$return[$item[$index]] = $item;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
|
||||
|
85
app/common/dao/store/StoreActivityOrderDao.php
Normal file
85
app/common/dao/store/StoreActivityOrderDao.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\dao\store;
|
||||
|
||||
use app\common\dao\BaseDao;
|
||||
use app\common\model\store\consumption\StoreConsumptionDetail;
|
||||
use app\common\model\store\consumption\StoreConsumptionUser;
|
||||
use app\common\model\store\StoreActivityOrder;
|
||||
|
||||
class StoreActivityOrderDao extends BaseDao
|
||||
{
|
||||
|
||||
protected function getModel(): string
|
||||
{
|
||||
return StoreActivityOrder::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存活动订单数据
|
||||
* @param $groupOrder 订单
|
||||
* @param int $spreadId 推荐人id
|
||||
* @param int $isFirstOrder 是否首单
|
||||
* @param int $activityId 活动id
|
||||
* @return StoreActivityOrder
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function save($groupOrder, int $spreadId, int $isFirstOrder, int $activityId = 1)
|
||||
{
|
||||
$model = new StoreActivityOrder();
|
||||
$model->activity_id = $activityId;
|
||||
$model->user_id = $groupOrder['uid'];
|
||||
$model->group_order_id = $groupOrder['group_order_id'];
|
||||
$model->spread_id = $spreadId;
|
||||
$model->pay_price = $groupOrder['pay_price'];
|
||||
$model->is_first_order = $isFirstOrder;
|
||||
$model->status = StoreActivityOrder::STATUS_VALID;
|
||||
$consumptionDetail = StoreConsumptionDetail::where('group_order_id', $groupOrder['group_order_id'])
|
||||
->field('group_order_id,sum(amount) amount,sum(pay_price) pay_price,coupon_user_id')
|
||||
->find();
|
||||
if (!empty($consumptionDetail['amount'])) {
|
||||
// 当前订单使用现金抵扣红包 或 使用通用红包后实付金额不足红包金额的1.5倍,视为无效订单
|
||||
$redPackType = StoreConsumptionUser::where('coupon_user_id', $consumptionDetail['coupon_user_id'])->value('type');
|
||||
if ($redPackType == StoreConsumptionUser::TYPE_TWO || ($redPackType == StoreConsumptionUser::TYPE_TWO && $consumptionDetail['pay_price'] < $consumptionDetail['amount'] * 1.5)) {
|
||||
$model->status = StoreActivityOrder::STATUS_INVALID;
|
||||
}
|
||||
}
|
||||
$model->red_pack = $consumptionDetail['amount'] ?? 0;
|
||||
if (!$model->save()) {
|
||||
throw new \Exception('活动订单保存失败');
|
||||
}
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动订单撤销
|
||||
* @param int $groupOrderId
|
||||
* @return void
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function repeal(int $groupOrderId)
|
||||
{
|
||||
$model = StoreActivityOrder::where('group_order_id', $groupOrderId)->find();
|
||||
$model->status = StoreActivityOrder::STATUS_INVALID;
|
||||
if (!$model->save()) {
|
||||
throw new \Exception('活动订单保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动订单批量撤销
|
||||
* @param array $groupOrderIds
|
||||
* @return void
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function batchRepeal(array $groupOrderIds)
|
||||
{
|
||||
$count = StoreActivityOrder::whereIn('group_order_id', $groupOrderIds)->update(['status' => StoreActivityOrder::STATUS_INVALID]);
|
||||
if ($count < count($groupOrderIds)) {
|
||||
throw new \Exception('活动订单批量作废失败');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
248
app/common/dao/store/StoreActivityUserDao.php
Normal file
248
app/common/dao/store/StoreActivityUserDao.php
Normal file
@ -0,0 +1,248 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\dao\store;
|
||||
|
||||
use app\common\dao\BaseDao;
|
||||
use app\common\dao\store\consumption\StoreConsumptionUserDao;
|
||||
use app\common\model\store\consumption\StoreConsumption;
|
||||
use app\common\model\store\consumption\StoreConsumptionUser;
|
||||
use app\common\model\store\StoreActivityOrder;
|
||||
use app\common\model\store\StoreActivityUser;
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\user\UserBill;
|
||||
|
||||
class StoreActivityUserDao extends BaseDao
|
||||
{
|
||||
|
||||
protected function getModel(): string
|
||||
{
|
||||
return StoreActivityUser::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择消费金类型
|
||||
* @param int $userId
|
||||
* @param int $couponId
|
||||
* @param int $activityId
|
||||
* @return void
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function choose(int $userId, int $couponId, int $activityId)
|
||||
{
|
||||
$consumption = StoreConsumption::where('coupon_id', $couponId)->find();
|
||||
if ($consumption['status'] != 1 || strtotime($consumption['start_time']) > time() || strtotime($consumption['end_time']) <= time()) {
|
||||
throw new \Exception('当前活动已结束');
|
||||
}
|
||||
$model = StoreActivityUser::where('user_id', $userId)->where('value', $couponId)->where('activity_id', $activityId)->find();
|
||||
if (empty($model)) {
|
||||
$model = new StoreActivityUser();
|
||||
$model->user_id = $userId;
|
||||
$model->value = $couponId;
|
||||
$model->activity_id = $activityId;
|
||||
$model->create_time = time();
|
||||
$model->status = 1;
|
||||
if (!$model->save()) {
|
||||
throw new \Exception('保存出错');
|
||||
}
|
||||
}
|
||||
$validModel = StoreActivityUser::where('user_id', $userId)->where('activity_id', $activityId)->where('status', 1)->find();
|
||||
if ($validModel['value'] != $couponId) {
|
||||
$consumption = StoreConsumption::where('coupon_id', $validModel['value'])->find();
|
||||
if ($consumption['type'] == StoreConsumption::TYPE_PULL_CONSUMPTION) {
|
||||
$groupOrders = StoreActivityOrder::whereRaw('user_id=:user_id or spread_id=:spread_id', ['user_id' => $userId, 'spread_id' => $userId])
|
||||
->where('activity_id', $activityId)
|
||||
->where('status', StoreActivityOrder::STATUS_VALID)
|
||||
->count();
|
||||
if ($groupOrders > 0) {
|
||||
$model->status = 0;
|
||||
if (!$model->save()) {
|
||||
throw new \Exception('保存出错');
|
||||
}
|
||||
throw new \Exception('您正在参与活动,暂时不支持切换');
|
||||
}
|
||||
}
|
||||
$validModel->status = 0;
|
||||
if (!$validModel->save()) {
|
||||
throw new \Exception('保存出错');
|
||||
}
|
||||
$model->status = 1;
|
||||
if (!$model->save()) {
|
||||
throw new \Exception('保存出错');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户选择的消费金类型
|
||||
* @param int $userId
|
||||
* @param int $activityId
|
||||
* @return int
|
||||
*/
|
||||
public function getValue(int $userId, int $activityId = 1)
|
||||
{
|
||||
$data = StoreActivityUser::where('user_id', $userId)->where('activity_id', $activityId)->where('status', 1)->find();
|
||||
return $data->value ?? 0;
|
||||
}
|
||||
|
||||
public function getOne(int $userId, int $activityId = 1)
|
||||
{
|
||||
return StoreActivityUser::where('user_id', $userId)->where('activity_id', $activityId)->where('status', 1)->find();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户参与活动的状态
|
||||
* @param int $userId 用户id
|
||||
* @param int $activityId 活动id
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function status(int $userId, int $activityId)
|
||||
{
|
||||
$target = 0;
|
||||
$userInfo = [];
|
||||
$activityUser = StoreActivityUser::where('user_id', $userId)
|
||||
->where('activity_id', $activityId)
|
||||
->where('status', 1)
|
||||
->find();
|
||||
if (empty($activityUser)) {
|
||||
return ['target' => $target, 'allow_receive' => false, 'user_info' => $userInfo];
|
||||
}
|
||||
$consumption = StoreConsumption::where('coupon_id', $activityUser['value'])
|
||||
->where('type', StoreConsumption::TYPE_PULL_CONSUMPTION)
|
||||
->find();
|
||||
$unReceiveConsumption = StoreConsumptionUser::where('uid', $userId)->where('status', StoreConsumptionUser::STATUS_UN_RECEIVE)->value('order_id_set');
|
||||
if (!empty($unReceiveConsumption)) {
|
||||
$groupOrderIds = explode(',', $unReceiveConsumption);
|
||||
$groupOrderId = $groupOrderIds[0];
|
||||
$myOrderWhere = ['group_order_id' => $groupOrderId];
|
||||
} else {
|
||||
$myOrderWhere = ['status' => StoreActivityOrder::STATUS_VALID];
|
||||
}
|
||||
$myOrder = StoreActivityOrder::where('user_id', $userId)
|
||||
->where('activity_id', $activityId)
|
||||
->where($myOrderWhere)
|
||||
->find();
|
||||
if (empty($myOrder) || empty($myOrder['pay_price'])) {
|
||||
return ['target' => $target, 'allow_receive' => false, 'user_info' => $userInfo];
|
||||
}
|
||||
$userInfo = User::where('spread_uid', $userId)->field('uid,nickname,avatar')->select()->toArray();
|
||||
$storeConsumptionUserDao = new StoreConsumptionUserDao();
|
||||
$scope = $storeConsumptionUserDao->getScope($consumption, $myOrder['pay_price']);
|
||||
$orderQuery = StoreActivityOrder::where('spread_id', $userId)
|
||||
->whereIn('user_id', array_column($userInfo, 'uid'))
|
||||
->where('activity_id', $activityId)
|
||||
->where('is_first_order', StoreActivityOrder::IS_FIRST_ORDER)
|
||||
->where('pay_price', '>=', $scope['start']);
|
||||
if (!empty($groupOrderIds)) {
|
||||
unset($groupOrderIds[0]);
|
||||
$orderQuery->whereIn('group_order_id', $groupOrderIds);
|
||||
} else {
|
||||
$orderQuery->where('status', StoreActivityOrder::STATUS_VALID);
|
||||
}
|
||||
$orders = $orderQuery->select()->toArray();
|
||||
$orders = reset_index($orders, 'user_id');
|
||||
foreach ($userInfo as &$user) {
|
||||
$user['target_amount'] = $scope['start'];
|
||||
$user['is_finish'] = isset($orders[$user['uid']]) ? 1 : 0;
|
||||
}
|
||||
return ['target' => $scope['num'], 'allow_receive' => count($orders) >= $scope['num'], 'user_info' => $userInfo];
|
||||
}
|
||||
|
||||
/**
|
||||
* 领取消费金
|
||||
* @param int $userId
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function receive(int $userId)
|
||||
{
|
||||
$consumption = StoreConsumption::where('type', StoreConsumption::TYPE_PULL_CONSUMPTION)
|
||||
->where('status', StoreConsumption::STATUS_ENABLE)
|
||||
->find();
|
||||
$userConsumption = StoreConsumptionUser::where('uid', $userId)
|
||||
->where('coupon_id', $consumption['coupon_id'])
|
||||
->where('status', StoreConsumptionUser::STATUS_UN_RECEIVE)
|
||||
->find();
|
||||
if (empty($userConsumption)) {
|
||||
throw new \Exception('您没有可领取的红包');
|
||||
}
|
||||
$userConsumption->status = StoreConsumptionUser::STATUS_UNUSED;
|
||||
$userConsumption->start_time = date('Y-m-d H:i:s', time() + 7 * 86400);
|
||||
$userConsumption->end_time = '2026-01-15 23:59:59';
|
||||
if (!$userConsumption->save()) {
|
||||
throw new \Exception('领取出错,请稍后重试');
|
||||
}
|
||||
return ['amount' => $userConsumption['coupon_price'], 'end_time' => $userConsumption['end_time']];
|
||||
}
|
||||
|
||||
/**
|
||||
* 红包获取记录
|
||||
* @param int $userId
|
||||
* @param int $type
|
||||
* @param int $page
|
||||
* @param int $limit
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function record(int $userId, int $type, int $page, int $limit)
|
||||
{
|
||||
$totalAmount = StoreConsumptionUser::where('uid', $userId)
|
||||
->whereIn('type', $type)
|
||||
->where('status', StoreConsumptionUser::STATUS_UNUSED)
|
||||
->sum('balance');
|
||||
$query = UserBill::field('link_id,create_time,number coupon_price,mark')
|
||||
->where('uid', $userId)
|
||||
->where('category', 'red_pack')
|
||||
->where('type', "red_pack_{$type}");
|
||||
$count = $query->count();
|
||||
$record = $query->page($page)->limit($limit)->select()->toArray();
|
||||
foreach ($record as &$item) {
|
||||
$item['order_amount'] = 0;
|
||||
if (mb_strpos($item['mark'], '订单金额:') !== false) {
|
||||
$item['order_amount'] = mb_substr($item['mark'], mb_strpos($item['mark'], '订单金额:') + 5);
|
||||
}
|
||||
unset($item['mark']);
|
||||
}
|
||||
return ['total_amount' => $totalAmount, 'count' => $count, 'record' => $record];
|
||||
}
|
||||
|
||||
/**
|
||||
* 红包余额统计
|
||||
* @param int $userId
|
||||
* @return array
|
||||
*/
|
||||
public function total(int $userId)
|
||||
{
|
||||
$totalAmount = StoreConsumptionUser::where('uid', $userId)
|
||||
->whereIn('type', [StoreConsumptionUser::TYPE_ONE, StoreConsumptionUser::TYPE_TWO])
|
||||
->where('status', StoreConsumptionUser::STATUS_UNUSED)
|
||||
->field('SUM(balance) as total_amount,type')
|
||||
->group('type')
|
||||
->select()->toArray();
|
||||
$totalAmount = reset_index($totalAmount, 'type');
|
||||
$result = [
|
||||
[
|
||||
'type' => 1,
|
||||
'total_amount' => 0.00
|
||||
],
|
||||
[
|
||||
'type' => 2,
|
||||
'total_amount' => 0.00
|
||||
]
|
||||
];
|
||||
foreach ($result as &$item) {
|
||||
if (isset($totalAmount[$item['type']])) {
|
||||
$item['total_amount'] = $totalAmount[$item['type']]['total_amount'];
|
||||
}
|
||||
$item['type_cn'] = StoreConsumptionUser::TYPE_MAP[$item['type']];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
159
app/common/dao/store/consumption/CommissionDao.php
Normal file
159
app/common/dao/store/consumption/CommissionDao.php
Normal file
@ -0,0 +1,159 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\dao\store\consumption;
|
||||
|
||||
use app\common\model\store\consumption\StoreConsumption;
|
||||
use app\common\model\store\consumption\StoreConsumptionUser;
|
||||
use app\common\model\store\order\StoreOrder;
|
||||
use app\common\model\system\merchant\Merchant;
|
||||
use app\common\model\user\User;
|
||||
use app\common\repositories\system\merchant\FinancialRecordRepository;
|
||||
use app\common\repositories\system\merchant\MerchantRepository;
|
||||
use crmeb\utils\Curl;
|
||||
use think\facade\Log;
|
||||
|
||||
class CommissionDao
|
||||
{
|
||||
|
||||
/**
|
||||
* 活动首单商户佣金 (支付成功后调用)
|
||||
* @param $order
|
||||
* @param $finance
|
||||
* @param $financeSn
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function firstOrderCommission($order, $finance, $financeSn)
|
||||
{
|
||||
$consumption = StoreConsumption::where('status', 1)->where('type', StoreConsumption::TYPE_FIRST_ORDER_COMMISSION)->find();
|
||||
if (empty($consumption)) {
|
||||
return $finance;
|
||||
}
|
||||
$storeConsumptionDao = new StoreConsumptionUserDao();
|
||||
$isFirstOrder = $storeConsumptionDao->isFirstOrder($order['uid'], $consumption['start_time'], $consumption['end_time']);
|
||||
if (!$isFirstOrder) {
|
||||
return $finance;
|
||||
}
|
||||
$commission = bcmul($order['pay_price'], $consumption['config']['commission_rate'], 2);
|
||||
if ($commission > 0) {
|
||||
$finance[] = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'user_info' => $order->user->nickname,
|
||||
'user_id' => $order['uid'],
|
||||
'financial_type' => 'first_order_commission',
|
||||
'financial_pm' => 0,
|
||||
'type' => 2,
|
||||
'number' => $commission,
|
||||
'mer_id' => $order->mer_id,
|
||||
'financial_record_sn' => $financeSn
|
||||
];
|
||||
app()->make(MerchantRepository::class)->addLockMoney($order['mer_id'], 'order', $order['order_id'], $commission);
|
||||
}
|
||||
$redPack = bcmul($order['pay_price'], $consumption['config']['red_pack_rate'], 2);
|
||||
if ($redPack > 0) {
|
||||
$userId = Merchant::where('mer_id', $order['mer_id'])->value('uid');
|
||||
$storeConsumptionDao->send($consumption, $consumption['config']['red_pack_rate'], $userId, $order['order_id'], $order['pay_price'], StoreConsumptionUser::STATUS_UNUSED, StoreConsumptionUser::TYPE_TWO);
|
||||
}
|
||||
$promotionCode = User::where('uid', $order['uid'])->value('promotion_code');
|
||||
if (!empty($promotionCode)) {
|
||||
$this->sendCommission($order, $promotionCode);
|
||||
}
|
||||
return $finance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动首单推广人佣金(供应商平台异步回调)
|
||||
* @param $data
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function firstOrderBatchCommission($data)
|
||||
{
|
||||
$consumption = StoreConsumption::where('status', 1)->where('type', StoreConsumption::TYPE_FIRST_ORDER_COMMISSION)->find();
|
||||
if (empty($consumption)) {
|
||||
return [];
|
||||
}
|
||||
$financialRecordRepository = app()->make(FinancialRecordRepository::class);
|
||||
$financeSn = $financialRecordRepository->getSn();
|
||||
$users = $data['user'];
|
||||
$order = StoreOrder::where('order_id', $data['order_id'])->find();
|
||||
if (empty($order)) {
|
||||
return [];
|
||||
}
|
||||
$finance = [];
|
||||
$result = [];
|
||||
foreach ($users as $k => $user) {
|
||||
$commission = bcdiv($user['user_profit'], 100, 2);
|
||||
if ($commission > 0) {
|
||||
$finance[] = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'user_info' => $order->user->nickname,
|
||||
'user_id' => $order['uid'],
|
||||
'financial_type' => $user['type'] == 3 ? 'order_commission' : 'first_order_commission',
|
||||
'financial_pm' => 0,
|
||||
'type' => 2,
|
||||
'number' => $commission,
|
||||
'mer_id' => $order['mer_id'],
|
||||
'financial_record_sn' => $financeSn . ($k + 1)
|
||||
];
|
||||
$result[] = $user;
|
||||
}
|
||||
//用户是镇合伙人,不发放红包
|
||||
if ($user['type'] == 3) {
|
||||
continue;
|
||||
}
|
||||
$redPack = bcmul($order['pay_price'], $consumption['config']['red_pack_rate'], 2);
|
||||
$user = User::where('phone', $user['account'])->find();
|
||||
if ($redPack > 0 && !empty($user)) {
|
||||
try {
|
||||
(new StoreConsumptionUserDao())->send($consumption, $consumption['config']['red_pack_rate'], $user['uid'], $order['order_id'], $order['pay_price'], StoreConsumptionUser::STATUS_UNUSED, StoreConsumptionUser::TYPE_TWO);
|
||||
$user->red_pack_balance = bcadd($user->red_pack_balance, $redPack, 2);
|
||||
if (!$user->save()) {
|
||||
throw new \Exception('红包余额更新出错');
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count($finance) > 0) {
|
||||
$financialRecordRepository->insertAll($finance);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 给镇合伙人或推广人发放佣金(支付完成后调用,推广人仅首单奖励)
|
||||
* 请求发送给供应商平台后异步回调
|
||||
* @param $order
|
||||
* @param $promotionCode
|
||||
* @param int $type 类型:1=>小组,2=>村合伙人,3=>镇合伙人,4=>配送员
|
||||
* @return void
|
||||
*/
|
||||
public function sendCommission($order, $promotionCode, $type = 1)
|
||||
{
|
||||
$curl = new Curl();
|
||||
$timestamp = time();
|
||||
$json = ['timestamp' => $timestamp, 'data' => ['order_id' => $order['order_id'], 'order_sn' => $order['order_no'], 'order_money' => bcmul($order['pay_price'], 100), 'promotion_code' => $promotionCode]];
|
||||
if ($type == 3) {
|
||||
$json['street_code'] = $promotionCode;
|
||||
} elseif ($type == 4) {
|
||||
$json['courier_phone'] = $promotionCode;
|
||||
} else {
|
||||
$json['promotion_code'] = $promotionCode;
|
||||
}
|
||||
$aes = new \AES();
|
||||
$iv = $aes->buildIv($timestamp);
|
||||
$encrypt = $aes->encrypt($json, $iv);
|
||||
$api = in_array($type, [1, 2]) ? 'user_first_order_share_profit' : 'user_order_share_profit';
|
||||
$url = env('task.worker_host_url') . '/api/shop_call/' . $api;
|
||||
$curl->post($url, ['timestamp' => $timestamp, 'data' => $encrypt]);
|
||||
}
|
||||
|
||||
}
|
47
app/common/dao/store/consumption/StoreConsumptionDao.php
Normal file
47
app/common/dao/store/consumption/StoreConsumptionDao.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\dao\store\consumption;
|
||||
|
||||
use app\common\dao\BaseDao;
|
||||
use \app\common\model\store\consumption\StoreConsumption;
|
||||
|
||||
class StoreConsumptionDao extends BaseDao
|
||||
{
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getModel(): string
|
||||
{
|
||||
return StoreConsumption::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取有效的消费金列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getValidList()
|
||||
{
|
||||
return StoreConsumption::whereIn('type', [StoreConsumption::TYPE_OWNER_CONSUMPTION, StoreConsumption::TYPE_PULL_CONSUMPTION])->where('status', StoreConsumption::STATUS_ENABLE)
|
||||
->field('coupon_id,start_time,end_time,title')->select()->each(function ($item){
|
||||
if($item['title']=='无门槛实物通用红包'){
|
||||
$item['title'] = '用户推荐拉新活动';
|
||||
}else{
|
||||
$item['title'] = '用户消费补贴活动';
|
||||
}
|
||||
return $item;
|
||||
});
|
||||
}
|
||||
|
||||
public function getOne($id)
|
||||
{
|
||||
return StoreConsumption::where('coupon_id', $id)
|
||||
->where('status', StoreConsumption::STATUS_ENABLE)
|
||||
->whereTime('start_time', '<=', time())
|
||||
->find();
|
||||
}
|
||||
|
||||
}
|
282
app/common/dao/store/consumption/StoreConsumptionUserDao.php
Normal file
282
app/common/dao/store/consumption/StoreConsumptionUserDao.php
Normal file
@ -0,0 +1,282 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\dao\store\consumption;
|
||||
|
||||
use app\common\dao\BaseDao;
|
||||
use app\common\dao\store\StoreActivityOrderDao;
|
||||
use app\common\dao\store\StoreActivityUserDao;
|
||||
use app\common\model\store\consumption\StoreConsumption;
|
||||
use app\common\model\store\consumption\StoreConsumptionUser;
|
||||
use app\common\model\store\order\StoreGroupOrder;
|
||||
use app\common\model\store\StoreActivityOrder;
|
||||
use app\common\model\user\User;
|
||||
use app\common\repositories\user\UserBillRepository;
|
||||
use think\facade\Db;
|
||||
|
||||
class StoreConsumptionUserDao extends BaseDao
|
||||
{
|
||||
|
||||
public $maxAmount = 20000;
|
||||
|
||||
protected function getModel(): string
|
||||
{
|
||||
return StoreConsumptionUser::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验用户是否满足红包拉新活动条件
|
||||
* @param int $userId 用户id
|
||||
* @param int $groupOrderId 订单id
|
||||
* @return false|void
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function check(int $userId, int $groupOrderId)
|
||||
{
|
||||
$spreadUserId = User::where('uid', $userId)->value('spread_uid');
|
||||
$groupOrder = StoreGroupOrder::where('group_order_id', $groupOrderId)->find();
|
||||
if (empty($spreadUserId)) {
|
||||
$this->promoter($userId, $groupOrder, $spreadUserId);
|
||||
} else {
|
||||
$this->guest($userId, $groupOrder, $spreadUserId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起人活动校验
|
||||
* @param int $userId
|
||||
* @param $groupOrder
|
||||
* @param int $spreadUserId
|
||||
* @return bool
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function promoter(int $userId, $groupOrder, int $spreadUserId)
|
||||
{
|
||||
$activityUser = (new StoreActivityUserDao())->getOne($userId);
|
||||
$consumption = (new StoreConsumptionDao())->getOne($activityUser['value'] ?? 0);
|
||||
//用户没有参加 消费金活动 或 已超过任务完成时间
|
||||
$endTime = $this->getEndTime($activityUser['create_time'] ?? '2024-01-01 00:00:00');
|
||||
if (empty($consumption['config']) || $endTime < time()) {
|
||||
return false;
|
||||
}
|
||||
$orderValidAmount = min($groupOrder['pay_price'], $this->maxAmount);
|
||||
$scope = $this->getScope($consumption, $orderValidAmount);
|
||||
//用户没有达到 消费金活动 任一档次
|
||||
if (empty($scope) || $scope['rate'] <= 0) {
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$isFirstOrder = $this->isFirstOrder($userId, $consumption['start_time'], date('Y-m-d H:i:s', $endTime));
|
||||
$storeActivityOrderDao = new StoreActivityOrderDao();
|
||||
$storeActivityOrder = $storeActivityOrderDao->save($groupOrder, $spreadUserId, $isFirstOrder);
|
||||
if ($consumption['type'] == StoreConsumption::TYPE_OWNER_CONSUMPTION && $storeActivityOrder['status'] == StoreActivityOrder::STATUS_VALID && $storeActivityOrder['red_pack'] == 0) {
|
||||
$this->send($consumption, $scope['rate'], $userId, $groupOrder['group_order_id'], $orderValidAmount, StoreConsumptionUser::STATUS_UNUSED);
|
||||
$this->send($consumption, $scope['rate_two'], $userId, $groupOrder['group_order_id'], $orderValidAmount, StoreConsumptionUser::STATUS_UNUSED, StoreConsumptionUser::TYPE_TWO);
|
||||
$storeActivityOrderDao->repeal($groupOrder['group_order_id']);
|
||||
}
|
||||
Db::commit();
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 受邀人活动校验
|
||||
* @param int $userId
|
||||
* @param $groupOrder
|
||||
* @param int $spreadUserId
|
||||
* @return bool|void
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function guest(int $userId, $groupOrder, int $spreadUserId)
|
||||
{
|
||||
// 查询推荐人的消费金类型
|
||||
$spreadActivityUser = (new StoreActivityUserDao())->getOne($spreadUserId);
|
||||
$endTime = $this->getEndTime($spreadActivityUser['create_time'] ?? '2024-01-01 00:00:00');
|
||||
$spreadConsumption = (new StoreConsumptionDao())->getOne($spreadActivityUser['value'] ?? 0);
|
||||
// 查询推荐人满足条件的有效订单
|
||||
$spreadGroupOrder = StoreActivityOrder::where('user_id', $spreadUserId)->where('status', StoreActivityOrder::STATUS_VALID)->find();
|
||||
if (empty($spreadGroupOrder) || empty($spreadConsumption['config']) || empty($spreadActivityUser) || $endTime < time()) {
|
||||
// 推荐人消费金数据为空 或 推荐人的有效订单为空 或推荐人已超过任务完成时间,作为发起人参加活动
|
||||
return $this->promoter($userId, $groupOrder, 0);
|
||||
}
|
||||
// 订单有效金额为实付金额+红包金额
|
||||
$orderValidAmount = bcadd($spreadGroupOrder['pay_price'], $spreadGroupOrder['red_pack'], 2);
|
||||
$orderValidAmount = min($orderValidAmount, $this->maxAmount);
|
||||
$spreadScope = $this->getScope($spreadConsumption, $orderValidAmount);
|
||||
if ($groupOrder['pay_price'] < $spreadScope['start']) {
|
||||
// 当前用户的订单不在推荐人的档位区间,作为发起人参加活动
|
||||
return $this->promoter($userId, $groupOrder, 0);
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$isFirstOrder = $this->isFirstOrder($userId, $spreadConsumption['start_time'], date('Y-m-d H:i:s', $endTime));
|
||||
$storeActivityOrderDao = new StoreActivityOrderDao();
|
||||
$storeActivityOrder = $storeActivityOrderDao->save($groupOrder, $spreadUserId, $isFirstOrder);
|
||||
if ($spreadConsumption['type'] == StoreConsumption::TYPE_PULL_CONSUMPTION && $isFirstOrder && $storeActivityOrder['status'] == StoreActivityOrder::STATUS_VALID) {
|
||||
// 推荐人消费金类型为拉新且当前用户为首单
|
||||
$spreadOrderIds = $this->isFinished($spreadUserId, $spreadScope);
|
||||
if ($spreadOrderIds !== false) {
|
||||
$spreadOrderIds = "{$spreadGroupOrder['group_order_id']}," . $spreadOrderIds;
|
||||
$orderValidAmount = $spreadGroupOrder['red_pack'] > 0 ? bcmul($orderValidAmount, 0.8, 2) : $orderValidAmount;
|
||||
$this->send($spreadConsumption, $spreadScope['rate'], $spreadUserId, $spreadOrderIds, $orderValidAmount);
|
||||
$storeActivityOrderDao->batchRepeal(explode(',', $spreadOrderIds));
|
||||
}
|
||||
}
|
||||
Db::commit();
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取消费档位区间
|
||||
* @param $consumption
|
||||
* @param float $amount
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function getScope($consumption, float $amount)
|
||||
{
|
||||
$scope = [];
|
||||
foreach ($consumption['config'] as $k => $item) {
|
||||
if ($item['start'] <= $amount && $item['end'] >= $amount) {
|
||||
$item['rate'] = bcdiv($item['rate'], 100, 2);
|
||||
$item['rate_two'] = (isset($item['rate_two']) && $item['rate_two'] > 0) ? bcdiv($item['rate_two'], 100, 2) : 0;
|
||||
$scope = $item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $scope;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断用户是否满足条件
|
||||
* @param int $userId
|
||||
* @param array $scope
|
||||
* @return false|string
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function isFinished(int $userId, array $scope)
|
||||
{
|
||||
$groupOrders = StoreActivityOrder::where('spread_id', $userId)
|
||||
->where('is_first_order', StoreActivityOrder::IS_FIRST_ORDER)
|
||||
->where('pay_price', '>=', $scope['start'])
|
||||
->where('status', StoreActivityOrder::STATUS_VALID)
|
||||
->field('group_order_id,user_id,pay_price')->select();
|
||||
$userOrders = [];
|
||||
foreach ($groupOrders as $groupOrder) {
|
||||
if (!isset($userOrders[$groupOrder['user_id']])) {
|
||||
$userOrders[$groupOrder['user_id']] = $groupOrder;
|
||||
}
|
||||
}
|
||||
if (count($userOrders) < $scope['num']) {
|
||||
return false;
|
||||
}
|
||||
return implode(',', array_column($userOrders, 'group_order_id'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 发放消费金
|
||||
* @param $consumption 消费金类型
|
||||
* @param float $rate 红包发放比例
|
||||
* @param int $userId 用户id
|
||||
* @param string $groupOrderIds 订单id集合
|
||||
* @param float $amount 订单金额
|
||||
* @param float $status 红包领取状态
|
||||
* @param int $type 红包类型
|
||||
* @return void
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function send($consumption, float $rate, int $userId, string $groupOrderIds, float $amount, $status = -2, $type = 1)
|
||||
{
|
||||
$title = $type == StoreConsumptionUser::TYPE_TWO ? '现金抵扣红包' : '无门槛实物通用红包';
|
||||
$model = StoreConsumptionUser::where('uid', $userId)->where('type', StoreConsumptionUser::TYPE_TWO)->find();
|
||||
$couponPrice = bcmul($amount, $rate, 2);
|
||||
if (!empty($model) && $model['type'] == $type) {
|
||||
$model->coupon_price = bcadd($model->coupon_price, $couponPrice, 2);
|
||||
$model->balance = bcadd($model->balance, $couponPrice, 2);
|
||||
} else {
|
||||
$model = new StoreConsumptionUser();
|
||||
$model->coupon_id = $consumption['coupon_id'];
|
||||
$model->uid = $userId;
|
||||
$model->coupon_title = $title;
|
||||
$model->order_id_set = $groupOrderIds;
|
||||
$model->coupon_price = $couponPrice;
|
||||
$model->balance = $model->coupon_price;
|
||||
$model->order_amount = $amount;
|
||||
$model->create_time = date('Y-m-d H:i:s');
|
||||
$model->start_time = date('Y-m-d H:i:s', time() + 7 * 86400);
|
||||
$model->end_time = '2026-01-15 23:59:59';
|
||||
$model->type = $type;
|
||||
$model->status = $status;
|
||||
}
|
||||
if (!$model->save()) {
|
||||
throw new \Exception('发放失败');
|
||||
}
|
||||
// 写入红包日志
|
||||
/** @var $userBillRepository UserBillRepository */
|
||||
$userBillRepository = app()->make(UserBillRepository::class);
|
||||
$userBillRepository->incBill($userId, 'red_pack', "red_pack_{$type}", [
|
||||
'link_id' => $model['coupon_user_id'],
|
||||
'status' => 1,
|
||||
'title' => '获得' . $title,
|
||||
'number' => $couponPrice,
|
||||
'mark' => '获得' . $title . $couponPrice . ",订单金额:{$amount}",
|
||||
'balance' => 0
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否是首单
|
||||
* @param int $userId 用户id
|
||||
* @param string $startTime 活动开始时间
|
||||
* @param string $endTime 活动结束时间
|
||||
* @return int
|
||||
* @throws \think\db\exception\DbException
|
||||
*/
|
||||
public function isFirstOrder(int $userId, string $startTime, string $endTime)
|
||||
{
|
||||
$isNewUser = User::where('uid', $userId)->whereBetweenTime('create_time', $startTime, $endTime)->count();
|
||||
if ($isNewUser == 0) {
|
||||
return 0;
|
||||
}
|
||||
$count = StoreGroupOrder::where('uid', $userId)->where('paid', 1)->whereBetweenTime('pay_time', $startTime, $endTime)->count();
|
||||
return intval($count <= 1);
|
||||
}
|
||||
|
||||
public function getEndTime($datetime)
|
||||
{
|
||||
return strtotime('+1 year', strtotime($datetime));
|
||||
}
|
||||
|
||||
/**
|
||||
* 扣减红包余额
|
||||
* @param $id
|
||||
* @param $amount
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function reduce($id, $amount)
|
||||
{
|
||||
$storeConsumptionUser = StoreConsumptionUser::where('coupon_user_id', $id)->find();
|
||||
if (empty($storeConsumptionUser) || $storeConsumptionUser->balance < $amount) {
|
||||
throw new \Exception('红包余额不足');
|
||||
}
|
||||
$balance = bcsub($storeConsumptionUser->balance, $amount, 2);
|
||||
$storeConsumptionUser->balance = max($balance, 0);
|
||||
if (!$storeConsumptionUser->save()) {
|
||||
throw new \Exception('红包余额更新出错');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -121,6 +121,9 @@ class StoreOrderOtherDao extends BaseDao
|
||||
->when(isset($where['uid']) && $where['uid'] !== '', function ($query) use ($where) {
|
||||
$query->where('StoreOrderOther.uid', $where['uid']);
|
||||
})
|
||||
->when(isset($where['source']) && $where['source'] !== '', function ($query) use ($where) {
|
||||
$query->where('StoreOrderOther.source', $where['source']);
|
||||
})
|
||||
->when(isset($where['is_user']) && $where['is_user'] !== 0, function ($query) use ($where) {
|
||||
$query->where(function ($query) {
|
||||
$query->where('order_type', 0)->whereOr(function ($query) {
|
||||
|
@ -1,294 +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\common\dao\system\merchant;
|
||||
|
||||
|
||||
use app\common\dao\BaseDao;
|
||||
use app\common\model\system\merchant\Merchant;
|
||||
use crmeb\services\VicWordService;
|
||||
use think\db\BaseQuery;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
use think\facade\Db;
|
||||
use think\Model;
|
||||
|
||||
class MerchantDao extends BaseDao
|
||||
{
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @author xaboy
|
||||
* @day 2020-04-16
|
||||
*/
|
||||
protected function getModel(): string
|
||||
{
|
||||
return Merchant::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $where
|
||||
* @return BaseQuery
|
||||
* @author xaboy
|
||||
* @day 2020-04-16
|
||||
*/
|
||||
public function search(array $where, $is_del = 0)
|
||||
{
|
||||
$query = Merchant::getDB()
|
||||
->when($is_del !== null, function ($query) use ($is_del) {
|
||||
$query->where('is_del', $is_del);
|
||||
})
|
||||
->when(isset($where['is_trader']) && $where['is_trader'] !== '', function ($query) use ($where) {
|
||||
$query->where('is_trader', $where['is_trader']);
|
||||
})
|
||||
->when(isset($where['is_best']) && $where['is_best'] !== '', function ($query) use ($where) {
|
||||
$query->where('is_best', $where['is_best']);
|
||||
})
|
||||
->when(isset($where['date']) && $where['date'] !== '', function ($query) use ($where) {
|
||||
getModelTime($query, $where['date']);
|
||||
})
|
||||
->when(isset($where['mer_state']) && $where['mer_state'] !== '', function ($query) use ($where) {
|
||||
$query->where('mer_state', $where['mer_state']);
|
||||
})
|
||||
->when(isset($where['mer_id']) && $where['mer_id'] !== '', function ($query) use ($where) {
|
||||
$query->where('mer_id', $where['mer_id']);
|
||||
})
|
||||
->when(isset($where['category_id']) && $where['category_id'] !== '', function ($query) use ($where) {
|
||||
$query->whereIn('category_id', is_array($where['category_id']) ? $where['category_id'] : explode(',', $where['category_id']));
|
||||
})
|
||||
->when(isset($where['type_id']) && $where['type_id'] !== '', function ($query) use ($where) {
|
||||
$query->whereIn('type_id', is_array($where['type_id']) ? $where['type_id'] : explode(',', $where['type_id']));
|
||||
})
|
||||
->when(isset($where['delivery_way']) && $where['delivery_way'] !== '', function ($query) use ($where) {
|
||||
$query->whereLike('delivery_way', "%{$where['delivery_way']}%");
|
||||
});
|
||||
|
||||
|
||||
if (isset($where['keyword']) && $where['keyword']) {
|
||||
if (is_numeric($where['keyword'])) {
|
||||
$query->whereLike('mer_name|mer_keyword|mer_phone', "%{$where['keyword']}%");
|
||||
} else {
|
||||
$word = app()->make(VicWordService::class)->getWord($where['keyword']);
|
||||
$query->where(function ($query) use ($word, $where) {
|
||||
foreach ($word as $item) {
|
||||
if(mb_strlen($item) > 1) {
|
||||
$query->whereOr('mer_name', 'LIKE', "%$item%");
|
||||
}
|
||||
}
|
||||
$query->whereOr('mer_name|mer_keyword', 'LIKE', "%{$where['keyword']}%");
|
||||
});
|
||||
}
|
||||
}
|
||||
if (isset($where['status']) && $where['status'] !== '')
|
||||
$query->where('status', $where['status']);
|
||||
$order = $where['order'] ?? '';
|
||||
$query->when($order, function ($query) use ($where, $order) {
|
||||
if ($order == 'rate') {
|
||||
$query->order('is_best DESC, product_score DESC,service_score DESC,postage_score DESC');
|
||||
} else if ($order == 'location' && isset($where['location']['long'], $where['location']['lat'])) {
|
||||
$lng = (float)$where['location']['long'];
|
||||
$lat = (float)$where['location']['lat'];
|
||||
$query->whereNotNull('lat')->whereNotNull('long')
|
||||
->order(Db::raw("(2 * 6378.137 * ASIN(
|
||||
SQRT(
|
||||
POW( SIN( PI( ) * ( $lng- `long` ) / 360 ), 2 ) + COS( PI( ) * $lat / 180 ) * COS( `lat` * PI( ) / 180 ) * POW( SIN( PI( ) * ( $lat- `lat` ) / 360 ), 2 )
|
||||
)
|
||||
)
|
||||
) ASC "));
|
||||
} else {
|
||||
$query->order('is_best DESC, sales DESC,sort DESC');
|
||||
}
|
||||
}, function ($query) use ($order) {
|
||||
$query->order('is_best DESC, sort DESC,sales DESC');
|
||||
});
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return array|Model|null
|
||||
* @throws DataNotFoundException
|
||||
* @throws DbException
|
||||
* @throws ModelNotFoundException
|
||||
* @author xaboy
|
||||
* @day 2020-04-17
|
||||
*/
|
||||
public function get($id)
|
||||
{
|
||||
return Merchant::getInstance()->where('is_del', 0)->find($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @author Qinii
|
||||
*/
|
||||
public function apiGetOne($id)
|
||||
{
|
||||
return Merchant::getInstance()->where(['is_del' => 0, 'status' => 1, 'mer_state' => 1])->find($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $merId
|
||||
* @author Qinii
|
||||
*/
|
||||
public function incCareCount(int $merId)
|
||||
{
|
||||
($this->getModel()::getDB())->where($this->getPk(), $merId)->inc('care_count', 1)->update();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $merId
|
||||
* @param int $inc
|
||||
* @author xaboy
|
||||
* @day 2020/9/25
|
||||
*/
|
||||
public function incSales($merId, $inc)
|
||||
{
|
||||
($this->getModel()::getDB())->where($this->getPk(), $merId)->inc('sales', $inc)->update();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $merId
|
||||
* @author Qinii
|
||||
*/
|
||||
public function decCareCount(array $merId)
|
||||
{
|
||||
($this->getModel()::getDB())->whereIn($this->getPk(), $merId)->where('care_count', '>', 0)->dec('care_count', 1)->update();
|
||||
}
|
||||
|
||||
public function dateMerchantNum($date)
|
||||
{
|
||||
return Merchant::getDB()->where('is_del', 0)->when($date, function ($query, $date) {
|
||||
getModelTime($query, $date);
|
||||
})->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO 获取复制商品次数
|
||||
* @param int $merId
|
||||
* @return mixed
|
||||
* @author Qinii
|
||||
* @day 2020-08-06
|
||||
*/
|
||||
public function getCopyNum(int $merId)
|
||||
{
|
||||
return Merchant::getDB()->where('mer_id', $merId)->value('copy_product_num');
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO 变更复制次数
|
||||
* @param int $merId
|
||||
* @param int $num 正负数
|
||||
* @return mixed
|
||||
* @author Qinii
|
||||
* @day 2020-08-06
|
||||
*/
|
||||
public function changeCopyNum(int $merId, int $num)
|
||||
{
|
||||
return $this->getModel()::where('mer_id', $merId)->inc('copy_product_num', $num)->update();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $value
|
||||
* @param int|null $except
|
||||
* @return bool
|
||||
* @author xaboy
|
||||
* @day 2020-03-30
|
||||
*/
|
||||
public function fieldExists($field, $value, ?int $except = null): bool
|
||||
{
|
||||
$query = ($this->getModel())::getDB()->where($field, $value);
|
||||
if (!is_null($except)) $query->where($this->getPk(), '<>', $except);
|
||||
return $query->where('is_del', 0)->count() > 0;
|
||||
}
|
||||
|
||||
public function names(array $ids)
|
||||
{
|
||||
return Merchant::getDB()->whereIn('mer_id',$ids)->column('mer_name');
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO 增加商户余额
|
||||
* @param int $merId
|
||||
* @param float $num
|
||||
* @author Qinii
|
||||
* @day 3/19/21
|
||||
*/
|
||||
public function addMoney(int $merId, float $num)
|
||||
{
|
||||
$field = 'mer_money';
|
||||
$merchant = $this->getModel()::getDB()->where('mer_id', $merId)->find();
|
||||
if ($merchant) {
|
||||
$mer_money = bcadd($merchant[$field], $num, 2);
|
||||
$merchant[$field] = $mer_money;
|
||||
$merchant->save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO 减少商户余额
|
||||
* @param int $merId
|
||||
* @param float $num
|
||||
* @author Qinii
|
||||
* @day 3/19/21
|
||||
*/
|
||||
public function subMoney(int $merId, float $num)
|
||||
{
|
||||
$field = 'mer_money';
|
||||
$merchant = $this->getModel()::getDB()->where('mer_id', $merId)->find();
|
||||
if ($merchant) {
|
||||
$mer_money = bcsub($merchant[$field], $num, 2);
|
||||
$merchant[$field] = $mer_money;
|
||||
$merchant->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function clearTypeId(int $typeId)
|
||||
{
|
||||
return Merchant::getDB()->where('type_id', $typeId)->update(['type_id' => 0]);
|
||||
}
|
||||
|
||||
public function addFieldNum(int $merId, int $num, string $field)
|
||||
{
|
||||
if ($num < 0) $num = -$num;
|
||||
$merchant = $this->getModel()::getDB()->where('mer_id', $merId)->find();
|
||||
$number = $merchant[$field] + $num;
|
||||
$merchant[$field] = $number;
|
||||
$merchant->save();
|
||||
}
|
||||
|
||||
public function sumFieldNum(int $merId, int $num, string $field)
|
||||
{
|
||||
if ($num < 0) $num = -$num;
|
||||
$merchant = $this->getModel()::getDB()->where('mer_id', $merId)->find();
|
||||
$number = $merchant[$field] - $num;
|
||||
$merchant[$field] = $number;
|
||||
$merchant->save();
|
||||
}
|
||||
|
||||
public function merIdByImage($merIds)
|
||||
{
|
||||
return $this->getModel()::getDB()->whereIn('mer_id', $merIds)->column('mer_id,mer_avatar');
|
||||
}
|
||||
|
||||
public function updateMargin($typeId, $margin, $is_margin)
|
||||
{
|
||||
return $this->getModel()::where('type_id',$typeId)->where('is_margin','in',[0,1])->update([
|
||||
'is_margin' => $is_margin,
|
||||
'margin' => $margin
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
28
app/common/model/store/StoreActivityOrder.php
Normal file
28
app/common/model/store/StoreActivityOrder.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\store;
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
|
||||
/**
|
||||
* 活动订单表
|
||||
* 目前用于拉新红包活动
|
||||
*/
|
||||
class StoreActivityOrder extends BaseModel
|
||||
{
|
||||
|
||||
const STATUS_VALID = 1; //有效
|
||||
const STATUS_INVALID = 0; //无效
|
||||
const IS_FIRST_ORDER = 1; //首单
|
||||
|
||||
public static function tablePk(): string
|
||||
{
|
||||
return 'id';
|
||||
}
|
||||
|
||||
public static function tableName(): string
|
||||
{
|
||||
return 'store_activity_order';
|
||||
}
|
||||
|
||||
}
|
21
app/common/model/store/StoreActivityUser.php
Normal file
21
app/common/model/store/StoreActivityUser.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\store;
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
|
||||
class StoreActivityUser extends BaseModel
|
||||
{
|
||||
|
||||
public static function tablePk(): string
|
||||
{
|
||||
return 'id';
|
||||
}
|
||||
|
||||
public static function tableName(): string
|
||||
{
|
||||
return 'store_activity_user';
|
||||
}
|
||||
|
||||
|
||||
}
|
29
app/common/model/store/consumption/StoreConsumption.php
Normal file
29
app/common/model/store/consumption/StoreConsumption.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\store\consumption;
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
|
||||
class StoreConsumption extends BaseModel
|
||||
{
|
||||
|
||||
protected $json = ['config'];
|
||||
protected $jsonAssoc = true;
|
||||
|
||||
const STATUS_ENABLE = 1; //启用
|
||||
|
||||
const TYPE_OWNER_CONSUMPTION = 13; //个人消费金
|
||||
const TYPE_PULL_CONSUMPTION = 14; //拉新消费金
|
||||
const TYPE_FIRST_ORDER_COMMISSION = 15; //首单佣金
|
||||
|
||||
public static function tablePk(): string
|
||||
{
|
||||
return 'coupon_id';
|
||||
}
|
||||
|
||||
public static function tableName(): string
|
||||
{
|
||||
return 'store_consumption';
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\store\consumption;
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
|
||||
class StoreConsumptionDetail extends BaseModel
|
||||
{
|
||||
|
||||
public static function tablePk(): string
|
||||
{
|
||||
return 'id';
|
||||
}
|
||||
|
||||
public static function tableName(): string
|
||||
{
|
||||
return 'store_consumption_detail';
|
||||
}
|
||||
|
||||
}
|
33
app/common/model/store/consumption/StoreConsumptionUser.php
Normal file
33
app/common/model/store/consumption/StoreConsumptionUser.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\store\consumption;
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
|
||||
class StoreConsumptionUser extends BaseModel
|
||||
{
|
||||
|
||||
const STATUS_UN_RECEIVE = -2; //未领取
|
||||
const STATUS_REPEAL = -1; //已作废
|
||||
const STATUS_UNUSED = 0; //未使用
|
||||
const STATUS_USED = 1; //已使用
|
||||
const STATUS_OVERDUE = 2; //过期的
|
||||
const TYPE_ONE = 1; //实物通用红包
|
||||
const TYPE_TWO = 2; //现金抵扣红包
|
||||
|
||||
const TYPE_MAP = [
|
||||
self::TYPE_ONE => '无门槛实物通用红包',
|
||||
self::TYPE_TWO => '现金抵扣红包',
|
||||
];
|
||||
|
||||
public static function tablePk(): string
|
||||
{
|
||||
return 'coupon_user_id';
|
||||
}
|
||||
|
||||
public static function tableName(): string
|
||||
{
|
||||
return 'store_consumption_user';
|
||||
}
|
||||
|
||||
}
|
@ -15,6 +15,7 @@ namespace app\common\model\user;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\store\consumption\StoreConsumptionUser;
|
||||
|
||||
class UserBill extends BaseModel
|
||||
{
|
||||
@ -44,4 +45,9 @@ class UserBill extends BaseModel
|
||||
return $this->hasOne(User::class, 'uid', 'uid');
|
||||
}
|
||||
|
||||
public function storeConsumptionUser()
|
||||
{
|
||||
return $this->hasOne(StoreConsumptionUser::class, 'coupon_user_id', 'link_id')->bind(['order_amount', 'coupon_price']);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,16 +26,21 @@ use app\validate\api\OrderVirtualFieldValidate;
|
||||
use app\validate\api\UserAddressValidate;
|
||||
use crmeb\jobs\SendSmsJob;
|
||||
use crmeb\services\SwooleTaskService;
|
||||
use crmeb\utils\Curl;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\Queue;
|
||||
|
||||
class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
{
|
||||
protected $store_consumption_user;
|
||||
protected $consumption_money;
|
||||
protected $balance;
|
||||
|
||||
public function v2CartIdByOrderInfo($user, array $cartId, array $takes = null, array $useCoupon = null, bool $useIntegral = false, int $addressId = null, $createOrder = false)
|
||||
public function v2CartIdByOrderInfo($user, array $cartId, array $takes = null, array $useCoupon = null, bool $useIntegral = false, int $addressId = null, $createOrder = false, $consumption_id = 0)
|
||||
{
|
||||
$uid = $user->uid;
|
||||
$this->balance = 0;
|
||||
$userIntegral = $user->integral;
|
||||
$key = md5(json_encode(compact('cartId', 'takes', 'useCoupon', 'useIntegral', 'addressId'))) . $uid;
|
||||
app()->make(StoreCouponUserRepository::class)->failCoupon();
|
||||
@ -70,6 +75,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
//虚拟订单自定义数据
|
||||
$order_extend = [];
|
||||
//检查商品类型, 活动商品只能单独购买
|
||||
$allowDelivery = true;
|
||||
foreach ($merchantCartList as $merchantCart) {
|
||||
|
||||
if (($merchantCart['type_id'] != Merchant::TypeSupplyChain) && $address) {
|
||||
@ -106,15 +112,15 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$order_extend = json_decode($cart['product']['extend'], true);
|
||||
}
|
||||
if ($address) {
|
||||
if ($cart['source'] == 0) {
|
||||
// $userAddressCode = ($address['province_code'] ?? '') . ',' . ($address['city_code'] ?? '') . ',' . ($address['district_code'] ?? '') . ',' . ($address['street_code'] ?? '') . ',' . ($address['village_code'] ?? '') . ',' . ($address['brigade_id'] ?? 0);
|
||||
// $getUrl = env('LOGISTICS_HOST_URL') . '/api/hasCourier?user_address_code=' . $userAddressCode;
|
||||
// $client = new \GuzzleHttp\Client();
|
||||
// $response = $client->request('GET', $getUrl);
|
||||
// $courierData = json_decode($response->getBody(), true);
|
||||
// if (empty($courierData['code']) || $courierData['code'] != 1) {
|
||||
// throw new ValidateException('该收货区域未设置快递员');
|
||||
// }
|
||||
if ($cart['source'] == 0 || $cart['source'] == 103) {
|
||||
$userAddressCode = ($address['province_code'] ?? '') . ',' . ($address['city_code'] ?? '') . ',' . ($address['district_code'] ?? '') . ',' . ($address['street_code'] ?? '') . ',' . ($address['village_code'] ?? '') . ',' . ($address['brigade_id'] ?? 0);
|
||||
$getUrl = env('LOGISTICS_HOST_URL') . '/api/hasCourier?user_address_code=' . $userAddressCode;
|
||||
$curl = new Curl();
|
||||
$response = $curl->get($getUrl);
|
||||
$courierData = json_decode($response, true);
|
||||
if (empty($courierData['data']['user_id'])) {
|
||||
$allowDelivery = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -147,6 +153,11 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
}
|
||||
$orderDeliveryStatus = true;
|
||||
$order_svip_discount = 0;
|
||||
|
||||
if ($consumption_id > 0) {
|
||||
$this->store_consumption_user = Db::name('store_consumption_user')->where('coupon_user_id', $consumption_id)->where('uid', $uid)->find();
|
||||
$this->balance=$this->store_consumption_user['balance'];
|
||||
}
|
||||
// 循环计算每个店铺的订单数据 委托商品是否设置收货方式 ?
|
||||
foreach ($merchantCartList as &$merchantCart) {
|
||||
if ($order_type == 98 && !empty($deliverMethodArray)) {
|
||||
@ -188,11 +199,11 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$merTake = $merTake && $proTake;
|
||||
$proDelivery = (!count($delivery_way) || in_array('2', $delivery_way, true));
|
||||
$merDelivery = $merDelivery && $proDelivery;
|
||||
$merchantCart['list'][$k]['allow_take'] = $proTake;
|
||||
$merchantCart['list'][$k]['allow_delivery'] = $proDelivery;
|
||||
$merchantCart['list'][$k]['allow_take'] = true;
|
||||
$merchantCart['list'][$k]['allow_delivery'] = $allowDelivery;
|
||||
} else {
|
||||
$merchantCart['list'][$k]['allow_take'] = $_merTake;
|
||||
$merchantCart['list'][$k]['allow_delivery'] = $_merDelivery;
|
||||
$merchantCart['list'][$k]['allow_take'] = true;
|
||||
$merchantCart['list'][$k]['allow_delivery'] = $allowDelivery;
|
||||
}
|
||||
if ($createOrder && $isTake && !$merTake) {
|
||||
$deliveryStatus = false;
|
||||
@ -438,12 +449,12 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
'platformCoupon' => $platformCoupon,
|
||||
'svip_coupon_merge' => $svip_coupon_merge,
|
||||
'postage_price' => $postage_price,
|
||||
'isTake' => $isTake,
|
||||
'isTake' => intval($allowDelivery == false || count($takes) > 0),
|
||||
'total_num' => $total_num,
|
||||
'enabledCoupon' => $enabledCoupon,
|
||||
'useCouponIds' => $useCouponIds,
|
||||
'allow_take' => $merTake,
|
||||
'allow_delivery' => $merDelivery,
|
||||
'allow_take' => true,
|
||||
'allow_delivery' => $allowDelivery,
|
||||
'delivery_status' => $deliveryStatus,
|
||||
'svip_discount' => $total_svip_discount,
|
||||
'use_svip' => $use_svip,
|
||||
@ -484,22 +495,21 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$StoreCouponUser = app()->make(StoreCouponUserRepository::class);
|
||||
$platformCoupon = $StoreCouponUser->validUserPlatformCoupon($uid);
|
||||
$platformConsumption = [];
|
||||
$consumption=[];
|
||||
//消费金
|
||||
// if ($source == 103) {
|
||||
// $ConsumptionWhere = [
|
||||
// 'uid' => $uid,
|
||||
// 'start_time' => date('Y-m-d H:i:s'),
|
||||
// 'status' => 0,
|
||||
// 'is_fail' => 0
|
||||
// ];
|
||||
// $platformConsumption = Db::name('store_consumption_user')->where($ConsumptionWhere)->limit(100)->order('create_time', 'desc')
|
||||
// ->filed('uid,coupon_title,coupon_price')
|
||||
// ->select();
|
||||
// if($platformConsumption){
|
||||
// $consumption=$platformConsumption[0];
|
||||
// }
|
||||
// }
|
||||
if ($source == 103) {
|
||||
$ConsumptionWhere = [
|
||||
'uid' => $uid,
|
||||
'status' => 0,
|
||||
'is_fail' => 0
|
||||
];
|
||||
|
||||
$platformConsumption = Db::name('store_consumption_user')->where($ConsumptionWhere)->limit(100)->order('create_time', 'desc')
|
||||
->field('coupon_user_id,uid,coupon_title,coupon_price,balance,start_time,end_time')
|
||||
->select()->each(function ($item) {
|
||||
$item['describe'] = '仅限平台指定商家商品可使用';
|
||||
return $item;
|
||||
});
|
||||
}
|
||||
// }
|
||||
|
||||
$usePlatformCouponId = 0;
|
||||
@ -557,9 +567,35 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
} else {
|
||||
$pay_price = $org_price;
|
||||
}
|
||||
//计算总红包金额
|
||||
if ($consumption_id > 0 ) {
|
||||
if ($this->store_consumption_user) {
|
||||
if ($this->store_consumption_user['type'] == 2 && $pay_price>=6) {
|
||||
$a = bcdiv($pay_price, 6);
|
||||
if ($this->balance > $a) {
|
||||
$pay_price = bcsub($pay_price, $a, 2);
|
||||
$this->consumption_money = bcadd($this->consumption_money, $a, 2);
|
||||
$this->balance = bcsub($this->balance, $a, 2);
|
||||
} else {
|
||||
$pay_price = bcsub($pay_price, $this->balance, 2);
|
||||
$this->consumption_money = bcadd($this->consumption_money, $this->balance, 2);
|
||||
$this->balance = 0;
|
||||
}
|
||||
}
|
||||
if ($this->store_consumption_user['type'] == 1) {
|
||||
if ($pay_price > $this->balance) {
|
||||
$pay_price = bcsub($pay_price, $this->balance, 2);
|
||||
$this->consumption_money = bcadd($this->consumption_money, $this->balance, 2);
|
||||
$this->balance=0;
|
||||
} else {
|
||||
$pay_price = 0;
|
||||
$this->consumption_money = bcadd($this->consumption_money, $pay_price, 2);
|
||||
$this->balance = $pay_price;
|
||||
|
||||
if($consumption){
|
||||
$pay_price = bcsub($pay_price, $consumption['coupon_price'], 2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$giveIntegralFlag = $sysIntegralConfig['integral_status'] && $sysIntegralConfig['integral_order_rate'] > 0;
|
||||
@ -568,7 +604,6 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
foreach ($fn as $callback) {
|
||||
$callback();
|
||||
}
|
||||
|
||||
$merchantCart['order']['order_type'] = $order_type;
|
||||
$merchantCart['order']['total_give_integral'] = $total_give_integral;
|
||||
$merchantCart['order']['total_integral_price'] = $total_integral_price;
|
||||
@ -578,6 +613,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$merchantCart['order']['coupon_price'] = $coupon_price;
|
||||
$merchantCart['order']['postage_price'] = $merchantCart['order']['postage_price'];
|
||||
$merchantCart['order']['procure_price'] = $merchantCart['order']['procure_price'];
|
||||
$merchantCart['order']['consumption_id'] = $consumption_id;
|
||||
$merchantCart['order']['consumption_money'] = $this->consumption_money;
|
||||
|
||||
$order_price = bcadd($order_price, $pay_price, 2);
|
||||
$order_total_price = bcadd($order_total_price, $total_price, 2);
|
||||
@ -599,10 +636,16 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
unset($merchantCart);
|
||||
$status = ($address || $order_model || $allow_no_address) ? ($noDeliver ? 'noDeliver' : 'finish') : 'noAddress';
|
||||
$order = $merchantCartList;
|
||||
$consumption_money = $this->consumption_money;
|
||||
$total_price = $order_total_price;
|
||||
$openIntegral = $merIntegralFlag && !$order_type && $sysIntegralConfig['integral_status'] && $sysIntegralConfig['integral_money'] > 0;
|
||||
$total_coupon = bcadd($order_svip_discount, bcadd(bcadd($total_platform_coupon_price, $order_coupon_price, 2), $order_total_integral_price, 2), 2);
|
||||
$is_self_pickup = true;
|
||||
if($order_type=='balance' &&$source!=103 &&$createOrder==true){
|
||||
throw new ValidateException('余额支付只能用于里海云仓');
|
||||
}
|
||||
return compact(
|
||||
'is_self_pickup',
|
||||
'order_type',
|
||||
'source',
|
||||
'order_model',
|
||||
@ -626,14 +669,17 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
'address',
|
||||
'openIntegral',
|
||||
'useIntegral',
|
||||
'key'
|
||||
'key',
|
||||
'platformConsumption',
|
||||
'consumption_money',
|
||||
'consumption_id'
|
||||
) + ['allow_address' => !$allow_no_address, 'order_delivery_status' => $orderDeliveryStatus];
|
||||
}
|
||||
|
||||
public function v2CreateOrder(int $pay_type, $user, array $cartId, array $extend, array $mark, array $receipt_data, array $takes = null, array $useCoupon = null, bool $useIntegral = false, int $addressId = null, array $post, int $product_type = 0)
|
||||
public function v2CreateOrder(int $pay_type, $user, array $cartId, array $extend, array $mark, array $receipt_data, array $takes = null, array $useCoupon = null, bool $useIntegral = false, int $addressId = null, array $post, int $product_type = 0, $consumption_id = 0)
|
||||
{
|
||||
$uid = $user->uid;
|
||||
$orderInfo = $this->v2CartIdByOrderInfo($user, $cartId, $takes, $useCoupon, $useIntegral, $addressId, true);
|
||||
$orderInfo = $this->v2CartIdByOrderInfo($user, $cartId, $takes, $useCoupon, $useIntegral, $addressId, true, $consumption_id);
|
||||
$order_model = $orderInfo['order_model'];
|
||||
$order_extend = $orderInfo['order_extend'];
|
||||
if (!$orderInfo['order_delivery_status']) {
|
||||
@ -706,7 +752,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
|
||||
$merchantRepository = app()->make(MerchantRepository::class);
|
||||
$giveCouponIds = [];
|
||||
$ex = systemConfig('extension_status');
|
||||
$ex = systemConfig('extension_status'); //是否开启分销
|
||||
$address = $orderInfo['address'];
|
||||
$allUseCoupon = $orderInfo['usePlatformCouponId'] ? [$orderInfo['usePlatformCouponId']] : [];
|
||||
$totalNum = 0;
|
||||
@ -726,63 +772,6 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$cost = bcadd(bcmul($cart['cost'], $cart['cart_num'], 2), $cost, 2);
|
||||
$extension_one = 0;
|
||||
$extension_two = 0;
|
||||
if ($ex) {
|
||||
//预售订单
|
||||
if ($orderType == 2) {
|
||||
$_payPrice = $merchantCart['order']['pay_price'];
|
||||
$rate = $cart['productPresell']['presell_type'] == 2 ? bcdiv($cart['productPresellAttr']['down_price'], $cart['productPresellAttr']['presell_price'], 3) : 1;
|
||||
$one_price = $_payPrice > 0 ? bcdiv($_payPrice, $cart['cart_num'], 2) : 0;
|
||||
if ($spreadUid && $cart['productPresellAttr']['bc_extension_one'] > 0) {
|
||||
$org_extension = $cart['productPresellAttr']['bc_extension_one'];
|
||||
if ($spreadUser->brokerage_level > 0 && $spreadUser->brokerage && $spreadUser->brokerage->extension_one_rate > 0) {
|
||||
$org_extension = bcmul($org_extension, 1 + $spreadUser->brokerage->extension_one_rate, 2);
|
||||
}
|
||||
$_extension_one = bcmul($rate, $org_extension, 3);
|
||||
$presell_extension_one = 0;
|
||||
if ($cart['true_price'] > 0) {
|
||||
$extension_one = bcmul(bcdiv($one_price, $cart['productPresellAttr']['down_price'], 3), $_extension_one, 2);
|
||||
}
|
||||
if ($rate < 1) {
|
||||
$presell_extension_one = bcmul(1 - $rate, $org_extension, 2);
|
||||
}
|
||||
$cart['final_extension_one'] = bcmul($extension_one, $cart['cart_num'], 2);
|
||||
$extension_one = bcadd($extension_one, $presell_extension_one, 2);
|
||||
$cart['presell_extension_one'] = bcmul($presell_extension_one, $cart['cart_num'], 2);
|
||||
}
|
||||
if ($topUid && $cart['productPresellAttr']['bc_extension_two'] > 0) {
|
||||
$org_extension = $cart['productPresellAttr']['bc_extension_two'];
|
||||
if ($topUser->brokerage_level > 0 && $topUser->brokerage && $topUser->brokerage->extension_two_rate > 0) {
|
||||
$org_extension = bcmul($org_extension, 1 + $topUser->brokerage->extension_two_rate, 2);
|
||||
}
|
||||
$_extension_two = bcmul($rate, $org_extension, 2);
|
||||
$presell_extension_two = 0;
|
||||
if ($cart['true_price'] > 0) {
|
||||
$extension_two = bcmul(bcdiv($one_price, $cart['productPresellAttr']['down_price'], 3), $_extension_two, 2);
|
||||
}
|
||||
if ($rate < 1) {
|
||||
$presell_extension_two = bcmul(1 - $rate, $org_extension, 2);
|
||||
}
|
||||
$cart['final_extension_two'] = bcmul($extension_two, $cart['cart_num'], 2);;
|
||||
$extension_two = bcadd($extension_two, $presell_extension_two, 2);
|
||||
$cart['presell_extension_two'] = bcmul($presell_extension_two, $cart['cart_num'], 2);
|
||||
}
|
||||
} else if (!$orderType) {
|
||||
if ($spreadUid && $cart['productAttr']['bc_extension_one'] > 0) {
|
||||
$org_extension = $cart['productAttr']['bc_extension_one'];
|
||||
if ($spreadUser->brokerage_level > 0 && $spreadUser->brokerage && $spreadUser->brokerage->extension_one_rate > 0) {
|
||||
$org_extension = bcmul($org_extension, 1 + $spreadUser->brokerage->extension_one_rate, 2);
|
||||
}
|
||||
$extension_one = $cart['true_price'] > 0 ? bcmul(bcdiv($cart['true_price'], $cart['total_price'], 3), $org_extension, 2) : 0;
|
||||
}
|
||||
if ($topUid && $cart['productAttr']['bc_extension_two'] > 0) {
|
||||
$org_extension = $cart['productAttr']['bc_extension_two'];
|
||||
if ($topUser->brokerage_level > 0 && $topUser->brokerage && $topUser->brokerage->extension_two_rate > 0) {
|
||||
$org_extension = bcmul($org_extension, 1 + $topUser->brokerage->extension_two_rate, 2);
|
||||
}
|
||||
$extension_two = $cart['true_price'] > 0 ? bcmul(bcdiv($cart['true_price'], $cart['total_price'], 3), $org_extension, 2) : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
$cart['extension_one'] = $extension_one;
|
||||
$cart['extension_two'] = $extension_two;
|
||||
$total_extension_one = bcadd($total_extension_one, bcmul($extension_one, $cart['cart_num'], 2), 2);
|
||||
@ -836,6 +825,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
'platform_coupon_price' => $merchantCart['order']['platform_coupon_price'],
|
||||
'pay_type' => $pay_type,
|
||||
'procure_price' => $merchantCart['order']['procure_price'],
|
||||
'consumption_id' => $merchantCart['order']['consumption_id'],
|
||||
'consumption_money' => $merchantCart['order']['consumption_money'],
|
||||
];
|
||||
$allUseCoupon = array_merge($allUseCoupon, $merchantCart['order']['useCouponIds']);
|
||||
$orderList[] = $_order;
|
||||
@ -843,6 +834,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$totalCost = bcadd($totalCost, $cost, 2);
|
||||
$totalNum += $merchantCart['order']['total_num'];
|
||||
}
|
||||
//总订单组
|
||||
$groupOrder = [
|
||||
'uid' => $uid,
|
||||
'group_order_sn' => count($orderList) === 1 ? $orderList[0]['order_sn'] : ($this->getNewOrderId(StoreOrderRepository::TYPE_SN_ORDER) . '0'),
|
||||
@ -862,6 +854,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
'integral' => $orderInfo['order_total_integral'],
|
||||
'integral_price' => $orderInfo['order_total_integral_price'],
|
||||
'give_integral' => $orderInfo['order_total_give_integral'],
|
||||
'consumption_id' => $orderInfo['consumption_id'],
|
||||
'consumption_money' => $orderInfo['consumption_money'],
|
||||
];
|
||||
event('order.create.before', compact('groupOrder', 'orderList'));
|
||||
$group = Db::transaction(function () use ($ex, $user, $topUid, $spreadUid, $uid, $receipt_data, $cartIds, $allUseCoupon, $groupOrder, $orderList, $orderInfo) {
|
||||
@ -946,7 +940,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
//创建订单
|
||||
$groupOrder = $storeGroupOrderRepository->create($groupOrder);
|
||||
$bills = [];
|
||||
|
||||
$consumptionDetails=[];
|
||||
if ($groupOrder['integral'] > 0) {
|
||||
$user->integral = bcsub($user->integral, $groupOrder['integral'], 0);
|
||||
app()->make(UserBillRepository::class)->decBill($user['uid'], 'integral', 'deduction', [
|
||||
@ -960,6 +954,31 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$user->save();
|
||||
}
|
||||
|
||||
if ($groupOrder['consumption_money'] > 0) {
|
||||
$balance = 0;
|
||||
$store_consumption_user = Db::name('store_consumption_user')->where('uid',$uid)->where('coupon_user_id', $groupOrder['consumption_id'])->where('status', 0)->find();
|
||||
if ($store_consumption_user) {
|
||||
if ($store_consumption_user['type'] == 1) {
|
||||
if ($store_consumption_user['balance'] > $groupOrder['consumption_money']) {
|
||||
$balance = bcsub($store_consumption_user['balance'], $groupOrder['consumption_money'], 2);
|
||||
$balanceArr = ['balance' => $balance];
|
||||
Db::name('store_consumption_user')->where('coupon_user_id', $store_consumption_user['coupon_user_id'])->update($balanceArr);
|
||||
} else {
|
||||
$balanceArr = ['balance' => 0, 'status' => 1];
|
||||
Db::name('store_consumption_user')->where('coupon_user_id', $store_consumption_user['coupon_user_id'])->update($balanceArr);
|
||||
}
|
||||
}
|
||||
}
|
||||
app()->make(UserBillRepository::class)->decBill($user['uid'], 'consumption', 'deduction', [
|
||||
'link_id' => $groupOrder['group_order_id'],
|
||||
'status' => 1,
|
||||
'title' => '购买商品',
|
||||
'number' => $groupOrder['consumption_money'],
|
||||
'mark' => '购买商品使用红包抵扣' . floatval($groupOrder['consumption_money']) . '元',
|
||||
'balance' => $balance
|
||||
]);
|
||||
}
|
||||
|
||||
foreach ($orderList as $k => $order) {
|
||||
$orderList[$k]['group_order_id'] = $groupOrder->group_order_id;
|
||||
}
|
||||
@ -990,6 +1009,18 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
'status' => 1
|
||||
];
|
||||
}
|
||||
if ($order['consumption_money'] > 0) {
|
||||
$consumptionDetails[] = [
|
||||
'user_id' => $uid,
|
||||
'order_id' => $_order->order_id,
|
||||
'group_order_id' => $groupOrder->group_order_id,
|
||||
'coupon_user_id' => $order['consumption_id'],
|
||||
'type' => 1,
|
||||
'amount' => $order['consumption_money'],
|
||||
'pay_price' => $order['pay_price'],
|
||||
'create_time' => time()
|
||||
];
|
||||
}
|
||||
|
||||
//创建发票信息
|
||||
if (isset($receipt_data[$_order['mer_id']])) {
|
||||
@ -1059,7 +1090,16 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$order_cart['active'] = $cart['productDiscount'];
|
||||
$order_cart['activeSku'] = $cart['productDiscountAttr'];
|
||||
}
|
||||
|
||||
$product_source_id = 0;
|
||||
$product_mer_id = 0;
|
||||
if ($cart['source'] == 103) {
|
||||
$old_product_id = Db::name('store_product')->where('product_id', $cart['product_id'])->value('old_product_id');
|
||||
if ($old_product_id) {
|
||||
$old_mer_id = Db::name('store_product')->where('product_id', $old_product_id)->value('mer_id');
|
||||
$product_mer_id = $old_mer_id;
|
||||
$product_source_id = $old_product_id;
|
||||
}
|
||||
}
|
||||
$orderProduct[] = [
|
||||
'order_id' => $_order->order_id,
|
||||
'cart_id' => $cart['cart_id'],
|
||||
@ -1084,7 +1124,9 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
'product_type' => $cart['product_type'],
|
||||
'source' => $cart['source'],
|
||||
'source_id' => $cart['source_id'],
|
||||
'cart_info' => json_encode($order_cart)
|
||||
'cart_info' => json_encode($order_cart),
|
||||
'product_source_id' => $product_source_id,
|
||||
'product_mer_id' => $product_mer_id,
|
||||
];
|
||||
}
|
||||
|
||||
@ -1095,6 +1137,9 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
if (count($bills) > 0) {
|
||||
app()->make(UserBillRepository::class)->insertAll($bills);
|
||||
}
|
||||
if (count($consumptionDetails) > 0) {
|
||||
Db::name('store_consumption_detail')->insertAll($consumptionDetails);
|
||||
}
|
||||
$storeOrderStatusRepository->batchCreateLog($orderStatus);
|
||||
$storeOrderProductRepository->insertAll($orderProduct);
|
||||
event('order.create', compact('groupOrder'));
|
||||
|
@ -11,6 +11,8 @@
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\common\repositories\store\order;
|
||||
|
||||
use app\common\dao\store\consumption\CommissionDao;
|
||||
use app\common\dao\store\consumption\StoreConsumptionUserDao;
|
||||
use app\common\dao\store\order\StoreCartDao;
|
||||
use app\common\dao\store\order\StoreOrderDao;
|
||||
use app\common\model\store\order\StoreGroupOrder;
|
||||
@ -161,6 +163,7 @@ class StoreOrderRepository extends BaseRepository
|
||||
Db::commit();
|
||||
} catch (Exception $e) {
|
||||
Db::rollback();
|
||||
halt($e);
|
||||
throw new ValidateException('余额支付失败');
|
||||
}
|
||||
|
||||
@ -271,6 +274,7 @@ class StoreOrderRepository extends BaseRepository
|
||||
// 订单的类型 0 发货 1 自提
|
||||
if ($order->order_type == 1 && $order->status != 10) {
|
||||
$order->verify_code = $this->verifyCode();
|
||||
$order->logistics_code = random_int(1000, 9999);
|
||||
}
|
||||
$order->save();
|
||||
$orderStatus[] = [
|
||||
@ -313,8 +317,69 @@ class StoreOrderRepository extends BaseRepository
|
||||
|
||||
if ($order->source == 103) {
|
||||
$_payPrice = $order->procure_price;
|
||||
$finance[] = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'user_info' => $groupOrder->user->nickname,
|
||||
'user_id' => $uid,
|
||||
'financial_type' => 'supply_chain',
|
||||
'financial_pm' => 0,
|
||||
'type' => 1,
|
||||
'number' => $_payPrice,
|
||||
'mer_id' => $order->mer_id,
|
||||
'financial_record_sn' => $financeSn . ($i++)
|
||||
];
|
||||
//市级供应链
|
||||
$product_mer_id = Db::name('store_order_product')->where('order_id', $order->order_id)->value('product_mer_id');
|
||||
if ($product_mer_id) {
|
||||
$finance[] = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'user_info' => $groupOrder->user->nickname,
|
||||
'user_id' => $uid,
|
||||
'financial_type' => 'order',
|
||||
'financial_pm' => 0,
|
||||
'type' => 1,
|
||||
'number' => $_payPrice,
|
||||
'mer_id' => $product_mer_id,
|
||||
'financial_record_sn' => $financeSn . (($i++)+1)
|
||||
];
|
||||
//市级供应链押金计算
|
||||
if ($_payPrice > 0) {
|
||||
/** @var MerchantRepository $merchantRepo */
|
||||
$merchantRepo = app()->make(MerchantRepository::class);
|
||||
$merchantRepo->merId = $product_mer_id;
|
||||
$merchantRepo->forceMargin = false;
|
||||
[$_payCityPrice, $finance, $increase] = $merchantRepo->autoMargin($_payPrice, $order, $finance, $financeSn, $i++);
|
||||
}
|
||||
$finance[] = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'user_info' => $groupOrder->user->nickname,
|
||||
'user_id' => $uid,
|
||||
'financial_type' => 'order_true',
|
||||
'financial_pm' => 0,
|
||||
'type' => 2,
|
||||
'number' => $_payCityPrice,
|
||||
'mer_id' => $product_mer_id,
|
||||
'financial_record_sn' => $financeSn . (($i++)+2)
|
||||
];
|
||||
if (!$is_combine) {
|
||||
app()->make(MerchantRepository::class)->addLockMoney($product_mer_id, 'order', $order->order_id, $_payCityPrice);
|
||||
}
|
||||
}
|
||||
|
||||
//计算手续费
|
||||
$_order_rate = bcsub($order->pay_price, $_payPrice, 2);
|
||||
|
||||
//计算镇级供应链云仓实际获得金额
|
||||
// 服务团队佣金统一由新供销平台结算
|
||||
// if ($_order_rate > 0) {
|
||||
// $commission_rate = bcdiv(12, 100, 2);
|
||||
// $_payPrice = bcmul($_order_rate, $commission_rate, 2);
|
||||
// } else {
|
||||
// $_payPrice = 0;
|
||||
// }
|
||||
} else {
|
||||
$_payPrice = $order->pay_price;
|
||||
$_order_rate = 0;
|
||||
@ -346,6 +411,7 @@ class StoreOrderRepository extends BaseRepository
|
||||
|
||||
if (!$presell) {
|
||||
if ($order['commission_rate'] > 0 || $order->source == 103) {
|
||||
//支出手续费
|
||||
$finance[] = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
@ -367,6 +433,20 @@ class StoreOrderRepository extends BaseRepository
|
||||
$merchantRepo->forceMargin = false;
|
||||
[$_payPrice, $finance, $increase] = $merchantRepo->autoMargin($_payPrice, $order, $finance, $financeSn, $i++);
|
||||
}
|
||||
if ($order->source == 103) {
|
||||
$finance[] = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'user_info' => $groupOrder->user->nickname,
|
||||
'user_id' => $uid,
|
||||
'financial_type' => 'commission_to_cloud_warehouse',
|
||||
'financial_pm' => 0,
|
||||
'type' => 1,
|
||||
'number' => $_payPrice,
|
||||
'mer_id' => $order->mer_id,
|
||||
'financial_record_sn' => $financeSn . ($i++)
|
||||
];
|
||||
} else {
|
||||
$finance[] = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
@ -379,6 +459,8 @@ class StoreOrderRepository extends BaseRepository
|
||||
'mer_id' => $order->mer_id,
|
||||
'financial_record_sn' => $financeSn . ($i++)
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
// if ($order->platform_coupon_price > 0) {
|
||||
// $finance[] = [
|
||||
@ -421,6 +503,13 @@ class StoreOrderRepository extends BaseRepository
|
||||
], $order->mer_id);
|
||||
//自动打印订单
|
||||
$this->autoPrinter($order->order_id, $order->mer_id);
|
||||
if ($order['pay_price'] > 0) {
|
||||
// "惠农供销,谱写数字新篇章"活动首单分润,商户和村、小组合伙人
|
||||
$finance = (new CommissionDao())->firstOrderCommission($order, $finance, $financeSn . ($i++));
|
||||
$addressCode = explode(',', $order['user_address_code']);
|
||||
// "惠农供销,谱写数字新篇章"活动首单分润,镇合伙人
|
||||
(new CommissionDao())->sendCommission($order, $addressCode[3], 3);
|
||||
}
|
||||
}
|
||||
//分销判断
|
||||
// if ($groupOrder->user->spread_uid) {
|
||||
@ -455,9 +544,7 @@ class StoreOrderRepository extends BaseRepository
|
||||
Queue::push(SendSmsJob::class, ['tempId' => 'ORDER_CREATE', 'phone' => $phone['phone'], 'orderId' => $order->order_id, 'id' => 0]); //短信通知
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if (count($groupOrder['give_coupon_ids']) > 0) {
|
||||
@ -2710,7 +2797,6 @@ class StoreOrderRepository extends BaseRepository
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$datas['product_id'] = $product_id ?? 0;
|
||||
$datas['mer_id'] = $merId;
|
||||
|
@ -639,13 +639,13 @@ class ProductRepository extends BaseRepository
|
||||
$ot_price = !$ot_price ? $ot_price_ : (($ot_price > $ot_price_) ? $ot_price : $ot_price_);
|
||||
|
||||
$unique = $this->setUnique($productId, $sku, $productType);
|
||||
$single_number=$value['single_number']??0;
|
||||
$single_procure_price=0;
|
||||
$single_price=0;
|
||||
if(isset($value['single_number']) && $value['single_number']>1){
|
||||
$single_procure_price= bcdiv($procure_price,$value['single_number'],2);
|
||||
$single_price= bcdiv($price,$value['single_number'],2);
|
||||
}
|
||||
// $single_number=$value['single_number']??0;
|
||||
// $single_procure_price=0;
|
||||
// $single_price=0;
|
||||
// if(isset($value['single_number']) && $value['single_number']>1){
|
||||
// $single_procure_price= bcdiv($procure_price,$value['single_number'],2);
|
||||
// $single_price= bcdiv($price,$value['single_number'],2);
|
||||
// }
|
||||
$result['attrValue'][] = [
|
||||
'detail' => json_encode($value['detail'] ?? ''),
|
||||
"bar_code" => $value["bar_code"] ?? '',
|
||||
@ -666,9 +666,9 @@ class ProductRepository extends BaseRepository
|
||||
'svip_price' => $_svip_price,
|
||||
'mer_id' => $merId,
|
||||
'procure_price' => $procure_price,
|
||||
'single_number'=>$single_number,
|
||||
'single_procure_price'=>$single_procure_price,
|
||||
'single_price'=>$single_price
|
||||
'single_number'=>$value['single_number']??0,
|
||||
'single_procure_price'=>$value['single_procure_price']??0,
|
||||
'single_price'=>$value['single_price']??0
|
||||
];
|
||||
$stock = $stock + intval($value['stock']);
|
||||
}
|
||||
|
@ -495,6 +495,11 @@ class FinancialRecordRepository extends BaseRepository
|
||||
$expend['count_auto_margin'] . '笔'
|
||||
|
||||
],
|
||||
[
|
||||
'自动下单市供应链',
|
||||
$expend['number_supply_chain'] . '元',
|
||||
$expend['count_supply_chain'] . '笔'
|
||||
],
|
||||
[
|
||||
'佣金',
|
||||
bcsub($expend['number_brokerage'], $expend['number_refund_brokerage'], 2) . '元',
|
||||
@ -674,6 +679,9 @@ 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 = ['supply_chain'];
|
||||
[$data['count_supply_chain'], $data['number_supply_chain']] = $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);
|
||||
@ -705,10 +713,16 @@ class FinancialRecordRepository extends BaseRepository
|
||||
$number = bcsub($data['number_brokerage'], $data['number_refund_brokerage'], 2);
|
||||
//平台手续费 =( order_charge + 预售手续费 presell_charge - 平台退给商户的手续费 refund_charge )
|
||||
$number_1 = bcsub($data['number_order_charge'], $data['number_charge'], 2);
|
||||
if($data['number_supply_chain']>0){
|
||||
$financialType = ['commission_to_cloud_warehouse'];
|
||||
[$data['count_commission_to_cloud_warehouse'], $data['number_commission_to_cloud_warehouse']] = $this->dao->getDataByType($type, $where, $date, $financialType);
|
||||
$number_1=bcadd($number_1, $data['number_supply_chain'], 2);
|
||||
$number_1=bcsub( $number_1, $data['number_commission_to_cloud_warehouse'], 2);
|
||||
}
|
||||
|
||||
//退回收入 refund_order + 退回佣金
|
||||
$number_2 = bcadd(bcadd($data['number_refund'], $data['number_coupon'], 2), $data['number_svipcoupon'], 2);
|
||||
$data['count'] = $data['count_brokerage'] + $data['count_refund'] + $data['count_order_charge'] + $data['count_refund_brokerage'] + $data['count_svipcoupon'] + $data['count_auto_margin']-$data['count_charge'];
|
||||
$data['count'] =$data['count_supply_chain']+ $data['count_brokerage'] + $data['count_refund'] + $data['count_order_charge'] + $data['count_refund_brokerage'] + $data['count_svipcoupon'] + $data['count_auto_margin']-$data['count_charge'];
|
||||
$data['number'] = bcadd(bcadd($number3,bcadd($number_2, $number, 2),2), $number_1, 2);
|
||||
|
||||
} else { //平台的
|
||||
|
@ -687,9 +687,9 @@ class MerchantRepository extends BaseRepository
|
||||
public function autoMargin($income, $order, $finance, $financeSn, $index = 0)
|
||||
{
|
||||
$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 直接返回 不计算押金
|
||||
if ($merchant['paid_margin']>= $margin_type|| ($this->forceMargin === false && $merchant['auto_margin_rate'] == 0)) {
|
||||
if ($merchant['paid_margin']>= $merchant['margin']|| ($this->forceMargin === false && $merchant['auto_margin_rate'] == 0)) {
|
||||
return [$income, $finance, false];
|
||||
}
|
||||
$rate = $this->forceMargin ? 100 : $merchant['auto_margin_rate'];
|
||||
@ -712,7 +712,7 @@ class MerchantRepository extends BaseRepository
|
||||
'mer_id' => $this->merId,
|
||||
'financial_record_sn' => $financeSn . $index
|
||||
];
|
||||
if(bcadd($merchant['paid_margin'],$margin)>=$margin_type){
|
||||
if(bcadd($merchant['paid_margin'],$margin)>=$merchant['margin']){
|
||||
$is_margin=10;
|
||||
}else{
|
||||
$is_margin=1;
|
||||
|
@ -673,6 +673,10 @@ class UserRepository extends BaseRepository
|
||||
];
|
||||
if($code){
|
||||
$data['promotion_code']=$code;
|
||||
$shop=explode('shop_',$code);
|
||||
if(count($shop)==2){
|
||||
$data['spread_uid']=$shop[1];
|
||||
}
|
||||
Cache::delete('promote_'.$ip);
|
||||
}
|
||||
return $this->create($user_type, $data);
|
||||
|
@ -18,6 +18,7 @@ use think\App;
|
||||
use crmeb\basic\BaseController;
|
||||
use app\validate\merchant\StoreProductAdminValidate as validate;
|
||||
use app\common\repositories\store\product\ProductRepository as repository;
|
||||
use think\facade\Db;
|
||||
use think\facade\Queue;
|
||||
|
||||
class StoreProduct extends BaseController
|
||||
@ -301,4 +302,28 @@ class StoreProduct extends BaseController
|
||||
$this->repository->updates($ids, $data);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
//**复制商品 */
|
||||
public function copy($product_id = 0, $mer_id = 0, $street_code = 0, $type_id = 0, $category_id = 0)
|
||||
{
|
||||
if ($product_id == 0) return app('json')->fail('参数错误');
|
||||
$products = $this->repository->getAdminOneProduct($product_id, 0);
|
||||
$product = $products->toArray();
|
||||
$product['mer_id'] = $mer_id;
|
||||
$product['old_product_id'] = $product['product_id'];
|
||||
$productId = $this->repository->create($product, 0, 1);
|
||||
$data = [
|
||||
'product_id' => $productId,
|
||||
'mer_id' => $mer_id,
|
||||
'source_mer_id' => $products['mer_id'],
|
||||
'street_code' => $street_code,
|
||||
'weight' => 1,
|
||||
'status' => 1,
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'type_id' => $type_id,
|
||||
'category_id' => $category_id,
|
||||
'cate_id' => $product['cate_id']
|
||||
];
|
||||
Db::name('cloud_product')->insert($data);
|
||||
return $productId;
|
||||
}
|
||||
}
|
||||
|
@ -410,6 +410,7 @@ class Auth extends BaseController
|
||||
}else{
|
||||
$data['show_controller_applet']=false;
|
||||
}
|
||||
$data['red_pack_balance']=Db::name('store_consumption_user')->where('uid',$data['uid'])->where('status',0)->sum('balance');
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
|
@ -57,6 +57,8 @@ use AlibabaCloud\Tea\Utils\Utils;
|
||||
use Darabonba\OpenApi\Models\Config;
|
||||
use AlibabaCloud\SDK\Ocr\V20191230\Models\RecognizeBusinessLicenseRequest;
|
||||
use AlibabaCloud\Tea\Utils\Utils\RuntimeOptions;
|
||||
use app\common\repositories\system\attachment\AttachmentRepository;
|
||||
use crmeb\services\QrcodeService;
|
||||
|
||||
/**
|
||||
* Class Common
|
||||
@ -634,4 +636,34 @@ class Common extends BaseController
|
||||
Cache::set('promote_' . app('request')->ip(), $code, 86400);
|
||||
return app('json')->success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成二维码
|
||||
*/
|
||||
public function Qrcode($data)
|
||||
{
|
||||
$siteUrl = systemConfig('site_url');
|
||||
$name = 'orcode'.$data['id'] .md5(date('Ymd')) . '.png';
|
||||
$attachmentRepository = app()->make(AttachmentRepository::class);
|
||||
$imageInfo = $attachmentRepository->getWhere(['attachment_name' => $name]);
|
||||
|
||||
if (isset($imageInfo['attachment_src']) && strstr($imageInfo['attachment_src'], 'http') !== false && curl_file_exist($imageInfo['attachment_src']) === false) {
|
||||
$imageInfo->delete();
|
||||
$imageInfo = null;
|
||||
}
|
||||
if (!$imageInfo) {
|
||||
$imageInfo = app()->make(QrcodeService::class)->getQRCodePath($data['code'], $name,['code'=>1]);
|
||||
if (is_string($imageInfo)) throw new ValidateException('二维码生成失败');
|
||||
|
||||
$imageInfo['dir'] = tidy_url($imageInfo['dir'], null, $siteUrl);
|
||||
$attachmentRepository->create(systemConfig('upload_type') ?: 1, -2, $data['id'], [
|
||||
'attachment_category_id' => 0,
|
||||
'attachment_name' => $imageInfo['name'],
|
||||
'attachment_src' => $imageInfo['dir']
|
||||
]);
|
||||
$urlCode = $imageInfo['dir'];
|
||||
} else $urlCode = $imageInfo['attachment_src'];
|
||||
return $urlCode;
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,8 @@ use think\facade\Db;
|
||||
use crmeb\services\UploadService;
|
||||
use Exception;
|
||||
use ZipArchive;
|
||||
|
||||
use think\facade\Queue;
|
||||
use crmeb\jobs\ProductCopyJob;
|
||||
/**
|
||||
* Class Auth
|
||||
* @package app\controller\api
|
||||
@ -30,204 +31,72 @@ class Demo extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$data=[
|
||||
|
||||
6923644264192,
|
||||
6923644210151,
|
||||
6921665735042,
|
||||
6921665731693,
|
||||
6921665731679,
|
||||
6921665730825,
|
||||
6921665707940,
|
||||
6921665701054,
|
||||
6920208995349,
|
||||
6920208986163,
|
||||
6920208960866,
|
||||
6920208960064,
|
||||
6920208924394,
|
||||
6920208924035,
|
||||
6920208924011,
|
||||
6919188019961,
|
||||
6919188019961,
|
||||
6908791503943,
|
||||
6908791006024,
|
||||
6907992507385,
|
||||
];
|
||||
$mer_id=167;
|
||||
foreach ($data as $item) {
|
||||
$store_product_attr_value=Db::name('store_product_attr_value')->alias('a')
|
||||
->join('store_product b','a.product_id=b.product_id and b.product_type=98')
|
||||
->where('a.bar_code',$item)->value('a.product_id');
|
||||
if($store_product_attr_value){
|
||||
$find=Db::name('store_product_attr_value')->alias('a')
|
||||
->join('store_product b','a.product_id=b.product_id and b.product_type=0 and b.mer_id='.$mer_id)
|
||||
->where('a.bar_code',$item)->field('a.product_id,b.cate_id')->find();
|
||||
if($find){
|
||||
$cloud_product=Db::name('cloud_product')->where('product_id',$find['product_id'])->where('mer_id',$mer_id)->value('product_id');
|
||||
if(!$cloud_product){
|
||||
$source_mer_id = Db::name('store_product')->where('product_id', $store_product_attr_value)->value('mer_id');
|
||||
$datas = [
|
||||
'product_id' => $find['product_id'],
|
||||
'cate_id' => $find['cate_id'],
|
||||
'mer_id' => $mer_id,
|
||||
'source_mer_id' => $source_mer_id,
|
||||
'street_code' => 510521107,
|
||||
'type_id' => 17,
|
||||
'category_id' => 2566,
|
||||
'weight' => 1,
|
||||
'status' => 1,
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'mer_labels' =>'',
|
||||
];
|
||||
Db::name('cloud_product')->insert($datas);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
halt(1);
|
||||
$mer_id = 104;
|
||||
$file = request()->file('file');
|
||||
$zip_name = explode('.', $file->getOriginalName())[0];
|
||||
// 上传到本地服务器
|
||||
$savename = \think\facade\Filesystem::putFile('zippic', $file);
|
||||
$dir = date('Y-m-d_H-i-s') . '_' . $mer_id;
|
||||
$path = public_path('uploads/pic').$dir;
|
||||
try {
|
||||
$zip = new ZipArchive;
|
||||
$filePath = public_path('uploads') . $savename;
|
||||
$zip->open($filePath);
|
||||
for ($i = 0; $i < $zip->numFiles; $i++) {
|
||||
$statInfo = $zip->statIndex($i, ZipArchive::FL_ENC_RAW);
|
||||
$filename = $this->transcoding($statInfo['name']);
|
||||
$mkdFile = explode('/',$filename);
|
||||
if ($statInfo['crc'] == 0) {
|
||||
// 新建目录
|
||||
if (!file_exists($path . '/' . $filename)) {
|
||||
mkdir($path . '/' . $filename, 0777, true);
|
||||
}
|
||||
} else {
|
||||
// 拷贝文件
|
||||
if(count($mkdFile)==3){
|
||||
if (!file_exists($path . '/' . $mkdFile[0].'/'.$mkdFile[1])) {
|
||||
mkdir($path . '/' .$mkdFile[0].'/'.$mkdFile[1], 0777, true);
|
||||
}
|
||||
copy('zip://' . $file . '#' . $zip->getNameIndex($i), $path . '/' . $filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
$zip->close();
|
||||
} catch (\Exception $e) {
|
||||
throw new \think\exception\HttpException(404, $e->getMessage() . '。line:' . $e->getLine());
|
||||
return app('json')->success('修改成功');
|
||||
$arr=Db::name('store_product')->whereIn('mer_id',[110,116,149,227,226,35,117,148,156,104,137,151,136,183,140,229,79,133,235])->where('status',1)->where('is_show',0)->field('product_id')->select();
|
||||
$mer_id=167;//导入到的商户
|
||||
$street_code=510521107;//导入到的商户
|
||||
$type_id=17;//导入到的商户分类
|
||||
$category_id=2566;//导入到的商户分类
|
||||
foreach($arr as $k=>$v){
|
||||
Queue::push(ProductCopyJob::class, ['product_id' => $v['product_id'], 'mer_id' =>$mer_id,'street_code'=>$street_code,'type_id'=>$type_id,'category_id'=>$category_id]);//短信通知
|
||||
}
|
||||
|
||||
$directory = $path.'/'.$zip_name;
|
||||
$files = scandir($directory);
|
||||
$dir = 'def/' . date('Y-m-d');
|
||||
$upload = UploadService::create();
|
||||
/**循环目录 */
|
||||
foreach ($files as $file) {
|
||||
if ($file === '.' || $file === '..' || $file === '__MACOSX') {
|
||||
continue;
|
||||
}
|
||||
if (!is_dir($directory . '/' . $file)) {
|
||||
continue;
|
||||
}
|
||||
$files_two = scandir($directory . '/' . $file);
|
||||
|
||||
$image_extensions = array('jpg', 'jpeg', 'png');
|
||||
$image = '';
|
||||
$slider_image = [];
|
||||
$details = [];
|
||||
$sku_arr = [];
|
||||
/**清洗图片 */
|
||||
foreach ($files_two as $file_two) {
|
||||
if ($file_two === '.' || $file_two === '..' || $file_two === '__MACOSX') {
|
||||
continue;
|
||||
$mer_id=236;//导入到的商户
|
||||
$street_code=510521123;//导入到的商户
|
||||
foreach($arr as $k=>$v){
|
||||
Queue::push(ProductCopyJob::class, ['product_id' => $v['product_id'], 'mer_id' =>$mer_id,'street_code'=>$street_code,'type_id'=>$type_id,'category_id'=>$category_id]);//短信通知
|
||||
}
|
||||
$arr = explode('.', $file_two);
|
||||
if (in_array($arr[1], $image_extensions)) {
|
||||
/**首图 */
|
||||
$images[] = $file_two;
|
||||
if ($image == '' && is_numeric($arr[0])) {
|
||||
$image = $directory . '/' . $file . '/' . $file_two;
|
||||
continue;
|
||||
|
||||
$mer_id=237;//导入到的商户
|
||||
$street_code=510521115;//导入到的商户
|
||||
|
||||
foreach($arr as $k=>$v){
|
||||
Queue::push(ProductCopyJob::class, ['product_id' => $v['product_id'], 'mer_id' =>$mer_id,'street_code'=>$street_code,'type_id'=>$type_id,'category_id'=>$category_id]);//短信通知
|
||||
}
|
||||
/**轮播图 */
|
||||
if (is_numeric($arr[0]) && count($slider_image) < 4) {
|
||||
$slider_image[] = $directory . '/' . $file . '/' . $file_two;
|
||||
continue;
|
||||
|
||||
$mer_id=238;//导入到的商户
|
||||
$street_code=510521105;//导入到的商户
|
||||
|
||||
foreach($arr as $k=>$v){
|
||||
Queue::push(ProductCopyJob::class, ['product_id' => $v['product_id'], 'mer_id' =>$mer_id,'street_code'=>$street_code,'type_id'=>$type_id,'category_id'=>$category_id]);//短信通知
|
||||
}
|
||||
/**详情图 */
|
||||
if (is_numeric($arr[0])) {
|
||||
$details[] = $directory . '/' .$file.'/'. $file_two;
|
||||
continue;
|
||||
|
||||
$mer_id=239;//导入到的商户
|
||||
$street_code=510521116;//导入到的商户
|
||||
|
||||
foreach($arr as $k=>$v){
|
||||
Queue::push(ProductCopyJob::class, ['product_id' => $v['product_id'], 'mer_id' =>$mer_id,'street_code'=>$street_code,'type_id'=>$type_id,'category_id'=>$category_id]);//短信通知
|
||||
}
|
||||
/**sku图 */
|
||||
$sku = explode('==', $arr[0]);
|
||||
if ($sku) {
|
||||
$sku = implode(',', $sku);
|
||||
$sku_arr[$sku] = $directory . '/' . $file . '/' . $file_two;
|
||||
|
||||
//江阳
|
||||
$mer_id=31;//导入到的商户
|
||||
$street_code=510502108;//导入到的商户
|
||||
|
||||
foreach($arr as $k=>$v){
|
||||
Queue::push(ProductCopyJob::class, ['product_id' => $v['product_id'], 'mer_id' =>$mer_id,'street_code'=>$street_code,'type_id'=>$type_id,'category_id'=>$category_id]);//短信通知
|
||||
}
|
||||
|
||||
$mer_id=32;//导入到的商户
|
||||
$street_code=510502107;//导入到的商户
|
||||
|
||||
foreach($arr as $k=>$v){
|
||||
Queue::push(ProductCopyJob::class, ['product_id' => $v['product_id'], 'mer_id' =>$mer_id,'street_code'=>$street_code,'type_id'=>$type_id,'category_id'=>$category_id]);//短信通知
|
||||
}
|
||||
|
||||
$mer_id=118;//导入到的商户
|
||||
$street_code=510502106;//导入到的商户
|
||||
|
||||
foreach($arr as $k=>$v){
|
||||
Queue::push(ProductCopyJob::class, ['product_id' => $v['product_id'], 'mer_id' =>$mer_id,'street_code'=>$street_code,'type_id'=>$type_id,'category_id'=>$category_id]);//短信通知
|
||||
}
|
||||
$where = ['mer_id' => $mer_id, 'is_del' => 0];
|
||||
$update = [];
|
||||
$update_content['title'] = '';
|
||||
$update_content['image'] = [];
|
||||
$update_content['type'] = 1;
|
||||
$find = Db::name('store_product')->where($where)->where('store_name', $file)->find();
|
||||
if ($find) {
|
||||
try {
|
||||
/**更新商品图片 */
|
||||
$image = $upload->to($dir)->stream(file_get_contents($image));
|
||||
$update['image'] = $image->filePath;
|
||||
foreach ($slider_image as $k => $v) {
|
||||
$oss = $upload->to($dir)->stream(file_get_contents($v));
|
||||
$update['slider_image'][] = $oss->filePath;
|
||||
|
||||
$mer_id=39;//导入到的商户
|
||||
$street_code=510502105;//导入到的商户
|
||||
|
||||
foreach($arr as $k=>$v){
|
||||
Queue::push(ProductCopyJob::class, ['product_id' => $v['product_id'], 'mer_id' =>$mer_id,'street_code'=>$street_code,'type_id'=>$type_id,'category_id'=>$category_id]);//短信通知
|
||||
}
|
||||
if (isset($update['slider_image'])) {
|
||||
$update['slider_image'] = implode(',', $update['slider_image']);
|
||||
}
|
||||
Db::name('store_product')->where('product_id', $find['product_id'])->update($update);
|
||||
/**更新规格图片 */
|
||||
foreach ($sku_arr as $k => $v) {
|
||||
// $sku = explode(',', $k);
|
||||
// if(count($sku)==2){
|
||||
// $sku_name=$sku[0];
|
||||
// }else{
|
||||
// continue;
|
||||
// }
|
||||
$store_product_attr_value = Db::name('store_product_attr_value')->where(['mer_id' => $mer_id, 'product_id' => $find['product_id'], 'sku' => $k])->find();
|
||||
if ($store_product_attr_value) {
|
||||
$oss = $upload->to($dir)->stream(file_get_contents($v));
|
||||
Db::name('store_product_attr_value')
|
||||
->where(['mer_id' => $mer_id, 'product_id' => $find['product_id'], 'sku' => $k])
|
||||
->update(['image' => $oss->filePath]);
|
||||
}
|
||||
}
|
||||
/**更新详情图片 */
|
||||
$store_product_content = Db::name('store_product_content')->where(['product_id' => $find['product_id']])->find();
|
||||
foreach ($details as $k => $v) {
|
||||
$oss = $upload->to($dir)->stream(file_get_contents($v));
|
||||
$update_content['image'][] = $oss->filePath;
|
||||
}
|
||||
if ($store_product_content) {
|
||||
if (isset($update_content['image']) && !empty($update_content['image'])) {
|
||||
Db::name('store_product_content')
|
||||
->where(['product_id' => $find['product_id']])
|
||||
->update(['content' => json_encode($update_content)]);
|
||||
}
|
||||
} else {
|
||||
$update_content['product_id'] = $find['product_id'];
|
||||
Db::name('store_product_content')
|
||||
->insert(['product_id' => $find['product_id'], 'type' => 1, 'content' => json_encode($update_content)]);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
halt($e->getMessage(), $e->getLine());
|
||||
}
|
||||
}
|
||||
}
|
||||
halt(1);
|
||||
}
|
||||
|
||||
public function transcoding($fileName)
|
||||
|
34
app/controller/api/Open.php
Normal file
34
app/controller/api/Open.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller\api;
|
||||
|
||||
use app\common\dao\store\consumption\CommissionDao;
|
||||
use crmeb\basic\BaseController;
|
||||
|
||||
class Open extends BaseController
|
||||
{
|
||||
|
||||
/**
|
||||
* 获取活动佣金(供应商平台异步回调)
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function activityCommission()
|
||||
{
|
||||
$timestamp = $this->request->post('timestamp');
|
||||
$data = $this->request->post('data');
|
||||
$aes = new \AES();
|
||||
$iv = !empty($timestamp) ? $aes->buildIv($timestamp) : '';
|
||||
$decrypted = $aes->decrypt($data, $iv);
|
||||
if (!empty($decrypted)) {
|
||||
$storeConsumptionUserDao = new CommissionDao();
|
||||
// "惠农供销,谱写数字新篇章"活动首单分润
|
||||
$result = $storeConsumptionUserDao->firstOrderBatchCommission($decrypted);
|
||||
return app('json')->success($result);
|
||||
}
|
||||
return app('json')->fail('解密失败');
|
||||
}
|
||||
|
||||
}
|
102
app/controller/api/store/StoreActivity.php
Normal file
102
app/controller/api/store/StoreActivity.php
Normal file
@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller\api\store;
|
||||
|
||||
use app\common\dao\store\consumption\StoreConsumptionDao;
|
||||
use app\common\dao\store\StoreActivityUserDao;
|
||||
use crmeb\basic\BaseController;
|
||||
|
||||
class StoreActivity extends BaseController
|
||||
{
|
||||
|
||||
/**
|
||||
* 消费金列表
|
||||
* @param StoreConsumptionDao $dao
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function consumption(StoreConsumptionDao $dao)
|
||||
{
|
||||
$list = $dao->getValidList();
|
||||
return app('json')->success($list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择消费金类型
|
||||
* @param StoreConsumptionDao $dao
|
||||
* @return mixed
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function choose(StoreActivityUserDao $dao)
|
||||
{
|
||||
$userId = $this->request->uid();
|
||||
$couponId = $this->request->post('coupon_id');
|
||||
$activityId = $this->request->post('activity_id', 1);
|
||||
$dao->choose($userId, $couponId, $activityId);
|
||||
return app('json')->success('提交成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户参与活动的状态
|
||||
* @param StoreActivityUserDao $dao
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function status(StoreActivityUserDao $dao)
|
||||
{
|
||||
$userId = $this->request->uid();
|
||||
$activityId = $this->request->post('activity_id', 1);
|
||||
$result = $dao->status($userId, $activityId);
|
||||
return app('json')->success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 领取消费金
|
||||
* @param StoreActivityUserDao $dao
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function receive(StoreActivityUserDao $dao)
|
||||
{
|
||||
$userId = $this->request->uid();
|
||||
$result = $dao->receive($userId);
|
||||
return app('json')->success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 红包获取记录
|
||||
* @param StoreActivityUserDao $dao
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function record(StoreActivityUserDao $dao)
|
||||
{
|
||||
$userId = $this->request->uid();
|
||||
$type = $this->request->get('type', 1);
|
||||
$page = $this->request->get('page', 1);
|
||||
$limit = $this->request->get('limit', 10);
|
||||
$result = $dao->record($userId, $type, $page, $limit);
|
||||
return app('json')->success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 红包余额统计
|
||||
* @param StoreActivityUserDao $dao
|
||||
* @return mixed
|
||||
*/
|
||||
public function total(StoreActivityUserDao $dao)
|
||||
{
|
||||
$userId = $this->request->uid();
|
||||
$result = $dao->total($userId);
|
||||
return app('json')->success($result);
|
||||
}
|
||||
|
||||
}
|
@ -60,6 +60,7 @@ class StoreOrder extends BaseController
|
||||
public function v2CheckOrder(StoreCartRepository $cartRepository, StoreOrderCreateRepository $orderCreateRepository)
|
||||
{
|
||||
$cartId = (array)$this->request->param('cart_id', []);
|
||||
$consumption_id = (int)$this->request->param('consumption_id',0);
|
||||
$addressId = (int)$this->request->param('address_id');
|
||||
$couponIds = (array)$this->request->param('use_coupon', []);
|
||||
$takes = (array)$this->request->param('takes', []);
|
||||
@ -68,7 +69,7 @@ class StoreOrder extends BaseController
|
||||
$uid = $user->uid;
|
||||
if (!($count = count($cartId)) || $count != count($cartRepository->validIntersection($cartId, $uid)))
|
||||
return app('json')->fail('数据无效');
|
||||
$orderInfo = $orderCreateRepository->v2CartIdByOrderInfo($user, $cartId, $takes, $couponIds, $useIntegral, $addressId);
|
||||
$orderInfo = $orderCreateRepository->v2CartIdByOrderInfo($user, $cartId, $takes, $couponIds, $useIntegral, $addressId,false,$consumption_id);
|
||||
|
||||
return app('json')->success($orderInfo);
|
||||
}
|
||||
@ -85,6 +86,7 @@ class StoreOrder extends BaseController
|
||||
$mark = (array)$this->request->param('mark', []);
|
||||
$payType = $this->request->param('pay_type');
|
||||
$post = (array)$this->request->param('post');
|
||||
$consumption_id = (int)$this->request->param('consumption_id',0);
|
||||
$isPc = $payType === 'pc';
|
||||
if ($isPc) {
|
||||
$payType = 'balance';
|
||||
@ -102,8 +104,8 @@ class StoreOrder extends BaseController
|
||||
if (!($count = count($cartId)) || $count != count($cartRepository->validIntersection($cartId, $uid)))
|
||||
return app('json')->fail('数据无效');
|
||||
|
||||
$groupOrder = app()->make(LockService::class)->exec('order.create', function () use ($orderCreateRepository, $receipt_data, $mark, $extend, $cartId, $payType, $takes, $couponIds, $useIntegral, $addressId, $post) {
|
||||
return $orderCreateRepository->v2CreateOrder(array_search($payType, StoreOrderRepository::PAY_TYPE), $this->request->userInfo(), $cartId, $extend, $mark, $receipt_data, $takes, $couponIds, $useIntegral, $addressId, $post);
|
||||
$groupOrder = app()->make(LockService::class)->exec('order.create', function () use ($orderCreateRepository, $receipt_data, $mark, $extend, $cartId, $payType, $takes, $couponIds, $useIntegral, $addressId, $post,$consumption_id) {
|
||||
return $orderCreateRepository->v2CreateOrder(array_search($payType, StoreOrderRepository::PAY_TYPE), $this->request->userInfo(), $cartId, $extend, $mark, $receipt_data, $takes, $couponIds, $useIntegral, $addressId, $post,0,$consumption_id);
|
||||
});
|
||||
|
||||
if ($groupOrder['pay_price'] == 0) {
|
||||
|
@ -77,18 +77,18 @@ class StoreOrderBehalf extends BaseController
|
||||
}else{
|
||||
$where['status']=['=',$status];
|
||||
}
|
||||
// $column = Db::name('store_order_behalf')->where('mer_id', $mer_id)->where($where)->page($page)->limit($limit)->column('order_id');
|
||||
// if ($column) {
|
||||
// $where['order_id'] = $column;
|
||||
$column = Db::name('store_order_behalf')->where('mer_id', $mer_id)->where($where)->page($page)->limit($limit)->column('order_id');
|
||||
if ($column) {
|
||||
$where['order_id'] = $column;
|
||||
|
||||
// }
|
||||
}
|
||||
if ($status == 0) {
|
||||
$where['status'] = 2;
|
||||
} elseif ($status == 1) {
|
||||
$where['status'] = 3;
|
||||
}
|
||||
$where['source']=103;
|
||||
return app('json')->success($this->repository->getList($where, $page, $limit));
|
||||
return app('json')->success($this->repository->getList($where,1, $limit));
|
||||
|
||||
}
|
||||
return app('json')->success([]);
|
||||
@ -151,4 +151,34 @@ class StoreOrderBehalf extends BaseController
|
||||
}
|
||||
return app('json')->success(compact('noDeliver', 'noPostage',));
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
public function status($id)
|
||||
{
|
||||
$uid = $this->request->userInfo()['uid'];
|
||||
$status = $this->request->param('status');
|
||||
$mer_id = Db::name('store_service')->where('uid', $uid)->where('is_del', 0)->value('mer_id');
|
||||
$type_id = Db::name('merchant')->where('mer_id', $mer_id)->value('type_id');
|
||||
$type_code = Db::name('merchant_type')->where('mer_type_id', $type_id)->value('type_code');
|
||||
$res=0;
|
||||
if ($status == 1) {
|
||||
if($type_code=='TypeSupplyChain'){
|
||||
$res = Db::name('store_order_behalf')->where('product_mer_id', $mer_id)
|
||||
->where('id',$id)->where('status',0)->update(['status'=>1]);
|
||||
}
|
||||
}
|
||||
if ($status == 3) {
|
||||
if($type_code!='TypeSupplyChain'){
|
||||
$res = Db::name('store_order_behalf')->where('master_mer_id', $mer_id)
|
||||
->where('id',$id)->where('status',1)->update(['status'=>3]);
|
||||
}
|
||||
}
|
||||
if($res){
|
||||
return app('json')->success('设置成功');
|
||||
}else{
|
||||
return app('json')->fail('设置失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
81
app/controller/api/store/order/StoreProcessing.php
Normal file
81
app/controller/api/store/order/StoreProcessing.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller\api\store\order;
|
||||
|
||||
use app\common\model\system\merchant\Merchant;
|
||||
use think\facade\Db;
|
||||
use crmeb\basic\BaseController;
|
||||
use think\facade\Log;
|
||||
use app\common\repositories\system\merchant\FinancialRecordRepository;
|
||||
|
||||
/**
|
||||
* 订单处理
|
||||
*/
|
||||
class StoreProcessing extends BaseController
|
||||
{
|
||||
/**
|
||||
* 自动向市级供应链创建订单
|
||||
*/
|
||||
public function AutomaticallyCreateOrders($order)
|
||||
{
|
||||
|
||||
|
||||
$merchant_two = Db::name('merchant')->where('mer_id', $order['mer_id'])->find();
|
||||
$store_group_order = Db::name('store_group_order')->where('group_order_id', $order['group_order_id'])->find();
|
||||
$store_group_order_other = Db::name('store_group_order_other')->where('group_order_sn', $order['order_sn'])->find();
|
||||
|
||||
if (!$store_group_order_other) {
|
||||
unset($store_group_order['group_order_id']);
|
||||
$group_order_id = Db::name('store_group_order_other')->insertGetId($store_group_order);
|
||||
}
|
||||
$select = Db::name('store_order_product')->where('order_id', $order['order_id'])->select();
|
||||
if ($order['source'] == 103 && $select) {
|
||||
// $financialRecordRepository = app()->make(FinancialRecordRepository::class);
|
||||
// $financeSn = $financialRecordRepository->getSn();
|
||||
$arr = $select->toArray();
|
||||
$order['group_order_id'] = $group_order_id;
|
||||
$order['source'] = 104;
|
||||
//镇级支出
|
||||
// $finance[] = [
|
||||
// 'order_id' => $order['order_id'],
|
||||
// 'order_sn' => $order['order_sn'],
|
||||
// 'user_info' => $order['real_name'],
|
||||
// 'user_id' => $order['uid'],
|
||||
// 'financial_type' => 'supply_chain',
|
||||
// 'financial_pm' => 0,
|
||||
// 'type' => 0,
|
||||
// 'number' => $order['procure_price'],
|
||||
// 'mer_id' => $order['mer_id'],
|
||||
// 'financial_record_sn' => $financeSn . '1'
|
||||
// ];
|
||||
$order['mer_id'] = $select[0]['product_mer_id'];
|
||||
$order['uid'] = $merchant_two['uid'];
|
||||
$order['real_name'] = $merchant_two['mer_name'] . '-' . $merchant_two['real_name'];
|
||||
$order['user_phone'] = $merchant_two['mer_phone'];
|
||||
$order['user_address'] = $merchant_two['mer_address'];
|
||||
//市级获得
|
||||
// $finance[] = [
|
||||
// 'order_id' => $order['order_id'],
|
||||
// 'order_sn' => $order['order_sn'],
|
||||
// 'user_info' => $order['real_name'],
|
||||
// 'user_id' => $order['uid'],
|
||||
// 'financial_type' => 'supply_chain',
|
||||
// 'financial_pm' => 1,
|
||||
// 'type' => 0,
|
||||
// 'number' => $order['procure_price'],
|
||||
// 'mer_id' => $order['mer_id'],
|
||||
// 'financial_record_sn' => $financeSn . '2'
|
||||
// ];
|
||||
unset($order['order_id'], $order['orderProduct'], $order['user'], $order['supply_chain_rate'], $order['logistics_code'], $order['logistics_phone']);
|
||||
$order_id = Db::name('store_order_other')->insertGetId($order);
|
||||
|
||||
foreach ($arr as $key => $value) {
|
||||
$arr[$key]['order_id'] = $order_id;
|
||||
$arr[$key]['source'] = 104;
|
||||
unset($arr[$key]['order_product_id']);
|
||||
}
|
||||
// $financialRecordRepository->insertAll($finance);
|
||||
Db::name('store_order_product_other')->insertAll($arr);
|
||||
}
|
||||
}
|
||||
}
|
@ -30,6 +30,7 @@ use think\App;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
use app\controller\api\Common;
|
||||
|
||||
class User extends BaseController
|
||||
{
|
||||
@ -535,4 +536,13 @@ class User extends BaseController
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成二维码
|
||||
*/
|
||||
public function qrcode(){
|
||||
$common= app()->make(Common::class);
|
||||
$siteUrl = systemConfig('site_url');
|
||||
$data=$common->Qrcode(['code'=>$siteUrl.'download/index.html?code=shop_'.$this->user->uid,'id'=>$this->user->uid]);
|
||||
return app('json')->success(['url'=>$data]);
|
||||
}
|
||||
}
|
||||
|
@ -56,9 +56,20 @@ class OrderOther extends BaseController
|
||||
public function lst()
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
$where = $this->request->params(['status', 'date', 'order_sn', 'username', 'order_type', 'keywords', 'order_id', 'activity_type', 'group_order_sn', 'store_name']);
|
||||
$where = $this->request->params(['type','status', 'date', 'order_sn', 'username', 'order_type', 'keywords', 'order_id', 'activity_type', 'group_order_sn', 'store_name','source']);
|
||||
if($where['type']=='user'){
|
||||
$uid = Db::name('merchant')->where('mer_id',$this->request->merId())->value('uid');
|
||||
if(!$uid){
|
||||
return app('json')->fail('商户不存在');
|
||||
}
|
||||
$where['uid'] = $uid;
|
||||
}else{
|
||||
$where['mer_id'] = $this->request->merId();
|
||||
}
|
||||
$where['paid']=1;
|
||||
if($where['source']<=0){
|
||||
$where['source']=105;
|
||||
}
|
||||
return app('json')->success($this->repository->merchantGetList($where, $page, $limit));
|
||||
}
|
||||
|
||||
|
183
app/controller/merchant/store/order/StoreOrderBehalf.php
Normal file
183
app/controller/merchant/store/order/StoreOrderBehalf.php
Normal file
@ -0,0 +1,183 @@
|
||||
<?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\merchant\store\order;
|
||||
|
||||
|
||||
|
||||
use app\common\dao\store\consumption\CommissionDao;
|
||||
use app\common\model\store\order\StoreOrder;
|
||||
use app\common\model\store\order\StoreOrderOther;
|
||||
use crmeb\basic\BaseController;
|
||||
|
||||
use app\common\repositories\store\order\StoreOrderRepository;
|
||||
use crmeb\services\SmsService;
|
||||
use think\facade\Db;
|
||||
use think\App;
|
||||
use app\common\dao\store\order\StoreOrderDao;
|
||||
use app\common\repositories\system\merchant\FinancialRecordRepository;
|
||||
|
||||
/**代发订单
|
||||
* Class StoreOrder
|
||||
* @package app\controller\api\store\order
|
||||
* @author xaboy
|
||||
* @day 2020/6/10
|
||||
*/
|
||||
class StoreOrderBehalf extends BaseController
|
||||
{
|
||||
/**
|
||||
* @var StoreOrderRepository
|
||||
*/
|
||||
protected $repository;
|
||||
protected $dao;
|
||||
|
||||
/**
|
||||
* StoreOrder constructor.
|
||||
* @param App $app
|
||||
* @param StoreOrderRepository $repository
|
||||
*/
|
||||
public function __construct(App $app, StoreOrderRepository $repository, StoreOrderDao $dao)
|
||||
{
|
||||
parent::__construct($app);
|
||||
$this->repository = $repository;
|
||||
$this->dao = $dao;
|
||||
}
|
||||
/**
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author xaboy
|
||||
* @day 2020/6/10
|
||||
*/
|
||||
public function lst()
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
$status = $this->request->param('status', 'all');
|
||||
$mer_id = $this->request->merId();
|
||||
if ($mer_id) {
|
||||
if ($status == 'all') {
|
||||
$where['status'] = ['>=', 0];
|
||||
} else {
|
||||
$where['status'] = ['=', $status];
|
||||
}
|
||||
$type_id = Db::name('merchant')->where('mer_id', $mer_id)->value('type_id');
|
||||
$type_code = Db::name('merchant_type')->where('mer_type_id', $type_id)->value('type_code');
|
||||
if($type_code=='TypeSupplyChain'){
|
||||
$column = Db::name('store_order_behalf')->where('product_mer_id', $mer_id)->where($where)->page($page)->limit($limit)->column('order_id');
|
||||
}else{
|
||||
$column = Db::name('store_order_behalf')->where('master_mer_id', $mer_id)->where($where)->page($page)->limit($limit)->column('order_id');
|
||||
}
|
||||
if ($column) {
|
||||
$where['order_id'] = $column;
|
||||
}else{
|
||||
return app('json')->success(['list'=>[],'count'=>0]);
|
||||
}
|
||||
if ($status == 0) {
|
||||
$where['status'] = 2;
|
||||
} elseif ($status == 1) {
|
||||
$where['status'] = 3;
|
||||
}
|
||||
$where['source'] = 103;
|
||||
return app('json')->success($this->repository->getList($where, 1, $limit));
|
||||
}
|
||||
return app('json')->success([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return mixed
|
||||
* @author xaboy
|
||||
* @day 2020/6/10
|
||||
*/
|
||||
public function detail($id)
|
||||
{
|
||||
$order = $this->repository->getDetail((int)$id);
|
||||
if (!$order)
|
||||
return app('json')->fail('订单不存在');
|
||||
if ($order->order_type == 1) {
|
||||
$order->append(['take', 'refund_status']);
|
||||
}
|
||||
return app('json')->success($order->toArray());
|
||||
}
|
||||
|
||||
/**代发订单统计
|
||||
* @return mixed
|
||||
* @author xaboy
|
||||
* @day 2020/6/10
|
||||
*/
|
||||
public function number()
|
||||
{
|
||||
$mer_id = $this->request->merId();
|
||||
if ($mer_id) {
|
||||
$noPostage = Db::name('store_order_behalf')
|
||||
->where('product_mer_id', $mer_id)->where('status', 0)
|
||||
->count();
|
||||
$noDeliver = Db::name('store_order_behalf')
|
||||
->where('product_mer_id', $mer_id)->where('status', 1)
|
||||
->count();
|
||||
}
|
||||
return app('json')->success(compact('noDeliver', 'noPostage',));
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
public function status()
|
||||
{
|
||||
$mer_id = $this->request->merId();
|
||||
$status = $this->request->param('status');
|
||||
$id = $this->request->param('id');
|
||||
$merchant = Db::name('merchant')->where('mer_id', $mer_id)->field('uid,mer_name')->find();
|
||||
$orderOther = StoreOrderOther::where('uid', $merchant['uid'])->where('order_id', $id)->find();
|
||||
$orderOther->status = $status;
|
||||
$res = $orderOther->save();
|
||||
// $find = Db::name('store_order_other')->where('uid', $uid)->where('order_id', $id)->find();
|
||||
// $find_two = Db::name('store_order')->where('order_sn', $find['order_sn'])->find();
|
||||
if($res){
|
||||
$order = StoreOrder::where('order_sn', $orderOther['order_sn'])->field('user_phone,order_type,logistics_code,logistics_phone')->find()->toArray();
|
||||
if($status==3 && $order['order_type'] == 1){
|
||||
SmsService::create()->send($order['user_phone'], 'RECEIVE_NOTICE', ['code' => $order['logistics_code'], 'name' => $merchant['mer_name']]);
|
||||
} elseif($status==3 && $order['order_type'] != 1){
|
||||
(new CommissionDao())->sendCommission($order, $order['logistics_phone'], 4);
|
||||
}
|
||||
return app('json')->success('设置成功');
|
||||
}else{
|
||||
return app('json')->fail('设置失败');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* TODO 订单头部统计
|
||||
* @return mixed
|
||||
* @author Qinii
|
||||
* @day 2020-08-17
|
||||
*/
|
||||
public function Chart()
|
||||
{
|
||||
$mer_id= $this->request->merId();
|
||||
$type_id = Db::name('merchant')->where('mer_id', $mer_id)->value('type_id');
|
||||
$type_code = Db::name('merchant_type')->where('mer_type_id', $type_id)->value('type_code');
|
||||
if($type_code=='TypeSupplyChain'){
|
||||
$column = Db::name('store_order_behalf')->where('product_mer_id', $mer_id)->column('order_id');
|
||||
}else{
|
||||
$column = Db::name('store_order_behalf')->where('master_mer_id', $mer_id)->column('order_id');
|
||||
}
|
||||
$where=[];
|
||||
if ($column) {
|
||||
$where['order_id'] = $column;
|
||||
}else{
|
||||
return app('json')->success(['list'=>[],'count'=>0]);
|
||||
}
|
||||
return app('json')->success($this->repository->OrderTitleNumberWhere($mer_id, $where));
|
||||
}
|
||||
}
|
@ -55,7 +55,6 @@ class Product extends BaseController
|
||||
$type = $this->request->merchant()['type_id'];
|
||||
$typeCode = Db::name('merchant_type')->where('mer_type_id', $type)->value('type_code');
|
||||
$product_type = 0;
|
||||
|
||||
// if ($type==12){
|
||||
if ($typeCode == Merchant::TypeCode['TypeSupplyChain']) {
|
||||
$where['product_type'] = 98; //供应链
|
||||
|
@ -4,7 +4,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace app\listener;
|
||||
|
||||
use app\common\dao\store\consumption\StoreConsumptionUserDao;
|
||||
use app\common\dao\store\order\StoreCartDao;
|
||||
use app\common\dao\store\StoreActivityUserDao;
|
||||
use app\common\dao\system\merchant\MerchantDao;
|
||||
use app\common\model\system\merchant\Merchant;
|
||||
use app\common\repositories\store\order\StoreOrderRepository;
|
||||
@ -13,6 +15,7 @@ use app\common\repositories\system\merchant\MerchantRepository;
|
||||
use crmeb\utils\DingTalk;
|
||||
use think\facade\Db;
|
||||
use think\facade\Log;
|
||||
use app\controller\api\store\order\StoreProcessing;
|
||||
|
||||
/**
|
||||
* 支付后逻辑
|
||||
@ -28,32 +31,20 @@ class paySuccess
|
||||
public $index = 1;
|
||||
public $remain;
|
||||
|
||||
public function handle($event)
|
||||
public function handle($event,StoreProcessing $StoreProcessing)
|
||||
{
|
||||
try {
|
||||
$orderList = $event['groupOrder']['orderList'];
|
||||
$storeConsumptionUserDao = new StoreConsumptionUserDao();
|
||||
$storeConsumptionUserDao->check($event['groupOrder']['uid'], $event['groupOrder']['group_order_id']);
|
||||
// $storeConsumptionUserDao->reduce($event['groupOrder']['consumption_id'], $event['groupOrder']['consumption_money']);
|
||||
foreach ($orderList as $k => $order) {
|
||||
// $merchant = Merchant::find($order['mer_id']);
|
||||
//添加到代发订单表里
|
||||
// if ($merchant['type_id'] == Merchant::TypeSupplyChain) {
|
||||
// $codes = explode(',', $order['user_address_code']);
|
||||
// if (count($codes) > 4) {
|
||||
// $merchant_two = Db::name('merchant')->where('street_id', $codes[3])->where('type_id', 17)->where('category_id', $merchant['category_id'])->find();
|
||||
// if ($merchant_two) {
|
||||
// $datas = [
|
||||
// 'master_mer_id' => $order['mer_id'],
|
||||
// 'mer_id' => $merchant_two['mer_id'],
|
||||
// 'order_id' => $order['order_id'],
|
||||
// 'status' => 0
|
||||
// ];
|
||||
// Db::name('store_order_behalf')->insert($datas);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
$StoreProcessing->AutomaticallyCreateOrders($order);
|
||||
$this->recordOrderAddr($order);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
Log::error('支付后逻辑报错:' . $e->getMessage() . 'lien:' . $e->getLine());
|
||||
Log::error('支付后逻辑报错:' . $e->getMessage() . '。lien:' . $e->getLine().'。file:'.$e->getFile());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
return [
|
||||
// 默认缓存驱动
|
||||
'default' => env('INSTALLED', false) ? env('cache.driver', 'redis') : 'file',
|
||||
'default' => 'redis',
|
||||
|
||||
// 缓存连接方式配置
|
||||
'stores' => [
|
||||
|
@ -1,116 +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>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
use app\webscoket\Manager;
|
||||
use Swoole\Table;
|
||||
use think\swoole\websocket\socketio\Parser;
|
||||
|
||||
return [
|
||||
'server' => [
|
||||
'host' => env('SWOOLE_HOST', '0.0.0.0'), // 监听地址
|
||||
'port' => env('SWOOLE_PORT', 8324), // 监听端口
|
||||
'mode' => SWOOLE_PROCESS, // 运行模式 默认为SWOOLE_PROCESS
|
||||
'sock_type' => SWOOLE_SOCK_TCP, // sock type 默认为SWOOLE_SOCK_TCP
|
||||
'options' => [
|
||||
'pid_file' => runtime_path() . 'swoole.pid',
|
||||
'log_file' => runtime_path() . 'swoole.log',
|
||||
'daemonize' => false,
|
||||
// Normally this value should be 1~4 times larger according to your cpu cores.
|
||||
'reactor_num' => swoole_cpu_num(),
|
||||
'worker_num' => swoole_cpu_num(),
|
||||
'task_worker_num' => swoole_cpu_num(),
|
||||
'task_enable_coroutine' => false,
|
||||
'task_max_request' => 2000,
|
||||
'enable_static_handler' => true,
|
||||
'document_root' => root_path('public'),
|
||||
'package_max_length' => 100 * 1024 * 1024,
|
||||
'buffer_output_size' => 10 * 1024 * 1024,
|
||||
'socket_buffer_size' => 128 * 1024 * 1024,
|
||||
'max_request' => 3000,
|
||||
'send_yield' => true,
|
||||
'reload_async' => true,
|
||||
],
|
||||
],
|
||||
'websocket' => [
|
||||
'enable' => true,
|
||||
'handler' => Manager::class,
|
||||
'parser' => Parser::class,
|
||||
'ping_interval' => 25000, //1000 = 1秒
|
||||
'ping_timeout' => 60000, //1000 = 1秒
|
||||
'room' => [
|
||||
'type' => 'table',
|
||||
'table' => [
|
||||
'room_rows' => 4096,
|
||||
'room_size' => 2048,
|
||||
'client_rows' => 8192,
|
||||
'client_size' => 2048,
|
||||
],
|
||||
'redis' => [
|
||||
|
||||
],
|
||||
],
|
||||
'listen' => [],
|
||||
'subscribe' => [],
|
||||
],
|
||||
'rpc' => [
|
||||
'server' => [
|
||||
'enable' => false,
|
||||
'port' => 9000,
|
||||
'services' => [
|
||||
],
|
||||
],
|
||||
'client' => [
|
||||
],
|
||||
],
|
||||
'hot_update' => [
|
||||
'enable' => env('APP_DEBUG', false),
|
||||
'name' => ['*.php'],
|
||||
'include' => [app_path(),root_path().'crmeb'],
|
||||
'exclude' => [],
|
||||
],
|
||||
//连接池
|
||||
'pool' => [
|
||||
'db' => [
|
||||
'enable' => true,
|
||||
'max_active' => 3,
|
||||
'max_wait_time' => 5,
|
||||
],
|
||||
'cache' => [
|
||||
'enable' => true,
|
||||
'max_active' => 3,
|
||||
'max_wait_time' => 5,
|
||||
],
|
||||
],
|
||||
'coroutine' => [
|
||||
'enable' => false,
|
||||
'flags' => SWOOLE_HOOK_ALL,
|
||||
],
|
||||
'tables' => [
|
||||
'user' => [
|
||||
'size' => 204800,
|
||||
'columns' => [
|
||||
['name' => 'fd', 'type' => Table::TYPE_INT],
|
||||
['name' => 'type', 'type' => Table::TYPE_INT],
|
||||
['name' => 'uid', 'type' => Table::TYPE_INT]
|
||||
]
|
||||
]
|
||||
],
|
||||
//每个worker里需要预加载以共用的实例
|
||||
'concretes' => [],
|
||||
//重置器
|
||||
'resetters' => [],
|
||||
//每次请求前需要清空的实例
|
||||
'instances' => [],
|
||||
//每次请求前需要重新执行的服务
|
||||
'services' => [],
|
||||
'locks' => ['group_buying'],
|
||||
];
|
36
crmeb/jobs/ProductCopyJob.php
Normal file
36
crmeb/jobs/ProductCopyJob.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace crmeb\jobs;
|
||||
|
||||
|
||||
use crmeb\interfaces\JobInterface;
|
||||
use app\controller\admin\store\StoreProduct;
|
||||
|
||||
|
||||
class ProductCopyJob implements JobInterface
|
||||
{
|
||||
|
||||
public function fire($job, $data)
|
||||
{
|
||||
$make = app()->make(StoreProduct::class);
|
||||
$make->copy($data['product_id'],$data['mer_id'],$data['street_code'],$data['type_id'],$data['category_id']);
|
||||
$job->delete();
|
||||
}
|
||||
|
||||
|
||||
public function failed($data)
|
||||
{
|
||||
// TODO: Implement failed() method.
|
||||
}
|
||||
}
|
@ -15,6 +15,7 @@ namespace crmeb\jobs;
|
||||
|
||||
use app\common\repositories\store\order\StoreOrderRepository;
|
||||
use crmeb\interfaces\JobInterface;
|
||||
use crmeb\utils\Curl;
|
||||
use think\facade\Log;
|
||||
use think\facade\Db;
|
||||
use think\queue\Job;
|
||||
@ -31,8 +32,9 @@ class SendGoodsCodeJob implements JobInterface
|
||||
Log::info("sendGoodsCodeJob ============= handle监听order_id " . $this->event['order_id']);
|
||||
try {
|
||||
if ($this->event['activity_type'] == 0 || in_array($this->event['source'], [0,2,103])) {
|
||||
$logisticsPhone = '';
|
||||
//发起物流信息返回快递员手机
|
||||
if($this->event['activity_type'] !=98){
|
||||
if($this->event['activity_type'] !=98 && $this->event['order_type'] != 1){
|
||||
$logisticsPhone = $this->sendLogistics($this->event['order_id'], $this->event['order_sn']);
|
||||
}
|
||||
//生成用户的收货码
|
||||
@ -57,28 +59,14 @@ class SendGoodsCodeJob implements JobInterface
|
||||
//发送物流
|
||||
public function sendLogistics($orderId, $orderSn)
|
||||
{
|
||||
$curl = new Curl();
|
||||
$postUrl = env('LOGISTICS_HOST_URL') . '/api/lstSet';
|
||||
Log::info("物流HOST: {$postUrl}");
|
||||
Log::info("发送物流信息 orderId: {$orderId}, orderSn: {$orderSn}");
|
||||
$curlPost = [
|
||||
'order_id' => $orderId,
|
||||
'order_sn' => $orderSn,
|
||||
];
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $postUrl);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
|
||||
$data = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
$phone = '';
|
||||
$data = $curl->post($postUrl, ['order_id' => $orderId, 'order_sn' => $orderSn]);
|
||||
if (!empty($data) && is_string($data)) {
|
||||
$logisticsInfo = json_decode($data, true);
|
||||
$phone = $logisticsInfo['data']['phone'] ?? '';
|
||||
Log::info("物流联系信息" . json_encode($logisticsInfo));
|
||||
}
|
||||
return $phone;
|
||||
return $phone ?? '';
|
||||
}
|
||||
|
||||
public function failed($data)
|
||||
|
@ -335,9 +335,11 @@ class ExcelService
|
||||
presell 收入 公共 新订单
|
||||
presell_charge 支出 商户 手续费
|
||||
presell_true 支出 平台 商户入账
|
||||
supply_chain 供应链商户入账
|
||||
*/
|
||||
$financialType = [
|
||||
'order' => '订单支付',
|
||||
'supply_chain' => '供应链',
|
||||
'presell' => '预售订单(尾款)',
|
||||
'brokerage_one' => '一级佣金',
|
||||
'brokerage_two' => '二级佣金',
|
||||
@ -364,13 +366,14 @@ class ExcelService
|
||||
'commission_to_village_refund' => '退回平台佣金',
|
||||
'commission_to_town_refund' => '退回平台佣金',
|
||||
'auto_margin_refund' => '退回押金',
|
||||
'commission_to_entry_merchant' => '订单平台佣金',
|
||||
'commission_to_cloud_warehouse' => '订单平台佣金',
|
||||
'commission_to_entry_merchant' => '订单平台佣金',//入口店铺佣金
|
||||
'commission_to_cloud_warehouse' => '订单平台佣金',//云仓佣金
|
||||
'commission_to_entry_merchant_refund' => '退回平台佣金',
|
||||
'commission_to_cloud_warehouse_refund' => '退回平台佣金',
|
||||
'first_order_commission' => '首单拉新',
|
||||
];
|
||||
$sys_pm_1 = ['order', 'presell', 'order_charge', 'order_presell', 'presell_charge', 'refund_brokerage_one', 'refund_brokerage_two', 'commission_to_platform'];
|
||||
$mer_pm_1 = ['order', 'presell', 'refund_brokerage_one', 'refund_brokerage_two', 'mer_presell',
|
||||
$sys_pm_1 = ['auto_margin','order', 'presell', 'order_charge', 'order_presell', 'presell_charge', 'refund_brokerage_one', 'refund_brokerage_two', 'commission_to_platform'];
|
||||
$mer_pm_1 = ['first_order_commission','order_true','order', 'presell', 'refund_brokerage_one', 'refund_brokerage_two', 'mer_presell',
|
||||
'order_platform_coupon', 'commission_to_cloud_warehouse', 'commission_to_entry_merchant', 'commission_to_town', 'commission_to_village', 'commission_to_service_team'];
|
||||
$date_ = $where['date'];
|
||||
unset($where['date']);
|
||||
|
@ -29,7 +29,7 @@ class QrcodeService
|
||||
* @param $name
|
||||
* @return array|bool|string
|
||||
*/
|
||||
public function getQRCodePath($url, $name)
|
||||
public function getQRCodePath($url, $name,$data)
|
||||
{
|
||||
if (!strlen(trim($url)) || !strlen(trim($name))) return false;
|
||||
try {
|
||||
@ -41,7 +41,22 @@ class QrcodeService
|
||||
if (!$siteUrl) return '请前往后台设置->系统设置->网站域名 填写您的域名格式为:http://域名';
|
||||
$info = [];
|
||||
$outfile = Config::get('qrcode.cache_dir');
|
||||
$code = new QrCode($url);
|
||||
$code = new QrCode();
|
||||
if(isset($data['code'])){
|
||||
$code->setForegroundColor([
|
||||
'r' => 248,
|
||||
'g' => 150,
|
||||
'b' => 46,
|
||||
'a' => 0,
|
||||
]);
|
||||
$code->setBackgroundColor([
|
||||
'r' => 255,
|
||||
'g' => 246,
|
||||
'b' => 235,
|
||||
'a' => 0,
|
||||
]);
|
||||
}
|
||||
$code->setText($url);
|
||||
if ($uploadType === 1) {
|
||||
if (!is_dir('./public/' . $outfile))
|
||||
mkdir('./public/' . $outfile, 0777, true);
|
||||
|
52
extend/AES.php
Normal file
52
extend/AES.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
class AES
|
||||
{
|
||||
|
||||
public $cipher = 'aes-128-cbc';
|
||||
public $secret = 've2HSq011whZYgKE';
|
||||
|
||||
/**
|
||||
* 使用对称密钥进行加密
|
||||
* @param $plainText
|
||||
* @param $iv
|
||||
* @return string
|
||||
*/
|
||||
function encrypt($plainText, $iv = null)
|
||||
{
|
||||
$plainText = json_encode($plainText);
|
||||
if (!empty($iv)) {
|
||||
$encryptedData = openssl_encrypt($plainText, $this->cipher, $this->secret, OPENSSL_RAW_DATA, $iv);
|
||||
} else {
|
||||
$encryptedData = openssl_encrypt($plainText, $this->cipher, $this->secret);
|
||||
}
|
||||
return base64_encode($encryptedData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用对称秘钥解密
|
||||
* @param $plainText
|
||||
* @param $iv
|
||||
* @return false|string
|
||||
*/
|
||||
function decrypt($plainText, $iv = null) {
|
||||
$plainText = base64_decode($plainText);
|
||||
if (!empty($iv)) {
|
||||
$data = openssl_decrypt($plainText, $this->cipher, $this->secret, OPENSSL_RAW_DATA, $iv);
|
||||
$data = json_decode($data, true);
|
||||
return $data;
|
||||
}
|
||||
return openssl_decrypt($plainText, $this->cipher, $this->secret);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成iv
|
||||
* @param int $timestamp 时间戳
|
||||
* @return false|string
|
||||
*/
|
||||
public function buildIv(int $timestamp)
|
||||
{
|
||||
return substr(md5($this->secret . $timestamp), 5, 16);
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because one or more lines are too long
1
public/mer/css/chunk-09559b9c.53a844dd.css
Normal file
1
public/mer/css/chunk-09559b9c.53a844dd.css
Normal file
@ -0,0 +1 @@
|
||||
.head[data-v-343bb459]{padding:30px 35px 25px}.head .full[data-v-343bb459]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.head .full .order_icon[data-v-343bb459]{width:60px;height:60px}.head .full .iconfont[data-v-343bb459]{color:#1890ff}.head .full .iconfont.sale-after[data-v-343bb459]{color:#90add5}.head .full .text[data-v-343bb459]{-ms-flex-item-align:center;align-self:center;-webkit-box-flex:1;-ms-flex:1;flex:1;min-width:0;padding-left:12px;font-size:13px;color:#606266}.head .full .text .title[data-v-343bb459]{margin-bottom:10px;font-weight:500;font-size:16px;line-height:16px;color:rgba(0,0,0,.85)}.head .full .text .order-num[data-v-343bb459]{padding-top:10px;white-space:nowrap}.head .list[data-v-343bb459]{display:-webkit-box;display:-ms-flexbox;display:flex;margin-top:20px;overflow:hidden;list-style:none;padding:0}.head .list .item[data-v-343bb459]{-webkit-box-flex:0;-ms-flex:none;flex:none;width:200px;font-size:14px;line-height:14px;color:rgba(0,0,0,.85)}.head .list .item .title[data-v-343bb459]{margin-bottom:12px;font-size:13px;line-height:13px;color:#666}.head .list .item .value1[data-v-343bb459]{color:#f56022}.head .list .item .value2[data-v-343bb459]{color:#1bbe6b}.head .list .item .value3[data-v-343bb459]{color:#1890ff}.head .list .item .value4[data-v-343bb459]{color:#6a7b9d}.head .list .item .value5[data-v-343bb459]{color:#f5222d}.el-tabs--border-card[data-v-343bb459]{-webkit-box-shadow:none;box-shadow:none;border-bottom:none}.section[data-v-343bb459]{padding:20px 0 5px;border-bottom:1px dashed #eee}.section .title[data-v-343bb459]{padding-left:10px;border-left:3px solid #1890ff;font-size:15px;line-height:15px;color:#303133}.section .list[data-v-343bb459]{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;list-style:none;padding:0}.section .item[data-v-343bb459]{-webkit-box-flex:0;-ms-flex:0 0 33.33333%;flex:0 0 33.33333%;display:-webkit-box;display:-ms-flexbox;display:flex;margin-top:16px;font-size:13px;color:#606266}.section .item[data-v-343bb459]:nth-child(3n+1){padding-right:20px}.section .item[data-v-343bb459]:nth-child(3n+2){padding-right:10px;padding-left:10px}.section .item[data-v-343bb459]:nth-child(3n+3){padding-left:20px}.section .value[data-v-343bb459]{-webkit-box-flex:1;-ms-flex:1;flex:1}.section .value image[data-v-343bb459]{display:inline-block;width:40px;height:40px;margin:0 12px 12px 0;vertical-align:middle}.tab[data-v-343bb459]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.tab .el-image[data-v-343bb459]{width:36px;height:36px;margin-right:10px}[data-v-343bb459] .el-drawer__body{overflow:auto}.gary[data-v-343bb459]{color:#aaa}.logistics[data-v-343bb459]{-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:10px 0}.logistics .logistics_img[data-v-343bb459]{width:45px;height:45px;margin-right:12px}.logistics .logistics_img img[data-v-343bb459]{width:100%;height:100%}.logistics .logistics_cent span[data-v-343bb459]{display:block;font-size:12px}.tabBox_tit[data-v-343bb459]{width:53%;font-size:12px!important;margin:0 2px 0 10px;letter-spacing:1px;padding:5px 0;-webkit-box-sizing:border-box;box-sizing:border-box}.pictures[data-v-56bbdfa6]{max-width:100%}.area-desc[data-v-56bbdfa6]{margin:0;color:#999;font-size:12px}.selWidth[data-v-56bbdfa6]{width:300px}.spBlock[data-v-56bbdfa6]{cursor:pointer;display:block;padding:5px 0}.check[data-v-56bbdfa6]{color:#00a2d4}.el-dropdown-link[data-v-56bbdfa6]{cursor:pointer;color:#409eff;font-size:12px}.el-icon-arrow-down[data-v-56bbdfa6]{font-size:12px}.tabBox_tit[data-v-56bbdfa6]{width:53%;font-size:12px!important;margin:0 2px 0 10px;letter-spacing:1px;padding:5px 0;-webkit-box-sizing:border-box;box-sizing:border-box}[data-v-56bbdfa6] .row-bg .cell{color:red!important}.headTab[data-v-56bbdfa6]{position:relative}.headTab .headBtn[data-v-56bbdfa6]{position:absolute;right:0;top:-6px}.dropdown[data-v-56bbdfa6]{padding:0 10px;border:1px solid #409eff;margin-right:10px;line-height:28px;border-radius:4px}
|
@ -1 +0,0 @@
|
||||
.selWidth[data-v-4c2bfa98]{width:330px}.title[data-v-4c2bfa98],.title[data-v-96d4296a]{margin-bottom:16px;color:#17233d;font-weight:500;font-size:14px}.description-term[data-v-96d4296a]{display:table-cell;padding-bottom:10px;line-height:20px;width:50%;font-size:12px}
|
@ -1 +0,0 @@
|
||||
.head[data-v-2f11caa9]{padding:30px 35px 25px}.head .full[data-v-2f11caa9]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.head .full .order_icon[data-v-2f11caa9]{width:60px;height:60px}.head .full .iconfont[data-v-2f11caa9]{color:#1890ff}.head .full .iconfont.sale-after[data-v-2f11caa9]{color:#90add5}.head .full .text[data-v-2f11caa9]{-ms-flex-item-align:center;align-self:center;-webkit-box-flex:1;-ms-flex:1;flex:1;min-width:0;padding-left:12px;font-size:13px;color:#606266}.head .full .text .title[data-v-2f11caa9]{margin-bottom:10px;font-weight:500;font-size:16px;line-height:16px;color:rgba(0,0,0,.85)}.head .full .text .order-num[data-v-2f11caa9]{padding-top:10px;white-space:nowrap}.head .list[data-v-2f11caa9]{display:-webkit-box;display:-ms-flexbox;display:flex;margin-top:20px;overflow:hidden;list-style:none;padding:0}.head .list .item[data-v-2f11caa9]{-webkit-box-flex:0;-ms-flex:none;flex:none;width:200px;font-size:14px;line-height:14px;color:rgba(0,0,0,.85)}.head .list .item .title[data-v-2f11caa9]{margin-bottom:12px;font-size:13px;line-height:13px;color:#666}.head .list .item .value1[data-v-2f11caa9]{color:#f56022}.head .list .item .value2[data-v-2f11caa9]{color:#1bbe6b}.head .list .item .value3[data-v-2f11caa9]{color:#1890ff}.head .list .item .value4[data-v-2f11caa9]{color:#6a7b9d}.head .list .item .value5[data-v-2f11caa9]{color:#f5222d}.el-tabs--border-card[data-v-2f11caa9]{-webkit-box-shadow:none;box-shadow:none;border-bottom:none}.section[data-v-2f11caa9]{padding:20px 0 5px;border-bottom:1px dashed #eee}.section .title[data-v-2f11caa9]{padding-left:10px;border-left:3px solid #1890ff;font-size:15px;line-height:15px;color:#303133}.section .list[data-v-2f11caa9]{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;list-style:none;padding:0}.section .item[data-v-2f11caa9]{-webkit-box-flex:0;-ms-flex:0 0 33.33333%;flex:0 0 33.33333%;display:-webkit-box;display:-ms-flexbox;display:flex;margin-top:16px;font-size:13px;color:#606266}.section .item[data-v-2f11caa9]:nth-child(3n+1){padding-right:20px}.section .item[data-v-2f11caa9]:nth-child(3n+2){padding-right:10px;padding-left:10px}.section .item[data-v-2f11caa9]:nth-child(3n+3){padding-left:20px}.section .value[data-v-2f11caa9]{-webkit-box-flex:1;-ms-flex:1;flex:1}.section .value image[data-v-2f11caa9]{display:inline-block;width:40px;height:40px;margin:0 12px 12px 0;vertical-align:middle}.tab[data-v-2f11caa9]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.tab .el-image[data-v-2f11caa9]{width:36px;height:36px;margin-right:10px}[data-v-2f11caa9] .el-drawer__body{overflow:auto}.gary[data-v-2f11caa9]{color:#aaa}.logistics[data-v-2f11caa9]{-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:10px 0}.logistics .logistics_img[data-v-2f11caa9]{width:45px;height:45px;margin-right:12px}.logistics .logistics_img img[data-v-2f11caa9]{width:100%;height:100%}.logistics .logistics_cent span[data-v-2f11caa9]{display:block;font-size:12px}.tabBox_tit[data-v-2f11caa9]{width:53%;font-size:12px!important;margin:0 2px 0 10px;letter-spacing:1px;padding:5px 0;-webkit-box-sizing:border-box;box-sizing:border-box}.pictures[data-v-08282ec2]{max-width:100%}.area-desc[data-v-08282ec2]{margin:0;color:#999;font-size:12px}.selWidth[data-v-08282ec2]{width:300px}.spBlock[data-v-08282ec2]{cursor:pointer;display:block;padding:5px 0}.check[data-v-08282ec2]{color:#00a2d4}.el-dropdown-link[data-v-08282ec2]{cursor:pointer;color:#409eff;font-size:12px}.el-icon-arrow-down[data-v-08282ec2]{font-size:12px}.tabBox_tit[data-v-08282ec2]{width:53%;font-size:12px!important;margin:0 2px 0 10px;letter-spacing:1px;padding:5px 0;-webkit-box-sizing:border-box;box-sizing:border-box}[data-v-08282ec2] .row-bg .cell{color:red!important}.headTab[data-v-08282ec2]{position:relative}.headTab .headBtn[data-v-08282ec2]{position:absolute;right:0;top:-6px}.dropdown[data-v-08282ec2]{padding:0 10px;border:1px solid #409eff;margin-right:10px;line-height:28px;border-radius:4px}
|
1
public/mer/css/chunk-52201564.7cd77cdd.css
Normal file
1
public/mer/css/chunk-52201564.7cd77cdd.css
Normal file
@ -0,0 +1 @@
|
||||
.head[data-v-6e818cc8]{padding:30px 35px 25px}.head .full[data-v-6e818cc8]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.head .full .order_icon[data-v-6e818cc8]{width:60px;height:60px}.head .full .iconfont[data-v-6e818cc8]{color:#1890ff}.head .full .iconfont.sale-after[data-v-6e818cc8]{color:#90add5}.head .full .text[data-v-6e818cc8]{-ms-flex-item-align:center;align-self:center;-webkit-box-flex:1;-ms-flex:1;flex:1;min-width:0;padding-left:12px;font-size:13px;color:#606266}.head .full .text .title[data-v-6e818cc8]{margin-bottom:10px;font-weight:500;font-size:16px;line-height:16px;color:rgba(0,0,0,.85)}.head .full .text .order-num[data-v-6e818cc8]{padding-top:10px;white-space:nowrap}.head .list[data-v-6e818cc8]{display:-webkit-box;display:-ms-flexbox;display:flex;margin-top:20px;overflow:hidden;list-style:none;padding:0}.head .list .item[data-v-6e818cc8]{-webkit-box-flex:0;-ms-flex:none;flex:none;width:200px;font-size:14px;line-height:14px;color:rgba(0,0,0,.85)}.head .list .item .title[data-v-6e818cc8]{margin-bottom:12px;font-size:13px;line-height:13px;color:#666}.head .list .item .value1[data-v-6e818cc8]{color:#f56022}.head .list .item .value2[data-v-6e818cc8]{color:#1bbe6b}.head .list .item .value3[data-v-6e818cc8]{color:#1890ff}.head .list .item .value4[data-v-6e818cc8]{color:#6a7b9d}.head .list .item .value5[data-v-6e818cc8]{color:#f5222d}.el-tabs--border-card[data-v-6e818cc8]{-webkit-box-shadow:none;box-shadow:none;border-bottom:none}.section[data-v-6e818cc8]{padding:20px 0 5px;border-bottom:1px dashed #eee}.section .title[data-v-6e818cc8]{padding-left:10px;border-left:3px solid #1890ff;font-size:15px;line-height:15px;color:#303133}.section .list[data-v-6e818cc8]{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;list-style:none;padding:0}.section .item[data-v-6e818cc8]{-webkit-box-flex:0;-ms-flex:0 0 33.33333%;flex:0 0 33.33333%;display:-webkit-box;display:-ms-flexbox;display:flex;margin-top:16px;font-size:13px;color:#606266}.section .item[data-v-6e818cc8]:nth-child(3n+1){padding-right:20px}.section .item[data-v-6e818cc8]:nth-child(3n+2){padding-right:10px;padding-left:10px}.section .item[data-v-6e818cc8]:nth-child(3n+3){padding-left:20px}.section .value[data-v-6e818cc8]{-webkit-box-flex:1;-ms-flex:1;flex:1}.section .value image[data-v-6e818cc8]{display:inline-block;width:40px;height:40px;margin:0 12px 12px 0;vertical-align:middle}.tab[data-v-6e818cc8]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.tab .el-image[data-v-6e818cc8]{width:36px;height:36px;margin-right:10px}[data-v-6e818cc8] .el-drawer__body{overflow:auto}.gary[data-v-6e818cc8]{color:#aaa}.logistics[data-v-6e818cc8]{-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:10px 0}.logistics .logistics_img[data-v-6e818cc8]{width:45px;height:45px;margin-right:12px}.logistics .logistics_img img[data-v-6e818cc8]{width:100%;height:100%}.logistics .logistics_cent span[data-v-6e818cc8]{display:block;font-size:12px}.tabBox_tit[data-v-6e818cc8]{width:53%;font-size:12px!important;margin:0 2px 0 10px;letter-spacing:1px;padding:5px 0;-webkit-box-sizing:border-box;box-sizing:border-box}.pictures[data-v-08282ec2]{max-width:100%}.area-desc[data-v-08282ec2]{margin:0;color:#999;font-size:12px}.selWidth[data-v-08282ec2]{width:300px}.spBlock[data-v-08282ec2]{cursor:pointer;display:block;padding:5px 0}.check[data-v-08282ec2]{color:#00a2d4}.el-dropdown-link[data-v-08282ec2]{cursor:pointer;color:#409eff;font-size:12px}.el-icon-arrow-down[data-v-08282ec2]{font-size:12px}.tabBox_tit[data-v-08282ec2]{width:53%;font-size:12px!important;margin:0 2px 0 10px;letter-spacing:1px;padding:5px 0;-webkit-box-sizing:border-box;box-sizing:border-box}[data-v-08282ec2] .row-bg .cell{color:red!important}.headTab[data-v-08282ec2]{position:relative}.headTab .headBtn[data-v-08282ec2]{position:absolute;right:0;top:-6px}.dropdown[data-v-08282ec2]{padding:0 10px;border:1px solid #409eff;margin-right:10px;line-height:28px;border-radius:4px}
|
1
public/mer/css/chunk-bf22cff6.da4ed78d.css
Normal file
1
public/mer/css/chunk-bf22cff6.da4ed78d.css
Normal file
@ -0,0 +1 @@
|
||||
.head[data-v-343bb459]{padding:30px 35px 25px}.head .full[data-v-343bb459]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.head .full .order_icon[data-v-343bb459]{width:60px;height:60px}.head .full .iconfont[data-v-343bb459]{color:#1890ff}.head .full .iconfont.sale-after[data-v-343bb459]{color:#90add5}.head .full .text[data-v-343bb459]{-ms-flex-item-align:center;align-self:center;-webkit-box-flex:1;-ms-flex:1;flex:1;min-width:0;padding-left:12px;font-size:13px;color:#606266}.head .full .text .title[data-v-343bb459]{margin-bottom:10px;font-weight:500;font-size:16px;line-height:16px;color:rgba(0,0,0,.85)}.head .full .text .order-num[data-v-343bb459]{padding-top:10px;white-space:nowrap}.head .list[data-v-343bb459]{display:-webkit-box;display:-ms-flexbox;display:flex;margin-top:20px;overflow:hidden;list-style:none;padding:0}.head .list .item[data-v-343bb459]{-webkit-box-flex:0;-ms-flex:none;flex:none;width:200px;font-size:14px;line-height:14px;color:rgba(0,0,0,.85)}.head .list .item .title[data-v-343bb459]{margin-bottom:12px;font-size:13px;line-height:13px;color:#666}.head .list .item .value1[data-v-343bb459]{color:#f56022}.head .list .item .value2[data-v-343bb459]{color:#1bbe6b}.head .list .item .value3[data-v-343bb459]{color:#1890ff}.head .list .item .value4[data-v-343bb459]{color:#6a7b9d}.head .list .item .value5[data-v-343bb459]{color:#f5222d}.el-tabs--border-card[data-v-343bb459]{-webkit-box-shadow:none;box-shadow:none;border-bottom:none}.section[data-v-343bb459]{padding:20px 0 5px;border-bottom:1px dashed #eee}.section .title[data-v-343bb459]{padding-left:10px;border-left:3px solid #1890ff;font-size:15px;line-height:15px;color:#303133}.section .list[data-v-343bb459]{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;list-style:none;padding:0}.section .item[data-v-343bb459]{-webkit-box-flex:0;-ms-flex:0 0 33.33333%;flex:0 0 33.33333%;display:-webkit-box;display:-ms-flexbox;display:flex;margin-top:16px;font-size:13px;color:#606266}.section .item[data-v-343bb459]:nth-child(3n+1){padding-right:20px}.section .item[data-v-343bb459]:nth-child(3n+2){padding-right:10px;padding-left:10px}.section .item[data-v-343bb459]:nth-child(3n+3){padding-left:20px}.section .value[data-v-343bb459]{-webkit-box-flex:1;-ms-flex:1;flex:1}.section .value image[data-v-343bb459]{display:inline-block;width:40px;height:40px;margin:0 12px 12px 0;vertical-align:middle}.tab[data-v-343bb459]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.tab .el-image[data-v-343bb459]{width:36px;height:36px;margin-right:10px}[data-v-343bb459] .el-drawer__body{overflow:auto}.gary[data-v-343bb459]{color:#aaa}.logistics[data-v-343bb459]{-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:10px 0}.logistics .logistics_img[data-v-343bb459]{width:45px;height:45px;margin-right:12px}.logistics .logistics_img img[data-v-343bb459]{width:100%;height:100%}.logistics .logistics_cent span[data-v-343bb459]{display:block;font-size:12px}.tabBox_tit[data-v-343bb459]{width:53%;font-size:12px!important;margin:0 2px 0 10px;letter-spacing:1px;padding:5px 0;-webkit-box-sizing:border-box;box-sizing:border-box}.pictures[data-v-889b05f8]{max-width:100%}.area-desc[data-v-889b05f8]{margin:0;color:#999;font-size:12px}.selWidth[data-v-889b05f8]{width:300px}.spBlock[data-v-889b05f8]{cursor:pointer;display:block;padding:5px 0}.check[data-v-889b05f8]{color:#00a2d4}.el-dropdown-link[data-v-889b05f8]{cursor:pointer;color:#409eff;font-size:12px}.el-icon-arrow-down[data-v-889b05f8]{font-size:12px}.tabBox_tit[data-v-889b05f8]{width:53%;font-size:12px!important;margin:0 2px 0 10px;letter-spacing:1px;padding:5px 0;-webkit-box-sizing:border-box;box-sizing:border-box}[data-v-889b05f8] .row-bg .cell{color:red!important}.headTab[data-v-889b05f8]{position:relative}.headTab .headBtn[data-v-889b05f8]{position:absolute;right:0;top:-6px}.dropdown[data-v-889b05f8]{padding:0 10px;border:1px solid #409eff;margin-right:10px;line-height:28px;border-radius:4px}
|
1
public/mer/css/chunk-commons.38f13325.css
Normal file
1
public/mer/css/chunk-commons.38f13325.css
Normal file
@ -0,0 +1 @@
|
||||
[data-v-2f8b624e] .selWidth{width:300px!important}.guarantee_info[data-v-2f8b624e]{display:block}[data-v-2f8b624e] .el-checkbox__input{vertical-align:top;top:3px}[data-v-2f8b624e] .el-checkbox__label{white-space:normal;word-break:break-all}.guarantee_name[data-v-2f8b624e]{font-weight:700;color:#333}.goods_detail .goods_detail_wrapper[data-v-4b4440b0]{z-index:200;position:absolute;left:50%;top:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);width:375px;background:#f0f2f5}.goods_detail .goods_detail_wrapper.on[data-v-4b4440b0]{position:fixed}.title[data-v-e85deb2a]{margin-bottom:16px;color:#17233d;font-weight:500;font-size:14px}.description-term[data-v-e85deb2a]{display:table-cell;padding-bottom:10px;line-height:20px;width:50%;font-size:12px}.title[data-v-96d4296a]{margin-bottom:16px;color:#17233d;font-weight:500;font-size:14px}.description-term[data-v-96d4296a]{display:table-cell;padding-bottom:10px;line-height:20px;width:50%;font-size:12px}.ivu-mb[data-v-058ef87a]{width:19%}.one[data-v-058ef87a]{background:#e4ecff}.two[data-v-058ef87a]{background:#fff3e0}.three[data-v-058ef87a]{background:#eaf9e1}.four[data-v-058ef87a]{background:#ffeaf4}.five[data-v-058ef87a]{background:#f1e4ff}.one1[data-v-058ef87a]{background:#4d7cfe}.two1[data-v-058ef87a]{background:#ffab2b}.three1[data-v-058ef87a]{background:#6dd230}.four1[data-v-058ef87a]{background:#ff85c0}.five1[data-v-058ef87a]{background:#b37feb}.card_box[data-v-058ef87a]{width:100%;height:100%;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:25px;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:4px;background:#f5f7f9}.card_box .card_box_cir[data-v-058ef87a]{width:60px;height:60px;overflow:hidden;margin-right:20px}.card_box .card_box_cir .card_box_cir1[data-v-058ef87a],.card_box .card_box_cir[data-v-058ef87a]{border-radius:50%;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.card_box .card_box_cir .card_box_cir1[data-v-058ef87a]{width:48px;height:48px;color:#fff}.card_box .card_box_txt .sp1[data-v-058ef87a]{display:block;color:#252631;font-size:24px;line-height:37px}.card_box .card_box_txt .sp2[data-v-058ef87a]{display:block;color:#98a9bc;font-size:12px}
|
@ -1 +0,0 @@
|
||||
[data-v-2f8b624e] .selWidth{width:300px!important}.guarantee_info[data-v-2f8b624e]{display:block}[data-v-2f8b624e] .el-checkbox__input{vertical-align:top;top:3px}[data-v-2f8b624e] .el-checkbox__label{white-space:normal;word-break:break-all}.guarantee_name[data-v-2f8b624e]{font-weight:700;color:#333}.goods_detail .goods_detail_wrapper[data-v-4b4440b0]{z-index:200;position:absolute;left:50%;top:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);width:375px;background:#f0f2f5}.goods_detail .goods_detail_wrapper.on[data-v-4b4440b0]{position:fixed}.title[data-v-e85deb2a]{margin-bottom:16px;color:#17233d;font-weight:500;font-size:14px}.description-term[data-v-e85deb2a]{display:table-cell;padding-bottom:10px;line-height:20px;width:50%;font-size:12px}.ivu-mb[data-v-058ef87a]{width:19%}.one[data-v-058ef87a]{background:#e4ecff}.two[data-v-058ef87a]{background:#fff3e0}.three[data-v-058ef87a]{background:#eaf9e1}.four[data-v-058ef87a]{background:#ffeaf4}.five[data-v-058ef87a]{background:#f1e4ff}.one1[data-v-058ef87a]{background:#4d7cfe}.two1[data-v-058ef87a]{background:#ffab2b}.three1[data-v-058ef87a]{background:#6dd230}.four1[data-v-058ef87a]{background:#ff85c0}.five1[data-v-058ef87a]{background:#b37feb}.card_box[data-v-058ef87a]{width:100%;height:100%;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:25px;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:4px;background:#f5f7f9}.card_box .card_box_cir[data-v-058ef87a]{width:60px;height:60px;overflow:hidden;margin-right:20px}.card_box .card_box_cir .card_box_cir1[data-v-058ef87a],.card_box .card_box_cir[data-v-058ef87a]{border-radius:50%;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.card_box .card_box_cir .card_box_cir1[data-v-058ef87a]{width:48px;height:48px;color:#fff}.card_box .card_box_txt .sp1[data-v-058ef87a]{display:block;color:#252631;font-size:24px;line-height:37px}.card_box .card_box_txt .sp2[data-v-058ef87a]{display:block;color:#98a9bc;font-size:12px}
|
1
public/mer/css/chunk-f139cc3c.d0e09c27.css
Normal file
1
public/mer/css/chunk-f139cc3c.d0e09c27.css
Normal file
@ -0,0 +1 @@
|
||||
.selWidth[data-v-4c2bfa98]{width:330px}.title[data-v-4c2bfa98]{margin-bottom:16px;color:#17233d;font-weight:500;font-size:14px}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/mer/js/chunk-09296115.dd430f92.js
Normal file
1
public/mer/js/chunk-09296115.dd430f92.js
Normal file
File diff suppressed because one or more lines are too long
1
public/mer/js/chunk-09559b9c.1c30888e.js
Normal file
1
public/mer/js/chunk-09559b9c.1c30888e.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user