初始上传
This commit is contained in:
92
addon/store/storeapi/controller/Account.php
Executable file
92
addon/store/storeapi/controller/Account.php
Executable file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\store\storeapi\controller;
|
||||
|
||||
use addon\store\model\StoreAccount;
|
||||
use app\storeapi\controller\BaseStoreApi;
|
||||
|
||||
/**
|
||||
* 门店账户
|
||||
*/
|
||||
class Account extends BaseStoreApi
|
||||
{
|
||||
/**
|
||||
* 账户列表
|
||||
*/
|
||||
public function pages()
|
||||
{
|
||||
$page = $this->params['page'] ?? 1;
|
||||
$page_size = $this->params['page_size'] ?? PAGE_LIST_ROWS;
|
||||
$remark = $this->params['remark'] ?? '';
|
||||
$start_date = $this->params['start_date'] ?? '';
|
||||
$end_date = $this->params['end_date'] ?? '';
|
||||
$from_type = $this->params['from_type'] ?? '';
|
||||
$store_id = $this->store_id;
|
||||
|
||||
$alias = 'sa';
|
||||
$join = [
|
||||
['store s', 'sa.store_id = s.store_id', 'inner'],
|
||||
];
|
||||
|
||||
$condition = [ [ 'sa.site_id', '=', $this->site_id ] ];
|
||||
|
||||
if (!empty($remark)) {
|
||||
$condition[] = [ 'sa.remark', 'like', '%' . $remark . '%' ];
|
||||
}
|
||||
if (!empty($from_type)) {
|
||||
$condition[] = [ 'sa.from_type', '=', $from_type ];
|
||||
}
|
||||
if ($store_id > 0) {
|
||||
$condition[] = [ 'sa.store_id', '=', $store_id ];
|
||||
}
|
||||
if ($start_date != '' && $end_date != '') {
|
||||
$condition[] = [ 'sa.create_time', 'between', [ strtotime($start_date), strtotime($end_date) ] ];
|
||||
} else if ($start_date != '' && $end_date == '') {
|
||||
$condition[] = [ 'sa.create_time', '>=', strtotime($start_date) ];
|
||||
} else if ($start_date == '' && $end_date != '') {
|
||||
$condition[] = [ 'sa.create_time', '<=', strtotime($end_date) ];
|
||||
}
|
||||
|
||||
$field = 'sa.*,s.store_name';
|
||||
$order = 'sa.id desc';
|
||||
|
||||
$account_model = new StoreAccount();
|
||||
$list = $account_model->getStoreAccountPageList($condition, $page, $page_size, $order, $field, $alias, $join);
|
||||
$list['data']['list'] = $account_model->getRelatedInfo($list['data']['list']);
|
||||
return $this->response($list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 筛选内容
|
||||
* @return false|string
|
||||
*/
|
||||
public function screen()
|
||||
{
|
||||
$account_model = new StoreAccount();
|
||||
$from_type_list = $account_model->from_type;
|
||||
$res = [
|
||||
'from_type_list' => $from_type_list,
|
||||
];
|
||||
return $this->response($this->success($res));
|
||||
}
|
||||
|
||||
/**
|
||||
* 账户导出
|
||||
*/
|
||||
public function export()
|
||||
{
|
||||
$input = $this->params;
|
||||
$input['store_id'] = $this->store_id;
|
||||
$account_model = new StoreAccount();
|
||||
$res = $account_model->addStoreAccountExport($input, $this->store_id);
|
||||
return $this->response($res);
|
||||
}
|
||||
}
|
||||
53
addon/store/storeapi/controller/Settlement.php
Executable file
53
addon/store/storeapi/controller/Settlement.php
Executable file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\store\storeapi\controller;
|
||||
|
||||
use addon\store\model\Settlement as SettlementModel;
|
||||
use app\model\order\OrderCommon as OrderCommonModel;
|
||||
use app\storeapi\controller\BaseStoreApi;
|
||||
|
||||
/**
|
||||
* 门店结算控制器
|
||||
*/
|
||||
class Settlement extends BaseStoreApi
|
||||
{
|
||||
/**
|
||||
* 门店结算列表
|
||||
*/
|
||||
public function records()
|
||||
{
|
||||
$model = new SettlementModel();
|
||||
$page = $this->params['page'] ?? 1;
|
||||
$page_size = $this->params['page_size'] ?? PAGE_LIST_ROWS;
|
||||
|
||||
$condition[] = [ 'store_id', '=', $this->store_id ];
|
||||
|
||||
$start_time = $this->params['start_time'] ?? '';
|
||||
$end_time = $this->params['end_time'] ?? '';
|
||||
if (!empty($start_time)) $start_time = strtotime($start_time);
|
||||
if (!empty($end_time)) $end_time = strtotime($end_time);
|
||||
|
||||
if (!empty($start_time) && empty($end_time)) {
|
||||
$condition[] = [ 'start_time', '>=', $start_time ];
|
||||
} elseif (empty($start_time) && !empty($end_time)) {
|
||||
$condition[] = [ 'end_time', '<=', $end_time ];
|
||||
} elseif (!empty($start_time) && !empty($end_time)) {
|
||||
$condition[] = [ 'start_time', '>=', $start_time ];
|
||||
$condition[] = [ 'end_time', '<=', $end_time ];
|
||||
}
|
||||
$order = 'id desc';
|
||||
$field = 'id,settlement_no,site_id,site_name,store_name,order_money,shop_money,refund_platform_money,platform_money,refund_shop_money,
|
||||
refund_money,create_time,commission,is_settlement,offline_refund_money,offline_order_money,start_time,end_time';
|
||||
$list = $model->getStoreSettlementPageList($condition, $page, $page_size, $order, $field);
|
||||
|
||||
return $this->response($list);
|
||||
}
|
||||
}
|
||||
198
addon/store/storeapi/controller/Store.php
Executable file
198
addon/store/storeapi/controller/Store.php
Executable file
@@ -0,0 +1,198 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 上海牛之云网络科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\store\storeapi\controller;
|
||||
|
||||
use addon\stock\model\stock\Stock as StockModel;
|
||||
use addon\store\model\Category;
|
||||
use addon\store\model\Label;
|
||||
use app\model\express\Local as LocalModel;
|
||||
use app\model\store\Store as StoreModel;
|
||||
use app\storeapi\controller\BaseStoreApi;
|
||||
use addon\store\model\Config;
|
||||
|
||||
/**
|
||||
* 门店控制器
|
||||
*/
|
||||
class Store extends BaseStoreApi
|
||||
{
|
||||
/**
|
||||
* 获取门店信息
|
||||
* @return false|string
|
||||
* @throws \app\exception\ApiException
|
||||
*/
|
||||
public function info()
|
||||
{
|
||||
$store_model = new StoreModel();
|
||||
$store_info = $store_model->getStoreDetail([ [ 'store_id', '=', $this->store_id ] ]);
|
||||
|
||||
$stock_config = [];
|
||||
if (addon_is_exit('stock')) {
|
||||
$stock_model = new StockModel();
|
||||
$stock_config = $stock_model->getStockConfig($this->site_id)[ 'data' ][ 'value' ];
|
||||
}
|
||||
$store_info[ 'data' ][ 'stock_config' ] = $stock_config;
|
||||
|
||||
return $this->response($store_info);
|
||||
}
|
||||
|
||||
/**
|
||||
* 门店修改
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$condition = array (
|
||||
[ "site_id", "=", $this->site_id ],
|
||||
[ "store_id", "=", $this->store_id ]
|
||||
);
|
||||
$store_model = new StoreModel();
|
||||
$store_name = $this->params[ 'store_name' ] ?? '';
|
||||
$telphone = $this->params[ 'telphone' ] ?? '';
|
||||
$store_image = $this->params[ 'store_image' ] ?? '';
|
||||
$status = $this->params[ 'status' ] ?? 0;
|
||||
$province_id = $this->params[ 'province_id' ] ?? 0;
|
||||
$city_id = $this->params[ 'city_id' ] ?? 0;
|
||||
$district_id = $this->params[ 'district_id' ] ?? 0;
|
||||
$community_id = $this->params[ 'community_id' ] ?? 0;
|
||||
$address = $this->params[ 'address' ] ?? '';
|
||||
$full_address = $this->params[ 'full_address' ] ?? '';
|
||||
$longitude = $this->params[ 'longitude' ] ?? 0;
|
||||
$latitude = $this->params[ 'latitude' ] ?? 0;
|
||||
$open_date = $this->params[ 'open_date' ] ?? '';
|
||||
$start_time = $this->params[ 'start_time' ] ?? 0;
|
||||
$end_time = $this->params[ 'end_time' ] ?? 0;
|
||||
$time_type = $this->params[ 'time_type' ] ?? 0;
|
||||
$time_week = $this->params[ 'time_week' ] ?? '';
|
||||
$store_type = $this->params[ 'store_type' ] ?? '';
|
||||
$support_trade_type = $this->params[ 'support_trade_type' ] ?? '';
|
||||
$stock_type = $this->params[ 'stock_type' ] ?? '';
|
||||
$data = array (
|
||||
"store_name" => $store_name,
|
||||
"telphone" => $telphone,
|
||||
"store_image" => $store_image,
|
||||
"status" => $status,
|
||||
"province_id" => $province_id,
|
||||
"city_id" => $city_id,
|
||||
"district_id" => $district_id,
|
||||
"community_id" => $community_id,
|
||||
"address" => $address,
|
||||
"full_address" => $full_address,
|
||||
"longitude" => $longitude,
|
||||
"latitude" => $latitude,
|
||||
"open_date" => $open_date,
|
||||
'start_time' => $start_time,
|
||||
'end_time' => $end_time,
|
||||
'time_type' => $time_type,
|
||||
'time_week' => $time_week,
|
||||
'support_trade_type' => $support_trade_type,
|
||||
'stock_type' => $stock_type,
|
||||
'category_id' => $this->params[ 'category_id' ] ?? 0,
|
||||
'category_name' => $this->params[ 'category_name' ] ?? '',
|
||||
'label_id' => $this->params[ 'label_id' ] ?? '',
|
||||
'label_name' => $this->params[ 'label_name' ] ?? '',
|
||||
'time_interval' => $this->params[ 'time_interval' ] ?? 30,
|
||||
'delivery_time' => $this->params[ 'delivery_time' ] ?? '',
|
||||
'advance_day' => input('advance_day', 0),
|
||||
'most_day' => input('most_day', 7),
|
||||
'store_type' => $store_type
|
||||
);
|
||||
$result = $store_model->editStore($data, $condition, [], 1, 1);
|
||||
return $this->response($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 同城配送详情
|
||||
* @return false|string
|
||||
*/
|
||||
public function localInfo()
|
||||
{
|
||||
$local_model = new LocalModel();
|
||||
$local_result = $local_model->getLocalInfo([ [ 'site_id', '=', $this->site_id ], [ 'store_id', '=', $this->store_id ] ]);
|
||||
return $this->response($local_result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 同城配送修改
|
||||
* @return false|string
|
||||
*/
|
||||
public function editLocal()
|
||||
{
|
||||
$data = [
|
||||
'type' => $this->params[ 'type' ] ?? 'default',
|
||||
'area_type' => $this->params[ 'area_type' ] ?? 1,
|
||||
'local_area_json' => $this->params[ 'local_area_json' ] ?? '',//区域及业务集合json
|
||||
'time_is_open' => $this->params[ 'time_is_open' ] ?? 0,
|
||||
'time_type' => $this->params[ 'time_type' ] ?? 0,//时间选取类型 0 全天 1 自定义
|
||||
'time_week' => $this->params[ 'time_week' ] ?? '',
|
||||
'start_time' => $this->params[ 'start_time' ] ?? 0,
|
||||
'end_time' => $this->params[ 'end_time' ] ?? 0,
|
||||
'update_time' => time(),
|
||||
'is_open_step' => $this->params[ 'is_open_step' ] ?? 0,
|
||||
'start_distance' => $this->params[ 'start_distance' ] ?? 0,
|
||||
'start_delivery_money' => $this->params[ 'start_delivery_money' ] ?? 0,
|
||||
'continued_distance' => $this->params[ 'continued_distance' ] ?? 0,
|
||||
'continued_delivery_money' => $this->params[ 'continued_delivery_money' ] ?? 0,
|
||||
'start_money' => $this->params[ 'start_money' ] ?? 0,
|
||||
'delivery_money' => $this->params[ 'delivery_money' ] ?? 0,
|
||||
'area_array' => $this->params[ 'area_array' ] ?? '',//地域集合
|
||||
'man_money' => $this->params[ 'man_money' ] ?? '',
|
||||
'man_type' => $this->params[ 'man_type' ] ?? '',
|
||||
'man_discount' => $this->params[ 'man_discount' ] ?? '',
|
||||
'time_interval' => $this->params[ 'time_interval' ] ?? 30,
|
||||
'delivery_time' => $this->params[ 'delivery_time' ] ?? '',
|
||||
'advance_day' => input('advance_day', 0),
|
||||
'most_day' => input('most_day', 7)
|
||||
];
|
||||
|
||||
$condition = array (
|
||||
[ 'site_id', '=', $this->site_id ],
|
||||
[ 'store_id', '=', $this->store_id ],
|
||||
);
|
||||
$local_model = new LocalModel();
|
||||
$res = $local_model->editLocal($data, $condition);
|
||||
return $this->response($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 门店标签
|
||||
*/
|
||||
public function label()
|
||||
{
|
||||
$label_list = ( new Label() )->getStoreLabelList([ [ 'site_id', '=', $this->site_id ] ], 'label_id,label_name');
|
||||
return $this->response($label_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 门点分类
|
||||
* @return false|string
|
||||
*/
|
||||
public function category()
|
||||
{
|
||||
$category = new Category();
|
||||
|
||||
$category_config = $category->getCategoryConfig($this->site_id)[ 'data' ][ 'value' ];
|
||||
$category_list = $category->getStoreCategoryList([ [ 'site_id', '=', $this->site_id ] ], 'category_id,category_name')[ 'data' ];
|
||||
|
||||
return $this->response($this->success([
|
||||
'status' => $category_config[ 'status' ],
|
||||
'list' => $category_list
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现配置
|
||||
* @return false|string
|
||||
*/
|
||||
public function withdrawConfig()
|
||||
{
|
||||
$config = ( new Config() )->getStoreWithdrawConfig($this->site_id)[ 'data' ][ 'value' ];
|
||||
return $this->response($this->success($config));
|
||||
}
|
||||
}
|
||||
153
addon/store/storeapi/controller/Withdraw.php
Executable file
153
addon/store/storeapi/controller/Withdraw.php
Executable file
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\store\storeapi\controller;
|
||||
|
||||
use addon\mobileshop\model\Config as ConfigModel;
|
||||
use addon\store\model\StoreWithdraw;
|
||||
use app\storeapi\controller\BaseStoreApi;
|
||||
|
||||
/**
|
||||
* 门店结算控制器
|
||||
*/
|
||||
class Withdraw extends BaseStoreApi
|
||||
{
|
||||
/**
|
||||
* 门店申请结算
|
||||
*/
|
||||
public function apply()
|
||||
{
|
||||
$store_withdraw_model = new StoreWithdraw();
|
||||
$money = $this->params[ 'money' ] ?? 0;
|
||||
$apply_params = array (
|
||||
'site_id' => $this->site_id,
|
||||
'store_id' => $this->store_id,
|
||||
'money' => $money,
|
||||
'settlement_type' => 'apply'
|
||||
);
|
||||
$withdraw_result = $store_withdraw_model->apply($apply_params);
|
||||
return $this->response($withdraw_result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 结算记录
|
||||
* @return false|string
|
||||
*/
|
||||
public function page()
|
||||
{
|
||||
$page = $this->params[ 'page' ] ?? 1;
|
||||
$page_size = $this->params[ 'page_size' ] ?? PAGE_LIST_ROWS;
|
||||
$withdraw_no = $this->params[ 'withdraw_no' ] ?? '';
|
||||
$start_date = $this->params[ 'start_date' ] ?? '';
|
||||
$end_date = $this->params[ 'end_date' ] ?? '';
|
||||
$status = $this->params[ 'status' ] ?? 'all';//提现状态
|
||||
$transfer_type = $this->params[ 'transfer_type' ] ?? '';//提现转账方式
|
||||
$payment_start_date = $this->params[ 'payment_start_date' ] ?? '';
|
||||
$payment_end_time = $this->params[ 'payment_end_time' ] ?? '';
|
||||
$settlement_type = $this->params[ 'settlement_type' ] ?? '';
|
||||
|
||||
$condition = [
|
||||
[ 'site_id', '=', $this->site_id ],
|
||||
[ 'store_id', '=', $this->store_id ]
|
||||
];
|
||||
|
||||
if (!empty($withdraw_no)) {
|
||||
$condition[] = [ 'withdraw_no', 'like', '%' . $withdraw_no . '%' ];
|
||||
}
|
||||
if (!empty($transfer_type)) {
|
||||
$condition[] = [ 'transfer_type', '=', $transfer_type ];
|
||||
}
|
||||
if (!empty($settlement_type)) {
|
||||
$condition[] = [ 'settlement_type', '=', $settlement_type ];
|
||||
}
|
||||
if ($status != 'all') {
|
||||
$condition[] = [ 'status', '=', $status ];
|
||||
}
|
||||
if ($start_date != '' && $end_date != '') {
|
||||
$condition[] = [ 'apply_time', 'between', [ strtotime($start_date), strtotime($end_date) ] ];
|
||||
} else if ($start_date != '' && $end_date == '') {
|
||||
$condition[] = [ 'apply_time', '>=', strtotime($start_date) ];
|
||||
} else if ($start_date == '' && $end_date != '') {
|
||||
$condition[] = [ 'apply_time', '<=', strtotime($end_date) ];
|
||||
}
|
||||
|
||||
if ($payment_start_date != '' && $payment_end_time != '') {
|
||||
$condition[] = [ 'transfer_time', 'between', [ strtotime($payment_start_date), strtotime($payment_end_time) ] ];
|
||||
} else if ($payment_start_date != '' && $payment_end_time == '') {
|
||||
$condition[] = [ 'transfer_time', '>=', strtotime($payment_start_date) ];
|
||||
} else if ($payment_start_date == '' && $payment_end_time != '') {
|
||||
$condition[] = [ 'transfer_time', '<=', strtotime($payment_end_time) ];
|
||||
}
|
||||
|
||||
$order = 'apply_time desc';
|
||||
$withdraw_model = new StoreWithdraw();
|
||||
$data = $withdraw_model->getStoreWithdrawPageList($condition, $page, $page_size, $order);
|
||||
|
||||
return $this->response($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 筛选内容
|
||||
* @return false|string
|
||||
*/
|
||||
public function screen()
|
||||
{
|
||||
$withdraw_model = new StoreWithdraw();
|
||||
$data = [
|
||||
'status' => $withdraw_model->status,
|
||||
'settlement_type' => $withdraw_model->settlement_type,
|
||||
'transfer_type_list' => $withdraw_model->getTransferType($this->site_id)
|
||||
];
|
||||
return $this->response($this->success($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取结算详情
|
||||
* @return false|string
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$withdraw_id = $this->params[ 'withdraw_id' ] ?? 0;
|
||||
$withdraw_model = new StoreWithdraw();
|
||||
$withdraw_info = $withdraw_model->detail([ 'site_id' => $this->site_id, 'store_id' => $this->store_id, 'withdraw_id' => $withdraw_id ]);
|
||||
return $this->response($withdraw_info);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 转账二维码
|
||||
* @return false|string
|
||||
*/
|
||||
public function getTransferCode()
|
||||
{
|
||||
$id = input('id', 0);
|
||||
if(empty($id)){
|
||||
return $this->response($this->error([],'id参数有误'));
|
||||
}
|
||||
|
||||
//获取扫码收款页面路径
|
||||
$config_model = new \app\model\web\Config();
|
||||
$config_info = $config_model->getH5DomainName($this->site_id)[ 'data' ][ 'value' ];
|
||||
if($config_info['deploy_way'] == 'default'){
|
||||
$domain_url = ROOT_URL.'/h5';
|
||||
}else{
|
||||
$domain_url = $config_info['domain_name_h5'];
|
||||
}
|
||||
$url = $domain_url.'/pages_tool/store/store_withdraw?id='.$id;
|
||||
|
||||
//生成页面二维码
|
||||
$qrcode_model = new \app\model\system\Qrcode();
|
||||
$qrcode_res = $qrcode_model->createBase64Qrcode($url);
|
||||
|
||||
return $this->response($qrcode_res);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user