diff --git a/app/admin/logic/user/UserLogic.php b/app/admin/logic/user/UserLogic.php
index aaa9bf58e..353b97607 100644
--- a/app/admin/logic/user/UserLogic.php
+++ b/app/admin/logic/user/UserLogic.php
@@ -63,6 +63,34 @@ class UserLogic extends BaseLogic
return false;
}
}
+
+ public static function StoreAdd(array $params)
+ {
+ $passwordSalt = Config::get('project.unique_identification');
+ $password = create_password($params['password'], $passwordSalt);
+ $defaultAvatar = config('project.default_image.admin_avatar');
+ $avatar = !empty($params['avatar']) ? FileService::setFileUrl($params['avatar']) : $defaultAvatar;
+
+ Db::startTrans();
+ try {
+ $res=User::create([
+ 'avatar' => $avatar,
+ 'real_name' =>'',
+ 'nickname' => '用户'.time(),
+ 'account' => $params['mobile'],
+ 'password' => $password,
+ 'mobile' => $params['mobile'],
+ 'user_money' => $params['user_money']
+ ]);
+
+ Db::commit();
+ return $res;
+ } catch (\Exception $e) {
+ Db::rollback();
+ self::setError($e->getMessage());
+ return false;
+ }
+ }
/**
* @notes 编辑用户列表
* @param array $params
diff --git a/app/admin/validate/user/UserValidate.php b/app/admin/validate/user/UserValidate.php
index b6a91c8ee..43df446b7 100644
--- a/app/admin/validate/user/UserValidate.php
+++ b/app/admin/validate/user/UserValidate.php
@@ -27,7 +27,14 @@ class UserValidate extends BaseValidate
'mobile' => 'require|mobile',
'is_disable' => 'in:0,1',
'sex' => 'in:1,2',
- 'user_money' => 'float'
+ 'user_money' => 'float',
+ 'province' => 'require',
+ 'city' => 'require',
+ 'district' => 'require',
+ 'street' => 'require',
+ 'village' => 'require',
+ 'brigade' => 'require',
+ 'user_ship' => 'require',
];
@@ -45,6 +52,13 @@ class UserValidate extends BaseValidate
'is_disable' => '是否禁用',
'sex' => '用户性别',
'user_money' => '用户余额',
+ 'province' => '省',
+ 'city' => '市',
+ 'district' => '区',
+ 'street' => '街道',
+ 'village' => '村',
+ 'brigade' => ' 队',
+ 'user_ship' => ' 会员类型',
];
@@ -59,6 +73,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 编辑场景
diff --git a/app/api/controller/BaseApiController.php b/app/api/controller/BaseApiController.php
index e3d9026ad..516bf8bec 100644
--- a/app/api/controller/BaseApiController.php
+++ b/app/api/controller/BaseApiController.php
@@ -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
{
diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php
index 8a31ce440..8dd609b2b 100644
--- a/app/api/controller/IndexController.php
+++ b/app/api/controller/IndexController.php
@@ -13,13 +13,12 @@ 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
{
@@ -27,36 +26,35 @@ class IndexController extends BaseApiController
public function index()
{
- $arr=StoreBranchProduct::where('store_id',5)->select();
- foreach ($arr as $item){
- StoreProductLogic::updateGoodsclass($item['cate_id'],5);
-
+ $arr = StoreBranchProduct::where('store_id', 5)->select();
+ foreach ($arr as $item) {
+ StoreProductLogic::updateGoodsclass($item['cate_id'], 5);
}
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);
@@ -67,15 +65,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 = [
@@ -85,7 +83,7 @@ d(22);
'auth_code' => (string)$auth_code
],
'amount' => [
- 'total' =>1,
+ 'total' => 1,
],
'scene_info' => [
"store_info" => [
@@ -93,14 +91,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);
@@ -143,7 +140,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);
}
@@ -152,7 +149,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);
}
@@ -165,4 +162,22 @@ 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);
+ }
}
diff --git a/app/api/controller/LoginController.php b/app/api/controller/LoginController.php
index d58b2ab1f..8143a4182 100644
--- a/app/api/controller/LoginController.php
+++ b/app/api/controller/LoginController.php
@@ -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
{
diff --git a/app/api/controller/PayController.php b/app/api/controller/PayController.php
index bcff5cf6d..6603df95e 100644
--- a/app/api/controller/PayController.php
+++ b/app/api/controller/PayController.php
@@ -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()]
+
/**
* 支付
diff --git a/app/api/controller/UploadController.php b/app/api/controller/UploadController.php
index 6ca026202..dc2993465 100644
--- a/app/api/controller/UploadController.php
+++ b/app/api/controller/UploadController.php
@@ -4,8 +4,7 @@
use app\common\service\UploadService;
use Exception;
- use hg\apidoc\annotation as ApiDoc;
- #[ApiDoc\NotParse()]
+
class UploadController extends BaseApiController
{
diff --git a/app/api/controller/cate/CateController.php b/app/api/controller/cate/CateController.php
index 17e573afe..5f6e4bb87 100644
--- a/app/api/controller/cate/CateController.php
+++ b/app/api/controller/cate/CateController.php
@@ -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()]
+
/**
* 商品分类控制器
diff --git a/app/api/controller/order/CartController.php b/app/api/controller/order/CartController.php
index 06ad4b0d1..7c74e03fc 100644
--- a/app/api/controller/order/CartController.php
+++ b/app/api/controller/order/CartController.php
@@ -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()
diff --git a/app/api/controller/order/OrderController.php b/app/api/controller/order/OrderController.php
index 70ec3e5a5..c8a6a62c3 100644
--- a/app/api/controller/order/OrderController.php
+++ b/app/api/controller/order/OrderController.php
@@ -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', []);
@@ -263,18 +261,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');
@@ -352,14 +350,14 @@ 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');
@@ -447,15 +445,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');
@@ -487,19 +485,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');
@@ -509,14 +507,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)
@@ -525,14 +523,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');
diff --git a/app/api/controller/product/ProductController.php b/app/api/controller/product/ProductController.php
index d1d54fa36..c10aeaceb 100644
--- a/app/api/controller/product/ProductController.php
+++ b/app/api/controller/product/ProductController.php
@@ -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'];
diff --git a/app/api/controller/shop/IndexController.php b/app/api/controller/shop/IndexController.php
index 9f797da5e..b1cf77793 100644
--- a/app/api/controller/shop/IndexController.php
+++ b/app/api/controller/shop/IndexController.php
@@ -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'];
diff --git a/app/api/controller/store/ProductRecordController.php b/app/api/controller/store/ProductRecordController.php
index f9d1f6e46..660de6eed 100644
--- a/app/api/controller/store/ProductRecordController.php
+++ b/app/api/controller/store/ProductRecordController.php
@@ -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
{
diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php
index 6b4dd010d..ef5b21d04 100644
--- a/app/api/controller/store/StoreController.php
+++ b/app/api/controller/store/StoreController.php
@@ -7,8 +7,7 @@ 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()]
+
class StoreController extends BaseApiController
{
diff --git a/app/api/controller/store/TransactionRecordController.php b/app/api/controller/store/TransactionRecordController.php
index c0b2bb023..37dd6b288 100644
--- a/app/api/controller/store/TransactionRecordController.php
+++ b/app/api/controller/store/TransactionRecordController.php
@@ -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
{
diff --git a/app/api/controller/user/AddressController.php b/app/api/controller/user/AddressController.php
index 931446ade..781f6f9e3 100644
--- a/app/api/controller/user/AddressController.php
+++ b/app/api/controller/user/AddressController.php
@@ -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
{
diff --git a/app/api/controller/user/UserController.php b/app/api/controller/user/UserController.php
index 67c7efbd1..b21be4f69 100644
--- a/app/api/controller/user/UserController.php
+++ b/app/api/controller/user/UserController.php
@@ -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');
@@ -95,16 +92,16 @@ class UserController extends BaseApiController
}
- #[
- 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 +119,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);
diff --git a/app/api/controller/user/UserFeedbackController.php b/app/api/controller/user/UserFeedbackController.php
index 3ad0f9030..46cedd303 100644
--- a/app/api/controller/user/UserFeedbackController.php
+++ b/app/api/controller/user/UserFeedbackController.php
@@ -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
{
diff --git a/app/api/controller/user/UserVisitController.php b/app/api/controller/user/UserVisitController.php
index 5570e2efe..d777c094a 100644
--- a/app/api/controller/user/UserVisitController.php
+++ b/app/api/controller/user/UserVisitController.php
@@ -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();
diff --git a/app/common/controller/BaseLikeController.php b/app/common/controller/BaseLikeController.php
index 79cf2b9f9..8b020b6e3 100644
--- a/app/common/controller/BaseLikeController.php
+++ b/app/common/controller/BaseLikeController.php
@@ -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 = [];
@@ -74,10 +73,10 @@ class BaseLikeController extends BaseController
return JsonService::fail($msg, $data, $code, $show);
}
- #[ApiDoc\NotParse()]
- #[
- ApiDoc\Title('是否免登录验证'),
- ]
+
+ // #[
+ // ApiDoc\Title('是否免登录验证'),
+ // ]
public function isNotNeedLogin() : bool
{
$notNeedLogin = $this->notNeedLogin;
diff --git a/app/common/controller/Definitions.php b/app/common/controller/Definitions.php
index 8e1e81085..11d053590 100644
--- a/app/common/controller/Definitions.php
+++ b/app/common/controller/Definitions.php
@@ -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()
{
diff --git a/app/common/lists/user/UserShipLists.php b/app/common/lists/user/UserShipLists.php
new file mode 100644
index 000000000..c33e1f700
--- /dev/null
+++ b/app/common/lists/user/UserShipLists.php
@@ -0,0 +1,60 @@
+searchWhere)
+ ->limit($this->limitOffset, $this->limitLength)
+ ->field($field)
+ ->order('sort desc')
+ ->select()->toArray();
+ return $lists;
+ }
+
+
+ /**
+ * @notes 获取数量
+ * @return int
+ * @author 乔峰
+ * @date 2022/9/22 15:51
+ */
+ public function count(): int
+ {
+ return UserShip::where($this->searchWhere)->count();
+ }
+}
\ No newline at end of file
diff --git a/app/store/controller/BaseAdminController.php b/app/store/controller/BaseAdminController.php
index 4ccd24c80..b35b0d401 100644
--- a/app/store/controller/BaseAdminController.php
+++ b/app/store/controller/BaseAdminController.php
@@ -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
{
diff --git a/app/store/controller/ConfigController.php b/app/store/controller/ConfigController.php
index c13dec726..a8220b243 100644
--- a/app/store/controller/ConfigController.php
+++ b/app/store/controller/ConfigController.php
@@ -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');
diff --git a/app/store/controller/DeliveryController.php b/app/store/controller/DeliveryController.php
index 0811d69f0..d0a747e67 100644
--- a/app/store/controller/DeliveryController.php
+++ b/app/store/controller/DeliveryController.php
@@ -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');
diff --git a/app/store/controller/DownloadController.php b/app/store/controller/DownloadController.php
index faf1a11ed..93ce7f38b 100644
--- a/app/store/controller/DownloadController.php
+++ b/app/store/controller/DownloadController.php
@@ -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
{
diff --git a/app/store/controller/FileController.php b/app/store/controller/FileController.php
index d1a50d9a4..e531cd65b 100644
--- a/app/store/controller/FileController.php
+++ b/app/store/controller/FileController.php
@@ -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');
diff --git a/app/store/controller/LoginController.php b/app/store/controller/LoginController.php
index 151e52bbe..b35adac66 100644
--- a/app/store/controller/LoginController.php
+++ b/app/store/controller/LoginController.php
@@ -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验证
diff --git a/app/store/controller/StaffController.php b/app/store/controller/StaffController.php
index 60e604c45..8dc4d3a0b 100644
--- a/app/store/controller/StaffController.php
+++ b/app/store/controller/StaffController.php
@@ -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');
diff --git a/app/store/controller/UploadController.php b/app/store/controller/UploadController.php
index 2cfc92110..cd00fde5a 100644
--- a/app/store/controller/UploadController.php
+++ b/app/store/controller/UploadController.php
@@ -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
{
diff --git a/app/store/controller/WorkbenchController.php b/app/store/controller/WorkbenchController.php
index 6788b71ca..3ca20e3cb 100644
--- a/app/store/controller/WorkbenchController.php
+++ b/app/store/controller/WorkbenchController.php
@@ -5,23 +5,22 @@ namespace app\store\controller;
use app\common\controller\Definitions;
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
{
- #[
- 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 +29,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 +48,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 +67,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 +87,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 +105,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 +123,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();
@@ -143,16 +142,16 @@ class WorkbenchController extends BaseAdminController
}
- #[
- 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"),
- ]
+ // #[
+ // 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();
diff --git a/app/store/controller/auth/AdminController.php b/app/store/controller/auth/AdminController.php
index 50c75f336..0ec1f6cbf 100644
--- a/app/store/controller/auth/AdminController.php
+++ b/app/store/controller/auth/AdminController.php
@@ -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]);
diff --git a/app/store/controller/auth/MenuController.php b/app/store/controller/auth/MenuController.php
index 0dd8ff82b..caa58acf6 100644
--- a/app/store/controller/auth/MenuController.php
+++ b/app/store/controller/auth/MenuController.php
@@ -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
{
diff --git a/app/store/controller/auth/RoleController.php b/app/store/controller/auth/RoleController.php
index 8cd0ee800..02557bb03 100644
--- a/app/store/controller/auth/RoleController.php
+++ b/app/store/controller/auth/RoleController.php
@@ -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
{
diff --git a/app/store/controller/cart/CartController.php b/app/store/controller/cart/CartController.php
index 6f3e640d8..e190a385b 100644
--- a/app/store/controller/cart/CartController.php
+++ b/app/store/controller/cart/CartController.php
@@ -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()
diff --git a/app/store/controller/cate/CateController.php b/app/store/controller/cate/CateController.php
index 870d369b9..d44b62da3 100644
--- a/app/store/controller/cate/CateController.php
+++ b/app/store/controller/cate/CateController.php
@@ -5,8 +5,7 @@ namespace app\store\controller\cate;
use app\store\controller\BaseAdminController;
use app\api\lists\cate\CateLists;
-use hg\apidoc\annotation as ApiDoc;
-#[ApiDoc\NotParse()]
+
/**
* 商品分类控制器
diff --git a/app/store/controller/finance/FinanceController.php b/app/store/controller/finance/FinanceController.php
index 2ed913b22..fb0e2f2ef 100644
--- a/app/store/controller/finance/FinanceController.php
+++ b/app/store/controller/finance/FinanceController.php
@@ -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');
diff --git a/app/store/controller/finance/StoreBillController.php b/app/store/controller/finance/StoreBillController.php
index 426f7cddd..50c7fb34c 100644
--- a/app/store/controller/finance/StoreBillController.php
+++ b/app/store/controller/finance/StoreBillController.php
@@ -6,46 +6,45 @@ use app\admin\lists\store_finance_flow\StoreFinanceFlowLists;
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());
}
- #[
- 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());
diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php
index 0dda0ad55..f8043f220 100644
--- a/app/store/controller/store_order/StoreOrderController.php
+++ b/app/store/controller/store_order/StoreOrderController.php
@@ -14,7 +14,6 @@ use app\store\controller\BaseAdminController;
use app\common\logic\store_order\StoreOrderLogic;
use app\common\model\store_order\StoreOrder;
use app\store\validate\store_order\StoreOrderValidate;
-use hg\apidoc\annotation as ApiDoc;
use support\Log;
use Webman\RedisQueue\Redis;
@@ -23,59 +22,59 @@ 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'],
- ]],
- ]],
- ]),
- ]
+ // #[
+ // 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 +89,17 @@ 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"),
- ]
+ // #[
+ // 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');
@@ -253,17 +252,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);
diff --git a/app/store/controller/store_order/StoreRefundOrderController.php b/app/store/controller/store_order/StoreRefundOrderController.php
index 14ffbb3ec..5857b772c 100644
--- a/app/store/controller/store_order/StoreRefundOrderController.php
+++ b/app/store/controller/store_order/StoreRefundOrderController.php
@@ -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');
diff --git a/app/store/controller/store_product/StoreProductController.php b/app/store/controller/store_product/StoreProductController.php
index c1aa3e16e..780430b60 100644
--- a/app/store/controller/store_product/StoreProductController.php
+++ b/app/store/controller/store_product/StoreProductController.php
@@ -9,7 +9,6 @@ use app\store\controller\BaseAdminController;
use app\store\logic\store_branch_product\StoreBranchProductLogic;
use app\store\logic\store_product\StoreProductLogic;
use app\store\validate\store_product\StoreProductValidate;
-use hg\apidoc\annotation as ApiDoc;
/**
@@ -17,57 +16,57 @@ use hg\apidoc\annotation as ApiDoc;
* Class StoreProductController
* @package app\store\controller\store_product
*/
-#[ApiDoc\title('商品列表')]
+// #[ApiDoc\title('商品列表')]
class StoreProductController extends BaseAdminController
{
- #[
- ApiDoc\Title('商品列表'),
- ApiDoc\url('/store/store_product/storeProduct/lists'),
- ApiDoc\Method('GET'),
- ApiDoc\NotHeaders(),
- ApiDoc\Query(name: 'cate_id', type: 'int', require: false, desc: '分类id'),
- ApiDoc\Query(name: 'store_name', type: 'string', require: false, desc: '商品名称'),
- ApiDoc\Query(name: 'status', type: 'int', require: false, desc: '状态:1上架,2下架,3售罄,4库存告警'),
- 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' => 'product_id', 'desc' => '商品ID', 'type' => 'int'],
- ['name' => 'image', 'desc' => '图片', 'type' => 'string'],
- ['name' => 'store_name', 'desc' => '商品名称', 'type' => 'string'],
- ['name' => 'price', 'desc' => '零售价', 'type' => 'float'],
- ['name' => 'cost', 'desc' => '成本价', 'type' => 'float'],
- ['name' => 'sales', 'desc' => '销量', 'type' => 'int'],
- ['name' => 'stock', 'desc' => '库存', 'type' => 'int'],
- ['name' => 'unit_name', 'desc' => '单位', 'type' => 'string'],
- ['name' => 'cate_name', 'desc' => '分类', 'type' => 'string'],
- ['name' => 'status', 'desc' => '状态:1上架,0下架', 'type' => 'string'],
- ]),
- ]
+ // #[
+ // ApiDoc\Title('商品列表'),
+ // ApiDoc\url('/store/store_product/storeProduct/lists'),
+ // ApiDoc\Method('GET'),
+ // ApiDoc\NotHeaders(),
+ // ApiDoc\Query(name: 'cate_id', type: 'int', require: false, desc: '分类id'),
+ // ApiDoc\Query(name: 'store_name', type: 'string', require: false, desc: '商品名称'),
+ // ApiDoc\Query(name: 'status', type: 'int', require: false, desc: '状态:1上架,2下架,3售罄,4库存告警'),
+ // 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' => 'product_id', 'desc' => '商品ID', 'type' => 'int'],
+ // ['name' => 'image', 'desc' => '图片', 'type' => 'string'],
+ // ['name' => 'store_name', 'desc' => '商品名称', 'type' => 'string'],
+ // ['name' => 'price', 'desc' => '零售价', 'type' => 'float'],
+ // ['name' => 'cost', 'desc' => '成本价', 'type' => 'float'],
+ // ['name' => 'sales', 'desc' => '销量', 'type' => 'int'],
+ // ['name' => 'stock', 'desc' => '库存', 'type' => 'int'],
+ // ['name' => 'unit_name', 'desc' => '单位', 'type' => 'string'],
+ // ['name' => 'cate_name', 'desc' => '分类', 'type' => 'string'],
+ // ['name' => 'status', 'desc' => '状态:1上架,0下架', 'type' => 'string'],
+ // ]),
+ // ]
public function lists()
{
return $this->dataLists(new StoreBranchProductLists());
}
- #[
- ApiDoc\Title('添加商品'),
- ApiDoc\url('/store/store_product/storeProduct/add'),
- ApiDoc\Method('POST'),
- ApiDoc\NotHeaders(),
- ApiDoc\Header(ref: [Definitions::class, "token"]),
- ApiDoc\ResponseSuccess("data", type: "array", children: [
- ['name' => 'id', 'desc' => 'ID', 'type' => 'int'],
- ['name' => 'image', 'desc' => '图片', 'type' => 'string'],
- ['name' => 'store_name', 'desc' => '商品名称', 'type' => 'string'],
- ['name' => 'price', 'desc' => '零售价', 'type' => 'float'],
- ['name' => 'cost', 'desc' => '成本价', 'type' => 'float'],
- ['name' => 'sales', 'desc' => '销量', 'type' => 'int'],
- ['name' => 'stock', 'desc' => '库存', 'type' => 'int'],
- ['name' => 'unit_name', 'desc' => '单位', 'type' => 'string'],
- ['name' => 'cate_name', 'desc' => '分类', 'type' => 'string'],
- ]),
- ]
+ // #[
+ // ApiDoc\Title('添加商品'),
+ // ApiDoc\url('/store/store_product/storeProduct/add'),
+ // ApiDoc\Method('POST'),
+ // ApiDoc\NotHeaders(),
+ // ApiDoc\Header(ref: [Definitions::class, "token"]),
+ // ApiDoc\ResponseSuccess("data", type: "array", children: [
+ // ['name' => 'id', 'desc' => 'ID', 'type' => 'int'],
+ // ['name' => 'image', 'desc' => '图片', 'type' => 'string'],
+ // ['name' => 'store_name', 'desc' => '商品名称', 'type' => 'string'],
+ // ['name' => 'price', 'desc' => '零售价', 'type' => 'float'],
+ // ['name' => 'cost', 'desc' => '成本价', 'type' => 'float'],
+ // ['name' => 'sales', 'desc' => '销量', 'type' => 'int'],
+ // ['name' => 'stock', 'desc' => '库存', 'type' => 'int'],
+ // ['name' => 'unit_name', 'desc' => '单位', 'type' => 'string'],
+ // ['name' => 'cate_name', 'desc' => '分类', 'type' => 'string'],
+ // ]),
+ // ]
public function add()
{
$params = (new StoreProductValidate())->post()->goCheck('add');
@@ -78,25 +77,25 @@ class StoreProductController extends BaseAdminController
return $this->fail(StoreProductLogic::getError());
}
- #[
- ApiDoc\Title('编辑商品'),
- ApiDoc\url('/store/store_product/storeProduct/edit'),
- ApiDoc\Method('POST'),
- ApiDoc\NotHeaders(),
- ApiDoc\Query(name: "id", type: "int", require: true, desc: "id"),
- ApiDoc\Header(ref: [Definitions::class, "token"]),
- ApiDoc\ResponseSuccess("data", type: "array", children: [
- ['name' => 'id', 'desc' => 'ID', 'type' => 'int'],
- ['name' => 'image', 'desc' => '图片', 'type' => 'string'],
- ['name' => 'store_name', 'desc' => '商品名称', 'type' => 'string'],
- ['name' => 'price', 'desc' => '零售价', 'type' => 'float'],
- ['name' => 'cost', 'desc' => '成本价', 'type' => 'float'],
- ['name' => 'sales', 'desc' => '销量', 'type' => 'int'],
- ['name' => 'stock', 'desc' => '库存', 'type' => 'int'],
- ['name' => 'unit_name', 'desc' => '单位', 'type' => 'string'],
- ['name' => 'cate_name', 'desc' => '分类', 'type' => 'string'],
- ]),
- ]
+ // #[
+ // ApiDoc\Title('编辑商品'),
+ // ApiDoc\url('/store/store_product/storeProduct/edit'),
+ // ApiDoc\Method('POST'),
+ // ApiDoc\NotHeaders(),
+ // ApiDoc\Query(name: "id", type: "int", require: true, desc: "id"),
+ // ApiDoc\Header(ref: [Definitions::class, "token"]),
+ // ApiDoc\ResponseSuccess("data", type: "array", children: [
+ // ['name' => 'id', 'desc' => 'ID', 'type' => 'int'],
+ // ['name' => 'image', 'desc' => '图片', 'type' => 'string'],
+ // ['name' => 'store_name', 'desc' => '商品名称', 'type' => 'string'],
+ // ['name' => 'price', 'desc' => '零售价', 'type' => 'float'],
+ // ['name' => 'cost', 'desc' => '成本价', 'type' => 'float'],
+ // ['name' => 'sales', 'desc' => '销量', 'type' => 'int'],
+ // ['name' => 'stock', 'desc' => '库存', 'type' => 'int'],
+ // ['name' => 'unit_name', 'desc' => '单位', 'type' => 'string'],
+ // ['name' => 'cate_name', 'desc' => '分类', 'type' => 'string'],
+ // ]),
+ // ]
public function edit()
{
$params = (new StoreProductValidate())->post()->goCheck('edit');
@@ -107,25 +106,25 @@ class StoreProductController extends BaseAdminController
return $this->fail(StoreProductLogic::getError());
}
- #[
- ApiDoc\Title('删除商品'),
- ApiDoc\url('/store/store_product/storeProduct/delete'),
- ApiDoc\Method('POST'),
- ApiDoc\NotHeaders(),
- ApiDoc\Param(name: "id", type: "int", require: true, desc: "id"),
- ApiDoc\Header(ref: [Definitions::class, "token"]),
- ApiDoc\ResponseSuccess("data", type: "array", children: [
- ['name' => 'id', 'desc' => 'ID', 'type' => 'int'],
- ['name' => 'image', 'desc' => '图片', 'type' => 'string'],
- ['name' => 'store_name', 'desc' => '商品名称', 'type' => 'string'],
- ['name' => 'price', 'desc' => '零售价', 'type' => 'float'],
- ['name' => 'cost', 'desc' => '成本价', 'type' => 'float'],
- ['name' => 'sales', 'desc' => '销量', 'type' => 'int'],
- ['name' => 'stock', 'desc' => '库存', 'type' => 'int'],
- ['name' => 'unit_name', 'desc' => '单位', 'type' => 'string'],
- ['name' => 'cate_name', 'desc' => '分类', 'type' => 'string'],
- ]),
- ]
+ // #[
+ // ApiDoc\Title('删除商品'),
+ // ApiDoc\url('/store/store_product/storeProduct/delete'),
+ // ApiDoc\Method('POST'),
+ // ApiDoc\NotHeaders(),
+ // ApiDoc\Param(name: "id", type: "int", require: true, desc: "id"),
+ // ApiDoc\Header(ref: [Definitions::class, "token"]),
+ // ApiDoc\ResponseSuccess("data", type: "array", children: [
+ // ['name' => 'id', 'desc' => 'ID', 'type' => 'int'],
+ // ['name' => 'image', 'desc' => '图片', 'type' => 'string'],
+ // ['name' => 'store_name', 'desc' => '商品名称', 'type' => 'string'],
+ // ['name' => 'price', 'desc' => '零售价', 'type' => 'float'],
+ // ['name' => 'cost', 'desc' => '成本价', 'type' => 'float'],
+ // ['name' => 'sales', 'desc' => '销量', 'type' => 'int'],
+ // ['name' => 'stock', 'desc' => '库存', 'type' => 'int'],
+ // ['name' => 'unit_name', 'desc' => '单位', 'type' => 'string'],
+ // ['name' => 'cate_name', 'desc' => '分类', 'type' => 'string'],
+ // ]),
+ // ]
public function delete()
{
$params = (new StoreProductValidate())->post()->goCheck('delete');
@@ -133,25 +132,25 @@ class StoreProductController extends BaseAdminController
return $this->success('删除成功', [], 1, 1);
}
- #[
- ApiDoc\Title('商品详情'),
- ApiDoc\url('/store/store_product/storeProduct/detail'),
- ApiDoc\Method('GET'),
- ApiDoc\NotHeaders(),
- ApiDoc\Query(name: "id", type: "int", require: true, desc: "id"),
- ApiDoc\Header(ref: [Definitions::class, "token"]),
- ApiDoc\ResponseSuccess("data", type: "array", children: [
- ['name' => 'id', 'desc' => 'ID', 'type' => 'int'],
- ['name' => 'image', 'desc' => '图片', 'type' => 'string'],
- ['name' => 'store_name', 'desc' => '商品名称', 'type' => 'string'],
- ['name' => 'price', 'desc' => '零售价', 'type' => 'float'],
- ['name' => 'cost', 'desc' => '成本价', 'type' => 'float'],
- ['name' => 'sales', 'desc' => '销量', 'type' => 'int'],
- ['name' => 'stock', 'desc' => '库存', 'type' => 'int'],
- ['name' => 'unit_name', 'desc' => '单位', 'type' => 'string'],
- ['name' => 'cate_name', 'desc' => '分类', 'type' => 'string'],
- ]),
- ]
+ // #[
+ // ApiDoc\Title('商品详情'),
+ // ApiDoc\url('/store/store_product/storeProduct/detail'),
+ // ApiDoc\Method('GET'),
+ // ApiDoc\NotHeaders(),
+ // ApiDoc\Query(name: "id", type: "int", require: true, desc: "id"),
+ // ApiDoc\Header(ref: [Definitions::class, "token"]),
+ // ApiDoc\ResponseSuccess("data", type: "array", children: [
+ // ['name' => 'id', 'desc' => 'ID', 'type' => 'int'],
+ // ['name' => 'image', 'desc' => '图片', 'type' => 'string'],
+ // ['name' => 'store_name', 'desc' => '商品名称', 'type' => 'string'],
+ // ['name' => 'price', 'desc' => '零售价', 'type' => 'float'],
+ // ['name' => 'cost', 'desc' => '成本价', 'type' => 'float'],
+ // ['name' => 'sales', 'desc' => '销量', 'type' => 'int'],
+ // ['name' => 'stock', 'desc' => '库存', 'type' => 'int'],
+ // ['name' => 'unit_name', 'desc' => '单位', 'type' => 'string'],
+ // ['name' => 'cate_name', 'desc' => '分类', 'type' => 'string'],
+ // ]),
+ // ]
public function detail()
{
$params = (new StoreProductValidate())->goCheck('detail');
@@ -159,15 +158,15 @@ class StoreProductController extends BaseAdminController
return $this->data($result);
}
- #[
- ApiDoc\Title('商品上下架'),
- ApiDoc\url('/store/store_product/storeProduct/status'),
- ApiDoc\Method('POST'),
- ApiDoc\NotHeaders(),
- ApiDoc\Param(name: "id", type: "int", require: true, desc: "id"),
- ApiDoc\Header(ref: [Definitions::class, "token"]),
- ApiDoc\ResponseSuccess("data", type: "array"),
- ]
+ // #[
+ // ApiDoc\Title('商品上下架'),
+ // ApiDoc\url('/store/store_product/storeProduct/status'),
+ // ApiDoc\Method('POST'),
+ // ApiDoc\NotHeaders(),
+ // ApiDoc\Param(name: "id", type: "int", require: true, desc: "id"),
+ // ApiDoc\Header(ref: [Definitions::class, "token"]),
+ // ApiDoc\ResponseSuccess("data", type: "array"),
+ // ]
public function status()
{
$params = (new StoreProductValidate())->post()->goCheck('detail');
@@ -175,19 +174,19 @@ class StoreProductController extends BaseAdminController
return $this->success('操作成功', [], 1, 1);
}
- #[
- ApiDoc\Title('商品库存增减'),
- ApiDoc\url('/store/store_product/storeProduct/stock'),
- ApiDoc\Method('POST'),
- ApiDoc\Param(name: "attrs", type: "array", require: true, desc: "id", children: [
- ['name' => 'unique', 'desc' => '唯一值', 'type' => 'string'],
- ['name' => 'type', 'desc' => '类型:1增加,2减少', 'type' => 'int'],
- ['name' => 'number', 'desc' => '数量', 'type' => 'int'],
- ]),
- ApiDoc\NotHeaders(),
- ApiDoc\Header(ref: [Definitions::class, "token"]),
- ApiDoc\ResponseSuccess("data", type: "array"),
- ]
+ // #[
+ // ApiDoc\Title('商品库存增减'),
+ // ApiDoc\url('/store/store_product/storeProduct/stock'),
+ // ApiDoc\Method('POST'),
+ // ApiDoc\Param(name: "attrs", type: "array", require: true, desc: "id", children: [
+ // ['name' => 'unique', 'desc' => '唯一值', 'type' => 'string'],
+ // ['name' => 'type', 'desc' => '类型:1增加,2减少', 'type' => 'int'],
+ // ['name' => 'number', 'desc' => '数量', 'type' => 'int'],
+ // ]),
+ // ApiDoc\NotHeaders(),
+ // ApiDoc\Header(ref: [Definitions::class, "token"]),
+ // ApiDoc\ResponseSuccess("data", type: "array"),
+ // ]
public function stock()
{
$params = (new StoreProductValidate())->post()->goCheck('stock');
diff --git a/app/store/controller/store_product/StoreStorageController.php b/app/store/controller/store_product/StoreStorageController.php
index 0fc5a2509..77ade604c 100644
--- a/app/store/controller/store_product/StoreStorageController.php
+++ b/app/store/controller/store_product/StoreStorageController.php
@@ -7,38 +7,37 @@ use app\store\controller\BaseAdminController;
use app\admin\lists\system_store_storage\SystemStoreStorageLists;
use app\admin\logic\system_store_storage\SystemStoreStorageLogic;
use app\admin\validate\system_store_storage\SystemStoreStorageValidate;
-use hg\apidoc\annotation as ApiDoc;
-#[ApiDoc\title('入库管理')]
+// #[ApiDoc\title('入库管理')]
class StoreStorageController extends BaseAdminController
{
- #[
- ApiDoc\Title('入库记录'),
- ApiDoc\url('/store/store_product/storeStorage/lists'),
- ApiDoc\Method('GET'),
- ApiDoc\NotHeaders(),
- ApiDoc\Query(name: 'store_id', type: 'int', require: false, desc: '门店id'),
- ApiDoc\Query(name: 'staff_id', type: 'int', require: false, desc: '店员id'),
- ApiDoc\Query(name: 'status', type: 'int', require: false, desc: '状态:0-待确认,1-已确认'),
- ApiDoc\Header(ref: [Definitions::class, "token"]),
- ApiDoc\Query(ref: [Definitions::class, "page"]),
- ApiDoc\ResponseSuccess("data", type: "array"),
- ]
+ // #[
+ // ApiDoc\Title('入库记录'),
+ // ApiDoc\url('/store/store_product/storeStorage/lists'),
+ // ApiDoc\Method('GET'),
+ // ApiDoc\NotHeaders(),
+ // ApiDoc\Query(name: 'store_id', type: 'int', require: false, desc: '门店id'),
+ // ApiDoc\Query(name: 'staff_id', type: 'int', require: false, desc: '店员id'),
+ // ApiDoc\Query(name: 'status', type: 'int', require: false, desc: '状态:0-待确认,1-已确认'),
+ // ApiDoc\Header(ref: [Definitions::class, "token"]),
+ // ApiDoc\Query(ref: [Definitions::class, "page"]),
+ // ApiDoc\ResponseSuccess("data", type: "array"),
+ // ]
public function lists()
{
return $this->dataLists(new SystemStoreStorageLists());
}
- #[
- ApiDoc\Title('确认入库'),
- ApiDoc\url('/store/store_product/storeStorage/confirm'),
- 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/store_product/storeStorage/confirm'),
+ // 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 confirm()
{
$params = (new SystemStoreStorageValidate())->post()->goCheck('edit');
diff --git a/app/store/controller/store_product_attr_value/StoreProductAttrValueController.php b/app/store/controller/store_product_attr_value/StoreProductAttrValueController.php
index ae7c08238..9b99546ac 100644
--- a/app/store/controller/store_product_attr_value/StoreProductAttrValueController.php
+++ b/app/store/controller/store_product_attr_value/StoreProductAttrValueController.php
@@ -8,7 +8,6 @@ use app\store\controller\BaseAdminController;
use app\store\lists\store_product_attr_value\StoreProductAttrValueLists;
use app\store\logic\store_product_attr_value\StoreProductAttrValueLogic;
use app\store\validate\store_product_attr_value\StoreProductAttrValueValidate;
-use hg\apidoc\annotation as ApiDoc;
/**
@@ -16,47 +15,47 @@ use hg\apidoc\annotation as ApiDoc;
* Class StoreProductAttrValueController
* @package app\store\controller\store_product_attr_value
*/
-#[ApiDoc\title('商品属性值')]
+// #[ApiDoc\title('商品属性值')]
class StoreProductAttrValueController extends BaseAdminController
{
- #[
- ApiDoc\Title('商品属性值列表'),
- ApiDoc\url('/store/store_product_attr_value/storeProductAttrValue/lists'),
- ApiDoc\Method('GET'),
- ApiDoc\NotHeaders(),
- ApiDoc\Header(ref: [Definitions::class, "token"]),
- ApiDoc\Query(ref: [Definitions::class, "page"]),
- ApiDoc\Query(name: 'product_id', type: 'int', require: true, desc: '商品ID'),
- ApiDoc\Query(name: 'store_id', type: 'int', require: true, desc: '门店ID'),
- ApiDoc\ResponseSuccess("data", type: "array", children: [
- ['name' => 'count', 'desc' => '总数', 'type' => 'int'],
- ['name' => 'page_no', 'desc' => '页码', 'type' => 'int'],
- ['name' => 'page_size', 'desc' => '每页数量', 'type' => 'int'],
- ['name' => 'extend', 'desc' => '扩展数据', 'type' => 'array'],
- ['name' => 'lists', 'desc' => '列表数据', 'type' => 'array', 'children' => [
- ['name' => 'id', 'desc' => 'ID', 'type' => 'int'],
- ['name' => 'product_id', 'desc' => '商品ID', 'type' => 'int'],
- ['name' => 'stock', 'desc' => '库存', 'type' => 'int'],
- ['name' => 'unique', 'desc' => '唯一值', 'type' => 'string'],
- ['name' => 'sales', 'desc' => '销量', 'type' => 'int'],
- ['name' => 'bar_code', 'desc' => '条码', 'type' => 'string'],
- ['name' => 'image', 'desc' => '规格图片', 'type' => 'string'],
- ]],
- ]),
- ]
+ // #[
+ // ApiDoc\Title('商品属性值列表'),
+ // ApiDoc\url('/store/store_product_attr_value/storeProductAttrValue/lists'),
+ // ApiDoc\Method('GET'),
+ // ApiDoc\NotHeaders(),
+ // ApiDoc\Header(ref: [Definitions::class, "token"]),
+ // ApiDoc\Query(ref: [Definitions::class, "page"]),
+ // ApiDoc\Query(name: 'product_id', type: 'int', require: true, desc: '商品ID'),
+ // ApiDoc\Query(name: 'store_id', type: 'int', require: true, desc: '门店ID'),
+ // ApiDoc\ResponseSuccess("data", type: "array", children: [
+ // ['name' => 'count', 'desc' => '总数', 'type' => 'int'],
+ // ['name' => 'page_no', 'desc' => '页码', 'type' => 'int'],
+ // ['name' => 'page_size', 'desc' => '每页数量', 'type' => 'int'],
+ // ['name' => 'extend', 'desc' => '扩展数据', 'type' => 'array'],
+ // ['name' => 'lists', 'desc' => '列表数据', 'type' => 'array', 'children' => [
+ // ['name' => 'id', 'desc' => 'ID', 'type' => 'int'],
+ // ['name' => 'product_id', 'desc' => '商品ID', 'type' => 'int'],
+ // ['name' => 'stock', 'desc' => '库存', 'type' => 'int'],
+ // ['name' => 'unique', 'desc' => '唯一值', 'type' => 'string'],
+ // ['name' => 'sales', 'desc' => '销量', 'type' => 'int'],
+ // ['name' => 'bar_code', 'desc' => '条码', 'type' => 'string'],
+ // ['name' => 'image', 'desc' => '规格图片', 'type' => 'string'],
+ // ]],
+ // ]),
+ // ]
public function lists()
{
return $this->dataLists(new StoreProductAttrValueLists());
}
- #[
- ApiDoc\Title('添加商品属性值'),
- ApiDoc\url('/store/store_product_attr_value/storeProductAttrValue/add'),
- ApiDoc\Method('POST'),
- ApiDoc\NotHeaders(),
- ApiDoc\Header(ref: [Definitions::class, "token"]),
- ]
+ // #[
+ // ApiDoc\Title('添加商品属性值'),
+ // ApiDoc\url('/store/store_product_attr_value/storeProductAttrValue/add'),
+ // ApiDoc\Method('POST'),
+ // ApiDoc\NotHeaders(),
+ // ApiDoc\Header(ref: [Definitions::class, "token"]),
+ // ]
public function add()
{
$params = (new StoreProductAttrValueValidate())->post()->goCheck('add');
@@ -67,13 +66,13 @@ class StoreProductAttrValueController extends BaseAdminController
return $this->fail(StoreProductAttrValueLogic::getError());
}
- #[
- ApiDoc\Title('编辑商品属性值'),
- ApiDoc\url('/store/store_product_attr_value/storeProductAttrValue/edit'),
- ApiDoc\Method('POST'),
- ApiDoc\NotHeaders(),
- ApiDoc\Header(ref: [Definitions::class, "token"]),
- ]
+ // #[
+ // ApiDoc\Title('编辑商品属性值'),
+ // ApiDoc\url('/store/store_product_attr_value/storeProductAttrValue/edit'),
+ // ApiDoc\Method('POST'),
+ // ApiDoc\NotHeaders(),
+ // ApiDoc\Header(ref: [Definitions::class, "token"]),
+ // ]
public function edit()
{
$params = (new StoreProductAttrValueValidate())->post()->goCheck('edit');
@@ -84,13 +83,13 @@ class StoreProductAttrValueController extends BaseAdminController
return $this->fail(StoreProductAttrValueLogic::getError());
}
- #[
- ApiDoc\Title('删除商品属性值'),
- ApiDoc\url('/store/store_product_attr_value/storeProductAttrValue/delete'),
- ApiDoc\Method('POST'),
- ApiDoc\NotHeaders(),
- ApiDoc\Header(ref: [Definitions::class, "token"]),
- ]
+ // #[
+ // ApiDoc\Title('删除商品属性值'),
+ // ApiDoc\url('/store/store_product_attr_value/storeProductAttrValue/delete'),
+ // ApiDoc\Method('POST'),
+ // ApiDoc\NotHeaders(),
+ // ApiDoc\Header(ref: [Definitions::class, "token"]),
+ // ]
public function delete()
{
$params = (new StoreProductAttrValueValidate())->post()->goCheck('delete');
@@ -98,14 +97,14 @@ class StoreProductAttrValueController extends BaseAdminController
return $this->success('删除成功', [], 1, 1);
}
- #[
- ApiDoc\Title('获取商品属性值详情'),
- ApiDoc\url('/store/store_product_attr_value/storeProductAttrValue/detail'),
- ApiDoc\Method('GET'),
- ApiDoc\Author('中国队长'),
- ApiDoc\NotHeaders(),
- ApiDoc\Header(ref: [Definitions::class, "token"]),
- ]
+ // #[
+ // ApiDoc\Title('获取商品属性值详情'),
+ // ApiDoc\url('/store/store_product_attr_value/storeProductAttrValue/detail'),
+ // ApiDoc\Method('GET'),
+ // ApiDoc\Author('中国队长'),
+ // ApiDoc\NotHeaders(),
+ // ApiDoc\Header(ref: [Definitions::class, "token"]),
+ // ]
public function detail()
{
$params = (new StoreProductAttrValueValidate())->goCheck('detail');
diff --git a/app/store/controller/system_store_storage/SystemStoreStorageController.php b/app/store/controller/system_store_storage/SystemStoreStorageController.php
index 11389cf74..b910e9a4e 100644
--- a/app/store/controller/system_store_storage/SystemStoreStorageController.php
+++ b/app/store/controller/system_store_storage/SystemStoreStorageController.php
@@ -9,7 +9,6 @@ use app\admin\logic\system_store_storage\SystemStoreStorageLogic;
use app\admin\validate\system_store_storage\SystemStoreStorageValidate;
use app\common\model\store_branch_product\StoreBranchProduct;
use app\common\model\system_store_storage\SystemStoreStorage;
-use hg\apidoc\annotation as ApiDoc;
/**
@@ -17,16 +16,16 @@ use hg\apidoc\annotation as ApiDoc;
* Class SystemStoreStorageController
* @package app\admin\controller\system_store_storage
*/
-#[ApiDoc\title('门店入库记录')]
+// #[ApiDoc\title('门店入库记录')]
class SystemStoreStorageController extends BaseAdminController
{
- #[
- ApiDoc\Title('列表'),
- ApiDoc\url('/store/system_store_storage/systemstorestorage/lists'),
- ApiDoc\Method('GET'),
- ApiDoc\NotHeaders(),
- ]
+ // #[
+ // ApiDoc\Title('列表'),
+ // ApiDoc\url('/store/system_store_storage/systemstorestorage/lists'),
+ // ApiDoc\Method('GET'),
+ // ApiDoc\NotHeaders(),
+ // ]
public function lists()
{
return $this->dataLists(new SystemStoreStorageLists());
diff --git a/app/store/controller/user/UserController.php b/app/store/controller/user/UserController.php
new file mode 100644
index 000000000..547f4f366
--- /dev/null
+++ b/app/store/controller/user/UserController.php
@@ -0,0 +1,41 @@
+dataLists(new UserLists());
+ }
+
+
+ public function add()
+ {
+ $params = (new UserValidate())->post()->goCheck('storeAdd');
+ d($params);
+ $result = UserLogic::StoreAdd($params);
+ if (true === $result) {
+ return $this->success('添加成功', [], 1, 1);
+ }
+ return $this->fail(UserLogic::getError());
+ }
+
+
+ public function detail()
+ {
+ $params = (new UserValidate())->goCheck('detail');
+ $detail = UserLogic::detail($params['id']);
+ return $this->success('', $detail);
+ }
+
+}
\ No newline at end of file
diff --git a/app/store/controller/user/UserShipController.php b/app/store/controller/user/UserShipController.php
new file mode 100644
index 000000000..e6bd8cdca
--- /dev/null
+++ b/app/store/controller/user/UserShipController.php
@@ -0,0 +1,18 @@
+dataLists(new UserShipLists());
+ }
+}
\ No newline at end of file
diff --git a/app/store/lists/user/UserLists.php b/app/store/lists/user/UserLists.php
new file mode 100644
index 000000000..379d078f8
--- /dev/null
+++ b/app/store/lists/user/UserLists.php
@@ -0,0 +1,60 @@
+ ['mobile'],
+ ];
+ }
+
+ /**
+ * @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,nickname,real_name,sex,avatar,account,mobile,user_money,create_time";
+ $lists = User::where($this->searchWhere)
+ ->limit($this->limitOffset, $this->limitLength)
+ ->field($field)
+ ->order('id desc')
+ ->select()->each(function($data){
+ $data['sex_text'] = $data->sex_text;
+ $data['mobile'] = substr_replace($data['mobile'], '****', 3, 4);
+ })->toArray();
+ return $lists;
+ }
+
+
+ /**
+ * @notes 获取数量
+ * @return int
+ * @author 乔峰
+ * @date 2022/9/22 15:51
+ */
+ public function count(): int
+ {
+ return User::where($this->searchWhere)->count();
+ }
+}
\ No newline at end of file
diff --git a/composer.json b/composer.json
index 7ed7add65..6906f2cef 100644
--- a/composer.json
+++ b/composer.json
@@ -54,7 +54,6 @@
"ext-bcmath": "*",
"jpush/jpush": "^3.6",
"workerman/crontab": "^1.0",
- "hg/apidoc": "^5.2",
"intervention/image": "^3.6",
"picqer/php-barcode-generator": "^2.4"
},
diff --git a/composer.lock b/composer.lock
index 2b148506f..6d7daedd7 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "8c97deb23217033cd0ab2cb6e5b5d195",
+ "content-hash": "974978f64812f55d8825aabadc43739f",
"packages": [
{
"name": "aliyuncs/oss-sdk-php",
@@ -1240,75 +1240,6 @@
],
"time": "2023-12-03T19:50:20+00:00"
},
- {
- "name": "hg/apidoc",
- "version": "v5.2.3",
- "source": {
- "type": "git",
- "url": "https://github.com/HGthecode/apidoc-php.git",
- "reference": "328aa4fe177ed7393f680724bf3eeb485052c2fe"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/HGthecode/apidoc-php/zipball/328aa4fe177ed7393f680724bf3eeb485052c2fe",
- "reference": "328aa4fe177ed7393f680724bf3eeb485052c2fe",
- "shasum": ""
- },
- "require": {
- "doctrine/annotations": "^1 || ^2",
- "php": "^7.1 || ^8.0"
- },
- "type": "library",
- "extra": {
- "laravel": {
- "providers": [
- "hg\\apidoc\\providers\\LaravelService"
- ]
- },
- "think": {
- "services": [
- "hg\\apidoc\\providers\\ThinkPHPService"
- ],
- "config": {
- "apidoc": "src/config.php"
- }
- },
- "hyperf": {
- "config": "hg\\apidoc\\ConfigProvider"
- }
- },
- "autoload": {
- "psr-4": {
- "hg\\apidoc\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "hg-code",
- "email": "376401263@qq.com"
- }
- ],
- "description": "根据注解生成API文档,兼容Laravel、ThinkPHP、Hyperf、Webman等框架;在线调试、Markdown文档、多应用/多版本、Mock数据、授权访问、接口生成器、代码生成器等众多实用功能",
- "keywords": [
- "apidoc",
- "api文档",
- "markdown",
- "php接口文档",
- "接口文档",
- "注解",
- "注释生成",
- "自动生成api"
- ],
- "support": {
- "issues": "https://github.com/HGthecode/apidoc-php/issues",
- "source": "https://github.com/HGthecode/apidoc-php/tree/v5.2.3"
- },
- "time": "2024-03-22T02:25:31+00:00"
- },
{
"name": "hyperf/context",
"version": "v3.1.15",
diff --git a/config/plugin/hg/apidoc/app.php b/config/plugin/hg/apidoc/app.php
deleted file mode 100644
index 6af1865fc..000000000
--- a/config/plugin/hg/apidoc/app.php
+++ /dev/null
@@ -1,105 +0,0 @@
- true,
- 'apidoc' => [
- // (选配)文档标题,显示在左上角与首页
- 'title' => '接口文档',
- // (选配)文档描述,显示在首页
- 'desc' => '',
- // (必须)设置文档的应用/版本
- 'apps' => [
- [
- // (必须)标题
- 'title' => 'store接口',
- // (必须)控制器目录地址
- 'path' => 'app\store\controller',
- // (必须)唯一的key
- 'key' => 'storeApi',
- ],
- [
- // (必须)标题
- 'title' => 'api接口',
- // (必须)控制器目录地址
- 'path' => 'app\api\controller',
- // (必须)唯一的key
- 'key' => 'apiApi',
- ]
- ],
- // (必须)指定通用注释定义的文件地址
- 'definitions' => "app\common\controller\Definitions",
- // (必须)自动生成url规则,当接口不添加@Apidoc\Url ("xxx")注解时,使用以下规则自动生成
- 'auto_url' => [
- // 字母规则,lcfirst=首字母小写;ucfirst=首字母大写;
- 'letter_rule' => "lcfirst",
- // url前缀
- 'prefix' => "",
- ],
- // (选配)是否自动注册路由
- 'auto_register_routes' => true,
- // (必须)缓存配置
- 'cache' => [
- // 是否开启缓存
- 'enable' => false,
- ],
- // (必须)权限认证配置
- 'auth' => [
- // 是否启用密码验证
- 'enable' => true,
- // 全局访问密码
- 'password' => "qwe123",
- // 密码加密盐
- 'secret_key' => "qwe123",
- // 授权访问后的有效期
- 'expire' => 86400 * 7
- ],
- // 全局参数
- 'params' => [
- // (选配)全局的请求Header
- 'header' => [
- // name=字段名,type=字段类型,require=是否必须,default=默认值,desc=字段描述
- ['name' => 'Authorization', 'type' => 'string', 'require' => true, 'desc' => '身份令牌Token'],
- ],
- // (选配)全局的请求Query
- 'query' => [
- // 同上 header
- ],
- // (选配)全局的请求Body
- 'body' => [
- // 同上 header
- ],
- ],
- // 全局响应体
- 'responses' => [
- // 成功响应体
- 'success' => [
- ['name' => 'code', 'desc' => '业务代码', 'type' => 'int', 'require' => 1],
- ['name' => 'message', 'desc' => '业务信息', 'type' => 'string', 'require' => 1],
- //参数同上 headers;main=true来指定接口Returned参数挂载节点
- ['name' => 'data', 'desc' => '业务数据', 'main' => true, 'type' => 'object', 'require' => 1],
- ],
- // 异常响应体
- 'error' => [
- ['name' => 'code', 'desc' => '业务代码', 'type' => 'int', 'require' => 1, 'md' => '/docs/HttpError.md'],
- ['name' => 'message', 'desc' => '业务信息', 'type' => 'string', 'require' => 1],
- ]
- ],
- //(选配)默认作者
- 'default_author' => '',
- //(选配)默认请求类型
- 'default_method' => 'GET',
- //(选配)Apidoc允许跨域访问
- 'allowCrossDomain' => false,
- /**
- * (选配)解析时忽略带@注解的关键词,当注解中存在带@字符并且非Apidoc注解,如 @key test,此时Apidoc页面报类似以下错误时:
- * [Semantical Error] The annotation "@key" in method xxx() was never imported. Did you maybe forget to add a "use" statement for this annotation?
- */
- 'ignored_annitation' => [],
-
- // (选配)数据库配置
- 'database' => [],
- // (选配)Markdown文档
- 'docs' => [],
- // (选配)接口生成器配置 注意:是一个二维数组
- 'generator' => []
- ]
-];
diff --git a/config/plugin/hg/apidoc/route.php b/config/plugin/hg/apidoc/route.php
deleted file mode 100644
index 1b03a1f35..000000000
--- a/config/plugin/hg/apidoc/route.php
+++ /dev/null
@@ -1,3 +0,0 @@
- array($vendorDir . '/topthink/think-container/src', $vendorDir . '/topthink/think-helper/src', $vendorDir . '/topthink/think-orm/src'),
'taoser\\' => array($vendorDir . '/taoser/webman-validate/src'),
'support\\' => array($vendorDir . '/workerman/webman-framework/src/support'),
- 'hg\\apidoc\\' => array($vendorDir . '/hg/apidoc/src'),
'app\\View\\Components\\' => array($baseDir . '/app/view/components'),
'app\\' => array($baseDir . '/app'),
'ZipStream\\' => array($vendorDir . '/maennchen/zipstream-php/src'),
diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php
index b4a008779..e2aa1e0ff 100644
--- a/vendor/composer/autoload_static.php
+++ b/vendor/composer/autoload_static.php
@@ -57,10 +57,6 @@ class ComposerStaticInitcefecbcff919f3c1c8084830bbb72adc
array (
'support\\' => 8,
),
- 'h' =>
- array (
- 'hg\\apidoc\\' => 10,
- ),
'a' =>
array (
'app\\View\\Components\\' => 20,
@@ -247,10 +243,6 @@ class ComposerStaticInitcefecbcff919f3c1c8084830bbb72adc
array (
0 => __DIR__ . '/..' . '/workerman/webman-framework/src/support',
),
- 'hg\\apidoc\\' =>
- array (
- 0 => __DIR__ . '/..' . '/hg/apidoc/src',
- ),
'app\\View\\Components\\' =>
array (
0 => __DIR__ . '/../..' . '/app/view/components',
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index 7c04a8972..fc3ca9341 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -1282,78 +1282,6 @@
],
"install-path": "../guzzlehttp/uri-template"
},
- {
- "name": "hg/apidoc",
- "version": "v5.2.3",
- "version_normalized": "5.2.3.0",
- "source": {
- "type": "git",
- "url": "https://github.com/HGthecode/apidoc-php.git",
- "reference": "328aa4fe177ed7393f680724bf3eeb485052c2fe"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/HGthecode/apidoc-php/zipball/328aa4fe177ed7393f680724bf3eeb485052c2fe",
- "reference": "328aa4fe177ed7393f680724bf3eeb485052c2fe",
- "shasum": ""
- },
- "require": {
- "doctrine/annotations": "^1 || ^2",
- "php": "^7.1 || ^8.0"
- },
- "time": "2024-03-22T02:25:31+00:00",
- "type": "library",
- "extra": {
- "laravel": {
- "providers": [
- "hg\\apidoc\\providers\\LaravelService"
- ]
- },
- "think": {
- "services": [
- "hg\\apidoc\\providers\\ThinkPHPService"
- ],
- "config": {
- "apidoc": "src/config.php"
- }
- },
- "hyperf": {
- "config": "hg\\apidoc\\ConfigProvider"
- }
- },
- "installation-source": "dist",
- "autoload": {
- "psr-4": {
- "hg\\apidoc\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "hg-code",
- "email": "376401263@qq.com"
- }
- ],
- "description": "根据注解生成API文档,兼容Laravel、ThinkPHP、Hyperf、Webman等框架;在线调试、Markdown文档、多应用/多版本、Mock数据、授权访问、接口生成器、代码生成器等众多实用功能",
- "keywords": [
- "apidoc",
- "api文档",
- "markdown",
- "php接口文档",
- "接口文档",
- "注解",
- "注释生成",
- "自动生成api"
- ],
- "support": {
- "issues": "https://github.com/HGthecode/apidoc-php/issues",
- "source": "https://github.com/HGthecode/apidoc-php/tree/v5.2.3"
- },
- "install-path": "../hg/apidoc"
- },
{
"name": "hyperf/context",
"version": "v3.1.15",
diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php
index 43e1d6ee2..83a57723f 100644
--- a/vendor/composer/installed.php
+++ b/vendor/composer/installed.php
@@ -1,9 +1,9 @@
array(
'name' => 'workerman/webman',
- 'pretty_version' => 'dev-main',
- 'version' => 'dev-main',
- 'reference' => '4b5122f1ac239cde50650106617717ac4ed3db2b',
+ 'pretty_version' => '1.0.0+no-version-set',
+ 'version' => '1.0.0.0',
+ 'reference' => null,
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -154,15 +154,6 @@
'aliases' => array(),
'dev_requirement' => false,
),
- 'hg/apidoc' => array(
- 'pretty_version' => 'v5.2.3',
- 'version' => '5.2.3.0',
- 'reference' => '328aa4fe177ed7393f680724bf3eeb485052c2fe',
- 'type' => 'library',
- 'install_path' => __DIR__ . '/../hg/apidoc',
- 'aliases' => array(),
- 'dev_requirement' => false,
- ),
'hyperf/context' => array(
'pretty_version' => 'v3.1.15',
'version' => '3.1.15.0',
@@ -1038,9 +1029,9 @@
'dev_requirement' => false,
),
'workerman/webman' => array(
- 'pretty_version' => 'dev-main',
- 'version' => 'dev-main',
- 'reference' => '4b5122f1ac239cde50650106617717ac4ed3db2b',
+ 'pretty_version' => '1.0.0+no-version-set',
+ 'version' => '1.0.0.0',
+ 'reference' => null,
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
diff --git a/vendor/hg/apidoc/.gitignore b/vendor/hg/apidoc/.gitignore
deleted file mode 100644
index 485dee64b..000000000
--- a/vendor/hg/apidoc/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-.idea
diff --git a/vendor/hg/apidoc/LICENSE b/vendor/hg/apidoc/LICENSE
deleted file mode 100644
index 367a697be..000000000
--- a/vendor/hg/apidoc/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2022 HG
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
\ No newline at end of file
diff --git a/vendor/hg/apidoc/README.md b/vendor/hg/apidoc/README.md
deleted file mode 100644
index 0f8ace596..000000000
--- a/vendor/hg/apidoc/README.md
+++ /dev/null
@@ -1,88 +0,0 @@
-
-

-
-
-
- Apidoc
-
-
-
- 基于PHP的注解生成API文档及Api接口开发工具
-
-
-
-
-
-## 🤷♀️ Apidoc是什么?
-
-Apidoc是一个通过解析注解生成Api接口文档的PHP composer扩展,兼容Laravel、ThinkPHP、Hyperf、Webman等框架;
-全面的注解引用、数据表字段引用,简单的注解即可生成Api文档,而Apidoc不仅于接口文档,在线接口调试、Mock调试数据、调试事件处理、Json/TypeScript生成、接口生成器、代码生成器等诸多实用功能,致力于提高Api接口开发效率。
-
-
-## ✨特性
-
-- 开箱即用:无繁杂的配置、安装后按文档编写注释即可自动生成API文档。
-- 轻松编写:支持通用注释引用、业务逻辑层、数据表字段的引用,几句注释即可完成。
-- 在线调试:在线文档可直接调试,并支持全局请求/Mock参数/事件处理,接口调试省时省力。
-- 安全高效:支持访问密码验证、应用/版本独立密码;支持文档缓存。
-- 多应用/多版本:可适应各种单应用、多应用、多版本的项目的Api管理。
-- 分组/Tag:可对控制器/接口进行多级分组或定义Tag。
-- Markdown文档:支持.md文件的文档展示。
-- Json/TypeScript生成:文档自动生成接口的Json及TypeScript。
-- 代码生成器:配置+模板即可快速生成代码及数据表的创建,大大提高工作效率。
-
-
-## 📌兼容
-
-以下框架已内置兼容,可开箱即用
-
-|框架|版本|
-|-|-|-|
-|ThinkPHP|5.1、6.x、8.x|
-|Laravel|8.x、9.x、10.x|
-|Webman|1.x|
-|Hyperf|2.x、3.x|
-
-
-## 📖使用文档
-
-[https://docs.apidoc.icu](https://docs.apidoc.icu/)
-
-[https://hg-code.gitee.io/apidoc-php/](https://hg-code.gitee.io/apidoc-php/)
-
-## 🏆支持我们
-
-如果本项目对您有所帮助,请点个Star支持我们
-
-- [Github](https://github.com/HGthecode/apidoc-php) ->
-
-
-- [Gitee](https://gitee.com/hg-code/apidoc-php) ->
-
-
-## 🌐交流群
-
-
-
-
-
-## 💡鸣谢
-
-doctrine/annotations
-
-
-## 🔗链接
- ApiDoc UI
-
- ApiDoc Demo
-
-
diff --git a/vendor/hg/apidoc/composer.json b/vendor/hg/apidoc/composer.json
deleted file mode 100644
index fef0c0abd..000000000
--- a/vendor/hg/apidoc/composer.json
+++ /dev/null
@@ -1,50 +0,0 @@
-{
- "name": "hg/apidoc",
- "description": "根据注解生成API文档,兼容Laravel、ThinkPHP、Hyperf、Webman等框架;在线调试、Markdown文档、多应用/多版本、Mock数据、授权访问、接口生成器、代码生成器等众多实用功能",
- "keywords": [
- "apidoc",
- "api文档",
- "接口文档",
- "自动生成api",
- "注释生成",
- "php接口文档",
- "api文档",
- "Markdown",
- "注解"
- ],
- "require": {
- "php": "^7.1 || ^8.0",
- "doctrine/annotations": "^1 || ^2"
- },
- "license": "MIT",
- "authors": [
- {
- "name": "hg-code",
- "email": "376401263@qq.com"
- }
- ],
- "autoload": {
- "psr-4": {
- "hg\\apidoc\\": "src/"
- }
- },
- "extra": {
- "laravel": {
- "providers": [
- "hg\\apidoc\\providers\\LaravelService"
- ]
- },
- "think": {
- "services": [
- "hg\\apidoc\\providers\\ThinkPHPService"
- ],
- "config": {
- "apidoc": "src/config.php"
- }
- },
- "hyperf": {
- "config": "hg\\apidoc\\ConfigProvider"
- }
- },
- "minimum-stability": "dev"
-}
diff --git a/vendor/hg/apidoc/src/Auth.php b/vendor/hg/apidoc/src/Auth.php
deleted file mode 100644
index b86686a5f..000000000
--- a/vendor/hg/apidoc/src/Auth.php
+++ /dev/null
@@ -1,192 +0,0 @@
-authConfig = $authConfig;
- }
-
- /**
- * 验证密码是否正确
- * @param $password
- * @return false|string
- */
- public function verifyAuth(string $password, string $appKey)
- {
- $authConfig = $this->authConfig;
- if (!empty($appKey)) {
- $currentAppConfig = Helper::getCurrentAppConfig($appKey);
- $currentApp = $currentAppConfig['appConfig'];
- if (!empty($currentApp) && !empty($currentApp['password'])) {
- // 应用密码
- if (md5($currentApp['password']) === $password) {
- return $this->createToken($currentApp['password'],$authConfig['expire']);
- }
- throw new ErrorException("password error");
- }
- }
- if ($authConfig['enable']) {
- // 密码验证
- if (md5($authConfig['password']) === $password) {
- return $this->createToken($authConfig['password'],$authConfig['expire']);
- }
- throw new ErrorException("password error");
- }
- return false;
- }
-
- /**
- * 验证token是否可用
- * @param $request
- * @return bool
- */
- public function checkAuth($params=[]): bool
- {
- $authConfig = $this->authConfig;
- $token = !empty($params['token'])?$params['token']:"";
- $appKey = !empty($params['appKey'])?$params['appKey']:"";
- if (!empty($appKey)) {
- $currentAppConfig = Helper::getCurrentAppConfig($appKey);
- $currentApp = $currentAppConfig['appConfig'];
- if (!empty($currentApp) && !empty($currentApp['password'])) {
- if (empty($token)) {
- throw new ErrorException("token not found");
- }
- // 应用密码
- if ($this->checkToken($token, $currentApp['password'])) {
- return true;
- } else {
- throw new ErrorException("token error");
- }
- } else if (empty($authConfig['enable'])) {
- return true;
- }
- }
- if($authConfig['enable'] && empty($token)){
- throw new ErrorException("token not found");
- }else if (!empty($token) && !$this->checkToken($token, "") && $authConfig['enable']) {
- throw new ErrorException("token error");
- }
- return true;
- }
-
-
- /**
- * 获取tokencode
- * @param string $password
- * @return string
- */
- protected static function getTokenCode(string $password): string
- {
- return md5(md5($password));
- }
-
-
- /**
- * 创建token
- * @param string $password
- * @return string
- */
- public function createToken(string $password): string
- {
- $authConfig = $this->authConfig;
- $data = [
- 'key'=>static::getTokenCode($password),
- 'expire'=>time()+$authConfig['expire']
- ];
- $code = json_encode($data);
- return static::handleToken($code, "CE",$authConfig['secret_key']);
- }
-
- /**
- * 验证token是否可用
- * @param $token
- * @return bool
- */
- public function checkToken(string $token, string $password): bool
- {
- $authConfig = $this->authConfig;
- if (empty($password)){
- $password = $authConfig['password'];
- }
- $decode = static::handleToken($token, "DE",$authConfig['secret_key']);
- $deData = json_decode($decode,true);
-
- if (!empty($deData['key']) && $deData['key'] === static::getTokenCode($password) && !empty($deData['expire']) && $deData['expire']>time()){
- return true;
- }
-
- return false;
- }
-
-
-
- /**
- * 处理token
- * @param $string
- * @param string $operation
- * @param string $key
- * @param int $expiry
- * @return false|string
- */
- protected static function handleToken(string $string, string $operation = 'DE', string $key = '', int $expiry = 0):string
- {
- $ckey_length = 4;
- $key = md5($key);
- $keya = md5(substr($key, 0, 16));
- $keyb = md5(substr($key, 16, 16));
- $keyc = $ckey_length ? ($operation == 'DE' ? substr($string, 0, $ckey_length) : substr(md5(microtime()), -$ckey_length)) : '';
- $cryptkey = $keya . md5($keya . $keyc);
- $key_length = strlen($cryptkey);
- $string = $operation == 'DE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0) . substr(md5($string . $keyb), 0, 16) . $string;
- $string_length = strlen($string);
- $result = '';
- $box = range(0, 255);
- $rndkey = array();
- for ($i = 0; $i <= 255; $i++) {
- $rndkey[$i] = ord($cryptkey[$i % $key_length]);
- }
- for ($j = $i = 0; $i < 256; $i++) {
- $j = ($j + $box[$i] + $rndkey[$i]) % 256;
- $tmp = $box[$i];
- $box[$i] = $box[$j];
- $box[$j] = $tmp;
- }
- for ($a = $j = $i = 0; $i < $string_length; $i++) {
- $a = ($a + 1) % 256;
- $j = ($j + $box[$a]) % 256;
- $tmp = $box[$a];
- $box[$a] = $box[$j];
- $box[$j] = $tmp;
- $result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));
- }
- if ($operation == 'DE') {
- $subNumber = (int)substr($result, 0, 10);
- if (($subNumber == 0 || $subNumber - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26) . $keyb), 0, 16)) {
- return substr($result, 26);
- } else {
- return '';
- }
- } else {
- return $keyc . str_replace('=', '', base64_encode($result));
- }
- }
-
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/ConfigProvider.php b/vendor/hg/apidoc/src/ConfigProvider.php
deleted file mode 100644
index f8f007c57..000000000
--- a/vendor/hg/apidoc/src/ConfigProvider.php
+++ /dev/null
@@ -1,24 +0,0 @@
- [],
- 'publish' => [
- [
- 'id' => 'config',
- 'description' => 'The config of apidoc.',
- 'source' => __DIR__ . '/config.php',
- 'destination' => BASE_PATH . '/config/autoload/apidoc.php',
- ],
- ],
- ];
- }
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/Controller.php b/vendor/hg/apidoc/src/Controller.php
deleted file mode 100644
index 479f77339..000000000
--- a/vendor/hg/apidoc/src/Controller.php
+++ /dev/null
@@ -1,451 +0,0 @@
-config = ConfigProvider::get();
- if (isset($this->config['enable']) && $this->config['enable'] === false) {
- throw new ErrorException("apidoc close");
- }
- if (!empty($this->config['request_params'])) {
- $this->requestParams = $this->config['request_params'];
- } else {
- $this->requestParams = (new Request())->param();
- }
- if (!empty($this->requestParams['lang']) && !empty($this->config['lang_register_function'])) {
- $this->lang = $this->requestParams['lang'];
- $this->config['lang_register_function']($this->lang);
- }
- if ($checkAuth) {
- (new Auth($this->config))->checkAuth($this->requestParams);
- }
- }
-
- /**
- * 验证权限
- * @param $config
- * @param $params
- */
- protected function checkAuth()
- {
- $config = $this->config;
- $params = $this->requestParams;
- if (!empty($params['shareKey'])) {
- //分享
- $shareData = (new ApiShare())->checkShareAuth($config, $params);
- $appKey = !empty($params['appKey']) ? $params['appKey'] : "";
- if (!empty($shareData['appKeys']) && !in_array($appKey, $shareData['appKeys'])) {
- throw new ErrorException("share not exists");
- }
- return $shareData;
- } else {
- (new Auth($config))->checkAuth($params);
- }
- }
-
-
- /**
- * 获取配置
- * @return \think\response\Json
- */
- public function getConfig()
- {
- $this->init(false);
- $params = $this->requestParams;
- if (!empty($params['shareKey'])) {
- // 接口分享
- $shareData = (new ApiShare())->checkShareAuth($this->config, $params);
- if (!empty($shareData['appKeys'])) {
- $config = ConfigProvider::getFeConfig($shareData['appKeys']);
- } else {
- $config = ConfigProvider::getFeConfig();
- }
- } else {
- (new Auth($this->config))->checkAuth($params);
- $config = ConfigProvider::getFeConfig();
- }
- return Helper::showJson(0, "", $config);
- }
-
- /**
- * 验证密码
- */
- public function verifyAuth()
- {
- $this->init();
- $config = $this->config;
- $params = $this->requestParams;
- if (empty($params['password'])) {
- throw new ErrorException("password not found");
- }
- $appKey = !empty($params['appKey']) ? $params['appKey'] : "";
- if (!empty($params['shareKey'])) {
- // 接口分享
- $shareData = (new ApiShare())->getShareDetailByKey($params['shareKey']);
- if (!empty($shareData['password']) && $params['password'] === md5($shareData['password'])) {
- $hasAuth = (new Auth($config))->createToken($params['password']);
- } else {
- throw new ErrorException("password error");
- }
- } else {
- if (!$appKey && !(!empty($config['auth']) && $config['auth']['enable'])) {
- throw new ErrorException("password error");
- }
- $hasAuth = (new Auth($config))->verifyAuth($params['password'], $appKey);
- }
- $res = [
- "token" => $hasAuth
- ];
- return Helper::showJson(0, "", $res);
- }
-
- /**
- * 获取api文档菜单
- */
- public function getApiMenus()
- {
- $this->init(false);
- $config = $this->config;
- $params = $this->requestParams;
- if (empty($params['appKey'])) {
- throw new ErrorException("appkey not found");
- }
- $appKey = $params['appKey'];
- $shareData = $this->checkAuth();
- $currentAppConfig = Helper::getCurrentAppConfig($appKey);
- $currentApp = $currentAppConfig['appConfig'];
- $apiData = $this->getApiMenusByAppKey($appKey);
- $groups = !empty($currentApp['groups']) ? $currentApp['groups'] : [];
- if (!empty($params['shareKey']) && $shareData['type'] == 'api') {
- $apiData['data'] = Helper::filterTreeNodesByKeys($apiData['data'], $shareData['apiKeys'], 'menuKey');
- }
- $json = [
- 'data' => $apiData['data'],
- 'app' => $currentApp,
- 'groups' => $groups,
- 'tags' => $apiData['tags'],
- ];
- return Helper::showJson(0, "", $json);
- }
-
- protected function getApiMenusByAppKey($appKey)
- {
- $config = $this->config;
- if (!empty($config['cache']) && $config['cache']['enable']) {
- $cacheKey = Helper::getCacheKey('apiMenu', $appKey, $this->lang);
- $cacheData = (new Cache())->get($cacheKey);
- if ($cacheData && empty($params['reload'])) {
- $apiData = $cacheData;
- } else {
- // 生成数据并缓存
- $apiData = (new ParseApiMenus($config))->renderApiMenus($appKey);
- (new Cache())->set($cacheKey, $apiData);
- }
- } else {
- // 生成数据
- $apiData = (new ParseApiMenus($config))->renderApiMenus($appKey);
- }
- return $apiData;
- }
-
-
- /**
- * 获取所有api文档菜单
- */
- public function getAllApiMenus()
- {
- $this->init(true);
- $config = $this->config;
- $params = $this->requestParams;
- $configApps = Helper::handleAppsConfig($config['apps'], false, $config);
- $data = ApiShare::getAppShareApis($config, $configApps, "", [], false);
- return Helper::showJson(0, "", $data);
- }
-
- /**
- * 获取接口明细
- * @return array
- */
- public function getApiDetail()
- {
- $this->init(false);
- $config = $this->config;
- $params = $this->requestParams;
- if (empty($params['path'])) {
- throw new ErrorException("path not found");
- }
- $appKey = !empty($params['appKey']) ? $params['appKey'] : "";
- $apiKey = urldecode($params['path']);
- $this->checkAuth();
- if (!empty($config['cache']) && $config['cache']['enable']) {
- $cacheKey = Helper::getCacheKey('apiDetail', $appKey, $this->lang, $params['path']);
- $cacheData = (new Cache())->get($cacheKey);
- if ($cacheData && empty($params['reload'])) {
- $res = $cacheData;
- } else {
- // 生成数据并缓存
- $res = (new ParseApiDetail($config))->renderApiDetail($appKey, $apiKey);
- (new Cache())->set($cacheKey, $res);
- }
- } else {
- // 生成数据
- $res = (new ParseApiDetail($config))->renderApiDetail($appKey, $apiKey);
- }
- $res['appKey'] = $appKey;
- return Helper::showJson(0, "", $res);
- }
-
-
- /**
- * 获取md菜单
- * @return array
- */
- public function getMdMenus()
- {
- $this->init(false);
- $config = $this->config;
- $params = $this->requestParams;
- $appKey = "";
- if (!empty($params['appKey'])) {
- // 获取指定应用
- $appKey = $params['appKey'];
- }
- $this->checkAuth();
- $docs = (new ParseMarkdown($config))->getDocsMenu($appKey, $this->lang);
- return Helper::showJson(0, "", $docs);
-
- }
-
- /**
- * 获取md文档内容
- * @return \think\response\Json
- */
- public function getMdDetail()
- {
- $this->init(false);
- $config = $this->config;
- $params = $this->requestParams;
- $this->checkAuth();
- try {
- if (empty($params['path'])) {
- throw new ErrorException("mdPath not found");
- }
- if (empty($params['appKey'])) {
- throw new ErrorException("appkey not found");
- }
-
- $path = urldecode($params['path']);
- $content = (new ParseMarkdown($config))->getContent($params['appKey'], $path, $this->lang);
- $res = [
- 'content' => $content,
- ];
- return Helper::showJson(0, "", $res);
-
- } catch (ErrorException $e) {
- return Helper::showJson($e->getCode(), $e->getMessage());
- }
- }
-
-
- /**
- * 创建代码生成器
- * @return array
- */
- public function createGenerator()
- {
- $this->init(true);
- $config = $this->config;
- $params = $this->requestParams;
- $res = (new generator\Index($config))->create($params);
- return Helper::showJson(0, "", $res);
- }
-
- /**
- * 删除所有接口缓存
- * @return array
- */
- public function cancelAllCache()
- {
- $this->init(true);
- $config = $this->config;
- $path = APIDOC_STORAGE_PATH . $config['cache']['folder']. '/apis';
- $res = DirAndFile::deleteDir($path);
- return Helper::showJson(0, "", $path);
- }
-
- /**
- * 生成所有接口缓存
- * @return array
- */
- public function createAllCache()
- {
- $this->init(true);
- $config = $this->config;
- $params = $this->requestParams;
- $apps = Helper::getAllApps($config['apps']);
- $cache = new Cache();
- DirAndFile::deleteDir(APIDOC_STORAGE_PATH . $config['cache']['folder'] . '/' . 'apis');
- if (!empty($apps) && count($apps)) {
- try {
- foreach ($apps as $app) {
- // 缓存菜单
- $appKey = $app['appKey'];
- $controllerData = (new ParseApiMenus($config))->renderApiMenus($appKey);
- if (!empty($controllerData['data']) && count($controllerData['data'])) {
- foreach ($controllerData['data'] as $controller) {
- if (!empty($controller['children']) && count($controller['children'])) {
- foreach ($controller['children'] as $item) {
- if (!empty($item['url']) && !empty($item['menuKey'])) {
- $apiDetail = (new ParseApiDetail($config))->renderApiDetail($appKey, urldecode($item['menuKey']));
- $apiDetailCacheKey = Helper::getCacheKey('apiDetail', $appKey, $this->lang, $item['menuKey']);
- $cache->set($apiDetailCacheKey, $apiDetail);
- }
- }
- }
- }
- }
- $cacheKey = Helper::getCacheKey('apiMenu', $appKey, $this->lang);
- $cache->set($cacheKey, $controllerData);
- }
- } catch (\ReflectionException $e) {
- DirAndFile::deleteDir(APIDOC_STORAGE_PATH . $config['cache']['folder'] . '/' . 'apis');
- throw new ErrorException($e->getMessage());
- }
- }
- return Helper::showJson(0, "", true);
- }
-
- /**
- * 生成代码模板内容
- * @return array
- */
- public function renderCodeTemplate()
- {
- $this->init(true);
- $config = $this->config;
- $params = $this->requestParams;
- $code = (new ParseCodeTemplate($config))->renderCode($params);
- return Helper::showJson(0, "", [
- 'code' => $code
- ]);
-
- }
-
-
- /**
- * 添加接口分享
- * @return array
- */
- public function addApiShare()
- {
- $this->init(true);
- $config = $this->config;
- $params = $this->requestParams;
- if (empty($params['name'])) {
- throw new ErrorException('field not found', ['field' => 'name']);
- }
- if (empty($params['type'])) {
- throw new ErrorException('field not found', ['field' => 'type']);
- }
- if ($params['type'] == 'app' && empty($params['appKeys'])) {
- throw new ErrorException('field not found', ['field' => 'appKeys']);
- }
- if ($params['type'] == 'api' && empty($params['apiKeys'])) {
- throw new ErrorException('field not found', ['field' => 'apiKeys']);
- }
- $res = (new ApiShare())->addApiShare($params);
- return Helper::showJson(0, "", $res);
- }
-
- /**
- * 获取接口分享分页列表
- * @return array
- */
- public function getApiShareList()
- {
- $this->init(true);
- $config = $this->config;
- $params = $this->requestParams;
- $pageIndex = !empty($params['pageIndex']) ? $params['pageIndex'] : 1;
- $pageSize = 5;
- $res = (new ApiShare())->getSharePageList($config, $pageIndex, $pageSize);
- return Helper::showJson(0, "", $res);
- }
-
- /**
- * 获取接口分享记录明细
- * @return array
- */
- public function getApiShareDetail()
- {
- $this->init(true);
- $config = $this->config;
- $params = $this->requestParams;
- if (empty($params['key'])) {
- throw new ErrorException('field not found', ['field' => 'key']);
- }
- $cacheData = (new ApiShare())->getShareDetailByKey($params['key']);
- return Helper::showJson(0, "", $cacheData);
- }
-
- /**
- * 删除接口分享记录
- * @return array
- */
- public function deleteApiShare()
- {
- $this->init(true);
- $config = $this->config;
- $params = $this->requestParams;
- if (empty($params['key'])) {
- throw new ErrorException('field not found', ['field' => 'key']);
- }
- $cacheKey = ApiShare::getShareCacheKey($params['key']);
- $res = (new Cache())->delete($cacheKey);
- return Helper::showJson(0, "", $res);
- }
-
- /**
- * 处理接口分享操作
- * @return array
- */
- public function handleApiShareAction()
- {
- $this->init(true);
- $config = $this->config;
- $params = $this->requestParams;
- if (empty($params['key'])) {
- throw new ErrorException('field not found', ['field' => 'key']);
- }
- if (!isset($params['index'])) {
- throw new ErrorException('field not found', ['field' => 'index']);
- }
- $res = (new ApiShare())->handleApiShareAction($config, $params['key'], $params['index']);
- return Helper::showJson(0, "", $res);
- }
-
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/Install.php b/vendor/hg/apidoc/src/Install.php
deleted file mode 100644
index af693184c..000000000
--- a/vendor/hg/apidoc/src/Install.php
+++ /dev/null
@@ -1,56 +0,0 @@
- 'config/plugin/hg/apidoc',
- );
-
- /**
- * Install
- * @return void
- */
- public static function install()
- {
- foreach (static::$configPath as $source => $dest) {
- if ($pos = strrpos($dest, '/')) {
- $parent_dir = base_path() . '/' . substr($dest, 0, $pos);
- if (!is_dir($parent_dir)) {
- mkdir($parent_dir, 0777, true);
- }
- }
- //symlink(__DIR__ . "/$source", base_path()."/$dest");
- copy_dir(__DIR__ . "/$source", base_path() . "/$dest");
- echo "Create $dest";
- }
- }
-
- /**
- * Uninstall
- * @return void
- */
- public static function uninstall()
- {
- foreach (static::$configPath as $source => $dest) {
- $path = base_path()."/$dest";
- if (!is_dir($path) && !is_file($path)) {
- continue;
- }
- echo "Remove $dest";
- if (is_file($path) || is_link($path)) {
- unlink($path);
- continue;
- }
- remove_dir($path);
- }
- }
-
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/annotation/AddField.php b/vendor/hg/apidoc/src/annotation/AddField.php
deleted file mode 100644
index 2f4450de1..000000000
--- a/vendor/hg/apidoc/src/annotation/AddField.php
+++ /dev/null
@@ -1,84 +0,0 @@
- 'Apidoc',
- // (选配)文档描述,显示在首页
- 'desc' => '',
- // (必须)设置文档的应用/版本
- 'apps' => [
- [
- // (必须)标题
- 'title'=>'Api接口',
- // (必须)控制器目录地址
- 'path'=>'app\controller',
- // (必须)唯一的key
- 'key'=>'api',
- ]
- ],
-
- // (必须)指定通用注释定义的文件地址
- 'definitions' => "app\common\controller\Definitions",
- // (必须)自动生成url规则,当接口不添加@Apidoc\Url ("xxx")注解时,使用以下规则自动生成
- 'auto_url' => [
- // 字母规则,lcfirst=首字母小写;ucfirst=首字母大写;
- 'letter_rule' => "lcfirst",
- // url前缀
- 'prefix'=>"",
- ],
- // 是否自动注册路由
- 'auto_register_routes'=>false,
- // (必须)缓存配置
- 'cache' => [
- // 是否开启缓存
- 'enable' => false,
- ],
- // (必须)权限认证配置
- 'auth' => [
- // 是否启用密码验证
- 'enable' => false,
- // 全局访问密码
- 'password' => "123456",
- // 密码加密盐
- 'secret_key' => "apidoc#hg_code",
- // 授权访问后的有效期
- 'expire' => 24*60*60
- ],
- // 全局参数
- 'params'=>[
- // (选配)全局的请求Header
- 'header'=>[
- // name=字段名,type=字段类型,require=是否必须,default=默认值,desc=字段描述
- ['name'=>'Authorization','type'=>'string','require'=>true,'desc'=>'身份令牌Token'],
- ],
- // (选配)全局的请求Query
- 'query'=>[
- // 同上 header
- ],
- // (选配)全局的请求Body
- 'body'=>[
- // 同上 header
- ],
- ],
- // 全局响应体
- 'responses'=>[
- // 成功响应体
- 'success'=>[
- ['name'=>'code','desc'=>'业务代码','type'=>'int','require'=>1],
- ['name'=>'message','desc'=>'业务信息','type'=>'string','require'=>1],
- //参数同上 headers;main=true来指定接口Returned参数挂载节点
- ['name'=>'data','desc'=>'业务数据','main'=>true,'type'=>'object','require'=>1],
- ],
- // 异常响应体
- 'error'=>[
- ['name'=>'code','desc'=>'业务代码','type'=>'int','require'=>1,'md'=>'/docs/HttpError.md'],
- ['name'=>'message','desc'=>'业务信息','type'=>'string','require'=>1],
- ]
- ],
- // (选配)apidoc路由前缀,默认apidoc
- 'route_prefix'=>'/apidoc',
- //(选配)默认作者
- 'default_author'=>'',
- //(选配)默认请求类型
- 'default_method'=>'GET',
- //(选配)允许跨域访问
- 'allowCrossDomain'=>false,
- /**
- * (选配)解析时忽略带@注解的关键词,当注解中存在带@字符并且非Apidoc注解,如 @key test,此时Apidoc页面报类似以下错误时:
- * [Semantical Error] The annotation "@key" in method xxx() was never imported. Did you maybe forget to add a "use" statement for this annotation?
- */
- 'ignored_annitation'=>[],
-
- // (选配)数据库配置
- 'database'=>[],
- // (选配)Markdown文档
- 'docs' => [],
- // (选配)代码生成器配置 注意:是一个二维数组
- 'generator' =>[],
- // (选配)代码模板
- 'code_template'=>[],
- // (选配)接口分享功能
- 'share'=>[
- // 是否开启接口分享功能
- 'enable'=>false,
- // 自定义接口分享操作,二维数组,每个配置为一个按钮操作
- 'actions'=>[]
- ],
-];
diff --git a/vendor/hg/apidoc/src/config/plugin/hg/apidoc/app.php b/vendor/hg/apidoc/src/config/plugin/hg/apidoc/app.php
deleted file mode 100644
index b9be3a7b0..000000000
--- a/vendor/hg/apidoc/src/config/plugin/hg/apidoc/app.php
+++ /dev/null
@@ -1,97 +0,0 @@
- true,
- 'apidoc' => [
- // (选配)文档标题,显示在左上角与首页
- 'title' => 'Apidoc',
- // (选配)文档描述,显示在首页
- 'desc' => '',
- // (必须)设置文档的应用/版本
- 'apps' => [
- [
- // (必须)标题
- 'title'=>'Api接口',
- // (必须)控制器目录地址
- 'path'=>'app\controller',
- // (必须)唯一的key
- 'key'=>'api',
- ]
- ],
- // (必须)指定通用注释定义的文件地址
- 'definitions' => "app\common\controller\Definitions",
- // (必须)自动生成url规则,当接口不添加@Apidoc\Url ("xxx")注解时,使用以下规则自动生成
- 'auto_url' => [
- // 字母规则,lcfirst=首字母小写;ucfirst=首字母大写;
- 'letter_rule' => "lcfirst",
- // url前缀
- 'prefix'=>"",
- ],
- // (选配)是否自动注册路由
- 'auto_register_routes'=>false,
- // (必须)缓存配置
- 'cache' => [
- // 是否开启缓存
- 'enable' => false,
- ],
- // (必须)权限认证配置
- 'auth' => [
- // 是否启用密码验证
- 'enable' => false,
- // 全局访问密码
- 'password' => "123456",
- // 密码加密盐
- 'secret_key' => "apidoc#hg_code",
- // 授权访问后的有效期
- 'expire' => 24*60*60
- ],
- // 全局参数
- 'params'=>[
- // (选配)全局的请求Header
- 'header'=>[
- // name=字段名,type=字段类型,require=是否必须,default=默认值,desc=字段描述
- ['name'=>'Authorization','type'=>'string','require'=>true,'desc'=>'身份令牌Token'],
- ],
- // (选配)全局的请求Query
- 'query'=>[
- // 同上 header
- ],
- // (选配)全局的请求Body
- 'body'=>[
- // 同上 header
- ],
- ],
- // 全局响应体
- 'responses'=>[
- // 成功响应体
- 'success'=>[
- ['name'=>'code','desc'=>'业务代码','type'=>'int','require'=>1],
- ['name'=>'message','desc'=>'业务信息','type'=>'string','require'=>1],
- //参数同上 headers;main=true来指定接口Returned参数挂载节点
- ['name'=>'data','desc'=>'业务数据','main'=>true,'type'=>'object','require'=>1],
- ],
- // 异常响应体
- 'error'=>[
- ['name'=>'code','desc'=>'业务代码','type'=>'int','require'=>1,'md'=>'/docs/HttpError.md'],
- ['name'=>'message','desc'=>'业务信息','type'=>'string','require'=>1],
- ]
- ],
- //(选配)默认作者
- 'default_author'=>'',
- //(选配)默认请求类型
- 'default_method'=>'GET',
- //(选配)Apidoc允许跨域访问
- 'allowCrossDomain'=>false,
- /**
- * (选配)解析时忽略带@注解的关键词,当注解中存在带@字符并且非Apidoc注解,如 @key test,此时Apidoc页面报类似以下错误时:
- * [Semantical Error] The annotation "@key" in method xxx() was never imported. Did you maybe forget to add a "use" statement for this annotation?
- */
- 'ignored_annitation'=>[],
-
- // (选配)数据库配置
- 'database'=>[],
- // (选配)Markdown文档
- 'docs' => [],
- // (选配)接口生成器配置 注意:是一个二维数组
- 'generator' =>[]
- ]
-];
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/config/plugin/hg/apidoc/route.php b/vendor/hg/apidoc/src/config/plugin/hg/apidoc/route.php
deleted file mode 100644
index 1b03a1f35..000000000
--- a/vendor/hg/apidoc/src/config/plugin/hg/apidoc/route.php
+++ /dev/null
@@ -1,3 +0,0 @@
- ['status'=>404,'code' => 4004, 'msg' => '文档已关闭'],
- 'password error' => ['status'=>402,'code' => 4002, 'msg' => '密码不正确,请重新输入'],
- 'password not found' => ['status'=>402,'code' => 4002, 'msg' => '密码不可为空'],
- 'token error' => ['status'=>401,'code' => 4001, 'msg' => '不合法的Token'],
- 'token not found' => ['status'=>401,'code' => 4001, 'msg' => '不存在Token'],
- 'appkey not found' => ['status'=>412,'code' => 4005, 'msg' => '缺少必要参数appKey'],
- 'mdPath not found' => ['status'=>412,'code' => 4006, 'msg' => '缺少必要参数path'],
- 'appKey error' => ['status'=>412,'code' => 4007, 'msg' => '不存在 key为${appKey}的apps配置'],
- 'template not found' => ['status'=>412,'code' => 4008, 'msg' => '${template}模板不存在'],
- 'path not found' => ['status'=>412,'code' => 4009, 'msg' => '${path}目录不存在'],
- 'classname error' => ['status'=>412,'code' => 4010, 'msg' => '${classname}文件名不合法'],
- 'apiKey not found' => ['status'=>412,'code' => 4011, 'msg' => '缺少必要参数apiKey'],
- 'no config apps' => ['status'=>412,'code' => 5000, 'msg' => 'apps配置不可为空'],
- 'unknown error' => ['status'=>501,'code' => 5000, 'msg' => '未知异常'],
- 'no debug' => ['status'=>412,'code' => 5001, 'msg' => '请在debug模式下,使用该功能'],
- 'no config crud' => ['status'=>412,'code' => 5002, 'msg' => 'crud未配置'],
- 'datatable crud error' => ['status'=>412,'code' => 5003, 'msg' => '数据表创建失败,请检查配置'],
- 'file already exists' => ['status'=>412,'code' => 5004, 'msg' => '${filepath}文件已存在'],
- 'file not exists' => ['status'=>412,'code' => 5005, 'msg' => '${filepath}文件不存在'],
- 'datatable already exists' => ['status'=>412,'code' => 5004, 'msg' => '数据表${table}已存在'],
- 'datatable not exists' => ['status'=>412,'code' => 5004, 'msg' => '数据表${table}不存在'],
- 'ref file not exists' => ['status'=>412,'code' => 5005, 'msg' => 'ref引入 ${path} 文件不存在'],
- 'ref method not exists' => ['status'=>412,'code' => 5005, 'msg' => 'ref引入${path} 中 ${method} 方法不存在'],
- 'datatable create error' => ['status'=>412,'code' => 5006, 'msg' => '数据表[${table}]创建失败,error:${message},sql:${sql}'],
- 'field not found' => ['status'=>412,'code' => 5006, 'msg' => '${field}字段不能为空'],
- 'share not exists' => ['status'=>404,'code' => 4004, 'msg' => '该分享不存在'],
- ];
-
- public function __construct(string $exceptionCode, array $data = [])
- {
- $config = ConfigProvider::get();
- $exception = $this->getException($exceptionCode);
- if ($exception){
- $msg = Helper::replaceTemplate($exception['msg'], $data);
- }else{
- $exception = $this->exceptions['unknown error'];
- $msg = $exceptionCode;
- }
- parent::__construct($exception['status'], $msg, null, [], $exception['code']);
-
- }
-
- public function getException($exceptionCode)
- {
- if (isset($this->exceptions[$exceptionCode])) {
- return $this->exceptions[$exceptionCode];
- }
- return null;
- }
-
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/exception/HttpException.php b/vendor/hg/apidoc/src/exception/HttpException.php
deleted file mode 100644
index 9d29f371b..000000000
--- a/vendor/hg/apidoc/src/exception/HttpException.php
+++ /dev/null
@@ -1,33 +0,0 @@
-statusCode = $statusCode;
- $this->headers = $headers;
-
- parent::__construct($message, $code, $previous);
- }
-
- public function getStatusCode()
- {
- return $this->statusCode;
- }
-
- public function getHeaders()
- {
- return $this->headers;
- }
-}
diff --git a/vendor/hg/apidoc/src/generator/Index.php b/vendor/hg/apidoc/src/generator/Index.php
deleted file mode 100644
index dbfc970eb..000000000
--- a/vendor/hg/apidoc/src/generator/Index.php
+++ /dev/null
@@ -1,358 +0,0 @@
- '',
- // 数据库编码,默认为utf8
- 'charset' => 'utf8',
- // 数据库引擎,默认为 InnoDB
- 'engine' => 'InnoDB',
- ];
-
- protected $systemDefaultValues = [
- 'CURRENT_TIMESTAMP'
- ];
-
- public function __construct($config)
- {
- $this->config = $config;
- if (!empty($config['database'])){
- if (!empty($config['database']['prefix'])){
- $this->databaseConfig['prefix'] = $config['database']['prefix'];
- }
- if (!empty($config['database']['charset'])){
- $this->databaseConfig['charset'] = $config['database']['charset'];
- }
- if (!empty($config['database']['engine'])){
- $this->databaseConfig['engine'] = $config['database']['engine'];
- }
- }
- }
-
- public function create($params){
- $appKey = $params['form']['appKey'];
- $currentAppConfig = Helper::getCurrentAppConfig($appKey);
- $currentApps = $currentAppConfig['apps'];
- $currentApp = $currentAppConfig['appConfig'];
- $generatorItem = $this->config['generator'][$params['index']];
-
- $checkParams = $this->checkFilesAndHandleParams($generatorItem,$params,$currentApps);
- $tplParams = $checkParams['tplParams'];
- // 注册中间件并执行before
- if (!empty($generatorItem['middleware']) && count($generatorItem['middleware'])){
- foreach ($generatorItem['middleware'] as $middleware) {
- $instance = new $middleware;
- $this->middlewares[] = $instance;
- if (method_exists($instance, 'before')) {
- $middlewareRes = $instance->before($tplParams);
- if (!empty($middlewareRes)){
- $tplParams = $middlewareRes;
- }
- }
- }
- }
-
- $this->createModels($checkParams['createModels'],$tplParams);
- $this->createFiles($checkParams['createFiles'],$tplParams);
- //执行after
- if (count($this->middlewares)){
- foreach ($this->middlewares as $middleware) {
- if (method_exists($instance, 'after')) {
- $instance->after($tplParams);
- }
- }
- }
- return $tplParams;
- }
-
- /**
- * 验证文件及处理模板数据
- * @param $generatorItem
- * @param $params
- * @param $currentApps
- * @return array
- */
- protected function checkFilesAndHandleParams($generatorItem,$params,$currentApps){
- // 组成模板参数
- $tplParams=[
- 'form'=>$params['form'],
- 'tables'=>$params['tables'],
- 'app'=>$currentApps
- ];
- $createFiles = [];
- if (!empty($params['files']) && count($params['files'])>0) {
- $files = $params['files'];
- foreach ($files as $file) {
- $fileConfig = Helper::getArrayFind($generatorItem['files'], function ($item) use ($file) {
- if ($file['name'] === $item['name']) {
- return true;
- }
- return false;
- });
-
- $filePath = $file['path'];
- if (!empty($fileConfig['namespace'])) {
- $fileNamespace = Helper::replaceCurrentAppTemplate($fileConfig['namespace'], $currentApps);
- $fileNamespace = Helper::replaceTemplate($fileNamespace, $params['form'],"form.");
- } else {
- $fileNamespace = $filePath;
- }
- $fileNamespaceEndStr = substr($fileNamespace, -1);
- if ($fileNamespaceEndStr == '\\') {
- $fileNamespace = substr($fileNamespace, 0, strlen($fileNamespace) - 1);
- }
- $template = Helper::replaceCurrentAppTemplate($fileConfig['template'], $currentApps);
- $template = Helper::replaceTemplate($template, $params['form'],"form.");
- $tplParams[$file['name']] = [
- 'class_name' => $file['value'],
- 'path' => $filePath,
- 'namespace' => $fileNamespace,
- 'template' => $template
- ];
-
- // 验证模板是否存在
- $templatePath =DirAndFile::formatPath( APIDOC_ROOT_PATH . $template,"/");
- if (is_readable($templatePath) == false) {
- throw new ErrorException("template not found", [
- 'template' => $template
- ]);
- }
- // 验证是否已存在生成的文件
- $fileFullPath = DirAndFile::formatPath(APIDOC_ROOT_PATH . $filePath, "/");
- $type = "folder";
- if (strpos($fileFullPath, '.php') !== false) {
- // 路径为php文件,则验证文件是否存在
- if (is_readable($fileFullPath) == false) {
- throw new ErrorException("file not exists", [
- 'filepath' => $filePath
- ]);
- }
- $type = "file";
- } else {
- $fileName = !empty($file['value']) ? $file['value'] : "";
- $fileFullPath = $fileFullPath . "/" . $fileName . ".php";
- if (is_readable($fileFullPath)) {
- throw new ErrorException("file already exists",[
- 'filepath' => DirAndFile::formatPath($filePath) . $fileName . ".php"
- ]);
- }
- }
- $createFiles[] = [
- 'fileFullPath' => $fileFullPath,
- 'template' => $template,
- 'templatePath'=>$templatePath,
- 'type' => $type
- ];
- }
- }
-
- $createModels = $this->checkModels($generatorItem,$tplParams,$currentApps,$params);
- $tplParams['tables'] = $createModels['tables'];
- return [
- 'tplParams'=>$tplParams,
- 'createFiles'=>$createFiles,
- 'createModels' =>$createModels['createModels']
- ];
- }
-
- /**
- * 验证模型及表
- * @param $generatorItem
- * @param $tplParams
- * @return array
- */
- protected function checkModels($generatorItem,$tplParams,$currentApps,$params=[]){
- if (empty($this->config['database_query_function'])){
- throw new ErrorException("not datatable_query_function config");
- }
-
- $res="";
- $tabls = $tplParams['tables'];
- $newTables = [];
- $createModels = [];
- if (!empty($tabls) && count($tabls)){
- foreach ($tabls as $k=>$table) {
- $tableConfig = $generatorItem['table'];
- $fileFullPath="";
- if (!empty($table['model_name'])){
- $namespace = Helper::replaceCurrentAppTemplate($tableConfig['items'][$k]['namespace'], $currentApps);
- $namespace = Helper::replaceTemplate($namespace, $params['form'],"form.");
- $path = Helper::replaceCurrentAppTemplate($tableConfig['items'][$k]['path'], $currentApps);
- $path = Helper::replaceTemplate($path, $params['form'],"form.");
- $template = $tableConfig['items'][$k]['template'];
-
- // 验证模板是否存在
- $templatePath = DirAndFile::formatPath(APIDOC_ROOT_PATH . $template,"/");
- if (is_readable($templatePath) == false) {
- throw new ErrorException("template not found", [
- 'template' => $template
- ]);
- }
- $tplParams['tables'][$k]['class_name'] =$table['model_name'];
- // 验证模型是否已存在
- $fileName = $table['model_name'];
- $fileFullPath = DirAndFile::formatPath(APIDOC_ROOT_PATH.$path). "/" . $fileName . ".php";
- if (is_readable($fileFullPath)) {
- throw new ErrorException("file already exists", [
- 'filepath' => DirAndFile::formatPath($path) . "/" . $fileName . ".php"
- ]);
- }
- }
- // 验证表是否存在
- if ($table['table_name']){
- $table_name = $this->databaseConfig['prefix'].$table['table_name'];
- $isTable = $this->config['database_query_function']('SHOW TABLES LIKE '."'".$table_name."'");
- if ($isTable){
- throw new ErrorException("datatable already exists", [
- 'table' => $table_name
- ]);
- }
- }
- $table['namespace']=$namespace;
- $table['path']=$path;
- $table['model_path']=$path;
- $newTables[]=$table;
- $createModels[]=[
- 'namespace'=>$namespace,
- 'template'=>$template,
- 'path'=>$path,
- 'templatePath' =>$templatePath,
- 'table'=>$table,
- 'fileFullPath'=>$fileFullPath
- ];
- }
- }
- return ['createModels'=>$createModels,'tables'=>$newTables];
-
- }
-
- /**
- * 创建文件
- * @param $createFiles
- * @param $tplParams
- * @return mixed
- */
- protected function createFiles($createFiles,$tplParams){
-
- if (!empty($createFiles) && count($createFiles)>0){
- foreach ($createFiles as $fileItem) {
- $html = (new ParseTemplate())->compile($fileItem['templatePath'],$tplParams);
- if ($fileItem['type'] === "file"){
- // 路径为文件,则添加到该文件
- $pathFileContent = DirAndFile::getFileContent($fileItem['fileFullPath']);
- $content = $pathFileContent."\r\n".$html;
- DirAndFile::createFile($fileItem['fileFullPath'],$content);
- }else{
- DirAndFile::createFile($fileItem['fileFullPath'],$html);
- }
- }
- }
- return $tplParams;
- }
-
- /**
- * 创建模型文件
- * @param $createModels
- * @param $tplParams
- */
- protected function createModels($createModels,$tplParams){
- if (!empty($createModels) && count($createModels)>0){
- foreach ($createModels as $k=>$item) {
- $table = $item['table'];
- if (!empty($table['table_name'])){
- $res = $this->createTable($table);
- }
- if (!empty($table['model_name'])){
- $tplParams['tables'][$k]['class_name'] =$table['model_name'];
- $html = (new ParseTemplate())->compile($item['templatePath'],$tplParams);
- DirAndFile::createFile($item['fileFullPath'],$html);
- }
-
- }
- }
- }
-
- /**
- * 创建数据表
- * @return mixed
- */
- protected function createTable($table){
- $datas = $table['datas'];
- $comment= "";
- if (!empty($table['table_comment'])){
- $comment =$table['table_comment'];
- }
- $table_name = $this->databaseConfig['prefix'].$table['table_name'];
- $table_data = '';
- $main_keys = '';
- $defaultNullTypes = ['timestamp'];
- foreach ($datas as $k=>$item){
- if (!empty($item['not_table_field'])){
- continue;
- }
- $table_field="`".$item['field']."` ".$item['type'];
- if (!empty($item['length'])){
- $table_field.="(".$item['length'].")";
- }
-
- if (!empty($item['main_key'])){
- $main_keys.=$item['field'];
- $table_field.=" NOT NULL";
- }else if (!empty($item['not_null'])){
- $table_field.=" NOT NULL";
- }
- if (!empty($item['incremental']) && !empty($item['main_key'])){
- $table_field.=" AUTO_INCREMENT";
- }
- if (!empty($item['default']) || (isset($item['default']) && $item['default']=="0")){
- $defaultValue = "'".$item['default']."'";
- if (in_array($item['default'],$this->systemDefaultValues)){
- $defaultValue = $item['default'];
- }
- $table_field.=" DEFAULT ".$defaultValue."";
- }else if (!empty($item['main_key']) && !$item['not_null']){
- $table_field.=" DEFAULT NULL";
- }else if (in_array($item['type'],$defaultNullTypes) && empty($item['not_null'])){
- $table_field.=" NULL DEFAULT NULL";
- }
- $fh = $k < (count($datas)-1)?",":"";
- $table_field.=" COMMENT '".$item['desc']."'".$fh;
- $table_data.=$table_field;
- }
- $primaryKey = "";
- if (!empty($main_keys)){
- $table_data.=",";
- $primaryKey = "PRIMARY KEY (`$main_keys`)";
- }
-
- $charset = $this->databaseConfig['charset'];
- $engine = $this->databaseConfig['engine'];
- $sql = "CREATE TABLE IF NOT EXISTS `$table_name` (
- $table_data
- $primaryKey
- ) ENGINE=$engine DEFAULT CHARSET=$charset COMMENT='$comment' AUTO_INCREMENT=1 ;";
-
- try {
- $this->config['database_query_function']($sql);
- return true;
- } catch (\Exception $e) {
- throw new ErrorException("datatable create error", [
- 'table' => $table_name,
- 'message'=>$e->getMessage(),
- 'sql'=>$sql
- ]);
- }
- }
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/generator/ParseTemplate.php b/vendor/hg/apidoc/src/generator/ParseTemplate.php
deleted file mode 100644
index 4839a3c34..000000000
--- a/vendor/hg/apidoc/src/generator/ParseTemplate.php
+++ /dev/null
@@ -1,341 +0,0 @@
-replaceForeach($tplContent,$params);
- $tplContent = $this->replaceParams($tplContent,$params);
- $tplContent = $this->replaceIf($tplContent,$params);
- $tplContent = preg_replace("/\s+\r\n/is", "\r\n", $tplContent);
- return $tplContent;
- }
-
- /**
- * 替换变量
- * @param $tplContent
- * @param $params
- * @return array|string|string[]|null
- */
- protected function replaceParams($tplContent,$params){
- $key = '{$%%}';
- $pattern = '#' . str_replace('%%', '(.+?)' , preg_quote($key, '#')) . '#';
- $tplContent = preg_replace_callback($pattern, function ($matches)use ($params){
- $k = $matches[1];
- if (strpos($k, '(') !== false){
- $tagArr = explode("(", $k);
- $fun = $tagArr[0];
- $k = str_replace(")", "",$tagArr[1] );
- $v = $this->getObjectValueByKeys($params,$k);
- if (empty($v)){
- return "";
- }
- if ($fun === "lower"){
- return Helper::lower($v);
- }else if ($fun === "snake"){
- return Helper::snake($v);
- }else if ($fun === "lcfirst"){
- return lcfirst($v);
- }else if ($fun === "ucfirst"){
- return ucfirst($v);
- }else if ($fun === "count"){
- return count($v);
- }
- }
- $value = $this->getObjectValueByKeys($params,$k);
- if (is_bool($value)){
- return $value==true?'true':'false';
- }else if (is_array($value)){
- return $k;
- }
- return $value;
- }, $tplContent);
- return $tplContent;
- }
-
- /**
- * 替换if内容
- * @param $tplContent
- * @param $params
- * @return array|mixed|string|string[]
- * @throws \Exception
- */
- protected function replaceIf($tplContent,$params){
- $res = [];
- $label = "if";
- $labelList = $this->parseLabel($tplContent,$label);
- if (!empty($labelList) && count($labelList)>0){
- foreach ($labelList as $item) {
- $itemStr =$item;
- $ifChildren= $this->parseLabel($itemStr,$label,"children");
-
- if (!empty($ifChildren) && count($ifChildren)>0){
- foreach ($ifChildren as $ifChild){
- $itemChildrenContent= $this->getIfContent($ifChild);
- $itemStr = str_replace($ifChild, $itemChildrenContent,$itemStr );
- }
- }
- $itemContent= $this->getIfContent($itemStr);
- $tplContent = str_replace($item, $itemContent,$tplContent );
- }
- }
-
- return $tplContent;
- }
- protected function parseForeach($str,$params){
- if (preg_match('#{foreach (.+?) as (.+?)=>(.+?)}#s', $str, $matches)){
- $complete = $matches[0];
- $condition = $matches[1];
- $keyField = str_replace("$", "",$matches[2] );
- $itemField = str_replace("$", "",$matches[3] );
- $conditionKey = str_replace("$", "",$condition );
- $forListData = $this->getObjectValueByKeys($params,$conditionKey);
- $contentStr = str_replace($complete, "",$str);
- $contentStr = substr($contentStr,0,-10);
- return [
- 'list'=>$forListData,
- 'keyField'=>$keyField,
- 'itemField'=>$itemField,
- 'content'=>$contentStr
- ];
- }
- return [];
- }
-
- /**
- * 获取所有foreach标签
- * @param $str
- * @return array
- * @throws \Exception
- */
- protected function getAllForeachLabel($str){
- $tree = [];
- $label = "foreach";
- $labelList = $this->parseLabel($str,$label);
- if (!empty($labelList) && count($labelList)>0){
- foreach ($labelList as $itemLabel) {
- $labelChildrenList = $this->parseLabel($itemLabel,$label,"children");
- if (!empty($labelChildrenList) && count($labelChildrenList)>0){
- $childrenList = [];
- foreach ($labelChildrenList as $item) {
- $childrenList[]=[
- 'str'=>$item,
- 'children' => []
- ];
- }
- $tree[]=[
- 'str'=>$itemLabel,
- 'children' => $childrenList
- ];
- }else{
- $tree[]=[
- 'str'=>$itemLabel,
- 'children' => []
- ];
- }
- }
- }
- return $tree;
- }
- // 解析foreach
- protected function replaceForeach($html,$params,$level=""){
- $allLabelData= $this->getAllForeachLabel($html);
- $res = [];
- if (count($allLabelData)>0){
- // 遍历每个foreach标签
- foreach ($allLabelData as $labelItem) {
- $itemStr = $labelItem['str'];
- $forOption = $this->parseForeach($labelItem['str'],$params);
- $itemContent="";
- if (!empty($forOption['list']) && count($forOption['list'])>0){
- // 处理每行数据
- foreach ($forOption['list'] as $rowKey=>$row) {
- $rowData = [$forOption['itemField']=>$row,$forOption['keyField']=>$rowKey];
- $rowParams = array_merge($params,$rowData);
- // 存在子标签,处理子标签
- if (!empty($labelItem['children']) && count($labelItem['children'])>0){
- $itemStrContent = "";
- foreach ($labelItem['children'] as $childLabel){
- $childContents = "";
- $childStr = $childLabel['str'];
- $childDataList = $this->parseForeach($childLabel['str'],$rowParams);
- // 处理子标签数据
- if (!empty($childDataList['list']) && count($childDataList['list'])>0){
- foreach ($childDataList['list'] as $childDataKey=>$childDataItem) {
- // 子标签每行数据
- $childDataItemData = [$childDataList['itemField']=>$childDataItem,$childDataList['keyField']=>$childDataKey,];
- $contentsStr= $this->getForContent($childDataList['content'],array_merge($rowParams,$childDataItemData));
- $contentsStr =ltrim($contentsStr,"\r\n");
- if (!empty(Helper::trimEmpty($contentsStr))){
- $childContents.= $contentsStr;
- }
- }
- }
- $itemStrContent.= str_replace($childLabel['str'], $childContents,$forOption['content']);
- }
- $rowContent=$this->replaceParams($itemStrContent,$rowParams);
- $itemContentStr=$this->replaceIf($rowContent,$rowParams);
- if (!empty(Helper::trimEmpty($itemContentStr))){
- $itemContent.= $itemContentStr;
- }
- }else{
- $rowContent=$this->getForContent($forOption['content'],$rowParams);
- if (empty(Helper::trimEmpty($rowContent))){
- $rowContent= "";
- }
- $itemContent.= $rowContent;
- }
- $itemContent =trim($itemContent,"\r\n");
- }
- }
- $html = str_replace($labelItem['str'], $itemContent,$html );
- }
- }
- return $html;
-
- }
-
- /**
- * 获取foreach内容
- * @param $str
- * @param $params
- * @return array|mixed|string|string[]
- * @throws \Exception
- */
- protected function getForContent($str,$params){
- $content = $str;
- if (!empty($params)){
- $content = $this->replaceParams($content,$params);
- $content = $this->replaceIf($content,$params);
- }
- return $content;
- }
-
-
- /**
- * 获取if条件的内容
- * @param $str
- * @return mixed|string
- */
- protected function getIfContent($str){
- if (preg_match('#{if (.+?)}(.*?){/if}#s', $str, $matches)){
- if (eval("return $matches[1];")){
- // 条件成立
- return $matches[2];
- }
- }
- return "";
- }
-
-
- /**
- * 解析指定标签
- * @param $str
- * @param $label
- * @param string $level
- * @return array
- * @throws \Exception
- */
- protected function parseLabel($str,$label,$level=""){
- // 后面的 flag 表示记录偏移量
- preg_match_all('!({/?'.$label.' ?}?)!', $str, $matches, PREG_OFFSET_CAPTURE);
- // 用数组来模拟栈
- $stack = [];
- $top = null;
- $result = [];
- foreach ($matches[0] as $k=>[$match, $offset]) {
- // 当取标签内容时,排除第一个和最后一个标签
- if ($level === 'children' && ($k==0 || $k>=count($matches[0])-1)){
- continue;
- }
- // 判断匹配到的如果是 开始标签
- if ($match === '{'.$label.' ') {
- $stack[] = $offset;
- // 记录开始的位置
- if ($top === null) {
- $top = $offset;
- }
- // 如果不是
- } else {
- // 从栈底部拿一个出来
- $pop = array_pop($stack);
- // 如果取出来的是 null 就说明存在多余的 标签
- if ($pop === null) {
- throw new \Exception('语法错误,存在多余的 {/'.$label.'} 标签');
- }
- // 如果取完后栈空了
- if (empty($stack)) {
- // offset 是匹配到的开始标签(前面)位置,加上内容的长度
- $newOffset = $offset + strlen($match)-$top;
- // 从顶部到当前的偏移就是这个标签里的内容
- $result[] = substr($str, $top, $newOffset);
- // 重置 top 开始下一轮
- $top = null;
- }
- }
- }
- // 如果运行完了,栈里面还有东西,那就说明缺少闭合标签。
- if (!empty($stack)) {
- throw new \Exception('语法错误,存在未闭合的 {/'.$label.'} 标签');
- }
- return $result;
- }
-
- /**
- * 根据keys获取对象中的值
- * @param $array
- * @param $keyStr
- * @param string $delimiter
- * @return mixed|null
- */
- public function getObjectValueByKeys($array, $keyStr, $delimiter = '.')
- {
- $keys = explode($delimiter, $keyStr);
- if (preg_match_all('#\[(.+?)]#s', $keyStr, $matches)){
- $value = $array;
- if (!empty($matches[1])){
- $matchesIndex=0;
- foreach ($keys as $keyItem) {
- if (strpos($keyItem, '[') !== false) {
- $tagArr = explode("[", $keyItem);
- if (!empty($value[$tagArr[0]]) && !empty($value[$tagArr[0]][$matches[1][$matchesIndex]])){
- $value =$value[$tagArr[0]][$matches[1][$matchesIndex]];
- }else{
- $value =null;
- break;
- }
- $matchesIndex=$matchesIndex+1;
- }else{
- $value =$value[$keyItem];
- }
- }
- }
- return $value;
- }else if (sizeof($keys) > 1) {
- $value = $array;
- foreach ($keys as $key){
- if (!empty($value[$key])){
- $value = $value[$key];
- }else{
- $value =null;
- break;
- }
- }
- return $value;
- } else {
- return $array[$keyStr] ?? null;
- }
- }
-
-
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/middleware/HyperfMiddleware.php b/vendor/hg/apidoc/src/middleware/HyperfMiddleware.php
deleted file mode 100644
index 95623726a..000000000
--- a/vendor/hg/apidoc/src/middleware/HyperfMiddleware.php
+++ /dev/null
@@ -1,81 +0,0 @@
-initConfig();
-
- if ($request->getMethod() == "GET"){
- $params = $request->getQueryParams();
- }else{
- $params = $request->getParsedBody();
- }
- $config = ConfigProvider::get();
- $config['request_params'] = $params;
- ConfigProvider::set($config);
- return $handler->handle($request);
- }
-
- static function getApidocConfig()
- {
- $config = config("apidoc");
- if (!(!empty($config['auto_url']) && !empty($config['auto_url']['filter_keys']))){
- $config['auto_url']['filter_keys'] = ['App','Controller'];
- }
- $config['app_frame'] = "hyperf";
- return $config;
- }
-
- static function registerRoute($route)
- {
- // TODO: Implement registerRoute() method.
- }
-
- static function databaseQuery($sql)
- {
- return Db::select($sql);
- }
-
- static function getRootPath()
- {
- return BASE_PATH."/";
- }
-
- static function getRuntimePath()
- {
- return BASE_PATH."/runtime/";
- }
-
- static function setLang($locale)
- {
- static::$langLocale = $locale;
- }
-
- static function getLang($lang): string
- {
- return trans($lang);
- }
-
- static function handleResponseJson($res)
- {
- return $res;
- }
-
- static function getTablePrefix(){
- return config('databases.default.prefix','');
- }
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/middleware/LaravelMiddleware.php b/vendor/hg/apidoc/src/middleware/LaravelMiddleware.php
deleted file mode 100644
index b6ec3b958..000000000
--- a/vendor/hg/apidoc/src/middleware/LaravelMiddleware.php
+++ /dev/null
@@ -1,17 +0,0 @@
-all();
- $config = ConfigProvider::get();
- $config['request_params'] = $params;
- ConfigProvider::set($config);
- return $next($request);
- }
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/middleware/ThinkPHPMiddleware.php b/vendor/hg/apidoc/src/middleware/ThinkPHPMiddleware.php
deleted file mode 100644
index 58e6c56c8..000000000
--- a/vendor/hg/apidoc/src/middleware/ThinkPHPMiddleware.php
+++ /dev/null
@@ -1,17 +0,0 @@
-param();
- $config = ConfigProvider::get();
- $config['request_params'] = $params;
- ConfigProvider::set($config);
- return $next($request);
- }
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/middleware/WebmanMiddleware.php b/vendor/hg/apidoc/src/middleware/WebmanMiddleware.php
deleted file mode 100644
index 9eefcb4ee..000000000
--- a/vendor/hg/apidoc/src/middleware/WebmanMiddleware.php
+++ /dev/null
@@ -1,88 +0,0 @@
-initConfig();
- $params = $request->all();
- $config = ConfigProvider::get();
- $config['request_params'] = $params;
- ConfigProvider::set($config);
-
- $response = $request->method() == 'OPTIONS' ? response('') : $handler($request);
- if (!empty($config['allowCrossDomain'])){
- // 给响应添加跨域相关的http头
- $response->withHeaders([
- 'Access-Control-Allow-Credentials' => 'true',
- 'Access-Control-Allow-Origin' => $request->header('origin', '*'),
- 'Access-Control-Allow-Methods' => $request->header('access-control-request-method', '*'),
- 'Access-Control-Allow-Headers' => $request->header('access-control-request-headers', '*'),
- ]);
- }
-
- return $response;
- }
-
- static function getApidocConfig()
- {
- $config = config('plugin.hg.apidoc.app.apidoc');
- if (!(!empty($config['auto_url']) && !empty($config['auto_url']['filter_keys']))){
- $config['auto_url']['filter_keys'] = ['app','controller'];
- }
- $config['app_frame'] = "webman";
- return $config;
- }
-
- static function registerRoute($route)
- {
- return "";
- }
-
- static function databaseQuery($sql)
- {
- return Db::select($sql);
- }
-
- static function getRootPath()
- {
- return BASE_PATH."/";
- }
-
- static function getRuntimePath()
- {
- return BASE_PATH."/runtime/";
- }
-
- static function setLang($locale)
- {
- locale($locale);
- }
-
- static function getLang($lang): string
- {
- return $lang;
- }
-
- static function handleResponseJson($res)
- {
- return json($res);
- }
-
- static function getTablePrefix(){
- $driver = config('database.default');
- $table_prefix=config('database.connections.'.$driver.'.prefix');
- return $table_prefix;
- }
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/parses/ParseAnnotation.php b/vendor/hg/apidoc/src/parses/ParseAnnotation.php
deleted file mode 100644
index 0a6e8fadf..000000000
--- a/vendor/hg/apidoc/src/parses/ParseAnnotation.php
+++ /dev/null
@@ -1,218 +0,0 @@
-parser = new AnnotationReader();
- if (!empty($config['ignored_annitation'])){
- foreach ($config['ignored_annitation'] as $item) {
- AnnotationReader::addGlobalIgnoredName($item);
- }
- }
- }
- /**
- * 解析非@注解的文本注释
- * @param $refMethod
- * @param $isAll bool 是否获取全部,true则将带@开头的注释也包含
- * @return array|false
- */
- public static function parseTextAnnotation($refMethod,$isAll=false): array
- {
- $annotation = $refMethod->getDocComment();
- if (empty($annotation)) {
- return [];
- }
- if (preg_match('#^/\*\*(.*)\*/#s', $annotation, $comment) === false)
- return [];
- $comment = trim($comment [1]);
- if (preg_match_all('#^\s*\*(.*)#m', $comment, $lines) === false)
- return [];
- $data = [];
- foreach ($lines[1] as $line) {
- $line = trim($line);
- if (!empty ($line) && ($isAll===true || ($isAll===false && strpos($line, '@') !== 0))) {
- $data[] = $line;
- }
- }
- return $data;
- }
-
- /**
- * 根据路径获取类名
- * @param $path
- * @return string
- */
- protected function getClassName($path){
- $NameArr = explode("\\", $path);
- $name = lcfirst($NameArr[count($NameArr) - 1]);
- return $name;
- }
-
- /**
- * 获取并处理注解参数
- * @param $attrList
- * @return array
- */
- protected function getParameters($attrList){
- $attrs = [];
- foreach ($attrList as $item) {
- $value = "";
- if ($item instanceof ReflectionAttribute) {
- $name = $this->getClassName($item->getName());
- $params = $item->getArguments();
- if (!empty($params)){
- if (is_array($params) && !empty($params[0]) && is_string($params[0]) && count($params)===1){
- $value = $params[0];
- }else{
- if (!empty($params[0])){
- $paramObj = [];
- foreach ($params as $k=>$value) {
- $key = $k===0?'name':$k;
- $paramObj[$key]=$value;
- }
- }else{
- $paramObj = $params;
- }
- $value = $paramObj;
- }
- }
- }else{
- $name = $this->getClassName(get_class($item));
- $valueObj = Helper::objectToArray($item);
- if (array_key_exists('name',$valueObj) && count($valueObj)===1){
- $value = $valueObj['name']===null?true: $valueObj['name'];
- }else{
- $value = $valueObj;
- }
- }
- if (!empty($attrs[$name]) && is_array($attrs[$name]) && Helper::arrayKeyFirst($attrs[$name])===0){
- $attrs[$name][]=$value;
- }else if(!empty($attrs[$name])){
- $attrs[$name] = [$attrs[$name],$value];
- }else{
- $attrs[$name]=$value;
- }
- }
- return $attrs;
- }
-
- /**
- * 获取类的注解参数
- * @param ReflectionMethod $refMethod
- * @return array
- */
- public function getClassAnnotation($refClass){
- if (method_exists($refClass,'getAttributes')){
- $attributes = $refClass->getAttributes();
- }else{
- $attributes = [];
- }
- $readerAttributes = $this->parser->getClassAnnotations($refClass);
- return $this->getParameters(array_merge($attributes,$readerAttributes));
- }
-
- /**
- * 获取方法的注解参数
- * @param ReflectionMethod $refMethod
- * @return array
- */
- public function getMethodAnnotation(ReflectionMethod $refMethod){
- if (method_exists($refMethod,'getAttributes')){
- $attributes = $refMethod->getAttributes();
- }else{
- $attributes = [];
- }
- $readerAttributes = $this->parser->getMethodAnnotations($refMethod);
- return $this->getParameters(array_merge($attributes,$readerAttributes));
- }
-
- /**
- * 获取属性的注解参数
- * @param $property
- * @return array
- */
- public function getPropertyAnnotation($property){
- if (method_exists($property,'getAttributes')){
- $attributes = $property->getAttributes();
- }else{
- $attributes = [];
- }
- $readerAttributes = $this->parser->getPropertyAnnotations($property);
- return $this->getParameters(array_merge($attributes,$readerAttributes));
- }
-
- /**
- * 解析类的属性文本注释的var
- * @param $propertyTextAnnotations
- * @return array
- */
- protected static function parsesPropertyTextAnnotation($propertyTextAnnotations){
- $varLine = "";
- foreach ($propertyTextAnnotations as $item) {
- if (strpos($item, '@var') !== false){
- $varLine = $item;
- break;
- }
- }
- $type = "";
- $desc = "";
- if ($varLine){
- $varLineArr = preg_split('/\\s+/', $varLine);
- $type = !empty($varLineArr[1])?$varLineArr[1]:"";
- $desc = !empty($varLineArr[2])?$varLineArr[2]:"";
- }
- if (empty($desc) && strpos($propertyTextAnnotations[0], '@var') === false){
- $desc = $propertyTextAnnotations[0];
- }
- return [
- 'type'=>$type,
- 'desc'=>$desc,
- ];
- }
-
- /**
- * 获取类的属性参数
- * @param $classReflect
- * @return array
- */
- public function getClassPropertiesy($classReflect){
- $publicProperties = $classReflect->getProperties(\ReflectionProperty::IS_PUBLIC);
- $arr=[];
- foreach ($publicProperties as $property) {
- $propertyAnnotations = $this->getPropertyAnnotation($property);
- $item = [];
- if (!empty($propertyAnnotations['property'])){
- // 有apidoc注解
- $arr[] = $propertyAnnotations['property'];
- continue;
- }
- $propertyTextAnnotations = self::parseTextAnnotation($property,true);
- if (empty($propertyTextAnnotations)){
- // 无注释
- continue;
- }
- $textAnnotationsParams=static::parsesPropertyTextAnnotation($propertyTextAnnotations);
- $textAnnotationsParams['name'] =$property->getName();
- $arr[]=$textAnnotationsParams;
- }
- return $arr;
- }
-
-
-
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/parses/ParseApiDetail.php b/vendor/hg/apidoc/src/parses/ParseApiDetail.php
deleted file mode 100644
index bb602e3f7..000000000
--- a/vendor/hg/apidoc/src/parses/ParseApiDetail.php
+++ /dev/null
@@ -1,743 +0,0 @@
-config = $config;
- }
-
- /**
- * 生成api接口数据
- * @param string $appKey
- * @param string $apiKey
- * @return array
- */
- public function renderApiDetail(string $appKey,string $apiKey)
- {
-
- $this->appKey = $appKey;
- $pathArr = explode("@", $apiKey);
- $classPath = $pathArr[0];
- $methodName = $pathArr[1];
- $currentAppConfig = Helper::getCurrentAppConfig($appKey);
- $this->currentApp = $currentAppConfig['appConfig'];
-
- try {
- $refClass = new ReflectionClass($classPath);
- $refMethod= $refClass->getMethod($methodName);
- $methodItem = $this->parseApiMethod($refClass,$refMethod);
- return $methodItem;
- } catch (\ReflectionException $e) {
- throw new ErrorException($e->getMessage());
- }
- }
-
-
- public function parseApiMethod($refClass,$refMethod,$currentAppData = null){
- $config = $this->config;
- if (!empty($currentAppData)){
- $currentApp = $currentAppData;
- $this->currentApp = $currentAppData;
- $this->appKey = $currentAppData['appKey'];
- }else{
- $currentApp = $this->currentApp;
-
- }
- if (empty($refMethod->name)) {
- return [];
- }
- $classTextAnnotations = ParseAnnotation::parseTextAnnotation($refClass);
- $classAnnotations = (new ParseAnnotation($config))->getClassAnnotation($refClass);
-
- $textAnnotations = ParseAnnotation::parseTextAnnotation($refMethod);
- // 标注不解析的方法
- if (in_array("NotParse", $textAnnotations)) {
- return [];
- }
- $methodAnnotations = $this->getMethodAnnotation($refMethod);
- $methodAnnotations = self::handleApiBaseInfo($methodAnnotations,$refClass->name,$refMethod->name,$textAnnotations,$config);
- // 是否开启debug
- if (
- in_array("NotDebug", $textAnnotations) ||
- (isset($config['notDebug']) && $config['notDebug']===true) ||
- (isset($currentApp['notDebug']) && $currentApp['notDebug']===true) ||
- isset($methodAnnotations['notDebug']) ||
- in_array("NotDebug", $classTextAnnotations) ||
- isset($classAnnotations['notDebug'])
- ) {
- $methodAnnotations['notDebug'] = true;
- }
-
- if(!empty($methodAnnotations['md'])){
- $methodAnnotations['md'] = $this->getFieldMarkdownContent($methodAnnotations['md']);
- }
- if(!empty($methodAnnotations['responseSuccessMd'])){
- $methodAnnotations['responseSuccessMd'] = $this->getFieldMarkdownContent($methodAnnotations['responseSuccessMd']);
- }
- if(!empty($methodAnnotations['responseErrorMd'])){
- $methodAnnotations['responseErrorMd'] = $this->getFieldMarkdownContent($methodAnnotations['responseErrorMd']);
- }
-
- // 合并全局请求参数-header
- if (
- (
- (!empty($config['params']) && !empty($config['params']['header'])) ||
- (!empty($currentApp['params']) && !empty($currentApp['params']['header']))
- ) &&
- !in_array("NotHeaders", $textAnnotations) &&
- !isset($methodAnnotations['notHeaders'])
- )
- {
- $headers = !empty($methodAnnotations['header'])?$methodAnnotations['header']:[];
- $methodAnnotations['header'] = $this->mergeGlobalOrAppParams($headers,'header');
- }
-
- // 合并全局请求参数-query
- if (
- (
- (!empty($config['params']) && !empty($config['params']['query'])) ||
- (!empty($this->currentApp['params']) && !empty($this->currentApp['params']['query']))
- ) &&
- !in_array("NotQuerys", $textAnnotations) &&
- !isset($methodAnnotations['notQuerys'])
- )
- {
- $querys = !empty($methodAnnotations['query'])?$methodAnnotations['query']:[];
- $methodAnnotations['query'] = $this->mergeGlobalOrAppParams($querys,'query');
- }
-
- // 合并全局请求参数-body
- if (
- (
- (!empty($config['params']) && !empty($config['params']['body'])) ||
- (!empty($this->currentApp['params']) && !empty($this->currentApp['params']['body']))
- ) &&
- !in_array("NotParams", $textAnnotations) &&
- !isset($methodAnnotations['notParams'])
- )
- {
- $params = !empty($methodAnnotations['param'])?$methodAnnotations['param']:[];
- $methodAnnotations['param'] = $this->mergeGlobalOrAppParams($params,'body');
- }
-
- //添加成功响应体
- $methodAnnotations['responseSuccess'] = $this->handleApiResponseSuccess($methodAnnotations,$textAnnotations);
- //添加异常响应体
- $methodAnnotations['responseError'] = $this->handleApiResponseError($methodAnnotations,$textAnnotations);
-
- // 合并全局事件after
- if (
- (
- (!empty($config['debug_events']) && !empty($config['debug_events']['after'])) ||
- (!empty($this->currentApp['debug_events']) && !empty($this->currentApp['debug_events']['after']))
- ) &&
- !in_array("NotEvent", $textAnnotations))
- {
- $debugAfterEvents = !empty($methodAnnotations['after'])?$methodAnnotations['after']:[];
- $methodAnnotations['after'] = $this->mergeGlobalOrAppEvents($debugAfterEvents,'after');
- }
-
- // 合并全局事件before
- if (
- (
- (!empty($config['debug_events']) && !empty($config['debug_events']['before'])) ||
- (!empty($this->currentApp['debug_events']) && !empty($this->currentApp['debug_events']['before']))
- ) &&
- !in_array("NotEvent", $textAnnotations))
- {
- $debugBeforeEvents = !empty($methodAnnotations['before'])?$methodAnnotations['before']:[];
- $methodAnnotations['before'] = $this->mergeGlobalOrAppEvents($debugBeforeEvents,'before');
- }
-
- return $methodAnnotations;
- }
-
- /**
- * 获取md注解内容
- * @param $mdAnnotations
- * @return mixed|string
- */
- protected function getFieldMarkdownContent($mdAnnotations){
- if(!empty($mdAnnotations['name'])){
- return $mdAnnotations['name'];
- }else if(!empty($mdAnnotations['ref'])){
- return ParseMarkdown::getContent($this->appKey,$mdAnnotations['ref']);
- }
- return $mdAnnotations;
- }
-
- /**
- * 获取方法的注解,并处理参数
- * @param $refMethod
- * @param string $refField ref时指定处理的参数
- * @return array
- */
- protected function getMethodAnnotation($refMethod,$refField=""){
- $annotations = (new ParseAnnotation($this->config))->getMethodAnnotation($refMethod);
- // 需要处理的注解字段
- if (!empty($refField)){
- $handleFields = [$refField];
- }else{
- $handleFields = ["header","query","param","routeParam","returned","before","after","responseSuccess","responseError"];
- }
- foreach ($handleFields as $field) {
- if (!empty($annotations[$field])){
- $annotations[$field]=$this->handleMethodParams($annotations[$field],$field);
- }
- }
- return $annotations;
- }
-
-
- protected function mergeGlobalOrAppParams($params,$paramType='param'){
- $config = $this->config;
- $currentApp = $this->currentApp;
- $globalParams = [];
- if (!empty($currentApp['params']) && !empty($currentApp['params'][$paramType])){
- // 不合并global的处理方式
- $globalParams = $currentApp['params'][$paramType];
- // 合并global的处理方式
- // $globalHeaders = Helper::arrayMergeAndUnique("name", $globalHeaders, $this->currentApp['params'][$paramType]);
- }else if(!empty($config['params']) && !empty($config['params'][$paramType])){
- $globalParams = $config['params'][$paramType];
- }
-
- if (!empty($params) && count($params) && count($globalParams)) {
- return Helper::arrayMergeAndUnique("name", $globalParams, $params);
- }
- return $globalParams;
- }
-
- protected function mergeGlobalOrAppEvents($events,$eventType='after'){
- $config = $this->config;
- $globalEvents = [];
- if (!empty($this->currentApp['debug_events']) && !empty($this->currentApp['debug_events'][$eventType])){
- $globalEvents = $this->currentApp['debug_events'][$eventType];
- }else if(!empty($config['debug_events']) && !empty($config['debug_events'][$eventType])){
- $globalEvents = $config['debug_events'][$eventType];
- }
- $mergeEvents = [];
- foreach ($globalEvents as $item){
- if (!empty($item['desc'])){
- $item['desc'] = Lang::getLang($item['desc']);
- }
- $mergeEvents[] = $item;
- }
- if (!empty($events) && count($events)){
- foreach ($events as $event) {
- $mergeEvents[] = $event;
- }
- }
- return $mergeEvents;
- }
-
- /**
- * 处理接口成功响应参数
- * @param $methodAnnotations
- * @param $textAnnotations
- * @return array|mixed
- */
- protected function handleApiResponseSuccess($methodAnnotations,$textAnnotations){
- $returned = !empty($methodAnnotations['returned'])?$methodAnnotations['returned']:"";
- $currentApp = $this->currentApp;
- $config = $this->config;
- $mergeParams = [];
- $paramType='success';
- if (
- in_array("NotResponses", $textAnnotations) ||
- in_array("NotResponseSuccess", $textAnnotations) ||
- isset($methodAnnotations['notResponses']) ||
- isset($methodAnnotations['notResponseSuccess'])
- ) {
- // 注解了不使用全局响应
- $mergeParams = [];
- }else if (!empty($currentApp['responses']) && !empty($currentApp['responses'][$paramType])){
- $mergeParams = $currentApp['params'][$paramType];
- }else if(!empty($config['responses']) && !empty($config['responses'][$paramType])){
- $mergeParams = $config['responses'][$paramType];
- }
-
- if (!empty($methodAnnotations['responseSuccess'])){
- if (!is_int(Helper::arrayKeyFirst($methodAnnotations['responseSuccess']))){
- $methodResponseSuccess = [$methodAnnotations['responseSuccess']];
- }else{
- $methodResponseSuccess = $methodAnnotations['responseSuccess'];
- }
- $mergeParams = Helper::arrayMergeAndUnique("name", $mergeParams,$methodResponseSuccess);
- }
-
- return $this->mergeResponseSuccessParam($mergeParams,$returned);
-
- }
-
- protected function mergeResponseSuccessParam($mergeParams,$returned){
- if (!empty($mergeParams) && count($mergeParams)){
- $resData = [];
- foreach ($mergeParams as $item) {
- if (!empty($item['main']) && $item['main'] === true){
- $item['children'] = $returned;
- }
- //支持到二级的挂载
- if (isset($item['children']) && !empty($item['children'])) {
- $item['children'] = $this->mergeResponseSuccessParam($item['children'],$returned);
- }
- if (!empty($item['desc'])){
- $item['desc'] = Lang::getLang($item['desc']);
- }
- if (!empty($item['md'])){
- $item['md'] = ParseMarkdown::getContent($this->appKey,$item['md']);
- }
- $resData[]=$item;
- }
- return $resData;
- }
- return $returned;
- }
-
- /**
- * 处理接口异常响应参数
- * @param $methodAnnotations
- * @param $textAnnotations
- * @return array|mixed|void
- */
- protected function handleApiResponseError($methodAnnotations,$textAnnotations){
- $config = $this->config;
- $currentApp = $this->currentApp;
- $responseErrors = [];
- $paramType = "error";
- $mergeParams = [];
- if (
- in_array("NotResponses", $textAnnotations) ||
- in_array("NotResponseError", $textAnnotations) ||
- isset($methodAnnotations['notResponses']) ||
- isset($methodAnnotations['notResponseError'])
- ) {
- // 注解了不使用全局响应
- $mergeParams = [];
- }else if (!empty($currentApp['responses']) && !empty($currentApp['responses'][$paramType])){
- $mergeParams = $currentApp['params'][$paramType];
- }else if(!empty($config['responses']) && !empty($config['responses'][$paramType])){
- $mergeParams = $config['responses'][$paramType];
- }
-
- if (!empty($methodAnnotations['responseError'])){
- if (!is_int(Helper::arrayKeyFirst($methodAnnotations['responseError']))){
- $methodResponseError = [$methodAnnotations['responseError']];
- }else{
- $methodResponseError = $methodAnnotations['responseError'];
- }
- $mergeParams = Helper::arrayMergeAndUnique("name", $mergeParams,$methodResponseError);
- }
-
- if (!empty($mergeParams) && count($mergeParams)){
- $resData = [];
- foreach ($mergeParams as $item) {
- $item['desc'] = Lang::getLang($item['desc']);
- if (!empty($item['md'])){
- $item['md'] = ParseMarkdown::getContent($this->appKey,$item['md']);
- }
- $resData[]=$item;
- }
- return $resData;
- }
- return [];
- }
-
-
-
- public static function handleApiBaseInfo($methodInfo,$className,$methodName,$textAnnotations,$config){
- // 无标题,且有文本注释
- if (empty($methodInfo['title']) && !empty($textAnnotations) && count($textAnnotations) > 0) {
- $methodInfo['title'] = Lang::getLang($textAnnotations[0]);
- }else if (!empty($methodInfo['title'])){
- $methodInfo['title'] = Lang::getLang($methodInfo['title']);
- }
-
- // 默认method
- if (!empty($methodInfo['method'])) {
- $apiMethods = Helper::handleApiMethod($methodInfo['method']);
- $methodInfo['method'] = count($apiMethods)==1?$apiMethods[0]:$apiMethods;
- }else{
- $methodInfo['method'] = !empty($config['default_method']) ? strtoupper($config['default_method']) : '*';
- }
-
- // 默认default_author
- if (
- empty($methodInfo['author']) &&
- !empty($config['default_author']) &&
- !in_array("NotDefaultAuthor", $textAnnotations) &&
- !isset($methodInfo['notDefaultAuthor'])
- ) {
- $methodInfo['author'] = $config['default_author'];
- }
-
- if (!empty($methodInfo['tag'])){
- $methodInfo['tag'] = static::handleTags($methodInfo['tag']);
- }
- // 无url,自动生成
- if (empty($methodInfo['url'])) {
- $methodInfo['url'] = static::autoCreateUrl($className,$methodName,$config);
- } else if (!empty($methodInfo['url']) && is_string($methodInfo['url']) && substr($methodInfo['url'], 0, 1) != "/") {
- $methodInfo['url'] = "/" . $methodInfo['url'];
- }
- $methodInfo['name'] = $methodName;
- $methodInfo['menuKey'] = Helper::createApiKey($className,$methodName);
- return $methodInfo;
- }
-
- /**
- * 处理方法的注解参数
- * @param $params array 注解参数
- * @param $field string 指定处理的参数字段名
- * @return array
- */
- protected function handleMethodParams($params,$field){
- // 不处理合并的注解字段
- $notMergeNameFields=['before','after'];
- $data=[];
- if (!empty($params)){
- // 处理单个注解为对象的参数
- if (!is_int(Helper::arrayKeyFirst($params))){
- $params = [$params];
- }
- foreach ($params as $param) {
- $item=$this->handleAnnotationsParamItem($param,$field);
- if (!empty($item) && is_int(Helper::arrayKeyFirst($item))){
- if (in_array($field,$notMergeNameFields)){
- $data = $item;
- }else{
- $data = Helper::arrayMergeAndUnique("name",$data,$item);
- }
- }else if ($item!==false){
- $data[]=$item;
- }
- }
- }
- return $data;
- }
-
-
- /**
- * 处理注解某一参数
- * @param $param array 参数
- * @param $field string 处理的字段名
- * @return array|array[]|mixed
- */
- protected function handleAnnotationsParamItem($param,$field){
- // 事件字段,不处理ref的数据过滤
- $eventFields=['before','after'];
- $data = [];
- if (!empty($param['ref'])){
- $refParams = $this->renderRef($param['ref'],$field);
- if (!empty($refParams[$field])){
- if (in_array($field,$eventFields)){
- $data=$refParams[$field];
- }else{
- $data = $this->handleRefData($param,$refParams[$field],$field);
- }
- }else{
- return false;
- }
- }else if(!empty($param['table'])){
- $tableParams = (new ParseModel($this->config))->getTableDocument($param['table'],[]);
- $data = $this->handleRefData($param,$tableParams,$field);
- } else{
- $data = $param;
- }
- if (!empty($data['desc'])){
- $data['desc'] = Lang::getLang($data['desc']);
- }
- if (!empty($data['md'])){
- $data['md'] = ParseMarkdown::getContent($this->appKey,$data['md']);
- }
- if (!empty($data['children']) && is_array($data['children'])){
- $childrenData = [];
- foreach ($data['children'] as $child) {
- $paramItem=$this->handleAnnotationsParamItem($child,$field);
-
- if ($paramItem!==false){
- if (!empty($paramItem) && is_array($paramItem) && Helper::arrayKeyFirst($paramItem)===0){
- $childrenData = Helper::arrayMergeAndUnique("name",$childrenData,$paramItem);
- }else{
- $childrenData[] = $paramItem;
- }
- }
- }
- $data['children'] = $childrenData;
- }
- if (!empty($data['type']) && $data['type'] === 'tree' ) {
- // 类型为tree的
- $data['children'][] = [
- 'children' => $data['children'],
- 'name' =>!empty($data['childrenField']) ?$data['childrenField']:'children',
- 'type' => 'array',
- 'desc' => !empty($data['childrenDesc'])?Lang::getLang($data['childrenDesc']):"",
- ];
- }
-
- // 自定义解析
- if (!empty($this->config['parsesAnnotation'])){
- $callback = $this->config['parsesAnnotation']($data);
- if (!empty($callback)){
- $data = $callback;
- }
- }
- return $data;
- }
-
- public static function handleTags($tagStr){
- if (!empty($tagStr)) {
- $tagStr = Lang::getLang($tagStr);
- $tagList = [];
- if (is_string($tagStr) && strpos($tagStr, ',') !== false) {
- $tagArr = explode(",", $tagStr);
- foreach ($tagArr as $tag) {
- $tagList[]=Lang::getLang($tag);
- }
- } else {
- $tagList = [Lang::getLang($tagStr)];
- }
- return $tagList;
- }
- return $tagStr;
- }
-
- /**
- * 自动生成url
- * @param $method
- * @return string
- */
- public static function autoCreateUrl($className,$methodName,$config): string
- {
-
- $pathArr = explode("\\", $className);
- $filterPathNames = !empty($config['auto_url']) && !empty($config['auto_url']['filter_keys'])?$config['auto_url']['filter_keys']:[];
- $classUrlArr = [];
- foreach ($pathArr as $item) {
- if (!in_array($item, $filterPathNames)) {
- if (!empty($config['auto_url'])){
- $key = $item;
- if (!empty($config['auto_url']['letter_rule'])){
- switch ($config['auto_url']['letter_rule']) {
- case 'lcfirst':
- $key = lcfirst($item);
- break;
- case 'ucfirst':
- $key = ucfirst($item);
- break;
- default:
- $key = $item;
- }
- }
- if (!empty($config['auto_url']['handle_key'])){
- $classUrlArr[] = $config['auto_url']['handle_key']($key);
- }else{
- $classUrlArr[] = $key;
- }
- }else{
- $classUrlArr[] = $item;
- }
- }
- }
- $classUrl = implode('/', $classUrlArr);
- $prefix = !empty($config['auto_url']) && !empty($config['auto_url']['prefix'])?$config['auto_url']['prefix']:"";
- $url = $prefix . '/' . $classUrl . '/' . $methodName;
- if (!empty($config['auto_url']) && !empty($config['auto_url']['custom']) && is_callable($config['auto_url']['custom'])){
- return $config['auto_url']['custom']($className,$methodName,$url);
- }
- return $url;
- }
-
- /**
- * ref引用
- */
- public function renderRef($refPath,$field): array
- {
- $res = ['type' => 'model'];
- $config = $this->config;
- $methodName ="";
- if (is_string($refPath)){
- if (strpos($refPath, '\\') === false) {
- // 引入通用注解
- $classPath = $config['definitions'];
- $methodName = $refPath;
- }else if (class_exists($refPath)) {
- // use类
- $classPath = $refPath;
- }else if (strpos($refPath, '@') !== false){
- // 带@指定方法
- $pathArr = explode("@", $refPath);
- $classPath = $pathArr[0];
- $methodName = $pathArr[1];
- }else{
- // 直接指定方法
- $pathArr = explode("\\", $refPath);
- $methodName = $pathArr[count($pathArr) - 1];
- unset($pathArr[count($pathArr) - 1]);
- $classPath = implode("\\", $pathArr);
- }
- }else if(is_array($refPath)){
- $classPath = $refPath[0];
- $methodName = !empty($refPath[1])?$refPath[1]:"";
- }else{
- // 未知ref
- }
- try {
- $modelClass = ParseModel::getModelClass($classPath);
- $classReflect = new \ReflectionClass($classPath);
- if (!empty($modelClass)){
- // 模型解析
- $modelParams = (new ParseModel($config))->parseModelTable($modelClass,$classReflect,$methodName);
- return [$field=>$modelParams];
- }else{
- // 类ref引用
- if (!empty($methodName)){
- // 指定引入类的方法注解
- $methodName = trim($methodName);
- $refMethod = $classReflect->getMethod($methodName);
- $res = $this->getMethodAnnotation($refMethod,$field);
- return $res;
- }else{
- // 类的参数property
- $private_properties = (new ParseAnnotation($config))->getClassPropertiesy($classReflect);
- return [$field=>$private_properties];
- }
- }
-
- } catch (\ReflectionException $e) {
- throw new ErrorException($e->getMessage());
- }
- }
-
-
-
- public function handleRefData($annotation,$refParams, string $field): array
- {
- // 过滤field
- if (!empty($annotation['field'])) {
- $refParams = static::filterParamsField($refParams, $annotation['field'], 'field');
- }
- // 过滤withoutField
- if (!empty($annotation['withoutField'])) {
- $refParams = static::filterParamsField($refParams, $annotation['withoutField'], 'withoutField');
- }
-
- if (!empty($annotation['name'])) {
- if (!empty($annotation['children'])) {
- $annotation['children'] = Helper::arrayMergeAndUnique("name",$refParams,$annotation['children']);
- }else{
- $annotation['children'] = $refParams;
- }
- return $annotation;
- }
-// else{
-// if (!empty($annotation[$field])) {
-// $annotation[$field] = Helper::arrayMergeAndUnique("name",$refParams,$annotation[$field]);
-// }
-// }
- return $refParams;
- }
-
-
-
-
-
- public function handleEventAnnotation($annotation,$type){
- $config = $this->config;
- if (!empty($annotation->ref)){
- if (strpos($annotation->ref, '\\') === false && !empty($config['definitions']) ) {
- $refPath = $config['definitions'] . '\\' . $annotation->ref;
- $data = $this->renderService($refPath);
- if (!empty($data[$type])){
- return $data[$type];
- }
- return [];
- }
- }
- if (!empty($annotation->value) && is_array($annotation->value)){
- $beforeInfo = Helper::objectToArray($annotation);
- $valueList = [];
- foreach ($annotation->value as $valueItem){
- $valueItemInfo = Helper::objectToArray($valueItem);
- if ($valueItem instanceof Before){
- $valueItemInfo['type'] = "before";
- }else if ($valueItem instanceof After){
- $valueItemInfo['type'] = "after";
- }
- $valueList[] = $valueItemInfo;
- }
- $beforeInfo['value'] = $valueList;
- return [$beforeInfo];
- }
- else if (!empty($annotation->value) && is_object($annotation->value)){
- $valueItemInfo = Helper::objectToArray($annotation->value);
- if ($annotation->value instanceof Before){
- $valueItemInfo['type'] = "before";
- }else if ($annotation->value instanceof After){
- $valueItemInfo['type'] = "after";
- }
- $annotation->value = [$valueItemInfo];
- return [$annotation];
- }else{
- return [$annotation];
- }
- }
-
-
-
- /**
- * 过滤指定字段、或只取指定字段
- * @param $data 参数
- * @param $fields 指定字段
- * @param string $type 处理类型
- * @return array
- */
- public static function filterParamsField(array $data, $fields, string $type = "field"): array
- {
- if (!empty($fields) && is_string($fields)){
- if (strpos($fields, ',') !== false){
- $fieldArr = explode(',', $fields);
- }else{
- $fieldArr = [$fields];
- }
- }else if (!empty($fields) && is_array($fields)){
- if (Helper::arrayKeyFirst($fields)=="name"){
- $fieldArr = $fields['name'];
- }else{
- $fieldArr = $fields;
- }
- }else{
- return $data;
- }
- $dataList = [];
- foreach ($data as $item) {
- $has = !empty($item['name']) && in_array($item['name'], $fieldArr);
- if ($has && $type === 'field') {
- $dataList[] = $item;
- } else if (!($has) && $type == "withoutField") {
- $dataList[] = $item;
- }
- }
- return $dataList;
- }
-
-
-
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/parses/ParseApiMenus.php b/vendor/hg/apidoc/src/parses/ParseApiMenus.php
deleted file mode 100644
index 6be17ab11..000000000
--- a/vendor/hg/apidoc/src/parses/ParseApiMenus.php
+++ /dev/null
@@ -1,318 +0,0 @@
-config = $config;
- }
-
- /**
- * 生成api接口数据
- * @param string $appKey
- * @param bool $isParseDetail 是否解析接口明细
- * @return array
- */
- public function renderApiMenus(string $appKey,bool $isParseDetail=false): array
- {
- $currentAppConfig = Helper::getCurrentAppConfig($appKey);
- $currentApp = $currentAppConfig['appConfig'];
- $this->currentApp = $currentApp;
-
- $controllers = [];
- if (!empty($currentApp['controllers']) && count($currentApp['controllers']) > 0) {
- // 配置的控制器列表
- $controllers = $this->getConfigControllers($currentApp['path'],$currentApp['controllers']);
- }else if(!empty($currentApp['path']) && is_array($currentApp['path']) && count($currentApp['path'])){
- // 读取paths的
- foreach ($currentApp['path'] as $path) {
- $controllersList = $this->getDirControllers($path);
- $controllers = array_merge($controllers,$controllersList);
- }
- } else if(!empty($currentApp['path']) && is_string($currentApp['path'])){
- // 默认读取path下所有的
- $controllers = $this->getDirControllers($currentApp['path']);
- }
- $apiData = [];
- if (!empty($controllers) && count($controllers) > 0) {
- foreach ($controllers as $class) {
- $classData = $this->parseController($class,$isParseDetail);
- if ($classData !== false) {
- $apiData[] = $classData;
- }
- }
- }
- // 排序
- $apiList = Helper::arraySortByKey($apiData);
-
- // 接口分组
- if (!empty($currentApp['groups'])){
- $apiList = ParseApiMenus::mergeApiGroup($apiList,$currentApp['groups']);
- }
-
- $json = array(
- "data" => $apiList,
- "tags" => $this->tags,
- "groups" => $this->groups,
- );
- return $json;
- }
-
- /**
- * 获取生成文档的控制器列表
- * @param string $path
- * @return array
- */
- public function getConfigControllers(string $path,$appControllers): array
- {
- $controllers = [];
- if (!empty($appControllers) && count($appControllers) > 0) {
- foreach ($appControllers as $item) {
- $classPath = $path."\\".$item;
- if ( class_exists($classPath)) {
- $controllers[] = $classPath;
- }
- }
- }
- return $controllers;
- }
-
- /**
- * 获取目录下的控制器列表
- * @param string $path
- * @return array
- */
- public function getDirControllers(string $path): array
- {
-
- if ($path) {
- if (strpos(APIDOC_ROOT_PATH, '/') !== false) {
- $pathStr = str_replace("\\", "/", $path);
- } else {
- $pathStr = $path;
- }
- $dir = APIDOC_ROOT_PATH . $pathStr;
- } else {
- $dir = APIDOC_ROOT_PATH . $this->controller_layer;
- }
- $controllers = [];
- if (is_dir($dir)) {
- $controllers = $this->scanDir($dir, $path);
- }
- return $controllers;
- }
-
-
-
- protected function scanDir($dir) {
-
- $classList= DirAndFile::getClassList($dir);
- $list=[];
-
- $configFilterController = !empty($this->config['filter_controllers']) ? $this->config['filter_controllers'] : [];
- $currentAppFilterController = !empty($this->currentApp['filter_controllers']) ? $this->currentApp['filter_controllers'] : [];
- $filterControllers = array_merge($configFilterController,$currentAppFilterController);
-
- $configFilterDir = !empty($this->config['filter_dirs']) ? $this->config['filter_dirs'] : [];
- $currentAppFilterDir = !empty($this->currentApp['filter_dirs']) ? $this->currentApp['filter_dirs'] : [];
- $filterDirList = array_merge($configFilterDir,$currentAppFilterDir);
- $filterDirs=[];
- foreach ($filterDirList as $dirItem) {
- $dirItemPath = DirAndFile::formatPath($dirItem,"/");
- $filterDirs[]=$dirItemPath;
- }
-
- foreach ($classList as $item) {
- $classNamespace = $item['name'];
-
- $isFilterDir = false;
- foreach ($filterDirs as $dirItem) {
- if (strpos($item['path'], $dirItem) !== false){
- $isFilterDir=true;
- }
- }
- if ($isFilterDir){
- continue;
- }else if (
- !in_array($classNamespace, $filterControllers) &&
- $this->config['definitions'] != $classNamespace
-
- ) {
- $list[] = $classNamespace;
- }
- }
-
- return $list;
- }
-
- public function parseController($class,$isParseDetail=false)
- {
-
- $refClass = new ReflectionClass($class);
- $classTextAnnotations = ParseAnnotation::parseTextAnnotation($refClass);
- $data = (new ParseAnnotation($this->config))->getClassAnnotation($refClass);
- if (in_array("NotParse", $classTextAnnotations) || isset($data['notParse'])) {
- return false;
- }
- $controllersName = $refClass->getShortName();
- $data['controller'] = $controllersName;
- $data['path'] = $class;
- if (!empty($data['group']) && !in_array($data['group'], $this->groups)) {
- $this->groups[] = $data['group'];
- }
-
- if (empty($data['title'])) {
- if (!empty($classTextAnnotations) && count($classTextAnnotations) > 0) {
- $data['title'] = $classTextAnnotations[0];
- } else {
- $data['title'] = $controllersName;
- }
- }
- $data['title'] = Lang::getLang($data['title']);
- $methodList = [];
- $data['menuKey'] = Helper::createRandKey($data['controller']);
- $isNotDebug = in_array("NotDebug", $classTextAnnotations) || isset($data['notDebug']);
- $parseApiDetail = new ParseApiDetail($this->config);
- foreach ($refClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $refMethod) {
- if ($isParseDetail){
- $methodItem = $parseApiDetail->parseApiMethod($refClass,$refMethod,$this->currentApp);
- }else{
- $methodItem = $this->parseApiMethod($refClass,$refMethod);
- }
- if ($methodItem===false){
- continue;
- }
- if ($isNotDebug) {
- $methodItem['notDebug'] = true;
- }
- $methodList[] = $methodItem;
- }
- $data['children'] = $methodList;
- if (count($methodList)===0){
- return false;
- }
- return $data;
- }
-
-
- protected function parseApiMethod($refClass,$refMethod){
- $config = $this->config;
- if (empty($refMethod->name)) {
- return false;
- }
-
- try {
- $textAnnotations = ParseAnnotation::parseTextAnnotation($refMethod);
-
- $methodInfo = (new ParseAnnotation($this->config))->getMethodAnnotation($refMethod);
- // 标注不解析的方法
- if (in_array("NotParse", $textAnnotations) || isset($methodInfo['notParse']) || empty($methodInfo)) {
- return false;
- }
- $methodInfo = ParseApiDetail::handleApiBaseInfo($methodInfo,$refClass->name,$refMethod->name,$textAnnotations,$config);
- $methodInfo['appKey'] = !empty($this->currentApp['appKey'])?$this->currentApp['appKey']:"";
- return Helper::getArrayValuesByKeys($methodInfo,['title','method','url','author','tag','name','menuKey','appKey']);
- }catch (AnnotationException $e) {
- throw new ErrorException($e->getMessage());
- }
-
- }
-
-
-
- /**
- * 对象分组到tree
- * @param $tree
- * @param $objectData
- * @param string $childrenField
- * @return array
- */
- public static function objtctGroupByTree($tree,$objectData,$childrenField='children'){
- $data = [];
- foreach ($tree as $node){
- if (!empty($node[$childrenField])){
- $node[$childrenField] = static::objtctGroupByTree($node[$childrenField],$objectData);
- }else if (!empty($objectData[$node['name']])){
- $node[$childrenField] = $objectData[$node['name']];
- }
- $node['menuKey'] = Helper::createRandKey( $node['name']);
- $data[] = $node;
- }
- return $data;
- }
-
- protected static function getAppGroupNames($groups){
- $groupNames = [];
- foreach ($groups as $item) {
- if (!empty($item['name'])){
- $groupNames[]=$item['name'];
- }
- if (!empty($item['children']) && count($item['children'])){
- $childrenNames = self::getAppGroupNames($item['children']);
- foreach ($childrenNames as $childrenName) {
- $groupNames[]=$childrenName;
- }
- }
- }
- return $groupNames;
- }
-
- /**
- * 合并接口到应用分组
- * @param $apiData
- * @param $groups
- * @return array
- */
- public static function mergeApiGroup($apiData,$groups){
- if (empty($groups) || count($apiData)<1){
- return $apiData;
- }
- $groupNames = static::getAppGroupNames($groups);
- $apiObject = [];
- foreach ($apiData as $controller){
- if (!empty($controller['group']) && in_array($controller['group'],$groupNames)){
- if (!empty($apiObject[$controller['group']])){
- $apiObject[$controller['group']][] = $controller;
- }else{
- $apiObject[$controller['group']] = [$controller];
- }
- }else{
- if (!empty($apiObject['notGroup'])){
- $apiObject['notGroup'][] = $controller;
- }else{
- $apiObject['notGroup'] = [$controller];
- }
- }
- }
- if (!empty($apiObject['notGroup'])){
- array_unshift($groups,['title'=>'未分组','name'=>'notGroup']);
- }
- $res = static::objtctGroupByTree($groups,$apiObject);
- return $res;
- }
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/parses/ParseCodeTemplate.php b/vendor/hg/apidoc/src/parses/ParseCodeTemplate.php
deleted file mode 100644
index 720abae27..000000000
--- a/vendor/hg/apidoc/src/parses/ParseCodeTemplate.php
+++ /dev/null
@@ -1,100 +0,0 @@
-config = $config;
- }
-
- public function renderCode($params)
- {
- $appKey = $params['appKey'];
- $currentAppConfig = Helper::getCurrentAppConfig($appKey);
- $currentApp = $currentAppConfig['appConfig'];
- $this->currentApp = $currentApp;
-
- $codeTemplate = $params['template'];
-
- //验证参数
-
- //验证模板文件是否存在
-
- //解析接口数据
- $tplData = [];
- if ($codeTemplate['select_mode'] == 'controller'){
- $parseApiMenusService = new ParseApiMenus($this->config);
- $controllers = $params['selected'];
- if (!empty($controllers) && count($controllers) > 0) {
- $controllerList = [];
- foreach ($controllers as $class) {
- $classData = $parseApiMenusService->parseController($class);
- if ($classData !== false) {
- $controllerList[] = $classData;
- }
- }
- if (empty($codeTemplate['multiple'])){
- $tplData = $controllerList[0];
- }else{
- $tplData = $controllerList;
- }
- }
- }else{
- // api
- $apis = $params['selected'];
- if (!empty($apis) && count($apis) > 0) {
- $parseApiDetailService = new ParseApiDetail($this->config);
- $apiList = [];
- foreach ($apis as $key) {
- $apiKey = urldecode($key);
- $apiDetail = $parseApiDetailService->renderApiDetail($appKey,$apiKey);
- if ($apiDetail !== false) {
- $apiList[] = $apiDetail;
- }
- }
- if (empty($codeTemplate['multiple'])){
- $tplData = $apiList[0];
- }else{
- $tplData = $apiList;
- }
- }
- }
-
-
- // 读取模板
- $templatePath =DirAndFile::formatPath( APIDOC_ROOT_PATH . $codeTemplate['template'],"/");
- if (is_readable($templatePath) == false) {
- throw new ErrorException("template not found", [
- 'template' => $template
- ]);
- }
- $tplParams = [
- 'form'=> $params['form'],
- 'data'=>$tplData
- ];
- $html = (new ParseTemplate())->compile($templatePath,$tplParams);
-
-
-
- return $html;
- }
-
-
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/parses/ParseMarkdown.php b/vendor/hg/apidoc/src/parses/ParseMarkdown.php
deleted file mode 100644
index cd9a4a0b9..000000000
--- a/vendor/hg/apidoc/src/parses/ParseMarkdown.php
+++ /dev/null
@@ -1,139 +0,0 @@
-config = $config;
- }
-
- /**
- * 获取md文档菜单
- * @return array
- */
- public function getDocsMenu($appKey,string $lang): array
- {
- $config = $this->config;
- $docData = [];
- if (!empty($config['docs']) && count($config['docs']) > 0) {
- $docData = $this->handleDocsMenuData($config['docs'],$appKey,$lang);
- }
- return $docData;
- }
-
- /**
- * 处理md文档菜单数据
- * @param array $menus
- * @return array
- */
- protected function handleDocsMenuData(array $menus,$appKey,string $lang): array
- {
- $list = [];
- foreach ($menus as $item) {
- $item['title'] = Lang::getLang($item['title']);
- if (!empty($item['appKey']) && $item['appKey'] != $appKey){
- continue;
- }
-
- if (!empty($item['children']) && count($item['children']) > 0) {
- $item['children'] = $this->handleDocsMenuData($item['children'],$appKey,$lang);
- $item['menuKey'] = Helper::createRandKey("md_group");
- } else {
- $filePath = static::getFilePath($appKey,$item['path'],$lang);
- if (!file_exists($filePath['filePath'])) {
- continue;
- }
-
- if(!empty($item['path'])){
- $item['path'] = Helper::replaceTemplate($item['path'],['lang'=>$lang]);
- }
- $item['type'] = 'md';
- $item['menuKey'] = Helper::createApiKey($item['path']);
- }
- $list[] = $item;
- }
- return $list;
- }
-
- public static function getFilePath(string $appKey, string $path,$lang=""){
- if (!empty($appKey)){
- $currentAppConfig = Helper::getCurrentAppConfig($appKey);
- $currentApps = $currentAppConfig['apps'];
- $fullPath = Helper::replaceCurrentAppTemplate($path, $currentApps);
- }else{
- $fullPath = $path;
- }
- $fullPath = Helper::replaceTemplate($fullPath,[
- 'lang'=>$lang
- ]);
-
- if (strpos($fullPath, '#') !== false) {
- $mdPathArr = explode("#", $fullPath);
- $mdPath=$mdPathArr[0];
- $mdAnchor =$mdPathArr[1];
- } else {
- $mdPath = $fullPath;
- $mdAnchor="";
- }
- $fileSuffix = "";
- if (strpos($fullPath, '.md') === false) {
- $fileSuffix = ".md";
- }
- $filePath = APIDOC_ROOT_PATH . $mdPath . $fileSuffix;
- return [
- 'filePath'=>$filePath,
- 'anchor'=>$mdAnchor
- ];
- }
-
-
- /**
- * 获取md文档内容
- * @param string $appKey
- * @param string $path
- * @return string
- */
- public static function getContent(string $appKey, string $path,$lang="")
- {
- $filePathArr = static::getFilePath($appKey,$path,$lang);
- $mdAnchor = $filePathArr['anchor'];
- $filePath = $filePathArr['filePath'];
- if (!file_exists($filePath)) {
- return $path;
- }
- $contents = DirAndFile::getFileContent($filePath);
- // 获取指定h2标签内容
- if (!empty($mdAnchor)){
- if (strpos($contents, '## ') !== false) {
- $contentArr = explode("\r\n", $contents);
- $contentText = "";
- foreach ($contentArr as $line){
- $contentText.="\r\n".trim($line);
- }
- $contentArr = explode("\r\n## ", $contentText);
- $content="";
- foreach ($contentArr as $item){
- $itemArr = explode("\r\n", $item);
- if (!empty($itemArr) && $itemArr[0] && $mdAnchor===$itemArr[0]){
- $content = str_replace($itemArr[0]."\r\n", '', $item);
- break;
- }
- }
- return $content;
- }
- }
- return $contents;
- }
-
-
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/parses/ParseModel.php b/vendor/hg/apidoc/src/parses/ParseModel.php
deleted file mode 100644
index dbe81e374..000000000
--- a/vendor/hg/apidoc/src/parses/ParseModel.php
+++ /dev/null
@@ -1,162 +0,0 @@
-config = $config;
- }
-
- public function parseModelTable($model, $classReflect, $methodName = "")
- {
- if (!is_callable(array($model, 'getTable'))) {
- return false;
- }
- $config = $this->config;
- try {
- // 获取所有模型属性
- $propertys = $classReflect->getDefaultProperties();
- $tableName = $model->getTable();
- $configTablePrefix = !empty($config['database']) && !empty($config['database']['prefix']) ? $config['database']['prefix'] : "";
- if (!empty($configTablePrefix) && strpos($tableName, $configTablePrefix) === false) {
- $tableName = $configTablePrefix . $model->getTable();
- }
- $table = $this->getTableDocument($tableName, $propertys, $model);
- if (empty($methodName)) {
- return $table;
- }
-
- $methodReflect = $classReflect->getMethod($methodName);
- $annotations = (new ParseAnnotation($config))->getMethodAnnotation($methodReflect);
- if (!empty($annotations['field'])) {
- $table = ParseApiDetail::filterParamsField($table, $annotations['field'], 'field');
- }
- if (!empty($annotations['withoutField'])) {
- $table = ParseApiDetail::filterParamsField($table, $annotations['withoutField'], 'withoutField');
- }
- if (!empty($annotations['addField'])) {
- $addFieldData = [];
- if (is_int(Helper::arrayKeyFirst($annotations['addField']))) {
- $addFieldData = $annotations['addField'];
- } else {
- $addFieldData = [$annotations['addField']];
- }
- $addFieldList = [];
- $parseApiDetail = new ParseApiDetail($config);
- $field = 'param';
- foreach ($addFieldData as $fieldItem) {
- if (!empty($fieldItem['ref'])) {
- $refParams = $parseApiDetail->renderRef($fieldItem['ref'], $field);
- if (!empty($refParams[$field])) {
- $fieldItem = $parseApiDetail->handleRefData($fieldItem, $refParams[$field], $field);
- }
- }
- if (!empty($fieldItem['md'])) {
- $fieldItem['md'] = ParseMarkdown::getContent("", $fieldItem['md']);
- }
- // 自定义解析
- if (!empty($config['parsesAnnotation'])) {
- $callback = $config['parsesAnnotation']($fieldItem);
- if (!empty($callback)) {
- $fieldItem = $callback;
- }
- }
- $addFieldList[] = $fieldItem;
- }
- $table = Helper::arrayMergeAndUnique("name", $table, $addFieldList);
- }
- return $table;
- } catch (\ReflectionException $e) {
- throw new ErrorException('Class ' . get_class($model) . ' ' . $e->getMessage());
- }
-
- }
-
- /**
- * 获取模型实例
- * @param $method
- * @return mixed|null
- */
- public static function getModelClass($namespaceName)
- {
- if (!empty($namespaceName) && class_exists($namespaceName)) {
- $modelInstance = new $namespaceName();
- if (is_callable(array($modelInstance, 'getTable'))) {
- return $modelInstance;
- }
- }
- return null;
- }
-
-
- /**
- * 获取模型注解数据
- * @param $tableName
- * @param $propertys
- * @return array
- */
- public function getTableDocument($tableName, array $propertys, $model = null): array
- {
- $config = $this->config;
- $fieldComment = [];
- if (empty($config['database_query_function'])) {
- throw new ErrorException("not datatable_query_function config");
- }
- $tableColumns = $config['database_query_function']("SHOW FULL COLUMNS FROM `" . $tableName . "`");
- foreach ($tableColumns as $columns) {
- $columns = Helper::objectToArray($columns);
- $name = $columns['Field'];
- $desc = $columns['Comment'];
- $mock = "";
- $md = "";
- if (isset($propertys['convertNameToCamel']) && $propertys['convertNameToCamel'] === true) {
- $name = Helper::camel($name);
- }
- if (!empty($desc)) {
- // 存在字段注释
- $desc = Lang::getLang($desc);
- if (strpos($desc, 'mock(') !== false) {
- // 存在mock
- preg_match('#mock\((.*)\)#s', $desc, $mocks);
- if (!empty($mocks[1])) {
- $mock = $mocks[1];
- $desc = str_replace($mocks[0], "", $desc);
- }
- }
- if (strpos($desc, 'md="') !== false) {
- // 存在md
- preg_match('#md="(.*)"#s', $desc, $mdRefs);
- if (!empty($mdRefs[1])) {
- $md = ParseMarkdown::getContent("", $mdRefs[1]);
- $desc = str_replace($mdRefs[0], "", $desc);
- }
- }
- }
- $fieldComment[] = [
- "name" => $name,
- "type" => $columns['Type'],
- "desc" => $desc,
- "default" => $columns['Default'],
- "require" => $columns['Null'] != "YES",
- "mock" => $mock,
- "md" => $md,
- ];
- }
- return $fieldComment;
- }
-
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/providers/BaseService.php b/vendor/hg/apidoc/src/providers/BaseService.php
deleted file mode 100644
index 91303aa8f..000000000
--- a/vendor/hg/apidoc/src/providers/BaseService.php
+++ /dev/null
@@ -1,172 +0,0 @@
-'config','route'=>'getConfig'],
- ['rule'=>'apiMenus','route'=>'getApiMenus'],
- ['rule'=>'apiDetail','route'=>'getApiDetail'],
- ['rule'=>'docMenus','route'=>'getMdMenus'],
- ['rule'=>'docDetail','route'=>'getMdDetail'],
- ['rule'=>'verifyAuth','route'=>'verifyAuth'],
- ['rule'=>'generator','route'=>'createGenerator'],
- ['rule'=>'cancelAllCache','route'=>'cancelAllCache'],
- ['rule'=>'createAllCache','route'=>'createAllCache'],
- ['rule'=>'renderCodeTemplate','route'=>'renderCodeTemplate'],
- ['rule'=>'allApiMenus','route'=>'getAllApiMenus'],
- ['rule'=>'addApiShare','route'=>'addApiShare'],
- ['rule'=>'getApiShareList','route'=>'getApiShareList'],
- ['rule'=>'getApiShareDetail','route'=>'getApiShareDetail'],
- ['rule'=>'deleteApiShare','route'=>'deleteApiShare'],
- ['rule'=>'handleApiShareAction','route'=>'handleApiShareAction'],
- ];
-
-
-
- /**
- * 获取apidoc配置
- * @return array 返回apidoc配置
- */
- abstract static function getApidocConfig();
-
-
- /**
- * 注册apidoc路由
- * @param $route 路由参数
- * @return mixed
- */
- abstract static function registerRoute($route);
-
- /**
- * 执行Sql语句
- * @return mixed
- */
- abstract static function databaseQuery($sql);
-
- /**
- * 获取项目根目录
- * @return string 返回项目根目录
- */
- abstract static function getRootPath();
-
- /**
- * 获取缓存目录
- * @return string 返回项目缓存目录
- */
- abstract static function getRuntimePath();
-
-
- /**
- * 设置当前语言
- * @param $locale 语言标识
- * @return mixed
- */
- abstract static function setLang($locale);
-
- /**
- * 获取语言定义
- * @param $lang
- * @return string
- */
- abstract static function getLang($lang);
-
-
- /**
- * 处理apidoc接口响应的数据
- * @return mixed
- */
- abstract static function handleResponseJson($res);
-
- abstract static function getTablePrefix();
-
- // 自动注册api路由
- static public function autoRegisterRoutes($routeFun,$config=""){
- if (empty($config)){
- $config = self::getApidocConfig();
- }
- if (isset($config['auto_register_routes']) && $config['auto_register_routes']===true) {
- $cacheKey = "apis/autoRegisterRoutes";
- if (!empty($config['cache']) && $config['cache']['enable']) {
- $cacheData = (new Cache())->get($cacheKey);
- if (!empty($cacheData)) {
- $autoRegisterApis = $cacheData;
- } else {
- $autoRegisterApis = (new AutoRegisterRouts($config))->getAppsApis();
- (new Cache())->set($cacheKey, $autoRegisterApis);
- }
- } else {
- $autoRegisterApis = (new AutoRegisterRouts($config))->getAppsApis();
- }
- $routeFun($autoRegisterApis);
- }
- }
-
- public function initConfig(){
- ! defined('APIDOC_ROOT_PATH') && define('APIDOC_ROOT_PATH', $this->getRootPath());
- ! defined('APIDOC_STORAGE_PATH') && define('APIDOC_STORAGE_PATH', $this->getRuntimePath());
- $config = self::getApidocConfig();
- if (empty($config['database_query_function'])){
- $config['database_query_function'] = function ($sql){
- return self::databaseQuery($sql);
- };
- }
- if (empty($config['lang_register_function'])){
- $config['lang_register_function'] = function ($sql){
- return self::setLang($sql);
- };
- }
- if (empty($config['lang_get_function'])){
- $config['lang_get_function'] = function ($lang){
- return self::getLang($lang);
- };
- }
- $config['handle_response_json'] = function ($res){
- return self::handleResponseJson($res);
- };
- $table_prefix = self::getTablePrefix();
- if (!empty($config['database'])){
- if (empty($config['prefix'])){
- $config['database']['prefix'] = $table_prefix;
- }
- }else{
- $config['database']=[
- 'prefix'=>$table_prefix
- ];
- }
- ConfigProvider::set($config);
- }
-
- /**
- * @param null $routeFun
- */
- static public function registerApidocRoutes($routeFun=null){
- $routes = static::$routes;
- $controller_namespace = '\hg\apidoc\Controller@';
- $route_prefix = "/apidoc";
- $config = self::getApidocConfig();
- if (!empty($config) && !empty($config['route_prefix'])){
- $route_prefix = $config['route_prefix'];
- }
- foreach ($routes as $item) {
- $route = [
- 'uri'=>$route_prefix."/".$item['rule'],
- 'callback'=>$controller_namespace.$item['route'],
- 'route'=>$item['route'],
- ];
- if (!empty($routeFun)){
- $routeFun($route);
- }else{
- self::registerRoute($route);
- }
- }
- }
-
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/providers/CommonService.php b/vendor/hg/apidoc/src/providers/CommonService.php
deleted file mode 100644
index 0fc5cbe2d..000000000
--- a/vendor/hg/apidoc/src/providers/CommonService.php
+++ /dev/null
@@ -1,56 +0,0 @@
- [HyperfMiddleware::class]]);
- });
-
- // 自动注册路由
- CommonService::autoRegisterRoutes(function ($routeData){
- foreach ($routeData as $controller) {
- if (count($controller['methods'])){
- $methods= $controller['methods'];
- $routeCallback = function ()use ($methods){
- foreach ($methods as $method) {
- $apiMethods = Helper::handleApiMethod($method['method']);
- $options = [];
- if (!empty($method['middleware'])){
- $options['middleware']= $method['middleware'];
- }
- Router::addRoute([...$apiMethods,'OPTIONS'],$method['url'], $method['controller']."@".$method['name'],$options);
- }
- };
- $groupOptions = [];
- if (!empty($controller['middleware'])){
- $groupOptions['middleware'] = $controller['middleware'];
- }
- Router::addGroup("",$routeCallback,$groupOptions);
- }
- }
- }, HyperfMiddleware::getApidocConfig());
- }
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/providers/LaravelService.php b/vendor/hg/apidoc/src/providers/LaravelService.php
deleted file mode 100644
index 7a5fa94ef..000000000
--- a/vendor/hg/apidoc/src/providers/LaravelService.php
+++ /dev/null
@@ -1,110 +0,0 @@
-publishes([
- __DIR__.'/../config.php' => config_path('apidoc.php'),
- ]);
- }
-
- public function register()
- {
- $config = static::getApidocConfig();
- $this->initConfig();
- self::registerApidocRoutes();
-
- // 自动注册路由
- self::autoRegisterRoutes(function ($routeData){
- foreach ($routeData as $controller) {
- if (count($controller['methods'])){
- $methods= $controller['methods'];
- $routeCallback = function ()use ($methods){
- foreach ($methods as $method) {
- $apiMethods = Helper::handleApiMethod($method['method']);
- $route = Route::match($apiMethods + ['OPTIONS'],$method['url'], "\\".$method['controller']."@".$method['name']);
- if (!empty($method['middleware'])){
- $route->middleware($method['middleware']);
- }
- }
- };
- $routeGroup = Route::prefix("");
- if (!empty($controller['middleware'])){
- $routeGroup->middleware($controller['middleware']);
- }
- $routeGroup->group($routeCallback);
- }
- }
- });
-
- }
-
- static function getApidocConfig()
- {
- $config = config("apidoc");
- if (!(!empty($config['auto_url']) && !empty($config['auto_url']['filter_keys']))){
- $config['auto_url']['filter_keys'] = ['App','Http','Controllers'];
- }
- $config['app_frame'] = "laravel";
- return $config;
- }
-
- static function registerRoute($route){
- $config = self::getApidocConfig();
- $registerRoute = Route::any($route['uri'], $route['callback']);
- $registerRoute->middleware([LaravelMiddleware::class]);
- if (!empty($config['allowCrossDomain'])) {
- $registerRoute->middleware([ApiCrossDomain::class]);
- }
- }
-
- static function databaseQuery($sql){
- return DB::select($sql);
- }
-
- static function getTablePrefix(){
- $driver = config('database.default');
- $table_prefix=config('database.connections.'.$driver.'.prefix');
- return $table_prefix;
- }
-
- static function getRootPath()
- {
- return base_path()."/";
- }
-
- static function getRuntimePath()
- {
- return storage_path()."/";
- }
-
- static function setLang($locale){
- Lang::setLocale($locale);
- }
-
- static function getLang($lang){
- return trans($lang);
- }
-
- static function handleResponseJson($res){
- return $res;
- }
-
-
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/providers/ThinkPHP5Service.php b/vendor/hg/apidoc/src/providers/ThinkPHP5Service.php
deleted file mode 100644
index c301ba041..000000000
--- a/vendor/hg/apidoc/src/providers/ThinkPHP5Service.php
+++ /dev/null
@@ -1,94 +0,0 @@
-initConfig();
- self::registerApidocRoutes();
- // 自动注册路由
- self::autoRegisterRoutes(function ($routeData){
- $appRoute = app('route');
- $routeGroup = $appRoute->getGroup();
- foreach ($routeData as $controller) {
- $routeGroup = $appRoute->getGroup();
- if (!empty($controller['middleware'])){
- $routeGroup->middleware($controller['middleware']);
- }
- if (count($controller['methods'])){
- foreach ($controller['methods'] as $method) {
- $apiMethods = Helper::handleApiMethod($method['method']);
- $apiMethods = implode("|",$apiMethods);
- $route = $routeGroup->addRule($method['url'],$method['controller']."@".$method['name'],$apiMethods);
- if (!empty($method['middleware'])){
- $route->middleware($method['middleware']);
- }
- }
- }
- }
- });
- }
-
- static function getApidocConfig()
- {
- $config = config("apidoc.");
- if (!(!empty($config['auto_url']) && !empty($config['auto_url']['filter_keys']))){
- $config['auto_url']['filter_keys'] = ['app','controller'];
- }
- $config['app_frame'] = "thinkphp5";
- return $config;
- }
-
- static function registerRoute($route){
- $config = self::getApidocConfig();
- $registerRoute = Route::rule($route['uri'], $route['callback'],"*");
- if (!empty($config['allowCrossDomain'])) {
- $registerRoute->allowCrossDomain();
- }
- }
-
- static function databaseQuery($sql){
- return Db::query($sql);
- }
-
- static function getTablePrefix(){
- $driver = config('database.default');
- $table_prefix=config('database.connections.'.$driver.'.prefix');
- return $table_prefix;
- }
-
- static function getRootPath()
- {
- return App::getRootPath();
- }
-
- static function getRuntimePath()
- {
- return App::getRuntimePath();
- }
-
- static function setLang($locale){
- Lang::setLangCookieVar($locale);
- }
-
- static function getLang($lang){
- return Lang::get($lang);
- }
-
- static function handleResponseJson($res){
- return json($res);
- }
-
-
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/providers/ThinkPHPService.php b/vendor/hg/apidoc/src/providers/ThinkPHPService.php
deleted file mode 100644
index 767699e7a..000000000
--- a/vendor/hg/apidoc/src/providers/ThinkPHPService.php
+++ /dev/null
@@ -1,107 +0,0 @@
-initConfig();
-
- $this->registerRoutes(function () use($config){
- //注册apidoc所需路由
- self::registerApidocRoutes(function ($route)use ($config){
- $registerRoute = Route::any($route['uri'], $route['callback']);
- $registerRoute->middleware([ThinkPHPMiddleware::class]);
- if (!empty($config['allowCrossDomain'])) {
- $registerRoute->allowCrossDomain();
- }
- });
-
- // 自动注册路由
- self::autoRegisterRoutes(function ($routeData){
- $appRoute = $this->app->route;
- $appName = $this->app->http->getName();
- foreach ($routeData as $controller) {
- $routeGroup = $appRoute->getGroup();
- if (!empty($controller['middleware'])){
- $routeGroup->middleware($controller['middleware']);
- }
- if (count($controller['methods'])){
- foreach ($controller['methods'] as $method) {
- if (!empty($appName)){
- $method['url'] = str_replace("/".$appName,'',$method['url']);
- }
- $apiMethods = Helper::handleApiMethod($method['method']);
- $apiMethods = implode("|",$apiMethods);
- $route = $routeGroup->addRule($method['url'],$method['controller']."@".$method['name'],$apiMethods);
- if (!empty($method['middleware'])){
- $route->middleware($method['middleware']);
- }
- }
- }
- }
- });
- });
- }
-
- static function registerRoute($route){
- $registerRoute = Route::any($route['uri'], $route['callback']);
- }
-
- static function databaseQuery($sql){
- return Db::query($sql);
- }
-
- static function getTablePrefix(){
- $driver = config('database.default');
- $table_prefix=config('database.connections.'.$driver.'.prefix');
- return $table_prefix;
- }
-
- static function getRootPath()
- {
- return App::getRootPath();
- }
-
- static function getRuntimePath()
- {
- return App::getRuntimePath();
- }
-
- static function setLang($locale){
- \think\facade\App::loadLangPack($locale);
- Lang::setLangSet($locale);
- }
-
- static function getLang($lang){
- return Lang::get($lang);
- }
-
- static function handleResponseJson($res){
- return json($res);
- }
-
-
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/providers/WebmanService.php b/vendor/hg/apidoc/src/providers/WebmanService.php
deleted file mode 100644
index 63aa3baa9..000000000
--- a/vendor/hg/apidoc/src/providers/WebmanService.php
+++ /dev/null
@@ -1,43 +0,0 @@
-middleware([WebmanMiddleware::class]);
- });
-
- // 自动注册路由
- CommonService::autoRegisterRoutes(function ($routeData){
- foreach ($routeData as $controller) {
- if (count($controller['methods'])){
- $methods= $controller['methods'];
- $routeCallback = function ()use ($methods){
- foreach ($methods as $method) {
- $apiMethods = Helper::handleApiMethod($method['method']);
- $route = Route::add([...$apiMethods,'OPTIONS'],$method['url'], $method['controller']."@".$method['name']);
- if (!empty($method['middleware'])){
- $route->middleware($method['middleware']);
- }
- }
- };
- $routeGroup = Route::group("",$routeCallback);
- if (!empty($controller['middleware'])){
- $routeGroup->middleware($controller['middleware']);
- }
- }
- }
- }, WebmanMiddleware::getApidocConfig());
- }
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/utils/AbstractAnnotation.php b/vendor/hg/apidoc/src/utils/AbstractAnnotation.php
deleted file mode 100644
index 8ed02b1f3..000000000
--- a/vendor/hg/apidoc/src/utils/AbstractAnnotation.php
+++ /dev/null
@@ -1,36 +0,0 @@
-formatParams($value);
- foreach ($formattedValue as $key => $val) {
- if ($key=="value" && !property_exists($this, $key)){
- $this->name = $val;
- }else{
- $this->{$key} = $val;
- }
- }
- }
-
- protected function formatParams($value): array
- {
- if (isset($value[0])) {
- $value = $value[0];
- }
- if (!is_array($value)) {
- $value = ['name' => $value];
- }
- return $value;
- }
-}
diff --git a/vendor/hg/apidoc/src/utils/ApiCrossDomain.php b/vendor/hg/apidoc/src/utils/ApiCrossDomain.php
deleted file mode 100644
index e09b7204b..000000000
--- a/vendor/hg/apidoc/src/utils/ApiCrossDomain.php
+++ /dev/null
@@ -1,22 +0,0 @@
-server('HTTP_ORIGIN') ? $request->server('HTTP_ORIGIN') : '';
- $response->header('Access-Control-Allow-Origin', $origin);
- $response->header('Access-Control-Allow-Headers', 'Origin, Content-Type, Cookie, X-CSRF-TOKEN, Accept, Authorization, X-XSRF-TOKEN');
- $response->header('Access-Control-Expose-Headers', 'Authorization, authenticated');
- $response->header('Access-Control-Allow-Methods', 'GET, POST, PATCH, PUT, OPTIONS');
- $response->header('Access-Control-Allow-Credentials', 'true');
- return $response;
-
- }
-
-
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/utils/ApiShare.php b/vendor/hg/apidoc/src/utils/ApiShare.php
deleted file mode 100644
index 05c8a4f48..000000000
--- a/vendor/hg/apidoc/src/utils/ApiShare.php
+++ /dev/null
@@ -1,165 +0,0 @@
- $params['name'],
- 'type' => $params['type'],
- ];
- if (!empty($params['appKeys'])) {
- $data['appKeys'] = $params['appKeys'];
- }
- if (!empty($params['apiKeys'])) {
- $data['apiKeys'] = $params['apiKeys'];
- }
- if (!empty($params['password'])) {
- $data['password'] = $params['password'];
- }
- $data['create_at'] = date('Y-m-d h:i:s');
- $data['create_time'] = time();
- $res = (new Cache())->set($cacheKey, $data);
- return $res;
- }
-
- public function getSharePageList($config,$pageIndex,$pageSize){
- $path = APIDOC_STORAGE_PATH . $config['cache']['folder'] . "/share";
-
- $list = DirAndFile::getFileList($path);
- $data = [];
- $cache = new Cache();
-
- foreach ($list as $item) {
- $fileNameArr = explode("_", $item['name']);
- $cacheKey = "share/" . $fileNameArr[0] . "_" . $fileNameArr[1];
- $cacheData = $cache->get($cacheKey);
- $itemData = [
- 'key' => $fileNameArr[1],
- 'name' => $cacheData['name'],
- 'type' => $cacheData['type'],
- 'create_time' => $cacheData['create_time'],
- 'create_at' => $cacheData['create_at'],
- ];
- $data[] = $itemData;
- }
- $data = Helper::arraySortByKey($data, 'create_time', SORT_DESC);
- $page = $pageIndex-1;
- $res = array_slice($data,$page*$pageSize,$pageSize);
- return [
- 'total'=>count($data),
- 'data'=>$res
- ];
- }
-
-
- public function getShareDetailByKey($shareKey)
- {
- if (empty($shareKey)) {
- throw new ErrorException('field not found', ['field' => 'shareKey']);
- }
- $cache = new Cache();
- $cacheKey = static::getShareCacheKey($shareKey);
- $cacheData = $cache->get($cacheKey);
- if (empty($cacheData)) {
- throw new ErrorException("share not exists");
- }
- return $cacheData;
- }
-
- public function checkShareAuth($config, $params)
- {
- if (empty($params['shareKey'])) {
- throw new ErrorException('field not found', ['field' => 'shareKey']);
- }
- $cacheData = $this->getShareDetailByKey($params['shareKey']);
-
- if (!empty($cacheData['password'])) {
- //验证密码
- if (empty($params['token'])) {
- throw new ErrorException("token not found");
- }
- $password = md5($cacheData['password']);
- $cacheData['pass'] = $password;
- $checkAuth = (new Auth($config))->checkToken($params['token'], $password);
- if (!$checkAuth) {
- throw new ErrorException("token error");
- }
- }
- return $cacheData;
- }
-
- public static function getAppShareApis(array $config, array $apps, $parentKey = "", $filterAppKeys = [], $isParseDetail = false)
- {
- $appList = [];
- $separ = !empty($parentKey) ? ',' : '';
- foreach ($apps as $app) {
- $appKey = $parentKey . $separ . $app['key'];
- if (!empty($app['items']) && count($app['items'])) {
- $items = static::getAppShareApis($config, $app['items'], $appKey, $filterAppKeys, $isParseDetail);
- $app['children'] = $items;
- } else {
- $app['appKey'] = $appKey;
- $apiData = (new ParseApiMenus($config))->renderApiMenus($appKey, $isParseDetail);
- $app['children'] = $apiData['data'];
- }
- if (!empty($filterAppKeys) && count($filterAppKeys) && !in_array($appKey, $filterAppKeys) && empty($app['items'])) {
- continue;
- }
- $app['menuKey'] = $appKey;
- $appList[] = $app;
- }
-
- return $appList;
- }
-
- public function getShareData($config, $key)
- {
- $shareData = $this->getShareDetailByKey($key);
- $filterAppKeys = !empty($shareData['appKeys']) ? $shareData['appKeys'] : [];
- $configApps = Helper::handleAppsConfig($config['apps'], false, $config);
- $appList = static::getAppShareApis($config, $configApps, "", $filterAppKeys, true);
- if ($shareData['type'] == 'api') {
- $appList = Helper::filterTreeNodesByKeys($appList, $shareData['apiKeys'], 'menuKey');
- }
- return [
- 'shareData' => $shareData,
- 'apiData' => $appList,
- ];
- }
-
- public function handleApiShareAction($config, $key, $index)
- {
-
- $actionConfig = $config['share']['actions'][$index];
- if (!empty($actionConfig['click'])) {
- $data = $this->getShareData($config, $key);
- $res = $actionConfig['click']($data['shareData'], $data['apiData']);
- return $res;
- }
- return false;
-
- }
-
-
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/utils/AutoRegisterRouts.php b/vendor/hg/apidoc/src/utils/AutoRegisterRouts.php
deleted file mode 100644
index b54e53711..000000000
--- a/vendor/hg/apidoc/src/utils/AutoRegisterRouts.php
+++ /dev/null
@@ -1,154 +0,0 @@
-config = $config;
- }
-
- /**
- * 解析所有应用的api
- * @return array
- */
- public function getAppsApis(){
- $apps = Helper::getAllApps($this->config['apps']);
- $apiList = [];
- if (!empty($apps) && count($apps)){
- foreach ($apps as $app) {
- $apis = $this->getAppApis($app);
- $apiList=array_merge($apiList,$apis);
- }
- }
- return $apiList;
-
- }
-
- /**
- * 生成api接口数据
- * @param array $app
- * @return array
- */
- public function getAppApis($app)
- {
- $controllers = [];
- if (!empty($app['controllers']) && count($app['controllers']) > 0) {
- // 配置的控制器列表
- $controllers = (new ParseApiMenus($this->config))->getConfigControllers($app['path'],$app['controllers']);
- }else if(!empty($app['path']) && is_array($app['path']) && count($app['path'])){
- $parseApiMenus = new ParseApiMenus($this->config);
- foreach ($app['path'] as $path) {
- $controllersList = $parseApiMenus->getDirControllers($path);
- $controllers = array_merge($controllers,$controllersList);
- }
- } else if(!empty($app['path']) && is_string($app['path'])) {
- // 默认读取所有的
- $controllers = (new ParseApiMenus($this->config))->getDirControllers($app['path']);
- }
-
- $routeData = [];
- if (!empty($controllers) && count($controllers) > 0) {
- foreach ($controllers as $class) {
- $classData = $this->parseController($class);
- if ($classData !== false) {
- $routeData[] = $classData;
- }
- }
- }
- return $routeData;
- }
-
-
- public function parseController($class)
- {
- $refClass = new ReflectionClass($class);
- $classTextAnnotations = ParseAnnotation::parseTextAnnotation($refClass);
- $classAnnotations = (new ParseAnnotation($this->config))->getClassAnnotation($refClass);
- if (in_array("NotParse", $classTextAnnotations) || isset($classAnnotations['notParse'])) {
- return false;
- }
-
-
- $methodList = [];
- foreach ($refClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $refMethod) {
- $methodItem = $this->parseApiMethod($refClass,$refMethod);
- if ($methodItem===false){
- continue;
- }
- $methodList[] = $methodItem;
- }
- if (count($methodList)===0){
- return false;
- }
- $data = [
- 'name'=>$refClass->name,
- 'methods'=>$methodList,
- ];
-
- //控制器中间件
- if (!empty($classAnnotations['routeMiddleware']) && !empty($classAnnotations['routeMiddleware'])) {
- $data['middleware'] = $classAnnotations['routeMiddleware'];
- }
- return $data;
- }
-
-
- protected function parseApiMethod($refClass,$refMethod){
- if (empty($refMethod->name) || in_array($refMethod->name,$this->filterMethods)) {
- return false;
- }
- $config = $this->config;
- $textAnnotations = ParseAnnotation::parseTextAnnotation($refMethod);
- $methodAnnotation = (new ParseAnnotation($config))->getMethodAnnotation($refMethod);
- if (in_array("NotParse", $textAnnotations) || isset($methodAnnotation['notParse'])) {
- return false;
- }
-
- if (empty($methodAnnotation['method'])) {
- $method = !empty($config['default_method']) ? strtoupper($config['default_method']) : '*';
- }else{
- $method = $methodAnnotation['method'];
- }
- if (empty($methodAnnotation['url'])) {
- $url = ParseApiDetail::autoCreateUrl($refClass->name,$refMethod->name,$config);
- }else{
- $url = $methodAnnotation['url'];
- }
- if (!empty($url) && substr($url, 0, 1) != "/") {
- $url = "/" . $url;
- }
- $data = [
- 'url'=>$url,
- 'method'=>$method,
- 'name'=>$refMethod->name,
- 'controller'=>$refClass->name,
- ];
- if (!empty($methodAnnotation['routeMiddleware']) && !empty($methodAnnotation['routeMiddleware'])) {
- $data['middleware'] = $methodAnnotation['routeMiddleware'];
- }
- return $data;
-
- }
-
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/utils/Cache.php b/vendor/hg/apidoc/src/utils/Cache.php
deleted file mode 100644
index 51b19020a..000000000
--- a/vendor/hg/apidoc/src/utils/Cache.php
+++ /dev/null
@@ -1,298 +0,0 @@
- 0,
- 'cache_subdir' => true,
- 'prefix' => '',
- 'path' => '',
- 'hash_type' => 'md5',
- 'data_compress' => false,
- 'serialize' => [],
- ];
-
- /**
- * 架构函数
- * @param array $options 参数
- */
- public function __construct( array $options = [])
- {
- if (!empty($options)) {
- $this->options = array_merge($this->options, $options);
- }
-
- if (empty($this->options['path'])) {
- $this->options['path'] = APIDOC_STORAGE_PATH .'/'. 'apidoc';
- }
-
- if (substr($this->options['path'], -1) != DIRECTORY_SEPARATOR) {
- $this->options['path'] .= DIRECTORY_SEPARATOR;
- }
- }
-
- /**
- * 取得变量的存储文件名
- * @access public
- * @param string $name 缓存变量名
- * @return string
- */
- public function getCacheKey(string $name): string
- {
- $name = $name."_".hash($this->options['hash_type'], $name);
-
- if ($this->options['prefix']) {
- $name = $this->options['prefix'] . DIRECTORY_SEPARATOR . $name;
- }
-
- return $this->options['path'] . $name . '.php';
- }
-
- /**
- * 序列化数据
- * @access protected
- * @param mixed $data 缓存数据
- * @return string
- */
- protected function serialize($data): string
- {
- if (is_numeric($data)) {
- return (string) $data;
- }
-
- $serialize = $this->options['serialize'][0] ?? "serialize";
-
- return $serialize($data);
- }
-
-
- /**
- * 反序列化数据
- * @access protected
- * @param string $data 缓存数据
- * @return mixed
- */
- protected function unserialize($data)
- {
- if (is_numeric($data)) {
- return $data;
- }
-
- $unserialize = $this->options['serialize'][1] ?? "unserialize";
-
- return $unserialize($data);
- }
-
-
- /**
- * 获取有效期
- * @access protected
- * @param integer|DateTimeInterface|DateInterval $expire 有效期
- * @return int
- */
- protected function getExpireTime($expire): int
- {
- if ($expire instanceof DateTimeInterface) {
- $expire = $expire->getTimestamp() - time();
- } elseif ($expire instanceof DateInterval) {
- $expire = DateTime::createFromFormat('U', (string) time())
- ->add($expire)
- ->format('U') - time();
- }
-
- return (int) $expire;
- }
-
- /**
- * 获取缓存数据
- * @param string $name 缓存标识名
- * @return array|null
- */
- protected function getRaw(string $name)
- {
- $filename = $this->getCacheKey($name);
-
- if (!is_file($filename)) {
- return;
- }
-
- $content = @file_get_contents($filename);
-
- if (false !== $content) {
- $expire = (int) substr($content, 8, 12);
- $createTime = filemtime($filename);
- if (0 != $expire && time() - $expire > $createTime) {
- //缓存过期删除缓存文件
- DirAndFile::unlink($item->getPathname());
- return;
- }
-
- $content = substr($content, 32);
-
- if ($this->options['data_compress'] && function_exists('gzcompress')) {
- //启用数据压缩
- $content = gzuncompress($content);
- }
-
- return is_string($content) ? ['content' => $content, 'expire' => $expire,'create_time'=>$createTime] : null;
- }
- }
-
- /**
- * 判断缓存是否存在
- * @access public
- * @param string $name 缓存变量名
- * @return bool
- */
- public function has($name): bool
- {
- return $this->getRaw($name) !== null;
- }
-
- /**
- * 读取缓存
- * @access public
- * @param string $name 缓存变量名
- * @param mixed $default 默认值
- * @return mixed
- */
- public function get($name, $default = null)
- {
- $this->readTimes++;
-
- $raw = $this->getRaw($name);
-
- return is_null($raw) ? $default : $this->unserialize($raw['content']);
- }
-
- /**
- * 写入缓存
- * @access public
- * @param string $name 缓存变量名
- * @param mixed $value 存储数据
- * @param int|\DateTime $expire 有效时间 0为永久
- * @return bool
- */
- public function set($name, $value, $expire = null): bool
- {
- $this->writeTimes++;
-
- if (is_null($expire)) {
- $expire = $this->options['expire'];
- }
-
- $expire = $this->getExpireTime($expire);
- $filename = $this->getCacheKey($name);
-
- $dir = dirname($filename);
-
- if (!is_dir($dir)) {
- try {
- mkdir($dir, 0755, true);
- } catch (\Exception $e) {
- // 创建失败
- }
- }
-
- $data = $this->serialize($value);
-
- if ($this->options['data_compress'] && function_exists('gzcompress')) {
- //数据压缩
- $data = gzcompress($data, 3);
- }
-
- $data = "\n" . $data;
- $result = file_put_contents($filename, $data);
-
- if ($result) {
- clearstatcache();
- return true;
- }
-
- return false;
- }
-
-
-
- /**
- * 删除缓存
- * @access public
- * @param string $name 缓存变量名
- * @return bool
- */
- public function delete($name): bool
- {
- $this->writeTimes++;
-
- return DirAndFile::unlink($this->getCacheKey($name));
- }
-
- /**
- * 清除缓存
- * @access public
- * @return bool
- */
- public function clear(): bool
- {
- $this->writeTimes++;
-
- $dirname = $this->options['path'] . $this->options['prefix'];
-
- $this->rmdir($dirname);
-
- return true;
- }
-
-
- /**
- * 删除文件夹
- * @param $dirname
- * @return bool
- */
- private function rmdir($dirname)
- {
- if (!is_dir($dirname)) {
- return false;
- }
-
- $items = new FilesystemIterator($dirname);
-
- foreach ($items as $item) {
- if ($item->isDir() && !$item->isLink()) {
- $this->rmdir($item->getPathname());
- } else {
- DirAndFile::unlink($item->getPathname());
- }
- }
-
- @rmdir($dirname);
-
- return true;
- }
-
-}
diff --git a/vendor/hg/apidoc/src/utils/ConfigProvider.php b/vendor/hg/apidoc/src/utils/ConfigProvider.php
deleted file mode 100644
index 07e2342a6..000000000
--- a/vendor/hg/apidoc/src/utils/ConfigProvider.php
+++ /dev/null
@@ -1,99 +0,0 @@
-[
- 'folder'=>'apidoc'
- ]
- ];
- protected static $config = [];
-
-
- public static function get($field=""){
-
- if (!empty(static::$config)) {
- $config = static::$config;
- }else{
- throw new ErrorException('ConfigProvider get error');
- }
-
- return Helper::getObjectFindByField($config,$field);
- }
-
- public static function set($config){
- if (!(!empty($config['cache']) && !empty($config['cache']['folder']))){
- if (!empty($config['cache'])){
- $config['cache']['folder'] =static::$defaultConfig['cache']['folder'];
- }
- }
- $config = static::handleConfig($config);
- static::$config = $config;
- }
-
- public static function handleConfig($config){
- if (!empty($config['params'])){
- if (!empty($config['params']['header'])){
- $config['params']['header'] = Helper::handleArrayParams($config['params']['header'],"desc",$config);
- }
- if (!empty($config['params']['query'])){
- $config['params']['query'] = Helper::handleArrayParams($config['params']['query'],"desc",$config);
- }
- if (!empty($config['params']['body'])){
- $config['params']['body'] = Helper::handleArrayParams($config['params']['body'],"desc",$config);
- }
- }
- if (!empty($config['responses'])){
- if (!empty($config['responses']['success'])){
- $config['responses']['success'] = Helper::handleArrayParams($config['responses']['success'],"desc",$config);
- }
- if (!empty($config['responses']['error'])){
- $config['responses']['error'] = Helper::handleArrayParams($config['responses']['error'],"desc",$config);
- }
- }
- return $config;
- }
-
- public static function getFeConfig($filterAppKeys=[]){
- $config = static::$config;
-
- $feConfig = [
- 'title' =>!empty($config['title'])?Lang::getLang($config['title'] ):'',
- 'desc' =>!empty($config['title'])?Lang::getLang($config['desc']):'',
- 'apps'=>!empty($config['apps'])?$config['apps']:[],
- 'cache'=>!empty($config['cache'])?$config['cache']:[],
- 'params'=>!empty($config['params'])?$config['params']:[],
- 'responses'=>!empty($config['responses'])?$config['responses']:[],
- 'generator'=>!empty($config['generator'])?$config['generator']:[],
- 'code_template'=>!empty($config['code_template'])?$config['code_template']:[],
- 'share'=>!empty($config['share'])?$config['share']:[],
- ];
- if (!empty($feConfig['apps']) && count($feConfig['apps'])){
- // 清除apps配置中的password
- $feConfig['apps'] = Helper::handleAppsConfig($feConfig['apps'],true,"","",$filterAppKeys);
- }
-
- if (!empty($feConfig['generator'])){
- $generatorList = [];
- $generators= Helper::handleArrayParams($feConfig['generator'],"title");
- foreach ($generators as $item) {
- if (isset($item['enable']) && $item['enable'] === false){
- continue;
- }
- if (!empty($item['form']) && !empty($item['form']['items']) && count($item['form']['items'])){
- $item['form']['items'] = Helper::handleArrayParams( $item['form']['items'],"title");
- }
- $generatorList[]=$item;
- }
- $feConfig['generator'] = $generatorList;
- }
- return $feConfig;
- }
-
-
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/utils/DirAndFile.php b/vendor/hg/apidoc/src/utils/DirAndFile.php
deleted file mode 100644
index e97ba0f57..000000000
--- a/vendor/hg/apidoc/src/utils/DirAndFile.php
+++ /dev/null
@@ -1,258 +0,0 @@
-$value,
- 'path'=>$sub_path,
- ];
- $children = static::getDirTree($sub_path);
- if (count($children)){
- $item['children'] = $children;
- }
- $arr[] = $item;
- }
- }
- }
- return $arr;
- }
-
- public static function getClassList($dir){
- if ($handle = opendir($dir)) {
- $file_list=[];
- while (false !== ($file = readdir($handle))) {
- if($file=='..' || $file=='.') continue;
- $filePath = static::formatPath($dir.'/'.$file,"/");
- if(is_file($filePath)) {
- if ('php' !== pathinfo($filePath, \PATHINFO_EXTENSION)) {
- continue;
- }
- $classes = self::findClasses($filePath);
- if (!empty($classes) && count($classes)){
- $file_list[] = [
- 'name'=>$classes[0],
- 'path'=>$filePath
- ];
- }else{
- $file_list=[];
- }
- continue;
- }
- $file_list[$file] = static::getClassList($filePath);
- foreach($file_list[$file] as $infile) {
- $file_list[] = $infile;
- }
- unset($file_list[$file]);
- }
- closedir($handle);
- return $file_list;
- }
- return [];
- }
- public static function getFileList($path){
- if(is_dir($path)) {
- $dirList = scandir($path);
- $list = [];
- foreach ($dirList as $dir) {
- if ($dir == '.' || $dir == '..') {
- continue;
- }
- $sub_path = DirAndFile::formatPath($path . '/' . $dir, "/");
- if (is_file($sub_path)){
- $list[]=[
- 'name'=>$dir,
- 'path'=>$sub_path
- ];;
- }
- }
- return $list;
- }
- return [];
- }
-
- public static function formatPath($path,$type="/"){
- if ($type==="/"){
- $path = str_replace("\\","/",$path);
- }else{
- $path = str_replace("/","\\",$path);
- $path = str_replace("\\\\","\\",$path);
- $endStr = substr($path, -1);
- if ($endStr=='\\'){
- $path = substr($path,0,strlen($path)-1);
- }
- }
- return $path;
- }
-
- private static function findClasses($path)
- {
- $contents = file_get_contents($path);
- $tokens = token_get_all($contents);
-
- $nsTokens = [\T_STRING => true, \T_NS_SEPARATOR => true];
- if (\defined('T_NAME_QUALIFIED')) {
- $nsTokens[T_NAME_QUALIFIED] = true;
- }
-
- $classes = [];
-
- $namespace = '';
- for ($i = 0; isset($tokens[$i]); ++$i) {
- $token = $tokens[$i];
-
- if (!isset($token[1])) {
- continue;
- }
-
- $class = '';
-
- switch ($token[0]) {
- case \T_NAMESPACE:
- $namespace = '';
- // If there is a namespace, extract it
- while (isset($tokens[++$i][1])) {
- if (isset($nsTokens[$tokens[$i][0]])) {
- $namespace .= $tokens[$i][1];
- }
- }
- $namespace .= '\\';
- break;
- case \T_CLASS:
- case \T_INTERFACE:
- case \T_TRAIT:
- // Skip usage of ::class constant
- $isClassConstant = false;
- for ($j = $i - 1; $j > 0; --$j) {
- if (!isset($tokens[$j][1])) {
- break;
- }
-
- if (\T_DOUBLE_COLON === $tokens[$j][0]) {
- $isClassConstant = true;
- break;
- } elseif (!\in_array($tokens[$j][0], [\T_WHITESPACE, \T_DOC_COMMENT, \T_COMMENT])) {
- break;
- }
- }
-
- if ($isClassConstant) {
- break;
- }
-
- // Find the classname
- while (isset($tokens[++$i][1])) {
- $t = $tokens[$i];
- if (\T_STRING === $t[0]) {
- $class .= $t[1];
- } elseif ('' !== $class && \T_WHITESPACE === $t[0]) {
- break;
- }
- }
-
- $classes[] = ltrim($namespace.$class, '\\');
- break;
- default:
- break;
- }
- }
-
- return $classes;
- }
-
-
- /**
- * 读取文件内容
- * @param $fileName
- * @return false|string
- */
- public static function getFileContent(string $fileName): string
- {
- $content = "";
- if (file_exists($fileName)) {
- $handle = fopen($fileName, "r");
- $content = fread($handle, filesize($fileName));
- fclose($handle);
- }
- return $content;
- }
-
- /**
- * 保存文件
- * @param $path
- * @param $str_tmp
- * @return bool
- */
- public static function createFile(string $path, string $str_tmp): bool
- {
- $pathArr = explode("/", $path);
- unset($pathArr[count($pathArr) - 1]);
- $dir = implode("/", $pathArr);
- if (!file_exists($dir)) {
- mkdir($dir, 0775, true);
- }
- $fp = fopen($path, "w") or die("Unable to open file!");
- fwrite($fp, $str_tmp); //存入内容
- fclose($fp);
- return true;
- }
-
- /**
- * 判断文件是否存在后,删除
- * @access private
- * @param string $path
- * @return bool
- */
- public static function unlink(string $path): bool
- {
- try {
- return is_file($path) && unlink($path);
- } catch (\Exception $e) {
- return false;
- }
- }
-
- public static function checkFileExist(string $path)
- {
- try {
- return $path;
- } catch (\Exception $e) {
- return $e;
- }
- }
-
- public static function deleteDir($path) {
- if (!is_dir($path)) {
- return false;
- }
- $open = opendir($path);
- if (!$open) {
- return false;
- }
- while (($v = readdir($open)) !== false) {
- if ('.' == $v || '..' == $v) {
- continue;
- }
- $item = $path . '/' . $v;
- if (is_file($item)) {
- unlink($item);
- continue;
- }
- static::deleteDir($item);
- }
- closedir($open);
- return rmdir($path);
- }
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/utils/Helper.php b/vendor/hg/apidoc/src/utils/Helper.php
deleted file mode 100644
index ba4d7bf9d..000000000
--- a/vendor/hg/apidoc/src/utils/Helper.php
+++ /dev/null
@@ -1,578 +0,0 @@
- $code,
- 'message' => $msg,
- 'data' => $data,
- ];
- $handle_response_json = ConfigProvider::get("handle_response_json");
- if (!empty($handle_response_json) && is_callable($handle_response_json)){
- return $handle_response_json($res);
- }
- return $res;
- }
-
-
-
- /**
- * 将tree树形数据转成list数据
- * @param array $tree tree数据
- * @param string $childName 子节点名称
- * @return array 转换后的list数据
- */
- public static function treeToList(array $tree, string $childName = 'children',string $key = "id",string $parentField = "parent")
- {
- $array = array();
- foreach ($tree as $val) {
- $array[] = $val;
- if (isset($val[$childName])) {
- $children = static::treeToList($val[$childName], $childName);
- if ($children) {
- $newChildren = [];
- foreach ($children as $item) {
- $item[$parentField] = $val[$key];
- $newChildren[] = $item;
- }
- $array = array_merge($array, $newChildren);
- }
- }
- }
- return $array;
- }
-
-
-
- /**
- * 根据一组keys获取所有关联节点
- * @param $tree
- * @param $keys
- */
- public static function getTreeNodesByKeys(array $tree, array $keys, string $field = "id", string $childrenField = "children")
- {
- $list = static::TreeToList($tree, $childrenField, "key");
- $data = [];
- foreach ($keys as $k => $v) {
- $parent = !$k ? "" : $keys[$k - 1];
- foreach ($list as $item) {
- if (((!empty($item['parent']) && $item['parent'] === $parent) || empty($item['parent'])) && $item[$field] == $v) {
- $data[] = $item;
- break;
- }
- }
- }
- return $data;
-
- }
-
- /**
- * 根据一组keys过滤树形数据
- * @param $tree
- * @param $keys
- */
- public static function filterTreeNodesByKeys(array $tree, array $keys, string $field = "id", string $childrenField = "children")
- {
- $data=[];
- foreach ($tree as $k => $item) {
- if (!empty($item[$childrenField])){
- $childrenList = static::filterTreeNodesByKeys($item[$childrenField],$keys,$field,$childrenField);
- if (!empty($childrenList) && count($childrenList)){
- $item[$childrenField] = $childrenList;
- $data[]=$item;
- }
- }else if(!empty($item[$field]) && in_array($item[$field],$keys)){
- $data[]=$item;
- }
- }
- return $data;
- }
-
- /**
- * 替换模板变量
- * @param $temp
- * @param $data
- * @param $prefix
- * @return string|string[]
- */
- public static function replaceTemplate(string $temp, array $data, string $prefix = ""):string
- {
- $str = $temp;
- foreach ($data as $k => $v) {
- $key = '${'. $prefix . $k . '}';
- if (strpos($str, $key) !== false) {
- $str = str_replace($key, $v, $str);
- }
- }
- return $str;
- }
-
- /**
- * 替换当前所选应用/版本的变量
- * @param $temp
- * @param $currentApps
- * @return string|string[]
- */
- public static function replaceCurrentAppTemplate(string $temp,array $currentApps):string
- {
- $str = $temp;
- if (!empty($currentApps) && count($currentApps) > 0) {
- $data = [];
- for ($i = 0; $i <= 3; $i++) {
- if (isset($currentApps[$i])) {
- $appItem = $currentApps[$i];
- foreach ($appItem as $k => $v) {
- $key = 'app[' . $i . '].' . $k;
- $data[$key] = $v;
- }
- } else {
- $appItem = $currentApps[0];
- foreach ($appItem as $k => $v) {
- $key = 'app[' . $i . '].' . $k;
- $data[$key] = "";
- }
- }
- }
- $str = static::replaceTemplate($str, $data);
- }
- return $str;
- }
-
- /**
- * 根据条件获取数组中的值
- * @param array $array
- * @param $query
- * @return mixed|null
- */
- public static function getArrayFind(array $array, $query)
- {
- $res = null;
- if (is_array($array)) {
- foreach ($array as $item) {
- if ($query($item)) {
- $res = $item;
- break;
- }
- }
- }
- return $res;
- }
-
- /**
- * 根据条件获取数组中的index
- * @param array $array
- * @param $query
- * @return mixed|null
- */
- public static function getArrayFindIndex(array $array, $query)
- {
- $res = null;
- if (is_array($array)) {
- foreach ($array as $k=>$item) {
- if ($query($item)) {
- $res = $k;
- break;
- }
- }
- }
- return $res;
- }
-
- /**
- * 查询符合条件的数组
- * @param array $array
- * @param $query
- * @return array
- */
- public static function getArraybyQuery(array $array, $query)
- {
- $res = [];
- if (is_array($array)) {
- foreach ($array as $item) {
- if ($query($item)) {
- $res[] = $item;
- }
- }
- }
- return $res;
- }
-
- /**
- * 对象转为数组
- * @param $object
- * @return mixed
- */
- public static function objectToArray($object) {
- $object = json_decode( json_encode($object),true);
- return $object;
- }
-
- /**
- * 合并对象数组并根据key去重
- * @param string $key
- * @param mixed ...$array
- * @return array
- */
- public static function arrayMergeAndUnique(string $key = "name", ...$array):array
- {
- $arrayByKey = [];
- foreach ($array as $k => $arr) {
- if (!empty($arr) && count($arr)){
- foreach ($arr as $item) {
- if (!empty($item[$key])){
- $arrayByKey[$item[$key]] = $item;
- }
- }
- }
- }
- $newArray = [];
- foreach ($arrayByKey as $item) {
- $newArray[]=$item;
- }
- return $newArray;
- }
-
- /**
- * 初始化当前所选的应用/版本数据
- * @param $appKey
- */
- public static function getCurrentAppConfig(string $appKey,$config=""):array
- {
- if (empty($config)){
- $config = ConfigProvider::get();
- }
- $config['apps'] = static::handleAppsConfig($config['apps'],false,$config);
- if (!(!empty($config['apps']) && count($config['apps']) > 0)) {
- throw new ErrorException("no config apps");
- }
- if (strpos($appKey, ',') !== false) {
- $keyArr = explode(",", $appKey);
- } else {
- $keyArr = [$appKey];
- }
- $currentApps = static::getTreeNodesByKeys($config['apps'], $keyArr, 'key', 'items');
- if (!$currentApps) {
- throw new ErrorException("appKey error", [
- 'appKey' => $appKey
- ]);
- }
- return [
- 'appConfig'=>$currentApps[count($currentApps) - 1],
- 'apps'=>$currentApps
- ];
-
- }
-
- public static function getCacheKey($type,$appKey,$lang="",$key="",$folder="apis"){
- return $folder."/".$type."_".$appKey."_".$lang."_".$key;
- }
-
- /**
- * 处理apps配置参数
- * @param array $apps
- * @return array
- */
- public static function handleAppsConfig(array $apps,$isHandlePassword=false,$config="", $parentKey = "",$filterAppKeys=[]):array
- {
- $appsConfig = [];
- $separ = !empty($parentKey) ? ',' : '';
- foreach ($apps as $app) {
- if (!empty($app['key'])){
- $appKey = $parentKey . $separ . $app['key'];
- $app['appKey'] = $appKey;
- }
- if (!empty($app['password']) && $isHandlePassword===true) {
- unset($app['password']);
- $app['hasPassword'] = true;
- }
- if (!empty($app['title'])){
- $app['title'] = Lang::getLang($app['title'],$config);
- }
- if (!empty($app['items']) && count($app['items']) > 0) {
- $app['items'] = static::handleAppsConfig($app['items'],$isHandlePassword,$config,$appKey,$filterAppKeys);
- }else if (!empty($filterAppKeys) && count($filterAppKeys) && !in_array($appKey,$filterAppKeys)){
- continue;
- }
- if (!empty($app['groups']) && count($app['groups']) > 0){
- $app['groups'] = static::handleGroupsConfig($app['groups']);
- }
- if (!empty($app['params'])){
- if (!empty($app['params']['header']) && count($app['params']['header']) > 0){
- $app['params']['header'] = static::handleArrayParams($app['params']['header'],"desc");
- }
- if (!empty($app['params']['query']) && count($app['params']['query']) > 0){
- $app['params']['query'] = static::handleArrayParams($app['params']['query'],"desc");
- }
- if (!empty($app['params']['body']) && count($app['params']['body']) > 0){
- $app['params']['body'] = static::handleArrayParams($app['params']['body'],"desc");
- }
- }
- $appsConfig[] = $app;
- }
- return $appsConfig;
- }
-
- public static function handleArrayParams($array,$field,$config=""){
- $data = [];
- if (!empty($array) && is_array($array)){
- foreach ($array as $item){
- $item[$field] = Lang::getLang($item[$field],$config);
- if (!empty($item['md'])){
- $item['md'] = ParseMarkdown::getContent("",$item['md']);
- }
- $data[]=$item;
- }
- }
- return $data;
- }
-
- public static function getAllApps(array $apps,$parentKey=""){
- $appList = [];
- $separ = !empty($parentKey)?',':'';
- foreach ($apps as $app) {
- $appKey = $parentKey.$separ.$app['key'];
- if (!empty($app['items']) && count($app['items'])){
- $items = static::getAllApps($app['items'],$appKey);
- $appList = array_merge($appList,$items);
- }else{
- $app['appKey'] = $appKey;
- $appList[]=$app;
- }
- }
- return $appList;
- }
-
- /**
- * 处理groups配置参数
- * @param array $groups
- * @return array
- */
- public static function handleGroupsConfig(array $groups):array
- {
- $groupConfig = [];
- foreach ($groups as $group) {
- if (!empty($group['title'])){
- $group['title'] = Lang::getLang($group['title']);
- }
- if (!empty($group['children']) && count($group['children']) > 0) {
- $group['children'] = static::handleAppsConfig($group['children']);
- }
- $groupConfig[] = $group;
- }
- return $groupConfig;
- }
-
- /**
- * 驼峰转下划线
- *
- * @param string $value
- * @param string $delimiter
- * @return string
- */
- public static function snake(string $value, string $delimiter = '_'): string
- {
- $key = $value;
-
- if (isset(static::$snakeCache[$key][$delimiter])) {
- return static::$snakeCache[$key][$delimiter];
- }
-
- if (!ctype_lower($value)) {
- $value = preg_replace('/\s+/u', '', $value);
-
- $value = static::lower(preg_replace('/(.)(?=[A-Z])/u', '$1' . $delimiter, $value));
- }
-
- return static::$snakeCache[$key][$delimiter] = $value;
- }
-
- /**
- * 下划线转驼峰(首字母小写)
- *
- * @param string $value
- * @return string
- */
- public static function camel(string $value): string
- {
- return lcfirst(static::studly($value));
- }
-
-
- /**
- * 下划线转驼峰(首字母大写)
- *
- * @param string $value
- * @return string
- */
- public static function studly(string $value): string
- {
- $value = ucwords(str_replace(['-', '_'], ' ', $value));
- return str_replace(' ', '', $value);
- }
-
- /**
- * 字符串转小写
- *
- * @param string $value
- * @return string
- */
- public static function lower(string $value): string
- {
- return mb_strtolower($value, 'UTF-8');
- }
-
- /**
- * 创建随机key
- * @param string $prefix
- * @return string
- */
- public static function createRandKey(string $prefix=""): string{
- return uniqid($prefix);
- }
-
- /**
- * 创建api的key
- * @param string $path
- * @param string $name
- * @return string
- */
- public static function createApiKey(string $path,string $name=""): string{
- if ($name){
- $key = $path."@".$name;
- }else{
- $key = $path;
- }
- $res = urlencode($key);
- return $res;
- }
-
-
- /**
- * 二维数组根据key排序
- * @param $array
- * @param string $field
- * @param int $order
- * @return mixed
- */
- public static function arraySortByKey($array, $field="sort",$order=SORT_ASC){
- $sorts = [];
- foreach ($array as $key => $row) {
- $sorts[$key] = isset($row[$field])?$row[$field]:"";
- }
- array_multisort($sorts, $order, $array);
- return $array;
- }
-
-
- /**
- * 过滤所有空格换行符
- * @param $str
- * @return array|string|string[]
- */
- public static function trimEmpty($str){
- $search = array(" "," ","\n","\r","\t");
- $replace = array("","","","","");
- return str_replace($search, $replace, $str);
- }
-
-
- public static function getObjectFindByField(array $data,string $name = null)
- {
- // 无参数时获取所有
- if (empty($name)) {
- return $data;
- }
- if (false === strpos($name, '.')) {
- $name = strtolower($name);
- return $data[$name] ?? [];
- }
- $name = explode('.', $name);
- $name[0] = strtolower($name[0]);
- $result = $data;
- // 按.拆分成多维数组进行判断
- foreach ($name as $val) {
- if (isset($result[$val])) {
- $result = $result[$val];
- } else {
- return [];
- }
- }
- return $result;
- }
-
-
- public static function inArrayBuyKeyword(array $arr,string $keyword):bool{
- $is = false;
- foreach ($arr as $item) {
- if (strpos($item, $keyword) !== false){
- $is=true;
- break;
- }
- }
- return $is;
- }
-
- /**
- * 处理接口请求类型为数组
- * @param $method
- * @return array|false|string[]
- */
- public static function handleApiMethod($method){
- if (is_array($method)){
- return $method;
- }else if (strpos($method, ',') !== false){
- return explode(",", strtoupper($method));
- }else {
- return [strtoupper($method)];
- }
- }
-
-
- /**
- * 获取数组中指定keys的值为新数组
- * @param array $array
- * @param array $keys
- * @return array
- */
- public static function getArrayValuesByKeys(array $array,array $keys){
- $data = [];
- foreach ($keys as $key) {
- if (isset($array[$key])){
- $data[$key]=$array[$key];
- }else{
- $data[$key]="";
- }
- }
- return $data;
- }
- public static function arrayKeyFirst($array){
- if (function_exists('array_key_first')) {
- return array_key_first($array);
- }else{
- foreach($array as $key => $unused) {
- return $key;
- }
- return NULL;
- }
- }
-
-
-
-
-
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/utils/Lang.php b/vendor/hg/apidoc/src/utils/Lang.php
deleted file mode 100644
index d765b30d4..000000000
--- a/vendor/hg/apidoc/src/utils/Lang.php
+++ /dev/null
@@ -1,59 +0,0 @@
-1 ? trim($key[1]):"";
- if (!empty($langKey)){
- return $langGetFunction($langKey);
- }
- }
- }
- return $string;
- }
-
- /**
- * 二维数组设置指定字段的多语言
- * @param $array
- * @param $field
- * @return array
- */
- public static function getArrayLang($array,$field,$config=[]){
- $data = [];
- if (!empty($array) && is_array($array)){
- foreach ($array as $item){
- $item[$field] = static::getLang($item[$field],$config);
- $data[]=$item;
- }
- }
- return $data;
- }
-
-
-}
\ No newline at end of file
diff --git a/vendor/hg/apidoc/src/utils/Request.php b/vendor/hg/apidoc/src/utils/Request.php
deleted file mode 100644
index bd22bf9cc..000000000
--- a/vendor/hg/apidoc/src/utils/Request.php
+++ /dev/null
@@ -1,46 +0,0 @@
-get = $_GET;
- $this->post = $_POST;
- $this->method = !empty($_SERVER['REQUEST_METHOD'])?$_SERVER['REQUEST_METHOD']:"";
- }
-
- public function get(){
- return $this->get;
- }
-
- public function post(){
- return $this->post;
- }
-
- public function input(){
- $input = file_get_contents('php://input');
- $inputObj = json_decode($input);
- return Helper::objectToArray($inputObj);
- }
-
- public function param(){
- $config = ConfigProvider::get();
- if (!empty($config['request_params'])){
- return $config['request_params'];
- }
- $method = !empty($this->method)?$this->method:"GET";
- if ($method == "GET"){
- return $this->get;
- }
- return $this->input();
- }
-
-}
\ No newline at end of file