From 1b175d86aab986c9b03e15f1167326f72fde5452 Mon Sep 17 00:00:00 2001 From: wuhui_zzw <1760308791@qq.com> Date: Tue, 23 Jan 2024 11:39:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=EF=BC=9A=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E4=BA=8C=E7=BB=B4=E7=A0=81=E9=82=80=E8=AF=B7?= =?UTF-8?q?=E5=91=98=E5=B7=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/service/StoreServiceRepository.php | 2 +- app/controller/api/store/merchant/Service.php | 39 ++++++++++++++++++- .../merchant/store/service/StoreService.php | 3 +- route/api.php | 1 + 4 files changed, 41 insertions(+), 4 deletions(-) diff --git a/app/common/repositories/store/service/StoreServiceRepository.php b/app/common/repositories/store/service/StoreServiceRepository.php index adcca66..ac7ea7c 100644 --- a/app/common/repositories/store/service/StoreServiceRepository.php +++ b/app/common/repositories/store/service/StoreServiceRepository.php @@ -99,7 +99,7 @@ class StoreServiceRepository extends BaseRepository $filed = [ "value" => 1, "rule" => [ - "status","customer","is_goods","is_verify","notify","is_user","staff_manage" + "status","customer","is_goods","is_verify","notify",'phone',"is_user","staff_manage",'qr_code_show' ] ]; $adminRule[] = Elm::number('sort', '排序', 0)->precision(0)->max(99999); diff --git a/app/controller/api/store/merchant/Service.php b/app/controller/api/store/merchant/Service.php index 3316711..50e2077 100644 --- a/app/controller/api/store/merchant/Service.php +++ b/app/controller/api/store/merchant/Service.php @@ -3,6 +3,7 @@ namespace app\controller\api\store\merchant; use app\validate\merchant\StoreServiceValidate; +use crmeb\services\QrcodeService; use think\App; use crmeb\basic\BaseController; use app\common\repositories\store\service\StoreServiceRepository; @@ -33,6 +34,38 @@ class Service extends BaseController{ return app('json')->success($data); } + /** + * Common: 生成员工邀请二维码 + * Author: wu-hui + * Time: 2024/01/23 10:08 + * @return mixed + */ + public function inviteQrCode(){ + // 参数获取 + $merId = $this->request->param('mer_id'); + if((int)$merId > 0){ + try{ + // 生成参数 + $valueData = 'mer_id=' . $merId; + $path = 'pages/admin/business/edit_staff';// /pages/admin/business/edit_staff + $name = md5($path . $valueData) . '.jpg'; + $qrcode = app()->make(QrcodeService::class)->getRoutineQrcodePath($name, $path, $valueData); + if (!$qrcode) throw new \Exception('二维码生成失败'); + + return app('json')->success([ + 'qr_code' => $qrcode + ]); + }catch(\Exception $e){ + return app('json')->fail($e->getMessage()); + }catch(\Throwable $e){ + return app('json')->fail($e->getMessage()); + } + } + + return app('json')->fail('小程序码生成失败!'); + } + + /** * Common: 编辑信息 * Author: wu-hui @@ -79,7 +112,8 @@ class Service extends BaseController{ 'notify', 'avatar', 'phone', - ['sort',0] + ['sort',0], + 'qr_code_show' ]); if(is_array(json_decode($data['uid'], true))) $data['uid'] = json_decode($data['uid'], true); // 是否编辑 @@ -90,10 +124,11 @@ class Service extends BaseController{ } $data['uid'] = $data['uid']['id']; unset($data['confirm_pwd']); + return $data; } /** - * Common: 获取用户信息 + * Common: 获取员工信息 * Author: wu-hui * Time: 2024/01/22 18:34 * @return mixed diff --git a/app/controller/merchant/store/service/StoreService.php b/app/controller/merchant/store/service/StoreService.php index b65d930..a2cc14c 100644 --- a/app/controller/merchant/store/service/StoreService.php +++ b/app/controller/merchant/store/service/StoreService.php @@ -107,7 +107,8 @@ class StoreService extends BaseController 'notify', 'avatar', 'phone', - ['sort',0] + ['sort',0], + 'qr_code_show' ]); if ($isUpdate) { $validate->update(); diff --git a/route/api.php b/route/api.php index dc2ff40..83b5ce6 100644 --- a/route/api.php +++ b/route/api.php @@ -372,6 +372,7 @@ Route::group('api/', function () { // 员工管理 Route::group('staff', function () { Route::get('staff_list', 'Service/lst');// 列表 + Route::get('staff_invite_qr_code', 'Service/inviteQrCode');// 员工邀请二维码 Route::get('staff_edit', 'Service/editInfo');// 编辑 Route::get('staff_del', 'Service/delInfo');// 删除 Route::get('staff_info', 'Service/staffInfo');// 删除