Merge remote-tracking branch 'origin/main' into dev
This commit is contained in:
commit
130e736cae
@ -37,7 +37,8 @@ class LoginController extends BaseAdminController
|
||||
*/
|
||||
public function account()
|
||||
{
|
||||
$params = (new LoginValidate())->post()->goCheck();
|
||||
$params = $this->request->post();
|
||||
// $params = (new LoginValidate())->post()->goCheck();
|
||||
return $this->data((new LoginLogic())->login($params));
|
||||
}
|
||||
|
||||
|
62
app/api/controller/DataController.php
Normal file
62
app/api/controller/DataController.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\model\store_branch_product\StoreBranchProduct;
|
||||
use app\common\model\store_category\StoreCategory;
|
||||
use think\facade\Db;
|
||||
class DataController extends BaseApiController
|
||||
{
|
||||
public $notNeedLogin = ['index', 'app_update', 'test','show'];
|
||||
|
||||
public static function updateGoodsclass($cate_id, $store_id = 0, $type = 0)
|
||||
{
|
||||
$one = StoreCategory::where('id', $cate_id)->find();
|
||||
if ($one) {
|
||||
//查二级分类
|
||||
$two = StoreCategory::where('id', $one['pid'])->find();
|
||||
if ($two) {
|
||||
if ($two['pid'] != 0) {
|
||||
self::cate_update($cate_id, $two['id'], $store_id, 3);
|
||||
self::cate_update($two['id'], $two['pid'], $store_id, 2);
|
||||
self::cate_update($two['pid'], 0, $store_id, 1);
|
||||
} else {
|
||||
if ($one['pid'] == 0) {
|
||||
self::cate_update($one['id'], 0, $store_id, 1);
|
||||
} else {
|
||||
self::cate_update($one['id'], $one['pid'], $store_id, 2);
|
||||
self::cate_update($one['pid'], 0, $store_id, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function cate_update($cate_id = 0, $pid = 0, $store_id = 0, $level = 1)
|
||||
{
|
||||
$find = Db::name('store_product_cate')->where(['store_id' => $store_id, 'cate_id' => $cate_id, 'level' => $level])->find();
|
||||
if ($find) {
|
||||
Db::name('store_product_cate')->where('id', $find['id'])->inc('count', 1)->update();
|
||||
} else {
|
||||
Db::name('store_product_cate')->insert(['pid' => $pid, 'store_id' => $store_id, 'cate_id' => $cate_id, 'count' => 1, 'level' => $level, 'create_time' => time(), 'update_time' => time()]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function show()
|
||||
{
|
||||
//处理分类缺失
|
||||
$store_id = 23;
|
||||
$data = StoreBranchProduct::where('store_id', $store_id)
|
||||
->field('cate_id,store_id')
|
||||
->select()->toArray();
|
||||
foreach ($data as $value){
|
||||
self::updateGoodsclass($value['cate_id'], $value['store_id']);
|
||||
}
|
||||
|
||||
d($data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
1368
app/api/controller/LiuController.php
Normal file
1368
app/api/controller/LiuController.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -36,6 +36,10 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L
|
||||
'=' => ['store_id', 'cate_id'],
|
||||
'%pipe_like%' => ['store_name' => 'store_name|bar_code'],
|
||||
];
|
||||
return [
|
||||
'=' => ['store_id', 'cate_id'],
|
||||
'%pipe_like%' => ['store_name' => 'store_name|bar_code'],
|
||||
];
|
||||
}
|
||||
/**
|
||||
* @notes 设置支持排序字段
|
||||
|
@ -68,6 +68,8 @@ class AddressLogic extends BaseLogic
|
||||
'phone' => $params['phone'],
|
||||
'detail' => $params['detail']??'',
|
||||
'is_default' => $params['is_default']??0,
|
||||
'detail' => $params['detail']??'',
|
||||
'is_default' => $params['is_default']??0,
|
||||
'province' => $params['province'],
|
||||
'city' => $params['city'],
|
||||
'area' => $params['area'],
|
||||
|
@ -279,6 +279,8 @@ class PayNotifyLogic extends BaseLogic
|
||||
$user = User::where('id', $order['uid'])->findOrEmpty();
|
||||
$capitalFlowDao = new CapitalFlowLogic($user);
|
||||
$deal_money = bcdiv($extra['amount']['refund'], 100, 2);
|
||||
if (in_array($order['pay_type'], [PayEnum::BALANCE_PAY, PayEnum::PURCHASE_FUNDS])) {
|
||||
if ($order['pay_type'] == PayEnum::BALANCE_PAY) { //用户余额
|
||||
if (in_array($order['pay_type'], [PayEnum::BALANCE_PAY, PayEnum::PURCHASE_FUNDS])) {
|
||||
if ($order['pay_type'] == PayEnum::BALANCE_PAY) { //用户余额
|
||||
$user->now_money = bcadd($user->now_money, $deal_money, 2);
|
||||
@ -288,6 +290,7 @@ class PayNotifyLogic extends BaseLogic
|
||||
//退款
|
||||
$capitalFlowDao->userIncome('system_balance_back', 'system_back', $order['id'], $deal_money);
|
||||
}
|
||||
if ($order['pay_type'] == PayEnum::PURCHASE_FUNDS) { //采购款
|
||||
if ($order['pay_type'] == PayEnum::PURCHASE_FUNDS) { //采购款
|
||||
$user->purchase_funds = bcadd($user->purchase_funds, $deal_money, 2);
|
||||
$user->save();
|
||||
@ -353,6 +356,7 @@ class PayNotifyLogic extends BaseLogic
|
||||
//日志记录
|
||||
$model = new StoreCashFinanceFlow();
|
||||
$model->store_id = $order['store_id'] ?? 0;
|
||||
$model->store_id = $order['store_id'] ?? 0;
|
||||
$model->cash_price = $order->pay_price;
|
||||
$model->receivable = $order->pay_price;
|
||||
$model->remark = '退款';
|
||||
@ -936,6 +940,7 @@ class PayNotifyLogic extends BaseLogic
|
||||
'id' => $StoreBranchProduct['id'],
|
||||
'stock' => $StoreBranchProduct['stock'] + $v['cart_num'],
|
||||
// 'sales' => ['inc', $v['cart_num']]
|
||||
// 'sales' => ['inc', $v['cart_num']]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ use app\common\model\user_recharge\UserRecharge;
|
||||
use app\common\service\ConfigService;
|
||||
use app\common\service\FileService;
|
||||
use app\statistics\logic\OrderLogic;
|
||||
use app\statistics\logic\OrderLogic;
|
||||
|
||||
|
||||
/**
|
||||
@ -101,6 +102,7 @@ class WorkbenchLogic extends BaseLogic
|
||||
$i++;
|
||||
}
|
||||
$field = 'from_unixtime(pay_time,"%H") as pay_time,sum(pay_price) as pay_price';
|
||||
$recharge_field = 'from_unixtime(pay_time,"%H") as pay_time,sum(price) as pay_price';
|
||||
} elseif ($dateDiff->days <= 31) {
|
||||
$group = 'DAY(pay_time)';
|
||||
$i = 0;
|
||||
@ -109,6 +111,7 @@ class WorkbenchLogic extends BaseLogic
|
||||
$i++;
|
||||
}
|
||||
$field = 'from_unixtime(pay_time,"%m-%d") as pay_time,sum(pay_price) as pay_price';
|
||||
$recharge_field = 'from_unixtime(pay_time,"%m-%d") as pay_time,sum(price) as pay_price';
|
||||
} else {
|
||||
$group = 'MONTH(pay_time)';
|
||||
$i = 0;
|
||||
@ -127,7 +130,27 @@ class WorkbenchLogic extends BaseLogic
|
||||
$i++;
|
||||
}
|
||||
$field = 'from_unixtime(pay_time,"%Y-%m") as pay_time,sum(pay_price) as pay_price';
|
||||
$recharge_field = 'from_unixtime(pay_time,"%Y-%m") as pay_time,sum(price) as pay_price';
|
||||
}
|
||||
$data['order_list'] = StoreOrder::with('user')->where($where)
|
||||
->whereBetweenTime('pay_time', $startTime, $endTime)
|
||||
->order('pay_time', 'desc')
|
||||
->limit(6)
|
||||
->select()->each(function($item){
|
||||
$item->pay_time=$item->pay_time>0?date('Y-m-d H:i:s',$item->pay_time):'';
|
||||
})
|
||||
->toArray();
|
||||
|
||||
//取消单个店铺搜索
|
||||
unset($where['store_id']);
|
||||
|
||||
$rechargeList = UserRecharge::field($recharge_field)
|
||||
->where(['paid'=>1])
|
||||
->whereBetweenTime('pay_time', $startTime, $endTime)
|
||||
->group($group)
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
$orderList = StoreOrder::field($field)
|
||||
->where($where)
|
||||
->whereBetweenTime('pay_time', $startTime, $endTime)
|
||||
@ -145,6 +168,7 @@ class WorkbenchLogic extends BaseLogic
|
||||
$orderListTmp = [];
|
||||
$userListTmp = [];
|
||||
$range = [];
|
||||
$mergedListTmp = [];
|
||||
foreach ($timeRange as $item) {
|
||||
$range[] = $item;
|
||||
if (!isset($orderList[$item])) {
|
||||
@ -157,22 +181,29 @@ class WorkbenchLogic extends BaseLogic
|
||||
} else {
|
||||
$userListTmp[$item] = $userList[$item]['user_num'];
|
||||
}
|
||||
|
||||
// 处理 $rechargeList 和 $orderList 的相加
|
||||
$mergedListTmp[$item] = 0;
|
||||
foreach ($rechargeList as $recharge) {
|
||||
if ($recharge['pay_time'] == $item) {
|
||||
$mergedListTmp[$item] += $recharge['pay_price'];
|
||||
}
|
||||
}
|
||||
foreach ($orderList as $order) {
|
||||
if ($order['pay_time'] == $item) {
|
||||
$mergedListTmp[$item] += $order['pay_price'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$data['statistics'] = [
|
||||
'range' => $range,
|
||||
'data' => [
|
||||
'order_amount' => array_values($orderListTmp),
|
||||
'user_number' => array_values($userListTmp)
|
||||
// 'order_amount' => array_values($orderListTmp),
|
||||
'user_number' => array_values($userListTmp),
|
||||
'order_amount' => array_values($mergedListTmp)
|
||||
]
|
||||
];
|
||||
$data['order_list'] = StoreOrder::with('user')->where($where)
|
||||
->whereBetweenTime('pay_time', $startTime, $endTime)
|
||||
->order('pay_time', 'desc')
|
||||
->limit(6)
|
||||
->select()->each(function($item){
|
||||
$item->pay_time=$item->pay_time>0?date('Y-m-d H:i:s',$item->pay_time):'';
|
||||
})
|
||||
->toArray();
|
||||
|
||||
$data['pay_type'] = [
|
||||
['name' => '线上收银订单', 'value' => bcsub($data['order_amount'], bcadd($data['verify_amount'], $data['cash_amount'], 2), 2)],
|
||||
['name' => '核销订单', 'value' => $data['verify_amount']],
|
||||
|
0
nginx.htaccess
Normal file
0
nginx.htaccess
Normal file
Loading…
x
Reference in New Issue
Block a user