commit
c47efccc3f
4
.gitignore
vendored
4
.gitignore
vendored
@ -4,4 +4,6 @@
|
||||
.env
|
||||
/tests/tmp
|
||||
/tests/.phpunit.result.cache
|
||||
public/uploads
|
||||
public/uploads
|
||||
public/image/barcode
|
||||
public/image
|
@ -704,8 +704,8 @@ class WorkbenchController extends BaseAdminController
|
||||
]
|
||||
],
|
||||
"month" => [
|
||||
WorkbenchLogic::month_order_count($dates_two,'本月订单数'),
|
||||
WorkbenchLogic::month_order_count($dates_two,'本月支付人数')
|
||||
WorkbenchLogic::month_order_count('本月订单数'),
|
||||
WorkbenchLogic::month_order_count('本月支付人数')
|
||||
]
|
||||
]
|
||||
];
|
||||
|
@ -0,0 +1,136 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\financial_transfers;
|
||||
|
||||
|
||||
use app\admin\controller\BaseAdminController;
|
||||
use app\admin\lists\financial_transfers\FinancialTransfersLists;
|
||||
use app\admin\logic\financial_transfers\FinancialTransfersLogic;
|
||||
use app\admin\validate\financial_transfers\FinancialTransfersValidate;
|
||||
|
||||
|
||||
/**
|
||||
* FinancialTransfers控制器
|
||||
* Class FinancialTransfersController
|
||||
* @package app\admin\controller\financial_transfers
|
||||
*/
|
||||
class FinancialTransfersController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2024/06/14 10:10
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new FinancialTransfersLists());
|
||||
}
|
||||
|
||||
//确认
|
||||
public function send_transfers()
|
||||
{
|
||||
$params = (new FinancialTransfersValidate())->post()->goCheck('send');
|
||||
$result = FinancialTransfersLogic::dealsend($params);
|
||||
|
||||
if (true === $result) {
|
||||
return $this->success('发送成功', [],1,1 );
|
||||
}
|
||||
return $this->fail(FinancialTransfersLogic::getError());
|
||||
|
||||
}
|
||||
|
||||
//财务上传凭证
|
||||
public function success_send()
|
||||
{
|
||||
$params = (new FinancialTransfersValidate())->post()->goCheck('success');
|
||||
$update = [
|
||||
'transfer_picture'=>$params['transfer_picture']
|
||||
];
|
||||
$update['status'] = -1;
|
||||
if($params['status']){
|
||||
$update['status'] = 3;
|
||||
$update['pay_status'] = 1;
|
||||
}
|
||||
$update['fail_msg'] = $params['fail_msg']??'';
|
||||
$result = FinancialTransfersLogic::dealchange($update,$params['id']);
|
||||
|
||||
if (true === $result) {
|
||||
return $this->success('转账成功',[],1,1);
|
||||
}
|
||||
return $this->fail(FinancialTransfersLogic::getError());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2024/06/14 10:10
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new FinancialTransfersValidate())->post()->goCheck('add');
|
||||
$result = FinancialTransfersLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(FinancialTransfersLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2024/06/14 10:10
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new FinancialTransfersValidate())->post()->goCheck('edit');
|
||||
$result = FinancialTransfersLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(FinancialTransfersLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2024/06/14 10:10
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new FinancialTransfersValidate())->post()->goCheck('delete');
|
||||
FinancialTransfersLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2024/06/14 10:10
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new FinancialTransfersValidate())->goCheck('detail');
|
||||
$result = FinancialTransfersLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -5,6 +5,7 @@ namespace app\admin\controller\store_branch_product;
|
||||
|
||||
use app\admin\controller\BaseAdminController;
|
||||
use app\admin\lists\store_branch_product\StoreBranchProductLists;
|
||||
use app\admin\lists\store_branch_product_exchange\StoreBranchProductExchangeLists;
|
||||
use app\admin\logic\store_branch_product\StoreBranchProductLogic;
|
||||
use app\admin\logic\store_product\StoreProductLogic;
|
||||
use app\admin\validate\store_product\StoreProductValidate;
|
||||
@ -27,7 +28,11 @@ class StoreBranchProductController extends BaseAdminController
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new StoreBranchProductLists());
|
||||
if($this->request->get('exchange',0)==1){
|
||||
return $this->dataLists(new StoreBranchProductExchangeLists());
|
||||
}else{
|
||||
return $this->dataLists(new StoreBranchProductLists());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -98,15 +98,16 @@ class StoreProductController extends BaseAdminController
|
||||
{
|
||||
$product_arr = $this->request->post('product_arr');
|
||||
$store_arr = $this->request->post('store_arr');
|
||||
$stock_type = $this->request->post('stock_type',1);
|
||||
if (count($store_arr) == 1) {
|
||||
$store_id = $store_arr[0];
|
||||
foreach ($product_arr as $key => $arr) {
|
||||
Redis::send('store-storage', ['product_arr' => $arr, 'store_id' => $store_id, 'admin_id' => $this->adminId]);
|
||||
Redis::send('store-storage', ['product_arr' => $arr, 'store_id' => $store_id,'stock_type'=>$stock_type, 'admin_id' => $this->adminId]);
|
||||
}
|
||||
} else {
|
||||
foreach ($product_arr as $key => $arr) {
|
||||
foreach ($store_arr as $k => $store_id) {
|
||||
Redis::send('store-storage', ['product_arr' => $arr, 'store_id' => $store_id, 'admin_id' => $this->adminId]);
|
||||
Redis::send('store-storage', ['product_arr' => $arr, 'store_id' => $store_id,'stock_type'=>$stock_type, 'admin_id' => $this->adminId]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,8 @@ class UserController extends BaseAdminController
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new UserValidate())->post()->goCheck('edit');
|
||||
// $params = (new UserValidate())->post()->goCheck('edit');
|
||||
$params = $this->request->post();
|
||||
$result = UserLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
|
95
app/admin/controller/user_label/UserLabelController.php
Normal file
95
app/admin/controller/user_label/UserLabelController.php
Normal file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\user_label;
|
||||
|
||||
|
||||
use app\admin\controller\BaseAdminController;
|
||||
use app\admin\lists\user_label\UserLabelLists;
|
||||
use app\admin\logic\user_label\UserLabelLogic;
|
||||
use app\admin\validate\user_label\UserLabelValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 用户标签控制器
|
||||
* Class UserLabelController
|
||||
* @package app\admin\controller\user_label
|
||||
*/
|
||||
class UserLabelController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取用户标签列表
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2024/06/17 17:02
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new UserLabelLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加用户标签
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2024/06/17 17:02
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new UserLabelValidate())->post()->goCheck('add');
|
||||
$result = UserLabelLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(UserLabelLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑用户标签
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2024/06/17 17:02
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new UserLabelValidate())->post()->goCheck('edit');
|
||||
$result = UserLabelLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(UserLabelLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除用户标签
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2024/06/17 17:02
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new UserLabelValidate())->post()->goCheck('delete');
|
||||
UserLabelLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取用户标签详情
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2024/06/17 17:02
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new UserLabelValidate())->goCheck('detail');
|
||||
$result = UserLabelLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\lists\financial_transfers;
|
||||
|
||||
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\model\financial_transfers\FinancialTransfers;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* FinancialTransfers列表
|
||||
* Class FinancialTransfersLists
|
||||
* @package app\admin\listsfinancial_transfers
|
||||
*/
|
||||
class FinancialTransfersLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author admin
|
||||
* @date 2024/06/14 10:10
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['store_id', 'admin_id', 'uid', 'status', 'initiation_time', 'confirmation_time', 'mark', 'money', 'remark_time','create_time'],
|
||||
'between_time' => 'create_time',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author admin
|
||||
* @date 2024/06/14 10:10
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$data = FinancialTransfers::with(['store','staff','admin'])->where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
foreach ($data as &$value){
|
||||
if($value['initiation_time']){
|
||||
$value['initiation_time'] = date('Y-m-d H:i:s',$value['initiation_time']);
|
||||
}
|
||||
|
||||
if($value['confirmation_time']){
|
||||
$value['confirmation_time'] = date('Y-m-d H:i:s',$value['confirmation_time']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author admin
|
||||
* @date 2024/06/14 10:10
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return FinancialTransfers::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\lists\store_branch_product_exchange;
|
||||
|
||||
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\model\cate\Cate;
|
||||
use app\common\model\store_category\StoreCategory;
|
||||
use app\common\model\store_product_unit\StoreProductUnit;
|
||||
use app\common\model\system_store\SystemStore;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\store_branch_product_exchange\StoreBranchProductExchange;
|
||||
|
||||
/**
|
||||
* 门店商品辅助表
|
||||
* Class StoreBranchProductLists
|
||||
* @package app\admin\listssystem_store
|
||||
*/
|
||||
class StoreBranchProductExchangeLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author admin
|
||||
* @date 2024/05/31 17:45
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['product_id', 'cate_id','store_id','status'],
|
||||
'%pipe_like%' => ['store_name_code'=>'store_name|bar_code'],
|
||||
'%like%' => ['store_name'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取门店列表列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author admin
|
||||
* @date 2024/05/31 17:45
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$status = $this->params['status'] ?? '';
|
||||
$class_all=$this->request->get('class_all');
|
||||
$where=[];
|
||||
if($class_all){
|
||||
$arr=Cate::where('pid',$class_all)->column('id');
|
||||
if($arr){
|
||||
$arr2=Cate::where('pid','in',$arr)->column('id');
|
||||
$where[]=['cate_id','in',array_merge($arr,$arr2)];
|
||||
}
|
||||
}
|
||||
return StoreBranchProductExchange::where($this->searchWhere)->where($where)
|
||||
->field(['id','store_id','product_id', 'image', 'store_name', 'cate_id', 'price', 'sales', 'stock', 'unit', 'cost', 'status'])
|
||||
->when(!empty($this->adminInfo['store_id']), function ($query) {
|
||||
$query->where('store_id', $this->adminInfo['store_id']);
|
||||
})
|
||||
->when(!empty($status), function ($query) use ($status) {
|
||||
if ($status == 1) {
|
||||
$query->where('status', $status);
|
||||
} elseif ($status == 2) {
|
||||
$query->where('status', 0);
|
||||
} elseif ($status == 3) {
|
||||
$query->where('stock', '<=', 0);
|
||||
} elseif ($status == 4) {
|
||||
$query->where('stock', '<', 10)->where('stock', '>', 0);
|
||||
}
|
||||
})
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['sort' => 'desc','stock'=>'desc','id' => 'desc'])
|
||||
->select()
|
||||
->each(function ($item) {
|
||||
$item['system_store_name']=SystemStore::where('id',$item['store_id'])->value('name');
|
||||
$item['unit_name'] = StoreProductUnit::where('id', $item['unit'])->value('name');
|
||||
$item['cate_name'] = StoreCategory::where('id', $item['cate_id'])->value('name');
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取门店列表数量
|
||||
* @return int
|
||||
* @author admin
|
||||
* @date 2024/05/31 17:45
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$status = $this->params['status'] ?? '';
|
||||
$class_all=$this->request->get('class_all');
|
||||
$where=[];
|
||||
if($class_all){
|
||||
$arr=Cate::where('pid',$class_all)->column('id');
|
||||
if($arr){
|
||||
$arr2=Cate::where('pid','in',$arr)->column('id');
|
||||
$where[]=['cate_id','in',array_merge($arr,$arr2)];
|
||||
}
|
||||
}
|
||||
return StoreBranchProductExchange::where($this->searchWhere)->where($where)
|
||||
->when(!empty($this->adminInfo['store_id']), function ($query) {
|
||||
$query->where('store_id', $this->adminInfo['store_id']);
|
||||
})
|
||||
->when(!empty($status), function ($query) use ($status) {
|
||||
if ($status == 1) {
|
||||
$query->where('status', $status);
|
||||
} elseif ($status == 2) {
|
||||
$query->where('status', 0);
|
||||
} elseif ($status == 3) {
|
||||
$query->where('stock', '<=', 0);
|
||||
} elseif ($status == 4) {
|
||||
$query->where('stock', '<', 10)->where('stock', '>', 0);
|
||||
}
|
||||
})
|
||||
->count();
|
||||
}
|
||||
|
||||
}
|
@ -4,6 +4,7 @@ namespace app\admin\lists\store_branch_product;
|
||||
|
||||
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\model\cate\Cate;
|
||||
use app\common\model\store_category\StoreCategory;
|
||||
use app\common\model\store_product_unit\StoreProductUnit;
|
||||
use app\common\model\system_store\SystemStore;
|
||||
@ -47,8 +48,22 @@ class StoreBranchProductLists extends BaseAdminDataLists implements ListsSearchI
|
||||
public function lists(): array
|
||||
{
|
||||
$status = $this->params['status'] ?? '';
|
||||
return StoreBranchProduct::where($this->searchWhere)
|
||||
->field(['id','store_id','product_id', 'image', 'store_name', 'cate_id', 'price', 'sales', 'stock', 'unit', 'cost', 'status'])
|
||||
$class_all=$this->request->get('class_all');
|
||||
$where=[];
|
||||
if($class_all){
|
||||
$arr=Cate::where('pid',$class_all)->column('id');
|
||||
if($arr){
|
||||
$arr2=Cate::where('pid','in',$arr)->column('id');
|
||||
$where[]=['cate_id','in',array_merge($arr,$arr2)];
|
||||
}
|
||||
}
|
||||
if(empty($where) && $class_all){
|
||||
//2或者1
|
||||
$where[]=['cate_id','=',$class_all];
|
||||
}
|
||||
|
||||
return StoreBranchProduct::where($this->searchWhere)->where($where)
|
||||
->field(['id','store_id','product_id', 'image', 'store_name', 'cate_id', 'price', 'sales', 'stock', 'unit', 'cost','purchase', 'status'])
|
||||
->when(!empty($this->adminInfo['store_id']), function ($query) {
|
||||
$query->where('store_id', $this->adminInfo['store_id']);
|
||||
})
|
||||
@ -85,7 +100,16 @@ class StoreBranchProductLists extends BaseAdminDataLists implements ListsSearchI
|
||||
public function count(): int
|
||||
{
|
||||
$status = $this->params['status'] ?? '';
|
||||
return StoreBranchProduct::where($this->searchWhere)
|
||||
$class_all=$this->request->get('class_all');
|
||||
$where=[];
|
||||
if($class_all){
|
||||
$arr=Cate::where('pid',$class_all)->column('id');
|
||||
if($arr){
|
||||
$arr2=Cate::where('pid','in',$arr)->column('id');
|
||||
$where[]=['cate_id','in',array_merge($arr,$arr2)];
|
||||
}
|
||||
}
|
||||
return StoreBranchProduct::where($this->searchWhere)->where($where)
|
||||
->when(!empty($this->adminInfo['store_id']), function ($query) {
|
||||
$query->where('store_id', $this->adminInfo['store_id']);
|
||||
})
|
||||
|
@ -33,6 +33,7 @@ class StoreFinanceFlowLists extends BaseAdminDataLists implements ListsSearchInt
|
||||
return [
|
||||
'=' => ['store_id', 'user_id', 'create_time', 'staff_id'],
|
||||
'between_time'=>'create_time',
|
||||
'%pipe_like%' => ['keyword'=>'order_sn'],
|
||||
];
|
||||
}
|
||||
|
||||
@ -63,13 +64,14 @@ class StoreFinanceFlowLists extends BaseAdminDataLists implements ListsSearchInt
|
||||
}
|
||||
if ($item['financial_pm'] == 0) {
|
||||
$item['number'] = '-' . $item['number'];
|
||||
$item['financial_type_name'] = '订单支出:'.OrderEnum::getFinancialType($item['financial_type']);
|
||||
} else {
|
||||
$item['financial_type_name'] = OrderEnum::getFinancialType($item['financial_type']).'获得';
|
||||
$item['number'] = '+' . $item['number'];
|
||||
}
|
||||
$item['staff_name'] = SystemStoreStaff::where('id', $item['staff_id'])->value('staff_name');
|
||||
$item['store_name'] = $item['store_id'] > 0 ? SystemStore::where('id', $item['store_id'])->value('name') : '';
|
||||
$item['pay_type_name'] = PayEnum::getPaySceneDesc($item['pay_type']);
|
||||
$item['financial_type_name'] = OrderEnum::getFinancialType($item['financial_type']);
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa
|
||||
public function lists(): array
|
||||
{
|
||||
return StoreProduct::where($this->searchWhere)
|
||||
->field(['id', 'image', 'store_name', 'cate_id', 'price','vip_price','sales', 'stock', 'is_show', 'unit', 'cost','rose','purchase','bar_code'])
|
||||
->field(['id', 'image', 'store_name','swap', 'cate_id','batch', 'price','vip_price','sales', 'stock', 'is_show', 'unit', 'cost','rose','purchase','bar_code'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($item) {
|
||||
|
@ -44,7 +44,9 @@ class SystemStoreLists extends BaseAdminDataLists implements ListsSearchInterfac
|
||||
public function lists(): array
|
||||
{
|
||||
return SystemStore::where($this->searchWhere)
|
||||
->field(['id', 'name', 'phone', 'detailed_address', 'image', 'is_show','day_start','day_end'])
|
||||
->field(['id', 'name', 'phone', 'detailed_address', 'image', 'is_show','day_start','day_end'
|
||||
,'bank','bank_code','bank_address','realname'
|
||||
])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($item){
|
||||
|
@ -29,7 +29,7 @@ class SystemStoreStorageLists extends BaseAdminDataLists implements ListsSearchI
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['store_id', 'admin_id', 'staff_id', 'status'],
|
||||
'=' => ['store_id', 'admin_id', 'staff_id', 'status','type'],
|
||||
];
|
||||
}
|
||||
|
||||
|
65
app/admin/lists/user_label/UserLabelLists.php
Normal file
65
app/admin/lists/user_label/UserLabelLists.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\lists\user_label;
|
||||
|
||||
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\model\user_label\UserLabel;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* 用户标签列表
|
||||
* Class UserLabelLists
|
||||
* @package app\admin\listsuser_label
|
||||
*/
|
||||
class UserLabelLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author admin
|
||||
* @date 2024/06/17 17:02
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['label_name'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取用户标签列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author admin
|
||||
* @date 2024/06/17 17:02
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return UserLabel::where($this->searchWhere)
|
||||
->field(['label_id', 'label_name'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['label_id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取用户标签数量
|
||||
* @return int
|
||||
* @author admin
|
||||
* @date 2024/06/17 17:02
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return UserLabel::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
156
app/admin/logic/financial_transfers/FinancialTransfersLogic.php
Normal file
156
app/admin/logic/financial_transfers/FinancialTransfersLogic.php
Normal file
@ -0,0 +1,156 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\logic\financial_transfers;
|
||||
|
||||
|
||||
use app\common\model\financial_transfers\FinancialTransfers;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* FinancialTransfers逻辑
|
||||
* Class FinancialTransfersLogic
|
||||
* @package app\admin\logic
|
||||
*/
|
||||
class FinancialTransfersLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author admin
|
||||
* @date 2024/06/14 10:05
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
FinancialTransfers::create([
|
||||
'store_id' => $params['store_id'],
|
||||
'admin_id' => $params['admin_id'],
|
||||
'uid' => $params['uid'],
|
||||
'status' => $params['status'],
|
||||
'initiation_time' => $params['initiation_time'],
|
||||
'confirmation_time' => $params['confirmation_time'],
|
||||
'mark' => $params['mark'],
|
||||
'money' => $params['money'],
|
||||
'remark_time' => $params['remark_time']
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author admin
|
||||
* @date 2024/06/14 10:05
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
FinancialTransfers::where('id', $params['id'])->update([
|
||||
'store_id' => $params['store_id'],
|
||||
'admin_id' => $params['admin_id'],
|
||||
'uid' => $params['uid'],
|
||||
'status' => $params['status'],
|
||||
'initiation_time' => $params['initiation_time'],
|
||||
'confirmation_time' => $params['confirmation_time'],
|
||||
'mark' => $params['mark'],
|
||||
'money' => $params['money'],
|
||||
'remark_time' => $params['remark_time']
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author admin
|
||||
* @date 2024/06/14 10:05
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return FinancialTransfers::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author admin
|
||||
* @date 2024/06/14 10:05
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
return FinancialTransfers::findOrEmpty($params['id'])->toArray();
|
||||
}
|
||||
|
||||
public static function dealsend($params)
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
FinancialTransfers::where('id',$params['id'])
|
||||
->update(
|
||||
[
|
||||
'status'=>1,
|
||||
'initiation_time'=>time()
|
||||
]
|
||||
);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
}catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function dealchange($params,$id)
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
FinancialTransfers::where('id',$id)
|
||||
->update(
|
||||
$params
|
||||
);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
}catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -67,9 +67,9 @@ class StoreBranchProductLogic extends BaseLogic
|
||||
}
|
||||
$data['cate_id']=$params['cate_id'];
|
||||
}else{
|
||||
if($params['statis']!=$StoreProduct['statis']){
|
||||
if($params['statis']==1){
|
||||
StoreProductLogic::updateGoodsclass($params['cate_id']);
|
||||
if($params['status']!=$StoreProduct['status']){
|
||||
if($params['status']==1){
|
||||
StoreProductLogic::updateGoodsclass($StoreProduct['cate_id'],$StoreProduct['store_id']);
|
||||
}else{
|
||||
self::store_product_cate_update($params['id'], $StoreProduct['cate_id'], $StoreProduct['store_id'],0);
|
||||
|
||||
@ -92,7 +92,7 @@ class StoreBranchProductLogic extends BaseLogic
|
||||
public static function store_product_cate_update($id,$cate_id,$store_id,$type=1)
|
||||
{
|
||||
$find=Db::name('store_product_cate')->where(['cate_id'=>$cate_id,'store_id'=>$store_id])->find();
|
||||
if($find['pid']>0){
|
||||
if($find &&$find['pid']>0){
|
||||
$two=Db::name('store_product_cate')->where(['cate_id'=>$find['pid'],'store_id'=>$store_id])->find();
|
||||
Db::name('store_product_cate')->where('id',$find['id'])->dec('count',1)->update();
|
||||
Db::name('store_product_cate')->where('id',$two['id'])->dec('count',1)->update();
|
||||
@ -101,7 +101,7 @@ class StoreBranchProductLogic extends BaseLogic
|
||||
}
|
||||
}
|
||||
if($type==1){
|
||||
StoreProductLogic::updateGoodsclass($cate_id);
|
||||
StoreProductLogic::updateGoodsclass($cate_id,$store_id);
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
@ -9,6 +9,7 @@ use app\common\model\store_branch_product\StoreBranchProduct;
|
||||
use app\common\model\store_branch_product_attr_value\StoreBranchProductAttrValue;
|
||||
use app\common\model\store_category\StoreCategory;
|
||||
use app\common\model\store_product_attr_value\StoreProductAttrValue;
|
||||
use app\common\model\store_product_cate\StoreProductCate;
|
||||
use app\common\model\system_store\SystemStore;
|
||||
use app\common\model\system_store_storage\SystemStoreStorage;
|
||||
use app\Request;
|
||||
@ -48,6 +49,8 @@ class StoreProductLogic extends BaseLogic
|
||||
'purchase' => $params['purchase'],
|
||||
'rose' => $params['rose'],
|
||||
'is_return' => $params['is_return'],
|
||||
'swap' => $params['swap'] ?? 0,
|
||||
'batch' => $params['batch'] ?? 0,
|
||||
];
|
||||
// if ($params['rose'] > 0) {
|
||||
// $rose_price = bcmul($params['cost'], $params['rose'], 2);
|
||||
@ -93,6 +96,33 @@ class StoreProductLogic extends BaseLogic
|
||||
}
|
||||
}
|
||||
|
||||
public static function deleteRelatedData($cate_id)
|
||||
{
|
||||
$data_to_delete = StoreProductCate::where('cate_id', $cate_id)->select();
|
||||
foreach ($data_to_delete as $item) {
|
||||
|
||||
if ($item['pid'] != 0) {
|
||||
self::deleteRelatedData($item['pid']);
|
||||
StoreProductCate::where('id', $item['id'])->update(['delete_time' => time()]);
|
||||
}
|
||||
|
||||
if ($item['pid'] == 0 && in_array($item['count'], [0, 1])) {
|
||||
StoreProductCate::where('id', $item['id'])->update(['delete_time' => time()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 递归减少分类数据的count值
|
||||
public static function decreaseCount($cate_id)
|
||||
{
|
||||
$data_to_decrease = StoreProductCate::where('cate_id', $cate_id)->select();
|
||||
foreach ($data_to_decrease as $item) {
|
||||
if ($item['pid'] != 0) {
|
||||
self::decreaseCount($item['pid']);
|
||||
}
|
||||
StoreProductCate::where('id', $item['id'])->update(['count' => $item['count'] - 1]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 编辑商品列表
|
||||
@ -118,14 +148,38 @@ class StoreProductLogic extends BaseLogic
|
||||
'is_return' => $params['is_return'],
|
||||
'price' => $params['price'],
|
||||
'vip_price' => $params['vip_price'],
|
||||
'cost' => $params['cost'],
|
||||
'batch' => $params['batch'],
|
||||
'swap' => $params['swap'] ?? 0,
|
||||
|
||||
];
|
||||
|
||||
StoreProduct::where('id', $params['id'])->update($data);
|
||||
|
||||
/*$old_cate = StoreBranchProduct::where('product_id', $params['id'])->field('cate_id,store_id')
|
||||
->select();
|
||||
// 获取分类ID
|
||||
foreach ($old_cate as $vv) {
|
||||
$related_data = Db::name('store_product_cate')->where('cate_id', $vv['cate_id'])->select();
|
||||
//删除之前的分类
|
||||
foreach ($related_data as $value) {
|
||||
if ($value['count'] == 1) {
|
||||
self::deleteRelatedData($value['cate_id']);
|
||||
} elseif ($value['count'] > 1) {
|
||||
self::decreaseCount($value['cate_id']);
|
||||
}
|
||||
//新增对应的分类
|
||||
self::updateGoodsclass($params['cate_id'], $value['store_id']);
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
//修改
|
||||
StoreBranchProduct::where('product_id', $params['id'])->update([
|
||||
'price' => $params['price'], 'vip_price' => $params['vip_price'],
|
||||
'cost' => $params['cost']
|
||||
'cost' => $params['cost'],
|
||||
'batch'=>$params['batch'],'store_name'=>$params['store_name']
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
@ -145,7 +199,9 @@ class StoreProductLogic extends BaseLogic
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return StoreProduct::destroy($params['id']);
|
||||
$res = StoreProduct::destroy($params['id']);
|
||||
StoreBranchProduct::where('product_id', $params['id'])->update(['delete_time' => time()]);
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
@ -177,7 +233,7 @@ class StoreProductLogic extends BaseLogic
|
||||
/**
|
||||
* 更新商品分类
|
||||
*/
|
||||
public static function updateGoodsclass($cate_id, $type = 0)
|
||||
public static function updateGoodsclass($cate_id, $store_id = 0, $type = 0)
|
||||
{
|
||||
$one = StoreCategory::where('id', $cate_id)->find();
|
||||
if ($one) {
|
||||
@ -185,23 +241,31 @@ class StoreProductLogic extends BaseLogic
|
||||
$two = StoreCategory::where('id', $one['pid'])->find();
|
||||
if ($two) {
|
||||
if ($two['pid'] != 0) {
|
||||
self::cate_update($cate_id, $two['id'], 0, 3);
|
||||
self::cate_update($two['id'], $two['pid'], 0, 2);
|
||||
self::cate_update($two['pid'], 0, 0, 1);
|
||||
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, $product_id = 0, $level = 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' => 1, 'cate_id' => $cate_id, 'level' => $level])->find();
|
||||
$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' => 1, 'cate_id' => $cate_id, 'count' => 1, 'level' => $level, 'create_time' => time(), 'update_time' => time()]);
|
||||
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()]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制商品到门店
|
||||
*/
|
||||
|
@ -45,6 +45,10 @@ class SystemStoreLogic extends BaseLogic
|
||||
'province' => $params['province_code'],
|
||||
'city' => $params['city_code'],
|
||||
'area' => $params['area_code'],
|
||||
'bank' => $params['bank']??'',
|
||||
'bank_code' => $params['bank_code']??'',
|
||||
'bank_address' => $params['bank_address']??'',
|
||||
'realname' => $params['realname']??'',
|
||||
'street' => $params['street_code'],
|
||||
'is_store' => $params['is_store'] ?? 0,
|
||||
'is_send' => $params['is_send'] ?? 0,
|
||||
@ -102,6 +106,10 @@ class SystemStoreLogic extends BaseLogic
|
||||
'day_time' => $params['day_time'] ?? 0,
|
||||
'is_store' => $params['is_store'] ?? 0,
|
||||
'is_send' => $params['is_send'] ?? 0,
|
||||
'bank' => $params['bank']??'',
|
||||
'bank_code' => $params['bank_code']??'',
|
||||
'bank_address' => $params['bank_address']??'',
|
||||
'realname' => $params['realname']??'',
|
||||
'default_delivery' => $params['default_delivery'] ?? 2,
|
||||
]);
|
||||
$res=SystemStoreStaff::where('store_id', $params['id'])->where('is_admin', 1)->where('account', $params['phone'])->find();
|
||||
|
@ -15,7 +15,11 @@ namespace app\admin\logic\user;
|
||||
|
||||
use app\common\enum\user\UserTerminalEnum;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\store_finance_flow\StoreFinanceFlow;
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\user\UserAddress;
|
||||
use app\common\model\user\UserRecharge;
|
||||
use app\common\model\user_label\UserLabel;
|
||||
use think\facade\Db;
|
||||
use app\common\service\FileService;
|
||||
use Webman\Config;
|
||||
@ -52,7 +56,6 @@ class UserLogic extends BaseLogic
|
||||
'mobile' => $params['mobile'],
|
||||
'sex' => $params['sex'],
|
||||
'is_disable' => $params['is_disable'],
|
||||
'user_money' => $params['user_money']
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
@ -63,6 +66,47 @@ class UserLogic extends BaseLogic
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function StoreAdd(array $params)
|
||||
{
|
||||
$passwordSalt = Config::get('project.unique_identification');
|
||||
$password = create_password(123456, $passwordSalt);
|
||||
$defaultAvatar = config('project.default_image.admin_avatar');
|
||||
$avatar = !empty($params['avatar']) ? FileService::setFileUrl($params['avatar']) : $defaultAvatar;
|
||||
|
||||
Db::startTrans();
|
||||
try {
|
||||
$data=[
|
||||
'avatar' => $avatar,
|
||||
'real_name' => $params['real_name']??"",
|
||||
'nickname' => '用户'.time(),
|
||||
'account' => $params['mobile'],
|
||||
'password' => $password,
|
||||
'mobile' => $params['mobile'],
|
||||
'user_ship' => $params['user_ship']??0,
|
||||
|
||||
];
|
||||
$res=User::create($data);
|
||||
UserAddress::create([
|
||||
'uid' => $res['id'],
|
||||
'real_name' => $params['real_name']??"",
|
||||
'mobile' => $params['mobile'],
|
||||
'province' => $params['province'],
|
||||
'city' => $params['city'],
|
||||
'area' => $params['area'],
|
||||
'street' => $params['street'],
|
||||
'village' => $params['village'],
|
||||
'brigade' => $params['brigade'],
|
||||
'is_default' => 1,
|
||||
]);
|
||||
Db::commit();
|
||||
return $res;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @notes 编辑用户列表
|
||||
* @param array $params
|
||||
@ -75,15 +119,15 @@ class UserLogic extends BaseLogic
|
||||
Db::startTrans();
|
||||
try {
|
||||
User::where('id', $params['id'])->update([
|
||||
'avatar' => $params['avatar'] ?? '',
|
||||
'real_name' => $params['real_name'],
|
||||
'nickname' => $params['nickname'],
|
||||
'account' => $params['account'],
|
||||
'password' => $params['password'] ?? '',
|
||||
'mobile' => $params['mobile'] ?? '',
|
||||
'sex' => $params['sex'] ?? 0,
|
||||
'is_disable' => $params['is_disable'] ?? 0,
|
||||
'user_money' => $params['user_money'] ?? 0
|
||||
// 'avatar' => $params['avatar'] ?? '',
|
||||
// 'real_name' => $params['real_name'],
|
||||
// 'nickname' => $params['nickname'],
|
||||
// 'account' => $params['account'],
|
||||
// 'password' => $params['password'] ?? '',
|
||||
// 'mobile' => $params['mobile'] ?? '',
|
||||
// 'sex' => $params['sex'] ?? 0,
|
||||
// 'is_disable' => $params['is_disable'] ?? 0,
|
||||
'label_id'=>$params['label_id']
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
@ -105,8 +149,8 @@ class UserLogic extends BaseLogic
|
||||
public static function detail(int $userId): array
|
||||
{
|
||||
$field = [
|
||||
'id', 'account', 'nickname', 'avatar', 'real_name',
|
||||
'sex', 'mobile', 'create_time', 'login_time', 'channel'
|
||||
'id', 'account', 'nickname', 'avatar', 'real_name','integral','label_id',
|
||||
'sex', 'mobile', 'create_time', 'login_time', 'channel','now_money','purchase_funds'
|
||||
];
|
||||
|
||||
$user = User::where(['id' => $userId])->field($field)
|
||||
@ -114,6 +158,8 @@ class UserLogic extends BaseLogic
|
||||
|
||||
$user['channel'] = UserTerminalEnum::getTermInalDesc($user['channel']);
|
||||
$user->sex = $user->getData('sex');
|
||||
$user['number']=StoreFinanceFlow::where('other_uid',$userId)->where(['status'=>0,'financial_pm'=>1,'type'=>1])->sum('number');
|
||||
$user['label_name']=$user->label_id?UserLabel::where('label_id',$user->label_id)->value('label_name'):"";
|
||||
return $user->toArray();
|
||||
}
|
||||
|
||||
|
94
app/admin/logic/user_label/UserLabelLogic.php
Normal file
94
app/admin/logic/user_label/UserLabelLogic.php
Normal file
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\logic\user_label;
|
||||
|
||||
|
||||
use app\common\model\user_label\UserLabel;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 用户标签逻辑
|
||||
* Class UserLabelLogic
|
||||
* @package app\admin\logic\user_label
|
||||
*/
|
||||
class UserLabelLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加用户标签
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author admin
|
||||
* @date 2024/06/17 17:02
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
UserLabel::create([
|
||||
'label_name' => $params['label_name']
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑用户标签
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author admin
|
||||
* @date 2024/06/17 17:02
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
UserLabel::where('label_id', $params['label_id'])->update([
|
||||
'label_name' => $params['label_name']
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除用户标签
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author admin
|
||||
* @date 2024/06/17 17:02
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return UserLabel::destroy($params['label_id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取用户标签详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author admin
|
||||
* @date 2024/06/17 17:02
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
return UserLabel::findOrEmpty($params['label_id'])->toArray();
|
||||
}
|
||||
}
|
@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate\financial_transfers;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* FinancialTransfers验证器
|
||||
* Class FinancialTransfersValidate
|
||||
* @package app\admin\validate\financial_transfers
|
||||
*/
|
||||
class FinancialTransfersValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'store_id' => 'require',
|
||||
'money' => 'require',
|
||||
'status' => 'require|number',
|
||||
'transfer_picture' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'store_id' => '店铺id',
|
||||
'money' => '金额',
|
||||
'status' => '状态',
|
||||
'transfer_picture' => '财务上传凭证',
|
||||
];
|
||||
|
||||
|
||||
public function sceneSend()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
public function sceneConfirm()
|
||||
{
|
||||
return $this->only(['id','status']);
|
||||
}
|
||||
|
||||
public function sceneSuccess()
|
||||
{
|
||||
return $this->only(['id','transfer_picture','status']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return FinancialTransfersValidate
|
||||
* @author admin
|
||||
* @date 2024/06/14 10:10
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['store_id','money']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return FinancialTransfersValidate
|
||||
* @author admin
|
||||
* @date 2024/06/14 10:10
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','store_id','money']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return FinancialTransfersValidate
|
||||
* @author admin
|
||||
* @date 2024/06/14 10:10
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return FinancialTransfersValidate
|
||||
* @author admin
|
||||
* @date 2024/06/14 10:10
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
@ -24,10 +24,16 @@ class UserValidate extends BaseValidate
|
||||
'nickname' => 'require',
|
||||
'account' => 'require',
|
||||
'password' => 'require',
|
||||
'mobile' => 'require|mobile',
|
||||
'mobile' => 'require|unique:user',
|
||||
'is_disable' => 'in:0,1',
|
||||
'sex' => 'in:1,2',
|
||||
'user_money' => 'float'
|
||||
'province' => 'require',
|
||||
'city' => 'require',
|
||||
'area' => 'require',
|
||||
'street' => 'require',
|
||||
'village' => 'require',
|
||||
'brigade' => 'require',
|
||||
'user_ship' => 'require',
|
||||
];
|
||||
|
||||
|
||||
@ -44,7 +50,13 @@ class UserValidate extends BaseValidate
|
||||
'mobile' => '用户电话',
|
||||
'is_disable' => '是否禁用',
|
||||
'sex' => '用户性别',
|
||||
'user_money' => '用户余额',
|
||||
'province' => '省',
|
||||
'city' => '市',
|
||||
'area' => '区',
|
||||
'street' => '街道',
|
||||
'village' => '村',
|
||||
'brigade' => ' 队',
|
||||
'user_ship' => ' 会员类型',
|
||||
];
|
||||
|
||||
|
||||
@ -59,6 +71,10 @@ class UserValidate extends BaseValidate
|
||||
return $this->remove('id',true);
|
||||
}
|
||||
|
||||
public function scenestoreAdd()
|
||||
{
|
||||
return $this->only(['mobile','province','city','district','street','village','brigade','user_ship']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
@ -68,7 +84,7 @@ class UserValidate extends BaseValidate
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','avatar','real_name','nickname','account','password','mobile','is_disable','sex','user_money'])->remove('password','require');
|
||||
return $this->only(['id','avatar','real_name','nickname','account','password','mobile','is_disable','sex'])->remove('password','require');
|
||||
}
|
||||
|
||||
|
||||
|
84
app/admin/validate/user_label/UserLabelValidate.php
Normal file
84
app/admin/validate/user_label/UserLabelValidate.php
Normal file
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate\user_label;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 用户标签验证器
|
||||
* Class UserLabelValidate
|
||||
* @package app\admin\validate\user_label
|
||||
*/
|
||||
class UserLabelValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'label_id' => 'require',
|
||||
'label_name' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'label_id' => 'label_id',
|
||||
'label_name' => '标签名称',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return UserLabelValidate
|
||||
* @author admin
|
||||
* @date 2024/06/17 17:02
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['label_name']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return UserLabelValidate
|
||||
* @author admin
|
||||
* @date 2024/06/17 17:02
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['label_id','label_name']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return UserLabelValidate
|
||||
* @author admin
|
||||
* @date 2024/06/17 17:02
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['label_id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return UserLabelValidate
|
||||
* @author admin
|
||||
* @date 2024/06/17 17:02
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['label_id']);
|
||||
}
|
||||
|
||||
}
|
@ -2,8 +2,7 @@
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\controller\BaseLikeController;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
#[ApiDoc\NotParse()]
|
||||
|
||||
|
||||
class BaseApiController extends BaseLikeController
|
||||
{
|
||||
|
@ -2,57 +2,61 @@
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\admin\logic\store_product\StoreProductLogic;
|
||||
use app\admin\validate\tools\GenerateTableValidate;
|
||||
use app\admin\logic\tools\GeneratorLogic;
|
||||
use app\common\logic\store_order\StoreOrderLogic;
|
||||
use app\common\model\store_branch_product\StoreBranchProduct;
|
||||
use app\common\model\system_store\SystemStore;
|
||||
use app\common\service\pay\PayService;
|
||||
use app\common\service\wechat\WechatTemplate;
|
||||
use Exception;
|
||||
use support\Cache;
|
||||
use think\facade\Db;
|
||||
use Webman\Config;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
use support\Log;
|
||||
use Yansongda\Pay\Exception\InvalidSignException;
|
||||
use Monolog\Handler\RotatingFileHandler;
|
||||
use Webman\RedisQueue\Redis;
|
||||
|
||||
#[ApiDoc\NotParse()]
|
||||
|
||||
|
||||
class IndexController extends BaseApiController
|
||||
{
|
||||
public $notNeedLogin = ['index', 'app_update', 'express_list', 'province', 'city', 'area', 'street'];
|
||||
public $notNeedLogin = ['index', 'app_update', 'express_list', 'province', 'city', 'area', 'street', 'village', 'brigade', 'config'];
|
||||
|
||||
public function index()
|
||||
{
|
||||
Redis::send('push-platform-print', ['order_id' => 119]);
|
||||
d(2);
|
||||
|
||||
$arr = StoreBranchProduct::select();
|
||||
foreach ($arr as $item) {
|
||||
StoreProductLogic::updateGoodsclass($item['cate_id'], $item['store_id']);
|
||||
}
|
||||
d(1);
|
||||
try {
|
||||
$wechat = new PayService(1);
|
||||
$time = time();
|
||||
$order = [
|
||||
'out_trade_no' => 'PF1717558027664507',
|
||||
'out_refund_no' => 'BO'.$time,
|
||||
'amount' => [
|
||||
'refund' => 1,
|
||||
'total' => 1,
|
||||
'currency' => 'CNY',
|
||||
],
|
||||
// '_action' => 'jsapi', // jsapi 退款,默认
|
||||
// '_action' => 'app', // app 退款
|
||||
// '_action' => 'combine', // 合单退款
|
||||
// '_action' => 'h5', // h5 退款
|
||||
// '_action' => 'miniapp', // 小程序退款
|
||||
// '_action' => 'native', // native 退款
|
||||
$wechat = new PayService(1);
|
||||
$time = time();
|
||||
$order = [
|
||||
'out_trade_no' => 'PF1717558027664507',
|
||||
'out_refund_no' => 'BO' . $time,
|
||||
'amount' => [
|
||||
'refund' => 1,
|
||||
'total' => 1,
|
||||
'currency' => 'CNY',
|
||||
],
|
||||
// '_action' => 'jsapi', // jsapi 退款,默认
|
||||
// '_action' => 'app', // app 退款
|
||||
// '_action' => 'combine', // 合单退款
|
||||
// '_action' => 'h5', // h5 退款
|
||||
// '_action' => 'miniapp', // 小程序退款
|
||||
// '_action' => 'native', // native 退款
|
||||
|
||||
];
|
||||
];
|
||||
|
||||
$res = $wechat->wechat->refund($order);
|
||||
Cache::set('kk',json_decode($res,true));
|
||||
$res = $wechat->wechat->refund($order);
|
||||
Cache::set('kk', json_decode($res, true));
|
||||
} catch (Exception $e) {
|
||||
\support\Log::info($e->extra['message']?? $e->getMessage());
|
||||
throw new \Exception($e->extra['message']?? $e->getMessage());
|
||||
\support\Log::info($e->extra['message'] ?? $e->getMessage());
|
||||
throw new \Exception($e->extra['message'] ?? $e->getMessage());
|
||||
}
|
||||
d(1);
|
||||
|
||||
@ -63,15 +67,15 @@ class IndexController extends BaseApiController
|
||||
|
||||
|
||||
|
||||
try{
|
||||
$a=new WechatTemplate();
|
||||
$a->NewQuotationNotification(['openid'=>'ocqhF6UfFQXE-SbzbP5YVQJlQAh0','data1'=>'阿萨','data2'=>date('Y-m-d H:i:s'),'data3'=>'占山','data3'=>18982406440]);
|
||||
}catch (Exception $e){
|
||||
try {
|
||||
$a = new WechatTemplate();
|
||||
$a->NewQuotationNotification(['openid' => 'ocqhF6UfFQXE-SbzbP5YVQJlQAh0', 'data1' => '阿萨', 'data2' => date('Y-m-d H:i:s'), 'data3' => '占山', 'data3' => 18982406440]);
|
||||
} catch (Exception $e) {
|
||||
d($e);
|
||||
}
|
||||
|
||||
|
||||
d(22);
|
||||
d(22);
|
||||
$auth_code = $this->request->get('code');
|
||||
$pay = (new PayService());
|
||||
$order = [
|
||||
@ -81,7 +85,7 @@ d(22);
|
||||
'auth_code' => (string)$auth_code
|
||||
],
|
||||
'amount' => [
|
||||
'total' =>1,
|
||||
'total' => 1,
|
||||
],
|
||||
'scene_info' => [
|
||||
"store_info" => [
|
||||
@ -89,14 +93,13 @@ d(22);
|
||||
]
|
||||
],
|
||||
];
|
||||
|
||||
try{
|
||||
$a= $pay->wechat->pos($order);
|
||||
|
||||
}catch (\Exception $th) {
|
||||
d($th);
|
||||
try {
|
||||
$a = $pay->wechat->pos($order);
|
||||
} catch (\Exception $th) {
|
||||
d($th);
|
||||
}
|
||||
d($a);
|
||||
d($a);
|
||||
$params = ['store_id' => 2, 'pay_type' => 17];
|
||||
$a = StoreOrderLogic::createOrder([1], 0, null, $params);
|
||||
d($a);
|
||||
@ -139,7 +142,7 @@ d($a);
|
||||
*/
|
||||
public function city()
|
||||
{
|
||||
$province_code = $this->request->get('code');
|
||||
$province_code = $this->request->get('province_code');
|
||||
$list = Db::name('geo_city')->where('province_code', $province_code)->select()?->toArray();
|
||||
return $this->success('ok', $list);
|
||||
}
|
||||
@ -148,7 +151,7 @@ d($a);
|
||||
*/
|
||||
public function area()
|
||||
{
|
||||
$city_code = $this->request->get('code');
|
||||
$city_code = $this->request->get('city_code');
|
||||
$list = Db::name('geo_area')->where('city_code', $city_code)->select()?->toArray();
|
||||
return $this->success('ok', $list);
|
||||
}
|
||||
@ -161,4 +164,36 @@ d($a);
|
||||
$list = Db::name('geo_street')->where('area_code', $area_code)->select()?->toArray();
|
||||
return $this->success('ok', $list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取村列表
|
||||
*/
|
||||
public function village()
|
||||
{
|
||||
$area_code = $this->request->get('street_code');
|
||||
$list = Db::name('geo_village')->where('street_code', $area_code)->select()?->toArray();
|
||||
return $this->success('ok', $list);
|
||||
}
|
||||
/**
|
||||
* @notes 获取队列表
|
||||
*/
|
||||
public function brigade()
|
||||
{
|
||||
$list = Db::name('geo_brigade')->select()?->toArray();
|
||||
return $this->success('ok', $list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取队列表
|
||||
*/
|
||||
public function config()
|
||||
{
|
||||
$store_id = getenv('STORE_ID') ?? 1;
|
||||
$find = SystemStore::where('id', $store_id)->find();
|
||||
$list = [
|
||||
'id' => $find['id'],
|
||||
'store_name' => $find['name'],
|
||||
];
|
||||
return $this->success('ok', $list);
|
||||
}
|
||||
}
|
||||
|
@ -6,8 +6,7 @@ use app\api\logic\LoginLogic;
|
||||
use app\common\model\system_store\SystemStore;
|
||||
use app\api\validate\{LoginAccountValidate, WechatLoginValidate};
|
||||
use app\common\model\user\UserAuth;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
#[ApiDoc\NotParse()]
|
||||
|
||||
|
||||
class LoginController extends BaseApiController
|
||||
{
|
||||
@ -19,7 +18,7 @@ class LoginController extends BaseApiController
|
||||
public function account()
|
||||
{
|
||||
$params=$this->request->post();
|
||||
$params = (new LoginAccountValidate())->post()->goCheck();
|
||||
// $params = (new LoginAccountValidate())->post()->goCheck();
|
||||
$result = LoginLogic::login($params);
|
||||
if (false === $result) {
|
||||
return $this->fail(LoginLogic::getError());
|
||||
|
@ -9,8 +9,7 @@ use app\common\model\store_order\StoreOrder;
|
||||
use app\common\service\pay\PayService;
|
||||
use support\Cache;
|
||||
use support\Log;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
#[ApiDoc\NotParse()]
|
||||
|
||||
|
||||
/**
|
||||
* 支付
|
||||
@ -69,6 +68,7 @@ class PayController extends BaseApiController
|
||||
public function wechatQuery()
|
||||
{
|
||||
$order_no = $this->request->get('order_no');
|
||||
$recharge = $this->request->get('recharge',0);
|
||||
$order = [
|
||||
'out_trade_no' => $order_no,
|
||||
];
|
||||
@ -76,7 +76,11 @@ class PayController extends BaseApiController
|
||||
|
||||
$res = $app->wechat->query($order);
|
||||
if ($res['trade_state'] == 'SUCCESS' && $res['trade_state_desc'] == '支付成功') {
|
||||
PayNotifyLogic::handle('wechat_common', $res['out_trade_no'], $res);
|
||||
if($recharge==0){
|
||||
PayNotifyLogic::handle('wechat_common', $res['out_trade_no'], $res);
|
||||
}else{
|
||||
PayNotifyLogic::handle('recharge', $res['out_trade_no'], $res);
|
||||
}
|
||||
return $this->success('支付成功');
|
||||
} else {
|
||||
return $this->fail('订单支付中');
|
||||
|
@ -4,8 +4,7 @@
|
||||
|
||||
use app\common\service\UploadService;
|
||||
use Exception;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
#[ApiDoc\NotParse()]
|
||||
|
||||
|
||||
class UploadController extends BaseApiController
|
||||
{
|
||||
|
@ -5,8 +5,7 @@ namespace app\api\controller\cate;
|
||||
|
||||
use app\api\controller\BaseApiController;
|
||||
use app\api\lists\cate\CateLists;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
#[ApiDoc\NotParse()]
|
||||
|
||||
|
||||
/**
|
||||
* 商品分类控制器
|
||||
|
@ -8,9 +8,8 @@ use app\api\controller\BaseApiController;
|
||||
use app\api\lists\order\CartList;
|
||||
use app\common\model\order\Cart;
|
||||
use app\common\model\store_branch_product\StoreBranchProduct;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
|
||||
#[ApiDoc\NotParse()]
|
||||
|
||||
class CartController extends BaseApiController
|
||||
{
|
||||
public function list()
|
||||
|
@ -16,9 +16,7 @@ use app\common\model\system_store\SystemStoreStaff;
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\user\UserAddress;
|
||||
use Webman\RedisQueue\Redis;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
|
||||
#[ApiDoc\title('订单')]
|
||||
class OrderController extends BaseApiController
|
||||
{
|
||||
public $notNeedLogin = ['refund_reason'];
|
||||
@ -32,15 +30,15 @@ class OrderController extends BaseApiController
|
||||
return $this->dataLists(new OrderList());
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('核销码查数据'),
|
||||
ApiDoc\url('/api/order/order/write_code'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\Param(name: "code", type: "string", require: false, desc: "核销码"),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('核销码查数据'),
|
||||
// ApiDoc\url('/api/order/order/write_code'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\Param(name: "code", type: "string", require: false, desc: "核销码"),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function write_code()
|
||||
{
|
||||
$code = $this->request->post('code');
|
||||
@ -54,18 +52,18 @@ class OrderController extends BaseApiController
|
||||
return $this->success('ok', $res);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('核销订单列表'),
|
||||
ApiDoc\url('/api/order/order/write_list'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\Param(name: "status", type: "int", require: true, desc: "1:待核销;2:已核销"),
|
||||
ApiDoc\Param(name: "name", type: "string", require: false, desc: "搜商品或者订单id"),
|
||||
ApiDoc\Param(name: "page_no", type: "int", require: true, desc: "默认1页数"),
|
||||
ApiDoc\Param(name: "page_size", type: "int", require: false, desc: "条数默认15"),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('核销订单列表'),
|
||||
// ApiDoc\url('/api/order/order/write_list'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\Param(name: "status", type: "int", require: true, desc: "1:待核销;2:已核销"),
|
||||
// ApiDoc\Param(name: "name", type: "string", require: false, desc: "搜商品或者订单id"),
|
||||
// ApiDoc\Param(name: "page_no", type: "int", require: true, desc: "默认1页数"),
|
||||
// ApiDoc\Param(name: "page_size", type: "int", require: false, desc: "条数默认15"),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function write_list()
|
||||
{
|
||||
$status = (int)$this->request->post('status', 1);
|
||||
@ -83,15 +81,15 @@ class OrderController extends BaseApiController
|
||||
return $this->success('ok', $res);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('核销数量'),
|
||||
ApiDoc\url('/api/order/order/write_count'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\Param(name: "name", type: "string", require: false, desc: "搜商品或者订单id"),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('核销数量'),
|
||||
// ApiDoc\url('/api/order/order/write_count'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\Param(name: "name", type: "string", require: false, desc: "搜商品或者订单id"),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function write_count()
|
||||
{
|
||||
$info = $this->userInfo;
|
||||
@ -100,41 +98,41 @@ class OrderController extends BaseApiController
|
||||
return $this->success('ok', $res);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('订单校验'),
|
||||
ApiDoc\url('/api/order/order/checkOrder'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\Param(name: "cart_id", type: "int", require: true, desc: "购物车id"),
|
||||
ApiDoc\Param(name: "address_id", type: "int", require: true, desc: "地址id"),
|
||||
ApiDoc\Param(name: "store_id", type: "int", require: true, desc: "店铺id"),
|
||||
ApiDoc\Param(name: "verify_code", type: "int", require: true, desc: "校验码"),
|
||||
ApiDoc\Param(name: "shipping_type", type: "int", require: true, desc: "配送方式"),
|
||||
ApiDoc\Param(name: "pay_type", type: "int", require: true, desc: "支付类型"),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
ApiDoc\ResponseSuccess("data", type: "array", children: [
|
||||
['name' => 'order', 'desc' => '订单信息', 'type' => 'array', 'children' => [
|
||||
['name' => 'create_time', 'desc' => '订单创建时间', 'type' => 'int'],
|
||||
['name' => 'order_id', 'desc' => '订单id', 'type' => 'int'],
|
||||
['name' => 'total_price', 'desc' => '订单总金额', 'type' => 'float'],
|
||||
['name' => 'pay_price', 'desc' => '实际支付金额', 'type' => 'float'],
|
||||
['name' => 'total_num', 'desc' => '订单总数量', 'type' => 'int'],
|
||||
['name' => 'pay_type', 'desc' => '支付方式', 'type' => 'int'],
|
||||
['name' => 'cart_id', 'desc' => '购物车id', 'type' => 'string'],
|
||||
['name' => 'store_id', 'desc' => '店铺id', 'type' => 'int'],
|
||||
['name' => 'shipping_type', 'desc' => '配送方式', 'type' => 'int'],
|
||||
]],
|
||||
['name' => 'cart_list', 'desc' => '购物车商品列表', 'type' => 'array', 'children' => [
|
||||
['name' => 'goods', 'desc' => '商品id', 'type' => 'int'],
|
||||
['name' => 'cart_num', 'desc' => '购买数量', 'type' => 'int'],
|
||||
['name' => 'total', 'desc' => '商品总价', 'type' => 'float'],
|
||||
['name' => 'price', 'desc' => '商品单价', 'type' => 'float'],
|
||||
['name' => 'product_id', 'desc' => '商品id', 'type' => 'int'],
|
||||
['name' => 'old_cart_id', 'desc' => '原购物车id', 'type' => 'string'],
|
||||
['name' => 'verify_code', 'desc' => '校验码', 'type' => 'string'],
|
||||
]],
|
||||
]),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('订单校验'),
|
||||
// ApiDoc\url('/api/order/order/checkOrder'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\Param(name: "cart_id", type: "int", require: true, desc: "购物车id"),
|
||||
// ApiDoc\Param(name: "address_id", type: "int", require: true, desc: "地址id"),
|
||||
// ApiDoc\Param(name: "store_id", type: "int", require: true, desc: "店铺id"),
|
||||
// ApiDoc\Param(name: "verify_code", type: "int", require: true, desc: "校验码"),
|
||||
// ApiDoc\Param(name: "shipping_type", type: "int", require: true, desc: "配送方式"),
|
||||
// ApiDoc\Param(name: "pay_type", type: "int", require: true, desc: "支付类型"),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array", children: [
|
||||
// ['name' => 'order', 'desc' => '订单信息', 'type' => 'array', 'children' => [
|
||||
// ['name' => 'create_time', 'desc' => '订单创建时间', 'type' => 'int'],
|
||||
// ['name' => 'order_id', 'desc' => '订单id', 'type' => 'int'],
|
||||
// ['name' => 'total_price', 'desc' => '订单总金额', 'type' => 'float'],
|
||||
// ['name' => 'pay_price', 'desc' => '实际支付金额', 'type' => 'float'],
|
||||
// ['name' => 'total_num', 'desc' => '订单总数量', 'type' => 'int'],
|
||||
// ['name' => 'pay_type', 'desc' => '支付方式', 'type' => 'int'],
|
||||
// ['name' => 'cart_id', 'desc' => '购物车id', 'type' => 'string'],
|
||||
// ['name' => 'store_id', 'desc' => '店铺id', 'type' => 'int'],
|
||||
// ['name' => 'shipping_type', 'desc' => '配送方式', 'type' => 'int'],
|
||||
// ]],
|
||||
// ['name' => 'cart_list', 'desc' => '购物车商品列表', 'type' => 'array', 'children' => [
|
||||
// ['name' => 'goods', 'desc' => '商品id', 'type' => 'int'],
|
||||
// ['name' => 'cart_num', 'desc' => '购买数量', 'type' => 'int'],
|
||||
// ['name' => 'total', 'desc' => '商品总价', 'type' => 'float'],
|
||||
// ['name' => 'price', 'desc' => '商品单价', 'type' => 'float'],
|
||||
// ['name' => 'product_id', 'desc' => '商品id', 'type' => 'int'],
|
||||
// ['name' => 'old_cart_id', 'desc' => '原购物车id', 'type' => 'string'],
|
||||
// ['name' => 'verify_code', 'desc' => '校验码', 'type' => 'string'],
|
||||
// ]],
|
||||
// ]),
|
||||
// ]
|
||||
public function checkOrder()
|
||||
{
|
||||
$cartId = (array)$this->request->post('cart_id', []);
|
||||
@ -154,19 +152,19 @@ class OrderController extends BaseApiController
|
||||
return $this->data($res);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('创建订单'),
|
||||
ApiDoc\url('/api/order/order/createOrder'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\Param(name: "cart_id", type: "int", require: true, desc: "id"),
|
||||
ApiDoc\Param(name: "store_id", type: "int", require: true, desc: "店铺id"),
|
||||
ApiDoc\Param(name: "address_id", type: "int", require: true, desc: "地址id"),
|
||||
ApiDoc\Param(name: "auth_code", type: "string", require: true, desc: "付款码"),
|
||||
ApiDoc\Param(name: "pay_type", type: "int", require: true, desc: "支付类型"),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('创建订单'),
|
||||
// ApiDoc\url('/api/order/order/createOrder'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\Param(name: "cart_id", type: "int", require: true, desc: "id"),
|
||||
// ApiDoc\Param(name: "store_id", type: "int", require: true, desc: "店铺id"),
|
||||
// ApiDoc\Param(name: "address_id", type: "int", require: true, desc: "地址id"),
|
||||
// ApiDoc\Param(name: "auth_code", type: "string", require: true, desc: "付款码"),
|
||||
// ApiDoc\Param(name: "pay_type", type: "int", require: true, desc: "支付类型"),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function createOrder()
|
||||
{
|
||||
$cartId = (array)$this->request->post('cart_id', []);
|
||||
@ -185,8 +183,16 @@ class OrderController extends BaseApiController
|
||||
$user=User::where('id',$this->userId)->find();
|
||||
|
||||
$order = OrderLogic::createOrder($cartId, $addressId, $user, $params);
|
||||
|
||||
if ($order != false) {
|
||||
if($order['pay_price'] <= 0){
|
||||
$pay_type = 3;
|
||||
}
|
||||
switch ($pay_type) {
|
||||
case PayEnum::PURCHASE_FUNDS:
|
||||
//采购款支付
|
||||
PayNotifyLogic::handle('purchase_funds', $order['order_id']);
|
||||
return $this->success('采购款支付成功');
|
||||
case PayEnum::BALANCE_PAY:
|
||||
//余额支付
|
||||
PayNotifyLogic::handle('balancePay', $order['order_id']);
|
||||
@ -260,18 +266,18 @@ class OrderController extends BaseApiController
|
||||
return $this->success('ok', ['no_pay' => $no_pay, 'waiting' => $waiting, 'receiving' => $receiving, 'all' => $all, 'applyRefund' => $applyRefund, 'refund' => $refund]);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('订单支付'),
|
||||
ApiDoc\url('/api/order/order/pay'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\Param(name: "order_id", type: "int", require: true, desc: "订单id"),
|
||||
ApiDoc\Param(name: "address_id", type: "int", require: true, desc: "地址id"),
|
||||
ApiDoc\Param(name: "auth_code", type: "string", require: true, desc: "付款码"),
|
||||
ApiDoc\Param(name: "pay_type", type: "int", require: true, desc: "支付类型"),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('订单支付'),
|
||||
// ApiDoc\url('/api/order/order/pay'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\Param(name: "order_id", type: "int", require: true, desc: "订单id"),
|
||||
// ApiDoc\Param(name: "address_id", type: "int", require: true, desc: "地址id"),
|
||||
// ApiDoc\Param(name: "auth_code", type: "string", require: true, desc: "付款码"),
|
||||
// ApiDoc\Param(name: "pay_type", type: "int", require: true, desc: "支付类型"),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function pay()
|
||||
{
|
||||
$order_id = (int)$this->request->post('order_id');
|
||||
@ -349,23 +355,29 @@ class OrderController extends BaseApiController
|
||||
}
|
||||
|
||||
|
||||
#[
|
||||
ApiDoc\Title('订单详情'),
|
||||
ApiDoc\url('/api/order/order/detail'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\Param(name: "order_id", type: "int", require: true, desc: "订单id"),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('订单详情'),
|
||||
// ApiDoc\url('/api/order/order/detail'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\Param(name: "order_id", type: "int", require: true, desc: "订单id"),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function detail()
|
||||
{
|
||||
$order_id = (int)$this->request->get('order_id');
|
||||
$lat = $this->request->get('lat','');
|
||||
$lng = $this->request->get('long','');
|
||||
$where = [
|
||||
'id' => $order_id,
|
||||
'uid' => $this->userId,
|
||||
];
|
||||
$url = 'https://'.$this->request->host(true);
|
||||
$order = OrderLogic::detail($where,$url);
|
||||
$parm = [
|
||||
'lat'=>$lat,
|
||||
'long'=>$lng
|
||||
];
|
||||
$order = OrderLogic::detail($where,$url,$parm);
|
||||
if ($order) {
|
||||
return $this->data($order);
|
||||
} else {
|
||||
@ -444,15 +456,15 @@ class OrderController extends BaseApiController
|
||||
}
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('核销'),
|
||||
ApiDoc\url('/api/order/order/writeoff_order'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\Param(name: "verify_code", type: "string", require: true, desc: "验证码"),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('核销'),
|
||||
// ApiDoc\url('/api/order/order/writeoff_order'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\Param(name: "verify_code", type: "string", require: true, desc: "验证码"),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function writeoff_order()
|
||||
{
|
||||
$params = (new OrderValidate())->post()->goCheck('check');
|
||||
@ -484,19 +496,19 @@ class OrderController extends BaseApiController
|
||||
}
|
||||
|
||||
|
||||
#[
|
||||
ApiDoc\Title('订单退款申请'),
|
||||
ApiDoc\url('/api/order/order/apply_refund'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\Param(name: "refund_message", type: "string", require: true, desc: "退款原因"),
|
||||
ApiDoc\Param(name: "refund_num", type: "int", require: true, desc: "退款数量"),
|
||||
ApiDoc\Param(name: "id", type: "int", require: true, desc: "订单id"),
|
||||
ApiDoc\Param(name: "old_cart_id", type: "int", require: true, desc: "购物车id"),
|
||||
ApiDoc\Param(name: "refund_type", type: "int", require: true, desc: "退款申请类型"),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('订单退款申请'),
|
||||
// ApiDoc\url('/api/order/order/apply_refund'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\Param(name: "refund_message", type: "string", require: true, desc: "退款原因"),
|
||||
// ApiDoc\Param(name: "refund_num", type: "int", require: true, desc: "退款数量"),
|
||||
// ApiDoc\Param(name: "id", type: "int", require: true, desc: "订单id"),
|
||||
// ApiDoc\Param(name: "old_cart_id", type: "int", require: true, desc: "购物车id"),
|
||||
// ApiDoc\Param(name: "refund_type", type: "int", require: true, desc: "退款申请类型"),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function apply_refund()
|
||||
{
|
||||
$params = (new OrderValidate())->post()->goCheck('add');
|
||||
@ -506,14 +518,14 @@ class OrderController extends BaseApiController
|
||||
return $this->success('申请成功');
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('订单退款原因'),
|
||||
ApiDoc\url('/api/order/order/refund_reason'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\Param(),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('订单退款原因'),
|
||||
// ApiDoc\url('/api/order/order/refund_reason'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\Param(),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function refund_reason()
|
||||
{
|
||||
$data = DictData::where('type_value', 'reason')->where('status', YesNoEnum::YES)
|
||||
@ -522,14 +534,14 @@ class OrderController extends BaseApiController
|
||||
}
|
||||
|
||||
|
||||
#[
|
||||
ApiDoc\Title('取消售后'),
|
||||
ApiDoc\url('/api/order/order/cancel_sale'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\Param(name: "order_id", type: "int", require: true, desc: "订单id"),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('取消售后'),
|
||||
// ApiDoc\url('/api/order/order/cancel_sale'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\Param(name: "order_id", type: "int", require: true, desc: "订单id"),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function cancel_sale()
|
||||
{
|
||||
$order_id = (int)$this->request->get('order_id');
|
||||
|
@ -3,8 +3,7 @@
|
||||
namespace app\api\controller\product;
|
||||
use app\api\controller\BaseApiController;
|
||||
use app\api\lists\product\ProductLists;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
#[ApiDoc\NotParse()]
|
||||
|
||||
|
||||
class ProductController extends BaseApiController{
|
||||
public $notNeedLogin = ['lists'];
|
||||
@ -13,7 +12,7 @@ class ProductController extends BaseApiController{
|
||||
*/
|
||||
public function lists(){
|
||||
|
||||
return $this->dataLists(new ProductLists());
|
||||
return $this->dataLists(new ProductLists(),1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -9,8 +9,7 @@ use app\common\model\dict\DictData;
|
||||
use app\common\model\merchant\Merchant;
|
||||
use app\common\model\supplier\Supplier;
|
||||
use think\facade\Db;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
#[ApiDoc\NotParse()]
|
||||
|
||||
|
||||
class IndexController extends BaseApiController{
|
||||
public $notNeedLogin = ['apply','get_token','merchat_type','record','apply_detail'];
|
||||
|
@ -3,8 +3,6 @@
|
||||
namespace app\api\controller\store;
|
||||
|
||||
use app\api\controller\BaseApiController;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
#[ApiDoc\title('收银机商品统计')]
|
||||
class ProductRecordController extends BaseApiController
|
||||
{
|
||||
|
||||
|
@ -2,13 +2,18 @@
|
||||
|
||||
namespace app\api\controller\store;
|
||||
|
||||
use app\admin\logic\user\UserLogic as UserUserLogic;
|
||||
use app\api\lists\store\SystemStoreLists;
|
||||
use app\api\controller\BaseApiController;
|
||||
use app\api\logic\store\StoreLogic;
|
||||
use app\common\service\pay\PayService;
|
||||
use Webman\Config;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
#[ApiDoc\NotParse()]
|
||||
use app\api\logic\user\UserLogic;
|
||||
use app\api\validate\UserValidate;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\logic\PaymentLogic;
|
||||
use app\common\logic\PayNotifyLogic;
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\user_recharge\UserRecharge;
|
||||
use Webman\RedisQueue\Redis;
|
||||
|
||||
class StoreController extends BaseApiController
|
||||
{
|
||||
@ -19,19 +24,78 @@ class StoreController extends BaseApiController
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 门店信息
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$store_id = (int)$this->request->get('store_id');
|
||||
$where = [
|
||||
'id' => $store_id
|
||||
];
|
||||
$phone = (int)$this->request->get('phone');
|
||||
$where = [];
|
||||
if($phone){
|
||||
$where['phone'] = $phone;
|
||||
}
|
||||
if($store_id){
|
||||
$where['id'] = $store_id;
|
||||
}
|
||||
|
||||
$info = StoreLogic::search($where);
|
||||
if ($info) {
|
||||
return $this->data($info);
|
||||
return $this->success('ok',$info??[]);
|
||||
} else {
|
||||
return $this->fail('店铺不存在');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 门店会员充值
|
||||
*/
|
||||
public function recharge()
|
||||
{
|
||||
$params = (new UserValidate())->post()->goCheck('rechargeStoreMoney');
|
||||
$auth_code = $this->request->post('auth_code'); //微信支付条码
|
||||
$find=User::where('mobile',$params['mobile'])->find();
|
||||
if(!$find){
|
||||
$find=UserUserLogic::StoreAdd($params);
|
||||
}else{
|
||||
$find['real_name']=$params['real_name'];
|
||||
$find->save();
|
||||
}
|
||||
$data=[
|
||||
'store_id'=>$params['store_id'],
|
||||
'uid'=>$find['id'],
|
||||
'staff_id'=>0,
|
||||
'order_id'=>getNewOrderId('CZ'),
|
||||
'price'=>0.01,
|
||||
'recharge_type'=>'INDUSTRYMEMBERS',
|
||||
];
|
||||
$order = UserRecharge::create($data);
|
||||
|
||||
$order['pay_price']=$order['price'];
|
||||
$result = PaymentLogic::codepay($auth_code, $order,'条码支付');
|
||||
if (PaymentLogic::hasError()) {
|
||||
return $this->fail(PaymentLogic::getError(), $params);
|
||||
}
|
||||
if (isset($result['trade_state_desc']) && $result['trade_state_desc'] == '支付成功') {
|
||||
PayNotifyLogic::handle('recharge', $result['out_trade_no'], $result);
|
||||
} else {
|
||||
Redis::send('send-code-pay', ['order_id' => $order['order_id'],'pay_type'=>'recharge']);
|
||||
return $this->success('用户支付中');
|
||||
}
|
||||
return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::WECHAT_PAY_BARCODE, 'transaction_id' => $result['transaction_id']]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 门店会员充值数量
|
||||
*/
|
||||
public function recharge_count()
|
||||
{
|
||||
$store_id = $this->request->get('store_id',0);
|
||||
$count=0;
|
||||
if($store_id){
|
||||
$count= UserRecharge::where(['store_id'=>$store_id,'recharge_type'=>'INDUSTRYMEMBERS','paid'=>1])->count();
|
||||
}
|
||||
return $this->success('ok',['count'=>$count]);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,7 @@
|
||||
namespace app\api\controller\store;
|
||||
|
||||
use app\api\controller\BaseApiController;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
#[ApiDoc\title('收银机盈收统计')]
|
||||
|
||||
class TransactionRecordController extends BaseApiController
|
||||
{
|
||||
|
||||
|
@ -6,8 +6,7 @@ use app\api\controller\BaseApiController;
|
||||
use app\api\lists\user\UserAddressList;
|
||||
use app\api\logic\user\AddressLogic;
|
||||
use app\api\validate\UserAddressValidate;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
#[ApiDoc\NotParse()]
|
||||
|
||||
|
||||
class AddressController extends BaseApiController
|
||||
{
|
||||
|
@ -7,10 +7,7 @@ use app\api\logic\user\UserLogic;
|
||||
use app\api\validate\UserValidate;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\logic\PaymentLogic;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
use taoser\Validate;
|
||||
|
||||
#[ApiDoc\title('用户')]
|
||||
|
||||
/**
|
||||
* 用户控制器
|
||||
@ -19,15 +16,15 @@ use taoser\Validate;
|
||||
*/
|
||||
class UserController extends BaseApiController
|
||||
{
|
||||
#[
|
||||
ApiDoc\Title('获取小程序手机号'),
|
||||
ApiDoc\url('/api/user/user/getMobileByMnp'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\Param(name: "code", type: "string", require: true, desc: "换取手机的code"),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('获取小程序手机号'),
|
||||
// ApiDoc\url('/api/user/user/getMobileByMnp'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\Param(name: "code", type: "string", require: true, desc: "换取手机的code"),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function getMobileByMnp()
|
||||
{
|
||||
$params = (new UserValidate())->post()->goCheck('getMobileByMnp');
|
||||
@ -41,45 +38,45 @@ class UserController extends BaseApiController
|
||||
}
|
||||
|
||||
|
||||
#[
|
||||
ApiDoc\Title('用户个人信息'),
|
||||
ApiDoc\url('/api/user/user/info'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\Param(),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('用户个人信息'),
|
||||
// ApiDoc\url('/api/user/user/info'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\Param(),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function info()
|
||||
{
|
||||
return $this->success('success', UserLogic::info($this->userId));
|
||||
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('充值金额'),
|
||||
ApiDoc\url('/api/user/user/rechange_amount'),
|
||||
ApiDoc\Method('Get'),
|
||||
ApiDoc\Param(),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('充值金额'),
|
||||
// ApiDoc\url('/api/user/user/rechange_amount'),
|
||||
// ApiDoc\Method('Get'),
|
||||
// ApiDoc\Param(),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function rechange_amount()
|
||||
{
|
||||
$res = UserLogic::rechange_level();
|
||||
return $this->success('ok',$res);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('小程序充值'),
|
||||
ApiDoc\url('/api/user/user/recharge'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\Param(name: "price", type: "string", require: true, desc: "金额"),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('小程序充值'),
|
||||
// ApiDoc\url('/api/user/user/recharge'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\Param(name: "price", type: "string", require: true, desc: "金额"),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function recharge()
|
||||
{
|
||||
$params = (new UserValidate())->post()->goCheck('rechargeMoney');
|
||||
@ -92,19 +89,18 @@ class UserController extends BaseApiController
|
||||
return $this->fail(PaymentLogic::getError(), $params);
|
||||
}
|
||||
return $this->success('', $result);
|
||||
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('会员账户详情'),
|
||||
ApiDoc\url('/api/user/user/capital_flow'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\Param(name: "page_no", type: "int", require: true, desc: "默认1页数"),
|
||||
ApiDoc\Param(name: "page_size", type: "int", require: false, desc: "条数默认15"),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('会员账户详情'),
|
||||
// ApiDoc\url('/api/user/user/capital_flow'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\Param(name: "page_no", type: "int", require: true, desc: "默认1页数"),
|
||||
// ApiDoc\Param(name: "page_size", type: "int", require: false, desc: "条数默认15"),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function capital_flow()
|
||||
{
|
||||
$page_no = (int)$this->request->post('page_no',1);
|
||||
@ -122,15 +118,15 @@ class UserController extends BaseApiController
|
||||
return $this->success('ok',$res);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('会员账户统计'),
|
||||
ApiDoc\url('/api/user/user/capital_count'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\Param(),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('会员账户统计'),
|
||||
// ApiDoc\url('/api/user/user/capital_count'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\Param(),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function capital_count()
|
||||
{
|
||||
$res = UserLogic::capital_count($this->userId);
|
||||
|
@ -6,8 +6,7 @@
|
||||
use app\api\logic\user\UserFeedbackLogic;
|
||||
use app\admin\validate\user\UserFeedbackValidate;
|
||||
use app\api\controller\BaseApiController;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
#[ApiDoc\NotParse()]
|
||||
|
||||
|
||||
class UserFeedbackController extends BaseApiController
|
||||
{
|
||||
|
24
app/api/controller/user/UserRechargeController.php
Normal file
24
app/api/controller/user/UserRechargeController.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller\user;
|
||||
|
||||
use app\api\lists\user\UserFeedbackLists;
|
||||
use app\api\logic\user\UserFeedbackLogic;
|
||||
use app\admin\validate\user\UserFeedbackValidate;
|
||||
use app\api\controller\BaseApiController;
|
||||
use app\api\lists\user\UserRechargeLists;
|
||||
|
||||
class UserRechargeController extends BaseApiController
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 获取用户充值
|
||||
* @return \support\Response
|
||||
* @author likeadmin
|
||||
* @date 2024/05/13 16:56
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new UserRechargeLists());
|
||||
}
|
||||
}
|
@ -5,25 +5,23 @@ namespace app\api\controller\user;
|
||||
use app\api\controller\BaseApiController;
|
||||
use app\api\logic\user\UserVisitLogic;
|
||||
use app\api\validate\VisitValidate;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use support\Response;
|
||||
|
||||
#[ApiDoc\title('用户访问')]
|
||||
class UserVisitController extends BaseApiController
|
||||
{
|
||||
public $notNeedLogin = ['productLog'];
|
||||
#[
|
||||
ApiDoc\Title('添加访问商品记录'),
|
||||
ApiDoc\url('/api/user/UserVisit/productLog'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\Param(name: "product_id", type: "int", require: true, desc: "product_id商品id"),
|
||||
ApiDoc\Param(name: "cate_id", type: "int", require: true, desc: "分类id"),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('添加访问商品记录'),
|
||||
// ApiDoc\url('/api/user/UserVisit/productLog'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\Param(name: "product_id", type: "int", require: true, desc: "product_id商品id"),
|
||||
// ApiDoc\Param(name: "cate_id", type: "int", require: true, desc: "分类id"),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function productLog(): Response
|
||||
{
|
||||
$params = (new VisitValidate())->post()->goCheck('add');
|
||||
@ -37,16 +35,16 @@ class UserVisitController extends BaseApiController
|
||||
}
|
||||
|
||||
|
||||
#[
|
||||
ApiDoc\Title('用户访问页面记录'),
|
||||
ApiDoc\url('/api/user/UserVisit/htmlLog'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\Param(name: "url", type: "string", require: true, desc: "路径"),
|
||||
ApiDoc\Param(name: "stay_time", type: "int", require: true, desc: "停留时间"),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('用户访问页面记录'),
|
||||
// ApiDoc\url('/api/user/UserVisit/htmlLog'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\Param(name: "url", type: "string", require: true, desc: "路径"),
|
||||
// ApiDoc\Param(name: "stay_time", type: "int", require: true, desc: "停留时间"),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function htmlLog()
|
||||
{
|
||||
$ip = $this->request->getRealIp();
|
||||
|
@ -46,6 +46,7 @@ class CateLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
$level = Request()->get('level', 1);
|
||||
$this->searchWhere[] = ['level', '=', $level];
|
||||
$this->searchWhere[] = ['count', '>', 0];
|
||||
$this->searchWhere[] = ['delete_time', '=', null];
|
||||
$cate_arr = Db::name('store_product_cate')->where($this->searchWhere)->column('cate_id');
|
||||
$lists = [];
|
||||
if ($cate_arr) {
|
||||
|
@ -63,7 +63,8 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
|
||||
foreach ($list as $key => &$item) {
|
||||
|
||||
$find = StoreBranchProduct::where(['product_id' => $item['product_id'],'store_id' => $item['store_id']])
|
||||
->field('product_id,image,price,cost,store_name,unit')
|
||||
->field('product_id,image,price,cost,store_name,unit,delete_time')
|
||||
->withTrashed()
|
||||
->find();
|
||||
// if (isset($check) && $check['status'] == 1) {
|
||||
// $find['price'] = $find['cost'];
|
||||
|
@ -88,17 +88,23 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface,Li
|
||||
}
|
||||
}
|
||||
if(!$found){
|
||||
$this->searchWhere[]=['store_id','=',2];
|
||||
$store_id = DictType::where('type','store')->value('remark')??5;
|
||||
$this->searchWhere[]=['store_id','=',$store_id];
|
||||
}
|
||||
$class_all=$this->request->get('class_all');
|
||||
$where=[];
|
||||
if($class_all){
|
||||
//查3级别的
|
||||
$arr=Cate::where('pid',$class_all)->column('id');
|
||||
if($arr){
|
||||
$arr2=Cate::where('pid','in',$arr)->column('id');
|
||||
$where[]=['cate_id','in',array_merge($arr,$arr2)];
|
||||
}
|
||||
}
|
||||
if(empty($where) && $class_all){
|
||||
//2或者1
|
||||
$where[]=['cate_id','=',$class_all];
|
||||
}
|
||||
|
||||
|
||||
$this->searchWhere[]=['status','=',1];
|
||||
@ -107,7 +113,7 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface,Li
|
||||
if($M_store_id){
|
||||
$where[]=['store_id','=',$M_store_id];
|
||||
$data = StoreBranchProduct::where($this->searchWhere)->where($where)
|
||||
->field(['id', 'product_id','cate_id','store_name', 'cost','store_id','price', 'bar_code','image','sales','store_info','delete_time','unit'])
|
||||
->field(['id', 'product_id','cate_id','store_name', 'cost','store_id','price', 'bar_code','image','sales','store_info','delete_time','unit','batch'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->with(['className','unitName'])
|
||||
->order($this->sortOrder)
|
||||
@ -116,7 +122,7 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface,Li
|
||||
|
||||
}else{
|
||||
$data = StoreBranchProduct::where($this->searchWhere)->where($where)
|
||||
->field(['id', 'product_id','cate_id','store_name','cost', 'store_id','price', 'bar_code','image','sales','store_info','delete_time','unit'])
|
||||
->field(['id', 'product_id','cate_id','store_name','cost', 'store_id','price', 'bar_code','image','sales','store_info','delete_time','unit','batch'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->with(['className','unitName'])
|
||||
->order($this->sortOrder)
|
||||
@ -159,7 +165,8 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface,Li
|
||||
}
|
||||
}
|
||||
if(!$found){
|
||||
$this->searchWhere[]=['store_id','=',2];
|
||||
$store_id = DictType::where('type','store')->value('remark')??5;
|
||||
$this->searchWhere[]=['store_id','=',$store_id];
|
||||
}
|
||||
$class_all=$this->request->get('class_all');
|
||||
$where=[];
|
||||
@ -170,6 +177,10 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface,Li
|
||||
$where[]=['cate_id','in',array_merge($arr,$arr2)];
|
||||
}
|
||||
}
|
||||
if(empty($where)&& $class_all){
|
||||
//2或者1
|
||||
$where[]=['cate_id','=',$class_all];
|
||||
}
|
||||
$M_store_id=$this->request->__get('store_id');
|
||||
$this->searchWhere[]=['status','=',1];
|
||||
$this->searchWhere[]=['stock','>',0];
|
||||
|
@ -49,7 +49,7 @@ class SystemStoreLists extends BaseAdminDataLists implements ListsSearchInterfac
|
||||
$latitude = $this->request->get('latitude','');
|
||||
$longitude = $this->request->get('longitude','');
|
||||
if(empty($longitude) || empty($latitude)){
|
||||
throw new MyBusinessException('缺失经纬度');
|
||||
throw new Exception('缺失经纬度');
|
||||
}
|
||||
$where[]=['is_show','=',YesNoEnum::YES];
|
||||
$data = SystemStore::where($this->searchWhere)->where($where)
|
||||
|
62
app/api/lists/user/UserRechargeLists.php
Normal file
62
app/api/lists/user/UserRechargeLists.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\lists\user;
|
||||
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\user\UserFeedback;
|
||||
use app\common\model\user_recharge\UserRecharge;
|
||||
|
||||
//用户充值表
|
||||
class UserRechargeLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/05/13 16:56
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['store_id','recharge_type'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取用户充值表列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/05/13 16:56
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return UserRecharge::where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$data['real_name'] =User::where('id',$data['uid'])->value('real_name');
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取用户充值表数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/05/13 16:56
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return UserRecharge::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
@ -8,6 +8,7 @@ use app\common\enum\UserShipEnum;
|
||||
use app\common\enum\YesNoEnum;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\logic\CapitalFlowLogic;
|
||||
use app\common\logic\PayNotifyLogic;
|
||||
use app\common\logic\StoreFinanceFlowLogic;
|
||||
use app\common\model\dict\DictData;
|
||||
use app\common\model\dict\DictType;
|
||||
@ -23,6 +24,7 @@ use app\common\model\system_store\SystemStoreStaff;
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\user\UserAddress;
|
||||
use app\common\model\user\UserShip;
|
||||
use app\common\model\user_spread_log\UserSpreadLog;
|
||||
use Picqer\Barcode\BarcodeGeneratorJPG;
|
||||
use Picqer\Barcode\BarcodeGeneratorPNG;
|
||||
use support\exception\BusinessException;
|
||||
@ -45,6 +47,7 @@ class OrderLogic extends BaseLogic
|
||||
public static $pay_price;
|
||||
public static $cost;
|
||||
public static $profit;
|
||||
public static $store_price;//门店零售价
|
||||
public static $activity_price;
|
||||
|
||||
/**
|
||||
@ -64,44 +67,55 @@ class OrderLogic extends BaseLogic
|
||||
try {
|
||||
self::$total_price = 0;
|
||||
self::$pay_price = 0;
|
||||
self::$cost = 0; //成本
|
||||
self::$cost = 0; //成本由采购价替代原成本为门店零售价
|
||||
self::$profit = 0; //利润
|
||||
self::$activity_price = 0; //活动减少
|
||||
self::$store_price = 0; //门店零售价
|
||||
/** 计算价格 */
|
||||
|
||||
foreach ($cart_select as $k => $v) {
|
||||
$find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field('id branch_product_id,store_name,image,unit,price,vip_price,cost,product_id')->find();
|
||||
$find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field('id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase,product_id')->withTrashed()->find();
|
||||
if (!$find) {
|
||||
continue;
|
||||
}
|
||||
unset($cart_select[$k]['id']);
|
||||
|
||||
$cart_select[$k]['price'] = $find['price'];
|
||||
$cart_select[$k]['cost'] = $find['cost'];
|
||||
$cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价
|
||||
$cart_select[$k]['deduction_price'] =self::$activity_price;//抵扣金额
|
||||
if ($user && $user['user_ship'] >= 1) {
|
||||
$cart_select[$k]['vip'] = 0;
|
||||
if ($user && $user['user_ship'] == 1) {
|
||||
//更新 会员为1的时候原价减去会员价
|
||||
$deduction_price_count=bcmul(bcsub($find['price'], $find['vip_price'], 2),$v['cart_num'],2);
|
||||
$cart_select[$k]['deduction_price'] =$deduction_price_count;
|
||||
self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2);
|
||||
$onePrice = bcsub($find['vip_price'], $find['cost'], 2);
|
||||
|
||||
}else{
|
||||
$onePrice = bcsub($find['price'], $find['cost'], 2);
|
||||
$cart_select[$k]['vip'] =1;
|
||||
}
|
||||
if ($user && $user['user_ship'] == 4) {
|
||||
//更新 为4商户的时候减去商户价格
|
||||
$deduction_price_count=bcmul(bcsub($find['price'], $find['cost'], 2),$v['cart_num'],2);
|
||||
$cart_select[$k]['deduction_price'] =$deduction_price_count;
|
||||
self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2);
|
||||
}
|
||||
|
||||
//利润
|
||||
$cart_select[$k]['profit'] = bcmul($v['cart_num'], $onePrice, 2); //利润
|
||||
$cart_select[$k]['cost'] = bcmul($v['cart_num'], $find['cost'], 2) ?? 0; //成本
|
||||
// $cart_select[$k]['profit'] = bcmul($v['cart_num'], $onePrice, 2); //利润
|
||||
$cart_select[$k]['purchase'] = bcmul($v['cart_num'], $find['purchase'], 2) ?? 0; //成本
|
||||
$cart_select[$k]['pay_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单支付金额
|
||||
$cart_select[$k]['store_price'] = bcmul($v['cart_num'], $find['cost'], 2)??0; //门店零售价
|
||||
$cart_select[$k]['vip_price'] = bcmul($v['cart_num'], $find['vip_price'], 2)??0; //vip售价
|
||||
|
||||
$cart_select[$k]['product_id'] = $find['product_id'];
|
||||
$cart_select[$k]['old_cart_id'] = $v['id'];
|
||||
$cart_select[$k]['cart_num'] = $v['cart_num'];
|
||||
$cart_select[$k]['verify_code'] = $params['verify_code'] ?? '';
|
||||
|
||||
//vip1待返回金额
|
||||
$cart_select[$k]['vip_frozen_price'] = bcsub($cart_select[$k]['pay_price'],$cart_select[$k]['vip_price'],2);
|
||||
// d($cart_select[$k]['pay_price'],$cart_select[$k]['store_price'],$cart_select[$k]['vip_price'] );
|
||||
$cartInfo = $cart_select[$k];
|
||||
$cartInfo['name'] = $find['store_name'];
|
||||
$cartInfo['image'] = $find['image'];
|
||||
|
||||
$cartInfo['vip_price'] = 0; //$cart_select[$k]['total'] - $vipPrice ?? 0;
|
||||
$cart_select[$k]['cart_info'] = json_encode($cartInfo);
|
||||
$cart_select[$k]['branch_product_id'] = $find['branch_product_id'];
|
||||
//理论上每笔都是拆分了
|
||||
@ -111,10 +125,16 @@ class OrderLogic extends BaseLogic
|
||||
$cart_select[$k]['unit_name'] = StoreProductUnit::where(['id' => $find['unit']])->value('name');
|
||||
self::$total_price = bcadd(self::$total_price, $cart_select[$k]['total_price'], 2);
|
||||
self::$pay_price = bcadd(self::$pay_price, $cart_select[$k]['pay_price'], 2);
|
||||
self::$cost = bcadd(self::$cost, $cart_select[$k]['cost'], 2);
|
||||
self::$profit = bcadd(self::$profit, $cart_select[$k]['profit'], 2);
|
||||
self::$cost = bcadd(self::$cost, $cart_select[$k]['purchase'], 2);
|
||||
self::$store_price = bcadd(self::$store_price, $cart_select[$k]['store_price'], 2);//门店零售价格
|
||||
// self::$profit = bcadd(self::$profit, $cart_select[$k]['profit'], 2);
|
||||
}
|
||||
$pay_price = bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额
|
||||
if ($user && $user['user_ship'] == 1) {
|
||||
$pay_price = self::$pay_price;
|
||||
}else{
|
||||
$pay_price =bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额
|
||||
}
|
||||
|
||||
$vipPrice = 0;
|
||||
//成本价 收益
|
||||
$order = [
|
||||
@ -122,7 +142,7 @@ class OrderLogic extends BaseLogic
|
||||
'order_id' => $params['order_id'] ?? getNewOrderId('PF'),
|
||||
'total_price' => self::$total_price, //总价
|
||||
'cost' => self::$cost, //成本价1-
|
||||
'profit' => self::$profit, //利润
|
||||
'profit' =>0, //利润
|
||||
'pay_price' => $pay_price, //后期可能有降价抵扣
|
||||
'vip_price' => $vipPrice,
|
||||
'total_num' => count($cart_select), //总数
|
||||
@ -134,13 +154,17 @@ class OrderLogic extends BaseLogic
|
||||
'activity' => '减免',
|
||||
'activity_price' => self::$activity_price,
|
||||
'activities' => self::$activity_price>0?1:0,
|
||||
'deduction_price' => self::$activity_price
|
||||
|
||||
'deduction_price' => self::$activity_price,
|
||||
'is_vip' => 0,
|
||||
];
|
||||
$order['default_delivery'] = 0;
|
||||
if ($params['store_id']) {
|
||||
$order['default_delivery'] = SystemStore::where('id', $params['store_id'])->value('is_send');
|
||||
}
|
||||
if($user && $user['user_ship']>=1 &&$user['user_ship']<=3){
|
||||
$order['is_vip'] = 1;
|
||||
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
@ -164,8 +188,8 @@ class OrderLogic extends BaseLogic
|
||||
return false;
|
||||
}
|
||||
$_order = $orderInfo['order'];
|
||||
$_order['uid'] = request()->userId;
|
||||
$user = User::where('id', \request()->userId)->find();
|
||||
$_order['uid'] = $user['id'];
|
||||
$_order['spread_uid'] =$params['spread_uid']??0;// UserSpreadLog::where('uid',request()->userId)->value('old_spread_uid')??0;//预留分享关系
|
||||
$_order['real_name'] = $user['real_name'];
|
||||
$_order['mobile'] = $user['mobile'];
|
||||
$_order['pay_type'] = $orderInfo['order']['pay_type'];
|
||||
@ -176,7 +200,7 @@ class OrderLogic extends BaseLogic
|
||||
$_order['reservation'] = YesNoEnum::YES;
|
||||
}
|
||||
if ($addressId > 0) {
|
||||
$address = UserAddress::where(['id' => $addressId, 'uid' => Request()->userId])->find();
|
||||
$address = UserAddress::where(['id' => $addressId, 'uid' => $user['id']])->find();
|
||||
if ($address) {
|
||||
$_order['real_name'] = $address['real_name'];
|
||||
$_order['user_phone'] = $address['phone'];
|
||||
@ -190,7 +214,7 @@ class OrderLogic extends BaseLogic
|
||||
$generator = new BarcodeGeneratorPNG();
|
||||
$barcode = $generator->getBarcode($verify_code, $generator::TYPE_CODE_128);
|
||||
$findPath = '/image/barcode/'.time().'.png';
|
||||
$savePath = 'public'.$findPath;
|
||||
$savePath = public_path().$findPath;
|
||||
file_put_contents($savePath, $barcode);
|
||||
$_order['verify_img'] = $findPath;
|
||||
Db::startTrans();
|
||||
@ -200,10 +224,10 @@ class OrderLogic extends BaseLogic
|
||||
$updateData = [];
|
||||
foreach ($goods_list as $k => $v) {
|
||||
$goods_list[$k]['oid'] = $order->id;
|
||||
$goods_list[$k]['uid'] = request()->userId;
|
||||
$goods_list[$k]['uid'] = $user['id'];
|
||||
$goods_list[$k]['cart_id'] = implode(',', $cartId);
|
||||
$goods_list[$k]['delivery_id'] = $params['store_id']; //商家id
|
||||
$StoreBranchProduct = StoreBranchProduct::where('id',$v['branch_product_id'])->find();
|
||||
$StoreBranchProduct = StoreBranchProduct::where('id',$v['branch_product_id'])->withTrashed()->find();
|
||||
$updateData[] = [
|
||||
'id' => $v['branch_product_id'],
|
||||
'stock' => $StoreBranchProduct['stock']-$v['cart_num'],
|
||||
@ -290,17 +314,16 @@ class OrderLogic extends BaseLogic
|
||||
|
||||
public static function purchaseAgain($order_id)
|
||||
{
|
||||
$arr = StoreOrderCartInfo::where('oid', $order_id)->field('product_id,cart_num,staff_id')->select();
|
||||
$arr = StoreOrderCartInfo::where('oid', $order_id)->field('product_id,cart_num,staff_id,store_id')->select();
|
||||
$data = [];
|
||||
foreach ($arr as $k => $v) {
|
||||
$data[$k]['product_id'] = $v['product_id'];
|
||||
$unique = StoreProductAttrValue::where('product_id', $v['product_id'])->value('v');
|
||||
$data[$k]['product_attr_unique'] = $unique;
|
||||
// $unique = StoreProductAttrValue::where('product_id', $v['product_id'])->value('v');
|
||||
$data[$k]['product_attr_unique'] = '';
|
||||
$data[$k]['cart_num'] = $v['cart_num'];
|
||||
$data[$k]['type'] = '';
|
||||
$data[$k]['uid'] = Request()->userId;
|
||||
$store_id = StoreProduct::where('id', $v['product_id'])->value('store_id');
|
||||
$data[$k]['store_id'] = $store_id;
|
||||
$data[$k]['store_id'] = $v['store_id'];
|
||||
$data[$k]['staff_id'] = $v['staff_id'];
|
||||
$data[$k]['combination_id'] = 0;
|
||||
$data[$k]['seckill_id'] = 0;
|
||||
@ -320,7 +343,7 @@ class OrderLogic extends BaseLogic
|
||||
}
|
||||
|
||||
|
||||
public static function detail($params,$url=''): array
|
||||
public static function detail($params,$url='',$param=[]): array
|
||||
{
|
||||
$find = StoreOrder::where($params)->findOrEmpty()->toArray();
|
||||
if ($find) {
|
||||
@ -342,6 +365,24 @@ class OrderLogic extends BaseLogic
|
||||
if($find['verify_img']){
|
||||
$find['verify_img'] = $url.$find['verify_img'];
|
||||
}
|
||||
//处理返回最近的店铺
|
||||
if($param['lat'] && $param['long']){
|
||||
$storeAll = SystemStore::field('id,name,phone,address,detailed_address,latitude,longitude')->select()->toArray();
|
||||
$nearestStore = null;
|
||||
$minDistance = PHP_FLOAT_MAX;
|
||||
foreach ($storeAll as $value){
|
||||
$value['distance'] = haversineDistance($value['latitude'],$value['longitude'],$param['lat'] ,$param['long']);
|
||||
if ($value['distance'] < $minDistance) {
|
||||
$minDistance = $value['distance'];
|
||||
$nearestStore = $value;
|
||||
}
|
||||
}
|
||||
if ($nearestStore) {
|
||||
$find['near_store'] =$nearestStore;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return $find;
|
||||
}
|
||||
@ -385,18 +426,24 @@ class OrderLogic extends BaseLogic
|
||||
'status' => OrderEnum::RECEIVED_GOODS,
|
||||
'is_writeoff' => OrderEnum::IS_OK,
|
||||
'update_time' => time(),
|
||||
'store_id' => $params['store_id'],
|
||||
'staff_id' => $params['staff_id']??0,
|
||||
], ['id' => $data['id']]);
|
||||
(new StoreOrderCartInfo())->update([
|
||||
'verify_code'=>$params['verify_code'].'-1',
|
||||
'writeoff_time' => time(),
|
||||
'is_writeoff' => YesNoEnum::YES,
|
||||
'store_id' => $params['store_id'],
|
||||
'staff_id' => $params['staff_id']??0,
|
||||
'update_time' => time(),
|
||||
], ['oid' => $data['id']]);
|
||||
$financeFlow = (new StoreFinanceFlowLogic)->getStoreOrder($data['id'], $data['store_id']);
|
||||
if (!empty($financeFlow)) {
|
||||
$capitalFlowLogic = new CapitalFlowLogic($data->store, 'store');
|
||||
$capitalFlowLogic->storeIncome('store_order_income', 'order', $data['id'], $financeFlow['number']);
|
||||
}
|
||||
// $financeFlow = (new StoreFinanceFlowLogic)->getStoreOrder($data['id'], $data['store_id']);
|
||||
// if (!empty($financeFlow)) {
|
||||
// $capitalFlowLogic = new CapitalFlowLogic($data->store, 'store');
|
||||
// $capitalFlowLogic->storeIncome('store_order_income', 'order', $data['id'], $financeFlow['number']);
|
||||
// }
|
||||
$order=StoreOrder::where('id',$data['id'])->find();
|
||||
PayNotifyLogic::afterPay($order);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
|
@ -67,8 +67,14 @@ class AddressLogic extends BaseLogic
|
||||
'phone' => $params['phone'],
|
||||
'detail' => $params['detail'],
|
||||
'is_default' => $params['is_default'],
|
||||
'province' => $params['province'],
|
||||
'city' => $params['city'],
|
||||
'area' => $params['area'],
|
||||
'street' => $params['street'],
|
||||
'village' => $params['village'],
|
||||
'brigade' => $params['brigade'],
|
||||
];
|
||||
UserAddress::where('uid', $params['uid'])->where('id', $params['address_id'])->update($data);
|
||||
UserAddress::where('uid', $params['uid'])->where('id', $params['id'])->update($data);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
@ -93,7 +99,7 @@ class AddressLogic extends BaseLogic
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取购物车表详情
|
||||
* @notes 获取地址详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
@ -101,6 +107,6 @@ class AddressLogic extends BaseLogic
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
return UserAddress::field('id address_id,real_name,phone,detail,is_default')->where('id',$params['address_id'])->findOrEmpty()->toArray();
|
||||
return UserAddress::field('id,real_name,phone,province,city,area,street,village,brigade,detail,is_default')->where($params)->findOrEmpty()->toArray();
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ namespace app\api\logic\user;
|
||||
use app\common\{logic\BaseLogic,
|
||||
model\dict\DictData,
|
||||
model\finance\CapitalFlow,
|
||||
model\store_finance_flow\StoreFinanceFlow,
|
||||
model\store_order\StoreOrder,
|
||||
model\system_store\DeliveryService,
|
||||
model\system_store\SystemStore,
|
||||
@ -14,6 +15,8 @@ use app\common\{logic\BaseLogic,
|
||||
model\user\UserRecharge,
|
||||
model\user\UserShip,
|
||||
service\wechat\WeChatMnpService};
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 会员逻辑层
|
||||
@ -66,7 +69,8 @@ class UserLogic extends BaseLogic
|
||||
public static function info($uid)
|
||||
{
|
||||
$data = User::with(['userShip'])->where('id',$uid)
|
||||
->field('id,avatar,real_name,nickname,account,mobile,sex,login_ip,now_money,total_recharge_amount,user_ship')
|
||||
->field('id,avatar,real_name,nickname,account,mobile,sex,login_ip,now_money,total_recharge_amount,user_ship
|
||||
,purchase_funds,integral')
|
||||
->find();
|
||||
//判断是不是员工
|
||||
if($data){
|
||||
@ -88,6 +92,10 @@ class UserLogic extends BaseLogic
|
||||
$data['store_id'] = $check['store_id'];
|
||||
}
|
||||
}
|
||||
$data['return_money'] = Db::name('vip_flow')->
|
||||
where(['user_id'=>$uid,'status'=>0])
|
||||
->sum('number');
|
||||
|
||||
}else{
|
||||
$data = [];
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ class UserAddressValidate extends BaseValidate
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['real_name','phone','detail','address_id']);
|
||||
return $this->only(['real_name','phone','id']);
|
||||
}
|
||||
|
||||
|
||||
|
@ -16,10 +16,14 @@ class UserValidate extends BaseValidate
|
||||
|
||||
protected $rule = [
|
||||
'code' => 'require',
|
||||
'store_id' => 'require',
|
||||
'mobile' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'code.require' => '参数缺失',
|
||||
'store_id.require' => '门店id',
|
||||
'mobile.require' => '手机',
|
||||
];
|
||||
|
||||
|
||||
@ -57,5 +61,14 @@ class UserValidate extends BaseValidate
|
||||
{
|
||||
return $this->only(['price']);
|
||||
}
|
||||
/**
|
||||
* @notes 充值
|
||||
* @return UserValidate
|
||||
* @Time: 2024/6/4 22:50
|
||||
*/
|
||||
public function sceneRechargeStoreMoney()
|
||||
{
|
||||
return $this->only(['price']);
|
||||
}
|
||||
|
||||
}
|
@ -7,9 +7,8 @@ namespace app\common\controller;
|
||||
use app\BaseController;
|
||||
use app\common\lists\BaseDataLists;
|
||||
use app\common\service\JsonService;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
|
||||
#[ApiDoc\NotParse()]
|
||||
|
||||
class BaseLikeController extends BaseController
|
||||
{
|
||||
public $notNeedLogin = [];
|
||||
@ -47,7 +46,7 @@ class BaseLikeController extends BaseController
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/8 00:40
|
||||
*/
|
||||
protected function dataLists(BaseDataLists $lists = null)
|
||||
protected function dataLists(BaseDataLists $lists = null,$remark = 0)
|
||||
{
|
||||
//列表类和控制器一一对应,"app/应用/controller/控制器的方法" =》"app\应用\lists\"目录下
|
||||
//(例如:"app/admin/controller/auth/AdminController.php的lists()方法" =》 "app/admin/lists/auth/AminLists.php")
|
||||
@ -56,7 +55,7 @@ class BaseLikeController extends BaseController
|
||||
// $listName = str_replace('.', '\\', App::getNamespace() . '\\lists\\' . $this->request->controller() . ucwords($this->request->action()));
|
||||
// $lists = invoke($listName);
|
||||
}
|
||||
return JsonService::dataLists($lists);
|
||||
return JsonService::dataLists($lists,$remark);
|
||||
}
|
||||
|
||||
|
||||
@ -74,10 +73,7 @@ class BaseLikeController extends BaseController
|
||||
return JsonService::fail($msg, $data, $code, $show);
|
||||
}
|
||||
|
||||
#[ApiDoc\NotParse()]
|
||||
#[
|
||||
ApiDoc\Title('是否免登录验证'),
|
||||
]
|
||||
|
||||
public function isNotNeedLogin() : bool
|
||||
{
|
||||
$notNeedLogin = $this->notNeedLogin;
|
||||
|
@ -2,22 +2,21 @@
|
||||
|
||||
namespace app\common\controller;
|
||||
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
|
||||
class Definitions
|
||||
{
|
||||
|
||||
#[
|
||||
ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
// ]
|
||||
public function token()
|
||||
{
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Query("page_no", type: "int", require: false, default: 1, desc: "页码"),
|
||||
ApiDoc\Query("page_size", type: "int", require: false, default: 25, desc: "每页条数"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Query("page_no", type: "int", require: false, default: 1, desc: "页码"),
|
||||
// ApiDoc\Query("page_size", type: "int", require: false, default: 25, desc: "每页条数"),
|
||||
// ]
|
||||
public function page()
|
||||
{
|
||||
|
||||
|
@ -16,9 +16,15 @@ class OrderEnum
|
||||
* @MERCHANT_ORDER_PAY 商户订单支付
|
||||
* @PLATFORM_ORDER_OBTAINS 平台订单获得
|
||||
* @SUPPLIER_ORDER_OBTAINS 供应链订单获得
|
||||
* @VIP_ORDER_OBTAINS 会员订单获得
|
||||
* @VILLAGE_ORDER_OBTAINS 村长获得
|
||||
* @BRIGADE_ORDER_OBTAINS 队长获得
|
||||
* @OTHER_ORDER_OBTAINS 其他获得
|
||||
* @PLATFORM_ORDER_PAY 平台订单支付
|
||||
* @SYSTEM_SET 系统设置
|
||||
* @OWN_GET 平台收入
|
||||
* @ORDER_MARGIN 商户保证金
|
||||
* @PURCHASE_FUNDS 采购款收银
|
||||
*/
|
||||
const USER_ORDER_PAY = 1;
|
||||
const MERCHANT_ORDER_OBTAINS = 2;
|
||||
@ -28,11 +34,18 @@ class OrderEnum
|
||||
const SUPPLIER_ORDER_OBTAINS = 6;
|
||||
const PLATFORM_ORDER_PAY = 7;
|
||||
const SYSTEM_SET = 8;
|
||||
const CASHIER_ORDER_PAY = 9;
|
||||
const CASHIER_ORDER_PAY = 9;//微信条码
|
||||
const CASHIER_CASH_ORDER_PAY = 10;
|
||||
|
||||
const ORDER_MARGIN = 11;
|
||||
const ORDER_COMMITION = 12;
|
||||
const VIP_ORDER_OBTAINS = 12;
|
||||
const CASHIER_ORDER_ALI_PAY = 13;//支付宝条码
|
||||
const VILLAGE_ORDER_OBTAINS = 14;
|
||||
const BRIGADE_ORDER_OBTAINS = 15;
|
||||
const OTHER_ORDER_OBTAINS = 16;
|
||||
|
||||
const CASHIER_FACE_PAY = 17;//现金收银
|
||||
|
||||
const PURCHASE_FUNDS = 18;//采购款收银
|
||||
|
||||
|
||||
/**
|
||||
@ -87,6 +100,7 @@ class OrderEnum
|
||||
|
||||
/**小程序下单**/
|
||||
const ONLINE = [1,2];
|
||||
const OFFLINE = [3];
|
||||
/**
|
||||
* 账户类型
|
||||
* @USER 用户
|
||||
@ -118,6 +132,10 @@ class OrderEnum
|
||||
const REFUND_STATUS_FINISH = 2;
|
||||
const CANCEL_SALE = 3;
|
||||
|
||||
//判断资金流水是否余额支付
|
||||
const BALANCE_PAYMEN_NO = 1;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取支付类型
|
||||
* @param bool $value
|
||||
@ -131,11 +149,20 @@ class OrderEnum
|
||||
self::USER_ORDER_PAY => '用户订单支付',
|
||||
self::MERCHANT_ORDER_PAY => '商户订单支付',
|
||||
self::PLATFORM_ORDER_PAY => '平台订单支付',
|
||||
self::MERCHANT_ORDER_OBTAINS => '商户订单获得',
|
||||
self::ORDER_HANDLING_FEES => '订单手续费',
|
||||
self::PLATFORM_ORDER_OBTAINS => '平台订单获得',
|
||||
self::SUPPLIER_ORDER_OBTAINS => '供应商订单获得',
|
||||
self::MERCHANT_ORDER_OBTAINS => '商户',
|
||||
self::ORDER_HANDLING_FEES => '手续费',
|
||||
self::PLATFORM_ORDER_OBTAINS => '平台',
|
||||
self::SUPPLIER_ORDER_OBTAINS => '供应商',
|
||||
self::SYSTEM_SET => '平台设置',
|
||||
self::VILLAGE_ORDER_OBTAINS => '村长',
|
||||
self::BRIGADE_ORDER_OBTAINS=>'队长',
|
||||
self::ORDER_MARGIN=>'保证金',
|
||||
self::VIP_ORDER_OBTAINS=>'会员',
|
||||
self::OTHER_ORDER_OBTAINS=>'其他',
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
];
|
||||
|
@ -31,6 +31,7 @@ class PayEnum
|
||||
* @GOODS_FIRST_PAYMENT_LATER 先货后款
|
||||
* @CORPORATE_TRANSFER 对公转账
|
||||
* @CASH_PAY 现金支付
|
||||
* @PURCHASE_FUNDS 采购款收银
|
||||
*/
|
||||
const BALANCE_PAY = 3;
|
||||
const WECHAT_PAY = 1;
|
||||
@ -49,7 +50,7 @@ class PayEnum
|
||||
const GOODS_FIRST_PAYMENT_LATER = 15;
|
||||
const CORPORATE_TRANSFER = 16;
|
||||
const CASH_PAY = 17;
|
||||
|
||||
const PURCHASE_FUNDS = 18;//采购款收银
|
||||
//支付状态
|
||||
const UNPAID = 0; //未支付
|
||||
const ISPAID = 1; //已支付
|
||||
@ -99,6 +100,7 @@ class PayEnum
|
||||
self::ALIPAY_QRCODE => '支付宝二维码',
|
||||
self::ALIPAY_BARCODE => '支付宝条码',
|
||||
self::BALANCE_PAY => '余额支付',
|
||||
self::PURCHASE_FUNDS => '采购款收银',
|
||||
|
||||
];
|
||||
if ($value === true) {
|
||||
|
@ -8,9 +8,14 @@ class UserShipEnum
|
||||
* 会员等级
|
||||
*/
|
||||
const VIP1 = 1;
|
||||
const VIP2 = 7;
|
||||
const VIP3 = 8;
|
||||
const VIP4 = 9;
|
||||
const VIP5 = 10;
|
||||
const VIP2 = 2;
|
||||
const VIP3 = 3;
|
||||
const VIP4 = 4;
|
||||
const VIP5 = 5;
|
||||
|
||||
/**
|
||||
* 切换折扣价
|
||||
*/
|
||||
const DISCOUNT_ARRAY = [4,5,6];
|
||||
|
||||
}
|
63
app/common/lists/user/UserShipLists.php
Normal file
63
app/common/lists/user/UserShipLists.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\common\lists\user;
|
||||
|
||||
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\model\user\UserShip;
|
||||
|
||||
/**
|
||||
* 会员类型
|
||||
*/
|
||||
class UserShipLists extends BaseAdminDataLists
|
||||
{
|
||||
/**
|
||||
* @notes 搜索条件
|
||||
* @return array
|
||||
* @author 乔峰
|
||||
* @date 2022/9/22 15:50
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获会员类型列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 乔峰
|
||||
* @date 2022/9/22 15:50
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
|
||||
$field = "id,title";
|
||||
$arr[]=['id'=>0,'title'=>'一般用户'];
|
||||
|
||||
$lists = UserShip::where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->field($field)
|
||||
->order('sort desc')
|
||||
->select()
|
||||
->toArray();
|
||||
return array_merge($arr,$lists);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author 乔峰
|
||||
* @date 2022/9/22 15:51
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return UserShip::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace app\common\logic;
|
||||
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\model\finance\CapitalFlow;
|
||||
|
||||
class CapitalFlowLogic extends BaseLogic
|
||||
@ -49,27 +50,29 @@ class CapitalFlowLogic extends BaseLogic
|
||||
/**
|
||||
* 用户支出
|
||||
* @param $category
|
||||
* @param $store_id
|
||||
* @param $linkType
|
||||
* @param $linkId
|
||||
* @param $amount
|
||||
* @param $mark
|
||||
* @return mixed
|
||||
*/
|
||||
public function userExpense($category, $linkType, $linkId, $amount, $mark = '',$payType=0)
|
||||
public function userExpense($category, $linkType, $linkId, $amount, $mark = '',$payType=0,$store_id=0)
|
||||
{
|
||||
$model = new CapitalFlow();
|
||||
$model->uid = $this->user['id'];
|
||||
$model->category = $category;
|
||||
$model->store_id = $store_id;
|
||||
$model->link_type = $linkType;
|
||||
$model->link_id = $linkId;
|
||||
$model->amount = $amount;
|
||||
// if($payType == 1){
|
||||
if($payType == OrderEnum::BALANCE_PAYMEN_NO){
|
||||
$model->before_balance = $this->user['now_money'];
|
||||
$model->balance = $this->user['now_money'];
|
||||
// }else{
|
||||
// $model->before_balance = $this->user['now_money'];
|
||||
// $model->balance = bcsub($this->user['now_money'], $amount, 2);
|
||||
// }
|
||||
}else{
|
||||
$model->before_balance = $this->user['now_money'];
|
||||
$model->balance = bcsub($this->user['now_money'], $amount, 2);
|
||||
}
|
||||
$model->create_time = date('Y-m-d H:i:s');
|
||||
$model->type = 'out';
|
||||
$model->title = $this->getTitle($category, $amount);
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace app\common\logic;
|
||||
|
||||
use app\common\enum\YesNoEnum;
|
||||
use app\common\model\store_cash_finance_flow\StoreCashFinanceFlow;
|
||||
|
||||
class CashFlowLogic extends BaseLogic
|
||||
@ -13,6 +14,7 @@ class CashFlowLogic extends BaseLogic
|
||||
$model->store_id = $storeId;
|
||||
$model->cash_price = $amount;
|
||||
$model->receivable = $amount;
|
||||
$model->status = YesNoEnum::YES;//收银台收了默认算完成了
|
||||
$model->save();
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace app\common\logic;
|
||||
|
||||
use app\api\logic\order\OrderLogic;
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\enum\user\UserShipEnum;
|
||||
@ -10,10 +11,13 @@ use app\common\model\finance\PayNotifyLog;
|
||||
use app\common\model\pay\PayNotify;
|
||||
use app\common\model\store_finance_flow\StoreFinanceFlow;
|
||||
use app\common\model\store_order\StoreOrder;
|
||||
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
||||
use app\common\model\system_store\SystemStore;
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\user\UserAddress;
|
||||
use app\common\model\user\UserRecharge;
|
||||
use app\common\model\user\UserShip;
|
||||
use app\common\model\user_sign\UserSign;
|
||||
use app\common\service\PushService;
|
||||
use support\Log;
|
||||
use think\facade\Db;
|
||||
@ -27,11 +31,11 @@ use Webman\RedisQueue\Redis;
|
||||
class PayNotifyLogic extends BaseLogic
|
||||
{
|
||||
|
||||
public static function handle($action, $orderSn, $extra = [])
|
||||
public static function handle($action, $orderSn, $extra = [], $type = 'wechat')
|
||||
{
|
||||
// Db::startTrans();
|
||||
// try {
|
||||
if ($action != 'cash_pay' && $action != 'balancePay') {
|
||||
Db::startTrans();
|
||||
try {
|
||||
if ($action != 'cash_pay' && $action != 'balancePay' && $action != 'purchase_funds') {
|
||||
$payNotifyLogLogic = new PayNotifyLogLogic();
|
||||
if ($action == 'refund') {
|
||||
$payNotifyLogLogic->insert($action, $extra, PayNotifyLog::TYPE_REFUND);
|
||||
@ -39,14 +43,14 @@ class PayNotifyLogic extends BaseLogic
|
||||
$payNotifyLogLogic->insert($action, $extra);
|
||||
}
|
||||
}
|
||||
self::$action($orderSn, $extra);
|
||||
// Db::commit();
|
||||
self::$action($orderSn, $extra, $type);
|
||||
Db::commit();
|
||||
return true;
|
||||
// } catch (\Exception $e) {
|
||||
// Db::rollback();
|
||||
// Log::error('支付回调处理失败' . $e->getMessage() . ',lien:' . $e->getLine() . ',file:' . $e->getFile());
|
||||
// throw new \Exception($e->getMessage());
|
||||
// }
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::error('支付回调处理失败' . $e->getMessage() . ',lien:' . $e->getLine() . ',file:' . $e->getFile());
|
||||
throw new \Exception($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -75,11 +79,64 @@ class PayNotifyLogic extends BaseLogic
|
||||
$user->now_money = bcsub($user['now_money'], $order['pay_price'], 2);
|
||||
$user->save();
|
||||
|
||||
if ($order['spread_uid'] > 0 && $user['user_ship'] == 1) {
|
||||
$oldUser = User::where('id',$order['spread_uid'])->value('purchase_funds');
|
||||
if ($oldUser < $order['pay_price']) {
|
||||
$order['pay_price'] = $oldUser;
|
||||
}
|
||||
}
|
||||
$capitalFlowDao = new CapitalFlowLogic($user);
|
||||
$capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order['pay_price']);
|
||||
self::afterPay($order);
|
||||
Redis::send('push-platform-print', ['id' => $order['id']], 60);
|
||||
$capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order['pay_price'],'',0,$order['store_id']);
|
||||
// self::afterPay($order);
|
||||
// Redis::send('push-platform-print', ['id' => $order['id']], 60);
|
||||
// PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 采购款支付
|
||||
* @param $orderSn
|
||||
* @param $extra
|
||||
* @return void
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public static function purchase_funds($orderSn, $extra = [])
|
||||
{
|
||||
$order = StoreOrder::where('order_id', $orderSn)->findOrEmpty();
|
||||
$user = User::where('id', $order['uid'])->find();
|
||||
if ($user['purchase_funds'] < $order['pay_price']) {
|
||||
throw new \Exception('采购款不足');
|
||||
}
|
||||
$order->money = $order['pay_price'];
|
||||
$order->paid = 1;
|
||||
$order->pay_time = time();
|
||||
if (!$order->save()) {
|
||||
throw new \Exception('订单保存出错');
|
||||
}
|
||||
// 减去采购款
|
||||
$user->purchase_funds = bcsub($user['purchase_funds'], $order['pay_price'], 2);
|
||||
$user->save();
|
||||
|
||||
$capitalFlowDao = new CapitalFlowLogic($user);
|
||||
$capitalFlowDao->userExpense('user_order_purchase_pay', 'order', $order['id'], $order['pay_price'],'',1,$order['store_id']);
|
||||
if ($user['user_ship'] == 1) {
|
||||
self::dealVipAmount($order, PayEnum::PURCHASE_FUNDS);
|
||||
}
|
||||
|
||||
if($extra && $extra['store_id']){
|
||||
$params = [
|
||||
'verify_code'=>$order['verify_code'],
|
||||
'store_id'=>$extra['store_id'],
|
||||
'staff_id'=>$extra['staff_id']
|
||||
];
|
||||
OrderLogic::writeOff($params);
|
||||
}
|
||||
|
||||
// self::afterPay($order);
|
||||
// Redis::send('push-platform-print', ['id' => $order['id']], 60);
|
||||
// PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -105,29 +162,25 @@ class PayNotifyLogic extends BaseLogic
|
||||
$extra['transaction_id'] = time();
|
||||
}
|
||||
$user = User::where('id', $order['uid'])->find();
|
||||
if ($order->pay_type == 9) {
|
||||
if ($order->pay_type == OrderEnum::CASHIER_ORDER_PAY || $order->pay_type == OrderEnum::CASHIER_ORDER_ALI_PAY) { //收银台支付
|
||||
$order->status = 2;
|
||||
self::afterPay($order, $extra['transaction_id']);
|
||||
} else {
|
||||
$capitalFlowDao = new CapitalFlowLogic($user);
|
||||
//微信支付和用户余额无关
|
||||
$capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order->pay_price, '', 1);
|
||||
}
|
||||
self::afterPay($order, $extra['transaction_id']);
|
||||
|
||||
//活动期间消费
|
||||
$check = DictType::where('type', 'activities')->find();
|
||||
if (isset($check) && $check['status'] == 1 && in_array($order->pay_type,[9,17])==false && $user['user_ship'] == 0) {
|
||||
self::dealChange($order['uid']);
|
||||
$capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order->pay_price, '', 1,$order['store_id']);
|
||||
}
|
||||
|
||||
if ($order->pay_type == 9) {
|
||||
$extra['create_time'] = $order['create_time'];
|
||||
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'cash_register', 'msg' => '您有一笔订单已支付', 'data' => $extra]);
|
||||
} else {
|
||||
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
|
||||
// Db::name('order_middle')->insert(['c_order_id' => $order['id']]);
|
||||
}
|
||||
Redis::send('push-platform-print', ['id' => $order['id']]);
|
||||
|
||||
// if ($order->pay_type == 9) {
|
||||
// $extra['create_time'] = $order['create_time'];
|
||||
// PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'cash_register', 'msg' => '您有一笔订单已支付', 'data' => $extra]);
|
||||
// Redis::send('push-platform-print', ['id' => $order['id']]);
|
||||
// }
|
||||
// else {
|
||||
// PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
|
||||
// Db::name('order_middle')->insert(['c_order_id' => $order['id']]);
|
||||
// }
|
||||
if (!empty($extra['payer']['openid']) && $order->pay_type == 7) {
|
||||
Redis::send('push-delivery', ['order_id' => $order['order_id'], 'openid' => $extra['payer']['openid']], 5);
|
||||
}
|
||||
@ -155,13 +208,17 @@ class PayNotifyLogic extends BaseLogic
|
||||
/**
|
||||
* 充值
|
||||
*/
|
||||
public static function recharge($orderSn, $extra = [])
|
||||
public static function recharge($orderSn, $extra = [], $type = 'wechat')
|
||||
{
|
||||
$order = UserRecharge::where('order_id', $orderSn)->findOrEmpty();
|
||||
if ($order->isEmpty() || $order->paid == PayEnum::ISPAID) {
|
||||
return true;
|
||||
}
|
||||
$price = bcdiv($extra['amount']['payer_total'], 100, 2);
|
||||
if ($type == 'wechat') {
|
||||
$price = bcdiv($extra['amount']['payer_total'], 100, 2);
|
||||
} else {
|
||||
$price = $extra['buyer_pay_amount'];
|
||||
}
|
||||
$order->price = $price;
|
||||
$order->paid = 1;
|
||||
$order->pay_time = time();
|
||||
@ -171,19 +228,23 @@ class PayNotifyLogic extends BaseLogic
|
||||
//用户的财务add
|
||||
$capitalFlowDao = new CapitalFlowLogic($user);
|
||||
$capitalFlowDao->userIncome('user_balance_recharge', 'user_recharge', $order['id'], $price);
|
||||
|
||||
|
||||
if ($user->isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
bcscale(2);
|
||||
$user->now_money = bcadd($user->now_money, $price, 2);
|
||||
// $user->now_money = bcadd($user->now_money, $price, 2);//v.1
|
||||
//更新等级
|
||||
if ($price >= 0.01) {
|
||||
$user->user_ship = 1; //v.1
|
||||
}
|
||||
$user->purchase_funds = bcadd($user->purchase_funds, $price, 2);
|
||||
$user->total_recharge_amount = bcadd($user->total_recharge_amount, $price, 2);
|
||||
$user->save();
|
||||
|
||||
//更新等级
|
||||
self::dealLevel($uid, $user->total_recharge_amount);
|
||||
if (!empty($extra['payer']['openid']) ) {
|
||||
Redis::send('push-delivery', ['order_id' => $order['order_id'], 'openid' => $extra['payer']['openid'],'logistics_type'=>3], 5);
|
||||
|
||||
if (!empty($extra['payer']['openid'])) {
|
||||
Redis::send('push-delivery', ['order_id' => $order['order_id'], 'openid' => $extra['payer']['openid'], 'logistics_type' => 3], 5);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -204,9 +265,10 @@ class PayNotifyLogic extends BaseLogic
|
||||
if (!$order->save()) {
|
||||
throw new \Exception('订单保存出错');
|
||||
}
|
||||
self::afterPay($order);
|
||||
$cashFlowLogic = new CashFlowLogic();
|
||||
$cashFlowLogic->insert($order['store_id'], $order['pay_price']);
|
||||
Redis::send('push-platform-print', ['id' => $order['id']]);
|
||||
// Redis::send('push-platform-print', ['id' => $order['id']]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -234,16 +296,17 @@ class PayNotifyLogic extends BaseLogic
|
||||
}
|
||||
if ($order->pay_type == 9) {
|
||||
$order->status = 2;
|
||||
self::afterPay($order);
|
||||
}
|
||||
self::afterPay($order);
|
||||
|
||||
if ($order->pay_type == 9) {
|
||||
$extra['create_time'] = $order['create_time'];
|
||||
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'cash_register', 'msg' => '您有一笔订单已支付', 'data' => $extra]);
|
||||
} else {
|
||||
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
|
||||
}
|
||||
Redis::send('push-platform-print', ['id' => $order['id']]);
|
||||
// if ($order->pay_type == 9) {
|
||||
// $extra['create_time'] = $order['create_time'];
|
||||
// PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'cash_register', 'msg' => '您有一笔订单已支付', 'data' => $extra]);
|
||||
// Redis::send('push-platform-print', ['id' => $order['id']]);
|
||||
// }
|
||||
// else {
|
||||
// PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -255,56 +318,171 @@ class PayNotifyLogic extends BaseLogic
|
||||
public static function afterPay($order, $transaction_id = 0)
|
||||
{
|
||||
$financeLogic = new StoreFinanceFlowLogic();
|
||||
$financeLogic->order = $order;
|
||||
$financeLogic->user = ['uid' => $order['uid']];
|
||||
if ($order->pay_type != 9 || $order->pay_type != 10) {
|
||||
$financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::USER_ORDER_PAY); //用户单入账
|
||||
//商户应该获得的钱 每个商品的price-ot_price 利润
|
||||
if (isset($order->profit) && $order->profit > 0) {
|
||||
//手续费
|
||||
$fees = bcdiv(bcmul($order['pay_price'], '0.02', 2), 1, 2);
|
||||
$financeLogic->in($transaction_id, $fees, OrderEnum::ORDER_COMMITION, $order['store_id']); //手续费入账
|
||||
|
||||
$financeLogic->out($transaction_id, $order['profit'], OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0); //商户获得的
|
||||
//冻结金额的
|
||||
$frozen = bcsub($order->profit, $fees, 2);
|
||||
//缴纳齐全了就加商户没有就加到平台
|
||||
$money_limt = SystemStore::where('id', $order['store_id'])->field('paid_deposit,security_deposit')->find();
|
||||
$deposit = bcsub($money_limt['security_deposit'], $money_limt['paid_deposit'], 2); //剩余额度
|
||||
if ($deposit > 0 && $frozen > 0) {
|
||||
$amount = min($deposit, $frozen);
|
||||
$financeLogic->in($transaction_id, $amount, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id']);
|
||||
$user_sing = new UserSign();
|
||||
$vipFen = 0;
|
||||
if ($order['uid'] > 0) {
|
||||
// 结算金额 要支付的钱减去冻结得钱去走后面得逻辑 发得兑换券也要去减去
|
||||
//用户下单该用户等级为1得时候才处理冻结金额
|
||||
$user = User::where('id', $order['uid'])->find();
|
||||
//纯在分销关系的时候要去判断分销出来的用户的采购款的额度 (只有会员按照这个逻辑拆分,其余的还是按照正常的支付金额)
|
||||
if ($order['spread_uid'] > 0) {
|
||||
$oldUser = User::where('id',$order['spread_uid'])->field('purchase_funds,user_ship')->find();
|
||||
if ($oldUser && $oldUser['user_ship'] == 1){
|
||||
if ($oldUser['purchase_funds'] < $order['pay_price']) {
|
||||
$vipFen = $oldUser['purchase_funds'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$financeLogic->save();
|
||||
}
|
||||
}
|
||||
elseif ($user['user_ship'] == 1){
|
||||
$vipFrozenAmount = self::dealFrozenPrice($order['id']);
|
||||
//为1的时候要去减活动价
|
||||
// $final_price = bcsub($order['pay_price'],$order['deduction_price'],2);
|
||||
// d($final_price,$vipFrozenAmount);
|
||||
$order['pay_price'] = bcsub($order['pay_price'],$vipFrozenAmount,2);
|
||||
self::dealVipAmount($order, $order['pay_type']);
|
||||
}
|
||||
|
||||
//等级处理
|
||||
public static function dealLevel($uid, $total_money)
|
||||
{
|
||||
$userShip = UserShip::where('limit', '<=', $total_money)
|
||||
->field('id,title,limit')
|
||||
->order('limit', 'desc')
|
||||
->find();
|
||||
$info = User::where('id', $uid)->findOrEmpty();
|
||||
if ($info && $userShip) {
|
||||
if ($info->user_ship != $userShip['id']) {
|
||||
$info->user_ship = $userShip['id'];
|
||||
$info->save();
|
||||
$user_number = bcmul($order['pay_price'], '0.10', 2);
|
||||
$sing = [
|
||||
'uid' => $order['uid'],
|
||||
'order_id' => $order['order_id'],
|
||||
'title' => '购买商品获得兑换券',
|
||||
'store_id' => $order['store_id'],
|
||||
'number' => $user_number,
|
||||
];
|
||||
$user_sing->save($sing);
|
||||
User::where('id', $order['uid'])->inc('integral', $user_number)->update();
|
||||
}
|
||||
|
||||
|
||||
$financeLogic->order = $order;
|
||||
$financeLogic->user = ['uid' => $order['uid']];
|
||||
// if ($order->pay_type != 9 || $order->pay_type != 10) {
|
||||
$financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::USER_ORDER_PAY, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //用户订单支付
|
||||
$count_frees = 0;
|
||||
|
||||
//平台手续费
|
||||
$fees = bcdiv(bcmul($order['pay_price'], '0.02', 2), 1, 2);
|
||||
$count_frees = bcadd($count_frees, $fees, 2);
|
||||
if ($fees > 0) {
|
||||
$financeLogic->in($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'], 0, 0, $order['pay_type']); //平台手续费
|
||||
$financeLogic->out($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //商户平台手续费支出
|
||||
}
|
||||
// $frozen = bcsub($order->profit, $fees, 2);
|
||||
//缴纳齐全了就加商户没有就加到平台
|
||||
$money_limt = SystemStore::where('id', $order['store_id'])->field('paid_deposit,security_deposit')->find();
|
||||
$deposit = bcsub($money_limt['security_deposit'], $money_limt['paid_deposit'], 2); //保证金剩余额度
|
||||
$store_profit = bcdiv(bcmul($order['pay_price'], '0.05', 2), 1, 2);
|
||||
$count_frees = bcadd($count_frees, $store_profit, 2);
|
||||
if ($deposit > 0) {
|
||||
if ($deposit > $store_profit) {
|
||||
if ($store_profit > 0) {
|
||||
$financeLogic->out($transaction_id, $store_profit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
||||
}
|
||||
} else {
|
||||
$money = bcsub($store_profit, $deposit, 2);
|
||||
if ($deposit > 0) {
|
||||
$financeLogic->out($transaction_id, $deposit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
||||
}
|
||||
if ($money) {
|
||||
SystemStore::where('id', $order['store_id'])->inc('store_money', $money)->update();
|
||||
$financeLogic->in($transaction_id, $money, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); //平台手续费
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($store_profit > 0) {
|
||||
SystemStore::where('id', $order['store_id'])->inc('store_money', $store_profit)->update();
|
||||
$financeLogic->in($transaction_id, $store_profit, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); //平台手续费
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// if ($order['is_vip'] >= 1) {
|
||||
if ($order['spread_uid'] > 0) {
|
||||
$financeLogic->other_arr['vip_uid'] = $order['spread_uid'];
|
||||
if($vipFen){
|
||||
$fees = bcdiv(bcmul($vipFen, '0.08', 2), 1, 2);
|
||||
}else{
|
||||
$fees = bcdiv(bcmul($order['pay_price'], '0.08', 2), 1, 2);
|
||||
}
|
||||
$count_frees = bcadd($count_frees, $fees, 2);
|
||||
if ($fees > 0) {
|
||||
User::where('id', $order['spread_uid'])->inc('now_money', $fees)->update();
|
||||
$financeLogic->in($transaction_id, $fees, OrderEnum::VIP_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); //vip订单获得
|
||||
$financeLogic->out($transaction_id, $fees, OrderEnum::VIP_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
||||
}
|
||||
}
|
||||
$fees = bcdiv(bcmul($order['pay_price'], '0.01', 2), 1, 2);
|
||||
$count_frees = bcadd($count_frees, bcmul($fees, 3, 2), 2);
|
||||
$village_uid = 0;
|
||||
$brigade_uid = 0;
|
||||
//查询用户对应的村长和队长
|
||||
if ($order['uid'] > 0) {
|
||||
$address = UserAddress::where(['uid' => $order['uid'], 'is_default' => 1])->find();
|
||||
if ($address) {
|
||||
$arr1 = UserAddress::where(['village' => $address['village'], 'is_default' => 1])->column('uid');
|
||||
if ($arr1) {
|
||||
$uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id');
|
||||
if ($uid) {
|
||||
User::where('id', $uid)->inc('integral', $fees)->update();
|
||||
$village_uid=$uid;
|
||||
}
|
||||
}
|
||||
$arr2 = UserAddress::where(['village' => $address['village'], 'brigade' => $address['brigade'], 'is_default' => 1])->column('uid');
|
||||
if ($arr2) {
|
||||
$uid = User::where('id', 'in', $arr1)->where('user_ship', 3)->value('id');
|
||||
if ($uid) {
|
||||
User::where('id', $uid)->inc('integral', $fees)->update();
|
||||
$brigade_uid=$uid;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($fees > 0) {
|
||||
//村长获得
|
||||
$sing = [];
|
||||
|
||||
//处理活动期间直接改用户的等级
|
||||
public static function dealChange($uid)
|
||||
{
|
||||
User::where('id', $uid)->update(['user_ship' => UserShipEnum::LEVEL_ONE]);
|
||||
return true;
|
||||
$sing[] = [
|
||||
'uid' => $village_uid,
|
||||
'order_id' => $order['order_id'],
|
||||
'title' => '村长订单获得兑换券',
|
||||
'store_id' => $order['store_id'],
|
||||
'number' => $fees,
|
||||
];
|
||||
$sing[] = [
|
||||
'uid' => $brigade_uid,
|
||||
'order_id' => $order['order_id'],
|
||||
'title' => '队长订单获得兑换券',
|
||||
'store_id' => $order['store_id'],
|
||||
'number' => $fees,
|
||||
];
|
||||
// if ($village_uid > 0) {
|
||||
// $financeLogic->other_arr['vip_uid'] = $village_uid;
|
||||
// }
|
||||
// $financeLogic->in($transaction_id, $fees, OrderEnum::VILLAGE_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']);
|
||||
// $financeLogic->out($transaction_id, $fees, OrderEnum::VILLAGE_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
||||
//队长获得
|
||||
// if ($brigade_uid > 0) {
|
||||
// $financeLogic->other_arr['vip_uid'] = $brigade_uid;
|
||||
// }
|
||||
// $financeLogic->in($transaction_id, $fees, OrderEnum::BRIGADE_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']);
|
||||
// $financeLogic->out($transaction_id, $fees, OrderEnum::BRIGADE_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
||||
$user_sing->saveAll($sing);
|
||||
//其他获得
|
||||
$financeLogic->other_arr['vip_uid'] = 0;
|
||||
$financeLogic->in($transaction_id, $fees, OrderEnum::OTHER_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']);
|
||||
$financeLogic->out($transaction_id, $fees, OrderEnum::OTHER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
||||
}
|
||||
// }
|
||||
$fees = bcsub($order['pay_price'], $count_frees, 2);
|
||||
//供应链订单获得
|
||||
if ($fees > 0) {
|
||||
$financeLogic->in($transaction_id, $fees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']);
|
||||
$financeLogic->out($transaction_id, $fees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
||||
}
|
||||
// }
|
||||
$financeLogic->save();
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 回调日志
|
||||
* @param $order
|
||||
@ -324,4 +502,54 @@ class PayNotifyLogic extends BaseLogic
|
||||
];
|
||||
PayNotify::create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 冻结金额
|
||||
* @param $oid
|
||||
* @return int|mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
|
||||
public static function dealFrozenPrice($oid)
|
||||
{
|
||||
$detail = StoreOrderCartInfo::where('oid',$oid)->select()->toArray();
|
||||
$total_vip = 0;
|
||||
foreach ($detail as $value){
|
||||
$total_vip +=$value['cart_info']['vip_frozen_price'];
|
||||
}
|
||||
return $total_vip;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理用户为vip1时得冻结资金
|
||||
* @param $order
|
||||
* @param $pay_type
|
||||
* @param $transaction_id
|
||||
* @return true
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public static function dealVipAmount($order,$pay_type =1,$transaction_id = 0)
|
||||
{
|
||||
$total_vip = self::dealFrozenPrice($order['id']);
|
||||
$data=[
|
||||
'order_id' => $order['id'],
|
||||
'transaction_id' => $transaction_id??0,
|
||||
'order_sn' =>$order['order_id'],
|
||||
'user_id' => $order['uid'],
|
||||
'number' => $total_vip,
|
||||
'pay_type' => $pay_type??1,
|
||||
'status' => 0,
|
||||
'store_id' => $order['store_id'],
|
||||
'staff_id' => $order['staff_id'],
|
||||
'create_time'=>time()
|
||||
];
|
||||
Db::name('vip_flow')->insert($data);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ class PaymentLogic extends BaseLogic
|
||||
/**
|
||||
* 微信条码支付
|
||||
*/
|
||||
public static function codepay($auth_code, $order)
|
||||
public static function codepay($auth_code, $order,$description='条码商品')
|
||||
{
|
||||
$pattern = '/^(10|11|12|13|14|15)\d{16}$/';
|
||||
|
||||
@ -83,7 +83,7 @@ class PaymentLogic extends BaseLogic
|
||||
return false;
|
||||
}
|
||||
$order = [
|
||||
'description' => '条码商品',
|
||||
'description' => $description,
|
||||
'out_trade_no' => (string)$order['order_id'],
|
||||
'payer' => [
|
||||
'auth_code' => (string)$auth_code
|
||||
|
@ -11,6 +11,7 @@ class StoreFinanceFlowLogic extends BaseLogic
|
||||
|
||||
public $order;
|
||||
public $user;
|
||||
public $other_arr;
|
||||
public $index = 0;
|
||||
public $financeSn;
|
||||
public $list = [];
|
||||
@ -24,9 +25,9 @@ class StoreFinanceFlowLogic extends BaseLogic
|
||||
* @param $staffId
|
||||
* @param $status
|
||||
*/
|
||||
public function out($transaction_id,$number, $financialType, $storeId = 0, $staffId = 0, $status = 1)
|
||||
public function out($transaction_id,$number, $financialType, $storeId = 0, $staffId = 0, $status = 1,$pay_type=7)
|
||||
{
|
||||
$this->setData($number, $financialType, 0, $storeId, $staffId, $status,$transaction_id);
|
||||
$this->setData($number, $financialType, 0, $storeId, $staffId, $status,$transaction_id,$pay_type);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -38,31 +39,49 @@ class StoreFinanceFlowLogic extends BaseLogic
|
||||
* @param $staffId
|
||||
* @param $status
|
||||
*/
|
||||
public function in($transaction_id,$number, $financialType, $storeId = 0, $staffId = 0, $status = 1)
|
||||
public function in($transaction_id,$number, $financialType, $storeId = 0, $staffId = 0, $status = 1,$pay_type=7)
|
||||
{
|
||||
$this->setData($number, $financialType, 1, $storeId, $staffId, $status,$transaction_id);
|
||||
$this->setData($number, $financialType, 1, $storeId, $staffId, $status,$transaction_id,$pay_type);
|
||||
}
|
||||
|
||||
public function setData($number, $financialType, $pm, $storeId, $staffId, $status,$transaction_id)
|
||||
public function setData($number, $financialType, $pm, $storeId, $staffId, $status,$transaction_id,$pay_type=7)
|
||||
{
|
||||
if (empty($this->financeSn)) {
|
||||
$this->financeSn = $this->getSn();
|
||||
}
|
||||
$this->list[] = [
|
||||
$data=[
|
||||
'order_id' => $this->order['id'],
|
||||
'transaction_id' => $transaction_id,
|
||||
'order_sn' => $this->order['order_id'],
|
||||
'user_id' => $this->user['uid'],
|
||||
'other_uid' => $this->other_arr['vip_uid']??0,
|
||||
'financial_type' => $financialType,
|
||||
'financial_pm' => $pm,
|
||||
'number' => $number,
|
||||
'pay_type' => PayEnum::WECHAT_PAY_MINI,
|
||||
'status' => $status,
|
||||
'pay_type' => $pay_type,
|
||||
'status' => 0,
|
||||
'store_id' => $storeId !== '' ? $storeId : $this->order['store_id'],
|
||||
'staff_id' => $staffId !== '' ? $staffId : $this->order['staff_id'],
|
||||
'financial_record_sn' => $this->financeSn . ($this->index++),
|
||||
'create_time'=>time()
|
||||
];
|
||||
switch($financialType){
|
||||
case OrderEnum::MERCHANT_ORDER_OBTAINS: // 商户
|
||||
case OrderEnum::ORDER_MARGIN: // 商户保证金
|
||||
$data['type'] =OrderEnum::MERCHANT;
|
||||
break;
|
||||
case OrderEnum::PLATFORM_ORDER_OBTAINS: // 平台
|
||||
case OrderEnum::ORDER_HANDLING_FEES: // 手续费
|
||||
$data['type'] =OrderEnum::PLATFORM;
|
||||
break;
|
||||
case OrderEnum::SUPPLIER_ORDER_OBTAINS: // 供应链
|
||||
$data['type'] =OrderEnum::SUPPLIER;
|
||||
break;
|
||||
default: // 用户
|
||||
$data['type'] =OrderEnum::USER;
|
||||
break;
|
||||
}
|
||||
$this->list[] = $data;
|
||||
}
|
||||
|
||||
public function save()
|
||||
|
183
app/common/logic/VipLogic.php
Normal file
183
app/common/logic/VipLogic.php
Normal file
@ -0,0 +1,183 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\common\logic;
|
||||
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\model\store_order\StoreOrder;
|
||||
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
||||
use app\common\model\system_store\SystemStore;
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\user\UserAddress;
|
||||
use app\common\model\user_sign\UserSign;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
* vip结算逻辑
|
||||
* Class VipLogic
|
||||
* @package app\common\logic
|
||||
*/
|
||||
class VipLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
public static function dealVipAmount($order,$pay_type =1, $transaction_id = 0)
|
||||
{
|
||||
$detail = StoreOrderCartInfo::where('oid',$order['id'])->select()->toArray();
|
||||
$total_vip = 0;
|
||||
foreach ($detail as $value){
|
||||
$total_vip +=$value['cart_info']['vip_frozen_price'];
|
||||
}
|
||||
$data=[
|
||||
'order_id' => $order['id'],
|
||||
'transaction_id' => $transaction_id??0,
|
||||
'order_sn' =>$order['order_id'],
|
||||
'user_id' => $order['uid'],
|
||||
// 'financial_type' => $financialType,
|
||||
'number' => $total_vip,
|
||||
'pay_type' => $pay_type??1,
|
||||
'status' => 0,
|
||||
'store_id' => $order['store_id'],
|
||||
'staff_id' => $order['staff_id'],
|
||||
'create_time'=>time()
|
||||
];
|
||||
Db::name('vip_flow')->insert($data);
|
||||
//todo 限制执行
|
||||
// self::afterPay($order,$transaction_id,$total_vip);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function afterPay($order, $transaction_id = 0,$Vipmoney=0)
|
||||
{
|
||||
$financeLogic = new StoreFinanceFlowLogic();
|
||||
$financeLogic->order = $order;
|
||||
$financeLogic->user = ['uid' => $order['uid']];
|
||||
|
||||
$financeLogic->in($transaction_id, $Vipmoney, OrderEnum::USER_ORDER_PAY); //用户订单支付
|
||||
$count_frees = 0;
|
||||
|
||||
//平台手续费
|
||||
$fees = bcdiv(bcmul($Vipmoney, '0.02', 2), 1, 2);
|
||||
$count_frees = bcadd($count_frees, $fees, 2);
|
||||
if ($fees > 0) {
|
||||
$financeLogic->in($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'], 0, 0, $order['pay_type']); //平台手续费
|
||||
$financeLogic->out($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //商户平台手续费支出
|
||||
}
|
||||
// $frozen = bcsub($order->profit, $fees, 2);
|
||||
//缴纳齐全了就加商户没有就加到平台
|
||||
$money_limt = SystemStore::where('id', $order['store_id'])->field('paid_deposit,security_deposit')->find();
|
||||
$deposit = bcsub($money_limt['security_deposit'], $money_limt['paid_deposit'], 2); //保证金剩余额度
|
||||
$store_profit = bcdiv(bcmul($Vipmoney, '0.05', 2), 1, 2);
|
||||
$count_frees = bcadd($count_frees, $store_profit, 2);
|
||||
if ($deposit > 0) {
|
||||
if ($deposit > $store_profit) {
|
||||
if ($store_profit > 0) {
|
||||
$financeLogic->out($transaction_id, $store_profit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
||||
}
|
||||
} else {
|
||||
$money = bcsub($store_profit, $deposit, 2);
|
||||
if ($deposit > 0) {
|
||||
$financeLogic->out($transaction_id, $deposit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
||||
}
|
||||
if ($money) {
|
||||
SystemStore::where('id', $order['store_id'])->inc('store_money', $money)->update();
|
||||
$financeLogic->in($transaction_id, $money, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); //平台手续费
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($store_profit > 0) {
|
||||
SystemStore::where('id', $order['store_id'])->inc('store_money', $store_profit)->update();
|
||||
$financeLogic->in($transaction_id, $store_profit, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); //平台手续费
|
||||
}
|
||||
}
|
||||
|
||||
if ($order['is_vip'] >= 1) {
|
||||
if ($order['spread_uid'] > 0) {
|
||||
$financeLogic->other_arr['vip_uid'] = $order['spread_uid'];
|
||||
$fees = bcdiv(bcmul($Vipmoney, '0.08', 2), 1, 2);
|
||||
$count_frees = bcadd($count_frees, $fees, 2);
|
||||
if ($fees > 0) {
|
||||
User::where('id', $order['spread_uid'])->inc('now_money', $fees)->update();
|
||||
$financeLogic->in($transaction_id, $fees, OrderEnum::VIP_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); //vip订单获得
|
||||
$financeLogic->out($transaction_id, $fees, OrderEnum::VIP_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
||||
}
|
||||
}
|
||||
$fees = bcdiv(bcmul($Vipmoney, '0.01', 2), 1, 2);
|
||||
$count_frees = bcadd($count_frees, bcmul($fees, 3, 2), 2);
|
||||
$village_uid = 0;
|
||||
$brigade_uid = 0;
|
||||
//查询用户对应的村长和队长
|
||||
if ($order['uid'] > 0) {
|
||||
$address = UserAddress::where(['uid' => $order['uid'], 'is_default' => 1])->find();
|
||||
if ($address) {
|
||||
$arr1 = UserAddress::where(['village' => $address['village'], 'is_default' => 1])->column('uid');
|
||||
if ($arr1) {
|
||||
$village_uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id');
|
||||
if($village_uid){
|
||||
User::where('id', $village_uid)->inc('integral', $fees)->update();
|
||||
}
|
||||
}
|
||||
$arr2 = UserAddress::where(['village' => $address['village'], 'brigade' => $address['brigade'], 'is_default' => 1])->column('uid');
|
||||
if ($arr2) {
|
||||
$brigade_uid = User::where('id', 'in', $arr1)->where('user_ship', 3)->value('id');
|
||||
if($brigade_uid){
|
||||
User::where('id', $brigade_uid)->inc('integral', $fees)->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($fees > 0) {
|
||||
//村长获得
|
||||
$sing=[];
|
||||
$user_sing=new UserSign();
|
||||
|
||||
$sing[]=[
|
||||
'uid'=>$village_uid,
|
||||
'title'=>'村长订单获得兑换券',
|
||||
'store_id'=>$order['store_id'],
|
||||
'number'=>$fees,
|
||||
];
|
||||
$sing[]=[
|
||||
'uid'=>$brigade_uid,
|
||||
'title'=>'队长订单获得兑换券',
|
||||
'store_id'=>$order['store_id'],
|
||||
'number'=>$fees,
|
||||
];
|
||||
// if ($village_uid > 0) {
|
||||
// $financeLogic->other_arr['vip_uid'] = $village_uid;
|
||||
// }
|
||||
// $financeLogic->in($transaction_id, $fees, OrderEnum::VILLAGE_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']);
|
||||
// $financeLogic->out($transaction_id, $fees, OrderEnum::VILLAGE_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
||||
//队长获得
|
||||
// if ($brigade_uid > 0) {
|
||||
// $financeLogic->other_arr['vip_uid'] = $brigade_uid;
|
||||
// }
|
||||
// $financeLogic->in($transaction_id, $fees, OrderEnum::BRIGADE_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']);
|
||||
// $financeLogic->out($transaction_id, $fees, OrderEnum::BRIGADE_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
||||
$user_sing->saveAll($sing);
|
||||
//其他获得
|
||||
$financeLogic->other_arr['vip_uid'] = 0;
|
||||
$financeLogic->in($transaction_id, $fees, OrderEnum::OTHER_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']);
|
||||
$financeLogic->out($transaction_id, $fees, OrderEnum::OTHER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
||||
}
|
||||
}
|
||||
|
||||
$fees=bcsub($Vipmoney, $count_frees, 2);
|
||||
//供应链订单获得
|
||||
if ($fees > 0) {
|
||||
$financeLogic->in($transaction_id,$fees , OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']);
|
||||
$financeLogic->out($transaction_id, $fees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
||||
|
||||
}
|
||||
$financeLogic->save();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -4,6 +4,7 @@ namespace app\common\logic\store_order;
|
||||
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\enum\UserShipEnum;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\enum\YesNoEnum;
|
||||
use app\common\model\dict\DictType;
|
||||
@ -12,7 +13,9 @@ use app\common\model\store_branch_product\StoreBranchProduct;
|
||||
use app\common\model\store_order\StoreOrder;
|
||||
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
||||
use app\common\model\store_product_unit\StoreProductUnit;
|
||||
use app\common\model\user\User;
|
||||
use app\common\service\pay\PayService;
|
||||
use app\common\service\SmsService;
|
||||
use Exception;
|
||||
use support\Cache;
|
||||
use think\facade\Db;
|
||||
@ -23,6 +26,7 @@ class StoreOrderLogic extends BaseLogic
|
||||
public static $pay_price;
|
||||
public static $cost;
|
||||
public static $profit;
|
||||
public static $store_price;//门店零售价
|
||||
public static $activity_price;
|
||||
/**
|
||||
* @notes 获取购物车商品信息
|
||||
@ -44,27 +48,47 @@ class StoreOrderLogic extends BaseLogic
|
||||
self::$cost = 0; //成本
|
||||
self::$profit = 0; //利润
|
||||
self::$activity_price = 0; //活动减少
|
||||
|
||||
self::$store_price = 0; //门店零售价
|
||||
/** 计算价格 */
|
||||
foreach ($cart_select as $k => $v) {
|
||||
$find = StoreBranchProduct::where(['product_id' => $v['product_id'],'store_id'=>$params['store_id']])->field('id branch_product_id,store_name,image,unit,cost price,cost,product_id')->find();
|
||||
$find = StoreBranchProduct::where(['product_id' => $v['product_id'],'store_id'=>$params['store_id']])->field('id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase,product_id')->withTrashed()->find();
|
||||
if (!$find) {
|
||||
continue;
|
||||
}
|
||||
unset($cart_select[$k]['id']);
|
||||
|
||||
$cart_select[$k]['price'] = $find['price'];
|
||||
$cart_select[$k]['cost'] = $find['cost'];
|
||||
$cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价
|
||||
$cart_select[$k]['deduction_price'] =self::$activity_price;//抵扣金额
|
||||
|
||||
$cart_select[$k]['vip'] = 0;
|
||||
if ($user && $user['user_ship'] == 1) {
|
||||
//更新 会员为1的时候原价减去会员价
|
||||
$deduction_price_count=bcmul(bcsub($find['price'], $find['vip_price'], 2),$v['cart_num'],2);
|
||||
$cart_select[$k]['deduction_price'] =$deduction_price_count;
|
||||
self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2);
|
||||
$cart_select[$k]['vip'] =1;
|
||||
}
|
||||
|
||||
if ($user && $user['user_ship'] == 4) {
|
||||
//更新 为4商户的时候减去商户价格
|
||||
$deduction_price_count=bcmul(bcsub($find['price'], $find['cost'], 2),$v['cart_num'],2);
|
||||
$cart_select[$k]['deduction_price'] =$deduction_price_count;
|
||||
self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2);
|
||||
}
|
||||
//利润
|
||||
$cart_select[$k]['profit'] = bcmul($cart_select[$k]['total_price'],0.05,2); //利润
|
||||
$cart_select[$k]['cost'] = bcmul($v['cart_num'], $find['cost'], 2) ?? 0; //成本
|
||||
// $cart_select[$k]['profit'] = bcmul($cart_select[$k]['total_price'],0.05,2); //利润
|
||||
$cart_select[$k]['purchase'] = bcmul($v['cart_num'], $find['purchase'], 2) ?? 0; //成本
|
||||
$cart_select[$k]['pay_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单支付金额
|
||||
$cart_select[$k]['store_price'] = bcmul($v['cart_num'], $find['cost'], 2)??0; //门店零售价
|
||||
$cart_select[$k]['vip_price'] = bcmul($v['cart_num'], $find['vip_price'], 2)??0; //vip售价
|
||||
$cart_select[$k]['product_id'] = $find['product_id'];
|
||||
$cart_select[$k]['old_cart_id'] = $v['id'];
|
||||
$cart_select[$k]['cart_num'] = $v['cart_num'];
|
||||
$cart_select[$k]['verify_code'] = $params['verify_code'] ?? '';
|
||||
//vip1待返回金额
|
||||
|
||||
$cart_select[$k]['vip_frozen_price'] = bcsub($cart_select[$k]['pay_price'],$cart_select[$k]['vip_price'],2);
|
||||
$cartInfo = $cart_select[$k];
|
||||
$cartInfo['name'] = $find['store_name'];
|
||||
$cartInfo['image'] = $find['image'];
|
||||
@ -73,7 +97,7 @@ class StoreOrderLogic extends BaseLogic
|
||||
// if ($vipPrice) {
|
||||
// $cartInfo['price'] = $vipPrice;
|
||||
// }
|
||||
$cartInfo['vip_price'] = 0;//$cart_select[$k]['total'] - $vipPrice ?? 0;
|
||||
//$cart_select[$k]['total'] - $vipPrice ?? 0;
|
||||
$cart_select[$k]['cart_info'] = json_encode($cartInfo);
|
||||
$cart_select[$k]['branch_product_id'] = $find['branch_product_id'];
|
||||
//理论上每笔都是拆分了
|
||||
@ -84,10 +108,17 @@ class StoreOrderLogic extends BaseLogic
|
||||
self::$total_price = bcadd(self::$total_price, $cart_select[$k]['total_price'], 2);
|
||||
self::$pay_price = bcadd(self::$pay_price, $cart_select[$k]['pay_price'], 2);
|
||||
self::$cost = bcadd(self::$cost, $cart_select[$k]['cost'], 2);
|
||||
self::$profit = bcadd(self::$profit, $cart_select[$k]['profit'], 2);
|
||||
self::$store_price = bcadd(self::$store_price, $cart_select[$k]['store_price'], 2);//门店零售价格
|
||||
// self::$profit = bcadd(self::$profit, $cart_select[$k]['profit'], 2);
|
||||
}
|
||||
//TODO 收单打9.9折 会员按照比例打折 等级按照充值去升级
|
||||
$pay_price = self::$pay_price;
|
||||
if ($user && $user['user_ship'] == 1) {
|
||||
$pay_price = self::$pay_price;
|
||||
$activity_string = '';
|
||||
}else{
|
||||
$pay_price =bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额
|
||||
$activity_string = '减免';
|
||||
}
|
||||
|
||||
$vipPrice = 0;
|
||||
//成本价 收益
|
||||
$order = [
|
||||
@ -95,7 +126,7 @@ class StoreOrderLogic extends BaseLogic
|
||||
'order_id' =>$params['order_id'] ?? getNewOrderId('PF'),
|
||||
'total_price' => self::$total_price, //总价
|
||||
'cost' => self::$cost,//成本价
|
||||
'profit' => self::$profit,//利润
|
||||
'profit' => 0,//利润
|
||||
'pay_price' => $pay_price,//后期可能有降价抵扣
|
||||
'vip_price' => $vipPrice,
|
||||
'total_num' => count($cart_select),//总数
|
||||
@ -104,14 +135,17 @@ class StoreOrderLogic extends BaseLogic
|
||||
'cart_id' => implode(',', $cartId),
|
||||
'store_id' => $params['store_id'] ?? 0,
|
||||
'shipping_type' =>3,//配送方式 1=快递 ,2=门店自提
|
||||
'activity' =>'减免',
|
||||
'activity_price' =>self::$activity_price,
|
||||
'activity' =>$activity_string,
|
||||
'activity_price' =>self::$activity_price,//活动优惠价
|
||||
'activities' => self::$activity_price>0?1:0,
|
||||
'default_delivery'=>1,
|
||||
'original_price'=>self::$total_price,
|
||||
'deduction_price' => self::$activity_price
|
||||
|
||||
'deduction_price' => self::$activity_price,//抵扣金额
|
||||
];
|
||||
if($user && $user['user_ship']!=4){
|
||||
$order['is_vip']=1;
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
@ -135,7 +169,7 @@ class StoreOrderLogic extends BaseLogic
|
||||
return false;
|
||||
}
|
||||
$_order = $orderInfo['order'];
|
||||
$_order['deduction_price'] = 0;
|
||||
$_order['uid'] = $user['id']??0;
|
||||
$_order['pay_type'] = $orderInfo['order']['pay_type'];
|
||||
$_order['verify_code'] = $verify_code;
|
||||
if (isset($params['reservation_time'])) {
|
||||
@ -148,7 +182,7 @@ class StoreOrderLogic extends BaseLogic
|
||||
$goods_list = $orderInfo['cart_list'];
|
||||
foreach ($goods_list as $k => $v) {
|
||||
$goods_list[$k]['oid'] = $order['id'];
|
||||
$goods_list[$k]['uid'] = 0;
|
||||
$goods_list[$k]['uid'] = $user['id']??0;
|
||||
$goods_list[$k]['cart_id'] = implode(',', $cartId);
|
||||
$goods_list[$k]['delivery_id'] = $params['store_id']; //商家id
|
||||
$stock = StoreBranchProduct::where('id',$v['branch_product_id'])->value('stock');
|
||||
@ -190,6 +224,12 @@ class StoreOrderLogic extends BaseLogic
|
||||
$order['refund_type_name'] = OrderEnum::refundType($order['refund_type']) ?? '';
|
||||
$order['pay_type_name'] =PayEnum::getPaySceneDesc($order['pay_type']) ?? '';
|
||||
|
||||
$detail =StoreOrderCartInfo::where('oid',$order['id'])->find()->toArray();
|
||||
$vip =0;
|
||||
if(isset($detail['cart_info']['vip']) && $detail['cart_info']['vip'] == 1){
|
||||
$vip = 1;
|
||||
}
|
||||
$order['vip'] = $vip;
|
||||
return $order->toArray();
|
||||
}
|
||||
|
||||
@ -302,4 +342,30 @@ class StoreOrderLogic extends BaseLogic
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function dealSendSms($param,$type = 0)
|
||||
{
|
||||
$code = generateRandomCode();
|
||||
$phone = User::where('id',$param['uid'])->value('mobile');
|
||||
if(empty($phone)){
|
||||
throw new \Exception('用户未设置手机号');
|
||||
}
|
||||
$template = getenv('SMS_TEMPLATE');
|
||||
if($type){
|
||||
$check =(new SmsService())->client($phone,$template,$code,1);
|
||||
}else{
|
||||
$check =(new SmsService())->client($phone,$template,$code);
|
||||
}
|
||||
|
||||
if($check){
|
||||
$remark = $param['uid'].'_smsPay';
|
||||
Cache::set($remark,$code,5*60);
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
45
app/common/model/financial_transfers/FinancialTransfers.php
Normal file
45
app/common/model/financial_transfers/FinancialTransfers.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\financial_transfers;
|
||||
|
||||
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\system_store\SystemStore;
|
||||
use app\common\model\system_store\SystemStoreStaff;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
/**
|
||||
* 财务转账提现表模型
|
||||
* Class FinancaialTransfers
|
||||
* @package app\common\model\order
|
||||
*/
|
||||
class FinancialTransfers extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $name = 'financial_transfers';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
public function store()
|
||||
{
|
||||
return $this->hasOne(SystemStore::class, 'id','store_id')
|
||||
->bind(['store_name'=>'name', 'store_phone'=>'phone','store_detailed_address'=>'detailed_address','store_simple_address'=>'address','store_bank'=>'bank','store_bank_code'=>'bank_code','store_bank_address'=>'bank_address','store_realName'=>'realname']);
|
||||
}
|
||||
|
||||
|
||||
public function staff()
|
||||
{
|
||||
return $this->hasOne(SystemStoreStaff::class, 'id', 'store_staff_id')->bind(['staff_name']);
|
||||
}
|
||||
|
||||
|
||||
public function admin()
|
||||
{
|
||||
return $this->hasOne(Admin::class, 'id','admin_id')
|
||||
->bind(['admin_name'=>'name']);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\store_branch_product_exchange;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\store_category\StoreCategory;
|
||||
use app\common\model\store_product\StoreProduct;
|
||||
use app\common\model\store_product_unit\StoreProductUnit;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
/**
|
||||
* 门店兑换商品属性值辅助表模型
|
||||
* Class StoreBranchProductExchange
|
||||
* @package app\common\model\store_branch_product_exchange
|
||||
*/
|
||||
class StoreBranchProductExchange extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $name = 'store_branch_product_exchange';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
}
|
14
app/common/model/store_product_cate/StoreProductCate.php
Normal file
14
app/common/model/store_product_cate/StoreProductCate.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\store_product_cate;
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
class StoreProductCate extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $name = 'store_product_cate';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
}
|
@ -8,7 +8,7 @@ use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
/**
|
||||
* 计量单位
|
||||
* 商品浏览分析
|
||||
* Class StoreProductUnit
|
||||
* @package app\common\model\store_product_unit
|
||||
*/
|
||||
|
22
app/common/model/user_label/UserLabel.php
Normal file
22
app/common/model/user_label/UserLabel.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\user_label;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
/**
|
||||
* 用户标签模型
|
||||
* Class UserLabel
|
||||
* @package app\common\model\user_label
|
||||
*/
|
||||
class UserLabel extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $name = 'user_label';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
}
|
22
app/common/model/user_sign/UserSign.php
Normal file
22
app/common/model/user_sign/UserSign.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\user_sign;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
/**
|
||||
* 计量单位
|
||||
* Class UserSign
|
||||
* @package app\common\model\user_sign
|
||||
*/
|
||||
class UserSign extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $name = 'user_sign';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
}
|
22
app/common/model/user_spread_log/UserSpreadLog.php
Normal file
22
app/common/model/user_spread_log/UserSpreadLog.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\user_spread_log;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
/**
|
||||
* 用户分享表模型
|
||||
* Class UserRecharge
|
||||
* @package app\common\model\user_recharge
|
||||
*/
|
||||
class UserSpreadLog extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $name = 'user_spread_log';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
}
|
@ -4,10 +4,13 @@
|
||||
namespace app\common\service;
|
||||
|
||||
|
||||
use app\api\logic\store\StoreLogic;
|
||||
use app\common\enum\ExportEnum;
|
||||
use app\common\lists\BaseDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsExtendInterface;
|
||||
use app\common\model\dict\DictType;
|
||||
use app\common\model\system_store\SystemStore;
|
||||
use support\Response;
|
||||
use support\exception\BusinessException;
|
||||
|
||||
@ -90,7 +93,7 @@ class JsonService
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/28 11:15
|
||||
*/
|
||||
public static function dataLists(BaseDataLists $lists)
|
||||
public static function dataLists(BaseDataLists $lists,$remark)
|
||||
{
|
||||
//获取导出信息
|
||||
if ($lists->export == ExportEnum::INFO && $lists instanceof ListsExcelInterface) {
|
||||
@ -109,6 +112,12 @@ class JsonService
|
||||
'page_no' => $lists->pageNo,
|
||||
'page_size' => $lists->pageSize,
|
||||
];
|
||||
$store_id = DictType::where('type','store')->value('remark')??5;
|
||||
if($remark){
|
||||
$data['store'] = StoreLogic::search([
|
||||
'id' => $store_id
|
||||
]);
|
||||
}
|
||||
$data['extend'] = [];
|
||||
if ($lists instanceof ListsExtendInterface) {
|
||||
$data['extend'] = $lists->extend();
|
||||
|
82
app/common/service/SmsService.php
Normal file
82
app/common/service/SmsService.php
Normal file
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\service;
|
||||
|
||||
use Overtrue\EasySms\EasySms;
|
||||
use Overtrue\EasySms\Exceptions\NoGatewayAvailableException;
|
||||
use support\exception\BusinessException;
|
||||
|
||||
class SmsService
|
||||
{
|
||||
|
||||
public $config;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$config = [
|
||||
// HTTP 请求的超时时间(秒)
|
||||
'timeout' => 5.0,
|
||||
|
||||
// 默认发送配置
|
||||
'default' => [
|
||||
// 网关调用策略,默认:顺序调用
|
||||
'strategy' => \Overtrue\EasySms\Strategies\OrderStrategy::class,
|
||||
|
||||
// 默认可用的发送网关
|
||||
'gateways' => [
|
||||
'yunpian', 'aliyun',
|
||||
],
|
||||
],
|
||||
// 可用的网关配置
|
||||
'gateways' => [
|
||||
'errorlog' => [
|
||||
'file' => runtime_path() . '/logs/' . date('Ymd') . '/easy-sms.log',
|
||||
],
|
||||
'aliyun' => [
|
||||
'access_key_id' => 'LTAI5t7mhH3ij2cNWs1zhPmv',
|
||||
'access_key_secret' => 'gqo2wMpvi8h5bDBmCpMje6BaiXvcPu',
|
||||
'sign_name' => '里海科技',
|
||||
],
|
||||
//...
|
||||
],
|
||||
];
|
||||
$this->config=$config;
|
||||
|
||||
}
|
||||
|
||||
public function client($phone,$template,$code,$type = 0)
|
||||
{
|
||||
try{
|
||||
$easySms = new EasySms($this->config);
|
||||
|
||||
if($type){//预留发送到货短信
|
||||
$res = $easySms->send($phone, [
|
||||
'content' => '您的验证码为: '.$code,
|
||||
'template' => $template,
|
||||
'data' => [
|
||||
'code' => $code
|
||||
],
|
||||
]);
|
||||
|
||||
}else{
|
||||
$res = $easySms->send($phone, [
|
||||
'content' => '您的验证码为: '.$code,
|
||||
'template' => $template,
|
||||
'data' => [
|
||||
'code' => $code
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
if($res && $res['aliyun']['status'] == 'success'){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}catch(NoGatewayAvailableException $e){
|
||||
throw new BusinessException($e->getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -405,6 +405,20 @@ if (!function_exists('haversineDistance')) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 随机验证码
|
||||
*/
|
||||
if (!function_exists('generateRandomCode')) {
|
||||
function generateRandomCode($length = 4) {
|
||||
$code = '';
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$code .= random_int(0, 9);
|
||||
}
|
||||
return $code;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('reset_index')) {
|
||||
/**
|
||||
* 重置数组索引
|
||||
|
@ -30,7 +30,11 @@ class CodePaySend implements Consumer
|
||||
];
|
||||
$res = $pay->wechat->query($order);
|
||||
if ($res['trade_state'] == 'SUCCESS' && $res['trade_state_desc'] == '支付成功') {
|
||||
PayNotifyLogic::handle('wechat_common', $res['out_trade_no'], $res);
|
||||
if(isset($data['pay_type']) && $data['pay_type']=='recharge'){
|
||||
PayNotifyLogic::handle('recharge', $res['out_trade_no'], $res);
|
||||
}else{
|
||||
PayNotifyLogic::handle('wechat_common', $res['out_trade_no'], $res);
|
||||
}
|
||||
}else{
|
||||
throw new BusinessException('订单支付中', 200);
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ namespace app\queue\redis;
|
||||
use app\admin\logic\store_product\StoreProductLogic;
|
||||
use app\common\model\store_branch_product\StoreBranchProduct;
|
||||
use app\common\model\store_branch_product_attr_value\StoreBranchProductAttrValue;
|
||||
use app\common\model\store_branch_product_exchange\StoreBranchProductExchange;
|
||||
use app\common\model\store_product\StoreProduct;
|
||||
use app\common\model\store_product_attr_value\StoreProductAttrValue;
|
||||
use app\common\model\system_store_storage\SystemStoreStorage;
|
||||
@ -28,9 +29,18 @@ class StoreStorageSend implements Consumer
|
||||
{
|
||||
$product_arr = $data['product_arr'];
|
||||
$store_id = $data['store_id'];
|
||||
$stock_type = $data['stock_type'];
|
||||
$admin_id = $data['admin_id'];
|
||||
Log::error('StoreStorageSend: ' . json_encode($data));
|
||||
$find = StoreProduct::where('id', $product_arr['id'])->findOrEmpty()->toArray();
|
||||
if($stock_type == 1){
|
||||
$this->ordinary($product_arr,$store_id,$admin_id,$find);
|
||||
}elseif($stock_type == 2){
|
||||
$this->exchange($product_arr,$store_id,$admin_id,$find);
|
||||
}
|
||||
}
|
||||
|
||||
/**普通 */
|
||||
public function ordinary($product_arr,$store_id,$admin_id,$find){
|
||||
$store_find = StoreBranchProduct::where(['product_id' => $product_arr['id'], 'store_id' => $store_id])->findOrEmpty()->toArray();
|
||||
if ($find && !$store_find) {
|
||||
$attr_value = StoreProductAttrValue::where('product_id', $product_arr['id'])->findOrEmpty();
|
||||
@ -45,9 +55,12 @@ class StoreStorageSend implements Consumer
|
||||
'bar_code' => $find['bar_code'],
|
||||
'cate_id' => $find['cate_id'],
|
||||
'price' => $find['price'],
|
||||
// 'cost' => $find['cost'], //v1.0
|
||||
'cost' => $find['cost'],
|
||||
'purchase' => $find['purchase'],
|
||||
'vip_price' => $find['vip_price'],
|
||||
'unit' => $find['unit'],
|
||||
'batch' => $find['batch'],
|
||||
'store_id' => $store_id,
|
||||
'sales' => 0,
|
||||
'stock' => 0,
|
||||
@ -65,7 +78,7 @@ class StoreStorageSend implements Consumer
|
||||
if ($product_arr['stock'] > 0) {
|
||||
$this->storage($find, $store_id, $admin_id, $product_arr);
|
||||
}
|
||||
StoreProductLogic::updateGoodsclass($find['cate_id']);
|
||||
StoreProductLogic::updateGoodsclass($find['cate_id'],$store_id);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
@ -77,7 +90,7 @@ class StoreStorageSend implements Consumer
|
||||
Db::startTrans();
|
||||
try {
|
||||
if ($product_arr['stock'] > 0) {
|
||||
$this->storage($find, $store_id, $admin_id, $product_arr);
|
||||
$this->storage($find, $store_id, $admin_id, $product_arr,1);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
@ -89,13 +102,64 @@ class StoreStorageSend implements Consumer
|
||||
}
|
||||
}
|
||||
|
||||
public function storage($find, $store_id, $admin_id, $product_arr)
|
||||
/**兑换 */
|
||||
public function exchange($product_arr,$store_id,$admin_id,$find){
|
||||
$store_find = StoreBranchProductExchange::where(['product_id' => $product_arr['id'], 'store_id' => $store_id])->findOrEmpty()->toArray();
|
||||
if ($find && !$store_find) {
|
||||
Db::startTrans();
|
||||
try {
|
||||
$product = [
|
||||
'product_id' => $find['id'],
|
||||
'image' => $find['image'],
|
||||
'store_name' => $find['store_name'],
|
||||
'store_info' => $find['store_info'],
|
||||
'keyword' => $find['keyword'],
|
||||
'bar_code' => $find['bar_code'],
|
||||
'cate_id' => $find['cate_id'],
|
||||
'price' => $find['price'],
|
||||
'cost' => $find['cost'],
|
||||
'purchase' => $find['purchase'],
|
||||
'vip_price' => $find['vip_price'],
|
||||
'unit' => $find['unit'],
|
||||
'store_id' => $store_id,
|
||||
'sales' => 0,
|
||||
'stock' => 0,
|
||||
];
|
||||
StoreBranchProductExchange::create($product);
|
||||
if ($product_arr['stock'] > 0) {
|
||||
$this->storage($find, $store_id, $admin_id, $product_arr);
|
||||
}
|
||||
// StoreProductLogic::updateGoodsclass($find['cate_id'],$store_id);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::error('store-storage队列消费失败: ' . $e->getMessage() . ',line:' . $e->getLine() . ',file:' . $e->getFile());
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
Db::startTrans();
|
||||
try {
|
||||
if ($product_arr['stock'] > 0) {
|
||||
$this->storage($find, $store_id, $admin_id, $product_arr,2);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::error('store-storage队列消费失败: ' . $e->getMessage() . ',line:' . $e->getLine() . ',file:' . $e->getFile());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
public function storage($find, $store_id, $admin_id, $product_arr,$stock_type=1)
|
||||
{
|
||||
$storage = [
|
||||
'product_id' => $product_arr['id'],
|
||||
'store_id' => $store_id,
|
||||
'nums' => $product_arr['stock'],
|
||||
'admin_id' => $admin_id,
|
||||
'type' => $stock_type,
|
||||
];
|
||||
if ($find['stock'] < $product_arr['stock']) {
|
||||
$storage['status'] = -1;
|
||||
|
107
app/statistics/controller/IndexController.php
Normal file
107
app/statistics/controller/IndexController.php
Normal file
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
namespace app\statistics\controller;
|
||||
|
||||
use app\common\controller\BaseLikeController;
|
||||
use app\statistics\logic\OrderLogic;
|
||||
use app\statistics\logic\ProductLogic;
|
||||
use app\statistics\logic\UserLogic;
|
||||
use DateTime;
|
||||
|
||||
class IndexController extends BaseLikeController
|
||||
{
|
||||
|
||||
public function index()
|
||||
{
|
||||
$res = OrderLogic::dayPayPrice(5);
|
||||
if (OrderLogic::hasError()) {
|
||||
return $this->fail(OrderLogic::getError()); //获取错误信息并返回错误信息
|
||||
}
|
||||
return $this->success('ok', ['dayPayPrice' => $res,'title'=>'喻寺镇农(特)产品交易大数据']);
|
||||
}
|
||||
public function user()
|
||||
{
|
||||
$today = strtotime(date('Y-m-d'));
|
||||
$dates=[];
|
||||
// 循环输出前5天的日期
|
||||
for ($i = 0; $i <= 4; $i++) {
|
||||
// 计算前第$i天的日期时间戳
|
||||
$timestamp = $today - ($i * 86400); // 86400秒等于1天
|
||||
|
||||
// 将时间戳格式化为日期
|
||||
$date = date('Y-m-d', $timestamp);
|
||||
$dates[]=$date;
|
||||
}
|
||||
$res = UserLogic::userCount(5,$dates);
|
||||
if (UserLogic::hasError()) {
|
||||
return $this->fail(UserLogic::getError()); //获取错误信息并返回错误信息
|
||||
}
|
||||
return $this->success('ok', $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 中间商品统计
|
||||
*/
|
||||
public function product_count()
|
||||
{
|
||||
$res = ProductLogic::Count(5);
|
||||
if (ProductLogic::hasError()) {
|
||||
return $this->fail(ProductLogic::getError()); //获取错误信息并返回错误信息
|
||||
}
|
||||
return $this->success('ok', $res);
|
||||
}
|
||||
/**
|
||||
* 订单统计
|
||||
*/
|
||||
public function order_user_num_count()
|
||||
{
|
||||
$res = OrderLogic::Count(5);
|
||||
if (ProductLogic::hasError()) {
|
||||
return $this->fail(ProductLogic::getError()); //获取错误信息并返回错误信息
|
||||
}
|
||||
return $this->success('ok', $res);
|
||||
}
|
||||
/**
|
||||
* 商品销量排行榜统计
|
||||
*/
|
||||
public function sales_ranking()
|
||||
{
|
||||
$res = ProductLogic::sales(5);
|
||||
if (ProductLogic::hasError()) {
|
||||
return $this->fail(ProductLogic::getError()); //获取错误信息并返回错误信息
|
||||
}
|
||||
return $this->success('ok', $res);
|
||||
}
|
||||
/**
|
||||
* 成交用户数据
|
||||
*/
|
||||
public function user_trade_count()
|
||||
{
|
||||
$dates = [];
|
||||
|
||||
$today = new DateTime();
|
||||
$thirtyDaysAgo = new DateTime($today->format('Y-m-d'));
|
||||
$thirtyDaysAgo->modify('-30 days');
|
||||
for ($i = 0; $i < 31; $i++) {
|
||||
$date = new DateTime($thirtyDaysAgo->format('Y-m-d'));
|
||||
$date->modify('+' . $i . ' days');
|
||||
$dates[] = $date->format('Y-m-d');
|
||||
}
|
||||
$res = UserLogic::TradeCount(5, $dates);
|
||||
if (UserLogic::hasError()) {
|
||||
return $this->fail(UserLogic::getError()); //获取错误信息并返回错误信息
|
||||
}
|
||||
return $this->success('ok', $res);
|
||||
}
|
||||
/**
|
||||
* 当日订单金额
|
||||
*/
|
||||
public function street_currday_order_count()
|
||||
{
|
||||
$res = OrderLogic::Currday(5);
|
||||
if (ProductLogic::hasError()) {
|
||||
return $this->fail(ProductLogic::getError()); //获取错误信息并返回错误信息
|
||||
}
|
||||
return $this->success('ok', $res);
|
||||
}
|
||||
}
|
69
app/statistics/logic/OrderLogic.php
Normal file
69
app/statistics/logic/OrderLogic.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace app\statistics\logic;
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\store_order\StoreOrder;
|
||||
use app\common\model\user_recharge\UserRecharge;
|
||||
|
||||
class OrderLogic extends BaseLogic
|
||||
{
|
||||
public static function Count($store_id)
|
||||
{
|
||||
$orderNum = StoreOrder::where('store_id', $store_id)->whereDay('create_time')->count();
|
||||
$orderPayNum = StoreOrder::where('store_id', $store_id)->where('paid', 1)->whereDay('create_time')->group('uid')->count();
|
||||
$monthOrderNum = StoreOrder::where('store_id', $store_id)->whereMonth('create_time')->count();
|
||||
$monthOrderPayNum = StoreOrder::where('store_id', $store_id)->where('paid', 1)->whereMonth('create_time')->group('uid')->count();
|
||||
$data = [
|
||||
"orderNum" => $orderNum,
|
||||
"monthOrderNum" => $monthOrderNum,
|
||||
"monthOrderNumRate" => 0,
|
||||
"orderNumRate" => 0,
|
||||
"orderPayNum" => $orderPayNum,
|
||||
"monthOrderPayNum" => $monthOrderPayNum,
|
||||
"monthOrderPayRate" => 0,
|
||||
"orderOrderPayRate" => 0
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
public static function Currday($store_id)
|
||||
{
|
||||
$date = date("Y-m-d");
|
||||
$startTime = strtotime($date . ' 00:00:00'); // 当天的开始时间戳
|
||||
$endTime = strtotime($date . ' 23:59:59'); // 当天的结束时间戳
|
||||
|
||||
$interval = 4 * 60 * 60; // 4小时的秒数
|
||||
$data = [];
|
||||
for ($time = $startTime; $time < $endTime; $time += $interval) {
|
||||
|
||||
$endTimeSegment = $time + $interval;
|
||||
$startTimeSegment = date('Y-m-d H:i:s', $time);
|
||||
$yesterendTimeSegment = date('Y-m-d H:i:s', $endTimeSegment - 86400);
|
||||
$endTimeSegment = date('Y-m-d H:i:s', $endTimeSegment);
|
||||
$yesterstartTimeSegment = date('Y-m-d H:i:s', $time - 86400);
|
||||
// 统计当前时间段的订单
|
||||
$todayAmount = StoreOrder::where('store_id', $store_id)
|
||||
->where('paid', 1)
|
||||
->whereBetween('create_time', [strtotime($startTimeSegment), strtotime($endTimeSegment)])
|
||||
->sum('pay_price');
|
||||
$yesterdayAmount = StoreOrder::where('store_id', $store_id)
|
||||
->where('paid', 1)
|
||||
->whereBetween('create_time', [strtotime($yesterstartTimeSegment), strtotime($yesterendTimeSegment)])
|
||||
->sum('pay_price');
|
||||
$data[] = [
|
||||
'todayAmount' => $todayAmount,
|
||||
'yesterdayAmount' => $yesterdayAmount,
|
||||
];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
public static function dayPayPrice($store_id)
|
||||
{
|
||||
$todayAmount = UserRecharge::where('store_id', $store_id)
|
||||
->where('paid', 1)
|
||||
->whereDay('create_time')
|
||||
->sum('price');
|
||||
|
||||
return $todayAmount;
|
||||
}
|
||||
}
|
51
app/statistics/logic/ProductLogic.php
Normal file
51
app/statistics/logic/ProductLogic.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace app\statistics\logic;
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\store_branch_product\StoreBranchProduct;
|
||||
|
||||
class ProductLogic extends BaseLogic
|
||||
{
|
||||
public static function Count($store_id)
|
||||
{
|
||||
$todayProductCount=StoreBranchProduct::where('store_id',$store_id)->count();
|
||||
$yestertodayProductCount=StoreBranchProduct::where('store_id',$store_id)->where('create_time', '<',strtotime(date('Y-md'))-1)->count();
|
||||
if ($yestertodayProductCount == 0 ||$todayProductCount==0) {
|
||||
$weeklyProductTotalGrowthRate = 0;
|
||||
} else {
|
||||
$weeklyProductTotalGrowthRate = ($todayProductCount - $yestertodayProductCount) / $yestertodayProductCount * 100;
|
||||
}
|
||||
|
||||
$todayNewProductCount=StoreBranchProduct::where('store_id',$store_id)->whereDay('create_time')->count();
|
||||
$yestertodayNewProductCount=StoreBranchProduct::where('store_id',$store_id)->whereDay('create_time', 'yesterday')->count();
|
||||
if ($yestertodayProductCount == 0 ||$todayProductCount==0) {
|
||||
$weeklyNewProductTotalGrowthRate = 0;
|
||||
} else {
|
||||
$weeklyNewProductTotalGrowthRate = ($todayNewProductCount - $yestertodayNewProductCount) / $yestertodayNewProductCount * 100;
|
||||
}
|
||||
$data = [
|
||||
"totalProductCounInfo" => [
|
||||
"todayProductCount" => $todayProductCount,
|
||||
"yestertodayProductCount" => $yestertodayProductCount,
|
||||
"weeklyProductTotalGrowthRate" => $weeklyProductTotalGrowthRate
|
||||
],
|
||||
"newProductCountInfo" => [
|
||||
"todayNewProductCount" => 0,
|
||||
"yestertodayNewProductCount" => 0,
|
||||
"weeklyNewProductTotalGrowthRate" => $weeklyNewProductTotalGrowthRate
|
||||
],
|
||||
"merchantCountInfo" => [
|
||||
"todayMerchantCount" => 1,
|
||||
"yestertodayMerchantCount" => 1,
|
||||
"weeklyMerchantGrowthRate" => 0
|
||||
]
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function sales($store_id){
|
||||
$select=StoreBranchProduct::where('store_id',$store_id)->limit(10)->order('sales desc')->field('id,store_name,image,sales')->select();
|
||||
return $select?->toArray();
|
||||
}
|
||||
}
|
33
app/statistics/logic/UserLogic.php
Normal file
33
app/statistics/logic/UserLogic.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace app\statistics\logic;
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\store_order\StoreOrder;
|
||||
use app\common\model\store_visit\StoreVisit;
|
||||
use app\common\model\user_recharge\UserRecharge;
|
||||
|
||||
class UserLogic extends BaseLogic
|
||||
{
|
||||
public static function userCount($store_id,$dates)
|
||||
{
|
||||
$data = [];
|
||||
foreach ($dates as $k=>$date) {
|
||||
$data[$k]['newUserCount']=UserRecharge::whereDay('create_time', $date)->where('store_id',$store_id)->where('paid',1)->where('recharge_type','INDUSTRYMEMBERS')->count();
|
||||
$data[$k]['viewUserCount']=StoreVisit::whereDay('create_time', $date)->where('store_id',$store_id)->group('uid')->count();
|
||||
$data[$k]['totalUserCount']=UserRecharge::where('create_time','<',strtotime($date) )->where('store_id',$store_id)->where('paid',1)->where('recharge_type','INDUSTRYMEMBERS')->count();
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
public static function TradeCount($store_id,$dates)
|
||||
{
|
||||
$data = [];
|
||||
foreach ($dates as $k=>$date) {
|
||||
$data[$k]['date']=$date;
|
||||
$data[$k]['visitUser']=StoreVisit::whereDay('create_time', $date)->where('store_id',$store_id)->cache('statistics_store_visit_count_' . $date, 300)->group('uid')->count();
|
||||
$data[$k]['orderUser']=StoreOrder::whereDay('create_time', $date)->where('store_id',$store_id)->cache('statistics_store_order_count_' . $date, 300)->group('uid')->count();
|
||||
$data[$k]['payOrderUser']=StoreOrder::whereDay('create_time', $date)->where('store_id',$store_id)->where('paid',1)->cache('statistics_store_order_pay_count_' . $date, 300)->group('uid')->count();
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
@ -5,9 +5,7 @@ namespace app\store\controller;
|
||||
|
||||
|
||||
use app\common\controller\BaseLikeController;
|
||||
use app\common\lists\BaseDataLists;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
#[ApiDoc\NotParse()]
|
||||
|
||||
|
||||
class BaseAdminController extends BaseLikeController
|
||||
{
|
||||
|
@ -19,7 +19,6 @@ use app\admin\logic\system_store\SystemStoreLogic;
|
||||
use app\common\controller\Definitions;
|
||||
use app\common\service\ConfigService;
|
||||
use app\common\service\FileService;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
@ -27,27 +26,26 @@ use think\facade\Db;
|
||||
* Class ConfigController
|
||||
* @package app\admin\controller
|
||||
*/
|
||||
#[ApiDoc\title('站点配置')]
|
||||
class ConfigController extends BaseAdminController
|
||||
{
|
||||
|
||||
public $notNeedLogin = ['getConfig', 'dict'];
|
||||
|
||||
#[
|
||||
ApiDoc\Title('站点配置'),
|
||||
ApiDoc\url('/store/config/getConfig'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\ResponseSuccess("data", type: "array", children: [
|
||||
['name' => 'oss_domain', 'desc' => 'oss域名', 'type' => 'string'],
|
||||
['name' => 'web_name', 'desc' => '站点名称', 'type' => 'string'],
|
||||
['name' => 'web_favicon', 'desc' => '站点图标', 'type' => 'string'],
|
||||
['name' => 'web_logo', 'desc' => '站点logo', 'type' => 'string'],
|
||||
['name' => 'login_image', 'desc' => '登录页背景图', 'type' => 'string'],
|
||||
['name' => 'copyright_config', 'desc' => '版权信息', 'type' => 'array'],
|
||||
]),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('站点配置'),
|
||||
// ApiDoc\url('/store/config/getConfig'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array", children: [
|
||||
// ['name' => 'oss_domain', 'desc' => 'oss域名', 'type' => 'string'],
|
||||
// ['name' => 'web_name', 'desc' => '站点名称', 'type' => 'string'],
|
||||
// ['name' => 'web_favicon', 'desc' => '站点图标', 'type' => 'string'],
|
||||
// ['name' => 'web_logo', 'desc' => '站点logo', 'type' => 'string'],
|
||||
// ['name' => 'login_image', 'desc' => '登录页背景图', 'type' => 'string'],
|
||||
// ['name' => 'copyright_config', 'desc' => '版权信息', 'type' => 'array'],
|
||||
// ]),
|
||||
// ]
|
||||
public function getConfig()
|
||||
{
|
||||
// $data = ConfigLogic::getConfig();
|
||||
@ -70,15 +68,15 @@ class ConfigController extends BaseAdminController
|
||||
return $this->data($data);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('门店配置'),
|
||||
ApiDoc\url('/store/config/store'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('门店配置'),
|
||||
// ApiDoc\url('/store/config/store'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function store()
|
||||
{
|
||||
$params['id'] = $this->request->adminInfo['store_id'];
|
||||
@ -86,15 +84,15 @@ class ConfigController extends BaseAdminController
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('保存门店配置'),
|
||||
ApiDoc\url('/store/config/saveStore'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('保存门店配置'),
|
||||
// ApiDoc\url('/store/config/saveStore'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function saveStore()
|
||||
{
|
||||
$params = $this->request->post();
|
||||
@ -103,31 +101,31 @@ class ConfigController extends BaseAdminController
|
||||
return $this->success('操作成功', [], 1, 1);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('省列表'),
|
||||
ApiDoc\url('/store/config/province'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('省列表'),
|
||||
// ApiDoc\url('/store/config/province'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function province()
|
||||
{
|
||||
$list = Db::name('geo_province')->select()->toArray();
|
||||
return $this->success('ok', $list);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('市列表'),
|
||||
ApiDoc\url('/store/config/city'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Query(name: 'code', type: 'int', require: true, desc: '省份代码'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('市列表'),
|
||||
// ApiDoc\url('/store/config/city'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Query(name: 'code', type: 'int', require: true, desc: '省份代码'),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function city()
|
||||
{
|
||||
$province_code = $this->request->get('code');
|
||||
@ -135,16 +133,16 @@ class ConfigController extends BaseAdminController
|
||||
return $this->success('ok', $list);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('区列表'),
|
||||
ApiDoc\url('/store/config/area'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Query(name: 'code', type: 'int', require: true, desc: '城市代码'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('区列表'),
|
||||
// ApiDoc\url('/store/config/area'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Query(name: 'code', type: 'int', require: true, desc: '城市代码'),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function area()
|
||||
{
|
||||
$city_code = $this->request->get('code');
|
||||
|
@ -5,41 +5,39 @@ namespace app\store\controller;
|
||||
use app\common\controller\Definitions;
|
||||
use app\common\lists\DeliveryServiceLists;
|
||||
use app\common\logic\DeliveryServiceLogic;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
|
||||
#[ApiDoc\title('配送员管理')]
|
||||
class DeliveryController extends BaseAdminController
|
||||
{
|
||||
|
||||
#[
|
||||
ApiDoc\Title('列表'),
|
||||
ApiDoc\url('/store/delivery/lists'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Query(name: 'keyword', type: 'string', require: false, desc: '名称/手机号'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\Query(ref: [Definitions::class, "page"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('列表'),
|
||||
// ApiDoc\url('/store/delivery/lists'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Query(name: 'keyword', type: 'string', require: false, desc: '名称/手机号'),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\Query(ref: [Definitions::class, "page"]),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new DeliveryServiceLists());
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('添加'),
|
||||
ApiDoc\url('/store/delivery/add'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\Param(name: 'avatar', type: 'string', require: true, desc: '头像'),
|
||||
ApiDoc\Param(name: 'nickname', type: 'string', require: true, desc: '店员名称'),
|
||||
ApiDoc\Param(name: 'phone', type: 'string', require: true, desc: '手机号'),
|
||||
ApiDoc\Param(name: 'status', type: 'string', require: true, desc: '状态,1启用,0禁用'),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('添加'),
|
||||
// ApiDoc\url('/store/delivery/add'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\Param(name: 'avatar', type: 'string', require: true, desc: '头像'),
|
||||
// ApiDoc\Param(name: 'nickname', type: 'string', require: true, desc: '店员名称'),
|
||||
// ApiDoc\Param(name: 'phone', type: 'string', require: true, desc: '手机号'),
|
||||
// ApiDoc\Param(name: 'status', type: 'string', require: true, desc: '状态,1启用,0禁用'),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function add(DeliveryServiceLogic $logic)
|
||||
{
|
||||
$params = $this->request->post();
|
||||
@ -47,20 +45,20 @@ class DeliveryController extends BaseAdminController
|
||||
return $this->success('操作成功', [], 1, 1);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('编辑'),
|
||||
ApiDoc\url('/store/delivery/edit'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\Param(name: 'avatar', type: 'string', require: true, desc: '头像'),
|
||||
ApiDoc\Param(name: 'nickname', type: 'string', require: true, desc: '店员名称'),
|
||||
ApiDoc\Param(name: 'phone', type: 'string', require: true, desc: '手机号'),
|
||||
ApiDoc\Param(name: 'status', type: 'string', require: true, desc: '状态,1启用,0禁用'),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('编辑'),
|
||||
// ApiDoc\url('/store/delivery/edit'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\Param(name: 'avatar', type: 'string', require: true, desc: '头像'),
|
||||
// ApiDoc\Param(name: 'nickname', type: 'string', require: true, desc: '店员名称'),
|
||||
// ApiDoc\Param(name: 'phone', type: 'string', require: true, desc: '手机号'),
|
||||
// ApiDoc\Param(name: 'status', type: 'string', require: true, desc: '状态,1启用,0禁用'),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function edit(DeliveryServiceLogic $logic)
|
||||
{
|
||||
$id = $this->request->post('id');
|
||||
@ -69,16 +67,16 @@ class DeliveryController extends BaseAdminController
|
||||
return $this->success('操作成功', [], 1, 1);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('删除'),
|
||||
ApiDoc\url('/store/delivery/delete'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('删除'),
|
||||
// ApiDoc\url('/store/delivery/delete'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function delete(DeliveryServiceLogic $logic)
|
||||
{
|
||||
$id = $this->request->post('id');
|
||||
@ -86,27 +84,27 @@ class DeliveryController extends BaseAdminController
|
||||
return $this->success('操作成功', [], 1, 1);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('详情'),
|
||||
ApiDoc\url('/store/delivery/detail'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\Query(name: 'id', type: 'int', require: true, desc: 'id'),
|
||||
ApiDoc\ResponseSuccess("data", type: "array", children: [
|
||||
['name' => 'id', 'desc' => 'ID', 'type' => 'int'],
|
||||
['name' => 'account', 'desc' => '账号', 'type' => 'string'],
|
||||
['name' => 'avatar', 'desc' => '头像', 'type' => 'string'],
|
||||
['name' => 'staff_name', 'desc' => '店员名称', 'type' => 'string'],
|
||||
['name' => 'phone', 'desc' => '手机号', 'type' => 'string'],
|
||||
['name' => 'verify_status', 'desc' => '核销开关,1开启,0关闭', 'type' => 'int'],
|
||||
['name' => 'order_status', 'desc' => '订单状态,1开启,0关闭', 'type' => 'int'],
|
||||
['name' => 'is_admin', 'desc' => '是否管理员,1是,0不是', 'type' => 'int'],
|
||||
['name' => 'is_manager', 'desc' => '是否是店长,1是,0不是', 'type' => 'int'],
|
||||
['name' => 'status', 'desc' => '状态,1启用,0禁用', 'type' => 'int'],
|
||||
]),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('详情'),
|
||||
// ApiDoc\url('/store/delivery/detail'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\Query(name: 'id', type: 'int', require: true, desc: 'id'),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array", children: [
|
||||
// ['name' => 'id', 'desc' => 'ID', 'type' => 'int'],
|
||||
// ['name' => 'account', 'desc' => '账号', 'type' => 'string'],
|
||||
// ['name' => 'avatar', 'desc' => '头像', 'type' => 'string'],
|
||||
// ['name' => 'staff_name', 'desc' => '店员名称', 'type' => 'string'],
|
||||
// ['name' => 'phone', 'desc' => '手机号', 'type' => 'string'],
|
||||
// ['name' => 'verify_status', 'desc' => '核销开关,1开启,0关闭', 'type' => 'int'],
|
||||
// ['name' => 'order_status', 'desc' => '订单状态,1开启,0关闭', 'type' => 'int'],
|
||||
// ['name' => 'is_admin', 'desc' => '是否管理员,1是,0不是', 'type' => 'int'],
|
||||
// ['name' => 'is_manager', 'desc' => '是否是店长,1是,0不是', 'type' => 'int'],
|
||||
// ['name' => 'status', 'desc' => '状态,1启用,0禁用', 'type' => 'int'],
|
||||
// ]),
|
||||
// ]
|
||||
public function detail(DeliveryServiceLogic $logic)
|
||||
{
|
||||
$id = $this->request->get('id');
|
||||
@ -114,16 +112,16 @@ class DeliveryController extends BaseAdminController
|
||||
return $this->data($data);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('开启/关闭'),
|
||||
ApiDoc\url('/store/delivery/status'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('开启/关闭'),
|
||||
// ApiDoc\url('/store/delivery/status'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function status(DeliveryServiceLogic $logic)
|
||||
{
|
||||
$id = $this->request->post('id');
|
||||
|
@ -7,8 +7,7 @@ namespace app\store\controller;
|
||||
use app\common\cache\ExportCache;
|
||||
use app\common\service\JsonService;
|
||||
use support\Cache;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
#[ApiDoc\NotParse()]
|
||||
|
||||
|
||||
class DownloadController extends BaseAdminController
|
||||
{
|
||||
|
@ -7,33 +7,32 @@ use app\admin\lists\file\FileLists;
|
||||
use app\admin\logic\FileLogic;
|
||||
use app\admin\validate\FileValidate;
|
||||
use app\common\controller\Definitions;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
|
||||
#[ApiDoc\title('文件管理')]
|
||||
// #[ApiDoc\title('文件管理')]
|
||||
class FileController extends BaseAdminController
|
||||
{
|
||||
|
||||
#[
|
||||
ApiDoc\Title('列表'),
|
||||
ApiDoc\url('/store/file/lists'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\Query(ref: [Definitions::class, "page"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('列表'),
|
||||
// ApiDoc\url('/store/file/lists'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\Query(ref: [Definitions::class, "page"]),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new FileLists());
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('移动'),
|
||||
ApiDoc\url('/store/file/move'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('移动'),
|
||||
// ApiDoc\url('/store/file/move'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function move()
|
||||
{
|
||||
$params = (new FileValidate())->post()->goCheck('move');
|
||||
@ -41,13 +40,13 @@ class FileController extends BaseAdminController
|
||||
return $this->success('移动成功', [], 1, 1);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('重命名'),
|
||||
ApiDoc\url('/store/file/rename'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('重命名'),
|
||||
// ApiDoc\url('/store/file/rename'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function rename()
|
||||
{
|
||||
$params = (new FileValidate())->post()->goCheck('rename');
|
||||
@ -55,13 +54,13 @@ class FileController extends BaseAdminController
|
||||
return $this->success('重命名成功', [], 1, 1);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('删除'),
|
||||
ApiDoc\url('/store/file/delete'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('删除'),
|
||||
// ApiDoc\url('/store/file/delete'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function delete()
|
||||
{
|
||||
$params = (new FileValidate())->post()->goCheck('delete');
|
||||
@ -69,25 +68,25 @@ class FileController extends BaseAdminController
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('分类列表'),
|
||||
ApiDoc\url('/store/file/listCate'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('分类列表'),
|
||||
// ApiDoc\url('/store/file/listCate'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function listCate()
|
||||
{
|
||||
return $this->dataLists(new FileCateLists());
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('添加文件分类'),
|
||||
ApiDoc\url('/store/file/addCate'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('添加文件分类'),
|
||||
// ApiDoc\url('/store/file/addCate'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function addCate()
|
||||
{
|
||||
$params = (new FileValidate())->post()->goCheck('addCate');
|
||||
@ -95,13 +94,13 @@ class FileController extends BaseAdminController
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('编辑文件分类'),
|
||||
ApiDoc\url('/store/file/editCate'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('编辑文件分类'),
|
||||
// ApiDoc\url('/store/file/editCate'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function editCate()
|
||||
{
|
||||
$params = (new FileValidate())->post()->goCheck('editCate');
|
||||
@ -109,13 +108,13 @@ class FileController extends BaseAdminController
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('删除文件分类'),
|
||||
ApiDoc\url('/store/file/delCate'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('删除文件分类'),
|
||||
// ApiDoc\url('/store/file/delCate'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function delCate()
|
||||
{
|
||||
$params = (new FileValidate())->post()->goCheck('id');
|
||||
|
@ -17,34 +17,33 @@ namespace app\store\controller;
|
||||
use app\store\logic\LoginLogic;
|
||||
use app\store\validate\LoginValidate;
|
||||
use think\facade\Cache;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
|
||||
/**
|
||||
* 管理员登录控制器
|
||||
* Class LoginController
|
||||
* @package app\store\controller
|
||||
*/
|
||||
#[ApiDoc\title('登入登出')]
|
||||
// #[ApiDoc\title('登入登出')]
|
||||
class LoginController extends BaseAdminController
|
||||
{
|
||||
|
||||
public $notNeedLogin = ['account'];
|
||||
|
||||
#[
|
||||
ApiDoc\Title('账号登录'),
|
||||
ApiDoc\url('/store/login/account'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\Param(name: "account", type: "string", require: true, desc: "账号"),
|
||||
ApiDoc\Param(name: "password", type: "string", require: true, desc: "密码"),
|
||||
ApiDoc\Param(name: "terminal", type: "integer", require: true, default: 1, desc: "终端类型:1-PC,2-H5"),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\ResponseSuccess("data", type: "array", children: [
|
||||
['name' => 'name', 'desc' => '用户名', 'type' => 'string'],
|
||||
['name' => 'avatar', 'desc' => '头像', 'type' => 'string'],
|
||||
['name' => 'token', 'desc' => 'token', 'type' => 'string'],
|
||||
['name' => 'role_name', 'desc' => '角色名称', 'type' => 'integer'],
|
||||
]),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('账号登录'),
|
||||
// ApiDoc\url('/store/login/account'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\Param(name: "account", type: "string", require: true, desc: "账号"),
|
||||
// ApiDoc\Param(name: "password", type: "string", require: true, desc: "密码"),
|
||||
// ApiDoc\Param(name: "terminal", type: "integer", require: true, default: 1, desc: "终端类型:1-PC,2-H5"),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array", children: [
|
||||
// ['name' => 'name', 'desc' => '用户名', 'type' => 'string'],
|
||||
// ['name' => 'avatar', 'desc' => '头像', 'type' => 'string'],
|
||||
// ['name' => 'token', 'desc' => 'token', 'type' => 'string'],
|
||||
// ['name' => 'role_name', 'desc' => '角色名称', 'type' => 'integer'],
|
||||
// ]),
|
||||
// ]
|
||||
public function account()
|
||||
{
|
||||
$params = (new LoginValidate())->post()->goCheck();
|
||||
@ -52,14 +51,14 @@ class LoginController extends BaseAdminController
|
||||
return $this->data((new LoginLogic())->login($params));
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('退出登录'),
|
||||
ApiDoc\url('/store/login/logout'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('退出登录'),
|
||||
// ApiDoc\url('/store/login/logout'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function logout()
|
||||
{
|
||||
//退出登录情况特殊,只有成功的情况,也不需要token验证
|
||||
|
@ -5,53 +5,52 @@ namespace app\store\controller;
|
||||
use app\common\controller\Definitions;
|
||||
use app\common\lists\StoreStaffLists;
|
||||
use app\common\logic\SystemStoreStaffLogic;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
|
||||
#[ApiDoc\title('店员管理')]
|
||||
// #[ApiDoc\title('店员管理')]
|
||||
class StaffController extends BaseAdminController
|
||||
{
|
||||
|
||||
#[
|
||||
ApiDoc\Title('列表'),
|
||||
ApiDoc\url('/store/staff/lists'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Query(name: 'keyword', type: 'string', require: false, desc: '店员名称/手机号/账号'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\Query(ref: [Definitions::class, "page"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array", children: [
|
||||
['name' => 'id', 'desc' => 'id', 'type' => 'int'],
|
||||
['name' => 'staff_name', 'desc' => '店员名称', 'type' => 'string'],
|
||||
['name' => 'avatar', 'desc' => '头像', 'type' => 'string'],
|
||||
['name' => 'account', 'desc' => '账号', 'type' => 'string'],
|
||||
['name' => 'phone', 'desc' => '手机号', 'type' => 'string'],
|
||||
['name' => 'is_admin', 'desc' => '是否是管理员,1是,0不是', 'type' => 'int'],
|
||||
['name' => 'is_manager', 'desc' => '是否是店长,1是,0不是', 'type' => 'int'],
|
||||
]),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('列表'),
|
||||
// ApiDoc\url('/store/staff/lists'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Query(name: 'keyword', type: 'string', require: false, desc: '店员名称/手机号/账号'),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\Query(ref: [Definitions::class, "page"]),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array", children: [
|
||||
// ['name' => 'id', 'desc' => 'id', 'type' => 'int'],
|
||||
// ['name' => 'staff_name', 'desc' => '店员名称', 'type' => 'string'],
|
||||
// ['name' => 'avatar', 'desc' => '头像', 'type' => 'string'],
|
||||
// ['name' => 'account', 'desc' => '账号', 'type' => 'string'],
|
||||
// ['name' => 'phone', 'desc' => '手机号', 'type' => 'string'],
|
||||
// ['name' => 'is_admin', 'desc' => '是否是管理员,1是,0不是', 'type' => 'int'],
|
||||
// ['name' => 'is_manager', 'desc' => '是否是店长,1是,0不是', 'type' => 'int'],
|
||||
// ]),
|
||||
// ]
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new StoreStaffLists());
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('添加'),
|
||||
ApiDoc\url('/store/staff/add'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\Param(name: 'account', type: 'string', require: true, desc: '账号'),
|
||||
ApiDoc\Param(name: 'pwd', type: 'string', require: true, desc: '密码'),
|
||||
ApiDoc\Param(name: 'avatar', type: 'string', require: true, desc: '头像'),
|
||||
ApiDoc\Param(name: 'staff_name', type: 'string', require: true, desc: '店员名称'),
|
||||
ApiDoc\Param(name: 'phone', type: 'string', require: true, desc: '手机号'),
|
||||
ApiDoc\Param(name: 'verify_status', type: 'string', require: true, desc: '核销开关,1开启,0关闭'),
|
||||
ApiDoc\Param(name: 'order_status', type: 'string', require: true, desc: '订单状态,1开启,0关闭'),
|
||||
ApiDoc\Param(name: 'is_manager', type: 'string', require: true, desc: '是否是店长,1是,0不是'),
|
||||
ApiDoc\Param(name: 'status', type: 'string', require: true, desc: '状态,1启用,0禁用'),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('添加'),
|
||||
// ApiDoc\url('/store/staff/add'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\Param(name: 'account', type: 'string', require: true, desc: '账号'),
|
||||
// ApiDoc\Param(name: 'pwd', type: 'string', require: true, desc: '密码'),
|
||||
// ApiDoc\Param(name: 'avatar', type: 'string', require: true, desc: '头像'),
|
||||
// ApiDoc\Param(name: 'staff_name', type: 'string', require: true, desc: '店员名称'),
|
||||
// ApiDoc\Param(name: 'phone', type: 'string', require: true, desc: '手机号'),
|
||||
// ApiDoc\Param(name: 'verify_status', type: 'string', require: true, desc: '核销开关,1开启,0关闭'),
|
||||
// ApiDoc\Param(name: 'order_status', type: 'string', require: true, desc: '订单状态,1开启,0关闭'),
|
||||
// ApiDoc\Param(name: 'is_manager', type: 'string', require: true, desc: '是否是店长,1是,0不是'),
|
||||
// ApiDoc\Param(name: 'status', type: 'string', require: true, desc: '状态,1启用,0禁用'),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function add(SystemStoreStaffLogic $staffLogic)
|
||||
{
|
||||
$params = $this->request->post();
|
||||
@ -59,24 +58,24 @@ class StaffController extends BaseAdminController
|
||||
return $this->success('操作成功', [], 1, 1);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('编辑'),
|
||||
ApiDoc\url('/store/staff/edit'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'),
|
||||
ApiDoc\Param(name: 'account', type: 'string', require: true, desc: '账号'),
|
||||
ApiDoc\Param(name: 'pwd', type: 'string', require: true, desc: '密码'),
|
||||
ApiDoc\Param(name: 'avatar', type: 'string', require: true, desc: '头像'),
|
||||
ApiDoc\Param(name: 'staff_name', type: 'string', require: true, desc: '店员名称'),
|
||||
ApiDoc\Param(name: 'phone', type: 'string', require: true, desc: '手机号'),
|
||||
ApiDoc\Param(name: 'verify_status', type: 'string', require: true, desc: '核销开关,1开启,0关闭'),
|
||||
ApiDoc\Param(name: 'order_status', type: 'string', require: true, desc: '订单状态,1开启,0关闭'),
|
||||
ApiDoc\Param(name: 'is_manager', type: 'string', require: true, desc: '是否是店长,1是,0不是'),
|
||||
ApiDoc\Param(name: 'status', type: 'string', require: true, desc: '状态,1启用,0禁用'),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('编辑'),
|
||||
// ApiDoc\url('/store/staff/edit'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'),
|
||||
// ApiDoc\Param(name: 'account', type: 'string', require: true, desc: '账号'),
|
||||
// ApiDoc\Param(name: 'pwd', type: 'string', require: true, desc: '密码'),
|
||||
// ApiDoc\Param(name: 'avatar', type: 'string', require: true, desc: '头像'),
|
||||
// ApiDoc\Param(name: 'staff_name', type: 'string', require: true, desc: '店员名称'),
|
||||
// ApiDoc\Param(name: 'phone', type: 'string', require: true, desc: '手机号'),
|
||||
// ApiDoc\Param(name: 'verify_status', type: 'string', require: true, desc: '核销开关,1开启,0关闭'),
|
||||
// ApiDoc\Param(name: 'order_status', type: 'string', require: true, desc: '订单状态,1开启,0关闭'),
|
||||
// ApiDoc\Param(name: 'is_manager', type: 'string', require: true, desc: '是否是店长,1是,0不是'),
|
||||
// ApiDoc\Param(name: 'status', type: 'string', require: true, desc: '状态,1启用,0禁用'),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function edit(SystemStoreStaffLogic $staffLogic)
|
||||
{
|
||||
$id = $this->request->post('id');
|
||||
@ -85,15 +84,15 @@ class StaffController extends BaseAdminController
|
||||
return $this->success('操作成功', [], 1, 1);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('删除'),
|
||||
ApiDoc\url('/store/staff/delete'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('删除'),
|
||||
// ApiDoc\url('/store/staff/delete'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function delete(SystemStoreStaffLogic $staffLogic)
|
||||
{
|
||||
$id = $this->request->post('id');
|
||||
@ -101,26 +100,26 @@ class StaffController extends BaseAdminController
|
||||
return $this->success('操作成功', [], 1, 1);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('详情'),
|
||||
ApiDoc\url('/store/staff/detail'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\Query(name: 'id', type: 'int', require: true, desc: 'id'),
|
||||
ApiDoc\ResponseSuccess("data", type: "array", children: [
|
||||
['name' => 'id', 'desc' => 'ID', 'type' => 'int'],
|
||||
['name' => 'account', 'desc' => '账号', 'type' => 'string'],
|
||||
['name' => 'avatar', 'desc' => '头像', 'type' => 'string'],
|
||||
['name' => 'staff_name', 'desc' => '店员名称', 'type' => 'string'],
|
||||
['name' => 'phone', 'desc' => '手机号', 'type' => 'string'],
|
||||
['name' => 'verify_status', 'desc' => '核销开关,1开启,0关闭', 'type' => 'int'],
|
||||
['name' => 'order_status', 'desc' => '订单状态,1开启,0关闭', 'type' => 'int'],
|
||||
['name' => 'is_admin', 'desc' => '是否管理员,1是,0不是', 'type' => 'int'],
|
||||
['name' => 'is_manager', 'desc' => '是否是店长,1是,0不是', 'type' => 'int'],
|
||||
['name' => 'status', 'desc' => '状态,1启用,0禁用', 'type' => 'int'],
|
||||
]),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('详情'),
|
||||
// ApiDoc\url('/store/staff/detail'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\Query(name: 'id', type: 'int', require: true, desc: 'id'),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array", children: [
|
||||
// ['name' => 'id', 'desc' => 'ID', 'type' => 'int'],
|
||||
// ['name' => 'account', 'desc' => '账号', 'type' => 'string'],
|
||||
// ['name' => 'avatar', 'desc' => '头像', 'type' => 'string'],
|
||||
// ['name' => 'staff_name', 'desc' => '店员名称', 'type' => 'string'],
|
||||
// ['name' => 'phone', 'desc' => '手机号', 'type' => 'string'],
|
||||
// ['name' => 'verify_status', 'desc' => '核销开关,1开启,0关闭', 'type' => 'int'],
|
||||
// ['name' => 'order_status', 'desc' => '订单状态,1开启,0关闭', 'type' => 'int'],
|
||||
// ['name' => 'is_admin', 'desc' => '是否管理员,1是,0不是', 'type' => 'int'],
|
||||
// ['name' => 'is_manager', 'desc' => '是否是店长,1是,0不是', 'type' => 'int'],
|
||||
// ['name' => 'status', 'desc' => '状态,1启用,0禁用', 'type' => 'int'],
|
||||
// ]),
|
||||
// ]
|
||||
public function detail(SystemStoreStaffLogic $staffLogic)
|
||||
{
|
||||
$id = $this->request->get('id');
|
||||
@ -128,15 +127,15 @@ class StaffController extends BaseAdminController
|
||||
return $this->data($data);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('开启/关闭'),
|
||||
ApiDoc\url('/store/staff/status'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('开启/关闭'),
|
||||
// ApiDoc\url('/store/staff/status'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function status(SystemStoreStaffLogic $logic)
|
||||
{
|
||||
$id = $this->request->post('id');
|
||||
|
@ -6,9 +6,7 @@ namespace app\store\controller;
|
||||
|
||||
use app\common\service\UploadService;
|
||||
use Exception;
|
||||
use Tinywan\Storage\Storage;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
#[ApiDoc\NotParse()]
|
||||
|
||||
|
||||
class UploadController extends BaseAdminController
|
||||
{
|
||||
|
@ -3,25 +3,26 @@
|
||||
namespace app\store\controller;
|
||||
|
||||
use app\common\controller\Definitions;
|
||||
use app\common\model\dict\DictType;
|
||||
use app\store\lists\store_order\StoreOrderLists;
|
||||
use app\store\logic\WorkbenchLogic;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
|
||||
#[ApiDoc\Title('工作台')]
|
||||
// #[ApiDoc\Title('工作台')]
|
||||
class WorkbenchController extends BaseAdminController
|
||||
{
|
||||
public $notNeedLogin = ['recharge_statistics'];
|
||||
|
||||
#[
|
||||
ApiDoc\Title('交易统计'),
|
||||
ApiDoc\url('/store/workbench/index'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'),
|
||||
ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('交易统计'),
|
||||
// ApiDoc\url('/store/workbench/index'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'),
|
||||
// ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function index()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
@ -30,17 +31,17 @@ class WorkbenchController extends BaseAdminController
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('商品统计(暂时不用)'),
|
||||
ApiDoc\url('/store/workbench/product'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'),
|
||||
ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('商品统计(暂时不用)'),
|
||||
// ApiDoc\url('/store/workbench/product'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'),
|
||||
// ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function product()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
@ -49,17 +50,17 @@ class WorkbenchController extends BaseAdminController
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('配送统计'),
|
||||
ApiDoc\url('/store/workbench/delivery'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'),
|
||||
ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('配送统计'),
|
||||
// ApiDoc\url('/store/workbench/delivery'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'),
|
||||
// ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function delivery()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
@ -68,18 +69,18 @@ class WorkbenchController extends BaseAdminController
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('配送订单统计'),
|
||||
ApiDoc\url('/store/workbench/deliveryOrder'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'),
|
||||
ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\Query(ref: [Definitions::class, "page"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('配送订单统计'),
|
||||
// ApiDoc\url('/store/workbench/deliveryOrder'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'),
|
||||
// ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\Query(ref: [Definitions::class, "page"]),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function deliveryOrder()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
@ -88,17 +89,17 @@ class WorkbenchController extends BaseAdminController
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('商品统计-概况'),
|
||||
ApiDoc\url('/store/workbench/get_basic'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'),
|
||||
ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('商品统计-概况'),
|
||||
// ApiDoc\url('/store/workbench/get_basic'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'),
|
||||
// ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function get_basic(\app\admin\controller\WorkbenchController $workbench)
|
||||
{
|
||||
$params = $this->request->get();
|
||||
@ -106,17 +107,17 @@ class WorkbenchController extends BaseAdminController
|
||||
return $workbench->get_basic();
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('商品统计-图表'),
|
||||
ApiDoc\url('/store/workbench/get_trend'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'),
|
||||
ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('商品统计-图表'),
|
||||
// ApiDoc\url('/store/workbench/get_trend'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'),
|
||||
// ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function get_trend(\app\admin\controller\WorkbenchController $workbench)
|
||||
{
|
||||
$params = $this->request->get();
|
||||
@ -124,17 +125,17 @@ class WorkbenchController extends BaseAdminController
|
||||
return $workbench->get_trend();
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('商品统计-排行'),
|
||||
ApiDoc\url('/store/workbench/get_product_ranking'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'),
|
||||
ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('商品统计-排行'),
|
||||
// ApiDoc\url('/store/workbench/get_product_ranking'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'),
|
||||
// ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function get_product_ranking(\app\admin\controller\WorkbenchController $workbench)
|
||||
{
|
||||
$params = $this->request->get();
|
||||
@ -142,4 +143,31 @@ class WorkbenchController extends BaseAdminController
|
||||
return $workbench->get_product_ranking();
|
||||
}
|
||||
|
||||
|
||||
// #[
|
||||
// ApiDoc\Title('收银台数据统计'),
|
||||
// ApiDoc\url('/store/workbench/business_statistics'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Query(),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function business_statistics()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['store_id'] = $this->request->adminInfo['store_id'];
|
||||
$result = WorkbenchLogic::revenueStatistics($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
public function recharge_statistics()
|
||||
{
|
||||
$params['store_id'] = DictType::where('type','store')->value('remark')??5;
|
||||
$result = WorkbenchLogic::rechargeData($params);
|
||||
return $this->data($result);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -19,38 +19,37 @@ use app\store\lists\auth\AdminLists;
|
||||
use app\store\validate\auth\AdminValidate;
|
||||
use app\store\logic\auth\AdminLogic;
|
||||
use app\store\validate\auth\editSelfValidate;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
|
||||
/**
|
||||
* 管理员控制器
|
||||
* Class AdminController
|
||||
* @package app\store\controller\auth
|
||||
*/
|
||||
#[ApiDoc\title('管理员信息')]
|
||||
// #[ApiDoc\title('管理员信息')]
|
||||
class AdminController extends BaseAdminController
|
||||
{
|
||||
|
||||
#[
|
||||
ApiDoc\Title("查看管理员列表"),
|
||||
ApiDoc\url('/store/auth/admin/lists'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title("查看管理员列表"),
|
||||
// ApiDoc\url('/store/auth/admin/lists'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new AdminLists());
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title("添加管理员"),
|
||||
ApiDoc\url('/store/auth/admin/add'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title("添加管理员"),
|
||||
// ApiDoc\url('/store/auth/admin/add'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function add()
|
||||
{
|
||||
$params = (new AdminValidate())->post()->goCheck('add');
|
||||
@ -61,14 +60,14 @@ class AdminController extends BaseAdminController
|
||||
return $this->fail(AdminLogic::getError());
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title("编辑管理员"),
|
||||
ApiDoc\url('/store/auth/admin/edit'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title("编辑管理员"),
|
||||
// ApiDoc\url('/store/auth/admin/edit'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function edit()
|
||||
{
|
||||
$params = (new AdminValidate())->post()->goCheck('edit');
|
||||
@ -79,14 +78,14 @@ class AdminController extends BaseAdminController
|
||||
return $this->fail(AdminLogic::getError());
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title("删除管理员"),
|
||||
ApiDoc\url('/store/auth/admin/delete'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title("删除管理员"),
|
||||
// ApiDoc\url('/store/auth/admin/delete'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function delete()
|
||||
{
|
||||
$params = (new AdminValidate())->post()->goCheck('delete');
|
||||
@ -97,14 +96,14 @@ class AdminController extends BaseAdminController
|
||||
return $this->fail(AdminLogic::getError());
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title("查看管理员详情"),
|
||||
ApiDoc\url('/store/auth/admin/detail'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title("查看管理员详情"),
|
||||
// ApiDoc\url('/store/auth/admin/detail'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function detail()
|
||||
{
|
||||
$params = (new AdminValidate())->goCheck('detail');
|
||||
@ -112,28 +111,28 @@ class AdminController extends BaseAdminController
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title("获取当前管理员信息"),
|
||||
ApiDoc\url('/store/auth/admin/mySelf'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title("获取当前管理员信息"),
|
||||
// ApiDoc\url('/store/auth/admin/mySelf'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function mySelf()
|
||||
{
|
||||
$result = AdminLogic::detail(['id' => $this->adminId], 'auth');
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title("编辑超级管理员信息"),
|
||||
ApiDoc\url('/store/auth/admin/editSelf'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title("编辑超级管理员信息"),
|
||||
// ApiDoc\url('/store/auth/admin/editSelf'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function editSelf()
|
||||
{
|
||||
$params = (new editSelfValidate())->post()->goCheck('', ['admin_id' => $this->adminId]);
|
||||
|
@ -19,7 +19,6 @@ use app\store\controller\BaseAdminController;
|
||||
use app\store\lists\auth\MenuLists;
|
||||
use app\store\logic\auth\MenuLogic;
|
||||
use app\store\validate\auth\MenuValidate;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
|
||||
|
||||
/**
|
||||
@ -27,7 +26,7 @@ use hg\apidoc\annotation as ApiDoc;
|
||||
* Class MenuController
|
||||
* @package app\store\controller\setting\system
|
||||
*/
|
||||
#[ApiDoc\NotParse()]
|
||||
|
||||
class MenuController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
@ -20,14 +20,12 @@ use app\store\{
|
||||
validate\auth\RoleValidate,
|
||||
controller\BaseAdminController
|
||||
};
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
|
||||
/**
|
||||
* 角色控制器
|
||||
* Class RoleController
|
||||
* @package app\store\controller\auth
|
||||
*/
|
||||
#[ApiDoc\NotParse()]
|
||||
|
||||
class RoleController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
@ -8,9 +8,8 @@ use app\common\model\store_branch_product\StoreBranchProduct;
|
||||
use app\store\lists\cart\CartList;
|
||||
use app\common\model\order\Cart;
|
||||
use app\store\controller\BaseAdminController;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
|
||||
#[ApiDoc\NotParse()]
|
||||
|
||||
class CartController extends BaseAdminController
|
||||
{
|
||||
public function list()
|
||||
@ -25,7 +24,7 @@ class CartController extends BaseAdminController
|
||||
{
|
||||
$params = (new CartValidate())->post()->goCheck('StoreAdd');
|
||||
$adminInfo = $this->adminInfo;
|
||||
$params['uid'] = 0;
|
||||
$params['uid'] = $this->request->post('uid')??0;
|
||||
$params['staff_id'] = $adminInfo['admin_id'];
|
||||
$params['store_id'] = $adminInfo['store_id'];
|
||||
$result = Cart::where(['uid' => 0,'staff_id'=>$adminInfo['admin_id'], 'store_id' => $adminInfo['store_id'], 'product_id' => $params['product_id'], 'is_fail' => 0, 'is_pay' => 0])->find();
|
||||
|
30
app/store/controller/cate/CateController.php
Normal file
30
app/store/controller/cate/CateController.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace app\store\controller\cate;
|
||||
|
||||
|
||||
use app\store\controller\BaseAdminController;
|
||||
use app\api\lists\cate\CateLists;
|
||||
|
||||
|
||||
/**
|
||||
* 商品分类控制器
|
||||
* Class CateController
|
||||
* @package app\admin\controller\goods
|
||||
*/
|
||||
class CateController extends BaseAdminController
|
||||
{
|
||||
public $notNeedLogin = ['lists'];
|
||||
/**
|
||||
* @notes 获取商品分类列表
|
||||
* @return
|
||||
* @author likeadmin
|
||||
* @date 2024/04/23 10:27
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new CateLists());
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -6,54 +6,53 @@ use app\admin\lists\store_finance_flow\StoreFinanceFlowLists;
|
||||
use app\common\controller\Definitions;
|
||||
use app\common\logic\StoreFinanceFlowLogic;
|
||||
use app\store\controller\BaseAdminController;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
|
||||
#[ApiDoc\title('财务')]
|
||||
// #[ApiDoc\title('财务')]
|
||||
class FinanceController extends BaseAdminController
|
||||
{
|
||||
|
||||
#[
|
||||
ApiDoc\Title('财务流水'),
|
||||
ApiDoc\url('/store/finance/finance/lists'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Query(name: 'keyword', type: 'string', require: false, desc: '订单编号'),
|
||||
ApiDoc\Query(name: 'staff_id', type: 'int', require: false, desc: '店员id'),
|
||||
ApiDoc\Query(name: 'start_time', type: 'string', require: false, desc: '开始时间'),
|
||||
ApiDoc\Query(name: 'end_time', type: 'string', require: false, desc: '结束时间'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\Query(ref: [Definitions::class, "page"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array", children: [
|
||||
['name' => 'id', 'desc' => 'ID', 'type' => 'int'],
|
||||
['name' => 'financial_record_sn', 'desc' => '流水号', 'type' => 'string'],
|
||||
['name' => 'order_sn', 'desc' => '订单号', 'type' => 'string'],
|
||||
['name' => 'number', 'desc' => '金额', 'type' => 'float'],
|
||||
['name' => 'create_time', 'desc' => '创建时间', 'type' => 'string'],
|
||||
['name' => 'nickname', 'desc' => '用户昵称', 'type' => 'string'],
|
||||
['name' => 'staff_name', 'desc' => '店员', 'type' => 'string'],
|
||||
['name' => 'store_name', 'desc' => '店铺名称', 'type' => 'string'],
|
||||
['name' => 'pay_type_name', 'desc' => '支付方式', 'type' => 'string'],
|
||||
['name' => 'financial_type_name', 'desc' => '流水类型', 'type' => 'string'],
|
||||
['name' => 'remark', 'desc' => '备注', 'type' => 'string'],
|
||||
]),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('财务流水'),
|
||||
// ApiDoc\url('/store/finance/finance/lists'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Query(name: 'keyword', type: 'string', require: false, desc: '订单编号'),
|
||||
// ApiDoc\Query(name: 'staff_id', type: 'int', require: false, desc: '店员id'),
|
||||
// ApiDoc\Query(name: 'start_time', type: 'string', require: false, desc: '开始时间'),
|
||||
// ApiDoc\Query(name: 'end_time', type: 'string', require: false, desc: '结束时间'),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\Query(ref: [Definitions::class, "page"]),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array", children: [
|
||||
// ['name' => 'id', 'desc' => 'ID', 'type' => 'int'],
|
||||
// ['name' => 'financial_record_sn', 'desc' => '流水号', 'type' => 'string'],
|
||||
// ['name' => 'order_sn', 'desc' => '订单号', 'type' => 'string'],
|
||||
// ['name' => 'number', 'desc' => '金额', 'type' => 'float'],
|
||||
// ['name' => 'create_time', 'desc' => '创建时间', 'type' => 'string'],
|
||||
// ['name' => 'nickname', 'desc' => '用户昵称', 'type' => 'string'],
|
||||
// ['name' => 'staff_name', 'desc' => '店员', 'type' => 'string'],
|
||||
// ['name' => 'store_name', 'desc' => '店铺名称', 'type' => 'string'],
|
||||
// ['name' => 'pay_type_name', 'desc' => '支付方式', 'type' => 'string'],
|
||||
// ['name' => 'financial_type_name', 'desc' => '流水类型', 'type' => 'string'],
|
||||
// ['name' => 'remark', 'desc' => '备注', 'type' => 'string'],
|
||||
// ]),
|
||||
// ]
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new StoreFinanceFlowLists());
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('备注'),
|
||||
ApiDoc\url('/store/finance/finance/remark'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'),
|
||||
ApiDoc\Param(name: 'remark', type: 'string', require: true, desc: '备注'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('备注'),
|
||||
// ApiDoc\url('/store/finance/finance/remark'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'),
|
||||
// ApiDoc\Param(name: 'remark', type: 'string', require: true, desc: '备注'),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function remark(StoreFinanceFlowLogic $logic)
|
||||
{
|
||||
$id = $this->request->post('id');
|
||||
|
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace app\store\controller\finance;
|
||||
|
||||
|
||||
use app\store\lists\financial_transfers\FinancialTransfersLists;
|
||||
use app\admin\logic\financial_transfers\FinancialTransfersLogic;
|
||||
use app\admin\validate\financial_transfers\FinancialTransfersValidate;
|
||||
use app\common\controller\Definitions;
|
||||
use app\store\controller\BaseAdminController;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
|
||||
#[ApiDoc\title('提现列表')]
|
||||
class FinancialTransfersController extends BaseAdminController
|
||||
{
|
||||
#[
|
||||
ApiDoc\Title('财务流水'),
|
||||
ApiDoc\url('/store/finance/financialTransfers/lists'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Query(name: 'status', type: 'int', require: true, desc: '状态1'),
|
||||
ApiDoc\Query(name: 'store_id', type: 'int', require: true, desc: '店员id'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\Query(ref: [Definitions::class, "page"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new FinancialTransfersLists());
|
||||
}
|
||||
|
||||
|
||||
#[
|
||||
ApiDoc\Title('店铺确认'),
|
||||
ApiDoc\url('/store/finance/financialTransfers/confirmation'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Query(name: 'status', type: 'int', require: true, desc: '状态1确认 0不确认'),
|
||||
ApiDoc\Query(name: 'id', type: 'int', require: true, desc: '数据id'),
|
||||
ApiDoc\Query(name: 'mark', type: 'string', require: false, desc: '原因/备注'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\Query(ref: [Definitions::class, "page"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
public function confirmation()
|
||||
{
|
||||
$params = (new FinancialTransfersValidate())->post()->goCheck('confirm');
|
||||
|
||||
$staff_id = $this->request->adminInfo['admin_id']??5;
|
||||
$data = [
|
||||
'store_staff_id' => $staff_id,
|
||||
'mark' => $params['mark']??'',
|
||||
];
|
||||
$status = -2;
|
||||
if ($params['status']) {
|
||||
$status = 2;
|
||||
$data['confirmation_time'] = time();
|
||||
}
|
||||
$data['status'] = $status;
|
||||
$result = FinancialTransfersLogic::dealchange($data,$params['id']);
|
||||
|
||||
if (true === $result) {
|
||||
return $this->success('操作成功',[],1,1 );
|
||||
}
|
||||
return $this->fail(FinancialTransfersLogic::getError());
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -2,50 +2,60 @@
|
||||
|
||||
namespace app\store\controller\finance;
|
||||
|
||||
use app\admin\lists\store_finance_flow\StoreFinanceFlowDayLists;
|
||||
use app\admin\lists\store_finance_flow\StoreFinanceFlowLists;
|
||||
use app\admin\lists\store_finance_flow\StoreFinanceFlowMonthLists;
|
||||
use app\admin\lists\store_finance_flow\StoreFinanceFlowWeekLists;
|
||||
use app\common\controller\Definitions;
|
||||
use app\common\lists\StoreBillLists;
|
||||
use app\store\controller\BaseAdminController;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
|
||||
#[ApiDoc\title('账单记录')]
|
||||
// #[ApiDoc\title('账单记录')]
|
||||
class StoreBillController extends BaseAdminController
|
||||
{
|
||||
|
||||
#[
|
||||
ApiDoc\Title('列表'),
|
||||
ApiDoc\url('/store/finance/storeBill/lists'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Query(name: 'type', type: 'int', require: false, desc: '类型:1日账单,2周账单,3月账单'),
|
||||
ApiDoc\Query(name: 'start_time', type: 'string', require: false, desc: '开始时间'),
|
||||
ApiDoc\Query(name: 'end_time', type: 'string', require: false, desc: '结束时间'),
|
||||
ApiDoc\Query(name: 'export', type: 'int', require: false, desc: '是否导出:2是'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\Query(ref: [Definitions::class, "page"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('列表'),
|
||||
// ApiDoc\url('/store/finance/storeBill/lists'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Query(name: 'type', type: 'int', require: false, desc: '类型:1日账单,2周账单,3月账单'),
|
||||
// ApiDoc\Query(name: 'start_time', type: 'string', require: false, desc: '开始时间'),
|
||||
// ApiDoc\Query(name: 'end_time', type: 'string', require: false, desc: '结束时间'),
|
||||
// ApiDoc\Query(name: 'export', type: 'int', require: false, desc: '是否导出:2是'),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\Query(ref: [Definitions::class, "page"]),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new StoreBillLists());
|
||||
$type = $this->request->get('type');
|
||||
if($type == 1){
|
||||
return $this->dataLists(new StoreFinanceFlowDayLists());
|
||||
}else if($type == 2){
|
||||
return $this->dataLists(new StoreFinanceFlowWeekLists());
|
||||
}else{
|
||||
return $this->dataLists(new StoreFinanceFlowMonthLists());
|
||||
}
|
||||
// return $this->dataLists(new StoreBillLists());
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('详情'),
|
||||
ApiDoc\url('/store/finance/storeBill/detail'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'),
|
||||
ApiDoc\Query(name: 'date_type', type: 'int', require: false, desc: '日期类型:1日账单,2周账单,3月账单'),
|
||||
ApiDoc\Query(name: 'date', type: 'string', require: false, desc: '日期,日账单:2021-01-01,周账单:2024-W23,月账单:2021-01'),
|
||||
ApiDoc\Query(name: 'staff_id', type: 'int', require: false, desc: '店员id'),
|
||||
ApiDoc\Query(name: 'keyword', type: 'string', require: false, desc: '流水号/用户昵称'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\Query(ref: [Definitions::class, "page"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('详情'),
|
||||
// ApiDoc\url('/store/finance/storeBill/detail'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'),
|
||||
// ApiDoc\Query(name: 'date_type', type: 'int', require: false, desc: '日期类型:1日账单,2周账单,3月账单'),
|
||||
// ApiDoc\Query(name: 'date', type: 'string', require: false, desc: '日期,日账单:2021-01-01,周账单:2024-W23,月账单:2021-01'),
|
||||
// ApiDoc\Query(name: 'staff_id', type: 'int', require: false, desc: '店员id'),
|
||||
// ApiDoc\Query(name: 'keyword', type: 'string', require: false, desc: '流水号/用户昵称'),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\Query(ref: [Definitions::class, "page"]),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function detail()
|
||||
{
|
||||
return $this->dataLists(new StoreFinanceFlowLists());
|
||||
|
@ -2,8 +2,11 @@
|
||||
|
||||
namespace app\store\controller\store_order;
|
||||
|
||||
use app\admin\logic\user\UserLogic;
|
||||
use app\api\logic\order\OrderLogic;
|
||||
use app\api\validate\OrderValidate;
|
||||
use app\common\model\order\Cart;
|
||||
use app\common\model\user\User;
|
||||
use app\store\lists\store_order\StoreOrderLists;
|
||||
use app\common\controller\Definitions;
|
||||
use app\common\enum\PayEnum;
|
||||
@ -12,9 +15,14 @@ use app\common\logic\PayNotifyLogic;
|
||||
use app\common\logic\SystemStoreStaffLogic;
|
||||
use app\store\controller\BaseAdminController;
|
||||
use app\common\logic\store_order\StoreOrderLogic;
|
||||
use app\common\model\store_branch_product\StoreBranchProduct;
|
||||
use app\common\model\store_order\StoreOrder;
|
||||
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
||||
use app\common\model\store_product_unit\StoreProductUnit;
|
||||
use app\common\model\system_store\SystemStore;
|
||||
use app\common\model\system_store\SystemStoreStaff;
|
||||
use app\common\model\user_recharge\UserRecharge;
|
||||
use app\store\validate\store_order\StoreOrderValidate;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
use support\Log;
|
||||
use Webman\RedisQueue\Redis;
|
||||
|
||||
@ -23,59 +31,25 @@ use Webman\RedisQueue\Redis;
|
||||
* Class StoreOrderController
|
||||
* @package app\store\controller\store_order
|
||||
*/
|
||||
#[ApiDoc\title('订单')]
|
||||
// #[ApiDoc\title('订单')]
|
||||
class StoreOrderController extends BaseAdminController
|
||||
{
|
||||
|
||||
#[
|
||||
ApiDoc\Title('订单列表'),
|
||||
ApiDoc\url('/store/store_order/storeOrder/lists'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Query(name: 'order_id', type: 'string', require: false, desc: '订单编号'),
|
||||
ApiDoc\Query(name: 'staff_id', type: 'int', require: false, desc: '店员id'),
|
||||
ApiDoc\Query(name: 'delivery_phone', type: 'int', require: false, desc: '配送员手机号'),
|
||||
ApiDoc\Query(name: 'shipping_type', type: 'int', require: false, desc: '订单配送方式:1配送订单,2核销订单,3收银台订单'),
|
||||
ApiDoc\Query(name: 'start_time', type: 'string', require: false, desc: '开始时间'),
|
||||
ApiDoc\Query(name: 'end_time', type: 'string', require: false, desc: '结束时间'),
|
||||
ApiDoc\Query(name: 'status', type: 'int', require: false, desc: '状态:-1待支付,0待发货,1待收货,2已完成'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\Query(ref: [Definitions::class, "page"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array", children: [
|
||||
['name' => 'id', 'desc' => 'ID', 'type' => 'int'],
|
||||
['name' => 'order_id', 'desc' => '订单编号', 'type' => 'string'],
|
||||
['name' => 'pay_price', 'desc' => '支付金额', 'type' => 'string'],
|
||||
['name' => 'pay_time', 'desc' => '支付时间', 'type' => 'float'],
|
||||
['name' => 'pay_type', 'desc' => '支付方式', 'type' => 'float'],
|
||||
['name' => 'status_name', 'desc' => '状态', 'type' => 'int'],
|
||||
['name' => 'staff_name', 'desc' => '店员', 'type' => 'int'],
|
||||
['name' => 'nickname', 'desc' => '用户昵称', 'type' => 'string'],
|
||||
['name' => 'avatar', 'desc' => '用户头像', 'type' => 'string'],
|
||||
['name' => 'product', 'desc' => '商品信息', 'type' => 'array', 'children' => [
|
||||
['name' => 'cart_info', 'desc' => '商品信息', 'type' => 'array', 'children' => [
|
||||
['name' => 'name', 'desc' => '商品名称', 'type' => 'int'],
|
||||
['name' => 'image', 'desc' => '图片', 'type' => 'string'],
|
||||
['name' => 'cart_num', 'desc' => '购买数量', 'type' => 'string'],
|
||||
['name' => 'price', 'desc' => '单价', 'type' => 'string'],
|
||||
]],
|
||||
]],
|
||||
]),
|
||||
]
|
||||
/**订单列表 */
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new StoreOrderLists());
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('订单统计'),
|
||||
ApiDoc\url('/store/store_order/storeOrder/title'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('订单统计'),
|
||||
// ApiDoc\url('/store/store_order/storeOrder/title'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function title(SystemStoreStaffLogic $staffLogic, StoreOrderLogic $orderLogic)
|
||||
{
|
||||
return $this->data([
|
||||
@ -90,17 +64,9 @@ class StoreOrderController extends BaseAdminController
|
||||
]);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('订单详情'),
|
||||
ApiDoc\url('/store/store_order/storeOrder/detail'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\Query(name: 'id', type: 'int', require: false, desc: '订单id'),
|
||||
ApiDoc\Query(name: 'verify_code', type: 'string', require: false, desc: '核销码'),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
/**
|
||||
* 订单详情
|
||||
*/
|
||||
public function detail(StoreOrderLogic $orderLogic)
|
||||
{
|
||||
$params = (new StoreOrderValidate())->goCheck('detail');
|
||||
@ -108,12 +74,16 @@ class StoreOrderController extends BaseAdminController
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单检查
|
||||
*/
|
||||
public function checkOrder()
|
||||
{
|
||||
$cartId = (array)$this->request->post('cart_id', []);
|
||||
$params = $this->request->post();
|
||||
$params['store_id']=$this->adminInfo['store_id'];
|
||||
$res = StoreOrderLogic::cartIdByOrderInfo($cartId, null, null, $params);
|
||||
$params['store_id'] = $this->adminInfo['store_id'];
|
||||
$user=User::where('id',$params['uid'])->find();
|
||||
$res = StoreOrderLogic::cartIdByOrderInfo($cartId, null, $user, $params);
|
||||
if ($res == false) {
|
||||
$msg = StoreOrderLogic::getError();
|
||||
if ($msg == '购物车为空') {
|
||||
@ -124,28 +94,68 @@ class StoreOrderController extends BaseAdminController
|
||||
return $this->data($res);
|
||||
}
|
||||
|
||||
|
||||
public function checkSms()
|
||||
{
|
||||
$params = (new StoreOrderValidate())->post()->goCheck('check');
|
||||
$params['store_id'] = $this->request->adminInfo['store_id']; //当前登录的店铺id,用于判断是否是当前店铺的订单
|
||||
$user = User::where('id', $params['uid'])->find();
|
||||
if (empty($user)) {
|
||||
return $this->fail('无该用户请检查');
|
||||
}
|
||||
$order = StoreOrderLogic::cartIdByOrderInfo($params['cart_id'], null, $user, $params);
|
||||
if (!$order) {
|
||||
return $this->fail(StoreOrderLogic::getError());
|
||||
}
|
||||
if ($order['order']['pay_price'] > $user['purchase_funds']) {
|
||||
return $this->fail('当前用户采购款不足支付');
|
||||
}
|
||||
$res = (new StoreOrderLogic())->dealSendSms($params);
|
||||
if ($res) {
|
||||
return $this->success('发送成功', [], 1, 0);
|
||||
} else {
|
||||
return $this->fail('发送失败');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建订单
|
||||
*/
|
||||
public function createOrder()
|
||||
{
|
||||
$cartId = (array)$this->request->post('cart_id', []);
|
||||
$pay_type = (int)$this->request->post('pay_type');
|
||||
$addressId = (int)$this->request->post('address_id');
|
||||
$auth_code = $this->request->post('auth_code'); //微信支付条码
|
||||
$uid=$this->request->post('uid');
|
||||
$params = $this->request->post();
|
||||
if ($auth_code == '' && $pay_type != PayEnum::CASH_PAY) {
|
||||
if ($auth_code == '' && $pay_type != PayEnum::CASH_PAY && $pay_type != PayEnum::PURCHASE_FUNDS) {
|
||||
return $this->fail('支付条码不能为空');
|
||||
}
|
||||
if (count($cartId) > 100) {
|
||||
return $this->fail('购物车商品不能超过100个');
|
||||
}
|
||||
$user = null;
|
||||
if ($uid) {
|
||||
$user = User::where('id', $uid)->find();
|
||||
}
|
||||
$params['store_id'] = $this->request->adminInfo['store_id']; //当前登录的店铺id,用于判断是否是当前店铺的订单
|
||||
$order = StoreOrderLogic::createOrder($cartId, $addressId, null, $params);
|
||||
$order = StoreOrderLogic::createOrder($cartId, $addressId, $user, $params);
|
||||
if ($order != false) {
|
||||
switch ($pay_type) {
|
||||
case PayEnum::PURCHASE_FUNDS:
|
||||
//采购款支付
|
||||
PayNotifyLogic::handle('purchase_funds', $order['order_id'], [
|
||||
'uid' => $uid,'store_id'=>$this->request->adminInfo['store_id'],
|
||||
'staff_id'=>$this->request->adminInfo['admin_id']
|
||||
]);
|
||||
return $this->success('采购款支付成功', ['id' => $order['id']]);
|
||||
|
||||
case PayEnum::CASH_PAY:
|
||||
//现金支付
|
||||
PayNotifyLogic::handle('cash_pay', $order['order_id']);
|
||||
return $this->success('现金支付成功');
|
||||
return $this->success('现金支付成功', ['id' => $order['id']]);
|
||||
|
||||
case PayEnum::WECHAT_PAY_BARCODE:
|
||||
//微信条码支付
|
||||
@ -160,7 +170,7 @@ class StoreOrderController extends BaseAdminController
|
||||
Redis::send('send-code-pay', ['order_id' => $order['order_id']]);
|
||||
return $this->success('用户支付中');
|
||||
}
|
||||
return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::WECHAT_PAY_BARCODE, 'transaction_id' => $result['transaction_id']]);
|
||||
return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::WECHAT_PAY_BARCODE, 'transaction_id' => $result['transaction_id'], 'id' => $order['id']]);
|
||||
case PayEnum::ALIPAY_BARCODE:
|
||||
//支付宝条码支付
|
||||
$result = PaymentLogic::ali_auth_code($auth_code, $order);
|
||||
@ -172,7 +182,7 @@ class StoreOrderController extends BaseAdminController
|
||||
}
|
||||
PayNotifyLogic::handle('alipay_cashier', $result['out_trade_no'], $result);
|
||||
$result['create_time'] = $order['create_time'];
|
||||
return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::ALIPAY_BARCODE, 'transaction_id' => $result['trade_no']]);
|
||||
return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::ALIPAY_BARCODE, 'transaction_id' => $result['trade_no'], 'id' => $order['id']]);
|
||||
default:
|
||||
return $this->fail('支付方式错误');
|
||||
}
|
||||
@ -181,6 +191,9 @@ class StoreOrderController extends BaseAdminController
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新支付
|
||||
*/
|
||||
public function pay()
|
||||
{
|
||||
$order_id = $this->request->post('order_id');
|
||||
@ -198,13 +211,15 @@ class StoreOrderController extends BaseAdminController
|
||||
if (!$order) {
|
||||
return $this->fail('订单不存在或已支付');
|
||||
}
|
||||
|
||||
switch ($pay_type) {
|
||||
|
||||
case PayEnum::PURCHASE_FUNDS:
|
||||
//采购款支付
|
||||
PayNotifyLogic::handle('purchase_funds', $order['order_id'], ['uid' => $order['uid']]);
|
||||
return $this->success('采购款支付成功', ['id' => $order['id']]);
|
||||
case PayEnum::CASH_PAY:
|
||||
//现金支付
|
||||
PayNotifyLogic::handle('cash_pay', $order['order_id']);
|
||||
return $this->success('现金支付成功');
|
||||
return $this->success('现金支付成功', ['id' => $order['id']]);
|
||||
break;
|
||||
case PayEnum::WECHAT_PAY_BARCODE:
|
||||
//微信条码支付
|
||||
@ -218,7 +233,7 @@ class StoreOrderController extends BaseAdminController
|
||||
Redis::send('send-code-pay', ['order_id' => $order['order_id']]);
|
||||
return $this->success('用户支付中');
|
||||
}
|
||||
return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::WECHAT_PAY_BARCODE, 'transaction_id' => $result['transaction_id']]);
|
||||
return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::WECHAT_PAY_BARCODE, 'transaction_id' => $result['transaction_id'], 'id' => $order['id']]);
|
||||
case PayEnum::ALIPAY_BARCODE:
|
||||
//支付宝条码支付
|
||||
$result = PaymentLogic::ali_auth_code($auth_code, $order);
|
||||
@ -231,13 +246,16 @@ class StoreOrderController extends BaseAdminController
|
||||
PayNotifyLogic::handle('alipay_cashier', $result['out_trade_no'], $result);
|
||||
|
||||
$result['create_time'] = $order['create_time'];
|
||||
return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::ALIPAY_BARCODE, 'transaction_id' => $result['trade_no']]);
|
||||
return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::ALIPAY_BARCODE, 'transaction_id' => $result['trade_no'], 'id' => $order['id']]);
|
||||
default:
|
||||
return $this->fail('支付方式错误');
|
||||
}
|
||||
return $this->fail('支付失败');
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单核销
|
||||
*/
|
||||
public function writeoff_order()
|
||||
{
|
||||
$params = (new OrderValidate())->post()->goCheck('check');
|
||||
@ -245,6 +263,8 @@ class StoreOrderController extends BaseAdminController
|
||||
if (empty($count)) {
|
||||
return $this->fail('无该核销码请检查');
|
||||
}
|
||||
$params['store_id'] = $this->adminInfo['store_id'];
|
||||
$params['staff_id'] = $this->adminId;
|
||||
$res = OrderLogic::writeOff($params);
|
||||
if ($res) {
|
||||
return $this->success('核销成功');
|
||||
@ -253,17 +273,17 @@ class StoreOrderController extends BaseAdminController
|
||||
}
|
||||
|
||||
|
||||
#[
|
||||
ApiDoc\Title('订单已核销列表'),
|
||||
ApiDoc\url('/store/store_order/storeOrder/writeoff_list'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\Query(name: 'page_no', type: 'int', require: false, desc: '页数 默认1'),
|
||||
ApiDoc\Query(name: 'page_size', type: 'int', require: false, desc: '每页条数 默认15'),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('订单已核销列表'),
|
||||
// ApiDoc\url('/store/store_order/storeOrder/writeoff_list'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\Query(name: 'page_no', type: 'int', require: false, desc: '页数 默认1'),
|
||||
// ApiDoc\Query(name: 'page_size', type: 'int', require: false, desc: '每页条数 默认15'),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function writeoff_list(StoreOrderLogic $orderLogic)
|
||||
{
|
||||
$page_no = (int)$this->request->post('page_no', 1);
|
||||
@ -275,18 +295,109 @@ class StoreOrderController extends BaseAdminController
|
||||
$params['page_no'] = 1;
|
||||
$params['page_size'] = 15;
|
||||
}
|
||||
$params['store_id'] =$this->request->adminInfo['store_id'];
|
||||
$params['store_id'] = $this->request->adminInfo['store_id'];
|
||||
$result = $orderLogic->writeList($params);
|
||||
|
||||
$data = [
|
||||
'lists' => $result,
|
||||
'count' => count($result),
|
||||
'page_no' => $params['page_no'],
|
||||
'page_size' =>$params['page_size'],
|
||||
'page_size' => $params['page_size'],
|
||||
];
|
||||
return $this->success('ok',$data);
|
||||
|
||||
return $this->success('ok', $data);
|
||||
}
|
||||
/**
|
||||
* vip充值
|
||||
*/
|
||||
public function rechange_amount()
|
||||
{
|
||||
$pay_type = $this->request->post('pay_type');
|
||||
$auth_code = $this->request->post('auth_code'); //微信支付条码
|
||||
if ($auth_code == '' && $pay_type != PayEnum::CASH_PAY) {
|
||||
return $this->fail('支付条码不能为空');
|
||||
}
|
||||
$params = $this->request->post();
|
||||
$data = [
|
||||
'store_id' => $this->adminInfo['store_id'],
|
||||
'uid' => $params['uid'],
|
||||
'staff_id' => $this->adminId,
|
||||
'order_id' => getNewOrderId('CZ'),
|
||||
'price' => $params['price'],
|
||||
'recharge_type' => 'INDUSTRYMEMBERS',
|
||||
];
|
||||
$order = UserRecharge::create($data);
|
||||
$order['pay_price'] = $order['price'];
|
||||
switch ($pay_type) {
|
||||
case PayEnum::WECHAT_PAY_BARCODE:
|
||||
//微信条码支付
|
||||
$result = PaymentLogic::codepay($auth_code, $order);
|
||||
if (PaymentLogic::hasError()) {
|
||||
return $this->fail(PaymentLogic::getError(), $params);
|
||||
}
|
||||
if (isset($result['trade_state_desc']) && $result['trade_state_desc'] == '支付成功') {
|
||||
PayNotifyLogic::handle('recharge', $result['out_trade_no'], $result);
|
||||
} else {
|
||||
Redis::send('send-code-pay', ['order_id' => $order['order_id'], 'pay_type' => 'recharge']);
|
||||
return $this->success('用户支付中');
|
||||
}
|
||||
return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::WECHAT_PAY_BARCODE, 'transaction_id' => $result['transaction_id']]);
|
||||
case PayEnum::ALIPAY_BARCODE:
|
||||
//支付宝条码支付
|
||||
$result = PaymentLogic::ali_auth_code($auth_code, $order);
|
||||
if (PaymentLogic::hasError()) {
|
||||
return $this->fail(PaymentLogic::getError(), $params);
|
||||
}
|
||||
if ($result['msg'] !== 'Success') {
|
||||
return $this->success('用户支付中');
|
||||
}
|
||||
PayNotifyLogic::handle('recharge', $result['out_trade_no'], $result, 'ali');
|
||||
|
||||
$result['create_time'] = $order['create_time'];
|
||||
return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::ALIPAY_BARCODE, 'transaction_id' => $result['trade_no']]);
|
||||
default:
|
||||
return $this->fail('支付方式错误');
|
||||
}
|
||||
return $this->fail('支付失败');
|
||||
}
|
||||
|
||||
public function stocking()
|
||||
{
|
||||
$uid = $this->request->post('uid');
|
||||
$res = (new StoreOrderLogic())->dealSendSms(['uid' => $uid], 1);
|
||||
if ($res) {
|
||||
return $this->success('发送成功', [], 0, 1);
|
||||
} else {
|
||||
return $this->fail('发送失败');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单打印
|
||||
*/
|
||||
public function print()
|
||||
{
|
||||
$id = $this->request->get('id');
|
||||
$find = StoreOrder::where('id', $id)->find();
|
||||
if ($find) {
|
||||
$merchant = SystemStore::where('id', $find['store_id'])->field('name,phone')->find();
|
||||
$mer_user_info = SystemStoreStaff::where('store_id', $find['store_id'])->where('is_admin', 1)->field('staff_name,phone')->find();
|
||||
$user = User::where('id', $find['uid'])->field('nickname,mobile')->find();
|
||||
$find['system_store_name'] = $merchant['name'];
|
||||
$find['pay_type_name'] = PayEnum::getPaySceneDesc($find['pay_type']);
|
||||
$find['system_store_phone'] = $merchant['phone'];
|
||||
$find['staff_name'] = $mer_user_info['staff_name'];
|
||||
$find['staff_phone'] = $mer_user_info['phone'];
|
||||
$find['nickname'] = $user['nickname'] ?? '';
|
||||
$find['user_mobile'] = $user['mobile'] ?? '';
|
||||
$find['info'] = StoreOrderCartInfo::where('oid', $find['id'])->field('store_id,product_id,cart_num,cart_info')->select()->each(function ($item) {
|
||||
$goods = StoreBranchProduct::where(['store_id' => $item['store_id'], 'product_id' => $item['product_id']])->field('store_name,unit')->find();
|
||||
$item['unit_name'] = StoreProductUnit::where('id', $goods['unit'])->value('name');
|
||||
$item['store_name'] = $goods['store_name'];
|
||||
$item['total_price'] = $item['cart_info']['total_price'];
|
||||
$item['price'] = $item['cart_info']['price'];
|
||||
return $item;
|
||||
});
|
||||
}
|
||||
return $this->success('获取成功', $find?->toArray());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -7,66 +7,65 @@ use app\common\lists\order\StoreRefundOrderLists;
|
||||
use app\store\controller\BaseAdminController;
|
||||
use app\common\logic\store_order\StoreOrderLogic;
|
||||
use app\store\validate\store_order\StoreOrderValidate;
|
||||
use hg\apidoc\annotation as ApiDoc;
|
||||
|
||||
/**
|
||||
* 订单列表控制器
|
||||
* Class StoreOrderController
|
||||
* @package app\store\controller\store_order
|
||||
*/
|
||||
#[ApiDoc\title('退款订单')]
|
||||
// #[ApiDoc\title('退款订单')]
|
||||
class StoreRefundOrderController extends BaseAdminController
|
||||
{
|
||||
|
||||
#[
|
||||
ApiDoc\Title('订单列表'),
|
||||
ApiDoc\url('/store/store_order/storeRefundOrder/lists'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Query(name: 'order_id', type: 'string', require: false, desc: '订单编号'),
|
||||
ApiDoc\Query(name: 'start_time', type: 'string', require: false, desc: '开始时间', mock: "@datetime('yyyy-MM-dd')"),
|
||||
ApiDoc\Query(name: 'end_time', type: 'string', require: false, desc: '结束时间', mock: "@datetime('yyyy-MM-dd')"),
|
||||
ApiDoc\Query(name: 'refund_type', type: 'int', require: false, desc: '状态:1仅退款,2退款退货,3拒绝退款,4商品待退货,5退货待收货,6已退款', mock: "@integer(1, 6)"),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\Query(ref: [Definitions::class, "page"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array", children: [
|
||||
['name' => 'id', 'desc' => 'ID', 'type' => 'int'],
|
||||
['name' => 'order_id', 'desc' => '订单编号', 'type' => 'string'],
|
||||
['name' => 'pay_price', 'desc' => '支付金额', 'type' => 'string'],
|
||||
['name' => 'pay_time', 'desc' => '支付时间', 'type' => 'float'],
|
||||
['name' => 'pay_type', 'desc' => '支付方式', 'type' => 'float'],
|
||||
['name' => 'status_name', 'desc' => '状态', 'type' => 'int'],
|
||||
['name' => 'refund_status_name', 'desc' => '退款状态', 'type' => 'string'],
|
||||
['name' => 'refund_type_name', 'desc' => '退款类型', 'type' => 'string'],
|
||||
['name' => 'refund_reason_time', 'desc' => '退款时间', 'type' => 'int'],
|
||||
['name' => 'staff_name', 'desc' => '店员', 'type' => 'int'],
|
||||
['name' => 'nickname', 'desc' => '用户昵称', 'type' => 'string'],
|
||||
['name' => 'avatar', 'desc' => '用户头像', 'type' => 'string'],
|
||||
['name' => 'product', 'desc' => '商品信息', 'type' => 'array', 'children' => [
|
||||
['name' => 'cart_info', 'desc' => '商品信息', 'type' => 'array', 'children' => [
|
||||
['name' => 'name', 'desc' => '商品名称', 'type' => 'int'],
|
||||
['name' => 'image', 'desc' => '图片', 'type' => 'string'],
|
||||
['name' => 'cart_num', 'desc' => '购买数量', 'type' => 'string'],
|
||||
['name' => 'price', 'desc' => '单价', 'type' => 'string'],
|
||||
]],
|
||||
]],
|
||||
]),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('订单列表'),
|
||||
// ApiDoc\url('/store/store_order/storeRefundOrder/lists'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Query(name: 'order_id', type: 'string', require: false, desc: '订单编号'),
|
||||
// ApiDoc\Query(name: 'start_time', type: 'string', require: false, desc: '开始时间', mock: "@datetime('yyyy-MM-dd')"),
|
||||
// ApiDoc\Query(name: 'end_time', type: 'string', require: false, desc: '结束时间', mock: "@datetime('yyyy-MM-dd')"),
|
||||
// ApiDoc\Query(name: 'refund_type', type: 'int', require: false, desc: '状态:1仅退款,2退款退货,3拒绝退款,4商品待退货,5退货待收货,6已退款', mock: "@integer(1, 6)"),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\Query(ref: [Definitions::class, "page"]),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array", children: [
|
||||
// ['name' => 'id', 'desc' => 'ID', 'type' => 'int'],
|
||||
// ['name' => 'order_id', 'desc' => '订单编号', 'type' => 'string'],
|
||||
// ['name' => 'pay_price', 'desc' => '支付金额', 'type' => 'string'],
|
||||
// ['name' => 'pay_time', 'desc' => '支付时间', 'type' => 'float'],
|
||||
// ['name' => 'pay_type', 'desc' => '支付方式', 'type' => 'float'],
|
||||
// ['name' => 'status_name', 'desc' => '状态', 'type' => 'int'],
|
||||
// ['name' => 'refund_status_name', 'desc' => '退款状态', 'type' => 'string'],
|
||||
// ['name' => 'refund_type_name', 'desc' => '退款类型', 'type' => 'string'],
|
||||
// ['name' => 'refund_reason_time', 'desc' => '退款时间', 'type' => 'int'],
|
||||
// ['name' => 'staff_name', 'desc' => '店员', 'type' => 'int'],
|
||||
// ['name' => 'nickname', 'desc' => '用户昵称', 'type' => 'string'],
|
||||
// ['name' => 'avatar', 'desc' => '用户头像', 'type' => 'string'],
|
||||
// ['name' => 'product', 'desc' => '商品信息', 'type' => 'array', 'children' => [
|
||||
// ['name' => 'cart_info', 'desc' => '商品信息', 'type' => 'array', 'children' => [
|
||||
// ['name' => 'name', 'desc' => '商品名称', 'type' => 'int'],
|
||||
// ['name' => 'image', 'desc' => '图片', 'type' => 'string'],
|
||||
// ['name' => 'cart_num', 'desc' => '购买数量', 'type' => 'string'],
|
||||
// ['name' => 'price', 'desc' => '单价', 'type' => 'string'],
|
||||
// ]],
|
||||
// ]],
|
||||
// ]),
|
||||
// ]
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new StoreRefundOrderLists());
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('编辑订单'),
|
||||
ApiDoc\url('/store/store_order/storeRefundOrder/edit'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('编辑订单'),
|
||||
// ApiDoc\url('/store/store_order/storeRefundOrder/edit'),
|
||||
// ApiDoc\Method('POST'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function edit()
|
||||
{
|
||||
$params = (new StoreOrderValidate())->post()->goCheck('edit');
|
||||
@ -77,16 +76,16 @@ class StoreRefundOrderController extends BaseAdminController
|
||||
return $this->fail(StoreOrderLogic::getError());
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('订单详情'),
|
||||
ApiDoc\url('/store/store_order/storeRefundOrder/detail'),
|
||||
ApiDoc\Method('GET'),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Author('中国队长'),
|
||||
ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
ApiDoc\Query(name: 'id', type: 'int', require: true, desc: '订单id'),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
// #[
|
||||
// ApiDoc\Title('订单详情'),
|
||||
// ApiDoc\url('/store/store_order/storeRefundOrder/detail'),
|
||||
// ApiDoc\Method('GET'),
|
||||
// ApiDoc\NotHeaders(),
|
||||
// ApiDoc\Author('中国队长'),
|
||||
// ApiDoc\Header(ref: [Definitions::class, "token"]),
|
||||
// ApiDoc\Query(name: 'id', type: 'int', require: true, desc: '订单id'),
|
||||
// ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
// ]
|
||||
public function detail(StoreOrderLogic $orderLogic)
|
||||
{
|
||||
$params = (new StoreOrderValidate())->goCheck('detail');
|
||||
|
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