From af55bd020b750ab9bdb5160f9bb65e7589903b38 Mon Sep 17 00:00:00 2001 From: 15090180611 <215509543@qq.com> Date: Sat, 4 Jan 2025 18:09:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=BC=8F=E6=B4=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controller/manystore/Index.php | 70 ++++++++++++++++++- .../controller/school/classes/ClassesLib.php | 57 +++++++++++++++ .../controller/school/classes/Teacher.php | 63 ++++++++++++++++- .../school/classes/activity/Activity.php | 61 +++++++++++++++- application/admin/model/Admin.php | 7 +- application/api/controller/Demo.php | 47 ++++++++++++- .../api/controller/school/HourOrder.php | 1 + application/api/controller/school/Order.php | 12 +++- application/api/controller/school/Pay.php | 2 +- .../api/controller/school/ServiceOrder.php | 3 +- .../api/controller/school/activity/Order.php | 1 + .../api/controller/school/activity/Pay.php | 2 +- .../controller/school/worker/HourOrder.php | 1 + .../api/controller/school/worker/Order.php | 1 + .../controller/school/worker/ServiceOrder.php | 7 +- .../school/worker/activity/Order.php | 1 + application/common/controller/Api.php | 17 +++++ application/common/library/Virtual.php | 45 ++++++++++++ .../common/model/dyqc/ManystoreShop.php | 4 ++ .../model/school/classes/ClassesLib.php | 4 +- .../common/model/school/classes/Teacher.php | 4 ++ .../school/classes/activity/Activity.php | 4 ++ .../manystore/controller/general/Profile.php | 63 +++++++++++++++-- .../controller/school/classes/ClassesLib.php | 57 ++++++++++++++- .../controller/school/classes/Teacher.php | 63 ++++++++++++++++- .../school/classes/activity/Activity.php | 64 ++++++++++++++++- .../manystore/view/general/profile/index.html | 9 +++ extend/bw/Common.php | 39 ++++++++++- extend/traits/CacheTrait.php | 8 ++- extend/traits/ModelTrait.php | 16 +++++ public/assets/js/backend/manystore/index.js | 7 +- .../school/classes/activity/activity.js | 9 ++- .../js/backend/school/classes/classes_lib.js | 8 ++- .../js/backend/school/classes/teacher.js | 8 ++- .../school/classes/activity/activity.js | 8 ++- .../manystore/school/classes/classes_lib.js | 10 ++- .../js/manystore/school/classes/teacher.js | 8 ++- 37 files changed, 745 insertions(+), 46 deletions(-) diff --git a/application/admin/controller/manystore/Index.php b/application/admin/controller/manystore/Index.php index b9aefb0..13f49ab 100644 --- a/application/admin/controller/manystore/Index.php +++ b/application/admin/controller/manystore/Index.php @@ -24,6 +24,7 @@ use fast\Random; use fast\Tree; use think\Exception; use think\Hook; +use think\Url; use think\Validate; /** @@ -34,7 +35,7 @@ use think\Validate; */ class Index extends Backend { - + protected $noNeedLogin = ["miniqrcode"]; /** * @var \app\manystore\model\Manystore */ @@ -219,6 +220,7 @@ class Index extends Backend foreach ($list as $k => &$v){ $v["check_full"] = (new \app\common\model\dyqc\ManystoreShop)->checkFull($v["shop"]["id"]); + $v["miniqrcode_link"] = Url::build("/manystore/index/miniqrcode", ["ids" => $v["shop"]["id"]]); } @@ -719,8 +721,19 @@ class Index extends Backend if($this->request->isPost()){ try{ if(isset($param['ids']))$ids = $param['ids']; + + $row = $this->model->get(['id' => $ids,'is_main'=>1]); + if (!$row) { + $this->error(__('No Results were found')); + } + $shop_info = $this->shopModel->get(array('id'=>$row['shop_id'])); + if(!$shop_info){ + $this->error(__('商家信息资料不存在')); + } + + //设置模拟资格 - $url = \app\common\model\dyqc\ManystoreShop::getPath($ids); + $url = \app\common\model\dyqc\ManystoreShop::getPath($row['shop_id']); }catch (\Exception $e){ $this->error($e->getMessage()); @@ -731,4 +744,57 @@ class Index extends Backend $this->view->assign('vo', $row); return $this->view->fetch(); } + + + /** + * 微信小程序码 + * @return string + * @throws \think\Exception + * @throws \think\db\exception\BindParamException + * @throws \think\exception\DbException + * @throws \think\exception\PDOException + */ + public function miniqrcode($ids = ''){ + $param = $this->request->param(); + try{ + if(isset($param['ids']))$ids = $param['ids']; + //设置模拟资格 + $url = \app\common\model\dyqc\ManystoreShop::getMiniQrcodeLink($ids); + + }catch (\Exception $e){ + $this->error($e->getMessage()); + } + + return $url["response"]; + } + + + + + /** + * 查看微信小程序码 + * @return string + * @throws \think\Exception + * @throws \think\db\exception\BindParamException + * @throws \think\exception\DbException + * @throws \think\exception\PDOException + */ + public function lookminiqrcode($ids = ''){ + $param = $this->request->param(); + if($this->request->isPost()){ + try{ + if(isset($param['ids']))$ids = $param['ids']; + //设置模拟资格 + $url = \app\common\model\dyqc\ManystoreShop::getMiniQrcodeLink($ids); + + }catch (\Exception $e){ + $this->error($e->getMessage()); + } + $this->success("生成小程序码成功",null,$url); + } + $row = $this->model->get($ids); + $this->view->assign('vo', $row); + return $this->view->fetch(); + } + } diff --git a/application/admin/controller/school/classes/ClassesLib.php b/application/admin/controller/school/classes/ClassesLib.php index 31f8bf6..b3ca495 100644 --- a/application/admin/controller/school/classes/ClassesLib.php +++ b/application/admin/controller/school/classes/ClassesLib.php @@ -18,6 +18,7 @@ use think\exception\PDOException; use think\exception\ValidateException; use think\Loader; use think\Model; +use think\Url; /** * 机构课程库 @@ -27,6 +28,7 @@ use think\Model; class ClassesLib extends Backend { + protected $noNeedLogin = ["miniqrcode"]; protected $qSwitch = true; protected $qFields = ["teacher_id","user_id","shop_id","manystore_id"]; /** @@ -141,6 +143,7 @@ class ClassesLib extends Backend foreach ($rows as $k => &$v) { $v["classes_type_name"] = $types[$v["classes_type"]] ?? "无"; + $v["miniqrcode_link"] = Url::build("/school/classes/classes_lib/miniqrcode", ["ids" => $v["id"]]); } $result = array("total" => $list->total(), "rows" => $rows); @@ -1080,4 +1083,58 @@ class ClassesLib extends Backend } + + + /** + * 微信小程序码 + * @return string + * @throws \think\Exception + * @throws \think\db\exception\BindParamException + * @throws \think\exception\DbException + * @throws \think\exception\PDOException + */ + public function miniqrcode($ids = ''){ + $param = $this->request->param(); + try{ + if(isset($param['ids']))$ids = $param['ids']; + //设置模拟资格 + $url = \app\common\model\school\classes\ClassesLib::getMiniQrcodeLink($ids); + + }catch (\Exception $e){ + $this->error($e->getMessage()); + } + + return $url["response"]; + } + + + + + /** + * 查看微信小程序码 + * @return string + * @throws \think\Exception + * @throws \think\db\exception\BindParamException + * @throws \think\exception\DbException + * @throws \think\exception\PDOException + */ + public function lookminiqrcode($ids = ''){ + $param = $this->request->param(); + if($this->request->isPost()){ + try{ + if(isset($param['ids']))$ids = $param['ids']; + //设置模拟资格 + $url = \app\common\model\school\classes\ClassesLib::getMiniQrcodeLink($ids); + + }catch (\Exception $e){ + $this->error($e->getMessage()); + } + $this->success("生成小程序码成功",null,$url); + } + $row = $this->model->get($ids); + $this->view->assign('vo', $row); + return $this->view->fetch(); + } + + } diff --git a/application/admin/controller/school/classes/Teacher.php b/application/admin/controller/school/classes/Teacher.php index 658dd68..aa8bfd7 100644 --- a/application/admin/controller/school/classes/Teacher.php +++ b/application/admin/controller/school/classes/Teacher.php @@ -16,6 +16,7 @@ use think\exception\DbException; use think\exception\PDOException; use think\exception\ValidateException; use think\Model; +use think\Url; /** * 机构老师 @@ -24,7 +25,7 @@ use think\Model; */ class Teacher extends Backend { - + protected $noNeedLogin = ["miniqrcode"]; /** * Teacher模型对象 * @var \app\admin\model\school\classes\Teacher @@ -86,7 +87,12 @@ class Teacher extends Backend $row->getRelation('shop')->visible(['name','logo','image','address_city','province','city','district','address','address_detail']); } - $result = array("total" => $list->total(), "rows" => $list->items()); + $rows = $list->items(); + foreach ($rows as $k=>&$v){ + $v["miniqrcode_link"] = Url::build("/school/classes/teacher/miniqrcode", ["ids" => $v["id"]]); + } + + $result = array("total" => $list->total(), "rows" => $rows); return json($result); } @@ -342,4 +348,57 @@ class Teacher extends Backend } + /** + * 微信小程序码 + * @return string + * @throws \think\Exception + * @throws \think\db\exception\BindParamException + * @throws \think\exception\DbException + * @throws \think\exception\PDOException + */ + public function miniqrcode($ids = ''){ + $param = $this->request->param(); + try{ + if(isset($param['ids']))$ids = $param['ids']; + //设置模拟资格 + $url = \app\common\model\school\classes\Teacher::getMiniQrcodeLink($ids); + + }catch (\Exception $e){ + $this->error($e->getMessage()); + } + + return $url["response"]; + } + + + + + /** + * 查看微信小程序码 + * @return string + * @throws \think\Exception + * @throws \think\db\exception\BindParamException + * @throws \think\exception\DbException + * @throws \think\exception\PDOException + */ + public function lookminiqrcode($ids = ''){ + $param = $this->request->param(); + if($this->request->isPost()){ + try{ + if(isset($param['ids']))$ids = $param['ids']; + //设置模拟资格 + $url = \app\common\model\school\classes\Teacher::getMiniQrcodeLink($ids); + + }catch (\Exception $e){ + $this->error($e->getMessage()); + } + $this->success("生成小程序码成功",null,$url); + } + $row = $this->model->get($ids); + $this->view->assign('vo', $row); + return $this->view->fetch(); + } + + + } diff --git a/application/admin/controller/school/classes/activity/Activity.php b/application/admin/controller/school/classes/activity/Activity.php index 145ee84..0d27388 100644 --- a/application/admin/controller/school/classes/activity/Activity.php +++ b/application/admin/controller/school/classes/activity/Activity.php @@ -11,6 +11,7 @@ use think\Exception; use think\exception\DbException; use think\exception\PDOException; use think\exception\ValidateException; +use think\Url; /** * 课程活动 @@ -29,6 +30,7 @@ class Activity extends Backend protected $qSwitch = true; protected $qFields = ["user_id","shop_id","manystore_id"]; + protected $noNeedLogin = ["miniqrcode"]; //不用审核允许修改的字段 @@ -143,8 +145,11 @@ class Activity extends Backend $row->getRelation('manystore')->visible(['nickname']); $row->getRelation('shop')->visible(['name','logo']); } - - $result = array("total" => $list->total(), "rows" => $list->items()); + $rows = $list->items(); + foreach ($rows as $k=>&$v){ + $v["miniqrcode_link"] = Url::build("/school/classes/activity/activity/miniqrcode", ["ids" => $v["id"]]); + } + $result = array("total" => $list->total(), "rows" => $rows); return json($result); } @@ -456,4 +461,56 @@ class Activity extends Backend } + /** + * 微信小程序码 + * @return string + * @throws \think\Exception + * @throws \think\db\exception\BindParamException + * @throws \think\exception\DbException + * @throws \think\exception\PDOException + */ + public function miniqrcode($ids = ''){ + $param = $this->request->param(); + try{ + if(isset($param['ids']))$ids = $param['ids']; + //设置模拟资格 + $url = \app\common\model\school\classes\activity\Activity::getMiniQrcodeLink($ids); + + }catch (\Exception $e){ + $this->error($e->getMessage()); + } + + return $url["response"]; + } + + + + + /** + * 查看微信小程序码 + * @return string + * @throws \think\Exception + * @throws \think\db\exception\BindParamException + * @throws \think\exception\DbException + * @throws \think\exception\PDOException + */ + public function lookminiqrcode($ids = ''){ + $param = $this->request->param(); + if($this->request->isPost()){ + try{ + if(isset($param['ids']))$ids = $param['ids']; + //设置模拟资格 + $url = \app\common\model\school\classes\activity\Activity::getMiniQrcodeLink($ids); + + }catch (\Exception $e){ + $this->error($e->getMessage()); + } + $this->success("生成小程序码成功",null,$url); + } + $row = $this->model->get($ids); + $this->view->assign('vo', $row); + return $this->view->fetch(); + } + + } diff --git a/application/admin/model/Admin.php b/application/admin/model/Admin.php index b01f3df..79975f5 100644 --- a/application/admin/model/Admin.php +++ b/application/admin/model/Admin.php @@ -60,10 +60,11 @@ class Admin extends Model } public static function getHaveCity($adminId){ - $admin = self::get($adminId); - if(!$admin)throw new \Exception("管理员不存在"); - $area_json = $admin->area_json; $provinces = $citys = $districts = $address_citys = []; + $admin = self::get($adminId); + if(!$admin)return compact("provinces","citys","districts","address_citys"); + $area_json = $admin->area_json; + if($area_json){ $searchCity = SearchCity::where("id","in",$area_json)->select(); foreach ($searchCity as $item){ diff --git a/application/api/controller/Demo.php b/application/api/controller/Demo.php index 17555b3..e862836 100644 --- a/application/api/controller/Demo.php +++ b/application/api/controller/Demo.php @@ -2,8 +2,12 @@ namespace app\api\controller; +use app\admin\model\school\help\Cate; use app\common\controller\Api; use app\common\job\test\DemoJob; +use app\common\model\appointment\car\MockOrder; +use bw\UrlLock; +use think\Cache; /** * 示例接口 @@ -16,7 +20,7 @@ class Demo extends Api //如果接口已经设置无需登录,那也就无需鉴权了 // // 无需登录的接口,*表示全部 - protected $noNeedLogin = ['test', 'test1']; + protected $noNeedLogin = ['test', 'test1','test2']; // 无需鉴权的接口,*表示全部 protected $noNeedRight = ['test2']; @@ -51,6 +55,32 @@ class Demo extends Api */ public function test1() { + + try{ + + $lock = new UrlLock(1,"mock-create-lock-suffix",120,"您的请求过于频繁,请您稍后再试!请求最大锁定间隔5秒/一次!"); + $lock->lock(); + //往缓存里取出数字 + $num = cache('test'); + if(!$num){ + $num = 1; + cache('test',$num); + }else{ + $num++; + cache('test',$num); + } + //数字加1 + //再存入缓存 + //再写入test.txt文件末尾(记得回车换行) + file_put_contents("test.txt",$num."\r\n",FILE_APPEND); + + }catch (\Throwable $e){ + $lock->free(); +// file_put_contents("test.txt",$e->getMessage().$e->getFile().$e->getLine());//写入文件,一般做正式环境测试 + $this->error($e->getMessage()); + } + $lock->free(); + $this->success('返回成功', ['action' => 'test1']); } @@ -60,7 +90,20 @@ class Demo extends Api */ public function test2() { - $this->success('返回成功', ['action' => 'test2']); + try{ + + $lock = new UrlLock(1,"mock-create-lock-suffix",120,"您的请求过于频繁,请您稍后再试!请求最大锁定间隔5秒/一次!"); + $lock->lock(); + var_dump(time()); + sleep(5); + }catch (\Throwable $e){ + $lock->free(); +// file_put_contents("test.txt",$e->getMessage().$e->getFile().$e->getLine());//写入文件,一般做正式环境测试 + $this->error($e->getMessage()); + } + $lock->free(); + + $this->success('返回成功', ['action' => 'test1']); } /** diff --git a/application/api/controller/school/HourOrder.php b/application/api/controller/school/HourOrder.php index bfd8ec0..67ab88f 100644 --- a/application/api/controller/school/HourOrder.php +++ b/application/api/controller/school/HourOrder.php @@ -26,6 +26,7 @@ class HourOrder extends Base parent::_initialize(); //判断登录用户是否是员工 + $this->setUrlLock(); } diff --git a/application/api/controller/school/Order.php b/application/api/controller/school/Order.php index 5a87ee0..52cf78a 100644 --- a/application/api/controller/school/Order.php +++ b/application/api/controller/school/Order.php @@ -4,6 +4,8 @@ namespace app\api\controller\school; use app\common\model\school\classes\order\Order as OrderModel; use app\common\model\school\classes\Teacher as Teachermodel; +use bw\UrlLock; +use think\Loader; /** * 用户端:课程订单接口 @@ -25,7 +27,9 @@ class Order extends Base $this->model = new OrderModel; parent::_initialize(); - //判断登录用户是否是员工 + $this->setUrlLock(); + + } @@ -115,15 +119,21 @@ class Order extends Base if($user)$user_id = $user['id']; $order_no = $this->request->post('order_no/s', ''); //订单号 $remark = $this->request->post('remark/s', ''); //下单备注 + // repeat_filter("appointment\order\create".$user_id, 2); try{ +// $lock = new UrlLock($user_id,"class-order-create-lock-suffix",120,"您的请求过于频繁,请您稍后再试!请求最大锁定间隔120秒!"); +// $lock->lock(); + //当前申请状态 $res = $this->model->cacheCreateOrder($order_no,$user_id,$remark,true); }catch (\Throwable $e){ // file_put_contents("test.txt",$e->getMessage().$e->getFile().$e->getLine());//写入文件,一般做正式环境测试 // Log::log($e->getMessage()); +// if(isset($lock))$lock->free(); $this->error($e->getMessage(),['errcode'=>$e->getCode()]);; } +// if(isset($lock))$lock->free(); $this->success('订单创建成功,缓存key被消耗', $res); } diff --git a/application/api/controller/school/Pay.php b/application/api/controller/school/Pay.php index 25c4a62..6e3a660 100644 --- a/application/api/controller/school/Pay.php +++ b/application/api/controller/school/Pay.php @@ -28,7 +28,7 @@ class Pay extends Base $this->model = new OrderModel; parent::_initialize(); - + $this->setUrlLock(); //判断登录用户是否是员工 } diff --git a/application/api/controller/school/ServiceOrder.php b/application/api/controller/school/ServiceOrder.php index 25ce894..aa73a7a 100644 --- a/application/api/controller/school/ServiceOrder.php +++ b/application/api/controller/school/ServiceOrder.php @@ -26,6 +26,7 @@ class ServiceOrder extends Base parent::_initialize(); //判断登录用户是否是员工 + $this->setUrlLock(); } @@ -46,7 +47,7 @@ class ServiceOrder extends Base } try { - $res = OrderModel::getDetail($id); + $res = $this->model::getDetail($id); } catch (\Exception $e){ // Log::log($e->getMessage()); $this->error($e->getMessage(),['errcode'=>$e->getCode()]); diff --git a/application/api/controller/school/activity/Order.php b/application/api/controller/school/activity/Order.php index da38029..98de2e1 100644 --- a/application/api/controller/school/activity/Order.php +++ b/application/api/controller/school/activity/Order.php @@ -27,6 +27,7 @@ class Order extends Base parent::_initialize(); //判断登录用户是否是员工 + $this->setUrlLock(); } diff --git a/application/api/controller/school/activity/Pay.php b/application/api/controller/school/activity/Pay.php index d195656..fa3f567 100644 --- a/application/api/controller/school/activity/Pay.php +++ b/application/api/controller/school/activity/Pay.php @@ -29,7 +29,7 @@ class Pay extends Base $this->model = new OrderModel; parent::_initialize(); - + $this->setUrlLock(); //判断登录用户是否是员工 } diff --git a/application/api/controller/school/worker/HourOrder.php b/application/api/controller/school/worker/HourOrder.php index da6e6c2..de4b3c0 100644 --- a/application/api/controller/school/worker/HourOrder.php +++ b/application/api/controller/school/worker/HourOrder.php @@ -28,6 +28,7 @@ class HourOrder extends Base parent::_initialize(); //判断登录用户是否是员工 + $this->setUrlLock(); } diff --git a/application/api/controller/school/worker/Order.php b/application/api/controller/school/worker/Order.php index f3cd8a5..ea8f2ba 100644 --- a/application/api/controller/school/worker/Order.php +++ b/application/api/controller/school/worker/Order.php @@ -27,6 +27,7 @@ class Order extends Base parent::_initialize(); //判断登录用户是否是员工 + $this->setUrlLock(); } diff --git a/application/api/controller/school/worker/ServiceOrder.php b/application/api/controller/school/worker/ServiceOrder.php index d1edcc4..9af23cd 100644 --- a/application/api/controller/school/worker/ServiceOrder.php +++ b/application/api/controller/school/worker/ServiceOrder.php @@ -27,6 +27,7 @@ class ServiceOrder extends Base parent::_initialize(); //判断登录用户是否是员工 + $this->setUrlLock(); } @@ -47,7 +48,7 @@ class ServiceOrder extends Base } try { - $res = OrderModel::getDetail($id,$this->classes_lib_ids); + $res = $this->model::getDetail($id,$this->classes_lib_ids); if(!$res)throw new \Exception('您无操作权限!',40003); } catch (\Exception $e){ // Log::log($e->getMessage()); @@ -241,8 +242,8 @@ class ServiceOrder extends Base $status = "yes"; $reject_reason = ""; $reject_images = ""; - $model = (new \app\common\model\school\classes\order\ServiceOrder()); - $model->shopConfirmation($res["order_no"],$status,$price,$reject_reason,$reject_images,0,true,'user',$user_id,true); +// $model = (new \app\common\model\school\classes\order\ServiceOrder()); + $this->model->shopConfirmation($res["order_no"],$status,$price,$reject_reason,$reject_images,0,true,'user',$user_id,true); diff --git a/application/api/controller/school/worker/activity/Order.php b/application/api/controller/school/worker/activity/Order.php index f18d180..717fca5 100644 --- a/application/api/controller/school/worker/activity/Order.php +++ b/application/api/controller/school/worker/activity/Order.php @@ -28,6 +28,7 @@ class Order extends Base parent::_initialize(); //判断登录用户是否是员工 + $this->setUrlLock(); } diff --git a/application/common/controller/Api.php b/application/common/controller/Api.php index 3b05fbe..49b4b85 100644 --- a/application/common/controller/Api.php +++ b/application/common/controller/Api.php @@ -87,6 +87,23 @@ class Api } } + + public function setUrlLock(){ + if($this->request->isPost() && !empty($this->model)){ + $user_id = 0; + $user = $this->auth->getUser();//登录用户 + if($user)$user_id = $user['id']; + + $modulename = $this->request->module(); + $controllername = Loader::parseName($this->request->controller()); + $actionname = strtolower($this->request->action()); + $path = $modulename . '/' . str_replace('.', '/', $controllername) . '/' . $actionname; + $this->model::$url_lock_key = $user_id; + $this->model::$url_lock_suffix = $path."lock-suffix"; + $this->model::$url_lock = true; + } + } + /** * 初始化操作 * @access protected diff --git a/application/common/library/Virtual.php b/application/common/library/Virtual.php index ba05763..6ac68f9 100644 --- a/application/common/library/Virtual.php +++ b/application/common/library/Virtual.php @@ -2,6 +2,7 @@ namespace app\common\library; +use addons\epay\library\Service; use app\common\model\school\Area; use app\common\model\school\classes\VirtualHead; use app\common\model\school\classes\VirtualUser; @@ -171,5 +172,49 @@ class Virtual return $template; } + public static function getMiniQrcodeLink($key,$params=[],$expression = '{{KEYWORD}}'){ + $path = self::getPath($key,$params,$expression); + //如果路径开头有斜杠则去除 + if(substr($path,0,1) == "/"){ + $path = substr($path,1); + } + //解析该路径,获取url参数和除去参数的url + $url_params = []; + $url = ""; + if(strpos($path,"?") !== false){ + $url_params = explode("?",$path); + $url = $url_params[0]; + $url_params = $url_params[1]; + }else{ + $url = $path; + } + + + $q_params = []; + //生成小程序二维码 + $query = $url_params; + $q_params["path"] = $url; + if($query)$q_params["query"] = $query; + + // 实例对应的接口对象 + $scheme = new \WeMini\Scheme(Service::wechatConfig()); + $res= $scheme->urlLink($q_params); + if(!isset($res["url_link"]))throw new \Exception("生成小程序二维码失败"); + $url_link = $res["url_link"]; + //链接生成二维码 + //二维码 + $response = Common::getQrcode([ + 'text' => $url_link, + 'size' => 200, + ],false,false,true); + //全返回 + return compact("url_link","response"); + } + + + + + + } \ No newline at end of file diff --git a/application/common/model/dyqc/ManystoreShop.php b/application/common/model/dyqc/ManystoreShop.php index daaf4bd..0d51295 100644 --- a/application/common/model/dyqc/ManystoreShop.php +++ b/application/common/model/dyqc/ManystoreShop.php @@ -1162,5 +1162,9 @@ public function adminCreateShop($admin_id){ return Virtual::getPath("shop",["shop_id"=>$id]); } + public static function getMiniQrcodeLink($id){ + return Virtual::getMiniQrcodeLink("shop",["shop_id"=>$id]); + } + } diff --git a/application/common/model/school/classes/ClassesLib.php b/application/common/model/school/classes/ClassesLib.php index 31def7e..f551289 100644 --- a/application/common/model/school/classes/ClassesLib.php +++ b/application/common/model/school/classes/ClassesLib.php @@ -1886,6 +1886,8 @@ $user_unpaid_order = $user_paid_order =null; return Virtual::getPath("classes",["classes_id"=>$id]); } - + public static function getMiniQrcodeLink($id){ + return Virtual::getMiniQrcodeLink("classes",["classes_id"=>$id]); + } } diff --git a/application/common/model/school/classes/Teacher.php b/application/common/model/school/classes/Teacher.php index 28861ce..634db2f 100644 --- a/application/common/model/school/classes/Teacher.php +++ b/application/common/model/school/classes/Teacher.php @@ -167,4 +167,8 @@ class Teacher extends BaseModel return Virtual::getPath("teacher",["teacher_id"=>$id]); } + public static function getMiniQrcodeLink($id){ + return Virtual::getMiniQrcodeLink("teacher",["teacher_id"=>$id]); + } + } diff --git a/application/common/model/school/classes/activity/Activity.php b/application/common/model/school/classes/activity/Activity.php index 29846da..5573d60 100644 --- a/application/common/model/school/classes/activity/Activity.php +++ b/application/common/model/school/classes/activity/Activity.php @@ -1599,4 +1599,8 @@ class Activity extends BaseModel return Virtual::getPath("activity",["activity_id"=>$id]); } + public static function getMiniQrcodeLink($id){ + return Virtual::getMiniQrcodeLink("activity",["activity_id"=>$id]); + } + } diff --git a/application/manystore/controller/general/Profile.php b/application/manystore/controller/general/Profile.php index 68b7fdd..a35a4e4 100644 --- a/application/manystore/controller/general/Profile.php +++ b/application/manystore/controller/general/Profile.php @@ -8,6 +8,7 @@ use app\common\controller\ManystoreBase; use fast\Random; use think\Exception; use think\Session; +use think\Url; use think\Validate; /** @@ -17,7 +18,7 @@ use think\Validate; */ class Profile extends ManystoreBase { - + protected $noNeedLogin = ["miniqrcode"]; /** * 查看 */ @@ -33,6 +34,7 @@ class Profile extends ManystoreBase $this->view->assign('check_full_msg',(new \app\common\model\dyqc\ManystoreShop)->checkFullMsg(SHOP_ID)); $this->getCity(); + $this->view->assign('miniqrcode_link',Url::build("/manystore/general/profile/miniqrcode", ["ids" => SHOP_ID])); return $this->view->fetch(); } @@ -72,9 +74,7 @@ class Profile extends ManystoreBase Session::set("manystore", $manystore->toArray()); - //调用事件 - $data = ['shop' => $manystore]; - \think\Hook::listen('shop_update_after', $data); + $this->success(); } $this->error(); @@ -92,9 +92,64 @@ class Profile extends ManystoreBase $shopModel = new ManystoreShop(); $shopModel->save($shop,array('id'=>SHOP_ID)); + //调用事件 + $data = ['shop' => $shopModel]; + \think\Hook::listen('shop_update_after', $data); $this->success(); } $this->error(); } + + + /** + * 微信小程序码 + * @return string + * @throws \think\Exception + * @throws \think\db\exception\BindParamException + * @throws \think\exception\DbException + * @throws \think\exception\PDOException + */ + public function miniqrcode($ids = ''){ + $param = $this->request->param(); + try{ + if(isset($param['ids']))$ids = $param['ids']; + //设置模拟资格 + $url = \app\common\model\dyqc\ManystoreShop::getMiniQrcodeLink($ids); + + }catch (\Exception $e){ + $this->error($e->getMessage()); + } + + return $url["response"]; + } + + + + + /** + * 查看微信小程序码 + * @return string + * @throws \think\Exception + * @throws \think\db\exception\BindParamException + * @throws \think\exception\DbException + * @throws \think\exception\PDOException + */ + public function lookminiqrcode($ids = ''){ + $param = $this->request->param(); + if($this->request->isPost()){ + try{ + if(isset($param['ids']))$ids = $param['ids']; + //设置模拟资格 + $url = \app\common\model\dyqc\ManystoreShop::getMiniQrcodeLink($ids); + + }catch (\Exception $e){ + $this->error($e->getMessage()); + } + $this->success("生成小程序码成功",null,$url); + } + $row = $this->model->get($ids); + $this->view->assign('vo', $row); + return $this->view->fetch(); + } } diff --git a/application/manystore/controller/school/classes/ClassesLib.php b/application/manystore/controller/school/classes/ClassesLib.php index 4a8726f..dd37c2c 100644 --- a/application/manystore/controller/school/classes/ClassesLib.php +++ b/application/manystore/controller/school/classes/ClassesLib.php @@ -15,6 +15,7 @@ use think\Exception; use think\exception\DbException; use think\exception\PDOException; use think\exception\ValidateException; +use think\Url; /** * 机构课程库 @@ -23,7 +24,7 @@ use think\exception\ValidateException; */ class ClassesLib extends ManystoreBase { - + protected $noNeedLogin = ["miniqrcode"]; protected $qSwitch = true; protected $qFields = ["teacher_id","user_id","shop_id","manystore_id"]; /** @@ -146,6 +147,7 @@ class ClassesLib extends ManystoreBase foreach ($rows as $k=>&$v){ $v["classes_type_name"] = $types[$v["classes_type"]] ?? "无" ; + $v["miniqrcode_link"] = Url::build("/manystore/school/classes/classes_lib/miniqrcode", ["ids" => $v["id"]]); } $result = array("total" => $list->total(), "rows" => $rows); @@ -649,4 +651,57 @@ class ClassesLib extends ManystoreBase } + + /** + * 微信小程序码 + * @return string + * @throws \think\Exception + * @throws \think\db\exception\BindParamException + * @throws \think\exception\DbException + * @throws \think\exception\PDOException + */ + public function miniqrcode($ids = ''){ + $param = $this->request->param(); + try{ + if(isset($param['ids']))$ids = $param['ids']; + //设置模拟资格 + $url = \app\common\model\school\classes\ClassesLib::getMiniQrcodeLink($ids); + + }catch (\Exception $e){ + $this->error($e->getMessage()); + } + + return $url["response"]; + } + + + + + /** + * 查看微信小程序码 + * @return string + * @throws \think\Exception + * @throws \think\db\exception\BindParamException + * @throws \think\exception\DbException + * @throws \think\exception\PDOException + */ + public function lookminiqrcode($ids = ''){ + $param = $this->request->param(); + if($this->request->isPost()){ + try{ + if(isset($param['ids']))$ids = $param['ids']; + //设置模拟资格 + $url = \app\common\model\school\classes\ClassesLib::getMiniQrcodeLink($ids); + + }catch (\Exception $e){ + $this->error($e->getMessage()); + } + $this->success("生成小程序码成功",null,$url); + } + $row = $this->model->get($ids); + $this->view->assign('vo', $row); + return $this->view->fetch(); + } + + } diff --git a/application/manystore/controller/school/classes/Teacher.php b/application/manystore/controller/school/classes/Teacher.php index 6e75745..806f3c7 100644 --- a/application/manystore/controller/school/classes/Teacher.php +++ b/application/manystore/controller/school/classes/Teacher.php @@ -10,6 +10,7 @@ use think\Db; use think\Exception; use think\exception\PDOException; use think\exception\ValidateException; +use think\Url; /** * 机构老师 @@ -18,7 +19,7 @@ use think\exception\ValidateException; */ class Teacher extends ManystoreBase { - + protected $noNeedLogin = ["miniqrcode"]; /** * Teacher模型对象 * @var \app\manystore\model\school\classes\Teacher @@ -78,7 +79,12 @@ class Teacher extends ManystoreBase $row->getRelation('manystoreshop')->visible(['name','image','address_city','province','city','district','address','address_detail']); } - $result = array("total" => $list->total(), "rows" => $list->items()); + $rows = $list->items(); + foreach ($rows as $k=>&$v){ + $v["miniqrcode_link"] = Url::build("/manystore/school/classes/teacher/miniqrcode", ["ids" => $v["id"]]); + } + + $result = array("total" => $list->total(), "rows" => $rows); return json($result); } @@ -310,4 +316,57 @@ class Teacher extends ManystoreBase $this->error(__('Parameter %s can not be empty', 'ids')); } + + + /** + * 微信小程序码 + * @return string + * @throws \think\Exception + * @throws \think\db\exception\BindParamException + * @throws \think\exception\DbException + * @throws \think\exception\PDOException + */ + public function miniqrcode($ids = ''){ + $param = $this->request->param(); + try{ + if(isset($param['ids']))$ids = $param['ids']; + //设置模拟资格 + $url = \app\common\model\school\classes\Teacher::getMiniQrcodeLink($ids); + + }catch (\Exception $e){ + $this->error($e->getMessage()); + } + + return $url["response"]; + } + + + + + /** + * 查看微信小程序码 + * @return string + * @throws \think\Exception + * @throws \think\db\exception\BindParamException + * @throws \think\exception\DbException + * @throws \think\exception\PDOException + */ + public function lookminiqrcode($ids = ''){ + $param = $this->request->param(); + if($this->request->isPost()){ + try{ + if(isset($param['ids']))$ids = $param['ids']; + //设置模拟资格 + $url = \app\common\model\school\classes\Teacher::getMiniQrcodeLink($ids); + + }catch (\Exception $e){ + $this->error($e->getMessage()); + } + $this->success("生成小程序码成功",null,$url); + } + $row = $this->model->get($ids); + $this->view->assign('vo', $row); + return $this->view->fetch(); + } + } diff --git a/application/manystore/controller/school/classes/activity/Activity.php b/application/manystore/controller/school/classes/activity/Activity.php index 5acdf38..c0e3807 100644 --- a/application/manystore/controller/school/classes/activity/Activity.php +++ b/application/manystore/controller/school/classes/activity/Activity.php @@ -11,6 +11,7 @@ use think\Db; use think\Exception; use think\exception\PDOException; use think\exception\ValidateException; +use think\Url; /** * 课程活动 @@ -31,7 +32,7 @@ class Activity extends ManystoreBase protected $qFields = ["user_id","shop_id","manystore_id"]; //不用审核允许修改的字段 protected $no_auth_fields = ['headimage','images',"status"]; - + protected $noNeedLogin = ["miniqrcode"]; protected $need_auth = true; public function _initialize() @@ -146,7 +147,12 @@ class Activity extends ManystoreBase $row->getRelation('manystoreshop')->visible(['name','logo']); } - $result = array("total" => $list->total(), "rows" => $list->items()); + $rows = $list->items(); + foreach ($rows as $k=>&$v){ + $v["miniqrcode_link"] = Url::build("/manystore/school/classes/activity/activity/miniqrcode", ["ids" => $v["id"]]); + } + + $result = array("total" => $list->total(), "rows" => $rows); return json($result); } @@ -457,4 +463,58 @@ class Activity extends ManystoreBase $this->error(__('Parameter %s can not be empty', 'ids')); } + /** + * 微信小程序码 + * @return string + * @throws \think\Exception + * @throws \think\db\exception\BindParamException + * @throws \think\exception\DbException + * @throws \think\exception\PDOException + */ + public function miniqrcode($ids = ''){ + $param = $this->request->param(); + try{ + if(isset($param['ids']))$ids = $param['ids']; + //设置模拟资格 + $url = \app\common\model\school\classes\activity\Activity::getMiniQrcodeLink($ids); + + }catch (\Exception $e){ + $this->error($e->getMessage()); + } + + return $url["response"]; + } + + + + + /** + * 查看微信小程序码 + * @return string + * @throws \think\Exception + * @throws \think\db\exception\BindParamException + * @throws \think\exception\DbException + * @throws \think\exception\PDOException + */ + public function lookminiqrcode($ids = ''){ + $param = $this->request->param(); + if($this->request->isPost()){ + try{ + if(isset($param['ids']))$ids = $param['ids']; + //设置模拟资格 + $url = \app\common\model\school\classes\activity\Activity::getMiniQrcodeLink($ids); + + }catch (\Exception $e){ + $this->error($e->getMessage()); + } + $this->success("生成小程序码成功",null,$url); + } + $row = $this->model->get($ids); + $this->view->assign('vo', $row); + return $this->view->fetch(); + } + + + + } diff --git a/application/manystore/view/general/profile/index.html b/application/manystore/view/general/profile/index.html index db0c695..fa683a9 100644 --- a/application/manystore/view/general/profile/index.html +++ b/application/manystore/view/general/profile/index.html @@ -105,6 +105,15 @@ {:token()}
+
+ + + + +
+

微信小程序端展示效果

+ +

打开微信扫一扫,扫码即可在手机端查看




{$check_full_msg} diff --git a/extend/bw/Common.php b/extend/bw/Common.php index 38a2e60..bb046fd 100644 --- a/extend/bw/Common.php +++ b/extend/bw/Common.php @@ -26,6 +26,7 @@ use app\common\model\Attachment; use addons\xftts\library\Tts; use addons\xftts\library\WebSocket\Client; use addons\xftts\library\WebSocket\Exception; +use think\Response; use traits\CacheTrait; /** 商城工具类 @@ -414,7 +415,10 @@ class Common * @throws \Endroid\QrCode\Exception\InvalidPathException * @throws \app\common\exception\UploadException */ - public static function getQrcode($params,$stream = false,$cache = true){ + public static function getQrcode($params,$stream = false,$cache = true,$response = false){ + if($response){ + return self::getQRcodeResponse($params); + } $qrCode = \addons\qrcode\library\Service::qrcode($params); if($stream)return $qrCode; // 写入到文件 @@ -1106,5 +1110,38 @@ class Common return $xftts; } + /** 生成并直接返回二维码http响应而不存储 + * @param $text + * @param $label + * @param $params + * @return Response|\think\response\Json|\think\response\Jsonp|\think\response\Redirect|\think\response\View|\think\response\Xml + * @throws \Endroid\QrCode\Exception\InvalidPathException + */ + public static function getQRcodeResponse($params=[]){ + + $params = array_intersect_key($params, array_flip(['text', 'size', 'padding', 'errorlevel', 'foreground', 'background', 'logo', 'logosize', 'logopath', 'label', 'labelfontsize', 'labelalignment'])); + +// $params['text'] = $text; +// $params['label'] = $label; + + $qrCode = \addons\qrcode\library\Service::qrcode($params); + + $mimetype = 'image/png'; + + $response = Response::create()->header("Content-Type", $mimetype); + + // 直接显示二维码 + header('Content-Type: ' . $qrCode->getContentType()); + + // 设置缓存过期时间(例如,30天) + $expiresTime = strtotime('+30 days'); + header('Expires: ' . gmdate('D, d M Y H:i:s', $expiresTime) . ' GMT'); + header('Cache-Control: max-age=' . (30 * 24 * 60 * 60)); + + + $response->content($qrCode->writeString()); + return $response; + } + } \ No newline at end of file diff --git a/extend/traits/CacheTrait.php b/extend/traits/CacheTrait.php index 79f48e9..e5f83f2 100644 --- a/extend/traits/CacheTrait.php +++ b/extend/traits/CacheTrait.php @@ -77,8 +77,10 @@ trait CacheTrait $redis = $this->getRedis(); $hashKey = $key.$suffix; // $redis->del($hashKey); +// var_dump($hashKey);die; //判断锁是否存在,如果存在,返回错误 - if ($redis->EXISTS($hashKey)){ + if ($redis->exists($hashKey)){ +// var_dump(111111222);die; if($this->cache_lock_thorws_excption){ throw new \Exception($this->cache_lock_error_msg); }else{ @@ -87,7 +89,9 @@ trait CacheTrait } //如果不存在创建锁并返回 - $redis->set($hashKey, 1,$timeout); +// $redis->set($hashKey, 1,$timeout);//注释掉 + //替换成原子操作的命令 + $redis->set($hashKey, 1,['nx', 'ex' => $timeout]); return true; } diff --git a/extend/traits/ModelTrait.php b/extend/traits/ModelTrait.php index bf1bafc..9abf71f 100644 --- a/extend/traits/ModelTrait.php +++ b/extend/traits/ModelTrait.php @@ -12,11 +12,25 @@ trait ModelTrait { protected $withTable = []; + + public static $url_enpity = null; + public static $url_lock = false; + public static $url_lock_key = ""; + public static $url_lock_suffix = "test-lock-suffix"; + + public static $url_lock_timeout = 120; + + public static $url_error_msg = "您的请求过于频繁,请您稍后再试!"; + /** * 开启事务 */ public static function beginTrans() { + if (self::$url_lock) { + self::$url_enpity = new \bw\UrlLock(self::$url_lock_key, self::$url_lock_suffix, self::$url_lock_timeout, self::$url_error_msg); + self::$url_enpity->lock(); + } Db::startTrans(); } @@ -25,6 +39,7 @@ trait ModelTrait */ public static function commitTrans() { + if(self::$url_enpity)self::$url_enpity->free(); Db::commit(); } @@ -33,6 +48,7 @@ trait ModelTrait */ public static function rollbackTrans() { + if(self::$url_enpity)self::$url_enpity->free(); Db::rollback(); } diff --git a/public/assets/js/backend/manystore/index.js b/public/assets/js/backend/manystore/index.js index faf6d09..fe0036f 100644 --- a/public/assets/js/backend/manystore/index.js +++ b/public/assets/js/backend/manystore/index.js @@ -10,6 +10,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin edit_url: 'manystore/index/edit' + location.search, del_url: 'manystore/index/del', url_url: 'manystore/index/url', + lookminiqrcode_url: 'manystore/index/lookminiqrcode', + miniqrcode_url: 'manystore/index/miniqrcode', + free_url: 'manystore/index/free', multi_url: 'manystore/index/multi', } @@ -22,7 +25,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', fixedColumns: true, - fixedRightNumber: 1, + fixedRightNumber: 2, columns: [ [ {checkbox: true}, @@ -81,7 +84,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin {field: 'logintime', title: __('Login time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true}, - + {field: 'miniqrcode_link', title: __('微信小程序端展示'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, {field: 'operate', title: __('Operate'),width:180, table: table , buttons: [ {name: 'url', text: '查看小程序链接', diff --git a/public/assets/js/backend/school/classes/activity/activity.js b/public/assets/js/backend/school/classes/activity/activity.js index b871a5e..af86bf8 100644 --- a/public/assets/js/backend/school/classes/activity/activity.js +++ b/public/assets/js/backend/school/classes/activity/activity.js @@ -10,6 +10,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin edit_url: 'school/classes/activity/activity/edit'+ location.search, del_url: 'school/classes/activity/activity/del', url_url: 'school/classes/activity/activity/url', + + lookminiqrcode_url: 'school/classes/activity/activity/lookminiqrcode', + miniqrcode_url: 'school/classes/activity/activity/miniqrcode', + + multi_url: 'school/classes/activity/activity/multi', import_url: 'school/classes/activity/activity/import', table: 'school_classes_activity', @@ -24,7 +29,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin pk: 'id', sortName: 'weigh', fixedColumns: true, - fixedRightNumber: 1, + fixedRightNumber: 2, columns: [ [ {checkbox: true}, @@ -77,7 +82,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin {field: 'shop.name', title: __('Shop.name'), operate: 'LIKE'}, {field: 'shop.logo', title: __('Shop.logo'), operate: 'LIKE'}, - + {field: 'miniqrcode_link', title: __('微信小程序端展示'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, {field: 'operate', title: __('Operate'), table: table , buttons: [ {name: 'url', diff --git a/public/assets/js/backend/school/classes/classes_lib.js b/public/assets/js/backend/school/classes/classes_lib.js index 1ba6841..3c9d6f8 100644 --- a/public/assets/js/backend/school/classes/classes_lib.js +++ b/public/assets/js/backend/school/classes/classes_lib.js @@ -11,6 +11,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin edit_url: 'school/classes/classes_lib/edit'+ location.search, copy_url: 'school/classes/classes_lib/copy'+ location.search, url_url: 'school/classes/classes_lib/url', + + lookminiqrcode_url: 'school/classes/classes_lib/lookminiqrcode', + miniqrcode_url: 'school/classes/classes_lib/miniqrcode', + del_url: 'school/classes/classes_lib/del', multi_url: 'school/classes/classes_lib/multi', import_url: 'school/classes/classes_lib/import', @@ -26,7 +30,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin pk: 'id', sortName: 'weigh', fixedColumns: true, - fixedRightNumber: 1, + fixedRightNumber: 2, columns: [ [ @@ -124,7 +128,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin {field: 'user.avatar', title: __('User.avatar'),visible:false, operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image}, {field: 'admin.nickname', title: __('Admin.nickname'),visible:false, operate: 'LIKE'}, - + {field: 'miniqrcode_link', title: __('微信小程序端展示'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, {field: 'operate', title: __('Operate'), table: table , buttons: [ {name: 'url', text: '查看小程序链接', diff --git a/public/assets/js/backend/school/classes/teacher.js b/public/assets/js/backend/school/classes/teacher.js index b626512..8cb9847 100644 --- a/public/assets/js/backend/school/classes/teacher.js +++ b/public/assets/js/backend/school/classes/teacher.js @@ -12,6 +12,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin multi_url: 'school/classes/teacher/multi', import_url: 'school/classes/teacher/import', url_url: 'school/classes/teacher/url', + + lookminiqrcode_url: 'school/classes/teacher/lookminiqrcode', + miniqrcode_url: 'school/classes/teacher/miniqrcode', + table: 'school_teacher', } }); @@ -24,7 +28,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin pk: 'id', sortName: 'weigh', fixedColumns: true, - fixedRightNumber: 1, + fixedRightNumber: 2, columns: [ [ {checkbox: true}, @@ -63,7 +67,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin {field: 'shop.district', title: __('Shop.district')}, {field: 'shop.address', title: __('Shop.address'), operate: 'LIKE'}, {field: 'shop.address_detail', title: __('Shop.address_detail'), operate: 'LIKE'}, - + {field: 'miniqrcode_link', title: __('微信小程序端展示'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, {field: 'operate', title: __('Operate'), table: table , buttons: [ {name: 'url', text: '查看小程序链接', diff --git a/public/assets/js/manystore/school/classes/activity/activity.js b/public/assets/js/manystore/school/classes/activity/activity.js index 1d44f78..d581948 100644 --- a/public/assets/js/manystore/school/classes/activity/activity.js +++ b/public/assets/js/manystore/school/classes/activity/activity.js @@ -8,6 +8,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin index_url: 'school/classes/activity/activity/index' + location.search, add_url: 'school/classes/activity/activity_auth/add'+ location.search, edit_url: 'school/classes/activity/activity/edit' + location.search, + + + lookminiqrcode_url: 'school/classes/activity/activity/lookminiqrcode', + miniqrcode_url: 'school/classes/activity/activity/miniqrcode', del_url: 'school/classes/activity/activity/del', multi_url: 'school/classes/activity/activity/multi', import_url: 'school/classes/activity/activity/import', @@ -23,7 +27,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin pk: 'id', sortName: 'weigh', fixedColumns: true, - fixedRightNumber: 1, + fixedRightNumber: 2, columns: [ [ {checkbox: true}, @@ -77,7 +81,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin {field: 'manystore.nickname', title: __('Manystore.nickname'), operate: 'LIKE'}, {field: 'manystoreshop.name', title: __('Manystoreshop.name'), operate: 'LIKE'}, {field: 'manystoreshop.logo', title: __('Manystoreshop.logo'), operate: 'LIKE'}, - + {field: 'miniqrcode_link', title: __('微信小程序端展示'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, {field: 'operate', title: __('Operate'), table: table , buttons: [ { diff --git a/public/assets/js/manystore/school/classes/classes_lib.js b/public/assets/js/manystore/school/classes/classes_lib.js index 12ec019..ba28db4 100644 --- a/public/assets/js/manystore/school/classes/classes_lib.js +++ b/public/assets/js/manystore/school/classes/classes_lib.js @@ -10,6 +10,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin addnew_url: 'school/classes/classes_lib/addnew'+ location.search, edit_url: 'school/classes/classes_lib/edit'+ location.search, copy_url: 'school/classes/classes_lib/copy'+ location.search, + + lookminiqrcode_url: 'school/classes/classes_lib/lookminiqrcode', + miniqrcode_url: 'school/classes/classes_lib/miniqrcode', + + del_url: 'school/classes/classes_lib/del', multi_url: 'school/classes/classes_lib/multi', import_url: 'school/classes/classes_lib/import', @@ -25,7 +30,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin pk: 'id', sortName: 'weigh', fixedColumns: true, - fixedRightNumber: 1, + fixedRightNumber: 2, columns: [ [ {checkbox: true}, @@ -131,8 +136,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin {field: 'user.avatar', title: __('User.avatar'),visible:false, operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image}, {field: 'admin.nickname', title: __('Admin.nickname'),visible:false, operate: 'LIKE'}, - - + {field: 'miniqrcode_link', title: __('微信小程序端展示'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, {field: 'operate', title: __('Operate'), table: table , buttons: [ { name: 'classes_spec', diff --git a/public/assets/js/manystore/school/classes/teacher.js b/public/assets/js/manystore/school/classes/teacher.js index cbdec02..db50456 100644 --- a/public/assets/js/manystore/school/classes/teacher.js +++ b/public/assets/js/manystore/school/classes/teacher.js @@ -11,6 +11,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin del_url: 'school/classes/teacher/del', multi_url: 'school/classes/teacher/multi', import_url: 'school/classes/teacher/import', + + lookminiqrcode_url: 'school/classes/teacher/lookminiqrcode', + miniqrcode_url: 'school/classes/teacher/miniqrcode', + table: 'school_teacher', } }); @@ -23,7 +27,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin pk: 'id', sortName: 'weigh', fixedColumns: true, - fixedRightNumber: 1, + fixedRightNumber: 2, columns: [ [ @@ -63,7 +67,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin // {field: 'manystoreshop.address', title: __('Manystoreshop.address'), operate: 'LIKE'}, // {field: 'manystoreshop.address_detail', title: __('Manystoreshop.address_detail'), operate: 'LIKE'}, // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} - + {field: 'miniqrcode_link', title: __('微信小程序端展示'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, {field: 'operate', title: __('Operate'), table: table , buttons: [ { name: 'classes',